added notes column and it resizes columns in a better looking way now (like the old gui)

still need to find a way to colorize columns individually, seems to be a problem with wxw
if there is a defaultgcm selected, hitting play boots that gcm.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@492 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2008-09-11 21:24:49 +00:00
parent f5ffe10fca
commit 8dbfcaef4f
8 changed files with 112 additions and 110 deletions

View File

@ -97,6 +97,7 @@ EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard)
EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen)
EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore)
EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar)
EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar)
EVT_MENU(IDM_LOADSLOT1, CFrame::OnLoadState)
EVT_MENU(IDM_LOADSLOT2, CFrame::OnLoadState)
EVT_MENU(IDM_LOADSLOT3, CFrame::OnLoadState)
@ -205,8 +206,8 @@ void CFrame::CreateMenu()
m_pMenuItemLoad = emulationMenu->AppendSubMenu(saveMenu, _T("&Load State"));
m_pMenuItemSave = emulationMenu->AppendSubMenu(loadMenu, _T("Sa&ve State"));
for (int i = 1; i < 10; i++) {
saveMenu->Append(IDM_LOADSLOT1 + i - 1, wxString::Format(_T("Slot %i F%i"), i, i));
loadMenu->Append(IDM_SAVESLOT1 + i - 1, wxString::Format(_T("Slot %i Shift+F%i"), i, i));
saveMenu->Append(IDM_LOADSLOT1 + i - 1, wxString::Format(_T("Slot %i\tF%i"), i, i));
loadMenu->Append(IDM_SAVESLOT1 + i - 1, wxString::Format(_T("Slot %i\tShift+F%i"), i, i));
}
m_pMenuBar->Append(emulationMenu, _T("&Emulation"));
@ -218,24 +219,27 @@ void CFrame::CreateMenu()
pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&DSP settings"));
pOptionsMenu->Append(IDM_CONFIG_PAD_PLUGIN, _T("&PAD settings"));
pOptionsMenu->AppendSeparator();
pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tEsc"));
pOptionsMenu->AppendCheckItem(IDM_TOGGLE_DUALCORE, _T("&Dual-core (unstable!)"));
pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter"));
pOptionsMenu->AppendCheckItem(IDM_TOGGLE_DUALCORE, _T("Dual-&core (unstable!)"));
pOptionsMenu->Check(IDM_TOGGLE_DUALCORE, SConfig::GetInstance().m_LocalCoreStartupParameter.bUseDualCore);
m_pMenuBar->Append(pOptionsMenu, _T("&Options"));
// misc menu
wxMenu* miscMenu = new wxMenu;
miscMenu->Append(IDM_MEMCARD, _T("&Memcard manager"));
miscMenu->AppendCheckItem(IDM_TOGGLE_TOOLBAR, _T("&Enable toolbar"));
miscMenu->AppendCheckItem(IDM_TOGGLE_TOOLBAR, _T("View &toolbar"));
miscMenu->Check(IDM_TOGGLE_TOOLBAR, true);
miscMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _T("View &statusbar"));
miscMenu->Check(IDM_TOGGLE_STATUSBAR, true);
miscMenu->AppendSeparator();
miscMenu->Append(IDM_MEMCARD, _T("&Memcard manager"));
m_pMenuBar->Append(miscMenu, _T("&Misc"));
// help menu
wxMenu* helpMenu = new wxMenu;
/*helpMenu->Append(wxID_HELP, _T("&Help"));
re-enable when there's something useful to display*/
helpMenu->Append(IDM_HELPWEBSITE, _T("&Dolphin web site"));
helpMenu->Append(IDM_HELPGOOGLECODE, _T("&Dolphin at Google Code"));
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..."));
m_pMenuBar->Append(helpMenu, _T("&Help"));
@ -399,6 +403,25 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
UpdateGUI();
}
else if (!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty())
{
if (wxFileExists(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.c_str()))
{
BootManager::BootCore(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM);
}
else
{
wxMessageBox("The default ISO you have set is invalid.\n"
"Please pick on new one by right clicking on a game\n"
"and selecting \"Set as default ISO\".", "Invalid Default ISO", wxOK, this);
}
}
else
{
wxMessageBox("You can set an ISO to load by default.\n"
"Choose one by right clicking on a game and selecting\n"
"\"Set as default ISO\".", "Set Default ISO", wxOK, this);
}
}
@ -550,6 +573,19 @@ void CFrame::OnToggleToolbar(wxCommandEvent& event)
}
}
void CFrame::OnToggleStatusbar(wxCommandEvent& event)
{
if (event.IsChecked())
{
m_pStatusBar = CreateStatusBar();
}
else
{
delete m_pStatusBar;
m_pStatusBar = NULL;
}
}
void CFrame::OnKeyDown(wxKeyEvent& event)
{
if (((event.GetKeyCode() == WXK_RETURN) && (event.GetModifiers() == wxMOD_ALT)) ||
@ -574,14 +610,12 @@ void CFrame::UpdateGUI()
m_pPluginOptions->Enable(true);
GetToolBar()->EnableTool(IDM_STOP, false);
GetToolBar()->EnableTool(IDM_PLAY, false);
m_pToolPlay->SetShortHelp(_T("Play"));
m_pToolPlay->SetLabel(_T("Play"));
m_pMenuItemPlay->SetText(_T("Play"));
m_pMenuItemPlay->SetText(_T("&Play"));
m_pMenuItemPlay->Enable(false);
m_pMenuItemStop->Enable(false);
m_pMenuItemLoad->Enable(false);
m_pMenuItemSave->Enable(false);
@ -592,9 +626,7 @@ void CFrame::UpdateGUI()
m_pPluginOptions->Enable(false);
GetToolBar()->EnableTool(IDM_STOP, true);
GetToolBar()->EnableTool(IDM_PLAY, true);
m_pMenuItemPlay->Enable(true);
m_pMenuItemStop->Enable(true);
m_pMenuItemLoad->Enable(true);
m_pMenuItemSave->Enable(true);
@ -605,7 +637,7 @@ void CFrame::UpdateGUI()
m_pToolPlay->SetShortHelp(_T("Pause"));
m_pToolPlay->SetLabel(_T("Pause"));
m_pMenuItemPlay->SetText(_T("Pause"));
m_pMenuItemPlay->SetText(_T("&Pause"));
}
else
{
@ -613,7 +645,7 @@ void CFrame::UpdateGUI()
m_pToolPlay->SetShortHelp(_T("Play"));
m_pToolPlay->SetLabel(_T("Play"));
m_pMenuItemPlay->SetText(_T("Play"));
m_pMenuItemPlay->SetText(_T("&Play"));
}
}
GetToolBar()->Realize();

View File

@ -67,6 +67,7 @@ class CFrame
void OnToggleDualCore(wxCommandEvent& event);
void OnToggleThrottle(wxCommandEvent& event);
void OnToggleToolbar(wxCommandEvent& event);
void OnToggleStatusbar(wxCommandEvent& event);
void OnKeyDown(wxKeyEvent& event);
void OnHostMessage(wxCommandEvent& event);
void OnLoadState(wxCommandEvent& event);

View File

@ -27,7 +27,6 @@
#include "Config.h"
#include "GameListCtrl.h"
#if USE_XPM_BITMAPS
#include "../resources/Flag_Europe.xpm"
#include "../resources/Flag_France.xpm"
@ -35,7 +34,6 @@
#include "../resources/Flag_USA.xpm"
#endif // USE_XPM_BITMAPS
BEGIN_EVENT_TABLE(CGameListCtrl, wxListCtrl)
EVT_SIZE(CGameListCtrl::OnSize)
@ -49,16 +47,13 @@ EVT_MENU(IDM_OPENCONTAININGFOLDER, CGameListCtrl::OnOpenContainingFolder)
EVT_MENU(IDM_SETDEFAULTGCM, CGameListCtrl::OnSetDefaultGCM)
END_EVENT_TABLE()
CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: wxListCtrl(parent, id, pos, size, style) // | wxLC_VIRTUAL)
{
InitBitmaps();
}
void
CGameListCtrl::InitBitmaps()
void CGameListCtrl::InitBitmaps()
{
m_imageListSmall = new wxImageList(96, 32);
SetImageList(m_imageListSmall, wxIMAGE_LIST_SMALL);
@ -76,9 +71,7 @@ CGameListCtrl::InitBitmaps()
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_UNKNOWN] = m_imageListSmall->Add(iconTemp);
}
void
CGameListCtrl::BrowseForDirectory()
void CGameListCtrl::BrowseForDirectory()
{
wxString dirHome;
wxGetHomeDir(&dirHome);
@ -96,9 +89,7 @@ CGameListCtrl::BrowseForDirectory()
}
}
void
CGameListCtrl::Update()
void CGameListCtrl::Update()
{
Hide();
@ -112,16 +103,26 @@ CGameListCtrl::Update()
InsertColumn(COLUMN_BANNER, _T("Banner"));
InsertColumn(COLUMN_TITLE, _T("Title"));
InsertColumn(COLUMN_COMPANY, _T("Company"));
InsertColumn(COLUMN_NOTES, _T("Notes"));
InsertColumn(COLUMN_COUNTRY, _T(""));
InsertColumn(COLUMN_SIZE, _T("Size"));
InsertColumn(COLUMN_EMULATION_STATE, _T("Emulation"), wxLIST_FORMAT_LEFT);
InsertColumn(COLUMN_EMULATION_STATE, _T("Emulation"));
// set initial sizes for columns
SetColumnWidth(COLUMN_BANNER, 106);
SetColumnWidth(COLUMN_TITLE, 150);
SetColumnWidth(COLUMN_COMPANY, 100);
SetColumnWidth(COLUMN_NOTES, 200);
SetColumnWidth(COLUMN_COUNTRY, 32);
SetColumnWidth(COLUMN_EMULATION_STATE, 75);
// add all items
for (int i = 0; i < (int)m_ISOFiles.size(); i++)
{
InsertItemInReportView(i);
}
SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
SetColumnWidth(COLUMN_SIZE, wxLIST_AUTOSIZE);
}
else
{
@ -132,7 +133,6 @@ CGameListCtrl::Update()
long item = InsertItem(0, buf, -1);
SetItemFont(item, *wxITALIC_FONT);
SetColumnWidth(item, wxLIST_AUTOSIZE);
SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
AutomaticColumnWidth();
@ -169,9 +169,7 @@ wxString NiceSizeFormat(s64 _size)
return(NiceString);
}
void
CGameListCtrl::InsertItemInReportView(size_t _Index)
void CGameListCtrl::InsertItemInReportView(long _Index)
{
CISOFile& rISOFile = m_ISOFiles[_Index];
@ -190,7 +188,7 @@ CGameListCtrl::InsertItemInReportView(size_t _Index)
#else
wxColour color = (_Index & 1) ? 0xFFFFFF : 0xEEEEEE;
#endif
// background color color
// background color
{
wxListItem item;
item.SetId(ItemIndex);
@ -198,24 +196,35 @@ CGameListCtrl::InsertItemInReportView(size_t _Index)
SetItem(item);
}
// title color
// title
{
wxListItem item;
item.SetId(ItemIndex);
item.SetColumn(COLUMN_TITLE);
//SetItemTextColour(item, (wxColour(0xFF0000)));
item.SetText(wxString::FromAscii(rISOFile.GetName().c_str()));
SetItem(item);
}
// company color
// company
{
wxListItem item;
item.SetId(ItemIndex);
item.SetColumn(COLUMN_COMPANY);
//SetItemTextColour(item, (wxColour(0x007030)));
item.SetText(wxString::FromAscii(rISOFile.GetCompany().c_str()));
SetItem(item);
}
// description
{
wxListItem item;
item.SetId(ItemIndex);
item.SetColumn(COLUMN_NOTES);
item.SetText(wxString::FromAscii(rISOFile.GetDescription().c_str()));
SetItem(item);
}
// size
{
wxListItem item;
@ -248,9 +257,7 @@ CGameListCtrl::InsertItemInReportView(size_t _Index)
SetItemData(ItemIndex, _Index);
}
void
CGameListCtrl::ScanForISOs()
void CGameListCtrl::ScanForISOs()
{
m_ISOFiles.clear();
@ -281,7 +288,7 @@ CGameListCtrl::ScanForISOs()
dialog.CenterOnParent();
for (size_t i = 0; i < rFilenames.size(); i++)
for (int i = 0; i < rFilenames.size(); i++)
{
std::string FileName;
SplitPath(rFilenames[i], NULL, &FileName, NULL);
@ -309,23 +316,18 @@ CGameListCtrl::ScanForISOs()
std::sort(m_ISOFiles.begin(), m_ISOFiles.end());
}
void
CGameListCtrl::OnColBeginDrag(wxListEvent& event)
void CGameListCtrl::OnColBeginDrag(wxListEvent& event)
{
event.Veto();
if (event.GetColumn() != COLUMN_TITLE && event.GetColumn() != COLUMN_COMPANY
&& event.GetColumn() != COLUMN_NOTES)
event.Veto();
}
void
CGameListCtrl::OnColEndDrag(wxListEvent& WXUNUSED (event))
void CGameListCtrl::OnColEndDrag(wxListEvent& WXUNUSED (event))
{
AutomaticColumnWidth();
}
void
CGameListCtrl::OnRightClick(wxMouseEvent& event)
void CGameListCtrl::OnRightClick(wxMouseEvent& event)
{
// Focus the clicked item.
int flags;
@ -346,9 +348,7 @@ CGameListCtrl::OnRightClick(wxMouseEvent& event)
}
}
void
CGameListCtrl::OnActivated(wxListEvent& event)
void CGameListCtrl::OnActivated(wxListEvent& event)
{
if (m_ISOFiles.size() == 0)
{
@ -365,8 +365,7 @@ CGameListCtrl::OnActivated(wxListEvent& event)
}
}
const CISOFile *
CGameListCtrl::GetSelectedISO() const
const CISOFile * CGameListCtrl::GetSelectedISO() const
{
int item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (item == -1)
@ -375,8 +374,7 @@ CGameListCtrl::GetSelectedISO() const
return &m_ISOFiles[GetItemData(item)];
}
void
CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event)) {
void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event)) {
const CISOFile *iso = GetSelectedISO();
if (!iso)
return;
@ -385,8 +383,7 @@ CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event)) {
File::Explore(path);
}
void
CGameListCtrl::OnSetDefaultGCM(wxCommandEvent& WXUNUSED (event)) {
void CGameListCtrl::OnSetDefaultGCM(wxCommandEvent& WXUNUSED (event)) {
const CISOFile *iso = GetSelectedISO();
if (!iso)
return;
@ -394,8 +391,7 @@ CGameListCtrl::OnSetDefaultGCM(wxCommandEvent& WXUNUSED (event)) {
SConfig::GetInstance().SaveSettings();
}
void
CGameListCtrl::OnEditPatchFile(wxCommandEvent& WXUNUSED (event))
void CGameListCtrl::OnEditPatchFile(wxCommandEvent& WXUNUSED (event))
{
const CISOFile *iso = GetSelectedISO();
if (!iso)
@ -415,20 +411,18 @@ CGameListCtrl::OnEditPatchFile(wxCommandEvent& WXUNUSED (event))
File::Launch(filename);
}
void
CGameListCtrl::OnSelected(wxListEvent& WXUNUSED (event))
{}
void CGameListCtrl::OnSize(wxSizeEvent& WXUNUSED (event))
void CGameListCtrl::OnSelected(wxListEvent& WXUNUSED (event))
{
AutomaticColumnWidth();
}
void CGameListCtrl::OnSize(wxSizeEvent& event)
{
AutomaticColumnWidth();
bool
CGameListCtrl::MSWDrawSubItem(wxPaintDC& rPaintDC, int item, int subitem)
event.Skip();
}
bool CGameListCtrl::MSWDrawSubItem(wxPaintDC& rPaintDC, int item, int subitem)
{
bool Result = false;
#ifdef __WXMSW__
@ -447,16 +441,12 @@ CGameListCtrl::MSWDrawSubItem(wxPaintDC& rPaintDC, int item, int subitem)
}
}
}
//
#endif
return(Result);
}
void
CGameListCtrl::AutomaticColumnWidth()
void CGameListCtrl::AutomaticColumnWidth()
{
wxRect rc(GetClientRect());
@ -466,37 +456,10 @@ CGameListCtrl::AutomaticColumnWidth()
}
else if (GetColumnCount() > 4)
{
SetColumnWidth(COLUMN_COUNTRY, 32);
SetColumnWidth(COLUMN_BANNER, 106);
int resizable = rc.GetWidth() - (213 + GetColumnWidth(COLUMN_SIZE));
// width
for (int i = 0; i < GetColumnCount() - 1; i++)
{
if ((i != COLUMN_COUNTRY) && (i != COLUMN_BANNER))
{
SetColumnWidth(i, wxLIST_AUTOSIZE);
}
}
int size = 0;
for (int i = 0; i < GetColumnCount() - 1; i++)
{
size += GetColumnWidth(i);
}
int rest = rc.GetWidth() - size - 3;
if (rest > 0)
{
SetColumnWidth(GetColumnCount() - 1, rest);
}
else
{
SetColumnWidth(GetColumnCount() - 1, 0);
}
SetColumnWidth(COLUMN_TITLE, wxMax(0.3*resizable, 100));
SetColumnWidth(COLUMN_COMPANY, wxMax(0.2*resizable, 100));
SetColumnWidth(COLUMN_NOTES, wxMax(0.5*resizable, 100));
}
}

View File

@ -40,6 +40,7 @@ class CGameListCtrl : public wxListCtrl
COLUMN_BANNER = 0,
COLUMN_TITLE,
COLUMN_COMPANY,
COLUMN_NOTES,
COLUMN_COUNTRY,
COLUMN_SIZE,
COLUMN_EMULATION_STATE,
@ -52,7 +53,7 @@ class CGameListCtrl : public wxListCtrl
std::vector<CISOFile> m_ISOFiles;
void InitBitmaps();
void InsertItemInReportView(size_t _Index);
void InsertItemInReportView(long _Index);
void ScanForISOs();
DECLARE_EVENT_TABLE()

View File

@ -57,6 +57,7 @@ enum
IDM_TOGGLE_FULLSCREEN,
IDM_TOGGLE_DUALCORE,
IDM_TOGGLE_TOOLBAR,
IDM_TOGGLE_STATUSBAR,
IDM_NOTIFYMAPLOADED,
IDM_UPDATELOGDISPLAY,
IDM_UPDATEDISASMDIALOG,

View File

@ -59,6 +59,7 @@ CISOFile::CISOFile(const std::string& _rFileName)
{
pBannerLoader->GetName(m_Name, 0); //m_Country == DiscIO::IVolume::COUNTRY_JAP ? 1 : 0);
pBannerLoader->GetCompany(m_Company);
pBannerLoader->GetDescription(m_Description);
if (pBannerLoader->GetBanner(g_ImageTemp))
{

View File

@ -35,6 +35,8 @@ class CISOFile
const std::string& GetCompany() const {return(m_Company);}
const std::string& GetDescription() const {return(m_Description);}
const std::string& GetUniqueID() const {return(m_UniqueID);}
DiscIO::IVolume::ECountry GetCountry() const {return(m_Country);}
@ -53,6 +55,7 @@ class CISOFile
std::string m_FileName;
std::string m_Name;
std::string m_Company;
std::string m_Description;
std::string m_UniqueID;
u64 m_FileSize;

View File

@ -220,7 +220,7 @@ void CMemcardManager::ReloadMemcard(const char *fileName, int card)
{
if(memoryCard[card]) delete memoryCard[card];
// TODO: add error checking and banners/icons
// TODO: add error checking and animate icons
memoryCard[card] = new GCMemcard(fileName);
m_MemcardList[card]->Hide();