From a75e8f3bed20bd39dd9c2d196856b35b189a45a2 Mon Sep 17 00:00:00 2001 From: William JCM Date: Sun, 12 Jan 2020 18:46:37 +0100 Subject: [PATCH] MainFrame: add UI for the staging area. --- GUI/MainFrame.cpp | 48 ++++-- GUI/MainFrame.fbp | 404 +++++++++++++++++++++++++++++++++++----------- GUI/MainFrame.h | 12 +- 3 files changed, 354 insertions(+), 110 deletions(-) diff --git a/GUI/MainFrame.cpp b/GUI/MainFrame.cpp index b9fa595..41e4dc5 100644 --- a/GUI/MainFrame.cpp +++ b/GUI/MainFrame.cpp @@ -31,9 +31,6 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co wxStaticBoxSizer* sbSizerButtons; sbSizerButtons = new wxStaticBoxSizer( new wxStaticBox( sbSizerInstalled->GetStaticBox(), wxID_ANY, wxT("Hangar actions") ), wxHORIZONTAL ); - _importButton = new wxButton( sbSizerButtons->GetStaticBox(), wxID_ANY, wxT("Import"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerButtons->Add( _importButton, 1, wxALL|wxEXPAND, 5 ); - _moveButton = new wxButton( sbSizerButtons->GetStaticBox(), wxID_ANY, wxT("Move"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerButtons->Add( _moveButton, 1, wxALL|wxEXPAND, 5 ); @@ -46,9 +43,6 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co wxBoxSizer* bSizerSecondRow; bSizerSecondRow = new wxBoxSizer( wxHORIZONTAL ); - - bSizerSecondRow->Add( 0, 0, 1, wxEXPAND, 5 ); - _zipButton = new wxButton( sbSizerInstalled->GetStaticBox(), wxID_ANY, wxT("Backup save files"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerSecondRow->Add( _zipButton, 2, wxALL|wxEXPAND, 5 ); @@ -56,14 +50,40 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co bSizerSecondRow->Add( _openSaveDirButton, 2, wxEXPAND|wxALL, 5 ); - bSizerSecondRow->Add( 0, 0, 1, wxEXPAND, 5 ); - - - sbSizerInstalled->Add( bSizerSecondRow, 0, wxEXPAND, 5 ); + sbSizerInstalled->Add( bSizerSecondRow, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); bSizerMainUi->Add( sbSizerInstalled, 1, wxEXPAND|wxALL, 5 ); + wxBoxSizer* bSizerImportExport; + bSizerImportExport = new wxBoxSizer( wxVERTICAL ); + + _importButton = new wxButton( this, wxID_ANY, wxT("Import"), wxDefaultPosition, wxDefaultSize, 0 ); + + _importButton->SetBitmap( wxArtProvider::GetBitmap( wxART_GO_BACK, wxART_BUTTON ) ); + bSizerImportExport->Add( _importButton, 1, wxALL|wxEXPAND, 5 ); + + _exportButton = new wxButton( this, wxID_ANY, wxT("Export"), wxDefaultPosition, wxDefaultSize, 0 ); + + _exportButton->SetBitmap( wxArtProvider::GetBitmap( wxART_GO_FORWARD, wxART_BUTTON ) ); + _exportButton->SetBitmapPosition( wxRIGHT ); + bSizerImportExport->Add( _exportButton, 0, wxALL|wxEXPAND, 5 ); + + + bSizerMainUi->Add( bSizerImportExport, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxStaticBoxSizer* sbSizerStagingArea; + sbSizerStagingArea = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Staging area") ), wxVERTICAL ); + + _stagingList = new wxListBox( sbSizerStagingArea->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB|wxLB_SINGLE ); + sbSizerStagingArea->Add( _stagingList, 1, wxALL|wxEXPAND, 5 ); + + _stagingAreaButton = new wxButton( sbSizerStagingArea->GetStaticBox(), wxID_ANY, wxT("Open staging area directory"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerStagingArea->Add( _stagingAreaButton, 0, wxALL|wxEXPAND, 5 ); + + + bSizerMainUi->Add( sbSizerStagingArea, 1, wxEXPAND|wxALL, 5 ); + bSizerMain->Add( bSizerMainUi, 1, wxEXPAND, 5 ); @@ -104,22 +124,26 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co this->Centre( wxBOTH ); // Connect Events - _importButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::importEvent ), NULL, this ); _moveButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::moveEvent ), NULL, this ); _deleteButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::deleteEvent ), NULL, this ); _zipButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::backupEvent ), NULL, this ); _openSaveDirButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::openSaveDirEvent ), NULL, this ); + _importButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::importEvent ), NULL, this ); + _exportButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::exportEvent ), NULL, this ); + _stagingAreaButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::stagingButtonEvent ), NULL, this ); this->Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( MainFrame::gameCheckTimerEvent ) ); } MainFrame::~MainFrame() { // Disconnect Events - _importButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::importEvent ), NULL, this ); _moveButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::moveEvent ), NULL, this ); _deleteButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::deleteEvent ), NULL, this ); _zipButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::backupEvent ), NULL, this ); _openSaveDirButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::openSaveDirEvent ), NULL, this ); + _importButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::importEvent ), NULL, this ); + _exportButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::exportEvent ), NULL, this ); + _stagingAreaButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrame::stagingButtonEvent ), NULL, this ); this->Disconnect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( MainFrame::gameCheckTimerEvent ) ); } diff --git a/GUI/MainFrame.fbp b/GUI/MainFrame.fbp index 58d86ec..ca42d6c 100644 --- a/GUI/MainFrame.fbp +++ b/GUI/MainFrame.fbp @@ -48,7 +48,7 @@ -1,-1 wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxSYSTEM_MENU ; ; forward_declare - M.A.S.S. Manager 0.2.0 + M.A.S.S. Manager 1.0.0-pre @@ -154,79 +154,6 @@ wxHORIZONTAL 1 none - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Import - - 0 - - 0 - - - 0 - - 1 - _importButton - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - importEvent - - 5 wxALL|wxEXPAND @@ -377,23 +304,13 @@ 5 - wxEXPAND + wxEXPAND|wxRIGHT|wxLEFT 0 bSizerSecondRow wxHORIZONTAL none - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - 5 wxALL|wxEXPAND @@ -540,16 +457,313 @@ openSaveDirEvent - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + + bSizerImportExport + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + Load From Art Provider; wxART_GO_BACK; wxART_BUTTON + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Import + + 0 + + 0 + + + 0 + + 1 + _importButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + importEvent + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + Load From Art Provider; wxART_GO_FORWARD; wxART_BUTTON + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Export + + 0 + + 0 + + + 0 + + 1 + _exportButton + 1 + + + protected + 1 + + wxRIGHT + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + exportEvent + + + + + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Staging area + + sbSizerStagingArea + wxVERTICAL + 1 + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + _stagingList + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_NEEDED_SB|wxLB_SINGLE + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Open staging area directory + + 0 + + 0 + + + 0 + + 1 + _stagingAreaButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + stagingButtonEvent diff --git a/GUI/MainFrame.h b/GUI/MainFrame.h index 47933cf..5fabfef 100644 --- a/GUI/MainFrame.h +++ b/GUI/MainFrame.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -37,11 +38,14 @@ class MainFrame : public wxFrame protected: wxListView* _installedListView; - wxButton* _importButton; wxButton* _moveButton; wxButton* _deleteButton; wxButton* _zipButton; wxButton* _openSaveDirButton; + wxButton* _importButton; + wxButton* _exportButton; + wxListBox* _stagingList; + wxButton* _stagingAreaButton; wxStaticText* _riskLabel; wxStaticText* _gameStatusLabel; wxStaticText* _gameStatus; @@ -49,17 +53,19 @@ class MainFrame : public wxFrame wxTimer _gameCheckTimer; // Virtual event handlers, overide them in your derived class - virtual void importEvent( wxCommandEvent& event ) { event.Skip(); } virtual void moveEvent( wxCommandEvent& event ) { event.Skip(); } virtual void deleteEvent( wxCommandEvent& event ) { event.Skip(); } virtual void backupEvent( wxCommandEvent& event ) { event.Skip(); } virtual void openSaveDirEvent( wxCommandEvent& event ) { event.Skip(); } + virtual void importEvent( wxCommandEvent& event ) { event.Skip(); } + virtual void exportEvent( wxCommandEvent& event ) { event.Skip(); } + virtual void stagingButtonEvent( wxCommandEvent& event ) { event.Skip(); } virtual void gameCheckTimerEvent( wxTimerEvent& event ) { event.Skip(); } public: - MainFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("M.A.S.S. Manager 0.2.0"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxSYSTEM_MENU|wxCLIP_CHILDREN|wxTAB_TRAVERSAL ); + MainFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("M.A.S.S. Manager 1.0.0-pre"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxSYSTEM_MENU|wxCLIP_CHILDREN|wxTAB_TRAVERSAL ); ~MainFrame();