mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Incremented version number to 0.3.7
When saving files an older version number is used if that version of MSE would be able to open the set git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1011 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -20,6 +20,7 @@ ExportTemplate::ExportTemplate()
|
||||
|
||||
String ExportTemplate::typeNameStatic() { return _("export-template"); }
|
||||
String ExportTemplate::typeName() const { return _("export-template"); }
|
||||
Version ExportTemplate::fileVersion() const { return file_version_export_template; }
|
||||
|
||||
void ExportTemplate::validate(Version) {
|
||||
if (!game) {
|
||||
|
||||
@@ -35,6 +35,7 @@ class ExportTemplate : public Packaged {
|
||||
|
||||
static String typeNameStatic();
|
||||
virtual String typeName() const;
|
||||
Version fileVersion() const;
|
||||
virtual void validate(Version = app_version);
|
||||
private:
|
||||
DECLARE_REFLECTION();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
template <typename T>
|
||||
String serialize_for_clipboard(Package& package, T& object) {
|
||||
shared_ptr<wxStringOutputStream> stream( new wxStringOutputStream );
|
||||
Writer writer(stream);
|
||||
Writer writer(stream, file_version_clipboard);
|
||||
WITH_DYNAMIC_ARG(clipboard_package, &package);
|
||||
writer.handle(object);
|
||||
return stream->GetString();
|
||||
|
||||
@@ -39,6 +39,7 @@ bool Game::isMagic() const {
|
||||
|
||||
String Game::typeNameStatic() { return _("game"); }
|
||||
String Game::typeName() const { return _("game"); }
|
||||
Version Game::fileVersion() const { return file_version_game; }
|
||||
|
||||
IMPLEMENT_REFLECTION(Game) {
|
||||
REFLECT_BASE(Packaged);
|
||||
|
||||
@@ -69,6 +69,7 @@ class Game : public Packaged {
|
||||
|
||||
static String typeNameStatic();
|
||||
virtual String typeName() const;
|
||||
Version fileVersion() const;
|
||||
|
||||
protected:
|
||||
virtual void validate(Version);
|
||||
|
||||
@@ -35,6 +35,7 @@ DECLARE_POINTER_TYPE(wxZipInputStream);
|
||||
// ----------------------------------------------------------------------------- : Installer
|
||||
|
||||
String Installer::typeName() const { return _("installer"); }
|
||||
Version Installer::fileVersion() const { return file_version_installer; }
|
||||
|
||||
IMPLEMENT_REFLECTION(Installer) {
|
||||
REFLECT_BASE(Packaged);
|
||||
|
||||
@@ -45,6 +45,7 @@ class Installer : public Packaged {
|
||||
|
||||
protected:
|
||||
String typeName() const;
|
||||
Version fileVersion() const;
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ DECLARE_TYPEOF(map<String COMMA SubLocaleP>);
|
||||
LocaleP the_locale;
|
||||
|
||||
String Locale::typeName() const { return _("locale"); }
|
||||
Version Locale::fileVersion() const { return file_version_locale; }
|
||||
|
||||
LocaleP Locale::byName(const String& name) {
|
||||
return package_manager.open<Locale>(name + _(".mse-locale"));
|
||||
|
||||
@@ -51,6 +51,7 @@ class Locale : public Packaged {
|
||||
|
||||
protected:
|
||||
String typeName() const;
|
||||
Version fileVersion() const;
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
|
||||
@@ -119,6 +119,7 @@ String Set::identification() const {
|
||||
|
||||
|
||||
String Set::typeName() const { return _("set"); }
|
||||
Version Set::fileVersion() const { return file_version_set; }
|
||||
|
||||
// fix values for versions < 0.2.7
|
||||
void fix_value_207(const ValueP& value) {
|
||||
|
||||
@@ -113,6 +113,7 @@ class Set : public Packaged {
|
||||
void clearOrderCache();
|
||||
|
||||
virtual String typeName() const;
|
||||
Version fileVersion() const;
|
||||
/// Validate that the set is correctly loaded
|
||||
virtual void validate(Version = app_version);
|
||||
|
||||
|
||||
@@ -277,6 +277,6 @@ void Settings::read() {
|
||||
}
|
||||
|
||||
void Settings::write() {
|
||||
Writer writer(new_shared1<wxFileOutputStream>(settingsFile()));
|
||||
Writer writer(new_shared1<wxFileOutputStream>(settingsFile()), app_version);
|
||||
writer.handle(*this);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ String StyleSheet::stylesheetName() const {
|
||||
|
||||
String StyleSheet::typeNameStatic() { return _("style"); }
|
||||
String StyleSheet::typeName() const { return _("style"); }
|
||||
Version StyleSheet::fileVersion() const { return file_version_stylesheet; }
|
||||
|
||||
void StyleSheet::validate(Version ver) {
|
||||
Packaged::validate(ver);
|
||||
|
||||
@@ -64,6 +64,7 @@ class StyleSheet : public Packaged {
|
||||
|
||||
static String typeNameStatic();
|
||||
virtual String typeName() const;
|
||||
Version fileVersion() const;
|
||||
/// Validate the stylesheet
|
||||
virtual void validate(Version = app_version);
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ SymbolFont::~SymbolFont() {
|
||||
|
||||
String SymbolFont::typeNameStatic() { return _("symbol-font"); }
|
||||
String SymbolFont::typeName() const { return _("symbol-font"); }
|
||||
Version SymbolFont::fileVersion() const { return file_version_symbol_font; }
|
||||
|
||||
SymbolFontP SymbolFont::byName(const String& name) {
|
||||
return package_manager.open<SymbolFont>(
|
||||
|
||||
@@ -70,6 +70,7 @@ class SymbolFont : public Packaged {
|
||||
|
||||
static String typeNameStatic();
|
||||
virtual String typeName() const;
|
||||
Version fileVersion() const;
|
||||
|
||||
/// Generate a 'insert symbol' menu.
|
||||
/** This class owns the menu!
|
||||
|
||||
@@ -237,7 +237,7 @@ void SymbolWindow::onFileSave(wxCommandEvent& ev) {
|
||||
void SymbolWindow::onFileSaveAs(wxCommandEvent& ev) {
|
||||
String name = wxFileSelector(_("Save symbol"),_(""),_(""),_(""),_("Symbol files (*.mse-symbol)|*.mse-symbol"),wxSAVE, this);
|
||||
if (!name.empty()) {
|
||||
Writer writer(new_shared1<wxFileOutputStream>(name));
|
||||
Writer writer(new_shared1<wxFileOutputStream>(name), file_version_symbol);
|
||||
writer.handle(control->getSymbol());
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ void SymbolWindow::onFileStore(wxCommandEvent& ev) {
|
||||
SymbolValueP value = static_pointer_cast<SymbolValue>(performer->value);
|
||||
Package& package = performer->getLocalPackage();
|
||||
FileName new_filename = package.newFileName(value->field().name,_(".mse-symbol")); // a new unique name in the package
|
||||
Writer writer(package.openOut(new_filename));
|
||||
Writer writer(package.openOut(new_filename), file_version_symbol);
|
||||
writer.handle(control->getSymbol());
|
||||
performer->addAction(value_action(value, new_filename));
|
||||
}
|
||||
|
||||
@@ -193,15 +193,15 @@ expected_locale_keys TEXT "../common/expected_locale_keys"
|
||||
// -------------------------------------------------------- : Version info
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 0,3,6,1
|
||||
PRODUCTVERSION 0,3,6,1
|
||||
FILEVERSION 0,3,7,0
|
||||
PRODUCTVERSION 0,3,7,0
|
||||
FILETYPE VFT_APP
|
||||
{
|
||||
BLOCK "StringFileInfo"
|
||||
{
|
||||
BLOCK "040904E4"
|
||||
{
|
||||
VALUE "FileVersion", "0.3.6b"
|
||||
VALUE "FileVersion", "0.3.7"
|
||||
VALUE "License", "GNU General Public License 2 or later; This is free software, and you are welcome to redistribute it under certain conditions; See the help file for details"
|
||||
VALUE "FileDescription", "Magic Set Editor"
|
||||
VALUE "InternalName", "mse2/8"
|
||||
|
||||
@@ -30,7 +30,6 @@ class GetDefaultMember {
|
||||
inline bool isComplex() const { return false; }
|
||||
inline void addAlias(int, const Char*, const Char*) {}
|
||||
inline void handleIgnore(int, const Char*) {}
|
||||
inline void handleAppVersion() {} // no effect
|
||||
|
||||
/// The result, or script_nil if the member was not found
|
||||
inline ScriptValueP result() { return value; }
|
||||
@@ -78,7 +77,6 @@ class GetMember : private GetDefaultMember {
|
||||
inline bool isComplex() const { return false; }
|
||||
inline void addAlias(int, const Char*, const Char*) {}
|
||||
inline void handleIgnore(int, const Char*) {}
|
||||
inline void handleAppVersion() {} // no effect
|
||||
|
||||
/// The result, or script_nil if the member was not found
|
||||
inline ScriptValueP result() { return gdm.result(); }
|
||||
|
||||
@@ -530,13 +530,13 @@ void Packaged::loadFully() {
|
||||
|
||||
void Packaged::save() {
|
||||
WITH_DYNAMIC_ARG(writing_package, this);
|
||||
writeFile(typeName(), *this);
|
||||
writeFile(typeName(), *this, fileVersion());
|
||||
referenceFile(typeName());
|
||||
Package::save();
|
||||
}
|
||||
void Packaged::saveAs(const String& package, bool remove_unused) {
|
||||
WITH_DYNAMIC_ARG(writing_package, this);
|
||||
writeFile(typeName(), *this);
|
||||
writeFile(typeName(), *this, fileVersion());
|
||||
referenceFile(typeName());
|
||||
Package::saveAs(package, remove_unused);
|
||||
}
|
||||
@@ -574,6 +574,7 @@ void Packaged::requireDependency(Packaged* package) {
|
||||
// ----------------------------------------------------------------------------- : IncludePackage
|
||||
|
||||
String IncludePackage::typeName() const { return _("include"); }
|
||||
Version IncludePackage::fileVersion() const { return file_version_script; }
|
||||
|
||||
IMPLEMENT_REFLECTION(IncludePackage) {
|
||||
REFLECT_BASE(Packaged);
|
||||
|
||||
@@ -133,8 +133,8 @@ class Package : public IntrusivePtrVirtualBase {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void writeFile(const String& file, const T& obj) {
|
||||
Writer writer(openOut(file));
|
||||
void writeFile(const String& file, const T& obj, Version file_version) {
|
||||
Writer writer(openOut(file), file_version);
|
||||
writer.handle(obj);
|
||||
}
|
||||
|
||||
@@ -229,6 +229,8 @@ class Packaged : public Package {
|
||||
virtual String typeName() const = 0;
|
||||
/// Can be overloaded to do validation after loading
|
||||
virtual void validate(Version file_app_version);
|
||||
/// What file version should be used for writing files?
|
||||
virtual Version fileVersion() const = 0;
|
||||
|
||||
DECLARE_REFLECTION_VIRTUAL();
|
||||
|
||||
@@ -244,6 +246,7 @@ class Packaged : public Package {
|
||||
class IncludePackage : public Packaged {
|
||||
protected:
|
||||
String typeName() const;
|
||||
Version fileVersion() const;
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
|
||||
@@ -310,7 +310,7 @@ void PackageDirectory::loadDatabase() {
|
||||
}
|
||||
|
||||
void PackageDirectory::saveDatabase() {
|
||||
Writer writer(new_shared1<wxFileOutputStream>(databaseFile()));
|
||||
Writer writer(new_shared1<wxFileOutputStream>(databaseFile()), app_version);
|
||||
writer.handle(*this);
|
||||
}
|
||||
String PackageDirectory::databaseFile() {
|
||||
|
||||
@@ -15,18 +15,15 @@
|
||||
|
||||
// ----------------------------------------------------------------------------- : Writer
|
||||
|
||||
Writer::Writer(const OutputStreamP& output)
|
||||
Writer::Writer(const OutputStreamP& output, Version file_app_version)
|
||||
: indentation(0), just_opened(false)
|
||||
, output(output), stream(*output)
|
||||
{
|
||||
stream.WriteString(BYTE_ORDER_MARK);
|
||||
handleAppVersion();
|
||||
handle(_("mse_version"), file_app_version);
|
||||
}
|
||||
|
||||
|
||||
void Writer::handleAppVersion() {
|
||||
handle(_("mse_version"), app_version);
|
||||
}
|
||||
|
||||
void Writer::enterBlock(const Char* name) {
|
||||
// indenting into a sub-block?
|
||||
|
||||
@@ -26,7 +26,7 @@ typedef shared_ptr<wxOutputStream> OutputStreamP;
|
||||
class Writer {
|
||||
public:
|
||||
/// Construct a writer that writes to the given output stream
|
||||
Writer(const OutputStreamP& output);
|
||||
Writer(const OutputStreamP& output, Version file_app_version);
|
||||
|
||||
/// Tell the reflection code we are not reading
|
||||
inline bool reading() const { return false; }
|
||||
@@ -35,9 +35,6 @@ class Writer {
|
||||
inline void addAlias(int, const Char*, const Char*) {}
|
||||
inline void handleIgnore(int, const Char*) {}
|
||||
|
||||
/// Write the application version
|
||||
void handleAppVersion();
|
||||
|
||||
// --------------------------------------------------- : Handling objects
|
||||
/// Handle an object: write it under the given name
|
||||
template <typename T>
|
||||
|
||||
+16
-3
@@ -50,14 +50,18 @@ template <> void GetDefaultMember::handle(const Version& v) {
|
||||
// ----------------------------------------------------------------------------- : Versions
|
||||
|
||||
// NOTE: Don't use leading zeroes, they mean octal
|
||||
const Version app_version = 306; // 0.3.6
|
||||
const Version app_version = 307; // 0.3.7
|
||||
#ifdef UNICODE
|
||||
const Char* version_suffix = _(" (beta)");
|
||||
#else
|
||||
const Char* version_suffix = _(" (beta, ascii build)");
|
||||
#endif
|
||||
|
||||
/* Changes:
|
||||
/// Which version of MSE are the files we write out compatible with?
|
||||
/* The saved files will have these version numbers attached.
|
||||
* They should be updated whenever a change breaks backwards compatability.
|
||||
*
|
||||
* Changes:
|
||||
* 0.2.0 : start of version numbering practice
|
||||
* 0.2.2 : _("include file")
|
||||
* 0.2.6 : fix in settings loading
|
||||
@@ -70,4 +74,13 @@ const Char* version_suffix = _(" (beta, ascii build)");
|
||||
* 0.3.5 : word lists, symbol font 'as text'
|
||||
* 0.3.6 : free rotation, rotation behaviour changed.
|
||||
*/
|
||||
const Version file_version = 306; // 0.3.6
|
||||
const Version file_version_locale = 307; // 0.3.7
|
||||
const Version file_version_set = 306; // 0.3.6
|
||||
const Version file_version_game = 307; // 0.3.7
|
||||
const Version file_version_stylesheet = 307; // 0.3.7
|
||||
const Version file_version_symbol_font = 306; // 0.3.6
|
||||
const Version file_version_export_template = 307; // 0.3.7
|
||||
const Version file_version_installer = 307; // 0.3.7
|
||||
const Version file_version_symbol = 305; // 0.3.5
|
||||
const Version file_version_clipboard = 306; // 0.3.6
|
||||
const Version file_version_script = 307; // 0.3.7
|
||||
|
||||
+11
-2
@@ -50,10 +50,19 @@ struct Version {
|
||||
extern const Version app_version;
|
||||
extern const Char* version_suffix;
|
||||
|
||||
/// File version, usually the same as program version,
|
||||
/// Which version of MSE are the files we write out compatible with?
|
||||
/** When no files are changed the file version is not incremented
|
||||
*/
|
||||
extern const Version file_version;
|
||||
extern const Version file_version_locale;
|
||||
extern const Version file_version_set;
|
||||
extern const Version file_version_game;
|
||||
extern const Version file_version_stylesheet;
|
||||
extern const Version file_version_symbol_font;
|
||||
extern const Version file_version_export_template;
|
||||
extern const Version file_version_installer;
|
||||
extern const Version file_version_symbol;
|
||||
extern const Version file_version_clipboard;
|
||||
extern const Version file_version_script;
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user