diff --git a/data/en.mse-locale/locale b/data/en.mse-locale/locale index 52189fdb..69611ecf 100644 --- a/data/en.mse-locale/locale +++ b/data/en.mse-locale/locale @@ -622,14 +622,24 @@ error: You should leave a bug report on http://magicseteditor.sourceforge.net/ # File related - file not found: File not found: '%s' in package '%s' + file not found: File not found: '%s' in package '%s' + file not found package like: + File not found: '%s' in package '%s' + If you are trying to open a file from another package, use "/package/filename" file parse error: Error while parsing file: '%s' %s package not found: Package not found: '%s' package out of date: The package '%s' (version %s) is out of date, version %s is required. + package too new: The package '%s' (version %s) is not compatible with version %s, required by '%s' unable to open output file: Error while saving, unable to open output file unable to store file: Error while saving, unable to store file + dependency not given: + The package '%s' uses files from the package '%s', but it does not list a dependency. + To resolve this, add: + depends on: + package: %s + version: %s # Script stuff has no member: %s has no member '%s' diff --git a/data/magic-extended-art.mse-style/style b/data/magic-extended-art.mse-style/style index c26b7507..419235a1 100644 --- a/data/magic-extended-art.mse-style/style +++ b/data/magic-extended-art.mse-style/style @@ -15,7 +15,7 @@ card dpi: 150 init script: # Load scripts for image box - include file: magic-default-image.mse-include/scripts + include file: /magic-default-image.mse-include/scripts # Should hybrids have a grey name? mask_hybrid_with_land := { styling.grey_hybrid_name } diff --git a/data/magic-firepenguinmaster-flip.mse-style/style b/data/magic-firepenguinmaster-flip.mse-style/style index 8a527b89..9b8d3f5d 100644 --- a/data/magic-firepenguinmaster-flip.mse-style/style +++ b/data/magic-firepenguinmaster-flip.mse-style/style @@ -33,7 +33,7 @@ card dpi: 150 init script: # Load blend scripts for hybrids/multicolors - include file: magic-default-image.mse-include/scripts + include file: /magic-default-image.mse-include/scripts # We have no land templates land_template := { "c{type}.jpg" } @@ -305,7 +305,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks text 2: left: 33 top : 65 @@ -348,7 +348,7 @@ card style: render style: image alignment: middle center angle: 180 - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT power: diff --git a/data/magic-firepenguinmaster.mse-style/style b/data/magic-firepenguinmaster.mse-style/style index d8278465..6e70aef6 100644 --- a/data/magic-firepenguinmaster.mse-style/style +++ b/data/magic-firepenguinmaster.mse-style/style @@ -279,7 +279,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT power: diff --git a/data/magic-firepenguinmasterpromo.mse-style/style b/data/magic-firepenguinmasterpromo.mse-style/style index f4195115..02eab4bc 100644 --- a/data/magic-firepenguinmasterpromo.mse-style/style +++ b/data/magic-firepenguinmasterpromo.mse-style/style @@ -250,7 +250,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT power: diff --git a/data/magic-firepenguinmastersplit.mse-style/style b/data/magic-firepenguinmastersplit.mse-style/style index ff4c5da3..f785ba4c 100644 --- a/data/magic-firepenguinmastersplit.mse-style/style +++ b/data/magic-firepenguinmastersplit.mse-style/style @@ -378,7 +378,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks watermark 2: left: 349.45 top : 240 @@ -387,7 +387,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT power: diff --git a/data/magic-firepenguinmastertokens.mse-style/style b/data/magic-firepenguinmastertokens.mse-style/style index 61d32e5f..816c3e82 100644 --- a/data/magic-firepenguinmastertokens.mse-style/style +++ b/data/magic-firepenguinmastertokens.mse-style/style @@ -263,7 +263,7 @@ card style: render style: image alignment: middle center visible: { card.rule_text != "" and card.flavor_text != "" } - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT power: diff --git a/data/magic-future-textless.mse-style/style b/data/magic-future-textless.mse-style/style index fe09686d..271c6b32 100644 --- a/data/magic-future-textless.mse-style/style +++ b/data/magic-future-textless.mse-style/style @@ -253,7 +253,7 @@ card style: width: { 300 - max(18,card_style.rarity.content_width) } height: 28 alignment: middle shrink-overflow - z index: 1 + z index: 2 padding top: 2 font: name: Matrix diff --git a/data/magic-future.mse-style/style b/data/magic-future.mse-style/style index d5c14320..1f298099 100644 --- a/data/magic-future.mse-style/style +++ b/data/magic-future.mse-style/style @@ -398,7 +398,7 @@ card style: z index: 2 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT pt: diff --git a/data/magic-new-flip.mse-style/style b/data/magic-new-flip.mse-style/style index 9fb93662..5ee25fc2 100644 --- a/data/magic-new-flip.mse-style/style +++ b/data/magic-new-flip.mse-style/style @@ -18,7 +18,7 @@ card dpi: 150 init script: # Load scripts for image box - include file: magic-default-image.mse-include/scripts + include file: /magic-default-image.mse-include/scripts # Should hybrids have a grey name? mask_hybrid_with_land := { false } @@ -332,7 +332,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks watermark 2: left: 151 top : 378 @@ -342,7 +342,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT pt: diff --git a/data/magic-new-planeswalker.mse-style/style b/data/magic-new-planeswalker.mse-style/style index db129dd6..fe5d5239 100644 --- a/data/magic-new-planeswalker.mse-style/style +++ b/data/magic-new-planeswalker.mse-style/style @@ -18,7 +18,7 @@ card dpi: 150 init script: # Load scripts for image box - include file: magic-default-image.mse-include/scripts + include file: /magic-default-image.mse-include/scripts # Should hybrids have a grey name? mask_hybrid_with_land := { styling.grey_hybrid_name } @@ -270,7 +270,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# Loyalty loyalty: diff --git a/data/magic-new-promo.mse-style/style b/data/magic-new-promo.mse-style/style index 55fff6d2..c997ca1e 100644 --- a/data/magic-new-promo.mse-style/style +++ b/data/magic-new-promo.mse-style/style @@ -14,7 +14,7 @@ card dpi: 150 init script: # Load scripts for image box - include file: magic-default-image.mse-include/scripts + include file: /magic-default-image.mse-include/scripts # Should hybrids have a grey name? mask_hybrid_with_land := { styling.grey_hybrid_name } @@ -229,7 +229,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT pt: diff --git a/data/magic-new-split.mse-style/style b/data/magic-new-split.mse-style/style index b9717086..a574fb1a 100644 --- a/data/magic-new-split.mse-style/style +++ b/data/magic-new-split.mse-style/style @@ -17,7 +17,7 @@ card dpi: 150 init script: # Load scripts for image box - include file: magic-default-image.mse-include/scripts + include file: /magic-default-image.mse-include/scripts # Should hybrids have a grey name? mask_hybrid_with_land := { styling.grey_hybrid_name } @@ -365,7 +365,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks watermark 2: left: 338 top : 228 @@ -374,7 +374,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT pt: diff --git a/data/magic-new-token.mse-style/style b/data/magic-new-token.mse-style/style index 3549f693..8ca277de 100644 --- a/data/magic-new-token.mse-style/style +++ b/data/magic-new-token.mse-style/style @@ -17,7 +17,7 @@ card dpi: 150 init script: # Load scripts for default images - include file: magic-default-image.mse-include/scripts + include file: /magic-default-image.mse-include/scripts # What should the textbox look like? text_shape := { diff --git a/data/magic-new.mse-style/style b/data/magic-new.mse-style/style index 0bab65cc..d4320c7b 100644 --- a/data/magic-new.mse-style/style +++ b/data/magic-new.mse-style/style @@ -21,7 +21,7 @@ card dpi: 150 init script: # Load scripts for image box - include file: magic-default-image.mse-include/scripts + include file: /magic-default-image.mse-include/scripts # Should hybrids have a grey name? mask_hybrid_with_land := { styling.grey_hybrid_name } @@ -224,7 +224,7 @@ card style: type: left: 35 - top : 299 + top : 298 width: { 308 - max(22,card_style.rarity.content_width) } height: 20 alignment: top shrink-overflow @@ -305,7 +305,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT pt: diff --git a/data/magic-old-split.mse-style/style b/data/magic-old-split.mse-style/style index a08a5dc7..dc3b1a23 100644 --- a/data/magic-old-split.mse-style/style +++ b/data/magic-old-split.mse-style/style @@ -426,7 +426,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks watermark 2: left: 338 top : 228 @@ -435,7 +435,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT pt: diff --git a/data/magic-old.mse-style/style b/data/magic-old.mse-style/style index 4f0e6e79..b02b1e42 100644 --- a/data/magic-old.mse-style/style +++ b/data/magic-old.mse-style/style @@ -315,7 +315,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT pt: diff --git a/data/magic-planeshifted.mse-style/style b/data/magic-planeshifted.mse-style/style index 906f499b..4ca2a992 100644 --- a/data/magic-planeshifted.mse-style/style +++ b/data/magic-planeshifted.mse-style/style @@ -266,7 +266,7 @@ card style: z index: 1 render style: image alignment: middle center - include file: magic-watermarks.mse-include/watermarks + include file: /magic-watermarks.mse-include/watermarks ############################# PT pt: diff --git a/data/magic.mse-game/game b/data/magic.mse-game/game index f715a15e..6f554b2d 100644 --- a/data/magic.mse-game/game +++ b/data/magic.mse-game/game @@ -173,10 +173,10 @@ init script: # The code consists of 4 parts: # normal/token, color, shifted, split sort_index := { - (if contains(card.shape, match:"token") then "T" else "N") + # Tokens come last + (if contains(card.shape, match:"token") then "T" else " ") + # Tokens come last color_of_card() + - (if contains(card.shape, match:"shifted") then "S" else "N") + # planeshifted cards come after normal ones - (if contains(card.shape, match:"split") then "S" else "N") + # split cards come after normal ones + (if contains(card.shape, match:"shifted") then "S" else " ") + # planeshifted cards come after normal ones + (if contains(card.shape, match:"split") then "S" else " ") + # split cards come after normal ones ":" } is_multicolor := { chosen(choice: "multicolor") and input != "artifact, multicolor" } @@ -221,7 +221,7 @@ init script: } rarity_sort := { - if set.sort_special_rarity == "with the rest" or card.rarity != "special" then "A" else "Z" + if set.sort_special_rarity == "with the rest" or card.rarity != "special" then " " else "S" } set_filter := { if set.sort_special_rarity != "separate numbering" then nil @@ -825,7 +825,7 @@ card field: name: watermark icon: stats/watermark.png position hint: 200 - include file: magic-watermarks.mse-include/watermark-names + include file: /magic-watermarks.mse-include/watermark-names description: A watermark for below the textbox, this can be a big mana symbol used on basic lands, or a guild symbol ############################# Loyalty @@ -1052,7 +1052,7 @@ card field: card field: type: choice name: watermark 2 - include file: magic-watermarks.mse-include/watermark-names + include file: /magic-watermarks.mse-include/watermark-names icon: stats/watermark.png show statistics: false description: A watermark for below the textbox, this can be a big mana symbol used on basic lands, a special symbol, or a guild symbol diff --git a/doc/file/format.txt b/doc/file/format.txt index 181a4f0a..27354b06 100644 --- a/doc/file/format.txt +++ b/doc/file/format.txt @@ -30,7 +30,7 @@ However some keys, like @mse version@ and @type@ must come first because they in A heirachical file can contain a reference to another file: >>>include file: filename -Where filename must be an absolute [[type:filename]]. +Where filename must be an absolute or relative [[type:filename]]. That file is included literally into the current one; except for indentation, the included file never escapes from the level the 'include file' line is on. diff --git a/doc/function/set_alpha.txt b/doc/function/set_alpha.txt index efd6007a..3305646e 100644 --- a/doc/function/set_alpha.txt +++ b/doc/function/set_alpha.txt @@ -15,7 +15,7 @@ If @alpha@ is 1 the image stays the same, if @alpha@ is 0 the image becomes comp --Examples-- > set_alpha("image1.png", alpha: 0.5) == [[Image]] ->>> set_mask("image1.png", alpha: 0.5) == "image_set_alpha.png" +>>> set_alpha("image1.png", alpha: 0.5) == "image_set_alpha.png" --See also-- | [[fun:set_mask]] Set the transparancy mask of an image. diff --git a/doc/type/filename.txt b/doc/type/filename.txt index e3816c35..bb0942b5 100644 --- a/doc/type/filename.txt +++ b/doc/type/filename.txt @@ -8,3 +8,13 @@ There are two types of filenames, relative and absolute: | /package/path/to/file An absolute filename includes the name of the package. This is a package somewhere in the MSE data directory. Don't forget the double quotes (@""@) in scripts. + +--Dependencies-- +When using an absolute filename to refer to a file from another [[file:package]], +the [[type:dependency]] on that package must be declared. +For example, +>include file: /common.mse-include/something +Will give a warning message, unless the file also lists +>depends on: +> package: common.mse-include +> version: 2007-01-01 diff --git a/src/data/action/keyword.cpp b/src/data/action/keyword.cpp index 1817e987..7917f487 100644 --- a/src/data/action/keyword.cpp +++ b/src/data/action/keyword.cpp @@ -70,7 +70,7 @@ void KeywordReminderTextValue::store() { String new_value = untag(value); // Try to parse the script vector parse_errors; - ScriptP new_script = parse(new_value, true, parse_errors); + ScriptP new_script = parse(new_value, nullptr, true, parse_errors); if (parse_errors.empty()) { // parsed okay, assign errors.clear(); diff --git a/src/data/action/symbol.cpp b/src/data/action/symbol.cpp index 1a3bebb6..b610e628 100644 --- a/src/data/action/symbol.cpp +++ b/src/data/action/symbol.cpp @@ -356,7 +356,7 @@ AddSymbolPartAction::AddSymbolPartAction(Symbol& symbol, const SymbolPartP& part {} String AddSymbolPartAction::getName(bool to_undo) const { - return format_string(_ACTION_("add part"), part->name); + return _ACTION_1_("add part", part->name); } void AddSymbolPartAction::perform(bool to_undo) { @@ -395,7 +395,7 @@ void RemoveSymbolPartsAction::check(SymbolGroup& group, const set& } String RemoveSymbolPartsAction::getName(bool to_undo) const { - return format_string(_ACTION_("remove parts"), removals.size() == 1 ? _TYPE_("shape") : _TYPE_("shapes")); + return _ACTION_1_("remove parts", removals.size() == 1 ? _TYPE_("shape") : _TYPE_("shapes")); } void RemoveSymbolPartsAction::perform(bool to_undo) { @@ -433,7 +433,7 @@ DuplicateSymbolPartsAction::DuplicateSymbolPartsAction(Symbol& symbol, const set } String DuplicateSymbolPartsAction::getName(bool to_undo) const { - return format_string(_ACTION_("duplicate"), duplications.size() == 1 ? _TYPE_("shape") : _TYPE_("shapes")); + return _ACTION_1_("duplicate", duplications.size() == 1 ? _TYPE_("shape") : _TYPE_("shapes")); } void DuplicateSymbolPartsAction::perform(bool to_undo) { diff --git a/src/data/action/value.cpp b/src/data/action/value.cpp index 06841460..1b2882e9 100644 --- a/src/data/action/value.cpp +++ b/src/data/action/value.cpp @@ -19,7 +19,7 @@ // ----------------------------------------------------------------------------- : ValueAction String ValueAction::getName(bool to_undo) const { - return format_string(_ACTION_("change"), valueP->fieldP->name); + return _ACTION_1_("change", valueP->fieldP->name); } // ----------------------------------------------------------------------------- : Simple diff --git a/src/data/format/clipboard.cpp b/src/data/format/clipboard.cpp index 9c488c4e..88b96598 100644 --- a/src/data/format/clipboard.cpp +++ b/src/data/format/clipboard.cpp @@ -31,7 +31,7 @@ String serialize_for_clipboard(Package& package, T& object) { template void deserialize_from_clipboard(T& object, Package& package, const String& data) { shared_ptr stream( new wxStringInputStream(data) ); - Reader reader(stream, _("clipboard")); + Reader reader(stream, nullptr, _("clipboard")); WITH_DYNAMIC_ARG(clipboard_package, &package); reader.handle_greedy(object); } diff --git a/src/data/installer.cpp b/src/data/installer.cpp index e9ea9b26..2b3c6c6e 100644 --- a/src/data/installer.cpp +++ b/src/data/installer.cpp @@ -42,12 +42,12 @@ void Installer::installFrom(const String& filename, bool message_on_success, boo i.open(filename); try { i.install(local); - } - catch (Error& e) { + } catch (const Error& e) { handle_error(e); return; } if (message_on_success) { + //wxMessageBox(_ERROR_2_("successful install", i.name(), String() << i.packaged.size(), wxMessageBox(String::Format(_("'%s' successfully installed %d package%s."), i.name().c_str(), i.packages.size(), i.packages.size() == 1 ? _("") : _("s")), _("Magic Set Editor"), wxOK | wxICON_INFORMATION); } @@ -65,15 +65,17 @@ struct dependency_check : public unary_function { void Installer::install(bool local) { // Destination directory String install_dir = local ? ::packages.getLocalDataDir() : ::packages.getGlobalDataDir(); - if (!wxDirExists(install_dir)) + if (!wxDirExists(install_dir)) { wxMkdir(install_dir, 0755); + } // All the packages we're installing. vector new_packages; FOR_EACH(p, packages) { - if (wxDirExists(install_dir + _("/") + p) || wxFileExists(install_dir + _("/") + p)) + if (wxDirExists(install_dir + _("/") + p) || wxFileExists(install_dir + _("/") + p)) { throw PackageError(_("Package ") + p + _(" is already installed. Overwriting currently not supported.")); + } PackagedP pack; wxString fn(wxFileName(p).GetExt()); if (fn == _("mse-game")) pack = new_intrusive(); @@ -90,7 +92,6 @@ void Installer::install(bool local) { new_packages.push_back(pack); } - // Check dependencies for each and every package. FOR_EACH(p, new_packages) { FOR_EACH(d, p->dependencies) { @@ -100,28 +101,31 @@ void Installer::install(bool local) { } } } - + const FileInfos& file_infos = getFileInfos(); for (FileInfos::const_iterator it = file_infos.begin() ; it != file_infos.end() ; ++it) { String file = it->first; - + wxFileName fn(file); wxArrayString dirs = fn.GetDirs(); - - if (fn.IsDir() || !dirs.GetCount() || find(packages.begin(), packages.end(), dirs[0]) == packages.end()) + + if (fn.IsDir() || !dirs.GetCount() || find(packages.begin(), packages.end(), dirs[0]) == packages.end()) { continue; - + } + String current_dir = install_dir; for (size_t j = 0; j < dirs.GetCount(); ++j) { current_dir += _("/") + dirs[j]; - if (!wxDirExists(current_dir) && !wxMkdir(current_dir, 0755)) + if (!wxDirExists(current_dir) && !wxMkdir(current_dir, 0755)) { throw PackageError(_("Cannot create folder ") + current_dir + _(" for install. Warning: some packages may have been installed anyway, and some may only be partially installed.")); + } } - + InputStreamP is = openIn(file); wxFileOutputStream os (install_dir + _("/") + file); - if (!os.IsOk()) + if (!os.IsOk()) { throw PackageError(_("Cannot create file ") + install_dir + _("/") + file + _(" for install. Warning: some packages may have been installed anyway, and some may only be partially installed.")); + } os.Write(*is); } } diff --git a/src/data/locale.cpp b/src/data/locale.cpp index 60f4b112..361ccaa2 100644 --- a/src/data/locale.cpp +++ b/src/data/locale.cpp @@ -206,7 +206,7 @@ DECLARE_TYPEOF(map); void Locale::validate(Version ver) { // load locale validator LocaleValidator v; - Reader r(load_resource_text(_("expected_locale_keys")), _("expected_locale_keys")); + Reader r(load_resource_text(_("expected_locale_keys")), nullptr, _("expected_locale_keys")); r.handle_greedy(v); // validate String errors; diff --git a/src/data/settings.cpp b/src/data/settings.cpp index 1f1921f4..834c9883 100644 --- a/src/data/settings.cpp +++ b/src/data/settings.cpp @@ -248,7 +248,7 @@ void Settings::read() { // settings file not existing is not an error shared_ptr file = new_shared1(filename); if (!file->Ok()) return; // failure is not an error - Reader reader(file, filename); + Reader reader(file, nullptr, filename); reader.handle_greedy(*this); } } diff --git a/src/gui/images_export_window.cpp b/src/gui/images_export_window.cpp index f1880ab2..33fdd5d8 100644 --- a/src/gui/images_export_window.cpp +++ b/src/gui/images_export_window.cpp @@ -66,7 +66,7 @@ void ImagesExportWindow::onOk(wxCommandEvent&) { else if (sel == 2) gs.images_export_conflicts = CONFLICT_NUMBER; else gs.images_export_conflicts = CONFLICT_NUMBER_OVERWRITE; // Script - ScriptP filename_script = parse(gs.images_export_filename, true); + ScriptP filename_script = parse(gs.images_export_filename, nullptr, true); // Select filename String name = wxFileSelector(_TITLE_("export images"),_(""), _LABEL_("filename is ignored"),_(""), _LABEL_("filename is ignored")+_("|*"), wxSAVE, this); diff --git a/src/gui/print_window.cpp b/src/gui/print_window.cpp index a55502d7..98af46cc 100644 --- a/src/gui/print_window.cpp +++ b/src/gui/print_window.cpp @@ -35,7 +35,7 @@ DECLARE_POINTER_TYPE(PageLayout); */ class TextBufferDC : public wxMemoryDC { public: - TextBufferDC(int width, int height); + TextBufferDC(int width, int height, bool buffer_text); virtual void DoDrawText(const String& str, int x, int y); virtual void DoDrawRotatedText(const String& str, int x, int y, double angle); @@ -62,24 +62,34 @@ class TextBufferDC : public wxMemoryDC { private: vector text; Bitmap buffer; + bool buffer_text; ///< buffering text? }; -TextBufferDC::TextBufferDC(int width, int height) +TextBufferDC::TextBufferDC(int width, int height, bool buffer_text) : buffer(width, height, 32) + , buffer_text(buffer_text) { SelectObject(buffer); // initialize to white clearDC(*this,*wxWHITE_BRUSH); } void TextBufferDC::DoDrawText(const String& str, int x, int y) { - double usx,usy; - GetUserScale(&usx, &usy); - text.push_back( new_intrusive7(GetFont(), GetTextForeground(), usx, usy, x, y, str) ); + if (buffer_text) { + double usx,usy; + GetUserScale(&usx, &usy); + text.push_back( new_intrusive7(GetFont(), GetTextForeground(), usx, usy, x, y, str) ); + } else { + wxMemoryDC::DoDrawText(str,x,y); + } } void TextBufferDC::DoDrawRotatedText(const String& str, int x, int y, double angle) { - double usx,usy; - GetUserScale(&usx, &usy); - text.push_back( new_intrusive8(GetFont(), GetTextForeground(), usx, usy, x, y, str, angle) ); + if (buffer_text) { + double usx,usy; + GetUserScale(&usx, &usy); + text.push_back( new_intrusive8(GetFont(), GetTextForeground(), usx, usy, x, y, str, angle) ); + } else { + wxMemoryDC::DoDrawRotatedText(str,x,y,angle); + } } DECLARE_TYPEOF_COLLECTION(TextBufferDC::TextDrawP); @@ -219,13 +229,16 @@ void CardsPrintout::drawCard(DC& dc, const CardP& card, int card_nr) { // create buffers int w = stylesheet.card_width, h = stylesheet.card_height; // in pixels if (rotation == 90) swap(w,h); - TextBufferDC bufferDC(w,h); - RotatedDC rdc(bufferDC, rotation, RealRect(0,0,w,h), 1.0, QUALITY_SUB_PIXEL); + // Draw using text buffer + //TextBufferDC bufferDC(w,h,true); + //RotatedDC rdc(bufferDC, rotation, RealRect(0,0,w,h), 1.0, QUALITY_SUB_PIXEL); + TextBufferDC bufferDC(w*4,h*4,false); + RotatedDC rdc(bufferDC, rotation, RealRect(0,0,w*4,h*4), 4.0, QUALITY_AA); // render card to dc viewer.setCard(card); viewer.draw(rdc, *wxWHITE); // render buffer to device - double px_per_mm = stylesheet.card_dpi / 25.4; + double px_per_mm = 4 * stylesheet.card_dpi / 25.4; dc.SetUserScale(scale_x / px_per_mm, scale_y / px_per_mm); dc.SetDeviceOrigin(scale_x * pos.x, scale_y * pos.y); bufferDC.drawToDevice(dc, 0, 0); // adjust for scaling diff --git a/src/gui/set/cards_panel.cpp b/src/gui/set/cards_panel.cpp index b59e5d00..3e0ee24c 100644 --- a/src/gui/set/cards_panel.cpp +++ b/src/gui/set/cards_panel.cpp @@ -188,7 +188,7 @@ void CardsPanel::onUpdateUI(wxUpdateUIEvent& ev) { ev.Enable(menu); if (insertSymbolMenu->GetSubMenu() != menu || (menu && menu->GetParent() != menuFormat)) { // re-add the menu - menuFormat->Remove(insertSymbolMenu); + menuFormat->Remove(ID_INSERT_SYMBOL); insertSymbolMenu->SetSubMenu(menu); menuFormat->Append(insertSymbolMenu); } diff --git a/src/gui/set/keywords_panel.cpp b/src/gui/set/keywords_panel.cpp index 0a891c20..6e8778c2 100644 --- a/src/gui/set/keywords_panel.cpp +++ b/src/gui/set/keywords_panel.cpp @@ -250,7 +250,7 @@ void KeywordsPanel::doPaste() { CUT_COPY_PASTE(doPaste, return (void), ! void KeywordsPanel::onChangeSet() { list->setSet(set); // warning label (depends on game name) - fixedL->SetLabel(format_string(_LABEL_("standard keyword"), set->game->short_name)); + fixedL->SetLabel(_LABEL_1_("standard keyword", set->game->short_name)); // init text controls keyword ->setSet(set); keyword ->getStyle().font.size = 16; diff --git a/src/gui/set/window.cpp b/src/gui/set/window.cpp index 45ab059b..b9734f8d 100644 --- a/src/gui/set/window.cpp +++ b/src/gui/set/window.cpp @@ -286,7 +286,7 @@ void SetWindow::updateTitle() { if (identification.empty()) identification = set->name(); if (identification.empty()) identification = _TITLE_("untitled"); set->short_name = identification; - SetTitle(format_string(_TITLE_("%s - magic set editor"),identification)); + SetTitle(_TITLE_1_("%s - magic set editor",identification)); } } @@ -335,7 +335,7 @@ void SetWindow::onClose(wxCloseEvent& ev) { bool SetWindow::askSaveAndContinue() { if (set->actions.atSavePoint()) return true; // todo : if more then one window has the set selected it's ok to proceed - int save = wxMessageBox(format_string(_LABEL_("save changes"), set->short_name), _TITLE_("save changes"), wxYES_NO | wxCANCEL | wxICON_EXCLAMATION); + int save = wxMessageBox(_LABEL_1_("save changes", set->short_name), _TITLE_("save changes"), wxYES_NO | wxCANCEL | wxICON_EXCLAMATION); if (save == wxYES) { // save the set try { diff --git a/src/gui/symbol/window.cpp b/src/gui/symbol/window.cpp index 9836ba61..7382a64e 100644 --- a/src/gui/symbol/window.cpp +++ b/src/gui/symbol/window.cpp @@ -29,7 +29,7 @@ SymbolWindow::SymbolWindow(Window* parent) { SymbolWindow::SymbolWindow(Window* parent, const String& filename) { // open file - Reader reader(new_shared1(filename), filename); + Reader reader(new_shared1(filename), nullptr, filename); SymbolP symbol; reader.handle_greedy(symbol); init(parent, symbol); @@ -204,7 +204,7 @@ void SymbolWindow::onFileOpen(wxCommandEvent& ev) { String ext = n.GetExt(); SymbolP symbol; if (ext.Lower() == _("mse-symbol")) { - Reader reader(new_shared1(name), name); + Reader reader(new_shared1(name), nullptr, name); reader.handle_greedy(symbol); } else { wxBusyCursor busy; diff --git a/src/gui/value/text.cpp b/src/gui/value/text.cpp index 20eec182..d46ed05e 100644 --- a/src/gui/value/text.cpp +++ b/src/gui/value/text.cpp @@ -297,8 +297,7 @@ void DropDownWordList::select(size_t item) { tve.selection_start_i = pos->start; tve.selection_end_i = pos->end; tve.fixSelection(TYPE_INDEX); - tve.replaceSelection(escape(new_value), - format_string(_ACTION_("change"), tve.field().name)); + tve.replaceSelection(escape(new_value), _ACTION_1_("change", tve.field().name)); // stay open? if (IsShown()) selection(); // update 'enabled' } diff --git a/src/main.cpp b/src/main.cpp index 28c8ff5a..e41de97b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -102,9 +102,10 @@ int MSE::OnRun() { InstallType type = settings.install_type; if (argc > 2) { String arg = argv[2]; - if (arg.Mid(0,2) == _("--")) - parse_enum(arg.Mid(2), type); + if (starts_with(argv[2], _("--"))) { + parse_enum(String(argv[2]).substr(2), type); } + } Installer::installFrom(argv[1], true, isInstallLocal(type)); return EXIT_SUCCESS; } else if (arg == _("--symbol-editor")) { diff --git a/src/resource/common/expected_locale_keys b/src/resource/common/expected_locale_keys index 84e794ec..ab3f9204 100644 --- a/src/resource/common/expected_locale_keys +++ b/src/resource/common/expected_locale_keys @@ -1,6 +1,6 @@ # This file contains the keys expected to be in MSE locales # It was automatically generated by tools/locale/locale.pl -# Generated on Fri Sep 21 14:19:24 2007 +# Generated on Mon Sep 24 22:07:59 2007 action: add control point: 0 @@ -82,9 +82,11 @@ error: checking updates: 0 checking updates failed: 0 coordinates for blending overlap: 0 + dependency not given: 4 dimension not found: 1 expected key: 1 file not found: 2 + file not found package like: 2 file parse error: 2 has no member: 2 has no member value: 2 @@ -99,7 +101,9 @@ error: no updates: 0 package not found: 1 package out of date: 3 + package too new: 4 stylesheet and set refer to different game: 0 + successful install: optional, 2 unable to open output file: 0 unable to store file: 0 unrecognized value: 1 diff --git a/src/script/parser.cpp b/src/script/parser.cpp index 7ff312d4..18704c41 100644 --- a/src/script/parser.cpp +++ b/src/script/parser.cpp @@ -57,7 +57,7 @@ enum OpenBrace /** Also stores errors found when tokenizing or parsing */ class TokenIterator { public: - TokenIterator(const String& str, bool string_mode, vector& errors); + TokenIterator(const String& str, Packaged* package, bool string_mode, vector& errors); /// Peek at the next token, doesn't move to the one after that /** Can peek further forward by using higher values of offset. @@ -75,6 +75,7 @@ class TokenIterator { String input; size_t pos; String filename; ///< Filename of include files, "" for the main input + Packaged* package; ///< Package the input is from vector buffer; ///< buffer of unread tokens, front() = current stack open_braces; ///< braces/quotes we entered from script mode bool newline; ///< Did we just pass a newline? @@ -83,6 +84,7 @@ class TokenIterator { String input; size_t pos; String filename; + Package* package; }; stack more; ///< Read tokens from here when we are done with the current input @@ -115,9 +117,10 @@ bool isLongOper(const String& s) { return s==_(":=") || s==_("==") || s==_("!=") // ----------------------------------------------------------------------------- : Tokenizing -TokenIterator::TokenIterator(const String& str, bool string_mode, vector& errors) +TokenIterator::TokenIterator(const String& str, Packaged* package, bool string_mode, vector& errors) : input(str) , pos(0) + , package(package) , newline(false) , errors(errors) { @@ -183,12 +186,12 @@ void TokenIterator::readToken() { if (eol == String::npos) eol = input.size(); String include_file = trim(input.substr(pos, eol - pos)); // store the current input for later retrieval - MoreInput m = {input, eol, filename}; + MoreInput m = {input, eol, filename, package}; more.push(m); // read the entire file, and start at the beginning of it pos = 0; filename = include_file; - InputStreamP is = packages.openFileFromPackage(include_file); + InputStreamP is = packages.openFileFromPackage(package, include_file); input = read_utf8_line(*is, true, true); } else if (isAlpha(c) || c == _('_')) { // name @@ -345,10 +348,10 @@ void parseExpr(TokenIterator& input, Script& script, Precedence min_prec); void parseOper(TokenIterator& input, Script& script, Precedence min_prec, InstructionType close_with = I_NOP, int close_with_data = 0); -ScriptP parse(const String& s, bool string_mode, vector& errors_out) { +ScriptP parse(const String& s, Packaged* package, bool string_mode, vector& errors_out) { errors_out.clear(); // parse - TokenIterator input(s, string_mode, errors_out); + TokenIterator input(s, package, string_mode, errors_out); ScriptP script(new Script); parseOper(input, *script, PREC_ALL, I_RET); Token eof = input.read(); @@ -363,9 +366,9 @@ ScriptP parse(const String& s, bool string_mode, vector& error } } -ScriptP parse(const String& s, bool string_mode) { +ScriptP parse(const String& s, Packaged* package, bool string_mode) { vector errors; - ScriptP script = parse(s, string_mode, errors); + ScriptP script = parse(s, package, string_mode, errors); if (!errors.empty()) { throw ScriptParseErrors(errors); } diff --git a/src/script/parser.hpp b/src/script/parser.hpp index f6783db0..9ea163ae 100644 --- a/src/script/parser.hpp +++ b/src/script/parser.hpp @@ -13,6 +13,8 @@ #include #include