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 00000000..7fbf0b84 Binary files /dev/null and b/src/resource/msw/tool/export.png differ diff --git a/src/resource/msw/tool/print.png b/src/resource/msw/tool/print.png new file mode 100644 index 00000000..1944560e Binary files /dev/null and b/src/resource/msw/tool/print.png differ diff --git a/src/resource/msw/tool/print_preview.png b/src/resource/msw/tool/print_preview.png new file mode 100644 index 00000000..a6bb5bc4 Binary files /dev/null and b/src/resource/msw/tool/print_preview.png differ diff --git a/src/script/functions/basic.cpp b/src/script/functions/basic.cpp index 49987dfc..9833c041 100644 --- a/src/script/functions/basic.cpp +++ b/src/script/functions/basic.cpp @@ -367,6 +367,38 @@ SCRIPT_FUNCTION(filter) { return filter_rule(ctx)->eval(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); }