Moved Quit and Menu mapping to Misc
- Moved Quit and Menu button/key mapping options to Misc Panel, from the Input panel. - Improved code for aligning elements on Misc panel - Reduced space used by elements, so they fit in 640 horizontal pixels
This commit is contained in:
parent
543e64cbca
commit
3e764d06e0
2 changed files with 168 additions and 158 deletions
|
@ -61,9 +61,6 @@ static gcn::Label *lblLeft;
|
|||
static gcn::UaeDropDown* cboLeft;
|
||||
static gcn::Label *lblRight;
|
||||
static gcn::UaeDropDown* cboRight;
|
||||
static gcn::Label *lblKeyForMenu;
|
||||
static gcn::UaeDropDown* KeyForMenu;
|
||||
|
||||
|
||||
class StringListModel : public gcn::ListModel
|
||||
{
|
||||
|
@ -106,11 +103,6 @@ const char *tapDelayValues[] = { "Normal", "Short", "None" };
|
|||
StringListModel tapDelayList(tapDelayValues, 3);
|
||||
#endif
|
||||
|
||||
static const int ControlKey_SDLKeyValues[] = { SDLK_F11, SDLK_F12, SDLK_LALT, SDLK_LCTRL };
|
||||
|
||||
const char *ControlKeyValues[] = { "F11", "F12", "LeftAlt", "LeftCtrl" };
|
||||
StringListModel ControlKeyList(ControlKeyValues, 4);
|
||||
|
||||
const char *mappingValues[] =
|
||||
{
|
||||
"CD32 rwd", "CD32 ffw", "CD32 play", "CD32 yellow", "CD32 green",
|
||||
|
@ -300,10 +292,6 @@ public:
|
|||
//
|
||||
// else if (actionEvent.getSource() == cboRight)
|
||||
// customControlMap[VK_RIGHT] = amigaKey[cboRight->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == KeyForMenu)
|
||||
changed_prefs.key_for_menu = ControlKey_SDLKeyValues[KeyForMenu->getSelected()] ;
|
||||
|
||||
}
|
||||
};
|
||||
static InputActionListener* inputActionListener;
|
||||
|
@ -469,15 +457,6 @@ void InitPanelInput(const struct _ConfigCategory& category)
|
|||
cboRight->setId("cboRight");
|
||||
cboRight->addActionListener(inputActionListener);
|
||||
|
||||
lblKeyForMenu = new gcn::Label("Key for Menu:");
|
||||
lblKeyForMenu->setSize(100, LABEL_HEIGHT);
|
||||
lblKeyForMenu->setAlignment(gcn::Graphics::RIGHT);
|
||||
KeyForMenu = new gcn::UaeDropDown(&ControlKeyList);
|
||||
KeyForMenu->setSize(150, DROPDOWN_HEIGHT);
|
||||
KeyForMenu->setBaseColor(gui_baseCol);
|
||||
KeyForMenu->setId("CKeyMenu");
|
||||
KeyForMenu->addActionListener(inputActionListener);
|
||||
|
||||
int posY = DISTANCE_BORDER;
|
||||
category.panel->add(lblPort0, DISTANCE_BORDER, posY);
|
||||
category.panel->add(cboPort0, DISTANCE_BORDER + lblPort0->getWidth() + 8, posY);
|
||||
|
@ -528,10 +507,6 @@ void InitPanelInput(const struct _ConfigCategory& category)
|
|||
category.panel->add(cboRight, 220 + lblRight->getWidth() + 8, posY);
|
||||
posY += cboLeft->getHeight() + DISTANCE_NEXT_Y;
|
||||
|
||||
category.panel->add(lblKeyForMenu, DISTANCE_BORDER, posY);
|
||||
category.panel->add(KeyForMenu, DISTANCE_BORDER + lblKeyForMenu->getWidth() + 8, posY);
|
||||
posY += KeyForMenu->getHeight() + 4;
|
||||
|
||||
RefreshPanelInput();
|
||||
}
|
||||
|
||||
|
@ -575,9 +550,6 @@ void ExitPanelInput(void)
|
|||
delete lblRight;
|
||||
delete cboRight;
|
||||
|
||||
delete lblKeyForMenu;
|
||||
delete KeyForMenu;
|
||||
|
||||
delete inputActionListener;
|
||||
}
|
||||
|
||||
|
@ -673,12 +645,4 @@ void RefreshPanelInput(void)
|
|||
// cboLeft->setSelected(GetAmigaKeyIndex(customControlMap[VK_LEFT]));
|
||||
// cboRight->setSelected(GetAmigaKeyIndex(customControlMap[VK_RIGHT]));
|
||||
|
||||
for(i=0; i<4; ++i)
|
||||
{
|
||||
if(changed_prefs.key_for_menu == ControlKey_SDLKeyValues[i])
|
||||
{
|
||||
KeyForMenu->setSelected(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,12 +22,15 @@
|
|||
static gcn::UaeCheckBox* chkStatusLine;
|
||||
static gcn::UaeCheckBox* chkHideIdleLed;
|
||||
static gcn::UaeCheckBox* chkShowGUI;
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
static gcn::Label* lblPandoraSpeed;
|
||||
static gcn::Label* lblPandoraSpeedInfo;
|
||||
static gcn::Slider* sldPandoraSpeed;
|
||||
#endif
|
||||
static gcn::UaeCheckBox* chkBSDSocket;
|
||||
static gcn::Label *lblKeyForMenu;
|
||||
static gcn::UaeDropDown* KeyForMenu;
|
||||
static gcn::Label *lblButtonForMenu;
|
||||
static gcn::UaeDropDown* ButtonForMenu;
|
||||
static gcn::Label *lblKeyForQuit;
|
||||
static gcn::UaeDropDown* KeyForQuit;
|
||||
static gcn::Label *lblButtonForQuit;
|
||||
static gcn::UaeDropDown* ButtonForQuit;
|
||||
|
||||
#ifdef RASPBERRY
|
||||
class StringListModel : public gcn::ListModel
|
||||
|
@ -59,13 +62,43 @@ static gcn::Label *lblNumLock;
|
|||
static gcn::UaeDropDown* cboKBDLed_num;
|
||||
static gcn::Label *lblScrLock;
|
||||
static gcn::UaeDropDown* cboKBDLed_scr;
|
||||
static gcn::Label *lblCapLock;
|
||||
static gcn::UaeDropDown* cboKBDLed_cap;
|
||||
|
||||
const char *listValues[] = { "none", "POWER", "DF0", "DF1", "DF2", "DF3", "DF*", "HD", "CD" };
|
||||
StringListModel KBDLedList(listValues, 9);
|
||||
#endif
|
||||
|
||||
static const int ControlKey_SDLKeyValues[] = { 0, SDLK_F11, SDLK_F12 };
|
||||
|
||||
const char *ControlKeyValues[] = { "------------------", "F11", "F12" };
|
||||
StringListModel ControlKeyList(ControlKeyValues, 3);
|
||||
|
||||
static int GetControlKeyIndex(int key)
|
||||
{
|
||||
int ControlKey_SDLKeyValues_Length = sizeof(ControlKey_SDLKeyValues) / sizeof(int);
|
||||
for (int i = 0; i < (ControlKey_SDLKeyValues_Length + 1); ++i)
|
||||
{
|
||||
if (ControlKey_SDLKeyValues[i] == key)
|
||||
return i;
|
||||
}
|
||||
return 0; // Default: no key
|
||||
}
|
||||
|
||||
static const int ControlButton_SDLButtonValues[] = { -1, 0, 1, 2, 3 };
|
||||
|
||||
const char *ControlButtonValues[] = { "------------------", "JoyButton0", "JoyButton1", "JoyButton2", "JoyButton3" };
|
||||
StringListModel ControlButtonList(ControlButtonValues, 5);
|
||||
|
||||
static int GetControlButtonIndex(int button)
|
||||
{
|
||||
int ControlButton_SDLButtonValues_Length = sizeof(ControlButton_SDLButtonValues) / sizeof(int);
|
||||
for (int i = 0; i < (ControlButton_SDLButtonValues_Length + 1); ++i)
|
||||
{
|
||||
if (ControlButton_SDLButtonValues[i] == button)
|
||||
return i;
|
||||
}
|
||||
return 0; // Default: no key
|
||||
}
|
||||
|
||||
class MiscActionListener : public gcn::ActionListener
|
||||
{
|
||||
public:
|
||||
|
@ -83,19 +116,17 @@ public:
|
|||
else if (actionEvent.getSource() == chkBSDSocket)
|
||||
changed_prefs.socket_emu = chkBSDSocket->isSelected();
|
||||
|
||||
else if (actionEvent.getSource() == KeyForMenu)
|
||||
changed_prefs.key_for_menu = ControlKey_SDLKeyValues[KeyForMenu->getSelected()];
|
||||
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
else if (actionEvent.getSource() == sldPandoraSpeed)
|
||||
{
|
||||
int newspeed = (int) sldPandoraSpeed->getValue();
|
||||
newspeed = newspeed - (newspeed % 20);
|
||||
if(changed_prefs.pandora_cpu_speed != newspeed)
|
||||
{
|
||||
changed_prefs.pandora_cpu_speed = newspeed;
|
||||
RefreshPanelMisc();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (actionEvent.getSource() == KeyForQuit)
|
||||
changed_prefs.key_for_quit = ControlKey_SDLKeyValues[KeyForQuit->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == ButtonForMenu)
|
||||
changed_prefs.button_for_menu = ControlButton_SDLButtonValues[ButtonForMenu->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == ButtonForQuit)
|
||||
changed_prefs.button_for_quit = ControlButton_SDLButtonValues[ButtonForQuit->getSelected()];
|
||||
|
||||
#ifdef RASPBERRY
|
||||
else if (actionEvent.getSource() == cboKBDLed_num)
|
||||
|
@ -125,24 +156,64 @@ void InitPanelMisc(const struct _ConfigCategory& category)
|
|||
chkShowGUI->setId("ShowGUI");
|
||||
chkShowGUI->addActionListener(miscActionListener);
|
||||
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
lblPandoraSpeed = new gcn::Label("Pandora Speed:");
|
||||
lblPandoraSpeed->setSize(110, LABEL_HEIGHT);
|
||||
lblPandoraSpeed->setAlignment(gcn::Graphics::RIGHT);
|
||||
sldPandoraSpeed = new gcn::Slider(500, 1260);
|
||||
sldPandoraSpeed->setSize(200, SLIDER_HEIGHT);
|
||||
sldPandoraSpeed->setBaseColor(gui_baseCol);
|
||||
sldPandoraSpeed->setMarkerLength(20);
|
||||
sldPandoraSpeed->setStepLength(20);
|
||||
sldPandoraSpeed->setId("PandSpeed");
|
||||
sldPandoraSpeed->addActionListener(miscActionListener);
|
||||
lblPandoraSpeedInfo = new gcn::Label("1000 MHz");
|
||||
#endif
|
||||
|
||||
chkBSDSocket = new gcn::UaeCheckBox("bsdsocket.library");
|
||||
chkBSDSocket->setId("BSDSocket");
|
||||
chkBSDSocket->addActionListener(miscActionListener);
|
||||
|
||||
lblNumLock = new gcn::Label("NumLock:");
|
||||
lblNumLock->setSize(85, LABEL_HEIGHT);
|
||||
lblNumLock->setAlignment(gcn::Graphics::RIGHT);
|
||||
cboKBDLed_num = new gcn::UaeDropDown(&KBDLedList);
|
||||
cboKBDLed_num->setSize(100, DROPDOWN_HEIGHT);
|
||||
cboKBDLed_num->setBaseColor(gui_baseCol);
|
||||
cboKBDLed_num->setId("numlock");
|
||||
cboKBDLed_num->addActionListener(miscActionListener);
|
||||
|
||||
lblScrLock = new gcn::Label("ScrollLock:");
|
||||
lblScrLock->setSize(85, LABEL_HEIGHT);
|
||||
lblScrLock->setAlignment(gcn::Graphics::RIGHT);
|
||||
cboKBDLed_scr = new gcn::UaeDropDown(&KBDLedList);
|
||||
cboKBDLed_scr->setSize(100, DROPDOWN_HEIGHT);
|
||||
cboKBDLed_scr->setBaseColor(gui_baseCol);
|
||||
cboKBDLed_scr->setId("scrolllock");
|
||||
cboKBDLed_scr->addActionListener(miscActionListener);
|
||||
|
||||
lblKeyForMenu = new gcn::Label("Menu Key:");
|
||||
lblKeyForMenu->setSize(85, LABEL_HEIGHT);
|
||||
lblKeyForMenu->setAlignment(gcn::Graphics::RIGHT);
|
||||
KeyForMenu = new gcn::UaeDropDown(&ControlKeyList);
|
||||
KeyForMenu->setSize(100, DROPDOWN_HEIGHT);
|
||||
KeyForMenu->setBaseColor(gui_baseCol);
|
||||
KeyForMenu->setId("KeyForMenu");
|
||||
KeyForMenu->addActionListener(miscActionListener);
|
||||
|
||||
lblKeyForQuit = new gcn::Label("Quit Key:");
|
||||
lblKeyForQuit->setSize(85, LABEL_HEIGHT);
|
||||
lblKeyForQuit->setAlignment(gcn::Graphics::RIGHT);
|
||||
KeyForQuit = new gcn::UaeDropDown(&ControlKeyList);
|
||||
KeyForQuit->setSize(100, DROPDOWN_HEIGHT);
|
||||
KeyForQuit->setBaseColor(gui_baseCol);
|
||||
KeyForQuit->setId("KeyForQuit");
|
||||
KeyForQuit->addActionListener(miscActionListener);
|
||||
|
||||
lblButtonForMenu = new gcn::Label("Menu Button:");
|
||||
lblButtonForMenu->setSize(85, LABEL_HEIGHT);
|
||||
lblButtonForMenu->setAlignment(gcn::Graphics::RIGHT);
|
||||
ButtonForMenu = new gcn::UaeDropDown(&ControlButtonList);
|
||||
ButtonForMenu->setSize(100, DROPDOWN_HEIGHT);
|
||||
ButtonForMenu->setBaseColor(gui_baseCol);
|
||||
ButtonForMenu->setId("ButtonForMenu");
|
||||
ButtonForMenu->addActionListener(miscActionListener);
|
||||
|
||||
lblButtonForQuit = new gcn::Label("Quit Button:");
|
||||
lblButtonForQuit->setSize(85, LABEL_HEIGHT);
|
||||
lblButtonForQuit->setAlignment(gcn::Graphics::RIGHT);
|
||||
ButtonForQuit = new gcn::UaeDropDown(&ControlButtonList);
|
||||
ButtonForQuit->setSize(100, DROPDOWN_HEIGHT);
|
||||
ButtonForQuit->setBaseColor(gui_baseCol);
|
||||
ButtonForQuit->setId("ButtonForQuit");
|
||||
ButtonForQuit->addActionListener(miscActionListener);
|
||||
|
||||
int posY = DISTANCE_BORDER;
|
||||
category.panel->add(chkStatusLine, DISTANCE_BORDER, posY);
|
||||
posY += chkStatusLine->getHeight() + DISTANCE_NEXT_Y;
|
||||
|
@ -150,83 +221,59 @@ void InitPanelMisc(const struct _ConfigCategory& category)
|
|||
posY += chkHideIdleLed->getHeight() + DISTANCE_NEXT_Y;
|
||||
category.panel->add(chkShowGUI, DISTANCE_BORDER, posY);
|
||||
posY += chkShowGUI->getHeight() + DISTANCE_NEXT_Y;
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
category.panel->add(lblPandoraSpeed, DISTANCE_BORDER, posY);
|
||||
category.panel->add(sldPandoraSpeed, DISTANCE_BORDER + lblPandoraSpeed->getWidth() + 8, posY);
|
||||
category.panel->add(lblPandoraSpeedInfo, sldPandoraSpeed->getX() + sldPandoraSpeed->getWidth() + 12, posY);
|
||||
posY += sldPandoraSpeed->getHeight() + DISTANCE_NEXT_Y;
|
||||
#endif
|
||||
|
||||
category.panel->add(chkBSDSocket, DISTANCE_BORDER, posY);
|
||||
posY += chkBSDSocket->getHeight() + DISTANCE_NEXT_Y;
|
||||
|
||||
#ifdef RASPBERRY
|
||||
lblNumLock = new gcn::Label("NumLock LED");
|
||||
lblNumLock->setSize(150, LABEL_HEIGHT);
|
||||
lblNumLock->setAlignment(gcn::Graphics::LEFT);
|
||||
cboKBDLed_num = new gcn::UaeDropDown(&KBDLedList);
|
||||
cboKBDLed_num->setSize(150, DROPDOWN_HEIGHT);
|
||||
cboKBDLed_num->setBaseColor(gui_baseCol);
|
||||
cboKBDLed_num->setId("numlock");
|
||||
cboKBDLed_num->addActionListener(miscActionListener);
|
||||
|
||||
lblCapLock = new gcn::Label("CapsLock LED");
|
||||
lblCapLock->setSize(150, LABEL_HEIGHT);
|
||||
lblCapLock->setAlignment(gcn::Graphics::LEFT);
|
||||
cboKBDLed_cap = new gcn::UaeDropDown(&KBDLedList);
|
||||
cboKBDLed_cap->setSize(150, DROPDOWN_HEIGHT);
|
||||
cboKBDLed_cap->setBaseColor(gui_baseCol);
|
||||
cboKBDLed_cap->setId("capslock");
|
||||
cboKBDLed_cap->addActionListener(miscActionListener);
|
||||
|
||||
lblScrLock = new gcn::Label("ScrollLock LED");
|
||||
lblScrLock->setSize(150, LABEL_HEIGHT);
|
||||
lblScrLock->setAlignment(gcn::Graphics::LEFT);
|
||||
cboKBDLed_scr = new gcn::UaeDropDown(&KBDLedList);
|
||||
cboKBDLed_scr->setSize(150, DROPDOWN_HEIGHT);
|
||||
cboKBDLed_scr->setBaseColor(gui_baseCol);
|
||||
cboKBDLed_scr->setId("scrolllock");
|
||||
cboKBDLed_scr->addActionListener(miscActionListener);
|
||||
|
||||
category.panel->add(lblNumLock, DISTANCE_BORDER, posY);
|
||||
// category.panel->add(lblCapLock, lblNumLock->getX() + lblNumLock->getWidth() + DISTANCE_NEXT_X, posY);
|
||||
category.panel->add(lblScrLock, lblCapLock->getX() + lblCapLock->getWidth() + DISTANCE_NEXT_X, posY);
|
||||
posY += lblNumLock->getHeight() + 4;
|
||||
category.panel->add(cboKBDLed_num, DISTANCE_BORDER + lblNumLock->getWidth() + 8, posY);
|
||||
|
||||
category.panel->add(cboKBDLed_num, DISTANCE_BORDER, posY);
|
||||
// category.panel->add(cboKBDLed_cap, cboKBDLed_num->getX() + cboKBDLed_num->getWidth() + DISTANCE_NEXT_X, posY);
|
||||
category.panel->add(cboKBDLed_scr, cboKBDLed_cap->getX() + cboKBDLed_cap->getWidth() + DISTANCE_NEXT_X, posY);
|
||||
category.panel->add(lblScrLock, cboKBDLed_num->getX() + cboKBDLed_num->getWidth() + DISTANCE_NEXT_X, posY);
|
||||
category.panel->add(cboKBDLed_scr, lblScrLock->getX() + lblScrLock->getWidth() + 8, posY);
|
||||
|
||||
posY += cboKBDLed_scr->getHeight() + DISTANCE_NEXT_Y;
|
||||
#endif
|
||||
|
||||
category.panel->add(lblKeyForMenu, DISTANCE_BORDER, posY);
|
||||
category.panel->add(KeyForMenu, DISTANCE_BORDER + lblKeyForMenu->getWidth() + 8, posY);
|
||||
|
||||
category.panel->add(lblKeyForQuit, KeyForMenu->getX() + KeyForMenu->getWidth() + DISTANCE_NEXT_X, posY);
|
||||
category.panel->add(KeyForQuit, lblKeyForQuit->getX() + lblKeyForQuit->getWidth() + 8, posY);
|
||||
|
||||
posY += KeyForMenu->getHeight() + DISTANCE_NEXT_Y;
|
||||
|
||||
category.panel->add(lblButtonForMenu, DISTANCE_BORDER, posY);
|
||||
category.panel->add(ButtonForMenu, DISTANCE_BORDER + lblButtonForMenu->getWidth() + 8, posY);
|
||||
|
||||
category.panel->add(lblButtonForQuit, ButtonForMenu->getX() + ButtonForMenu->getWidth() + DISTANCE_NEXT_X, posY);
|
||||
category.panel->add(ButtonForQuit, lblButtonForQuit->getX() + lblButtonForQuit->getWidth() + 8, posY);
|
||||
|
||||
RefreshPanelMisc();
|
||||
}
|
||||
|
||||
|
||||
void ExitPanelMisc(void)
|
||||
{
|
||||
delete chkStatusLine;
|
||||
delete chkHideIdleLed;
|
||||
delete chkShowGUI;
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
delete lblPandoraSpeed;
|
||||
delete sldPandoraSpeed;
|
||||
delete lblPandoraSpeedInfo;
|
||||
#endif
|
||||
delete chkBSDSocket;
|
||||
|
||||
#ifdef RASPBERRY
|
||||
delete lblCapLock;
|
||||
delete lblScrLock;
|
||||
delete lblNumLock;
|
||||
delete cboKBDLed_num;
|
||||
delete cboKBDLed_cap;
|
||||
delete cboKBDLed_scr;
|
||||
#endif
|
||||
delete miscActionListener;
|
||||
delete lblKeyForMenu;
|
||||
delete KeyForMenu;
|
||||
delete lblKeyForQuit;
|
||||
delete KeyForQuit;
|
||||
delete lblButtonForMenu;
|
||||
delete ButtonForMenu;
|
||||
delete lblButtonForQuit;
|
||||
delete ButtonForQuit;
|
||||
}
|
||||
|
||||
|
||||
void RefreshPanelMisc(void)
|
||||
{
|
||||
char tmp[20];
|
||||
|
@ -234,15 +281,14 @@ void RefreshPanelMisc(void)
|
|||
chkStatusLine->setSelected(changed_prefs.leds_on_screen);
|
||||
chkHideIdleLed->setSelected(changed_prefs.pandora_hide_idle_led);
|
||||
chkShowGUI->setSelected(changed_prefs.start_gui);
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
sldPandoraSpeed->setValue(changed_prefs.pandora_cpu_speed);
|
||||
snprintf(tmp, 20, "%d MHz", changed_prefs.pandora_cpu_speed);
|
||||
lblPandoraSpeedInfo->setCaption(tmp);
|
||||
#endif
|
||||
|
||||
chkBSDSocket->setSelected(changed_prefs.socket_emu);
|
||||
#ifdef RASPBERRY
|
||||
cboKBDLed_num->setSelected(changed_prefs.kbd_led_num);
|
||||
cboKBDLed_scr->setSelected(changed_prefs.kbd_led_scr);
|
||||
#endif
|
||||
KeyForMenu->setSelected(GetControlKeyIndex(changed_prefs.key_for_menu));
|
||||
KeyForQuit->setSelected(GetControlKeyIndex(changed_prefs.key_for_quit));
|
||||
ButtonForMenu->setSelected(GetControlButtonIndex(changed_prefs.button_for_menu));
|
||||
ButtonForQuit->setSelected(GetControlButtonIndex(changed_prefs.button_for_quit));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue