diff --git a/src/gui/editControls.cpp b/src/gui/editControls.cpp index 9c8f0ad4..671ca63b 100644 --- a/src/gui/editControls.cpp +++ b/src/gui/editControls.cpp @@ -19,6 +19,7 @@ #include "gui.h" #include "IconsFontAwesome4.h" +#include void FurnaceGUI::drawMobileControls() { if (ImGui::Begin("Mobile Controls",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) { @@ -81,27 +82,40 @@ void FurnaceGUI::drawEditControls() { switch (settings.controlLayout) { case 0: // classic if (ImGui::Begin("Play/Edit Controls",&editControlsOpen,globalWinFlags)) { - ImGui::Text("Octave"); - ImGui::SameLine(); - if (ImGui::InputInt("##Octave",&curOctave,1,1)) { - if (curOctave>7) curOctave=7; - if (curOctave<-5) curOctave=-5; - e->autoNoteOffAll(); + if (ImGui::BeginTable("PlayEditAlign",2)) { + ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch); - if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { - nextWindow=GUI_WINDOW_PATTERN; + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("Octave"); + ImGui::TableNextColumn(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::InputInt("##Octave",&curOctave,1,1)) { + if (curOctave>7) curOctave=7; + if (curOctave<-5) curOctave=-5; + e->autoNoteOffAll(); + + if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { + nextWindow=GUI_WINDOW_PATTERN; + } } - } - ImGui::Text("Edit Step"); - ImGui::SameLine(); - if (ImGui::InputInt("##EditStep",&editStep,1,1)) { - if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1; - if (editStep<0) editStep=0; + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("Edit Step"); + ImGui::TableNextColumn(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (ImGui::InputInt("##EditStep",&editStep,1,1)) { + if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1; + if (editStep<0) editStep=0; - if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { - nextWindow=GUI_WINDOW_PATTERN; + if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { + nextWindow=GUI_WINDOW_PATTERN; + } } + + ImGui::EndTable(); } ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(e->isPlaying())); @@ -219,35 +233,36 @@ void FurnaceGUI::drawEditControls() { break; case 2: // compact vertical if (ImGui::Begin("Play/Edit Controls",&editControlsOpen,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) { + ImVec2 buttonSize=ImVec2(ImGui::GetContentRegionAvail().x,0.0f); ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(e->isPlaying())); - if (ImGui::Button(ICON_FA_PLAY "##Play")) { + if (ImGui::Button(ICON_FA_PLAY "##Play",buttonSize)) { play(); } ImGui::PopStyleColor(); - if (ImGui::Button(ICON_FA_STOP "##Stop")) { + if (ImGui::Button(ICON_FA_STOP "##Stop",buttonSize)) { stop(); } - if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) { + if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne",buttonSize)) { e->stepOne(cursor.y); pendingStepUpdate=true; } bool repeatPattern=e->getRepeatPattern(); ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(repeatPattern)); - if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern")) { + if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern",buttonSize)) { e->setRepeatPattern(!repeatPattern); } ImGui::PopStyleColor(); ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(edit)); - if (ImGui::Button(ICON_FA_CIRCLE "##Edit")) { + if (ImGui::Button(ICON_FA_CIRCLE "##Edit",buttonSize)) { edit=!edit; } ImGui::PopStyleColor(); bool metro=e->getMetronome(); ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(metro)); - if (ImGui::Button(ICON_FA_BELL_O "##Metronome")) { + if (ImGui::Button(ICON_FA_BELL_O "##Metronome",buttonSize)) { e->setMetronome(!metro); } ImGui::PopStyleColor(); @@ -278,12 +293,12 @@ void FurnaceGUI::drawEditControls() { ImGui::Text("Foll."); ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(followOrders)); - if (ImGui::SmallButton("Ord##FollowOrders")) { handleUnimportant + if (ImGui::Button("Ord##FollowOrders",buttonSize)) { handleUnimportant followOrders=!followOrders; } ImGui::PopStyleColor(); ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(followPattern)); - if (ImGui::SmallButton("Pat##FollowPattern")) { handleUnimportant + if (ImGui::Button("Pat##FollowPattern",buttonSize)) { handleUnimportant followPattern=!followPattern; } ImGui::PopStyleColor();