summaryrefslogtreecommitdiffstats
path: root/src/extension/implementation/script.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2008-02-29 21:37:22 +0000
committergouldtj <gouldtj@users.sourceforge.net>2008-02-29 21:37:22 +0000
commit23c6090f0f77b6cd8b47e80e69974519e22f4ecf (patch)
tree91fc6ca41a0daacd1f336038b2e77eacc1315ae0 /src/extension/implementation/script.cpp
parentCopy perspectives, too, when pasting 3D boxes (solves LP #195867) (diff)
downloadinkscape-23c6090f0f77b6cd8b47e80e69974519e22f4ecf.tar.gz
inkscape-23c6090f0f77b6cd8b47e80e69974519e22f4ecf.zip
r18220@shi: ted | 2008-02-29 13:18:55 -0800
Okay, sadly I'm not keeping the version history because I'm not convenced that SVK will do it right. One mega-patch, but that's life. Reshuffle the exection-env and prefdialog code so that the state machines aren't intertwines, which fixes a whole host of bugs with them. I think the behavior is correct now. Make it so that the effects can count how many preferences they have to determine if the dialog should be shown (fix above). Once this code was written it was easy to make it show an ellipsis on the verb if there is a dialog or not. This involved removing ellipsis from those effects that had it hard coded. Make it so that the parameters know that their command line options are going into a list. They don't have to acknowledge it, but they can, and specifically notebook does and handles it differently. This should fix the notebooks on Win32, but doesn't apparently completely. Change the script extension on windows to use pythonw instead of python so that the command line doesn't appear all the time. (bzr r4908)
Diffstat (limited to 'src/extension/implementation/script.cpp')
-rw-r--r--src/extension/implementation/script.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index 09dc9eb30..37e4e15b8 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -98,7 +98,11 @@ struct interpreter_t {
*/
static interpreter_t const interpreterTab[] = {
{"perl", "perl-interpreter", "perl" },
+#ifdef _WIN32
+ {"python", "python-interpreter", "pythonw" },
+#else
{"python", "python-interpreter", "python" },
+#endif
{"ruby", "ruby-interpreter", "ruby" },
{"shell", "shell-interpreter", "sh" },
{ NULL, NULL, NULL }
@@ -453,19 +457,19 @@ Script::check(Inkscape::Extension::Extension *module)
}
class ScriptDocCache : public ImplementationDocumentCache {
- friend class Script;
+ friend class Script;
protected:
- std::string _filename;
+ std::string _filename;
int _tempfd;
public:
- ScriptDocCache (Inkscape::UI::View::View * view);
- ~ScriptDocCache ( );
+ ScriptDocCache (Inkscape::UI::View::View * view);
+ ~ScriptDocCache ( );
};
ScriptDocCache::ScriptDocCache (Inkscape::UI::View::View * view) :
- ImplementationDocumentCache(view),
- _filename(""),
- _tempfd(0)
+ ImplementationDocumentCache(view),
+ _filename(""),
+ _tempfd(0)
{
try {
_tempfd = Glib::file_open_tmp(_filename, "ink_ext_XXXXXX.svg");
@@ -481,7 +485,7 @@ ScriptDocCache::ScriptDocCache (Inkscape::UI::View::View * view) :
Inkscape::Extension::db.get(SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE),
view->doc(), _filename.c_str(), FALSE, FALSE, FALSE);
- return;
+ return;
}
ScriptDocCache::~ScriptDocCache ( )
@@ -727,21 +731,21 @@ Script::save(Inkscape::Extension::Output *module,
void
Script::effect(Inkscape::Extension::Effect *module,
Inkscape::UI::View::View *doc,
- ImplementationDocumentCache * docCache)
+ ImplementationDocumentCache * docCache)
{
- if (docCache == NULL) {
- docCache = newDocCache(module, doc);
- }
- ScriptDocCache * dc = dynamic_cast<ScriptDocCache *>(docCache);
- if (dc == NULL) {
- printf("TOO BAD TO LIVE!!!");
- exit(1);
- }
+ if (docCache == NULL) {
+ docCache = newDocCache(module, doc);
+ }
+ ScriptDocCache * dc = dynamic_cast<ScriptDocCache *>(docCache);
+ if (dc == NULL) {
+ printf("TOO BAD TO LIVE!!!");
+ exit(1);
+ }
SPDesktop *desktop = (SPDesktop *)doc;
sp_namedview_document_from_window(desktop);
- gchar * orig_output_extension = g_strdup(sp_document_repr_root(desktop->doc())->attribute("inkscape:output_extension"));
+ gchar * orig_output_extension = g_strdup(sp_document_repr_root(desktop->doc())->attribute("inkscape:output_extension"));
std::list<std::string> params;
module->paramListString(params);
@@ -807,9 +811,9 @@ Script::effect(Inkscape::Extension::Effect *module,
mydoc->release();
sp_namedview_update_layers_from_document(desktop);
- sp_document_repr_root(desktop->doc())->setAttribute("inkscape:output_extension", orig_output_extension);
+ sp_document_repr_root(desktop->doc())->setAttribute("inkscape:output_extension", orig_output_extension);
}
- g_free(orig_output_extension);
+ g_free(orig_output_extension);
return;
}