From 2fb6ea021b7cca10018c878be672106ccde72385 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 9 Mar 2022 15:43:30 -0500 Subject: [PATCH 1/3] GUI: this menu is packed with features that DON'T WORK YET --- src/gui/gui.cpp | 5 +++++ src/gui/gui.h | 2 ++ src/gui/pattern.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 25d662d0..7317385b 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -6135,6 +6135,11 @@ FurnaceGUI::FurnaceGUI(): bindSetPending(false), nextScroll(-1.0f), nextAddScroll(0.0f), + transposeAmount(0), + randomizeMin(0), + randomizeMax(255), + scaleMin(0.0f), + scaleMax(100.0f), oldOrdersLen(0) { // octave 1 diff --git a/src/gui/gui.h b/src/gui/gui.h index 7d7f6b4a..e64fe4a0 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -650,6 +650,8 @@ class FurnaceGUI { ImVec2 threeChars, twoChars; SelectionPoint sel1, sel2; int dummyRows, demandX; + int transposeAmount, randomizeMin, randomizeMax; + float scaleMin, scaleMax; int oldOrdersLen; DivOrders oldOrders; diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index 9bf6eee5..2b3f2d6a 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -817,6 +817,24 @@ void FurnaceGUI::drawPattern() { ImGui::Selectable("cut"); ImGui::Selectable("copy"); ImGui::Selectable("paste"); + if (ImGui::BeginMenu("paste special...")) { + ImGui::Selectable("paste mix"); + ImGui::Selectable("paste mix (background)"); + ImGui::Selectable("paste flood"); + ImGui::Selectable("paste overflow"); + ImGui::EndMenu(); + } + ImGui::Selectable("delete"); + ImGui::Separator(); + + ImGui::InputInt("##TransposeAmount",&transposeAmount,1,1); + ImGui::SameLine(); + ImGui::Button("Transpose"); + + ImGui::Separator(); + ImGui::Selectable("interpolate"); + ImGui::Selectable("fade in"); + ImGui::Selectable("fade out"); if (ImGui::BeginMenu("change instrument...")) { if (e->song.ins.empty()) { ImGui::Text("no instruments available"); @@ -828,6 +846,26 @@ void FurnaceGUI::drawPattern() { } ImGui::EndMenu(); } + if (ImGui::BeginMenu("scale...")) { + ImGui::InputFloat("Bottom",&scaleMin,1,1); + ImGui::InputFloat("Top",&scaleMax,1,1); + ImGui::Button("Scale"); + ImGui::EndMenu(); + } + if (ImGui::BeginMenu("randomize...")) { + ImGui::InputInt("Minimum",&randomizeMin,1,1); + ImGui::InputInt("Maximum",&randomizeMax,1,1); + ImGui::Button("Randomize"); + ImGui::EndMenu(); + } + ImGui::Selectable("invert values"); + + ImGui::SameLine(); + + ImGui::Selectable("flip selection"); + ImGui::Selectable("collapse"); + ImGui::Selectable("expand"); + ImGui::EndPopup(); } } From b80b33ac8e46a4b345f047e262ff9a8fd85ff574 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 9 Mar 2022 16:42:15 -0500 Subject: [PATCH 2/3] GUI: demand scroll X in more situations --- src/gui/gui.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 7317385b..a2cd182c 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -2479,6 +2479,7 @@ void FurnaceGUI::moveCursorPrevChannel(bool overflow) { selStart=cursor; selEnd=cursor; + demandScrollX=true; } void FurnaceGUI::moveCursorNextChannel(bool overflow) { @@ -2501,6 +2502,7 @@ void FurnaceGUI::moveCursorNextChannel(bool overflow) { selStart=cursor; selEnd=cursor; + demandScrollX=true; } void FurnaceGUI::moveCursorTop(bool select) { @@ -2510,6 +2512,7 @@ void FurnaceGUI::moveCursorTop(bool select) { DETERMINE_FIRST; cursor.xCoarse=firstChannel; cursor.xFine=0; + demandScrollX=true; } else { cursor.y=0; } @@ -2527,6 +2530,7 @@ void FurnaceGUI::moveCursorBottom(bool select) { DETERMINE_LAST; cursor.xCoarse=lastChannel-1; cursor.xFine=2+e->song.pat[cursor.xCoarse].effectRows*2; + demandScrollX=true; } else { cursor.y=e->song.patLen-1; } From 93b3e1621396c4238c09d72cdaaf70fcb0ff5c2d Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 9 Mar 2022 18:03:15 -0500 Subject: [PATCH 3/3] i need to go TODO: - EDIT LATCH - EDIT MASK --- src/gui/gui.cpp | 106 +++++++++++++++++++++++++++++++++++++++----- src/gui/gui.h | 27 ++++++++++- src/gui/pattern.cpp | 54 +--------------------- 3 files changed, 122 insertions(+), 65 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index a2cd182c..a1fad153 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -2861,7 +2861,7 @@ void FurnaceGUI::doCopy(bool cut) { } } -void FurnaceGUI::doPaste() { +void FurnaceGUI::doPaste(PasteMode mode) { finishSelection(); prepareUndo(GUI_UNDO_PATTERN_PASTE); char* clipText=SDL_GetClipboardText(); @@ -4394,6 +4394,99 @@ void FurnaceGUI::processDrags(int dragX, int dragY) { #define BIND_FOR(x) getKeyName(actionKeys[x],true).c_str() +void FurnaceGUI::editOptions(bool topMenu) { + char id[4096]; + if (ImGui::MenuItem("cut",BIND_FOR(GUI_ACTION_PAT_CUT))) doCopy(true); + if (ImGui::MenuItem("copy",BIND_FOR(GUI_ACTION_PAT_COPY))) doCopy(false); + if (ImGui::MenuItem("paste",BIND_FOR(GUI_ACTION_PAT_PASTE))) doPaste(); + if (ImGui::BeginMenu("paste special...")) { + ImGui::MenuItem("paste mix",BIND_FOR(GUI_ACTION_PAT_PASTE_MIX)); + ImGui::MenuItem("paste mix (background)",BIND_FOR(GUI_ACTION_PAT_PASTE_MIX_BG)); + ImGui::MenuItem("paste flood",BIND_FOR(GUI_ACTION_PAT_PASTE_FLOOD)); + ImGui::MenuItem("paste overflow",BIND_FOR(GUI_ACTION_PAT_PASTE_OVERFLOW)); + ImGui::EndMenu(); + } + if (ImGui::MenuItem("delete",BIND_FOR(GUI_ACTION_PAT_DELETE))) doDelete(); + if (topMenu) { + if (ImGui::MenuItem("select all",BIND_FOR(GUI_ACTION_PAT_SELECT_ALL))) doSelectAll(); + } + ImGui::Separator(); + + if (ImGui::MenuItem("set latch",BIND_FOR(GUI_ACTION_PAT_LATCH))) { + // TODO + } + ImGui::Separator(); + + if (ImGui::MenuItem("note up",BIND_FOR(GUI_ACTION_PAT_NOTE_UP))) doTranspose(1); + if (ImGui::MenuItem("note down",BIND_FOR(GUI_ACTION_PAT_NOTE_DOWN))) doTranspose(-1); + if (ImGui::MenuItem("octave up",BIND_FOR(GUI_ACTION_PAT_OCTAVE_UP))) doTranspose(12); + if (ImGui::MenuItem("octave down",BIND_FOR(GUI_ACTION_PAT_OCTAVE_DOWN))) doTranspose(-12); + if (ImGui::InputInt("##TransposeAmount",&transposeAmount,1,1)) { + if (transposeAmount<-96) transposeAmount=-96; + if (transposeAmount>96) transposeAmount=96; + } + ImGui::SameLine(); + if (ImGui::Button("Transpose")) { + doTranspose(transposeAmount); + ImGui::CloseCurrentPopup(); + } + + ImGui::Separator(); + ImGui::MenuItem("interpolate",BIND_FOR(GUI_ACTION_PAT_INTERPOLATE)); + ImGui::MenuItem("fade in",BIND_FOR(GUI_ACTION_PAT_FADE_IN)); + ImGui::MenuItem("fade out",BIND_FOR(GUI_ACTION_PAT_FADE_OUT)); + if (ImGui::BeginMenu("change instrument...")) { + if (e->song.ins.empty()) { + ImGui::Text("no instruments available"); + } + for (size_t i=0; isong.ins.size(); i++) { + snprintf(id,4095,"%.2X: %s",(int)i,e->song.ins[i]->name.c_str()); + if (ImGui::MenuItem(id)) { // TODO + } + } + ImGui::EndMenu(); + } + if (ImGui::BeginMenu("scale...")) { + if (ImGui::InputFloat("Bottom",&scaleMin,1,1,"%.1f%%")) { + if (scaleMin<0.0f) scaleMin=0.0f; + if (scaleMin>100.0f) scaleMin=100.0f; + } + if (ImGui::InputFloat("Top",&scaleMax,1,1,"%.1f%%")) { + if (scaleMax<0.0f) scaleMax=0.0f; + if (scaleMax>100.0f) scaleMax=100.0f; + } + if (ImGui::Button("Scale")) { + ImGui::CloseCurrentPopup(); + } + ImGui::EndMenu(); + } + if (ImGui::BeginMenu("randomize...")) { + ImGui::InputInt("Minimum",&randomizeMin,1,1); + ImGui::InputInt("Maximum",&randomizeMax,1,1); + if (ImGui::Button("Randomize")) { + ImGui::CloseCurrentPopup(); + } + ImGui::EndMenu(); + } + ImGui::MenuItem("invert values",BIND_FOR(GUI_ACTION_PAT_INVERT_VALUES)); + + ImGui::Separator(); + + ImGui::MenuItem("flip selection",BIND_FOR(GUI_ACTION_PAT_FLIP_SELECTION)); + ImGui::MenuItem("collapse",BIND_FOR(GUI_ACTION_PAT_COLLAPSE_ROWS)); + ImGui::MenuItem("expand",BIND_FOR(GUI_ACTION_PAT_EXPAND_ROWS)); + + if (topMenu) { + ImGui::Separator(); + ImGui::MenuItem("collapse pattern",BIND_FOR(GUI_ACTION_PAT_COLLAPSE_PAT)); + ImGui::MenuItem("expand pattern",BIND_FOR(GUI_ACTION_PAT_EXPAND_PAT)); + + ImGui::Separator(); + ImGui::MenuItem("collapse song",BIND_FOR(GUI_ACTION_PAT_COLLAPSE_SONG)); + ImGui::MenuItem("expand song",BIND_FOR(GUI_ACTION_PAT_EXPAND_SONG)); + } +} + bool FurnaceGUI::loop() { while (!quit) { SDL_Event ev; @@ -5028,16 +5121,7 @@ bool FurnaceGUI::loop() { if (ImGui::MenuItem("undo",BIND_FOR(GUI_ACTION_UNDO))) doUndo(); if (ImGui::MenuItem("redo",BIND_FOR(GUI_ACTION_REDO))) doRedo(); ImGui::Separator(); - if (ImGui::MenuItem("cut",BIND_FOR(GUI_ACTION_PAT_CUT))) doCopy(true); - if (ImGui::MenuItem("copy",BIND_FOR(GUI_ACTION_PAT_COPY))) doCopy(false); - if (ImGui::MenuItem("paste",BIND_FOR(GUI_ACTION_PAT_PASTE))) doPaste(); - if (ImGui::MenuItem("delete",BIND_FOR(GUI_ACTION_PAT_DELETE))) doDelete(); - if (ImGui::MenuItem("select all",BIND_FOR(GUI_ACTION_PAT_SELECT_ALL))) doSelectAll(); - ImGui::Separator(); - if (ImGui::MenuItem("note up",BIND_FOR(GUI_ACTION_PAT_NOTE_UP))) doTranspose(1); - if (ImGui::MenuItem("note down",BIND_FOR(GUI_ACTION_PAT_NOTE_DOWN))) doTranspose(-1); - if (ImGui::MenuItem("octave up",BIND_FOR(GUI_ACTION_PAT_OCTAVE_UP))) doTranspose(12); - if (ImGui::MenuItem("octave down",BIND_FOR(GUI_ACTION_PAT_OCTAVE_DOWN))) doTranspose(-12); + editOptions(true); /*ImGui::Separator(); ImGui::MenuItem("clear...");*/ ImGui::EndMenu(); diff --git a/src/gui/gui.h b/src/gui/gui.h index e64fe4a0..1ce74f3e 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -233,6 +233,10 @@ enum FurnaceGUIActions { GUI_ACTION_PAT_CUT, GUI_ACTION_PAT_COPY, GUI_ACTION_PAT_PASTE, + GUI_ACTION_PAT_PASTE_MIX, + GUI_ACTION_PAT_PASTE_MIX_BG, + GUI_ACTION_PAT_PASTE_FLOOD, + GUI_ACTION_PAT_PASTE_OVERFLOW, GUI_ACTION_PAT_CURSOR_UP, GUI_ACTION_PAT_CURSOR_DOWN, GUI_ACTION_PAT_CURSOR_LEFT, @@ -268,6 +272,18 @@ enum FurnaceGUIActions { GUI_ACTION_PAT_COLLAPSE, GUI_ACTION_PAT_INCREASE_COLUMNS, GUI_ACTION_PAT_DECREASE_COLUMNS, + GUI_ACTION_PAT_INTERPOLATE, + GUI_ACTION_PAT_FADE_IN, + GUI_ACTION_PAT_FADE_OUT, + GUI_ACTION_PAT_INVERT_VALUES, + GUI_ACTION_PAT_FLIP_SELECTION, + GUI_ACTION_PAT_COLLAPSE_ROWS, + GUI_ACTION_PAT_EXPAND_ROWS, + GUI_ACTION_PAT_COLLAPSE_PAT, + GUI_ACTION_PAT_EXPAND_PAT, + GUI_ACTION_PAT_COLLAPSE_SONG, + GUI_ACTION_PAT_EXPAND_SONG, + GUI_ACTION_PAT_LATCH, GUI_ACTION_PAT_MAX, GUI_ACTION_INS_LIST_MIN, @@ -334,6 +350,14 @@ enum FurnaceGUIActions { GUI_ACTION_MAX }; +enum PasteMode { + GUI_PASTE_MODE_NORMAL=0, + GUI_PASTE_MODE_MIX_FG, + GUI_PASTE_MODE_MIX_BG, + GUI_PASTE_MODE_FLOOD, + GUI_PASTE_MODE_OVERFLOW +}; + #define FURKMOD_CTRL (1<<31) #define FURKMOD_SHIFT (1<<29) #define FURKMOD_META (1<<28) @@ -720,9 +744,10 @@ class FurnaceGUI { void doInsert(); void doTranspose(int amount); void doCopy(bool cut); - void doPaste(); + void doPaste(PasteMode mode=GUI_PASTE_MODE_NORMAL); void doUndo(); void doRedo(); + void editOptions(bool topMenu); void play(int row=0); void stop(); diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index 2b3f2d6a..b2ff56ce 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -813,59 +813,7 @@ void FurnaceGUI::drawPattern() { if (patternOpen) { if (!inhibitMenu && ImGui::IsItemClicked(ImGuiMouseButton_Right)) ImGui::OpenPopup("patternActionMenu"); if (ImGui::BeginPopup("patternActionMenu",ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings)) { - char id[4096]; - ImGui::Selectable("cut"); - ImGui::Selectable("copy"); - ImGui::Selectable("paste"); - if (ImGui::BeginMenu("paste special...")) { - ImGui::Selectable("paste mix"); - ImGui::Selectable("paste mix (background)"); - ImGui::Selectable("paste flood"); - ImGui::Selectable("paste overflow"); - ImGui::EndMenu(); - } - ImGui::Selectable("delete"); - ImGui::Separator(); - - ImGui::InputInt("##TransposeAmount",&transposeAmount,1,1); - ImGui::SameLine(); - ImGui::Button("Transpose"); - - ImGui::Separator(); - ImGui::Selectable("interpolate"); - ImGui::Selectable("fade in"); - ImGui::Selectable("fade out"); - if (ImGui::BeginMenu("change instrument...")) { - if (e->song.ins.empty()) { - ImGui::Text("no instruments available"); - } - for (size_t i=0; isong.ins.size(); i++) { - snprintf(id,4095,"%.2X: %s",(int)i,e->song.ins[i]->name.c_str()); - if (ImGui::Selectable(id)) { // TODO - } - } - ImGui::EndMenu(); - } - if (ImGui::BeginMenu("scale...")) { - ImGui::InputFloat("Bottom",&scaleMin,1,1); - ImGui::InputFloat("Top",&scaleMax,1,1); - ImGui::Button("Scale"); - ImGui::EndMenu(); - } - if (ImGui::BeginMenu("randomize...")) { - ImGui::InputInt("Minimum",&randomizeMin,1,1); - ImGui::InputInt("Maximum",&randomizeMax,1,1); - ImGui::Button("Randomize"); - ImGui::EndMenu(); - } - ImGui::Selectable("invert values"); - - ImGui::SameLine(); - - ImGui::Selectable("flip selection"); - ImGui::Selectable("collapse"); - ImGui::Selectable("expand"); - + editOptions(false); ImGui::EndPopup(); } }