From 77ab586881da595e2971a19800c1c5a8d09ebb93 Mon Sep 17 00:00:00 2001 From: twanvl Date: Fri, 21 Sep 2007 12:35:24 +0000 Subject: [PATCH] Option to show/hide editing hints (i.e. word list boxes) git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@727 0fc631ac-6414-0410-93d0-97cfa31319b6 --- data/en.mse-locale/locale | 1 + src/data/settings.cpp | 3 +++ src/data/settings.hpp | 1 + src/gui/control/card_editor.cpp | 3 ++- src/gui/preferences_window.cpp | 6 +++++- src/gui/value/text.cpp | 12 ++++++++---- src/resource/common/expected_locale_keys | 3 ++- 7 files changed, 22 insertions(+), 7 deletions(-) diff --git a/data/en.mse-locale/locale b/data/en.mse-locale/locale index ad3be729..82ac409a 100644 --- a/data/en.mse-locale/locale +++ b/data/en.mse-locale/locale @@ -482,6 +482,7 @@ button: browse: &Browse... high quality: &High quality rendering show lines: Show &lines around fields + show editing hints: Show boxes and hints for &editing zoom export: Use zoom and rotation settings when e&xporting check now: Check &Now always: Always diff --git a/src/data/settings.cpp b/src/data/settings.cpp index b2ff0213..1f1921f4 100644 --- a/src/data/settings.cpp +++ b/src/data/settings.cpp @@ -108,6 +108,7 @@ StyleSheetSettings::StyleSheetSettings() , card_angle (0, true) , card_anti_alias (true, true) , card_borders (true, true) + , card_draw_editing (true, true) , card_normal_export(true, true) {} @@ -116,6 +117,7 @@ void StyleSheetSettings::useDefault(const StyleSheetSettings& ss) { 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_borders .isDefault()) card_borders .assignDefault(ss.card_borders); + 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); } @@ -124,6 +126,7 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(StyleSheetSettings) { REFLECT(card_angle); REFLECT(card_anti_alias); REFLECT(card_borders); + REFLECT(card_draw_editing); REFLECT(card_normal_export); } diff --git a/src/data/settings.hpp b/src/data/settings.hpp index 660957da..7dc074a3 100644 --- a/src/data/settings.hpp +++ b/src/data/settings.hpp @@ -94,6 +94,7 @@ class StyleSheetSettings : public IntrusivePtrBase { Defaultable card_angle; Defaultable card_anti_alias; Defaultable card_borders; + Defaultable card_draw_editing; Defaultable card_normal_export; /// Where the settings are the default, use the value from ss diff --git a/src/gui/control/card_editor.cpp b/src/gui/control/card_editor.cpp index 04aec457..b4d61542 100644 --- a/src/gui/control/card_editor.cpp +++ b/src/gui/control/card_editor.cpp @@ -42,7 +42,8 @@ bool DataEditor::drawBorders() const { settings.stylesheetSettingsFor(set->stylesheetFor(card)).card_borders(); } bool DataEditor::drawEditing() const { - return true; + return nativeLook() || + settings.stylesheetSettingsFor(set->stylesheetFor(card)).card_draw_editing(); } bool DataEditor::drawFocus() const { return FindFocus() == this; diff --git a/src/gui/preferences_window.cpp b/src/gui/preferences_window.cpp index 9f8ce531..7778b228 100644 --- a/src/gui/preferences_window.cpp +++ b/src/gui/preferences_window.cpp @@ -49,7 +49,7 @@ class DisplayPreferencesPage : public PreferencesPage { private: DECLARE_EVENT_TABLE(); - wxCheckBox* high_quality, *borders; + wxCheckBox* high_quality, *borders, *draw_editing; wxSpinCtrl* zoom; wxCheckBox* non_normal_export; @@ -170,12 +170,14 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent) // init controls high_quality = new wxCheckBox(this, wxID_ANY, _BUTTON_("high quality")); borders = new wxCheckBox(this, wxID_ANY, _BUTTON_("show lines")); + draw_editing = new wxCheckBox(this, wxID_ANY, _BUTTON_("show editing hints")); zoom = new wxSpinCtrl(this, wxID_ANY); non_normal_export = new wxCheckBox(this, wxID_ANY, _BUTTON_("zoom export")); //wxButton* columns = new wxButton(this, ID_SELECT_COLUMNS, _BUTTON_("select")); // set values high_quality-> SetValue( settings.default_stylesheet_settings.card_anti_alias()); borders-> SetValue( settings.default_stylesheet_settings.card_borders()); + draw_editing-> SetValue( settings.default_stylesheet_settings.card_draw_editing()); non_normal_export->SetValue(!settings.default_stylesheet_settings.card_normal_export()); zoom->SetRange(1, 1000); zoom-> SetValue(static_cast(settings.default_stylesheet_settings.card_zoom() * 100)); @@ -184,6 +186,7 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent) wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("card display")); s2->Add(high_quality, 0, wxEXPAND | wxALL, 4); s2->Add(borders, 0, wxEXPAND | wxALL, 4); + s2->Add(draw_editing, 0, wxEXPAND | wxALL, 4); wxSizer* s3 = new wxBoxSizer(wxHORIZONTAL); s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("zoom")), 0, wxALL & ~wxLEFT, 4); s3->Add(zoom); @@ -207,6 +210,7 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent) void DisplayPreferencesPage::store() { settings.default_stylesheet_settings.card_anti_alias = high_quality->GetValue(); settings.default_stylesheet_settings.card_borders = borders->GetValue(); + settings.default_stylesheet_settings.card_draw_editing = draw_editing->GetValue(); settings.default_stylesheet_settings.card_zoom = zoom->GetValue() / 100.0; settings.default_stylesheet_settings.card_normal_export = !non_normal_export->GetValue(); } diff --git a/src/gui/value/text.cpp b/src/gui/value/text.cpp index 4db132b5..fb072e3a 100644 --- a/src/gui/value/text.cpp +++ b/src/gui/value/text.cpp @@ -1329,9 +1329,11 @@ void TextValueEditor::drawWordListIndicators(RotatedDC& dc, bool redrawing) { if (!redrawing) { wl->behind = dc.GetBackground(RealRect(r.right(), r.top() - 1, 10, r.height + 3)); } - // draw rectangle around value - dc.SetBrush(*wxTRANSPARENT_BRUSH); - dc.DrawRectangle(r.move(-1,-1,2,2)); + if (current || viewer.drawEditing()) { + // draw rectangle around value + dc.SetBrush(*wxTRANSPARENT_BRUSH); + dc.DrawRectangle(r.move(-1,-1,2,2)); + } } // Draw drop down arrows FOR_EACH_REVERSE(wl, word_lists) { @@ -1350,7 +1352,9 @@ void TextValueEditor::drawWordListIndicators(RotatedDC& dc, bool redrawing) { small = (wl.get() != hovered_words); } if (small) { - dc.DrawRectangle(RealRect(r.right(), r.top() - 1, 2, r.height + 2)); + if (viewer.drawEditing()) { + dc.DrawRectangle(RealRect(r.right(), r.top() - 1, 2, r.height + 2)); + } } else { // draw background of drop down button dc.DrawRectangle(RealRect(r.right(), r.top() - 1, 9, r.height + 2)); diff --git a/src/resource/common/expected_locale_keys b/src/resource/common/expected_locale_keys index 22071081..84e794ec 100644 --- a/src/resource/common/expected_locale_keys +++ b/src/resource/common/expected_locale_keys @@ -1,6 +1,6 @@ # This file contains the keys expected to be in MSE locales # It was automatically generated by tools/locale/locale.pl -# Generated on Thu Sep 20 23:50:25 2007 +# Generated on Fri Sep 21 14:19:24 2007 action: add control point: 0 @@ -67,6 +67,7 @@ button: select all: 0 select none: 0 show: 0 + show editing hints: 0 show lines: 0 symbol gallery: optional, 0 use auto replace: 0