Update uimenu.cpp

pull/267/head
arsamus 3 years ago committed by GitHub
parent feaf5d57ad
commit bfef969457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 53
      src/uimenu.cpp

@ -52,8 +52,7 @@ const CUIMenu::TMenuItem CUIMenu::s_MainMenu[] =
{"TG8", MenuHandler, s_TGMenu, 7}, {"TG8", MenuHandler, s_TGMenu, 7},
#endif #endif
{"Effects", MenuHandler, s_EffectsMenu}, {"Effects", MenuHandler, s_EffectsMenu},
{"Performance", PerformanceMenu}, {"Performance", MenuHandler, s_PerformanceMenu},
{"Save", MenuHandler, s_SaveMenu},
{0} {0}
}; };
@ -145,7 +144,7 @@ const CUIMenu::TMenuItem CUIMenu::s_EditVoiceMenu[] =
{"LFO Wave", EditVoiceParameter, 0, DEXED_LFO_WAVE}, {"LFO Wave", EditVoiceParameter, 0, DEXED_LFO_WAVE},
{"P Mod Sens.", EditVoiceParameter, 0, DEXED_LFO_PITCH_MOD_SENS}, {"P Mod Sens.", EditVoiceParameter, 0, DEXED_LFO_PITCH_MOD_SENS},
{"Transpose", EditVoiceParameter, 0, DEXED_TRANSPOSE}, {"Transpose", EditVoiceParameter, 0, DEXED_TRANSPOSE},
{"\E[?25lName", InputTxt,0 , 3}, // escape code \E[?25l is for turnoff cursor {"Name", InputTxt,0 , 3},
{0} {0}
}; };
@ -178,8 +177,9 @@ const CUIMenu::TMenuItem CUIMenu::s_OperatorMenu[] =
const CUIMenu::TMenuItem CUIMenu::s_SaveMenu[] = const CUIMenu::TMenuItem CUIMenu::s_SaveMenu[] =
{ {
{"Overwrite", SavePerformance}, {"Overwrite", SavePerformance, 0, 0},
{"\E[?25lNew", InputTxt,0 , 1}, // escape code \E[?25l is for turnoff cursor {"New", InputTxt,0 , 1},
{"Save as deault", SavePerformance, 0, 1},
{0} {0}
}; };
@ -282,6 +282,15 @@ const char CUIMenu::s_NoteName[100][4] =
}; };
static const unsigned NoteC3 = 27; static const unsigned NoteC3 = 27;
const CUIMenu::TMenuItem CUIMenu::s_PerformanceMenu[] =
{
{"Load", PerformanceMenu, 0, 0},
{"Save", MenuHandler, s_SaveMenu},
{"Delete", PerformanceMenu, 0, 1},
{0}
};
CUIMenu::CUIMenu (CUserInterface *pUI, CMiniDexed *pMiniDexed) CUIMenu::CUIMenu (CUserInterface *pUI, CMiniDexed *pMiniDexed)
: m_pUI (pUI), : m_pUI (pUI),
m_pMiniDexed (pMiniDexed), m_pMiniDexed (pMiniDexed),
@ -803,7 +812,7 @@ void CUIMenu::SavePerformance (CUIMenu *pUIMenu, TMenuEvent Event)
return; return;
} }
bool bOK = pUIMenu->m_pMiniDexed->SavePerformance (); bool bOK = pUIMenu->m_pMiniDexed->SavePerformance (pUIMenu->m_nCurrentParameter == 1);
const char *pMenuName = const char *pMenuName =
pUIMenu->m_MenuStackParent[pUIMenu->m_nCurrentMenuDepth-1] pUIMenu->m_MenuStackParent[pUIMenu->m_nCurrentMenuDepth-1]
@ -1114,6 +1123,7 @@ void CUIMenu::TimerHandlerNoBack (TKernelTimerHandle hTimer, void *pParam, void
void CUIMenu::PerformanceMenu (CUIMenu *pUIMenu, TMenuEvent Event) void CUIMenu::PerformanceMenu (CUIMenu *pUIMenu, TMenuEvent Event)
{ {
bool bPerformanceSelectToLoad = pUIMenu->m_pMiniDexed->GetPerformanceSelectToLoad();
unsigned nValue = pUIMenu->m_nSelectedPerformanceID; unsigned nValue = pUIMenu->m_nSelectedPerformanceID;
std::string Value; std::string Value;
@ -1140,6 +1150,10 @@ void CUIMenu::PerformanceMenu (CUIMenu *pUIMenu, TMenuEvent Event)
--nValue; --nValue;
} }
pUIMenu->m_nSelectedPerformanceID = nValue; pUIMenu->m_nSelectedPerformanceID = nValue;
if (!bPerformanceSelectToLoad && pUIMenu->m_nCurrentParameter==0)
{
pUIMenu->m_pMiniDexed->SetNewPerformance(nValue);
}
break; break;
case MenuEventStepUp: case MenuEventStepUp:
@ -1148,20 +1162,33 @@ void CUIMenu::PerformanceMenu (CUIMenu *pUIMenu, TMenuEvent Event)
nValue = pUIMenu->m_pMiniDexed->GetLastPerformance()-1; nValue = pUIMenu->m_pMiniDexed->GetLastPerformance()-1;
} }
pUIMenu->m_nSelectedPerformanceID = nValue; pUIMenu->m_nSelectedPerformanceID = nValue;
if (!bPerformanceSelectToLoad && pUIMenu->m_nCurrentParameter==0)
{
pUIMenu->m_pMiniDexed->SetNewPerformance(nValue);
}
break; break;
case MenuEventSelect: case MenuEventSelect:
if(pUIMenu->m_pMiniDexed->GetActualPerformanceID() != nValue || pUIMenu->m_pMiniDexed->GetActualPerformanceID() == 0 ) switch (pUIMenu->m_nCurrentParameter)
{
case 0:
if (bPerformanceSelectToLoad)
{ {
pUIMenu->m_pMiniDexed->SetNewPerformance(nValue); pUIMenu->m_pMiniDexed->SetNewPerformance(nValue);
} }
else
break;
case 1:
if (pUIMenu->m_nSelectedPerformanceID != 0)
{ {
pUIMenu->m_bPerformanceDeleteMode=true; pUIMenu->m_bPerformanceDeleteMode=true;
pUIMenu->m_bConfirmDeletePerformance=false; pUIMenu->m_bConfirmDeletePerformance=false;
} }
break; break;
default:
break;
}
break;
default: default:
return; return;
} }
@ -1210,7 +1237,7 @@ void CUIMenu::PerformanceMenu (CUIMenu *pUIMenu, TMenuEvent Event)
std::string nPSelected = ""; std::string nPSelected = "";
if(nValue == pUIMenu->m_pMiniDexed->GetActualPerformanceID()) if(nValue == pUIMenu->m_pMiniDexed->GetActualPerformanceID())
{ {
nPSelected= "[Ld]"; nPSelected= "[L]";
} }
pUIMenu->m_pUI->DisplayWrite (pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, nPSelected.c_str(), pUIMenu->m_pUI->DisplayWrite (pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, nPSelected.c_str(),
@ -1243,7 +1270,7 @@ void CUIMenu::InputTxt (CUIMenu *pUIMenu, TMenuEvent Event)
MaxChars=14; MaxChars=14;
MenuTitleL="Performance Name"; MenuTitleL="Performance Name";
MenuTitleR=""; MenuTitleR="";
OkTitleL="\E[?25lNew Performance"; OkTitleL="New Performance"; // \E[?25l
OkTitleR=""; OkTitleR="";
break; break;
@ -1252,7 +1279,7 @@ void CUIMenu::InputTxt (CUIMenu *pUIMenu, TMenuEvent Event)
MaxChars=14; MaxChars=14;
MenuTitleL="Performance Name"; MenuTitleL="Performance Name";
MenuTitleR=""; MenuTitleR="";
OkTitleL="\E[?25lRename Perf."; OkTitleL="Rename Perf."; // \E[?25l
OkTitleR=""; OkTitleR="";
break; break;
@ -1380,7 +1407,7 @@ void CUIMenu::InputTxt (CUIMenu *pUIMenu, TMenuEvent Event)
pUIMenu->m_pMiniDexed->SetVoiceName(pUIMenu->m_InputText, nTG); pUIMenu->m_pMiniDexed->SetVoiceName(pUIMenu->m_InputText, nTG);
} }
Value = Value + escCursor; Value = Value + " " + escCursor ;
pUIMenu->m_pUI->DisplayWrite (MenuTitleR.c_str(),MenuTitleL.c_str(), Value.c_str(), false, false); pUIMenu->m_pUI->DisplayWrite (MenuTitleR.c_str(),MenuTitleL.c_str(), Value.c_str(), false, false);

Loading…
Cancel
Save