GUI: add option to center pattern - INCOMPLETE

if you right click on the left area it doesn't work
This commit is contained in:
tildearrow 2022-10-03 19:22:24 -05:00
parent c63ff7320e
commit 70e0b4ab52
4 changed files with 20 additions and 0 deletions

View file

@ -403,6 +403,12 @@ void FurnaceGUI::drawPattern() {
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_SELECTION_HOVER]);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_SELECTION_ACTIVE]);
if (settings.centerPattern) {
float centerOff=(ImGui::GetContentRegionAvail().x-lastPatternWidth)*0.5;
if (centerOff>0.0f) {
ImGui::SetCursorPosX(ImGui::GetCursorPosX()+centerOff);
}
}
if (ImGui::BeginTable("PatternView",displayChans+2,ImGuiTableFlags_BordersInnerV|ImGuiTableFlags_ScrollX|ImGuiTableFlags_ScrollY|ImGuiTableFlags_NoPadInnerX|ImGuiTableFlags_NoBordersInFrozenArea)) {
ImGui::TableSetupColumn("pos",ImGuiTableColumnFlags_WidthFixed);
char chanID[2048];
@ -427,6 +433,7 @@ void FurnaceGUI::drawPattern() {
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
float lpwStart=ImGui::GetCursorPosX();
if (ImGui::Selectable((extraChannelButtons==2)?" --##ExtraChannelButtons":" ++##ExtraChannelButtons",false,ImGuiSelectableFlags_NoPadWithHalfSpacing,ImVec2(0.0f,lineHeight+1.0f*dpiScale))) {
if (++extraChannelButtons>2) extraChannelButtons=0;
}
@ -839,6 +846,7 @@ void FurnaceGUI::drawPattern() {
}
}
ImGui::TableNextColumn();
lastPatternWidth=ImGui::GetCursorPosX()-lpwStart+ImGui::GetStyle().ScrollbarSize;
if (e->hasExtValue()) {
ImGui::TextColored(uiColors[GUI_COLOR_EE_VALUE]," %.2X",e->getExtValue());
}