Binding of CGEditor's settings

This commit is contained in:
Loic Guegan 2023-01-09 15:22:31 +01:00
parent 518edf6f30
commit 30b7577ab3
3 changed files with 17 additions and 5 deletions

View file

@ -2,7 +2,7 @@
## Before releasing v0.1.0
- [x] In BoardCanvas search for a workaround of the dynamic allocation of adata.buffer (on canvas resize)
- [ ] Bind the chess game editor settings to EditorPrefs.hpp
- [x] Bind the chess game editor settings to EditorPrefs.hpp
- [x] Ask before closing MainWindow/Tabs if anything is not saved
- [x] Disable the save button in GameTab after saving (and re-enable it on new changes)
- [ ] Make PGNGameBase use GotoNextGame() instead of ParseNextGame() in the NextGame() method to improve performance

View file

@ -8,10 +8,10 @@ EditorCanvas::EditorCanvas(wxFrame *parent, std::shared_ptr<Game> game)
// Theme:
default_font=wxFont(*wxNORMAL_FONT).MakeBold();
color_scrollbar_bg=wxColour(243,243,243);
color_scrollbar=*wxLIGHT_GREY;
color_margin=wxColour(243,243,243);
color_comments_bg=wxColour(255, 255, 204);
color_scrollbar_bg=wxColour("#FFFFFF");
color_scrollbar=wxColour("#838383");
color_margin=wxColour("#F3F3F3");
color_comments_bg=wxColour("#ffffcc");
color_current_move_bg=wxColour(216, 216, 216);
color_menu_item_bg=wxColour(216, 216, 216);
// The following should be called when using an EVT_PAINT handler
@ -233,6 +233,10 @@ void EditorCanvas::ApplyPreferences(){
CGEditor::status.MoveHeight=conf->Read("row_size", 50);
CGEditor::status.MoveWidth=conf->Read("col_size", 100);
CGEditor::status.UseMoveIcons=conf->Read("show_move_icons", true);
color_margin=wxColour(conf->Read("color_margin", "#F3F3F3"));
color_scrollbar=wxColour(conf->Read("color_scrollbar", "#838383"));
color_scrollbar_bg=wxColour(conf->Read("color_scrollbarbg", "#FFFFFF"));
color_comments_bg=wxColour(conf->Read("color_commentbg", "#ffffcc"));
CONFIG_CLOSE(conf);
Refresh();
}

View file

@ -21,6 +21,10 @@ public:
row_size->SetValue(config->Read("editor/row_size", 50));
col_size->SetValue(config->Read("editor/col_size", 100));
show_move_icons->SetValue(config->Read("editor/show_move_icons", true));
color_margin->SetColour(wxColour(config->Read("editor/color_margin", "#F3F3F3")));
color_scrollbar->SetColour(wxColour(config->Read("editor/color_scrollbar", "#838383")));
color_scrollbarbg->SetColour(wxColour(config->Read("editor/color_scrollbarbg", "#FFFFFF")));
color_commentbg->SetColour(wxColour(config->Read("editor/color_commentbg", "#ffffcc")));
CONFIG_CLOSE(config);
return true;
}
@ -30,6 +34,10 @@ public:
config->Write("editor/row_size", row_size->GetValue());
config->Write("editor/col_size", col_size->GetValue());
config->Write("editor/show_move_icons", show_move_icons->GetValue());
config->Write("editor/color_margin", color_margin->GetColour().GetAsString());
config->Write("editor/color_scrollbar", color_scrollbar->GetColour().GetAsString());
config->Write("editor/color_scrollbarbg", color_scrollbarbg->GetColour().GetAsString());
config->Write("editor/color_commentbg", color_commentbg->GetColour().GetAsString());
CONFIG_CLOSE(config);
}