mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
feat: uncouple export zoom from display zoom
This commit is contained in:
@@ -36,18 +36,23 @@ private:
|
|||||||
double angle = 0.0;
|
double angle = 0.0;
|
||||||
};
|
};
|
||||||
Rotation UnzoomedDataViewer::getRotation() const {
|
Rotation UnzoomedDataViewer::getRotation() const {
|
||||||
if (use_zoom_settings) {
|
/*if (use_zoom_settings) {
|
||||||
return DataViewer::getRotation();
|
return DataViewer::getRotation();
|
||||||
} else {
|
} else {
|
||||||
if (!stylesheet) stylesheet = set->stylesheet;
|
if (!stylesheet) stylesheet = set->stylesheet;
|
||||||
return Rotation(angle, stylesheet->getCardRect(), zoom, 1.0, ROTATION_ATTACH_TOP_LEFT);
|
return Rotation(angle, stylesheet->getCardRect(), zoom, 1.0, ROTATION_ATTACH_TOP_LEFT);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
if (!stylesheet) stylesheet = set->stylesheet;
|
||||||
|
int export_zoom = settings.stylesheetSettingsFor(set->stylesheetFor(card)).export_zoom();
|
||||||
|
return Rotation(angle, stylesheet->getCardRect(), export_zoom, 1.0, ROTATION_ATTACH_TOP_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bitmap export_bitmap(const SetP& set, const CardP& card) {
|
Bitmap export_bitmap(const SetP& set, const CardP& card) {
|
||||||
if (!set) throw Error(_("no set"));
|
if (!set) throw Error(_("no set"));
|
||||||
// create viewer
|
// create viewer
|
||||||
UnzoomedDataViewer viewer(!settings.stylesheetSettingsFor(set->stylesheetFor(card)).card_normal_export());
|
UnzoomedDataViewer viewer(false);
|
||||||
|
//UnzoomedDataViewer viewer(!settings.stylesheetSettingsFor(set->stylesheetFor(card)).card_normal_export());
|
||||||
viewer.setSet(set);
|
viewer.setSet(set);
|
||||||
viewer.setCard(card);
|
viewer.setCard(card);
|
||||||
// size of cards
|
// size of cards
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(GameSettings) {
|
|||||||
|
|
||||||
StyleSheetSettings::StyleSheetSettings()
|
StyleSheetSettings::StyleSheetSettings()
|
||||||
: card_zoom (1.0, true)
|
: card_zoom (1.0, true)
|
||||||
|
, export_zoom (2.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)
|
||||||
@@ -132,6 +133,7 @@ StyleSheetSettings::StyleSheetSettings()
|
|||||||
|
|
||||||
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 (export_zoom.isDefault()) export_zoom.assignDefault(ss.export_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);
|
||||||
@@ -142,6 +144,7 @@ void StyleSheetSettings::useDefault(const StyleSheetSettings& ss) {
|
|||||||
|
|
||||||
IMPLEMENT_REFLECTION_NO_SCRIPT(StyleSheetSettings) {
|
IMPLEMENT_REFLECTION_NO_SCRIPT(StyleSheetSettings) {
|
||||||
REFLECT(card_zoom);
|
REFLECT(card_zoom);
|
||||||
|
REFLECT(export_zoom);
|
||||||
REFLECT(card_angle);
|
REFLECT(card_angle);
|
||||||
REFLECT(card_anti_alias);
|
REFLECT(card_anti_alias);
|
||||||
REFLECT(card_borders);
|
REFLECT(card_borders);
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ public:
|
|||||||
|
|
||||||
// Rendering/display settings
|
// Rendering/display settings
|
||||||
Defaultable<double> card_zoom;
|
Defaultable<double> card_zoom;
|
||||||
|
Defaultable<double> export_zoom;
|
||||||
Defaultable<Degrees> card_angle;
|
Defaultable<Degrees> card_angle;
|
||||||
Defaultable<bool> card_anti_alias;
|
Defaultable<bool> card_anti_alias;
|
||||||
Defaultable<bool> card_borders;
|
Defaultable<bool> card_borders;
|
||||||
|
|||||||
@@ -59,13 +59,18 @@ private:
|
|||||||
#else
|
#else
|
||||||
wxSpinCtrl* zoom;
|
wxSpinCtrl* zoom;
|
||||||
#endif
|
#endif
|
||||||
wxCheckBox* non_normal_export;
|
//wxCheckBox* non_normal_export;
|
||||||
|
wxComboBox* export_zoom;
|
||||||
|
int export_zoom_int;
|
||||||
|
|
||||||
void onSelectColumns(wxCommandEvent&);
|
void onSelectColumns(wxCommandEvent&);
|
||||||
#if USE_ZOOM_COMBOBOX
|
#if USE_ZOOM_COMBOBOX
|
||||||
void onZoomChange(wxCommandEvent&);
|
void onZoomChange(wxCommandEvent&);
|
||||||
void updateZoom();
|
void updateZoom();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void onExportZoomChange(wxCommandEvent&);
|
||||||
|
void updateExportZoom();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Preferences page for directories of programs
|
// Preferences page for directories of programs
|
||||||
@@ -202,14 +207,15 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
|
|||||||
#else
|
#else
|
||||||
zoom = new wxSpinCtrl(this, ID_ZOOM);
|
zoom = new wxSpinCtrl(this, ID_ZOOM);
|
||||||
#endif
|
#endif
|
||||||
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());
|
||||||
spellcheck_enabled->SetValue( settings.default_stylesheet_settings.card_spellcheck_enabled());
|
spellcheck_enabled->SetValue( settings.default_stylesheet_settings.card_spellcheck_enabled());
|
||||||
non_normal_export-> SetValue(!settings.default_stylesheet_settings.card_normal_export());
|
//non_normal_export-> SetValue(!settings.default_stylesheet_settings.card_normal_export());
|
||||||
|
export_zoom = new wxComboBox(this, ID_EXPORT_ZOOM);
|
||||||
#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));
|
||||||
@@ -221,6 +227,14 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
|
|||||||
zoom->SetRange(1, 1000);
|
zoom->SetRange(1, 1000);
|
||||||
zoom-> SetValue(static_cast<int>(settings.default_stylesheet_settings.card_zoom() * 100));
|
zoom-> SetValue(static_cast<int>(settings.default_stylesheet_settings.card_zoom() * 100));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
export_zoom_int = static_cast<int>(settings.default_stylesheet_settings.export_zoom() * 100);
|
||||||
|
export_zoom->SetValue(String::Format(_("%d%%"), export_zoom_int));
|
||||||
|
int export_choices[] = { 100,200,300,400,500 };
|
||||||
|
for (unsigned int i = 0; i < sizeof(export_choices) / sizeof(export_choices[0]); ++i) {
|
||||||
|
export_zoom->Append(String::Format(_("%d%%"), export_choices[i]));
|
||||||
|
}
|
||||||
|
|
||||||
// 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"));
|
||||||
@@ -233,18 +247,17 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
|
|||||||
s3->AddSpacer(2);
|
s3->AddSpacer(2);
|
||||||
s3->Add(zoom);
|
s3->Add(zoom);
|
||||||
s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("percent of normal")),1, wxALL & ~wxRIGHT, 4);
|
s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("percent of normal")),1, wxALL & ~wxRIGHT, 4);
|
||||||
|
wxSizer* s4 = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
s4->Add(new wxStaticText(this, wxID_ANY, _LABEL_("export")), 0, wxALL & ~wxLEFT, 4);
|
||||||
|
s4->AddSpacer(2);
|
||||||
|
s4->Add(export_zoom);
|
||||||
|
s4->Add(new wxStaticText(this, wxID_ANY, _LABEL_("percent of normal")), 1, wxALL & ~wxRIGHT, 4);
|
||||||
|
|
||||||
s2->Add(s3, 0, wxEXPAND | wxALL, 4);
|
s2->Add(s3, 0, wxEXPAND | wxALL, 4);
|
||||||
s2->Add(non_normal_export,0, wxEXPAND | wxALL, 4);
|
s2->Add(s4, 0, wxEXPAND | wxALL, 4);
|
||||||
s2->Add(new wxStaticText(this, wxID_ANY, _HELP_("zoom export")), 0, wxALL & ~wxTOP, 4);
|
|
||||||
s->Add(s2, 0, wxEXPAND | wxALL, 8);
|
s->Add(s2, 0, wxEXPAND | wxALL, 8);
|
||||||
/*
|
|
||||||
wxSizer* s4 = new wxStaticBoxSizer(wxVERTICAL, this, _("Card List"));
|
|
||||||
wxSizer* s5 = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
s5->Add(new wxStaticText(this, wxID_ANY, _("Columns: ")), 0, wxALL & ~wxLEFT | wxEXPAND, 4);
|
|
||||||
s5->Add(columns);
|
|
||||||
s4->Add(s5, 0, wxEXPAND | wxALL, 4);
|
|
||||||
s->Add(s4, 0, wxEXPAND | wxALL & ~wxTOP, 8);
|
|
||||||
*/
|
|
||||||
s->SetSizeHints(this);
|
s->SetSizeHints(this);
|
||||||
SetSizer(s);
|
SetSizer(s);
|
||||||
}
|
}
|
||||||
@@ -260,7 +273,8 @@ void DisplayPreferencesPage::store() {
|
|||||||
#else
|
#else
|
||||||
settings.default_stylesheet_settings.card_zoom = zoom->GetValue() / 100.0;
|
settings.default_stylesheet_settings.card_zoom = zoom->GetValue() / 100.0;
|
||||||
#endif
|
#endif
|
||||||
settings.default_stylesheet_settings.card_normal_export = !non_normal_export->GetValue();
|
//settings.default_stylesheet_settings.card_normal_export = !non_normal_export->GetValue();
|
||||||
|
settings.default_stylesheet_settings.export_zoom = export_zoom_int / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayPreferencesPage::onSelectColumns(wxCommandEvent&) {
|
void DisplayPreferencesPage::onSelectColumns(wxCommandEvent&) {
|
||||||
@@ -281,12 +295,27 @@ void DisplayPreferencesPage::onSelectColumns(wxCommandEvent&) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void DisplayPreferencesPage::onExportZoomChange(wxCommandEvent&) {
|
||||||
|
updateExportZoom();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayPreferencesPage::updateExportZoom() {
|
||||||
|
String s = export_zoom->GetValue();
|
||||||
|
int i = export_zoom_int;
|
||||||
|
if (wxSscanf(s.c_str(), _("%u"), &i)) {
|
||||||
|
export_zoom_int = min(max(i, 1), 1000);
|
||||||
|
}
|
||||||
|
export_zoom->SetValue(String::Format(_("%d%%"), (int)export_zoom_int));
|
||||||
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(DisplayPreferencesPage, wxPanel)
|
BEGIN_EVENT_TABLE(DisplayPreferencesPage, wxPanel)
|
||||||
EVT_BUTTON (ID_SELECT_COLUMNS, DisplayPreferencesPage::onSelectColumns)
|
EVT_BUTTON (ID_SELECT_COLUMNS, DisplayPreferencesPage::onSelectColumns)
|
||||||
#if USE_ZOOM_COMBOBOX
|
#if USE_ZOOM_COMBOBOX
|
||||||
EVT_COMBOBOX (ID_ZOOM, DisplayPreferencesPage::onZoomChange)
|
EVT_COMBOBOX (ID_ZOOM, DisplayPreferencesPage::onZoomChange)
|
||||||
EVT_TEXT_ENTER (ID_ZOOM, DisplayPreferencesPage::onZoomChange)
|
EVT_TEXT_ENTER (ID_ZOOM, DisplayPreferencesPage::onZoomChange)
|
||||||
#endif
|
#endif
|
||||||
|
EVT_COMBOBOX(ID_EXPORT_ZOOM, DisplayPreferencesPage::onExportZoomChange)
|
||||||
|
EVT_TEXT_ENTER(ID_EXPORT_ZOOM, DisplayPreferencesPage::onExportZoomChange)
|
||||||
END_EVENT_TABLE ()
|
END_EVENT_TABLE ()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -271,6 +271,9 @@ enum ControlID {
|
|||||||
ID_ZOOM,
|
ID_ZOOM,
|
||||||
ID_ZOOM_X,
|
ID_ZOOM_X,
|
||||||
ID_ZOOM_Y,
|
ID_ZOOM_Y,
|
||||||
|
ID_EXPORT_ZOOM,
|
||||||
|
ID_EXPORT_ZOOM_X,
|
||||||
|
ID_EXPORT_ZOOM_Y,
|
||||||
ID_SHARPEN,
|
ID_SHARPEN,
|
||||||
ID_SHARPEN_AMOUNT,
|
ID_SHARPEN_AMOUNT,
|
||||||
// Updates window
|
// Updates window
|
||||||
|
|||||||
Reference in New Issue
Block a user