From 6ef60ed15f805f434078bc880b99f8902f7995c0 Mon Sep 17 00:00:00 2001 From: twanvl Date: Sun, 13 May 2007 17:27:25 +0000 Subject: [PATCH] Icons for export and print; match_rule script function git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@356 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/set/window.cpp | 6 ++--- src/resource/msw/mse.rc | 3 +++ src/resource/msw/tool/export.png | Bin 0 -> 260 bytes src/resource/msw/tool/print.png | Bin 0 -> 273 bytes src/resource/msw/tool/print_preview.png | Bin 0 -> 336 bytes src/script/functions/basic.cpp | 34 ++++++++++++++++++++++++ 6 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 src/resource/msw/tool/export.png create mode 100644 src/resource/msw/tool/print.png create mode 100644 src/resource/msw/tool/print_preview.png diff --git a/src/gui/set/window.cpp b/src/gui/set/window.cpp index ef701e3e..b87a6d2a 100644 --- a/src/gui/set/window.cpp +++ b/src/gui/set/window.cpp @@ -61,14 +61,14 @@ SetWindow::SetWindow(Window* parent, const SetP& set) menuExport->Append(ID_FILE_EXPORT_IMAGES, _("export_images"), _MENU_("export images"), _HELP_("export images")); menuExport->Append(ID_FILE_EXPORT_APPR, _("export_apprentice"), _MENU_("export apprentice"),_HELP_("export apprentice")); menuExport->Append(ID_FILE_EXPORT_MWS, _("export_mws"), _MENU_("export mws"), _HELP_("export mws")); - menuFile->Append(ID_FILE_EXPORT, _MENU_("export"), _("Export the set..."), menuExport); + menuFile->Append(ID_FILE_EXPORT, _("export"), _MENU_("export"), _("Export the set..."), wxITEM_NORMAL, menuExport); menuFile->AppendSeparator(); // menuFile->Append(ID_FILE_INSPECT, _("Inspect Internal Data..."), _("Shows a the data in the set using a tree structure")); // menuFile->AppendSeparator(); menuFile->Append(ID_FILE_RELOAD, _MENU_("reload data"), _HELP_("reload data")); menuFile->AppendSeparator(); - menuFile->Append(ID_FILE_PRINT_PREVIEW, _MENU_("print preview"), _HELP_("print preview")); - menuFile->Append(ID_FILE_PRINT, _MENU_("print"), _HELP_("print")); + menuFile->Append(ID_FILE_PRINT_PREVIEW, _("print_preview"), _MENU_("print preview"), _HELP_("print preview")); + menuFile->Append(ID_FILE_PRINT, _("print"), _MENU_("print"), _HELP_("print")); menuFile->AppendSeparator(); // recent files go here menuFile->AppendSeparator(); diff --git a/src/resource/msw/mse.rc b/src/resource/msw/mse.rc index b0b10a39..793439f3 100644 --- a/src/resource/msw/mse.rc +++ b/src/resource/msw/mse.rc @@ -22,11 +22,14 @@ cursor/rot_text CURSOR "cursor/rot_text.cur" tool/new IMAGE "tool/new.png" tool/open IMAGE "tool/open.png" tool/save IMAGE "tool/save.png" +tool/export IMAGE "tool/export.png" tool/export_html IMAGE "tool/export_html.png" tool/export_image IMAGE "tool/export_image.png" tool/export_images IMAGE "tool/export_images.png" tool/export_mws IMAGE "tool/export_mws.png" tool/export_apprentice IMAGE "tool/export_apprentice.png" +tool/print IMAGE "tool/print.png" +tool/print_preview IMAGE "tool/print_preview.png" tool/undo IMAGE "tool/undo.png" tool/redo IMAGE "tool/redo.png" diff --git a/src/resource/msw/tool/export.png b/src/resource/msw/tool/export.png new file mode 100644 index 0000000000000000000000000000000000000000..7fbf0b8416f24f73c55b3aec9cc7ea8ef83be735 GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!6#K6G#d|Jc;Acw6a$S;`T00{P0?A`?w;Vkfo zEM{Qf76M_$OLy!3fCNiiBTAg}b8}PkN*EYAwR+irg8iN@jv*CurUu>?Y%t(hz4(RG zx;yv(?GOrD5m5QX82@l3Pw%bnlnqDfVA7amSUwbf?XAr^L@Na`x!lQv7SI?=k(~ z?Snq2q7#lte_TD&{c6!e0gf6kJ}YjEGhQ1G@E&Mu77pGJycXy*22WQ%mvv4FO#rQg BWIq4^ literal 0 HcmV?d00001 diff --git a/src/resource/msw/tool/print.png b/src/resource/msw/tool/print.png new file mode 100644 index 0000000000000000000000000000000000000000..1944560e8ed05948a7bce0da48f784b308d7b4c6 GIT binary patch literal 273 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!7%)r1n>(-?sK#oCxPlzj!ZUEy3Fx3F$HGsf@ z0|)*C#s4$>2U9>A$O3|D`HdjGoFzei!C(O(!4T|UAp{aE@Q5sCVBiL_xrG=n-L3lr zR_Pj1;+&tGo0?a`z|g7H%LWvT^>lFzshFedXUKQJfg`D8_xpPZXrQ~pRvqC`1?%DmfPH0(LG`7rTiV)Sc*}6x$^ZFar-#0d^F-s^;+N9?yqsU~h lBzpe$SNWGeeC8P+V-J{M(2%Np&m3qGgQu&X%Q~loCIIbYVH*Gd literal 0 HcmV?d00001 diff --git a/src/resource/msw/tool/print_preview.png b/src/resource/msw/tool/print_preview.png new file mode 100644 index 0000000000000000000000000000000000000000..a6bb5bc4882691467638f38e7959af861044046e GIT binary patch literal 336 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!6#K6G#d|Jc;Acw6a$S;`TKalmm^ML*YAkA6e z5n0T@z;_sg8IR|$NC63!xJHyX=jZ08=9MrobZYgo0R?Y+x;TbZ%;^pC=4*1`nVVd} zp#Qkk#7($&$Hb}9!r$E>CXjm~CQ zS(fNW0&IWhaTV?<39#1w=IY3#5x($}brSQO#uXY*a^~01+S|6>M8!m-eZBVq&R1fp ztM%q}YAsov6ccM*obCLGMTc?KD#rzXwoBZVH=1Cu^UUJrj5DjwZe9KT?_ZG?=8H^5 zWd{T!m<^>q@-gn^Kfropx8Mb1Kcj`aST|Z*Fo}sxR(YCQC$ieval(ctx); } +// ----------------------------------------------------------------------------- : Rules : regex match + +class ScriptMatchRule : public ScriptValue { + public: + virtual ScriptType type() const { return SCRIPT_FUNCTION; } + virtual String typeName() const { return _("match_rule"); } + virtual ScriptValueP eval(Context& ctx) const { + SCRIPT_PARAM(String, input); + SCRIPT_RETURN(regex.Matches(input)); + } + + wxRegEx regex; ///< Regex to match +}; + +// Create a regular expression rule for filtering strings +ScriptValueP match_rule(Context& ctx) { + intrusive_ptr ret(new ScriptMatchRule); + // match + SCRIPT_PARAM(String, match); + if (!ret->regex.Compile(match, wxRE_ADVANCED)) { + throw ScriptError(_("Error while compiling regular expression: '")+match+_("'")); + } + return ret; +} + +SCRIPT_FUNCTION(match_rule) { + return match_rule(ctx); +} +SCRIPT_FUNCTION(match) { + return match_rule(ctx)->eval(ctx); +} + // ----------------------------------------------------------------------------- : Rules : sort /// Sort a string using a specification using the shortest cycle metric, see spec_sort @@ -558,8 +590,10 @@ void init_script_basic_functions(Context& ctx) { // advanced string rules ctx.setVariable(_("replace"), script_replace); ctx.setVariable(_("filter"), script_filter); + ctx.setVariable(_("match"), script_match); ctx.setVariable(_("sort"), script_sort); ctx.setVariable(_("replace rule"), script_replace_rule); ctx.setVariable(_("filter rule"), script_filter_rule); + ctx.setVariable(_("match rule"), script_match_rule); ctx.setVariable(_("sort rule"), script_sort_rule); }