Commit 6992cc80 authored by coppro's avatar coppro

New 'show spelling errors' option in the preferences window.

parent 97ff17e5
mse version: 0.3.8 mse version: 0.3.8
installer group: translations/English installer group: translations/English
full name: English full name: English
version: 2008-08-08 version: 2008-08-08
...@@ -571,6 +571,7 @@ button: ...@@ -571,6 +571,7 @@ button:
show lines: Show &lines around fields show lines: Show &lines around fields
show editing hints: Show boxes and hints for &editing show editing hints: Show boxes and hints for &editing
zoom export: Use zoom and rotation settings when e&xporting zoom export: Use zoom and rotation settings when e&xporting
spellcheck enabled: Show &spelling errors on cards
check now: Check &Now check now: Check &Now
always: Always always: Always
if internet connection exists: If internet connection exists if internet connection exists: If internet connection exists
......
...@@ -123,21 +123,23 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(GameSettings) { ...@@ -123,21 +123,23 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(GameSettings) {
StyleSheetSettings::StyleSheetSettings() StyleSheetSettings::StyleSheetSettings()
: card_zoom (1.0, true) : card_zoom (1.0, true)
, card_angle (0, true) , card_angle (0, true)
, card_anti_alias (true, true) , card_anti_alias (true, true)
, card_borders (true, true) , card_borders (true, true)
, card_draw_editing (true, true) , card_draw_editing (true, true)
, card_normal_export(true, true) , card_normal_export (true, true)
, card_spellcheck_enabled(true, true)
{} {}
void StyleSheetSettings::useDefault(const StyleSheetSettings& ss) { void StyleSheetSettings::useDefault(const StyleSheetSettings& ss) {
if (card_zoom .isDefault()) card_zoom .assignDefault(ss.card_zoom); if (card_zoom .isDefault()) card_zoom .assignDefault(ss.card_zoom);
if (card_angle .isDefault()) card_angle .assignDefault(ss.card_angle); if (card_angle .isDefault()) card_angle .assignDefault(ss.card_angle);
if (card_anti_alias .isDefault()) card_anti_alias .assignDefault(ss.card_anti_alias); if (card_anti_alias .isDefault()) card_anti_alias .assignDefault(ss.card_anti_alias);
if (card_borders .isDefault()) card_borders .assignDefault(ss.card_borders); if (card_borders .isDefault()) card_borders .assignDefault(ss.card_borders);
if (card_draw_editing .isDefault()) card_draw_editing .assignDefault(ss.card_draw_editing); if (card_draw_editing .isDefault()) card_draw_editing .assignDefault(ss.card_draw_editing);
if (card_normal_export.isDefault()) card_normal_export.assignDefault(ss.card_normal_export); if (card_normal_export .isDefault()) card_normal_export .assignDefault(ss.card_normal_export);
if (card_spellcheck_enabled.isDefault()) card_spellcheck_enabled.assignDefault(ss.card_spellcheck_enabled);
} }
IMPLEMENT_REFLECTION_NO_SCRIPT(StyleSheetSettings) { IMPLEMENT_REFLECTION_NO_SCRIPT(StyleSheetSettings) {
...@@ -147,6 +149,7 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(StyleSheetSettings) { ...@@ -147,6 +149,7 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(StyleSheetSettings) {
REFLECT(card_borders); REFLECT(card_borders);
REFLECT(card_draw_editing); REFLECT(card_draw_editing);
REFLECT(card_normal_export); REFLECT(card_normal_export);
REFLECT(card_spellcheck_enabled);
} }
// ----------------------------------------------------------------------------- : Settings // ----------------------------------------------------------------------------- : Settings
......
...@@ -103,6 +103,7 @@ class StyleSheetSettings : public IntrusivePtrBase<StyleSheetSettings> { ...@@ -103,6 +103,7 @@ class StyleSheetSettings : public IntrusivePtrBase<StyleSheetSettings> {
Defaultable<bool> card_borders; Defaultable<bool> card_borders;
Defaultable<bool> card_draw_editing; Defaultable<bool> card_draw_editing;
Defaultable<bool> card_normal_export; Defaultable<bool> card_normal_export;
Defaultable<bool> card_spellcheck_enabled;
/// Where the settings are the default, use the value from ss /// Where the settings are the default, use the value from ss
void useDefault(const StyleSheetSettings& ss); void useDefault(const StyleSheetSettings& ss);
......
...@@ -54,7 +54,7 @@ class DisplayPreferencesPage : public PreferencesPage { ...@@ -54,7 +54,7 @@ class DisplayPreferencesPage : public PreferencesPage {
private: private:
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
wxCheckBox* high_quality, *borders, *draw_editing; wxCheckBox* high_quality, *borders, *draw_editing, *spellcheck_enabled;
#if USE_ZOOM_COMBOBOX #if USE_ZOOM_COMBOBOX
wxComboBox* zoom; wxComboBox* zoom;
int zoom_int; int zoom_int;
...@@ -195,9 +195,10 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent) ...@@ -195,9 +195,10 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
: PreferencesPage(parent) : PreferencesPage(parent)
{ {
// init controls // init controls
high_quality = new wxCheckBox(this, wxID_ANY, _BUTTON_("high quality")); high_quality = new wxCheckBox(this, wxID_ANY, _BUTTON_("high quality"));
borders = new wxCheckBox(this, wxID_ANY, _BUTTON_("show lines")); borders = new wxCheckBox(this, wxID_ANY, _BUTTON_("show lines"));
draw_editing = new wxCheckBox(this, wxID_ANY, _BUTTON_("show editing hints")); draw_editing = new wxCheckBox(this, wxID_ANY, _BUTTON_("show editing hints"));
spellcheck_enabled = new wxCheckBox(this, wxID_ANY, _BUTTON_("spellcheck enabled"));
#if USE_ZOOM_COMBOBOX #if USE_ZOOM_COMBOBOX
zoom = new wxComboBox(this, ID_ZOOM); zoom = new wxComboBox(this, ID_ZOOM);
#else #else
...@@ -206,10 +207,11 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent) ...@@ -206,10 +207,11 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
non_normal_export = new wxCheckBox(this, wxID_ANY, _BUTTON_("zoom export")); non_normal_export = new wxCheckBox(this, wxID_ANY, _BUTTON_("zoom export"));
//wxButton* columns = new wxButton(this, ID_SELECT_COLUMNS, _BUTTON_("select")); //wxButton* columns = new wxButton(this, ID_SELECT_COLUMNS, _BUTTON_("select"));
// set values // set values
high_quality-> SetValue( settings.default_stylesheet_settings.card_anti_alias()); high_quality-> SetValue( settings.default_stylesheet_settings.card_anti_alias());
borders-> SetValue( settings.default_stylesheet_settings.card_borders()); borders-> SetValue( settings.default_stylesheet_settings.card_borders());
draw_editing-> SetValue( settings.default_stylesheet_settings.card_draw_editing()); draw_editing-> SetValue( settings.default_stylesheet_settings.card_draw_editing());
non_normal_export->SetValue(!settings.default_stylesheet_settings.card_normal_export()); spellcheck_enabled->SetValue( settings.default_stylesheet_settings.card_spellcheck_enabled());
non_normal_export-> SetValue(!settings.default_stylesheet_settings.card_normal_export());
#if USE_ZOOM_COMBOBOX #if USE_ZOOM_COMBOBOX
zoom_int = static_cast<int>(settings.default_stylesheet_settings.card_zoom() * 100); zoom_int = static_cast<int>(settings.default_stylesheet_settings.card_zoom() * 100);
zoom->SetValue(String::Format(_("%d%%"),zoom_int)); zoom->SetValue(String::Format(_("%d%%"),zoom_int));
...@@ -224,9 +226,10 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent) ...@@ -224,9 +226,10 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
// init sizer // init sizer
wxSizer* s = new wxBoxSizer(wxVERTICAL); wxSizer* s = new wxBoxSizer(wxVERTICAL);
wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("card display")); wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("card display"));
s2->Add(high_quality, 0, wxEXPAND | wxALL, 4); s2->Add(high_quality, 0, wxEXPAND | wxALL, 4);
s2->Add(borders, 0, wxEXPAND | wxALL, 4); s2->Add(borders, 0, wxEXPAND | wxALL, 4);
s2->Add(draw_editing, 0, wxEXPAND | wxALL, 4); s2->Add(draw_editing, 0, wxEXPAND | wxALL, 4);
s2->Add(spellcheck_enabled, 0, wxEXPAND | wxALL, 4);
wxSizer* s3 = new wxBoxSizer(wxHORIZONTAL); wxSizer* s3 = new wxBoxSizer(wxHORIZONTAL);
s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("zoom")), 0, wxALL & ~wxLEFT, 4); s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("zoom")), 0, wxALL & ~wxLEFT, 4);
s3->AddSpacer(2); s3->AddSpacer(2);
...@@ -249,9 +252,10 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent) ...@@ -249,9 +252,10 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
} }
void DisplayPreferencesPage::store() { void DisplayPreferencesPage::store() {
settings.default_stylesheet_settings.card_anti_alias = high_quality->GetValue(); settings.default_stylesheet_settings.card_anti_alias = high_quality->GetValue();
settings.default_stylesheet_settings.card_borders = borders->GetValue(); settings.default_stylesheet_settings.card_borders = borders->GetValue();
settings.default_stylesheet_settings.card_draw_editing = draw_editing->GetValue(); settings.default_stylesheet_settings.card_draw_editing = draw_editing->GetValue();
settings.default_stylesheet_settings.card_spellcheck_enabled = spellcheck_enabled->GetValue();
#if USE_ZOOM_COMBOBOX #if USE_ZOOM_COMBOBOX
updateZoom(); updateZoom();
settings.default_stylesheet_settings.card_zoom = zoom_int / 100.0; settings.default_stylesheet_settings.card_zoom = zoom_int / 100.0;
......
...@@ -84,6 +84,7 @@ button: ...@@ -84,6 +84,7 @@ button:
select all: 0 select all: 0
select cards: 0 select cards: 0
select none: 0 select none: 0
spellcheck enabled: 0
show: 0 show: 0
show editing hints: 0 show editing hints: 0
show lines: 0 show lines: 0
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <script/functions/util.hpp> #include <script/functions/util.hpp>
#include <util/spell_checker.hpp> #include <util/spell_checker.hpp>
#include <util/tagged_string.hpp> #include <util/tagged_string.hpp>
#include <data/stylesheet.hpp>
// ----------------------------------------------------------------------------- : Functions // ----------------------------------------------------------------------------- : Functions
...@@ -89,9 +90,12 @@ void check_word(const String& tag, const String& input, String& out, Char sep, s ...@@ -89,9 +90,12 @@ void check_word(const String& tag, const String& input, String& out, Char sep, s
} }
SCRIPT_FUNCTION(check_spelling) { SCRIPT_FUNCTION(check_spelling) {
SCRIPT_PARAM_C(StyleSheetP,stylesheet);
SCRIPT_PARAM_C(String,language); SCRIPT_PARAM_C(String,language);
SCRIPT_PARAM_C(String,input); SCRIPT_PARAM_C(String,input);
assert_tagged(input); assert_tagged(input);
if (!settings.stylesheetSettingsFor(*stylesheet).card_spellcheck_enabled)
SCRIPT_RETURN(input);
SCRIPT_OPTIONAL_PARAM_N_(String,_("extra dictionary"),extra_dictionary); SCRIPT_OPTIONAL_PARAM_N_(String,_("extra dictionary"),extra_dictionary);
SCRIPT_OPTIONAL_PARAM_N_(ScriptValueP,_("extra match"),extra_match); SCRIPT_OPTIONAL_PARAM_N_(ScriptValueP,_("extra match"),extra_match);
// remove old spelling error tags // remove old spelling error tags
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment