diff --git a/src/osdep/gui/PanelConfig.cpp b/src/osdep/gui/PanelConfig.cpp index 790473e1..174d52f1 100644 --- a/src/osdep/gui/PanelConfig.cpp +++ b/src/osdep/gui/PanelConfig.cpp @@ -208,6 +208,49 @@ void InitPanelConfig(const struct _ConfigCategory& category) { configButtonActionListener = new ConfigButtonActionListener(); + 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->setBaseColor(colTextboxBackground); + 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); + + lblName = new gcn::Label("Name:"); + lblName->setSize(lblName->getWidth(), lblName->getHeight()); + lblName->setAlignment(gcn::Graphics::RIGHT); + txtName = new gcn::TextField(); + txtName->setSize(300, TEXTFIELD_HEIGHT); + 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, TEXTFIELD_HEIGHT); + txtDesc->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, txtName->getY() + txtName->getHeight() + DISTANCE_NEXT_Y); + category.panel->add(txtDesc, DISTANCE_BORDER + lblDesc->getWidth() + 8, + txtName->getY() + txtName->getHeight() + DISTANCE_NEXT_Y); + cmdLoad = new gcn::Button("Load"); cmdLoad->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); cmdLoad->setBaseColor(gui_baseCol); @@ -235,52 +278,7 @@ void InitPanelConfig(const struct _ConfigCategory& category) 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, TEXTFIELD_HEIGHT); - 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, TEXTFIELD_HEIGHT); - 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->setBaseColor(colTextboxBackground); - 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, txtName->getY() + txtName->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) { if (strlen(last_loaded_config) == 0)