Commit 67cf9bfb authored by twanvl's avatar twanvl

Icons for export and print;

match_rule script function
parent 8a143327
......@@ -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();
......
......@@ -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"
......
......@@ -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<ScriptMatchRule> 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);
}
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