mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
convert to CRLF line endings
This commit is contained in:
+40
-40
@@ -54,7 +54,7 @@ IMPLEMENT_REFLECTION_ENUM(FilenameConflicts) {
|
||||
}
|
||||
|
||||
const vector<int> Settings::scale_choices = { 50,66,75,80,100,120,125,150,175,200 };
|
||||
|
||||
|
||||
const int COLUMN_NOT_INITIALIZED = -100000;
|
||||
|
||||
ColumnSettings::ColumnSettings()
|
||||
@@ -103,11 +103,11 @@ void GameSettings::initDefaults(const Game& game) {
|
||||
ar->custom = false;
|
||||
auto_replaces.push_back(ar);
|
||||
}
|
||||
}
|
||||
// make sure things aren't in a problematic state
|
||||
}
|
||||
// make sure things aren't in a problematic state
|
||||
for (auto it = cardlist_columns.begin(); it != cardlist_columns.end(); ++it) {
|
||||
if (it->second.width < 20) it->second.width = 20;
|
||||
}
|
||||
}
|
||||
if (images_export_filename.Trim().empty()) images_export_filename = _("{card.name}.png");
|
||||
}
|
||||
|
||||
@@ -174,13 +174,13 @@ IMPLEMENT_REFLECTION_ENUM(CutterLinesType) {
|
||||
VALUE_N("none", CUTTER_NONE);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Dark mode settings
|
||||
|
||||
IMPLEMENT_REFLECTION_ENUM(DarkModeType) {
|
||||
VALUE_N("yes", DARKMODE_YES);
|
||||
VALUE_N("system", DARKMODE_SYSTEM);
|
||||
VALUE_N("no", DARKMODE_NO);
|
||||
}
|
||||
// ----------------------------------------------------------------------------- : Dark mode settings
|
||||
|
||||
IMPLEMENT_REFLECTION_ENUM(DarkModeType) {
|
||||
VALUE_N("yes", DARKMODE_YES);
|
||||
VALUE_N("system", DARKMODE_SYSTEM);
|
||||
VALUE_N("no", DARKMODE_NO);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Settings
|
||||
|
||||
@@ -234,7 +234,7 @@ GameSettings& Settings::gameSettingsFor(const Game& game) {
|
||||
if (!gs) gs = make_intrusive<GameSettings>();
|
||||
gs->initDefaults(game);
|
||||
return *gs;
|
||||
}
|
||||
}
|
||||
|
||||
ColumnSettings& Settings::columnSettingsFor(const Game& game, const Field& field) {
|
||||
// Get game info
|
||||
@@ -248,7 +248,7 @@ ColumnSettings& Settings::columnSettingsFor(const Game& game, const Field& field
|
||||
cs.width = field.card_list_width;
|
||||
}
|
||||
return cs;
|
||||
}
|
||||
}
|
||||
|
||||
StyleSheetSettings& Settings::stylesheetSettingsFor(const StyleSheet& stylesheet) {
|
||||
// Use the canonical form here since the stylesheet name will be used as a stored key.
|
||||
@@ -257,37 +257,37 @@ StyleSheetSettings& Settings::stylesheetSettingsFor(const StyleSheet& stylesheet
|
||||
if (!ss) ss = make_intrusive<StyleSheetSettings>();
|
||||
ss->useDefault(default_stylesheet_settings); // update default settings
|
||||
return *ss;
|
||||
}
|
||||
}
|
||||
|
||||
double Settings::exportScaleSettingsFor(const StyleSheet& stylesheet) {
|
||||
StyleSheetSettings& ss = stylesheetSettingsFor(stylesheet);
|
||||
int export_scale = ss.export_scale_selection();
|
||||
if (export_scale == 0) return adaptiveScaleSettingsFor(stylesheet, 300.0, 50.0);
|
||||
if (export_scale == 1) return adaptiveScaleSettingsFor(stylesheet, 300.0, 1.0);
|
||||
if (export_scale == 2) return adaptiveScaleSettingsFor(stylesheet, 150.0, 1.0);
|
||||
int export_scale = ss.export_scale_selection();
|
||||
if (export_scale == 0) return adaptiveScaleSettingsFor(stylesheet, 300.0, 50.0);
|
||||
if (export_scale == 1) return adaptiveScaleSettingsFor(stylesheet, 300.0, 1.0);
|
||||
if (export_scale == 2) return adaptiveScaleSettingsFor(stylesheet, 150.0, 1.0);
|
||||
return (double)scale_choices[export_scale - 3] / 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
double Settings::importScaleSettingsFor(const StyleSheet& stylesheet) {
|
||||
if (import_scale_selection == 0) return exportScaleSettingsFor(stylesheet);
|
||||
if (import_scale_selection == 1) return adaptiveScaleSettingsFor(stylesheet, 300.0, 50.0);
|
||||
if (import_scale_selection == 2) return adaptiveScaleSettingsFor(stylesheet, 300.0, 1.0);
|
||||
if (import_scale_selection == 3) return adaptiveScaleSettingsFor(stylesheet, 150.0, 1.0);
|
||||
if (import_scale_selection == 0) return exportScaleSettingsFor(stylesheet);
|
||||
if (import_scale_selection == 1) return adaptiveScaleSettingsFor(stylesheet, 300.0, 50.0);
|
||||
if (import_scale_selection == 2) return adaptiveScaleSettingsFor(stylesheet, 300.0, 1.0);
|
||||
if (import_scale_selection == 3) return adaptiveScaleSettingsFor(stylesheet, 150.0, 1.0);
|
||||
return (double)scale_choices[import_scale_selection - 4] / 100.0;
|
||||
}
|
||||
|
||||
double Settings::adaptiveScaleSettingsFor(const StyleSheet& stylesheet, double dpi_target, double dpi_leeway) {
|
||||
if (abs(stylesheet.card_dpi - dpi_target) <= dpi_leeway) return 1.0;
|
||||
}
|
||||
|
||||
double Settings::adaptiveScaleSettingsFor(const StyleSheet& stylesheet, double dpi_target, double dpi_leeway) {
|
||||
if (abs(stylesheet.card_dpi - dpi_target) <= dpi_leeway) return 1.0;
|
||||
return dpi_target / max(10.0, stylesheet.card_dpi);
|
||||
}
|
||||
}
|
||||
|
||||
Settings::ExportSettings Settings::exportSettingsFor(const StyleSheet& stylesheet) {
|
||||
StyleSheetSettings& ss = stylesheetSettingsFor(stylesheet);
|
||||
double zoom = settings.exportScaleSettingsFor(stylesheet);
|
||||
double zoom = settings.exportScaleSettingsFor(stylesheet);
|
||||
double angle = ss.card_normal_export() ? 0.0 : deg_to_rad(ss.card_angle());
|
||||
double bleed = ss.card_bleed_export() ? (stylesheet.card_dpi / 300.0) * 36.0 * zoom : 0.0; // 36 pixels of bleed on a 300 DPI print
|
||||
double bleed = ss.card_bleed_export() ? (stylesheet.card_dpi / 300.0) * 36.0 * zoom : 0.0; // 36 pixels of bleed on a 300 DPI print
|
||||
return ExportSettings{zoom, angle, bleed};
|
||||
}
|
||||
}
|
||||
|
||||
IndexMap<FieldP,ValueP>& Settings::exportOptionsFor(const ExportTemplate& export_template) {
|
||||
return export_options.get(export_template.name(), export_template.option_fields);
|
||||
@@ -306,17 +306,17 @@ String Settings::settingsFile() {
|
||||
|
||||
bool Settings::darkMode() {
|
||||
return wxSystemSettings::GetAppearance().IsDark();
|
||||
}
|
||||
}
|
||||
|
||||
String Settings::darkModePrefix() {
|
||||
if (darkMode()) return _("dark_");
|
||||
if (darkMode()) return _("dark_");
|
||||
return _("");
|
||||
}
|
||||
}
|
||||
|
||||
Color Settings::darkModeColor() {
|
||||
if (darkMode()) return wxColor(15,8,0);
|
||||
if (darkMode()) return wxColor(15,8,0);
|
||||
return wxColor(240,247,255);
|
||||
}
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION_NO_SCRIPT(Settings) {
|
||||
REFLECT(locale);
|
||||
@@ -377,10 +377,10 @@ void Settings::read() {
|
||||
wxFileInputStream file(filename);
|
||||
if (!file.Ok()) return; // failure is not an error
|
||||
Reader reader(file, nullptr, filename);
|
||||
reader.handle_greedy(*this);
|
||||
// make sure things aren't in a problematic state
|
||||
if (locale.Trim().empty()) locale = _("en");
|
||||
if (symbol_grid_size < 30) symbol_grid_size = 30;
|
||||
reader.handle_greedy(*this);
|
||||
// make sure things aren't in a problematic state
|
||||
if (locale.Trim().empty()) locale = _("en");
|
||||
if (symbol_grid_size < 30) symbol_grid_size = 30;
|
||||
if (default_stylesheet_settings.card_zoom < 0.5) default_stylesheet_settings.card_zoom = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user