From f4cd1ea9e1fd3cba85d7b167d56a1d5fc1116d91 Mon Sep 17 00:00:00 2001 From: ishmal Date: Mon, 10 Mar 2008 00:37:22 +0000 Subject: [PATCH] Update to follow new scripting stuff --- src/ui/dialog/scriptdialog.cpp | 46 +++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/src/ui/dialog/scriptdialog.cpp b/src/ui/dialog/scriptdialog.cpp index a56e74df3..fd0a43851 100644 --- a/src/ui/dialog/scriptdialog.cpp +++ b/src/ui/dialog/scriptdialog.cpp @@ -4,7 +4,7 @@ * Author: * Bob Jamison * - * Copyright (C) 2004-2007 Authors + * Copyright (C) 2004-2008 Authors * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -22,9 +22,14 @@ #include -namespace Inkscape { -namespace UI { -namespace Dialog { + +namespace Inkscape +{ +namespace UI +{ +namespace Dialog +{ + //######################################################################### @@ -62,15 +67,20 @@ class ScriptDialogImpl : public ScriptDialog */ void execute(Inkscape::Extension::Script::InkscapeScript::ScriptLanguage lang); + /** + * Execute a Javascript script + */ + void executeJavascript(); + /** * Execute a Python script */ void executePython(); /** - * Execute a Perl script + * Execute a Ruby script */ - void executePerl(); + void executeRuby(); @@ -100,7 +110,7 @@ class ScriptDialogImpl : public ScriptDialog }; -static char *defaultPythonCodeStr = +static const char *defaultPythonCodeStr = #if defined(WITH_PYTHON) "# This is a sample Python script.\n" "# To run it, select 'Execute Python' from the File menu above.\n" @@ -169,6 +179,14 @@ lang) } } +/** + * Execute the script in the dialog + */ +void ScriptDialogImpl::executeJavascript() +{ + execute(Inkscape::Extension::Script::InkscapeScript::JAVASCRIPT); +} + /** * Execute the script in the dialog */ @@ -180,9 +198,9 @@ void ScriptDialogImpl::executePython() /** * Execute the script in the dialog */ -void ScriptDialogImpl::executePerl() +void ScriptDialogImpl::executeRuby() { - execute(Inkscape::Extension::Script::InkscapeScript::PERL); + execute(Inkscape::Extension::Script::InkscapeScript::RUBY); } @@ -201,14 +219,12 @@ ScriptDialogImpl::ScriptDialogImpl() : menuBar.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_File"), fileMenu) ); fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_Clear"), sigc::mem_fun(*this, &ScriptDialogImpl::clear) ) ); -#ifdef WITH_PYTHON + fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_Execute Javascript"), + sigc::mem_fun(*this, &ScriptDialogImpl::executeJavascript) ) ); fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_Execute Python"), sigc::mem_fun(*this, &ScriptDialogImpl::executePython) ) ); -#endif -#ifdef WITH_PERL - fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_Execute Perl"), - sigc::mem_fun(*this, &ScriptDialogImpl::executePerl) ) ); -#endif + fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_Execute Ruby"), + sigc::mem_fun(*this, &ScriptDialogImpl::executeRuby) ) ); contents->pack_start(menuBar, Gtk::PACK_SHRINK); //### Set up the script field -- 2.30.2