[Scummvm-cvs-logs] SF.net SVN: scummvm:[43360] tools/branches/gsoc2009-gui/gui
Remere at users.sourceforge.net
Remere at users.sourceforge.net
Fri Aug 14 03:57:54 CEST 2009
Revision: 43360
http://scummvm.svn.sourceforge.net/scummvm/?rev=43360&view=rev
Author: Remere
Date: 2009-08-14 01:57:53 +0000 (Fri, 14 Aug 2009)
Log Message:
-----------
*First page displays real buttons instead of radio buttons now.
Modified Paths:
--------------
tools/branches/gsoc2009-gui/gui/main.cpp
tools/branches/gsoc2009-gui/gui/main.h
tools/branches/gsoc2009-gui/gui/pages.cpp
tools/branches/gsoc2009-gui/gui/pages.h
Modified: tools/branches/gsoc2009-gui/gui/main.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/main.cpp 2009-08-14 00:48:14 UTC (rev 43359)
+++ tools/branches/gsoc2009-gui/gui/main.cpp 2009-08-14 01:57:53 UTC (rev 43360)
@@ -206,7 +206,6 @@
// And reset the buttons to a standard state
_buttons->reset();
- _buttons->showPrevious(_pages.size() > 1);
_buttons->setPage(_pages.back(), newPanel);
}
@@ -304,6 +303,7 @@
enablePrevious(true);
showFinish(false);
showAbort(false);
+ showNavigation(true);
wxString label(wxT("ScummVM Tools"));
if (_configuration.selectedTool)
@@ -331,8 +331,6 @@
}
void WizardButtons::enablePrevious(bool enable) {
- if (enable)
- showPrevious(true);
_prev->Enable(enable);
}
@@ -350,11 +348,14 @@
_cancel->SetLabel(wxT("Cancel"));
}
-void WizardButtons::showPrevious(bool show) {
- if (show)
+void WizardButtons::showNavigation(bool show) {
+ if (show) {
+ _next->Show();
_prev->Show();
- else
+ } else {
+ _next->Hide();
_prev->Hide();
+ }
}
// wx event handlers
Modified: tools/branches/gsoc2009-gui/gui/main.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/main.h 2009-08-14 00:48:14 UTC (rev 43359)
+++ tools/branches/gsoc2009-gui/gui/main.h 2009-08-14 01:57:53 UTC (rev 43360)
@@ -39,6 +39,9 @@
ID_CANCEL,
ID_HELP,
ID_ABOUT,
+ ID_COMPRESS,
+ ID_EXTRACT,
+ ID_ADVANCED,
};
/**
@@ -164,9 +167,9 @@
/**
- * Display the previous button.
+ * Display the previous/next button.
*/
- void showPrevious(bool show);
+ void showNavigation(bool show);
/**
* Changes name of the 'next' button to finish
Modified: tools/branches/gsoc2009-gui/gui/pages.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.cpp 2009-08-14 00:48:14 UTC (rev 43359)
+++ tools/branches/gsoc2009-gui/gui/pages.cpp 2009-08-14 01:57:53 UTC (rev 43360)
@@ -101,6 +101,12 @@
// Introduction page
+BEGIN_EVENT_TABLE(IntroPage, WizardPage)
+ EVT_BUTTON(ID_COMPRESS, IntroPage::onClickCompress)
+ EVT_BUTTON(ID_EXTRACT, IntroPage::onClickExtract)
+ EVT_BUTTON(ID_ADVANCED, IntroPage::onClickAdvanced)
+END_EVENT_TABLE()
+
IntroPage::IntroPage(ScummToolsFrame *frame)
: WizardPage(frame)
{
@@ -114,63 +120,91 @@
sizer->AddSpacer(15);
sizer->Add(new wxStaticText(panel, wxID_ANY,
- wxT("Welcome to the ScummVM extraction and compression utility.")));
+ wxT("Welcome to the ScummVM extraction and compression utility.\nWhat do you want to do?")));
- wxString choices[] = {
- wxT("Compress audio files"),
- wxT("Extract from game data files"),
- wxT("Choose tool to use (advanced)")
- };
+ sizer->AddSpacer(15);
- wxRadioBox *options = new wxRadioBox(panel, wxID_ANY, wxT(""),
- wxDefaultPosition, wxDefaultSize, 3, choices, 1,
- wxRA_SPECIFY_COLS | wxBORDER_NONE, wxDefaultValidator, wxT("ChooseActivity"));
- sizer->Add(options);
- options->SetSelection(0);
+ wxSizer *sidesizer = new wxBoxSizer(wxHORIZONTAL);
- SetAlignedSizer(panel, sizer);
+ wxPanel *buttonpanel;
+ wxSizer *buttonsizer;
- // Load options
- Configuration &config = _configuration;
- if (config.advanced)
- options->SetSelection(2);
- else if (config.compressing)
- options->SetSelection(0);
- else
- options->SetSelection(1);
+ // The precise pixel dimensions used for the text here is actually quite bad, as it relies
+ // on specific measurements from different platforms...
- return panel;
-}
+ buttonpanel = new wxPanel(panel, wxID_ANY);
+ buttonsizer = new wxStaticBoxSizer(wxVERTICAL, buttonpanel, wxT(""));
+ buttonsizer->Add(new wxButton(buttonpanel, ID_COMPRESS, wxT("Compress")), wxSizerFlags().Expand());
+ buttonsizer->Add(new wxStaticText(buttonpanel, wxID_ANY,
+ wxT("Compress game audio files into archive files for use with ScummVM."),
+ wxDefaultPosition, wxSize(100, 60), wxALIGN_CENTER));
+ buttonpanel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(IntroPage::onClickCompress), NULL, this);
+ buttonpanel->SetSizer(buttonsizer);
+ sidesizer->Add(buttonpanel);
-void IntroPage::save(wxWindow *panel) {
- wxString selected_option = static_cast<wxRadioBox *>(panel->FindWindowByName(wxT("ChooseActivity")))->GetStringSelection().Lower();
+ sidesizer->AddSpacer(15);
- _configuration.advanced = selected_option.Find(wxT("advanced")) != wxNOT_FOUND;
- _configuration.compressing = selected_option.Find(wxT("extract")) == wxNOT_FOUND;
+ buttonpanel = new wxPanel(panel, wxID_ANY);
+ buttonsizer = new wxStaticBoxSizer(wxVERTICAL, buttonpanel, wxT(""));
+ buttonsizer->Add(new wxButton(buttonpanel, ID_EXTRACT, wxT("Extract")), wxSizerFlags().Expand());
+ buttonsizer->Add(new wxStaticText(buttonpanel, wxID_ANY,
+ wxT("Extract the contents of archive files used by many games."),
+ wxDefaultPosition, wxSize(100, 60), wxALIGN_CENTER));
+ buttonpanel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(IntroPage::onClickExtract), NULL, this);
+ buttonpanel->SetSizer(buttonsizer);
+ sidesizer->Add(buttonpanel);
+
+ sidesizer->AddSpacer(15);
+
+ buttonpanel = new wxPanel(panel, wxID_ANY);
+ buttonsizer = new wxStaticBoxSizer(wxVERTICAL, buttonpanel, wxT(""));
+ buttonsizer->Add(new wxButton(buttonpanel, ID_ADVANCED, wxT("Advanced")), wxSizerFlags().Expand());
+ buttonsizer->Add(new wxStaticText(buttonpanel, wxID_ANY,
+ wxT("Choose the precise tool you want to use."),
+ wxDefaultPosition, wxSize(100, 60), wxALIGN_CENTER));
+ buttonpanel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(IntroPage::onClickAdvanced), NULL, this);
+ buttonpanel->SetSizer(buttonsizer);
+ sidesizer->Add(buttonpanel);
+
+
+ sizer->Add(sidesizer);
+ SetAlignedSizer(panel, sizer);
+
+ return panel;
}
wxString IntroPage::getHelp() {
return wxT("Select the activity you would like to do. In order to play your game.\nMost common usage is compression of game files.");
}
-void IntroPage::onNext(wxWindow *panel) {
- wxString selected_option = static_cast<wxRadioBox *>(panel->FindWindowByName(wxT("ChooseActivity")))->GetStringSelection().Lower();
- if (selected_option.Find(wxT("advanced")) != wxNOT_FOUND) {
- // advanced
- switchPage(new ChooseToolPage(_topframe));
- } else {
- // extract / compress
- switchPage(new ChooseInPage(_topframe));
- }
-}
-
void IntroPage::updateButtons(wxWindow *panel, WizardButtons *buttons) {
buttons->setLineLabel(wxT("ScummVM Tools"));
+
+ buttons->showNavigation(false);
WizardPage::updateButtons(panel, buttons);
}
+void IntroPage::onClickCompress(wxCommandEvent &e) {
+ _configuration.compressing = true;
+ _configuration.advanced = false;
+ switchPage(new ChooseInPage(_topframe));
+}
+
+void IntroPage::onClickExtract(wxCommandEvent &e) {
+ _configuration.compressing = false;
+ _configuration.advanced = false;
+
+ switchPage(new ChooseInPage(_topframe));
+}
+
+void IntroPage::onClickAdvanced(wxCommandEvent &e) {
+ _configuration.advanced = true;
+
+ switchPage(new ChooseToolPage(_topframe));
+}
+
// Page to choose the tool to use
ChooseToolPage::ChooseToolPage(ScummToolsFrame *frame, const wxArrayString &options)
Modified: tools/branches/gsoc2009-gui/gui/pages.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.h 2009-08-14 00:48:14 UTC (rev 43359)
+++ tools/branches/gsoc2009-gui/gui/pages.h 2009-08-14 01:57:53 UTC (rev 43360)
@@ -145,13 +145,15 @@
wxWindow *CreatePanel(wxWindow *parent);
- void save(wxWindow *panel);
-
wxString getHelp();
-
- void onNext(wxWindow *panel);
void updateButtons(wxWindow *panel, WizardButtons *buttons);
+
+ void onClickCompress(wxCommandEvent &e);
+ void onClickExtract(wxCommandEvent &e);
+ void onClickAdvanced(wxCommandEvent &e);
+
+ DECLARE_EVENT_TABLE()
};
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list