[Scummvm-cvs-logs] SF.net SVN: scummvm:[41651] tools/branches/gsoc2009-gui/gui
Remere at users.sourceforge.net
Remere at users.sourceforge.net
Fri Jun 19 01:08:59 CEST 2009
Revision: 41651
http://scummvm.svn.sourceforge.net/scummvm/?rev=41651&view=rev
Author: Remere
Date: 2009-06-18 23:08:59 +0000 (Thu, 18 Jun 2009)
Log Message:
-----------
*Moved Wizard Pages into their own files.
Modified Paths:
--------------
tools/branches/gsoc2009-gui/gui/main.cpp
tools/branches/gsoc2009-gui/gui/main.h
Added Paths:
-----------
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-06-18 22:51:47 UTC (rev 41650)
+++ tools/branches/gsoc2009-gui/gui/main.cpp 2009-06-18 23:08:59 UTC (rev 41651)
@@ -1,4 +1,4 @@
-/* gui_main.cpp - Main entry point for the tool GUI
+/* main.cpp - Main entry point for the tool GUI
* Copyright (C) 2009 The ScummVM project
*
* This program is free software; you can redistribute it and/or
@@ -34,6 +34,8 @@
#include "main.h"
+#include "pages.h"
+
class ScummVMToolsApp : public wxApp
{
virtual bool OnInit();
@@ -276,199 +278,3 @@
dc.DrawText(wxT("Extraction & Compression Wizard"), 290, 70);
}
-WizardPage::WizardPage(wxWindow *parent)
- : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxT("Wizard Page")),
- _nextPage(NULL),
- _prevPage(NULL),
- _buttons(NULL)
-{
-}
-
-void WizardPage::updateButtons() {
- // Do nothing
-}
-
-void WizardPage::SetAlignedSizer(wxSizer *sizer) {
- wxSizer *topsizer = new wxBoxSizer(wxHORIZONTAL);
- topsizer->AddSpacer(100);
- topsizer->Add(sizer);
- SetSizer(topsizer);
-}
-
-void WizardPage::SwitchPage(WizardPage *next) {
- wxWindow *grandparent = GetParent();
- while(grandparent->GetParent() != NULL)
- grandparent = grandparent->GetParent();
-
- if(grandparent) {
- ScummToolsFrame *frame = dynamic_cast<ScummToolsFrame*>(grandparent);
- frame->SwitchPage(next);
- // We are probably dead now, make sure to do nothing
- // involving member variabls after this point
- }
-}
-
-// Our default handler for cancel
-void WizardPage::onCancel() {
- wxMessageDialog dlg(this, wxT("Are you sure you want to abort the wizard?"), wxT("Abort"), wxYES | wxNO);
- wxWindowID ret = dlg.ShowModal();
- if(ret == wxID_YES) {
- wxWindow *grandparent = GetParent();
- while(grandparent->GetParent() != NULL)
- grandparent = grandparent->GetParent();
-
- grandparent->Close(true);
- } else {
- // Do nothing
- }
-}
-
-void WizardPage::onUpdateButtons(WizardButtons *buttons) {
- // We have this functions to avoid having to this in every child handler
- _buttons = buttons;
- updateButtons();
-}
-
-// Load/Save settings
-void WizardPage::load(Configuration &configuration) {
-}
-
-void WizardPage::save(Configuration &configuration) {
-}
-
-// Introduction page
-
-IntroPage::IntroPage(wxWindow *parent)
- : WizardPage(parent)
-{
- wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
-
- sizer->AddSpacer(15);
-
- sizer->Add(new wxStaticText(this, wxID_ANY,
- wxT("Welcome to the ScummVM extraction and compression utility.")));
- sizer->Add(new wxStaticText(this, wxID_ANY,
- wxT("Please select what you want to do, or drop a file or folder on this window for automatic .")));
-
- wxString choices[] = {
- wxT("Extract from game data files"),
- wxT("Compress audio files")
- };
-
- _options = new wxRadioBox(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, 2, choices, 1, wxRA_SPECIFY_COLS | wxBORDER_NONE);
- sizer->Add(_options);
- _options->SetSelection(0);
-
- SetAlignedSizer(sizer);
-}
-
-void IntroPage::updateButtons() {
- _buttons->showPrevious(false);
- _buttons->enableNext(true);
-}
-
-void IntroPage::load(Configuration &config) {
- if(config.compressing)
- _options->SetSelection(1);
-}
-
-void IntroPage::save(Configuration &config) {
- config.compressing = _options->GetStringSelection().Lower().Find(wxT("extract")) == wxNOT_FOUND;
-}
-
-void IntroPage::onNext() {
- if(_options->GetStringSelection().Lower().Find(wxT("extract")) != wxNOT_FOUND) {
- // extract
- } else {
- // compress
- SwitchPage(new CompressionPage(this->GetParent()));
- }
-}
-
-// Page to choose compression tool
-
-CompressionPage::CompressionPage(wxWindow *parent)
- : WizardPage(parent)
-{
- wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
-
- sizer->AddSpacer(15);
-
- sizer->Add(new wxStaticText(this, wxID_ANY,
- wxT("Please select for what game/engine you'd like to compress files.")));
-
- // This list is most likely incomplete
- wxArrayString choices;
-
- // Many games use the same tool internally, and are grouped by tool used here
- // the array is ordered before being displayed, though
-
- // compress_agos
- choices.Add(wxT("Feeble Files")),
- choices.Add(wxT("Simon the Sorcerer I/II")),
-
- // compress_gob
- choices.Add(wxT("Gobliiins (all versions)")),
-
- // compress_kyra
- choices.Add(wxT("The Legend of Kyrandia")),
- choices.Add(wxT("The Legend of Kyrandia: Hand of Fate")),
- choices.Add(wxT("The Legend of Kyrandia: Malcolm's Revenge")),
- choices.Add(wxT("Lands of Lore: The Throne of Chaos")),
-
- // compress_queen
- choices.Add(wxT("Flight of the Amazon Queen")),
-
- // compress_saga
- choices.Add(wxT("SAGA: Inherit The Earth")),
- choices.Add(wxT("I Have No Mouth")),
- choices.Add(wxT("I Must Scream")),
-
- // compress_scumm_bun
- choices.Add(wxT("The Secret of Monkey Island")),
- choices.Add(wxT("Monkey Island 2: LeChuck's Revenge")),
- choices.Add(wxT("The Curse of Monkey Island")),
-
- // compress_scumm_san
- // compress_scumm_sou
- // Unsure of exact games...
-
- // compress_sword1
- choices.Add(wxT("Broken Sword 1")),
-
- // compress_sword2
- choices.Add(wxT("Broken Sword 2")),
-
- // compress_touche
- choices.Add(wxT("Touch\xE9: The Adventures of the Fifth Musketeer")),
-
- // compress_tucker
- choices.Add(wxT("Bud Tucker in Double Trouble")),
-
-
- // Sort the array for display
- choices.Sort();
-
- _game = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
- sizer->Add(_game);
- _game->SetSelection(0);
-
- SetAlignedSizer(sizer);
-}
-
-void CompressionPage::onPrevious() {
- // It's kinda ugly that we must know the type here, would be better
- // if we could infer previous page automatically, somehow, possibly
- // templates + inheritence could solve this?
- SwitchPage(new IntroPage(this->GetParent()));
-}
-
-
-// Load/Save settings
-void CompressionPage::load(Configuration &config) {
- _game->SetStringSelection(config.selectedGame);
-}
-
-void CompressionPage::save(Configuration &config) {
- config.selectedGame = _game->GetStringSelection();
-}
Modified: tools/branches/gsoc2009-gui/gui/main.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/main.h 2009-06-18 22:51:47 UTC (rev 41650)
+++ tools/branches/gsoc2009-gui/gui/main.h 2009-06-18 23:08:59 UTC (rev 41651)
@@ -1,4 +1,4 @@
-/* gui_main.h - Main window classes for the tool GUI
+/* main.h - Main window classes for the tool GUI
* Copyright (C) 2009 The ScummVM project
*
* This program is free software; you can redistribute it and/or
@@ -118,74 +118,4 @@
DECLARE_EVENT_TABLE()
};
-// Wizard Page
-// A page in the extraction wizard
-// This class is responsible for almost everything!
-
-class WizardPage : public wxPanel
-{
-public:
- WizardPage(wxWindow *parent);
- virtual void updateButtons();
-
- // This adds an offset (about 100px) to the left of the sizer
- // to center the text somewhat, before adding it to the panel
- void SetAlignedSizer(wxSizer *sizer);
-
- // This calls parent -> SwitchPage
- // This page WILL BE DELETED
- // You should return out of this class immedietly after calling this function
- void SwitchPage(WizardPage *next);
-
- // Load/Save configuration
- virtual void load(Configuration &configuration);
- virtual void save(Configuration &configuration);
-
- // Event handlers
- // overload these to handle prev/next/cancel clicks
- virtual void onNext() {}
- virtual void onPrevious() {}
- virtual void onCancel(); // Default is to display 'Are you sure' and quit if you click 'Yes'
-
- // Calls updateButtons
- void onUpdateButtons(WizardButtons *buttons);
-
-protected:
- WizardPage *_nextPage;
- WizardPage *_prevPage;
- WizardButtons *_buttons;
-};
-
-// Introduction page, with options to extract/compress
-
-class IntroPage : public WizardPage
-{
-public:
- IntroPage(wxWindow *parent);
- virtual void updateButtons();
-
- void load(Configuration &configuration);
- void save(Configuration &configuration);
-
- virtual void onNext();
-
-protected:
- wxRadioBox *_options;
-};
-
-class CompressionPage : public WizardPage
-{
-public:
- CompressionPage(wxWindow *parent);
-
- void load(Configuration &configuration);
- void save(Configuration &configuration);
-
- virtual void onPrevious();
-
-protected:
- wxChoice *_game;
-};
-
-
#endif
Added: tools/branches/gsoc2009-gui/gui/pages.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.cpp (rev 0)
+++ tools/branches/gsoc2009-gui/gui/pages.cpp 2009-06-18 23:08:59 UTC (rev 41651)
@@ -0,0 +1,231 @@
+/* pages.cpp - All the pages in the wizard
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/wx.h"
+#endif
+
+#include "main.h"
+#include "pages.h"
+
+WizardPage::WizardPage(wxWindow *parent)
+ : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxT("Wizard Page")),
+ _nextPage(NULL),
+ _prevPage(NULL),
+ _buttons(NULL)
+{
+}
+
+void WizardPage::updateButtons() {
+ // Do nothing
+}
+
+void WizardPage::SetAlignedSizer(wxSizer *sizer) {
+ wxSizer *topsizer = new wxBoxSizer(wxHORIZONTAL);
+ topsizer->AddSpacer(100);
+ topsizer->Add(sizer);
+ SetSizer(topsizer);
+}
+
+void WizardPage::SwitchPage(WizardPage *next) {
+ wxWindow *grandparent = GetParent();
+ while(grandparent->GetParent() != NULL)
+ grandparent = grandparent->GetParent();
+
+ if(grandparent) {
+ ScummToolsFrame *frame = dynamic_cast<ScummToolsFrame*>(grandparent);
+ frame->SwitchPage(next);
+ // We are probably dead now, make sure to do nothing
+ // involving member variabls after this point
+ }
+}
+
+// Our default handler for cancel
+void WizardPage::onCancel() {
+ wxMessageDialog dlg(this, wxT("Are you sure you want to abort the wizard?"), wxT("Abort"), wxYES | wxNO);
+ wxWindowID ret = dlg.ShowModal();
+ if(ret == wxID_YES) {
+ wxWindow *grandparent = GetParent();
+ while(grandparent->GetParent() != NULL)
+ grandparent = grandparent->GetParent();
+
+ grandparent->Close(true);
+ } else {
+ // Do nothing
+ }
+}
+
+void WizardPage::onUpdateButtons(WizardButtons *buttons) {
+ // We have this functions to avoid having to this in every child handler
+ _buttons = buttons;
+ updateButtons();
+}
+
+// Load/Save settings
+void WizardPage::load(Configuration &configuration) {
+}
+
+void WizardPage::save(Configuration &configuration) {
+}
+
+// Introduction page
+
+IntroPage::IntroPage(wxWindow *parent)
+ : WizardPage(parent)
+{
+ wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+
+ sizer->AddSpacer(15);
+
+ sizer->Add(new wxStaticText(this, wxID_ANY,
+ wxT("Welcome to the ScummVM extraction and compression utility.")));
+ sizer->Add(new wxStaticText(this, wxID_ANY,
+ wxT("Please select what you want to do, or drop a file or folder on this window for automatic .")));
+
+ wxString choices[] = {
+ wxT("Extract from game data files"),
+ wxT("Compress audio files")
+ };
+
+ _options = new wxRadioBox(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, 2, choices, 1, wxRA_SPECIFY_COLS | wxBORDER_NONE);
+ sizer->Add(_options);
+ _options->SetSelection(0);
+
+ SetAlignedSizer(sizer);
+}
+
+void IntroPage::updateButtons() {
+ _buttons->showPrevious(false);
+ _buttons->enableNext(true);
+}
+
+void IntroPage::load(Configuration &config) {
+ if(config.compressing)
+ _options->SetSelection(1);
+}
+
+void IntroPage::save(Configuration &config) {
+ config.compressing = _options->GetStringSelection().Lower().Find(wxT("extract")) == wxNOT_FOUND;
+}
+
+void IntroPage::onNext() {
+ if(_options->GetStringSelection().Lower().Find(wxT("extract")) != wxNOT_FOUND) {
+ // extract
+ } else {
+ // compress
+ SwitchPage(new CompressionPage(this->GetParent()));
+ }
+}
+
+// Page to choose compression tool
+
+CompressionPage::CompressionPage(wxWindow *parent)
+ : WizardPage(parent)
+{
+ wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+
+ sizer->AddSpacer(15);
+
+ sizer->Add(new wxStaticText(this, wxID_ANY,
+ wxT("Please select for what game/engine you'd like to compress files.")));
+
+ // This list is most likely incomplete
+ wxArrayString choices;
+
+ // Many games use the same tool internally, and are grouped by tool used here
+ // the array is ordered before being displayed, though
+
+ // compress_agos
+ choices.Add(wxT("Feeble Files")),
+ choices.Add(wxT("Simon the Sorcerer I/II")),
+
+ // compress_gob
+ choices.Add(wxT("Gobliiins (all versions)")),
+
+ // compress_kyra
+ choices.Add(wxT("The Legend of Kyrandia")),
+ choices.Add(wxT("The Legend of Kyrandia: Hand of Fate")),
+ choices.Add(wxT("The Legend of Kyrandia: Malcolm's Revenge")),
+ choices.Add(wxT("Lands of Lore: The Throne of Chaos")),
+
+ // compress_queen
+ choices.Add(wxT("Flight of the Amazon Queen")),
+
+ // compress_saga
+ choices.Add(wxT("SAGA: Inherit The Earth")),
+ choices.Add(wxT("I Have No Mouth")),
+ choices.Add(wxT("I Must Scream")),
+
+ // compress_scumm_bun
+ choices.Add(wxT("The Secret of Monkey Island")),
+ choices.Add(wxT("Monkey Island 2: LeChuck's Revenge")),
+ choices.Add(wxT("The Curse of Monkey Island")),
+
+ // compress_scumm_san
+ // compress_scumm_sou
+ // Unsure of exact games...
+
+ // compress_sword1
+ choices.Add(wxT("Broken Sword 1")),
+
+ // compress_sword2
+ choices.Add(wxT("Broken Sword 2")),
+
+ // compress_touche
+ choices.Add(wxT("Touche: The Adventures of the Fifth Musketeer")),
+
+ // compress_tucker
+ choices.Add(wxT("Bud Tucker in Double Trouble")),
+
+
+ // Sort the array for display
+ choices.Sort();
+
+ _game = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
+ sizer->Add(_game);
+ _game->SetSelection(0);
+
+ SetAlignedSizer(sizer);
+}
+
+void CompressionPage::onPrevious() {
+ // It's kinda ugly that we must know the type here, would be better
+ // if we could infer previous page automatically, somehow, possibly
+ // templates + inheritence could solve this?
+ SwitchPage(new IntroPage(this->GetParent()));
+}
+
+
+// Load/Save settings
+void CompressionPage::load(Configuration &config) {
+ _game->SetStringSelection(config.selectedGame);
+}
+
+void CompressionPage::save(Configuration &config) {
+ config.selectedGame = _game->GetStringSelection();
+}
Property changes on: tools/branches/gsoc2009-gui/gui/pages.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Added: tools/branches/gsoc2009-gui/gui/pages.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.h (rev 0)
+++ tools/branches/gsoc2009-gui/gui/pages.h 2009-06-18 23:08:59 UTC (rev 41651)
@@ -0,0 +1,93 @@
+/* pages.h - All the pages in the wizard
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+#include <wx/wx.h>
+
+#include "configuration.h"
+
+// Wizard Page
+// A page in the extraction wizard
+
+class WizardPage : public wxPanel
+{
+public:
+ WizardPage(wxWindow *parent);
+ virtual void updateButtons();
+
+ // This adds an offset (about 100px) to the left of the sizer
+ // to center the text somewhat, before adding it to the panel
+ void SetAlignedSizer(wxSizer *sizer);
+
+ // This calls parent -> SwitchPage
+ // This page WILL BE DELETED
+ // You should return out of this class immedietly after calling this function
+ void SwitchPage(WizardPage *next);
+
+ // Load/Save configuration
+ virtual void load(Configuration &configuration);
+ virtual void save(Configuration &configuration);
+
+ // Event handlers
+ // overload these to handle prev/next/cancel clicks
+ virtual void onNext() {}
+ virtual void onPrevious() {}
+ virtual void onCancel(); // Default is to display 'Are you sure' and quit if you click 'Yes'
+
+ // Calls updateButtons
+ void onUpdateButtons(WizardButtons *buttons);
+
+protected:
+ WizardPage *_nextPage;
+ WizardPage *_prevPage;
+ WizardButtons *_buttons;
+};
+
+// Introduction page, with options to extract/compress
+
+class IntroPage : public WizardPage
+{
+public:
+ IntroPage(wxWindow *parent);
+ virtual void updateButtons();
+
+ void load(Configuration &configuration);
+ void save(Configuration &configuration);
+
+ virtual void onNext();
+
+protected:
+ wxRadioBox *_options;
+};
+
+class CompressionPage : public WizardPage
+{
+public:
+ CompressionPage(wxWindow *parent);
+
+ void load(Configuration &configuration);
+ void save(Configuration &configuration);
+
+ virtual void onPrevious();
+
+protected:
+ wxChoice *_game;
+};
Property changes on: tools/branches/gsoc2009-gui/gui/pages.h
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
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