mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
feat: add internal storage scale option to preferences window
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<int>(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
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user