diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-02-26 21:59:41 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-02-26 21:59:41 +0100 |
| commit | 711fce41c7a9a0843bb59d23ead830ad89b8a903 (patch) | |
| tree | fd68ead920f862bf83a902ac4a94baf3ed48ae93 /src/game_tab/editor | |
| parent | 6c34ef20fb217d240c790b24ea330592679ac010 (diff) | |
Now engine list in game tab is updated properly
Diffstat (limited to 'src/game_tab/editor')
| -rw-r--r-- | src/game_tab/editor/EditorPanel.cpp | 26 | ||||
| -rw-r--r-- | src/game_tab/editor/EditorPanel.hpp | 1 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/game_tab/editor/EditorPanel.cpp b/src/game_tab/editor/EditorPanel.cpp index 3e6a7db..892673f 100644 --- a/src/game_tab/editor/EditorPanel.cpp +++ b/src/game_tab/editor/EditorPanel.cpp @@ -15,17 +15,7 @@ EditorPanel::EditorPanel(wxFrame *parent, Game *game) tags_list->InsertColumn(1, L"Value", wxLIST_FORMAT_LEFT, 500); tagTextCtrl->SetHint("Tag"); valueTextCtrl->SetHint("Value"); - CONFIG_OPEN(conf); - conf->SetPath("engines/"); - wxString engine_name; - long index; - if (conf->GetFirstGroup(engine_name, index)) { - do { - engine_list->Append(engine_name); - } while (conf->GetNextGroup(engine_name, index)); - } - CONFIG_CLOSE(conf); RefreshTagsList(); // Bind events @@ -44,6 +34,7 @@ EditorPanel::EditorPanel(wxFrame *parent, Game *game) wxID_ANY); this->Bind(wxEVT_BUTTON, &EditorPanel::OnApply, this, UPDATE_BTN); this->Bind(wxEVT_BUTTON, &EditorPanel::OnDelete, this, DELETE_BTN); + ApplyPreferences(); } void EditorPanel::OnTagSelected(wxListEvent &event) { @@ -146,6 +137,21 @@ void EditorPanel::Notify() { editor_canvas->SetMoves(game->GetMoves(), m); } +void EditorPanel::ApplyPreferences() { + engine_list->Clear(); + CONFIG_OPEN(conf); + conf->SetPath("engines/"); + wxString engine_name; + long index; + if (conf->GetFirstGroup(engine_name, index)) { + do { + engine_list->Append(engine_name); + } while (conf->GetNextGroup(engine_name, index)); + } + + CONFIG_CLOSE(conf); +} + void EditorPanel::RefreshTagsList() { tags_list->DeleteAllItems(); for (std::string s : game->ListTags()) { diff --git a/src/game_tab/editor/EditorPanel.hpp b/src/game_tab/editor/EditorPanel.hpp index 36d57f1..8502c14 100644 --- a/src/game_tab/editor/EditorPanel.hpp +++ b/src/game_tab/editor/EditorPanel.hpp @@ -36,4 +36,5 @@ public: void OnDelete(wxCommandEvent &event); void OnPreviousMove(wxCommandEvent &event); void OnNextMove(wxCommandEvent &event); + void ApplyPreferences(); };
\ No newline at end of file |
