Memory card manager: fixes and improvements:

1. Bugfix: when multitap 1 was disabled, multitap 2 slots were not showing at all on dialog load (were showing only after disable+enable of MT2).
2. Bugfix: when multitap 1 was disabled and refreshing the list, multitap 2 slots were showing (the disabled) multitap 1 slots,
3. Improvement: the "Slot" column title is renamed to "PS2 Location", and now contains a proper name instead of an unuseful number.
4. MCD manager is now resizable (though the mcd list only gets resized horizontally for now, but I did make it slightly higher to allow the maximum 8 slots without vertical scroll - on my system)


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4406 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
avihal@gmail.com 2011-03-08 03:44:15 +00:00
parent 92977728c1
commit c1e844b7f7
2 changed files with 78 additions and 12 deletions

View File

@ -69,6 +69,7 @@ bool EnumerateMemoryCard( McdListItem& dest, const wxFileName& filename )
return true;
}
//avih: unused??
static int EnumerateMemoryCards( McdList& dest, const wxArrayString& files )
{
int pushed = 0;
@ -200,7 +201,7 @@ void Panels::BaseMcdListPanel::Apply()
void Panels::BaseMcdListPanel::AppStatusEvent_OnSettingsApplied()
{
if( (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[0] = g_Conf->EmuOptions.MultitapPort0_Enabled;
m_MultitapEnabled[1] = g_Conf->EmuOptions.MultitapPort1_Enabled;
@ -456,7 +457,7 @@ Panels::MemoryCardListPanel_Simple::MemoryCardListPanel_Simple( wxWindow* parent
m_MultitapEnabled[1] = false;
m_listview = new MemoryCardListView_Simple(this);
m_listview->SetMinSize(wxSize(m_listview->GetMinWidth(), m_listview->GetCharHeight() * 10));
m_listview->SetMinSize(wxSize(m_listview->GetMinWidth(), m_listview->GetCharHeight() * 13));
m_listview->SetDropTarget( new McdDropTarget(m_listview) );
m_button_Create = new wxButton(this, wxID_ANY, _("Create"));
@ -473,6 +474,9 @@ Panels::MemoryCardListPanel_Simple::MemoryCardListPanel_Simple( wxWindow* parent
*s_leftside_buttons += m_button_Mount;
//*s_leftside_buttons += 2;
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_ITEM_SELECTED, wxListEventHandler(MemoryCardListPanel_Simple::OnListSelectionChanged));
Connect( m_listview->GetId(), wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler(MemoryCardListPanel_Simple::OnListSelectionChanged));
@ -701,5 +705,57 @@ int Panels::MemoryCardListPanel_Simple::GetLength() const
McdListItem& Panels::MemoryCardListPanel_Simple::GetCard( int idx )
{
return m_Cards[idx];
//calculate actual card slot (targetSlot) from list-view index (idx).
//card slots are fixed as sollows:
// slot 0: mcd1 (= MT1 slot 1)
// slot 1: mcd2 (= MT2 slot 1)
// slots 2,3,4: MT1 slots 2,3,4
// slots 5,6,7: MT2 slots 2,3,4
//
//however, the list-view doesn't show MT slots when this MT is disabled,
// so the view-index should "shift" to point at the real card slot.
int targetSlot=-1;
//this list-view arrangement is mostly kept aligned with the slots indexes, and only takes care
// of the case where MT1 is disabled (hence the MT2 slots "move backwards" 3 places on the view-index)
if (!m_MultitapEnabled[0] && idx>=2)
{
//we got an MT2 slot.
assert(idx < 5);
targetSlot = idx+3;
}
else
{
targetSlot=idx;//identical view-index and card slot.
}
/* //alternative arrangement of list-view:
//mcd1(=MT1 slot 1)
//[MT1 slots 2,3,4 if MT1 is enabled]
//mcd2(=MT2 slot 1)
//[MT2 slots 2,3,4 if MT2 is enabled]
if (m_MultitapEnabled[0]){
//MT1 enabled:
if (1<=idx && idx<=3){//MT1 slots 2/3/4 move one place backwards
targetSlot=idx+1;
}else if (idx==4){//mcd2 (=MT2 slot 1) moves 3 places forward
targetSlot=1;
} else {//mcd1 keeps it's pos as first, MT2 slots keep their pos at the end of the list.
targetSlot=idx;
}
} else {
//MT1 disabled: mcd1 and mcd2 stay put, MT2 slots 2,3,4 come next (move backwards 3 places)
if (2<=idx && idx<=4)
targetSlot=idx+3;
else
targetSlot=idx;
}
*/
assert(targetSlot>=0);
return m_Cards[targetSlot];
}

View File

@ -102,13 +102,13 @@ const ListViewColumnInfo& MemoryCardListView_Simple::GetDefaultColumnInfo( uint
{
static const ListViewColumnInfo columns[] =
{
{ _("Slot") , 48 , wxLIST_FORMAT_CENTER },
{ _("Status") , 96 , wxLIST_FORMAT_CENTER },
{ _("Size") , 72 , wxLIST_FORMAT_LEFT },
{ _("Formatted") , 96 , wxLIST_FORMAT_CENTER },
{ _("Modified") , 120 , wxLIST_FORMAT_LEFT },
{ _("Created") , 120 , wxLIST_FORMAT_LEFT },
{ _("Filename") , 256 , wxLIST_FORMAT_LEFT },
{ _("PS2 Location") , 140 , wxLIST_FORMAT_CENTER },
{ _("Status") , 96 , wxLIST_FORMAT_CENTER },
{ _("Size") , 72 , wxLIST_FORMAT_LEFT },
{ _("Formatted") , 96 , wxLIST_FORMAT_CENTER },
{ _("Modified") , 120 , wxLIST_FORMAT_LEFT },
{ _("Created") , 120 , wxLIST_FORMAT_LEFT },
{ _("Filename") , 256 , wxLIST_FORMAT_LEFT },
};
pxAssumeDev( idx < ArraySize(columns), "ListView column index is out of bounds." );
@ -127,12 +127,22 @@ void MemoryCardListView_Simple::SetCardCount( int length )
wxString MemoryCardListView_Simple::OnGetItemText(long item, long column) const
{
if( !m_CardProvider ) return _parent::OnGetItemText(item, column);
const McdListItem& it( m_CardProvider->GetCard(item) );
switch( column )
{
case McdColS_PortSlot: return pxsFmt( L"%u", item+1);
// case McdColS_PortSlot: return pxsFmt( L"%u", item+1);
case McdColS_PortSlot: {
wxString desc=_("");
if (!it.IsMultitapSlot()){
return pxsFmt(L"Card-%u or Multitap-%u-Slot-1", it.GetMtapPort()+1, it.GetMtapPort()+1);
} else {
return pxsFmt(L" Multitap-%u-Slot-%u", it.GetMtapPort()+1, it.GetMtapSlot()+1);
}
wxString d2=pxsFmt(L"MT=%s, MTP=%u, MTS=%u", (it.IsMultitapSlot()?_("true"):_("false")), it.GetMtapPort(), (it.IsMultitapSlot()?it.GetMtapSlot():999));
return desc;
return pxsFmt( L"", item+1);
}
case McdColS_Status: return it.IsPresent ? ( it.IsEnabled ? _("Enabled") : _("Disabled")) : _("Missing");
case McdColS_Size: return it.IsPresent ? pxsFmt( L"%u MB", it.SizeInMB ) : (wxString)_("N/A");
case McdColS_Formatted: return it.IsFormatted ? _("Yes") : _("No");