diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 5aff5dab..e3819314 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -1007,6 +1007,7 @@ LoadOrderPreview::LoadOrderPreview(wxWindow *parent, const wxString title, const //Set up event handling. Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoadOrderPreview::OnMoveUp, this, BUTTON_MoveUp); Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoadOrderPreview::OnMoveDown, this, BUTTON_MoveDown); + Bind(wxEVT_COMMAND_LIST_ITEM_SELECTED, &LoadOrderPreview::OnPluginSelect, this, LIST_LoadOrder); //Set up layout. wxBoxSizer * bigBox = new wxBoxSizer(wxVERTICAL); @@ -1027,12 +1028,21 @@ LoadOrderPreview::LoadOrderPreview(wxWindow *parent, const wxString title, const if (sizer != NULL) bigBox->Add(sizer, 0, wxEXPAND|wxLEFT|wxBOTTOM|wxRIGHT, 15); + //Set initial up/down button states. + _moveUp->Enable(false); + _moveDown->Enable(false); + //Now set the layout and sizes. SetBackgroundColour(wxColour(255,255,255)); SetIcon(wxIconLocation("BOSS.exe")); SetSizerAndFit(bigBox); } +void LoadOrderPreview::OnPluginSelect(wxListEvent& event) { + _moveUp->Enable(true); + _moveDown->Enable(true); +} + void LoadOrderPreview::OnMoveUp(wxCommandEvent& event) { BOOST_LOG_TRIVIAL(debug) << "Moving plugin(s) up the load order."; long selected = _loadOrder->GetFirstSelected(); diff --git a/src/gui/main.h b/src/gui/main.h index 0bc3dabd..9a44bd44 100644 --- a/src/gui/main.h +++ b/src/gui/main.h @@ -37,7 +37,7 @@ public: bool OnInit(); //Load settings, apply logging and language settings, check if BOSS is already running, detect games, set game to last game or to first detected game if auto, create launcher window. private: wxLocale * wxLoc; - + YAML::Node _settings; std::vector _games; boss::Game _game; @@ -46,11 +46,11 @@ private: class Launcher : public wxFrame { public: Launcher(const wxChar *title, YAML::Node& settings, boss::Game& inGame, std::vector& games); - + void OnSortPlugins(wxCommandEvent& event); void OnEditMetadata(wxCommandEvent& event); void OnViewLastReport(wxCommandEvent& event); - + void OnOpenSettings(wxCommandEvent& event); void OnGameChange(wxCommandEvent& event); void OnHelp(wxCommandEvent& event); @@ -61,7 +61,7 @@ public: private: wxMenu * GameMenu; wxButton * ViewButton; - + boss::Game& _game; YAML::Node& _settings; //BOSS Settings. std::vector& _games; @@ -71,6 +71,7 @@ class LoadOrderPreview : public wxDialog { public: LoadOrderPreview(wxWindow *parent, const wxString title, const std::list& plugins); + void OnPluginSelect(wxListEvent& event); void OnMoveUp(wxCommandEvent& event); void OnMoveDown(wxCommandEvent& event);