MCD manager: enable the "create new card" button/context menu also when no item is selected and for the [-- Unused cards --] item.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4460 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
avihal@gmail.com 2011-03-20 05:08:23 +00:00
parent 870a86c117
commit eccbf165b9
1 changed files with 24 additions and 22 deletions

View File

@ -507,10 +507,14 @@ void Panels::MemoryCardListPanel_Simple::UpdateUI()
if( !m_listview ) return; if( !m_listview ) return;
int sel = m_listview->GetFirstSelected(); int sel = m_listview->GetFirstSelected();
m_button_Create->Enable();
if( wxNOT_FOUND == sel ) if( wxNOT_FOUND == sel )
{ {
m_button_Create->Disable(); m_button_Create->SetLabel( _("Create ...") );
pxSetToolTip( m_button_Create, _("Create a new memory card." ));
// m_button_Mount->Disable(); // m_button_Mount->Disable();
m_button_Rename->Disable(); m_button_Rename->Disable();
m_button_Duplicate->Disable(); m_button_Duplicate->Disable();
@ -534,14 +538,15 @@ void Panels::MemoryCardListPanel_Simple::UpdateUI()
wxString dupTip = _("Create a duplicate of this memory card ..."); wxString dupTip = _("Create a duplicate of this memory card ...");
pxSetToolTip( m_button_Duplicate, dupTip ); pxSetToolTip( m_button_Duplicate, dupTip );
m_button_Create->Enable(card.Slot>=0 || card.IsPresent); //m_button_Create->Enable( card.Slot>=0 || card.IsPresent);
m_button_Create->SetLabel( card.IsPresent ? _("Delete") : _("Create ...") ); m_button_Create->SetLabel( card.IsPresent ? _("Delete") : _("Create ...") );
wxString deleteTip = _("Permanently delete this memory card from disk (all contents are lost)");
if (card.IsPresent) if (card.IsPresent)
pxSetToolTip( m_button_Create, deleteTip); pxSetToolTip( m_button_Create, _("Permanently delete this memory card from disk (all contents are lost)"));
else else if( card.Slot >= 0 )
pxSetToolTip( m_button_Create, _("Create a new memory card and assign it to the selected PS2-Port." )); pxSetToolTip( m_button_Create, _("Create a new memory card and assign it to this Port." ));
else
pxSetToolTip( m_button_Create, _("Create a new memory card." ));
/* /*
m_button_Mount->Enable( card.IsPresent && card.Slot>=0); m_button_Mount->Enable( card.IsPresent && card.Slot>=0);
@ -668,7 +673,8 @@ void Panels::MemoryCardListPanel_Simple::DoRefresh()
// ===================================================================================================== // =====================================================================================================
void Panels::MemoryCardListPanel_Simple::UiCreateNewCard( McdSlotItem& card ) void Panels::MemoryCardListPanel_Simple::UiCreateNewCard( McdSlotItem& card )
{ {//card can also be the filesystem placeholder. On that case, the changes
// made to it will be reverted on refresh, and we'll just have a new card at the folder.
if( card.IsPresent ){ if( card.IsPresent ){
Console.WriteLn("Error: Aborted: create mcd invoked but but a file is already associated."); Console.WriteLn("Error: Aborted: create mcd invoked but but a file is already associated.");
return; return;
@ -876,8 +882,9 @@ void Panels::MemoryCardListPanel_Simple::UiRenameCard( McdSlotItem& card )
void Panels::MemoryCardListPanel_Simple::OnCreateOrDeleteCard(wxCommandEvent& evt) void Panels::MemoryCardListPanel_Simple::OnCreateOrDeleteCard(wxCommandEvent& evt)
{ {
const int selectedViewIndex = m_listview->GetFirstSelected(); int selectedViewIndex = m_listview->GetFirstSelected();
if( wxNOT_FOUND == selectedViewIndex ) return; if( wxNOT_FOUND == selectedViewIndex )
selectedViewIndex = -1;//get filesystem placeholder, just create a new card at the filesystem.
McdSlotItem& card( GetCardForViewIndex(selectedViewIndex) ); McdSlotItem& card( GetCardForViewIndex(selectedViewIndex) );
@ -1042,24 +1049,19 @@ void Panels::MemoryCardListPanel_Simple::OnOpenItemContextMenu(wxListEvent& evt)
const McdSlotItem& card( GetCardForViewIndex(idx) ); const McdSlotItem& card( GetCardForViewIndex(idx) );
if (card.IsPresent){ if (card.IsPresent){
/*
if (card.Slot>=0)
{
junk->Append( McdMenuId_Mount, card.IsEnabled ? _("Disable Port") : _("Enable Port") );
junk->AppendSeparator();
}
*/
junk->Append( McdMenuId_AssignUnassign, card.Slot>=0?_("Eject card"):_("Insert card ...") ); junk->Append( McdMenuId_AssignUnassign, card.Slot>=0?_("Eject card"):_("Insert card ...") );
junk->Append( McdMenuId_Duplicate, _("Duplicate card ...") ); junk->Append( McdMenuId_Duplicate, _("Duplicate card ...") );
junk->Append( McdMenuId_Rename, _("Rename card ...") ); junk->Append( McdMenuId_Rename, _("Rename card ...") );
junk->Append( McdMenuId_Create, _("Delete card") );
} }
else
junk->Append( McdMenuId_Create, _("Create a new card ...") );
if ( card.IsPresent || card.Slot>=0 )
{
junk->Append( McdMenuId_Create, card.IsPresent ? _("Delete card") : _("Create a new card ...") );
junk->AppendSeparator();
}
} }
else
junk->Append( McdMenuId_Create, _("Create a new card ...") );
junk->AppendSeparator();
junk->Append( McdMenuId_RefreshList, _("Refresh List") ); junk->Append( McdMenuId_RefreshList, _("Refresh List") );