i need to go

TODO:
- EDIT LATCH
- EDIT MASK
This commit is contained in:
tildearrow 2022-03-09 18:03:15 -05:00
parent b80b33ac8e
commit 93b3e16213
3 changed files with 122 additions and 65 deletions

View file

@ -2861,7 +2861,7 @@ void FurnaceGUI::doCopy(bool cut) {
} }
} }
void FurnaceGUI::doPaste() { void FurnaceGUI::doPaste(PasteMode mode) {
finishSelection(); finishSelection();
prepareUndo(GUI_UNDO_PATTERN_PASTE); prepareUndo(GUI_UNDO_PATTERN_PASTE);
char* clipText=SDL_GetClipboardText(); 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() #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; i<e->song.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() { bool FurnaceGUI::loop() {
while (!quit) { while (!quit) {
SDL_Event ev; SDL_Event ev;
@ -5028,16 +5121,7 @@ bool FurnaceGUI::loop() {
if (ImGui::MenuItem("undo",BIND_FOR(GUI_ACTION_UNDO))) doUndo(); if (ImGui::MenuItem("undo",BIND_FOR(GUI_ACTION_UNDO))) doUndo();
if (ImGui::MenuItem("redo",BIND_FOR(GUI_ACTION_REDO))) doRedo(); if (ImGui::MenuItem("redo",BIND_FOR(GUI_ACTION_REDO))) doRedo();
ImGui::Separator(); ImGui::Separator();
if (ImGui::MenuItem("cut",BIND_FOR(GUI_ACTION_PAT_CUT))) doCopy(true); editOptions(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);
/*ImGui::Separator(); /*ImGui::Separator();
ImGui::MenuItem("clear...");*/ ImGui::MenuItem("clear...");*/
ImGui::EndMenu(); ImGui::EndMenu();

View file

@ -233,6 +233,10 @@ enum FurnaceGUIActions {
GUI_ACTION_PAT_CUT, GUI_ACTION_PAT_CUT,
GUI_ACTION_PAT_COPY, GUI_ACTION_PAT_COPY,
GUI_ACTION_PAT_PASTE, 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_UP,
GUI_ACTION_PAT_CURSOR_DOWN, GUI_ACTION_PAT_CURSOR_DOWN,
GUI_ACTION_PAT_CURSOR_LEFT, GUI_ACTION_PAT_CURSOR_LEFT,
@ -268,6 +272,18 @@ enum FurnaceGUIActions {
GUI_ACTION_PAT_COLLAPSE, GUI_ACTION_PAT_COLLAPSE,
GUI_ACTION_PAT_INCREASE_COLUMNS, GUI_ACTION_PAT_INCREASE_COLUMNS,
GUI_ACTION_PAT_DECREASE_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_PAT_MAX,
GUI_ACTION_INS_LIST_MIN, GUI_ACTION_INS_LIST_MIN,
@ -334,6 +350,14 @@ enum FurnaceGUIActions {
GUI_ACTION_MAX 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_CTRL (1<<31)
#define FURKMOD_SHIFT (1<<29) #define FURKMOD_SHIFT (1<<29)
#define FURKMOD_META (1<<28) #define FURKMOD_META (1<<28)
@ -720,9 +744,10 @@ class FurnaceGUI {
void doInsert(); void doInsert();
void doTranspose(int amount); void doTranspose(int amount);
void doCopy(bool cut); void doCopy(bool cut);
void doPaste(); void doPaste(PasteMode mode=GUI_PASTE_MODE_NORMAL);
void doUndo(); void doUndo();
void doRedo(); void doRedo();
void editOptions(bool topMenu);
void play(int row=0); void play(int row=0);
void stop(); void stop();

View file

@ -813,59 +813,7 @@ void FurnaceGUI::drawPattern() {
if (patternOpen) { if (patternOpen) {
if (!inhibitMenu && ImGui::IsItemClicked(ImGuiMouseButton_Right)) ImGui::OpenPopup("patternActionMenu"); if (!inhibitMenu && ImGui::IsItemClicked(ImGuiMouseButton_Right)) ImGui::OpenPopup("patternActionMenu");
if (ImGui::BeginPopup("patternActionMenu",ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings)) { if (ImGui::BeginPopup("patternActionMenu",ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings)) {
char id[4096]; editOptions(false);
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; i<e->song.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");
ImGui::EndPopup(); ImGui::EndPopup();
} }
} }