~registry/dolphin-emu/triforce

« back to all changes in this revision

Viewing changes to Source/Core/DolphinWX/Src/MemcardManager.h

  • Committer: Sérgio Benjamim
  • Date: 2015-02-13 05:54:40 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20150213055440-ey2rt3sjpy27km78
Dolphin Triforce branch from code.google, commit b957980 (4.0-315).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2013 Dolphin Emulator Project
 
2
// Licensed under GPLv2
 
3
// Refer to the license.txt file included.
 
4
 
 
5
#ifndef __MEMCARD_MANAGER_h__
 
6
#define __MEMCARD_MANAGER_h__
 
7
 
 
8
#include <wx/wx.h>
 
9
#include <wx/sizer.h>
 
10
#include <wx/filepicker.h>
 
11
#include <wx/statbmp.h>
 
12
#include <wx/stattext.h>
 
13
#include <wx/listctrl.h>
 
14
#include <wx/imaglist.h>
 
15
#include <wx/fontmap.h>
 
16
 
 
17
#include "IniFile.h"
 
18
#include "FileUtil.h"
 
19
#include "HW/GCMemcard.h"
 
20
 
 
21
#undef MEMCARD_MANAGER_STYLE
 
22
#define MEMCARD_MANAGER_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX | wxRESIZE_BORDER | wxMAXIMIZE_BOX
 
23
#define MEMCARDMAN_TITLE _trans("Memory Card Manager WARNING-Make backups before using, should be fixed but could mangle stuff!")
 
24
 
 
25
#define E_SAVEFAILED "File write failed"
 
26
#define E_UNK "Unknown error"
 
27
#define FIRSTPAGE 0
 
28
 
 
29
class CMemcardManager : public wxDialog
 
30
{
 
31
        public:
 
32
 
 
33
                CMemcardManager(wxWindow *parent, wxWindowID id = wxID_ANY, const wxString& title = wxGetTranslation(wxT(MEMCARDMAN_TITLE)),
 
34
                        const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MEMCARD_MANAGER_STYLE);
 
35
                virtual ~CMemcardManager();
 
36
 
 
37
        private:
 
38
                DECLARE_EVENT_TABLE();
 
39
 
 
40
                int page[2],
 
41
                        itemsPerPage,
 
42
                        maxPages;
 
43
                std::string DefaultMemcard[2],
 
44
                                        DefaultIOPath;
 
45
                IniFile MemcardManagerIni;
 
46
                IniFile::Section* iniMemcardSection;
 
47
 
 
48
                wxButton *m_CopyFrom[2],
 
49
                                 *m_SaveImport[2],
 
50
                                 *m_SaveExport[2],
 
51
                                 *m_Delete[2],
 
52
                                 *m_NextPage[2],
 
53
                                 *m_PrevPage[2],
 
54
                                 *m_ConvertToGci;
 
55
                wxFilePickerCtrl *m_MemcardPath[2];
 
56
                wxStaticText *t_Status[2];
 
57
 
 
58
                enum
 
59
                {
 
60
                        ID_COPYFROM_A = 1000,   // Do not rearrange these items,
 
61
                        ID_COPYFROM_B,                  // ID_..._B must be 1 more than ID_..._A
 
62
                        ID_FIXCHECKSUM_A,
 
63
                        ID_FIXCHECKSUM_B,
 
64
                        ID_DELETE_A,
 
65
                        ID_DELETE_B,
 
66
                        ID_SAVEEXPORT_A,
 
67
                        ID_SAVEEXPORT_B,
 
68
                        ID_SAVEIMPORT_A,
 
69
                        ID_SAVEIMPORT_B,
 
70
                        ID_EXPORTALL_A,
 
71
                        ID_EXPORTALL_B,
 
72
                        ID_CONVERTTOGCI,
 
73
                        ID_NEXTPAGE_A,
 
74
                        ID_NEXTPAGE_B,
 
75
                        ID_PREVPAGE_A,
 
76
                        ID_PREVPAGE_B,
 
77
                        ID_MEMCARDLIST_A,
 
78
                        ID_MEMCARDLIST_B,
 
79
                        ID_MEMCARDPATH_A,
 
80
                        ID_MEMCARDPATH_B,
 
81
                        ID_USEPAGES,
 
82
                        ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
 
83
                };
 
84
 
 
85
                enum
 
86
                {
 
87
                        COLUMN_BANNER = 0,
 
88
                        COLUMN_TITLE,
 
89
                        COLUMN_COMMENT,
 
90
                        COLUMN_ICON,
 
91
                        COLUMN_BLOCKS,
 
92
                        COLUMN_FIRSTBLOCK,
 
93
                        COLUMN_GAMECODE,
 
94
                        COLUMN_MAKERCODE,
 
95
                        COLUMN_FILENAME,
 
96
                        COLUMN_BIFLAGS,
 
97
                        COLUMN_MODTIME,
 
98
                        COLUMN_IMAGEADD,
 
99
                        COLUMN_ICONFMT,
 
100
                        COLUMN_ANIMSPEED,
 
101
                        COLUMN_PERMISSIONS,
 
102
                        COLUMN_COPYCOUNTER,
 
103
                        COLUMN_COMMENTSADDRESS,
 
104
                        NUMBER_OF_COLUMN
 
105
                };
 
106
                
 
107
                GCMemcard *memoryCard[2];
 
108
 
 
109
                void CreateGUIControls();
 
110
                void CopyDeleteClick(wxCommandEvent& event);
 
111
                bool ReloadMemcard(const char *fileName, int card);
 
112
                void OnMenuChange(wxCommandEvent& event);
 
113
                void OnPageChange(wxCommandEvent& event);
 
114
                void OnPathChange(wxFileDirPickerEvent& event);
 
115
                void ChangePath(int id);
 
116
                bool CopyDeleteSwitch(u32 error, int slot);
 
117
                bool LoadSettings();
 
118
                bool SaveSettings();
 
119
 
 
120
                struct _mcmSettings
 
121
                {
 
122
                        bool twoCardsLoaded;
 
123
                        bool usePages;
 
124
                        bool column[NUMBER_OF_COLUMN + 1];
 
125
                } mcmSettings;
 
126
 
 
127
                class CMemcardListCtrl : public wxListCtrl
 
128
                {
 
129
//BEGIN_EVENT_TABLE(CMemcardManager::CMemcardListCtrl, wxListCtrl)
 
130
//      EVT_RIGHT_DOWN(CMemcardManager::CMemcardListCtrl::OnRightClick)
 
131
//END_EVENT_TABLE()
 
132
                public:
 
133
                        CMemcardListCtrl(wxWindow* parent, const wxWindowID id,
 
134
                                const wxPoint& pos, const wxSize& size,
 
135
                                long style, _mcmSettings& _mcmSetngs)
 
136
                                : wxListCtrl(parent, id, pos, size, style)
 
137
                                , __mcmSettings(_mcmSetngs)
 
138
                        {
 
139
                                Bind(wxEVT_RIGHT_DOWN, &CMemcardListCtrl::OnRightClick, this);
 
140
                        }
 
141
                        ~CMemcardListCtrl()
 
142
                        {
 
143
                                Unbind(wxEVT_RIGHT_DOWN, &CMemcardListCtrl::OnRightClick, this);
 
144
                        }
 
145
                        _mcmSettings & __mcmSettings;
 
146
                        bool prevPage,
 
147
                                 nextPage;
 
148
                private:
 
149
                        void OnRightClick(wxMouseEvent& event); 
 
150
                };
 
151
                
 
152
                CMemcardListCtrl *m_MemcardList[2];
 
153
};
 
154
 
 
155
#endif