GUI code cleanup and minor improvements
This commit is contained in:
parent
02414634e8
commit
2f4b3c756c
25 changed files with 1332 additions and 1120 deletions
|
@ -28,10 +28,10 @@
|
|||
#define DIALOG_WIDTH 620
|
||||
#define DIALOG_HEIGHT 202
|
||||
|
||||
static SDL_Joystick *GUIjoy;
|
||||
static SDL_Joystick* GUIjoy;
|
||||
extern struct host_input_button host_input_buttons[MAX_INPUT_DEVICES];
|
||||
|
||||
static const char *harddisk_filter[] = { ".hdf", "\0" };
|
||||
static const char* harddisk_filter[] = {".hdf", "\0"};
|
||||
|
||||
static bool dialogResult = false;
|
||||
static bool dialogFinished = false;
|
||||
|
@ -107,14 +107,16 @@ static void InitCreateFilesysHardfile()
|
|||
|
||||
cmdOK = new gcn::Button("Ok");
|
||||
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X,
|
||||
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||
cmdOK->setBaseColor(gui_baseCol);
|
||||
cmdOK->setId("createHdfOK");
|
||||
cmdOK->addActionListener(createFilesysHardfileActionListener);
|
||||
|
||||
cmdCancel = new gcn::Button("Cancel");
|
||||
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH,
|
||||
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
|
||||
cmdCancel->setBaseColor(gui_baseCol);
|
||||
cmdCancel->setId("createHdfCancel");
|
||||
cmdCancel->addActionListener(createFilesysHardfileActionListener);
|
||||
|
@ -173,7 +175,8 @@ static void InitCreateFilesysHardfile()
|
|||
|
||||
wndCreateFilesysHardfile->add(lblPath, DISTANCE_BORDER, posY);
|
||||
wndCreateFilesysHardfile->add(txtPath, DISTANCE_BORDER + lblPath->getWidth() + 8, posY);
|
||||
wndCreateFilesysHardfile->add(cmdPath, wndCreateFilesysHardfile->getWidth() - DISTANCE_BORDER - SMALL_BUTTON_WIDTH, posY);
|
||||
wndCreateFilesysHardfile->add(cmdPath, wndCreateFilesysHardfile->getWidth() - DISTANCE_BORDER - SMALL_BUTTON_WIDTH,
|
||||
posY);
|
||||
posY += txtPath->getHeight() + DISTANCE_NEXT_Y;
|
||||
|
||||
wndCreateFilesysHardfile->add(lblSize, lblDevice->getX(), posY);
|
||||
|
@ -215,6 +218,8 @@ static void ExitCreateFilesysHardfile()
|
|||
|
||||
static void CreateFilesysHardfileLoop()
|
||||
{
|
||||
FocusBugWorkaround(wndCreateFilesysHardfile);
|
||||
|
||||
GUIjoy = SDL_JoystickOpen(0);
|
||||
while (!dialogFinished)
|
||||
{
|
||||
|
@ -255,71 +260,65 @@ static void CreateFilesysHardfileLoop()
|
|||
gui_input->pushInput(event); // Fire key down
|
||||
event.type = SDL_KEYUP; // and the key up
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (event.type == SDL_JOYBUTTONDOWN || event.type == SDL_JOYHATMOTION)
|
||||
{
|
||||
gcn::FocusHandler* focusHdl;
|
||||
gcn::Widget* activeWidget;
|
||||
else if (event.type == SDL_JOYBUTTONDOWN || event.type == SDL_JOYHATMOTION)
|
||||
{
|
||||
gcn::FocusHandler* focusHdl;
|
||||
gcn::Widget* activeWidget;
|
||||
|
||||
int hat = SDL_JoystickGetHat(GUIjoy, 0);
|
||||
const int hat = SDL_JoystickGetHat(GUIjoy, 0);
|
||||
|
||||
if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_up) || (hat & SDL_HAT_UP)) // dpad
|
||||
{
|
||||
|
||||
if(HandleNavigation(DIRECTION_UP))
|
||||
continue; // Don't change value when enter Slider -> don't send event to control
|
||||
else
|
||||
{PushFakeKey(SDLK_UP);}
|
||||
break;
|
||||
|
||||
}
|
||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_down) || (hat & SDL_HAT_DOWN)) // dpad
|
||||
{
|
||||
if(HandleNavigation(DIRECTION_DOWN))
|
||||
continue; // Don't change value when enter Slider -> don't send event to control
|
||||
else
|
||||
{PushFakeKey(SDLK_DOWN);}
|
||||
break;
|
||||
}
|
||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_right) || (hat & SDL_HAT_RIGHT)) // dpad
|
||||
{
|
||||
if(HandleNavigation(DIRECTION_RIGHT))
|
||||
continue; // Don't change value when enter Slider -> don't send event to control
|
||||
else
|
||||
{PushFakeKey(SDLK_RIGHT);}
|
||||
break;
|
||||
}
|
||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].dpad_left) || (hat & SDL_HAT_LEFT)) // dpad
|
||||
{
|
||||
if(HandleNavigation(DIRECTION_LEFT))
|
||||
continue; // Don't change value when enter Slider -> don't send event to control
|
||||
else
|
||||
{PushFakeKey(SDLK_LEFT);}
|
||||
break;
|
||||
}
|
||||
|
||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].south_button)) // need this to be X button
|
||||
{
|
||||
PushFakeKey(SDLK_RETURN);
|
||||
continue; }
|
||||
|
||||
else if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].east_button) ||
|
||||
SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].start_button)) // need this to be START button
|
||||
{ dialogFinished = true;
|
||||
break;}
|
||||
|
||||
}
|
||||
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_up) || (hat & SDL_HAT_UP)) // dpad
|
||||
{
|
||||
if (HandleNavigation(DIRECTION_UP))
|
||||
continue; // Don't change value when enter Slider -> don't send event to control
|
||||
PushFakeKey(SDLK_UP);
|
||||
break;
|
||||
}
|
||||
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_down) || (hat & SDL_HAT_DOWN)) // dpad
|
||||
{
|
||||
if (HandleNavigation(DIRECTION_DOWN))
|
||||
continue; // Don't change value when enter Slider -> don't send event to control
|
||||
PushFakeKey(SDLK_DOWN);
|
||||
break;
|
||||
}
|
||||
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_right) || (hat & SDL_HAT_RIGHT)) // dpad
|
||||
{
|
||||
if (HandleNavigation(DIRECTION_RIGHT))
|
||||
continue; // Don't change value when enter Slider -> don't send event to control
|
||||
PushFakeKey(SDLK_RIGHT);
|
||||
break;
|
||||
}
|
||||
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_left) || (hat & SDL_HAT_LEFT)) // dpad
|
||||
{
|
||||
if (HandleNavigation(DIRECTION_LEFT))
|
||||
continue; // Don't change value when enter Slider -> don't send event to control
|
||||
PushFakeKey(SDLK_LEFT);
|
||||
break;
|
||||
}
|
||||
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].south_button)) // need this to be X button
|
||||
{
|
||||
PushFakeKey(SDLK_RETURN);
|
||||
continue;
|
||||
}
|
||||
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].east_button) ||
|
||||
SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].start_button)) // need this to be START button
|
||||
{
|
||||
dialogFinished = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Send event to guisan-controls
|
||||
//-------------------------------------------------
|
||||
#ifdef ANDROIDSDL
|
||||
androidsdl_event(event, gui_input);
|
||||
androidsdl_event(event, gui_input);
|
||||
#else
|
||||
gui_input->pushInput(event);
|
||||
gui_input->pushInput(event);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -365,7 +364,7 @@ bool CreateFilesysHardfile()
|
|||
size = 1;
|
||||
if (size > 2048)
|
||||
size = 2048;
|
||||
int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), 1, 0);
|
||||
const int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), 1, 0);
|
||||
extractPath(const_cast<char *>(txtPath->getText().c_str()), currentDir);
|
||||
|
||||
FILE* newFile = fopen(txtPath->getText().c_str(), "wb");
|
||||
|
@ -381,13 +380,13 @@ bool CreateFilesysHardfile()
|
|||
struct uaedev_config_info ci;
|
||||
|
||||
uci_set_defaults(&ci, false);
|
||||
strncpy(ci.devname, (char *) txtDevice->getText().c_str(), MAX_DPATH);
|
||||
strncpy(ci.rootdir, (char *) txtPath->getText().c_str(), MAX_DPATH);
|
||||
strncpy(ci.devname, const_cast<char *>(txtDevice->getText().c_str()), MAX_DPATH);
|
||||
strncpy(ci.rootdir, const_cast<char *>(txtPath->getText().c_str()), MAX_DPATH);
|
||||
ci.type = UAEDEV_HDF;
|
||||
ci.surfaces = (size / 1024) + 1;
|
||||
ci.bootpri = bp;
|
||||
|
||||
struct uaedev_config_data * uci = add_filesys_config(&changed_prefs, -1, &ci);
|
||||
struct uaedev_config_data* uci = add_filesys_config(&changed_prefs, -1, &ci);
|
||||
if (uci)
|
||||
{
|
||||
struct hardfiledata* hfd = get_hardfile_data(uci->configoffset);
|
||||
|
|
|
@ -125,7 +125,7 @@ public:
|
|||
return 4;
|
||||
}
|
||||
|
||||
string getElementAt(int i) override
|
||||
string getElementAt(const int i) override
|
||||
{
|
||||
char num[8];
|
||||
|
||||
|
@ -400,8 +400,6 @@ static void EditFilesysHardfileLoop()
|
|||
{
|
||||
FocusBugWorkaround(wndEditFilesysHardfile);
|
||||
|
||||
GUIjoy = SDL_JoystickOpen(0);
|
||||
|
||||
while (!dialogFinished)
|
||||
{
|
||||
SDL_Event event;
|
||||
|
|
|
@ -225,7 +225,6 @@ static void EditFilesysVirtualLoop()
|
|||
{
|
||||
FocusBugWorkaround(wndEditFilesysVirtual);
|
||||
|
||||
GUIjoy = SDL_JoystickOpen(0);
|
||||
while (!dialogFinished)
|
||||
{
|
||||
SDL_Event event;
|
||||
|
|
|
@ -423,6 +423,8 @@ bool HandleNavigation(int direction)
|
|||
case DIRECTION_DOWN:
|
||||
searchFor = navMap[i].downWidget;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (searchFor.length() > 0)
|
||||
{
|
||||
|
@ -465,7 +467,7 @@ bool HandleNavigation(int direction)
|
|||
return focusTarget != nullptr;
|
||||
}
|
||||
|
||||
void PushFakeKey(SDL_Keycode inKey)
|
||||
void PushFakeKey(const SDL_Keycode inKey)
|
||||
{ SDL_Event nuevent;
|
||||
|
||||
nuevent.type = SDL_KEYDOWN; // and the key up
|
||||
|
|
|
@ -193,7 +193,7 @@ static JITActionListener* jitActionListener;
|
|||
class FPUActionListener : public gcn::ActionListener
|
||||
{
|
||||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent)
|
||||
void action(const gcn::ActionEvent& actionEvent) override
|
||||
{
|
||||
if (actionEvent.getSource() == chkFPUstrict) {
|
||||
changed_prefs.fpu_strict = chkFPUstrict->isSelected();
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
//---------------------------------------
|
||||
// Chipset selected
|
||||
//---------------------------------------
|
||||
int cs = chipsets[cboChipset->getSelected()].compatible;
|
||||
const int cs = chipsets[cboChipset->getSelected()].compatible;
|
||||
if (changed_prefs.cs_compatible != cs) {
|
||||
changed_prefs.cs_compatible = cs;
|
||||
built_in_chipset_prefs(&changed_prefs);
|
||||
|
|
|
@ -33,12 +33,14 @@ static gcn::ScrollArea* scrAreaConfigs;
|
|||
bool LoadConfigByName(const char *name)
|
||||
{
|
||||
ConfigFileInfo* config = SearchConfigInList(name);
|
||||
if (config != NULL)
|
||||
if (config != nullptr)
|
||||
{
|
||||
if (emulating) {
|
||||
if (emulating)
|
||||
{
|
||||
uae_restart(-1, config->FullPath);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
txtName->setText(config->Name);
|
||||
txtDesc->setText(config->Description);
|
||||
target_cfgfile_load(&changed_prefs, config->FullPath, 0, 0);
|
||||
|
@ -49,321 +51,325 @@ bool LoadConfigByName(const char *name)
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetLastActiveConfig(const char* filename)
|
||||
{
|
||||
extractFileName(filename, last_active_config);
|
||||
removeFileExtension(last_active_config);
|
||||
}
|
||||
|
||||
|
||||
class ConfigsListModel : public gcn::ListModel
|
||||
{
|
||||
vector<string> configs;
|
||||
|
||||
public:
|
||||
ConfigsListModel()
|
||||
{
|
||||
}
|
||||
|
||||
int getNumberOfElements() override
|
||||
void SetLastActiveConfig(const char* filename)
|
||||
{
|
||||
return configs.size();
|
||||
extractFileName(filename, last_active_config);
|
||||
removeFileExtension(last_active_config);
|
||||
}
|
||||
|
||||
string getElementAt(int i) override
|
||||
{
|
||||
if (i >= configs.size() || i < 0)
|
||||
return "---";
|
||||
return configs[i];
|
||||
}
|
||||
|
||||
void InitConfigsList(void)
|
||||
class ConfigsListModel : public gcn::ListModel
|
||||
{
|
||||
configs.clear();
|
||||
for (int i = 0; i<ConfigFilesList.size(); ++i)
|
||||
vector<string> configs;
|
||||
|
||||
public:
|
||||
ConfigsListModel()
|
||||
{
|
||||
char tmp[MAX_DPATH];
|
||||
strncpy(tmp, ConfigFilesList[i]->Name, MAX_DPATH);
|
||||
if (strlen(ConfigFilesList[i]->Description) > 0)
|
||||
}
|
||||
|
||||
int getNumberOfElements() override
|
||||
{
|
||||
return configs.size();
|
||||
}
|
||||
|
||||
string getElementAt(int i) override
|
||||
{
|
||||
if (i >= configs.size() || i < 0)
|
||||
return "---";
|
||||
return configs[i];
|
||||
}
|
||||
|
||||
void InitConfigsList(void)
|
||||
{
|
||||
configs.clear();
|
||||
for (int i = 0; i<ConfigFilesList.size(); ++i)
|
||||
{
|
||||
strncat(tmp, " (", MAX_DPATH - 1);
|
||||
strncat(tmp, ConfigFilesList[i]->Description, MAX_DPATH - 1);
|
||||
strncat(tmp, ")", MAX_DPATH - 1);
|
||||
}
|
||||
configs.push_back(tmp);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static ConfigsListModel* configsList;
|
||||
|
||||
|
||||
class ConfigButtonActionListener : public gcn::ActionListener
|
||||
{
|
||||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent) override
|
||||
{
|
||||
int i;
|
||||
if (actionEvent.getSource() == cmdLoad)
|
||||
{
|
||||
//-----------------------------------------------
|
||||
// Load selected configuration
|
||||
//-----------------------------------------------
|
||||
i = lstConfigs->getSelected();
|
||||
if (emulating) {
|
||||
uae_restart(-1, ConfigFilesList[i]->FullPath);
|
||||
}
|
||||
else {
|
||||
target_cfgfile_load(&changed_prefs, ConfigFilesList[i]->FullPath, 0, 0);
|
||||
strncpy(last_active_config, ConfigFilesList[i]->Name, MAX_PATH);
|
||||
DisableResume();
|
||||
RefreshAllPanels();
|
||||
}
|
||||
}
|
||||
else if (actionEvent.getSource() == cmdSave)
|
||||
{
|
||||
//-----------------------------------------------
|
||||
// Save current configuration
|
||||
//-----------------------------------------------
|
||||
char filename[MAX_DPATH];
|
||||
if (!txtName->getText().empty())
|
||||
{
|
||||
fetch_configurationpath(filename, MAX_DPATH);
|
||||
strncat(filename, txtName->getText().c_str(), MAX_DPATH - 1);
|
||||
strncat(filename, ".uae", MAX_DPATH);
|
||||
strncpy(changed_prefs.description, txtDesc->getText().c_str(), 256);
|
||||
if (cfgfile_save(&changed_prefs, filename, 0))
|
||||
RefreshPanelConfig();
|
||||
}
|
||||
}
|
||||
else if (actionEvent.getSource() == cmdLoadFrom)
|
||||
{
|
||||
}
|
||||
else if (actionEvent.getSource() == cmdSaveAs)
|
||||
{
|
||||
}
|
||||
else if (actionEvent.getSource() == cmdDelete)
|
||||
{
|
||||
//-----------------------------------------------
|
||||
// Delete selected config
|
||||
//-----------------------------------------------
|
||||
char msg[256];
|
||||
i = lstConfigs->getSelected();
|
||||
if (i >= 0 && strcmp(ConfigFilesList[i]->Name, OPTIONSFILENAME))
|
||||
{
|
||||
snprintf(msg, 256, "Do you want to delete '%s' ?", ConfigFilesList[i]->Name);
|
||||
if (ShowMessage("Delete Configuration", msg, "", "Yes", "No"))
|
||||
char tmp[MAX_DPATH];
|
||||
strncpy(tmp, ConfigFilesList[i]->Name, MAX_DPATH);
|
||||
if (strlen(ConfigFilesList[i]->Description) > 0)
|
||||
{
|
||||
remove(ConfigFilesList[i]->FullPath);
|
||||
if (!strcmp(last_active_config, ConfigFilesList[i]->Name))
|
||||
{
|
||||
txtName->setText("");
|
||||
txtDesc->setText("");
|
||||
last_active_config[0] = '\0';
|
||||
}
|
||||
ConfigFilesList.erase(ConfigFilesList.begin() + i);
|
||||
RefreshPanelConfig();
|
||||
strncat(tmp, " (", MAX_DPATH - 1);
|
||||
strncat(tmp, ConfigFilesList[i]->Description, MAX_DPATH - 1);
|
||||
strncat(tmp, ")", MAX_DPATH - 1);
|
||||
}
|
||||
cmdDelete->requestFocus();
|
||||
configs.push_back(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
static ConfigButtonActionListener* configButtonActionListener;
|
||||
static ConfigsListModel* configsList;
|
||||
|
||||
|
||||
class ConfigsListActionListener : public gcn::ActionListener
|
||||
{
|
||||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent) override
|
||||
class ConfigButtonActionListener : public gcn::ActionListener
|
||||
{
|
||||
int selected_item = lstConfigs->getSelected();
|
||||
if (!txtName->getText().compare(ConfigFilesList[selected_item]->Name))
|
||||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent) override
|
||||
{
|
||||
//-----------------------------------------------
|
||||
// Selected same config again -> load and start it
|
||||
//-----------------------------------------------
|
||||
if (emulating) {
|
||||
uae_restart(0, ConfigFilesList[selected_item]->FullPath);
|
||||
}
|
||||
else {
|
||||
target_cfgfile_load(&changed_prefs, ConfigFilesList[selected_item]->FullPath, 0, 0);
|
||||
strncpy(last_active_config, ConfigFilesList[selected_item]->Name, MAX_PATH);
|
||||
DisableResume();
|
||||
RefreshAllPanels();
|
||||
uae_reset(0, 1);
|
||||
}
|
||||
gui_running = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtName->setText(ConfigFilesList[selected_item]->Name);
|
||||
txtDesc->setText(ConfigFilesList[selected_item]->Description);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static ConfigsListActionListener* configsListActionListener;
|
||||
|
||||
void InitPanelConfig(const struct _ConfigCategory& category)
|
||||
{
|
||||
configButtonActionListener = new ConfigButtonActionListener();
|
||||
|
||||
cmdLoad = new gcn::Button("Load");
|
||||
cmdLoad->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
cmdLoad->setBaseColor(gui_baseCol);
|
||||
cmdLoad->setId("ConfigLoad");
|
||||
cmdLoad->addActionListener(configButtonActionListener);
|
||||
|
||||
cmdSave = new gcn::Button("Save");
|
||||
cmdSave->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
cmdSave->setBaseColor(gui_baseCol);
|
||||
cmdSave->setId("ConfigSave");
|
||||
cmdSave->addActionListener(configButtonActionListener);
|
||||
|
||||
cmdLoadFrom = new gcn::Button("Load From...");
|
||||
cmdLoadFrom->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
cmdLoadFrom->setBaseColor(gui_baseCol);
|
||||
cmdLoadFrom->setId("CfgLoadFrom");
|
||||
cmdLoadFrom->addActionListener(configButtonActionListener);
|
||||
cmdLoadFrom->setEnabled(false);
|
||||
|
||||
cmdSaveAs = new gcn::Button("Save As...");
|
||||
cmdSaveAs->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
cmdSaveAs->setBaseColor(gui_baseCol);
|
||||
cmdSaveAs->setId("CfgSaveAs");
|
||||
cmdSaveAs->addActionListener(configButtonActionListener);
|
||||
cmdSaveAs->setEnabled(false);
|
||||
|
||||
cmdDelete = new gcn::Button("Delete");
|
||||
cmdDelete->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
cmdDelete->setBaseColor(gui_baseCol);
|
||||
cmdDelete->setId("CfgDelete");
|
||||
cmdDelete->addActionListener(configButtonActionListener);
|
||||
|
||||
int buttonX = DISTANCE_BORDER;
|
||||
int buttonY = category.panel->getHeight() - DISTANCE_BORDER - BUTTON_HEIGHT;
|
||||
category.panel->add(cmdLoad, buttonX, buttonY);
|
||||
buttonX += BUTTON_WIDTH + DISTANCE_NEXT_X;
|
||||
category.panel->add(cmdSave, buttonX, buttonY);
|
||||
buttonX += BUTTON_WIDTH + 3 * DISTANCE_NEXT_X;
|
||||
buttonX += BUTTON_WIDTH + DISTANCE_NEXT_X;
|
||||
buttonX = category.panel->getWidth() - DISTANCE_BORDER - BUTTON_WIDTH;
|
||||
category.panel->add(cmdDelete, buttonX, buttonY);
|
||||
|
||||
lblName = new gcn::Label("Name:");
|
||||
lblName->setSize(lblName->getWidth(), lblName->getHeight());
|
||||
lblName->setAlignment(gcn::Graphics::RIGHT);
|
||||
txtName = new gcn::TextField();
|
||||
txtName->setSize(300, txtName->getHeight());
|
||||
txtName->setId("ConfigName");
|
||||
txtName->setBackgroundColor(colTextboxBackground);
|
||||
|
||||
lblDesc = new gcn::Label("Description:");
|
||||
lblDesc->setSize(lblDesc->getWidth(), lblDesc->getHeight());
|
||||
lblDesc->setAlignment(gcn::Graphics::RIGHT);
|
||||
txtDesc = new gcn::TextField();
|
||||
txtDesc->setSize(300, txtDesc->getHeight());
|
||||
txtDesc->setId("ConfigDesc");
|
||||
txtDesc->setBackgroundColor(colTextboxBackground);
|
||||
|
||||
ReadConfigFileList();
|
||||
configsList = new ConfigsListModel();
|
||||
configsList->InitConfigsList();
|
||||
configsListActionListener = new ConfigsListActionListener();
|
||||
|
||||
lstConfigs = new gcn::UaeListBox(configsList);
|
||||
lstConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 22, 232);
|
||||
lstConfigs->setBackgroundColor(colTextboxBackground);
|
||||
lstConfigs->setWrappingEnabled(true);
|
||||
lstConfigs->setId("ConfigList");
|
||||
lstConfigs->addActionListener(configsListActionListener);
|
||||
|
||||
scrAreaConfigs = new gcn::ScrollArea(lstConfigs);
|
||||
scrAreaConfigs->setBorderSize(1);
|
||||
scrAreaConfigs->setPosition(DISTANCE_BORDER, DISTANCE_BORDER);
|
||||
scrAreaConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 2, 252);
|
||||
scrAreaConfigs->setScrollbarWidth(20);
|
||||
scrAreaConfigs->setBackgroundColor(colTextboxBackground);
|
||||
category.panel->add(scrAreaConfigs);
|
||||
|
||||
category.panel->add(lblName, DISTANCE_BORDER, scrAreaConfigs->getY() + scrAreaConfigs->getHeight() + DISTANCE_NEXT_Y);
|
||||
category.panel->add(txtName, DISTANCE_BORDER + lblDesc->getWidth() + 8, scrAreaConfigs->getY() + scrAreaConfigs->getHeight() + DISTANCE_NEXT_Y);
|
||||
category.panel->add(lblDesc, DISTANCE_BORDER, lblName->getY() + lblName->getHeight() + DISTANCE_NEXT_Y);
|
||||
category.panel->add(txtDesc, DISTANCE_BORDER + lblDesc->getWidth() + 8, txtName->getY() + txtName->getHeight() + DISTANCE_NEXT_Y);
|
||||
|
||||
if (strlen(last_active_config) == 0)
|
||||
strncpy(last_active_config, OPTIONSFILENAME, MAX_PATH);
|
||||
txtName->setText(last_active_config);
|
||||
txtDesc->setText(changed_prefs.description);
|
||||
ensureVisible = -1;
|
||||
RefreshPanelConfig();
|
||||
}
|
||||
|
||||
void ExitPanelConfig()
|
||||
{
|
||||
delete lstConfigs;
|
||||
delete scrAreaConfigs;
|
||||
delete configsListActionListener;
|
||||
delete configsList;
|
||||
|
||||
delete cmdLoad;
|
||||
delete cmdSave;
|
||||
delete cmdLoadFrom;
|
||||
delete cmdSaveAs;
|
||||
delete cmdDelete;
|
||||
|
||||
delete configButtonActionListener;
|
||||
|
||||
delete lblName;
|
||||
delete txtName;
|
||||
delete lblDesc;
|
||||
delete txtDesc;
|
||||
}
|
||||
|
||||
static void MakeCurrentVisible()
|
||||
{
|
||||
if (ensureVisible >= 0)
|
||||
{
|
||||
scrAreaConfigs->setVerticalScrollAmount(ensureVisible * 19);
|
||||
ensureVisible = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void RefreshPanelConfig()
|
||||
{
|
||||
ReadConfigFileList();
|
||||
configsList->InitConfigsList();
|
||||
|
||||
// Search current entry
|
||||
if (!txtName->getText().empty())
|
||||
{
|
||||
for (int i = 0; i < ConfigFilesList.size(); ++i)
|
||||
{
|
||||
if (!_tcscmp(ConfigFilesList[i]->Name, txtName->getText().c_str()))
|
||||
int i;
|
||||
if (actionEvent.getSource() == cmdLoad)
|
||||
{
|
||||
// Select current entry
|
||||
lstConfigs->setSelected(i);
|
||||
ensureVisible = i;
|
||||
RegisterRefreshFunc(MakeCurrentVisible);
|
||||
break;
|
||||
//-----------------------------------------------
|
||||
// Load selected configuration
|
||||
//-----------------------------------------------
|
||||
i = lstConfigs->getSelected();
|
||||
if (emulating)
|
||||
{
|
||||
uae_restart(-1, ConfigFilesList[i]->FullPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
target_cfgfile_load(&changed_prefs, ConfigFilesList[i]->FullPath, 0, 0);
|
||||
strncpy(last_active_config, ConfigFilesList[i]->Name, MAX_PATH);
|
||||
DisableResume();
|
||||
RefreshAllPanels();
|
||||
}
|
||||
}
|
||||
else if (actionEvent.getSource() == cmdSave)
|
||||
{
|
||||
//-----------------------------------------------
|
||||
// Save current configuration
|
||||
//-----------------------------------------------
|
||||
char filename[MAX_DPATH];
|
||||
if (!txtName->getText().empty())
|
||||
{
|
||||
fetch_configurationpath(filename, MAX_DPATH);
|
||||
strncat(filename, txtName->getText().c_str(), MAX_DPATH - 1);
|
||||
strncat(filename, ".uae", MAX_DPATH);
|
||||
strncpy(changed_prefs.description, txtDesc->getText().c_str(), 256);
|
||||
if (cfgfile_save(&changed_prefs, filename, 0))
|
||||
RefreshPanelConfig();
|
||||
}
|
||||
}
|
||||
else if (actionEvent.getSource() == cmdLoadFrom)
|
||||
{
|
||||
}
|
||||
else if (actionEvent.getSource() == cmdSaveAs)
|
||||
{
|
||||
}
|
||||
else if (actionEvent.getSource() == cmdDelete)
|
||||
{
|
||||
//-----------------------------------------------
|
||||
// Delete selected config
|
||||
//-----------------------------------------------
|
||||
char msg[256];
|
||||
i = lstConfigs->getSelected();
|
||||
if (i >= 0 && strcmp(ConfigFilesList[i]->Name, OPTIONSFILENAME))
|
||||
{
|
||||
snprintf(msg, 256, "Do you want to delete '%s' ?", ConfigFilesList[i]->Name);
|
||||
if (ShowMessage("Delete Configuration", msg, "", "Yes", "No"))
|
||||
{
|
||||
remove(ConfigFilesList[i]->FullPath);
|
||||
if (!strcmp(last_active_config, ConfigFilesList[i]->Name))
|
||||
{
|
||||
txtName->setText("");
|
||||
txtDesc->setText("");
|
||||
last_active_config[0] = '\0';
|
||||
}
|
||||
ConfigFilesList.erase(ConfigFilesList.begin() + i);
|
||||
RefreshPanelConfig();
|
||||
}
|
||||
cmdDelete->requestFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static ConfigButtonActionListener* configButtonActionListener;
|
||||
|
||||
|
||||
class ConfigsListActionListener : public gcn::ActionListener
|
||||
{
|
||||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent) override
|
||||
{
|
||||
const int selected_item = lstConfigs->getSelected();
|
||||
if (!txtName->getText().compare(ConfigFilesList[selected_item]->Name))
|
||||
{
|
||||
//-----------------------------------------------
|
||||
// Selected same config again -> load and start it
|
||||
//-----------------------------------------------
|
||||
if (emulating)
|
||||
{
|
||||
uae_restart(0, ConfigFilesList[selected_item]->FullPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
target_cfgfile_load(&changed_prefs, ConfigFilesList[selected_item]->FullPath, 0, 0);
|
||||
strncpy(last_active_config, ConfigFilesList[selected_item]->Name, MAX_PATH);
|
||||
DisableResume();
|
||||
RefreshAllPanels();
|
||||
uae_reset(0, 1);
|
||||
}
|
||||
gui_running = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtName->setText(ConfigFilesList[selected_item]->Name);
|
||||
txtDesc->setText(ConfigFilesList[selected_item]->Description);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static ConfigsListActionListener* configsListActionListener;
|
||||
|
||||
void InitPanelConfig(const struct _ConfigCategory& category)
|
||||
{
|
||||
configButtonActionListener = new ConfigButtonActionListener();
|
||||
|
||||
cmdLoad = new gcn::Button("Load");
|
||||
cmdLoad->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
cmdLoad->setBaseColor(gui_baseCol);
|
||||
cmdLoad->setId("ConfigLoad");
|
||||
cmdLoad->addActionListener(configButtonActionListener);
|
||||
|
||||
cmdSave = new gcn::Button("Save");
|
||||
cmdSave->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
cmdSave->setBaseColor(gui_baseCol);
|
||||
cmdSave->setId("ConfigSave");
|
||||
cmdSave->addActionListener(configButtonActionListener);
|
||||
|
||||
cmdLoadFrom = new gcn::Button("Load From...");
|
||||
cmdLoadFrom->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
cmdLoadFrom->setBaseColor(gui_baseCol);
|
||||
cmdLoadFrom->setId("CfgLoadFrom");
|
||||
cmdLoadFrom->addActionListener(configButtonActionListener);
|
||||
cmdLoadFrom->setEnabled(false);
|
||||
|
||||
cmdSaveAs = new gcn::Button("Save As...");
|
||||
cmdSaveAs->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
cmdSaveAs->setBaseColor(gui_baseCol);
|
||||
cmdSaveAs->setId("CfgSaveAs");
|
||||
cmdSaveAs->addActionListener(configButtonActionListener);
|
||||
cmdSaveAs->setEnabled(false);
|
||||
|
||||
cmdDelete = new gcn::Button("Delete");
|
||||
cmdDelete->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
cmdDelete->setBaseColor(gui_baseCol);
|
||||
cmdDelete->setId("CfgDelete");
|
||||
cmdDelete->addActionListener(configButtonActionListener);
|
||||
|
||||
int buttonX = DISTANCE_BORDER;
|
||||
int buttonY = category.panel->getHeight() - DISTANCE_BORDER - BUTTON_HEIGHT;
|
||||
category.panel->add(cmdLoad, buttonX, buttonY);
|
||||
buttonX += BUTTON_WIDTH + DISTANCE_NEXT_X;
|
||||
category.panel->add(cmdSave, buttonX, buttonY);
|
||||
buttonX += BUTTON_WIDTH + 3 * DISTANCE_NEXT_X;
|
||||
buttonX += BUTTON_WIDTH + DISTANCE_NEXT_X;
|
||||
buttonX = category.panel->getWidth() - DISTANCE_BORDER - BUTTON_WIDTH;
|
||||
category.panel->add(cmdDelete, buttonX, buttonY);
|
||||
|
||||
lblName = new gcn::Label("Name:");
|
||||
lblName->setSize(lblName->getWidth(), lblName->getHeight());
|
||||
lblName->setAlignment(gcn::Graphics::RIGHT);
|
||||
txtName = new gcn::TextField();
|
||||
txtName->setSize(300, txtName->getHeight());
|
||||
txtName->setId("ConfigName");
|
||||
txtName->setBackgroundColor(colTextboxBackground);
|
||||
|
||||
lblDesc = new gcn::Label("Description:");
|
||||
lblDesc->setSize(lblDesc->getWidth(), lblDesc->getHeight());
|
||||
lblDesc->setAlignment(gcn::Graphics::RIGHT);
|
||||
txtDesc = new gcn::TextField();
|
||||
txtDesc->setSize(300, txtDesc->getHeight());
|
||||
txtDesc->setId("ConfigDesc");
|
||||
txtDesc->setBackgroundColor(colTextboxBackground);
|
||||
|
||||
ReadConfigFileList();
|
||||
configsList = new ConfigsListModel();
|
||||
configsList->InitConfigsList();
|
||||
configsListActionListener = new ConfigsListActionListener();
|
||||
|
||||
lstConfigs = new gcn::UaeListBox(configsList);
|
||||
lstConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 22, 232);
|
||||
lstConfigs->setBackgroundColor(colTextboxBackground);
|
||||
lstConfigs->setWrappingEnabled(true);
|
||||
lstConfigs->setId("ConfigList");
|
||||
lstConfigs->addActionListener(configsListActionListener);
|
||||
|
||||
scrAreaConfigs = new gcn::ScrollArea(lstConfigs);
|
||||
scrAreaConfigs->setBorderSize(1);
|
||||
scrAreaConfigs->setPosition(DISTANCE_BORDER, DISTANCE_BORDER);
|
||||
scrAreaConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 2, 252);
|
||||
scrAreaConfigs->setScrollbarWidth(20);
|
||||
scrAreaConfigs->setBackgroundColor(colTextboxBackground);
|
||||
category.panel->add(scrAreaConfigs);
|
||||
|
||||
category.panel->add(lblName, DISTANCE_BORDER, scrAreaConfigs->getY() + scrAreaConfigs->getHeight() + DISTANCE_NEXT_Y);
|
||||
category.panel->add(txtName, DISTANCE_BORDER + lblDesc->getWidth() + 8, scrAreaConfigs->getY() + scrAreaConfigs->getHeight() + DISTANCE_NEXT_Y);
|
||||
category.panel->add(lblDesc, DISTANCE_BORDER, lblName->getY() + lblName->getHeight() + DISTANCE_NEXT_Y);
|
||||
category.panel->add(txtDesc, DISTANCE_BORDER + lblDesc->getWidth() + 8, txtName->getY() + txtName->getHeight() + DISTANCE_NEXT_Y);
|
||||
|
||||
if (strlen(last_active_config) == 0)
|
||||
strncpy(last_active_config, OPTIONSFILENAME, MAX_PATH);
|
||||
txtName->setText(last_active_config);
|
||||
txtDesc->setText(changed_prefs.description);
|
||||
ensureVisible = -1;
|
||||
RefreshPanelConfig();
|
||||
}
|
||||
|
||||
void ExitPanelConfig()
|
||||
{
|
||||
delete lstConfigs;
|
||||
delete scrAreaConfigs;
|
||||
delete configsListActionListener;
|
||||
delete configsList;
|
||||
|
||||
delete cmdLoad;
|
||||
delete cmdSave;
|
||||
delete cmdLoadFrom;
|
||||
delete cmdSaveAs;
|
||||
delete cmdDelete;
|
||||
|
||||
delete configButtonActionListener;
|
||||
|
||||
delete lblName;
|
||||
delete txtName;
|
||||
delete lblDesc;
|
||||
delete txtDesc;
|
||||
}
|
||||
|
||||
static void MakeCurrentVisible()
|
||||
{
|
||||
if (ensureVisible >= 0)
|
||||
{
|
||||
scrAreaConfigs->setVerticalScrollAmount(ensureVisible * 19);
|
||||
ensureVisible = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void RefreshPanelConfig()
|
||||
{
|
||||
ReadConfigFileList();
|
||||
configsList->InitConfigsList();
|
||||
|
||||
// Search current entry
|
||||
if (!txtName->getText().empty())
|
||||
{
|
||||
for (int i = 0; i < ConfigFilesList.size(); ++i)
|
||||
{
|
||||
if (!_tcscmp(ConfigFilesList[i]->Name, txtName->getText().c_str()))
|
||||
{
|
||||
// Select current entry
|
||||
lstConfigs->setSelected(i);
|
||||
ensureVisible = i;
|
||||
RegisterRefreshFunc(MakeCurrentVisible);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool HelpPanelConfig(std::vector<std::string> &helptext)
|
||||
{
|
||||
helptext.clear();
|
||||
helptext.push_back("To load a configuration, select the entry in the list and then click on \"Load\". If you doubleclick on an entry");
|
||||
helptext.push_back("in the list, the emulation starts with this configuration.");
|
||||
helptext.push_back("");
|
||||
helptext.push_back("If you want to create a new configuration, setup all options, enter a new name in \"Name\", provide a short");
|
||||
helptext.push_back("description and then click on \"Save\".");
|
||||
helptext.push_back("");
|
||||
helptext.push_back("\"Delete\" will delete the selected configuration.");
|
||||
return true;
|
||||
}
|
||||
bool HelpPanelConfig(std::vector<std::string> &helptext)
|
||||
{
|
||||
helptext.clear();
|
||||
helptext.push_back("To load a configuration, select the entry in the list and then click on \"Load\". If you doubleclick on an entry");
|
||||
helptext.push_back("in the list, the emulation starts with this configuration.");
|
||||
helptext.push_back("");
|
||||
helptext.push_back("If you want to create a new configuration, setup all options, enter a new name in \"Name\", provide a short");
|
||||
helptext.push_back("description and then click on \"Save\".");
|
||||
helptext.push_back("");
|
||||
helptext.push_back("\"Delete\" will delete the selected configuration.");
|
||||
return true;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -170,7 +170,7 @@ public:
|
|||
//---------------------------------------
|
||||
// Show info about current disk-image
|
||||
//---------------------------------------
|
||||
if (changed_prefs.floppyslots[i].dfxtype != DRV_NONE && strlen(changed_prefs.floppyslots[i].df) > 0); // ToDo: Show info dialog
|
||||
//if (changed_prefs.floppyslots[i].dfxtype != DRV_NONE && strlen(changed_prefs.floppyslots[i].df) > 0); // ToDo: Show info dialog
|
||||
//ToDo: Show info dialog
|
||||
}
|
||||
else if (actionEvent.getSource() == cmdDFxEject[i])
|
||||
|
@ -237,7 +237,7 @@ public:
|
|||
//---------------------------------------
|
||||
if (!bIgnoreListChange)
|
||||
{
|
||||
int idx = cboDFxFile[i]->getSelected();
|
||||
const int idx = cboDFxFile[i]->getSelected();
|
||||
|
||||
if (idx < 0)
|
||||
{
|
||||
|
@ -372,7 +372,7 @@ void InitPanelFloppy(const struct _ConfigCategory& category)
|
|||
int posX;
|
||||
int posY = DISTANCE_BORDER;
|
||||
int i;
|
||||
int textFieldWidth = category.panel->getWidth() - 2 * DISTANCE_BORDER - SMALL_BUTTON_WIDTH - DISTANCE_NEXT_X;
|
||||
const int textFieldWidth = category.panel->getWidth() - 2 * DISTANCE_BORDER - SMALL_BUTTON_WIDTH - DISTANCE_NEXT_X;
|
||||
|
||||
dfxCheckActionListener = new DFxCheckActionListener();
|
||||
driveTypeActionListener = new DriveTypeActionListener();
|
||||
|
@ -571,7 +571,7 @@ void RefreshPanelFloppy()
|
|||
changed_prefs.nr_floppies = 0;
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
bool driveEnabled = changed_prefs.floppyslots[i].dfxtype != DRV_NONE;
|
||||
const bool driveEnabled = changed_prefs.floppyslots[i].dfxtype != DRV_NONE;
|
||||
chkDFx[i]->setSelected(driveEnabled);
|
||||
cboDFxType[i]->setSelected(changed_prefs.floppyslots[i].dfxtype + 1);
|
||||
chkDFxWriteProtect[i]->setSelected(disk_getwriteprotect(&changed_prefs, changed_prefs.floppyslots[i].df));
|
||||
|
|
|
@ -111,7 +111,7 @@ class StringListModel : public gcn::ListModel
|
|||
private:
|
||||
std::vector<std::string> values;
|
||||
public:
|
||||
StringListModel(const char* entries[], int count)
|
||||
StringListModel(const char* entries[], const int count)
|
||||
{
|
||||
for (int i = 0; i < count; ++i)
|
||||
values.push_back(entries[i]);
|
||||
|
@ -128,7 +128,7 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
string getElementAt(int i) override
|
||||
string getElementAt(const int i) override
|
||||
{
|
||||
if (i < 0 || i >= values.size())
|
||||
return "---";
|
||||
|
@ -210,7 +210,7 @@ static int GetAmigaKeyIndex(int key)
|
|||
class InputActionListener : public gcn::ActionListener
|
||||
{
|
||||
public:
|
||||
void clear_ports(const int sel, const int current_port)
|
||||
static void clear_ports(const int sel, const int current_port)
|
||||
{
|
||||
for (auto i = 0; i < MAX_JPORTS; i++)
|
||||
{
|
||||
|
@ -553,7 +553,7 @@ void InitPanelInput(const struct _ConfigCategory& category)
|
|||
#endif
|
||||
|
||||
inputActionListener = new InputActionListener();
|
||||
int textFieldWidth = category.panel->getWidth() - 2 * DISTANCE_BORDER - SMALL_BUTTON_WIDTH - DISTANCE_NEXT_X * 2;
|
||||
const int textFieldWidth = category.panel->getWidth() - 2 * DISTANCE_BORDER - SMALL_BUTTON_WIDTH - DISTANCE_NEXT_X * 2;
|
||||
const int mode_length = 80;
|
||||
const int port_lbl_length = 120;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class StringListModel : public gcn::ListModel
|
|||
{
|
||||
vector<string> values;
|
||||
public:
|
||||
StringListModel(const char* entries[], int count)
|
||||
StringListModel(const char* entries[], const int count)
|
||||
{
|
||||
for (int i = 0; i < count; ++i)
|
||||
values.push_back(entries[i]);
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
#include "gui_handling.h"
|
||||
|
||||
|
||||
static gcn::Label *lblModel;
|
||||
static gcn::Label* lblModel;
|
||||
static gcn::UaeDropDown* cboModel;
|
||||
static gcn::Label *lblConfig;
|
||||
static gcn::Label* lblConfig;
|
||||
static gcn::UaeDropDown* cboConfig;
|
||||
static gcn::UaeCheckBox* chkNTSC;
|
||||
|
||||
|
@ -42,48 +42,68 @@ static gcn::UaeDropDown* cboCDFile;
|
|||
static gcn::UaeCheckBox* chkQuickstartMode;
|
||||
|
||||
|
||||
struct amigamodels {
|
||||
struct amigamodels
|
||||
{
|
||||
int compalevels;
|
||||
char name[32];
|
||||
char configs[8][128];
|
||||
};
|
||||
|
||||
static struct amigamodels amodels[] = {
|
||||
{ 4, "Amiga 500", {
|
||||
"1.3 ROM, OCS, 512 KB Chip + 512 KB Slow RAM (most common)",
|
||||
"1.3 ROM, ECS Agnus, 512 KB Chip RAM + 512 KB Slow RAM",
|
||||
"1.3 ROM, ECS Agnus, 1 MB Chip RAM",
|
||||
"1.3 ROM, OCS Agnus, 512 KB Chip RAM",
|
||||
"1.2 ROM, OCS Agnus, 512 KB Chip RAM",
|
||||
"1.2 ROM, OCS Agnus, 512 KB Chip RAM + 512 KB Slow RAM",
|
||||
"\0" } },
|
||||
{ 4, "Amiga 500+", {
|
||||
"Basic non-expanded configuration",
|
||||
"2 MB Chip RAM expanded configuration",
|
||||
"4 MB Fast RAM expanded configuration",
|
||||
"\0" } },
|
||||
{ 4, "Amiga 600", {
|
||||
"Basic non-expanded configuration",
|
||||
"2 MB Chip RAM expanded configuration",
|
||||
"4 MB Fast RAM expanded configuration",
|
||||
"\0" } },
|
||||
{ 4, "Amiga 1200", {
|
||||
"Basic non-expanded configuration",
|
||||
"4 MB Fast RAM expanded configuration",
|
||||
"\0" } },
|
||||
// { 2, "Amiga 3000", {
|
||||
// "1.4 ROM, 2MB Chip + 8MB Fast",
|
||||
// "2.04 ROM, 2MB Chip + 8MB Fast",
|
||||
// "3.1 ROM, 2MB Chip + 8MB Fast",
|
||||
// "\0" } },
|
||||
{ 1, "Amiga 4000", {
|
||||
"68030, 3.1 ROM, 2MB Chip + 8MB Fast",
|
||||
"68040, 3.1 ROM, 2MB Chip + 8MB Fast",
|
||||
"\0" } },
|
||||
{ 3, "CD32", {
|
||||
"CD32",
|
||||
"CD32 with Full Motion Video cartridge",
|
||||
"\0" } },
|
||||
{ -1 }
|
||||
{
|
||||
4, "Amiga 500", {
|
||||
"1.3 ROM, OCS, 512 KB Chip + 512 KB Slow RAM (most common)",
|
||||
"1.3 ROM, ECS Agnus, 512 KB Chip RAM + 512 KB Slow RAM",
|
||||
"1.3 ROM, ECS Agnus, 1 MB Chip RAM",
|
||||
"1.3 ROM, OCS Agnus, 512 KB Chip RAM",
|
||||
"1.2 ROM, OCS Agnus, 512 KB Chip RAM",
|
||||
"1.2 ROM, OCS Agnus, 512 KB Chip RAM + 512 KB Slow RAM",
|
||||
"\0"
|
||||
}
|
||||
},
|
||||
{
|
||||
4, "Amiga 500+", {
|
||||
"Basic non-expanded configuration",
|
||||
"2 MB Chip RAM expanded configuration",
|
||||
"4 MB Fast RAM expanded configuration",
|
||||
"\0"
|
||||
}
|
||||
},
|
||||
{
|
||||
4, "Amiga 600", {
|
||||
"Basic non-expanded configuration",
|
||||
"2 MB Chip RAM expanded configuration",
|
||||
"4 MB Fast RAM expanded configuration",
|
||||
"\0"
|
||||
}
|
||||
},
|
||||
{
|
||||
4, "Amiga 1200", {
|
||||
"Basic non-expanded configuration",
|
||||
"4 MB Fast RAM expanded configuration",
|
||||
"\0"
|
||||
}
|
||||
},
|
||||
// { 2, "Amiga 3000", {
|
||||
// "1.4 ROM, 2MB Chip + 8MB Fast",
|
||||
// "2.04 ROM, 2MB Chip + 8MB Fast",
|
||||
// "3.1 ROM, 2MB Chip + 8MB Fast",
|
||||
// "\0" } },
|
||||
{
|
||||
1, "Amiga 4000", {
|
||||
"68030, 3.1 ROM, 2MB Chip + 8MB Fast",
|
||||
"68040, 3.1 ROM, 2MB Chip + 8MB Fast",
|
||||
"\0"
|
||||
}
|
||||
},
|
||||
{
|
||||
3, "CD32", {
|
||||
"CD32",
|
||||
"CD32 with Full Motion Video cartridge",
|
||||
"\0"
|
||||
}
|
||||
},
|
||||
{-1}
|
||||
};
|
||||
|
||||
static const int numModels = 6;
|
||||
|
@ -91,16 +111,18 @@ static int numModelConfigs = 0;
|
|||
static bool bIgnoreListChange = true;
|
||||
|
||||
|
||||
static const char *diskfile_filter[] = { ".adf", ".adz", ".fdi", ".zip", ".dms", ".gz", ".xz", "\0" };
|
||||
static const char *cdfile_filter[] = { ".cue", ".ccd", ".iso", "\0" };
|
||||
static const char* diskfile_filter[] = {".adf", ".adz", ".fdi", ".zip", ".dms", ".gz", ".xz", "\0"};
|
||||
static const char* cdfile_filter[] = {".cue", ".ccd", ".iso", "\0"};
|
||||
|
||||
static void AdjustDropDownControls(void);
|
||||
|
||||
static void CountModelConfigs(void)
|
||||
{
|
||||
numModelConfigs = 0;
|
||||
if (quickstart_model >= 0 && quickstart_model < numModels) {
|
||||
for (int i = 0; i<8; ++i) {
|
||||
if (quickstart_model >= 0 && quickstart_model < numModels)
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
if (amodels[quickstart_model].configs[i][0] == '\0')
|
||||
break;
|
||||
++numModelConfigs;
|
||||
|
@ -109,13 +131,14 @@ static void CountModelConfigs(void)
|
|||
}
|
||||
|
||||
|
||||
static void SetControlState(int model)
|
||||
static void SetControlState(const int model)
|
||||
{
|
||||
bool df1Visible = true;
|
||||
bool cdVisible = false;
|
||||
bool df0Editable = true;
|
||||
|
||||
switch (model) {
|
||||
switch (model)
|
||||
{
|
||||
case 0: // A500
|
||||
case 1: // A500+
|
||||
case 2: // A600
|
||||
|
@ -124,11 +147,13 @@ static void SetControlState(int model)
|
|||
break;
|
||||
|
||||
case 5: // CD32
|
||||
// No floppy drive available, CD available
|
||||
// No floppy drive available, CD available
|
||||
df0Editable = false;
|
||||
df1Visible = false;
|
||||
cdVisible = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
chkDFxWriteProtect[0]->setEnabled(df0Editable && !changed_prefs.floppy_read_only);
|
||||
|
@ -153,16 +178,17 @@ static void SetControlState(int model)
|
|||
|
||||
static void AdjustPrefs(void)
|
||||
{
|
||||
int old_cs = changed_prefs.cs_compatible;
|
||||
const int old_cs = changed_prefs.cs_compatible;
|
||||
|
||||
built_in_prefs(&changed_prefs, quickstart_model, quickstart_conf, 0, 0);
|
||||
switch (quickstart_model) {
|
||||
switch (quickstart_model)
|
||||
{
|
||||
case 0: // A500
|
||||
case 1: // A500+
|
||||
case 2: // A600
|
||||
case 3: // A1200
|
||||
case 4: // A4000
|
||||
// df0 always active
|
||||
// df0 always active
|
||||
changed_prefs.floppyslots[0].dfxtype = DRV_35_DD;
|
||||
|
||||
// No CD available
|
||||
|
@ -171,22 +197,25 @@ static void AdjustPrefs(void)
|
|||
break;
|
||||
|
||||
case 5: // CD32
|
||||
// No floppy drive available, CD available
|
||||
// No floppy drive available, CD available
|
||||
changed_prefs.floppyslots[0].dfxtype = DRV_NONE;
|
||||
changed_prefs.floppyslots[1].dfxtype = DRV_NONE;
|
||||
changed_prefs.cdslots[0].inuse = true;
|
||||
changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (emulating && old_cs != changed_prefs.cs_compatible)
|
||||
uae_restart(-1, NULL);
|
||||
uae_restart(-1, nullptr);
|
||||
}
|
||||
|
||||
|
||||
static void SetModelFromConfig(void)
|
||||
{
|
||||
switch (changed_prefs.cs_compatible) {
|
||||
switch (changed_prefs.cs_compatible)
|
||||
{
|
||||
case CP_A500:
|
||||
quickstart_model = 0;
|
||||
if (changed_prefs.chipset_mask == 0)
|
||||
|
@ -266,13 +295,14 @@ public:
|
|||
return numModels;
|
||||
}
|
||||
|
||||
std::string getElementAt(int i) override
|
||||
string getElementAt(int i) override
|
||||
{
|
||||
if (i < 0 || i >= numModels)
|
||||
return "---";
|
||||
return amodels[i].name;
|
||||
}
|
||||
};
|
||||
|
||||
static AmigaModelListModel amigaModelList;
|
||||
|
||||
|
||||
|
@ -288,13 +318,14 @@ public:
|
|||
return numModelConfigs;
|
||||
}
|
||||
|
||||
std::string getElementAt(int i) override
|
||||
string getElementAt(const int i) override
|
||||
{
|
||||
if (quickstart_model < 0 || i < 0 || i >= numModelConfigs)
|
||||
return "---";
|
||||
return amodels[quickstart_model].configs[i];
|
||||
}
|
||||
};
|
||||
|
||||
static AmigaConfigListModel amigaConfigList;
|
||||
|
||||
|
||||
|
@ -310,13 +341,14 @@ public:
|
|||
return lstMRUDiskList.size();
|
||||
}
|
||||
|
||||
std::string getElementAt(int i) override
|
||||
string getElementAt(const int i) override
|
||||
{
|
||||
if (i < 0 || i >= lstMRUDiskList.size())
|
||||
return "---";
|
||||
return lstMRUDiskList[i];
|
||||
}
|
||||
};
|
||||
|
||||
static QSDiskfileListModel diskfileList;
|
||||
|
||||
|
||||
|
@ -332,13 +364,14 @@ public:
|
|||
return lstMRUCDList.size();
|
||||
}
|
||||
|
||||
std::string getElementAt(int i) override
|
||||
string getElementAt(const int i) override
|
||||
{
|
||||
if (i < 0 || i >= lstMRUCDList.size())
|
||||
return "---";
|
||||
return lstMRUCDList[i];
|
||||
}
|
||||
};
|
||||
|
||||
static QSCDfileListModel cdfileList;
|
||||
|
||||
|
||||
|
@ -347,14 +380,16 @@ class QSCDButtonActionListener : public gcn::ActionListener
|
|||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent) override
|
||||
{
|
||||
if (actionEvent.getSource() == cmdCDEject) {
|
||||
if (actionEvent.getSource() == cmdCDEject)
|
||||
{
|
||||
//---------------------------------------
|
||||
// Eject CD from drive
|
||||
//---------------------------------------
|
||||
strncpy(changed_prefs.cdslots[0].name, "", MAX_DPATH);
|
||||
AdjustDropDownControls();
|
||||
}
|
||||
else if (actionEvent.getSource() == cmdCDSelect) {
|
||||
else if (actionEvent.getSource() == cmdCDSelect)
|
||||
{
|
||||
char tmp[MAX_DPATH];
|
||||
|
||||
if (strlen(changed_prefs.cdslots[0].name) > 0)
|
||||
|
@ -381,6 +416,7 @@ public:
|
|||
RefreshPanelQuickstart();
|
||||
}
|
||||
};
|
||||
|
||||
static QSCDButtonActionListener* cdButtonActionListener;
|
||||
|
||||
|
||||
|
@ -392,17 +428,21 @@ public:
|
|||
//---------------------------------------
|
||||
// CD image from list selected
|
||||
//---------------------------------------
|
||||
if (!bIgnoreListChange) {
|
||||
int idx = cboCDFile->getSelected();
|
||||
if (!bIgnoreListChange)
|
||||
{
|
||||
const int idx = cboCDFile->getSelected();
|
||||
|
||||
if (idx < 0) {
|
||||
if (idx < 0)
|
||||
{
|
||||
strncpy(changed_prefs.cdslots[0].name, "", MAX_DPATH);
|
||||
AdjustDropDownControls();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (cdfileList.getElementAt(idx).compare(changed_prefs.cdslots[0].name))
|
||||
{
|
||||
strncpy(changed_prefs.cdslots[0].name, cdfileList.getElementAt(idx).c_str(), sizeof(changed_prefs.cdslots[0].name));
|
||||
strncpy(changed_prefs.cdslots[0].name, cdfileList.getElementAt(idx).c_str(),
|
||||
sizeof(changed_prefs.cdslots[0].name));
|
||||
changed_prefs.cdslots[0].inuse = true;
|
||||
changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE;
|
||||
lstMRUCDList.erase(lstMRUCDList.begin() + idx);
|
||||
|
@ -417,6 +457,7 @@ public:
|
|||
RefreshPanelQuickstart();
|
||||
}
|
||||
};
|
||||
|
||||
static QSCDFileActionListener* cdFileActionListener;
|
||||
|
||||
|
||||
|
@ -425,12 +466,15 @@ class AmigaModelActionListener : public gcn::ActionListener
|
|||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent) override
|
||||
{
|
||||
if (!bIgnoreListChange) {
|
||||
if (actionEvent.getSource() == cboModel) {
|
||||
if (!bIgnoreListChange)
|
||||
{
|
||||
if (actionEvent.getSource() == cboModel)
|
||||
{
|
||||
//---------------------------------------
|
||||
// Amiga model selected
|
||||
//---------------------------------------
|
||||
if (quickstart_model != cboModel->getSelected()) {
|
||||
if (quickstart_model != cboModel->getSelected())
|
||||
{
|
||||
quickstart_model = cboModel->getSelected();
|
||||
CountModelConfigs();
|
||||
cboConfig->setSelected(0);
|
||||
|
@ -439,11 +483,13 @@ public:
|
|||
DisableResume();
|
||||
}
|
||||
}
|
||||
else if (actionEvent.getSource() == cboConfig) {
|
||||
else if (actionEvent.getSource() == cboConfig)
|
||||
{
|
||||
//---------------------------------------
|
||||
// Model configuration selected
|
||||
//---------------------------------------
|
||||
if (quickstart_conf != cboConfig->getSelected()) {
|
||||
if (quickstart_conf != cboConfig->getSelected())
|
||||
{
|
||||
quickstart_conf = cboConfig->getSelected();
|
||||
AdjustPrefs();
|
||||
}
|
||||
|
@ -452,6 +498,7 @@ public:
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
static AmigaModelActionListener* amigaModelActionListener;
|
||||
|
||||
|
||||
|
@ -460,17 +507,20 @@ class QSNTSCButtonActionListener : public gcn::ActionListener
|
|||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent) override
|
||||
{
|
||||
if (chkNTSC->isSelected()) {
|
||||
if (chkNTSC->isSelected())
|
||||
{
|
||||
changed_prefs.ntscmode = true;
|
||||
changed_prefs.chipset_refreshrate = 60;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
changed_prefs.ntscmode = false;
|
||||
changed_prefs.chipset_refreshrate = 50;
|
||||
}
|
||||
RefreshPanelChipset();
|
||||
}
|
||||
};
|
||||
|
||||
static QSNTSCButtonActionListener* ntscButtonActionListener;
|
||||
|
||||
|
||||
|
@ -479,8 +529,10 @@ class QSDFxCheckActionListener : public gcn::ActionListener
|
|||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent) override
|
||||
{
|
||||
for (int i = 0; i<2; ++i) {
|
||||
if (actionEvent.getSource() == chkDFx[i]) {
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (actionEvent.getSource() == chkDFx[i])
|
||||
{
|
||||
//---------------------------------------
|
||||
// Drive enabled/disabled
|
||||
//---------------------------------------
|
||||
|
@ -489,14 +541,17 @@ public:
|
|||
else
|
||||
changed_prefs.floppyslots[i].dfxtype = DRV_NONE;
|
||||
}
|
||||
else if (actionEvent.getSource() == chkDFxWriteProtect[i]) {
|
||||
else if (actionEvent.getSource() == chkDFxWriteProtect[i])
|
||||
{
|
||||
//---------------------------------------
|
||||
// Write-protect changed
|
||||
//---------------------------------------
|
||||
disk_setwriteprotect(&changed_prefs, i, changed_prefs.floppyslots[i].df, chkDFxWriteProtect[i]->isSelected());
|
||||
if (disk_getwriteprotect(&changed_prefs, changed_prefs.floppyslots[i].df) != chkDFxWriteProtect[i]->isSelected()) {
|
||||
if (disk_getwriteprotect(&changed_prefs, changed_prefs.floppyslots[i].df) != chkDFxWriteProtect[i]->isSelected())
|
||||
{
|
||||
// Failed to change write protection -> maybe filesystem doesn't support this
|
||||
ShowMessage("Set/Clear write protect", "Failed to change write permission.", "Maybe underlying filesystem doesn't support this.", "Ok", "");
|
||||
ShowMessage("Set/Clear write protect", "Failed to change write permission.",
|
||||
"Maybe underlying filesystem doesn't support this.", "Ok", "");
|
||||
}
|
||||
DISK_reinsert(i);
|
||||
}
|
||||
|
@ -506,6 +561,7 @@ public:
|
|||
RefreshPanelQuickstart();
|
||||
}
|
||||
};
|
||||
|
||||
static QSDFxCheckActionListener* dfxCheckActionListener;
|
||||
|
||||
|
||||
|
@ -514,15 +570,18 @@ class QSDFxButtonActionListener : public gcn::ActionListener
|
|||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent) override
|
||||
{
|
||||
for (int i = 0; i<2; ++i) {
|
||||
if (actionEvent.getSource() == cmdDFxInfo[i]) {
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (actionEvent.getSource() == cmdDFxInfo[i])
|
||||
{
|
||||
//---------------------------------------
|
||||
// Show info about current disk-image
|
||||
//---------------------------------------
|
||||
if (changed_prefs.floppyslots[i].dfxtype != DRV_NONE && strlen(changed_prefs.floppyslots[i].df) > 0)
|
||||
; // ToDo: Show info dialog
|
||||
//if (changed_prefs.floppyslots[i].dfxtype != DRV_NONE && strlen(changed_prefs.floppyslots[i].df) > 0);
|
||||
// ToDo: Show info dialog
|
||||
}
|
||||
else if (actionEvent.getSource() == cmdDFxEject[i]) {
|
||||
else if (actionEvent.getSource() == cmdDFxEject[i])
|
||||
{
|
||||
//---------------------------------------
|
||||
// Eject disk from drive
|
||||
//---------------------------------------
|
||||
|
@ -530,7 +589,8 @@ public:
|
|||
strncpy(changed_prefs.floppyslots[i].df, "", MAX_DPATH);
|
||||
AdjustDropDownControls();
|
||||
}
|
||||
else if (actionEvent.getSource() == cmdDFxSelect[i]) {
|
||||
else if (actionEvent.getSource() == cmdDFxSelect[i])
|
||||
{
|
||||
//---------------------------------------
|
||||
// Select disk for drive
|
||||
//---------------------------------------
|
||||
|
@ -560,6 +620,7 @@ public:
|
|||
RefreshPanelQuickstart();
|
||||
}
|
||||
};
|
||||
|
||||
static QSDFxButtonActionListener* dfxButtonActionListener;
|
||||
|
||||
|
||||
|
@ -568,22 +629,29 @@ class QSDiskFileActionListener : public gcn::ActionListener
|
|||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent) override
|
||||
{
|
||||
for (int i = 0; i<2; ++i) {
|
||||
if (actionEvent.getSource() == cboDFxFile[i]) {
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (actionEvent.getSource() == cboDFxFile[i])
|
||||
{
|
||||
//---------------------------------------
|
||||
// Diskimage from list selected
|
||||
//---------------------------------------
|
||||
if (!bIgnoreListChange) {
|
||||
int idx = cboDFxFile[i]->getSelected();
|
||||
if (!bIgnoreListChange)
|
||||
{
|
||||
const int idx = cboDFxFile[i]->getSelected();
|
||||
|
||||
if (idx < 0) {
|
||||
if (idx < 0)
|
||||
{
|
||||
disk_eject(i);
|
||||
strncpy(changed_prefs.floppyslots[i].df, "", MAX_DPATH);
|
||||
AdjustDropDownControls();
|
||||
}
|
||||
else {
|
||||
if (diskfileList.getElementAt(idx).compare(changed_prefs.floppyslots[i].df)) {
|
||||
strncpy(changed_prefs.floppyslots[i].df, diskfileList.getElementAt(idx).c_str(), sizeof(changed_prefs.floppyslots[i].df));
|
||||
else
|
||||
{
|
||||
if (diskfileList.getElementAt(idx).compare(changed_prefs.floppyslots[i].df))
|
||||
{
|
||||
strncpy(changed_prefs.floppyslots[i].df, diskfileList.getElementAt(idx).c_str(),
|
||||
sizeof(changed_prefs.floppyslots[i].df));
|
||||
disk_insert(i, changed_prefs.floppyslots[i].df);
|
||||
lstMRUDiskList.erase(lstMRUDiskList.begin() + idx);
|
||||
lstMRUDiskList.insert(lstMRUDiskList.begin(), changed_prefs.floppyslots[i].df);
|
||||
|
@ -599,6 +667,7 @@ public:
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
static QSDiskFileActionListener* diskFileActionListener;
|
||||
|
||||
|
||||
|
@ -610,12 +679,12 @@ public:
|
|||
quickstart_start = chkQuickstartMode->isSelected();
|
||||
}
|
||||
};
|
||||
|
||||
static QuickstartModeActionListener* quickstartModeActionListener;
|
||||
|
||||
|
||||
void InitPanelQuickstart(const struct _ConfigCategory& category)
|
||||
{
|
||||
int posX;
|
||||
int posY = DISTANCE_BORDER;
|
||||
int i;
|
||||
|
||||
|
@ -650,7 +719,7 @@ void InitPanelQuickstart(const struct _ConfigCategory& category)
|
|||
chkNTSC->setId("qsNTSC");
|
||||
chkNTSC->addActionListener(ntscButtonActionListener);
|
||||
|
||||
for (i = 0; i<2; ++i)
|
||||
for (i = 0; i < 2; ++i)
|
||||
{
|
||||
char tmp[20];
|
||||
snprintf(tmp, 20, "DF%d:", i);
|
||||
|
@ -727,9 +796,9 @@ void InitPanelQuickstart(const struct _ConfigCategory& category)
|
|||
category.panel->add(cboConfig, DISTANCE_BORDER + lblConfig->getWidth() + 8, posY);
|
||||
posY += cboConfig->getHeight() + DISTANCE_NEXT_Y;
|
||||
|
||||
for (i = 0; i<2; ++i)
|
||||
for (i = 0; i < 2; ++i)
|
||||
{
|
||||
posX = DISTANCE_BORDER;
|
||||
int posX = DISTANCE_BORDER;
|
||||
category.panel->add(chkDFx[i], posX, posY);
|
||||
posX += 180;
|
||||
category.panel->add(chkDFxWriteProtect[i], posX, posY);
|
||||
|
@ -750,7 +819,8 @@ void InitPanelQuickstart(const struct _ConfigCategory& category)
|
|||
category.panel->add(cmdCDSelect, cmdDFxSelect[1]->getX(), cmdDFxSelect[1]->getY());
|
||||
category.panel->add(cboCDFile, cboDFxFile[1]->getX(), cboDFxFile[1]->getY());
|
||||
|
||||
category.panel->add(chkQuickstartMode, category.panel->getWidth() - chkQuickstartMode->getWidth() - DISTANCE_BORDER, posY);
|
||||
category.panel->add(chkQuickstartMode, category.panel->getWidth() - chkQuickstartMode->getWidth() - DISTANCE_BORDER,
|
||||
posY);
|
||||
posY += chkQuickstartMode->getHeight() + DISTANCE_NEXT_Y;
|
||||
|
||||
chkCD->setVisible(false);
|
||||
|
@ -778,7 +848,7 @@ void ExitPanelQuickstart(void)
|
|||
delete lblConfig;
|
||||
delete cboConfig;
|
||||
delete chkNTSC;
|
||||
for (int i = 0; i<2; ++i)
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
delete chkDFx[i];
|
||||
delete chkDFxWriteProtect[i];
|
||||
|
@ -810,13 +880,13 @@ static void AdjustDropDownControls(void)
|
|||
|
||||
bIgnoreListChange = true;
|
||||
|
||||
for (i = 0; i<2; ++i)
|
||||
for (i = 0; i < 2; ++i)
|
||||
{
|
||||
cboDFxFile[i]->clearSelected();
|
||||
|
||||
if (changed_prefs.floppyslots[i].dfxtype != DRV_NONE && strlen(changed_prefs.floppyslots[i].df) > 0)
|
||||
{
|
||||
for (int j = 0; j<lstMRUDiskList.size(); ++j)
|
||||
for (int j = 0; j < lstMRUDiskList.size(); ++j)
|
||||
{
|
||||
if (!lstMRUDiskList[j].compare(changed_prefs.floppyslots[i].df))
|
||||
{
|
||||
|
@ -853,10 +923,11 @@ void RefreshPanelQuickstart(void)
|
|||
AdjustDropDownControls();
|
||||
|
||||
changed_prefs.nr_floppies = 0;
|
||||
for (int i = 0; i<4; ++i)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
bool driveEnabled = changed_prefs.floppyslots[i].dfxtype != DRV_NONE;
|
||||
if (i < 2) {
|
||||
const bool driveEnabled = changed_prefs.floppyslots[i].dfxtype != DRV_NONE;
|
||||
if (i < 2)
|
||||
{
|
||||
chkDFx[i]->setSelected(driveEnabled);
|
||||
chkDFxWriteProtect[i]->setSelected(disk_getwriteprotect(&changed_prefs, changed_prefs.floppyslots[i].df));
|
||||
if (i == 0)
|
||||
|
@ -884,15 +955,17 @@ void RefreshPanelQuickstart(void)
|
|||
}
|
||||
|
||||
|
||||
bool HelpPanelQuickstart(std::vector<std::string> &helptext)
|
||||
bool HelpPanelQuickstart(vector<string>& helptext)
|
||||
{
|
||||
helptext.clear();
|
||||
helptext.push_back("Simplified start of emulation by just selecting the Amiga model and the disk/CD you want to use.");
|
||||
helptext.push_back("");
|
||||
helptext.push_back("After selecting the Amiga model, you can choose from a small list of standard configurations for this model to");
|
||||
helptext.push_back(
|
||||
"After selecting the Amiga model, you can choose from a small list of standard configurations for this model to");
|
||||
helptext.push_back("start with.");
|
||||
helptext.push_back("");
|
||||
helptext.push_back("When you activate \"Start in Quickstart mode\", the next time you run the emulator, it will start with the quickstart");
|
||||
helptext.push_back(
|
||||
"When you activate \"Start in Quickstart mode\", the next time you run the emulator, it will start with the quickstart");
|
||||
helptext.push_back("panel. Otherwise you start in configuraions panel.");
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class ROMListModel : public gcn::ListModel
|
|||
int ROMType;
|
||||
|
||||
public:
|
||||
ROMListModel(int romtype)
|
||||
ROMListModel(const int romtype)
|
||||
{
|
||||
ROMType = romtype;
|
||||
}
|
||||
|
@ -46,14 +46,14 @@ public:
|
|||
return roms.size();
|
||||
}
|
||||
|
||||
std::string getElementAt(int i) override
|
||||
std::string getElementAt(const int i) override
|
||||
{
|
||||
if (i < 0 || i >= roms.size())
|
||||
return "---";
|
||||
return roms[i];
|
||||
}
|
||||
|
||||
AvailableROM* getROMat(int i)
|
||||
AvailableROM* getROMat(const int i)
|
||||
{
|
||||
if (i >= 0 && i < idxToAvailableROMs.size())
|
||||
return idxToAvailableROMs[i] < 0 ? NULL : lstAvailableROMs[idxToAvailableROMs[i]];
|
||||
|
@ -204,7 +204,7 @@ static ROMButtonActionListener* romButtonActionListener;
|
|||
|
||||
void InitPanelROM(const struct _ConfigCategory& category)
|
||||
{
|
||||
int textFieldWidth = category.panel->getWidth() - 2 * DISTANCE_BORDER - SMALL_BUTTON_WIDTH - DISTANCE_NEXT_X;
|
||||
const int textFieldWidth = category.panel->getWidth() - 2 * DISTANCE_BORDER - SMALL_BUTTON_WIDTH - DISTANCE_NEXT_X;
|
||||
|
||||
mainROMActionListener = new MainROMActionListener();
|
||||
extROMActionListener = new ExtROMActionListener();
|
||||
|
|
|
@ -150,7 +150,7 @@ void InitPanelSavestate(const struct _ConfigCategory& category)
|
|||
|
||||
category.panel->add(grpNumber, DISTANCE_BORDER, DISTANCE_BORDER);
|
||||
category.panel->add(wndScreenshot, DISTANCE_BORDER + 100, DISTANCE_BORDER);
|
||||
int buttonY = category.panel->getHeight() - DISTANCE_BORDER - BUTTON_HEIGHT;
|
||||
const int buttonY = category.panel->getHeight() - DISTANCE_BORDER - BUTTON_HEIGHT;
|
||||
category.panel->add(cmdLoadState, DISTANCE_BORDER, buttonY);
|
||||
category.panel->add(cmdSaveState, DISTANCE_BORDER + BUTTON_WIDTH + DISTANCE_NEXT_X, buttonY);
|
||||
category.panel->add(lblWarningHDDon, DISTANCE_BORDER + 100, DISTANCE_BORDER + 50);
|
||||
|
@ -220,7 +220,7 @@ void RefreshPanelSavestate()
|
|||
if (f)
|
||||
{
|
||||
fclose(f);
|
||||
gcn::Rectangle rect = wndScreenshot->getChildrenArea();
|
||||
const gcn::Rectangle rect = wndScreenshot->getChildrenArea();
|
||||
SDL_Surface* loadedImage = IMG_Load(screenshot_filename);
|
||||
if (loadedImage != nullptr)
|
||||
{
|
||||
|
@ -241,7 +241,7 @@ void RefreshPanelSavestate()
|
|||
}
|
||||
}
|
||||
|
||||
bool enabled = true; // nr_units () == 0;
|
||||
const bool enabled = true; // nr_units () == 0;
|
||||
optState0->setEnabled(enabled);
|
||||
optState1->setEnabled(enabled);
|
||||
optState2->setEnabled(enabled);
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
return freq.size();
|
||||
}
|
||||
|
||||
string getElementAt(int i) override
|
||||
string getElementAt(const int i) override
|
||||
{
|
||||
if (i < 0 || i >= freq.size())
|
||||
return "---";
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
return entry.size();
|
||||
}
|
||||
|
||||
string getElementAt(int i) override
|
||||
string getElementAt(const int i) override
|
||||
{
|
||||
if (i < 0 || i >= entry.size())
|
||||
return "---";
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
return entry.size();
|
||||
}
|
||||
|
||||
string getElementAt(int i) override
|
||||
string getElementAt(const int i) override
|
||||
{
|
||||
if (i < 0 || i >= entry.size())
|
||||
return "---";
|
||||
|
@ -169,6 +169,8 @@ public:
|
|||
case 3:
|
||||
changed_prefs.sound_freq = 44100;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,6 +200,8 @@ public:
|
|||
changed_prefs.sound_filter = FILTER_SOUND_ON;
|
||||
changed_prefs.sound_filter_type = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -382,7 +386,6 @@ void ExitPanelSound()
|
|||
void RefreshPanelSound()
|
||||
{
|
||||
char tmp[10];
|
||||
int i;
|
||||
|
||||
switch (changed_prefs.produce_sound)
|
||||
{
|
||||
|
@ -398,6 +401,8 @@ void RefreshPanelSound()
|
|||
case 3:
|
||||
optSoundEmulatedBest->setSelected(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (changed_prefs.sound_stereo == 0)
|
||||
|
@ -423,7 +428,7 @@ void RefreshPanelSound()
|
|||
|
||||
cboInterpolation->setSelected(changed_prefs.sound_interpol);
|
||||
|
||||
i = 0;
|
||||
int i = 0;
|
||||
switch (changed_prefs.sound_filter)
|
||||
{
|
||||
case 0:
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
return dirs.size() + files.size();
|
||||
}
|
||||
|
||||
string getElementAt(int i) override
|
||||
string getElementAt(const int i) override
|
||||
{
|
||||
if (i >= dirs.size() + files.size() || i < 0)
|
||||
return "---";
|
||||
|
@ -286,6 +286,39 @@ static void ExitSelectFile()
|
|||
delete wndSelectFile;
|
||||
}
|
||||
|
||||
static void navigate_right()
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == lstFiles)
|
||||
if (createNew)
|
||||
txtFilename->requestFocus();
|
||||
else
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == txtFilename)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdCancel)
|
||||
lstFiles->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
cmdCancel->requestFocus();
|
||||
}
|
||||
|
||||
static void navigate_left()
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == lstFiles)
|
||||
cmdCancel->requestFocus();
|
||||
else if (activeWidget == cmdCancel)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
if (createNew)
|
||||
txtFilename->requestFocus();
|
||||
else
|
||||
lstFiles->requestFocus();
|
||||
else if (activeWidget == txtFilename)
|
||||
lstFiles->requestFocus();
|
||||
}
|
||||
|
||||
static void SelectFileLoop()
|
||||
{
|
||||
|
@ -307,39 +340,11 @@ static void SelectFileLoop()
|
|||
break;
|
||||
|
||||
case VK_LEFT:
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == lstFiles)
|
||||
cmdCancel->requestFocus();
|
||||
else if (activeWidget == cmdCancel)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
if (createNew)
|
||||
txtFilename->requestFocus();
|
||||
else
|
||||
lstFiles->requestFocus();
|
||||
else if (activeWidget == txtFilename)
|
||||
lstFiles->requestFocus();
|
||||
}
|
||||
navigate_left();
|
||||
break;
|
||||
|
||||
case VK_RIGHT:
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == lstFiles)
|
||||
if (createNew)
|
||||
txtFilename->requestFocus();
|
||||
else
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == txtFilename)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdCancel)
|
||||
lstFiles->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
cmdCancel->requestFocus();
|
||||
}
|
||||
navigate_right();
|
||||
break;
|
||||
|
||||
case VK_Red:
|
||||
|
@ -369,36 +374,12 @@ static void SelectFileLoop()
|
|||
}
|
||||
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_left) || (hat & SDL_HAT_LEFT))
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == lstFiles)
|
||||
cmdCancel->requestFocus();
|
||||
else if (activeWidget == cmdCancel)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
if (createNew)
|
||||
txtFilename->requestFocus();
|
||||
else
|
||||
lstFiles->requestFocus();
|
||||
else if (activeWidget == txtFilename)
|
||||
lstFiles->requestFocus();
|
||||
navigate_left();
|
||||
break;
|
||||
}
|
||||
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_right) || (hat & SDL_HAT_RIGHT))
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == lstFiles)
|
||||
if (createNew)
|
||||
txtFilename->requestFocus();
|
||||
else
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == txtFilename)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdCancel)
|
||||
lstFiles->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
cmdCancel->requestFocus();
|
||||
navigate_right();
|
||||
break;
|
||||
}
|
||||
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_up) || (hat & SDL_HAT_UP))
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
return dirs.size();
|
||||
}
|
||||
|
||||
string getElementAt(int i) override
|
||||
string getElementAt(const int i) override
|
||||
{
|
||||
if (i >= dirs.size() || i < 0)
|
||||
return "---";
|
||||
|
@ -241,29 +241,11 @@ static void SelectFolderLoop()
|
|||
break;
|
||||
|
||||
case VK_LEFT:
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == lstFolders)
|
||||
cmdCancel->requestFocus();
|
||||
else if (activeWidget == cmdCancel)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
lstFolders->requestFocus();
|
||||
}
|
||||
navigate_left();
|
||||
break;
|
||||
|
||||
case VK_RIGHT:
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == lstFolders)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdCancel)
|
||||
lstFolders->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
cmdCancel->requestFocus();
|
||||
}
|
||||
navigate_right();
|
||||
break;
|
||||
|
||||
case VK_Red:
|
||||
|
@ -295,27 +277,13 @@ static void SelectFolderLoop()
|
|||
|
||||
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_left) || (hat & SDL_HAT_LEFT))
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == lstFolders)
|
||||
cmdCancel->requestFocus();
|
||||
else if (activeWidget == cmdCancel)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
lstFolders->requestFocus();
|
||||
navigate_left();
|
||||
break;
|
||||
}
|
||||
|
||||
if (SDL_JoystickGetButton(GUIjoy, host_input_buttons[0].dpad_right) || (hat & SDL_HAT_RIGHT))
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == lstFolders)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdCancel)
|
||||
lstFolders->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
cmdCancel->requestFocus();
|
||||
navigate_right();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
return lines.size();
|
||||
}
|
||||
|
||||
string getElementAt(int i) override
|
||||
string getElementAt(const int i) override
|
||||
{
|
||||
if (i >= 0 && i < lines.size())
|
||||
return lines[i];
|
||||
|
|
|
@ -157,6 +157,16 @@ static void ShowMessageWaitInputLoop()
|
|||
}
|
||||
}
|
||||
|
||||
static void navigate_left_right()
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == cmdCancel)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
cmdCancel->requestFocus();
|
||||
}
|
||||
|
||||
static void ShowMessageLoop()
|
||||
{
|
||||
FocusBugWorkaround(wndShowMessage);
|
||||
|
@ -178,14 +188,7 @@ static void ShowMessageLoop()
|
|||
|
||||
case VK_LEFT:
|
||||
case VK_RIGHT:
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == cmdCancel)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
cmdCancel->requestFocus();
|
||||
}
|
||||
navigate_left_right();
|
||||
break;
|
||||
|
||||
case VK_Red:
|
||||
|
@ -220,12 +223,7 @@ static void ShowMessageLoop()
|
|||
(hat & SDL_HAT_RIGHT))
|
||||
|
||||
{
|
||||
gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler();
|
||||
gcn::Widget* activeWidget = focusHdl->getFocused();
|
||||
if (activeWidget == cmdCancel)
|
||||
cmdOK->requestFocus();
|
||||
else if (activeWidget == cmdOK)
|
||||
cmdCancel->requestFocus();
|
||||
navigate_left_right();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace gcn
|
|||
}
|
||||
|
||||
UaeCheckBox::UaeCheckBox(const std::string& caption,
|
||||
bool selected)
|
||||
const bool selected)
|
||||
: CheckBox(caption, selected)
|
||||
{
|
||||
setId(caption);
|
||||
|
@ -36,9 +36,9 @@ namespace gcn
|
|||
{
|
||||
graphics->setColor(Color(0x000000));
|
||||
graphics->drawRectangle(Rectangle(0,
|
||||
0,
|
||||
getWidth(),
|
||||
getHeight()));
|
||||
0,
|
||||
getWidth(),
|
||||
getHeight()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,20 +45,21 @@ namespace gcn
|
|||
}
|
||||
}
|
||||
|
||||
void UaeDropDown::clearSelected()
|
||||
void UaeDropDown::clearSelected() const
|
||||
{
|
||||
mListBox->setSelected(-1);
|
||||
}
|
||||
|
||||
bool UaeDropDown::isDroppedDown()
|
||||
bool UaeDropDown::isDroppedDown() const
|
||||
{
|
||||
return mDroppedDown;
|
||||
}
|
||||
|
||||
bool UaeDropDown::getEnabled(void)
|
||||
{
|
||||
return mEnabled;
|
||||
}
|
||||
bool UaeDropDown::getEnabled() const
|
||||
{
|
||||
return mEnabled;
|
||||
}
|
||||
|
||||
void UaeDropDown::setEnabled(bool enabled)
|
||||
{
|
||||
if (mEnabled != enabled)
|
||||
|
|
|
@ -11,29 +11,28 @@
|
|||
|
||||
namespace gcn
|
||||
{
|
||||
class GCN_CORE_DECLSPEC UaeDropDown : public DropDown
|
||||
{
|
||||
public:
|
||||
UaeDropDown(ListModel *listModel = nullptr,
|
||||
ScrollArea *scrollArea = nullptr,
|
||||
ListBox *listBox = nullptr);
|
||||
class GCN_CORE_DECLSPEC UaeDropDown : public DropDown
|
||||
{
|
||||
public:
|
||||
UaeDropDown(ListModel* listModel = nullptr,
|
||||
ScrollArea* scrollArea = nullptr,
|
||||
ListBox* listBox = nullptr);
|
||||
|
||||
virtual ~UaeDropDown();
|
||||
virtual ~UaeDropDown();
|
||||
|
||||
void keyPressed(KeyEvent& keyEvent) override;
|
||||
void keyPressed(KeyEvent& keyEvent) override;
|
||||
|
||||
void setEnabled(bool enabled);
|
||||
void setEnabled(bool enabled);
|
||||
|
||||
bool getEnabled(void);
|
||||
bool getEnabled(void) const;
|
||||
|
||||
void clearSelected(void);
|
||||
void clearSelected(void) const;
|
||||
|
||||
bool isDroppedDown(void);
|
||||
bool isDroppedDown(void) const;
|
||||
|
||||
protected:
|
||||
Color mBackgroundColorBackup;
|
||||
|
||||
};
|
||||
protected:
|
||||
Color mBackgroundColorBackup;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace gcn
|
|||
// Check the current clip area so we don't draw unnecessary items
|
||||
// that are not visible.
|
||||
const ClipRectangle currentClipArea = graphics->getCurrentClipArea();
|
||||
int rowHeight = getFont()->getHeight();
|
||||
const int rowHeight = getFont()->getHeight();
|
||||
|
||||
// Calculate the number of rows to draw by checking the clip area.
|
||||
// The addition of two makes covers a partial visible row at the top
|
||||
|
@ -75,11 +75,10 @@ namespace gcn
|
|||
colSelectorActive.g = 136;
|
||||
colSelectorActive.b = 187;
|
||||
|
||||
int i;
|
||||
// The y coordinate where we start to draw the text is
|
||||
// simply the y coordinate multiplied with the font height.
|
||||
int y = rowHeight * startRow;
|
||||
for (i = startRow; i < startRow + numberOfRows; ++i)
|
||||
for (int i = startRow; i < startRow + numberOfRows; ++i)
|
||||
{
|
||||
if (i == mSelected)
|
||||
{
|
||||
|
|
|
@ -10,8 +10,8 @@ namespace gcn
|
|||
}
|
||||
|
||||
UaeRadioButton::UaeRadioButton(const std::string& caption,
|
||||
const std::string& group,
|
||||
bool selected)
|
||||
const std::string& group,
|
||||
const bool selected)
|
||||
: RadioButton(caption, group, selected)
|
||||
{
|
||||
setId(caption);
|
||||
|
@ -26,9 +26,9 @@ namespace gcn
|
|||
void UaeRadioButton::draw(Graphics* graphics)
|
||||
{
|
||||
graphics->pushClipArea(Rectangle(1,
|
||||
1,
|
||||
getWidth() - 1,
|
||||
getHeight() - 1));
|
||||
1,
|
||||
getWidth() - 1,
|
||||
getHeight() - 1));
|
||||
drawBox(graphics);
|
||||
graphics->popClipArea();
|
||||
|
||||
|
@ -40,12 +40,12 @@ namespace gcn
|
|||
{
|
||||
graphics->setColor(Color(0x000000));
|
||||
graphics->drawRectangle(Rectangle(0,
|
||||
0,
|
||||
getWidth(),
|
||||
getHeight()));
|
||||
0,
|
||||
getWidth(),
|
||||
getHeight()));
|
||||
}
|
||||
|
||||
int h = getHeight() + getHeight() / 2;
|
||||
const int h = getHeight() + getHeight() / 2;
|
||||
|
||||
graphics->drawText(getCaption(), h - 2, 0);
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ namespace gcn
|
|||
UaeRadioButton();
|
||||
|
||||
UaeRadioButton(const std::string& caption,
|
||||
const std::string& group,
|
||||
bool selected = false);
|
||||
const std::string& group,
|
||||
bool selected = false);
|
||||
|
||||
virtual ~UaeRadioButton();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue