feat: revert hack for time card columns, use scripts instead

This commit is contained in:
Brendan Hagan
2022-06-20 21:06:27 -04:00
parent f9525fab82
commit 4173d5017b
5 changed files with 273 additions and 309 deletions
+268 -268
View File
@@ -1,5 +1,5 @@
Magic Set Editor changelog, for the details see `git log` Magic Set Editor changelog, for the details see `git log`
============================================================================== ==============================================================================
FORK: Changes isolated to this fork FORK: Changes isolated to this fork
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
@@ -8,271 +8,271 @@ Features:
* Independently control Export Zoom setting in Preferences Window. * Independently control Export Zoom setting in Preferences Window.
* Center the loaded image by default in the Image Slice Window. * Center the loaded image by default in the Image Slice Window.
* Add Button to Center the loaded image in the Image Slice Window. * Add Button to Center the loaded image in the Image Slice Window.
* Add "Created At", "Last Modified At", "Has Notes" columns to card list. * Add "Created At", "Last Modified At" columns to card list.
* Add filter box to Game and Stylesheet selection. * Add filter box to Game and Stylesheet selection.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
HEAD: new items added as changes are made HEAD: new items added as changes are made
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Features: Features:
* You can now check/uncheck all selected cards in the export window (#93) * You can now check/uncheck all selected cards in the export window (#93)
Template features: Template features:
* Localization of game/stylesheet/symbol_font names is now done in those templates, instead of via the program-wide locale file. (#100) * Localization of game/stylesheet/symbol_font names is now done in those templates, instead of via the program-wide locale file. (#100)
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 2.1.2, 2020-09-28 version 2.1.2, 2020-09-28
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Bug fixes: Bug fixes:
* Fixed: crash in expand_keywords when given empty tags (#90) * Fixed: crash in expand_keywords when given empty tags (#90)
* Fixed: tab traversal in native look editors (style and set info tabs) (#98) * Fixed: tab traversal in native look editors (style and set info tabs) (#98)
* Fixed: Mana Symbol Menu Items were not using names from locale (#84) * Fixed: Mana Symbol Menu Items were not using names from locale (#84)
* Auto replaces that match "" are now disabled * Auto replaces that match "" are now disabled
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 2.1.1, 2020-06-14 version 2.1.1, 2020-06-14
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Features: Features:
* Sorting of the card list can now be changed per window * Sorting of the card list can now be changed per window
Bug fixes: Bug fixes:
* Fixed: keywords after atoms were not showing up (#67) * Fixed: keywords after atoms were not showing up (#67)
* Fixed: multiple keywords that matched in the same place both showed reminder text. (#70) * Fixed: multiple keywords that matched in the same place both showed reminder text. (#70)
Now, when there are overlapping matches the longest one is used. Now, when there are overlapping matches the longest one is used.
* Fixed: Slice Image window defaulting to Force to Fit (#69) * Fixed: Slice Image window defaulting to Force to Fit (#69)
* Fixed: Wide set symbols being shrunk down (#68) * Fixed: Wide set symbols being shrunk down (#68)
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 2.1.0, 2020-06-01 version 2.1.0, 2020-06-01
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Features: Features:
* In the quick search box you can specify which field to search in, * In the quick search box you can specify which field to search in,
for example `type:Wizard` searches for cards with Wizard in the type. for example `type:Wizard` searches for cards with Wizard in the type.
* Added "Select All" to menu (#19) * Added "Select All" to menu (#19)
* Added "Save as Directory" to menu * Added "Save as Directory" to menu
* Added a keyboard shortcut for the search box (Ctrl+K) * Added a keyboard shortcut for the search box (Ctrl+K)
Bug fixes: Bug fixes:
* Keywords that appear multiple times don't mess up reminder text (#20) * Keywords that appear multiple times don't mess up reminder text (#20)
* card variable in console panel now refers to the selected card * card variable in console panel now refers to the selected card
* length function now gives correct results for maps * length function now gives correct results for maps
* substr("foo",begin:3) now returns "" instead of true * substr("foo",begin:3) now returns "" instead of true
Template features: Template features:
* Added `<font:...>` tag to change the font inside a text field. * Added `<font:...>` tag to change the font inside a text field.
* Added `<margin:...>` tag to change the margins of a block of text. * Added `<margin:...>` tag to change the margins of a block of text.
* Added `<align:...>` tag to change the horizontal alignment of a block of text. * Added `<align:...>` tag to change the horizontal alignment of a block of text.
* Added `<li>` tag for list bullet points. (Experimental!) * Added `<li>` tag for list bullet points. (Experimental!)
* Colors can now be written using hex notation, `#rrggbb` / `#rrggbbaa`, and short hex notation (`#rgb` / `#rgba`) * Colors can now be written using hex notation, `#rrggbb` / `#rrggbbaa`, and short hex notation (`#rgb` / `#rgba`)
* Added card_style.field.layout, with information on the position of each line and paragraph in a text box. * Added card_style.field.layout, with information on the position of each line and paragraph in a text box.
* It is now possible to set the width and height of set info and style fields. This is especially useful for set specific images like watermarks and symbols. * It is now possible to set the width and height of set info and style fields. This is especially useful for set specific images like watermarks and symbols.
Scripting: Scripting:
* Added type_name function * Added type_name function
* `nil != ""`, so missing values are no longer equal to the empty string * `nil != ""`, so missing values are no longer equal to the empty string
* The `=` operator is now deprecated, use `==` for comparisons, `:=` for assignment. * The `=` operator is now deprecated, use `==` for comparisons, `:=` for assignment.
* if statements without an else will now produce a warning if their result is used. * if statements without an else will now produce a warning if their result is used.
* Added case-of control structure, for comparing a value against multiple alternatives * Added case-of control structure, for comparing a value against multiple alternatives
Internal: Internal:
* Switch build system to to CMake * Switch build system to to CMake
* Update code to work with wxWidgets 3.1 and C++ 17 * Update code to work with wxWidgets 3.1 and C++ 17
* Lots of code cleanup * Lots of code cleanup
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 2.0.1 version 2.0.1
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
* Some bugfixes * Some bugfixes
Other Other
* Changes to build system * Changes to build system
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 2.0.0, 2011-02-05 version 2.0.0, 2011-02-05
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Program: Program:
* Added operators ("" and -) to quick search * Added operators ("" and -) to quick search
* Added quick search for keywords (#58) * Added quick search for keywords (#58)
* Added "Console" panel * Added "Console" panel
* Error message handling moved to console * Error message handling moved to console
* fixed #56: The quick search bar doesn't look in card.notes. * fixed #56: The quick search bar doesn't look in card.notes.
* fixed #59: Keywords with special characters don't work. * fixed #59: Keywords with special characters don't work.
* fixed: Selection in package lists (new set window and style tab) is not highlighted. * fixed: Selection in package lists (new set window and style tab) is not highlighted.
Templates: Templates:
* no changes * no changes
Other: Other:
* Actually started maintaining changelog, older entries are reconstructed. * Actually started maintaining changelog, older entries are reconstructed.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.9, 2011-01-07 version 0.3.9, 2011-01-07
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Program: Program:
* Added quick search box for filtering the card list * Added quick search box for filtering the card list
* Win32: themed selection rectangles in GallaryList (broken) * Win32: themed selection rectangles in GallaryList (broken)
* Win32: themed selection rectangles in Card/KeywordList * Win32: themed selection rectangles in Card/KeywordList
* bug fixes: #18,#19, #16,#24,#25,28, #13,#14,#51 * bug fixes: #18,#19, #16,#24,#25,28, #13,#14,#51
Templates: Templates:
* Magic: new keywords and various minor updates * Magic: new keywords and various minor updates
Other: Other:
* This is the first new release in nearly two years * This is the first new release in nearly two years
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.8, 2009-01-15 version 0.3.8, 2009-01-15
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
New in this release: New in this release:
* A spelling checker. * A spelling checker.
* Improved random booster pack generator. * Improved random booster pack generator.
* A bit of support for different languages in templates. * A bit of support for different languages in templates.
* Improvements in text alignment. * Improvements in text alignment.
* Many other small improvements. * Many other small improvements.
* And of course lots of bug fixes. * And of course lots of bug fixes.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.7b, 2008-08-11 version 0.3.7b, 2008-08-11
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
* This release fixes some semi-critical bugs in 0.3.7b. * This release fixes some semi-critical bugs in 0.3.7b.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.7, 2008-08-11 version 0.3.7, 2008-08-11
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
New in this release: New in this release:
* A random booster pack generator. * A random booster pack generator.
* A command line interface for connecting MSE with other programs. * A command line interface for connecting MSE with other programs.
* Many other minor improvements. * Many other minor improvements.
* And of course lots of bug fixes. * And of course lots of bug fixes.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.6b, 2008-06-02 version 0.3.6b, 2008-06-02
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
* This release fixes some critical bugs in 0.3.6. * This release fixes some critical bugs in 0.3.6.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.6, 2008-06-01 version 0.3.6, 2008-06-01
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
New in this release: New in this release:
* 2/R mana symbols and , the reverse tap symbol. * 2/R mana symbols and , the reverse tap symbol.
* Customizable set statistics. * Customizable set statistics.
* Improved printing quality. * Improved printing quality.
* User friendly system for installing templates. * User friendly system for installing templates.
* Support for arbitrarily rotated text in templates. * Support for arbitrarily rotated text in templates.
* Support for changing font size and color in templates. * Support for changing font size and color in templates.
* Many, many bug fixes and minor improvements. * Many, many bug fixes and minor improvements.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.5b, 2007-09-21 version 0.3.5b, 2007-09-21
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
* This release fixes some critical bugs in 0.3.5. * This release fixes some critical bugs in 0.3.5.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.5, 2007-09-20 version 0.3.5, 2007-09-20
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
New in this release: New in this release:
* Future sight templates. * Future sight templates.
* Planeswalker template. * Planeswalker template.
* HTML export for VS-System. * HTML export for VS-System.
* New style VS-System templates. * New style VS-System templates.
* Many, many bug fixes and minor improvements. * Many, many bug fixes and minor improvements.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.4, 2007-07-05 version 0.3.4, 2007-07-05
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
New in this release: New in this release:
* Export to HTML. * Export to HTML.
* New color combination dialog for magic. * New color combination dialog for magic.
* Modern style magic tokens. * Modern style magic tokens.
* VS-System hellboy templates. * VS-System hellboy templates.
* and of course lots of minor improvements and bugfixes. * and of course lots of minor improvements and bugfixes.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.3, 2007-05-14 version 0.3.3, 2007-05-14
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
* The crashes are finally fixed. * The crashes are finally fixed.
* All keyword problems are fixed. * All keyword problems are fixed.
* Two dimensional statistics (e.g. color vs. rarity) * Two dimensional statistics (e.g. color vs. rarity)
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.2, 2007-05-11 version 0.3.2, 2007-05-11
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
* The templates have recieved a large update. * The templates have recieved a large update.
* The large bugs from the previous version are fixed. * The large bugs from the previous version are fixed.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.1, 2007-04-21 version 0.3.1, 2007-04-21
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
* The most important new thing are the keywords. You can now make keywords with multiple parameters. * The most important new thing are the keywords. You can now make keywords with multiple parameters.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.3.0(NQMSE), 2006-12-25 version 0.3.0(NQMSE), 2006-12-25
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Version 0.3.0, prerelease. Version 0.3.0, prerelease.
* no keywords * no keywords
* no printing * no printing
* no export * no export
* no search/replace * no search/replace
* no help * no help
* no windows 9x build * no windows 9x build
* lots of new bugs * lots of new bugs
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.2.7, 2006-08-04 version 0.2.7, 2006-08-04
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
New features: New features:
* Buttons for making text bold/italic * Buttons for making text bold/italic
* Good looking guild watermarks * Good looking guild watermarks
* Yu-Gi-Oh templates (by artfreakwiu) * Yu-Gi-Oh templates (by artfreakwiu)
Bug fixes / template tweaks: Bug fixes / template tweaks:
* Correct snow mana symbol * Correct snow mana symbol
* Fixed crash when creating new set * Fixed crash when creating new set
* Settings of styles are finally saved correctly * Settings of styles are finally saved correctly
* The latest VS System templates * The latest VS System templates
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.2.6, 2006-07-18 version 0.2.6, 2006-07-18
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Bug fixes: Bug fixes:
* Duplicate text in keyword reminder text * Duplicate text in keyword reminder text
* Reminder text of Scry * Reminder text of Scry
* Not remembering zoom, and border display settings * Not remembering zoom, and border display settings
* Crash when deleting cards * Crash when deleting cards
* Drawing glitches under windows 9x * Drawing glitches under windows 9x
* Support for symbols with transparency * Support for symbols with transparency
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
version 0.2.5, 2006-06-25 version 0.2.5, 2006-06-25
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
New features: New features:
* Improved high quality rendering * Improved high quality rendering
* Improved statistics/graphs * Improved statistics/graphs
* Smart keywords, numbers are written with words, for example Graft 2 (This creature comes into play with two +1/+1 counters on it...). To use this with your own keywords all you need to do is say "counter(s)". * Smart keywords, numbers are written with words, for example Graft 2 (This creature comes into play with two +1/+1 counters on it...). To use this with your own keywords all you need to do is say "counter(s)".
Bug fixes: Bug fixes:
* Card sizes are now changed correctly when using different styles * Card sizes are now changed correctly when using different styles
* The infamous 'n' keyword bug * The infamous 'n' keyword bug
* Probably more Some template tweaks * Probably more Some template tweaks
+2 -10
View File
@@ -1325,6 +1325,7 @@ card field:
show statistics: false show statistics: false
save value: false save value: false
editable: false editable: false
script: card.time_created
card list visible: true card list visible: true
card list name: Created At card list name: Created At
card list column: 100 card list column: 100
@@ -1335,17 +1336,8 @@ card field:
show statistics: false show statistics: false
save value: false save value: false
editable: false editable: false
script: card.time_modified
card list visible: true card list visible: true
card list name: Last Modified At card list name: Last Modified At
card list column: 101 card list column: 101
card list width: 150 card list width: 150
card field:
type: text
name: has notes
show statistics: false
save value: false
editable: false
card list visible: true
card list name: Has Notes
card list column: 102
card list width: 50
-18
View File
@@ -52,24 +52,6 @@ String Card::identification() const {
} }
} }
String Card::valueOfDataKey(FieldP fieldP) {
String columnName = fieldP.get()->name;
if (columnName == "time_created") {
return time_created.Format("%Y-%m-%d %H:%M:%S").ToStdString();
}
else if (columnName == "time_modified") {
return time_modified.Format("%Y-%m-%d %H:%M:%S").ToStdString();
}
else if (columnName == "has_notes") {
return notes.empty() ? "N" : "Y";
}
ValueP val = data[fieldP];
if (val) return val->toString();
else return wxEmptyString;
}
bool Card::contains(QuickFilterPart const& query) const { bool Card::contains(QuickFilterPart const& query) const {
FOR_EACH_CONST(v, data) { FOR_EACH_CONST(v, data) {
if (query.match(v->fieldP->name, v->toString())) return true; if (query.match(v->fieldP->name, v->toString())) return true;
-3
View File
@@ -61,9 +61,6 @@ public:
/// Get the identification of this card, an identification is something like a name, title, etc. /// Get the identification of this card, an identification is something like a name, title, etc.
/** May return "" */ /** May return "" */
String identification() const; String identification() const;
String valueOfDataKey(FieldP fieldP);
/// Does any field contains the given query string? /// Does any field contains the given query string?
bool contains(QuickFilterPart const& query) const; bool contains(QuickFilterPart const& query) const;
+3 -10
View File
@@ -186,17 +186,9 @@ bool CardListBase::doDelete() {
// Comparison object for comparing cards // Comparison object for comparing cards
bool CardListBase::compareItems(void* a, void* b) const { bool CardListBase::compareItems(void* a, void* b) const {
FieldP sort_field = column_fields[sort_by_column]; FieldP sort_field = column_fields[sort_by_column];
ValueP va = reinterpret_cast<Card*>(a)->data[sort_field]; ValueP va = reinterpret_cast<Card*>(a)->data[sort_field];
ValueP vb = reinterpret_cast<Card*>(b)->data[sort_field]; ValueP vb = reinterpret_cast<Card*>(b)->data[sort_field];
assert(va && vb); assert(va && vb);
// Super hack for sorting internal fields. Couldn't figure out how to bind these to ValuePs.
if (sort_field->name == "time_created" || sort_field->name == "time_modified" || sort_field->name == "has_notes") {
int cmp = smart_compare(reinterpret_cast<Card*>(a)->valueOfDataKey(sort_field), reinterpret_cast<Card*>(b)->valueOfDataKey(sort_field));
if (cmp != 0) return cmp < 0;
}
// compare sort keys // compare sort keys
int cmp = smart_compare( va->getSortKey(), vb->getSortKey() ); int cmp = smart_compare( va->getSortKey(), vb->getSortKey() );
if (cmp != 0) return cmp < 0; if (cmp != 0) return cmp < 0;
@@ -317,8 +309,9 @@ String CardListBase::OnGetItemText(long pos, long col) const {
// wx may give us non existing columns! // wx may give us non existing columns!
return wxEmptyString; return wxEmptyString;
} }
ValueP val = getCard(pos)->data[column_fields[col]];
return getCard(pos)->valueOfDataKey(column_fields[col]); if (val) return val->toString();
else return wxEmptyString;
} }
int CardListBase::OnGetItemImage(long pos) const { int CardListBase::OnGetItemImage(long pos) const {