[Scummvm-cvs-logs] SF.net SVN: scummvm: [28351] tools/branches/gsoc2007-toolsgui

lightcast at users.sourceforge.net lightcast at users.sourceforge.net
Tue Jul 31 04:07:32 CEST 2007


Revision: 28351
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28351&view=rev
Author:   lightcast
Date:     2007-07-30 19:07:32 -0700 (Mon, 30 Jul 2007)

Log Message:
-----------
Several changes to the compression options.  Compression options are now hidden by default but a checkbox has been added to show them.  Compression options are now filled to the same defaults as those found in compress.c.

Modified Paths:
--------------
    tools/branches/gsoc2007-toolsgui/tools_gui.cpp
    tools/branches/gsoc2007-toolsgui/tools_gui.h

Modified: tools/branches/gsoc2007-toolsgui/tools_gui.cpp
===================================================================
--- tools/branches/gsoc2007-toolsgui/tools_gui.cpp	2007-07-31 02:04:46 UTC (rev 28350)
+++ tools/branches/gsoc2007-toolsgui/tools_gui.cpp	2007-07-31 02:07:32 UTC (rev 28351)
@@ -24,17 +24,25 @@
 
 IMPLEMENT_APP(ToolsGui)
 
+BEGIN_EVENT_TABLE( CompressionOptions, wxPanel )
+	EVT_CHOICE(kCompressionModeChoice, CompressionOptions::OnCompressionModeChange)
+END_EVENT_TABLE()
+
 BEGIN_EVENT_TABLE( CompressionPanel, wxPanel )
 	EVT_CHOICE(kCompressionToolChoice, CompressionPanel::OnCompressionToolChange)
 	EVT_CHOICE(kCompressionTypeChoice, CompressionPanel::OnCompressionTypeChange)
-	EVT_CHOICE(kCompressionStartButton, CompressionPanel::OnCompressionStart)
+	EVT_BUTTON(kCompressionStartButton, CompressionPanel::OnCompressionStart)
 END_EVENT_TABLE()
 
 BEGIN_EVENT_TABLE( ExtractionPanel, wxPanel )
 	EVT_CHOICE(kExtractionToolChoice, ExtractionPanel::OnExtractionToolChange)
-	EVT_CHOICE(kExtractionStartButton, ExtractionPanel::OnExtractionStart)
+	EVT_BUTTON(kExtractionStartButton, ExtractionPanel::OnExtractionStart)
 END_EVENT_TABLE()
 
+BEGIN_EVENT_TABLE( MainFrame, wxFrame)
+	EVT_CHECKBOX(kCompressionOptionsToggle, MainFrame::OnCompressionOptionsToggle)
+END_EVENT_TABLE()
+
 bool ToolsGui::OnInit() {
 	MainFrame *frame = new MainFrame(wxT("ScummVM Tools"));
 
@@ -48,51 +56,50 @@
 	wxBoxSizer *mainSizer = new wxBoxSizer(wxHORIZONTAL);
 	this->SetSizer(mainSizer);
 
-	wxNotebook *mainNotebook = new wxNotebook(this, wxID_ANY);
+	_mainNotebook = new wxNotebook(this, wxID_ANY);
 
-	CompressionPanel *compressionTools = new CompressionPanel(mainNotebook);
-	wxPanel *extractionTools = new ExtractionPanel(mainNotebook);
+	_compressionTools = new CompressionPanel(_mainNotebook);
+	_extractionTools = new ExtractionPanel(_mainNotebook);
 
-	mainNotebook->AddPage(compressionTools, wxT("Compression"), false, wxID_ANY);
-	mainNotebook->AddPage(extractionTools, wxT("Extraction"), false, wxID_ANY);
+	_mainNotebook->AddPage(_compressionTools, wxT("Compression"), false, wxID_ANY);
+	_mainNotebook->AddPage(_extractionTools, wxT("Extraction"), false, wxID_ANY);
 
-	mainSizer->Add(mainNotebook, 1, wxEXPAND);
+	mainSizer->Add(_mainNotebook, 1, wxEXPAND);
 	mainSizer->SetSizeHints(this);
 }
 
 DropDownBox::DropDownBox(wxWindow *parent, wxWindowID id, wxString title, int numItems, wxString items[]) : wxPanel(parent) {
-	wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
+	wxStaticBox *box = new wxStaticBox(this, wxID_ANY, title);
+	wxStaticBoxSizer *sizer = new wxStaticBoxSizer(box, wxHORIZONTAL);
 	this->SetSizer(sizer);
 
-	wxStaticBoxSizer *box = new wxStaticBoxSizer(wxVERTICAL, this, title);
 	_choice = new wxChoice(this, id, wxDefaultPosition, wxDefaultSize, numItems, items);
 
-	box->Add(_choice, 1, wxEXPAND | wxLEFT | wxRIGHT, 5);
-	sizer->Add(box, 1, wxEXPAND);
+	sizer->Add(_choice, 1, wxEXPAND | wxLEFT | wxRIGHT, 5);
 }
 
 IOChooser::IOChooser(wxWindow *parent, wxString title, wxString defaultPath, bool isFileChooser) : wxPanel(parent) {
-	wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
+	wxStaticBox *box = new wxStaticBox(this, wxID_ANY, title);
+	wxStaticBoxSizer *sizer = new wxStaticBoxSizer(box, wxHORIZONTAL);
 	this->SetSizer(sizer);
 
-	wxStaticBoxSizer *box = new wxStaticBoxSizer(wxHORIZONTAL, this, title);
 	_text = new wxTextCtrl(this, wxID_ANY, defaultPath);
 	_browse = new wxButton(this, wxID_ANY, wxT("Browse"));
 	_isFileChooser = isFileChooser;
 
-	/* The button looks like it is shifted 2 pixels down from the text control
+	/* The button looks like it is shifted 2 pixels down 
+	 * from the text control (probably because of the wxStaticBox label)
 	 * so we simply pad the top by -2
 	 */
-	box->Add(_text, 3, wxBOTTOM | wxLEFT | wxRIGHT, 5);
-	box->Add(_browse, 1, wxTOP, -2);
-
-	sizer->Add(box, 1, wxEXPAND);
+	sizer->Add(_text, 3, wxBOTTOM | wxLEFT | wxRIGHT, 5);
+	sizer->Add(_browse, 1, wxTOP, -2);
 }
 
 /* ----- Compression ----- */
 
 CompressionOptions::CompressionOptions(wxWindow *parent) : wxPanel(parent) {
-	wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+	wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("Compression Options"));
+	wxStaticBoxSizer *sizer = new wxStaticBoxSizer(box, wxVERTICAL);
 	this->SetSizer(sizer);
 
 	wxPanel *grid = new wxPanel(this);
@@ -118,10 +125,10 @@
 	_compressionLevelChooser = new wxChoice(grid, wxID_ANY, wxDefaultPosition, wxDefaultSize, kNumValidCompressionLevels, kVaildCompressionLevels);
 
 	wxStaticText *modeLabel = new wxStaticText(grid, wxID_ANY, wxT("Compression Mode"));
-	_modeChooser = new wxChoice(grid, wxID_ANY, wxDefaultPosition, wxDefaultSize, kNumMP3Modes, kMP3ModeNames);
+	_modeChooser = new wxChoice(grid, kCompressionModeChoice, wxDefaultPosition, wxDefaultSize, kNumMP3Modes, kMP3ModeNames);
 
 	wxStaticText *blockSizeLabel = new wxStaticText(grid, wxID_ANY, wxT("Block Size"));
-	_blockSize = new wxChoice(grid, wxID_ANY, wxDefaultPosition, wxDefaultSize, kNumFLACBlocksize, kFLACBlocksize);
+	_blockSize = new wxChoice(grid, wxID_ANY, wxDefaultPosition, wxDefaultSize, kNumValidFlacBlocksize, kValidFlacBlocksize);
 
 	wxStaticText *verifyLabel = new wxStaticText(grid, wxID_ANY, wxT("Verify"));
 	_verifyChooser = new wxCheckBox(grid, wxID_ANY, wxT(""));
@@ -153,10 +160,7 @@
 	gridSizer->Add(_verifyChooser, 0, wxALIGN_CENTER);
 	gridSizer->Add(_silentChooser, 0, wxALIGN_CENTER);
 
-	wxStaticBoxSizer *box = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Compression Options"));
-	box->Add(grid, 0, wxALIGN_CENTER);
-
-	sizer->Add(box, 0, wxEXPAND);
+	sizer->Add(grid, 0, wxALIGN_CENTER);
 }
 
 CompressionPanel::CompressionPanel(wxWindow *parent) : wxPanel(parent) {
@@ -169,9 +173,13 @@
 	topPanelSizer->AddGrowableCol(1);
 	topPanel->SetSizer(topPanelSizer);
 
-	_compressionToolChooserPanel = new DropDownBox((wxWindow *)topPanel, kCompressionToolChoice, wxT("Choose Tool"), kNumCompressionTools, kCompressionToolNames);
+	_compressionToolChooserBox = new DropDownBox((wxWindow *)topPanel, kCompressionToolChoice, wxT("Game Engine"), kNumCompressionTools, kCompressionToolNames);
+
+	_compressionTypeBox = new DropDownBox(topPanel, kCompressionTypeChoice, wxT("Compression Type"), kNumCompressionTypes, kCompressionTypeNames);
+	_compressionOptionsChooser = new wxCheckBox(_compressionTypeBox, kCompressionOptionsToggle, wxT("Advanced"));
+	_compressionTypeBox->GetSizer()->Add(_compressionOptionsChooser, 1, wxEXPAND | wxLEFT | wxRIGHT, 10);
+
 	_inputPanel = new IOChooser(topPanel, wxT("Input"), wxT(""), true);
-	_compressionTypePanel = new DropDownBox(topPanel, kCompressionTypeChoice, wxT("Choose Compression"), kNumCompressionTypes, kCompressionTypeNames);
 	_outputPanel = new IOChooser(topPanel, wxT("Output"), wxT(""), true);
 
 	/* Bottom Panel */
@@ -179,27 +187,33 @@
 	wxBoxSizer *bottomPanelSizer = new wxBoxSizer(wxVERTICAL);
 	bottomPanel->SetSizer(bottomPanelSizer);
 
+	/* Initially hide the advanced compression options 
+	 * They can be shown by toggling _compressionOptionsChooser
+	 */
 	_compressionOptionsPanel = new CompressionOptions(bottomPanel);
+	_compressionOptionsPanel->Show(false);
+
 	_startButton = new wxButton(bottomPanel, kCompressionStartButton, wxT("START"));
 	_toolOutput = new wxTextCtrl(bottomPanel, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1, 300), wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH);
 
-	topPanelSizer->Add(_compressionToolChooserPanel, 1, wxEXPAND);
+	topPanelSizer->Add(_compressionToolChooserBox, 1, wxEXPAND);
 	topPanelSizer->Add(_inputPanel, 4, wxEXPAND);
-	topPanelSizer->Add(_compressionTypePanel, 1, wxEXPAND);
+	topPanelSizer->Add(_compressionTypeBox, 1, wxEXPAND);
 	topPanelSizer->Add(_outputPanel, 4, wxEXPAND);
-	bottomPanelSizer->Add(_compressionOptionsPanel, 0, wxEXPAND | wxBOTTOM, 5);
-	bottomPanelSizer->Add(_startButton, 0, wxEXPAND | wxBOTTOM, 5);
-	bottomPanelSizer->Add(_toolOutput, 1, wxEXPAND);
+	bottomPanelSizer->Add(_startButton, 0, wxEXPAND | wxTOP, 5);
+	bottomPanelSizer->Add(_compressionOptionsPanel, 0, wxEXPAND);
+	bottomPanelSizer->Add(_toolOutput, 1, wxEXPAND | wxTOP, 5);
 
 	sizer->Add(topPanel, 0, wxEXPAND);
 	sizer->Add(bottomPanel, 1, wxEXPAND);
 
-	/* Simulate selecting the first tool and MP3 to set up the compression options */
-	_compressionToolChooserPanel->_choice->SetSelection(0);
+	/* Simulate selecting the first tool to set up the compression options */
+	_compressionToolChooserBox->_choice->SetSelection(0);
 	wxCommandEvent toolEvent = wxCommandEvent(wxEVT_COMMAND_CHOICE_SELECTED, kCompressionToolChoice);
 	this->OnCompressionToolChange(toolEvent);
 
-	_compressionTypePanel->_choice->SetSelection(0);
+	/* Simulate selecting the first compression type to set up the compression options */
+	_compressionTypeBox->_choice->SetSelection(0);
 	wxCommandEvent compressionEvent = wxCommandEvent(wxEVT_COMMAND_CHOICE_SELECTED, kCompressionTypeChoice);
 	this->OnCompressionTypeChange(compressionEvent);
 }
@@ -207,7 +221,8 @@
 /* ----- Extraction ----- */
 
 ExtractionOptions::ExtractionOptions(wxWindow *parent) : wxPanel(parent) {
-	wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+	wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("Extraction Options"));
+	wxStaticBoxSizer *sizer = new wxStaticBoxSizer(box, wxVERTICAL);
 	this->SetSizer(sizer);
 
 	wxPanel *grid = new wxPanel(this);
@@ -241,10 +256,7 @@
 	gridSizer->Add(_kyraSingleFile, 0, wxALIGN_CENTER);
 	gridSizer->Add(_kyraFilename, 0, wxALIGN_CENTER);
 
-	wxStaticBoxSizer *box = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Extraction Options"));
-	box->Add(grid, 0, wxALIGN_CENTER);
-
-	sizer->Add(box, 0, wxEXPAND);
+	sizer->Add(grid, 0, wxALIGN_CENTER);
 }
 
 ExtractionPanel::ExtractionPanel(wxWindow *parent) : wxPanel(parent) {
@@ -257,7 +269,7 @@
 	topPanelSizer->AddGrowableCol(1);
 	topPanel->SetSizer(topPanelSizer);
 
-	_extractionToolChooserPanel = new DropDownBox((wxWindow *)topPanel, kExtractionToolChoice, wxT("Choose Tool"), kNumExtractionTools, kExtractionToolNames);
+	_extractionToolChooserPanel = new DropDownBox((wxWindow *)topPanel, kExtractionToolChoice, wxT("Game Engine"), kNumExtractionTools, kExtractionToolNames);
 	_input1Panel = new IOChooser(topPanel, wxT("Input 1"), wxT(""), true);
 	_input2Panel = new IOChooser(topPanel, wxT("Input 2"), wxT(""), true);
 	_outputPanel = new IOChooser(topPanel, wxT("Output"), wxT(""), true);
@@ -272,11 +284,11 @@
 	_toolOutput = new wxTextCtrl(bottomPanel, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1, 300), wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH);
 
 	topPanelSizer->Add(_extractionToolChooserPanel, 1, wxEXPAND);
-	topPanelSizer->Add(_input1Panel, 4, wxEXPAND);
+	topPanelSizer->Add(_input1Panel, 5, wxEXPAND);
 	topPanelSizer->AddStretchSpacer();
-	topPanelSizer->Add(_input2Panel, 4, wxEXPAND);
+	topPanelSizer->Add(_input2Panel, 5, wxEXPAND);
 	topPanelSizer->AddStretchSpacer();
-	topPanelSizer->Add(_outputPanel, 4, wxEXPAND);
+	topPanelSizer->Add(_outputPanel, 5, wxEXPAND);
 	bottomPanelSizer->Add(_extractionOptionsPanel, 0, wxEXPAND | wxBOTTOM, 5);
 	bottomPanelSizer->Add(_startButton, 0, wxEXPAND | wxBOTTOM, 5);
 	bottomPanelSizer->Add(_toolOutput, 1, wxEXPAND);
@@ -284,7 +296,7 @@
 	sizer->Add(topPanel, 0, wxEXPAND);
 	sizer->Add(bottomPanel, 1, wxEXPAND);
 
-	/* Simulate selecting the first tool and MP3 to set up the compression options */
+	/* Simulate selecting the first tool to set up the extraction options */
 	_extractionToolChooserPanel->_choice->SetSelection(0);
 	wxCommandEvent toolEvent = wxCommandEvent(wxEVT_COMMAND_CHOICE_SELECTED, kExtractionToolChoice);
 	this->OnExtractionToolChange(toolEvent);
@@ -293,60 +305,60 @@
 /* ----- Compression Events ----- */
 
 void CompressionPanel::OnCompressionToolChange(wxCommandEvent &event) {
-	wxString selectedTool = this->_compressionToolChooserPanel->_choice->GetStringSelection();
+	wxString selectedTool = this->_compressionToolChooserBox->_choice->GetStringSelection();
 
 	this->_inputPanel->_browse->Enable(true);
 	this->_inputPanel->_text->Enable(true);
 	this->_outputPanel->_isFileChooser = false;
 
-	if (selectedTool == wxT("compress_agos")) {
+	if (selectedTool == wxT("AGOS")) {
 		this->_inputPanel->_isFileChooser = true;
 		this->_outputPanel->_browse->Enable(false);
 		this->_outputPanel->_text->Enable(false);
-	} else if (selectedTool == wxT("compress_agos (MAC)")) {
+	} else if (selectedTool == wxT("Broken Sword 1")) {
 		this->_inputPanel->_isFileChooser = false;
 		this->_outputPanel->_browse->Enable(false);
 		this->_outputPanel->_text->Enable(false);
-	} else if (selectedTool == wxT("compress_kyra")) {
+	} else if (selectedTool == wxT("Broken Sword 2")) {
 		this->_inputPanel->_isFileChooser = true;
-		this->_outputPanel->_browse->Enable(true);
-		this->_outputPanel->_text->Enable(true);
-	} else if (selectedTool == wxT("compress_queen")) {
+		this->_outputPanel->_browse->Enable(false);
+		this->_outputPanel->_text->Enable(false);
+	} else if (selectedTool == wxT("Encode DXA")) {
 		this->_inputPanel->_isFileChooser = true;
 		this->_outputPanel->_browse->Enable(false);
 		this->_outputPanel->_text->Enable(false);
-	} else if (selectedTool == wxT("compress_saga")) {
+	} else if (selectedTool == wxT("Flight of the Amazon Queen")) {
 		this->_inputPanel->_isFileChooser = true;
 		this->_outputPanel->_browse->Enable(false);
 		this->_outputPanel->_text->Enable(false);
-	} else if (selectedTool == wxT("compress_scumm_bun")) {
+	} else if (selectedTool == wxT("Kyra")) {
 		this->_inputPanel->_isFileChooser = true;
 		this->_outputPanel->_browse->Enable(true);
 		this->_outputPanel->_text->Enable(true);
-	} else if (selectedTool == wxT("compress_scumm_san")) {
+	} else if (selectedTool == wxT("SAGA")) {
 		this->_inputPanel->_isFileChooser = true;
+		this->_outputPanel->_browse->Enable(false);
+		this->_outputPanel->_text->Enable(false);
+	} else if (selectedTool == wxT("SCUMM BUN")) {
+		this->_inputPanel->_isFileChooser = true;
 		this->_outputPanel->_browse->Enable(true);
 		this->_outputPanel->_text->Enable(true);
-	} else if (selectedTool == wxT("compress_scumm_sou")) {
+	} else if (selectedTool == wxT("SCUMM SAN")) {
 		this->_inputPanel->_isFileChooser = true;
+		this->_outputPanel->_browse->Enable(true);
+		this->_outputPanel->_text->Enable(true);
+	} else if (selectedTool == wxT("SCUMM SOU")) {
+		this->_inputPanel->_isFileChooser = true;
 		this->_outputPanel->_browse->Enable(false);
 		this->_outputPanel->_text->Enable(false);
-	} else if (selectedTool == wxT("compress_sword1")) {
+	} else if (selectedTool == wxT("Simon 2 (MAC)")) {
 		this->_inputPanel->_isFileChooser = false;
 		this->_outputPanel->_browse->Enable(false);
 		this->_outputPanel->_text->Enable(false);
-	} else if (selectedTool == wxT("compress_sword2")) {
-		this->_inputPanel->_isFileChooser = true;
-		this->_outputPanel->_browse->Enable(false);
-		this->_outputPanel->_text->Enable(false);
-	} else if (selectedTool == wxT("compress_touche")) {
+	} else if (selectedTool == wxT("Touche")) {
 		this->_inputPanel->_isFileChooser = false;
 		this->_outputPanel->_browse->Enable(true);
 		this->_outputPanel->_text->Enable(true);
-	} else if (selectedTool == wxT("encode_dxa")) {
-		this->_inputPanel->_isFileChooser = true;
-		this->_outputPanel->_browse->Enable(false);
-		this->_outputPanel->_text->Enable(false);
 	} else {
 		this->_inputPanel->_browse->Enable(false);
 		this->_inputPanel->_text->Enable(false);
@@ -358,11 +370,22 @@
 }
 
 void CompressionPanel::OnCompressionTypeChange(wxCommandEvent &event) {
-	wxString selectedCompression = this->_compressionTypePanel->_choice->GetStringSelection();
+	wxString selectedCompression = this->_compressionTypeBox->_choice->GetStringSelection();
 
 	if (selectedCompression == wxT("MP3")) {
-		this->_compressionOptionsPanel->_minBitrateChooser->Enable(false);
-		this->_compressionOptionsPanel->_avgBitrateChooser->Enable(true);
+		this->_compressionOptionsPanel->_avgBitrateChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_blockSize->SetSelection(0);
+		this->_compressionOptionsPanel->_compressionLevelChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_maxBitrateChooser->SetStringSelection(kDefaultMP3VBRMaxBitrate);
+		this->_compressionOptionsPanel->_minBitrateChooser->SetStringSelection(kDefaultMP3VBRMinBitrate);
+		this->_compressionOptionsPanel->_modeChooser->SetStringSelection(kDefaultMP3CompressionType);
+		this->_compressionOptionsPanel->_mpegQualityChooser->SetStringSelection(kDefaultMP3MpegQuality);
+		this->_compressionOptionsPanel->_silentChooser->SetValue(false);
+		this->_compressionOptionsPanel->_verifyChooser->SetValue(false);
+		this->_compressionOptionsPanel->_vbrQualityChooser->SetStringSelection(kDefaultMP3VBRQuality);
+
+		this->_compressionOptionsPanel->_minBitrateChooser->Enable(true);
+		this->_compressionOptionsPanel->_avgBitrateChooser->Enable(false);
 		this->_compressionOptionsPanel->_maxBitrateChooser->Enable(true);
 		this->_compressionOptionsPanel->_vbrQualityChooser->Enable(true);
 		this->_compressionOptionsPanel->_mpegQualityChooser->Enable(true);
@@ -372,6 +395,17 @@
 		this->_compressionOptionsPanel->_verifyChooser->Enable(false);
 		this->_compressionOptionsPanel->_silentChooser->Enable(true);
 	} else if (selectedCompression == wxT("Vorbis")) {
+		this->_compressionOptionsPanel->_avgBitrateChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_blockSize->SetSelection(0);
+		this->_compressionOptionsPanel->_compressionLevelChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_maxBitrateChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_minBitrateChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_modeChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_mpegQualityChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_silentChooser->SetValue(false);
+		this->_compressionOptionsPanel->_verifyChooser->SetValue(false);
+		this->_compressionOptionsPanel->_vbrQualityChooser->SetStringSelection(kDefaultOggQuality);
+
 		this->_compressionOptionsPanel->_minBitrateChooser->Enable(true);
 		this->_compressionOptionsPanel->_avgBitrateChooser->Enable(true);
 		this->_compressionOptionsPanel->_maxBitrateChooser->Enable(true);
@@ -383,6 +417,17 @@
 		this->_compressionOptionsPanel->_verifyChooser->Enable(false);
 		this->_compressionOptionsPanel->_silentChooser->Enable(true);
 	} else if (selectedCompression == wxT("FLAC")) {
+		this->_compressionOptionsPanel->_avgBitrateChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_blockSize->SetStringSelection(kDefaultFlacBlocksize);
+		this->_compressionOptionsPanel->_compressionLevelChooser->SetStringSelection(kDefaultFlacCompress);
+		this->_compressionOptionsPanel->_maxBitrateChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_minBitrateChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_modeChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_mpegQualityChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_silentChooser->SetValue(false);
+		this->_compressionOptionsPanel->_verifyChooser->SetValue(false);
+		this->_compressionOptionsPanel->_vbrQualityChooser->SetSelection(0);
+
 		this->_compressionOptionsPanel->_minBitrateChooser->Enable(false);
 		this->_compressionOptionsPanel->_avgBitrateChooser->Enable(false);
 		this->_compressionOptionsPanel->_maxBitrateChooser->Enable(false);
@@ -394,6 +439,17 @@
 		this->_compressionOptionsPanel->_verifyChooser->Enable(true);
 		this->_compressionOptionsPanel->_silentChooser->Enable(true);
 	} else {
+		this->_compressionOptionsPanel->_avgBitrateChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_blockSize->SetSelection(0);
+		this->_compressionOptionsPanel->_compressionLevelChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_maxBitrateChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_minBitrateChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_modeChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_mpegQualityChooser->SetSelection(0);
+		this->_compressionOptionsPanel->_silentChooser->SetValue(false);
+		this->_compressionOptionsPanel->_verifyChooser->SetValue(false);
+		this->_compressionOptionsPanel->_vbrQualityChooser->SetSelection(0);
+
 		this->_compressionOptionsPanel->_minBitrateChooser->Enable(false);
 		this->_compressionOptionsPanel->_avgBitrateChooser->Enable(false);
 		this->_compressionOptionsPanel->_maxBitrateChooser->Enable(false);
@@ -406,6 +462,42 @@
 	}
 }
 
+void CompressionOptions::OnCompressionModeChange(wxCommandEvent &event) {
+	wxString selectedMode = this->_modeChooser->GetStringSelection();
+
+	if (selectedMode == wxT("VBR")) {
+		this->_avgBitrateChooser->SetSelection(0);
+		this->_maxBitrateChooser->SetStringSelection(kDefaultMP3VBRMaxBitrate);
+		this->_minBitrateChooser->SetStringSelection(kDefaultMP3VBRMinBitrate);
+		this->_vbrQualityChooser->SetStringSelection(kDefaultMP3VBRQuality);
+
+		this->_avgBitrateChooser->Enable(false);
+		this->_minBitrateChooser->Enable(true);
+		this->_maxBitrateChooser->Enable(true);
+		this->_vbrQualityChooser->Enable(true);
+	} else if (selectedMode == wxT("ABR")) {
+		this->_avgBitrateChooser->SetStringSelection(kDefaultMP3ABRAvgBitrate);
+		this->_maxBitrateChooser->SetSelection(0);
+		this->_minBitrateChooser->SetSelection(0);
+		this->_vbrQualityChooser->SetSelection(0);
+	
+		this->_avgBitrateChooser->Enable(true);
+		this->_minBitrateChooser->Enable(false);
+		this->_maxBitrateChooser->Enable(false);
+		this->_vbrQualityChooser->Enable(false);
+	} else {
+		this->_avgBitrateChooser->SetSelection(0);
+		this->_maxBitrateChooser->SetSelection(0);
+		this->_minBitrateChooser->SetSelection(0);
+		this->_vbrQualityChooser->SetSelection(0);
+
+		this->_avgBitrateChooser->Enable(false);
+		this->_minBitrateChooser->Enable(false);
+		this->_maxBitrateChooser->Enable(false);
+		this->_vbrQualityChooser->Enable(false);
+	}
+}
+
 void CompressionPanel::OnCompressionStart(wxCommandEvent &event) {
 
 }
@@ -421,7 +513,7 @@
 	this->_input2Panel->_isFileChooser = true;
 	this->_outputPanel->_isFileChooser = false;
 
-	if (selectedTool == wxT("extract_agos")) {
+	if (selectedTool == wxT("AGOS")) {
 		this->_input2Panel->_browse->Enable(false);
 		this->_input2Panel->_text->Enable(false);
 		this->_outputPanel->_browse->Enable(false);
@@ -431,7 +523,7 @@
 		this->_extractionOptionsPanel->_kyraFilename->Enable(false);
 		this->_extractionOptionsPanel->_kyraSingleFile->Enable(false);
 		this->_extractionOptionsPanel->_parallactionSmall->Enable(false);
-	} else if (selectedTool == wxT("extract_kyra")) {
+	} else if (selectedTool == wxT("Kyra")) {
 		this->_input2Panel->_browse->Enable(false);
 		this->_input2Panel->_text->Enable(false);
 		this->_outputPanel->_browse->Enable(false);
@@ -441,7 +533,7 @@
 		this->_extractionOptionsPanel->_kyraFilename->Enable(true);
 		this->_extractionOptionsPanel->_kyraSingleFile->Enable(true);
 		this->_extractionOptionsPanel->_parallactionSmall->Enable(false);
-	} else if (selectedTool == wxT("extract_loom_tg16")) {
+	} else if (selectedTool == wxT("Loom (TG16)")) {
 		this->_input2Panel->_browse->Enable(false);
 		this->_input2Panel->_text->Enable(false);
 		this->_outputPanel->_browse->Enable(false);
@@ -451,7 +543,7 @@
 		this->_extractionOptionsPanel->_kyraFilename->Enable(false);
 		this->_extractionOptionsPanel->_kyraSingleFile->Enable(false);
 		this->_extractionOptionsPanel->_parallactionSmall->Enable(false);
-	} else if (selectedTool == wxT("extract_mm_apple")) {
+	} else if (selectedTool == wxT("Maniac Mansion (Apple)")) {
 		this->_input2Panel->_browse->Enable(true);
 		this->_input2Panel->_text->Enable(true);
 		this->_outputPanel->_browse->Enable(false);
@@ -461,7 +553,7 @@
 		this->_extractionOptionsPanel->_kyraFilename->Enable(false);
 		this->_extractionOptionsPanel->_kyraSingleFile->Enable(false);
 		this->_extractionOptionsPanel->_parallactionSmall->Enable(false);
-	} else if (selectedTool == wxT("extract_mm_c64")) {
+	} else if (selectedTool == wxT("Maniac Mansion (C64)")) {
 		this->_input2Panel->_browse->Enable(true);
 		this->_input2Panel->_text->Enable(true);
 		this->_outputPanel->_browse->Enable(false);
@@ -471,7 +563,7 @@
 		this->_extractionOptionsPanel->_kyraFilename->Enable(false);
 		this->_extractionOptionsPanel->_kyraSingleFile->Enable(false);
 		this->_extractionOptionsPanel->_parallactionSmall->Enable(false);
-	} else if (selectedTool == wxT("extract_mm_nes")) {
+	} else if (selectedTool == wxT("Maniac Mansion (NES)")) {
 		this->_input2Panel->_browse->Enable(false);
 		this->_input2Panel->_text->Enable(false);
 		this->_outputPanel->_browse->Enable(false);
@@ -481,7 +573,7 @@
 		this->_extractionOptionsPanel->_kyraFilename->Enable(false);
 		this->_extractionOptionsPanel->_kyraSingleFile->Enable(false);
 		this->_extractionOptionsPanel->_parallactionSmall->Enable(false);
-	} else if (selectedTool == wxT("extract_parallaction")) {
+	} else if (selectedTool == wxT("Parallaction")) {
 		this->_input2Panel->_browse->Enable(false);
 		this->_input2Panel->_text->Enable(false);
 		this->_outputPanel->_browse->Enable(true);
@@ -491,7 +583,7 @@
 		this->_extractionOptionsPanel->_kyraFilename->Enable(false);
 		this->_extractionOptionsPanel->_kyraSingleFile->Enable(false);
 		this->_extractionOptionsPanel->_parallactionSmall->Enable(true);
-	} else if (selectedTool == wxT("extract_scumm_mac")) {
+	} else if (selectedTool == wxT("SCUMM (MAC)")) {
 		this->_input2Panel->_browse->Enable(false);
 		this->_input2Panel->_text->Enable(false);
 		this->_outputPanel->_browse->Enable(false);
@@ -501,7 +593,7 @@
 		this->_extractionOptionsPanel->_kyraFilename->Enable(false);
 		this->_extractionOptionsPanel->_kyraSingleFile->Enable(false);
 		this->_extractionOptionsPanel->_parallactionSmall->Enable(false);
-	} else if (selectedTool == wxT("extract_zak_c64")) {
+	} else if (selectedTool == wxT("Zak McKracken (C64)")) {
 		this->_input2Panel->_browse->Enable(true);
 		this->_input2Panel->_text->Enable(true);
 		this->_outputPanel->_browse->Enable(false);
@@ -532,3 +624,31 @@
 void ExtractionPanel::OnExtractionStart(wxCommandEvent &event) {
 
 }
+
+void MainFrame::OnCompressionOptionsToggle(wxCommandEvent &event) {
+	int height, width;
+
+	this->_compressionTools->_compressionOptionsPanel->Show(!this->_compressionTools->_compressionOptionsPanel->IsShown());
+	this->_compressionTools->Fit();
+	this->_compressionTools->SetSize(this->_compressionTools->GetSize().GetWidth() + 10, this->_compressionTools->GetSize().GetHeight());
+
+	this->_extractionTools->Fit();
+
+	if (this->_compressionTools->GetSize().GetWidth() >= this->_extractionTools->GetSize().GetWidth()) {
+		width = this->_compressionTools->GetSize().GetWidth();
+	} else {
+		width = this->_extractionTools->GetSize().GetWidth();
+	}
+
+	if (this->_compressionTools->GetSize().GetHeight() >= this->_extractionTools->GetSize().GetHeight()) {
+		height = this->_compressionTools->GetSize().GetHeight();
+	} else {
+		height = this->_extractionTools->GetSize().GetHeight();
+	}
+
+	this->_mainNotebook->SetMinSize(wxSize(width, height));
+	this->_mainNotebook->Fit();
+
+	this->SetMinSize(wxSize(width, height));
+	this->Fit();
+}

Modified: tools/branches/gsoc2007-toolsgui/tools_gui.h
===================================================================
--- tools/branches/gsoc2007-toolsgui/tools_gui.h	2007-07-31 02:04:46 UTC (rev 28350)
+++ tools/branches/gsoc2007-toolsgui/tools_gui.h	2007-07-31 02:07:32 UTC (rev 28351)
@@ -25,11 +25,27 @@
 #include <wx/statbox.h>
 #include <wx/textctrl.h>
 
+/* Default MP3 parameters */
+wxString kDefaultMP3ABRAvgBitrate = wxT("24");
+wxString kDefaultMP3CompressionType = wxT("VBR");
+wxString kDefaultMP3MpegQuality = wxT("2");
+wxString kDefaultMP3VBRMaxBitrate = wxT("64");
+wxString kDefaultMP3VBRMinBitrate = wxT("24");
+wxString kDefaultMP3VBRQuality = wxT("4");
+
+/* Default Vorbis parameters */
+wxString kDefaultOggQuality = wxT("3");
+
+/* Default FLAC parameters */
+wxString kDefaultFlacCompress = wxT("8");
+wxString kDefaultFlacBlocksize = wxT("1152");
+
+
 #define kNumCompressionTools 12
-wxString kCompressionToolNames[12] = {wxT("compress_agos"), wxT("compress_agos (MAC)"), wxT("compress_kyra"), wxT("compress_queen"),  wxT("compress_saga"),  wxT("compress_scumm_bun"),  wxT("compress_scumm_san"),  wxT("compress_scumm_sou"),  wxT("compress_sword1"),  wxT("compress_sword2"),  wxT("compress_touche"), wxT("encode_dxa")};
+wxString kCompressionToolNames[12] = {wxT("AGOS"), wxT("Broken Sword 1"), wxT("Broken Sword 2"), wxT("Encode DXA"), wxT("Flight of the Amazon Queen"), wxT("Kyra"), wxT("SAGA"), wxT("SCUMM BUN"), wxT("SCUMM SAN"), wxT("SCUMM SOU"), wxT("Simon 2 (MAC)"), wxT("Touche")};
 
 #define kNumExtractionTools 9
-wxString kExtractionToolNames[9] = {wxT("extract_agos"), wxT("extract_kyra"), wxT("extract_loom_tg16"), wxT("extract_mm_apple"), wxT("extract_mm_c64"), wxT("extract_mm_nes"), wxT("extract_parallaction"), wxT("extract_scumm_mac"), wxT("extract_zak_c64")};
+wxString kExtractionToolNames[9] = {wxT("AGOS"), wxT("Kyra"), wxT("Loom (TG16)"), wxT("Maniac Mansion (Apple)"), wxT("Maniac Mansion (C64)"), wxT("Maniac Mansion (NES)"), wxT("Parallaction"), wxT("SCUMM (MAC)"), wxT("Zak McKracken (C64)")};
 
 #define kNumCompressionTypes 3
 wxString kCompressionTypeNames[3] = {wxT("MP3"), wxT("Vorbis"), wxT("FLAC")};
@@ -43,22 +59,32 @@
 #define kNumValidCompressionLevels 10
 wxString kVaildCompressionLevels[10] = {wxT(""), wxT("0"), wxT("1"), wxT("2"), wxT("3"), wxT("4"), wxT("5"), wxT("6"), wxT("7"), wxT("8")};
 
-#define kNumFLACBlocksize 5
-wxString kFLACBlocksize[5] = {wxT(""), wxT("576"), wxT("1152"), wxT("2304"), wxT("4608")};
+#define kNumValidFlacBlocksize 5
+wxString kValidFlacBlocksize[5] = {wxT(""), wxT("576"), wxT("1152"), wxT("2304"), wxT("4608")};
 
 #define kNumMP3Modes 2
 wxString kMP3ModeNames[2] = {wxT("VBR"), wxT("ABR")};
 
+enum {
+	kCompressionToolChoice,
+	kCompressionTypeChoice,
+	kCompressionModeChoice,
+	kCompressionInputBrowse,
+	kCompressionOptionsToggle,
+	kCompressionStartButton,
+	kExtractionToolChoice,
+	kExtractionInput1Browse,
+	kExtractionInput2Browse,
+	kExtractionOutputBrowse,
+	kExtractionStartButton
+};
+
+
 class ToolsGui : public wxApp {
 public:
 	virtual bool OnInit();
 };
 
-class MainFrame : public wxFrame {
-public:
-	MainFrame(const wxString& title);
-};
-
 class DropDownBox : public wxPanel {
 public:
 	DropDownBox(wxWindow *parent, wxWindowID id, wxString title, int numItems, wxString items[]);
@@ -91,27 +117,25 @@
 	wxChoice *_blockSize;
 	wxCheckBox *_verifyChooser;
 	wxCheckBox *_silentChooser;
+
+	void OnCompressionModeChange(wxCommandEvent &event);
+
+	DECLARE_EVENT_TABLE()
 };
 
 class CompressionPanel : public wxPanel {
 public:
 	CompressionPanel(wxWindow *parent);
 
-	DropDownBox *_compressionToolChooserPanel;
-	DropDownBox *_compressionTypePanel;
+	DropDownBox *_compressionToolChooserBox;
+	DropDownBox *_compressionTypeBox;
+	wxCheckBox *_compressionOptionsChooser;
 	IOChooser *_inputPanel;
 	IOChooser *_outputPanel;
 	CompressionOptions *_compressionOptionsPanel;
 	wxButton *_startButton;
 	wxTextCtrl *_toolOutput;
 
-	enum {
-		kCompressionToolChoice,
-		kCompressionTypeChoice,
-		kCompressionInputBrowse,
-		kCompressionStartButton
-	} kEventID;
-
 	void OnCompressionToolChange(wxCommandEvent &event);
 	void OnCompressionTypeChange(wxCommandEvent &event);
 	void OnCompressionStart(wxCommandEvent &event);
@@ -144,16 +168,23 @@
 	wxButton *_startButton;
 	wxTextCtrl *_toolOutput;
 
-	enum {
-		kExtractionToolChoice,
-		kExtractionInput1Browse,
-		kExtractionInput2Browse,
-		kExtractionOutputBrowse,
-		kExtractionStartButton
-	} kEventID;
-
 	void OnExtractionToolChange(wxCommandEvent &event);
 	void OnExtractionStart(wxCommandEvent &event);
 
 	DECLARE_EVENT_TABLE()
 };
+
+/* ----- Main Panel ----- */
+
+class MainFrame : public wxFrame {
+public:
+	MainFrame(const wxString& title);
+
+	wxNotebook *_mainNotebook;
+	CompressionPanel *_compressionTools;
+	ExtractionPanel *_extractionTools;
+
+	void OnCompressionOptionsToggle(wxCommandEvent &event);
+
+	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