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

Remere at users.sourceforge.net Remere at users.sourceforge.net
Sat Jul 11 03:19:19 CEST 2009


Revision: 42363
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42363&view=rev
Author:   Remere
Date:     2009-07-11 01:19:19 +0000 (Sat, 11 Jul 2009)

Log Message:
-----------
*Alot of GUI tweaks with sizes, position etc.
*Added about dialog.
*Added extraIn page.
*"Open output folder" now works on Windows.

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/tools.cpp
    tools/branches/gsoc2009-gui/gui/tools.h

Modified: tools/branches/gsoc2009-gui/gui/main.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/main.cpp	2009-07-11 01:18:14 UTC (rev 42362)
+++ tools/branches/gsoc2009-gui/gui/main.cpp	2009-07-11 01:19:19 UTC (rev 42363)
@@ -31,6 +31,7 @@
 #endif
 
 #include <wx/statline.h>
+#include <wx/aboutdlg.h>
 
 #include "main.h"
 
@@ -102,7 +103,7 @@
 
 	// Buttons on the bottom
 	_buttons = new WizardButtons(main, linetext);
-	sizer->Add(_buttons, wxSizerFlags().Border().Right());
+	sizer->Add(_buttons, wxSizerFlags().Border().Center().Expand());
 	
 	// Create input page
 	WizardPage *introPage = new IntroPage(this);
@@ -161,12 +162,15 @@
 	if (_pages.back()->onIdle(dynamic_cast<wxPanel *>(_wizardpane->FindWindow(wxT("Wizard Page"))))) {
 		// We want more!
 		evt.RequestMore(true);
+		// This way we don't freeze the OS with continous events
+		wxMilliSleep(10);
 	}
 }
 
 //
 
 BEGIN_EVENT_TABLE(WizardButtons, wxPanel)
+	EVT_BUTTON(ID_ABOUT, WizardButtons::onClickAbout)
 	EVT_BUTTON(ID_NEXT, WizardButtons::onClickNext)
 	EVT_BUTTON(ID_PREV, WizardButtons::onClickPrevious)
 	EVT_BUTTON(ID_CANCEL, WizardButtons::onClickCancel)
@@ -177,23 +181,37 @@
 	  _linetext(linetext),
 	  _currentPage(NULL)
 {
+	wxSizer *topsizer = new wxBoxSizer(wxHORIZONTAL);
+
 	wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
 
+	_prev = new wxButton(this, ID_ABOUT, wxT("About"));
+	_prev->SetSize(80, -1);
+	sizer->Add(_prev, wxSizerFlags().Left().ReserveSpaceEvenIfHidden());
+
+	// Insert space between the buttons
+	topsizer->Add(sizer, wxSizerFlags().Left());
+	topsizer->Add(10, 10, 1, wxEXPAND);
+	sizer = new wxBoxSizer(wxHORIZONTAL);
+
+
 	_prev = new wxButton(this, ID_PREV, wxT("< Back"));
 	_prev->SetSize(80, -1);
-	sizer->Add(_prev, wxSizerFlags().Center().ReserveSpaceEvenIfHidden());
+	sizer->Add(_prev, wxSizerFlags().Right().ReserveSpaceEvenIfHidden());
 
 	_next = new wxButton(this, ID_NEXT, wxT("Next >"));
 	_next->SetSize(80, -1);
-	sizer->Add(_next, wxSizerFlags().Center().ReserveSpaceEvenIfHidden());
+	sizer->Add(_next, wxSizerFlags().Right().ReserveSpaceEvenIfHidden());
 
 	sizer->AddSpacer(10);
 
 	_cancel = new wxButton(this, ID_CANCEL, wxT("Cancel"));
 	_cancel->SetSize(80, -1);
-	sizer->Add(_cancel, wxSizerFlags().Center().ReserveSpaceEvenIfHidden());
+	sizer->Add(_cancel, wxSizerFlags().Right().ReserveSpaceEvenIfHidden());
+	
+	topsizer->Add(sizer, wxSizerFlags().Right());
 
-	SetSizerAndFit(sizer);
+	SetSizerAndFit(topsizer);
 
 	reset();
 }
@@ -244,6 +262,22 @@
 }
 
 // wx event handlers
+void WizardButtons::onClickAbout(wxCommandEvent &e) {
+	wxAboutDialogInfo about = wxAboutDialogInfo();
+	about.SetVersion(wxT("Development Version"));
+	about.SetCopyright(wxT("ScummVM Team 2009"));
+	about.SetLicense(
+		wxT("Published under the GNU General Public License\n")
+		wxT("This program comes with ABSOLUTELY NO WARRANTY\n")
+		wxT("This is free software, and you are welcome to redistribute it ")
+		wxT("under certain conditions"));
+	about.SetDescription(
+		wxT("This tool allows you to extract data files from several different games \n")
+		wxT("to be used by ScummVM, it can also compress audio data files into a more \n")
+		wxT("compact format than the original."));
+	::wxAboutBox(about);
+}
+
 void WizardButtons::onClickNext(wxCommandEvent &e) {
 	wxASSERT(_currentPage);
 	_currentPage->onNext(_currentPanel);

Modified: tools/branches/gsoc2009-gui/gui/main.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/main.h	2009-07-11 01:18:14 UTC (rev 42362)
+++ tools/branches/gsoc2009-gui/gui/main.h	2009-07-11 01:19:19 UTC (rev 42363)
@@ -37,6 +37,7 @@
 	ID_NEXT,
 	ID_PREV,
 	ID_CANCEL,
+	ID_ABOUT,
 };
 
 /**
@@ -148,7 +149,7 @@
 	void showFinish(bool show);
 
 	// wx event handlers
-	// overload the virtual functions below for the page-specific handlers
+	void onClickAbout(wxCommandEvent &e);
 	void onClickNext(wxCommandEvent &e);
 	void onClickPrevious(wxCommandEvent &e);
 	void onClickCancel(wxCommandEvent &e);

Modified: tools/branches/gsoc2009-gui/gui/pages.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.cpp	2009-07-11 01:18:14 UTC (rev 42362)
+++ tools/branches/gsoc2009-gui/gui/pages.cpp	2009-07-11 01:19:19 UTC (rev 42363)
@@ -62,7 +62,7 @@
 void WizardPage::SetAlignedSizer(wxWindow *panel, wxSizer *sizer) {
 	wxSizer *topsizer = new wxBoxSizer(wxHORIZONTAL);
 	topsizer->AddSpacer(100);
-	topsizer->Add(sizer, 0, wxEXPAND);
+	topsizer->Add(sizer, 1, wxEXPAND);
 	panel->SetSizer(topsizer);
 }
 
@@ -109,8 +109,6 @@
 
 	sizer->Add(new wxStaticText(panel, wxID_ANY, 
 		wxT("Welcome to the ScummVM extraction and compression utility.")));
-	sizer->Add(new wxStaticText(panel, wxID_ANY,
-		wxT("Please select what you want to do, or drop a file or folder on this window for automatic detection.")));
 	
 	wxString choices[] = {
 		wxT("Extract from game data files"),
@@ -187,6 +185,8 @@
 			wxT("Select what tool you'd like to use.")));
 		choices = g_tools.getToolList(TOOLTYPE_ALL);
 	}
+	
+	sizer->AddSpacer(20);
 
 	wxChoice *tool = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 
 		choices, 0, wxDefaultValidator, wxT("ToolSelection"));
@@ -230,22 +230,25 @@
 	sizer->AddSpacer(15);
 	
 	// some help perhaps?
-	sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Select an input file")));
+	sizer->Add(new wxStaticText(panel, wxID_ANY, 
+		wxT("Select an input file, if you have two input files (CD1 and CD2), ")
+		wxT("you will be queried for the other file later.")
+		wxT("You can also drag & drop a file on this window.")
+		),
+		wxSizerFlags(1).Expand());
 
 	sizer->AddSpacer(10);
 
-	// Create input selection
-	wxStaticBoxSizer *inputbox = new wxStaticBoxSizer(wxVERTICAL, panel, wxT("Input file"));
 
-
 	//if (input._file) {
-		inputbox->Add(new wxFilePickerCtrl(
+		sizer->Add(new wxFilePickerCtrl(
 				panel, wxID_ANY, wxEmptyString, wxT("Select a file"), 
 				wxT("*.*"), 
-				wxDefaultPosition, wxDefaultSize, 
+				wxDefaultPosition, wxSize(300, -1),
 				wxFLP_USE_TEXTCTRL | wxDIRP_DIR_MUST_EXIST, wxDefaultValidator, 
-				wxT("InputPicker")),
-			wxSizerFlags().Expand());
+				wxT("InputPicker")));
+
+	sizer->AddSpacer(30);
 	/* 
 	// TODO: There is no way to select directory input, yet
 	} else {
@@ -259,18 +262,12 @@
 	}
 	*/
 	
-	sizer->Add(inputbox, wxSizerFlags().Expand());
-	
 	SetAlignedSizer(panel, sizer);
 	
 	return panel;
 }
 
 void ChooseInPage::save(wxWindow *panel) {
-//	wxWindow *outputWindow = panel->FindWindowByName(wxT("OutputPicker"));
-//	wxDirPickerCtrl *outDirWindow = dynamic_cast<wxDirPickerCtrl *>(outputWindow);
-//	wxFilePickerCtrl *outFileWindow = dynamic_cast<wxFilePickerCtrl *>(outputWindow);
-
 	_configuration.inputFilePaths.clear();
 
 	wxDirPickerCtrl *inDirWindow = dynamic_cast<wxDirPickerCtrl *>(panel->FindWindowByName(wxT("InputPicker")));
@@ -283,11 +280,16 @@
 }
 
 void ChooseInPage::onNext(wxWindow *panel) {
-	if (_configuration.advanced)
-		// TODO: Display extra input page
-		switchPage(new ChooseOutPage(_topframe));
-	else
-		switchPage(new ChooseToolPage(_topframe, g_tools.getToolList()));
+	if (_configuration.advanced) {
+		if(_configuration.selectedTool->_inputs.size() > 1)
+			switchPage(new ChooseExtraInPage(_topframe));
+		else
+			switchPage(new ChooseOutPage(_topframe));
+	} else {
+		wxArrayString ls = g_tools.getToolList();
+		// TODO: If only one input, skip this page and go right to ExtraInput
+		switchPage(new ChooseToolPage(_topframe, ls));
+	}
 }
 
 // Page to choose input and output directory or file
@@ -316,6 +318,7 @@
 
 	int i = 1;
 	wxASSERT_MSG(tool._inputs.size() > 1, wxT("Extra input page should not display with only one input"));
+
 	for (ToolInputs::const_iterator iter = tool._inputs.begin() + 1; iter != tool._inputs.end(); ++iter) {
 		const ToolInput &input = *iter;
 
@@ -328,14 +331,14 @@
 				input._extension, 
 				wxDefaultPosition, wxDefaultSize, 
 				wxFLP_USE_TEXTCTRL | wxDIRP_DIR_MUST_EXIST, wxDefaultValidator, 
-				windowName), wxSizerFlags().Expand());
+				windowName));
 
 		} else {
 			inputbox->Add(new wxDirPickerCtrl(
 				panel, wxID_ANY, wxEmptyString, wxT("Select a folder"), 
 				wxDefaultPosition, wxDefaultSize, 
 				wxFLP_USE_TEXTCTRL | wxFLP_OPEN, wxDefaultValidator, 
-				windowName), wxSizerFlags().Expand());
+				windowName));
 
 		}
 		++i;
@@ -360,12 +363,13 @@
 
 	const ToolGUI &tool = *_configuration.selectedTool;
 
-	_configuration.inputFilePaths.clear();
+	// Remove all additional inputs
+	wxArrayString filelist = _configuration.inputFilePaths;
+	if(filelist.size() > 1)
+		filelist.erase(filelist.begin() + 1, filelist.end());
 
 	int i = 1;
 	for (ToolInputs::const_iterator iter = tool._inputs.begin(); iter != tool._inputs.end(); ++iter) {
-//		const ToolInput &input = *iter;
-
 		wxString windowName = wxT("InputPicker");
 		windowName << i;
 
@@ -402,7 +406,12 @@
 	const ToolGUI &tool = *_configuration.selectedTool;
 
 	// some help perhaps?
-	sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Select output directory / file")));
+	sizer->Add(new wxStaticText(panel, wxID_ANY, 
+		wxT("Select an output directory.\n\n")
+		wxT("Note: Some tools display file picker here, this should perhaps be changed to always ")
+		wxT("be directory output, since often don't want to name the output file.)")
+		),
+		wxSizerFlags(1).Expand());
 
 	// Create input selection	
 
@@ -415,22 +424,22 @@
 
 		box->Add(new wxDirPickerCtrl(
 			panel, wxID_ANY, _configuration.outputPath, wxT("Select a folder"), 
-			wxDefaultPosition, wxDefaultSize, 
+			wxDefaultPosition, wxSize(300, -1),
 			wxFLP_USE_TEXTCTRL | wxDIRP_DIR_MUST_EXIST, wxDefaultValidator, 
 			wxT("OutputPicker")));
 
-		sizer->Add(box, wxSizerFlags().Expand());
+		sizer->Add(box);
 	} else {
 		wxStaticBoxSizer *box = new wxStaticBoxSizer(wxHORIZONTAL, panel, wxT("Destination file"));
 
 		box->Add(new wxFilePickerCtrl(
 			panel, wxID_ANY, _configuration.outputPath, wxT("Select a file"), 
 			wxT("*.*"),
-			wxDefaultPosition, wxDefaultSize, 
+			wxDefaultPosition, wxSize(300, -1),
 			wxFLP_USE_TEXTCTRL | wxFLP_OVERWRITE_PROMPT | wxFLP_SAVE, wxDefaultValidator, 
 			wxT("OutputPicker")));
 		
-		sizer->Add(box, wxSizerFlags().Expand());
+		sizer->Add(box);
 	}
 
 	SetAlignedSizer(panel, sizer);
@@ -471,7 +480,9 @@
 	sizer->AddSpacer(15);
 
 	sizer->Add(new wxStaticText(panel, wxID_ANY, 
-		wxT("Select audio format you want to compress to")));
+		wxT("Select audio format you want to compress to.")));
+
+	sizer->AddSpacer(20);
 	
 	wxArrayString choices;
 
@@ -479,17 +490,15 @@
 	choices.Add(wxT("FLAC"));
 	choices.Add(wxT("MP3"));
 
-	sizer->AddSpacer(10);
-
 	wxChoice *format = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(80, -1), 
 		choices, 0, wxDefaultValidator, wxT("AudioSelection"));
-	sizer->Add(format, wxSizerFlags().Expand());
+	sizer->Add(format);
 	
 	sizer->AddSpacer(10);
 
 	wxCheckBox *advanced = new wxCheckBox(panel, wxID_ANY, wxT("Select advanced audio settings"), 
 		wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("AdvancedAudio"));
-	sizer->Add(advanced, wxSizerFlags().Expand());
+	sizer->Add(advanced);
 
 	SetAlignedSizer(panel, sizer);
 
@@ -1037,10 +1046,14 @@
 
 void FinishPage::onNext(wxWindow *panel) {
 	wxCheckBox *display = static_cast<wxCheckBox *>(panel->FindWindowByName(wxT("DisplayOutput")));
-	if (display->GetValue())
-		// Haven't found the function to do this yet...
-		//wxOpenExplorer(_topframe->_configuration.outputPath);
-		(void)0;
+	if (display->GetValue()) {
+		// There is no standard way to do this
+		// On windows we can simply spawn an explorer instance
+#ifdef __WINDOWS__
+		wxExecute(wxT("explorer.exe") + _topframe->_configuration.outputPath);
+#else
+#endif
+	}
 	_topframe->Close(true);
 }
 

Modified: tools/branches/gsoc2009-gui/gui/tools.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/tools.cpp	2009-07-11 01:18:14 UTC (rev 42362)
+++ tools/branches/gsoc2009-gui/gui/tools.cpp	2009-07-11 01:19:19 UTC (rev 42363)
@@ -44,6 +44,7 @@
 #include "../compress_scumm_san.h"
 #include "../compress_scumm_sou.h"
 #include "../compress_sword1.h"
+#include "../compress_sword2.h"
 #include "../compress_touche.h"
 #include "../compress_tinsel.h"
 #include "../compress_touche.h"
@@ -77,6 +78,7 @@
 	addTool(new ToolGUI(new CompressScummSan()));
 	addTool(new ToolGUI(new CompressScummSou()));
 	addTool(new ToolGUI(new CompressSword1()));
+	addTool(new ToolGUI(new CompressSword2()));
 	addTool(new ToolGUI(new CompressTinsel()));
 	addTool(new ToolGUI(new CompressTouche(), wxT("/")));
 	addTool(new ToolGUI(new CompressTucker(), wxT("/")));
@@ -85,8 +87,12 @@
 	addTool(new ToolGUI(new ExtractGobStk()));
 	addTool(new ToolGUI(new ExtractLoomTG16()));
 	addTool(new ToolGUI(new ExtractMMApple()));
-	addTool(new ToolGUI(new ExtractMMC64()));
-	addTool(new ToolGUI(new ExtractMMNes()));
+	ToolGUI *mmc64 = new ToolGUI(new ExtractMMC64());
+	mmc64->addInput(wxT("*.*"));
+	addTool(mmc64);
+	ToolGUI *mmnes = new ToolGUI(new ExtractMMNes());
+	mmnes->addInput(wxT("*.*"));
+	addTool(mmnes);
 	addTool(new ToolGUI(new ExtractParallaction()));
 	addTool(new ToolGUI(new ExtractZakC64()));
 
@@ -301,6 +307,13 @@
 	_games.Add(game_name);
 }
 
+void ToolGUI::addInput(const wxString &input_wildcard, bool input_is_directory) {
+	ToolInput t;
+	t._extension = input_wildcard;
+	t._file = !input_is_directory;
+	_inputs.push_back(t);
+}
+
 bool ToolGUI::supportsAudioFormat(AudioFormat format) const {
 	return (_backend->_supported_formats & format) == format;
 }

Modified: tools/branches/gsoc2009-gui/gui/tools.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/tools.h	2009-07-11 01:18:14 UTC (rev 42362)
+++ tools/branches/gsoc2009-gui/gui/tools.h	2009-07-11 01:19:19 UTC (rev 42363)
@@ -92,6 +92,14 @@
 	 */
 	void addGame(const wxString &game_name);
 
+	/**
+	 * Adds a file input to the tool.
+	 *
+	 * @param input_wildcard The wildcard filename of the input, like "*.zip".
+	 * @param input_is_directory True if input is a directory (false by default).
+	 */
+	void addInput(const wxString &input_wildcard, bool input_is_directory = false);
+
 	// Helper functions to get info about the tool
 	
 	/**


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