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

View File

@ -29,6 +29,9 @@
#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 {
GUI_COLOR_BACKGROUND=0,
GUI_COLOR_FRAME_BACKGROUND,
@ -495,6 +498,7 @@ class FurnaceGUI {
int viewPrevPattern;
int guiColorsBase;
int avoidRaisingPattern;
int insFocusesPattern;
unsigned int maxUndoSteps;
String mainFontPath;
String patFontPath;
@ -537,6 +541,7 @@ class FurnaceGUI {
viewPrevPattern(1),
guiColorsBase(0),
avoidRaisingPattern(0),
insFocusesPattern(1),
maxUndoSteps(100),
mainFontPath(""),
patFontPath(""),

View File

@ -75,6 +75,10 @@ void FurnaceGUI::drawOrders() {
e->setOrder(i);
curNibble=false;
orderCursor=-1;
if (orderEditMode==0) {
handleUnimportant;
}
}
ImGui::PopStyleColor();
for (int j=0; j<e->getTotalChannelCount(); j++) {
@ -111,6 +115,10 @@ void FurnaceGUI::drawOrders() {
curNibble=false;
}
}
if (orderEditMode==0) {
handleUnimportant;
}
}
if (!pat->name.empty() && ImGui::IsItemHovered()) {
ImGui::SetTooltip("%s",pat->name.c_str());
@ -148,21 +156,21 @@ void FurnaceGUI::drawOrders() {
ImGui::EndTable();
}
ImGui::NextColumn();
if (ImGui::Button(ICON_FA_PLUS)) {
if (ImGui::Button(ICON_FA_PLUS)) { handleUnimportant
// add order row (new)
doAction(GUI_ACTION_ORDERS_ADD);
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Add new order");
}
if (ImGui::Button(ICON_FA_MINUS)) {
if (ImGui::Button(ICON_FA_MINUS)) { handleUnimportant
// remove this order row
doAction(GUI_ACTION_ORDERS_REMOVE);
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Remove order");
}
if (ImGui::Button(ICON_FA_FILES_O)) {
}
if (ImGui::Button(ICON_FA_FILES_O)) { handleUnimportant
// duplicate order row
doAction(GUI_ACTION_ORDERS_DUPLICATE);
}
@ -172,21 +180,21 @@ void FurnaceGUI::drawOrders() {
if (ImGui::IsItemHovered()) {
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
doAction(GUI_ACTION_ORDERS_MOVE_UP);
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Move order up");
}
if (ImGui::Button(ICON_FA_ANGLE_DOWN)) {
if (ImGui::Button(ICON_FA_ANGLE_DOWN)) { handleUnimportant
// move order row down
doAction(GUI_ACTION_ORDERS_MOVE_DOWN);
}
if (ImGui::IsItemHovered()) {
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
doAction(GUI_ACTION_ORDERS_DUPLICATE_END);
}
@ -196,7 +204,7 @@ void FurnaceGUI::drawOrders() {
if (ImGui::IsItemHovered()) {
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
changeAllOrders=!changeAllOrders;
}
@ -217,7 +225,7 @@ void FurnaceGUI::drawOrders() {
} else {
orderEditModeLabel=ICON_FA_MOUSE_POINTER "##OrderEditMode";
}
if (ImGui::Button(orderEditModeLabel)) {
if (ImGui::Button(orderEditModeLabel)) { handleUnimportant
orderEditMode++;
if (orderEditMode>3) orderEditMode=0;
curNibble=false;

View File

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