Commit e7819c56 authored by twanvl's avatar twanvl

added guild mana support for all magic styles;

uses correct script context for cards using a stylesheet other then the default one.
parent 6eb576cf
...@@ -26,7 +26,13 @@ init script: ...@@ -26,7 +26,13 @@ init script:
land_template := { "acard.jpg" } land_template := { "acard.jpg" }
# Use the normal tap symbol # Use the normal tap symbol
mana_t := { "new" } mana_t := {
if styling.tap_symbol == "old" then "old"
else if styling.tap_symbol == "diagonal T" then "older"
else "new"
}
# Use guild mana symbols?
guild_mana := { styling.use_guild_mana_symbols }
# Does the card have a color that requires a white font for copyright/artist? # Does the card have a color that requires a white font for copyright/artist?
white_font_colors := filter_rule(match:"^(hybrid )?black|^land") white_font_colors := filter_rule(match:"^(hybrid )?black|^land")
...@@ -55,12 +61,30 @@ styling field: ...@@ -55,12 +61,30 @@ styling field:
name: popup mana symbols name: popup mana symbols
description: Use the symbols of the casting cost line inside the text box as well description: Use the symbols of the casting cost line inside the text box as well
initial: no initial: no
styling field:
type: choice
name: tap symbol
description: What tap symbol should be used on cards?
initial: modern
choice: modern
choice: old
choice: diagonal T
styling style: styling style:
use guild mana symbols:
choice images:
yes: /magic-mana-small.mse-symbol-font/mana_guild_rg.png
no: /magic-mana-small.mse-symbol-font/mana_rg.png
popup mana symbols: popup mana symbols:
choice images: choice images:
yes: /magic-mana-large.mse-symbol-font/mana_w.png yes: /magic-mana-large.mse-symbol-font/mana_w.png
no: /magic-mana-small.mse-symbol-font/mana_w.png no: /magic-mana-small.mse-symbol-font/mana_w.png
tap symbol:
render style: both
choice images:
modern: /magic-mana-large.mse-symbol-font/mana_t.png
old: /magic-mana-large.mse-symbol-font/mana_t_old.png
diagonal T: /magic-mana-large.mse-symbol-font/mana_t_older.png
############################################################## Card fields ############################################################## Card fields
card style: card style:
......
...@@ -27,7 +27,13 @@ init script: ...@@ -27,7 +27,13 @@ init script:
pt_template := { "/magic-new.mse-style/" + artifact_template() + "pt.jpg" } pt_template := { "/magic-new.mse-style/" + artifact_template() + "pt.jpg" }
# Use the normal tap symbol # Use the normal tap symbol
mana_t := { "mana_t.png" } mana_t := {
if styling.tap_symbol == "old" then "old"
else if styling.tap_symbol == "diagonal T" then "older"
else "new"
}
# Use guild mana symbols?
guild_mana := { styling.use_guild_mana_symbols }
# Does the card have a color that requires a white font for copyright/artist? # Does the card have a color that requires a white font for copyright/artist?
white_font_colors := filter_rule(match:"^(hybrid 2 color)?black|^land") white_font_colors := filter_rule(match:"^(hybrid 2 color)?black|^land")
...@@ -63,12 +69,30 @@ styling field: ...@@ -63,12 +69,30 @@ styling field:
name: popup mana symbols name: popup mana symbols
description: Use the symbols of the casting cost line inside the text box as well description: Use the symbols of the casting cost line inside the text box as well
initial: no initial: no
styling field:
type: choice
name: tap symbol
description: What tap symbol should be used on cards?
initial: modern
choice: modern
choice: old
choice: diagonal T
styling style: styling style:
use guild mana symbols:
choice images:
yes: /magic-mana-small.mse-symbol-font/mana_guild_rg.png
no: /magic-mana-small.mse-symbol-font/mana_rg.png
popup mana symbols: popup mana symbols:
choice images: choice images:
yes: /magic-mana-large.mse-symbol-font/mana_w.png yes: /magic-mana-large.mse-symbol-font/mana_w.png
no: /magic-mana-small.mse-symbol-font/mana_w.png no: /magic-mana-small.mse-symbol-font/mana_w.png
tap symbol:
render style: both
choice images:
modern: /magic-mana-large.mse-symbol-font/mana_t.png
old: /magic-mana-large.mse-symbol-font/mana_t_old.png
diagonal T: /magic-mana-large.mse-symbol-font/mana_t_older.png
############################################################## Card fields ############################################################## Card fields
card style: card style:
......
...@@ -19,7 +19,13 @@ init script: ...@@ -19,7 +19,13 @@ init script:
} }
# Use the normal tap symbol # Use the normal tap symbol
mana_t := { "mana_t.png" } mana_t := {
if styling.tap_symbol == "old" then "old"
else if styling.tap_symbol == "diagonal T" then "older"
else "new"
}
# Use guild mana symbols?
guild_mana := { styling.use_guild_mana_symbols }
# Does the card have a color that requires a white font for copyright/artist? # Does the card have a color that requires a white font for copyright/artist?
white_font_colors := filter_rule(match:"^(hybrid 2 color)?black|^land") white_font_colors := filter_rule(match:"^(hybrid 2 color)?black|^land")
...@@ -31,81 +37,50 @@ init script: ...@@ -31,81 +37,50 @@ init script:
} }
############################################################## Set info fields ############################################################## Extra style options
info style:
title:
padding left: 2
font:
size: 16
symbol:
variation:
name: common
border radius: 0.10
fill type: solid
fill color: rgb(0,0,0)
border color: rgb(255,255,255)
variation:
name: uncommon
border radius: 0.05
fill type: linear gradient
fill color 1: rgb(224,224,224)
fill color 2: rgb(84, 84, 84)
border color 1: rgb(0, 0, 0)
border color 2: rgb(0, 0, 0)
variation:
name: rare
border radius: 0.05
fill type: linear gradient
fill color 1: rgb(214,196,94)
fill color 2: rgb(95, 84, 40)
border color 1: rgb(0, 0, 0)
border color 2: rgb(0, 0, 0)
variation:
name: special
border radius: 0.10
fill type: linear gradient
fill color 1: rgb(224,170,247)
fill color 2: rgb(58,7,80)
border color 1: rgb(255,255,255)
border color 2: rgb(255,255,255)
automatic reminder text:
render style: both
choice images:
yes: script: buildin_image("bool_yes")
no: script: buildin_image("bool_no")
use gradient multicolor:
render style: both
choice images:
yes: script: buildin_image("bool_yes")
no: script: buildin_image("bool_no")
styling field:
############################################################## Extra style
extra field:
type: boolean type: boolean
name: colored mana symbols name: colored mana symbols
description: Use colored mana symbols, as used by Wizards since Fifth Dawn. description: Use colored mana symbols, as used by Wizards since Fifth Dawn.
extra field: styling field:
type: boolean type: boolean
name: darker artifacts name: darker artifacts
description: Use darker artifacts, as used by Wizards since Fifth Dawn. description: Use darker artifacts, as used by Wizards since Fifth Dawn.
extra field: styling field:
type: boolean type: boolean
name: use guild mana symbols name: use guild mana symbols
description: Use the Ravnica guild symbols instead of the official half/half circles for hybrid mana. description: Use the Ravnica guild symbols instead of the official half/half circles for hybrid mana.
initial: no initial: no
extra field: styling field:
type: boolean type: boolean
name: popup mana symbols name: popup mana symbols
description: Use the symbols of the casting cost line inside the text box as well description: Use the symbols of the casting cost line inside the text box as well
initial: no initial: no
styling field:
extra style: type: choice
name: tap symbol
description: What tap symbol should be used on cards?
initial: modern
choice: modern
choice: old
choice: diagonal T
styling style:
use guild mana symbols:
choice images:
yes: /magic-mana-small.mse-symbol-font/mana_guild_rg.png
no: /magic-mana-small.mse-symbol-font/mana_rg.png
popup mana symbols: popup mana symbols:
choice images: choice images:
yes: /magic-mana-large.mse-symbol-font/mana_w.png yes: /magic-mana-large.mse-symbol-font/mana_w.png
no: /magic-mana-small.mse-symbol-font/mana_w.png no: /magic-mana-small.mse-symbol-font/mana_w.png
tap symbol:
render style: both
choice images:
modern: /magic-mana-large.mse-symbol-font/mana_t.png
old: /magic-mana-large.mse-symbol-font/mana_t_old.png
diagonal T: /magic-mana-large.mse-symbol-font/mana_t_older.png
############################################################## Card fields ############################################################## Card fields
card style: card style:
......
...@@ -34,6 +34,8 @@ init script: ...@@ -34,6 +34,8 @@ init script:
else if styling.tap_symbol == "diagonal T" then "older" else if styling.tap_symbol == "diagonal T" then "older"
else "new" else "new"
} }
# Use guild mana symbols?
guild_mana := { styling.use_guild_mana_symbols }
# Does the card have a color that requires a white font for copyright/artist? # Does the card have a color that requires a white font for copyright/artist?
white_font_colors := filter_rule(match:"^(hybrid 2 color )?(hybrid 3 color [^/]*/[^/]*/ )?(hybrid vertical [^/]*/ )?(black|land|hybrid 4 color w/u/b/r)") white_font_colors := filter_rule(match:"^(hybrid 2 color )?(hybrid 3 color [^/]*/[^/]*/ )?(hybrid vertical [^/]*/ )?(black|land|hybrid 4 color w/u/b/r)")
...@@ -90,6 +92,10 @@ styling style: ...@@ -90,6 +92,10 @@ styling style:
light: oacard.jpg light: oacard.jpg
dark: acard.jpg dark: acard.jpg
brown: bacard.jpg brown: bacard.jpg
use guild mana symbols:
choice images:
yes: /magic-mana-small.mse-symbol-font/mana_guild_rg.png
no: /magic-mana-small.mse-symbol-font/mana_rg.png
popup mana symbols: popup mana symbols:
choice images: choice images:
yes: /magic-mana-large.mse-symbol-font/mana_w.png yes: /magic-mana-large.mse-symbol-font/mana_w.png
......
...@@ -23,8 +23,14 @@ init script: ...@@ -23,8 +23,14 @@ init script:
# Horizontal 5 color blends are not supported # Horizontal 5 color blends are not supported
card_hybrid_5b := card_hybrid_5 card_hybrid_5b := card_hybrid_5
# Use the old tap symbol # Use the normal tap symbol
mana_t := { "old" } mana_t := {
if styling.tap_symbol == "old" then "old"
else if styling.tap_symbol == "diagonal T" then "older"
else "new"
}
# Use guild mana symbols?
guild_mana := { styling.use_guild_mana_symbols }
# Does the card have a color that requires a black font for copyright/artist? # Does the card have a color that requires a black font for copyright/artist?
black_font_colors := filter_rule(match:"^(hybrid 2 color)?white") black_font_colors := filter_rule(match:"^(hybrid 2 color)?white")
...@@ -35,56 +41,42 @@ init script: ...@@ -35,56 +41,42 @@ init script:
rgb(255,255,255) rgb(255,255,255)
} }
############################################################## Set info fields ############################################################## Extra style options
info style:
title: styling field:
padding left: 2 type: boolean
font: name: use guild mana symbols
size: 16 description: Use the Ravnica guild symbols instead of the official half/half circles for hybrid mana.
symbol: initial: no
variation: styling field:
name: common type: boolean
border radius: 0.10 name: popup mana symbols
fill type: solid description: Use the symbols of the casting cost line inside the text box as well
fill color: rgb(0,0,0) initial: no
border color: rgb(255,255,255) styling field:
variation: type: choice
name: uncommon name: tap symbol
border radius: 0.05 description: What tap symbol should be used on cards?
fill type: linear gradient initial: old
fill color 1: rgb(224,224,224) choice: modern
fill color 2: rgb(84, 84, 84) choice: old
border color 1: rgb(0, 0, 0) choice: diagonal T
border color 2: rgb(0, 0, 0)
variation: styling style:
name: rare use guild mana symbols:
border radius: 0.05
fill type: linear gradient
fill color 1: rgb(214,196,94)
fill color 2: rgb(95, 84, 40)
border color 1: rgb(0, 0, 0)
border color 2: rgb(0, 0, 0)
variation:
name: special
border radius: 0.10
fill type: linear gradient
fill color 1: rgb(224,170,247)
fill color 2: rgb(58,7,80)
border color 1: rgb(255,255,255)
border color 2: rgb(255,255,255)
automatic reminder text:
render style: both
choice images: choice images:
yes: script: buildin_image("bool_yes") yes: /magic-mana-small.mse-symbol-font/mana_guild_rg.png
no: script: buildin_image("bool_no") no: /magic-mana-small.mse-symbol-font/mana_rg.png
use gradient multicolor: popup mana symbols:
choice images:
yes: /magic-mana-large.mse-symbol-font/mana_w.png
no: /magic-mana-small.mse-symbol-font/mana_w.png
tap symbol:
render style: both render style: both
choice images: choice images:
yes: script: buildin_image("bool_yes") modern: /magic-mana-large.mse-symbol-font/mana_t.png
no: script: buildin_image("bool_no") old: /magic-mana-large.mse-symbol-font/mana_t_old.png
diagonal T: /magic-mana-large.mse-symbol-font/mana_t_older.png
############################################################## Extra style
############################################################## Card fields ############################################################## Card fields
card style: card style:
...@@ -181,7 +173,11 @@ card style: ...@@ -181,7 +173,11 @@ card style:
scale down to: 6 scale down to: 6
color: rgb(0,0,0) color: rgb(0,0,0)
symbol font: symbol font:
name: magic-mana-small name:
script:
if styling.popup_mana_symbols
then "magic-mana-large"
else "magic-mana-small"
size: 13 size: 13
align: middle center align: middle center
z index: 2 z index: 2
......
...@@ -23,8 +23,14 @@ init script: ...@@ -23,8 +23,14 @@ init script:
# Horizontal 5 color blends are not supported # Horizontal 5 color blends are not supported
card_hybrid_5b := card_hybrid_5 card_hybrid_5b := card_hybrid_5
# Use the old tap symbol # Use the normal tap symbol
mana_t := { "old" } mana_t := {
if styling.tap_symbol == "old" then "old"
else if styling.tap_symbol == "diagonal T" then "older"
else "new"
}
# Use guild mana symbols?
guild_mana := { styling.use_guild_mana_symbols }
# Does the card have a color that requires a black font for copyright/artist? # Does the card have a color that requires a black font for copyright/artist?
black_font_colors := filter_rule(match:"^(hybrid 2 color)?white") black_font_colors := filter_rule(match:"^(hybrid 2 color)?white")
...@@ -35,57 +41,43 @@ init script: ...@@ -35,57 +41,43 @@ init script:
rgb(255,255,255) rgb(255,255,255)
} }
############################################################## Set info fields
info style:
title:
padding left: 2
font:
size: 16
symbol:
variation:
name: common
border radius: 0.10
fill type: solid
fill color: rgb(0,0,0)
border color: rgb(255,255,255)
variation:
name: uncommon
border radius: 0.05
fill type: linear gradient
fill color 1: rgb(224,224,224)
fill color 2: rgb(84, 84, 84)
border color 1: rgb(0, 0, 0)
border color 2: rgb(0, 0, 0)
variation:
name: rare
border radius: 0.05
fill type: linear gradient
fill color 1: rgb(214,196,94)
fill color 2: rgb(95, 84, 40)
border color 1: rgb(0, 0, 0)
border color 2: rgb(0, 0, 0)
variation:
name: special
border radius: 0.10
fill type: linear gradient
fill color 1: rgb(224,170,247)
fill color 2: rgb(58,7,80)
border color 1: rgb(255,255,255)
border color 2: rgb(255,255,255)
automatic reminder text:
render style: both
choice images:
yes: script: buildin_image("bool_yes")
no: script: buildin_image("bool_no")
use gradient multicolor:
render style: both
choice images:
yes: script: buildin_image("bool_yes")
no: script: buildin_image("bool_no")
############################################################## Extra style options
styling field:
type: boolean
name: use guild mana symbols
description: Use the Ravnica guild symbols instead of the official half/half circles for hybrid mana.
initial: no
styling field:
type: boolean
name: popup mana symbols
description: Use the symbols of the casting cost line inside the text box as well
initial: no
styling field:
type: choice
name: tap symbol
description: What tap symbol should be used on cards?
initial: old
choice: modern
choice: old
choice: diagonal T
############################################################## Extra style styling style:
use guild mana symbols:
choice images:
yes: /magic-mana-small.mse-symbol-font/mana_guild_rg.png
no: /magic-mana-small.mse-symbol-font/mana_rg.png
popup mana symbols:
choice images:
yes: /magic-mana-large.mse-symbol-font/mana_w.png
no: /magic-mana-small.mse-symbol-font/mana_w.png
tap symbol:
render style: both
choice images:
modern: /magic-mana-large.mse-symbol-font/mana_t.png
old: /magic-mana-large.mse-symbol-font/mana_t_old.png
diagonal T: /magic-mana-large.mse-symbol-font/mana_t_older.png
############################################################## Card fields ############################################################## Card fields
card style: card style:
...@@ -203,7 +195,11 @@ card style: ...@@ -203,7 +195,11 @@ card style:
scale down to: 6 scale down to: 6
color: rgb(0,0,0) color: rgb(0,0,0)
symbol font: symbol font:
name: magic-mana-small name:
script:
if styling.popup_mana_symbols
then "magic-mana-large"
else "magic-mana-small"
size: 13 size: 13
align: middle left align: middle left
z index: 2 z index: 2
......
...@@ -25,7 +25,13 @@ init script: ...@@ -25,7 +25,13 @@ init script:
pt_template := { input + "pt.jpg" } pt_template := { input + "pt.jpg" }
# Use the normal tap symbol # Use the normal tap symbol
mana_t := { "new" } mana_t := {
if styling.tap_symbol == "old" then "old"
else if styling.tap_symbol == "diagonal T" then "older"
else "new"
}
# Use guild mana symbols?
guild_mana := { styling.use_guild_mana_symbols }
# Does the card have a color that requires a white font for copyright/artist? # Does the card have a color that requires a white font for copyright/artist?
white_font_colors := filter_rule(match:"^(hybrid 2 color)?black|^land") white_font_colors := filter_rule(match:"^(hybrid 2 color)?black|^land")
...@@ -36,86 +42,28 @@ init script: ...@@ -36,86 +42,28 @@ init script:
rgb(0,0,0) rgb(0,0,0)
} }
############################################################## Set info fields ############################################################## Extra style options
info style:
title:
padding left: 2
font:
size: 16
symbol:
variation:
name: common
border radius: 0.10
fill type: solid
fill color: rgb(0,0,0)
border color: rgb(255,255,255)
variation:
name: uncommon
border radius: 0.05
fill type: linear gradient
fill color 1: rgb(224,224,224)
fill color 2: rgb(84, 84, 84)
border color 1: rgb(0, 0, 0)
border color 2: rgb(0, 0, 0)
variation:
name: rare
border radius: 0.05
fill type: linear gradient
fill color 1: rgb(214,196,94)
fill color 2: rgb(95, 84, 40)
border color 1: rgb(0, 0, 0)
border color 2: rgb(0, 0, 0)
variation:
name: special
border radius: 0.10
fill type: linear gradient
fill color 1: rgb(224,170,247)
fill color 2: rgb(58,7,80)
border color 1: rgb(255,255,255)
border color 2: rgb(255,255,255)
automatic reminder text:
render style: both
choice images:
yes: script: buildin_image("bool_yes")
no: script: buildin_image("bool_no")
use gradient multicolor:
render style: both
choice images:
yes: script: buildin_image("bool_yes")
no: script: buildin_image("bool_no")
############################################################## Extra style styling field:
extra field:
type: boolean
name: colored mana symbols
description: Use colored mana symbols, as used by Wizards since Fifth Dawn.
extra field:
type: boolean type: boolean
name: darker artifacts name: darker artifacts
description: Use darker artifacts, as used by Wizards since Fifth Dawn. description: Use darker artifacts, as used by Wizards since Fifth Dawn.
extra field: styling field:
type: boolean type: boolean
name: grey hybrid name name: grey hybrid name
description: Use a grey background for the name and type line on hybrid cards. This is done on real cards. description: Use a grey background for the name and type line on hybrid cards. This is done on real cards.
initial: no initial: no
extra field: styling field:
type: boolean type: boolean
name: use guild mana symbols name: use guild mana symbols
description: Use the Ravnica guild symbols instead of the official half/half circles for hybrid mana. description: Use the Ravnica guild symbols instead of the official half/half circles for hybrid mana.
initial: no initial: no
extra field:
type: boolean
name: popup mana symbols
description: Use the symbols of the casting cost line inside the text box as well
initial: no
extra style: styling style:
popup mana symbols: use guild mana symbols:
choice images: choice images:
yes: /magic-mana-large.mse-symbol-font/mana_w.png yes: /magic-mana-small.mse-symbol-font/mana_guild_rg.png
no: /magic-mana-small.mse-symbol-font/mana_w.png no: /magic-mana-small.mse-symbol-font/mana_rg.png
############################################################## Card fields ############################################################## Card fields
card style: card style:
......
This diff is collapsed.
...@@ -9,8 +9,14 @@ icon: card-sample.png ...@@ -9,8 +9,14 @@ icon: card-sample.png
############################################################## Extra scripts ############################################################## Extra scripts
init script: init script:
# Use the old tap symbol # Use the normal tap symbol
mana_t := { "old" } mana_t := {
if styling.tap_symbol == "old" then "old"
else if styling.tap_symbol == "diagonal T" then "older"
else "new"
}
# Use guild mana symbols?
guild_mana := { styling.use_guild_mana_symbols }
############################################################## Set info fields ############################################################## Set info fields
info style: info style:
...@@ -19,13 +25,42 @@ info style: ...@@ -19,13 +25,42 @@ info style:
font: font:
size: 16 size: 16
############################################################## Extra style ############################################################## Extra style options
extra field: styling field:
type: boolean
name: use guild mana symbols
description: Use the Ravnica guild symbols instead of the official half/half circles for hybrid mana.
initial: no
styling field:
type: boolean type: boolean
name: popup mana symbols name: popup mana symbols
description: Use the symbols of the casting cost line inside the text box as well description: Use the symbols of the casting cost line inside the text box as well
initial: no initial: no
styling field:
type: choice
name: tap symbol
description: What tap symbol should be used on cards?
initial: old
choice: modern
choice: old
choice: diagonal T
styling style:
use guild mana symbols:
choice images:
yes: /magic-mana-small.mse-symbol-font/mana_guild_rg.png
no: /magic-mana-small.mse-symbol-font/mana_rg.png
popup mana symbols:
choice images:
yes: /magic-mana-large.mse-symbol-font/mana_w.png
no: /magic-mana-small.mse-symbol-font/mana_w.png
tap symbol:
render style: both
choice images:
modern: /magic-mana-large.mse-symbol-font/mana_t.png
old: /magic-mana-large.mse-symbol-font/mana_t_old.png
diagonal T: /magic-mana-large.mse-symbol-font/mana_t_older.png
############################################################## Card fields ############################################################## Card fields
card style: card style:
......
...@@ -94,6 +94,9 @@ init script: ...@@ -94,6 +94,9 @@ init script:
############################################################## Set fields ############################################################## Set fields
set field:
type: info
name: Set Information
set field: set field:
type: text type: text
name: title name: title
...@@ -107,6 +110,9 @@ set field: ...@@ -107,6 +110,9 @@ set field:
set field: set field:
type: text type: text
name: copyright name: copyright
set field:
type: info
name: Defaults and Automation
set field: set field:
type: color type: color
name: border color name: border color
...@@ -129,6 +135,14 @@ set field: ...@@ -129,6 +135,14 @@ set field:
initial: no initial: no
description: Should card numbers be shown on the cards? description: Should card numbers be shown on the cards?
############################# Default style
default set style:
title:
padding left: 2
font:
size: 16
############################################################## Card fields ############################################################## Card fields
############################# Background stuff ############################# Background stuff
......
...@@ -97,5 +97,10 @@ class KeywordReminderTextValue : public KeywordTextValue { ...@@ -97,5 +97,10 @@ class KeywordReminderTextValue : public KeywordTextValue {
void highlight(const String& code, const vector<ScriptParseError>& errors); void highlight(const String& code, const vector<ScriptParseError>& errors);
}; };
/// Changing the mode of a keyword
class ChangeKeywordModeAction : public Action {
};
// ----------------------------------------------------------------------------- : EOF // ----------------------------------------------------------------------------- : EOF
#endif #endif
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/artprov.h> #include <wx/artprov.h>
DECLARE_TYPEOF_COLLECTION(KeywordParamP);
DECLARE_TYPEOF_COLLECTION(KeywordModeP);
// ----------------------------------------------------------------------------- : KeywordsPanel // ----------------------------------------------------------------------------- : KeywordsPanel
KeywordsPanel::KeywordsPanel(Window* parent, int id) KeywordsPanel::KeywordsPanel(Window* parent, int id)
...@@ -36,6 +39,8 @@ KeywordsPanel::KeywordsPanel(Window* parent, int id) ...@@ -36,6 +39,8 @@ KeywordsPanel::KeywordsPanel(Window* parent, int id)
reminder = new TextCtrl(panel, wxID_ANY, true); // allow multiline for wordwrap reminder = new TextCtrl(panel, wxID_ANY, true); // allow multiline for wordwrap
rules = new TextCtrl(panel, wxID_ANY, true); rules = new TextCtrl(panel, wxID_ANY, true);
errors = new wxStaticText(panel, wxID_ANY, _("")); errors = new wxStaticText(panel, wxID_ANY, _(""));
mode = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr);
add_param = new wxButton(panel, ID_KEYWORD_ADD_PARAM, _("Insert Parameter"));
// warning about fixed keywords // warning about fixed keywords
fixedL = new wxStaticText(panel, wxID_ANY, _("")); fixedL = new wxStaticText(panel, wxID_ANY, _(""));
wxStaticBitmap* fixedI = new wxStaticBitmap(panel, wxID_ANY, wxArtProvider::GetBitmap(wxART_WARNING)); wxStaticBitmap* fixedI = new wxStaticBitmap(panel, wxID_ANY, wxArtProvider::GetBitmap(wxART_WARNING));
...@@ -52,12 +57,15 @@ KeywordsPanel::KeywordsPanel(Window* parent, int id) ...@@ -52,12 +57,15 @@ KeywordsPanel::KeywordsPanel(Window* parent, int id)
wxSizer* s1 = new wxBoxSizer(wxVERTICAL); wxSizer* s1 = new wxBoxSizer(wxVERTICAL);
s1->Add(new wxStaticText(panel, wxID_ANY, _("Keyword:")), 0); s1->Add(new wxStaticText(panel, wxID_ANY, _("Keyword:")), 0);
s1->Add(keyword, 0, wxEXPAND | wxTOP, 2); s1->Add(keyword, 0, wxEXPAND | wxTOP, 2);
s1->Add(new wxStaticText(panel, wxID_ANY, _("Mode:")), 0, wxTOP, 2);
s1->Add(mode, 0, wxEXPAND | wxTOP, 2);
sp->Add(s1, 0, wxEXPAND | wxLEFT, 2); sp->Add(s1, 0, wxEXPAND | wxLEFT, 2);
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8); sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8);
wxSizer* s2 = new wxBoxSizer(wxVERTICAL); wxSizer* s2 = new wxBoxSizer(wxVERTICAL);
s2->Add(new wxStaticText(panel, wxID_ANY, _("Match:")), 0); s2->Add(new wxStaticText(panel, wxID_ANY, _("Match:")), 0);
s2->Add(match, 0, wxEXPAND | wxTOP, 2); s2->Add(match, 0, wxEXPAND | wxTOP, 2);
s2->Add(new wxStaticText(panel, wxID_ANY, _("Parameters:")), 0, wxTOP, 6); s2->Add(new wxStaticText(panel, wxID_ANY, _("Parameters:")), 0, wxTOP, 6);
s2->Add(add_param, 0, wxALIGN_LEFT | wxTOP, 2);
sp->Add(s2, 0, wxEXPAND | wxLEFT, 2); sp->Add(s2, 0, wxEXPAND | wxLEFT, 2);
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8); sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8);
wxSizer* s3 = new wxBoxSizer(wxVERTICAL); wxSizer* s3 = new wxBoxSizer(wxVERTICAL);
...@@ -127,6 +135,8 @@ void KeywordsPanel::onUpdateUI(wxUpdateUIEvent& ev) { ...@@ -127,6 +135,8 @@ void KeywordsPanel::onUpdateUI(wxUpdateUIEvent& ev) {
case ID_KEYWORD_PREV: ev.Enable(list->canSelectPrevious()); break; case ID_KEYWORD_PREV: ev.Enable(list->canSelectPrevious()); break;
case ID_KEYWORD_NEXT: ev.Enable(list->canSelectNext()); break; case ID_KEYWORD_NEXT: ev.Enable(list->canSelectNext()); break;
case ID_KEYWORD_REMOVE: ev.Enable(list->getKeyword() && !list->getKeyword()->fixed); break; case ID_KEYWORD_REMOVE: ev.Enable(list->getKeyword() && !list->getKeyword()->fixed); break;
case ID_KEYWORD_ADD_PARAM:
break;
} }
} }
...@@ -147,6 +157,14 @@ void KeywordsPanel::onCommand(int id) { ...@@ -147,6 +157,14 @@ void KeywordsPanel::onCommand(int id) {
set->actions.add(new RemoveKeywordAction(*set, list->getKeyword())); set->actions.add(new RemoveKeywordAction(*set, list->getKeyword()));
} }
break; break;
case ID_KEYWORD_ADD_PARAM: {
wxMenu param_menu;
FOR_EACH(p, set->game->keyword_parameter_types) {
param_menu.Append(wxID_ANY, p->name);
}
add_param->PopupMenu(&param_menu, 0, add_param->GetSize().y);
break;
}
} }
} }
...@@ -174,6 +192,12 @@ void KeywordsPanel::onChangeSet() { ...@@ -174,6 +192,12 @@ void KeywordsPanel::onChangeSet() {
match ->getStyle().font.font.SetPointSize(10); match ->getStyle().font.font.SetPointSize(10);
reminder->updateSize(); reminder->updateSize();
rules ->setSet(set); rules ->setSet(set);
// parameter & mode lists
add_param->Enable(false);
mode->Clear();
FOR_EACH(m, set->game->keyword_modes) {
mode->Append(m->name);
}
// re-layout // re-layout
panel->Layout(); panel->Layout();
} }
...@@ -198,12 +222,16 @@ void KeywordsPanel::onKeywordSelect(KeywordSelectEvent& ev) { ...@@ -198,12 +222,16 @@ void KeywordsPanel::onKeywordSelect(KeywordSelectEvent& ev) {
shared_ptr<KeywordReminderTextValue> reminder_value(new KeywordReminderTextValue(reminder->getFieldP(), &kw, !kw.fixed)); shared_ptr<KeywordReminderTextValue> reminder_value(new KeywordReminderTextValue(reminder->getFieldP(), &kw, !kw.fixed));
reminder->setValue(reminder_value); reminder->setValue(reminder_value);
errors->SetLabel(reminder_value->errors); errors->SetLabel(reminder_value->errors);
add_param->Enable(!kw.fixed && !set->game->keyword_parameter_types.empty());
mode->SetStringSelection(kw.mode);
sp->Layout(); sp->Layout();
} else { } else {
keyword ->setValue(nullptr); keyword ->setValue(nullptr);
match ->setValue(nullptr); match ->setValue(nullptr);
rules ->setValue(nullptr); rules ->setValue(nullptr);
reminder->setValue(nullptr); reminder->setValue(nullptr);
add_param->Enable(false);
mode ->Enable(false);
} }
} }
......
...@@ -52,6 +52,8 @@ class KeywordsPanel : public SetWindowPanel { ...@@ -52,6 +52,8 @@ class KeywordsPanel : public SetWindowPanel {
wxStaticText* fixedL; wxStaticText* fixedL;
wxSizer* fixed; wxSizer* fixed;
wxStaticText* errors; wxStaticText* errors;
wxChoice* mode;
wxButton* add_param;
/// Controls to edit a parameter /// Controls to edit a parameter
struct ParamEditor { struct ParamEditor {
wxStaticText* label; wxStaticText* label;
......
...@@ -57,7 +57,7 @@ bool DataViewer::drawEditing() const { return false; } ...@@ -57,7 +57,7 @@ bool DataViewer::drawEditing() const { return false; }
bool DataViewer::drawFocus() const { return false; } bool DataViewer::drawFocus() const { return false; }
wxPen DataViewer::borderPen(bool) const { return wxPen(); } wxPen DataViewer::borderPen(bool) const { return wxPen(); }
ValueViewer* DataViewer::focusedViewer() const { return nullptr; } ValueViewer* DataViewer::focusedViewer() const { return nullptr; }
Context& DataViewer::getContext() const { return set->getContext(); } Context& DataViewer::getContext() const { return set->getContext(card); }
Rotation DataViewer::getRotation() const { Rotation DataViewer::getRotation() const {
if (!stylesheet) stylesheet = set->stylesheet; if (!stylesheet) stylesheet = set->stylesheet;
...@@ -68,7 +68,7 @@ Rotation DataViewer::getRotation() const { ...@@ -68,7 +68,7 @@ Rotation DataViewer::getRotation() const {
// ----------------------------------------------------------------------------- : Setting data // ----------------------------------------------------------------------------- : Setting data
void DataViewer::setCard(const CardP& card) { void DataViewer::setCard(const CardP& card) {
if (!card) return; // TODO: clear editor? if (!card) return; // TODO: clear vie?
assert(set); assert(set);
this->card = card; this->card = card;
stylesheet = set->stylesheetFor(card); stylesheet = set->stylesheetFor(card);
......
...@@ -108,6 +108,8 @@ enum ChildMenuID { ...@@ -108,6 +108,8 @@ enum ChildMenuID {
, ID_KEYWORD_REMOVE , ID_KEYWORD_REMOVE
, ID_KEYWORD_PREV , ID_KEYWORD_PREV
, ID_KEYWORD_NEXT , ID_KEYWORD_NEXT
, ID_KEYWORD_ADD_PARAM
, ID_KEYWORD_REF_PARAM
// Format menu // Format menu
, ID_FORMAT_BOLD = 1201 , ID_FORMAT_BOLD = 1201
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment