mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Merge pull request #6 from haganbmj/stored_image_resolution
misc: change storage size of image slices
This commit is contained in:
@@ -65,6 +65,23 @@ private:
|
||||
void updateZoom();
|
||||
void onExportZoomChange(wxCommandEvent&);
|
||||
void updateExportZoom();
|
||||
};
|
||||
|
||||
class InternalPreferencesPage : public PreferencesPage {
|
||||
public:
|
||||
InternalPreferencesPage(Window* parent);
|
||||
void store() override;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
wxCheckBox* internal_image_extension;
|
||||
|
||||
wxComboBox* internal_scale;
|
||||
int internal_scale_int;
|
||||
|
||||
void onInternalScaleChange(wxCommandEvent&);
|
||||
void updateInternalScale();
|
||||
};
|
||||
|
||||
// Preferences page for directories of programs
|
||||
@@ -107,7 +124,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 +202,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 +311,61 @@ 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_image_extension = new wxCheckBox(this, wxID_ANY, _BUTTON_("internal image extension"));
|
||||
internal_scale = new wxComboBox(this, ID_INTERNAL_SCALE);
|
||||
|
||||
internal_image_extension->SetValue(settings.internal_image_extension);
|
||||
|
||||
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);
|
||||
s2->Add(internal_image_extension, 0, wxEXPAND | wxALL, 4);
|
||||
s->Add(s2, 0, wxEXPAND | wxALL, 8);
|
||||
s->SetSizeHints(this);
|
||||
SetSizer(s);
|
||||
}
|
||||
|
||||
void InternalPreferencesPage::store() {
|
||||
settings.internal_image_extension = internal_image_extension->GetValue();
|
||||
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user