diff --git a/Source/Core/DolphinWX/Src/FrameAui.cpp b/Source/Core/DolphinWX/Src/FrameAui.cpp index 9036aaffc8..16dc073946 100644 --- a/Source/Core/DolphinWX/Src/FrameAui.cpp +++ b/Source/Core/DolphinWX/Src/FrameAui.cpp @@ -597,7 +597,7 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event) Tmp.Name = dlg.GetValue().mb_str(); Tmp.Perspective = m_Mgr->SavePerspective(); - ActivePerspective = Perspectives.size(); + ActivePerspective = (u32)Perspectives.size(); Perspectives.push_back(Tmp); UpdateCurrentPerspective(); diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index ef46599e13..5b1a610340 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -60,32 +60,50 @@ bool operator < (const GameListItem &one, const GameListItem &other) switch (one.GetCountry()) { - case DiscIO::IVolume::COUNTRY_JAPAN:; - case DiscIO::IVolume::COUNTRY_USA:indexOne = 0; break; - default: indexOne = (int)SConfig::GetInstance().m_InterfaceLanguage; + case DiscIO::IVolume::COUNTRY_JAPAN: + case DiscIO::IVolume::COUNTRY_USA: + indexOne = 0; + break; + default: + indexOne = SConfig::GetInstance().m_InterfaceLanguage; } switch (other.GetCountry()) { - case DiscIO::IVolume::COUNTRY_JAPAN:; - case DiscIO::IVolume::COUNTRY_USA:indexOther = 0; break; - default: indexOther = (int)SConfig::GetInstance().m_InterfaceLanguage; + case DiscIO::IVolume::COUNTRY_JAPAN: + case DiscIO::IVolume::COUNTRY_USA: + indexOther = 0; + break; + default: + indexOther = SConfig::GetInstance().m_InterfaceLanguage; } switch(currentColumn) { - case CGameListCtrl::COLUMN_TITLE: return strcasecmp(one.GetName(indexOne).c_str(), other.GetName(indexOther).c_str()) < 0; - case CGameListCtrl::COLUMN_NOTES: - { - // On Gamecube we show the company string, while it's empty on other platforms, so we show the description instead - std::string cmp1 = (one.GetPlatform() == GameListItem::GAMECUBE_DISC) ? one.GetCompany() : one.GetDescription(indexOne); - std::string cmp2 = (other.GetPlatform() == GameListItem::GAMECUBE_DISC) ? other.GetCompany() : other.GetDescription(indexOther); - return strcasecmp(cmp1.c_str(), cmp2.c_str()) < 0; - } - case CGameListCtrl::COLUMN_COUNTRY: return (one.GetCountry() < other.GetCountry()); - case CGameListCtrl::COLUMN_SIZE: return (one.GetFileSize() < other.GetFileSize()); - case CGameListCtrl::COLUMN_PLATFORM: return (one.GetPlatform() < other.GetPlatform()); - default: return strcasecmp(one.GetName(indexOne).c_str(), other.GetName(indexOther).c_str()) < 0; + case CGameListCtrl::COLUMN_TITLE: + return strcasecmp(one.GetName(indexOne).c_str(), + other.GetName(indexOther).c_str()) < 0; + case CGameListCtrl::COLUMN_NOTES: + { + // On Gamecube we show the company string, while it's empty on + // other platforms, so we show the description instead + std::string cmp1 = + (one.GetPlatform() == GameListItem::GAMECUBE_DISC) ? + one.GetCompany() : one.GetDescription(indexOne); + std::string cmp2 = + (other.GetPlatform() == GameListItem::GAMECUBE_DISC) ? + other.GetCompany() : other.GetDescription(indexOther); + return strcasecmp(cmp1.c_str(), cmp2.c_str()) < 0; + } + case CGameListCtrl::COLUMN_COUNTRY: + return (one.GetCountry() < other.GetCountry()); + case CGameListCtrl::COLUMN_SIZE: + return (one.GetFileSize() < other.GetFileSize()); + case CGameListCtrl::COLUMN_PLATFORM: + return (one.GetPlatform() < other.GetPlatform()); + default: + return strcasecmp(one.GetName(indexOne).c_str(), + other.GetName(indexOther).c_str()) < 0; } } @@ -118,7 +136,8 @@ BEGIN_EVENT_TABLE(CGameListCtrl, wxListCtrl) END_EVENT_TABLE() -CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style) +CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const + wxPoint& pos, const wxSize& size, long style) : wxListCtrl(parent, id, pos, size, style), toolTip(0) { } @@ -183,21 +202,22 @@ void CGameListCtrl::BrowseForDirectory() wxGetHomeDir(&dirHome); // browse - wxDirDialog dialog(this, _("Browse for a directory to add"), dirHome, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST); + wxDirDialog dialog(this, _("Browse for a directory to add"), dirHome, + wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST); if (dialog.ShowModal() == wxID_OK) { std::string sPath(dialog.GetPath().mb_str()); std::vector::iterator itResult = std::find( - SConfig::GetInstance().m_ISOFolder.begin(), SConfig::GetInstance().m_ISOFolder.end(), sPath - ); + SConfig::GetInstance().m_ISOFolder.begin(), + SConfig::GetInstance().m_ISOFolder.end(), sPath); if (itResult == SConfig::GetInstance().m_ISOFolder.end()) { SConfig::GetInstance().m_ISOFolder.push_back(sPath); SConfig::GetInstance().SaveSettings(); } - + Update(); } } @@ -233,9 +253,10 @@ void CGameListCtrl::Update() InsertColumn(COLUMN_PLATFORM, _("")); InsertColumn(COLUMN_BANNER, _("Banner")); InsertColumn(COLUMN_TITLE, _("Title")); - - // Instead of showing the notes + the company, which is unknown with wii titles - // We show in the same column : company for GC games and description for wii/wad games + + // Instead of showing the notes + the company, which is unknown with + // wii titles We show in the same column : company for GC games and + // description for wii/wad games InsertColumn(COLUMN_NOTES, _("Notes")); InsertColumn(COLUMN_COUNTRY, _("")); InsertColumn(COLUMN_SIZE, _("Size")); @@ -268,8 +289,9 @@ void CGameListCtrl::Update() else { wxString errorString; - // We just check for one hide setting to be enabled, as we may only have GC games - // for example, and hide them, so we should show the second message instead + // We just check for one hide setting to be enabled, as we may only + // have GC games for example, and hide them, so we should show the + // second message instead if ((SConfig::GetInstance().m_ListGC && SConfig::GetInstance().m_ListWii && SConfig::GetInstance().m_ListWad) && @@ -277,11 +299,13 @@ void CGameListCtrl::Update() SConfig::GetInstance().m_ListUsa && SConfig::GetInstance().m_ListPal)) { - errorString = _("Dolphin could not find any GC/Wii ISOs. Doubleclick here to browse for files..."); + errorString = wxT("Dolphin could not find any GC/Wii ISOs. ") + wxT("Doubleclick here to browse for files..."); } else { - errorString = _("Dolphin is currently set to hide all games. Doubleclick here to show all games..."); + errorString = wxT("Dolphin is currently set to hide all games. ") + wxT("Doubleclick here to show all games..."); } InsertColumn(0, _("No ISOs or WADS found")); long index = InsertItem(0, errorString); @@ -299,7 +323,7 @@ wxString NiceSizeFormat(s64 _size) const char* sizes[] = {"b", "KB", "MB", "GB", "TB", "PB", "EB"}; int s = 0; int frac = 0; - + while (_size > (s64)1024) { s++; @@ -317,12 +341,12 @@ wxString NiceSizeFormat(s64 _size) } std::string CGameListCtrl::GetGamePaths() const -{ - return m_gamePath; +{ + return m_gamePath; } std::string CGameListCtrl::GetGameNames() const -{ - return m_gameList; +{ + return m_gameList; } #ifdef _WIN32 @@ -342,7 +366,8 @@ void CGameListCtrl::OnPaintDrawImages(wxPaintEvent& event) { // Retrieve the topmost shown item and get drawing offsets long top = GetTopItem(); - int flagOffset = GetColumnWidth(0) + GetColumnWidth(1) + GetColumnWidth(2) + GetColumnWidth(3); + int flagOffset = GetColumnWidth(0) + GetColumnWidth(1) + + GetColumnWidth(2) + GetColumnWidth(3); int stateOffset = flagOffset + GetColumnWidth(4) + GetColumnWidth(5); // Only redraw shown lines @@ -353,12 +378,16 @@ void CGameListCtrl::OnPaintDrawImages(wxPaintEvent& event) int itemY = itemRect.GetTop(); const GameListItem& rISOFile = m_ISOFiles[GetItemData(i)]; - m_imageListSmall->Draw(m_PlatformImageIndex[rISOFile.GetPlatform()], dc, itemRect.GetX()+3, itemY); - m_imageListSmall->Draw(m_FlagImageIndex[rISOFile.GetCountry()], dc, flagOffset, itemY); + m_imageListSmall->Draw(m_PlatformImageIndex[rISOFile.GetPlatform()], + dc, itemRect.GetX()+3, itemY); + m_imageListSmall->Draw(m_FlagImageIndex[rISOFile.GetCountry()], + dc, flagOffset, itemY); - ini.Load((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + (rISOFile.GetUniqueID()) + ".ini").c_str()); + ini.Load((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + + (rISOFile.GetUniqueID()) + ".ini").c_str()); ini.Get("EmuState", "EmulationStateId", &nState); - m_imageListSmall->Draw(m_EmuStateImageIndex[nState], dc, stateOffset, itemY); + m_imageListSmall->Draw(m_EmuStateImageIndex[nState], + dc, stateOffset, itemY); } } } @@ -382,7 +411,8 @@ void CGameListCtrl::InsertItemInReportView(long _Index) // Insert a first row with the platform image, that will be used as the Index #ifndef _WIN32 - long ItemIndex = InsertItem(_Index, wxEmptyString, m_PlatformImageIndex[rISOFile.GetPlatform()]); + long ItemIndex = InsertItem(_Index, wxEmptyString, + m_PlatformImageIndex[rISOFile.GetPlatform()]); #else long ItemIndex = InsertItem(_Index, wxEmptyString, -1); #endif @@ -408,38 +438,50 @@ void CGameListCtrl::InsertItemInReportView(long _Index) case DiscIO::IVolume::COUNTRY_JAPAN: { wxString name = wxString(rISOFile.GetName(0).c_str(), SJISConv); - m_gameList.append(StringFromFormat("%s (J)\n", (const char*)name.c_str())); + m_gameList.append(StringFromFormat("%s (J)\n", name.c_str())); SetItem(_Index, COLUMN_TITLE, name, -1); - SetItem(_Index, COLUMN_NOTES, wxString(company.size() ? company.c_str() : rISOFile.GetDescription(0).c_str(), SJISConv), -1); + SetItem(_Index, COLUMN_NOTES, wxString(company.size() ? + company.c_str() : rISOFile.GetDescription(0).c_str(), + SJISConv), -1); } break; case DiscIO::IVolume::COUNTRY_USA: m_gameList.append(StringFromFormat("%s (U)\n", rISOFile.GetName(0).c_str())); - SetItem(_Index, COLUMN_TITLE, + SetItem(_Index, COLUMN_TITLE, wxString::From8BitData(rISOFile.GetName(0).c_str()), -1); - SetItem(_Index, COLUMN_NOTES, - wxString::From8BitData(company.size() ? company.c_str() : rISOFile.GetDescription(0).c_str()), -1); + SetItem(_Index, COLUMN_NOTES, + wxString::From8BitData(company.size() ? + company.c_str() : rISOFile.GetDescription(0).c_str()), -1); break; default: - m_gameList.append(StringFromFormat("%s (E)\n", rISOFile.GetName((int)SConfig::GetInstance().m_InterfaceLanguage).c_str())); - SetItem(_Index, COLUMN_TITLE, - wxString::From8BitData(rISOFile.GetName((int)SConfig::GetInstance().m_InterfaceLanguage).c_str()), -1); - SetItem(_Index, COLUMN_NOTES, wxString::From8BitData( - company.size() ? company.c_str() : rISOFile.GetDescription((int)SConfig::GetInstance().m_InterfaceLanguage).c_str()), -1); + m_gameList.append(StringFromFormat("%s (E)\n", + rISOFile.GetName(SConfig::GetInstance().m_InterfaceLanguage).c_str())); + SetItem(_Index, COLUMN_TITLE, + wxString::From8BitData( + rISOFile.GetName(SConfig::GetInstance().m_InterfaceLanguage).c_str()), + -1); + SetItem(_Index, COLUMN_NOTES, + wxString::From8BitData(company.size() ? + company.c_str() : + rISOFile.GetDescription(SConfig::GetInstance().m_InterfaceLanguage).c_str()), + -1); break; } } else // It's a Wad file { m_gameList.append(StringFromFormat("%s (WAD)\n", rISOFile.GetName(0).c_str())); - SetItem(_Index, COLUMN_TITLE, wxString(rISOFile.GetName(0).c_str(), SJISConv), -1); - SetItem(_Index, COLUMN_NOTES, wxString(rISOFile.GetDescription(0).c_str(), SJISConv), -1); + SetItem(_Index, COLUMN_TITLE, + wxString(rISOFile.GetName(0).c_str(), SJISConv), -1); + SetItem(_Index, COLUMN_NOTES, + wxString(rISOFile.GetDescription(0).c_str(), SJISConv), -1); } #ifndef _WIN32 // Load the INI file for columns that read from it IniFile ini; - ini.Load((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + (rISOFile.GetUniqueID()) + ".ini").c_str()); + ini.Load((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + + (rISOFile.GetUniqueID()) + ".ini").c_str()); // Emulation status int nState; @@ -476,7 +518,10 @@ void CGameListCtrl::SetBackgroundColor() { for(long i = 0; i < GetItemCount(); i++) { - wxColour color = (i & 1) ? blend50(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)) : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + wxColour color = (i & 1) ? + blend50(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), + wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)) : + wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); CGameListCtrl::SetItemBackgroundColour(i, color); } } @@ -501,14 +546,16 @@ void CGameListCtrl::ScanForISOs() for (u32 k = 0; k < Directories.size(); k++) { NormalizeDirSep(&Directories.at(k)); - if (strcmp(Directories.at(k).c_str(), FST_Temp.children.at(j).physicalName.c_str()) == 0) + if (strcmp(Directories.at(k).c_str(), + FST_Temp.children.at(j).physicalName.c_str()) == 0) { duplicate = true; break; } } if (!duplicate) - Directories.push_back(FST_Temp.children.at(j).physicalName.c_str()); + Directories.push_back( + FST_Temp.children.at(j).physicalName.c_str()); } } } @@ -536,7 +583,6 @@ void CGameListCtrl::ScanForISOs() (int)rFilenames.size(), // range this, // parent wxPD_APP_MODAL | - // wxPD_AUTO_HIDE | -- try this as well wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME | @@ -559,9 +605,7 @@ void CGameListCtrl::ScanForISOs() // Update with the progress (i) and the message (msg) bool Cont = dialog.Update(i, msg); if (!Cont) - { break; - } #endif GameListItem ISOFile(rFilenames[i]); if (ISOFile.IsValid()) @@ -570,52 +614,53 @@ void CGameListCtrl::ScanForISOs() switch(ISOFile.GetPlatform()) { - case GameListItem::WII_DISC: - if (!SConfig::GetInstance().m_ListWii) - list = false; - break; - case GameListItem::WII_WAD: - if (!SConfig::GetInstance().m_ListWad) - list = false; - break; - default: - if (!SConfig::GetInstance().m_ListGC) - list = false; - break; + case GameListItem::WII_DISC: + if (!SConfig::GetInstance().m_ListWii) + list = false; + break; + case GameListItem::WII_WAD: + if (!SConfig::GetInstance().m_ListWad) + list = false; + break; + default: + if (!SConfig::GetInstance().m_ListGC) + list = false; + break; } switch(ISOFile.GetCountry()) { - case DiscIO::IVolume::COUNTRY_TAIWAN: - if (!SConfig::GetInstance().m_ListTaiwan) - list = false; - case DiscIO::IVolume::COUNTRY_KOREA: - if (!SConfig::GetInstance().m_ListKorea) - list = false; - break; - case DiscIO::IVolume::COUNTRY_JAPAN: - if (!SConfig::GetInstance().m_ListJap) - list = false; - break; - case DiscIO::IVolume::COUNTRY_USA: - if (!SConfig::GetInstance().m_ListUsa) - list = false; - break; - case DiscIO::IVolume::COUNTRY_FRANCE: - if (!SConfig::GetInstance().m_ListFrance) - list = false; - break; - case DiscIO::IVolume::COUNTRY_ITALY: - if (!SConfig::GetInstance().m_ListItaly) - list = false; - break; - default: - if (!SConfig::GetInstance().m_ListPal) - list = false; - break; + case DiscIO::IVolume::COUNTRY_TAIWAN: + if (!SConfig::GetInstance().m_ListTaiwan) + list = false; + case DiscIO::IVolume::COUNTRY_KOREA: + if (!SConfig::GetInstance().m_ListKorea) + list = false; + break; + case DiscIO::IVolume::COUNTRY_JAPAN: + if (!SConfig::GetInstance().m_ListJap) + list = false; + break; + case DiscIO::IVolume::COUNTRY_USA: + if (!SConfig::GetInstance().m_ListUsa) + list = false; + break; + case DiscIO::IVolume::COUNTRY_FRANCE: + if (!SConfig::GetInstance().m_ListFrance) + list = false; + break; + case DiscIO::IVolume::COUNTRY_ITALY: + if (!SConfig::GetInstance().m_ListItaly) + list = false; + break; + default: + if (!SConfig::GetInstance().m_ListPal) + list = false; + break; } - if (list) m_ISOFiles.push_back(ISOFile); + if (list) + m_ISOFiles.push_back(ISOFile); } } } @@ -628,7 +673,8 @@ void CGameListCtrl::ScanForISOs() for (u32 i = 0; i < drives.size() && i < 24; i++) { Drive[i] = new GameListItem(drives[i].c_str()); - if (Drive[i]->IsValid()) m_ISOFiles.push_back(*Drive[i]); + if (Drive[i]->IsValid()) + m_ISOFiles.push_back(*Drive[i]); } } @@ -649,14 +695,14 @@ const GameListItem *CGameListCtrl::GetISO(int index) const CGameListCtrl *caller; int wxCALLBACK wxListCompare(long item1, long item2, long sortData) { - //return 1 if item1 > item2 - //return -1 if item1 < item2 - //0 for identity + // return 1 if item1 > item2 + // return -1 if item1 < item2 + // return 0 for identity const GameListItem *iso1 = caller->GetISO(item1); const GameListItem *iso2 = caller->GetISO(item2); - + int t = 1; - + if (sortData < 0) { t = -1; @@ -668,55 +714,77 @@ int wxCALLBACK wxListCompare(long item1, long item2, long sortData) switch (iso1->GetCountry()) { - case DiscIO::IVolume::COUNTRY_JAPAN:; - case DiscIO::IVolume::COUNTRY_USA:indexOne = 0; break; - default: indexOne = (int)SConfig::GetInstance().m_InterfaceLanguage; + case DiscIO::IVolume::COUNTRY_JAPAN: + case DiscIO::IVolume::COUNTRY_USA: + indexOne = 0; + break; + default: + indexOne = SConfig::GetInstance().m_InterfaceLanguage; } switch (iso2->GetCountry()) { - case DiscIO::IVolume::COUNTRY_JAPAN:; - case DiscIO::IVolume::COUNTRY_USA:indexOther = 0; break; - default: indexOther = (int)SConfig::GetInstance().m_InterfaceLanguage; + case DiscIO::IVolume::COUNTRY_JAPAN: + case DiscIO::IVolume::COUNTRY_USA: + indexOther = 0; + break; + default: + indexOther = SConfig::GetInstance().m_InterfaceLanguage; } switch(sortData) { - case CGameListCtrl::COLUMN_TITLE: - return strcasecmp(iso1->GetName(indexOne).c_str(),iso2->GetName(indexOther).c_str()) *t; - case CGameListCtrl::COLUMN_NOTES: - { - std::string cmp1 = (iso1->GetPlatform() == GameListItem::GAMECUBE_DISC) ? iso1->GetCompany() : iso1->GetDescription(indexOne); - std::string cmp2 = (iso2->GetPlatform() == GameListItem::GAMECUBE_DISC) ? iso2->GetCompany() : iso2->GetDescription(indexOther); - return strcasecmp(cmp1.c_str(), cmp2.c_str()) *t; - } - case CGameListCtrl::COLUMN_COUNTRY: - if(iso1->GetCountry() > iso2->GetCountry()) return 1 *t; - if(iso1->GetCountry() < iso2->GetCountry()) return -1 *t; - return 0; - case CGameListCtrl::COLUMN_SIZE: - if (iso1->GetFileSize() > iso2->GetFileSize()) return 1 *t; - if (iso1->GetFileSize() < iso2->GetFileSize()) return -1 *t; - return 0; - case CGameListCtrl::COLUMN_PLATFORM: - if(iso1->GetPlatform() > iso2->GetPlatform()) return 1 *t; - if(iso1->GetPlatform() < iso2->GetPlatform()) return -1 *t; - return 0; - case CGameListCtrl::COLUMN_EMULATION_STATE: - IniFile ini; int nState1 = 0, nState2 = 0; - std::string GameIni1 = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + iso1->GetUniqueID() + ".ini"; - std::string GameIni2 = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + iso2->GetUniqueID() + ".ini"; - - ini.Load(GameIni1.c_str()); - ini.Get("EmuState", "EmulationStateId", &nState1); - ini.Load(GameIni2.c_str()); - ini.Get("EmuState", "EmulationStateId", &nState2); + case CGameListCtrl::COLUMN_TITLE: + return strcasecmp(iso1->GetName(indexOne).c_str(), + iso2->GetName(indexOther).c_str()) * t; + case CGameListCtrl::COLUMN_NOTES: + { + std::string cmp1 = + (iso1->GetPlatform() == GameListItem::GAMECUBE_DISC) ? + iso1->GetCompany() : iso1->GetDescription(indexOne); + std::string cmp2 = + (iso2->GetPlatform() == GameListItem::GAMECUBE_DISC) ? + iso2->GetCompany() : iso2->GetDescription(indexOther); + return strcasecmp(cmp1.c_str(), cmp2.c_str()) * t; + } + case CGameListCtrl::COLUMN_COUNTRY: + if(iso1->GetCountry() > iso2->GetCountry()) + return 1 * t; + if(iso1->GetCountry() < iso2->GetCountry()) + return -1 * t; + return 0; + case CGameListCtrl::COLUMN_SIZE: + if (iso1->GetFileSize() > iso2->GetFileSize()) + return 1 * t; + if (iso1->GetFileSize() < iso2->GetFileSize()) + return -1 * t; + return 0; + case CGameListCtrl::COLUMN_PLATFORM: + if(iso1->GetPlatform() > iso2->GetPlatform()) + return 1 * t; + if(iso1->GetPlatform() < iso2->GetPlatform()) + return -1 * t; + return 0; + case CGameListCtrl::COLUMN_EMULATION_STATE: + IniFile ini; + int nState1 = 0, nState2 = 0; + std::string GameIni1 = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + + iso1->GetUniqueID() + ".ini"; + std::string GameIni2 = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + + iso2->GetUniqueID() + ".ini"; - if(nState1 > nState2) return 1 *t; - if(nState1 < nState2) return -1 *t; - return 0; + ini.Load(GameIni1.c_str()); + ini.Get("EmuState", "EmulationStateId", &nState1); + ini.Load(GameIni2.c_str()); + ini.Get("EmuState", "EmulationStateId", &nState2); + + if(nState1 > nState2) + return 1 * t; + if(nState1 < nState2) + return -1 * t; + return 0; } - + return 0; } @@ -725,7 +793,7 @@ void CGameListCtrl::OnColumnClick(wxListEvent& event) if(event.GetColumn() != COLUMN_BANNER) { int current_column = event.GetColumn(); - + if(last_column == current_column) { last_sort = -last_sort; @@ -735,7 +803,7 @@ void CGameListCtrl::OnColumnClick(wxListEvent& event) last_column = current_column; last_sort = current_column; } - + caller = this; SortItems(wxListCompare, last_sort); } @@ -778,12 +846,14 @@ void CGameListCtrl::OnKeyPress(wxListEvent& event) sLoop++; UnselectAll(); - SetItemState(i, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED); + SetItemState(i, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, + wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED); EnsureVisible(i); break; } - // If we get past the last game in the list, we'll have to go back to the first one. + // If we get past the last game in the list, + // we'll have to go back to the first one. if (i+1 == (int)m_ISOFiles.size() && sLoop > 0 && Loop > 0) i = -1; } @@ -794,15 +864,17 @@ void CGameListCtrl::OnKeyPress(wxListEvent& event) // This shows a little tooltip with the current Game's emulation state void CGameListCtrl::OnMouseMotion(wxMouseEvent& event) { - int flags; long subitem = 0; + int flags; + long subitem = 0; long item = HitTest(event.GetPosition(), flags, &subitem); static int lastItem = -1; - if (item != wxNOT_FOUND) + if (item != wxNOT_FOUND) { if (subitem == COLUMN_EMULATION_STATE) { - if (toolTip || lastItem == item || this != FindFocus()) { + if (toolTip || lastItem == item || this != FindFocus()) + { event.Skip(); return; } @@ -810,10 +882,18 @@ void CGameListCtrl::OnMouseMotion(wxMouseEvent& event) const GameListItem& rISO = m_ISOFiles[GetItemData(item)]; IniFile ini; - ini.Load((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + (rISO.GetUniqueID()) + ".ini").c_str()); + ini.Load((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + + (rISO.GetUniqueID()) + ".ini").c_str()); // Emulation status - std::string emuState[5] = {"Broken", "Intro", "In-Game", "Playable", "Perfect"}, issues; + std::string emuState[5] = { + "Broken", + "Intro", + "In-Game", + "Playable", + "Perfect" + }; + std::string issues; int nState; ini.Get("EmuState", "EmulationStateId", &nState); @@ -830,15 +910,18 @@ void CGameListCtrl::OnMouseMotion(wxMouseEvent& event) if (nState > 0 && nState < 6) { char temp[2048]; - sprintf(temp, "^ %s%s%s", emuState[nState -1].c_str(), issues.size() > 0 ? " :\n" : "", issues.c_str()); + sprintf(temp, "^ %s%s%s", emuState[nState -1].c_str(), + issues.size() > 0 ? " :\n" : "", issues.c_str()); toolTip = new wxEmuStateTip(this, wxString(temp, *wxConvCurrent), &toolTip); } else toolTip = new wxEmuStateTip(this, wxT("Not Set"), &toolTip); - toolTip->SetBoundingRect(wxRect(mx - GetColumnWidth(subitem), my, GetColumnWidth(subitem), Rect.GetHeight())); - toolTip->SetPosition(wxPoint(mx - GetColumnWidth(subitem), my - 5 + Rect.GetHeight())); - + toolTip->SetBoundingRect(wxRect(mx - GetColumnWidth(subitem), + my, GetColumnWidth(subitem), Rect.GetHeight())); + toolTip->SetPosition(wxPoint(mx - GetColumnWidth(subitem), + my - 5 + Rect.GetHeight())); + lastItem = item; } } @@ -850,14 +933,15 @@ void CGameListCtrl::OnLeftClick(wxMouseEvent& event) { // Focus the clicked item. int flags; - long item = HitTest(event.GetPosition(), flags); - if ((item != wxNOT_FOUND) && (GetSelectedItemCount() == 0) && (!event.ControlDown()) && (!event.ShiftDown())) + long item = HitTest(event.GetPosition(), flags); + if ((item != wxNOT_FOUND) && (GetSelectedItemCount() == 0) && + (!event.ControlDown()) && (!event.ShiftDown())) { SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); wxGetApp().GetCFrame()->UpdateGUI(); } - + event.Skip(); } @@ -865,8 +949,8 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event) { // Focus the clicked item. int flags; - long item = HitTest(event.GetPosition(), flags); - if (item != wxNOT_FOUND) + long item = HitTest(event.GetPosition(), flags); + if (item != wxNOT_FOUND) { if (GetItemState(item, wxLIST_STATE_SELECTED) != wxLIST_STATE_SELECTED) { @@ -892,7 +976,7 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event) } popupMenu->Append(IDM_OPENCONTAININGFOLDER, _("Open &containing folder")); popupMenu->AppendCheckItem(IDM_SETDEFAULTGCM, _("Set as &default ISO")); - + // First we have to decide a starting value when we append it if(selected_iso->GetFileName() == SConfig::GetInstance(). m_LocalCoreStartupParameter.m_strDefaultGCM) @@ -927,16 +1011,12 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event) const GameListItem * CGameListCtrl::GetSelectedISO() { if (m_ISOFiles.size() == 0) - { return NULL; - } else if (GetSelectedItemCount() == 0) - { return NULL; - } else { - long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); + long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item == wxNOT_FOUND) return new GameListItem(""); else @@ -953,7 +1033,7 @@ const GameListItem * CGameListCtrl::GetSelectedISO() } } -void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event)) +void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event)) { const GameListItem *iso = GetSelectedISO(); if (!iso) @@ -963,7 +1043,7 @@ void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event)) WxUtils::Explore(path.c_str()); } -void CGameListCtrl::OnOpenSaveFolder(wxCommandEvent& WXUNUSED (event)) +void CGameListCtrl::OnOpenSaveFolder(wxCommandEvent& WXUNUSED (event)) { const GameListItem *iso = GetSelectedISO(); if (!iso) @@ -991,27 +1071,26 @@ void CGameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED (event)) } } -// ======================================================= // Save this file as the default file -// ------------- -void CGameListCtrl::OnSetDefaultGCM(wxCommandEvent& event) +void CGameListCtrl::OnSetDefaultGCM(wxCommandEvent& event) { const GameListItem *iso = GetSelectedISO(); if (!iso) return; - - if (event.IsChecked()) // Write the new default value and save it the ini file + + if (event.IsChecked()) { - SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = iso->GetFileName(); + // Write the new default value and save it the ini file + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = + iso->GetFileName(); SConfig::GetInstance().SaveSettings(); } - else // Othwerise blank the value and save it + else { + // Othwerise blank the value and save it SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = ""; SConfig::GetInstance().SaveSettings(); } } -// ============= - void CGameListCtrl::OnDeleteGCM(wxCommandEvent& WXUNUSED (event)) { @@ -1020,8 +1099,9 @@ void CGameListCtrl::OnDeleteGCM(wxCommandEvent& WXUNUSED (event)) const GameListItem *iso = GetSelectedISO(); if (!iso) return; - if (wxMessageBox(_("Are you sure you want to delete this file?\nIt will be gone forever!"), - wxMessageBoxCaptionStr, wxYES_NO | wxICON_EXCLAMATION) == wxYES) + if (wxMessageBox(wxT("Are you sure you want to delete this file?\n") + wxT("It will be gone forever!"), + wxMessageBoxCaptionStr, wxYES_NO | wxICON_EXCLAMATION) == wxYES) { File::Delete(iso->GetFileName().c_str()); Update(); @@ -1029,8 +1109,9 @@ void CGameListCtrl::OnDeleteGCM(wxCommandEvent& WXUNUSED (event)) } else { - if (wxMessageBox(_("Are you sure you want to delete these files?\nThey will be gone forever!"), - wxMessageBoxCaptionStr, wxYES_NO | wxICON_EXCLAMATION) == wxYES) + if (wxMessageBox(wxT("Are you sure you want to delete these files?\n") + wxT("They will be gone forever!"), + wxMessageBoxCaptionStr, wxYES_NO | wxICON_EXCLAMATION) == wxYES) { int selected = GetSelectedItemCount(); @@ -1044,7 +1125,7 @@ void CGameListCtrl::OnDeleteGCM(wxCommandEvent& WXUNUSED (event)) } } -void CGameListCtrl::OnProperties(wxCommandEvent& WXUNUSED (event)) +void CGameListCtrl::OnProperties(wxCommandEvent& WXUNUSED (event)) { const GameListItem *iso = GetSelectedISO(); if (!iso) @@ -1066,7 +1147,6 @@ void CGameListCtrl::OnInstallWAD(wxCommandEvent& WXUNUSED (event)) 1000, // range this, // parent wxPD_APP_MODAL | - // wxPD_AUTO_HIDE | -- try this as well wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME | @@ -1081,9 +1161,11 @@ void CGameListCtrl::OnInstallWAD(wxCommandEvent& WXUNUSED (event)) void CGameListCtrl::MultiCompressCB(const char* text, float percent, void* arg) { percent = (((float)m_currentItem) + percent) / (float)m_numberItem; - wxString textString(StringFromFormat("%s (%i/%i) - %s", m_currentFilename.c_str(), (int)m_currentItem+1, (int)m_numberItem, text).c_str(), *wxConvCurrent); + wxString textString(StringFromFormat("%s (%i/%i) - %s", + m_currentFilename.c_str(), (int)m_currentItem+1, + (int)m_numberItem, text).c_str(), *wxConvCurrent); - ((wxProgressDialog*)arg)->Update((int)(percent*1000), textString); + ((wxProgressDialog*)arg)->Update((int)(percent*1000), textString); } void CGameListCtrl::OnMultiCompressGCM(wxCommandEvent& /*event*/) @@ -1101,22 +1183,23 @@ void CGameListCtrl::CompressSelection(bool _compress) wxString dirHome; wxGetHomeDir(&dirHome); - wxDirDialog browseDialog(this, _("Browse for output directory"), dirHome, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST); + wxDirDialog browseDialog(this, _("Browse for output directory"), dirHome, + wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST); if (browseDialog.ShowModal() != wxID_OK) return; - wxProgressDialog progressDialog(_compress ? _("Compressing ISO") : _("Decompressing ISO"), - _("Working..."), - 1000, // range - this, // parent - wxPD_APP_MODAL | - // wxPD_AUTO_HIDE | -- try this as well - wxPD_ELAPSED_TIME | - wxPD_ESTIMATED_TIME | - wxPD_REMAINING_TIME | - wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small - ); - + wxProgressDialog progressDialog(_compress ? + _("Compressing ISO") : _("Decompressing ISO"), + _("Working..."), + 1000, // range + this, // parent + wxPD_APP_MODAL | + wxPD_ELAPSED_TIME | + wxPD_ESTIMATED_TIME | + wxPD_REMAINING_TIME | + wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small + ); + progressDialog.SetSize(wxSize(600, 180)); progressDialog.CenterOnParent(); @@ -1134,9 +1217,14 @@ void CGameListCtrl::CompressSelection(bool _compress) FileName.append(".gcz"); std::string OutputFileName; - BuildCompleteFilename(OutputFileName, (const char *)browseDialog.GetPath().mb_str(wxConvUTF8), FileName); + BuildCompleteFilename(OutputFileName, + (const char *)browseDialog.GetPath().mb_str(wxConvUTF8), + FileName); - DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), OutputFileName.c_str(), (iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0, 16384, &MultiCompressCB, &progressDialog); + DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), + OutputFileName.c_str(), + (iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0, + 16384, &MultiCompressCB, &progressDialog); } else if (iso->IsCompressed() && !_compress) { @@ -1144,18 +1232,17 @@ void CGameListCtrl::CompressSelection(bool _compress) SplitPath(iso->GetFileName(), NULL, &FileName, NULL); m_currentFilename = FileName; if (iso->GetPlatform() == GameListItem::WII_DISC) - { FileName.append(".iso"); - } else - { FileName.append(".gcm"); - } std::string OutputFileName; - BuildCompleteFilename(OutputFileName, (const char *)browseDialog.GetPath().mb_str(wxConvUTF8), FileName); + BuildCompleteFilename(OutputFileName, + (const char *)browseDialog.GetPath().mb_str(wxConvUTF8), + FileName); - DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(), OutputFileName.c_str(), &MultiCompressCB, &progressDialog); + DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(), + OutputFileName.c_str(), &MultiCompressCB, &progressDialog); } m_currentItem++; } @@ -1164,10 +1251,11 @@ void CGameListCtrl::CompressSelection(bool _compress) void CGameListCtrl::CompressCB(const char* text, float percent, void* arg) { - ((wxProgressDialog*)arg)->Update((int)(percent*1000), wxString(text, *wxConvCurrent)); + ((wxProgressDialog*)arg)-> + Update((int)(percent*1000), wxString(text, *wxConvCurrent)); } -void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event)) +void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event)) { const GameListItem *iso = GetSelectedISO(); if (!iso) @@ -1181,31 +1269,26 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event)) if (iso->IsCompressed()) { if (iso->GetPlatform() == GameListItem::WII_DISC) - { Ext = wxT("*.iso"); - } else - { Ext = wxT("*.gcm"); - } - path = wxFileSelector( - _T("Save decompressed ISO"), - wxEmptyString, wxString(FileName.c_str(), *wxConvCurrent), wxEmptyString, - wxString::Format - ( - _T("All GC/Wii ISO files (%s)|%s|All files (%s)|%s"), - (char *)Ext.After('.').char_str(wxConvUTF8), - (char *)Ext.char_str(wxConvUTF8), - wxFileSelectorDefaultWildcardStr, - wxFileSelectorDefaultWildcardStr - ), - wxFD_SAVE, - this); + + path = wxFileSelector( + _T("Save decompressed ISO"), + wxEmptyString, wxString(FileName.c_str(), *wxConvCurrent), wxEmptyString, + wxString::Format + ( + _T("All GC/Wii ISO files (%s)|%s|All files (%s)|%s"), + (char *)Ext.After('.').char_str(wxConvUTF8), + (char *)Ext.char_str(wxConvUTF8), + wxFileSelectorDefaultWildcardStr, + wxFileSelectorDefaultWildcardStr + ), + wxFD_SAVE, + this); if (!path) - { return; - } } else { @@ -1214,38 +1297,40 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event)) wxEmptyString, wxString(FileName.c_str(), *wxConvCurrent), wxEmptyString, wxString::Format ( - _T("All compressed GC/Wii ISO files (gcz)|*.gcz|All files (%s)|%s"), - wxFileSelectorDefaultWildcardStr, - wxFileSelectorDefaultWildcardStr + _T("All compressed GC/Wii ISO files (gcz)|*.gcz|All files (%s)|%s"), + wxFileSelectorDefaultWildcardStr, + wxFileSelectorDefaultWildcardStr ), wxFD_SAVE, this); if (!path) - { return; - } } - wxProgressDialog dialog(iso->IsCompressed() ? _T("Decompressing ISO") : _T("Compressing ISO"), - _T("Working..."), - 1000, // range - this, // parent - wxPD_APP_MODAL | - // wxPD_AUTO_HIDE | -- try this as well - wxPD_ELAPSED_TIME | - wxPD_ESTIMATED_TIME | - wxPD_REMAINING_TIME | - wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small - ); - + wxProgressDialog dialog(iso->IsCompressed() ? + _T("Decompressing ISO") : _T("Compressing ISO"), + _T("Working..."), + 1000, // range + this, // parent + wxPD_APP_MODAL | + wxPD_ELAPSED_TIME | + wxPD_ESTIMATED_TIME | + wxPD_REMAINING_TIME | + wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small + ); + dialog.SetSize(wxSize(280, 180)); dialog.CenterOnParent(); if (iso->IsCompressed()) - DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(), path.char_str(), &CompressCB, &dialog); + DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(), + path.char_str(), &CompressCB, &dialog); else - DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), path.char_str(), (iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0, 16384, &CompressCB, &dialog); + DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), + path.char_str(), + (iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0, + 16384, &CompressCB, &dialog); Update(); } @@ -1261,12 +1346,10 @@ void CGameListCtrl::OnSize(wxSizeEvent& event) void CGameListCtrl::AutomaticColumnWidth() { - wxRect rc(GetParent()->GetRect()); + wxRect rc(GetClientRect()); if (GetColumnCount() == 1) - { SetColumnWidth(0, rc.GetWidth()); - } else if (GetColumnCount() > 4) { int resizable = rc.GetWidth() - ( @@ -1274,11 +1357,10 @@ void CGameListCtrl::AutomaticColumnWidth() + GetColumnWidth(COLUMN_COUNTRY) + GetColumnWidth(COLUMN_SIZE) + GetColumnWidth(COLUMN_EMULATION_STATE) - + GetColumnWidth(COLUMN_PLATFORM) - + 5); // some pad to keep the horizontal scrollbar away :) + + GetColumnWidth(COLUMN_PLATFORM)); - // We hide the Company column if the window is too small - if (resizable / 2 > 200) + // We hide the Notes column if the window is too small + if (resizable > 400) { SetColumnWidth(COLUMN_TITLE, resizable / 2); SetColumnWidth(COLUMN_NOTES, resizable / 2); diff --git a/Source/Core/DolphinWX/Src/LogWindow.cpp b/Source/Core/DolphinWX/Src/LogWindow.cpp index 8e76ca8f03..38d43b0d66 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.cpp +++ b/Source/Core/DolphinWX/Src/LogWindow.cpp @@ -46,6 +46,7 @@ BEGIN_EVENT_TABLE(CLogWindow, wxPanel) EVT_CHECKBOX(IDM_WRITEWINDOW, CLogWindow::OnOptionsCheck) EVT_CHECKLISTBOX(IDM_LOGCHECKS, CLogWindow::OnLogCheck) EVT_TIMER(IDTM_UPDATELOG, CLogWindow::OnLogTimer) + EVT_SIZE(CLogWindow::OnSize) END_EVENT_TABLE() CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos, @@ -170,14 +171,28 @@ void CLogWindow::OnClose(wxCloseEvent& event) event.Skip(); } +void CLogWindow::OnSize(wxSizeEvent& event) +{ + if (!Parent->g_pCodeWindow && + Parent->m_Mgr->GetPane(wxT("Pane 1")).IsShown()) + { + x = Parent->m_Mgr->GetPane(wxT("Pane 1")).rect.GetWidth(); + y = Parent->m_Mgr->GetPane(wxT("Pane 1")).rect.GetHeight(); + winpos = Parent->m_Mgr->GetPane(wxT("Pane 1")).dock_direction; + } + event.Skip(); +} + void CLogWindow::SaveSettings() { IniFile ini; + ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX)); + if (!Parent->g_pCodeWindow) { - ini.Set("LogWindow", "x", Parent->m_Mgr->GetPane(wxT("Pane 1")).rect.GetWidth()); - ini.Set("LogWindow", "y", Parent->m_Mgr->GetPane(wxT("Pane 1")).rect.GetHeight()); - ini.Set("LogWindow", "pos", Parent->m_Mgr->GetPane(wxT("Pane 1")).dock_direction); + ini.Set("LogWindow", "x", x); + ini.Set("LogWindow", "y", y); + ini.Set("LogWindow", "pos", winpos); } ini.Set("Options", "Verbosity", m_verbosity->GetSelection() + 1); ini.Set("Options", "Font", m_FontChoice->GetSelection()); diff --git a/Source/Core/DolphinWX/Src/LogWindow.h b/Source/Core/DolphinWX/Src/LogWindow.h index e529324a3b..be77d9c206 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.h +++ b/Source/Core/DolphinWX/Src/LogWindow.h @@ -97,6 +97,7 @@ private: void CreateGUIControls(); void PopulateRight(); void UnPopulateRight(); void OnClose(wxCloseEvent& event); + void OnSize(wxSizeEvent& event); void OnSubmit(wxCommandEvent& event); void OnOptionsCheck(wxCommandEvent& event); void OnLogCheck(wxCommandEvent& event);