Code

Add option to align & distribute dialog to treat the selection as a group (closes...
[inkscape.git] / src / ui / dialog / scriptdialog.cpp
index fd0a43851ba011c20f8afddfc78c0cefb02098e6..7b299b700cdb9231e10eb8a1c9d4142c92fdb5e2 100644 (file)
@@ -110,31 +110,20 @@ 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"
+    "importPackage(javax.swing);\n"
+    "function sayHello() {\n"
+    "  JOptionPane.showMessageDialog(null, 'Hello, world!',\n"
+       "     'Welcome to Inkscape', JOptionPane.WARNING_MESSAGE);\n"
+    "}\n"
+    "\n"
+    "sayHello();\n"
+    "\n";
+
 
 
 
@@ -229,7 +218,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"));