From 38d36b2e7c2a972850135808e2edd31ad71c20dd Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Wed, 8 Jul 2009 01:10:59 +0000 Subject: [PATCH] wxgui: Fix Linux. git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1478 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Config.h | 31 +- pcsx2/Linux/pcsx2.cbp | 810 +++++++++++----------- pcsx2/gui/App.h | 20 +- pcsx2/gui/AppConfig.cpp | 9 +- pcsx2/gui/Dialogs/ConfigurationDialog.cpp | 8 +- pcsx2/gui/Dialogs/ConfigurationDialog.h | 3 +- pcsx2/gui/main.cpp | 34 +- 7 files changed, 476 insertions(+), 439 deletions(-) diff --git a/pcsx2/Config.h b/pcsx2/Config.h index 0022a7f738..fbdf8860ae 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -69,7 +69,7 @@ public: void LoadSave( IniInterface& conf ); }; - + // ------------------------------------------------------------------------ struct FilenameOptions { @@ -113,7 +113,7 @@ public: } Profiler; - struct + struct { bool EnableEE:1, @@ -132,7 +132,7 @@ public: bool MultithreadGS; // Uses the multithreaded GS interface. bool closeOnEsc; // Closes the GS/Video port on escape (good for fullscreen activity) bool UseFramelimiter; - + int RegionMode; // 0=NTSC and 1=PAL int CustomFps; int CustomFrameSkip; @@ -153,7 +153,7 @@ public: void LoadSave(); }; - + // ------------------------------------------------------------------------ struct SpeedhackOptions { @@ -165,7 +165,7 @@ public: void LoadSave( IniInterface& conf ); }; - + // ------------------------------------------------------------------------ // Helper functions for returning full pathnames of various Folders and files // @@ -183,20 +183,27 @@ public: public: AppConfig() : Files( *this ) + , Listbook_ImageSize( 32 ) + , Toolbar_ImageSize( 32 ) { } - + FullpathHelpers Files; - + wxPoint MainGuiPosition; bool CdvdVerboseReads; // enables cdvd read activity verbosely dumped to the console // String value describing the desktop theme to use for pcsk2 (icons and background images) // The theme name is used to look up files in the themes folder (relative to the executable). wxString DeskTheme; - - // Enables use of 64x64 toolbar icons; when false 32x32 icons are used instead. - bool Toolbar_UseLargeImages; + + // Specifies the size of icons used in Listbooks; specifically the PCSX2 Properties dialog box. + // Realisic values range from 96x96 to 24x24. + int Listbook_ImageSize; + + // Specifies the size of each toolbar icon, in pixels (any value >= 2 is valid, but realistically + // values should be between 64 and 16 for usability reasons) + int Toolbar_ImageSize; // Enables display of toolbar text labels. bool Toolbar_ShowLabels; @@ -209,11 +216,11 @@ public: FolderOptions Folders; FilenameOptions BaseFilenames; McdSysOptions MemoryCards; - + public: void Load(); void Save(); - + protected: void LoadSave( IniInterface& ini ); }; diff --git a/pcsx2/Linux/pcsx2.cbp b/pcsx2/Linux/pcsx2.cbp index e7c986ee25..dc6383c7dc 100644 --- a/pcsx2/Linux/pcsx2.cbp +++ b/pcsx2/Linux/pcsx2.cbp @@ -1,398 +1,412 @@ - - - - - - + + + + + + diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index c47ea77a97..8c0b1f6e35 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -20,7 +20,7 @@ #include #include - +#include #include "System.h" class MainEmuFrame; @@ -65,7 +65,7 @@ protected: virtual void DoClose(); DECLARE_EVENT_TABLE() - + void OnMoveAround( wxMoveEvent& evt ); void OnResize( wxSizeEvent& evt ); }; @@ -78,8 +78,8 @@ struct AppImageIds Speedhacks, Gamefixes, Video; - - ConfigIds() : + + ConfigIds() : Paths( -1 ) , Speedhacks( -1 ) , Gamefixes( -1 ) @@ -87,7 +87,7 @@ struct AppImageIds { } } Config; - + struct ToolbarIds { int Settings, @@ -96,8 +96,8 @@ struct AppImageIds PluginVideo, PluginAudio, PluginPad; - - ToolbarIds() : + + ToolbarIds() : Settings( -1 ) , Play( -1 ) , PluginVideo( -1 ) @@ -119,7 +119,7 @@ protected: wxImageList m_ConfigImages; bool m_ConfigImagesAreLoaded; - + wxImageList* m_ToolbarImages; // dynamic (pointer) to allow for large/small redefinition. AppImageIds m_ImageId; @@ -136,7 +136,7 @@ public: const wxBitmap& GetLogoBitmap(); wxImageList& GetImgList_Config(); wxImageList& GetImgList_Toolbars(); - + const AppImageIds& GetImgId() const { return m_ImageId; } MainEmuFrame& GetMainFrame() const @@ -147,7 +147,7 @@ public: ConsoleLogFrame* GetConsoleFrame() const { return m_ConsoleFrame; } void SetConsoleFrame( ConsoleLogFrame& frame ) { m_ConsoleFrame = &frame; } - + bool TryOpenConfigCwd(); }; diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index 50997d695f..ee7c9aaf2b 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -82,7 +82,7 @@ namespace PathDefs { return AppRoot + Plugins; } - + wxDirName GetThemes() { return AppRoot + Themes; @@ -166,7 +166,10 @@ wxString AppConfig::FullpathHelpers::Bios() const { return Path::Combine( m_conf wxString AppConfig::FullpathHelpers::Mcd( uint mcdidx ) const { return Path::Combine( m_conf.Folders.MemoryCards, m_conf.MemoryCards.Mcd[mcdidx].Filename ); } // ------------------------------------------------------------------------ -#define IniEntry( varname, defval ) ini.Entry( L#varname, varname, defval ) +// GCC Note: wxT() macro is required when using string token pasting. For some reason L generates +// syntax errors. >_< +// +#define IniEntry( varname, defval ) ini.Entry( wxT(#varname), varname, defval ) void AppConfig::LoadSave( IniInterface& ini ) { @@ -212,7 +215,7 @@ void AppConfig::ConsoleLogOptions::LoadSave( IniInterface& ini ) void AppConfig::SpeedhackOptions::LoadSave( IniInterface& ini ) { ini.SetPath( L"Speedhacks" ); - + ini.SetPath( L".." ); } diff --git a/pcsx2/gui/Dialogs/ConfigurationDialog.cpp b/pcsx2/gui/Dialogs/ConfigurationDialog.cpp index aa215fbd7f..973bb9e112 100644 --- a/pcsx2/gui/Dialogs/ConfigurationDialog.cpp +++ b/pcsx2/gui/Dialogs/ConfigurationDialog.cpp @@ -34,8 +34,14 @@ using namespace Panels; Dialogs::ConfigurationDialog::ConfigurationDialog( wxWindow* parent, int id ) : wxDialogWithHelpers( parent, id, _T("PCSX2 Configuration"), true ) { +#if defined(__WXMAC__) || defined(__WXMSW__) + int orient = wxBK_TOP; +#else + int orient = wxBK_LEFT; +#endif + wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL ); - wxListbook& Notebook = *new wxListbook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLB_TOP ); + wxListbook& Notebook = *new wxListbook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, orient ); Notebook.SetImageList( &wxGetApp().GetImgList_Config() ); diff --git a/pcsx2/gui/Dialogs/ConfigurationDialog.h b/pcsx2/gui/Dialogs/ConfigurationDialog.h index d67b2dd067..fe10590938 100644 --- a/pcsx2/gui/Dialogs/ConfigurationDialog.h +++ b/pcsx2/gui/Dialogs/ConfigurationDialog.h @@ -20,7 +20,6 @@ #include #include -#include #include #include "wxHelpers.h" @@ -37,4 +36,4 @@ namespace Dialogs public: }; -} \ No newline at end of file +} diff --git a/pcsx2/gui/main.cpp b/pcsx2/gui/main.cpp index 743efa06be..25a343ef0f 100644 --- a/pcsx2/gui/main.cpp +++ b/pcsx2/gui/main.cpp @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - + #include "PrecompiledHeader.h" #include "IniInterface.h" #include "MainFrame.h" @@ -111,7 +111,7 @@ bool Pcsx2App::OnInit() // been installed or configured. The first place we look is in our program's working // directory. If the ini there exist, and is *not* empty, then we'll use it. Otherwise // we fall back on the ini file in the user's Documents folder. - + if( !TryOpenConfigCwd() ) { PathDefs::GetDocuments().Mkdir(); @@ -180,12 +180,12 @@ const wxImage& LoadImageAny( } base.SetExt( L"bmp" ); - if( base.FileExists() ) + if( base.FileExists() ) { if( dest.LoadFile( base.GetFullPath() ) ) return dest; } } - + return dest = onFail.Get(); } @@ -209,7 +209,7 @@ const wxBitmap& Pcsx2App::GetLogoBitmap() // loading theme from zipfile. //wxFileInputStream stream( zipped.ToString() ) //wxZipInputStream zstream( stream ); - + Console::Error( "Loading themes from zipfile is not supported yet.\nFalling back on default theme." ); } @@ -218,7 +218,8 @@ const wxBitmap& Pcsx2App::GetLogoBitmap() } wxImage img; - LoadImageAny( img, useTheme, mess, L"BackgroundLogo", EmbeddedImage() ); + EmbeddedImage temp; // because gcc can't allow non-const temporaries. + LoadImageAny( img, useTheme, mess, L"BackgroundLogo", temp ); m_Bitmap_Logo = new wxBitmap( img ); return *m_Bitmap_Logo; @@ -245,20 +246,23 @@ wxImageList& Pcsx2App::GetImgList_Config() } wxImage img; - int width, height; - m_ConfigImages.GetSize( 0, width, height ); + // GCC Specific: wxT() macro is required when using string token pasting. For some reason L + // generates syntax errors. >_< #undef FancyLoadMacro #define FancyLoadMacro( name ) \ + { \ + EmbeddedImage temp( g_Conf.Listbook_ImageSize, g_Conf.Listbook_ImageSize ); \ m_ImageId.Config.name = m_ConfigImages.Add( LoadImageAny( \ - img, useTheme, mess, L"ConfigIcon_" L#name, EmbeddedImage( width, height ) ) \ - ); + img, useTheme, mess, L"ConfigIcon_" wxT(#name), temp ) \ + ); \ + } FancyLoadMacro( Paths ); FancyLoadMacro( Gamefixes ); FancyLoadMacro( Speedhacks ); - FancyLoadMacro( Video ); + FancyLoadMacro( Video ); } m_ConfigImagesAreLoaded = true; return m_ConfigImages; @@ -269,7 +273,7 @@ wxImageList& Pcsx2App::GetImgList_Toolbars() { if( m_ToolbarImages == NULL ) { - const int imgSize = g_Conf.Toolbar_UseLargeImages ? 64 : 32; + const int imgSize = g_Conf.Toolbar_ImageSize ? 64 : 32; m_ToolbarImages = new wxImageList( imgSize, imgSize ); wxFileName mess; bool useTheme = (g_Conf.DeskTheme != L"default"); @@ -283,7 +287,11 @@ wxImageList& Pcsx2App::GetImgList_Toolbars() wxImage img; #undef FancyLoadMacro #define FancyLoadMacro( name ) \ - m_ImageId.Toolbars.name = m_ConfigImages.Add( LoadImageAny64( img, useTheme, g_Conf.Toolbar_UseLargeImages, mess, L"ToolbarIcon64" L#name, EmbeddedImage() ) ); + { \ + EmbeddedImage temp( imgSize, imgSize ); \ + m_ImageId.Toolbars.name = m_ConfigImages.Add( LoadImageAny( img, useTheme, mess, L"ToolbarIcon" wxT(#name), temp ) ); \ + } + } return *m_ToolbarImages; }