[Scummvm-cvs-logs] SF.net SVN: scummvm:[43660] tools/branches/gsoc2009-gui/gui

Remere at users.sourceforge.net Remere at users.sourceforge.net
Sat Aug 22 20:44:36 CEST 2009


Revision: 43660
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43660&view=rev
Author:   Remere
Date:     2009-08-22 18:44:35 +0000 (Sat, 22 Aug 2009)

Log Message:
-----------
*Added an advanced (defaults) settings window, note that the settings specified don't actually save yet.

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-22 17:20:55 UTC (rev 43659)
+++ tools/branches/gsoc2009-gui/gui/main.cpp	2009-08-22 18:44:35 UTC (rev 43660)
@@ -34,6 +34,7 @@
 #include <wx/aboutdlg.h>
 #include <wx/stdpaths.h>
 #include <wx/hyperlink.h>
+#include <wx/notebook.h>
 
 #include "main.h"
 
@@ -67,16 +68,18 @@
 	frame->SetMinSize(wxSize(600, 400));
 	SetTopWindow(frame);
 	
+	Configuration &configuration = frame->_configuration;
+
 	if (argc == 2) {
 		Filename fn((const char *)wxString(argv[1]).mb_str());
 
 		wxArrayString ls = g_tools.getToolList(fn);
 		if(ls.size() == 1)
-			frame->switchPage(new ChooseOutPage(frame));
+			frame->switchPage(new ChooseOutPage(configuration));
 		else
-			frame->switchPage(new ChooseToolPage(frame, ls));
+			frame->switchPage(new ChooseToolPage(configuration, ls));
 	} else {
-		frame->switchPage(new IntroPage(frame));
+		frame->switchPage(new IntroPage(configuration));
 	}
 	
 	frame->Show(true);
@@ -149,6 +152,8 @@
 	//EVT_MENU(wxID_PREFERENCES, ScummToolsFrame::onMenuPreferences)
 	EVT_BUTTON(ID_HELP, ScummToolsFrame::onMenuHelp)
 	EVT_MENU(wxID_HELP, ScummToolsFrame::onMenuHelp)
+	EVT_BUTTON(ID_ADVANCED, ScummToolsFrame::onMenuAdvanced)
+	EVT_MENU(ID_ADVANCED, ScummToolsFrame::onMenuAdvanced)
 	EVT_MENU(ID_MANUAL, ScummToolsFrame::onMenuManual)
 	EVT_MENU(ID_WEBSITE, ScummToolsFrame::onMenuWebsite)
 	EVT_MENU(wxID_ABOUT, ScummToolsFrame::onMenuAbout)
@@ -221,8 +226,9 @@
 
 	// Name of this seems really inappropriate
 	wxMenu *helpmenu = new wxMenu();
-	//filemenu->Append(wxID_PREFERENCES, wxT("&Preferences"));
 	helpmenu->Append(wxID_HELP, wxT("Help"));
+	// Might be under the wrong menu...
+	helpmenu->Append(ID_ADVANCED, wxT("&Default Settings"));
 	helpmenu->Append(ID_MANUAL, wxT("&Manual Page"));
 	helpmenu->Append(ID_WEBSITE, wxT("Visit ScummVM &Website"));
 	helpmenu->Append(wxID_ABOUT, wxT("&About ") + wxGetApp().GetAppName());
@@ -232,6 +238,10 @@
 }
 
 void ScummToolsFrame::switchPage(WizardPage *next, bool moveback) {
+	// Associate us with the new page
+	if(next)
+		next->SetScummFrame(this);
+
 	// Find the old page
 	wxPanel *oldPanel = dynamic_cast<wxPanel *>(_wizardpane->FindWindow(wxT("Wizard Page")));
 
@@ -274,6 +284,12 @@
 	dlg.ShowModal();
 }
 
+void ScummToolsFrame::onMenuAdvanced(wxCommandEvent &evt) {
+	Configuration defaults;
+	AdvancedSettingsDialog dlg(this, defaults);
+	dlg.ShowModal();
+}
+
 void ScummToolsFrame::onMenuManual(wxCommandEvent &evt) {
 	// Wiki page
 	::wxLaunchDefaultBrowser(wxT("http://wiki.scummvm.org/index.php/User_Manual/Appendix:_Tools"));
@@ -308,8 +324,6 @@
 
 // Event table for the WizardButtons window
 BEGIN_EVENT_TABLE(WizardButtons, wxPanel)
-	//EVT_BUTTON(ID_HELP, WizardButtons::onClickHelp)
-	//EVT_BUTTON(ID_ABOUT, WizardButtons::onClickAbout)
 	EVT_BUTTON(ID_NEXT, WizardButtons::onClickNext)
 	EVT_BUTTON(ID_PREV, WizardButtons::onClickPrevious)
 	EVT_BUTTON(ID_CANCEL, WizardButtons::onClickCancel)
@@ -335,6 +349,17 @@
 	_help->SetSize(80, -1);
 	sizer->Add(_help, wxSizerFlags().Left().ReserveSpaceEvenIfHidden());
 
+	sizer->AddSpacer(10);
+
+	_prefs= new wxButton(this, ID_ADVANCED, wxT("Default Settings"));
+	_prefs->SetSize(80, -1);
+	sizer->Add(_prefs, wxSizerFlags().Left().ReserveSpaceEvenIfHidden());
+
+#ifdef __WXMAC__
+	_help->Hide();
+	_prefs->Hide();
+#endif
+
 	// Insert space between the buttons
 	topsizer->Add(sizer, wxSizerFlags().Left());
 	topsizer->Add(10, 10, 1, wxEXPAND);
@@ -447,6 +472,8 @@
 	_currentPage->onCancel(_currentPanel);
 }
 
+// Window header
+
 BEGIN_EVENT_TABLE(Header, wxPanel)
 	EVT_PAINT(Header::onPaint)
 END_EVENT_TABLE()
@@ -512,3 +539,30 @@
 	dc.DrawText(_title, 290, 70);
 }
 
+AdvancedSettingsDialog::AdvancedSettingsDialog(wxWindow *parent, Configuration &defaults) :
+	wxDialog(parent, wxID_ANY, wxT("Default Settings"), wxDefaultPosition, wxDefaultSize),
+	_defaults(defaults)
+{
+	wxNotebook *notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP);
+	
+	mp3 = new ChooseAudioOptionsMp3Page(defaults);
+	flac = new ChooseAudioOptionsFlacPage(defaults);
+	vorbis = new ChooseAudioOptionsVorbisPage(defaults);
+
+	notebook->AddPage(mp3->CreatePanel(notebook), wxT("MP3"));
+	notebook->AddPage(flac->CreatePanel(notebook), wxT("Flac"));
+	notebook->AddPage(vorbis->CreatePanel(notebook), wxT("Vorbis"));
+	
+	wxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
+
+	topsizer->Add(notebook, wxSizerFlags(1).Expand().Border());
+	topsizer->Add(CreateStdDialogButtonSizer(wxOK | wxCANCEL), wxSizerFlags(0).Center().Border());
+
+	SetSizerAndFit(topsizer);
+}
+
+AdvancedSettingsDialog::~AdvancedSettingsDialog() {
+	delete mp3;
+	delete flac;
+	delete vorbis;
+}

Modified: tools/branches/gsoc2009-gui/gui/main.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/main.h	2009-08-22 17:20:55 UTC (rev 43659)
+++ tools/branches/gsoc2009-gui/gui/main.h	2009-08-22 18:44:35 UTC (rev 43660)
@@ -101,6 +101,7 @@
 	 */
 	void onClose(wxCloseEvent &evt);
 
+	void onMenuAdvanced(wxCommandEvent &evt);
 	void onMenuHelp(wxCommandEvent &evt);
 	void onMenuWebsite(wxCommandEvent &evt);
 	void onMenuManual(wxCommandEvent &evt);
@@ -207,6 +208,8 @@
 	wxButton *_prev;
 	/** 'Help' button. */
 	wxButton *_help;
+	/** 'Preferences' button */
+	wxButton *_prefs;
 	/** 'Cancel' button. */
 	wxButton *_cancel;
 	/** The static text on the line seperating the page area and the buttons. */
@@ -240,4 +243,26 @@
 	DECLARE_EVENT_TABLE()
 };
 
+/**
+ *
+ */
+
+class ChooseAudioOptionsMp3Page;
+class ChooseAudioOptionsFlacPage;
+class ChooseAudioOptionsVorbisPage;
+
+class AdvancedSettingsDialog : public wxDialog
+{
+public:
+	AdvancedSettingsDialog(wxWindow *parent, Configuration &defaults);
+	~AdvancedSettingsDialog();
+
+protected:
+	Configuration &_defaults;
+
+	ChooseAudioOptionsMp3Page *mp3;
+	ChooseAudioOptionsFlacPage *flac;
+	ChooseAudioOptionsVorbisPage *vorbis;
+};
+
 #endif

Modified: tools/branches/gsoc2009-gui/gui/pages.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.cpp	2009-08-22 17:20:55 UTC (rev 43659)
+++ tools/branches/gsoc2009-gui/gui/pages.cpp	2009-08-22 18:44:35 UTC (rev 43660)
@@ -42,12 +42,16 @@
 BEGIN_EVENT_TABLE(WizardPage, wxEvtHandler)
 END_EVENT_TABLE()
 
-WizardPage::WizardPage(ScummToolsFrame *frame)
-	: _topframe(frame),
-	  _configuration(frame->_configuration)
+WizardPage::WizardPage(Configuration &config)
+	: _configuration(config),
+	  _topframe(NULL)
 {
 }
 
+void WizardPage::SetScummFrame(ScummToolsFrame *topframe) {
+	_topframe = topframe;
+}
+
 wxWindow *WizardPage::CreatePanel(wxWindow *parent) {
 	return new wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxT("Wizard Page"));
 }
@@ -70,13 +74,16 @@
 // Our default handler for next/prev/cancel
 
 void WizardPage::onNext(wxWindow *panel) {
+	wxASSERT_MSG(_topframe != NULL, wxT("Can not call onNext without topframe set."));
 }
 
 void WizardPage::onPrevious(wxWindow *panel) {
+	wxASSERT_MSG(_topframe != NULL, wxT("Can not call onPrevious without topframe set."));
 	_topframe->switchToPreviousPage();
 }
 
 bool WizardPage::onCancel(wxWindow *panel) {
+	wxASSERT_MSG(_topframe != NULL, wxT("Can not call onCancel without topframe set."));
 	wxMessageDialog dlg(panel, wxT("Are you sure you want to abort the wizard?"), wxT("Abort"), wxYES | wxNO);
 	wxWindowID ret = dlg.ShowModal();
 	if (ret == wxID_YES) {
@@ -107,8 +114,8 @@
 	EVT_BUTTON(ID_ADVANCED, IntroPage::onClickAdvanced)
 END_EVENT_TABLE()
 
-IntroPage::IntroPage(ScummToolsFrame *frame)
-	: WizardPage(frame)
+IntroPage::IntroPage(Configuration &config)
+	: WizardPage(config)
 {
 }
 
@@ -189,26 +196,26 @@
 	_configuration.compressing = true;
 	_configuration.advanced = false;
 
-	switchPage(new ChooseInPage(_topframe));
+	switchPage(new ChooseInPage(_configuration));
 }
 
 void IntroPage::onClickExtract(wxCommandEvent &e) {
 	_configuration.compressing = false;
 	_configuration.advanced = false;
 
-	switchPage(new ChooseInPage(_topframe));
+	switchPage(new ChooseInPage(_configuration));
 }
 
 void IntroPage::onClickAdvanced(wxCommandEvent &e) {
 	_configuration.advanced = true;
 
-	switchPage(new ChooseToolPage(_topframe));
+	switchPage(new ChooseToolPage(_configuration));
 }
 
 // Page to choose the tool to use
 
-ChooseToolPage::ChooseToolPage(ScummToolsFrame *frame, const wxArrayString &options)
-	: WizardPage(frame),
+ChooseToolPage::ChooseToolPage(Configuration &config, const wxArrayString &options)
+	: WizardPage(config),
 	  _options(options)
 {
 }
@@ -282,11 +289,11 @@
 	const ToolGUI *tool = g_tools.get(static_cast<wxChoice *>(panel->FindWindowByName(wxT("ToolSelection")))->GetStringSelection());
 
 	if (_configuration.advanced)
-		switchPage(new ChooseInPage(_topframe));
+		switchPage(new ChooseInPage(_configuration));
 	else if (tool && tool->getInputList().size() > 1)
-		switchPage(new ChooseExtraInPage(_topframe));
+		switchPage(new ChooseExtraInPage(_configuration));
 	else
-		switchPage(new ChooseOutPage(_topframe));
+		switchPage(new ChooseOutPage(_configuration));
 }
 
 void ChooseToolPage::onChangeTool(wxCommandEvent &evt) {
@@ -304,12 +311,14 @@
 
 // Common base class for the IO pages
 
-ChooseIOPage::ChooseIOPage(ScummToolsFrame *frame)
-	: WizardPage(frame)
+ChooseIOPage::ChooseIOPage(Configuration &config)
+	: WizardPage(config)
 {
 }
 
 void ChooseIOPage::onSelectFile(wxFileDirPickerEvent &evt) {
+	wxASSERT_MSG(_topframe != NULL, wxT("Can not call onSelectFile without topframe set."));
+
 	wxWindow *win = dynamic_cast<wxWindow *>(evt.GetEventObject());
 	wxPanel *panel = dynamic_cast<wxPanel *>(win->GetParent());
 	
@@ -348,8 +357,8 @@
 
 // Page to choose input directory or file
 
-ChooseInPage::ChooseInPage(ScummToolsFrame *frame)
-	: ChooseIOPage(frame)
+ChooseInPage::ChooseInPage(Configuration &config)
+	: ChooseIOPage(config)
 {
 }
 
@@ -433,20 +442,20 @@
 
 	if (_configuration.advanced) {
 		if (_configuration.selectedTool->getInputList().size() > 1)
-			switchPage(new ChooseExtraInPage(_topframe));
+			switchPage(new ChooseExtraInPage(_configuration));
 		else
-			switchPage(new ChooseOutPage(_topframe));
+			switchPage(new ChooseOutPage(_configuration));
 	} else {
 		wxArrayString ls = g_tools.getToolList(filename,
 			_configuration.compressing? TOOLTYPE_COMPRESSION : TOOLTYPE_EXTRACTION);
 		if(ls.size() == 1) {
 			_configuration.selectedTool = g_tools.get(ls[0]);
 			if (_configuration.selectedTool->getInputList().size() == 1)
-				switchPage(new ChooseOutPage(_topframe));
+				switchPage(new ChooseOutPage(_configuration));
 			else
-				switchPage(new ChooseExtraInPage(_topframe));
+				switchPage(new ChooseExtraInPage(_configuration));
 		} else {
-			switchPage(new ChooseToolPage(_topframe, ls));
+			switchPage(new ChooseToolPage(_configuration, ls));
 		}
 	}
 }
@@ -466,8 +475,8 @@
 
 // Page to choose input and output directory or file
 
-ChooseExtraInPage::ChooseExtraInPage(ScummToolsFrame *frame)
-	: ChooseIOPage(frame)
+ChooseExtraInPage::ChooseExtraInPage(Configuration &config)
+	: ChooseIOPage(config)
 {
 }
 
@@ -573,13 +582,13 @@
 }
 
 void ChooseExtraInPage::onNext(wxWindow *panel) {
-	switchPage(new ChooseOutPage(_topframe));
+	switchPage(new ChooseOutPage(_configuration));
 }
 
 // Page to choose input and output directory or file
 
-ChooseOutPage::ChooseOutPage(ScummToolsFrame *frame)
-	: ChooseIOPage(frame)
+ChooseOutPage::ChooseOutPage(Configuration &config)
+	: ChooseIOPage(config)
 {
 }
 
@@ -666,15 +675,15 @@
 
 void ChooseOutPage::onNext(wxWindow *panel) {
 	if (_configuration.selectedTool->getType() == TOOLTYPE_COMPRESSION)
-		switchPage(new ChooseTargetPlatformPage(_topframe));
+		switchPage(new ChooseTargetPlatformPage(_configuration));
 	else
-		switchPage(new ProcessPage(_topframe));
+		switchPage(new ProcessPage(_configuration));
 }
 
 // Page to choose input and output directory or file
 
-ChooseTargetPlatformPage::ChooseTargetPlatformPage(ScummToolsFrame *frame)
-	: WizardPage(frame)
+ChooseTargetPlatformPage::ChooseTargetPlatformPage(Configuration &config)
+	: WizardPage(config)
 {
 }
 
@@ -694,7 +703,7 @@
 
 	wxChoice *platform = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(80, -1), 
 		choices, 0, wxDefaultValidator, wxT("PlatformSelection"));
-	sizer->Add(platform);
+	sizer->Add(platform, wxSizerFlags().Expand().Border(wxRIGHT, 100));
 
 	SetAlignedSizer(panel, sizer);
 
@@ -720,13 +729,13 @@
 }
 
 void ChooseTargetPlatformPage::onNext(wxWindow *panel) {
-	switchPage(new ChooseAudioFormatPage(_topframe));
+	switchPage(new ChooseAudioFormatPage(_configuration));
 }
 
 // Page to choose input and output directory or file
 
-ChooseAudioFormatPage::ChooseAudioFormatPage(ScummToolsFrame *frame)
-	: WizardPage(frame)
+ChooseAudioFormatPage::ChooseAudioFormatPage(Configuration &config)
+	: WizardPage(config)
 {
 }
 
@@ -805,20 +814,20 @@
 	if (advanced->GetValue()) {
 
 		if (format->GetStringSelection() == wxT("Vorbis"))
-			switchPage(new ChooseAudioOptionsVorbisPage(_topframe));
+			switchPage(new ChooseAudioOptionsVorbisPage(_configuration));
 		else if (format->GetStringSelection() == wxT("FLAC"))
-			switchPage(new ChooseAudioOptionsFlacPage(_topframe));
+			switchPage(new ChooseAudioOptionsFlacPage(_configuration));
 		else if (format->GetStringSelection() == wxT("MP3"))
-			switchPage(new ChooseAudioOptionsMp3Page(_topframe));
+			switchPage(new ChooseAudioOptionsMp3Page(_configuration));
 	} else {
-		switchPage(new ProcessPage(_topframe));
+		switchPage(new ProcessPage(_configuration));
 	}
 }
 
 // Page to choose Mp3 compression options
 
-ChooseAudioOptionsMp3Page::ChooseAudioOptionsMp3Page(ScummToolsFrame *frame)
-	: WizardPage(frame)
+ChooseAudioOptionsMp3Page::ChooseAudioOptionsMp3Page(Configuration &config)
+	: WizardPage(config)
 {
 }
 
@@ -868,7 +877,7 @@
 	wxChoice *vbrMinBitrate = new wxChoice(
 		panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 
 		possibleBitrateCount, possibleBitrates, 0, wxDefaultValidator, wxT("MinimumBitrate"));
-	sizer->Add(vbrMinBitrate, wxSizerFlags().Expand());
+	sizer->Add(vbrMinBitrate, wxSizerFlags().Expand().Border(wxRIGHT, 100));
 	
 
 	sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Maximum Bitrate:")));
@@ -876,7 +885,7 @@
 	wxChoice *vbrMaxBitrate = new wxChoice(
 		panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 
 		possibleBitrateCount, possibleBitrates, 0, wxDefaultValidator, wxT("MaximumBitrate"));
-	sizer->Add(vbrMaxBitrate, wxSizerFlags().Expand());
+	sizer->Add(vbrMaxBitrate, wxSizerFlags().Expand().Border(wxRIGHT, 100));
 	
 
 	sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Average Bitrate:")));
@@ -884,7 +893,7 @@
 	wxChoice *abrAvgBitrate = new wxChoice(
 		panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 
 		possibleBitrateCount, possibleBitrates, 0, wxDefaultValidator, wxT("AverageBitrate"));
-	sizer->Add(abrAvgBitrate, wxSizerFlags().Expand());
+	sizer->Add(abrAvgBitrate, wxSizerFlags().Expand().Border(wxRIGHT, 100));
 
 	abrButton->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler(ChooseAudioOptionsMp3Page::onChangeCompressionType), NULL, this);
 	vbrButton->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler(ChooseAudioOptionsMp3Page::onChangeCompressionType), NULL, this);
@@ -901,7 +910,7 @@
 	wxChoice *vbrQuality = new wxChoice(
 		panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 
 		possibleQualityCount, possibleQualities, 0, wxDefaultValidator, wxT("VBRQuality"));
-	sizer->Add(vbrQuality, wxSizerFlags().Expand());
+	sizer->Add(vbrQuality, wxSizerFlags().Expand().Border(wxRIGHT, 100));
 	
 
 	sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("MPEG Quality:")));
@@ -909,7 +918,7 @@
 	wxChoice *mpegQuality = new wxChoice(
 		panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 
 		possibleQualityCount, possibleQualities, 0, wxDefaultValidator, wxT("MpegQuality"));
-	sizer->Add(mpegQuality, wxSizerFlags().Expand());
+	sizer->Add(mpegQuality, wxSizerFlags().Expand().Border(wxRIGHT, 100));
 
 	// Finish the window
 	SetAlignedSizer(panel, sizer);
@@ -975,13 +984,13 @@
 }
 
 void ChooseAudioOptionsMp3Page::onNext(wxWindow *panel) {
-	switchPage(new ProcessPage(_topframe));
+	switchPage(new ProcessPage(_configuration));
 }
 
 // Page to choose Flac compression options
 
-ChooseAudioOptionsFlacPage::ChooseAudioOptionsFlacPage(ScummToolsFrame *frame)
-	: WizardPage(frame)
+ChooseAudioOptionsFlacPage::ChooseAudioOptionsFlacPage(Configuration &config)
+	: WizardPage(config)
 {
 }
 
@@ -1023,7 +1032,7 @@
 	wxChoice *compressionLevel = new wxChoice(
 		panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 
 		possibleLevelCount, possibleLevels, 0, wxDefaultValidator, wxT("CompressionLevel"));
-	sizer->Add(compressionLevel, wxSizerFlags().Expand());
+	sizer->Add(compressionLevel, wxSizerFlags().Expand().Border(wxRIGHT, 100));
 
 
 	// Block Size
@@ -1040,7 +1049,7 @@
 	wxChoice *blockSize = new wxChoice(
 		panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 
 		sizeof blockSizes / sizeof *blockSizes, blockSizes, 0, wxDefaultValidator, wxT("BlockSize"));
-	sizer->Add(blockSize, wxSizerFlags().Expand());
+	sizer->Add(blockSize, wxSizerFlags().Expand().Border(wxRIGHT, 100));
 	
 	// Finish the window
 	topsizer->Add(sizer);
@@ -1063,13 +1072,13 @@
 }
 
 void ChooseAudioOptionsFlacPage::onNext(wxWindow *panel) {
-	switchPage(new ProcessPage(_topframe));
+	switchPage(new ProcessPage(_configuration));
 }
 
 // Page to choose Vorbis compression options
 
-ChooseAudioOptionsVorbisPage::ChooseAudioOptionsVorbisPage(ScummToolsFrame *frame)
-	: WizardPage(frame)
+ChooseAudioOptionsVorbisPage::ChooseAudioOptionsVorbisPage(Configuration &config)
+	: WizardPage(config)
 {
 }
 
@@ -1100,7 +1109,7 @@
 	wxChoice *MinBitrate = new wxChoice(
 		panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 
 		possibleBitrateCount, possibleBitrates, 0, wxDefaultValidator, wxT("MinimumBitrate"));
-	sizer->Add(MinBitrate, wxSizerFlags().Expand());
+	sizer->Add(MinBitrate, wxSizerFlags().Expand().Border(wxRIGHT, 100));
 	
 
 	sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Nominal Bitrate:")));
@@ -1108,7 +1117,7 @@
 	wxChoice *AvgBitrate = new wxChoice(
 		panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 
 		possibleBitrateCount, possibleBitrates, 0, wxDefaultValidator, wxT("NominalBitrate"));
-	sizer->Add(AvgBitrate, wxSizerFlags().Expand());
+	sizer->Add(AvgBitrate, wxSizerFlags().Expand().Border(wxRIGHT, 100));
 	
 
 	sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Maximum Bitrate:")));
@@ -1116,7 +1125,7 @@
 	wxChoice *MaxBitrate = new wxChoice(
 		panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 
 		possibleBitrateCount, possibleBitrates, 0, wxDefaultValidator, wxT("MaximumBitrate"));
-	sizer->Add(MaxBitrate, wxSizerFlags().Expand());
+	sizer->Add(MaxBitrate, wxSizerFlags().Expand().Border(wxRIGHT, 100));
 
 	// Quality
 	const int possibleQualityCount = 10;
@@ -1130,7 +1139,7 @@
 	wxChoice *quality = new wxChoice(
 		panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 
 		possibleQualityCount, possibleQualities, 0, wxDefaultValidator, wxT("Quality"));
-	sizer->Add(quality, wxSizerFlags().Expand());
+	sizer->Add(quality, wxSizerFlags().Expand().Border(wxRIGHT, 100));
 
 	// Finish the window
 	SetAlignedSizer(panel, sizer);
@@ -1158,14 +1167,14 @@
 }
 
 void ChooseAudioOptionsVorbisPage::onNext(wxWindow *panel) {
-	switchPage(new ProcessPage(_topframe));
+	switchPage(new ProcessPage(_configuration));
 }
 
 
 // Page to choose ANY tool to use
 
-ProcessPage::ProcessPage(ScummToolsFrame *frame)
-	: WizardPage(frame),
+ProcessPage::ProcessPage(Configuration &config)
+	: WizardPage(config),
 	  _finished(false),
 	  _success(false)
 {
@@ -1282,7 +1291,8 @@
 		_finished = true;
 
 		// Update UI
-		updateButtons(panel, _topframe->_buttons);
+		if (_topframe)
+			updateButtons(panel, _topframe->_buttons);
 		return false;
 	}
 
@@ -1296,9 +1306,9 @@
 
 void ProcessPage::onNext(wxWindow *panel) {
 	if (_success)
-		switchPage(new FinishPage(_topframe));
+		switchPage(new FinishPage(_configuration));
 	else
-		switchPage(new FailurePage(_topframe));
+		switchPage(new FailurePage(_configuration));
 }
 
 bool ProcessPage::onCancel(wxWindow *panel) {
@@ -1406,8 +1416,8 @@
 
 // Last page of the wizard, offers the option to open the output directory
 
-FinishPage::FinishPage(ScummToolsFrame *frame)
-	: WizardPage(frame)
+FinishPage::FinishPage(Configuration &config)
+	: WizardPage(config)
 {
 }
 
@@ -1466,8 +1476,8 @@
 
 // If the tool fails, this page is shown instead of the last page
 
-FailurePage::FailurePage(ScummToolsFrame *frame)
-	: WizardPage(frame)
+FailurePage::FailurePage(Configuration &config)
+	: WizardPage(config)
 {
 }
 

Modified: tools/branches/gsoc2009-gui/gui/pages.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.h	2009-08-22 17:20:55 UTC (rev 43659)
+++ tools/branches/gsoc2009-gui/gui/pages.h	2009-08-22 18:44:35 UTC (rev 43660)
@@ -38,10 +38,19 @@
 
 class WizardPage : public wxEvtHandler {
 public:
-	WizardPage(ScummToolsFrame *frame);
+	WizardPage(Configuration &config);
 	~WizardPage() {}
 
 	/**
+	 * Associate a topframe with this WizardPage, if the page is a child of another type
+	 * of window, you shouldn't call this. Note that button response functions cannot be
+	 * called without a topframe
+	 *
+	 * @param topframe The topframe to associate with.
+	 */
+	void SetScummFrame(ScummToolsFrame *topframe);
+
+	/**
 	 * Creates a visual representation of this page as a child problem of the supplied parent
 	 * Values will be loaded from the configuration object stored by the ScummToolsFrame
 	 * 
@@ -141,7 +150,7 @@
 
 class IntroPage : public WizardPage {
 public:
-	IntroPage(ScummToolsFrame *frame);
+	IntroPage(Configuration &configuration);
 	
 	wxWindow *CreatePanel(wxWindow *parent);
 
@@ -165,7 +174,7 @@
 
 class ChooseToolPage : public WizardPage {
 public:
-	ChooseToolPage(ScummToolsFrame *frame, const wxArrayString &options = wxArrayString());
+	ChooseToolPage(Configuration &config, const wxArrayString &options = wxArrayString());
 
 	wxWindow *CreatePanel(wxWindow *parent);
 
@@ -189,7 +198,7 @@
 
 class ChooseIOPage : public WizardPage  {
 public:
-	ChooseIOPage(ScummToolsFrame *frame);
+	ChooseIOPage(Configuration &configuration);
 
 	void onSelectFile(wxFileDirPickerEvent &evt);
 	
@@ -202,7 +211,7 @@
 
 class ChooseInPage : public ChooseIOPage {
 public:
-	ChooseInPage(ScummToolsFrame *frame);
+	ChooseInPage(Configuration &configuration);
 
 	wxWindow *CreatePanel(wxWindow *parent);
 
@@ -221,7 +230,7 @@
 
 class ChooseExtraInPage : public ChooseIOPage {
 public:
-	ChooseExtraInPage(ScummToolsFrame *frame);
+	ChooseExtraInPage(Configuration &configuration);
 
 	wxWindow *CreatePanel(wxWindow *parent);
 
@@ -241,7 +250,7 @@
 
 class ChooseOutPage : public ChooseIOPage {
 public:
-	ChooseOutPage(ScummToolsFrame *frame);
+	ChooseOutPage(Configuration &configuration);
 
 	wxWindow *CreatePanel(wxWindow *parent);
 
@@ -260,7 +269,7 @@
 
 class ChooseAudioFormatPage : public WizardPage {
 public:
-	ChooseAudioFormatPage(ScummToolsFrame *frame);
+	ChooseAudioFormatPage(Configuration &configuration);
 
 	wxWindow *CreatePanel(wxWindow *parent);
 
@@ -277,7 +286,7 @@
 
 class ChooseTargetPlatformPage : public WizardPage {
 public:
-	ChooseTargetPlatformPage(ScummToolsFrame *frame);
+	ChooseTargetPlatformPage(Configuration &configuration);
 
 	wxWindow *CreatePanel(wxWindow *parent);
 
@@ -295,7 +304,7 @@
 
 class ChooseAudioOptionsMp3Page : public WizardPage {
 public:
-	ChooseAudioOptionsMp3Page(ScummToolsFrame *frame);
+	ChooseAudioOptionsMp3Page(Configuration &configuration);
 
 	wxWindow *CreatePanel(wxWindow *parent);
 
@@ -323,7 +332,7 @@
 
 class ChooseAudioOptionsFlacPage : public WizardPage {
 public:
-	ChooseAudioOptionsFlacPage(ScummToolsFrame *frame);
+	ChooseAudioOptionsFlacPage(Configuration &configuration);
 
 	wxWindow *CreatePanel(wxWindow *parent);
 
@@ -339,7 +348,7 @@
 
 class ChooseAudioOptionsVorbisPage : public WizardPage {
 public:
-	ChooseAudioOptionsVorbisPage(ScummToolsFrame *frame);
+	ChooseAudioOptionsVorbisPage(Configuration &configuration);
 
 	wxWindow *CreatePanel(wxWindow *parent);
 
@@ -445,7 +454,7 @@
 	ThreadCommunicationBuffer _output;
 
 public:
-	ProcessPage(ScummToolsFrame *frame);
+	ProcessPage(Configuration &configuration);
 
 	wxWindow *CreatePanel(wxWindow *parent);
 
@@ -474,7 +483,7 @@
 
 class FinishPage : public WizardPage {
 public:
-	FinishPage(ScummToolsFrame *frame);
+	FinishPage(Configuration &configuration);
 
 	wxWindow *CreatePanel(wxWindow *parent);
 	
@@ -492,7 +501,7 @@
 
 class FailurePage : public WizardPage {
 public:
-	FailurePage(ScummToolsFrame *frame);
+	FailurePage(Configuration &configuration);
 
 	wxWindow *CreatePanel(wxWindow *parent);
 


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