Reverting unnecessarty formatting changes introduced by onsave formatter

pull/508/head
Vincent GAUCHE 1 year ago
parent 3eccb2a9e1
commit 494aaa3bba
  1. 102
      src/uimenu.cpp
  2. 4
      src/uimenu.h

@ -30,6 +30,7 @@
#include <circle/sysconfig.h> #include <circle/sysconfig.h>
#include <assert.h> #include <assert.h>
#include <chrono> #include <chrono>
#include <random>
#include <dexed.h> #include <dexed.h>
@ -197,8 +198,7 @@ const CUIMenu::TMenuItem CUIMenu::s_OperatorMenu[] =
{"K Vel. Sens.", EditOPParameter, 0, DEXED_OP_KEY_VEL_SENS}, {"K Vel. Sens.", EditOPParameter, 0, DEXED_OP_KEY_VEL_SENS},
{"Enable", EditOPParameter, 0, DEXED_OP_ENABLE}, {"Enable", EditOPParameter, 0, DEXED_OP_ENABLE},
{"Random", CUIMenu::GenerateRandomOperator, nullptr, 0}, {"Random", CUIMenu::GenerateRandomOperator, nullptr, 0},
{0} {0}};
};
const CUIMenu::TMenuItem CUIMenu::s_SaveMenu[] = const CUIMenu::TMenuItem CUIMenu::s_SaveMenu[] =
{ {
@ -323,7 +323,6 @@ const char CUIMenu::s_NoteName[100][4] =
"A8", "A#8", "B8", "C8", "C#8", "D8", "D#8", "E8", "F8", "F#8", "G8", "G#8", "A8", "A#8", "B8", "C8", "C#8", "D8", "D#8", "E8", "F8", "F#8", "G8", "G#8",
"A9", "A#9", "B9", "C9" "A9", "A#9", "B9", "C9"
}; };
static const unsigned NoteC3 = 27; static const unsigned NoteC3 = 27;
const CUIMenu::TMenuItem CUIMenu::s_PerformanceMenu[] = const CUIMenu::TMenuItem CUIMenu::s_PerformanceMenu[] =
@ -335,6 +334,7 @@ const CUIMenu::TMenuItem CUIMenu::s_PerformanceMenu[] =
{0} {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),
@ -426,9 +426,12 @@ void CUIMenu::MenuHandler(CUIMenu *pUIMenu, TMenuEvent Event)
assert (pUIMenu->m_nCurrentMenuDepth < MaxMenuDepth); assert (pUIMenu->m_nCurrentMenuDepth < MaxMenuDepth);
pUIMenu->m_MenuStackParent[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_pParentMenu; pUIMenu->m_MenuStackParent[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_pParentMenu;
pUIMenu->m_MenuStackMenu[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_pCurrentMenu; pUIMenu->m_MenuStackMenu[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_pCurrentMenu;
pUIMenu->m_nMenuStackItem[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_nCurrentMenuItem; pUIMenu->m_nMenuStackItem[pUIMenu->m_nCurrentMenuDepth]
pUIMenu->m_nMenuStackSelection[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_nCurrentSelection; = pUIMenu->m_nCurrentMenuItem;
pUIMenu->m_nMenuStackParameter[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_nCurrentParameter; pUIMenu->m_nMenuStackSelection[pUIMenu->m_nCurrentMenuDepth]
= pUIMenu->m_nCurrentSelection;
pUIMenu->m_nMenuStackParameter[pUIMenu->m_nCurrentMenuDepth]
= pUIMenu->m_nCurrentParameter;
pUIMenu->m_nCurrentMenuDepth++; pUIMenu->m_nCurrentMenuDepth++;
pUIMenu->m_pParentMenu = pUIMenu->m_pCurrentMenu; pUIMenu->m_pParentMenu = pUIMenu->m_pCurrentMenu;
@ -510,8 +513,7 @@ void CUIMenu::EditGlobalParameter(CUIMenu *pUIMenu, TMenuEvent Event)
const char *pMenuName = const char *pMenuName =
pUIMenu->m_MenuStackParent[pUIMenu->m_nCurrentMenuDepth-1] pUIMenu->m_MenuStackParent[pUIMenu->m_nCurrentMenuDepth-1]
[pUIMenu->m_nMenuStackItem[pUIMenu->m_nCurrentMenuDepth - 1]] [pUIMenu->m_nMenuStackItem[pUIMenu->m_nCurrentMenuDepth-1]].Name;
.Name;
string Value = GetGlobalValueString (Param, pUIMenu->m_pMiniDexed->GetParameter (Param)); string Value = GetGlobalValueString (Param, pUIMenu->m_pMiniDexed->GetParameter (Param));
@ -556,7 +558,8 @@ void CUIMenu::EditVoiceBankNumber(CUIMenu *pUIMenu, TMenuEvent Event)
string TG ("TG"); string TG ("TG");
TG += to_string (nTG+1); TG += to_string (nTG+1);
string Value = to_string(nValue + 1) + "=" + pUIMenu->m_pMiniDexed->GetSysExFileLoader()->GetBankName(nValue); string Value = to_string (nValue+1) + "="
+ pUIMenu->m_pMiniDexed->GetSysExFileLoader ()->GetBankName (nValue);
pUIMenu->m_pUI->DisplayWrite (TG.c_str (), pUIMenu->m_pUI->DisplayWrite (TG.c_str (),
pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name,
@ -609,19 +612,18 @@ void CUIMenu::EditProgramNumber(CUIMenu *pUIMenu, TMenuEvent Event)
} }
string voiceName = pUIMenu->m_pMiniDexed->GetVoiceName (nTG); // Skip empty voices string voiceName = pUIMenu->m_pMiniDexed->GetVoiceName (nTG); // Skip empty voices
if (voiceName == "EMPTY " || voiceName == " " || voiceName == "----------" || voiceName == "~~~~~~~~~~") if (voiceName == "EMPTY "
{ || voiceName == " "
if (Event == MenuEventStepUp) || voiceName == "----------"
|| voiceName == "~~~~~~~~~~" )
{ {
if (Event == MenuEventStepUp) {
CUIMenu::EditProgramNumber (pUIMenu, MenuEventStepUp); CUIMenu::EditProgramNumber (pUIMenu, MenuEventStepUp);
} }
if (Event == MenuEventStepDown) if (Event == MenuEventStepDown) {
{
CUIMenu::EditProgramNumber (pUIMenu, MenuEventStepDown); CUIMenu::EditProgramNumber (pUIMenu, MenuEventStepDown);
} }
} } else {
else
{
string TG ("TG"); string TG ("TG");
TG += to_string (nTG+1); TG += to_string (nTG+1);
@ -737,6 +739,7 @@ void CUIMenu::EditTGParameter2(CUIMenu *pUIMenu, TMenuEvent Event) // second men
pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name,
Value.c_str (), Value.c_str (),
nValue > rParam.Minimum, nValue < rParam.Maximum); nValue > rParam.Minimum, nValue < rParam.Maximum);
} }
void CUIMenu::EditVoiceParameter (CUIMenu *pUIMenu, TMenuEvent Event) void CUIMenu::EditVoiceParameter (CUIMenu *pUIMenu, TMenuEvent Event)
@ -905,8 +908,7 @@ void CUIMenu::SavePerformance(CUIMenu *pUIMenu, TMenuEvent Event)
const char *pMenuName = const char *pMenuName =
pUIMenu->m_MenuStackParent[pUIMenu->m_nCurrentMenuDepth-1] pUIMenu->m_MenuStackParent[pUIMenu->m_nCurrentMenuDepth-1]
[pUIMenu->m_nMenuStackItem[pUIMenu->m_nCurrentMenuDepth - 1]] [pUIMenu->m_nMenuStackItem[pUIMenu->m_nCurrentMenuDepth-1]].Name;
.Name;
pUIMenu->m_pUI->DisplayWrite (pMenuName, pUIMenu->m_pUI->DisplayWrite (pMenuName,
pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name,
@ -1021,12 +1023,9 @@ string CUIMenu::ToMIDIChannel(int nValue)
{ {
switch (nValue) switch (nValue)
{ {
case CMIDIDevice::OmniMode: case CMIDIDevice::OmniMode: return "Omni";
return "Omni"; case CMIDIDevice::Disabled: return "Off";
case CMIDIDevice::Disabled: default: return to_string (nValue+1);
return "Off";
default:
return to_string(nValue + 1);
} }
} }
@ -1110,12 +1109,9 @@ string CUIMenu::ToPortaMode(int nValue)
{ {
switch (nValue) switch (nValue)
{ {
case 0: case 0: return "Fingered";
return "Fingered"; case 1: return "Full time";
case 1: default: return to_string (nValue);
return "Full time";
default:
return to_string(nValue);
} }
}; };
@ -1123,12 +1119,9 @@ string CUIMenu::ToPortaGlissando(int nValue)
{ {
switch (nValue) switch (nValue)
{ {
case 0: case 0: return "Off";
return "Off"; case 1: return "On";
case 1: default: return to_string (nValue);
return "On";
default:
return to_string(nValue);
} }
}; };
@ -1136,12 +1129,9 @@ string CUIMenu::ToPolyMono(int nValue)
{ {
switch (nValue) switch (nValue)
{ {
case 0: case 0: return "Poly";
return "Poly"; case 1: return "Mono";
case 1: default: return to_string (nValue);
return "Mono";
default:
return to_string(nValue);
} }
} }
@ -1154,7 +1144,8 @@ void CUIMenu::TGShortcutHandler(TMenuEvent Event)
assert (m_nMenuStackItem[1] == nTG); assert (m_nMenuStackItem[1] == nTG);
assert (m_nMenuStackParameter[1] == nTG); assert (m_nMenuStackParameter[1] == nTG);
assert(Event == MenuEventPressAndStepDown || Event == MenuEventPressAndStepUp); assert ( Event == MenuEventPressAndStepDown
|| Event == MenuEventPressAndStepUp);
if (Event == MenuEventPressAndStepDown) if (Event == MenuEventPressAndStepDown)
{ {
nTG--; nTG--;
@ -1183,7 +1174,8 @@ void CUIMenu::OPShortcutHandler(TMenuEvent Event)
assert (m_nMenuStackItem[m_nCurrentMenuDepth-1] == nOP); assert (m_nMenuStackItem[m_nCurrentMenuDepth-1] == nOP);
assert (m_nMenuStackParameter[m_nCurrentMenuDepth-1] == nOP); assert (m_nMenuStackParameter[m_nCurrentMenuDepth-1] == nOP);
assert(Event == MenuEventPressAndStepDown || Event == MenuEventPressAndStepUp); assert ( Event == MenuEventPressAndStepDown
|| Event == MenuEventPressAndStepUp);
if (Event == MenuEventPressAndStepDown) if (Event == MenuEventPressAndStepDown)
{ {
nOP--; nOP--;
@ -1333,6 +1325,7 @@ void CUIMenu::PerformanceMenu(CUIMenu *pUIMenu, TMenuEvent Event)
{ {
Value = pUIMenu->m_pMiniDexed->GetPerformanceName(nValue); Value = pUIMenu->m_pMiniDexed->GetPerformanceName(nValue);
std::string nPSelected = ""; std::string nPSelected = "";
if(nValue == pUIMenu->m_pMiniDexed->GetActualPerformanceID()) if(nValue == pUIMenu->m_pMiniDexed->GetActualPerformanceID())
{ {
@ -1401,6 +1394,7 @@ void CUIMenu::InputTxt(CUIMenu *pUIMenu, TMenuEvent Event)
unsigned nPosition = pUIMenu->m_InputTextPosition; unsigned nPosition = pUIMenu->m_InputTextPosition;
unsigned nChar = pUIMenu->m_InputText[nPosition]; unsigned nChar = pUIMenu->m_InputText[nPosition];
switch (Event) switch (Event)
{ {
case MenuEventUpdate: case MenuEventUpdate:
@ -1428,10 +1422,10 @@ void CUIMenu::InputTxt(CUIMenu *pUIMenu, TMenuEvent Event)
case MenuEventStepDown: case MenuEventStepDown:
if (nChar > 32) if (nChar > 32)
{ {
do do {
{
--nChar; --nChar;
} while (NoValidChars.find(nChar) != std::string::npos); }
while (NoValidChars.find(nChar) != std::string::npos);
} }
pUIMenu->m_InputTextChar = nChar; pUIMenu->m_InputTextChar = nChar;
break; break;
@ -1439,14 +1433,16 @@ void CUIMenu::InputTxt(CUIMenu *pUIMenu, TMenuEvent Event)
case MenuEventStepUp: case MenuEventStepUp:
if (nChar < 126) if (nChar < 126)
{ {
do do {
{
++nChar; ++nChar;
} while (NoValidChars.find(nChar) != std::string::npos); }
while (NoValidChars.find(nChar) != std::string::npos);
} }
pUIMenu->m_InputTextChar = nChar; pUIMenu->m_InputTextChar = nChar;
break; break;
case MenuEventSelect: case MenuEventSelect:
if(pUIMenu->m_nCurrentParameter == 1) if(pUIMenu->m_nCurrentParameter == 1)
{ {
@ -1484,6 +1480,7 @@ void CUIMenu::InputTxt(CUIMenu *pUIMenu, TMenuEvent Event)
return; return;
} }
// \E[2;%dH Cursor move to row %1 and column %2 (starting at 1) // \E[2;%dH Cursor move to row %1 and column %2 (starting at 1)
// \E[?25h Normal cursor visible // \E[?25h Normal cursor visible
// \E[?25l Cursor invisible // \E[?25l Cursor invisible
@ -1492,6 +1489,7 @@ void CUIMenu::InputTxt(CUIMenu *pUIMenu, TMenuEvent Event)
escCursor += to_string(nPosition + 2); escCursor += to_string(nPosition + 2);
escCursor += "H"; escCursor += "H";
std::string Value = pUIMenu->m_InputText; std::string Value = pUIMenu->m_InputText;
Value[nPosition]=nChar; Value[nPosition]=nChar;
pUIMenu->m_InputText = Value; pUIMenu->m_InputText = Value;
@ -1503,6 +1501,8 @@ void CUIMenu::InputTxt(CUIMenu *pUIMenu, TMenuEvent Event)
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);
} }
void CUIMenu::EditTGParameterModulation (CUIMenu *pUIMenu, TMenuEvent Event) void CUIMenu::EditTGParameterModulation (CUIMenu *pUIMenu, TMenuEvent Event)

@ -25,9 +25,6 @@
#include <string> #include <string>
#include <circle/timer.h> #include <circle/timer.h>
#include <cassert>
#include <iostream>
#include <random>
class CMiniDexed; class CMiniDexed;
class CUserInterface; class CUserInterface;
@ -175,6 +172,7 @@ private:
bool m_bConfirmDeletePerformance=false; bool m_bConfirmDeletePerformance=false;
unsigned m_nSelectedPerformanceID =0; unsigned m_nSelectedPerformanceID =0;
bool m_bSplashShow=false; bool m_bSplashShow=false;
}; };
#endif #endif

Loading…
Cancel
Save