From bd77bd0a81e2d8d1a530a962043c5bf3e08f7b40 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 5 Nov 2022 16:22:15 -0500 Subject: [PATCH] GUI: some improvements - mobile UI work - highlight channel at cursor in orders --- src/gui/dataList.cpp | 4 ++-- src/gui/gui.cpp | 4 ++++ src/gui/gui.h | 2 ++ src/gui/orders.cpp | 7 ++++++- src/gui/pattern.cpp | 4 ++-- src/gui/settings.cpp | 8 ++++++++ 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/gui/dataList.cpp b/src/gui/dataList.cpp index f45028ff1..8a62c822f 100644 --- a/src/gui/dataList.cpp +++ b/src/gui/dataList.cpp @@ -410,7 +410,7 @@ void FurnaceGUI::drawInsList(bool asChild) { curIns=i; wavePreviewInit=true; } - if (ImGui::IsItemHovered() && i>=0) { + if (ImGui::IsItemHovered() && i>=0 && !mobileUI) { ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_TEXT]); ImGui::SetTooltip("%s",insType); ImGui::PopStyleColor(); @@ -679,7 +679,7 @@ void FurnaceGUI::actualSampleList() { updateSampleTex=true; } if (wantScrollList && curSample==i) ImGui::SetScrollHereY(); - if (ImGui::IsItemHovered()) { + if (ImGui::IsItemHovered() && !mobileUI) { ImGui::SetTooltip("Bank %d: %s",i/12,sampleNote[i%12]); if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) { sampleEditOpen=true; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index e1e2654d1..62bd1bdc1 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -3896,8 +3896,12 @@ bool FurnaceGUI::loop() { if (fileDialog->isError()) { #if defined(_WIN32) || defined(__APPLE__) showError("there was an error in the file dialog! you may want to report this issue to:\nhttps://github.com/tildearrow/furnace/issues\ncheck the Log Viewer (window > log viewer) for more information.\n\nfor now please disable the system file picker in Settings > General."); +#else +#ifdef ANDROID + showError("can't do anything without Storage permissions!"); #else showError("Zenity/KDialog not available!\nplease install one of these, or disable the system file picker in Settings > General."); +#endif #endif } if (fileDialog->accepted()) { diff --git a/src/gui/gui.h b/src/gui/gui.h index 30a97a684..9afafc0ea 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1212,6 +1212,7 @@ class FurnaceGUI { int midiOutMode; int maxRecentFile; int centerPattern; + int ordersCursor; unsigned int maxUndoSteps; String mainFontPath; String patFontPath; @@ -1338,6 +1339,7 @@ class FurnaceGUI { midiOutMode(1), maxRecentFile(10), centerPattern(0), + ordersCursor(1), maxUndoSteps(100), mainFontPath(""), patFontPath(""), diff --git a/src/gui/orders.cpp b/src/gui/orders.cpp index a82dcc25f..5f822078f 100644 --- a/src/gui/orders.cpp +++ b/src/gui/orders.cpp @@ -102,7 +102,7 @@ void FurnaceGUI::drawOrders() { //} ImGui::PushStyleColor(ImGuiCol_Text,(curOrder==i || e->curOrders->ord[j][i]==e->curOrders->ord[j][curOrder])?uiColors[GUI_COLOR_ORDER_SIMILAR]:uiColors[GUI_COLOR_ORDER_INACTIVE]); - if (ImGui::Selectable(selID,(orderEditMode!=0 && curOrder==i && orderCursor==j))) { + if (ImGui::Selectable(selID,settings.ordersCursor?(cursor.xCoarse==j && oldOrder1!=i):false)) { if (curOrder==i) { if (orderEditMode==0) { prepareUndo(GUI_UNDO_CHANGE_ORDER); @@ -135,6 +135,11 @@ void FurnaceGUI::drawOrders() { } } ImGui::PopStyleColor(); + if (orderEditMode!=0 && curOrder==i && orderCursor==j) { + // draw a border + ImDrawList* dl=ImGui::GetWindowDrawList(); + dl->AddRect(ImGui::GetItemRectMin(),ImGui::GetItemRectMax(),ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),2.0f*dpiScale); + } if (!pat->name.empty() && ImGui::IsItemHovered()) { ImGui::SetTooltip("%s",pat->name.c_str()); } diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index 00e9b5106..dbfee3026 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -437,7 +437,7 @@ void FurnaceGUI::drawPattern() { if (ImGui::Selectable((extraChannelButtons==2)?" --##ExtraChannelButtons":" ++##ExtraChannelButtons",false,ImGuiSelectableFlags_NoPadWithHalfSpacing,ImVec2(0.0f,lineHeight+1.0f*dpiScale))) { if (++extraChannelButtons>2) extraChannelButtons=0; } - if (ImGui::IsItemHovered()) { + if (ImGui::IsItemHovered() && !mobileUI) { if (extraChannelButtons==2) { ImGui::SetTooltip("Pattern names (click to collapse)\nRight-click for visualizer"); } else if (extraChannelButtons==1) { @@ -706,7 +706,7 @@ void FurnaceGUI::drawPattern() { if (extraChannelButtons==0 || settings.channelVolStyle!=0) ImGui::PopStyleVar(); - if (displayTooltip && ImGui::IsItemHovered()) { + if (displayTooltip && ImGui::IsItemHovered() && !mobileUI) { ImGui::SetTooltip("%s",e->getChannelName(i)); } if (settings.channelFont==0) ImGui::PopFont(); diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index a5f8c4fc5..138443025 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -1460,6 +1460,11 @@ void FurnaceGUI::drawSettings() { settings.sysSeparators=sysSeparatorsB; }*/ + bool ordersCursorB=settings.ordersCursor; + if (ImGui::Checkbox("Highlight channel at cursor in Orders",&ordersCursorB)) { + settings.ordersCursor=ordersCursorB; + } + bool partyTimeB=settings.partyTime; if (ImGui::Checkbox("About screen party time",&partyTimeB)) { settings.partyTime=partyTimeB; @@ -2371,6 +2376,7 @@ void FurnaceGUI::syncSettings() { settings.midiOutClock=e->getConfInt("midiOutClock",0); settings.midiOutMode=e->getConfInt("midiOutMode",1); settings.centerPattern=e->getConfInt("centerPattern",0); + settings.ordersCursor=e->getConfInt("ordersCursor",1); clampSetting(settings.mainFontSize,2,96); clampSetting(settings.patFontSize,2,96); @@ -2475,6 +2481,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.midiOutClock,0,1); clampSetting(settings.midiOutMode,0,2); clampSetting(settings.centerPattern,0,1); + clampSetting(settings.ordersCursor,0,1); String initialSys2=e->getConfString("initialSys2",""); if (initialSys2.empty()) { @@ -2640,6 +2647,7 @@ void FurnaceGUI::commitSettings() { e->setConf("midiOutClock",settings.midiOutClock); e->setConf("midiOutMode",settings.midiOutMode); e->setConf("centerPattern",settings.centerPattern); + e->setConf("ordersCursor",settings.ordersCursor); // colors for (int i=0; i