void InitPanelGamePort(const struct _ConfigCategory& category) { int j; total_devices = 1 + JSEM_LASTKBD; for (j = 0; j < inputdevice_get_device_total (IDTYPE_JOYSTICK) && total_devices < 12; j++, total_devices++) inputport_list[total_devices] = inputdevice_get_device_name (IDTYPE_JOYSTICK, j); for (j = 0; j < inputdevice_get_device_total (IDTYPE_MOUSE) && total_devices < 12; j++, total_devices++) inputport_list[total_devices] = inputdevice_get_device_name (IDTYPE_MOUSE, j); ctrlPortList.clear(); for(j = 0; j < total_devices; ++j) ctrlPortList.add(inputport_list[j]); gameportActionListener = new GamePortActionListener(); lblPort0 = new gcn::Label("Port 1:"); lblPort0->setSize(95, LABEL_HEIGHT); lblPort0->setAlignment(gcn::Graphics::RIGHT); cboPorts[0] = new gcn::UaeDropDown(&ctrlPortList); cboPorts[0]->setSize(230, DROPDOWN_HEIGHT); cboPorts[0]->setBaseColor(gui_baseCol); cboPorts[0]->setId("cboPort0"); cboPorts[0]->addActionListener(gameportActionListener); lblPort1 = new gcn::Label("Port 2:"); lblPort1->setSize(95, LABEL_HEIGHT); lblPort1->setAlignment(gcn::Graphics::RIGHT); cboPorts[1] = new gcn::UaeDropDown(&ctrlPortList); cboPorts[1]->setSize(230, DROPDOWN_HEIGHT); cboPorts[1]->setBaseColor(gui_baseCol); cboPorts[1]->setId("cboPort1"); cboPorts[1]->addActionListener(gameportActionListener); lblPort2 = new gcn::Label("paral. Port 1:"); lblPort2->setSize(95, LABEL_HEIGHT); lblPort2->setAlignment(gcn::Graphics::RIGHT); cboPorts[2] = new gcn::UaeDropDown(&ctrlPortList); cboPorts[2]->setSize(230, DROPDOWN_HEIGHT); cboPorts[2]->setBaseColor(gui_baseCol); cboPorts[2]->setId("cboPort2"); cboPorts[2]->addActionListener(gameportActionListener); lblPort3 = new gcn::Label("paral. Port 2:"); lblPort3->setSize(95, LABEL_HEIGHT); lblPort3->setAlignment(gcn::Graphics::RIGHT); cboPorts[3] = new gcn::UaeDropDown(&ctrlPortList); cboPorts[3]->setSize(230, DROPDOWN_HEIGHT); cboPorts[3]->setBaseColor(gui_baseCol); cboPorts[3]->setId("cboPort3"); cboPorts[3]->addActionListener(gameportActionListener); cboPortModes[0] = new gcn::UaeDropDown(&ctrlPortModeList); cboPortModes[0]->setSize(90, DROPDOWN_HEIGHT); cboPortModes[0]->setBaseColor(gui_baseCol); cboPortModes[0]->setId("cboPortMode0"); cboPortModes[0]->addActionListener(gameportActionListener); cboPortModes[1] = new gcn::UaeDropDown(&ctrlPortModeList); cboPortModes[1]->setSize(90, DROPDOWN_HEIGHT); cboPortModes[1]->setBaseColor(gui_baseCol); cboPortModes[1]->setId("cboPortMode1"); cboPortModes[1]->addActionListener(gameportActionListener); cboAutofires[0] = new gcn::UaeDropDown(&autofireList); cboAutofires[0]->setSize(130, DROPDOWN_HEIGHT); cboAutofires[0]->setBaseColor(gui_baseCol); cboAutofires[0]->setId("cboAutofire0"); cboAutofires[0]->addActionListener(gameportActionListener); cboAutofires[1] = new gcn::UaeDropDown(&autofireList); cboAutofires[1]->setSize(130, DROPDOWN_HEIGHT); cboAutofires[1]->setBaseColor(gui_baseCol); cboAutofires[1]->setId("cboAutofire1"); cboAutofires[1]->addActionListener(gameportActionListener); lblMouseSpeed = new gcn::Label("Mouse Speed:"); lblMouseSpeed->setSize(95, LABEL_HEIGHT); lblMouseSpeed->setAlignment(gcn::Graphics::RIGHT); sldMouseSpeed = new gcn::Slider(0, 4); sldMouseSpeed->setSize(110, SLIDER_HEIGHT); sldMouseSpeed->setBaseColor(gui_baseCol); sldMouseSpeed->setMarkerLength(20); sldMouseSpeed->setStepLength(1); sldMouseSpeed->setId("MouseSpeed"); sldMouseSpeed->addActionListener(gameportActionListener); lblMouseSpeedInfo = new gcn::Label(".25"); lblAutofireRate = new gcn::Label("Autofire rate:"); lblAutofireRate->setSize(82, LABEL_HEIGHT); lblAutofireRate->setAlignment(gcn::Graphics::RIGHT); sldAutofireRate = new gcn::Slider(1, 40); sldAutofireRate->setSize(117, SLIDER_HEIGHT); sldAutofireRate->setBaseColor(gui_baseCol); sldAutofireRate->setMarkerLength(20); sldAutofireRate->setStepLength(1); sldAutofireRate->setId("AutofireRate"); sldAutofireRate->addActionListener(gameportActionListener); lblAutofireRateInfo = new gcn::Label("XXXX lines."); // lblNumLock = new gcn::Label("NumLock LED:"); // lblNumLock->setSize(100, LABEL_HEIGHT); // lblNumLock->setAlignment(gcn::Graphics::RIGHT); // cboKBDLed_num = new gcn::UaeDropDown(&KBDLedList); // cboKBDLed_num->setSize(150, DROPDOWN_HEIGHT); // cboKBDLed_num->setBaseColor(gui_baseCol); // cboKBDLed_num->setId("numlock"); // cboKBDLed_num->addActionListener(gameportActionListener); // lblCapLock = new gcn::Label("CapsLock LED:"); // lblCapLock->setSize(100, LABEL_HEIGHT); // lblCapLock->setAlignment(gcn::Graphics::RIGHT); // cboKBDLed_cap = new gcn::UaeDropDown(&KBDLedList); // cboKBDLed_cap->setSize(150, DROPDOWN_HEIGHT); // cboKBDLed_cap->setBaseColor(gui_baseCol); // cboKBDLed_cap->setId("capslock"); // cboKBDLed_cap->addActionListener(gameportActionListener); // lblScrLock = new gcn::Label("ScrollLock LED:"); // lblScrLock->setSize(100, LABEL_HEIGHT); // lblScrLock->setAlignment(gcn::Graphics::RIGHT); // cboKBDLed_scr = new gcn::UaeDropDown(&KBDLedList); // cboKBDLed_scr->setSize(150, DROPDOWN_HEIGHT); // cboKBDLed_scr->setBaseColor(gui_baseCol); // cboKBDLed_scr->setId("scrolllock"); // cboKBDLed_scr->addActionListener(gameportActionListener); int posY = DISTANCE_BORDER; category.panel->add(lblPort0, DISTANCE_BORDER, posY); category.panel->add(cboPorts[0], DISTANCE_BORDER + lblPort0->getWidth() + 8, posY); category.panel->add(cboPortModes[0], cboPorts[0]->getX() + cboPorts[0]->getWidth() + 8, posY); category.panel->add(cboAutofires[0], cboPortModes[0]->getX() + cboPortModes[0]->getWidth() + 8, posY); posY += cboPorts[0]->getHeight() + DISTANCE_NEXT_Y; category.panel->add(lblPort1, DISTANCE_BORDER, posY); category.panel->add(cboPorts[1], DISTANCE_BORDER + lblPort1->getWidth() + 8, posY); category.panel->add(cboPortModes[1], cboPorts[1]->getX() + cboPorts[1]->getWidth() + 8, posY); category.panel->add(cboAutofires[1], cboPortModes[1]->getX() + cboPortModes[1]->getWidth() + 8, posY); posY += cboPorts[1]->getHeight() + DISTANCE_NEXT_Y; category.panel->add(lblPort2, DISTANCE_BORDER, posY); category.panel->add(cboPorts[2], DISTANCE_BORDER + lblPort2->getWidth() + 8, posY); posY += cboPorts[2]->getHeight() + DISTANCE_NEXT_Y; category.panel->add(lblPort3, DISTANCE_BORDER, posY); category.panel->add(cboPorts[3], DISTANCE_BORDER + lblPort3->getWidth() + 8, posY); posY += cboPorts[3]->getHeight() + DISTANCE_NEXT_Y; category.panel->add(lblMouseSpeed, DISTANCE_BORDER, posY); category.panel->add(sldMouseSpeed, DISTANCE_BORDER + lblMouseSpeed->getWidth() + 9, posY); category.panel->add(lblMouseSpeedInfo, sldMouseSpeed->getX() + sldMouseSpeed->getWidth() + 12, posY); category.panel->add(lblAutofireRate, 300, posY); category.panel->add(sldAutofireRate, 300 + lblAutofireRate->getWidth() + 9, posY); category.panel->add(lblAutofireRateInfo, sldAutofireRate->getX() + sldAutofireRate->getWidth() + 12, posY); posY += sldAutofireRate->getHeight() + DISTANCE_NEXT_Y; // category.panel->add(lblNumLock, DISTANCE_BORDER, posY); // category.panel->add(cboKBDLed_num, DISTANCE_BORDER + lblNumLock->getWidth() + 8, posY); // category.panel->add(lblCapLock, lblNumLock->getX() + lblNumLock->getWidth() + DISTANCE_NEXT_X, posY); // category.panel->add(cboKBDLed_cap, cboKBDLed_num->getX() + cboKBDLed_num->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; values_to_dialog(); }
void InitPanelInput(const struct _ConfigCategory& category) { inputActionListener = new InputActionListener(); if (ctrlPortList.getNumberOfElements() < (4 + inputdevice_get_device_total (IDTYPE_JOYSTICK))) { int i; for(i=0; i<(inputdevice_get_device_total (IDTYPE_JOYSTICK) - 1); i++) { ctrlPortList.AddElement(inputdevice_get_device_name(IDTYPE_JOYSTICK,i + 1)); } } lblPort0 = new gcn::Label("Port0:"); lblPort0->setSize(100, LABEL_HEIGHT); lblPort0->setAlignment(gcn::Graphics::RIGHT); cboPort0 = new gcn::UaeDropDown(&ctrlPortList); cboPort0->setSize(435, DROPDOWN_HEIGHT); cboPort0->setBaseColor(gui_baseCol); cboPort0->setId("cboPort0"); cboPort0->addActionListener(inputActionListener); lblPort1 = new gcn::Label("Port1:"); lblPort1->setSize(100, LABEL_HEIGHT); lblPort1->setAlignment(gcn::Graphics::RIGHT); cboPort1 = new gcn::UaeDropDown(&ctrlPortList); cboPort1->setSize(435, DROPDOWN_HEIGHT); cboPort1->setBaseColor(gui_baseCol); cboPort1->setId("cboPort1"); cboPort1->addActionListener(inputActionListener); lblAutofire = new gcn::Label("Autofire Rate:"); lblAutofire->setSize(100, LABEL_HEIGHT); lblAutofire->setAlignment(gcn::Graphics::RIGHT); cboAutofire = new gcn::UaeDropDown(&autofireList); cboAutofire->setSize(80, DROPDOWN_HEIGHT); cboAutofire->setBaseColor(gui_baseCol); cboAutofire->setId("cboAutofire"); cboAutofire->addActionListener(inputActionListener); lblMouseSpeed = new gcn::Label("Mouse Speed:"); lblMouseSpeed->setSize(100, LABEL_HEIGHT); lblMouseSpeed->setAlignment(gcn::Graphics::RIGHT); sldMouseSpeed = new gcn::Slider(0, 4); sldMouseSpeed->setSize(110, SLIDER_HEIGHT); sldMouseSpeed->setBaseColor(gui_baseCol); sldMouseSpeed->setMarkerLength(20); sldMouseSpeed->setStepLength(1); sldMouseSpeed->setId("MouseSpeed"); sldMouseSpeed->addActionListener(inputActionListener); lblMouseSpeedInfo = new gcn::Label(".25"); #ifndef RASPBERRY lblTapDelay = new gcn::Label("Tap Delay:"); lblTapDelay->setSize(100, LABEL_HEIGHT); lblTapDelay->setAlignment(gcn::Graphics::RIGHT); cboTapDelay = new gcn::UaeDropDown(&tapDelayList); cboTapDelay->setSize(80, DROPDOWN_HEIGHT); cboTapDelay->setBaseColor(gui_baseCol); cboTapDelay->setId("cboTapDelay"); cboTapDelay->addActionListener(inputActionListener); chkMouseHack = new gcn::UaeCheckBox("Enable mousehack"); chkMouseHack->setId("MouseHack"); chkMouseHack->addActionListener(inputActionListener); #endif chkCustomCtrl = new gcn::UaeCheckBox("Custom Control"); chkCustomCtrl->setId("CustomCtrl"); chkCustomCtrl->addActionListener(inputActionListener); lblA = new gcn::Label("<A>:"); lblA->setSize(100, LABEL_HEIGHT); lblA->setAlignment(gcn::Graphics::RIGHT); cboA = new gcn::UaeDropDown(&mappingList); cboA->setSize(150, DROPDOWN_HEIGHT); cboA->setBaseColor(gui_baseCol); cboA->setId("cboA"); cboA->addActionListener(inputActionListener); lblB = new gcn::Label("<B>:"); lblB->setSize(100, LABEL_HEIGHT); lblB->setAlignment(gcn::Graphics::RIGHT); cboB = new gcn::UaeDropDown(&mappingList); cboB->setSize(150, DROPDOWN_HEIGHT); cboB->setBaseColor(gui_baseCol); cboB->setId("cboB"); cboB->addActionListener(inputActionListener); lblX = new gcn::Label("<X>:"); lblX->setSize(100, LABEL_HEIGHT); lblX->setAlignment(gcn::Graphics::RIGHT); cboX = new gcn::UaeDropDown(&mappingList); cboX->setSize(150, DROPDOWN_HEIGHT); cboX->setBaseColor(gui_baseCol); cboX->setId("cboX"); cboX->addActionListener(inputActionListener); lblY = new gcn::Label("<Y>:"); lblY->setSize(100, LABEL_HEIGHT); lblY->setAlignment(gcn::Graphics::RIGHT); cboY = new gcn::UaeDropDown(&mappingList); cboY->setSize(150, DROPDOWN_HEIGHT); cboY->setBaseColor(gui_baseCol); cboY->setId("cboY"); cboY->addActionListener(inputActionListener); lblL = new gcn::Label("<L>:"); lblL->setSize(100, LABEL_HEIGHT); lblL->setAlignment(gcn::Graphics::RIGHT); cboL = new gcn::UaeDropDown(&mappingList); cboL->setSize(150, DROPDOWN_HEIGHT); cboL->setBaseColor(gui_baseCol); cboL->setId("cboL"); cboL->addActionListener(inputActionListener); lblR = new gcn::Label("<R>:"); lblR->setSize(100, LABEL_HEIGHT); lblR->setAlignment(gcn::Graphics::RIGHT); cboR = new gcn::UaeDropDown(&mappingList); cboR->setSize(150, DROPDOWN_HEIGHT); cboR->setBaseColor(gui_baseCol); cboR->setId("cboR"); cboR->addActionListener(inputActionListener); lblUp = new gcn::Label("Up:"); lblUp->setSize(100, LABEL_HEIGHT); lblUp->setAlignment(gcn::Graphics::RIGHT); cboUp = new gcn::UaeDropDown(&mappingList); cboUp->setSize(150, DROPDOWN_HEIGHT); cboUp->setBaseColor(gui_baseCol); cboUp->setId("cboUp"); cboUp->addActionListener(inputActionListener); lblDown = new gcn::Label("Down:"); lblDown->setSize(100, LABEL_HEIGHT); lblDown->setAlignment(gcn::Graphics::RIGHT); cboDown = new gcn::UaeDropDown(&mappingList); cboDown->setSize(150, DROPDOWN_HEIGHT); cboDown->setBaseColor(gui_baseCol); cboDown->setId("cboDown"); cboDown->addActionListener(inputActionListener); lblLeft = new gcn::Label("Left:"); lblLeft->setSize(100, LABEL_HEIGHT); lblLeft->setAlignment(gcn::Graphics::RIGHT); cboLeft = new gcn::UaeDropDown(&mappingList); cboLeft->setSize(150, DROPDOWN_HEIGHT); cboLeft->setBaseColor(gui_baseCol); cboLeft->setId("cboLeft"); cboLeft->addActionListener(inputActionListener); lblRight = new gcn::Label("Right:"); lblRight->setSize(100, LABEL_HEIGHT); lblRight->setAlignment(gcn::Graphics::RIGHT); cboRight = new gcn::UaeDropDown(&mappingList); cboRight->setSize(150, DROPDOWN_HEIGHT); cboRight->setBaseColor(gui_baseCol); 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); posY += cboPort0->getHeight() + DISTANCE_NEXT_Y; category.panel->add(lblPort1, DISTANCE_BORDER, posY); category.panel->add(cboPort1, DISTANCE_BORDER + lblPort1->getWidth() + 8, posY); posY += cboPort1->getHeight() + DISTANCE_NEXT_Y; category.panel->add(lblAutofire, DISTANCE_BORDER, posY); category.panel->add(cboAutofire, DISTANCE_BORDER + lblAutofire->getWidth() + 8, posY); posY += cboAutofire->getHeight() + DISTANCE_NEXT_Y; category.panel->add(lblMouseSpeed, DISTANCE_BORDER, posY); category.panel->add(sldMouseSpeed, DISTANCE_BORDER + lblMouseSpeed->getWidth() + 8, posY); category.panel->add(lblMouseSpeedInfo, sldMouseSpeed->getX() + sldMouseSpeed->getWidth() + 12, posY); posY += sldMouseSpeed->getHeight() + DISTANCE_NEXT_Y; #ifndef RASPBERRY category.panel->add(chkMouseHack, DISTANCE_BORDER + lblA->getWidth() + 8, posY); category.panel->add(lblTapDelay, 300, posY); category.panel->add(cboTapDelay, 300 + lblTapDelay->getWidth() + 8, posY); posY += cboTapDelay->getHeight() + DISTANCE_NEXT_Y; #endif category.panel->add(chkCustomCtrl, DISTANCE_BORDER + lblA->getWidth() + 8, posY); posY += chkCustomCtrl->getHeight() + DISTANCE_NEXT_Y; category.panel->add(lblA, DISTANCE_BORDER, posY); category.panel->add(cboA, DISTANCE_BORDER + lblA->getWidth() + 8, posY); category.panel->add(lblB, 300, posY); category.panel->add(cboB, 300 + lblB->getWidth() + 8, posY); posY += cboA->getHeight() + 4; category.panel->add(lblX, DISTANCE_BORDER, posY); category.panel->add(cboX, DISTANCE_BORDER + lblX->getWidth() + 8, posY); category.panel->add(lblY, 300, posY); category.panel->add(cboY, 300 + lblY->getWidth() + 8, posY); posY += cboX->getHeight() + 4; category.panel->add(lblL, DISTANCE_BORDER, posY); category.panel->add(cboL, DISTANCE_BORDER + lblL->getWidth() + 8, posY); category.panel->add(lblR, 300, posY); category.panel->add(cboR, 300 + lblR->getWidth() + 8, posY); posY += cboL->getHeight() + 4; category.panel->add(lblUp, DISTANCE_BORDER, posY); category.panel->add(cboUp, DISTANCE_BORDER + lblUp->getWidth() + 8, posY); category.panel->add(lblDown, 300, posY); category.panel->add(cboDown, 300 + lblDown->getWidth() + 8, posY); posY += cboUp->getHeight() + 4; category.panel->add(lblLeft, DISTANCE_BORDER, posY); category.panel->add(cboLeft, DISTANCE_BORDER + lblLeft->getWidth() + 8, posY); category.panel->add(lblRight, 300, posY); category.panel->add(cboRight, 300 + lblRight->getWidth() + 8, posY); posY += cboLeft->getHeight() + DISTANCE_NEXT_Y; category.panel->add(lblKeyForMenu, DISTANCE_BORDER, posY); category.panel->add(KeyForMenu, DISTANCE_BORDER + lblLeft->getWidth() + 8, posY); posY += KeyForMenu->getHeight() + 4; RefreshPanelInput(); }