diff --git a/src/gui/editControls.cpp b/src/gui/editControls.cpp index 6bfde0107..a7582ff38 100644 --- a/src/gui/editControls.cpp +++ b/src/gui/editControls.cpp @@ -212,7 +212,7 @@ void FurnaceGUI::drawMobileControls() { ImGui::Separator(); - ImGui::Text("Song info here..."); + drawSongInfo(true); break; } case GUI_SCENE_CHANNELS: diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 9cce27f20..ebd7dafa0 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -3774,6 +3774,7 @@ bool FurnaceGUI::loop() { curWindow=GUI_WINDOW_PATTERN; drawPattern(); drawPiano(); + drawMobileOrderSel(); break; } diff --git a/src/gui/gui.h b/src/gui/gui.h index a371789f7..23da50710 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1730,8 +1730,9 @@ class FurnaceGUI { void popToggleColors(); void drawMobileControls(); + void drawMobileOrderSel(); void drawEditControls(); - void drawSongInfo(); + void drawSongInfo(bool asChild=false); void drawOrders(); void drawPattern(); void drawInsList(bool asChild=false); diff --git a/src/gui/orders.cpp b/src/gui/orders.cpp index 5f822078f..73fcb9147 100644 --- a/src/gui/orders.cpp +++ b/src/gui/orders.cpp @@ -18,8 +18,45 @@ */ #include "gui.h" +#include #include "IconsFontAwesome4.h" -#include +#include "imgui_internal.h" + +void FurnaceGUI::drawMobileOrderSel() { + if (!portrait) return; + + ImGui::SetNextWindowPos(ImVec2(0.0f,mobileMenuPos*-0.65*canvasH)); + ImGui::SetNextWindowSize(ImVec2(canvasW,0.12*canvasW)); + if (ImGui::Begin("OrderSel",NULL,globalWinFlags)) { + ImDrawList* dl=ImGui::GetWindowDrawList(); + ImGuiWindow* window=ImGui::GetCurrentWindow(); + ImGuiStyle& style=ImGui::GetStyle(); + + ImVec2 size=ImGui::GetContentRegionAvail(); + + ImVec2 minArea=window->DC.CursorPos; + ImVec2 maxArea=ImVec2( + minArea.x+size.x, + minArea.y+size.y + ); + ImRect rect=ImRect(minArea,maxArea); + ImGui::ItemSize(size,style.FramePadding.y); + ImU32 col=ImGui::GetColorU32(ImGuiCol_Text); + if (ImGui::ItemAdd(rect,ImGui::GetID("OrderSelW"))) { + String text=fmt::sprintf("%.2X",curOrder); + + ImVec2 pos=ImLerp(minArea,maxArea,ImVec2(0.5,0.0)); + ImGui::PushFont(bigFont); + ImVec2 textSize=ImGui::CalcTextSize(text.c_str()); + ImGui::PopFont(); + + pos.x-=textSize.x*0.5*(size.y/textSize.y); + + dl->AddText(bigFont,size.y,pos,col,text.c_str()); + } + } + ImGui::End(); +} void FurnaceGUI::drawOrders() { static char selID[4096]; diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index ec158d650..483d66b53 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -376,8 +376,8 @@ void FurnaceGUI::drawPattern() { } ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0.0f,0.0f)); if (mobileUI) { - patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*canvasH)):ImVec2((0.16*canvasH)+0.5*canvasW*mobileMenuPos,0.0f)); - patWindowSize=(portrait?ImVec2(canvasW,canvasH-(0.16*canvasW)-(pianoOpen?(0.4*canvasW):0.0f)):ImVec2(canvasW-(0.16*canvasH),canvasH-(pianoOpen?(0.3*canvasH):0.0f))); + patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*canvasH)+(0.12*canvasW)):ImVec2((0.16*canvasH)+0.5*canvasW*mobileMenuPos,0.0f)); + patWindowSize=(portrait?ImVec2(canvasW,canvasH-(0.16*canvasW)-(0.12*canvasW)-(pianoOpen?(0.4*canvasW):0.0f)):ImVec2(canvasW-(0.16*canvasH),canvasH-(pianoOpen?(0.3*canvasH):0.0f))); ImGui::SetNextWindowPos(patWindowPos); ImGui::SetNextWindowSize(patWindowSize); } diff --git a/src/gui/piano.cpp b/src/gui/piano.cpp index b135114f8..98e83f351 100644 --- a/src/gui/piano.cpp +++ b/src/gui/piano.cpp @@ -158,7 +158,7 @@ void FurnaceGUI::drawPiano() { } ImGui::TableNextColumn(); - if (pianoInputPadMode==1 && cursor.xFine>0) { + if (pianoInputPadMode==1 && cursor.xFine>0 && curWindow==GUI_WINDOW_PATTERN) { ImVec2 buttonSize=ImGui::GetContentRegionAvail(); if (ImGui::BeginTable("InputPadP",8,ImGuiTableFlags_SizingFixedSame)) { ImGui::TableNextRow(); @@ -430,7 +430,7 @@ void FurnaceGUI::drawPiano() { ImGui::End(); // draw input pad if necessary - if ((pianoInputPadMode==2 && cursor.xFine>0) || pianoInputPadMode==3) { + if (curWindow==GUI_WINDOW_PATTERN && ((pianoInputPadMode==2 && cursor.xFine>0) || pianoInputPadMode==3)) { if (ImGui::Begin("Input Pad",NULL,ImGuiWindowFlags_NoTitleBar)) { ImGui::BeginDisabled(cursor.xFine==0); if (ImGui::BeginTable("InputPad",3,ImGuiTableFlags_Borders)) { diff --git a/src/gui/songInfo.cpp b/src/gui/songInfo.cpp index 24ed67c0b..151991871 100644 --- a/src/gui/songInfo.cpp +++ b/src/gui/songInfo.cpp @@ -22,14 +22,15 @@ #include "misc/cpp/imgui_stdlib.h" #include "intConst.h" -void FurnaceGUI::drawSongInfo() { +void FurnaceGUI::drawSongInfo(bool asChild) { if (nextWindow==GUI_WINDOW_SONG_INFO) { songInfoOpen=true; ImGui::SetNextWindowFocus(); nextWindow=GUI_WINDOW_NOTHING; } - if (!songInfoOpen) return; - if (ImGui::Begin("Song Information",&songInfoOpen,globalWinFlags)) { + if (!songInfoOpen && !asChild) return; + bool began=asChild?ImGui::BeginChild("Song Information"):ImGui::Begin("Song Information",&songInfoOpen,globalWinFlags); + if (began) { if (ImGui::BeginTable("NameAuthor",2,ImGuiTableFlags_SizingStretchProp)) { ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed,0.0); ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,0.0); @@ -240,6 +241,10 @@ void FurnaceGUI::drawSongInfo() { ImGui::EndTable(); } } - if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_SONG_INFO; - ImGui::End(); + if (!asChild && ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_SONG_INFO; + if (asChild) { + ImGui::EndChild(); + } else { + ImGui::End(); + } }