Esempio n. 1
0
    void action(const gcn::ActionEvent& actionEvent)
    {
 	    if (actionEvent.getSource() == sldChipmem) {
    		changed_prefs.chipmem_size = ChipMem_values[(int)(sldChipmem->getValue())];
      	if ((changed_prefs.chipmem_size > 0x200000) && (changed_prefs.fastmem_size > 0))
      		changed_prefs.fastmem_size = 0;
			}
			
 	    if (actionEvent.getSource() == sldSlowmem) {
      	changed_prefs.bogomem_size = SlowMem_values[(int)(sldSlowmem->getValue())];
      }
      
	    if (actionEvent.getSource() == sldFastmem) {
     		changed_prefs.fastmem_size = FastMem_values[(int)(sldFastmem->getValue())];
	      if (changed_prefs.fastmem_size > 0 && changed_prefs.chipmem_size > 0x200000)
	        changed_prefs.chipmem_size = 0x200000;
  		}	

	    if (actionEvent.getSource() == sldZ3mem) {
     		changed_prefs.z3fastmem_size = FastMem_values[(int)(sldZ3mem->getValue())];
	      if (changed_prefs.z3fastmem_size > max_z3fastmem)
	        changed_prefs.z3fastmem_size = max_z3fastmem;
  		}	

	    if (actionEvent.getSource() == sldGfxmem) {
     		changed_prefs.gfxmem_size = FastMem_values[(int)(sldGfxmem->getValue())];
  		}	

  		RefreshPanelRAM();
    }
void GlassTabbedContainer::action(const gcn::ActionEvent &ae) {
	GlassTabState s = ((GlassTab*)ae.getSource())->getState();
	if(s == GTS_OPENED || s == GTS_OPENING)
		((GlassTab*)ae.getSource())->close();
	else
		((GlassTab*)ae.getSource())->open();
}
Esempio n. 3
0
void ChangeDisplay::action(const gcn::ActionEvent &event)
{
    if (Net::getPlayerHandler()->canCorrectAttributes() &&
        event.getSource() == mDec)
    {
        int newcorpoints = PlayerInfo::getAttribute(CORR_POINTS) - 1;
        PlayerInfo::setAttribute(CORR_POINTS, newcorpoints);

        int newpoints = PlayerInfo::getAttribute(CHAR_POINTS) + 1;
        PlayerInfo::setAttribute(CHAR_POINTS, newpoints);

        int newbase = PlayerInfo::getStatBase(mId) - 1;
        PlayerInfo::setStatBase(mId, newbase);

        Net::getPlayerHandler()->decreaseAttribute(mId);
    }
    else if (event.getSource() == mInc)
    {
        int newpoints = PlayerInfo::getAttribute(CHAR_POINTS) - 1;
        PlayerInfo::setAttribute(CHAR_POINTS, newpoints);

        int newbase = PlayerInfo::getStatBase(mId) + 1;
        PlayerInfo::setStatBase(mId, newbase);

        Net::getPlayerHandler()->increaseAttribute(mId);
    }
}
 void action(const gcn::ActionEvent& actionEvent)
 {
   if(actionEvent.getSource() == cmdPath)
   {
     char tmp[MAX_PATH];
     strncpy(tmp, txtPath->getText().c_str(), MAX_PATH);
     wndEditFilesysVirtual->releaseModalFocus();
     if(SelectFolder("Select folder", tmp))
       txtPath->setText(tmp);
     wndEditFilesysVirtual->requestModalFocus();
     cmdPath->requestFocus();
   }
   else
   {
     if (actionEvent.getSource() == cmdOK)
     {
       if(txtDevice->getText().length() <= 0)
       {
         wndEditFilesysVirtual->setCaption("Please enter a device name.");
         return;
       }
       if(txtVolume->getText().length() <= 0)
       {
         wndEditFilesysVirtual->setCaption("Please enter a volume name.");
         return;
       }
       dialogResult = true;
     }
     dialogFinished = true;
   }
 }
Esempio n. 5
0
 void action(const gcn::ActionEvent& actionEvent) {
     if (actionEvent.getSource() == radioButton_quickSwitch_off)
         mainMenu_quickSwitch=0;
     else if (actionEvent.getSource() == radioButton_quickSwitch_1)
         mainMenu_quickSwitch=1;
     else if (actionEvent.getSource() == radioButton_quickSwitch_2)
         mainMenu_quickSwitch=2;
     show_settings_TabOnScreen();
 }
Esempio n. 6
0
      void action(const gcn::ActionEvent& actionEvent)
      {
  	    if (actionEvent.getSource() == radioButton_boothd_off)
	      	mainMenu_bootHD=0;
	      else if (actionEvent.getSource() == radioButton_boothd_hddir)
		      mainMenu_bootHD=1;
	      else if (actionEvent.getSource() == radioButton_boothd_hdfile)
		      mainMenu_bootHD=2;
      }
Esempio n. 7
0
    void action(const gcn::ActionEvent& actionEvent)
    {
	    if (actionEvent.getSource() == opt7Mhz)
      	changed_prefs.m68k_speed = M68K_SPEED_7MHZ_CYCLES;
      else if (actionEvent.getSource() == opt14Mhz)
	      changed_prefs.m68k_speed = M68K_SPEED_14MHZ_CYCLES;
      else if (actionEvent.getSource() == opt28Mhz)
	      changed_prefs.m68k_speed = M68K_SPEED_25MHZ_CYCLES;
      else if (actionEvent.getSource() == optFastest)
	      changed_prefs.m68k_speed = -1;
    }
Esempio n. 8
0
 void action(const gcn::ActionEvent& actionEvent) {
     char tempPath[300];
     strcpy(tempPath, prefs_get_attr ("rom_path"));
     strcpy(currentDir,tempPath);
     if (actionEvent.getSource() == button_main_rom) {
         run_menuLoad_guichan(currentDir, MENU_SELECT_MAIN_ROM);
     }
     if (actionEvent.getSource() == button_ext_rom) {
         run_menuLoad_guichan(currentDir, MENU_SELECT_EXT_ROM);
     }
     if (actionEvent.getSource() == button_key_rom) {
         run_menuLoad_guichan(currentDir, MENU_SELECT_KEY_ROM);
     }
 }
Esempio n. 9
0
 void action(const gcn::ActionEvent& actionEvent)
 {
   if (actionEvent.getSource() == cmdOK)
   {
     int selected_item;
     selected_item = lstFiles->getSelected();
     if(createNew)
     {
       char tmp[MAX_PATH];
       if(txtFilename->getText().length() <= 0)
         return;
       strcpy(tmp, workingDir);
       strcat(tmp, "/");
       strcat(tmp, txtFilename->getText().c_str());
       if(strstr(tmp, filefilter[0]) == NULL)
         strcat(tmp, filefilter[0]);
       if(my_existsfile(tmp) == 1)
         return; // File already exists
       strcpy(workingDir, tmp);
       dialogResult = true;
     }
     else
     {
       if(fileList->isDir(selected_item))
         return; // Directory selected -> Ok not possible
       strcat(workingDir, "/");
       strcat(workingDir, fileList->getElementAt(selected_item).c_str());
       dialogResult = true;
     }
   }
   dialogFinished = true;
 }
Esempio n. 10
0
 void action(const gcn::ActionEvent& actionEvent) {
     if (actionEvent.getSource() == checkBox_cpu_compatible)
         if (checkBox_cpu_compatible->isSelected())
             changed_prefs.cpu_compatible = 1;
         else
             changed_prefs.cpu_compatible = 0;
 }
Esempio n. 11
0
void Setup_Joystick::action(const gcn::ActionEvent &event)
{
    if (!joystick)
    {
        return;
    }

    if (event.getSource() == mJoystickEnabled)
    {
        joystick->setEnabled(mJoystickEnabled->isSelected());
    }
    else
    {
        if (joystick->isCalibrating())
        {
            mCalibrateButton->setCaption(_("Calibrate"));
            mCalibrateLabel->setCaption
                (_("Press the button to start calibration"));
            joystick->finishCalibration();
        }
        else
        {
            mCalibrateButton->setCaption(_("Stop"));
            mCalibrateLabel->setCaption(_("Rotate the stick"));
            joystick->startCalibration();
        }
    }
}
Esempio n. 12
0
 void action(const gcn::ActionEvent& actionEvent) {
     if (actionEvent.getSource() == checkBox_cpu_cycle_exact)
         if (checkBox_cpu_cycle_exact->isSelected())
             changed_prefs.cpu_cycle_exact = 1;
         else
             changed_prefs.cpu_cycle_exact = 0;
 }
Esempio n. 13
0
void TabbedArea::action(const gcn::ActionEvent& actionEvent)
{
    Widget* source = actionEvent.getSource();
    Tab* tab = dynamic_cast<Tab*>(source);

    if (tab)
    {
        setSelectedTab(tab);
    }
    else
    {
        if (actionEvent.getId() == "shift_left")
        {
            if (mTabScrollIndex)
                --mTabScrollIndex;
        }
        else if (actionEvent.getId() == "shift_right")
        {
            if (mTabScrollIndex < mTabs.size() - 1)
                ++mTabScrollIndex;
        }
        adjustTabPositions();

        updateArrowEnableState();
    }
}
Esempio n. 14
0
void LayerPanel::action(const gcn::ActionEvent& ae)
{
    gcn::Widget *src = ae.getSource();

    if(src == cbVisible)
    {
        _engine->GetLayerMgr()->GetLayer(_engine->GetDrawPanel()->GetActiveLayerId())->visible = cbVisible->isSelected();
        UpdateSelection();
    }
    else if(src == tfName)
    {
        _engine->GetLayerMgr()->GetLayer(_engine->GetDrawPanel()->GetActiveLayerId())->name = tfName->getText();
        focusNext(); // move focus away, else almost impossible to escape from textfield widget
        UpdateSelection();
    }
    else if(src == btnAllVisible)
    {
        for(uint32 i = 0; i < LAYER_MAX; i++)
            _engine->GetLayerMgr()->GetLayer(i)->visible = true;
        UpdateSelection();
    }
    else if(src == btnNoneVisible)
    {
        for(uint32 i = 0; i < LAYER_MAX; i++)
            _engine->GetLayerMgr()->GetLayer(i)->visible = false;
        UpdateSelection();
    }

}
Esempio n. 15
0
 void action(const gcn::ActionEvent& actionEvent) {
     if (actionEvent.getSource() == radioButton_speedMax)
         changed_prefs.m68k_speed = -1;
     else if (actionEvent.getSource() == radioButton_speedReal)
         changed_prefs.m68k_speed = 0;
     else if (actionEvent.getSource() == radioButton_speed1)
         changed_prefs.m68k_speed = 512;
     else if (actionEvent.getSource() == radioButton_speed2)
         changed_prefs.m68k_speed = 1024;
     else if (actionEvent.getSource() == radioButton_finegrain) {
         backgrd_finegrain->setVisible(true);
         dropDown_finegrain->setVisible(true);
         changed_prefs.m68k_speed = finegrain_backup;
     }
     show_settings_CpuFpu();
 }
Esempio n. 16
0
void TabbedArea::action(const gcn::ActionEvent& actionEvent)
{
    gcn::Widget* source = actionEvent.getSource();
    Tab* tab = dynamic_cast<Tab*>(source);

    if (tab != NULL)
        setSelectedTab(tab);
}
Esempio n. 17
0
 void action(const gcn::ActionEvent& actionEvent) {
     if (actionEvent.getSource() == checkBox_address_space_24)
         if (changed_prefs.cpu_level<=3)
             if (checkBox_address_space_24->isSelected())
                 changed_prefs.address_space_24 = 1;
             else
                 changed_prefs.address_space_24 = 0;
     show_settings_CpuFpu();
 }
Esempio n. 18
0
 void action(const gcn::ActionEvent& actionEvent) {
     if (actionEvent.getSource() == checkBox_extfilter) {
         if (checkBox_extfilter->isSelected())
             menuLoad_extfilter=1;
         else
             menuLoad_extfilter=0;
     }
     dirList=currentDir;
 }
Esempio n. 19
0
    void action(const gcn::ActionEvent& actionEvent)
    {
	    if (actionEvent.getSource() == optCPU68000)
	    {
  		  changed_prefs.cpu_model = 68000;
  		  changed_prefs.fpu_model = 0;
  		  changed_prefs.address_space_24 = true;
  		  changed_prefs.z3fastmem_size = 0;
  		  changed_prefs.gfxmem_size = 0;
      }
      else if (actionEvent.getSource() == optCPU68010)
      {
  		  changed_prefs.cpu_model = 68010;
  		  changed_prefs.fpu_model = 0;
  		  changed_prefs.address_space_24 = true;
  		  changed_prefs.z3fastmem_size = 0;
  		  changed_prefs.gfxmem_size = 0;
  		  changed_prefs.cpu_compatible = 0;
      }
      else if (actionEvent.getSource() == optCPU68020)
      {
  		  changed_prefs.cpu_model = 68020;
  		  if(changed_prefs.fpu_model == 68040)
  		    changed_prefs.fpu_model = 68881;
  		  changed_prefs.cpu_compatible = 0;
      }
      else if (actionEvent.getSource() == optCPU68030)
      {
  		  changed_prefs.cpu_model = 68030;
  		  if(changed_prefs.fpu_model == 68040)
  		    changed_prefs.fpu_model = 68881;
  		  changed_prefs.address_space_24 = false;
  		  changed_prefs.cpu_compatible = 0;
      }
      else if (actionEvent.getSource() == optCPU68040)
      {
  		  changed_prefs.cpu_model = 68040;
  		  changed_prefs.fpu_model = 68040;
  		  changed_prefs.address_space_24 = false;
  		  changed_prefs.cpu_compatible = 0;
      }
	    RefreshPanelCPU();
	    RefreshPanelRAM();
    }
Esempio n. 20
0
void MenuShell::action(const gcn::ActionEvent& event)
{
   if(event.getSource() == actionsListBox)
   {
      selectSound->play();

      MenuAction selectedAction = (MenuAction)listOps->getActionAt(actionsListBox->getSelected());
      activeState->showPanel(selectedAction);
   }
}
	void action(const gcn::ActionEvent& actionEvent)
	{
		g_bPlayEnd = false;
		Mix_HookMusicFinished(0);
		std::string str;


		// Here we use the widget pointer to check which widget the action
		// originated from.
		if (actionEvent.getSource() == m_pWidgetsContainer->m_pListBoxScrollArea)
		{
			
		}
		if (actionEvent.getSource() == m_pWidgetsContainer->m_pListBox)
		{
			int selected = m_pWidgetsContainer->m_pListBox->getSelected();
			m_selected = selected;
			std::string szMidFile = "assets/";
			szMidFile += m_pWidgetsContainer->m_pListBox->getListModel()->getElementAt(selected);

			if (m_pMusic)
			{
				Mix_HaltMusic();
				Mix_FreeMusic(m_pMusic);
				m_pMusic = 0;
			}
			
			m_pMusic = Mix_LoadMUS(szMidFile.c_str());

			if (m_pMusic == 0)
			{				
				return;
			}			

			Mix_PlayMusic(m_pMusic, 1); //Music loop=1
			Mix_HookMusicFinished(musicDone);
			m_bMusicPlaying = true;
			
			
		}
	}
Esempio n. 22
0
void CharSelectDialog::action(const gcn::ActionEvent &event)
{
    // Check if a button of a character was pressed
    const gcn::Widget *sourceParent = event.getSource()->getParent();
    int selected = -1;
    for (int i = 0; i < (int)mCharacterEntries.size(); ++i)
    {
        if (mCharacterEntries[i] == sourceParent)
        {
            selected = i;
            break;
        }
    }

    const std::string &eventId = event.getId();

    if (selected != -1)
    {
        if (eventId == "use")
        {
            attemptCharacterSelect(selected);
        }
        else if (eventId == "new"
                 && !mCharacterEntries[selected]->getCharacter())
        {
            // Start new character dialog
            CharCreateDialog *charCreateDialog =
                    new CharCreateDialog(this, selected);
            mCharHandler->setCharCreateDialog(charCreateDialog);
        }
        else if (eventId == "delete"
                 && mCharacterEntries[selected]->getCharacter())
        {
            new CharDeleteConfirm(this, selected);
        }
    }
    else if (eventId == "switch")
    {
        Client::setState(STATE_SWITCH_LOGIN);
    }
    else if (eventId == "change_password")
    {
        Client::setState(STATE_CHANGEPASSWORD);
    }
    else if (eventId == "change_email")
    {
        Client::setState(STATE_CHANGEEMAIL);
    }
    else if (eventId == "unregister")
    {
        Client::setState(STATE_UNREGISTER);
    }
}
Esempio n. 23
0
    void action(const gcn::ActionEvent& actionEvent)
    {
	    if (actionEvent.getSource() == optFPUnone)
  		{
  		  changed_prefs.fpu_model = 0;
  		}
      else if(actionEvent.getSource() == optFPU68881)
  		{
  		  changed_prefs.fpu_model = 68881;
  		}
      else if(actionEvent.getSource() == optFPU68882)
  		{
  		  changed_prefs.fpu_model = 68882;
  		}
      else if(actionEvent.getSource() == optFPUinternal)
  		{
  		  changed_prefs.fpu_model = 68040;
  		}
	    RefreshPanelCPU();
	    RefreshPanelRAM();
    }
Esempio n. 24
0
 void action(const gcn::ActionEvent& actionEvent) {
     if (actionEvent.getSource() == button_onscreen_ok) {
         mainMenu_pos_x_textinput = window_pos_textinput->getX();
         mainMenu_pos_y_textinput = window_pos_textinput->getY();
         mainMenu_pos_x_dpad = window_pos_dpad->getX();
         mainMenu_pos_y_dpad = window_pos_dpad->getY();
         mainMenu_pos_x_button1 = window_pos_button1->getX();
         mainMenu_pos_y_button1 = window_pos_button1->getY();
         mainMenu_pos_x_button2 = window_pos_button2->getX();
         mainMenu_pos_y_button2 = window_pos_button2->getY();
         mainMenu_pos_x_button3 = window_pos_button3->getX();
         mainMenu_pos_y_button3 = window_pos_button3->getY();
         mainMenu_pos_x_button4 = window_pos_button4->getX();
         mainMenu_pos_y_button4 = window_pos_button4->getY();
         mainMenu_pos_x_button5 = window_pos_button5->getX();
         mainMenu_pos_y_button5 = window_pos_button5->getY();
         mainMenu_pos_x_button6 = window_pos_button6->getX();
         mainMenu_pos_y_button6 = window_pos_button6->getY();
         top->remove(window_setup_position);
     }
     if (actionEvent.getSource() == button_onscreen_reset) {
         mainMenu_pos_x_textinput = 0;
         mainMenu_pos_y_textinput = 0;
         mainMenu_pos_x_dpad = 4;
         mainMenu_pos_y_dpad = 215;
         mainMenu_pos_x_button1 = 430;
         mainMenu_pos_y_button1 = 286;
         mainMenu_pos_x_button2 = 378;
         mainMenu_pos_y_button2 = 286;
         mainMenu_pos_x_button3 = 430;
         mainMenu_pos_y_button3 = 214;
         mainMenu_pos_x_button4 = 378;
         mainMenu_pos_y_button4 = 214;
         mainMenu_pos_x_button5 = 430;
         mainMenu_pos_y_button5 = 142;
         mainMenu_pos_x_button6 = 378;
         mainMenu_pos_y_button6 = 142;
         top->remove(window_setup_position);
     }
 }
Esempio n. 25
0
void FileDialog::action(const gcn::ActionEvent& ae)
{
    gcn::Widget *src = ae.getSource();

    if(src == bOk || src == lbFiles || src == tbFilename)
    {
        _HandleSelection();
    }
    else if(src == bCancel)
    {
        Close();
    }
}
Esempio n. 26
0
void SkillDialog::action(const gcn::ActionEvent &event)
{
    if (event.getId() == "inc")
    {
        SkillEntry *disp = dynamic_cast<SkillEntry*>(event.getSource()->getParent());

        if (disp)
            Net::getPlayerHandler()->increaseSkill(disp->mInfo->id);
    }
    else if (event.getId() == "close")
    {
        setVisible(false);
    }
}
Esempio n. 27
0
    void WorldEditor::action(const gcn::ActionEvent& actionEvent)
    {
        if (actionEvent.getSource() == mNewRoomDialogCancelButton)
        {
            mNewRoomDialogWindow->setVisible(false);
        }
        else if (actionEvent.getSource() ==  mNewRoomDialogOKButton)
        {
            mNewRoomDialogWindow->setVisible(false);
            std::string name = mNewRoomDialogNameTextField->getText();

            if (name.empty())
            {
                return;
            }

            int newRoomNumber = ResourceHandler::getInstance()->newRoomBitmap(mNewRoomWidth / 20,
                                                                              mNewRoomHeight / 15,
                                                                              name);

            WorldPiece* worldPiece = new WorldPiece(newRoomNumber);
            worldPiece->setPosition(mNewRoomX, mNewRoomY);
            worldPiece->addActionListener(this);
            mWorldPieces[newRoomNumber] = worldPiece;
            add(worldPiece);

            mRoomSelector->setSelectedRoom(newRoomNumber);
        }
        else
        {
            WorldPiece* worldPiece = static_cast<WorldPiece*>(actionEvent.getSource());
            mRoomSelector->setSelectedRoom(worldPiece->getRoomNumber());

            resizeToContent();
        }
    }
Esempio n. 28
0
void HomePane::action(const gcn::ActionEvent& event)
{
   for(int i = 0; i < PlayerData::PARTY_SIZE; ++i)
   {
      if(&(characterModules[i]) == event.getSource())
      {
         if(moduleSelectListener != NULL)
         {
            moduleSelectListener->moduleSelected(i, characterModules[i].getId());
         }
         
         break;
      }
   }
}
Esempio n. 29
0
void SpecialsWindow::action(const gcn::ActionEvent &event)
{
    if (event.getId() == "use")
    {
        SpecialEntry *disp = dynamic_cast<SpecialEntry*>(event.getSource()->getParent());

        if (disp)
        {
            /*Being *target = player_node->getTarget();

            if (target)
                Net::getSpecialHandler()->use(disp->mInfo->id, 1, target->getId());
            else*/
                Net::getSpecialHandler()->use(disp->mInfo->id);
        }
    }
    else if (event.getId() == "close")
    {
        setVisible(false);
    }
}
Esempio n. 30
0
void Setup_Keyboard::action(const gcn::ActionEvent &event)
{
    if (event.getSource() == mKeyList)
    {
        if (!mKeySetting)
            mAssignKeyButton->setEnabled(true);
    }
    else if (event.getId() == "assign")
    {
        mKeySetting = true;
        mAssignKeyButton->setEnabled(false);
        keyboard.setEnabled(false);
        int i(mKeyList->getSelected());
        keyboard.setNewKeyIndex(i);
        mKeyListModel->setElementAt(i, keyboard.getKeyCaption(i) + ": ?");
    }
    else if (event.getId() == "makeDefault")
    {
        keyboard.makeDefault();
        refreshKeys();
    }
}