Some wxWidgets features, like wxProgressDialog used when updating the

game list, rely on the main event handler already running, which isn't
the case until after OnInit(). This is a problem when an ISO directory
is already set at startup.

To deal with such actions that can only properly be done after the wx
environment is fully functional, schedule AfterInit() where the initial
game list scan is done.

The underlying icon object for wxIcon on OS X didn't work with our 
(non-square?) 96x32 game list graphics, but we weren't using any wxIcon
properties such as transparency anyhow, so just skip the wxBitmap to 
wxIcon back to wxBitmap conversions.

Use wxID_ABOUT and wxID_PREFERENCES so that those menu items are
automagically teleported to their canonincal locations on each platform.

USE_XPM_BITMAPS has been implicit on all platforms for some time now.
 
AddGrowableCol() causes problems in a couple of inessential places for    
some unknown reason, even though the same pattern works fine elsewhere.
 
These changes make us play a lot nicer with wxWidgets 2.9.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5564 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-06-01 21:03:02 +00:00
parent 4ffdba7b92
commit c9564405d9
12 changed files with 91 additions and 80 deletions

View File

@ -44,7 +44,7 @@ SCoreStartupParameter::SCoreStartupParameter()
bSkipIdle(true), bNTSC(false),
bHLE_BS2(true), bUseFastMem(false),
bLockThreads(false),
bEnableCheats(false), bEnableIsoCache(false),
bEnableCheats(false),
bRunCompareServer(false), bRunCompareClient(false),
iTLBHack(0), SelectedLanguage(0),
bWii(false),

View File

@ -75,7 +75,6 @@ struct SCoreStartupParameter
bool bUseFastMem;
bool bLockThreads;
bool bEnableCheats;
bool bEnableIsoCache;
bool bRunCompareServer;
bool bRunCompareClient;

View File

@ -20,7 +20,6 @@ files = [
wxenv = env.Clone()
wxenv.Append(
CPPDEFINES = [
'USE_XPM_BITMAPS',
'wxNEEDS_CHARPP'
],
LINKFLAGS = [

View File

@ -238,7 +238,7 @@ EVT_MENU(wxID_OPEN, CFrame::OnOpen)
EVT_MENU(wxID_EXIT, CFrame::OnQuit)
EVT_MENU(IDM_HELPWEBSITE, CFrame::OnHelp)
EVT_MENU(IDM_HELPGOOGLECODE, CFrame::OnHelp)
EVT_MENU(IDM_HELPABOUT, CFrame::OnHelp)
EVT_MENU(wxID_ABOUT, CFrame::OnHelp)
EVT_MENU(wxID_REFRESH, CFrame::OnRefresh)
EVT_MENU(IDM_PLAY, CFrame::OnPlay)
EVT_MENU(IDM_STOP, CFrame::OnStop)
@ -248,7 +248,7 @@ EVT_MENU(IDM_PLAYRECORD, CFrame::OnPlayRecording)
EVT_MENU(IDM_FRAMESTEP, CFrame::OnFrameStep)
EVT_MENU(IDM_LUA, CFrame::OnOpenLuaWindow)
EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot)
EVT_MENU(IDM_CONFIG_MAIN, CFrame::OnConfigMain)
EVT_MENU(wxID_PREFERENCES, CFrame::OnConfigMain)
EVT_MENU(IDM_CONFIG_GFX_PLUGIN, CFrame::OnPluginGFX)
EVT_MENU(IDM_CONFIG_DSP_PLUGIN, CFrame::OnPluginDSP)
EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnPluginPAD)
@ -498,10 +498,6 @@ CFrame::CFrame(wxFrame* parent,
m_bControlsCreated = true;
UpdateGUI();
//if we are ever going back to optional iso caching:
//m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache);
if (m_GameListCtrl) m_GameListCtrl->Update();
// If we are rerecording create the status bar now instead of later when a game starts
#ifdef RERECORDING
ModifyStatusBar();

View File

@ -121,6 +121,7 @@ class CFrame : public CRenderFrame
bool bRenderToMain;
bool bNoWiimoteMsg;
void UpdateGUI();
void UpdateGameList();
void ToggleLogWindow(bool, int i = -1);
void ToggleConsole(bool, int i = -1);
void PostEvent(wxCommandEvent& event);

View File

@ -166,7 +166,7 @@ void CFrame::CreateMenu()
// Options menu
wxMenu* pOptionsMenu = new wxMenu;
pOptionsMenu->Append(IDM_CONFIG_MAIN, _T("Co&nfigure..."));
pOptionsMenu->Append(wxID_PREFERENCES, _T("Co&nfigure..."));
pOptionsMenu->AppendSeparator();
pOptionsMenu->Append(IDM_CONFIG_GFX_PLUGIN, _T("&Graphics Settings"));
pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&DSP Settings"));
@ -259,12 +259,12 @@ void CFrame::CreateMenu()
// Help menu
wxMenu* helpMenu = new wxMenu;
/*helpMenu->Append(wxID_HELP, _T("&Help"));
re-enable when there's something useful to display*/
// Re-enable when there's something useful to display */
// helpMenu->Append(wxID_HELP, _T("&Help"));
helpMenu->Append(IDM_HELPWEBSITE, _T("Dolphin &Web Site"));
helpMenu->Append(IDM_HELPGOOGLECODE, _T("Dolphin at &Google Code"));
helpMenu->AppendSeparator();
helpMenu->Append(IDM_HELPABOUT, _T("&About..."));
helpMenu->Append(wxID_ABOUT, _T("&About..."));
m_MenuBar->Append(helpMenu, _T("&Help"));
// Associate the menu bar with the frame
@ -329,7 +329,7 @@ void CFrame::PopulateToolbar(wxAuiToolBar* ToolBar)
ToolBar->AddTool(IDM_TOGGLE_FULLSCREEN, _T("FullScr"), m_Bitmaps[Toolbar_FullScreen], _T("Toggle Fullscreen"));
ToolBar->AddTool(IDM_SCREENSHOT, _T("ScrShot"), m_Bitmaps[Toolbar_FullScreen], _T("Take Screenshot"));
ToolBar->AddSeparator();
ToolBar->AddTool(IDM_CONFIG_MAIN, _T("Config"), m_Bitmaps[Toolbar_PluginOptions], _T("Configure..."));
ToolBar->AddTool(wxID_PREFERENCES, _T("Config"), m_Bitmaps[Toolbar_PluginOptions], _T("Configure..."));
ToolBar->AddTool(IDM_CONFIG_GFX_PLUGIN, _T("Graphics"), m_Bitmaps[Toolbar_PluginGFX], _T("Graphics settings"));
ToolBar->AddTool(IDM_CONFIG_DSP_PLUGIN, _T("DSP"), m_Bitmaps[Toolbar_PluginDSP], _T("DSP settings"));
ToolBar->AddTool(IDM_CONFIG_PAD_PLUGIN, _T("GCPad"), m_Bitmaps[Toolbar_PluginPAD], _T("Gamecube Pad settings"));
@ -961,7 +961,7 @@ void CFrame::OnHelp(wxCommandEvent& event)
{
switch (event.GetId())
{
case IDM_HELPABOUT:
case wxID_ABOUT:
{
AboutDolphin frame(this);
frame.ShowModal();
@ -1327,6 +1327,11 @@ void CFrame::UpdateGUI()
m_Mgr->Update();
}
void CFrame::UpdateGameList()
{
m_GameListCtrl->Update();
}
void CFrame::GameListChanged(wxCommandEvent& event)
{
switch (event.GetId())

View File

@ -35,22 +35,18 @@
#include "WxUtils.h"
#include "Main.h"
#if USE_XPM_BITMAPS
#include "../resources/Flag_Europe.xpm"
#include "../resources/Flag_France.xpm"
#include "../resources/Flag_Italy.xpm"
#include "../resources/Flag_Japan.xpm"
#include "../resources/Flag_USA.xpm"
#include "../resources/Flag_Taiwan.xpm"
#include "../resources/Flag_Korea.xpm"
#include "../resources/Flag_Unknown.xpm"
#include "../resources/Platform_Wad.xpm"
#include "../resources/Platform_Wii.xpm"
#include "../resources/Platform_Gamecube.xpm"
#include "../resources/rating_gamelist.h"
#endif // USE_XPM_BITMAPS
#include "../resources/Flag_Europe.xpm"
#include "../resources/Flag_France.xpm"
#include "../resources/Flag_Italy.xpm"
#include "../resources/Flag_Japan.xpm"
#include "../resources/Flag_USA.xpm"
#include "../resources/Flag_Taiwan.xpm"
#include "../resources/Flag_Korea.xpm"
#include "../resources/Flag_Unknown.xpm"
#include "../resources/Platform_Wad.xpm"
#include "../resources/Platform_Wii.xpm"
#include "../resources/Platform_Gamecube.xpm"
#include "../resources/rating_gamelist.h"
size_t CGameListCtrl::m_currentItem = 0;
size_t CGameListCtrl::m_numberItem = 0;
@ -137,49 +133,48 @@ void CGameListCtrl::InitBitmaps()
{
m_imageListSmall = new wxImageList(96, 32);
SetImageList(m_imageListSmall, wxIMAGE_LIST_SMALL);
wxIcon iconTemp;
m_FlagImageIndex.resize(DiscIO::IVolume::NUMBER_OF_COUNTRIES);
iconTemp.CopyFromBitmap(wxBitmap(Flag_Europe_xpm));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_EUROPE] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(Flag_France_xpm));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_FRANCE] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(Flag_USA_xpm));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_USA] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(Flag_Japan_xpm));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_JAPAN] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(Flag_Korea_xpm));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_KOREA] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(Flag_Italy_xpm));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_ITALY] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(Flag_Taiwan_xpm));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_TAIWAN] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(Flag_Unknown_xpm));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_SDK] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(Flag_Unknown_xpm));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_UNKNOWN] = m_imageListSmall->Add(iconTemp);
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_EUROPE] =
m_imageListSmall->Add(wxBitmap(Flag_Europe_xpm), wxNullBitmap);
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_FRANCE] =
m_imageListSmall->Add(wxBitmap(Flag_France_xpm), wxNullBitmap);
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_USA] =
m_imageListSmall->Add(wxBitmap(Flag_USA_xpm), wxNullBitmap);
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_JAPAN] =
m_imageListSmall->Add(wxBitmap(Flag_Japan_xpm), wxNullBitmap);
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_KOREA] =
m_imageListSmall->Add(wxBitmap(Flag_Korea_xpm), wxNullBitmap);
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_ITALY] =
m_imageListSmall->Add(wxBitmap(Flag_Italy_xpm), wxNullBitmap);
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_TAIWAN] =
m_imageListSmall->Add(wxBitmap(Flag_Taiwan_xpm), wxNullBitmap);
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_SDK] =
m_imageListSmall->Add(wxBitmap(Flag_Unknown_xpm), wxNullBitmap);
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_UNKNOWN] =
m_imageListSmall->Add(wxBitmap(Flag_Unknown_xpm), wxNullBitmap);
m_PlatformImageIndex.resize(3);
iconTemp.CopyFromBitmap(wxBitmap(Platform_Gamecube_xpm));
m_PlatformImageIndex[0] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(Platform_Wii_xpm));
m_PlatformImageIndex[1] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(Platform_Wad_xpm));
m_PlatformImageIndex[2] = m_imageListSmall->Add(iconTemp);
m_PlatformImageIndex[0] =
m_imageListSmall->Add(wxBitmap(Platform_Gamecube_xpm), wxNullBitmap);
m_PlatformImageIndex[1] =
m_imageListSmall->Add(wxBitmap(Platform_Wii_xpm), wxNullBitmap);
m_PlatformImageIndex[2] =
m_imageListSmall->Add(wxBitmap(Platform_Wad_xpm), wxNullBitmap);
m_EmuStateImageIndex.resize(6);
iconTemp.CopyFromBitmap(wxBitmap(rating_0));
m_EmuStateImageIndex[0] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(rating_1));
m_EmuStateImageIndex[1] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(rating_2));
m_EmuStateImageIndex[2] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(rating_3));
m_EmuStateImageIndex[3] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(rating_4));
m_EmuStateImageIndex[4] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(rating_5));
m_EmuStateImageIndex[5] = m_imageListSmall->Add(iconTemp);
m_EmuStateImageIndex[0] =
m_imageListSmall->Add(wxBitmap(rating_0), wxNullBitmap);
m_EmuStateImageIndex[1] =
m_imageListSmall->Add(wxBitmap(rating_1), wxNullBitmap);
m_EmuStateImageIndex[2] =
m_imageListSmall->Add(wxBitmap(rating_2), wxNullBitmap);
m_EmuStateImageIndex[3] =
m_imageListSmall->Add(wxBitmap(rating_3), wxNullBitmap);
m_EmuStateImageIndex[4] =
m_imageListSmall->Add(wxBitmap(rating_4), wxNullBitmap);
m_EmuStateImageIndex[5] =
m_imageListSmall->Add(wxBitmap(rating_5), wxNullBitmap);
}
void CGameListCtrl::BrowseForDirectory()

View File

@ -88,7 +88,7 @@ enum
IDM_DRIVE1,
IDM_DRIVE24 = IDM_DRIVE1 + 23,//248,
IDM_MEMCARD, // Misc menu
IDM_MEMCARD, // Tools menu
IDM_CHEATS,
IDM_NETPLAY,
IDM_RESTART,
@ -116,11 +116,9 @@ enum
IDM_LISTDRIVES,
IDM_PURGECACHE,
IDM_HELPABOUT, // Help menu
IDM_HELPWEBSITE,
IDM_HELPWEBSITE, // Help menu
IDM_HELPGOOGLECODE,
IDM_CONFIG_MAIN,
IDM_CONFIG_GFX_PLUGIN,
IDM_CONFIG_DSP_PLUGIN,
IDM_CONFIG_PAD_PLUGIN,

View File

@ -25,11 +25,9 @@
#include "ConfigManager.h"
#include "StringUtil.h"
#if USE_XPM_BITMAPS
#include "../resources/isoprop_file.xpm"
#include "../resources/isoprop_folder.xpm"
#include "../resources/isoprop_disc.xpm"
#endif // USE_XPM_BITMAPS
#include "../resources/isoprop_file.xpm"
#include "../resources/isoprop_folder.xpm"
#include "../resources/isoprop_disc.xpm"
struct WiiPartition
{
@ -414,7 +412,7 @@ void CISOProperties::CreateGUIControls(bool IsWad)
// ISO Details
sbISODetails = new wxStaticBoxSizer(wxVERTICAL, m_Information, _("ISO Details"));
sISODetails = new wxGridBagSizer(0, 0);
sISODetails->AddGrowableCol(1);
// XXX sISODetails->AddGrowableCol(0);
m_NameText = new wxStaticText(m_Information, ID_NAME_TEXT, _("Name:"), wxDefaultPosition, wxDefaultSize);
m_Name = new wxTextCtrl(m_Information, ID_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_GameIDText = new wxStaticText(m_Information, ID_GAMEID_TEXT, _("Game ID:"), wxDefaultPosition, wxDefaultSize);
@ -431,7 +429,7 @@ void CISOProperties::CreateGUIControls(bool IsWad)
// Banner Details
sbBannerDetails = new wxStaticBoxSizer(wxVERTICAL, m_Information, _("Banner Details"));
sBannerDetails = new wxGridBagSizer(0, 0);
sBannerDetails->AddGrowableCol(1); sBannerDetails->AddGrowableCol(2); sBannerDetails->AddGrowableCol(3);
// XXX sBannerDetails->AddGrowableCol(1); sBannerDetails->AddGrowableCol(2); sBannerDetails->AddGrowableCol(3);
m_LangText = new wxStaticText(m_Information, ID_LANG_TEXT, _("Show Language:"), wxDefaultPosition, wxDefaultSize);
arrayStringFor_Lang.Add(_("English"));
arrayStringFor_Lang.Add(_("German"));

View File

@ -52,6 +52,10 @@
IMPLEMENT_APP(DolphinApp)
BEGIN_EVENT_TABLE(DolphinApp, wxApp)
EVT_TIMER(wxID_ANY, DolphinApp::AfterInit)
END_EVENT_TABLE()
#include <wx/stdpaths.h>
bool wxMsgAlert(const char*, const char*, bool, int);
@ -451,9 +455,19 @@ bool DolphinApp::OnInit()
XInitThreads();
#endif
// Postpone final actions until event handler is running
m_afterinit = new wxTimer(this, wxID_ANY);
m_afterinit->Start(1, wxTIMER_ONE_SHOT);
return true;
}
void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
{
delete m_afterinit;
main_frame->UpdateGameList();
}
void DolphinApp::OnEndSession()
{

View File

@ -29,6 +29,13 @@ public:
void OnEndSession();
int OnExit();
CFrame* GetCFrame();
private:
DECLARE_EVENT_TABLE()
wxTimer *m_afterinit;
void AfterInit(wxTimerEvent& WXUNUSED(event));
};
DECLARE_APP(DolphinApp);

View File

@ -45,7 +45,6 @@ if wxenv['HAVE_WX']:
]
CPPDEFINES = [
'USE_XPM_BITMAPS',
'wxNEEDS_CHARPP',
],