From 9f2b30b2dba5bf510380d204224b664d6fc8d708 Mon Sep 17 00:00:00 2001 From: twanvl Date: Thu, 23 Aug 2007 16:33:12 +0000 Subject: [PATCH] Added word lists for choosing things like card type; Added 'in_place' pattern to spec_sort git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@616 0fc631ac-6414-0410-93d0-97cfa31319b6 --- doc/function/sort_text.txt | 3 + doc/type/game.txt | 1 + doc/type/tagged_string.txt | 2 + doc/type/word_list.txt | 18 +++ doc/type/word_list_word.txt | 18 +++ src/data/game.cpp | 3 +- src/data/game.hpp | 2 + src/data/word_list.cpp | 34 +++++ src/data/word_list.hpp | 43 ++++++ src/gui/control/card_editor.cpp | 2 +- src/gui/drop_down_list.cpp | 47 ++++--- src/gui/drop_down_list.hpp | 8 +- src/gui/value/choice.cpp | 3 +- src/gui/value/choice.hpp | 2 +- src/gui/value/color.cpp | 5 +- src/gui/value/editor.hpp | 2 +- src/gui/value/multiple_choice.cpp | 18 ++- src/gui/value/text.cpp | 220 +++++++++++++++++++++++++++++- src/gui/value/text.hpp | 22 ++- src/mse.vcproj | 6 + src/render/text/element.hpp | 10 +- src/script/functions/editor.cpp | 25 ++-- src/util/spec_sort.cpp | 27 +++- 23 files changed, 461 insertions(+), 60 deletions(-) create mode 100644 doc/type/word_list.txt create mode 100644 doc/type/word_list_word.txt create mode 100644 src/data/word_list.cpp create mode 100644 src/data/word_list.hpp diff --git a/doc/function/sort_text.txt b/doc/function/sort_text.txt index 4fb132df..a6174c38 100644 --- a/doc/function/sort_text.txt +++ b/doc/function/sort_text.txt @@ -35,6 +35,9 @@ Parts | @"pattern(.z. xyz)"@ @"yzz"@ Selects all things that match the pattern, where @"."@ is a wildcard. The things matching the wildcards are then sorted using the given pattern (separated by a space), and subsituted back in. So in "zzyyxxy" the pattern matches "zzyxxy" with wildcards "zy" these sort as "yz" and in the pattern this becomes "yzz". +| @"in_place(yz)"@ @"yyyzxxz"@ Sort everything with the given pattern, and insert the remaining characters in their orignal places.
+ For example, in @"zzyyxxy"@ we match y and z, leaving @"....xx."@. + The result of the pattern is @"yyyzz"@, subsituting that back in gives @"yyyzxxz"@. The parts are read from left to right, each part that matches something removes it from the input, so for example > sort_text(order: "xx") diff --git a/doc/type/game.txt b/doc/type/game.txt index 8baa6799..729b3d85 100644 --- a/doc/type/game.txt +++ b/doc/type/game.txt @@ -40,6 +40,7 @@ Such a package contains a [[file:format|data file]] called game that ha | @keyword modes@ [[type:list]] of [[type:keyword mode]]s Choices for the 'mode' property of keywords. | @keyword parameter types@ [[type:list]] of [[type:keyword param type]]s Types of parameters available to keywords. | @keywords@ [[type:list]] of [[type:keyword]]s Standard keywords for this game. +| @word lists@ [[type:list]] of [[type:word list]]s Word lists that can be used by text fields. --Examples-- Look at the game files in the standard MSE distribution for examples. diff --git a/doc/type/tagged_string.txt b/doc/type/tagged_string.txt index a82565c8..e1ae225b 100644 --- a/doc/type/tagged_string.txt +++ b/doc/type/tagged_string.txt @@ -37,6 +37,8 @@ This is written as the character with code 1 in files. Inserting this tag manually will confuse that function!
This tag can never be selected, and its contents can not be edited. | @""@ Like @""@, only hidden. This is inserted by [[fun:combined_editor]] +| @""@ Indicate that the text inside the tag should be selected from a [[type:word list]]. + The ? must be the name of a word list in the game. | any other tag Other tags are ignored. --Related functions-- diff --git a/doc/type/word_list.txt b/doc/type/word_list.txt new file mode 100644 index 00000000..861b78b2 --- /dev/null +++ b/doc/type/word_list.txt @@ -0,0 +1,18 @@ +Data type: word list + +A list of words. Used for drop down lists in the text editor, for example for card types. + +--Properties-- +! Property Type Default Description +| @name@ [[type:string]] ''Required'' Name of this word list, refered to using a @""@ tag. +| @words@ [[type:list]] of [[type:word list word]]s ''Required'' The words in the list + +--Example-- +>word list: +> name: type +> word: Creature +> word: Spell +> word: Artifact +This can be used with for example: +> @"Creature"@ +Which gives the creature choice, and that can be changed with a drop down list. diff --git a/doc/type/word_list_word.txt b/doc/type/word_list_word.txt new file mode 100644 index 00000000..6ba7614f --- /dev/null +++ b/doc/type/word_list_word.txt @@ -0,0 +1,18 @@ +Data type: word list word + +A word in a [[type:word list]]. + +--Properties-- +! Property Type Default Description +| @name@ [[type:string]] ''Required'' The word +| @line below@ [[type:boolean]] @false@ Display a line below this item in the list? +| @words@ [[type:list]] of [[type:word list word]]s A submenu + +A word can also be given in a short form, in that case only the name is specified. + +--Example-- +In short form: +>word: xyz +Is the same as: +>word: +> name: xyz diff --git a/src/data/game.cpp b/src/data/game.cpp index 946c0519..7f244c3e 100644 --- a/src/data/game.cpp +++ b/src/data/game.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include