summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/scriptdialog.cpp
diff options
context:
space:
mode:
authorBob Jamison <ishmalius@gmail.com>2008-03-11 21:13:53 +0000
committerishmal <ishmal@users.sourceforge.net>2008-03-11 21:13:53 +0000
commitc12eeb6315500334d0a244d87f8a88936ee04959 (patch)
treef8ffc37515b41260d18e4ddf4012b9a7fa9107fe /src/ui/dialog/scriptdialog.cpp
parentAdd more javac stuff. Add target="" attribute to javac (diff)
downloadinkscape-c12eeb6315500334d0a244d87f8a88936ee04959.tar.gz
inkscape-c12eeb6315500334d0a244d87f8a88936ee04959.zip
Got initial JS execution working
(bzr r5057)
Diffstat (limited to 'src/ui/dialog/scriptdialog.cpp')
-rw-r--r--src/ui/dialog/scriptdialog.cpp39
1 files changed, 13 insertions, 26 deletions
diff --git a/src/ui/dialog/scriptdialog.cpp b/src/ui/dialog/scriptdialog.cpp
index fd0a43851..ff075c186 100644
--- a/src/ui/dialog/scriptdialog.cpp
+++ b/src/ui/dialog/scriptdialog.cpp
@@ -110,31 +110,18 @@ class ScriptDialogImpl : public ScriptDialog
};
-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"
- "desktop = inkscape.activeDesktop\n"
- "dialogmanager = desktop.dialogManager\n"
- "document = inkscape.activeDocument\n"
- "inkscape.hello()\n"
- "dialogmanager.showAbout()\n"
-#elif defined(WITH_PERL)
- "# This is a sample Perl script.\n"
- "# To run it, select 'Execute Perl' from the File menu above.\n"
- "my $desktop = $inkscape->getDesktop();\n"
- "my $dialogmanager = $inkscape->getDialogManager();\n"
- "my $document = $desktop->getDocument();\n"
- "$document->hello();\n"
- "$dialogmanager->showAbout();\n"
-#else
- "# This is where you could type a script.\n"
- "# However, no scripting languages have been compiled\n"
- "# into Inkscape, so this window has no functionality.\n"
- "# When compiling Inkscape, run \"configure\" with\n"
- "# \"--with-python\" and/or \"--with-perl\".\n"
-#endif
- "";
+static const char *defaultCodeStr =
+ "/**\n"
+ " * This is some example Javascript.\n"
+ " * Try 'Execute Javascript'\n"
+ " */\n"
+ "function sayHello() {\n"
+ " println('Hello, world!');\n"
+ "}\n"
+ "\n"
+ "sayHello();\n"
+ "\n";
+
@@ -229,7 +216,7 @@ ScriptDialogImpl::ScriptDialogImpl() :
//### Set up the script field
scriptText.set_editable(true);
- scriptText.get_buffer()->set_text(defaultPythonCodeStr);
+ scriptText.get_buffer()->set_text(defaultCodeStr);
scriptTextScroll.add(scriptText);
scriptTextScroll.set_policy(Gtk::POLICY_ALWAYS, Gtk::POLICY_ALWAYS);
scriptTextFrame.set_label(_("Script"));