Add action to set curIns based on current channel instrument at cursor (#2090)

* push test

* remove test file

* add GUI_ACTION_PAT_ABSORB_INSTRUMENT action (set current instrument to channel's current instrument column)

---------

Co-authored-by: Adam Lederer <adam@adamlederer.com>
This commit is contained in:
alederer 2024-08-17 13:50:52 -07:00 committed by GitHub
parent 3cde827c17
commit fca3ce02a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 0 deletions

View file

@ -676,6 +676,17 @@ void FurnaceGUI::doAction(int what) {
latchTarget=0;
latchNibble=false;
break;
case GUI_ACTION_PAT_ABSORB_INSTRUMENT: {
DivPattern* pat=e->curPat[cursor.xCoarse].getPattern(e->curOrders->ord[cursor.xCoarse][curOrder],false);
if (!pat) break;
for (int i=cursor.y; i>=0; i--) {
if (pat->data[i][2] >= 0) {
curIns=pat->data[i][2];
break;
}
}
break;
}
case GUI_ACTION_INS_LIST_ADD:
if (settings.insTypeMenu) {

View file

@ -816,6 +816,7 @@ enum FurnaceGUIActions {
GUI_ACTION_PAT_LATCH,
GUI_ACTION_PAT_SCROLL_MODE,
GUI_ACTION_PAT_CLEAR_LATCH,
GUI_ACTION_PAT_ABSORB_INSTRUMENT,
GUI_ACTION_PAT_MAX,
GUI_ACTION_INS_LIST_MIN,

View file

@ -687,6 +687,7 @@ const FurnaceGUIActionDef guiActions[GUI_ACTION_MAX]={
D("PAT_LATCH", _N("Set note input latch"), 0),
D("PAT_SCROLL_MODE", _N("Change mobile scroll mode"), 0),
D("PAT_CLEAR_LATCH", _N("Clear note input latch"), 0),
D("PAT_ABSORB_INSTRUMENT", _N("Set current instrument to channel's current instrument column"), 0),
D("PAT_MAX", "", NOT_AN_ACTION),
D("INS_LIST_MIN", _N("---Instrument list"), NOT_AN_ACTION),

View file

@ -2415,6 +2415,7 @@ void FurnaceGUI::drawSettings() {
UI_KEYBIND_CONFIG(GUI_ACTION_PAT_EXPAND_SONG);
UI_KEYBIND_CONFIG(GUI_ACTION_PAT_LATCH);
UI_KEYBIND_CONFIG(GUI_ACTION_PAT_CLEAR_LATCH);
UI_KEYBIND_CONFIG(GUI_ACTION_PAT_ABSORB_INSTRUMENT);
KEYBIND_CONFIG_END;
ImGui::TreePop();