Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and deprecate the "Main (alt recording)" section in the Cycle Action editor #1902

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SnM/SnM.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ class UndoJob : public ScheduledJob
enum {
SNM_SEC_IDX_MAIN=0,
SNM_SEC_IDX_MAIN_ALT,
SNM_SEC_IDX_EPXLORER,
SNM_SEC_IDX_EXPLORER,
SNM_SEC_IDX_ME,
SNM_SEC_IDX_ME_EL,
SNM_SEC_IDX_ME_INLINE,
Expand Down
12 changes: 10 additions & 2 deletions SnM/SnM_Cyclactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ int PerformSingleCommand(int _section, const char* _cmdStr, int _val, int _valhw
case SNM_SEC_IDX_ME:
case SNM_SEC_IDX_ME_EL:
return MIDIEditor_LastFocused_OnCommand(cmdId, _section==SNM_SEC_IDX_ME_EL);
case SNM_SEC_IDX_EPXLORER:
case SNM_SEC_IDX_EXPLORER:
if (HWND h = GetReaHwndByTitle(__localizeFunc("Media Explorer", "explorer", 0))) {
SendMessage(h, WM_COMMAND, cmdId, 0);
return 1;
Expand Down Expand Up @@ -2162,6 +2162,11 @@ void CyclactionWnd::OnCommand(WPARAM wParam, LPARAM lParam)
break;
case ADD_CYCLACTION_MSG:
{
if (g_editedSection == SNM_SEC_IDX_MAIN_ALT)
{
MessageBox(g_caWndMgr.GetMsgHWND(), __LOCALIZE("The \"Main (alt recording)\" section is deprecated in the Cycle Action editor.\n\nCreate the action in the \"Main\" section and add a shortcut in the Action List's \"Main (alt recording)\" section instead.", "sws_DLG_161"), __LOCALIZE("S&M - Warning","sws_DLG_161"), MB_OK);
break;
}
Cyclaction* a = new Cyclaction(__LOCALIZE("Untitled","sws_DLG_161"));
a->m_added = true;
g_editedActions[g_editedSection].Add(a);
Expand Down Expand Up @@ -2364,7 +2369,10 @@ void CyclactionWnd::OnCommand(WPARAM wParam, LPARAM lParam)
case CMBID_SECTION:
if (HIWORD(wParam)==CBN_SELCHANGE) {
AllEditListItemEnd(false);
UpdateSection(m_cbSection.GetCurSel());
int sec = m_cbSection.GetCurSel();
if(sec == SNM_SEC_IDX_MAIN_ALT && g_cas[sec].GetSize() < 1)
sec = SNM_SEC_IDX_MAIN;
UpdateSection(sec);
}
break;
case BTNID_UNDO:
Expand Down
5 changes: 4 additions & 1 deletion sws_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,13 @@ bool hookCommandProc2(KbdSectionInfo* sec, int cmdId, int val, int valhw, int re
// Ignore commands that don't have anything to do with us from this point forward
if (COMMAND_T* cmd = SWSGetCommandByID(cmdId))
{
// Main section actions can be run from the alt sections transparently.
// Previously cycle actions could be added in the alt-recording section
// so checking the original secId is needed for backward compatibility.
int secId = sec->uniqueID;
if(secId == 100 || (secId >= 1 && secId <= 16)) // for REAPER 7.03+, alt-recording & alt-{1,16}
secId = 0;
if (cmd->uniqueSectionId==secId && cmd->cmdId==cmdId)
if ((cmd->uniqueSectionId==secId || cmd->uniqueSectionId==sec->uniqueID) && cmd->cmdId==cmdId)
{
// job for hookCommandProc?
// note: we could perform cmd->doCommand() here, but we'd loose the "flag" param value
Expand Down