35 Commits

Author SHA1 Message Date
GenevensiS d9b58bb5eb Selection highlight debug for linux
this is not optimized but it'll do for now
2026-06-05 05:08:57 +02:00
GenevensiS 512a237f39 fix keywords panel 2026-06-05 02:45:56 +02:00
GenevensiS 1a64496206 fix bug not loading links correctly 2026-05-27 20:30:38 +02:00
GenevensiS 23463c4b96 don't print scientific notation in to_json 2026-05-24 16:14:13 +02:00
GenevensiS 6f526a81f1 fix link window appearing on wrong monitor 2026-05-24 13:25:26 +02:00
GenevensiS ae02c71be6 console and to_json function now accept stylesheets, games and style index maps 2026-05-20 15:50:54 +02:00
GenevensiS c531b8aa74 Add option to download missing stylesheets on startup 2026-05-18 23:31:39 +02:00
GenevensiS 2f77e8c4c1 fix compile 2026-05-15 18:23:27 +02:00
GenevensiS 754ca3bccf add "update group" buttons to package manager 2026-05-15 15:37:56 +02:00
GenevensiS 8fadb1f099 fix compile 2026-05-14 19:24:35 +02:00
GenevensiS a335b730ca apply update scripts in correct order 2026-05-14 19:00:50 +02:00
GenevensiS 76af996f0a tweaks
allow import_image to accept script images
import_image and download_image no longer save the set or require it to have been saved once
console panel now tries to output toJson() before falling back to toCode()
2026-05-14 13:50:02 +02:00
GenevensiS 6f4fc0066d update locales 2026-05-13 18:11:08 +02:00
GenevensiS 151a04909a Add update_cards_scripts 2026-05-13 18:09:56 +02:00
GenevensiS f4fe9ab6b0 Strengthen paste logic 2026-05-11 13:51:43 +02:00
GenevensiS 2135a14b17 FINE I'll do it myself 2026-05-11 13:11:37 +02:00
GenevensiS 72830ec218 Update viewer.cpp 2026-05-11 11:57:16 +02:00
GenevensiS b13de8e099 add "version_is_older" script function 2026-05-11 10:29:29 +02:00
GenevensiS 24abf8fe86 add "exists_as_package" script function 2026-05-11 09:32:13 +02:00
GenevensiS 19b144f37b restore ability to paste in Paint 2026-05-10 09:39:19 +02:00
GenevensiS 50b649beca add "add double faced card" menu option 2026-05-09 19:42:19 +02:00
GenevensiS d79e8afb56 add new_uid script function 2026-05-09 18:10:59 +02:00
GenevensiS d4efc5b973 improve blending error messages 2026-05-07 11:34:15 +02:00
GenevensiS 9b51ca0537 tweak text highlight logic 2026-05-05 08:51:27 +02:00
GenevensiS 8a86778bfb refactor card copy pasting 2026-05-04 12:15:13 +02:00
GenevensiS 3c2c3ac977 fake stable sort on card list 2026-05-04 07:01:52 +02:00
GenevensiS db1fd4f343 fix copy pasting bugs 2026-05-04 05:27:11 +02:00
GenevensiS 8cc17abecc add card uid map 2026-05-04 02:21:33 +02:00
GenevensiS 9a5be16e4e fix bug with image decoding 2026-05-03 05:03:08 +02:00
GenevensiS 05d205cafa update locales 2026-04-26 21:13:02 +02:00
GenevensiS 8c0e5f3e71 add info to package manager window 2026-04-26 21:01:42 +02:00
GenevensiS 72724a35c7 allow set_alpha to handle values > 1.0 2026-04-24 15:27:21 +02:00
GenevensiS 0baa73ae7d fix bugs
- dimensions_of should now work in all contexts
- import_image now works in style files, although should be avoided, since it reloads the file every time the code in run, it should be used in one shot scripts, like import scripts and bulk modification scripts
- process_english_hints now correctly processes <singular> and <plural> tags
2026-04-24 13:18:40 +02:00
GenevensiS d782e4851c add is_default script function 2026-04-19 19:06:52 +02:00
GenevensiS 17dd3cf407 add exceptions to english_plural and english_singular 2026-04-19 16:04:20 +02:00
133 changed files with 3774 additions and 1199 deletions
+3 -4
View File
@@ -27,10 +27,9 @@ if( NOT HUNSPELL_FOUND )
endif()
endif()
# You will most likely get a message about being unable to open hunspell-1.7.lib because pkgconf forgets to add the actual path to
# HUNSPELL_LIBRARIES. If so, uncomment the below line and point it to the correct vcpkg root folder/library.
# You will most likely get a message about being unable to open hunspell-1.7.lib because pkgconf forgets to add the actual path to HUNSPELL_LIBRARIES.
# If so, uncomment the below line and point it to the correct vcpkg root folder/library. (For debug builds, add "debug\\" just before "lib\\")
#set(HUNSPELL_LIBRARIES "C:\\PATH\\TO\\ROOT\\vcpkg\\installed\\${VCPKG_TARGET_TRIPLET}\\lib\\hunspell-1.7.lib")
message("-- Does this have a full path? If not, and it's just a file name, it's broken: Found Hunspell at ${HUNSPELL_LIBRARIES}")
include_directories("${PROJECT_BINARY_DIR}/src")
include_directories("${PROJECT_SOURCE_DIR}/src")
@@ -143,4 +142,4 @@ endif()
include(test/tests.cmake)
# Debug Message
message("-- Does this have a full path? If not, and it's just a file name, it's broken: Found Hunspell at ${HUNSPELL_LIBRARIES}")
message("-- Does this have a full path? If not, and it's just a file name, it's broken: ${HUNSPELL_LIBRARIES}")
+18
View File
@@ -18,6 +18,24 @@
}
]
},
{
"name": "x64-Debug-static",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "-DVCPKG_TARGET_TRIPLET=x64-windows-static",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "VCPKG_MANIFEST_FEATURES",
"value": "fonts",
"type": "STRING"
}
]
},
{
"name": "x86-Debug",
"generator": "Ninja",
+36 -2
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/chinese simplified
full name: 简体中文 (Simplified Chinese)
version: 2026-02-28
@@ -54,6 +54,8 @@ menu:
next card: 选择下一张卡牌 PgDn
search cards: 搜索卡 Ctrl+K
add card: 添加卡牌 Ctrl+Enter
#TODO: Localize
add card double: &Add Double Faced Card Ctrl+Shift+Enter
add cards: 批量添加卡牌...
remove card: 删除所选卡牌
#TODO: Localize
@@ -208,6 +210,8 @@ help:
next card: 选择列表中的下一张卡牌
search cards: 使用搜索词过滤卡片列表
add card: 添加一个新的空白卡牌到本套牌
#TODO: Localize
add card double: Add a new, blank, card that has a back face to this set
add cards: 添加多张卡牌到本套牌
remove card: 从本套牌中删除所选卡牌
#TODO: Localize
@@ -468,6 +472,8 @@ tooltip:
# cards toolbar
add card: 添加卡牌
#TODO: Localize
add card double: Add double faced card
remove card: 移除选中卡牌
#TODO: Localize
link card: Link cards to selected card
@@ -614,6 +620,16 @@ label:
stylesheet not found:
你要打开的套牌使用的是 "%s" 样式表
这个样式表在你的系统里没有找到,请选择其他方案
#TODO: Localize
searching online: Searching online...
#TODO: Localize
searching online fail: Not found online
#TODO: Localize
found online downloading: Found online! Downloading...
#TODO: Localize
found online installing: Found online! Installing...
#TODO: Localize
found online fail: Installation failed
# preferences dialog
language: 语言
@@ -758,6 +774,8 @@ label:
installable version: 最新版本
installer size: 尺寸
installer status: 地位
#TODO: Localize
folder name: Folder name:
no version: -
#TODO: Localize
@@ -890,10 +908,16 @@ button:
upgrade package: 升级
reinstall package: 重新安装
remove package: 移除
#TODO: Localize
keep group: Keep Group As Is
install group: 全部安装
upgrade group: 全部升级
remove group: 全部移除
# stylesheet not found dialog
#TODO: Localize
find package online: Search Online
############################################################## Titles in the GUI
title:
# window titles
@@ -981,6 +1005,8 @@ action:
# cards
#TODO: Localize Section
reorder cards: Reorder cards
#TODO: Localize
update card: Update card
change link: Change link
change notes: Change notes
change id: Change ID
@@ -1052,6 +1078,12 @@ error:
file not found package like:
没有找到文件:'%s' 在 '%s' 文件包中
如果你尝试从别的文件包中打开文件, 使用以下格式"/package/filename"
#TODO: Localize
file not found package like init:
File not found: '%s' in package '%s'
If this folder is empty or unused, delete it.
#TODO: Localize
package name parse error: Unable to parse package name '%s'
file parse error:
处理文件发生错误:'%s'
%s
@@ -1130,7 +1162,9 @@ error:
# image stuff
coordinates for blending overlap: 坐标混合重叠
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+36 -2
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/chinese traditional
full name: 繁體中文 (Traditional Chinese)
version: 2026-02-28
@@ -54,6 +54,8 @@ menu:
next card: 選擇下一張卡牌 PgDn
search cards: 搜尋卡 Ctrl+K
add card: 添加卡牌 Ctrl+Enter
#TODO: Localize
add card double: &Add Double Faced Card Ctrl+Shift+Enter
add cards: 批量添加卡牌...
remove card: 刪除所選卡牌
#TODO: Localize
@@ -208,6 +210,8 @@ help:
next card: 選擇列表中的下一張卡牌
search cards: 使用搜尋字詞過濾卡片列表
add card: 添加一個新的空白卡牌到本套牌
#TODO: Localize
add card double: Add a new, blank, card that has a back face to this set
add cards: 添加多張卡牌到本套牌
remove card: 從本套牌中刪除所選卡牌
#TODO: Localize
@@ -466,6 +470,8 @@ tooltip:
# cards toolbar
add card: 添加卡牌
#TODO: Localize
add card double: Add double faced card
remove card: 移除選中卡牌
#TODO: Localize
link card: Link cards to selected card
@@ -612,6 +618,16 @@ label:
stylesheet not found:
你要打開的套牌使用的是 "%s" 樣式表
這個樣式表在你的系統里沒有找到,請選擇其他方案
#TODO: Localize
searching online: Searching online...
#TODO: Localize
searching online fail: Not found online
#TODO: Localize
found online downloading: Found online! Downloading...
#TODO: Localize
found online installing: Found online! Installing...
#TODO: Localize
found online fail: Installation failed
# preferences dialog
language: 語言
@@ -756,6 +772,8 @@ label:
installable version: 最新版本
installer size: 尺寸
installer status: 地位
#TODO: Localize
folder name: Folder name:
no version: -
#TODO: Localize
@@ -888,10 +906,16 @@ button:
upgrade package: 昇級
reinstall package: 重新安裝
remove package: 移除
#TODO: Localize
keep group: Keep Group As Is
install group: 全部安裝
upgrade group: 全部昇級
remove group: 全部移除
# stylesheet not found dialog
#TODO: Localize
find package online: Search Online
############################################################## Titles in the GUI
title:
# window titles
@@ -979,6 +1003,8 @@ action:
# cards
#TODO: Localize Section
reorder cards: Reorder cards
#TODO: Localize
update card: Update card
change link: Change link
change notes: Change notes
change id: Change ID
@@ -1050,6 +1076,12 @@ error:
file not found package like:
沒有找到文件:'%s' 在 '%s' 文件包中
如果你嘗試從別的文件包中打開文件, 使用以下格式"/package/filename"
#TODO: Localize
file not found package like init:
File not found: '%s' in package '%s'
If this folder is empty or unused, delete it.
#TODO: Localize
package name parse error: Unable to parse package name '%s'
file parse error:
處理文件發生錯誤:'%s'
%s
@@ -1128,7 +1160,9 @@ error:
# image stuff
coordinates for blending overlap: 坐標混合重疊
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+36 -2
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/danish
full name: Dansk (Danish)
version: 2026-02-28
@@ -56,6 +56,8 @@ menu:
next card: Vælg &Næste Kort PgDn
search cards: &Søg kort Ctrl+K
add card: &Tilføj Kort Ctrl+Enter
#TODO: Localize
add card double: &Add Double Faced Card Ctrl+Shift+Enter
add cards: Tilføj &Flere Kort...
remove card: &Slet Valgte Kort
#TODO: Localize
@@ -214,6 +216,8 @@ help:
next card: Vælger det næste kort i listen
search cards: Filtrer kortlisten ved hjælp af søgetermer
add card: Tilføler et nyt, tomt kort til listen
#TODO: Localize
add card double: Add a new, blank, card that has a back face to this set
add cards: Tilføjer flere kort til listen
remove card: Sletter det valgte kort fra sættet!
#TODO: Localize
@@ -477,6 +481,8 @@ tooltip:
# cards toolbar
add card: Tilføj kort
#TODO: Localize
add card double: Add double faced card
remove card: Fjern valgte kort
#TODO: Localize
link card: Link cards to selected card
@@ -624,6 +630,16 @@ label:
stylesheet not found:
Sættet du har åbner bruger stilen "%s".
Denne stil er ikke i dit system, vælg venligst et alternativ.
#TODO: Localize
searching online: Searching online...
#TODO: Localize
searching online fail: Not found online
#TODO: Localize
found online downloading: Found online! Downloading...
#TODO: Localize
found online installing: Found online! Installing...
#TODO: Localize
found online fail: Installation failed
# preferences dialog
language: Sprog
@@ -774,6 +790,8 @@ label:
installable version: seneste version:
installer size: Størrelse:
installer status: Status:
#TODO: Localize
folder name: Folder name:
no version: -
#TODO: Localize
@@ -906,10 +924,16 @@ button:
upgrade package: &Opdatér
reinstall package: Gen&installér
remove package: &Fjern
#TODO: Localize
keep group: Keep Group As Is
install group: &Installér Alt
upgrade group: &Opgradér Alt
remove group: &Fjern Alt
# stylesheet not found dialog
#TODO: Localize
find package online: Search Online
############################################################## Titles in the GUI
title:
# window titles
@@ -999,6 +1023,8 @@ action:
# cards
#TODO: Localize Section
reorder cards: Reorder cards
#TODO: Localize
update card: Update card
change link: Change link
change notes: Change notes
change id: Change ID
@@ -1074,6 +1100,12 @@ error:
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"
#TODO: Localize
file not found package like init:
File not found: '%s' in package '%s'
If this folder is empty or unused, delete it.
#TODO: Localize
package name parse error: Unable to parse package name '%s'
file parse error:
Error while parsing file: '%s'
%s
@@ -1154,7 +1186,9 @@ error:
#TODO: Localize
coordinates for blending overlap: Coordinates for blending overlap. Space them out.
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+30 -10
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/german
full name: Deutsch (German)
version: 2026-02-28
@@ -21,7 +21,7 @@ menu:
export images: Alle Bilder exportieren...
export apprentice: &Karte exportieren...
export mws: Magic &Workstation...
check updates: Nach Updates schauen...
check updates: Aktualisierungen / Neue Stylesheets...
print preview: Druckvorschau...
print: &Drucken... Ctrl+P
reload data: Daten neu laden Ctrl+F5
@@ -54,6 +54,7 @@ menu:
next card: Nächste Karte PgDn
search cards: Suchkarten Ctrl+K
add card: Karte Hinzufügen Ctrl+Enter
add card double: Doppelseitige Karte hinzufügen Ctrl+Shift+Enter
add cards: Mehrere Karten hinzufügen...
remove card: Markierte Entfernen Del
add card csv: Karten aus CSV oder TSV hinzufügen...
@@ -195,7 +196,8 @@ help:
previous card: Wählt die vorherige Karte in der Liste aus
next card: Wählt die nächste Karte in der Liste aus
search cards: Filtert die Kartenliste anhand von Suchbegriffen
add card: Fügt eine neue Karte zur Edition hinzu
add card: Fügt eine neue, leere Karte zur Edition hinzu
add card double: Fügt eine neue, leere Karte mit Rückseite zur Edition hinzu
add cards: Fügt mehrere Karten zur Edition hinzu
remove card: Entfernt die gewählte Karte aus der Edition
link card: Verknüpft eine oder mehrere Karten mit der ausgewählten Karte
@@ -442,6 +444,7 @@ tooltip:
# cards toolbar
add card: Karte hinzufügen
add card double: Doppelseitige Karte hinzufügen
remove card: Gewählte Karte entfernen
link card: Karten mit ausgewählter Karte verknüpfen
copy card and links: Ausgewählte und verknüpfte Karten kopieren
@@ -578,7 +581,13 @@ label:
# stylesheet not found dialog
stylesheet not found:
Die ausgewählte Edition benutzt das Stylesheet "%s" .
Leider konnte es nicht gefunden werden. Bitte probieren Sie ein anderes.
Dieses Stylesheet wurde auf Ihrem System nicht gefunden.
Bitte wählen Sie eine Alternative oder suchen Sie online danach.
searching online: Online-Suche...
searching online fail: Nicht gefunden
found online downloading: Online gefunden! Wird heruntergeladen...
found online installing: Online gefunden! Wird installiert...
found online fail: Installation fehlgeschlagen
# preferences dialog
language: Sprache
@@ -709,6 +718,7 @@ label:
installable version: Letzte Version
installer size: Größe
installer status: Status:
folder name: Ordnername:
no version: -
load image: Doppelklicken Sie, um ein Bild zu laden
@@ -821,15 +831,19 @@ button:
close: &Beenden
# packages window
keep package: &Nicht verändern
keep package: &Unverändert beibehalten
don't install package: &Nicht installieren
install package: &Installieren
upgrade package: &Upgraden
upgrade package: &Aktualisieren
reinstall package: Neu &installieren
remove package: &Entfernen
install group: &Installiere alle
upgrade group: &Upgrade alle
remove group: &Entferne alle
keep group: Gruppe unverändert beibehalten
install group: Gruppe installieren/aktualisieren
upgrade group: Gruppe aktualisieren
remove group: Gruppe entfernen
# stylesheet not found dialog
find package online: Online Suchen
############################################################## Titles in the GUI
title:
@@ -909,6 +923,7 @@ title:
action:
# cards
reorder cards: Karten neu anordnen
update card: Karte aktualisieren
change link: Link ändern
change notes: Notizen ändern
change id: ID ändern
@@ -978,6 +993,10 @@ error:
file not found package like:
Datei nicht gefunden: '%s' im Package '%s'
Wenn Sie versuchen sollten, die Datei von einem anderen Package zu laden, verwenden Sie "/package/filename"
file not found package like init:
Datei nicht gefunden: '%s' im Package '%s'
Wenn dieser Ordner leer oder nicht verwendet ist, löschen Sie ihn.
package name parse error: Packagename '%s' konnte nicht analysiert werden.
file parse error:
Fehler beim Parsen von Datei: '%s'
%s
@@ -1047,7 +1066,8 @@ error:
# image stuff
coordinates for blending overlap: Die Koordinaten für die Überblendung überlappen sich.
blending different sizes: Die für die Überblendung verwendeten Bilder müssen in der Funktion '%s' die gleiche Größe haben.
blending different sizes: Die für die Überblendung verwendeten Bilder müssen in der Funktion '%s' die gleiche Größe haben. (Eines ist %s, das andere ist %s)
blending different mask: Bild und Maske, die zum Überblenden verwendet werden, müssen in der Funktion '%s' die gleiche Größe haben. (Bild ist %s, Maske ist %s)
negative image width: Bild mit Breite Null oder negativer Breite, erstellt in der Funktion '%s'
negative image height: Bild mit Höhe Null oder negativer Höhe, erstellt in der Funktion '%s'
can't load image: Bild konnte nicht geladen werden. Stelle sicher, dass das tatsächliche Format des Bildes mit der gespeicherten Dateiendung übereinstimmt.
+29 -9
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/english
full name: English
version: 2026-02-28
@@ -21,7 +21,7 @@ menu:
export images: All Card I&mages...
export apprentice: &Apprentice...
export mws: Magic &Workstation...
check updates: Check &Updates...
check updates: Check &Updates / New Styles...
print preview: Print Pre&view...
print: &Print... Ctrl+P
reload data: Reload Data Ctrl+F5
@@ -54,6 +54,7 @@ menu:
next card: Select &Next Card PgDn
search cards: &Search Cards Ctrl+K
add card: &Add Card Ctrl+Enter
add card double: &Add Double Faced Card Ctrl+Shift+Enter
add cards: Add &Multiple Cards...
remove card: &Delete Selected Card
add card csv: Add Cards from CSV or TSV...
@@ -196,6 +197,7 @@ help:
next card: Selects the next card in the list
search cards: Filter the card list using search terms
add card: Add a new, blank, card to this set
add card double: Add a new, blank, card that has a back face to this set
add cards: Add multiple cards to the set
remove card: Delete the selected card from this set
link card: Link one or more cards to the selected card
@@ -443,6 +445,7 @@ tooltip:
# cards toolbar
add card: Add card
add card double: Add double faced card
remove card: Remove selected card
link card: Link cards to selected card
copy card and links: Copy selected cards and linked cards
@@ -579,7 +582,13 @@ label:
# stylesheet not found dialog
stylesheet not found:
The set you are trying to open uses the stylesheet "%s".
This stylesheet is not found on your system, please select an alternative.
This stylesheet is not found on your system.
Please select an alternative, or look for it online.
searching online: Searching online...
searching online fail: Not found online
found online downloading: Found online! Downloading...
found online installing: Found online! Installing...
found online fail: Installation failed
# preferences dialog
language: Language
@@ -708,6 +717,7 @@ label:
installable version: Latest version:
installer size: Size:
installer status: Status:
folder name: Folder name:
no version: -
load image: Double click to load image
@@ -822,15 +832,19 @@ button:
close: &Close
# packages window
keep package: &Don't change
don't install package: &Don't install
keep package: Keep As Is
don't install package: &Don't Install
install package: &Install
upgrade package: &Update
reinstall package: Re&install
remove package: &Remove
install group: &Install All
upgrade group: &Upgrade All
remove group: &Remove All
keep group: Keep Group As Is
install group: &Install/Update Group
upgrade group: &Update Group
remove group: &Remove Group
# stylesheet not found dialog
find package online: Search Online
############################################################## Titles in the GUI
title:
@@ -910,6 +924,7 @@ title:
action:
# cards
reorder cards: Reorder cards
update card: Update card
change link: Change link
change notes: Change notes
change id: Change ID
@@ -979,6 +994,10 @@ error:
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 not found package like init:
File not found: '%s' in package '%s'
If this folder is empty or unused, delete it.
package name parse error: Unable to parse package name '%s'
file parse error:
Error while parsing file: '%s'
%s
@@ -1048,7 +1067,8 @@ error:
# image stuff
coordinates for blending overlap: Coordinates for blending overlap. Space them out.
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
negative image width: Image with zero or negative width created in function '%s'
negative image height: Image with zero or negative height created in function '%s'
can't load image: Failed to load image. Ensure the image's actual format matches its saved extension.
+36 -2
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/spanish
full name: Español (Spanish)
version: 2026-02-28
@@ -54,6 +54,8 @@ menu:
next card: Seleccionar &carta siguiente PgDn
search cards: &Buscar Cartas Ctrl+K
add card: &Añadir carta Ctrl+Enter
#TODO: Localize
add card double: &Add Double Faced Card Ctrl+Shift+Enter
add cards: Añadir &múltiples cartas...
remove card: &Borrar carta seleccionada
#TODO: Localize
@@ -208,6 +210,8 @@ help:
next card: Selecciona la carta siguiente en la lista
search cards: Filtra la lista de cartas usando términos de búsqueda
add card: Añade una carta nueva, vacía, a este Set
#TODO: Localize
add card double: Add a new, blank, card that has a back face to this set
add cards: Añade múltiples cartas al Set
remove card: Borra la carta seleccionada de este Set
#TODO: Localize
@@ -468,6 +472,8 @@ tooltip:
# cards toolbar
add card: Añadir carta
#TODO: Localize
add card double: Add double faced card
remove card: Eliminar carta seleccionada
#TODO: Localize
link card: Link cards to selected card
@@ -615,6 +621,16 @@ label:
stylesheet not found:
El Set que estás intentando abrir usa el estilo "%s".
Este estilo no se encuentra en tu sistema, por favor selecciona otro.
#TODO: Localize
searching online: Searching online...
#TODO: Localize
searching online fail: Not found online
#TODO: Localize
found online downloading: Found online! Downloading...
#TODO: Localize
found online installing: Found online! Installing...
#TODO: Localize
found online fail: Installation failed
# preferences dialog
language: Idioma
@@ -759,6 +775,8 @@ label:
installable version: Última versión:
installer size: Tamaño:
installer status: Estado:
#TODO: Localize
folder name: Folder name:
no version: -
#TODO: Localize
@@ -891,10 +909,16 @@ button:
upgrade package: &Actualizar
reinstall package: R&einstalar
remove package: &Eliminar
#TODO: Localize
keep group: Keep Group As Is
install group: Instalar &Todos
upgrade group: A&ctualizar Todos
remove group: Q&uitar Todos
# stylesheet not found dialog
#TODO: Localize
find package online: Search Online
############################################################## Titles in the GUI
title:
# window titles
@@ -982,6 +1006,8 @@ action:
# cards
#TODO: Localize Section
reorder cards: Reorder cards
#TODO: Localize
update card: Update card
change link: Change link
change notes: Change notes
change id: Change ID
@@ -1053,6 +1079,12 @@ error:
file not found package like:
Archivo no encontrado: '%s' en el paquete '%s'
Si estás intentando abrir un archivo de otro paquete, usa "/package/filename"
#TODO: Localize
file not found package like init:
File not found: '%s' in package '%s'
If this folder is empty or unused, delete it.
#TODO: Localize
package name parse error: Unable to parse package name '%s'
file parse error:
Error mientras se analizaba el archivo: '%s'
%s
@@ -1131,7 +1163,9 @@ error:
# image stuff
coordinates for blending overlap: Coordenadas para la mezcla (blending) solapada
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+115 -95
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/french
full name: Français (French)
version: 2026-02-28
@@ -21,7 +21,7 @@ menu:
export images: Toutes les I&mages de Carte...
export apprentice: &Apprentice...
export mws: Magic &Workstation...
check updates: Vérifier les Mises à Jo&ur...
check updates: Mises à Jo&ur / Nouveaux Styles...
print preview: Aperçu d'&Impression...
print: &Imprimer... Ctrl+P
reload data: Recharger les Données Ctrl+F5
@@ -54,8 +54,9 @@ menu:
next card: Carte &Suivante PgDn
search cards: Rechercher dans les Cartes Ctrl+K
add card: &Ajouter une Carte Ctrl+Enter
add card double: Ajouter une Carte recto-verso Ctrl+Shift+Enter
add cards: Ajouter &plusieurs Cartes...
remove card: &Supprimer la carte sélectionnée
remove card: &Supprimer la Carte sélectionnée
add card csv: Ajouter plusieurs Cartes depuis un CSV ou TSV...
add card json: Ajouter plusieurs Cartes depuis un JSON...
link card: &Lier des Cartes à la Carte sélectionnée...
@@ -159,15 +160,15 @@ help:
save set as directory: Sauver le Set en tant que dossier non compressé
export: Exporter le Set...
export html: Exporter le Set en tant que fichier HTML
export image: Exporter la carte selectionnée en tant qu'image
export images: Exporter toutes les cartes en tant qu'images
export image: Exporter la Carte selectionnée en tant qu'image
export images: Exporter toutes les Cartes en tant qu'images
export apprentice: Exporter le Set pour être utilisé avec Apprentice
export mws: Exporter le Set pour être utilisé avec Magic Workstation
add card csv: Ajouter des Cartes depuis un fichier à Valeurs Séparées par des Virgules ou Tabulations
add card json: Ajouter des Cartes depuis un fichier JSON
check updates: Ouvrir une fenêtre de mise à jour pour télécharger les nouveaux packages (Jeux, Styles, Localisations)
print preview: Voir les cartes telles qu'elles vont être imprimées
print: Imprimer les cartes de ce Set
print preview: Voir les Cartes telles qu'elles vont être imprimées
print: Imprimer les Cartes de ce Set
reload data: Recharger tous les Templates ainsi que le Set
show profiler: Afficher la fenêtre du Profiler, avec la durée d'exécution des scripts; Utilisé pour l'optimisation
exit: Quitter Magic Set Editor; Vous demandera de sauvegarder le Set
@@ -176,37 +177,38 @@ help:
undo: Annuler la dernière action
redo: Refaire la dernière action
cut: Couper le texte selectionné dans le presse-papier
cut card: Couper la carte selectionnée dans le presse-papier
cut card: Couper la Carte selectionnée dans le presse-papier
cut keyword: Couper le Mot-clef selectionné dans le presse-papier
copy: Copier le texte selectionné dans le presse-papier
copy card: Copier la carte selectionnée dans le presse-papier
copy card: Copier la Carte selectionnée dans le presse-papier
copy keyword: Copier le Mot-clef selectionné dans le presse-papier
paste: Insérer le texte depuis le presse-papier
paste card: Insérer la carte depuis le presse-papier
paste card: Insérer la Carte depuis le presse-papier
paste keyword: Insérer le mot_clef depuis le presse-papier
select all: Sélectionner tout le texte
find: Rechercher un bout de texte dans les cartes
find: Rechercher un bout de texte dans les Cartes
find next: Rechercher l'occurrence suivante
replace: Remplacer l'occurrence
auto replace: Quel texte devra être automatiquement remplacé?
preferences: Changer la configuration de Magic Set Editor
# cards menu
previous card: Choisir la carte précédente dans la liste
next card: Choisir la carte suivante dans la liste
search cards: Filtrer la liste des carte à l'aide de termes de recherche
add card: Ajouter une nouvelle carte vierge au Set
add cards: Ajouter plusieurs cartes au Set
remove card: Supprimer la carte sélectionnée du Set
link card: Lier des cartes à la carte sélectionnée
copy card and links: Copier les cartes sélectionnées ainsi que toutes leurs cartes liées
bulk modify: Modifier beaucoup de cartes d'un coup
orientation: Orientation de la carte visualisée
rotate card: Tourner la carte de 90° dans le sens des aiguilles d'une montre
rotate 0: Afficher la carte dans son sens original
rotate 270: Afficher la carte tournée dans le sens des aiguilles d'une montre
rotate 90: Afficher la carte tournée dans le sens inverse des aiguilles d'une montre
rotate 180: Afficher la carte à l'envers
previous card: Choisir la Carte précédente dans la liste
next card: Choisir la Carte suivante dans la liste
search cards: Filtrer la liste des Carte à l'aide de termes de recherche
add card: Ajouter une nouvelle Carte vierge au Set
add card double: Ajouter une nouvelle Carte vierge avec un verso au Set
add cards: Ajouter plusieurs Cartes au Set
remove card: Supprimer la Carte sélectionnée du Set
link card: Lier des Cartes à la Carte sélectionnée
copy card and links: Copier les Cartes sélectionnées ainsi que toutes leurs Cartes liées
bulk modify: Modifier beaucoup de Cartes d'un coup
orientation: Orientation de la Carte visualisée
rotate card: Tourner la Carte de 90° dans le sens des aiguilles d'une montre
rotate 0: Afficher la Carte dans son sens original
rotate 270: Afficher la Carte tournée dans le sens des aiguilles d'une montre
rotate 90: Afficher la Carte tournée dans le sens inverse des aiguilles d'une montre
rotate 180: Afficher la Carte à l'envers
card list columns: Choisir quelles colonnes doivent être affichées et dans quel ordre
# keywords menu
@@ -231,10 +233,10 @@ help:
no spelling suggestions: Il n'y a pas de suggestions pour corriger cette faute
# graph menu
pie: Un graphique en secteurs, l'épaisseur de la tranche indique le nombre de cartes
bar: Un graphique à barres, la hauteur de la barre indique le nombre de cartes
pie: Un graphique en secteurs, l'épaisseur de la tranche indique le nombre de Cartes
bar: Un graphique à barres, la hauteur de la barre indique le nombre de Cartes
stack: Un graphique à barres empilées
scatter: Un nuage de points, la taille du point indique le nombre de cartes
scatter: Un nuage de points, la taille du point indique le nombre de Cartes
scatter pie: Un nuage de points où chaque point est un petit graphique en secteurs
# console menu
@@ -242,12 +244,12 @@ help:
# window menu
new window: Ouvrir une nouvelle fenêtre pour éditer le même Set
cards tab: Éditer les cartes du Set
cards tab: Éditer les Cartes du Set
set info tab: Éditer les informations du Set, son créateur, etc...
style tab: Changer le Style des cartes
style tab: Changer le Style des Cartes
keywords tab: Définir des Mots-clefs supplémentaires pour le Set
stats tab: Voir les statistiques des cartes du Set
random pack tab: Générer des boosters aléatoires de cartes du Set
stats tab: Voir les statistiques des Cartes du Set
random pack tab: Générer des boosters aléatoires de Cartes du Set
console tab: Afficher les messages d'erreurs et executer des scripts
# help menu
@@ -261,12 +263,12 @@ help:
search stylesheet list control: Filtrer la liste des Styles. Utilisez - pour exclure des Styles. Utilisez field: pour rechercher uniquement dans un champ donné. Utilisez des guillemets pour une recherche litterale. Séparez plusieurs filtres par un espace.
# card select / image export
filename format: (Utilisez {card.name} pour le nom de la carte ; Le type de fichier est déterminé, basé par l'extension)
filename format: (Utilisez {card.name} pour le nom de la Carte ; Le type de fichier est déterminé, basé par l'extension)
# cards panel
collapse notes: Cacher les notes des cartes
expand notes: Afficher les notes des cartes
search cards control: Filtrer la liste des cartes. Utilisez - pour exclure des cartes. Utilisez field: pour rechercher uniquement dans un champ donné. Utilisez des guillemets pour une recherche litterale. Séparez plusieurs filtres par un espace.
collapse notes: Cacher les notes des Cartes
expand notes: Afficher les notes des Cartes
search cards control: Filtrer la liste des Cartes. Utilisez - pour exclure des Cartes. Utilisez field: pour rechercher uniquement dans un champ donné. Utilisez des guillemets pour une recherche litterale. Séparez plusieurs filtres par un espace.
# keywords panel
search keywords control: Filtrer la liste des mots-clefs. Utilisez - pour exclure des mots-clefs. Utilisez field: pour rechercher uniquement dans un champ donné. Utilisez des guillemets pour une recherche litterale. Séparez plusieurs filtres par un espace.
@@ -284,7 +286,7 @@ help:
pour que le changement prenne effet.
zoom export:
(Quand l'option est décochée, les
cartes sont exportées à 100% de leur
Cartes sont exportées à 100% de leur
taille et dans leur rotation normale.)
# apprentice export
@@ -367,7 +369,7 @@ tool:
console tab: Console
# cards toolbar
search cards: Rechercher des cartes (Ctrl+K)
search cards: Rechercher des Cartes (Ctrl+K)
stats card counts 1: %s Au total
stats card counts 2: %s Dans le filtre, %s Au total
card counts 2: %s Dans la sélection, %s Au total
@@ -442,11 +444,12 @@ tooltip:
redo: Rétablir%s
# cards toolbar
add card: Ajouter une carte
remove card: Supprimer la carte sélectionnée
link card: Lier des cartes à la carte sélectionnée
copy card and links: Copier les cartes sélectionnées et leurs cartes liées
rotate card: Tourner la carte
add card: Ajouter une Carte
add card double: Ajouter une Carte recto-verso
remove card: Supprimer la Carte sélectionnée
link card: Lier des Cartes à la Carte sélectionnée
copy card and links: Copier les Cartes sélectionnées et leurs Cartes liées
rotate card: Tourner la Carte
# keywords toolbar
add keyword: Ajouter un Mot-clef
@@ -513,7 +516,7 @@ tooltip:
label:
## app window items labels
# cards panel
card notes: Notes de carte:
card notes: Notes de Carte:
# keywords panel
search keywords: Recherche dans les mots-clefs (Ctrl+K)
@@ -542,18 +545,18 @@ label:
custom link selected: Générateur, Face Avant, Composant d'Assimilation, etc...
custom link linked: Jeton, Face Arrière, Résultat d'Assimilation, etc...
custom link undefined: Non Défini
linked cards relation: Choisissez le type de relation entre la carte sélectionnée ('%s') et les cartes liées:
linked cards relation: Choisissez le type de relation entre la Carte sélectionnée ('%s') et les Cartes liées:
selected card: Carte sélectionnée:
linked cards: Cartes liées:
select linked cards: Choisissez jusqu’à 4 cartes liées:
select linked cards: Choisissez jusqu’à 4 Cartes liées:
# bulk modification dialog
bulk modify selection: Quelles cartes doivent être modifiées:
bulk modify all: Toutes les cartes
bulk modify filtered: Les cartes actuellement filtrées
bulk modify selected: Les cartes actuellement sélectionnées
bulk modify predicate: Les cartes qui vérifient un critère
bulk modify predicate description: Quel critère doit être vérifié pour que la carte soit modifiée:
bulk modify selection: Quelles Cartes doivent être modifiées:
bulk modify all: Toutes les Cartes
bulk modify filtered: Les Cartes actuellement filtrées
bulk modify selected: Les Cartes actuellement sélectionnées
bulk modify predicate: Les Cartes qui vérifient un critère
bulk modify predicate description: Quel critère doit être vérifié pour que la Carte soit modifiée:
bulk modify predicate example: Example (petites créatures de M:tG):
bulk modify field: Quelle valeur doit être modifiée:
bulk modify mod description: Que doit être la nouvelle valeur:
@@ -572,14 +575,20 @@ label:
# new set dialog
game type: &Type de jeu:
style type: &Style des carte:
style type: &Style des Carte:
search game list: Filtrer les jeux
search stylesheet list: Filtrer les Styles
# stylesheet not found dialog
stylesheet not found:
Le Set que vous essayez d'ouvrir utilise le Style "%s".
Ce Style n'a pas été trouvé sur votre ordinateur. Selectionnez une alternative.
Ce Style n'a pas été trouvé sur votre ordinateur.
Selectionnez une alternative, ou cherchez en ligne.
searching online: Recherche en ligne...
searching online fail: Introuvable en ligne
found online downloading: Trouvé en ligne! Téléchargement...
found online installing: Trouvé en ligne! Installation...
found online fail: Échec de linstallation
# preferences dialog
language: Langue
@@ -589,7 +598,7 @@ label:
dark mode no: Mode clair
dark mode yes: Mode sombre
app language: Langue de l'interface utilisateur (App Language)
card display: Affichage des cartes
card display: Affichage des Cartes
zoom: &Zoom:
import: Import
export: &Export
@@ -602,7 +611,7 @@ label:
external programs: Programmes externes
apprentice: &Apprentice:
apprentice exe: Executable Apprentice
export desc: Lors de l'exportation de cartes en images:
export desc: Lors de l'exportation de Cartes en images:
import desc: Lors de l'importation d'images pour les illustrations:
internal scale desc:
Taille à laquelle stocker les images en interne.
@@ -621,8 +630,8 @@ label:
# card select / image export dialogs
select cards: Cartes à exporter
select cards print: Selectionner les cartes à imprimer
selected card count: %s cartes seront exportées.
select cards print: Selectionner les Cartes à imprimer
selected card count: %s Cartes seront exportées.
filename format: &Format:
filename conflicts: &Gestion des doublons de fichiers:
export filenames: Nom des fichiers
@@ -646,7 +655,7 @@ label:
# JSON import dialog
add card json type: Type de fichier JSON:
add card json custom: Fichier JSON customisé
add card json path: Chemin vers la liste de cartes à l'intérieur du fichier:
add card json path: Chemin vers la liste de Cartes à l'intérieur du fichier:
add card json file: Chemin du fichier:
# image slicer dialog
@@ -709,17 +718,18 @@ label:
installable version: Dernière version:
installer size: Taille:
installer status: État:
folder name: Dossier:
no version: -
load image: Double-cliquer pour charger une image
# print dialog
put space between cards: Ajouter un espace entre les cartes?
spacing print: Espace entre les cartes en millimètres
put space between cards: Ajouter un espace entre les Cartes?
spacing print: Espace entre les Cartes en millimètres
bleed print: Marge de fond perdu en millimètres
cutter lines print: Ajouter des lignes de découpe?
cutter lines all: Toutes
cutter lines no intersect: Si elles n'intersectent pas de carte
cutter lines no intersect: Si elles n'intersectent pas de Carte
cutter lines none: Aucune
## symbol editor
@@ -732,8 +742,8 @@ button:
link select: Sélectionner
# style panel
use for all cards: Utiliser pour toutes les c&artes
use custom styling options: Options &spécifique à cette carte
use for all cards: Utiliser pour toutes les C&artes
use custom styling options: Options &spécifique à cette Carte
# set info panel
edit symbol: Éditer
@@ -773,9 +783,9 @@ button:
Ajoutez une marge de
fond perdu grossière
notes export:
Exporter les notes de la carte à
Exporter les notes de la Carte à
l'intérieur des Métadonnées de l'image
spellcheck enabled: Afficher les fautes d'orthographe sur les cartes
spellcheck enabled: Afficher les fautes d'orthographe sur les Cartes
check now: &Vérifier maintenant
always: Toujours
every 5 startups: Tous les 5 démarrages
@@ -801,7 +811,7 @@ button:
export entire set: Set complet
export generated packs: Packs générés
export custom cards selection: Sélection personalisée
select cards: &Sélection des cartes...
select cards: &Sélection des Cartes...
select all: Sélectionner &toutes
select none: Sélectionner &aucune
overwrite: Ecraser les anciens fichiers
@@ -824,12 +834,16 @@ button:
keep package: &Ne pas modifier
don't install package: &Ne pas installer
install package: &Installer
upgrade package: &Upgrader
upgrade package: &Mettre à jour
reinstall package: Ré&installer
remove package: &Supprimer
install group: &Installer Tout
upgrade group: &Upgrader Tout
remove group: &Supprimer Tout
keep group: &Ne pas modifier le groupe
install group: &Installer/Mettre à jour le groupe
upgrade group: &Mettre à jour le groupe
remove group: &Supprimer le groupe
# stylesheet not found dialog
find package online: Chercher En Ligne
############################################################## Titles in the GUI
title:
@@ -908,12 +922,13 @@ title:
############################################################## Action (undo/redo) names
action:
# cards
reorder cards: Réorganiser les cartes
reorder cards: Réorganiser les Cartes
update card: Mettre à jour la Carte
change link: Modifier le lien
change notes: Modifier les notes
change id: Modifier l'ID
change style: Modifier le style
change all styles: Modifier le style (toutes les cartes)
change all styles: Modifier le style (toutes les Cartes)
use custom style: Utiliser un style personnalisé
show reminder text: Afficher le texte de rappel
hide reminder text: Masquer le texte de rappel
@@ -978,6 +993,10 @@ error:
file not found package like:
Fichier non trouvé: '%s' dans le package '%s'
Si vous essayez d'ouvrir un fichier d'un autre package, utilisez "/package/fichier"
file not found package like init:
Fichier non trouvé: '%s' dans le package '%s'
Si ce dossier est vide ou inutilisé, supprimez-le.
package name parse error: Impossible d'analyser le nom du package '%s'.
file parse error:
Erreur lors de la lecture du fichier: '%s'
%s
@@ -1010,7 +1029,7 @@ error:
no field with name: Impossible de trouver le champ de %s nommé '%s'
styling data not map: La valeur donnée pour « %s_data » n'est pas un dictionnaire
styling data without stylesheet: Valeur donnée pour « %s_data » avant la définition d'un Style
cant set value: Impossible de définir la valeur de la carte '%s', son type est incorrect
cant set value: Impossible de définir la valeur de la Carte '%s', son type est incorrect
cant set image value: On ne peut définir la valeur d'une image qu'avec un nom de fichier relatif depuis le package, ou avec les fonctions import_image/download_image (dans le champ '%s')
cant set symbol value: On ne peut définir la valeur d'un symbol qu'avec un nom de fichier relatif depuis le package (dans le champ '%s')
add card csv file not found: Impossible de trouver ou charger le fichier CSV ou TSV spécifié
@@ -1047,14 +1066,15 @@ error:
# image stuff
coordinates for blending overlap: Les coordonnées pour le mélange sont superposées. Espacez-les.
blending different sizes: Les images utilisées pour le mélange doivent avoir la même taille dans la fonction '%s'.
blending different sizes: Les images utilisées pour le mélange doivent avoir la même taille dans la fonction '%s'. (L'une est %s, l'autre est %s)
blending different mask: L'image et le masque utilisés pour le mélange doivent avoir la même taille dans la fonction '%s'. (L'image est %s, le masque est %s)
negative image width: Image de largeur nulle ou négative créée par la fonction '%s'
negative image height: Image de hauteur nulle ou négative créée par la fonction '%s'
can't load image: Échec du chargement de l'image. Assurez-vous que le format réel de l'image corresponde à son extension enregistrée.
symbol image has alpha: Pour un résultat optimal, l'image doit être en noir et blanc sans transparence.
# error from files
no card fields: Le jeu '%s' ne contient aucun champ de carte. Définissez au moins un champ de carte.
no card fields: Le jeu '%s' ne contient aucun champ de Carte. Définissez au moins un champ de Carte.
reserved field name: '%s' est un nom de champ réservé. Veuillez utiliser un autre nom.
duplicate field name: Le nom de champ alternatif '%s' est un doublon : il sagit à la fois dun nom alternatif pour '%s' et '%s'.
no game specified: Pas de jeu spécifié pour le %s
@@ -1084,15 +1104,15 @@ error:
no updates: Il n'y a pas de mises à jour disponibles.
# card linking
not enough free links: La carte '%s' n'a pas assez de liens disponibles. Vous pouvez former au maximum 4 liens par carte.
not enough free links for copy: La carte '%s' n'a pas assez de liens disponibles pour copier. Vous pouvez former au maximum 4 liens par carte.
could not link: Les cartes suivantes n'ont pas pu être liées, elles ont déjà 4 liens:
missing free links: La carte ne contient que %s liens libres. Sélectionnez moins de cartes.
not enough free links: La Carte '%s' n'a pas assez de liens disponibles. Vous pouvez former au maximum 4 liens par Carte.
not enough free links for copy: La Carte '%s' n'a pas assez de liens disponibles pour copier. Vous pouvez former au maximum 4 liens par Carte.
could not link: Les Cartes suivantes n'ont pas pu être liées, elles ont déjà 4 liens:
missing free links: La Carte ne contient que %s liens libres. Sélectionnez moins de Cartes.
link duplicate: Nom de lien localisé dupliqué. '%s' correspond à la fois à '%s' et à '%s'.
multiple front faces: La carte '%s' contient plusieurs cartes liées comme face avant.
multiple back faces: La carte '%s' contient plusieurs cartes liées comme face arrière.
cant link to self: Impossible de lier une carte à elle-même. (Cet assignation sera ignorée.)
no cards selected: Aucune carte sélectionnée. Sélectionnez jusqu'à 4 cartes à lier.
multiple front faces: La Carte '%s' contient plusieurs Cartes liées comme face avant.
multiple back faces: La Carte '%s' contient plusieurs Cartes liées comme face arrière.
cant link to self: Impossible de lier une Carte à elle-même. (Cet assignation sera ignorée.)
no cards selected: Aucune Carte sélectionnée. Sélectionnez jusqu'à 4 Cartes à lier.
could not find input: Carte d'input introuvable.
could not find linked: Carte liée (linked_card) introuvable.
@@ -1102,11 +1122,11 @@ error:
bulk modify mod is not string: La modification doit être une chaîne de caractères, mais a été évaluée à %s.
bulk modify mod is not color: La modification doit être une couleur, mais a été évaluée à %s.
bulk modify mod is not image: La modification doit être une image, mais a été évaluée à %s. Utilisez les fonctions import_image/download_image pour définir les champs d' images.
bulk modify mod is nil: La modification est null pour la carte '%s'. Elle ne sera pas appliquée.
bulk modify no cards: Aucune carte à modifier.
bulk modify no cards verify: Aucune carte ne correspond au critère.
bulk modify nothing: Aucune carte n'a été modifiée.
bulk modify success: Nombre de cartes modifiées avec succès : %s
bulk modify mod is nil: La modification est null pour la Carte '%s'. Elle ne sera pas appliquée.
bulk modify no cards: Aucune Carte à modifier.
bulk modify no cards verify: Aucune Carte ne correspond au critère.
bulk modify nothing: Aucune Carte n'a été modifiée.
bulk modify success: Nombre de Cartes modifiées avec succès : %s
# web request
web request failed: Échec de la requête Web
@@ -1167,9 +1187,9 @@ type:
stylesheet: stylesheet
export template: modèle d'export
symbol: symbole
card: carte
cards: cartes
extra card: extra carte
card: Carte
cards: Cartes
extra card: extra Carte
field: champ
style: style
styling: style
@@ -1177,8 +1197,8 @@ type:
keyword: mot-clef
keywords: mots-clefs
pack: type de pack
card region: région de carte
card regions: régions de carte
card region: région de Carte
card regions: régions de Carte
# symbol editor shapes
shape: forme
+29 -9
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/italian
full name: Italiano (Italian)
version: 2026-02-28
@@ -21,7 +21,7 @@ menu:
export images: I&mmagini Carte...
export apprentice: &Apprentice...
export mws: Magic &Workstation...
check updates: Cerca aggiornamenti...
check updates: Aggiornamenti / Nuovi Stili...
print preview: Anteprima di S&tampa...
print: &Stampa... Ctrl+P
reload data: Ricarica dati Ctrl+F5
@@ -54,6 +54,7 @@ menu:
next card: Seleziona &carta successiva PgDn
search cards: Cerca carte Ctrl+K
add card: &Aggiungi carta Ctrl+Enter
add card double: Aggiungi carta fronte-retro Ctrl+Shift+Enter
add cards: Aggiungi &carte Multiple...
remove card: &Rimuovi carta Del
add card csv: Aggiungi carte da CSV o TSV...
@@ -196,6 +197,7 @@ help:
next card: Seleziona la prossima carta della lista
search cards: Filtra l'elenco delle carte utilizzando i termini di ricerca
add card: Aggiunge una nuova carta vuota al set
add card double: Aggiunge una nuova carta vuota con il retro al set
add cards: Aggiunge carte multiple al set
remove card: Cancella la carta selezionata dal set
link card: Collega una o più carte alla carta selezionata
@@ -443,6 +445,7 @@ tooltip:
# cards toolbar
add card: Aggiungi carta
add card double: Aggiungi carta fronte-retro
remove card: Rimuovi carta selezionata
link card: Collega alcune carte alla carta selezionata
copy card and links: Copia le carte selezionate e tutte le carte collegate
@@ -579,7 +582,13 @@ label:
# stylesheet not found dialog
stylesheet not found:
Il set che stai cercando di aprire usa lo stile "%s".
Questo stile non è stato trovato sul tuo sistema, scegli un'alternativa.
Questo stile non è stato trovato sul tuo sistema.
Seleziona un'alternativa o cercalo online.
searching online: Ricerca online in corso...
searching online fail: Non trovato online
found online downloading: Trovato online! Download in corso...
found online installing: Trovato online! Installazione in corso...
found online fail: Installazione non riuscita
# preferences dialog
language: Lingua
@@ -709,6 +718,7 @@ label:
installable version: Ultima versione:
installer size: Dimesioni:
installer status: Stato:
folder name: Nome:
no version: -
load image: Fai doppio clic per caricare un'immagine
@@ -821,15 +831,19 @@ button:
close: &Chiudi
# packages window
keep package: &Non modificare
keep package: &Mantieni così com'è
don't install package: &Non installare
install package: &Installa
upgrade package: Aggiorna (&U)
upgrade package: Aggiorna
reinstall package: Re&installa
remove package: &Rimuovi
install group: &Installa Tutto
upgrade group: &Upgrade Tutto
remove group: &Rimuovi Tutto
keep group: Mantieni il gruppo così com'è
install group: &Installa/Aggiorna il gruppo
upgrade group: &Aggiorna il gruppo
remove group: &Rimuovi il gruppo
# stylesheet not found dialog
find package online: Cerca online
############################################################## Titles in the GUI
title:
@@ -909,6 +923,7 @@ title:
action:
# cards
reorder cards: Riordina le carte
update card: Aggiorna la carta
change link: Modifica collegamento
change notes: Modifica note
change id: Modifica ID
@@ -978,6 +993,10 @@ error:
file not found package like:
File non trovato: '%s' nel pacchetto '%s'
Se si sta tentando di aprire un file da un altro pacchetto, utilizzare "/package/filename"
file not found package like init:
File non trovato: '%s' nel pacchetto '%s'
Se questa cartella è vuota o inutilizzata, eliminala.
package name parse error: Impossibile analizzare il nome del pacchetto '%s'
file parse error:
Errore analizzando il file: '%s'
%s
@@ -1047,7 +1066,8 @@ error:
# image stuff
coordinates for blending overlap: Le coordinate per la fusione si sovrappongono.
blending different sizes: Le immagini utilizzate per la fusione devono avere le stesse dimensioni nella funzione '%s'.
blending different sizes: Le immagini utilizzate per la fusione devono avere le stesse dimensioni nella funzione '%s'. (Una è %s, l'altra è %s)
blending different mask: L'immagine e la maschera utilizzate per la fusione devono avere le stesse dimensioni nella funzione '%s'. (L'immagine è %s, la maschera è %s)
negative image width: Immagine con larghezza zero o negativa creata nella funzione '%s'.
negative image height: Immagine con altezza zero o negativa creata nella funzione '%s'.
can't load image: Impossibile caricare l'immagine. Assicurarsi che il formato effettivo dell'immagine corrisponda all'estensione salvata.
+36 -2
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/japanese
full name: 日本語 (Japanese)
version: 2026-02-28
@@ -54,6 +54,8 @@ menu:
next card: 次のカードを選択 PgDn
search cards: カードの検索 Ctrl+K
add card: &カードを追加 Ctrl+Enter
#TODO: Localize
add card double: &Add Double Faced Card Ctrl+Shift+Enter
add cards: &複数のカードを追加...
remove card: &選択したカードを削除
#TODO: Localize
@@ -208,6 +210,8 @@ help:
next card: リストの次のカードを選択します。
search cards: 検索語を使用してカードリストをフィルタリングする
add card: 新しいカードを現在のセットに加えます。
#TODO: Localize
add card double: Add a new, blank, card that has a back face to this set
add cards: 複数のカードを現在のセットに加えます。
remove card: 現在のセットから選ばれたカードを削除します。
#TODO: Localize
@@ -467,6 +471,8 @@ tooltip:
# cards toolbar
add card: カードを追加
#TODO: Localize
add card double: Add double faced card
remove card: 選択したカードを削除
#TODO: Localize
link card: Link cards to selected card
@@ -614,6 +620,16 @@ label:
stylesheet not found:
あなたが始めようとしているセットがスタイルシートを使う "%s"。
このstylesheetがあなたのシステムで見つからないで、選択肢を選んでください。
#TODO: Localize
searching online: Searching online...
#TODO: Localize
searching online fail: Not found online
#TODO: Localize
found online downloading: Found online! Downloading...
#TODO: Localize
found online installing: Found online! Installing...
#TODO: Localize
found online fail: Installation failed
# preferences dialog
language: 言語
@@ -758,6 +774,8 @@ label:
installable version: 最新バージョン
installer size: サイズ
installer status: 状態
#TODO: Localize
folder name: Folder name:
no version: -
#TODO: Localize
@@ -890,10 +908,16 @@ button:
upgrade package: &アップグレード
reinstall package: 再インストール
remove package: &取り外す
#TODO: Localize
keep group: Keep Group As Is
install group: すべてインストールする
upgrade group: すべてアップグレードする
remove group: すべて削除する
# stylesheet not found dialog
#TODO: Localize
find package online: Search Online
############################################################## Titles in the GUI
title:
# window titles
@@ -982,6 +1006,8 @@ action:
# cards
#TODO: Localize Section
reorder cards: Reorder cards
#TODO: Localize
update card: Update card
change link: Change link
change notes: Change notes
change id: Change ID
@@ -1053,6 +1079,12 @@ error:
file not found package like:
ファイルが見つかりません '%s' パッケージの '%s'
しようとしている場合は、別のパッケージからファイルを開くには、使用する "/パッケージ/ファイル名"
#TODO: Localize
file not found package like init:
File not found: '%s' in package '%s'
If this folder is empty or unused, delete it.
#TODO: Localize
package name parse error: Unable to parse package name '%s'
file parse error:
ファイルをパースし誤り: '%s'
%s
@@ -1131,7 +1163,9 @@ error:
# image stuff
coordinates for blending overlap: オーバーラップを混ぜることのための座標
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+36 -2
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/korean
full name: 한국어 (Korean)
version: 2026-02-28
@@ -54,6 +54,8 @@ menu:
next card: 다음 카드 PgDn
search cards: &카드 검색 Ctrl+K
add card: &카드 추가 Ctrl+Enter
#TODO: Localize
add card double: &Add Double Faced Card Ctrl+Shift+Enter
add cards: &여러 카드 추가...
remove card: &카드 삭제
#TODO: Localize
@@ -208,6 +210,8 @@ help:
next card: 목록에서 다음 카드를 선택합니다.
search cards: 검색어를 사용하여 카드 목록 필터링
add card: 이 세트에 새로운 빈 카드를 추가하세요.
#TODO: Localize
add card double: Add a new, blank, card that has a back face to this set
add cards: 세트에 여러 카드 추가
remove card: 이 세트에서 선택한 카드를 삭제하세요.
#TODO: Localize
@@ -473,6 +477,8 @@ tooltip:
# cards toolbar
add card: 카드 추가
#TODO: Localize
add card double: Add double faced card
remove card: 선택한 카드 삭제
#TODO: Localize
link card: Link cards to selected card
@@ -619,6 +625,16 @@ label:
stylesheet not found:
열려고 하는 세트는 스타일시트 '%s'을 사용합니다.
이 스타일시트를 시스템에서 찾을 수 없습니다. 대체 스타일을 선택하십시오.
#TODO: Localize
searching online: Searching online...
#TODO: Localize
searching online fail: Not found online
#TODO: Localize
found online downloading: Found online! Downloading...
#TODO: Localize
found online installing: Found online! Installing...
#TODO: Localize
found online fail: Installation failed
# preferences dialog
language: 언어
@@ -764,6 +780,8 @@ label:
installable version: 최신 버전:
installer size: 크기:
installer status: 상태:
#TODO: Localize
folder name: Folder name:
no version: -
#TODO: Localize
@@ -896,10 +914,16 @@ button:
upgrade package: 업데이트
reinstall package: 재설치
remove package: 제거하다
#TODO: Localize
keep group: Keep Group As Is
install group: 모두 설치
upgrade group: 모두 업그레이드
remove group: 모두 제거
# stylesheet not found dialog
#TODO: Localize
find package online: Search Online
############################################################## Titles in the GUI
title:
# window titles
@@ -988,6 +1012,8 @@ action:
# cards
#TODO: Localize Section
reorder cards: Reorder cards
#TODO: Localize
update card: Update card
change link: Change link
change notes: Change notes
change id: Change ID
@@ -1059,6 +1085,12 @@ error:
file not found package like:
파일을 찾을 수 없습니다: '%s' 패키지에 '%s'
다른 패키지의 파일을 열려고 하는 경우 다음을 사용하십시오. "/패키지 이름/파일 이름"
#TODO: Localize
file not found package like init:
File not found: '%s' in package '%s'
If this folder is empty or unused, delete it.
#TODO: Localize
package name parse error: Unable to parse package name '%s'
file parse error:
파일을 구문 분석하는 중 오류가 발생했습니다.: '%s'
%s
@@ -1137,7 +1169,9 @@ error:
# image stuff
coordinates for blending overlap: 블렌딩 오버랩을 위한 좌표
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+36 -2
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/polski
full name: Polski (Polish)
version: 2026-02-28
@@ -64,6 +64,8 @@ menu:
#TODO: Localize
search cards: &Search Cards Ctrl+K
add card: &Dodaj Kartę Ctrl+Enter
#TODO: Localize
add card double: &Add Double Faced Card Ctrl+Shift+Enter
add cards: Dodaj &Wiele Kart...
remove card: &Usuń Wybraną Kartę
#TODO: Localize
@@ -227,6 +229,8 @@ help:
#TODO: Localize
search cards: Filter the card list using search terms
add card: Dodaj nową, pustą kartę do zestawu
#TODO: Localize
add card double: Add a new, blank, card that has a back face to this set
add cards: Dodaj wiele kart do zestawu
remove card: Usuń wybraną kartę z zestawu
#TODO: Localize
@@ -502,6 +506,8 @@ tooltip:
# cards toolbar
add card: Dodaj kartę
#TODO: Localize
add card double: Add double faced card
remove card: Usuń wybraną kartę
#TODO: Localize
link card: Link cards to selected card
@@ -654,6 +660,16 @@ label:
stylesheet not found:
Zestaw który próbujesz otworzyć używa stylu z arkusz "%s".
Nie udało się znaleźć tego arkuszu, wybierz jakiś inny.
#TODO: Localize
searching online: Searching online...
#TODO: Localize
searching online fail: Not found online
#TODO: Localize
found online downloading: Found online! Downloading...
#TODO: Localize
found online installing: Found online! Installing...
#TODO: Localize
found online fail: Installation failed
# preferences dialog
language: Język
@@ -808,6 +824,8 @@ label:
installable version: Najnowsza wersja:
installer size: Rozmiar:
installer status: Stan:
#TODO: Localize
folder name: Folder name:
no version: -
#TODO: Localize
@@ -944,10 +962,16 @@ button:
upgrade package: &Uaktualnij
reinstall package: Zainstaluj &ponownie
remove package: &Usuń
#TODO: Localize
keep group: Keep Group As Is
install group: &Instaluj wszystkie
upgrade group: &Uaktualnij wszystkie
remove group: &Usuń wszystkie
# stylesheet not found dialog
#TODO: Localize
find package online: Search Online
############################################################## Titles in the GUI
title:
# window titles
@@ -1037,6 +1061,8 @@ action:
# cards
#TODO: Localize Section
reorder cards: Reorder cards
#TODO: Localize
update card: Update card
change link: Change link
change notes: Change notes
change id: Change ID
@@ -1109,6 +1135,12 @@ error:
file not found package like:
Nie znaleziono pliku: '%s' w paczce '%s'
Jeśli próbujesz otworzyć plik z innej paczki, użyj "/paczka/plik"
#TODO: Localize
file not found package like init:
File not found: '%s' in package '%s'
If this folder is empty or unused, delete it.
#TODO: Localize
package name parse error: Unable to parse package name '%s'
file parse error:
Błąd parsowania pliku: '%s'
%s
@@ -1187,7 +1219,9 @@ error:
# image stuff
coordinates for blending overlap: Współrzędne scalania (blending) nachodzą na siebie
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+33 -13
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/portuguese brazilian
full name: Português do Brasil (Brazilian Portuguese)
version: 2026-02-28
@@ -21,7 +21,7 @@ menu:
export images: Todas as I&magens dos Cards...
export apprentice: &Apprentice...
export mws: Magic &Workstation...
check updates: &Atualizações...
check updates: &Atualizações / Novas folhas de estilo...
print preview: V&isualização da Imprensão...
print: &Imprimir... Ctrl+P
reload data: Recarregar Dados Ctrl+F5
@@ -54,6 +54,7 @@ menu:
next card: Selecionar Próximo ca&rd PgDn
search cards: &Procurar Cards Ctrl+K
add card: &Adicionar Card Ctrl+Enter
add card double: &Adicionar Card de dupla face Ctrl+Shift+Enter
add cards: Adicionar &Multiplos Cards...
remove card: &Deletar Card Selecionado
add card csv: Adicionar Cards de um arquivo CSV ou TSV...
@@ -194,8 +195,9 @@ help:
# cards menu
previous card: Seleciona o Card anterior da lista.
next card: Seleciona o próximo Card da lista.
search cards: Filtre a lista de Cards usando termos de pesquisa
search cards: Filtre a lista de Cards usando termos de pesquisa.
add card: Adicione um novo, em branco, Card para esta Edição.
add card double: Adicione um novo, em branco, Card com verso para esta Edição.
add cards: Adicione multiplos Cards à esta Edição.
remove card: Apaga o Card selecionado desta Edição.
link card: Vincular um ou mais Cards à Card selecionado
@@ -444,6 +446,7 @@ tooltip:
# cards toolbar
add card: Adiciona um Card
add card double: Adicionar um Card de dupla face
remove card: Remove o Card selecionado
link card: Vincular Cards ao Card selecionado
copy card and links: Copiar Cards selecionados e seus Cards vinculados
@@ -579,8 +582,14 @@ label:
# stylesheet not found dialog
stylesheet not found:
A Edição está tentando abrir a folha de estilo "%s".
Esta folha de estilo não é compatível com o sistema padrão. Por favor escolha uma folha de estilo alternativa.
A Edição está tentando abrir a folha de estilo "%s".
Esta folha de estilo não é compatível com o sistema padrão.
Selecione uma alternativa ou procure-a online.
searching online: Pesquisando online...
searching online fail: Não encontrado online
found online downloading: Encontrado online! Baixando...
found online installing: Encontrado online! Instalando...
found online fail: Falha na instalação
# preferences dialog
language: Linguagem
@@ -710,6 +719,7 @@ label:
installable version: Última versão:
installer size: Dimenções:
installer status: Status:
folder name: Nome da pasta:
no version: -
load image: Clique duas vezes para carregar uma imagem
@@ -822,15 +832,19 @@ button:
close: &Fechar
# packages window
keep package: Não& alterar
keep package: Manter como está
don't install package: Não& instalar
install package: &Instalar
upgrade package: &Atualizações
upgrade package: &Atualizar
reinstall package: Re&instalar
remove package: &Remover
install group: &Instalar Tudo
upgrade group: &Atualizar tudo
remove group: &Remover tudo
keep group: &Manter o grupo como está
install group: &Instalar/Atualizar o grupo
upgrade group: &Atualizar o grupo
remove group: &Remover o grupo
# stylesheet not found dialog
find package online: Pesquisar online
############################################################## Titles in the GUI
title:
@@ -910,6 +924,7 @@ title:
action:
# cards
reorder cards: Reordenar Cards
update card: Atualizar Card
change link: Alterar link
change notes: Alterar notas
change id: Alterar ID
@@ -975,10 +990,14 @@ action:
############################################################## Error messages
error:
# file related
file not found: O arquivo não foi encontrado: '%s' em pacotes '%s'
file not found: O arquivo não foi encontrado: '%s' no pacote '%s'
file not found package like:
Arquivo nao encontrado: '%s' in package '%s'
Arquivo nao encontrado: '%s' no pacote '%s'
Se você está tentando abrir um arquivo de outro pacote, use "/package/filename"
file not found package like init:
Arquivo nao encontrado: '%s' no pacote '%s'
Se esta pasta estiver vazia ou não for usada, exclua-a.
package name parse error: Não foi possível analisar o nome do pacote '%s'
file parse error:
Erro ao analisar o arquivo: '%s'
%s
@@ -1048,7 +1067,8 @@ error:
# image stuff
coordinates for blending overlap: As coordenadas para a mistura se sobrepõem.
blending different sizes: As imagens usadas para mesclagem devem ter o mesmo tamanho na função '%s'.
blending different sizes: As imagens usadas para mesclagem devem ter o mesmo tamanho na função '%s'. (Uma é %s, a outra é %s)
blending different mask: A imagem e a máscara usadas para mesclagem devem ter o mesmo tamanho na função '%s' (Imagem é %s, máscara é %s)
negative image width: Imagem com largura zero ou negativa criada na função '%s'
negative image height: Imagem com altura zero ou negativa criada na função '%s'
can't load image: Falha ao carregar a imagem. Verifique se o formato real da imagem corresponde à extensão salva.
+36 -2
View File
@@ -1,4 +1,4 @@
mse version: 2.5.8
mse version: 2.6.0
installer group: Magic Set Editor/translations/russian
full name: Русский (Russian)
version: 2026-02-28
@@ -55,6 +55,8 @@ menu:
next card: Следующая карта PgDn
search cards: Найти карты Ctrl+K
add card: Добавить карту Ctrl+Enter
#TODO: Localize
add card double: &Add Double Faced Card Ctrl+Shift+Enter
add cards: Добавить несколько карт...
remove card: Удалить выделенную карту
#TODO: Localize
@@ -219,6 +221,8 @@ help:
next card: Выбрать следующую карту в списке
search cards: Отфильтруйте список карточек с помощью условий поиска
add card: Добавить новую карту в текущий сет
#TODO: Localize
add card double: Add a new, blank, card that has a back face to this set
add cards: Добавить несколько новых карт в текущий сет
remove card: Удалить выбранную карту из текущего сета
#TODO: Localize
@@ -490,6 +494,8 @@ tooltip:
# cards toolbar
add card: Добавить карту
#TODO: Localize
add card double: Add double faced card
remove card: Удалить выделенную карту
#TODO: Localize
link card: Link cards to selected card
@@ -642,6 +648,16 @@ label:
stylesheet not found:
Сет, который ты пытаешься открыть использует стиль "%s".
Этого стиля не найдено в твоей системе, выбери альтернативу
#TODO: Localize
searching online: Searching online...
#TODO: Localize
searching online fail: Not found online
#TODO: Localize
found online downloading: Found online! Downloading...
#TODO: Localize
found online installing: Found online! Installing...
#TODO: Localize
found online fail: Installation failed
# preferences dialog
language: Язык
@@ -798,6 +814,8 @@ label:
installable version: Последняя версия:
installer size: Размер:
installer status: Статус:
#TODO: Localize
folder name: Folder name:
no version: -
#TODO: Localize
@@ -932,10 +950,16 @@ button:
upgrade package: Обновить
reinstall package: Переустановить
remove package: Удалить
#TODO: Localize
keep group: Keep Group As Is
install group: Установить все
upgrade group: Обновить все
remove group: Удалить все
# stylesheet not found dialog
#TODO: Localize
find package online: Search Online
############################################################## Titles in the GUI
title:
# window titles
@@ -1025,6 +1049,8 @@ action:
# cards
#TODO: Localize Section
reorder cards: Reorder cards
#TODO: Localize
update card: Update card
change link: Change link
change notes: Change notes
change id: Change ID
@@ -1102,6 +1128,12 @@ error:
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"
#TODO: Localize
file not found package like init:
File not found: '%s' in package '%s'
If this folder is empty or unused, delete it.
#TODO: Localize
package name parse error: Unable to parse package name '%s'
file parse error:
Error while parsing file: '%s'
%s
@@ -1182,7 +1214,9 @@ error:
#TODO: Localize
coordinates for blending overlap: Coordinates for blending overlap. Space them out.
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+16
View File
@@ -0,0 +1,16 @@
Function: exists_as_package
--Usage--
> exists_as_package("package")
Check if a package exists in the data folder.
Returns the package's version number as major-minor-patch, or nil if the package does not exists.
--Parameters--
! Parameter Type Description
| @input@ [[type:string]] Full name of the package folder, including game and extension.
--Examples--
> exists_as_package("magic-modules.mse-include") == "2026-02-28"
> exists_as_package("magic-quadruple-faced-leveler.mse-style") == nil
+4
View File
@@ -78,6 +78,7 @@ These functions are built into the program, other [[type:function]]s can be defi
| [[fun:exclusive_choice]] Require that at most one of the given choices is selected.
| [[fun:require_exclusive_choice]] Require that exactly one of the given choices is selected.
| [[fun:remove_choice]] Remove the given choices from a multiple choice value.
| [[fun:is_default]] Check if a field is in its default state.
! Images <<<
| [[fun:linear_blend]] Blend two images together using a linear gradient.
@@ -108,6 +109,7 @@ These functions are built into the program, other [[type:function]]s can be defi
! Cards <<<
| [[fun:new_card]] Construct a new [[type:card]] object.
| [[fun:new_uid]] Construct a new uid.
| [[fun:add_card_to_set]] Add a [[type:card]] to a [[type:set]].
| [[fun:get_card_styling]] Get the styling data of a [[type:card]].
| [[fun:get_card_stylesheet]] Get the stylesheet of a [[type:card]].
@@ -136,4 +138,6 @@ These functions are built into the program, other [[type:function]]s can be defi
| [[fun:assert]] Check a condition for debugging purposes.
| [[fun:warning]] Output a warning message.
| [[fun:error]] Output an error message.
| [[fun:version_is_older]] Checks if a version number is older than another.
| [[fun:exists_as_package]] Checks if a package exists.
| [[fun:exists_in_package]] Checks if a file exists in a package.
+10
View File
@@ -0,0 +1,10 @@
Function: is_default
--Usage--
> is_default(some_field)
Returns true if the field is in its default state, that is, if the user hasn't modified the value yet, false otherwise.
--Parameters--
! Parameter Type Description
| @input@ [[type:field]] Field to test.
+10
View File
@@ -0,0 +1,10 @@
Function: new_uid
--Usage--
> new_uid()
Returns a new card uid, a string of 32 random digits, which is guaranteed to not exist in the set.
--Parameters--
! Parameter Type Description
| @set@ [[type:set]] The set in which to look for uid conflicts. This can be omitted since 'set' is a predefined variable.
+18
View File
@@ -0,0 +1,18 @@
Function: version_is_older
--Usage--
> version_is_older("version", than: "other version")
Check if a version number is strictly older than another.
Malformed version numbers, including nil, are treated as 0-0-0.
--Parameters--
! Parameter Type Description
| @input@ [[type:string]] Version we want to check.
| @than@ [[type:string]] Version we want to check against.
--Examples--
> version_is_older("2025-06-28", than: "2026-02-18") == true
> version_is_older("2026-02-18", than: "2026-02-18") == false
> version_is_older(nil, than: "0-0-1") == true
Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

+1
View File
@@ -66,6 +66,7 @@ tool/dark_reminder IMAGE "tool/dark_reminder.png"
tool/no_auto IMAGE "tool/no_auto.png"
tool/card_add IMAGE "tool/card_add.png"
tool/card_add_double IMAGE "tool/card_add_double.png"
tool/card_add_multiple IMAGE "tool/card_add_multiple.png"
tool/card_modify_multiple IMAGE "tool/card_modify_multiple.png"
tool/card_del IMAGE "tool/card_del.png"
+40 -18
View File
@@ -30,13 +30,6 @@ AddCardAction::AddCardAction(AddingOrRemoving ar, Set& set, const vector<CardP>&
// We always assume uid conflicts occur because a card was copy-pasted into the same set,
// and never because two different cards randomly got assigned the same uid
if (!action.adding) return;
// Tally existing unique ids
unordered_map<String, CardP> all_existing_cards;
unordered_set<String> all_existing_uids;
FOR_EACH(card, set.cards) {
all_existing_cards.insert({ card->uid, card });
all_existing_uids.insert(card->uid);
}
// Tally added unique ids
unordered_map<String, CardP> all_added_uids;
for (size_t pos = 0; pos < action.steps.size(); ++pos) {
@@ -49,7 +42,7 @@ AddCardAction::AddCardAction(AddingOrRemoving ar, Set& set, const vector<CardP>&
String old_uid = added_pair.first;
CardP added_card = added_pair.second;
// Assign new unique id if necessary
if (all_existing_cards.find(old_uid) == all_existing_cards.end()) continue;
if (set.card_uids.find(old_uid) == set.card_uids.end()) continue;
String new_uid = generate_uid();
added_card->uid = new_uid;
all_added_uids.insert({ new_uid, added_card });
@@ -58,21 +51,22 @@ AddCardAction::AddCardAction(AddingOrRemoving ar, Set& set, const vector<CardP>&
FOR_EACH(linked_pair, linked_pairs) {
String& linked_uid = linked_pair.first.get();
if (linked_uid.empty()) continue;
// If it's an added card, replace the link
// If it's an added card, update the link
if (all_added_uids.find(linked_uid) != all_added_uids.end()) {
all_added_uids.at(linked_uid)->updateLinkedUID(old_uid, new_uid);
}
// Otherwise, if it's an existing card, create an action to copy the link
else if (all_existing_cards.find(linked_uid) != all_existing_cards.end()) {
CardP linked_card = all_existing_cards.at(linked_uid);
int linked_index = linked_card->findFreeLink(new_uid, all_existing_uids);
if (linked_index < 0) {
else if (set.card_uids.find(linked_uid) != set.card_uids.end()) {
CardP linked_card = set.card_uids.at(linked_uid);
int selected_index = linked_card->findUIDLink(old_uid);
if (selected_index < 0) continue;
int free_index = linked_card->findFreeLink(new_uid, set.card_uids);
if (free_index < 0) {
queue_message(MESSAGE_WARNING, _ERROR_1_("not enough free links", linked_card->identification()));
continue;
}
else {
String relation(linked_card->getLinkedRelation(linked_index));
card_link_actions.push_back(make_intrusive<OneWayLinkCardsAction>(linked_card, new_uid, relation, linked_index));
}
String selected_relation(linked_card->getLinkedRelation(selected_index));
card_link_actions.push_back(make_intrusive<OneWayLinkCardsAction>(linked_card, new_uid, selected_relation, free_index));
}
}
}
@@ -88,6 +82,33 @@ void AddCardAction::perform(bool to_undo) {
// Update card links
for (size_t i = 0; i < card_link_actions.size(); ++i) {
card_link_actions[i]->perform(to_undo);
}
// Update uid map
set.buildUIDMap();
}
UpdateCardAction::UpdateCardAction(Set& set, const vector<CardP>& cards_to_add, const vector<CardP>& cards_to_remove)
: CardListAction(set)
, action_add(ADD, set, cards_to_add)
, action_remove(REMOVE, set, cards_to_remove)
{}
String UpdateCardAction::getName(bool to_undo) const {
return _ACTION_("update card");
}
void UpdateCardAction::perform(bool to_undo) {
if (to_undo) {
action_remove.perform(to_undo);
set.actions.tellListeners(action_remove, to_undo);
action_add.perform(to_undo);
set.actions.tellListeners(action_add, to_undo);
}
else {
action_add.perform(to_undo);
set.actions.tellListeners(action_add, to_undo);
action_remove.perform(to_undo);
set.actions.tellListeners(action_remove, to_undo);
}
}
@@ -249,7 +270,8 @@ void ChangeCardUIDAction::perform(bool to_undo) {
FOR_EACH(c, set.cards) {
c->updateLinkedUID(card->uid, uid);
}
swap(card->uid, uid);
swap(card->uid, uid);
set.buildUIDMap();
}
// ----------------------------------------------------------------------------- : Pack types
+12
View File
@@ -50,6 +50,18 @@ public:
vector<ActionP> card_link_actions;
};
/// Update one or more cards from a set by replacing them with other cards
class UpdateCardAction : public CardListAction {
public:
UpdateCardAction(Set& set, const vector<CardP>& cards_to_add, const vector<CardP>& cards_to_remove);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
AddCardAction action_add;
AddCardAction action_remove;
};
// ----------------------------------------------------------------------------- : Reorder cards
/// Change the position of a card in the card list by swapping two cards
+4 -2
View File
@@ -400,8 +400,10 @@ String BulkAction::getName(bool to_undo) const {
return to_undo ? name_undo : name_do;
}
void BulkAction::perform(bool to_undo) {
FOR_EACH(action, actions) {
void BulkAction::perform(bool to_undo) {
size_t size = actions.size();
for (size_t i = 0 ; i < size ; ++i) {
ActionP& action = actions[to_undo ? size - i - 1 : i];
action->perform(to_undo);
set->actions.tellListeners(*action, to_undo);
}
+9 -5
View File
@@ -25,18 +25,22 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(AddCardsScript) {
void AddCardsScript::perform(Set& set, vector<CardP>& out) {
// Perform script
Context& ctx = set.getContext();
Context& ctx = set.getContext();
if (enabled.hasBeenRead()) {
enabled.update(ctx);
if (!enabled()) return;
}
ScriptValueP result = script.invoke(ctx);
// Add cards to out
ScriptValueP it = result->makeIterator();
while (ScriptValueP item = it->next()) {
CardP card = from_script<CardP>(item);
CardP new_card = from_script<CardP>(item);
// is this a new card?
if (contains(set.cards,card) || contains(out,card)) {
if (contains(set.cards,new_card) || contains(out,new_card)) {
// make copy
card = make_intrusive<Card>(*card);
new_card = make_intrusive<Card>(&set, new_card);
}
out.push_back(card);
out.push_back(new_card);
}
}
+126 -47
View File
@@ -42,7 +42,38 @@ Card::Card(Game& game)
, has_styling(false)
{
data.init(game.card_fields);
}
}
Card::Card(Set* set, const CardP& card)
: game(card->game)
, time_created (wxDateTime::Now())
, time_modified(wxDateTime::Now())
, notes(card->notes)
, uid(generate_uid())
, linked_card_1(card->linked_card_1)
, linked_card_2(card->linked_card_2)
, linked_card_3(card->linked_card_3)
, linked_card_4(card->linked_card_4)
, linked_relation_1(card->linked_relation_1)
, linked_relation_2(card->linked_relation_2)
, linked_relation_3(card->linked_relation_3)
, linked_relation_4(card->linked_relation_4)
, has_styling(card->has_styling)
, stylesheet_version(card->stylesheet_version)
, stylesheet(card->stylesheet)
{
if (!stylesheet && set) {
stylesheet = set->stylesheetForP(card);
}
if (has_styling) {
styling_data.cloneFrom(card->styling_data);
}
else {
if (stylesheet && set) styling_data.cloneFrom(set->stylingDataFor(*stylesheet));
}
data.cloneFrom(card->data);
extra_data.cloneFrom(card->extra_data);
}
String Card::identification() const {
// an identifying field
@@ -67,7 +98,7 @@ bool Card::contains(QuickFilterPart const& query) const {
return false;
}
vector<int> Card::findFreeLinks(vector<String>& linked_uids, const unordered_set<String>& all_existing_uids) {
vector<int> Card::findFreeLinks(vector<String>& linked_uids, const unordered_map<String, CardP>& all_existing_uids) {
vector<int> freeIndexes;
int count = min(4, (int)linked_uids.size());
LINK_PAIRS(linked_pairs, this);
@@ -109,7 +140,7 @@ vector<int> Card::findFreeLinks(vector<String>& linked_uids, const unordered_set
}
return freeIndexes;
}
int Card::findFreeLink(const String& linked_uid, const unordered_set<String>& all_existing_uids) {
int Card::findFreeLink(const String& linked_uid, const unordered_map<String, CardP>& all_existing_uids) {
vector<String> linked_uids { linked_uid };
return findFreeLinks(linked_uids, all_existing_uids)[0];
}
@@ -155,12 +186,26 @@ void Card::updateLinkedUID(const String& old_uid, const String& new_uid) {
if (index >= 0) getLinkedUID(index) = new_uid;
}
vector<CardP> Card::getLinkedRelationCards(const vector<CardP>& cards, const String& linked_relation, bool erase_if_no_card) {
//vector<CardP> Card::getLinkedRelationCards(const vector<CardP>& cards, const String& linked_relation, bool erase_if_no_card) {
// vector<CardP> other_cards;
// vector<int> indexes = findRelationLinks(linked_relation);
// for (size_t i = 0; i < indexes.size(); ++i) {
// String& linked_uid = getLinkedUID(indexes[i]);
// CardP other_card = getUIDCard(cards, linked_uid);
// if (other_card) other_cards.push_back(other_card);
// else if (erase_if_no_card) {
// linked_uid = _("");
// getLinkedRelation(indexes[i]) = _("");
// }
// }
// return other_cards;
//}
vector<CardP> Card::getLinkedRelationCards(const Set& set, const String& linked_relation, bool erase_if_no_card) {
vector<CardP> other_cards;
vector<int> indexes = findRelationLinks(linked_relation);
for (size_t i = 0; i < indexes.size(); ++i) {
String& linked_uid = getLinkedUID(indexes[i]);
CardP other_card = getUIDCard(cards, linked_uid);
CardP other_card = getUIDCard(set, linked_uid);
if (other_card) other_cards.push_back(other_card);
else if (erase_if_no_card) {
linked_uid = _("");
@@ -169,51 +214,76 @@ vector<CardP> Card::getLinkedRelationCards(const vector<CardP>& cards, const Str
}
return other_cards;
}
vector<CardP> Card::getLinkedRelationCards(const Set& set, const String& linked_relation, bool erase_if_no_card) {
return getLinkedRelationCards(set.cards, linked_relation, erase_if_no_card);
}
vector<pair<CardP, String>> Card::getLinkedCards(const vector<CardP>& cards) {
unordered_map<String, String> links{
{ linked_card_1, linked_relation_1 },
{ linked_card_2, linked_relation_2 },
{ linked_card_3, linked_relation_3 },
{ linked_card_4, linked_relation_4 }
};
//vector<pair<CardP, String>> Card::getLinkedCards(const vector<CardP>& cards) {
// unordered_map<String, String> links{
// { linked_card_1, linked_relation_1 },
// { linked_card_2, linked_relation_2 },
// { linked_card_3, linked_relation_3 },
// { linked_card_4, linked_relation_4 }
// };
// vector<pair<CardP, String>> linked_cards;
// FOR_EACH(other_card, cards) {
// if (links.find(other_card->uid) != links.end()) {
// linked_cards.push_back(make_pair(other_card, links.at(other_card->uid)));
// }
// }
// return linked_cards;
//}
vector<pair<CardP, String>> Card::getLinkedCards(const Set& set) {
vector<pair<CardP, String>> linked_cards;
FOR_EACH(other_card, cards) {
if (links.find(other_card->uid) != links.end()) {
linked_cards.push_back(make_pair(other_card, links.at(other_card->uid)));
}
CardP other_card_1 = getUIDCard(set, linked_card_1);
if (other_card_1) {
linked_cards.push_back(make_pair(other_card_1, linked_relation_1));
}
CardP other_card_2 = getUIDCard(set, linked_card_2);
if (other_card_2) {
linked_cards.push_back(make_pair(other_card_2, linked_relation_2));
}
CardP other_card_3 = getUIDCard(set, linked_card_3);
if (other_card_3) {
linked_cards.push_back(make_pair(other_card_3, linked_relation_3));
}
CardP other_card_4 = getUIDCard(set, linked_card_4);
if (other_card_4) {
linked_cards.push_back(make_pair(other_card_4, linked_relation_4));
}
return linked_cards;
}
vector<pair<CardP, String>> Card::getLinkedCards(const Set& set) {
return getLinkedCards(set.cards);
}
CardP Card::getLinkedOtherFaceCard(const vector<CardP>& cards) {
unordered_set<String> faces;
if (linked_relation_1 == _("Front Face") || linked_relation_1 == _("Back Face")) faces.emplace(linked_card_1);
if (linked_relation_2 == _("Front Face") || linked_relation_2 == _("Back Face")) faces.emplace(linked_card_2);
if (linked_relation_3 == _("Front Face") || linked_relation_3 == _("Back Face")) faces.emplace(linked_card_3);
if (linked_relation_4 == _("Front Face") || linked_relation_4 == _("Back Face")) faces.emplace(linked_card_4);
FOR_EACH(other_card, cards) {
if (faces.find(other_card->uid) != faces.end()) return other_card;
//CardP Card::getLinkedOtherFaceCard(const vector<CardP>& cards) {
// unordered_set<String> faces;
// if (linked_relation_1 == _("Front Face") || linked_relation_1 == _("Back Face")) faces.emplace(linked_card_1);
// if (linked_relation_2 == _("Front Face") || linked_relation_2 == _("Back Face")) faces.emplace(linked_card_2);
// if (linked_relation_3 == _("Front Face") || linked_relation_3 == _("Back Face")) faces.emplace(linked_card_3);
// if (linked_relation_4 == _("Front Face") || linked_relation_4 == _("Back Face")) faces.emplace(linked_card_4);
// FOR_EACH(other_card, cards) {
// if (faces.find(other_card->uid) != faces.end()) return other_card;
// }
// return nullptr;
//}
CardP Card::getLinkedOtherFaceCard(const Set& set) {
if (linked_relation_1 == _("Front Face") || linked_relation_1 == _("Back Face")) {
CardP other_card_1 = getUIDCard(set, linked_card_1);
if (other_card_1) return other_card_1;
}
if (linked_relation_2 == _("Front Face") || linked_relation_2 == _("Back Face")) {
CardP other_card_2 = getUIDCard(set, linked_card_2);
if (other_card_2) return other_card_2;
}
if (linked_relation_3 == _("Front Face") || linked_relation_3 == _("Back Face")) {
CardP other_card_3 = getUIDCard(set, linked_card_3);
if (other_card_3) return other_card_3;
}
if (linked_relation_4 == _("Front Face") || linked_relation_4 == _("Back Face")) {
CardP other_card_4 = getUIDCard(set, linked_card_4);
if (other_card_4) return other_card_4;
}
return nullptr;
}
CardP Card::getLinkedOtherFaceCard(const Set& set) {
return getLinkedOtherFaceCard(set.cards);
}
void Card::addLink(const Set& set, CardP& linked_card, const String& selected_relation, const String& linked_relation) {
unordered_set<String> all_existing_uids;
FOR_EACH(card, set.cards) {
all_existing_uids.insert(card->uid);
}
int index = findFreeLink(linked_card->uid, all_existing_uids);
int index = findFreeLink(linked_card->uid, set.card_uids);
if (index < 0) {
queue_message(MESSAGE_ERROR, _ERROR_1_("not enough free links", identification()));
return;
@@ -221,7 +291,7 @@ void Card::addLink(const Set& set, CardP& linked_card, const String& selected_re
getLinkedUID(index) = linked_card->uid;
getLinkedRelation(index) = linked_relation;
index = linked_card->findFreeLink(uid, all_existing_uids);
index = linked_card->findFreeLink(uid, set.card_uids);
if (index < 0) {
queue_message(MESSAGE_ERROR, _ERROR_1_("not enough free links", linked_card->identification()));
}
@@ -246,15 +316,19 @@ void Card::removeLink(const CardP& linked_card)
}
}
CardP Card::getUIDCard(const vector<CardP>& cards, const String& uid) {
FOR_EACH(card, cards) {
if (card->uid == uid) return card;
//CardP Card::getUIDCard(const vector<CardP>& cards, const String& uid) {
// FOR_EACH(card, cards) {
// if (card->uid == uid) return card;
// }
// return nullptr;
//}
CardP Card::getUIDCard(const Set& set, const String& uid) {
auto it = set.card_uids.find(uid);
if (it != set.card_uids.end()) {
return it->second;
}
return nullptr;
}
CardP Card::getUIDCard(const Set& set, const String& uid) {
return getUIDCard(set.cards, uid);
}
IndexMap<FieldP, ValueP>& Card::extraDataFor(const StyleSheet& stylesheet) {
return extra_data.get(stylesheet.name(), stylesheet.extra_card_fields);
@@ -301,7 +375,12 @@ void reflect_version_check(GetDefaultMember& handler, const Char* key, intrusive
IMPLEMENT_REFLECTION(Card) {
REFLECT(stylesheet);
reflect_version_check(handler, _("stylesheet_version"), stylesheet);
if (Handler::isReading) {
REFLECT_NO_SCRIPT(stylesheet_version);
}
else {
reflect_version_check(handler, _("stylesheet_version"), stylesheet);
}
REFLECT(has_styling);
if (has_styling) {
if (stylesheet) {
+11 -7
View File
@@ -35,6 +35,8 @@ public:
Card();
/// Creates a card using the given game
Card(Game& game);
/// Copy constructor, makes a deep copy
Card(Set* set, const CardP& card);
/// The game this card is made for
Game* game;
@@ -60,7 +62,9 @@ public:
wxDateTime time_created, time_modified;
/// Alternative style to use for this card
/** Optional; if not set use the card style from the set */
StyleSheetP stylesheet;
StyleSheetP stylesheet;
/// What version of the stylesheet was this card using when it was last saved?
Version stylesheet_version;
/// Alternative options to use for this card, for this card's stylesheet
/** Optional; if not set use the styling data from the set.
* If stylesheet is set then contains data for the this->stylesheet, otherwise for set->stylesheet
@@ -106,8 +110,8 @@ public:
}
/// Find the index of a free link slot to write to. Returns -1 if not found.
int findFreeLink (const String& linked_uid, const unordered_set<String>& all_existing_uids);
vector<int> findFreeLinks(vector<String>& linked_uids, const unordered_set<String>& all_existing_uids);
int findFreeLink (const String& linked_uid, const unordered_map<String, CardP>& all_existing_uids);
vector<int> findFreeLinks(vector<String>& linked_uids, const unordered_map<String, CardP>& all_existing_uids);
/// Find the index of a link slot that references the linked_uid. Returns -1 if not found.
int findUIDLink(const String& linked_uid);
@@ -125,18 +129,18 @@ public:
//void updateLinkedRelation(const String& old_relation, const String& new_relation);
/// Get the card with the given uid.
static CardP getUIDCard(const vector<CardP>& cards, const String& uid);
//static CardP getUIDCard(const vector<CardP>& cards, const String& uid);
static CardP getUIDCard(const Set& set, const String& uid);
/// Get all the cards linked to this card with the given relation.
vector<CardP> getLinkedRelationCards(const vector<CardP>& cards, const String& linked_relation, bool erase_if_no_card = true);
//vector<CardP> getLinkedRelationCards(const vector<CardP>& cards, const String& linked_relation, bool erase_if_no_card = true);
vector<CardP> getLinkedRelationCards(const Set& set, const String& linked_relation, bool erase_if_no_card = true);
/// Get all the cards linked to this card.
vector<pair<CardP, String>> getLinkedCards(const vector<CardP>& cards);
//vector<pair<CardP, String>> getLinkedCards(const vector<CardP>& cards);
vector<pair<CardP, String>> getLinkedCards(const Set& set);
/// Get the back face or front face of this card.
CardP getLinkedOtherFaceCard(const vector<CardP>& cards);
//CardP getLinkedOtherFaceCard(const vector<CardP>& cards);
CardP getLinkedOtherFaceCard(const Set& set);
/// Link a card to this card.
+4
View File
@@ -305,6 +305,10 @@ bool Value::equals(const Value* that) {
return this == that;
}
bool Value::isDefault() {
return false;
}
bool Value::update(Context& ctx) {
updateAge();
updateSortValue(ctx);
+3 -1
View File
@@ -255,7 +255,9 @@ public:
virtual ValueP clone() const = 0;
/// Convert this value to a string for use in tables
virtual String toString() const = 0;
virtual String toString() const = 0;
/// Check if this value is in the default state
virtual bool isDefault();
/// Apply scripts to this value, return true if the value has changed
virtual bool update(Context& ctx);
/// This value has been updated by an action
+6 -1
View File
@@ -317,7 +317,12 @@ ChoiceValue::ChoiceValue(const ChoiceFieldP& field, bool initial_first_choice)
String ChoiceValue::toString() const {
return value();
}
}
bool ChoiceValue::isDefault() {
return value.isDefault();
}
bool ChoiceValue::update(Context& ctx) {
bool change = field().default_script.invokeOnDefault(ctx, value)
| field(). script.invokeOn(ctx, value);
+3 -1
View File
@@ -199,7 +199,9 @@ public:
DECLARE_VALUE_TYPE(Choice, Defaultable<String>);
ValueType value; /// The name of the selected choice
bool isDefault() override;
bool update(Context&) override;
};
+5
View File
@@ -110,7 +110,12 @@ String ColorValue::toString() const {
if (value() == c->color) return c->name;
}
return _("<color>");
}
bool ColorValue::isDefault() {
return value.isDefault();
}
bool ColorValue::update(Context& ctx) {
bool change = field().default_script.invokeOnDefault(ctx, value)
| field(). script.invokeOn(ctx, value);
+3 -1
View File
@@ -77,7 +77,9 @@ public:
DECLARE_VALUE_TYPE(Color, Defaultable<Color>);
ValueType value; ///< The value
bool isDefault() override;
bool update(Context&) override;
};
+4
View File
@@ -39,6 +39,10 @@ String ImageValue::toString() const {
return filename.empty() ? _("") : _("<image>");
}
bool ImageValue::isDefault() {
return filename.empty();
}
// custom reflection: convert to ScriptImageP for scripting
void ImageValue::reflect(Reader& handler) {
+3 -1
View File
@@ -47,7 +47,9 @@ public:
}
ValueType filename; ///< Filename of the image (in the current package), or ""
Age last_update; ///< When was the image last changed?
Age last_update; ///< When was the image last changed?
bool isDefault() override;
};
// ----------------------------------------------------------------------------- : ImageStyle
+5
View File
@@ -62,7 +62,12 @@ IMPLEMENT_REFLECTION(InfoStyle) {
String InfoValue::toString() const {
return value;
}
bool InfoValue::isDefault() {
return true;
}
bool InfoValue::update(Context& ctx) {
if (value.empty()) value = field().caption.get();
bool change = field().script.invokeOn(ctx, value);
+3 -1
View File
@@ -60,7 +60,9 @@ public:
DECLARE_VALUE_TYPE(Info, String);
ValueType value;
bool isDefault() override;
bool update(Context&) override;
};
+4
View File
@@ -52,6 +52,10 @@ IMPLEMENT_REFLECTION_NAMELESS(MultipleChoiceValue) {
REFLECT_BASE(ChoiceValue);
}
bool MultipleChoiceValue::isDefault() {
return value.isDefault();
}
bool MultipleChoiceValue::update(Context& ctx) {
String old_value = value();
ctx.setVariable(_("last_change"), to_script(last_change));
+3 -1
View File
@@ -63,7 +63,9 @@ public:
/// Splits the value, stores the selected choices in the out parameter
void get(vector<String>& out) const;
bool isDefault() override;
bool update(Context&) override;
private:
+6
View File
@@ -62,6 +62,12 @@ PackagedP PackageChoiceValue::getPackage() const {
else return package_manager.openAny(package_name, true);
}
bool PackageChoiceValue::isDefault() {
PackageChoiceFieldP packageFieldP = boost::dynamic_pointer_cast<PackageChoiceField>(fieldP);
if (packageFieldP) return package_name == packageFieldP->initial;
return false;
}
bool PackageChoiceValue::update(Context& ctx) {
bool change = field().script.invokeOn(ctx, package_name);
Value::update(ctx);
+3 -1
View File
@@ -61,7 +61,9 @@ public:
/// Get the package (if it is set), otherwise return nullptr
PackagedP getPackage() const;
bool isDefault() override;
bool update(Context&) override;
};
+4
View File
@@ -51,6 +51,10 @@ String SymbolValue::toString() const {
return filename.empty() ? _("") : _("<symbol>");
}
bool SymbolValue::isDefault() {
return filename.empty();
}
IMPLEMENT_REFLECTION_NO_GET_MEMBER(SymbolValue) {
if (fieldP->save_value || !handler.isWriting) REFLECT_NAMELESS(filename);
}
+3 -1
View File
@@ -69,6 +69,8 @@ public:
DECLARE_VALUE_TYPE(Symbol, LocalFileName);
ValueType filename; ///< Filename of the symbol (in the current package)
Age last_update; ///< When was the symbol last changed?
Age last_update; ///< When was the symbol last changed?
bool isDefault() override;
};
+5
View File
@@ -176,7 +176,12 @@ IMPLEMENT_REFLECTION(TextStyle) {
String TextValue::toString() const {
return untag_hide_sep(value());
}
bool TextValue::isDefault() {
return value.isDefault();
}
bool TextValue::update(Context& ctx) {
updateAge();
WITH_DYNAMIC_ARG(last_update_age, last_update.get());
+3 -1
View File
@@ -112,7 +112,9 @@ public:
ValueType value; ///< The text of this value
Age last_update; ///< When was the text last changed?
bool isDefault() override;
bool update(Context&) override;
};
+1 -1
View File
@@ -640,8 +640,8 @@ ApprenticeExportWindow::ApprenticeExportWindow(Window* parent, const SetP& set)
s->Add(new wxStaticText(this, -1, _HELP_( "set code")), 0, wxALL, 4);
s->AddSpacer(4);
s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | (wxALL & ~wxTOP), 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
}
void ApprenticeExportWindow::onApprenticeBrowse(wxCommandEvent& ev) {
+48 -25
View File
@@ -61,9 +61,11 @@ IMPLEMENT_REFLECTION(WrappedCards) {
}
wxDataFormat CardsDataObject::format(wxString("application/x-mse-cards"));
wxDataFormat CardsDataObject::format(wxString("application/x-mse-cards"));
CardsDataObject::CardsDataObject(const SetP& set, const String id, const vector<CardP>& cards) {
CardsDataObject::CardsDataObject(const SetP& set, const String& id, const vector<CardP>& cards)
: wxCustomDataObject(format)
{
// set the stylesheet, so when deserializing we know whos style options we are reading
vector<bool> has_styling;
for (size_t i = 0 ; i < cards.size() ; ++i) {
@@ -72,9 +74,15 @@ CardsDataObject::CardsDataObject(const SetP& set, const String id, const vector<
cards[i]->stylesheet = set->stylesheet;
}
}
// store as raw bytes
WrappedCards data = { set->game.get(), set->game->name(), id, cards };
SetText(serialize_for_clipboard(*set, data));
// restore cards
String serialized = serialize_for_clipboard(*set, data);
wxScopedCharBuffer utf8 = serialized.utf8_str();
buffer.assign(utf8.data(), utf8.length());
SetData(buffer.size(), buffer.data());
// restore styling
for (size_t i = 0 ; i < cards.size() ; ++i) {
if (has_styling[i]) {
cards[i]->stylesheet = StyleSheetP();
@@ -83,22 +91,31 @@ CardsDataObject::CardsDataObject(const SetP& set, const String id, const vector<
SetFormat(format);
}
CardsDataObject::CardsDataObject() {
SetFormat(format);
}
CardsDataObject::CardsDataObject()
: wxCustomDataObject(format)
{}
bool CardsDataObject::getCards(const SetP& set, const String id, vector<CardP>& out) {
bool CardsDataObject::getCards(const SetP& set, const String& id, vector<CardP>& out) {
size_t size = GetSize();
if (size == 0) return false;
const void* raw = GetData();
if (!raw) return false;
String text(wxString::FromUTF8(static_cast<const char*>(raw), size));
WrappedCards data = { set->game.get(), set->game->name() };
deserialize_from_clipboard(data, *set, GetText());
try {
deserialize_from_clipboard(data, *set, text);
} catch (...) {
queue_message(MESSAGE_ERROR, _("DEBUG: Card deserialization failed"));
return false;
}
if (data.cards.empty()) return false;
if (!id.empty() && data.id == id) return false;
if (data.game_name == set->game->name()) {
// Cards are from the same game
out = data.cards;
return true;
} else {
return false;
}
if (data.game_name != set->game->name()) return false;
// Cards are from the same game
out = data.cards;
return true;
}
// ----------------------------------------------------------------------------- : KeywordDataObject
@@ -139,28 +156,34 @@ KeywordP KeywordDataObject::getKeyword(const SetP& set) {
deserialize_from_clipboard(data, *set, GetText());
if (data.game_name != set->game->name()) return KeywordP(); // Keyword is from a different game
else return keyword;
}
}
// ----------------------------------------------------------------------------- : Card on clipboard
CardsOnClipboard::CardsOnClipboard(const SetP& set, const String id, const vector<CardP>& cards) {
wxBusyCursor busy;
// Conversion to image file
if (cards.size() < 6) {
Bitmap bmp;
Image img;
if (cards.size() == 1) {
img = export_image(set, cards[0]);
img = export_image(set, cards[0], true, 1.0, 0.0, 0.0, &bmp);
}
else {
img = export_image(set, cards);
img = export_image(set, cards);
bmp = Bitmap(img);
}
String temp_path = wxFileName::CreateTempFileName(_("mse")) + _(".png");
img.SaveFile(temp_path, wxBITMAP_TYPE_PNG);
wxFileDataObject* fileData = new wxFileDataObject();
fileData->AddFile(temp_path);
Add(fileData);
wxImageDataObject* imgData = new wxImageDataObject();
//wxFileDataObject* fileData = new wxFileDataObject(); // needed for pasting on desktop, but slow
//String temp_path = wxFileName::CreateTempFileName(_("mse")) + _(".png");
//img.SaveFile(temp_path, wxBITMAP_TYPE_PNG);
//fileData->AddFile(temp_path);
//Add(fileData);
wxImageDataObject* imgData = new wxImageDataObject(); // needed for metadata
imgData->SetImage(img);
Add(imgData);
wxBitmapDataObject* bmpData = new wxBitmapDataObject(); // needed for pasting in MSPaint
bmpData->SetBitmap(bmp);
Add(bmpData);
}
// Conversion to serialized card format
Add(new CardsDataObject(set, id, cards), true);
+8 -5
View File
@@ -18,20 +18,23 @@ DECLARE_POINTER_TYPE(Keyword);
// ----------------------------------------------------------------------------- : CardDataObject
/// The data format for cards on the clipboard
class CardsDataObject : public wxTextDataObject {
class CardsDataObject : public wxCustomDataObject {
public:
/// Name of the format of MSE cards
static wxDataFormat format;
CardsDataObject();
/// Store a card
CardsDataObject(const SetP& set, const String id, const vector<CardP>& cards);
CardsDataObject(const SetP& set, const String& id, const vector<CardP>& cards);
/// Retrieve the cards, only if this is made with the same game as set
/// And if this is NOT of the same id as the given one
/** Return true if the cards are correctly retrieved, and there is at least one card */
bool getCards(const SetP& set, const String id, vector<CardP>& out);
};
bool getCards(const SetP& set, const String& id, vector<CardP>& out);
private:
std::string buffer; // keep data alive for wx
};
// ----------------------------------------------------------------------------- : KeywordDataObject
@@ -44,7 +47,7 @@ public:
KeywordDataObject();
/// Store a keyword
KeywordDataObject(const SetP& set, const KeywordP& card);
/// Retrieve a keyword, only if it is made with the same game as set
KeywordP getKeyword(const SetP& set);
};
+1 -1
View File
@@ -89,7 +89,7 @@ FileFormatP mtg_editor_file_format();
// ----------------------------------------------------------------------------- : Other ways to export
/// Generate a wxImage of one or more cards
Image export_image(const SetP& set, const CardP& card, bool write_metadata = true, double zoom = 1.0, Radians angle_radians = 0.0, double bleed_pixels = 0.0);
Image export_image(const SetP& set, const CardP& card, bool write_metadata = true, double zoom = 1.0, Radians angle_radians = 0.0, double bleed_pixels = 0.0, Bitmap* out_bitmap = nullptr);
Image export_image(const SetP& set, const vector<CardP>& cards, int padding = 2, double global_zoom = 1.0, bool use_zoom_setting = true, bool use_rotation_setting = true, bool use_bleed_setting = false);
/// Export the image of one or more cards to a given filename, using the app's zoom, rotation and bleed settings, and including metadata
+5 -3
View File
@@ -35,7 +35,7 @@ Rotation ZoomedUnrotatedDataViewer::getRotation() const {
// ----------------------------------------------------------------------------- : wxImage export
Image export_image(const SetP& set, const CardP& card, bool write_metadata, double zoom, Radians angle_radians, double bleed_pixels) {
Image export_image(const SetP& set, const CardP& card, bool write_metadata, double zoom, Radians angle_radians, double bleed_pixels, Bitmap* out_bitmap) {
if (!set) throw Error(_("no set"));
/// create and zoom
ZoomedUnrotatedDataViewer viewer = ZoomedUnrotatedDataViewer(zoom);
@@ -51,6 +51,9 @@ Image export_image(const SetP& set, const CardP& card, bool write_metadata, doub
viewer.draw(dc);
dc.SelectObject(wxNullBitmap);
Image img = bitmap.ConvertToImage();
/// return bitmap if needed
if (out_bitmap) *out_bitmap = std::move(bitmap);
/// rotate
img = rotate_image(img, angle_radians);
@@ -218,8 +221,7 @@ void export_image(const SetP& set, const CardP& card, const String& filename) {
img.SaveFile(filename);
}
void export_image(const SetP& set, const vector<CardP>& cards, const String& path, const String& filename_template, FilenameConflicts conflicts)
{
void export_image(const SetP& set, const vector<CardP>& cards, const String& path, const String& filename_template, FilenameConflicts conflicts) {
wxBusyCursor busy;
// Script
ScriptP filename_script = parse(filename_template, nullptr, true);
+84 -80
View File
@@ -13,6 +13,7 @@
#include <boost/json.hpp>
#include <wx/filename.h>
#include <fstream>
#include <filesystem>
// ----------------------------------------------------------------------------- : Crop Rect Encoding
@@ -36,44 +37,44 @@ inline static String encodeRectInWxString(RealRect rect, int degrees) {
_("</mse-crop-data>");
}
/// Retreive a rect encoded in a string, return true if successful
/// Retreive a rect encoded in a string, return true if "<mse-crop-data>" was found
inline static bool decodeRectFromString(const String& rectString, RealRect& rect_out, int& degrees_out) {
size_t start = rectString.find(_("<mse-crop-data>"));
if (start == String::npos) return false;
size_t end = rectString.find(_("</mse-crop-data>"), start + 15);
if (end == String::npos) return false;
if (end == String::npos) return true;
String string = rectString.substr(start + 15, end - (start + 15));
if (string.empty()) return false;
if (string.empty()) return true;
size_t divider = string.find(_(";"));
if (divider == String::npos) return false;
if (divider == 0) return false;
if (divider == String::npos) return true;
if (divider == 0) return true;
int x;
if(!string.substr(0, divider).ToInt(&x)) return false;
if(!string.substr(0, divider).ToInt(&x)) return true;
string = string.substr(divider + 1);
divider = string.find(_(";"));
if (divider == String::npos) return false;
if (divider == 0) return false;
if (divider == String::npos) return true;
if (divider == 0) return true;
int y;
if(!string.substr(0, divider).ToInt(&y)) return false;
if(!string.substr(0, divider).ToInt(&y)) return true;
string = string.substr(divider + 1);
divider = string.find(_(";"));
if (divider == String::npos) return false;
if (divider == 0) return false;
if (divider == String::npos) return true;
if (divider == 0) return true;
int width;
if(!string.substr(0, divider).ToInt(&width)) return false;
if(!string.substr(0, divider).ToInt(&width)) return true;
string = string.substr(divider + 1);
divider = string.find(_(";"));
if (divider == String::npos) return false;
if (divider == 0) return false;
if (divider == String::npos) return true;
if (divider == 0) return true;
int height;
if(!string.substr(0, divider).ToInt(&height)) return false;
if(!string.substr(0, divider).ToInt(&height)) return true;
string = string.substr(divider + 1);
if(!string.ToInt(&degrees_out)) return false;
if(!string.ToInt(&degrees_out)) return true;
rect_out = RealRect(x, y, width, height);
return true;
@@ -81,17 +82,18 @@ inline static bool decodeRectFromString(const String& rectString, RealRect& rect
/// Retreive a rect encoded in a string, apply a transformation, then encode it back
inline static String transformEncodedRect(const String& rectString, RectTransform transform, double param_x, double param_y, int mode) {
RealRect rect(0,0,0,0);
int degrees;
if (!decodeRectFromString(rectString, rect, degrees)) return _("");
transform(rect, degrees, param_x, param_y, mode);
return encodeRectInWxString(rect, degrees);
RealRect rect(0.0, 0.0, 0.0, 0.0);
int degrees = 0;
decodeRectFromString(rectString, rect, degrees);
if (rect.width > 0.0 && rect.height > 0.0) {
transform(rect, degrees, param_x, param_y, mode);
return encodeRectInWxString(rect, degrees);
}
return _("");
}
/// Retreive all rects encoded in a string, apply a transformation, then encode them back
inline static String transformAllEncodedRects(const String& rectString, RectTransform transform, double param_x, double param_y, int mode = 0) {
RealRect rect(0,0,0,0);
int degrees;
size_t start = rectString.find(_("<mse-crop-data>"));
if (start == String::npos) return rectString;
size_t end = 0;
@@ -110,67 +112,70 @@ inline static String transformAllEncodedRects(const String& rectString, RectTran
// ----------------------------------------------------------------------------- : File to UTF8 Encoding
inline static const char Base64Alphabet[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
inline static const std::vector<int> Base64ReverseAlphabet = [] {
std::vector<int> table(256, -1);
for (int i = 0; i < 64; i++) table[(uint8_t)Base64Alphabet[i]] = i;
return table;
}();
/// Encode a file in a string
inline static std::string fileToUTF8(const std::string& filepath) {
// File to char
// Load file
std::ifstream file(filepath, std::ios::binary);
file.unsetf(std::ios::skipws);
std::vector<unsigned char> buffer = std::vector<unsigned char>(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());
int size = buffer.size();
if (size < 2) {
queue_message(MESSAGE_WARNING, _("File too small to encode"));
if (!file) {
queue_message(MESSAGE_WARNING, _("Could not find file: ") + String(filepath));
return "";
}
// All bytes that have a highest bit of 0 are valid UTF8 characters, so:
// Reset the highest bit of each byte, store these bits in additional bytes at the end
const unsigned char highest_bit = 1 << 7;
unsigned char added_byte = 0;
for (int i = 0, b = 0 ; i < size ; ++i, ++b) {
if (b == 7) { // Never set the highest bit of the added byte
buffer.push_back(added_byte);
b = 0;
}
unsigned char bit = 1 << b;
if ((buffer[i] & highest_bit) != 0) { // The highest bit of the buffer is set
buffer[i] &= ~highest_bit; // Reset the highest bit of the buffer
added_byte |= bit; // Set the bit of the added byte
} else {
added_byte &= ~bit; // Reset the bit of the added byte
size_t size = std::filesystem::file_size(filepath);
std::vector<uint8_t> data(size);
file.read(reinterpret_cast<char*>(data.data()), size);
// Base64 encode
std::string out;
out.reserve(((size + 2) / 3) * 4);
int val = 0;
int valb = -6;
for (uint8_t c : data) {
val = (val << 8) | c;
valb += 8;
while (valb >= 0) {
out.push_back(Base64Alphabet[(val >> valb) & 0x3F]);
valb -= 6;
}
}
buffer.push_back(added_byte);
// Char to string
return std::string(buffer.begin(), buffer.end());
if (valb > -6) {
out.push_back(Base64Alphabet[((val << 8) >> (valb + 8)) & 0x3F]);
}
// Pad
while (out.size() % 4) {
out.push_back('=');
}
return out;
}
/// Retreive a file encoded in a string, return true if successful
inline static bool UTF8ToFile(const std::string& filepath, std::string& string) {
// String to char
std::vector<unsigned char> buffer(string.begin(), string.end());
int size = buffer.size();
if (size < 2) {
queue_message(MESSAGE_WARNING, _("File too small to decode"));
return false;
}
// Restore the highest bit of each byte
size = (size * 7) / 8;
const unsigned char highest_bit = 1 << 7;
unsigned char added_byte = buffer[size];
for (int i = 0, j = size, b = 0 ; i < size ; ++i, ++b) {
if (b == 7) {
++j;
added_byte = buffer[j];
b = 0;
}
unsigned char bit = 1 << b;
if ((added_byte & bit) != 0) { // The bit of the added byte is set
buffer[i] |= highest_bit; // Set the highest bit of the buffer
inline static bool UTF8ToFile(const std::string& filepath, std::string& data) {
// Base64 decode
std::string out;
out.reserve(data.size() * 3 / 4);
int val = 0;
int valb = -8;
for (uint8_t c : data) {
if (c == '=') break; // padding, we're done
val = (val << 6) | Base64ReverseAlphabet[c];
valb += 6;
if (valb >= 0) {
out.push_back(static_cast<char>((val >> valb) & 0xFF));
valb -= 8;
}
}
buffer.resize(size);
// Char to file
std::ofstream file(filepath, std::ios::out|std::ios::binary);
std::copy(buffer.cbegin(), buffer.cend(), std::ostream_iterator<unsigned char>(file));
// Save file
std::ofstream file(filepath, std::ios::binary);
file.write(out.data(), out.size());
return true;
}
@@ -184,22 +189,21 @@ inline static std::string encodeImageInString(const Image& img) {
return s;
}
/// Retreive an image encoded in a string
inline static Image decodeImageFromString(const String& string) {
Image img;
/// Retreive an image encoded in a string, return true if "<mse-image-data>" was found
inline static bool decodeImageFromString(const String& string, Image& img_out) {
size_t first = string.find(_("<mse-image-data>"));
if (first == String::npos) return img;
if (first == String::npos) return false;
size_t last = string.find(_("</mse-image-data>"), first + 16);
if (last == String::npos) return img;
if (last == String::npos) return true;
std::string s = string.substr(first + 16, last - (first + 16)).ToStdString();
if (s.empty()) return img;
if (s.empty()) return true;
const std::string& temppath = (wxFileName::CreateTempFileName(_("mse")) + _(".png")).ToStdString();
UTF8ToFile(temppath, s);
img.LoadFile(temppath, wxBITMAP_TYPE_PNG);
img_out.LoadFile(temppath, wxBITMAP_TYPE_PNG);
wxRemoveFile(temppath);
wxRemoveFile(temppath.substr(0, temppath.size() - 4));
return img;
return true;
}
// ----------------------------------------------------------------------------- : Metadata manipulation
+8 -3
View File
@@ -16,6 +16,7 @@
#include <data/pack.hpp>
#include <data/word_list.hpp>
#include <data/add_cards_script.hpp>
#include <data/update_cards_script.hpp>
#include <util/io/package_manager.hpp>
#include <script/script.hpp>
@@ -55,7 +56,6 @@ IMPLEMENT_REFLECTION(Game) {
REFLECT_NO_SCRIPT(json_paths);
REFLECT_NO_SCRIPT(statistics_dimensions);
REFLECT_NO_SCRIPT(statistics_categories);
REFLECT_COMPAT(<308, "pack_item", pack_types);
REFLECT_NO_SCRIPT(pack_types);
REFLECT_NO_SCRIPT(keyword_match_script);
REFLECT(has_keywords);
@@ -63,7 +63,8 @@ IMPLEMENT_REFLECTION(Game) {
REFLECT(keyword_parameter_types);
REFLECT_NO_SCRIPT(keywords);
REFLECT_NO_SCRIPT(word_lists);
REFLECT_NO_SCRIPT(add_cards_scripts);
REFLECT_NO_SCRIPT(add_cards_scripts);
REFLECT_NO_SCRIPT(update_cards_scripts);
REFLECT_NO_SCRIPT(auto_replaces);
}
@@ -205,7 +206,11 @@ void Game::validate(Version v) {
}
card_links_alt_names.emplace(linked_tr, linked_default);
}
}
}
// sort the update_cards_scripts from oldest to newest
std::sort(update_cards_scripts.begin(), update_cards_scripts.end(), [](const auto& a, const auto& b) {
return *a < *b;
});
}
void Game::initCardListColorScript() {
+23 -21
View File
@@ -26,6 +26,7 @@ DECLARE_POINTER_TYPE(KeywordMode);
DECLARE_POINTER_TYPE(Keyword);
DECLARE_POINTER_TYPE(WordList);
DECLARE_POINTER_TYPE(AddCardsScript);
DECLARE_POINTER_TYPE(UpdateCardsScript);
DECLARE_POINTER_TYPE(AutoReplace);
// ----------------------------------------------------------------------------- : Game
@@ -38,27 +39,28 @@ class Game : public Packaged {
public:
Game();
OptionalScript init_script; ///< Script of variables available to other scripts in this game
vector<FieldP> set_fields; ///< Fields for set information
IndexMap<FieldP,StyleP> default_set_style; ///< Default style for the set fields, because it is often the same
vector<FieldP> card_fields; ///< Fields on each card
vector<CardLinkP> card_links; ///< Possible links between cards
OptionalScript card_list_color_script; ///< Script that determines the color of items in the card list
OptionalScript import_script; ///< Script applied as the last step of the new_card function
vector<String> json_paths; ///< Paths inside JSON files to find the card array
vector<StatsDimensionP> statistics_dimensions; ///< (Additional) statistics dimensions
vector<StatsCategoryP> statistics_categories; ///< (Additional) statistics categories
vector<PackTypeP> pack_types; ///< Types of random card packs to generate
vector<WordListP> word_lists; ///< Word lists for editing with a drop down list
vector<AddCardsScriptP> add_cards_scripts; ///< Scripts for adding multiple cards to the set
vector<AutoReplaceP> auto_replaces; ///< Things to autoreplace in textboxes
map<String,String> card_fields_alt_names; ///< Other names that fields might go by, for example in CSV files
map<String,String> card_links_alt_names; ///< Localized names that card links go by
bool has_keywords; ///< Does this game use keywords?
OptionalScript keyword_match_script; ///< For the keyword editor
vector<KeywordParamP> keyword_parameter_types;///< Types of keyword parameters
vector<KeywordModeP> keyword_modes; ///< Modes of keywords
vector<KeywordP> keywords; ///< Keywords for use in text
OptionalScript init_script; ///< Script of variables available to other scripts in this game
vector<FieldP> set_fields; ///< Fields for set information
IndexMap<FieldP,StyleP> default_set_style; ///< Default style for the set fields, because it is often the same
vector<FieldP> card_fields; ///< Fields on each card
vector<CardLinkP> card_links; ///< Possible links between cards
OptionalScript card_list_color_script; ///< Script that determines the color of items in the card list
OptionalScript import_script; ///< Script applied as the last step of the new_card function
vector<String> json_paths; ///< Paths inside JSON files to find the card array
vector<StatsDimensionP> statistics_dimensions; ///< (Additional) statistics dimensions
vector<StatsCategoryP> statistics_categories; ///< (Additional) statistics categories
vector<PackTypeP> pack_types; ///< Types of random card packs to generate
vector<WordListP> word_lists; ///< Word lists for editing with a drop down list
vector<AddCardsScriptP> add_cards_scripts; ///< Scripts for adding multiple cards to the set
vector<UpdateCardsScriptP> update_cards_scripts; ///< Scripts for updating cards made with an earlier version of this game
vector<AutoReplaceP> auto_replaces; ///< Things to autoreplace in textboxes
map<String,String> card_fields_alt_names; ///< Other names that fields might go by, for example in CSV files
map<String,String> card_links_alt_names; ///< Localized names that card links go by
bool has_keywords; ///< Does this game use keywords?
OptionalScript keyword_match_script; ///< For the keyword editor
vector<KeywordParamP> keyword_parameter_types;///< Types of keyword parameters
vector<KeywordModeP> keyword_modes; ///< Modes of keywords
vector<KeywordP> keywords; ///< Keywords for use in text
Dependencies dependent_scripts_cards; ///< scripts that depend on the card list
Dependencies dependent_scripts_keywords; ///< scripts that depend on the keywords
+22
View File
@@ -16,6 +16,7 @@
#include <util/io/package_manager.hpp>
#include <util/platform.hpp>
#include <gui/util.hpp> // load_resource_image
#include <wx/webrequest.h>
#include <wx/filename.h>
#include <wx/wfstream.h>
#include <wx/zipstrm.h>
@@ -319,6 +320,27 @@ void InstallablePackage::determineStatus() {
}
}
bool InstallablePackage::ensureIsDownloaded() {
if (!installer) return true; // Nothing to download
if (installer->installer) return true; // Already loaded
if (installer->installer_url.empty()) return false; // No URL
// download installer
wxWebRequestSync request = wxWebSessionSync::GetDefault().CreateRequest(installer->installer_url);
auto const result = request.Execute();
if (!result) {
throw Error(_ERROR_2_("can't download installer", description->name, installer->installer_url));
}
wxInputStream* is(request.GetResponse().GetStream());
installer->installer_file = wxFileName::CreateTempFileName(_("mse-installer"));
wxFileOutputStream os(installer->installer_file);
os.Write(*is);
os.Close();
// open installer
installer->installer = make_intrusive<Installer>();
installer->installer->open(installer->installer_file);
return true;
}
bool InstallablePackage::willBeInstalled() const {
return has(PACKAGE_ACT_INSTALL) ||
(has(PACKAGE_INSTALLED) && !has(PACKAGE_ACT_REMOVE));
+2 -1
View File
@@ -152,7 +152,8 @@ public:
int old_automatic;
void determineStatus();
bool ensureIsDownloaded();
/// After the action, will the package be installed?
bool willBeInstalled() const;
-1
View File
@@ -85,7 +85,6 @@ bool Keyword::contains(QuickFilterPart const& query) const {
IMPLEMENT_REFLECTION(Keyword) {
REFLECT(keyword);
if (handler.formatVersion() < 301) read_compat(handler, this);
REFLECT(match);
REFLECT(reminder);
REFLECT(rules);
+83 -10
View File
@@ -14,6 +14,7 @@
#include <data/keyword.hpp>
#include <data/pack.hpp>
#include <data/field.hpp>
#include <data/update_cards_script.hpp>
#include <data/field/text.hpp> // for 0.2.7 fix
#include <data/field/information.hpp>
#include <data/field/image.hpp>
@@ -22,6 +23,7 @@
#include <util/tagged_string.hpp> // for 0.2.7 fix
#include <util/order_cache.hpp>
#include <util/delayed_index_maps.hpp>
#include <util/uid.hpp>
#include <script/script_manager.hpp>
#include <script/profiler.hpp>
#include <wx/sstream.h>
@@ -67,6 +69,16 @@ void Set::updateStyles(const CardP& card, bool only_content_dependent) {
void Set::updateDelayed() {
script_manager->updateDelayed();
}
void Set::buildUIDMap() {
card_uids.clear();
FOR_EACH(c, cards) {
while (card_uids.find(c->uid) != card_uids.end()) {
queue_message(MESSAGE_WARNING, _("Multiple cards found with same uid:\n") + c->identification() + _("\n") + card_uids[c->uid]->identification() + _("\nPlease notify someone on the Discord server."));
c->uid = generate_uid();
}
card_uids[c->uid] = c;
}
}
Context& Set::getContextForThumbnails() {
assert(!wxThread::IsMain());
@@ -161,7 +173,7 @@ void fix_value_207(const ValueP& value) {
void Set::validate(Version file_app_version) {
Packaged::validate(file_app_version);
// are the
// are the game and stylesheet defined?
if (!game) {
throw Error(_ERROR_1_("no game specified",_TYPE_("set")));
}
@@ -172,7 +184,9 @@ void Set::validate(Version file_app_version) {
if (stylesheet->game != game) {
throw Error(_ERROR_("stylesheet and set refer to different game"));
}
// We can probably retire this
/*
// This is our chance to fix version incompatabilities
if (file_app_version < 207) {
// Since 0.2.7 we use </tag> style close tags, in older versions it was </>
@@ -181,14 +195,65 @@ void Set::validate(Version file_app_version) {
FOR_EACH(v, c->data) fix_value_207(v);
}
FOR_EACH(v, data) fix_value_207(v);
/* FOR_EACH(s, styleData) {
FOR_EACH(s, styleData) {
FOR_EACH(v, s.second->data) fix_value_207(v);
}
*/ }
}
*/
// we want at least one card
if (cards.empty()) cards.push_back(make_intrusive<Card>(*game));
if (cards.empty()) cards.push_back(make_intrusive<Card>(*game));
// build uid map
buildUIDMap();
// update scripts
script_manager->updateAll();
script_manager->updateAll();
// update_cards_scripts
// first apply all the stylesheet scripts that are older than the first game script
// then apply the first game script
// then apply all the stylesheet scripts that are older than the second game script
// then apply the second game script, etc...
Version previous_cutoff = Version();
Version current_cutoff = Version();
for (size_t g = 0; g < game->update_cards_scripts.size() + 1; ++g) {
bool last_iteration = g == game->update_cards_scripts.size();
UpdateCardsScriptP game_script = last_iteration ? nullptr : game->update_cards_scripts[g];
previous_cutoff = current_cutoff;
current_cutoff = last_iteration ? current_cutoff : game_script->before_version;
// Apply stylesheet scripts that are older than the current game script
for (size_t i = 0; i < cards.size(); ++i) {
CardP& card = cards[i];
StyleSheetP stylesheet = card->stylesheet ? card->stylesheet : stylesheetForP(card);
Version stylesheet_version = card->stylesheet_version.isZero() ? this->stylesheet_version : card->stylesheet_version;
for (size_t j = 0; j < stylesheet->update_cards_scripts.size(); ++j) {
UpdateCardsScriptP& script = stylesheet->update_cards_scripts[j];
if (script->before_version >= current_cutoff && !last_iteration) continue;
if (script->before_version < previous_cutoff) continue;
if (stylesheet_version >= script->before_version) continue;
vector<CardP> new_cards = script->perform(*this, card);
if (!new_cards.empty()) {
FOR_EACH(new_card, new_cards) {
// Initialize the stylesheet_version if it wasn't defined, to prevent this script from applying again
if (stylesheet == stylesheetForP(new_card) && new_card->stylesheet_version < script->before_version) {
new_card->stylesheet_version = script->before_version;
}
}
--i;
break;
}
}
}
// Apply current game script
if (last_iteration || game_version >= current_cutoff) continue;
size_t size = cards.size();
for (int i = 0; i < size; ++i) {
CardP& card = cards[i];
vector<CardP> new_cards = game_script->perform(*this, card);
if (!new_cards.empty()) {
--i;
--size;
}
}
}
}
void reflect_version_check(Reader& handler, const Char* key, intrusive_ptr<Packaged> const& package) {
@@ -212,15 +277,23 @@ IMPLEMENT_REFLECTION(Set) {
REFLECT_IF_READING {
data.init(game->set_fields);
}
reflect_version_check(handler, _("game_version"), game);
if (Handler::isReading) {
REFLECT_NO_SCRIPT(game_version);
}
else {
reflect_version_check(handler, _("game_version"), game);
}
WITH_DYNAMIC_ARG(game_for_reading, game.get());
REFLECT(stylesheet);
REFLECT_COMPAT(<300, "style", stylesheet);
reflect_version_check(handler, _("stylesheet_version"), stylesheet);
if (Handler::isReading) {
REFLECT_NO_SCRIPT(stylesheet_version);
}
else {
reflect_version_check(handler, _("stylesheet_version"), stylesheet);
}
WITH_DYNAMIC_ARG(stylesheet_for_reading, stylesheet.get());
REFLECT_N("set_info", data);
if (stylesheet) {
REFLECT_COMPAT(<300, "extra_set_info", styling_data);
REFLECT_N("styling", styling_data);
}
// Experimental: save each card to a different file
+18 -11
View File
@@ -45,22 +45,27 @@ public:
Set(const StyleSheetP& stylesheet);
~Set();
GameP game; ///< The game this set uses
StyleSheetP stylesheet; ///< The default stylesheet
GameP game; ///< The game this set uses
StyleSheetP stylesheet; ///< The default stylesheet
/// The values on the fields of the set
/** The indices should correspond to the set_fields in the Game */
IndexMap<FieldP, ValueP> data;
IndexMap<FieldP, ValueP> data;
/// Extra values for specific stylesheets, indexed by stylesheet name
DelayedIndexMaps<FieldP,ValueP> styling_data;
vector<CardP> cards; ///< The cards in the set
vector<KeywordP> keywords; ///< Additional keywords used in this set
vector<PackTypeP> pack_types; ///< Additional/replacement pack types
String apprentice_code; ///< Code to use for apprentice (magic only)
ActionStack actions; ///< Actions performed on this set and the cards in it
KeywordDatabase keyword_db; ///< Database for matching keywords, must be cleared when keywords change
VCSP vcs; ///< The version control system to use
vector<CardP> cards; ///< The cards in the set
unordered_map<String, CardP> card_uids; ///< The uids of the cards in the set
vector<KeywordP> keywords; ///< Additional keywords used in this set
vector<PackTypeP> pack_types; ///< Additional/replacement pack types
String apprentice_code; ///< Code to use for apprentice (magic only)
ActionStack actions; ///< Actions performed on this set and the cards in it
KeywordDatabase keyword_db; ///< Database for matching keywords, must be cleared when keywords change
VCSP vcs; ///< The version control system to use
/// What version of the game was this set using when it was last saved?
Version game_version;
/// What version of the default stylesheet was this set using when it was last saved?
Version stylesheet_version;
/// A context for performing scripts
/** Should only be used from the main thread! */
Context& getContext();
@@ -71,6 +76,8 @@ public:
void updateStyles(const CardP& card, bool only_content_dependent);
/// Update scripts that were delayed
void updateDelayed();
/// Update uid map
void buildUIDMap();
/// A context for performing scripts
/** Should only be used from the thumbnail thread! */
Context& getContextForThumbnails();
+10 -12
View File
@@ -10,6 +10,7 @@
#include <data/stylesheet.hpp>
#include <data/game.hpp>
#include <data/field.hpp>
#include <data/update_cards_script.hpp>
#include <util/io/package_manager.hpp>
#include <gui/new_window.hpp> // for selecting stylesheets on load error
@@ -37,21 +38,13 @@ StyleSheetP StyleSheet::byGameAndName(const Game& game, const String& name) {
return package_manager.open<StyleSheet>(full_name);
}
} catch (PackageNotFoundError& e) {
queue_message(MESSAGE_ERROR, _("Missing stylesheet: ") + full_name);
// This causes a freeze when the set contains two cards that use the same missing StyleSheet, and the second one has styling_data
// Also, it's probably better to ask the user for an alternative for each missing StyleSheet individually
//if (stylesheet_for_reading()) {
// // we already have a stylesheet higher up, so just return a null pointer
// return StyleSheetP();
//}
// load an alternative stylesheet
StyleSheetP ss = select_stylesheet(game, name);
StyleSheetP ss = select_stylesheet(game, full_name);
if (ss) {
stylesheet_alternatives[full_name] = ss->relativeFilename();
return ss;
} else {
queue_message(MESSAGE_ERROR, _("Missing stylesheet: ") + full_name);
throw e;
}
}
@@ -75,7 +68,11 @@ void StyleSheet::validate(Version ver) {
throw Error(_ERROR_1_("no game specified",_TYPE_("stylesheet")));
}
// a stylesheet depends on the game it is made for
requireDependency(game.get());
requireDependency(game.get());
// sort the update_cards_scripts from oldest to newest
std::sort(update_cards_scripts.begin(), update_cards_scripts.end(), [](const auto& a, const auto& b) {
return *a < *b;
});
}
@@ -98,8 +95,8 @@ void mark_dependency_value(const StyleSheet& stylesheet, const Dependency& dep)
IMPLEMENT_REFLECTION(StyleSheet) {
REFLECT(game);
REFLECT_BASE(Packaged);
REFLECT(game);
REFLECT(card_width);
REFLECT(card_height);
REFLECT(card_dpi);
@@ -125,6 +122,7 @@ IMPLEMENT_REFLECTION(StyleSheet) {
extra_card_style.init(extra_card_fields);
}
REFLECT(extra_card_style);
REFLECT_NO_SCRIPT(update_cards_scripts);
}
+8 -6
View File
@@ -22,6 +22,7 @@ DECLARE_POINTER_TYPE(StyleSheet);
DECLARE_POINTER_TYPE(Field);
DECLARE_POINTER_TYPE(Style);
DECLARE_POINTER_TYPE(CardRegion);
DECLARE_POINTER_TYPE(UpdateCardsScript);
// ----------------------------------------------------------------------------- : StyleSheet
@@ -33,12 +34,13 @@ class StyleSheet : public Packaged {
public:
StyleSheet();
GameP game; ///< The game this stylesheet is made for
OptionalScript init_script; ///< Script of variables available to other scripts in this stylesheet
double card_width; ///< The width of a card in pixels
double card_height; ///< The height of a card in pixels
double card_dpi; ///< The resolution of a card in dots per inch
Color card_background; ///< The background color of cards
GameP game; ///< The game this stylesheet is made for
OptionalScript init_script; ///< Script of variables available to other scripts in this stylesheet
vector<UpdateCardsScriptP> update_cards_scripts; ///< Scripts for updating cards made with an earlier version of this stylesheet
double card_width; ///< The width of a card in pixels
double card_height; ///< The height of a card in pixels
double card_dpi; ///< The resolution of a card in dots per inch
Color card_background; ///< The background color of cards
vector<CardRegionP> card_regions;
/// The styling for card fields
/** The indices should correspond to the card_fields in the Game */
-1
View File
@@ -178,7 +178,6 @@ IMPLEMENT_REFLECTION(SymbolInFont) {
REFLECT(draw_text);
REFLECT(text_font);
REFLECT(text_alignment);
REFLECT_COMPAT(<300,"text_align",text_alignment);
REFLECT(text_margin_left);
REFLECT(text_margin_right);
REFLECT(text_margin_top);
+57
View File
@@ -0,0 +1,57 @@
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make card games |
//| Copyright: (C) Twan van Laarhoven and the other MSE developers |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <data/update_cards_script.hpp>
#include <data/action/set.hpp>
#include <data/set.hpp>
#include <data/card.hpp>
#include <data/stylesheet.hpp>
#include <data/action/value.hpp>
// ----------------------------------------------------------------------------- : UpdateCardsScript
IMPLEMENT_REFLECTION_NO_SCRIPT(UpdateCardsScript) {
REFLECT(before_version);
REFLECT(description);
REFLECT(enabled);
REFLECT(script);
}
void UpdateCardsScript::perform(Set& set, CardP& card, vector<CardP>& out) {
// Perform script
Context& ctx = set.getContext(card);
if (enabled.hasBeenRead()) {
enabled.update(ctx);
if (!enabled()) return;
}
ScriptValueP result = script.invoke(ctx);
// Add cards to out
ScriptValueP it = result->makeIterator();
while (ScriptValueP item = it->next()) {
CardP new_card = from_script<CardP>(item);
// is this a new card?
if (contains(set.cards,new_card) || contains(out,new_card)) {
// make copy
new_card = make_intrusive<Card>(&set, new_card);
}
out.push_back(new_card);
}
}
vector<CardP> UpdateCardsScript::perform(Set& set, CardP card) {
// Perform script
vector<CardP> cards;
perform(set, card, cards);
// Add to set
if (!cards.empty()) {
set.actions.addAction(make_unique<UpdateCardAction>(set, cards, vector<CardP>{card}), false);
}
return cards;
}
+39
View File
@@ -0,0 +1,39 @@
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make card games |
//| Copyright: (C) Twan van Laarhoven and the other MSE developers |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#pragma once
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <script/scriptable.hpp>
class Set;
DECLARE_POINTER_TYPE(Card);
// ----------------------------------------------------------------------------- : UpdateCardsScript
/// A script to add one or more cards to a set
class UpdateCardsScript : public IntrusivePtrBase<UpdateCardsScript> {
public:
Version before_version;
String description;
Scriptable<bool> enabled;
OptionalScript script;
bool operator < (const UpdateCardsScript& other) const {
return before_version < other.before_version;
}
/// Perform the script; return the cards (if any)
void perform(Set& set, CardP& card, vector<CardP>& out);
/// Perform the script; add cards to the set
vector<CardP> perform(Set& set, CardP card); // don't use CardP& here, because set.cards may get reallocated which would invalidate the ref
DECLARE_REFLECTION();
};
+33 -17
View File
@@ -19,7 +19,7 @@ template <typename T> inline T sqr(T x) { return x * x; }
void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2,double y2) {
int width = img1.GetWidth(), height = img1.GetHeight();
if (img2.GetWidth() != width || img2.GetHeight() != height) {
throw Error(_ERROR_1_("blending different sizes", "linear_blend"));
throw Error(_ERROR_3_("blending different sizes", "linear_blend", String()<<width<<_("x")<<height, String()<<img2.GetWidth()<<_("x")<<img2.GetHeight()));
}
const int fixed = 1<<16; // fixed point multiplier
@@ -82,10 +82,10 @@ void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2
void mask_blend(Image& img1, const Image& img2, const Image& mask) {
int width = img1.GetWidth(), height = img1.GetHeight();
if (img2.GetWidth() != width || img2.GetHeight() != height) {
throw Error(_("Images used for blending in masked_blend function must have the same size"));
throw Error(_ERROR_3_("blending different sizes", "masked_blend", String()<<width<<_("x")<<height, String()<<img2.GetWidth()<<_("x")<<img2.GetHeight()));
}
if (mask.GetWidth() != width || mask.GetHeight() != height) {
throw Error(_("Mask used for blending in masked_blend function must have the same size as the images"));
throw Error(_ERROR_3_("blending different mask", "masked_blend", String()<<width<<_("x")<<height, String()<<mask.GetWidth()<<_("x")<<mask.GetHeight()));
}
UInt size = width * height;
@@ -124,33 +124,49 @@ void set_alpha(Image& img, const Image& img_alpha) {
}
void set_alpha(Image& img, Byte* al, const wxSize& alpha_size) {
if (img.GetWidth() != alpha_size.GetWidth() || img.GetHeight() != alpha_size.GetHeight()) {
throw Error(_("Image must have same size as mask"));
int width = img.GetWidth(), height = img.GetHeight();
if (width != alpha_size.GetWidth() || height != alpha_size.GetHeight()) {
throw Error(_ERROR_3_("blending different mask", "set_alpha", String()<<width<<_("x")<<height, String()<<alpha_size.GetWidth()<<_("x")<<alpha_size.GetHeight()));
}
if (!img.HasAlpha()) {
// copy
img.InitAlpha();
memcpy(img.GetAlpha(), al, img.GetWidth() * img.GetHeight());
memcpy(img.GetAlpha(), al, width * height);
} else{
// merge
Byte *im = img.GetAlpha();
size_t size = img.GetWidth() * img.GetHeight();
size_t size = width * height;
for (size_t i = 0 ; i < size ; ++i) {
im[i] = (im[i] * al[i]) / 255;
}
}
}
void set_alpha(Image& img, double alpha) {
Byte b_alpha = Byte(alpha * 255);
if (!img.HasAlpha()) {
img.InitAlpha();
memset(img.GetAlpha(), b_alpha, img.GetWidth() * img.GetHeight());
} else {
Byte *im = img.GetAlpha();
size_t size = img.GetWidth() * img.GetHeight();
for (size_t i = 0 ; i < size ; ++i) {
im[i] = (im[i] * b_alpha) / 255;
void set_alpha(Image& img, double alpha) {
size_t size = img.GetWidth() * img.GetHeight();
if (alpha <= 0.0) {
if (!img.HasAlpha()) img.InitAlpha();
memset(img.GetAlpha(), Byte(0), size);
}
else if (alpha > 1.0) {
if (!img.HasAlpha()) return;
else {
Byte *im = img.GetAlpha();
for (size_t i = 0 ; i < size ; ++i) {
im[i] = Byte(min(im[i] * alpha, 255.0));
}
}
}
else {
Byte b_alpha = Byte(alpha * 255);
if (!img.HasAlpha()) {
img.InitAlpha();
memset(img.GetAlpha(), b_alpha, size);
} else {
Byte *im = img.GetAlpha();
for (size_t i = 0 ; i < size ; ++i) {
im[i] = (im[i] * b_alpha) / 255;
}
}
}
}
+4 -3
View File
@@ -449,13 +449,14 @@ void combine_image_do(Image& a, Image b) {
void combine_image(Image& a, const Image& b, ImageCombine combine) {
// Images must have same size
if (a.GetWidth() != b.GetWidth() || a.GetHeight() != b.GetHeight()) {
throw Error(_ERROR_1_("blending different sizes", "combine_blend"));
int width = a.GetWidth(), height = a.GetHeight();
if (b.GetWidth() != width || b.GetHeight() != height) {
throw Error(_ERROR_3_("blending different sizes", "combine_blend", String()<<width<<_("x")<<height, String()<<b.GetWidth()<<_("x")<<b.GetHeight()));
}
// Copy alpha channel?
if (b.HasAlpha()) {
if (!a.HasAlpha()) a.InitAlpha();
memcpy(a.GetAlpha(), b.GetAlpha(), a.GetWidth() * a.GetHeight());
memcpy(a.GetAlpha(), b.GetAlpha(), width * height);
}
// Combine image data, by dispatching to combineImageDo
switch(combine) {
+55 -35
View File
@@ -783,32 +783,57 @@ bool SetMetadataImage::operator == (const GeneratedImage& that) const {
&& metadata == that2->metadata;
}
// ----------------------------------------------------------------------------- : ScriptedImage
ScriptedImage::ScriptedImage(Set* set, const GeneratedImageP& image) {
// get the image
Image img = image->generate(GeneratedImage::Options(0, 0, set, set));
// add the file to the set
LocalFileName new_image_file = set->newFileName(_("scripted_image"), _(".png"));
savename = new_image_file.toStringForWriting();
loadpath = savename;
img.SaveFile(set->nameOut(new_image_file), wxBITMAP_TYPE_PNG);
}
Image ScriptedImage::generate(const Options& opt) {
auto imageInputStream = opt.local_package->openIn(savename);
Image img(*imageInputStream, wxBITMAP_TYPE_PNG);
if (!img.IsOk()) throw ScriptError(_ERROR_1_("can't import image", loadpath));
return img;
}
bool ScriptedImage::operator == (const GeneratedImage& that) const {
const ScriptedImage* that2 = dynamic_cast<const ScriptedImage*>(&that);
return that2 && that2->loadpath == loadpath;
}
// ----------------------------------------------------------------------------- : ImportedImage
ImportedImage::ImportedImage(Set* set, const String& filepath)
{
ImportedImage::ImportedImage(Set* set, const String& filepath) {
// determine save name
loadpath = filepath;
// has the set already been saved at least once?
if (set->needSaveAs()) throw ScriptError(_ERROR_1_("can't import image without set", loadpath));
savename = normalize_internal_filename(loadpath);
savename.Replace(_(":"), _("-"));
savename.Replace(_("/"), _("-"));
// does the file pointed to by filepath exist?
if (!wxFileName(loadpath, wxPATH_UNIX).FileExists()) throw ScriptError(_ERROR_1_("import not found", loadpath));
if (!wxFileName(loadpath, wxPATH_UNIX).FileExists()) {
if (set->contains(savename)) return;
else throw ScriptError(_ERROR_1_("import not found", loadpath));
}
// is the file an image?
Image img;
img.LoadFile(loadpath);
if (!img.IsOk()) throw ScriptError(_ERROR_1_("import not image", loadpath));
// add the file to the set (or overwrite it if pre-existing), save set
savename = normalize_internal_filename(loadpath + _(".png"));
savename.Replace(":", "-");
savename.Replace("/", "-");
auto outStream = set->openOut(savename);
img.SaveFile(*outStream, wxBITMAP_TYPE_PNG);
if (!outStream->IsOk()) throw ScriptError(_ERROR_1_("can't write image to set", loadpath));
outStream->Close();
set->save(false);
// add the file to the set
LocalFileName new_image_file = set->newFileName(savename, _(".png"));
savename = new_image_file.toStringForWriting();
img.SaveFile(set->nameOut(new_image_file), wxBITMAP_TYPE_PNG);
}
Image ImportedImage::generate(const Options& opt) {
@@ -827,32 +852,27 @@ bool ImportedImage::operator == (const GeneratedImage& that) const {
// ----------------------------------------------------------------------------- : DownloadedImage
DownloadedImage::DownloadedImage(Set* set, const String& url)
{
DownloadedImage::DownloadedImage(Set* set, const String& url) {
// determine save name
loadpath = url;
// has the set already been saved at least once?
if (set->needSaveAs()) throw ScriptError(_ERROR_1_("can't download image without set", loadpath));
savename = normalize_internal_filename(loadpath);
savename.Replace(":", "-");
savename.Replace("/", "-");
// can we download the data?
WebRequestWindow wnd(loadpath);
if (wnd.ShowModal() != wxID_OK) throw ScriptError(_ERROR_1_("can't download image", loadpath));
if (wnd.ShowModal() != wxID_OK) {
if (set->contains(savename)) return;
else throw ScriptError(_ERROR_1_("can't download image", loadpath));
}
// is the data an image?
const String& content_type = wnd.out.GetContentType();
if (!content_type.StartsWith(_("image"))) throw ScriptError(_ERROR_1_("download not image", loadpath));
Image img(*wnd.out.GetStream());
if (!img.IsOk()) throw ScriptError(_ERROR_("web request corrupted"));
// add the file to the set (or overwrite it if pre-existing), save set
savename = normalize_internal_filename(loadpath + _(".png"));
savename.Replace(":", "-");
savename.Replace("/", "-");
auto outStream = set->openOut(savename);
img.SaveFile(*outStream, wxBITMAP_TYPE_PNG);
if (!outStream->IsOk()) throw ScriptError(_ERROR_1_("can't write image to set", loadpath));
outStream->Close();
set->save(false);
if (!wnd.content_type.StartsWith(_("image/"))) throw ScriptError(_ERROR_1_("download not image", loadpath));
// add the file to the set
LocalFileName new_image_file = set->newFileName(savename, _(".png"));
savename = new_image_file.toStringForWriting();
wnd.image_out.SaveFile(set->nameOut(new_image_file), wxBITMAP_TYPE_PNG);
}
Image DownloadedImage::generate(const Options& opt) {
+10
View File
@@ -522,6 +522,16 @@ protected:
String savename;
};
// ----------------------------------------------------------------------------- : ScriptedImage
/// Load an image from a script
class ScriptedImage : public ExternalImage {
public:
ScriptedImage(Set* set, const GeneratedImageP& image);
Image generate(const Options&) override;
bool operator == (const GeneratedImage& that) const override;
};
// ----------------------------------------------------------------------------- : ImportedImage
/// Load an image from the filesystem
+1 -1
View File
@@ -48,8 +48,8 @@ AddCSVWindow::AddCSVWindow(Window* parent, const SetP& set, bool sizer)
s2->Add(CreateButtonSizer(wxOK | wxCANCEL), 1, wxEXPAND, 8);
s->Add(s2, 0, wxEXPAND | wxALL, 12);
file_browse->SetFocus();
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
SetSize(500, 110);
}
}
+1 -1
View File
@@ -59,8 +59,8 @@ AddJSONWindow::AddJSONWindow(Window* parent, const SetP& set, bool sizer)
s2->Add(CreateButtonSizer(wxOK | wxCANCEL), 1, wxEXPAND, 8);
s->Add(s2, 0, wxEXPAND | wxALL, 12);
file_browse->SetFocus();
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
SetSize(500, 110);
}
}
+1 -1
View File
@@ -199,8 +199,8 @@ AutoReplaceWindow::AutoReplaceWindow(Window* parent, const Game& game)
s4->Add(defaults, 0, wxALL & ~wxRIGHT, 8);
s4->Add(CreateButtonSizer(wxOK | wxCANCEL), 1, wxALL, 8);
s->Add(s4, 0, wxEXPAND);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
// Set default size
SetSize(350, 450);
// initialize values
+1 -1
View File
@@ -85,8 +85,8 @@ BulkModificationWindow::BulkModificationWindow(Window* parent, const SetP& set,
s1->AddButton(new wxButton(this, wxID_CANCEL));
s1->Realize();
s->Add(s1, 1, wxEXPAND | wxALL, 12);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
SetSize(600, 400);
Layout();
}
+4 -8
View File
@@ -20,7 +20,7 @@
// ----------------------------------------------------------------------------- : ExportCardSelectionChoice
CardLinkWindow::CardLinkWindow(Window* parent, const SetP& set, const CardP& selected_card, bool sizer)
: wxDialog(parent, wxID_ANY, _TITLE_("link cards"), wxPoint(400,-1), wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
: wxDialog(parent, wxID_ANY, _TITLE_("link cards"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
, set(set), parent(parent), selected_card(selected_card)
{
// init controls
@@ -53,8 +53,8 @@ CardLinkWindow::CardLinkWindow(Window* parent, const SetP& set, const CardP& sel
s2->Add(sel_none, 0, wxEXPAND | wxRIGHT, 8);
s2->Add(CreateButtonSizer(wxOK | wxCANCEL), 1, wxEXPAND, 8);
s->Add(s2, 0, wxEXPAND | (wxALL & ~wxTOP), 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
SetSize(600,500);
}
}
@@ -126,11 +126,7 @@ void CardLinkWindow::onOk(wxCommandEvent&) {
linked_uids.push_back(linked_cards[i]->uid);
}
// Find free links
unordered_set<String> all_existing_uids;
FOR_EACH(card, set->cards) {
all_existing_uids.insert(card->uid);
}
vector<int> free_link_indexes = selected_card->findFreeLinks(linked_uids, all_existing_uids);
vector<int> free_link_indexes = selected_card->findFreeLinks(linked_uids, set->card_uids);
int free_link_count = 0;
for (size_t i = 0; i < free_link_indexes.size(); ++i) {
if (free_link_indexes[i] >= 0) free_link_count++;
@@ -163,7 +159,7 @@ void CardLinkWindow::onOk(wxCommandEvent&) {
// Find reciprocal free slots and make actions
String& selected_uid = selected_card->uid;
for (size_t i = 0; i < linked_cards.size(); ++i) {
int free_link_index = linked_cards[i]->findFreeLink(selected_uid, all_existing_uids);
int free_link_index = linked_cards[i]->findFreeLink(selected_uid, set->card_uids);
if (free_link_index >= 0) {
actions.push_back(make_intrusive<OneWayLinkCardsAction>(linked_cards[i], selected_uid, selected_relation_string, free_link_index));
}
+1 -1
View File
@@ -140,8 +140,8 @@ CardSelectWindow::CardSelectWindow(Window* parent, const SetP& set, const String
s2->Add(sel_none, 0, wxEXPAND | wxRIGHT, 8);
s2->Add(CreateButtonSizer(wxOK | wxCANCEL), 1, wxEXPAND, 8);
s->Add(s2, 0, wxEXPAND | (wxALL & ~wxTOP), 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
SetSize(600,500);
}
}
+214 -109
View File
@@ -165,7 +165,8 @@ bool CardListBase::doCopy() {
if (cards_to_copy.empty()) return false;
// put on clipboard
if (!wxTheClipboard->Open()) return false;
bool ok = wxTheClipboard->SetData(new CardsOnClipboard(set, _(""), cards_to_copy)); // ignore result
bool ok = wxTheClipboard->SetData(new CardsOnClipboard(set, _(""), cards_to_copy)); // ignore result
wxTheClipboard->Flush();
wxTheClipboard->Close();
return ok;
}
@@ -191,7 +192,8 @@ bool CardListBase::doCopyCardAndLinkedCards() {
}
}
}
bool ok = wxTheClipboard->SetData(new CardsOnClipboard(set, _(""), cards_to_copy)); // ignore result
bool ok = wxTheClipboard->SetData(new CardsOnClipboard(set, _(""), cards_to_copy)); // ignore result
wxTheClipboard->Flush();
wxTheClipboard->Close();
return ok;
}
@@ -199,7 +201,8 @@ bool CardListBase::doCopyCardAndLinkedCards() {
bool CardListBase::doPaste() {
if (!canPaste()) return false;
if (!wxTheClipboard->Open()) return false;
bool ok = wxTheClipboard->GetData(*drop_target->data_object);
bool ok = wxTheClipboard->GetData(*drop_target->data_object);
wxTheClipboard->Flush();
wxTheClipboard->Close();
if (ok) return parseData(false);
return false;
@@ -209,9 +212,15 @@ bool CardListBase::doDelete() {
// cards to delete
vector<CardP> cards_to_delete;
getSelection(cards_to_delete);
if (cards_to_delete.empty()) return false;
if (cards_to_delete.empty()) return false;
// if there is one double faced card, select the other face to make it clear it hasn't been deleted
CardP other_face = nullptr;
if (cards_to_delete.size() == 1) {
other_face = cards_to_delete[0]->getLinkedOtherFaceCard(*set);
}
// delete cards
set->actions.addAction(make_unique<AddCardAction>(REMOVE, *set, cards_to_delete));
set->actions.addAction(make_unique<AddCardAction>(REMOVE, *set, cards_to_delete));
if (other_face) setCard(other_face, true);
return true;
}
@@ -242,66 +251,65 @@ bool CardListBase::doBulkModification() {
return false;
}
void CardListBase::parseImageMetadata(CardP& card, const Image& image)
{
void CardListBase::parseImageMetadata(CardP& card, const Image& image) {
for (IndexMap<FieldP, ValueP>::iterator it = card->data.begin(); it != card->data.end(); it++) {
ImageValue* value = dynamic_cast<ImageValue*>(it->get());
if (value && !value->filename.empty()) {
RealRect rect(0.0, 0.0, 0.0, 0.0);
int degrees = 0;
decodeRectFromString(value->filename.toStringForKey(), rect, degrees);
rect = rect.intersect(RealRect(0.0, 0.0, image.GetWidth(), image.GetHeight()));
if (rect.width > 0.0 && rect.height > 0.0) {
Image img = image.GetSubImage(rect);
img = rotate_image(img, deg_to_rad(360 - degrees));
LocalFileName filename = set->newFileName("cropped_image", _(".png")); // a new unique name in the package
img.SaveFile(set->nameOut(filename), wxBITMAP_TYPE_PNG);
value->filename = filename;
}
else {
value->filename = LocalFileName();
if (decodeRectFromString(value->filename.toStringForKey(), rect, degrees)) {
rect = rect.intersect(RealRect(0.0, 0.0, image.GetWidth(), image.GetHeight()));
if (rect.width > 0.0 && rect.height > 0.0) {
Image img = image.GetSubImage(rect);
img = rotate_image(img, deg_to_rad(360 - degrees));
LocalFileName filename = set->newFileName(_("cropped_image"), _(".png")); // a new unique name in the package
img.SaveFile(set->nameOut(filename), wxBITMAP_TYPE_PNG);
value->filename = filename;
}
else {
value->filename = LocalFileName();
//queue_message(MESSAGE_WARNING, _("failed to recover image crop for card '") + card->identification() + _("'"));
}
}
}
}
}
void CardListBase::parseImageMetadata(CardP& card)
{
void CardListBase::parseImageMetadata(CardP& card) {
for (IndexMap<FieldP, ValueP>::iterator it = card->data.begin(); it != card->data.end(); it++) {
ImageValue* value = dynamic_cast<ImageValue*>(it->get());
if (value) {
Image img = decodeImageFromString(value->filename.toStringForKey());
if (img.IsOk()) {
LocalFileName filename = set->newFileName(_("decoded_image"), _(".png")); // a new unique name in the package
img.SaveFile(set->nameOut(filename), wxBITMAP_TYPE_PNG);
value->filename = filename;
if (value && !value->filename.empty()) {
Image img;
if (decodeImageFromString(value->filename.toStringForKey(), img)) {
if (img.IsOk()) {
LocalFileName filename = set->newFileName(_("decoded_image"), _(".png")); // a new unique name in the package
img.SaveFile(set->nameOut(filename), wxBITMAP_TYPE_PNG);
value->filename = filename;
}
else {
value->filename = LocalFileName();
//queue_message(MESSAGE_WARNING, _("failed to recover image encode for card '") + card->identification() + _("'"));
}
}
}
}
}
bool CardListBase::parseUrl(String& url, vector<CardP>& out) {
bool CardListBase::parseUrl(String& url, vector<CardP>& out) {
size_t j = out.size();
size_t pos = url.find("URL=");
if (pos != std::string::npos) {
url = url.substr(pos+4);
}
if (!url.StartsWith(_("http"))) return false;
if (!url.StartsWith(_("http"))) return false;
WebRequestWindow wnd(url);
if (wnd.ShowModal() == wxID_OK) {
const String& content_type = wnd.out.GetContentType();
if (content_type.StartsWith(_("image"))) {
Image img(*wnd.out.GetStream());
if (img.IsOk()) {
parseImage(img, out);
}
else {
queue_message(MESSAGE_ERROR, _ERROR_("web request corrupted"));
}
if (wnd.ShowModal() == wxID_OK) {
if (wnd.content_type.StartsWith(_("image/"))) {
parseImage(wnd.image_out, out);
}
else if (content_type.StartsWith(_("text"))) {
String text = wnd.out.AsString();
else if (wnd.content_type.StartsWith(_("text/"))) {
String text = String(wnd.text_out.data(), wnd.text_out.size());
parseText(text, out);
}
else {
@@ -311,19 +319,26 @@ bool CardListBase::parseUrl(String& url, vector<CardP>& out) {
return j < out.size();
}
bool CardListBase::parseFiles(wxArrayString& filenames, vector<CardP>& out) {
bool CardListBase::parseFiles(wxArrayString& filenames, vector<CardP>& out) {
size_t j = out.size();
for (size_t i = 0; i < filenames.size(); i++) {
// if it's an image file, try to get meta_data
Image image_file;
image_file.SetLoadFlags(image_file.GetLoadFlags() & ~wxImage::Load_Verbose);
if (image_file.LoadFile(filenames[i])) {
parseImage(image_file, out);
if (wxImage::CanRead(filenames[i])) {
// if it's an image file, try to get meta_data
Image image_file;
image_file.SetLoadFlags(image_file.GetLoadFlags() & ~wxImage::Load_Verbose);
if (image_file.LoadFile(filenames[i])) {
parseImage(image_file, out);
}
else queue_message(MESSAGE_ERROR, _ERROR_("can't load image"));
} else {
// if it's an url, request the data
std::ifstream ifs(filenames[i].ToStdString());
if (ifs.bad() || ifs.fail() || !ifs.good() || !ifs.is_open()) continue;
std::string content((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()));
if (ifs.bad() || ifs.fail() || !ifs.good() || !ifs.is_open()) continue;
std::string content((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()));
bool looks_like_text = std::all_of(content.begin(), content.end(), [](char c) {
return isprint(c) || isspace(c);
});
if (!looks_like_text) continue;
wxString text(content);
if (!parseUrl(text, out)) parseText(text, out);
}
@@ -331,7 +346,7 @@ bool CardListBase::parseFiles(wxArrayString& filenames, vector<CardP>& out) {
return j < out.size();
}
bool CardListBase::parseImage(Image& image, vector<CardP>& out) {
bool CardListBase::parseImage(Image& image, vector<CardP>& out) {
size_t j = out.size();
if (image.HasOption(wxIMAGE_OPTION_PNG_DESCRIPTION)) {
auto text = image.GetOption(wxIMAGE_OPTION_PNG_DESCRIPTION);
@@ -346,26 +361,30 @@ bool CardListBase::parseImage(Image& image, vector<CardP>& out) {
return j < out.size();
}
bool CardListBase::parseText(String& text, vector<CardP>& out) {
size_t j = out.size();
if (size_t pos = text.find("<mse-card-data>") != wxString::npos) {
text = text.substr(pos + 14, text.find("</mse-card-data>") - pos - 14);
bool CardListBase::parseText(String& text, vector<CardP>& out) {
if (text.size() == 0) {
return false;
}
size_t j = out.size();
size_t pos = text.find("<mse-card-data>");
if (pos != wxString::npos) {
text = text.substr(pos + 15, text.find("</mse-card-data>") - pos - 15);
}
try {
ScriptValueP sv = json_to_mse(text, set.get());
if (sv->type() == SCRIPT_COLLECTION) {
if (sv->type() == SCRIPT_COLLECTION) {
if (ScriptCustomCollection* custom = dynamic_cast<ScriptCustomCollection*>(sv.get())) {
for (size_t i = 0; i < custom->value.size(); i++) {
if (ScriptObject<CardP>* c = dynamic_cast<ScriptObject<CardP>*>(custom->value[i].get())) {
out.push_back(make_intrusive<Card>(*c->getValue()));
out.push_back(c->getValue());
}
}
}
} else if (ScriptObject<CardP>* c = dynamic_cast<ScriptObject<CardP>*>(sv.get())) {
out.push_back(make_intrusive<Card>(*c->getValue()));
out.push_back(c->getValue());
}
} catch (...) {}
} catch (...) {}
// decode images to populate image fields
for (int k = j; k < out.size(); k++) {
CardP& card = out[k];
@@ -375,56 +394,125 @@ bool CardListBase::parseText(String& text, vector<CardP>& out) {
return j < out.size();
}
bool CardListBase::parseData(bool ignore_cards_from_own_card_list) {
bool CardListBase::parseData(bool ignore_cards_from_own_card_list) {
wxBusyCursor wait;
wxDataFormat format = drop_target->data_object->GetReceivedFormat();
wxDataObject *data = drop_target->data_object->GetObject(format);
wxDataObjectComposite* composite = drop_target->data_object;
wxDataFormat format = composite->GetReceivedFormat();
vector<CardP> new_cards;
if (CardsDataObject* card_data = dynamic_cast<CardsDataObject*>(data)) {
if (format == CardsDataObject::format) {
String id = ignore_cards_from_own_card_list ? drop_target->ignored_id : _("");
card_data->getCards(set, id, new_cards);
size_t size = composite->GetDataSize(format);
if (size < 1) {
queue_message(MESSAGE_ERROR, _("DEBUG: CardsDataObject corrupted"));
return false;
}
if (size > 10000000) { // 10Mb
queue_message(MESSAGE_ERROR, _("Too much card data, paste less cards!"));
return false;
}
std::vector<char> buffer(size);
if (composite->GetDataHere(format, buffer.data())) {
CardsDataObject card_data;
card_data.SetData(size, buffer.data());
card_data.getCards(set, id, new_cards);
}
}
else switch (format.GetType())
{
case wxDF_FILENAME:
else {
wxDataObject *data = composite->GetObject(format);
switch (format.GetType())
{
wxFileDataObject* file_data = static_cast<wxFileDataObject*>(data);
wxArrayString filenames = file_data->GetFilenames();
parseFiles(filenames, new_cards);
}
break;
case wxDF_FILENAME:
{
wxFileDataObject* file_data = static_cast<wxFileDataObject*>(data);
wxArrayString filenames = file_data->GetFilenames();
parseFiles(filenames, new_cards);
}
break;
case wxDF_PNG:
{
wxImageDataObject* image_data = static_cast<wxImageDataObject*>(data);
Image image = image_data->GetImage();
parseImage(image, new_cards);
}
break;
case wxDF_PNG:
{
wxImageDataObject* image_data = static_cast<wxImageDataObject*>(data);
size_t size = image_data->GetDataSize();
if (size < 1) {
queue_message(MESSAGE_ERROR, _("DEBUG: ImageDataObject corrupted"));
return false;
}
if (size > 50000000) { // 50Mb
queue_message(MESSAGE_ERROR, _("Image data too large or corrupted"));
return false;
}
try {
Image image = image_data->GetImage();
if (!image.IsOk() || image.GetWidth() > 20000 || image.GetHeight() > 20000) {
queue_message(MESSAGE_ERROR, _("Image too large or corrupted"));
return false;
}
parseImage(image, new_cards);
} catch (const std::bad_alloc&) {
//queue_message(MESSAGE_ERROR, _("Image couldn't be allocated"));
return false;
} catch (...) {
queue_message(MESSAGE_ERROR, _("Image couldn't be processed"));
return false;
}
}
break;
case wxDF_BITMAP:
{
wxBitmapDataObject* bitmap_data = static_cast<wxBitmapDataObject*>(data);
wxBitmap bitmap = bitmap_data->GetBitmap();
Image image = bitmap.ConvertToImage();
parseImage(image, new_cards);
}
break;
case wxDF_BITMAP:
{
wxBitmapDataObject* bitmap_data = static_cast<wxBitmapDataObject*>(data);
size_t size = bitmap_data->GetDataSize();
if (size < 1) {
queue_message(MESSAGE_ERROR, _("DEBUG: BitmapDataObject corrupted"));
return false;
}
if (size > 50000000) { // 50Mb
queue_message(MESSAGE_ERROR, _("Bitmap data too large or corrupted"));
return false;
}
try {
wxBitmap bitmap = bitmap_data->GetBitmap();
if (!bitmap.IsOk() || bitmap.GetWidth() > 20000 || bitmap.GetHeight() > 20000) {
queue_message(MESSAGE_ERROR, _("Bitmap too large or corrupted"));
return false;
}
Image image = bitmap.ConvertToImage();
parseImage(image, new_cards);
} catch (const std::bad_alloc&) {
//queue_message(MESSAGE_ERROR, _("Bitmap or Image couldn't be allocated"));
return false;
} catch (...) {
queue_message(MESSAGE_ERROR, _("Bitmap or Image couldn't be processed"));
return false;
}
}
break;
case wxDF_UNICODETEXT:
case wxDF_TEXT:
case wxDF_HTML:
{
wxTextDataObject* text_data = static_cast<wxTextDataObject*>(data);
String text = text_data->GetText();
if (!parseUrl(text, new_cards)) parseText(text, new_cards);
}
break;
case wxDF_UNICODETEXT:
case wxDF_TEXT:
case wxDF_HTML:
{
wxTextDataObject* text_data = static_cast<wxTextDataObject*>(data);
size_t size = text_data->GetDataSize();
if (size < 1) {
queue_message(MESSAGE_ERROR, _("DEBUG: TextDataObject corrupted"));
return false;
}
if (size > 30000000) { // 30Mb
queue_message(MESSAGE_ERROR, _("Text too large or corrupted"));
return false;
}
String text = text_data->GetText();
if (!parseUrl(text, new_cards)) parseText(text, new_cards);
}
break;
default:
{
queue_message(MESSAGE_ERROR, _ERROR_("unknown data format"));
default:
{
queue_message(MESSAGE_ERROR, _ERROR_("unknown data format"));
}
}
}
@@ -441,15 +529,12 @@ bool CardListBase::canLink() const {
vector<CardP> selected_cards;
getSelection(selected_cards);
if (selected_cards.size() != 1) return false;
unordered_set<String> all_existing_uids;
FOR_EACH(card, set->cards) {
all_existing_uids.insert(card->uid);
}
CardP card = selected_cards[0];
return card->findFreeLink(card->uid, all_existing_uids) >= 0;
return card->findFreeLink(card->uid, set->card_uids) >= 0;
}
bool CardListBase::doLink() {
CardLinkWindow wnd(this, set, getCard());
CardLinkWindow wnd(this, set, getCard());
wnd.CentreOnParent();
if (wnd.ShowModal() == wxID_OK) {
// The actual linking is done in this window's onOk function
return true;
@@ -476,7 +561,23 @@ bool CardListBase::compareItems(void* a, void* b) const {
// compare sort keys
int cmp = smart_compare( va->getSortKey(), vb->getSortKey() );
if (cmp != 0) return cmp < 0;
// equal values, compare alternate sort key
// equal values, compare alternate sort keys
if (sort_by_column2 != sort_by_column && sort_by_column2 >= 0) {
FieldP sort_field2 = column_fields[sort_by_column2];
ValueP va2 = reinterpret_cast<Card*>(a)->data[sort_field2];
ValueP vb2 = reinterpret_cast<Card*>(b)->data[sort_field2];
assert(va2 && vb2);
int cmp = smart_compare( va2->getSortKey(), vb2->getSortKey() );
if (cmp != 0) return cmp < 0;
if (sort_by_column3 != sort_by_column && sort_by_column3 != sort_by_column2 && sort_by_column3 >= 0) {
FieldP sort_field3 = column_fields[sort_by_column3];
ValueP va3 = reinterpret_cast<Card*>(a)->data[sort_field3];
ValueP vb3 = reinterpret_cast<Card*>(b)->data[sort_field3];
assert(va3 && vb3);
int cmp = smart_compare( va3->getSortKey(), vb3->getSortKey() );
if (cmp != 0) return cmp < 0;
}
}
if (alternate_sort_field) {
ValueP va = reinterpret_cast<Card*>(a)->data[alternate_sort_field];
ValueP vb = reinterpret_cast<Card*>(b)->data[alternate_sort_field];
@@ -516,6 +617,8 @@ void CardListBase::rebuild() {
GameSettings& gs = settings.gameSettingsFor(*set->game);
sort_ascending = gs.sort_cards_ascending;
sort_by_column = -1;
sort_by_column2 = -1;
sort_by_column3 = -1;
long i = 0;
FOR_EACH(f, column_fields) {
if (f->name == gs.sort_cards_by) {
@@ -651,7 +754,8 @@ void CardListBase::onChar(wxKeyEvent& ev) {
}
}
void CardListBase::onBeginDrag(wxListEvent&) {
void CardListBase::onBeginDrag(wxListEvent& ev) {
ev.Skip();
drop_timer.Start(200, wxTIMER_ONE_SHOT);
}
@@ -697,6 +801,7 @@ void CardListBase::onContextMenu(wxContextMenuEvent&) {
add_menu_item_tr(&m, wxID_PASTE, "paste", "paste_card");
m.AppendSeparator();
add_menu_item_tr(&m, ID_CARD_ADD, "card_add", "add card");
add_menu_item_tr(&m, ID_CARD_ADD_DOUBLE, "card_add_double", "add card double");
add_menu_item_tr(&m, ID_CARD_REMOVE, "card_del", "remove card");
add_menu_item_tr(&m, ID_CARD_LINK, settings.darkModePrefix() + "card_link", "link card");
PopupMenu(&m);
@@ -723,7 +828,7 @@ CardListDropTarget::CardListDropTarget(CardListBase* card_list)
CardListDropTarget::~CardListDropTarget() {}
wxDragResult CardListDropTarget::OnData(wxCoord x, wxCoord y, wxDragResult defaultDragResult) {
wxDragResult CardListDropTarget::OnData(wxCoord x, wxCoord y, wxDragResult defaultDragResult) {
if (!GetData()) return wxDragNone;
if (!card_list->parseData(true)) return wxDragError;
return wxDragCopy;
+1 -1
View File
@@ -34,8 +34,8 @@ CardListColumnSelectDialog::CardListColumnSelectDialog(Window* parent, const Gam
s2->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s->Add(s2 , 1, wxEXPAND | wxALL, 4);
s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
// Set default size
SetSize(350, 450);
// Initialize order list
+4 -2
View File
@@ -16,7 +16,7 @@
ItemList::ItemList(Window* parent, int id, long additional_style, bool multi_sel)
: wxListView(parent, id, wxDefaultPosition, wxDefaultSize, additional_style | wxLC_REPORT | wxLC_VIRTUAL | (multi_sel ? 0 : wxLC_SINGLE_SEL))
, selected_item_pos(-1)
, sort_by_column(-1), sort_ascending(true)
, sort_by_column(-1), sort_by_column2(-1), sort_by_column3(-1), sort_ascending(true)
{
// create image list
wxImageList* il = new wxImageList(18,14);
@@ -262,7 +262,9 @@ void ItemList::onColumnClick(wxListEvent& ev) {
} else {
new_sort_by_column = -1; // 3rd click on same column -> don't sort
}
} else {
} else {
sort_by_column3 = sort_by_column2;
sort_by_column2 = sort_by_column;
sort_ascending = true;
}
sortBy(new_sort_by_column, sort_ascending);
+2
View File
@@ -107,6 +107,8 @@ protected:
VoidP selected_item; ///< The currently selected item
long selected_item_pos; ///< Position of the selected item in the sorted_list, or -1 if no card is selected
long sort_by_column; ///< Column to use for sorting, or -1 if not sorted
long sort_by_column2; ///< Previous column used for sorting, or -1 if not sorted
long sort_by_column3; ///< Previous previous column used for sorting, or -1 if not sorted (stable sort aint workin so we doing this I guess)
bool sort_ascending; ///< Sort order
vector<VoidP> sorted_list; ///< Sorted list of items, can be considered a map: pos->item
+2
View File
@@ -109,6 +109,7 @@ bool KeywordList::doCopy() {
if (!canCopy()) return false;
if (!wxTheClipboard->Open()) return false;
bool ok = wxTheClipboard->SetData(new KeywordDataObject(set, getKeyword())); // ignore result
wxTheClipboard->Flush();
wxTheClipboard->Close();
return ok;
}
@@ -125,6 +126,7 @@ bool KeywordList::doPaste() {
if (!wxTheClipboard->Open()) return false;
KeywordDataObject data;
bool ok = wxTheClipboard->GetData(data);
wxTheClipboard->Flush();
wxTheClipboard->Close();
if (!ok) return false;
// add keyword to set
+2 -1
View File
@@ -58,7 +58,8 @@ void TextCtrl::updateSize() {
ValueViewer& viewer = *viewers.front();
viewer.bounding_box.width = cs.GetWidth() - 2;
viewer.bounding_box.height = cs.GetHeight() - 2;
viewers.front()->getEditor()->determineSize(true);
viewers.front()->getEditor()->determineSize(true);
InvalidateBestSize();
}
void TextCtrl::setValue(String* value, bool untagged) {
+3 -3
View File
@@ -68,12 +68,12 @@ public:
/// Show a dialog to inform the user that updates are available (if there are any)
/// Call check_updates first. Call this function from an onIdle loop
inline void show_update_dialog(Window* parent) {
inline void show_update_dialog(Window* set_window) {
if (shown_dialog || check_status != FOUND) return; // we already have the latest version, or this has already been displayed.
shown_dialog = true;
wxMessageDialog dial = wxMessageDialog(parent, _LABEL_("updates found"), _TITLE_("updates available"), wxYES_NO);
wxMessageDialog dial = wxMessageDialog(set_window, _LABEL_("updates found"), _TITLE_("updates available"), wxYES_NO);
if (dial.ShowModal() == wxID_YES) {
(new PackagesWindow(parent))->Show();
(new PackagesWindow(set_window))->Show();
}
}
+2 -2
View File
@@ -44,11 +44,11 @@ HtmlExportWindow::HtmlExportWindow(Window* parent, const SetP& set, const Export
s2->Add(s3, 7, wxEXPAND | wxLEFT, 8);
s->Add(s2, 1, wxEXPAND | wxALL, 4);
s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
SetSize(700,500);
// list
list->showData<ExportTemplate>(set->game->name() + _("-*"));
list->showData<ExportTemplate>(set->game->name() + _("*"));
list->select(settings.gameSettingsFor(*set->game).default_export);
}
+1 -1
View File
@@ -229,8 +229,8 @@ ImageSliceWindow::ImageSliceWindow(Window* parent, const Image& source, const St
s5->AddStretchSpacer(1);
s->Add(s5, 0, wxEXPAND);
s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL, 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
// Only now do we allow events to be processed.
initialized = true;
updateControls();
+1 -1
View File
@@ -43,8 +43,8 @@ ImagesExportWindow::ImagesExportWindow(Window* parent, const SetP& set, const Ex
wxSizer* s3 = ExportWindowBase::Create();
s->Add(s3, 1, wxEXPAND | (wxALL & ~wxTOP), 8);
s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | (wxALL & ~wxTOP), 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
SetSize(500,-1);
}
+121 -18
View File
@@ -10,6 +10,8 @@
#include <gui/new_window.hpp>
#include <gui/control/gallery_list.hpp>
#include <gui/control/package_list.hpp>
#include <gui/downloadable_installers.hpp>
#include <data/installer.hpp>
#include <data/game.hpp>
#include <data/stylesheet.hpp>
#include <data/set.hpp>
@@ -56,8 +58,8 @@ NewSetWindow::NewSetWindow(Window* parent)
s->Add(s3, wxSizerFlags().Expand().Border(wxALL, 6));
s->Add(stylesheet_list, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
// Resize
Layout();
wxSize min_size = GetSizer()->GetMinSize() + GetSize() - GetClientSize();
@@ -177,10 +179,15 @@ StyleSheetP select_stylesheet(const Game& game, const String& failed_name) {
SelectStyleSheetWindow::SelectStyleSheetWindow(Window* parent, const Game& game, const String& failed_name)
: wxDialog(parent, wxID_ANY, _TITLE_("select stylesheet"), wxDefaultPosition, wxSize(830,320), wxDEFAULT_DIALOG_STYLE)
, game(game)
, failed_name(failed_name)
{
wxBusyCursor wait;
// init controls
stylesheet_list = new PackageList (this, ID_STYLESHEET_LIST);
// init controls
ok_button = new wxButton (this, wxID_OK);
cancel_button = new wxButton (this, wxID_CANCEL);
find_online_button = new wxButton (this, ID_DOWNLOAD_STYLESHEET, _BUTTON_("find package online"));
stylesheet_list = new PackageList (this, ID_STYLESHEET_LIST);
find_online_status_text = new wxStaticText(this, wxID_ANY, _(""));
wxStaticText* description = new wxStaticText(this, ID_GAME_LIST, _LABEL_1_("stylesheet not found", failed_name));
wxStaticText* stylesheet_text = new wxStaticText(this, ID_STYLESHEET_LIST, _LABEL_("style type"));
@@ -195,18 +202,26 @@ SelectStyleSheetWindow::SelectStyleSheetWindow(Window* parent, const Game& game,
s2->AddStretchSpacer();
s2->Add(stylesheet_filter, 1, wxRIGHT, 4);
s->Add(s2, wxSizerFlags().Expand().Border(wxALL, 6));
s->Add(stylesheet_list, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8);
s->SetSizeHints(this);
s->Add(stylesheet_list, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
wxBoxSizer* s3 = new wxBoxSizer(wxHORIZONTAL);
s3->Add(find_online_button, 0, wxRIGHT, 8);
s3->Add(find_online_status_text, 1, wxALIGN_CENTER_VERTICAL);
s3->AddStretchSpacer();
s3->Add(ok_button, 0, wxRIGHT, 4);
s3->Add(cancel_button, 0);
s->Add(s3, 0, wxEXPAND | wxALL, 8);
SetSizer(s);
s->SetSizeHints(this);
// init list
stylesheet_list->showData<StyleSheet>(game.name() + _("-*"));
stylesheet_list->showData<StyleSheet>(game.name() + _("*"));
stylesheet_list->select(settings.gameSettingsFor(game).default_stylesheet);
// Resize
Layout();
wxSize min_size = GetSizer()->GetMinSize() + GetSize() - GetClientSize();
SetSize(830,min_size.y);
UpdateWindowUI(wxUPDATE_UI_RECURSE);
UpdateWindowUI(wxUPDATE_UI_RECURSE);
// start downloading the installer list
downloadable_installers.download();
}
void SelectStyleSheetWindow::onStyleSheetSelect(wxCommandEvent&) {
@@ -226,7 +241,88 @@ void SelectStyleSheetWindow::onStylesheetFilterUpdate(wxCommandEvent&) {
else {
stylesheet_list->setFilter(stylesheet_filter->getFilter<PackageData>());
}
}
}
void SelectStyleSheetWindow::onFindOnline(wxCommandEvent&) {
if (searching_online) return;
searching_online = true;
find_online_status_text->SetLabel(_LABEL_("searching online"));
find_online_button->Enable(false);
//downloadable_installers.download();
}
void SelectStyleSheetWindow::tryAutoInstall() {
auto_installing = true;
searching_online = false;
wxBusyCursor busy;
// search for missing stylesheet
InstallablePackages packages;
package_manager.findAllInstalledPackages(packages);
FOR_EACH(inst, downloadable_installers.installers) {
merge(packages, inst);
}
FOR_EACH(p, packages) {
if (!p) continue;
p->determineStatus();
}
InstallablePackageP target;
FOR_EACH(p, packages) {
if (!p || !p->description) continue;
if (p->description->name == failed_name) {
target = p;
break;
}
}
if (!target) {
find_online_status_text->SetLabel(_LABEL_("searching online fail"));
auto_installing = false;
return;
}
try {
// update UI
find_online_status_text->SetLabel(_LABEL_("found online downloading"));
ok_button->Enable(false);
cancel_button->Enable(false);
stylesheet_list->Enable(false);
stylesheet_filter->Enable(false);
Layout();
Refresh();
Update();
wxSafeYield(this, true);
// resolve dependencies
PackageAction where = is_install_local(settings.install_type) ? PACKAGE_ACT_LOCAL : PACKAGE_ACT_GLOBAL;
bool action_ok = set_package_action(packages, target, PACKAGE_ACT_INSTALL | where);
if (!action_ok) throw Error(_("can't resolve dependencies"));
// download stylesheet and dependencies
FOR_EACH(p, packages) {
if (!p->has(PACKAGE_ACT_INSTALL)) continue;
p->ensureIsDownloaded();
}
// update UI
find_online_status_text->SetLabel(_LABEL_("found online installing"));
Layout();
Refresh();
Update();
wxSafeYield(this, true);
// install stylesheet and dependencies
FOR_EACH(p, packages) {
if (!p->has(PACKAGE_ACT_INSTALL)) continue;
bool package_ok = package_manager.install(*p);
if (!package_ok) throw Error(_("install package failed"));
}
// auto select stylesheet and exit
stylesheet = StyleSheet::byGameAndName(game, failed_name);
EndModal(wxID_OK);
} catch (const Error& e) {
handle_error(e);
auto_installing = false;
find_online_status_text->SetLabel(_LABEL_("found online fail"));
ok_button->Enable(true);
cancel_button->Enable(true);
stylesheet_list->Enable(true);
stylesheet_filter->Enable(true);
}
}
void SelectStyleSheetWindow::OnOK(wxCommandEvent&) {
done();
@@ -245,22 +341,29 @@ void SelectStyleSheetWindow::done() {
void SelectStyleSheetWindow::onUpdateUI(wxUpdateUIEvent& ev) {
switch (ev.GetId()) {
case wxID_OK:
ev.Enable(stylesheet_list->hasSelection());
if (!auto_installing) ev.Enable(stylesheet_list->hasSelection());
break;
}
}
void SelectStyleSheetWindow::onIdle(wxIdleEvent& ev) {
// Stuff that must be done in the main thread
//handle_pending_errors(); // errors are ignored until set window is shown
if (searching_online && !auto_installing) {
// still downloading?
if (!downloadable_installers.download()) {
return;
}
// installer list ready
tryAutoInstall();
}
}
BEGIN_EVENT_TABLE(SelectStyleSheetWindow, wxDialog)
EVT_GALLERY_SELECT (ID_STYLESHEET_LIST, SelectStyleSheetWindow::onStyleSheetSelect)
EVT_GALLERY_ACTIVATE(ID_STYLESHEET_LIST, SelectStyleSheetWindow::onStyleSheetActivate)
EVT_COMMAND_RANGE(ID_STYLESHEET_FILTER, ID_STYLESHEET_FILTER, wxEVT_COMMAND_TEXT_UPDATED, SelectStyleSheetWindow::onStylesheetFilterUpdate)
EVT_BUTTON (wxID_OK, SelectStyleSheetWindow::OnOK)
EVT_UPDATE_UI (wxID_ANY, SelectStyleSheetWindow::onUpdateUI)
EVT_IDLE ( SelectStyleSheetWindow::onIdle)
EVT_GALLERY_SELECT (ID_STYLESHEET_LIST, SelectStyleSheetWindow::onStyleSheetSelect)
EVT_GALLERY_ACTIVATE(ID_STYLESHEET_LIST, SelectStyleSheetWindow::onStyleSheetActivate)
EVT_COMMAND_RANGE (ID_STYLESHEET_FILTER, ID_STYLESHEET_FILTER, wxEVT_COMMAND_TEXT_UPDATED, SelectStyleSheetWindow::onStylesheetFilterUpdate)
EVT_BUTTON (ID_DOWNLOAD_STYLESHEET, SelectStyleSheetWindow::onFindOnline)
EVT_BUTTON (wxID_OK, SelectStyleSheetWindow::OnOK)
EVT_UPDATE_UI (wxID_ANY, SelectStyleSheetWindow::onUpdateUI)
EVT_IDLE ( SelectStyleSheetWindow::onIdle)
END_EVENT_TABLE ()
+17 -7
View File
@@ -81,22 +81,32 @@ private:
const Game& game;
// gui items
PackageList* stylesheet_list;
PackageList* stylesheet_list;
FilterCtrl* stylesheet_filter;
String stylesheet_filter_value;
wxButton* ok_button, *cancel_button;
wxButton* find_online_button;
wxStaticText* find_online_status_text;
bool searching_online = false;
bool auto_installing = false;
String failed_name;
FilterCtrl* stylesheet_filter;
String stylesheet_filter_value;
// --------------------------------------------------- : events
void onStyleSheetSelect (wxCommandEvent&);
void onStyleSheetActivate(wxCommandEvent&);
void onStylesheetFilterUpdate(wxCommandEvent&);
void onFindOnline(wxCommandEvent&);
virtual void OnOK(wxCommandEvent&);
void onUpdateUI(wxUpdateUIEvent&);
void onIdle(wxIdleEvent&);
void onIdle(wxIdleEvent&);
void tryAutoInstall();
// we are done, close the window
void done();
};
+62 -11
View File
@@ -16,18 +16,36 @@
/// A list of installed and downloadable packages
class PackageUpdateList : public TreeList {
private:
class TreeItem;
public:
typedef intrusive_ptr<TreeItem> TreeItemP;
PackageUpdateList(Window* parent, const InstallablePackages& packages, bool show_only_installable, int id = wxID_ANY);
~PackageUpdateList();
inline InstallablePackageP getSelection() const {
return selection == NOTHING ? InstallablePackageP() : get(selection);
inline InstallablePackageP getSelectedPackage() const {
TreeItem* ti = getSelectedItem();
return ti ? ti->package : InstallablePackageP();
}
inline InstallablePackageP get(size_t item) const {
return static_pointer_cast<TreeItem>(items[item])->package;
inline bool selectionIsGroup() const {
TreeItem* ti = getSelectedItem();
return ti && !ti->package;
}
inline void forEachSelectedPackage(const std::function<void(const InstallablePackageP&)>& fn) const {
forEachPackage(getSelectedItem(), fn);
}
inline bool anySelectedPackage(const std::function<bool(const InstallablePackageP&)>& predicate) const {
return anyPackage(getSelectedItem(), predicate);
}
inline bool allSelectedPackages(const std::function<bool(const InstallablePackageP&)>& predicate) const {
return allPackages(getSelectedItem(), predicate);
}
protected:
// overridden methods from TreeList
void initItems() override;
@@ -38,15 +56,48 @@ protected:
int columnWidth(size_t column) const override;
private:
inline TreeItem* getSelectedItem() const {
return selection >= items.size() ? nullptr : static_pointer_cast<TreeItem>(items[selection]).get();
}
inline void forEachPackage(const TreeItem* item, const std::function<void(const InstallablePackageP&)>& fn) const {
if (!item) return;
if (item->package) {
fn(item->package);
}
for (const auto& child : item->children) {
forEachPackage(child.get(), fn);
}
}
inline bool anyPackage(const TreeItem* item, const std::function<bool(const InstallablePackageP&)>& predicate) const {
if (!item) return false;
if (item->package && predicate(item->package)) {
return true;
}
for (const auto& child : item->children) {
if (anyPackage(child.get(), predicate)) {
return true;
}
}
return false;
}
inline bool allPackages(const TreeItem* item, const std::function<bool(const InstallablePackageP&)>& predicate) const {
if (!item) return false;
if (item->package && !predicate(item->package)) {
return false;
}
for (const auto& child : item->children) {
if (!allPackages(child.get(), predicate)) {
return false;
}
}
return true;
}
/// The list of packages we are displaying
const InstallablePackages& packages;
/// Show only packages with an installer?
bool show_only_installable;
class TreeItem;
public:
typedef intrusive_ptr<TreeItem> TreeItemP;
private:
class TreeItem : public Item {
public:
TreeItem() : position_type(TYPE_OTHER), position_hint(1000000) {}
+96 -62
View File
@@ -18,7 +18,6 @@
#include <data/settings.hpp>
#include <gfx/gfx.hpp>
#include <wx/wfstream.h>
#include <wx/webrequest.h>
#include <wx/dcbuffer.h>
#include <wx/progdlg.h>
#include <wx/tglbtn.h>
@@ -86,31 +85,36 @@ void PackageInfoPanel::draw(DC& dc) {
icon_w = icon.GetWidth();
icon_h = icon.GetHeight();
}
dc.DrawBitmap(icon, x+(max_size-icon_w)/2, y+(max_size-icon_h)/2);
dc.DrawBitmap(icon, x+(max_size-icon_w)/2, y+(max_size-icon_h)/2 + 2);
x += max_size;
}
// package name
// package info
x += 7;
dc.SetFont(wxFont(16, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, _("Arial")));
dc.DrawText(d.full_name, x, y);
dc.DrawText(d.short_name, x, y);
y += dc.GetCharHeight() + 7;
dc.SetFont(wxFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, _("Arial")));
if (d.full_name != d.short_name) dc.DrawText(d.full_name, x, y);
y += dc.GetCharHeight() + 7;
// version
dc.SetFont(*wxNORMAL_FONT);
int dy = dc.GetCharHeight() + 3;
dc.DrawText(_LABEL_("installed version"), x, y);
dc.DrawText(_LABEL_("installable version"), x, y + 1*dy);
dc.DrawText(_LABEL_("folder name"), x, y);
dc.DrawText(_LABEL_("installed version"), x, y + 1*dy);
dc.DrawText(_LABEL_("installable version"), x, y + 2*dy);
//dc.DrawText(_LABEL_("installer size"), x, y + 2*dy);
//dc.DrawText(_LABEL_("installer status"), x, y + 3*dy);
// text size?
int dx = 0, max_dx = 0;
dc.GetTextExtent(_LABEL_("folder name"), &dx, nullptr); max_dx = max(max_dx, dx);
dc.GetTextExtent(_LABEL_("installed version"), &dx, nullptr); max_dx = max(max_dx, dx);
dc.GetTextExtent(_LABEL_("installable version"), &dx, nullptr); max_dx = max(max_dx, dx);
//dc.GetTextExtent(_LABEL_("installer size"), &dx, nullptr); max_dx = max(max_dx, dx);
//dc.GetTextExtent(_LABEL_("installer status"), &dx, nullptr); max_dx = max(max_dx, dx);
x += max_dx + 5;
dc.DrawText(package->installed ? package->installed->version.toString() : _LABEL_("no version"), x, y);
dc.DrawText(package->installer ? package->description->version.toString() : _LABEL_("no version"), x, y + 1*dy);
dc.DrawText(d.name, x, y);
dc.DrawText(package->installed ? package->installed->version.toString() : _LABEL_("no version"), x, y + 1*dy);
dc.DrawText(package->installer ? package->description->version.toString() : _LABEL_("no version"), x, y + 2*dy);
//dc.DrawText(_("?"), x, y + 2*dy);
//dc.DrawText(_("?"), x, y + 3*dy);
}
@@ -126,9 +130,7 @@ END_EVENT_TABLE()
// ----------------------------------------------------------------------------- : PackagesWindow
enum Action {
KEEP, INSTALL, UPGRADE, REMOVE
};
DEFINE_EVENT_TYPE(EVENT_PACKAGE_LIST_CHANGED);
PackagesWindow::PackagesWindow(Window* parent, bool download_package_list)
: waiting_for_list(download_package_list)
@@ -194,7 +196,8 @@ void PackagesWindow::init(Window* parent, bool show_only_installable) {
v2->AddStretchSpacer();
v2->Add(keep_button, 0, wxEXPAND | wxBOTTOM, 4);
v2->AddStretchSpacer();
v2->Add(remove_button, 0, wxEXPAND | wxBOTTOM, 0);
v2->Add(remove_button, 0, wxEXPAND | wxBOTTOM, 0);
v2->SetMinSize(wxSize(170, -1));
h->Add(v2);
v->Add(h, 0, wxEXPAND | (wxALL & ~wxTOP), 8);
wxBoxSizer* h2 = new wxBoxSizer(wxHORIZONTAL);
@@ -202,7 +205,7 @@ void PackagesWindow::init(Window* parent, bool show_only_installable) {
h2->AddStretchSpacer();
h2->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | (wxALL & ~wxTOP), 8);
v->Add(h2, 0, wxEXPAND);
v->SetMinSize(800,600);
v->SetMinSize(820,650);
SetSizerAndFit(v);
wxUpdateUIEvent::SetMode(wxUPDATE_UI_PROCESS_SPECIFIED);
@@ -212,25 +215,28 @@ void PackagesWindow::init(Window* parent, bool show_only_installable) {
PackagesWindow::~PackagesWindow() {
}
void PackagesWindow::onPackageSelect(wxCommandEvent& ev) {
package_info->setPackage(package = package_list->getSelection());
package_info->setPackage(package = package_list->getSelectedPackage());
UpdateWindowUI(wxUPDATE_UI_RECURSE);
}
void PackagesWindow::onActionChange(wxCommandEvent& ev) {
if (package) {
PackageAction act = ev.GetId() == ID_INSTALL ? PACKAGE_ACT_INSTALL
: ev.GetId() == ID_UPGRADE ? PACKAGE_ACT_INSTALL
: ev.GetId() == ID_REMOVE ? PACKAGE_ACT_REMOVE
: PACKAGE_ACT_NOTHING;
act = act | where;
// set action
set_package_action(installable_packages, package, act);
package_list->Refresh(false);
UpdateWindowUI(wxUPDATE_UI_RECURSE);
}
}
PackageAction act = ev.GetId() == ID_INSTALL ? PACKAGE_ACT_INSTALL
: ev.GetId() == ID_UPGRADE ? PACKAGE_ACT_INSTALL
: ev.GetId() == ID_REMOVE ? PACKAGE_ACT_REMOVE
: PACKAGE_ACT_NOTHING;
act = act | where;
// set action
package_list->forEachSelectedPackage(
[&](const InstallablePackageP& p) {
if (p->can(act)) {
set_package_action(installable_packages, p, act);
}
}
);
package_list->Refresh(false);
UpdateWindowUI(wxUPDATE_UI_RECURSE);
}
void PackagesWindow::onOk(wxCommandEvent& ev) {
// count number of packages to change
@@ -252,7 +258,7 @@ void PackagesWindow::onOk(wxCommandEvent& ev) {
}
}
// anything to do?
if (!to_change) {
if (!to_change && !app_change) {
ev.Skip();
return;
}
@@ -272,8 +278,6 @@ void PackagesWindow::onOk(wxCommandEvent& ev) {
this,
wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_SMOOTH | wxSTAY_ON_TOP
);
// Clear package list
package_manager.reset();
// Download installers
int package_pos = 0, step = 0;
FOR_EACH(ip, installable_packages) {
@@ -281,21 +285,8 @@ void PackagesWindow::onOk(wxCommandEvent& ev) {
if (ip->has(PACKAGE_ACT_INSTALL) && ip->installer && !ip->installer->installer) {
if (!progress.Update(step++, String::Format(_ERROR_("downloading updates"), ++package_pos, to_download))) {
return; // aborted
}
// download installer
wxWebRequestSync request = wxWebSessionSync::GetDefault().CreateRequest(ip->installer->installer_url);
auto const result = request.Execute();
if (!result) {
throw Error(_ERROR_2_("can't download installer", ip->description->name, ip->installer->installer_url));
}
wxInputStream* is(request.GetResponse().GetStream());
ip->installer->installer_file = wxFileName::CreateTempFileName(_("mse-installer"));
wxFileOutputStream os(ip->installer->installer_file);
os.Write(*is);
os.Close();
// open installer
ip->installer->installer = make_intrusive<Installer>();
ip->installer->installer->open(ip->installer->installer_file);
}
ip->ensureIsDownloaded();
}
}
// Install stuff
@@ -360,6 +351,8 @@ void PackagesWindow::onOk(wxCommandEvent& ev) {
// }
//}
}
// Notify that packages have changed
sendEvent();
// Continue event propagation into the dialog window so that it closes.
ev.Skip();
//%% TODO: will we delete packages?
@@ -368,28 +361,64 @@ void PackagesWindow::onOk(wxCommandEvent& ev) {
//%% NOTE: The above text is for the locale.pl program
}
void PackagesWindow::onUpdateUI(wxUpdateUIEvent& ev) {
void PackagesWindow::onUpdateUI(wxUpdateUIEvent& ev) {
bool is_group = package_list->selectionIsGroup();
wxToggleButton* w = (wxToggleButton*)ev.GetEventObject();
switch (ev.GetId()) {
case ID_KEEP:
w->SetValue(package && package->has(PACKAGE_ACT_NOTHING));
w->Enable (package && package->can(PACKAGE_ACT_NOTHING | where));
w->SetLabel(package && package->installed ? _BUTTON_("keep package") : _BUTTON_("don't install package"));
w->SetValue(
package_list->allSelectedPackages([&](const InstallablePackageP& p) {
return p->has(PACKAGE_ACT_NOTHING);
})
);
w->Enable(
package_list->anySelectedPackage([&](const InstallablePackageP& p) {
return p->can(PACKAGE_ACT_NOTHING | where);
})
);
w->SetLabel(is_group ? _BUTTON_("keep group") :
package && package->installed ? _BUTTON_("keep package") :
_BUTTON_("don't install package"));
break;
case ID_INSTALL:
w->SetValue(package && package->has(PACKAGE_ACT_INSTALL | where));
w->Enable (package && package->can(PACKAGE_ACT_INSTALL | where));
w->SetLabel(!(package && package->installed) ? _BUTTON_("install package")
: (package && package->has(PACKAGE_UPDATES)) ? _BUTTON_("upgrade package")
: _BUTTON_("reinstall package"));
w->SetValue(
package_list->allSelectedPackages([&](const InstallablePackageP& p) {
return p->has(PACKAGE_ACT_INSTALL | where) ||
(p->has(PACKAGE_INSTALLED) && !p->has(PACKAGE_ACT_REMOVE) && !p->has(PACKAGE_UPDATES));
}) &&
package_list->anySelectedPackage([&](const InstallablePackageP& p) {
return p->has(PACKAGE_ACT_INSTALL | where);
})
);
w->Enable(
package_list->anySelectedPackage([&](const InstallablePackageP& p) {
return p->can(PACKAGE_ACT_INSTALL | where);
})
);
w->SetLabel(is_group ? _BUTTON_("install group") :
!(package && package->installed) ? _BUTTON_("install package") :
(package && package->has(PACKAGE_UPDATES)) ? _BUTTON_("upgrade package") :
_BUTTON_("reinstall package"));
break;
case ID_REMOVE:
w->SetValue(package && package->has(PACKAGE_ACT_REMOVE | where));
w->Enable (package && package->can(PACKAGE_ACT_REMOVE | where));
//w->SetLabel(package && package->... ? _BUTTON_("remove group") : _BUTTON_("remove package"));
w->SetValue(
package_list->allSelectedPackages([&](const InstallablePackageP& p) {
return p->has(PACKAGE_ACT_REMOVE | where) ||
(!p->has(PACKAGE_INSTALLED) && !p->has(PACKAGE_ACT_INSTALL));
}) &&
package_list->anySelectedPackage([&](const InstallablePackageP& p) {
return p->has(PACKAGE_ACT_REMOVE | where);
})
);
w->Enable(
package_list->anySelectedPackage([&](const InstallablePackageP& p) {
return p->can(PACKAGE_ACT_REMOVE | where);
})
);
w->SetLabel(is_group ? _BUTTON_("remove group") :
_BUTTON_("remove package"));
break;
}
// TODO: change labels to _BUTTON_("install group"), _BUTTON_("remove group"), _BUTTON_("upgrade group")
}
void PackagesWindow::onIdle(wxIdleEvent& ev) {
@@ -409,11 +438,16 @@ bool PackagesWindow::checkInstallerList(bool refresh) {
// refresh
if (refresh) {
package_list->rebuild();
package_info->setPackage(package = package_list->getSelection());
package_info->setPackage(package = package_list->getSelectedPackage());
UpdateWindowUI(wxUPDATE_UI_RECURSE);
}
return true;
}
}
void PackagesWindow::sendEvent() {
wxCommandEvent ev(EVENT_PACKAGE_LIST_CHANGED, GetId());
wxPostEvent(GetParent(), ev);
}
BEGIN_EVENT_TABLE(PackagesWindow, wxDialog)
EVT_LISTBOX (ID_PACKAGE_LIST, PackagesWindow::onPackageSelect)
+3 -1
View File
@@ -50,6 +50,8 @@ private:
/// Check whether we have downloaded the list of installers
/** If the download is (partially) complete, update the installable_packages list */
bool checkInstallerList(bool refresh = true);
bool checkInstallerList(bool refresh = true);
/// Notify that the package list has changed
void sendEvent();
};
+10 -7
View File
@@ -125,8 +125,8 @@ PreferencesWindow::PreferencesWindow(Window* parent)
s->Add(nb, 1, wxEXPAND | (wxALL & ~wxBOTTOM), 8);
s->AddSpacer(4);
s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | (wxALL & ~wxTOP), 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
}
void PreferencesWindow::onOk(wxCommandEvent&) {
@@ -177,7 +177,6 @@ GlobalPreferencesPage::GlobalPreferencesPage(Window* parent)
dark_mode->SetSelection((int)settings.dark_mode_type);
// init sizer
wxSizer* s = new wxBoxSizer(wxVERTICAL);
s->SetSizeHints(this);
wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("language"));
s2->Add(new wxStaticText(this, wxID_ANY, _LABEL_("app language")), 0, wxALL, 4);
s2->Add(language, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
@@ -191,6 +190,7 @@ GlobalPreferencesPage::GlobalPreferencesPage(Window* parent)
s4->Add(new wxStaticText(this, wxID_ANY, _HELP_( "app language")), 0, wxALL, 4);
s->Add(s4, 0, wxEXPAND | wxALL, 8);
SetSizer(s);
s->SetSizeHints(this);
}
void GlobalPreferencesPage::store() {
@@ -243,8 +243,8 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("percent of normal")),1, wxALL & ~wxRIGHT, 4);
s2->Add(s3, 0, wxEXPAND | wxALL, 4);
s->Add(s2, 0, wxEXPAND | wxALL, 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
}
void DisplayPreferencesPage::store() {
@@ -342,8 +342,8 @@ TransfersPreferencesPage::TransfersPreferencesPage(Window* parent) : Preferences
s->Add(s2, 0, wxEXPAND | wxALL, 8);
s->Add(s5, 0, wxEXPAND | wxALL, 8);
export_scale->SetFocus();
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
}
void TransfersPreferencesPage::store() {
@@ -375,8 +375,8 @@ DirsPreferencesPage::DirsPreferencesPage(Window* parent)
s3->Add(ab, 0, wxEXPAND);
s2->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s->Add(s2, 0, wxEXPAND | wxALL, 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
}
void DirsPreferencesPage::store() {
@@ -440,14 +440,17 @@ void UpdatePreferencesPage::store() {
else settings.check_updates_what = CHECK_EVERYTHING;
}
void UpdatePreferencesPage::onCheckUpdatesNow(wxCommandEvent&) {
void UpdatePreferencesPage::onCheckUpdatesNow(wxCommandEvent&) {
downloadable_installers.shown_dialog = true;
downloadable_installers.check_updates_now(false);
if (downloadable_installers.check_status == DownloadableInstallerList::CheckStatus::FAILED) {
wxMessageBox(_ERROR_("checking updates failed"), _TITLE_("update check"), wxICON_ERROR | wxOK);
} else if (downloadable_installers.check_status == DownloadableInstallerList::CheckStatus::NOT_FOUND) {
wxMessageBox(_ERROR_("no updates"), _TITLE_("update check"), wxICON_INFORMATION | wxOK);
} else {
(new PackagesWindow(GetParent()))->Show();
wxWindow* set_window = this;
while (set_window->GetParent()) set_window = set_window->GetParent();
(new PackagesWindow(set_window))->Show();
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ void PrintJob::measure_cards() {
if (already_measured_cards.find(card) != already_measured_cards.end()) continue;
already_measured_cards.emplace(card);
card_layouts.emplace_back(measure_card(card));
CardP other_face = card->getLinkedOtherFaceCard(cards);
CardP other_face = card->getLinkedOtherFaceCard(*set); // we assume that if you want to print one side, you also want to print the other, so we look for it in the entire set instead of just the given cards
if (other_face && already_measured_cards.find(other_face) == already_measured_cards.end()) {
already_measured_cards.emplace(other_face);
card_layouts.emplace_back(measure_card(other_face));
+19 -5
View File
@@ -118,8 +118,8 @@ CardsPanel::CardsPanel(Window* parent, int id)
link_grid_4->Add(link_viewer_4, wxGBPosition(1, 0), wxGBSpan(1, 2));
s->Add(s_left, 0, wxEXPAND | wxRIGHT, 2);
s->Add(splitter, 1, wxEXPAND);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
// init menus
menuCard = new wxMenu();
@@ -127,13 +127,14 @@ CardsPanel::CardsPanel(Window* parent, int id)
add_menu_item_tr(menuCard, ID_CARD_NEXT, nullptr, "next card");
add_menu_item_tr(menuCard, ID_CARD_SEARCH, nullptr, "search cards");
menuCard->AppendSeparator();
add_menu_item_tr(menuCard, ID_CARD_ADD, "card_add", "add_card");
add_menu_item_tr(menuCard, ID_CARD_ADD_DOUBLE, "card_add_double", "add_card_double");
insertManyCardsMenu = add_menu_item_tr(menuCard, ID_CARD_ADD_MULT, "card_add_multiple", "add cards");
// NOTE: space after "Del" prevents wx from making del an accellerator
// otherwise we delete a card when delete is pressed inside the editor
// Adding a space never hurts, please keep it just to be safe.
add_menu_item(menuCard, ID_CARD_ADD_CSV, "card_add_multiple", _MENU_("add card csv") + _(" "), _HELP_("add card csv"));
add_menu_item(menuCard, ID_CARD_ADD_JSON, "card_add_multiple", _MENU_("add card json") + _(" "), _HELP_("add card json"));
add_menu_item_tr(menuCard, ID_CARD_ADD, "card_add", "add_card");
add_menu_item(menuCard, ID_CARD_REMOVE, "card_del", _MENU_("remove card")+_(" "), _HELP_("remove card"));
add_menu_item(menuCard, ID_CARD_LINK, settings.darkModePrefix() + "card_link", _MENU_("link card") + _(" "), _HELP_("link card"));
add_menu_item(menuCard, ID_CARD_AND_LINK_COPY, "card_copy", _MENU_("copy card and links") + _(" "), _HELP_("copy card and links"));
@@ -255,7 +256,7 @@ void CardsPanel::onChangeSet() {
insertManyCardsMenu->SetSubMenu(makeAddCardsSubmenu(false));
// re-add the menu
menuCard->Remove(ID_CARD_ADD_MULT);
((wxMenu*)menuCard)->Insert(4,insertManyCardsMenu); // HACK: the position is hardcoded
((wxMenu*)menuCard)->Insert(6,insertManyCardsMenu); // HACK: the position is hardcoded
// also for the toolbar dropdown menu
if (toolAddCard) {
// Originally this was using the menu directly, but there are compatibility issues apparently.
@@ -270,6 +271,7 @@ wxMenu* CardsPanel::makeAddCardsSubmenu(bool add_single_card_option) {
if (add_single_card_option) {
cards_scripts_menu = new wxMenu();
add_menu_item_tr(cards_scripts_menu, ID_CARD_ADD, "card_add", "add_card");
add_menu_item_tr(cards_scripts_menu, ID_CARD_ADD_DOUBLE, "card_add_double", "add_card_double");
cards_scripts_menu->AppendSeparator();
}
// create menu for add_cards_scripts
@@ -435,6 +437,17 @@ void CardsPanel::onCommand(int id) {
case ID_CARD_ADD:
set->actions.addAction(make_unique<AddCardAction>(*set));
break;
case ID_CARD_ADD_DOUBLE: {
vector<CardP> cards;
cards.push_back(make_intrusive<Card>(*set->game));
cards.push_back(make_intrusive<Card>(*set->game));
cards[0]->linked_card_1 = cards[1]->uid;
cards[1]->linked_card_1 = cards[0]->uid;
cards[0]->linked_relation_1 = "Back Face";
cards[1]->linked_relation_1 = "Front Face";
set->actions.addAction(make_unique<AddCardAction>(ADD, *set, cards));
break;
}
case ID_CARD_ADD_CSV:
card_list->doAddCSV();
break;
@@ -566,7 +579,7 @@ bool CardsPanel::canPaste() const {
else return false;
}
void CardsPanel::doPaste() {
if (card_list->doPaste()) return;
if (card_list->doPaste()) return;
int id = focused_control(this);
if (id == ID_EDITOR) editor->doPaste();
@@ -654,8 +667,9 @@ CardP CardsPanel::selectedCard() const {
return card_list->getCard();
}
void CardsPanel::selectCard(const CardP& card) {
if (!set) return; // we want onChangeSet first
if (!set) return; // we want onChangeSet first
card_list->SetFocus();
card_list->setCard(card);
editor->setCard(card);
+13 -4
View File
@@ -14,6 +14,7 @@
#include <util/window_id.hpp>
#include <data/stylesheet.hpp>
#include <data/card.hpp>
#include <script/functions/json.hpp>
#include <wx/splitter.h>
#include <wx/dcbuffer.h>
#include <wx/clipbrd.h>
@@ -107,6 +108,7 @@ public:
} else {
ok = wxTheClipboard->SetData(new wxTextDataObject(msg.text));
}
wxTheClipboard->Flush();
wxTheClipboard->Close();
return ok;
}
@@ -513,8 +515,8 @@ ConsolePanel::ConsolePanel(Window* parent, int id)
// init sizer
wxSizer* s = new wxBoxSizer(wxVERTICAL);
s->Add(splitter, 1, wxEXPAND);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
// init menus
menuConsole = new wxMenu();
@@ -623,7 +625,7 @@ void ConsolePanel::exec(String const& command) {
// type of result
ScriptType type = result->type();
if (type == SCRIPT_IMAGE) {
GeneratedImage::Options options(0,0, set->stylesheet.get(), set.get());
GeneratedImage::Options options(0,0, card->stylesheet ? card->stylesheet.get() : set->stylesheet.get(), set.get());
wxImage image = result->toImage()->generate(options);
message->bitmap = wxBitmap(image);
} else if (type == SCRIPT_COLOR) {
@@ -633,8 +635,15 @@ void ConsolePanel::exec(String const& command) {
fill_image(image,color);
set_alpha(image, color.Alpha() / 255.0);
message->bitmap = wxBitmap(image);
} else {
message->text = result->toCode();
} else {
try {
boost::json::value jresult = mse_to_json(result, set.get(), true);
if (jresult.is_null()) message->text = result->toCode();
else message->text = json_pretty_print(jresult);
}
catch (...) {
message->text = result->toCode();
}
}
messages->add_message(message);
} catch (ScriptError const& e) {
+20 -17
View File
@@ -60,29 +60,32 @@ void KeywordsPanel::initControls() {
sp = new wxBoxSizer(wxVERTICAL);
sp->Add(fixed, 0, wxEXPAND); sp->Show(fixed,false);
wxSizer* s1 = new wxBoxSizer(wxVERTICAL);
s1->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("keyword")+_(":")), 0, wxTOP, 2);
s1->Add(keyword, 1, wxEXPAND | wxTOP, 2);
s1->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("mode")+_(":")), 0, wxTOP, 2);
s1->Add(mode, 0, wxEXPAND | wxTOP, 2);
s1->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("keyword")+_(":")), 0, wxTOP | wxLEFT, 4);
s1->Add(keyword, 0, wxEXPAND | wxTOP | wxLEFT, 4);
sp->Add(s1, 0, wxEXPAND | wxRIGHT, 4);
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8);
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 16);
wxSizer* s9 = new wxBoxSizer(wxVERTICAL);
s9->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("mode")+_(":")), 0, wxTOP | wxLEFT, 4);
s9->Add(mode, 0, wxEXPAND | wxTOP | wxLEFT, 4);
sp->Add(s9, 0, wxEXPAND | wxRIGHT, 4);
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 16);
wxSizer* s2 = new wxBoxSizer(wxVERTICAL);
s2->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("match")+_(":")), 0);
s2->Add(match, 1, wxEXPAND | wxTOP, 2);
s2->Add(add_param, 0, wxALIGN_LEFT | wxTOP, 2);
s2->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("match")+_(":")), 0, wxTOP | wxLEFT, 4);
s2->Add(match, 0, wxEXPAND | wxTOP | wxLEFT, 4);
s2->Add(add_param, 0, wxALIGN_LEFT | wxTOP | wxLEFT, 4);
sp->Add(s2, 0, wxEXPAND | wxRIGHT, 4);
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8);
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 16);
wxSizer* s3 = new wxBoxSizer(wxVERTICAL);
s3->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("reminder")+_(":")), 0);
s3->Add(reminder, 1, wxEXPAND | wxTOP, 2);
s3->Add(ref_param, 0, wxALIGN_LEFT | wxTOP, 2);
s3->Add(errors, 0, wxEXPAND | wxTOP, 4);
s3->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("reminder")+_(":")), 0, wxTOP | wxLEFT, 4);
s3->Add(reminder, 1, wxEXPAND | wxTOP | wxLEFT, 4);
s3->Add(ref_param, 0, wxALIGN_LEFT | wxTOP | wxLEFT, 4);
s3->Add(errors, 0, wxEXPAND | wxTOP | wxLEFT, 4);
//s3->Add(new wxStaticText(panel, wxID_ANY, _("Example:")), 0, wxTOP, 6);
sp->Add(s3, 1, wxEXPAND | wxRIGHT, 4);
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8);
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 16);
wxSizer* s4 = new wxBoxSizer(wxVERTICAL);
s4->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("rules")+_(":")), 0);
s4->Add(rules, 1, wxEXPAND | wxTOP, 2);
s4->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("rules")+_(":")), 0, wxTOP | wxLEFT, 4);
s4->Add(rules, 1, wxEXPAND | wxTOP | wxLEFT, 4);
sp->Add(s4, 1, wxEXPAND | wxRIGHT, 4);
panel->SetSizer(sp);
// init splitter
@@ -92,8 +95,8 @@ void KeywordsPanel::initControls() {
// init sizer
wxSizer* s = new wxBoxSizer(wxHORIZONTAL);
s->Add(splitter, 1, wxEXPAND);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
//s->Add(new wxStaticText(this, wxID_ANY, _("Sorry, no keywords for now"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTER), 1, wxALIGN_CENTER); // TODO: Remove
/* wxSizer* s2 = new wxBoxSizer(wxVERTICAL);
+2 -1
View File
@@ -24,8 +24,9 @@ class SetWindowPanel : public wxPanel, public SetView {
public:
SetWindowPanel(Window* parent, int id, bool autoTabbing = true);
/// We will probably want to respond to set changes
/// We will probably want to respond to set changes or package list changes
virtual void onSetChange() {}
virtual void onPackageListChange() {}
// // --------------------------------------------------- : Meta information
//
+2 -2
View File
@@ -301,8 +301,8 @@ CustomPackDialog::CustomPackDialog(Window* parent, const SetP& set, const PackTy
totals->setGame(set->game);
updateTotals();
// set sizer
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
}
void CustomPackDialog::updateTotals() {
@@ -417,8 +417,8 @@ void RandomPackPanel::initControls() {
s2->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s2->Add(card_list, 1, wxEXPAND);
s->Add(s2, 1, wxEXPAND, 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
}
RandomPackPanel::~RandomPackPanel() {
+1 -1
View File
@@ -22,8 +22,8 @@ SetInfoPanel::SetInfoPanel(Window* parent, int id)
// init sizer
wxSizer* s = new wxBoxSizer(wxVERTICAL);
s->Add(editor, 1, wxEXPAND, 2);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
}
void SetInfoPanel::onChangeSet() {
+1 -1
View File
@@ -330,8 +330,8 @@ void StatsPanel::initControls() {
s->Add(categories, 0, wxEXPAND | wxRIGHT, 2);
#endif
s->Add(splitter, 1, wxEXPAND);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
// init menu
menuGraph = new wxMenu();
+22 -11
View File
@@ -55,8 +55,8 @@ void StylePanel::initControls() {
s4->Add(editor, 2, wxEXPAND, 0);
s2->Add(s4, 1, wxEXPAND | wxALL, 2);
s->Add(s2, 1, wxEXPAND, 8);
s->SetSizeHints(this);
SetSizer(s);
s->SetSizeHints(this);
}
void StylePanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
@@ -95,13 +95,31 @@ bool StylePanel::Layout() {
void StylePanel::onChangeSet() {
if (!isInitialized()) return;
list->showData<StyleSheet>(set->game->name() + _("-*"));
list->showData<StyleSheet>(set->game->name() + _("*"));
list->select(set->stylesheet->name(), false);
editor->setSet(set);
preview->setSet(set);
card = CardP();
use_for_all->Enable(false);
}
}
void StylePanel::onPackageListChange() {
if (!isInitialized()) return;
if (!list) return;
list->showData<StyleSheet>(set->game->name() + _("*"));
onFilterChange();
}
void StylePanel::onFilterChange() {
if (list->hasSelection()) {
StyleSheetP existingStylesheetSelection = list->getSelection<StyleSheet>(false);
list->setFilter(stylesheet_filter->getFilter<PackageData>());
list->select(existingStylesheetSelection->name());
}
else {
list->setFilter(stylesheet_filter->getFilter<PackageData>());
}
}
void StylePanel::onAction(const Action& action, bool undone) {
if (!isInitialized()) return;
@@ -139,14 +157,7 @@ void StylePanel::onAction(const Action& action, bool undone) {
}
void StylePanel::onStylesheetFilterUpdate(wxCommandEvent&) {
if (list->hasSelection()) {
StyleSheetP existingStylesheetSelection = list->getSelection<StyleSheet>(false);
list->setFilter(stylesheet_filter->getFilter<PackageData>());
list->select(existingStylesheetSelection->name());
}
else {
list->setFilter(stylesheet_filter->getFilter<PackageData>());
}
onFilterChange();
}
// ----------------------------------------------------------------------------- : Selection
+5 -3
View File
@@ -22,14 +22,16 @@ class StylingEditor;
class StylePanel : public SetWindowPanel {
public:
StylePanel(Window* parent, int id);
void onChangeSet() override;
void onPackageListChange() override;
void onFilterChange();
void onAction(const Action&, bool undone) override;
// --------------------------------------------------- : UI
void initUI(wxToolBar*, wxMenuBar*) override;
// --------------------------------------------------- : Clipboard
bool canCut() const override;
bool canCopy() const override;
@@ -61,7 +63,7 @@ private:
void onUseCustom(wxCommandEvent&);
void onStylesheetFilterUpdate(wxCommandEvent&);
/// Determine the best size for the list of stylesheets based on available space
void updateListSize();
bool Layout() override;

Some files were not shown because too many files have changed in this diff Show More