Linux compilation fixes.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4425 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2011-03-12 23:19:49 +00:00
parent 2cfe05d290
commit 2d5ade6016
1 changed files with 45 additions and 45 deletions

View File

@ -149,9 +149,9 @@ Panels::BaseMcdListPanel::BaseMcdListPanel( wxWindow* parent )
//_("memory card Search Path:"), // static box label //_("memory card Search Path:"), // static box label
_("Select folder with PS2 memory cards") // dir picker popup label _("Select folder with PS2 memory cards") // dir picker popup label
); );
m_listview = NULL; m_listview = NULL;
m_btn_Refresh = new wxButton( this, wxID_ANY, _("Refresh list") ); m_btn_Refresh = new wxButton( this, wxID_ANY, _("Refresh list") );
Connect( m_btn_Refresh->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BaseMcdListPanel::OnRefreshSelections) ); Connect( m_btn_Refresh->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BaseMcdListPanel::OnRefreshSelections) );
@ -210,7 +210,7 @@ void Panels::BaseMcdListPanel::AppStatusEvent_OnSettingsApplied()
{ {
m_MultitapEnabled[0] = g_Conf->EmuOptions.MultitapPort0_Enabled; m_MultitapEnabled[0] = g_Conf->EmuOptions.MultitapPort0_Enabled;
m_MultitapEnabled[1] = g_Conf->EmuOptions.MultitapPort1_Enabled; m_MultitapEnabled[1] = g_Conf->EmuOptions.MultitapPort1_Enabled;
RefreshMcds(); RefreshMcds();
} }
} }
@ -231,7 +231,7 @@ public:
{ {
m_viewIndex = viewIndex; m_viewIndex = viewIndex;
} }
uint GetViewIndex() const uint GetViewIndex() const
{ {
pxAssumeDev( m_viewIndex >= 0, "memory card view-Index is uninitialized (invalid drag&drop object state)" ); pxAssumeDev( m_viewIndex >= 0, "memory card view-Index is uninitialized (invalid drag&drop object state)" );
@ -252,7 +252,7 @@ public:
virtual bool SetData(size_t len, const void *buf) virtual bool SetData(size_t len, const void *buf)
{ {
if( !pxAssertDev( len == sizeof(u32), "Data length mismatch on memory card drag&drop operation." ) ) return false; if( !pxAssertDev( len == sizeof(u32), "Data length mismatch on memory card drag&drop operation." ) ) return false;
m_viewIndex = *(u32*)buf; m_viewIndex = *(u32*)buf;
return ( (uint)m_viewIndex < 8 ); // sanity check (unsigned, so that -1 also is invalid) :) return ( (uint)m_viewIndex < 8 ); // sanity check (unsigned, so that -1 also is invalid) :)
} }
@ -308,7 +308,7 @@ public:
return def; return def;
} }
virtual void OnLeave() virtual void OnLeave()
{ {
m_listview->SetTargetedItem( wxNOT_FOUND ); m_listview->SetTargetedItem( wxNOT_FOUND );
@ -384,7 +384,7 @@ public:
return wxDragNone; return wxDragNone;
} }
newFilename += L".ps2"; newFilename += L".ps2";
//check that the name is valid for a new file //check that the name is valid for a new file
wxString errMsg; wxString errMsg;
if( !isValidNewFilename( newFilename, basepath, errMsg, 5 ) ) if( !isValidNewFilename( newFilename, basepath, errMsg, 5 ) )
@ -408,29 +408,29 @@ public:
{ {
wxString content; wxString content;
content.Printf( content.Printf(
pxE( "!Notice:Mcd:Overwrite", pxE( "!Notice:Mcd:Overwrite",
L"This will copy the entire contents of memory card file '%s' [=slot %u] to the memory card file '%s' [=slot %u]. " L"This will copy the entire contents of memory card file '%s' [=slot %u] to the memory card file '%s' [=slot %u]. "
L"All previous data on memory card file '%s' will be lost. Are you sure?" ), L"All previous data on memory card file '%s' will be lost. Are you sure?" ),
src.Filename.GetFullName().c_str(), src.Slot, src.Filename.GetFullName().c_str(), src.Slot,
dest.Filename.GetFullName().c_str(), dest.Slot, dest.Filename.GetFullName().c_str(), dest.Slot,
dest.Filename.GetFullName().c_str(), dest.Slot dest.Filename.GetFullName().c_str(), dest.Slot
); );
result = Msgbox::YesNo( content, _("Overwrite memory card file?") ); result = Msgbox::YesNo( content, _("Overwrite memory card file?") );
if (!result) if (!result)
return wxDragNone; return wxDragNone;
} }
ScopedBusyCursor doh( Cursor_ReallyBusy ); ScopedBusyCursor doh( Cursor_ReallyBusy );
if( !wxCopyFile( srcfile.GetFullPath(), destfile.GetFullPath(), true ) ) if( !wxCopyFile( srcfile.GetFullPath(), destfile.GetFullPath(), true ) )
{ {
wxString heading; wxString heading;
heading.Printf( pxE( "!Notice:Mcd:Copy Failed", heading.Printf( pxE( "!Notice:Mcd:Copy Failed",
L"Error! Copy failed. Destination memory card file '%s' [=slot %u] is in use." ), L"Error! Copy failed. Destination memory card file '%s' [=slot %u] is in use." ),
dest.Filename.GetFullName().c_str(), dest.Slot dest.Filename.GetFullName().c_str(), dest.Slot
); );
wxString content; wxString content;
Msgbox::Alert( heading + L"\n\n" + content, _("Copy failed!") ); Msgbox::Alert( heading + L"\n\n" + content, _("Copy failed!") );
@ -449,18 +449,18 @@ public:
} }
else if( wxDragMove == def ) else if( wxDragMove == def )
{ {
/* /*
// Move always performs a swap :) // Move always performs a swap :)
const bool srcExists( srcfile.FileExists() ); const bool srcExists( srcfile.FileExists() );
const bool destExists( destfile.FileExists() ); const bool destExists( destfile.FileExists() );
if( destExists && srcExists) if( destExists && srcExists)
{ {
wxFileName tempname; wxFileName tempname;
tempname.AssignTempFileName( basepath.ToString() ); tempname.AssignTempFileName( basepath.ToString() );
// Neat trick to handle errors. // Neat trick to handle errors.
result = result && wxRenameFile( srcfile.GetFullPath(), tempname.GetFullPath(), true ); result = result && wxRenameFile( srcfile.GetFullPath(), tempname.GetFullPath(), true );
result = result && wxRenameFile( destfile.GetFullPath(), srcfile.GetFullPath(), false ); result = result && wxRenameFile( destfile.GetFullPath(), srcfile.GetFullPath(), false );
@ -474,7 +474,7 @@ public:
{ {
result = wxRenameFile( srcfile.GetFullPath(), destfile.GetFullPath() ); result = wxRenameFile( srcfile.GetFullPath(), destfile.GetFullPath() );
} }
// Swap isEnabled state since both files got exchanged // Swap isEnabled state since both files got exchanged
bool temp = dest.IsEnabled; bool temp = dest.IsEnabled;
dest.IsEnabled = src.IsEnabled; dest.IsEnabled = src.IsEnabled;
@ -489,10 +489,10 @@ public:
Console.Indent().WriteLn( L"Dest: " + destfile.GetFullPath() ); Console.Indent().WriteLn( L"Dest: " + destfile.GetFullPath() );
} }
*/ */
// avih: old implementation above was swapping file contents (by actually switching the file names of 2 files) // avih: old implementation above was swapping file contents (by actually switching the file names of 2 files)
// New implementation just swaps the assigned file names at the slots. // New implementation just swaps the assigned file names at the slots.
//Note: each slot has 2 important properties: IsPresent (with Filename) and IsEnabled. //Note: each slot has 2 important properties: IsPresent (with Filename) and IsEnabled.
// For the sake of usability, when draggind src to dest, if src IsPresent, automatically enable dest. // For the sake of usability, when draggind src to dest, if src IsPresent, automatically enable dest.
// However, src slot keeps its old IsEnabled regardless of what happened. // However, src slot keeps its old IsEnabled regardless of what happened.
@ -511,7 +511,7 @@ public:
src.IsPresent = tmpPresent; src.IsPresent = tmpPresent;
} }
} }
return def; return def;
} }
}; };
@ -561,12 +561,12 @@ Panels::MemoryCardListPanel_Simple::MemoryCardListPanel_Simple( wxWindow* parent
*s_leftside_buttons += m_button_Rename; *s_leftside_buttons += m_button_Rename;
*s_leftside_buttons += 2; *s_leftside_buttons += 2;
*s_leftside_buttons += m_button_Create; *s_leftside_buttons += m_button_Create;
parent->SetWindowStyle(parent->GetWindowStyle() | wxRESIZE_BORDER); parent->SetWindowStyle(parent->GetWindowStyle() | wxRESIZE_BORDER);
Connect( m_listview->GetId(), wxEVT_COMMAND_LIST_BEGIN_DRAG, wxListEventHandler(MemoryCardListPanel_Simple::OnListDrag)); Connect( m_listview->GetId(), wxEVT_COMMAND_LIST_BEGIN_DRAG, wxListEventHandler(MemoryCardListPanel_Simple::OnListDrag));
Connect( m_listview->GetId(), wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler(MemoryCardListPanel_Simple::OnListSelectionChanged)); Connect( m_listview->GetId(), wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler(MemoryCardListPanel_Simple::OnListSelectionChanged));
//Deselected is not working for some reason (e.g. when clicking an empty row at the table) - avih //Deselected is not working for some reason (e.g. when clicking an empty row at the table) - avih
Connect( m_listview->GetId(), wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler(MemoryCardListPanel_Simple::OnListSelectionChanged)); Connect( m_listview->GetId(), wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler(MemoryCardListPanel_Simple::OnListSelectionChanged));
@ -577,7 +577,7 @@ Panels::MemoryCardListPanel_Simple::MemoryCardListPanel_Simple( wxWindow* parent
Connect( m_button_Rename->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MemoryCardListPanel_Simple::OnRenameFile)); Connect( m_button_Rename->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MemoryCardListPanel_Simple::OnRenameFile));
// Popup Menu Connections! // Popup Menu Connections!
Connect( McdMenuId_Create, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemoryCardListPanel_Simple::OnCreateCard) ); Connect( McdMenuId_Create, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemoryCardListPanel_Simple::OnCreateCard) );
Connect( McdMenuId_Mount, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemoryCardListPanel_Simple::OnMountCard) ); Connect( McdMenuId_Mount, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemoryCardListPanel_Simple::OnMountCard) );
Connect( McdMenuId_Rename, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemoryCardListPanel_Simple::OnRenameFile) ); Connect( McdMenuId_Rename, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemoryCardListPanel_Simple::OnRenameFile) );
@ -587,7 +587,7 @@ Panels::MemoryCardListPanel_Simple::MemoryCardListPanel_Simple( wxWindow* parent
void Panels::MemoryCardListPanel_Simple::UpdateUI() void Panels::MemoryCardListPanel_Simple::UpdateUI()
{ {
if( !m_listview ) return; if( !m_listview ) return;
int sel = m_listview->GetFirstSelected(); int sel = m_listview->GetFirstSelected();
if( wxNOT_FOUND == sel ) if( wxNOT_FOUND == sel )
@ -599,7 +599,7 @@ void Panels::MemoryCardListPanel_Simple::UpdateUI()
} }
const McdSlotItem& card( GetCardForViewIndex(sel) ); const McdSlotItem& card( GetCardForViewIndex(sel) );
m_button_Rename->Enable( card.IsPresent ); m_button_Rename->Enable( card.IsPresent );
wxString renameTip = _("Rename this memory card file."); wxString renameTip = _("Rename this memory card file.");
renameTip += wxString(L"\n") + _("Note: Port needs to be disabled first, and the change then needs to be applied." ); renameTip += wxString(L"\n") + _("Note: Port needs to be disabled first, and the change then needs to be applied." );
@ -610,11 +610,10 @@ void Panels::MemoryCardListPanel_Simple::UpdateUI()
wxString deleteTip = _("Permanently delete this memory card file from disk (all contents are lost)"); wxString deleteTip = _("Permanently delete this memory card file from disk (all contents are lost)");
deleteTip += wxString(L"\n") + _("Note: Port needs to be disabled first, and the change then needs to be applied." ); deleteTip += wxString(L"\n") + _("Note: Port needs to be disabled first, and the change then needs to be applied." );
pxSetToolTip( m_button_Create, if (card.IsPresent)
card.IsPresent pxSetToolTip( m_button_Create, deleteTip);
? deleteTip else
: _("Create a new memory card file and assign it to the selected PS2-Port." ) pxSetToolTip( m_button_Create, _("Create a new memory card file and assign it to the selected PS2-Port." ));
);
m_button_Mount->Enable( card.IsPresent ); m_button_Mount->Enable( card.IsPresent );
m_button_Mount->SetLabel( card.IsEnabled ? _("Disable Port") : _("Enable Port") ); m_button_Mount->SetLabel( card.IsEnabled ? _("Disable Port") : _("Enable Port") );
@ -638,7 +637,7 @@ void Panels::MemoryCardListPanel_Simple::Apply()
g_Conf->Mcd[slot].Enabled = m_Cards[slot].IsEnabled && m_Cards[slot].IsPresent; g_Conf->Mcd[slot].Enabled = m_Cards[slot].IsEnabled && m_Cards[slot].IsPresent;
if (m_Cards[slot].IsPresent) if (m_Cards[slot].IsPresent)
g_Conf->Mcd[slot].Filename = m_Cards[slot].Filename; g_Conf->Mcd[slot].Filename = m_Cards[slot].Filename;
else else
g_Conf->Mcd[slot].Filename = L""; g_Conf->Mcd[slot].Filename = L"";
} }
} }
@ -679,14 +678,14 @@ void Panels::MemoryCardListPanel_Simple::DoRefresh()
{ {
if( FileMcd_IsMultitapSlot(slot) && !m_MultitapEnabled[FileMcd_GetMtapPort(slot)] ) if( FileMcd_IsMultitapSlot(slot) && !m_MultitapEnabled[FileMcd_GetMtapPort(slot)] )
continue; continue;
//wxFileName fullpath( m_FolderPicker->GetPath() + g_Conf->Mcd[slot].Filename.GetFullName() ); //wxFileName fullpath( m_FolderPicker->GetPath() + g_Conf->Mcd[slot].Filename.GetFullName() );
wxFileName fullpath = m_FolderPicker->GetPath() + m_Cards[slot].Filename.GetFullName(); wxFileName fullpath = m_FolderPicker->GetPath() + m_Cards[slot].Filename.GetFullName();
EnumerateMemoryCard( m_Cards[slot], fullpath, m_FolderPicker->GetPath()); EnumerateMemoryCard( m_Cards[slot], fullpath, m_FolderPicker->GetPath());
m_Cards[slot].Slot = slot; m_Cards[slot].Slot = slot;
} }
if( m_listview ) m_listview->SetMcdProvider( this ); if( m_listview ) m_listview->SetMcdProvider( this );
UpdateUI(); UpdateUI();
} }
@ -753,8 +752,8 @@ void Panels::MemoryCardListPanel_Simple::OnCreateCard(wxCommandEvent& evt)
card.IsEnabled=false; card.IsEnabled=false;
} }
} }
wxCommandEvent change(pxEvt_SomethingChanged);
this->AddPendingEvent(wxCommandEvent(pxEvt_SomethingChanged));//enable the apply button (the auto-trigger doesn't get triggered here...) this->AddPendingEvent(change);//enable the apply button (the auto-trigger doesn't get triggered here...)
RefreshSelections(); RefreshSelections();
closed_core.AllowResume(); closed_core.AllowResume();
@ -762,7 +761,7 @@ void Panels::MemoryCardListPanel_Simple::OnCreateCard(wxCommandEvent& evt)
/*void Panels::MemoryCardListPanel_Simple::OnSwapPorts(wxCommandEvent& evt) /*void Panels::MemoryCardListPanel_Simple::OnSwapPorts(wxCommandEvent& evt)
{ {
}*/ }*/
void Panels::MemoryCardListPanel_Simple::OnMountCard(wxCommandEvent& evt) void Panels::MemoryCardListPanel_Simple::OnMountCard(wxCommandEvent& evt)
@ -771,7 +770,7 @@ void Panels::MemoryCardListPanel_Simple::OnMountCard(wxCommandEvent& evt)
const int selectedViewIndex = m_listview->GetFirstSelected(); const int selectedViewIndex = m_listview->GetFirstSelected();
if( wxNOT_FOUND == selectedViewIndex ) return; if( wxNOT_FOUND == selectedViewIndex ) return;
McdSlotItem& card( GetCardForViewIndex(selectedViewIndex) ); McdSlotItem& card( GetCardForViewIndex(selectedViewIndex) );
card.IsEnabled = !card.IsEnabled; card.IsEnabled = !card.IsEnabled;
@ -833,7 +832,7 @@ void Panels::MemoryCardListPanel_Simple::OnRenameFile(wxCommandEvent& evt)
return; return;
} }
newFilename += L".ps2"; newFilename += L".ps2";
//check that the name is valid for a new file //check that the name is valid for a new file
wxString errMsg; wxString errMsg;
if( !isValidNewFilename( newFilename, basepath, errMsg, 5 ) ) if( !isValidNewFilename( newFilename, basepath, errMsg, 5 ) )
@ -852,11 +851,12 @@ void Panels::MemoryCardListPanel_Simple::OnRenameFile(wxCommandEvent& evt)
Msgbox::Alert( _("Error: Rename could not be completed.\n"), _("Rename memory card file") ); Msgbox::Alert( _("Error: Rename could not be completed.\n"), _("Rename memory card file") );
return; return;
} }
card.Filename = newFilename; card.Filename = newFilename;
this->DoRefresh(); this->DoRefresh();
this->AddPendingEvent(wxCommandEvent(pxEvt_SomethingChanged));//enable the apply button (the auto-trigger doesn't get triggered here...) wxCommandEvent change(pxEvt_SomethingChanged);
this->AddPendingEvent(change);//enable the apply button (the auto-trigger doesn't get triggered here...)
} }
void Panels::MemoryCardListPanel_Simple::OnListDrag(wxListEvent& evt) void Panels::MemoryCardListPanel_Simple::OnListDrag(wxListEvent& evt)
@ -865,7 +865,7 @@ void Panels::MemoryCardListPanel_Simple::OnListDrag(wxListEvent& evt)
if( selectionViewIndex < 0 ) return; if( selectionViewIndex < 0 ) return;
McdDataObject my_data( selectionViewIndex ); McdDataObject my_data( selectionViewIndex );
wxDropSource dragSource( m_listview ); wxDropSource dragSource( m_listview );
dragSource.SetData( my_data ); dragSource.SetData( my_data );
/*wxDragResult result = */dragSource.DoDragDrop( wxDrag_AllowMove ); /*wxDragResult result = */dragSource.DoDragDrop( wxDrag_AllowMove );
@ -881,7 +881,7 @@ void Panels::MemoryCardListPanel_Simple::OnOpenItemContextMenu(wxListEvent& evt)
int idx = evt.GetIndex(); int idx = evt.GetIndex();
wxMenu* junk = new wxMenu(); wxMenu* junk = new wxMenu();
if( idx != wxNOT_FOUND ) if( idx != wxNOT_FOUND )
{ {
const McdSlotItem& card( GetCardForViewIndex(idx) ); const McdSlotItem& card( GetCardForViewIndex(idx) );
@ -897,7 +897,7 @@ void Panels::MemoryCardListPanel_Simple::OnOpenItemContextMenu(wxListEvent& evt)
} }
junk->Append( McdMenuId_RefreshList, _("Refresh List") ); junk->Append( McdMenuId_RefreshList, _("Refresh List") );
PopupMenu( junk ); PopupMenu( junk );
m_listview->RefreshItem( idx ); m_listview->RefreshItem( idx );
UpdateUI(); UpdateUI();
@ -977,4 +977,4 @@ McdSlotItem& Panels::MemoryCardListPanel_Simple::GetCardForViewIndex( int idx )
{ {
int slot = GetSlotIndexForViewIndex( idx ); int slot = GetSlotIndexForViewIndex( idx );
return m_Cards[slot]; return m_Cards[slot];
} }