Attemp at scaling the spacing between lines to better fill the text box;

Did some profiling, conclusions:
 - we want to buffer our input streams, apperantly wx doesn't do this automatically
 - compiling regexes is SLOW.
   This is not just in the numbers, but it is actually noticable! The textbox used to be quite unresponsive.
   I wrapped the call to filter_text in the game file with a quick contains() call, so usually, the regex doesn't fire.
   It would be nicer if this was somehow automatic, but that will not be easy.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@627 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-08-25 00:02:33 +00:00
parent ca55a4d5da
commit 694566fef4
6 changed files with 102 additions and 31 deletions
+2
View File
@@ -262,6 +262,8 @@ card style:
line height hard: 1.2
line height line: 1.5
line height soft: 0.9
line height hard max: 1.3
line height line max: 1.6
watermark:
left: 117
+9 -5
View File
@@ -103,13 +103,15 @@ init script:
# Look for a CDA that defines colors
text_to_color := {
text := filter_text(match: card_name+"(</[-a-z]+>)? is (colorless|all colors|((blue|white|green|red|black)((,|,? and) (blue|white|green|red|black))*))\\.")
if text == "" then ""
else if contains(text, match: "all colors") then (
# Note: running filter_text is quite slow, do a quick 'contains' check first
if contains(match: card_name) then (
text := filter_text(match: card_name+"(</[-a-z]+>)? is (colorless|all colors|((blue|white|green|red|black)((,|,? and) (blue|white|green|red|black))*))\\.")
if text != "" then (
if contains(text, match: "all colors") then (
colors := "WUBRG"
if land = "land" then land_multicolor()
else mana_to_color(hybrid: "")
) else (
) else (
colors := ""
if contains(text, match: "white") then colors := colors + "W"
if contains(text, match: "blue") then colors := colors + "U"
@@ -118,6 +120,8 @@ init script:
if contains(text, match: "green") then colors := colors + "G"
if land = "land" then land_multicolor()
else mana_to_color(hybrid: "")
)
)
)
}
@@ -129,7 +133,7 @@ init script:
is_spell := match_rule(match: "(?i)Instant|Sorcery")
card_color := {
# usually the color of mana
text_color := text_to_color(rules_text, land: is_land(type), card_name: card_name);
text_color := text_to_color(rules_text, land: is_land(type));
if text_color == "" then (
mana_color := mana_to_color(colors: color_filter(casting_cost), hybrid: color_filterH(casting_cost))
if mana_color == "colorless" and is_land (type) then land_to_color(watermark)