GUI: improve mobile order input
This commit is contained in:
parent
fd4570f973
commit
65b50f4acc
|
|
@ -1319,6 +1319,32 @@ void FurnaceGUI::valueInput(int num, bool direct, int target) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FurnaceGUI::orderInput(int num) {
|
||||||
|
if (orderCursor>=0 && orderCursor<e->getTotalChannelCount()) {
|
||||||
|
prepareUndo(GUI_UNDO_CHANGE_ORDER);
|
||||||
|
e->lockSave([this,num]() {
|
||||||
|
if (!curNibble && !settings.pushNibble) e->curOrders->ord[orderCursor][curOrder]=0;
|
||||||
|
e->curOrders->ord[orderCursor][curOrder]=((e->curOrders->ord[orderCursor][curOrder]<<4)|num);
|
||||||
|
});
|
||||||
|
MARK_MODIFIED;
|
||||||
|
curNibble=!curNibble;
|
||||||
|
if (orderEditMode==2 || orderEditMode==3) {
|
||||||
|
if (!curNibble) {
|
||||||
|
if (orderEditMode==2) {
|
||||||
|
orderCursor++;
|
||||||
|
if (orderCursor>=e->getTotalChannelCount()) orderCursor=0;
|
||||||
|
} else if (orderEditMode==3) {
|
||||||
|
if (curOrder<e->curSubSong->ordersLen-1) {
|
||||||
|
setOrder(curOrder+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e->walkSong(loopOrder,loopRow,loopEnd);
|
||||||
|
makeUndo(GUI_UNDO_CHANGE_ORDER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define changeLatch(x) \
|
#define changeLatch(x) \
|
||||||
if (x<0) x=0; \
|
if (x<0) x=0; \
|
||||||
if (!latchNibble && !settings.pushNibble) x=0; \
|
if (!latchNibble && !settings.pushNibble) x=0; \
|
||||||
|
|
@ -1529,29 +1555,7 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
||||||
auto it=valueKeys.find(ev.key.keysym.sym);
|
auto it=valueKeys.find(ev.key.keysym.sym);
|
||||||
if (it!=valueKeys.cend()) {
|
if (it!=valueKeys.cend()) {
|
||||||
int num=it->second;
|
int num=it->second;
|
||||||
if (orderCursor>=0 && orderCursor<e->getTotalChannelCount()) {
|
orderInput(num);
|
||||||
prepareUndo(GUI_UNDO_CHANGE_ORDER);
|
|
||||||
e->lockSave([this,num]() {
|
|
||||||
if (!curNibble && !settings.pushNibble) e->curOrders->ord[orderCursor][curOrder]=0;
|
|
||||||
e->curOrders->ord[orderCursor][curOrder]=((e->curOrders->ord[orderCursor][curOrder]<<4)|num);
|
|
||||||
});
|
|
||||||
MARK_MODIFIED;
|
|
||||||
curNibble=!curNibble;
|
|
||||||
if (orderEditMode==2 || orderEditMode==3) {
|
|
||||||
if (!curNibble) {
|
|
||||||
if (orderEditMode==2) {
|
|
||||||
orderCursor++;
|
|
||||||
if (orderCursor>=e->getTotalChannelCount()) orderCursor=0;
|
|
||||||
} else if (orderEditMode==3) {
|
|
||||||
if (curOrder<e->curSubSong->ordersLen-1) {
|
|
||||||
setOrder(curOrder+1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
e->walkSong(loopOrder,loopRow,loopEnd);
|
|
||||||
makeUndo(GUI_UNDO_CHANGE_ORDER);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -4518,6 +4522,7 @@ bool FurnaceGUI::loop() {
|
||||||
ordersOpen=true;
|
ordersOpen=true;
|
||||||
curWindow=GUI_WINDOW_ORDERS;
|
curWindow=GUI_WINDOW_ORDERS;
|
||||||
MEASURE(orders,drawOrders());
|
MEASURE(orders,drawOrders());
|
||||||
|
MEASURE(piano,drawPiano());
|
||||||
break;
|
break;
|
||||||
case GUI_SCENE_INSTRUMENT:
|
case GUI_SCENE_INSTRUMENT:
|
||||||
insEditOpen=true;
|
insEditOpen=true;
|
||||||
|
|
|
||||||
|
|
@ -2555,6 +2555,7 @@ class FurnaceGUI {
|
||||||
DivSystem systemPicker();
|
DivSystem systemPicker();
|
||||||
void noteInput(int num, int key, int vol=-1);
|
void noteInput(int num, int key, int vol=-1);
|
||||||
void valueInput(int num, bool direct=false, int target=-1);
|
void valueInput(int num, bool direct=false, int target=-1);
|
||||||
|
void orderInput(int num);
|
||||||
|
|
||||||
void doGenerateWave();
|
void doGenerateWave();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,6 +181,10 @@ void FurnaceGUI::drawOrderButtons() {
|
||||||
}
|
}
|
||||||
NEXT_BUTTON;
|
NEXT_BUTTON;
|
||||||
|
|
||||||
|
if (orderEditMode==0 && mobileUI) {
|
||||||
|
orderEditMode=1;
|
||||||
|
}
|
||||||
|
|
||||||
const char* orderEditModeLabel="?##OrderEditMode";
|
const char* orderEditModeLabel="?##OrderEditMode";
|
||||||
if (orderEditMode==3) {
|
if (orderEditMode==3) {
|
||||||
orderEditModeLabel=ICON_FA_ARROWS_V "##OrderEditMode";
|
orderEditModeLabel=ICON_FA_ARROWS_V "##OrderEditMode";
|
||||||
|
|
@ -193,7 +197,7 @@ void FurnaceGUI::drawOrderButtons() {
|
||||||
}
|
}
|
||||||
if (ImGui::Button(orderEditModeLabel)) { handleUnimportant
|
if (ImGui::Button(orderEditModeLabel)) { handleUnimportant
|
||||||
orderEditMode++;
|
orderEditMode++;
|
||||||
if (orderEditMode>3) orderEditMode=0;
|
if (orderEditMode>3) orderEditMode=mobileUI?1:0;
|
||||||
curNibble=false;
|
curNibble=false;
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
|
|
@ -219,7 +223,7 @@ void FurnaceGUI::drawOrders() {
|
||||||
if (!ordersOpen) return;
|
if (!ordersOpen) return;
|
||||||
if (mobileUI) {
|
if (mobileUI) {
|
||||||
patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*canvasH)):ImVec2((0.16*canvasH)+0.5*canvasW*mobileMenuPos,0.0f));
|
patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*canvasH)):ImVec2((0.16*canvasH)+0.5*canvasW*mobileMenuPos,0.0f));
|
||||||
patWindowSize=(portrait?ImVec2(canvasW,canvasH-(0.16*canvasW)):ImVec2(canvasW-(0.16*canvasH),canvasH));
|
patWindowSize=(portrait?ImVec2(canvasW,canvasH-(0.16*canvasW)-(pianoOpen?(0.4*canvasW):0.0f)):ImVec2(canvasW-(0.16*canvasH),canvasH-(pianoOpen?(0.3*canvasH):0.0f)));
|
||||||
ImGui::SetNextWindowPos(patWindowPos);
|
ImGui::SetNextWindowPos(patWindowPos);
|
||||||
ImGui::SetNextWindowSize(patWindowSize);
|
ImGui::SetNextWindowSize(patWindowSize);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,11 @@ const bool isTopKey[12]={
|
||||||
|
|
||||||
#define VALUE_DIGIT(x,label) \
|
#define VALUE_DIGIT(x,label) \
|
||||||
if (ImGui::Button(label,buttonSize)) { \
|
if (ImGui::Button(label,buttonSize)) { \
|
||||||
valueInput(x,false); \
|
if (curWindow==GUI_WINDOW_ORDERS && orderEditMode>0) { \
|
||||||
|
orderInput(x); \
|
||||||
|
} else { \
|
||||||
|
valueInput(x,false); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::drawPiano() {
|
void FurnaceGUI::drawPiano() {
|
||||||
|
|
@ -166,7 +170,7 @@ void FurnaceGUI::drawPiano() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
if (pianoInputPadMode==PIANO_INPUT_PAD_REPLACE && cursor.xFine>0 && curWindow==GUI_WINDOW_PATTERN) {
|
if (pianoInputPadMode==PIANO_INPUT_PAD_REPLACE && ((cursor.xFine>0 && curWindow==GUI_WINDOW_PATTERN) || (curWindow==GUI_WINDOW_ORDERS && orderEditMode>0))) {
|
||||||
ImVec2 buttonSize=ImGui::GetContentRegionAvail();
|
ImVec2 buttonSize=ImGui::GetContentRegionAvail();
|
||||||
if (ImGui::BeginTable("InputPadP",8,ImGuiTableFlags_SizingFixedSame)) {
|
if (ImGui::BeginTable("InputPadP",8,ImGuiTableFlags_SizingFixedSame)) {
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
|
|
@ -443,9 +447,9 @@ void FurnaceGUI::drawPiano() {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
// draw input pad if necessary
|
// draw input pad if necessary
|
||||||
if ((curWindow==GUI_WINDOW_PATTERN || !mobileUI) && ((pianoInputPadMode==PIANO_INPUT_PAD_SPLIT_AUTO && cursor.xFine>0) || pianoInputPadMode==PIANO_INPUT_PAD_SPLIT_VISIBLE)) {
|
if ((curWindow==GUI_WINDOW_ORDERS || curWindow==GUI_WINDOW_PATTERN || !mobileUI) && ((pianoInputPadMode==PIANO_INPUT_PAD_SPLIT_AUTO && (cursor.xFine>0 || (curWindow==GUI_WINDOW_ORDERS && orderEditMode>0))) || pianoInputPadMode==PIANO_INPUT_PAD_SPLIT_VISIBLE)) {
|
||||||
if (ImGui::Begin("Input Pad",NULL,ImGuiWindowFlags_NoTitleBar)) {
|
if (ImGui::Begin("Input Pad",NULL,ImGuiWindowFlags_NoTitleBar)) {
|
||||||
ImGui::BeginDisabled(cursor.xFine==0);
|
ImGui::BeginDisabled(cursor.xFine==0 && !(curWindow==GUI_WINDOW_ORDERS && orderEditMode>0));
|
||||||
if (ImGui::BeginTable("InputPad",3,ImGuiTableFlags_Borders)) {
|
if (ImGui::BeginTable("InputPad",3,ImGuiTableFlags_Borders)) {
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue