diff --git a/data/en.mse-locale/locale b/data/en.mse-locale/locale index adb0c127..d3d8b077 100644 --- a/data/en.mse-locale/locale +++ b/data/en.mse-locale/locale @@ -485,14 +485,20 @@ label: # Preferences language : Language windows : Open sets - app language : Language of the user interface : - card display : Card Display - zoom : &Zoom : - export : &Export : + app language : Language of the user interface : + card display : Card Display + storage : Storage + zoom : &Zoom: + export : &Export: + scale : &Internal Scale: percent of normal: % of normal size external programs: External programs apprentice: &Apprentice: - apprentice exe: Apprentice Executable + apprentice exe: Apprentice Executable + internal scale desc: + Scale to internally store card images at. + Changing this may impact how Sharpening looks. + Does not retroactively apply to existing images. check at startup: Check for new versions at startup checking requires internet: Checking for updates requires an internet connection. @@ -675,7 +681,8 @@ title: preferences: Preferences global: Global display: Display - directories: Directories + directories: Directories + internal: Internal updates: Updates update check: Update Check locate apprentice: Locate Apprentice diff --git a/src/data/settings.cpp b/src/data/settings.cpp index 4089c0df..6e77441b 100644 --- a/src/data/settings.cpp +++ b/src/data/settings.cpp @@ -171,7 +171,8 @@ Settings::Settings() , symbol_grid_size (30) , symbol_grid (true) , symbol_grid_snap (false) - , print_layout (LAYOUT_NO_SPACE) + , print_layout (LAYOUT_NO_SPACE) + , internal_scale (1.0) #if USE_OLD_STYLE_UPDATE_CHECKER , updates_url (_("http://magicseteditor.sourceforge.net/updates")) #endif @@ -257,7 +258,8 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(Settings) { REFLECT(symbol_grid_snap); REFLECT(default_game); REFLECT(print_layout); - REFLECT(apprentice_location); + REFLECT(apprentice_location); + REFLECT(internal_scale); #if USE_OLD_STYLE_UPDATE_CHECKER REFLECT(updates_url); #else diff --git a/src/data/settings.hpp b/src/data/settings.hpp index fcb3d340..2ced6e4b 100644 --- a/src/data/settings.hpp +++ b/src/data/settings.hpp @@ -192,7 +192,10 @@ public: // --------------------------------------------------- : Special game stuff String apprentice_location; - + + // --------------------------------------------------- : Internal settings + double internal_scale; + // --------------------------------------------------- : Update checking #if USE_OLD_STYLE_UPDATE_CHECKER String updates_url; diff --git a/src/gui/preferences_window.cpp b/src/gui/preferences_window.cpp index 0e2c2b67..3ede27bb 100644 --- a/src/gui/preferences_window.cpp +++ b/src/gui/preferences_window.cpp @@ -65,6 +65,21 @@ private: void updateZoom(); void onExportZoomChange(wxCommandEvent&); void updateExportZoom(); +}; + +class InternalPreferencesPage : public PreferencesPage { +public: + InternalPreferencesPage(Window* parent); + void store() override; + +private: + DECLARE_EVENT_TABLE(); + + wxComboBox* internal_scale; + int internal_scale_int; + + void onInternalScaleChange(wxCommandEvent&); + void updateInternalScale(); }; // Preferences page for directories of programs @@ -107,7 +122,8 @@ PreferencesWindow::PreferencesWindow(Window* parent) // init notebook wxNotebook* nb = new wxNotebook(this, ID_NOTEBOOK); nb->AddPage(new GlobalPreferencesPage (nb), _TITLE_("global")); - nb->AddPage(new DisplayPreferencesPage(nb), _TITLE_("display")); + nb->AddPage(new DisplayPreferencesPage(nb), _TITLE_("display")); + nb->AddPage(new InternalPreferencesPage(nb), _TITLE_("internal")); nb->AddPage(new DirsPreferencesPage (nb), _TITLE_("directories")); nb->AddPage(new UpdatePreferencesPage (nb), _TITLE_("updates")); @@ -184,7 +200,7 @@ void GlobalPreferencesPage::store() { // set the_locale? // open_sets_in_new_window settings.open_sets_in_new_window = open_sets_in_new_window->GetValue(); -} +} // ----------------------------------------------------------------------------- : Preferences page : display @@ -293,7 +309,55 @@ BEGIN_EVENT_TABLE(DisplayPreferencesPage, wxPanel) EVT_COMBOBOX(ID_EXPORT_ZOOM, DisplayPreferencesPage::onExportZoomChange) EVT_TEXT_ENTER(ID_EXPORT_ZOOM, DisplayPreferencesPage::onExportZoomChange) END_EVENT_TABLE () + +// ----------------------------------------------------------------------------- : Preferences page : internal + +InternalPreferencesPage::InternalPreferencesPage(Window* parent) : PreferencesPage(parent) { + internal_scale = new wxComboBox(this, ID_INTERNAL_SCALE); + + internal_scale_int = static_cast(settings.internal_scale * 100); + internal_scale->SetValue(String::Format(_("%d%%"), internal_scale_int)); + + int choices[] = { 100,200 }; + for (unsigned int i = 0; i < sizeof(choices) / sizeof(choices[0]); ++i) { + internal_scale->Append(String::Format(_("%d%%"), choices[i])); + } + + wxSizer* s = new wxBoxSizer(wxVERTICAL); + wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("storage")); + wxSizer* s3 = new wxBoxSizer(wxHORIZONTAL); + s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("scale")), 0, wxALL & ~wxLEFT, 4); + s3->AddSpacer(2); + s3->Add(internal_scale); + s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("percent of normal")), 1, wxALL & ~wxRIGHT, 4); + s2->Add(s3); + s2->Add(new wxStaticText(this, wxID_ANY, _LABEL_("internal scale desc")), 0, wxALL & ~wxLEFT, 4); + s->Add(s2, 0, wxEXPAND | wxALL, 8); + s->SetSizeHints(this); + SetSizer(s); +} + +void InternalPreferencesPage::store() { + updateInternalScale(); + settings.internal_scale = internal_scale_int / 100.0; +} + +void InternalPreferencesPage::onInternalScaleChange(wxCommandEvent&) { + updateInternalScale(); +} +void InternalPreferencesPage::updateInternalScale() { + String s = internal_scale->GetValue(); + int i = internal_scale_int; + if (wxSscanf(s.c_str(), _("%u"), &i)) { + internal_scale_int = min(max(i, 1), 1000); + } + internal_scale->SetValue(String::Format(_("%d%%"), (int)internal_scale_int)); +} + +BEGIN_EVENT_TABLE(InternalPreferencesPage, wxPanel) +EVT_COMBOBOX(ID_INTERNAL_SCALE, InternalPreferencesPage::onInternalScaleChange) +END_EVENT_TABLE() // ----------------------------------------------------------------------------- : Preferences page : directories diff --git a/src/gui/value/image.cpp b/src/gui/value/image.cpp index f13e6a37..94cb9f88 100644 --- a/src/gui/value/image.cpp +++ b/src/gui/value/image.cpp @@ -41,7 +41,7 @@ void ImageValueEditor::sliceImage(const Image& image) { AlphaMask mask; style().mask.getNoCache(options,mask); // slice - RealSize desiredSliceSize = RealSize(style().getSize().width * 2, style().getSize().height * 2); + RealSize desiredSliceSize = RealSize(style().getSize().width * settings.internal_scale, style().getSize().height * settings.internal_scale); ImageSliceWindow s(wxGetTopLevelParent(&editor()), image, desiredSliceSize, mask); // clicked ok? if (s.ShowModal() == wxID_OK) { diff --git a/src/util/window_id.hpp b/src/util/window_id.hpp index 2ec455f4..568046be 100644 --- a/src/util/window_id.hpp +++ b/src/util/window_id.hpp @@ -281,7 +281,9 @@ enum ControlID { ID_EXPORT_ZOOM_X, ID_EXPORT_ZOOM_Y, ID_SHARPEN, - ID_SHARPEN_AMOUNT, + ID_SHARPEN_AMOUNT, + // Internal window + ID_INTERNAL_SCALE, // Updates window ID_PACKAGE_LIST, ID_KEEP,