GUI: major usability improvement coming

click on orders in click-to-edit or select instrument=auto-focus pattern
This commit is contained in:
tildearrow 2022-03-05 02:13:15 -05:00
parent e07caddc92
commit 23431323e2
4 changed files with 75 additions and 18 deletions

View file

@ -623,6 +623,10 @@ void FurnaceGUI::drawEditControls() {
e->noteOff(activeNotes[i].chan); e->noteOff(activeNotes[i].chan);
} }
activeNotes.clear(); activeNotes.clear();
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
} }
ImGui::Text("Edit Step"); ImGui::Text("Edit Step");
@ -630,6 +634,10 @@ void FurnaceGUI::drawEditControls() {
if (ImGui::InputInt("##EditStep",&editStep,1,1)) { if (ImGui::InputInt("##EditStep",&editStep,1,1)) {
if (editStep>=e->song.patLen) editStep=e->song.patLen-1; if (editStep>=e->song.patLen) editStep=e->song.patLen-1;
if (editStep<0) editStep=0; if (editStep<0) editStep=0;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
} }
if (ImGui::Button(ICON_FA_PLAY "##Play")) { if (ImGui::Button(ICON_FA_PLAY "##Play")) {
@ -649,9 +657,9 @@ void FurnaceGUI::drawEditControls() {
ImGui::Text("Follow"); ImGui::Text("Follow");
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox("Orders",&followOrders); unimportant(ImGui::Checkbox("Orders",&followOrders));
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox("Pattern",&followPattern); unimportant(ImGui::Checkbox("Pattern",&followPattern));
bool repeatPattern=e->getRepeatPattern(); bool repeatPattern=e->getRepeatPattern();
if (ImGui::Checkbox("Repeat pattern",&repeatPattern)) { if (ImGui::Checkbox("Repeat pattern",&repeatPattern)) {
@ -713,6 +721,10 @@ void FurnaceGUI::drawEditControls() {
e->noteOff(activeNotes[i].chan); e->noteOff(activeNotes[i].chan);
} }
activeNotes.clear(); activeNotes.clear();
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
} }
ImGui::SameLine(); ImGui::SameLine();
@ -722,14 +734,18 @@ void FurnaceGUI::drawEditControls() {
if (ImGui::InputInt("##EditStep",&editStep,1,1)) { if (ImGui::InputInt("##EditStep",&editStep,1,1)) {
if (editStep>=e->song.patLen) editStep=e->song.patLen-1; if (editStep>=e->song.patLen) editStep=e->song.patLen-1;
if (editStep<0) editStep=0; if (editStep<0) editStep=0;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text("Follow"); ImGui::Text("Follow");
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox("Orders",&followOrders); unimportant(ImGui::Checkbox("Orders",&followOrders));
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox("Pattern",&followPattern); unimportant(ImGui::Checkbox("Pattern",&followPattern));
} }
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS; if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
ImGui::End(); ImGui::End();
@ -776,6 +792,10 @@ void FurnaceGUI::drawEditControls() {
e->noteOff(activeNotes[i].chan); e->noteOff(activeNotes[i].chan);
} }
activeNotes.clear(); activeNotes.clear();
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
} }
ImGui::Text("Step"); ImGui::Text("Step");
@ -783,16 +803,20 @@ void FurnaceGUI::drawEditControls() {
if (ImGui::InputInt("##EditStep",&editStep,0,0)) { if (ImGui::InputInt("##EditStep",&editStep,0,0)) {
if (editStep>=e->song.patLen) editStep=e->song.patLen-1; if (editStep>=e->song.patLen) editStep=e->song.patLen-1;
if (editStep<0) editStep=0; if (editStep<0) editStep=0;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
} }
ImGui::Text("Foll."); ImGui::Text("Foll.");
ImGui::PushStyleColor(ImGuiCol_Button,ImVec4(0.2f,(followOrders)?0.6f:0.2f,0.2f,1.0f)); ImGui::PushStyleColor(ImGuiCol_Button,ImVec4(0.2f,(followOrders)?0.6f:0.2f,0.2f,1.0f));
if (ImGui::SmallButton("Ord##FollowOrders")) { if (ImGui::SmallButton("Ord##FollowOrders")) { handleUnimportant
followOrders=!followOrders; followOrders=!followOrders;
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::PushStyleColor(ImGuiCol_Button,ImVec4(0.2f,(followPattern)?0.6f:0.2f,0.2f,1.0f)); ImGui::PushStyleColor(ImGuiCol_Button,ImVec4(0.2f,(followPattern)?0.6f:0.2f,0.2f,1.0f));
if (ImGui::SmallButton("Pat##FollowPattern")) { if (ImGui::SmallButton("Pat##FollowPattern")) { handleUnimportant
followPattern=!followPattern; followPattern=!followPattern;
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor();
@ -860,6 +884,10 @@ void FurnaceGUI::drawEditControls() {
e->noteOff(activeNotes[i].chan); e->noteOff(activeNotes[i].chan);
} }
activeNotes.clear(); activeNotes.clear();
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
} }
ImGui::Text("Step"); ImGui::Text("Step");
@ -869,11 +897,15 @@ void FurnaceGUI::drawEditControls() {
if (ImGui::InputInt("##EditStep",&editStep,1,1)) { if (ImGui::InputInt("##EditStep",&editStep,1,1)) {
if (editStep>=e->song.patLen) editStep=e->song.patLen-1; if (editStep>=e->song.patLen) editStep=e->song.patLen-1;
if (editStep<0) editStep=0; if (editStep<0) editStep=0;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
} }
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Checkbox("Follow orders",&followOrders); unimportant(ImGui::Checkbox("Follow orders",&followOrders));
ImGui::Checkbox("Follow pattern",&followPattern); unimportant(ImGui::Checkbox("Follow pattern",&followPattern));
} }
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS; if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
ImGui::End(); ImGui::End();
@ -1169,10 +1201,15 @@ void FurnaceGUI::drawInsList() {
if (ImGui::Selectable(name.c_str(),curIns==i)) { if (ImGui::Selectable(name.c_str(),curIns==i)) {
curIns=i; curIns=i;
} }
if (settings.insFocusesPattern && patternOpen && ImGui::IsItemActivated()) {
nextWindow=GUI_WINDOW_PATTERN;
curIns=i;
}
ImGui::PopStyleColor(); ImGui::PopStyleColor();
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) { if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
insEditOpen=true; insEditOpen=true;
nextWindow=GUI_WINDOW_INS_EDIT;
} }
} }
} }
@ -5094,6 +5131,7 @@ bool FurnaceGUI::loop() {
ImGui::DockSpaceOverViewport(); ImGui::DockSpaceOverViewport();
drawPattern();
drawEditControls(); drawEditControls();
drawSongInfo(); drawSongInfo();
drawOrders(); drawOrders();
@ -5106,7 +5144,6 @@ bool FurnaceGUI::loop() {
drawMixer(); drawMixer();
drawOsc(); drawOsc();
drawVolMeter(); drawVolMeter();
drawPattern();
drawSettings(); drawSettings();
drawDebug(); drawDebug();
drawStats(); drawStats();

View file

@ -29,6 +29,9 @@
#define rightClickable if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) ImGui::SetKeyboardFocusHere(-1); #define rightClickable if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) ImGui::SetKeyboardFocusHere(-1);
#define handleUnimportant if (settings.insFocusesPattern && patternOpen) {nextWindow=GUI_WINDOW_PATTERN;}
#define unimportant(x) if (x) {handleUnimportant}
enum FurnaceGUIColors { enum FurnaceGUIColors {
GUI_COLOR_BACKGROUND=0, GUI_COLOR_BACKGROUND=0,
GUI_COLOR_FRAME_BACKGROUND, GUI_COLOR_FRAME_BACKGROUND,
@ -495,6 +498,7 @@ class FurnaceGUI {
int viewPrevPattern; int viewPrevPattern;
int guiColorsBase; int guiColorsBase;
int avoidRaisingPattern; int avoidRaisingPattern;
int insFocusesPattern;
unsigned int maxUndoSteps; unsigned int maxUndoSteps;
String mainFontPath; String mainFontPath;
String patFontPath; String patFontPath;
@ -537,6 +541,7 @@ class FurnaceGUI {
viewPrevPattern(1), viewPrevPattern(1),
guiColorsBase(0), guiColorsBase(0),
avoidRaisingPattern(0), avoidRaisingPattern(0),
insFocusesPattern(1),
maxUndoSteps(100), maxUndoSteps(100),
mainFontPath(""), mainFontPath(""),
patFontPath(""), patFontPath(""),

View file

@ -75,6 +75,10 @@ void FurnaceGUI::drawOrders() {
e->setOrder(i); e->setOrder(i);
curNibble=false; curNibble=false;
orderCursor=-1; orderCursor=-1;
if (orderEditMode==0) {
handleUnimportant;
}
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor();
for (int j=0; j<e->getTotalChannelCount(); j++) { for (int j=0; j<e->getTotalChannelCount(); j++) {
@ -111,6 +115,10 @@ void FurnaceGUI::drawOrders() {
curNibble=false; curNibble=false;
} }
} }
if (orderEditMode==0) {
handleUnimportant;
}
} }
if (!pat->name.empty() && ImGui::IsItemHovered()) { if (!pat->name.empty() && ImGui::IsItemHovered()) {
ImGui::SetTooltip("%s",pat->name.c_str()); ImGui::SetTooltip("%s",pat->name.c_str());
@ -148,21 +156,21 @@ void FurnaceGUI::drawOrders() {
ImGui::EndTable(); ImGui::EndTable();
} }
ImGui::NextColumn(); ImGui::NextColumn();
if (ImGui::Button(ICON_FA_PLUS)) { if (ImGui::Button(ICON_FA_PLUS)) { handleUnimportant
// add order row (new) // add order row (new)
doAction(GUI_ACTION_ORDERS_ADD); doAction(GUI_ACTION_ORDERS_ADD);
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Add new order"); ImGui::SetTooltip("Add new order");
} }
if (ImGui::Button(ICON_FA_MINUS)) { if (ImGui::Button(ICON_FA_MINUS)) { handleUnimportant
// remove this order row // remove this order row
doAction(GUI_ACTION_ORDERS_REMOVE); doAction(GUI_ACTION_ORDERS_REMOVE);
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Remove order"); ImGui::SetTooltip("Remove order");
} }
if (ImGui::Button(ICON_FA_FILES_O)) { if (ImGui::Button(ICON_FA_FILES_O)) { handleUnimportant
// duplicate order row // duplicate order row
doAction(GUI_ACTION_ORDERS_DUPLICATE); doAction(GUI_ACTION_ORDERS_DUPLICATE);
} }
@ -172,21 +180,21 @@ void FurnaceGUI::drawOrders() {
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Duplicate order (right-click to deep clone)"); ImGui::SetTooltip("Duplicate order (right-click to deep clone)");
} }
if (ImGui::Button(ICON_FA_ANGLE_UP)) { if (ImGui::Button(ICON_FA_ANGLE_UP)) { handleUnimportant
// move order row up // move order row up
doAction(GUI_ACTION_ORDERS_MOVE_UP); doAction(GUI_ACTION_ORDERS_MOVE_UP);
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Move order up"); ImGui::SetTooltip("Move order up");
} }
if (ImGui::Button(ICON_FA_ANGLE_DOWN)) { if (ImGui::Button(ICON_FA_ANGLE_DOWN)) { handleUnimportant
// move order row down // move order row down
doAction(GUI_ACTION_ORDERS_MOVE_DOWN); doAction(GUI_ACTION_ORDERS_MOVE_DOWN);
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Move order down"); ImGui::SetTooltip("Move order down");
} }
if (ImGui::Button(ICON_FA_ANGLE_DOUBLE_DOWN)) { if (ImGui::Button(ICON_FA_ANGLE_DOUBLE_DOWN)) { handleUnimportant
// duplicate order row at end // duplicate order row at end
doAction(GUI_ACTION_ORDERS_DUPLICATE_END); doAction(GUI_ACTION_ORDERS_DUPLICATE_END);
} }
@ -196,7 +204,7 @@ void FurnaceGUI::drawOrders() {
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Duplicate order at end of song (right-click to deep clone)"); ImGui::SetTooltip("Duplicate order at end of song (right-click to deep clone)");
} }
if (ImGui::Button(changeAllOrders?ICON_FA_LINK"##ChangeAll":ICON_FA_CHAIN_BROKEN"##ChangeAll")) { if (ImGui::Button(changeAllOrders?ICON_FA_LINK"##ChangeAll":ICON_FA_CHAIN_BROKEN"##ChangeAll")) { handleUnimportant
// whether to change one or all orders in a row // whether to change one or all orders in a row
changeAllOrders=!changeAllOrders; changeAllOrders=!changeAllOrders;
} }
@ -217,7 +225,7 @@ void FurnaceGUI::drawOrders() {
} else { } else {
orderEditModeLabel=ICON_FA_MOUSE_POINTER "##OrderEditMode"; orderEditModeLabel=ICON_FA_MOUSE_POINTER "##OrderEditMode";
} }
if (ImGui::Button(orderEditModeLabel)) { if (ImGui::Button(orderEditModeLabel)) { handleUnimportant
orderEditMode++; orderEditMode++;
if (orderEditMode>3) orderEditMode=0; if (orderEditMode>3) orderEditMode=0;
curNibble=false; curNibble=false;

View file

@ -167,6 +167,11 @@ void FurnaceGUI::drawSettings() {
settings.avoidRaisingPattern=avoidRaisingPatternB; settings.avoidRaisingPattern=avoidRaisingPatternB;
} }
bool insFocusesPatternB=settings.insFocusesPattern;
if (ImGui::Checkbox("Focus pattern editor when selecting instrument",&insFocusesPatternB)) {
settings.insFocusesPattern=insFocusesPatternB;
}
bool restartOnFlagChangeB=settings.restartOnFlagChange; bool restartOnFlagChangeB=settings.restartOnFlagChange;
if (ImGui::Checkbox("Restart song when changing system properties",&restartOnFlagChangeB)) { if (ImGui::Checkbox("Restart song when changing system properties",&restartOnFlagChangeB)) {
settings.restartOnFlagChange=restartOnFlagChangeB; settings.restartOnFlagChange=restartOnFlagChangeB;
@ -870,6 +875,7 @@ void FurnaceGUI::syncSettings() {
settings.viewPrevPattern=e->getConfInt("viewPrevPattern",1); settings.viewPrevPattern=e->getConfInt("viewPrevPattern",1);
settings.guiColorsBase=e->getConfInt("guiColorsBase",0); settings.guiColorsBase=e->getConfInt("guiColorsBase",0);
settings.avoidRaisingPattern=e->getConfInt("avoidRaisingPattern",0); settings.avoidRaisingPattern=e->getConfInt("avoidRaisingPattern",0);
settings.insFocusesPattern=e->getConfInt("insFocusesPattern",1);
// keybinds // keybinds
LOAD_KEYBIND(GUI_ACTION_OPEN,FURKMOD_CMD|SDLK_o); LOAD_KEYBIND(GUI_ACTION_OPEN,FURKMOD_CMD|SDLK_o);
@ -1067,6 +1073,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("viewPrevPattern",settings.viewPrevPattern); e->setConf("viewPrevPattern",settings.viewPrevPattern);
e->setConf("guiColorsBase",settings.guiColorsBase); e->setConf("guiColorsBase",settings.guiColorsBase);
e->setConf("avoidRaisingPattern",settings.avoidRaisingPattern); e->setConf("avoidRaisingPattern",settings.avoidRaisingPattern);
e->setConf("insFocusesPattern",settings.insFocusesPattern);
PUT_UI_COLOR(GUI_COLOR_BACKGROUND); PUT_UI_COLOR(GUI_COLOR_BACKGROUND);
PUT_UI_COLOR(GUI_COLOR_FRAME_BACKGROUND); PUT_UI_COLOR(GUI_COLOR_FRAME_BACKGROUND);