diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-06-19 10:00:24 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2011-06-19 10:00:24 +0000 |
| commit | 06dfaa02d7a80bcdff717d579a48f81643f53f31 (patch) | |
| tree | 49b8e67ad9051f1507b0959cac986383ab4001e2 /src/extension | |
| parent | Fix rendering of control points (diff) | |
| parent | fix bug 796451: Measure tools should support rotation constraint (diff) | |
| download | inkscape-06dfaa02d7a80bcdff717d579a48f81643f53f31.tar.gz inkscape-06dfaa02d7a80bcdff717d579a48f81643f53f31.zip | |
Merge from trunk
(bzr r9508.1.89)
Diffstat (limited to 'src/extension')
40 files changed, 591 insertions, 385 deletions
diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index cd640d3d0..60de65416 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -1,41 +1,251 @@ -SET(extfolders -#dxf2svg -implementation -internal -internal/bitmap -internal/filter -internal/pdfinput -param -script -) -FOREACH(extlistsrc ${extfolders}) - ADD_SUBDIRECTORY(${extlistsrc}) -ENDFOREACH(extlistsrc) - -SET(extension_SRC -db.cpp -dependency.cpp -effect.cpp -error-file.cpp -execution-env.cpp -extension.cpp -init.cpp -input.cpp -output.cpp -patheffect.cpp -prefdialog.cpp -print.cpp -system.cpp -timer.cpp -#${extension_dxf2svg_SRC} -${extension_implementation_SRC} -${extension_internal_bitmap_SRC} -${extension_internal_filter_SRC} -${extension_internal_pdfinput_SRC} -${extension_param_SRC} -${extension_script_SRC} +set(extension_SRC + db.cpp + dependency.cpp + effect.cpp + error-file.cpp + execution-env.cpp + extension.cpp + init.cpp + input.cpp + output.cpp + patheffect.cpp + prefdialog.cpp + print.cpp + system.cpp + timer.cpp + + implementation/implementation.cpp + implementation/xslt.cpp + implementation/script.cpp + + param/bool.cpp + param/color.cpp + param/description.cpp + param/enum.cpp + param/float.cpp + param/int.cpp + param/notebook.cpp + param/parameter.cpp + param/radiobutton.cpp + param/string.cpp + + internal/bluredge.cpp + internal/cairo-png-out.cpp + internal/cairo-ps-out.cpp + internal/cairo-render-context.cpp + internal/cairo-renderer.cpp + internal/cairo-renderer-pdf-out.cpp + internal/emf-win32-inout.cpp + internal/emf-win32-print.cpp + internal/gdkpixbuf-input.cpp + internal/gimpgrad.cpp + internal/grid.cpp + internal/latex-pstricks.cpp + internal/latex-pstricks-out.cpp + internal/odf.cpp + internal/latex-text-renderer.cpp + internal/pdf-input-cairo.cpp + internal/pov-out.cpp + internal/javafx-out.cpp + internal/svg.cpp + internal/svgz.cpp + + internal/filter/filter-all.cpp + internal/filter/filter-file.cpp + internal/filter/filter.cpp + + internal/pdfinput/pdf-input.cpp + internal/pdfinput/pdf-parser.cpp + internal/pdfinput/svg-builder.cpp + + script/InkscapeScript.cpp + + # dxf2svg/aci2rgb.cpp + # dxf2svg/entities2elements.cpp + # dxf2svg/tables2svg_info.cpp + # dxf2svg/blocks.cpp + # dxf2svg/entities.cpp + # dxf2svg/tables.cpp + # dxf2svg/dxf2svg.cpp + # dxf2svg/read_dxf.cpp + # dxf2svg/test_dxf.cpp + + + # ------ + # Header + db.h + dependency.h + effect.h + error-file.h + execution-env.h + extension-forward.h + extension.h + init.h + input.h + output.h + param/bool.h + param/color.h + param/description.h + param/enum.h + param/float.h + param/int.h + param/notebook.h + param/parameter.h + param/radiobutton.h + param/string.h + patheffect.h + prefdialog.h + print.h + system.h + timer.h + + implementation/implementation.h + implementation/script.h + implementation/xslt.h + + internal/bluredge.h + internal/cairo-png-out.h + internal/cairo-ps-out.h + internal/cairo-render-context.h + internal/cairo-renderer-pdf-out.h + internal/cairo-renderer.h + internal/clear-n_.h + internal/emf-win32-inout.h + internal/emf-win32-print.h + internal/filter/abc.h + internal/filter/color.h + internal/filter/drop-shadow.h + internal/filter/experimental.h + internal/filter/filter.h + internal/filter/morphology.h + internal/filter/shadows.h + internal/filter/snow.h + internal/gdkpixbuf-input.h + internal/gimpgrad.h + internal/grid.h + internal/javafx-out.h + internal/latex-pstricks-out.h + internal/latex-pstricks.h + internal/latex-text-renderer.h + internal/odf.h + internal/pdf-input-cairo.h + internal/pdfinput/pdf-input.h + internal/pdfinput/pdf-parser.h + internal/pdfinput/svg-builder.h + internal/pov-out.h + internal/svg.h + internal/svgz.h + internal/win32.h + + script/InkscapeScript.h ) -ADD_LIBRARY(extension STATIC ${extension_SRC}) -TARGET_LINK_LIBRARIES(extension -2geom ${INKSCAPE_LIBS})
\ No newline at end of file + +if(WIN32) + list(APPEND extension_SRC + internal/win32.cpp + internal/win32.h + ) +endif() + +if(LibWPG_FOUND) + list(APPEND extension_SRC + internal/wpg-input.cpp + internal/wpg-input.h + ) +endif() + +if(ImageMagick_FOUND) + list(APPEND extension_SRC + internal/bitmap/adaptiveThreshold.cpp + internal/bitmap/adaptiveThreshold.h + internal/bitmap/addNoise.cpp + internal/bitmap/addNoise.h + internal/bitmap/blur.cpp + internal/bitmap/blur.h + internal/bitmap/channel.cpp + internal/bitmap/channel.h + internal/bitmap/charcoal.cpp + internal/bitmap/charcoal.h + internal/bitmap/colorize.cpp + internal/bitmap/colorize.h + internal/bitmap/contrast.cpp + internal/bitmap/contrast.h + internal/bitmap/cycleColormap.cpp + internal/bitmap/cycleColormap.h + internal/bitmap/despeckle.cpp + internal/bitmap/despeckle.h + internal/bitmap/edge.cpp + internal/bitmap/edge.h + internal/bitmap/emboss.cpp + internal/bitmap/emboss.h + internal/bitmap/enhance.cpp + internal/bitmap/enhance.h + internal/bitmap/equalize.cpp + internal/bitmap/equalize.h + internal/bitmap/gaussianBlur.cpp + internal/bitmap/gaussianBlur.h + internal/bitmap/imagemagick.cpp + internal/bitmap/imagemagick.h + internal/bitmap/implode.cpp + internal/bitmap/implode.h + internal/bitmap/level.cpp + internal/bitmap/level.h + internal/bitmap/levelChannel.cpp + internal/bitmap/levelChannel.h + internal/bitmap/medianFilter.cpp + internal/bitmap/medianFilter.h + internal/bitmap/modulate.cpp + internal/bitmap/modulate.h + internal/bitmap/negate.cpp + internal/bitmap/negate.h + internal/bitmap/normalize.cpp + internal/bitmap/normalize.h + internal/bitmap/oilPaint.cpp + internal/bitmap/oilPaint.h + internal/bitmap/opacity.cpp + internal/bitmap/opacity.h + internal/bitmap/raise.cpp + internal/bitmap/raise.h + internal/bitmap/reduceNoise.cpp + internal/bitmap/reduceNoise.h + internal/bitmap/sample.cpp + internal/bitmap/sample.h + internal/bitmap/shade.cpp + internal/bitmap/shade.h + internal/bitmap/sharpen.cpp + internal/bitmap/sharpen.h + internal/bitmap/solarize.cpp + internal/bitmap/solarize.h + internal/bitmap/spread.cpp + internal/bitmap/spread.h + internal/bitmap/swirl.cpp + internal/bitmap/swirl.h + internal/bitmap/threshold.cpp + internal/bitmap/threshold.h + internal/bitmap/unsharpmask.cpp + internal/bitmap/unsharpmask.h + internal/bitmap/wave.cpp + internal/bitmap/wave.h + ) +endif() + +if(WITH_DBUS) + list(APPEND extension_SRC + dbus/application-interface.cpp + dbus/dbus-init.cpp + dbus/document-interface.cpp + + # ------ + # Header + dbus/application-interface.h + dbus/dbus-init.h + dbus/document-interface.h + dbus/wrapper/inkscape-dbus-wrapper.h + ) + + include_directories(dbus) +endif() + +# add_inkscape_lib(extension_LIB "${extension_SRC}") +add_inkscape_source("${extension_SRC}") diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index 8e22849b5..4e629a1a9 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -35,6 +35,7 @@ #include "selection.h" //selection struct #include "sp-ellipse.h" #include "sp-object.h" +#include "sp-root.h" #include "style.h" //style_write #include "file.h" //IO @@ -202,8 +203,7 @@ dbus_create_node (SPDesktop *desk, const gchar *type) * There is probably a better way to do this (use the shape tools default styles) * but I'm not sure how. */ -gchar * -finish_create_shape (DocumentInterface *object, GError **error, Inkscape::XML::Node *newNode, gchar *desc) +gchar *finish_create_shape (DocumentInterface *object, GError ** /*error*/, Inkscape::XML::Node *newNode, gchar *desc) { SPCSSAttr *style = sp_desktop_get_style(object->desk, TRUE); @@ -218,11 +218,11 @@ finish_create_shape (DocumentInterface *object, GError **error, Inkscape::XML::N object->desk->currentLayer()->appendChildRepr(newNode); object->desk->currentLayer()->updateRepr(); - if (object->updates) - - Inkscape::DocumentUndo::done(sp_desktop_document(object->desk), 0, (gchar *)desc); - //else + if (object->updates) { + Inkscape::DocumentUndo::done(sp_desktop_document(object->desk), 0, (gchar *)desc); + //} else { //document_interface_pause_updates(object, error); + } return strdup(newNode->attribute("id")); } @@ -285,7 +285,7 @@ document_interface_class_init (DocumentInterfaceClass *klass) static void document_interface_init (DocumentInterface *object) { - object->desk = NULL; + object->desk = NULL; } @@ -312,37 +312,34 @@ inkscape_error_quark (void) #define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } -GType -inkscape_error_get_type (void) +GType inkscape_error_get_type(void) { - static GType etype = 0; + static GType etype = 0; - if (etype == 0) - { - static const GEnumValue values[] = - { + if (etype == 0) { + static const GEnumValue values[] = + { - ENUM_ENTRY (INKSCAPE_ERROR_SELECTION, "Incompatible_Selection"), - ENUM_ENTRY (INKSCAPE_ERROR_OBJECT, "Incompatible_Object"), - ENUM_ENTRY (INKSCAPE_ERROR_VERB, "Failed_Verb"), - ENUM_ENTRY (INKSCAPE_ERROR_OTHER, "Generic_Error"), - { 0, 0, 0 } - }; + ENUM_ENTRY(INKSCAPE_ERROR_SELECTION, "Incompatible_Selection"), + ENUM_ENTRY(INKSCAPE_ERROR_OBJECT, "Incompatible_Object"), + ENUM_ENTRY(INKSCAPE_ERROR_VERB, "Failed_Verb"), + ENUM_ENTRY(INKSCAPE_ERROR_OTHER, "Generic_Error"), + { 0, 0, 0 } + }; - etype = g_enum_register_static ("InkscapeError", values); - } + etype = g_enum_register_static("InkscapeError", values); + } - return etype; + return etype; } /**************************************************************************** MISC FUNCTIONS ****************************************************************************/ -gboolean -document_interface_delete_all (DocumentInterface *object, GError **error) +gboolean document_interface_delete_all(DocumentInterface *object, GError ** /*error*/) { - sp_edit_clear_all (object->desk); + sp_edit_clear_all(object->desk); return TRUE; } @@ -523,7 +520,7 @@ document_interface_image (DocumentInterface *object, int x, int y, gchar *filena return strdup(newNode->attribute("id")); } -gchar *document_interface_node (DocumentInterface *object, gchar *type, GError **error) +gchar *document_interface_node(DocumentInterface *object, gchar *type, GError ** /*error*/) { SPDocument * doc = sp_desktop_document (object->desk); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); @@ -533,10 +530,11 @@ gchar *document_interface_node (DocumentInterface *object, gchar *type, GError * object->desk->currentLayer()->appendChildRepr(newNode); object->desk->currentLayer()->updateRepr(); - if (object->updates) + if (object->updates) { Inkscape::DocumentUndo::done(sp_desktop_document(object->desk), 0, (gchar *)"created empty node"); - //else + //} else { //document_interface_pause_updates(object, error); + } return strdup(newNode->attribute("id")); } @@ -556,26 +554,23 @@ document_interface_document_get_height (DocumentInterface *object) return sp_desktop_document(object->desk)->getHeight(); } -gchar * -document_interface_document_get_css (DocumentInterface *object, GError **error) +gchar *document_interface_document_get_css(DocumentInterface *object, GError ** /*error*/) { SPCSSAttr *current = (object->desk)->current; return sp_repr_css_write_string(current); } -gboolean -document_interface_document_merge_css (DocumentInterface *object, - gchar *stylestring, GError **error) +gboolean document_interface_document_merge_css(DocumentInterface *object, + gchar *stylestring, GError ** /*error*/) { SPCSSAttr * style = sp_repr_css_attr_new(); - sp_repr_css_attr_add_from_string (style, stylestring); - sp_desktop_set_style (object->desk, style); + sp_repr_css_attr_add_from_string(style, stylestring); + sp_desktop_set_style(object->desk, style); return TRUE; } -gboolean -document_interface_document_set_css (DocumentInterface *object, - gchar *stylestring, GError **error) +gboolean document_interface_document_set_css(DocumentInterface *object, + gchar *stylestring, GError ** /*error*/) { SPCSSAttr * style = sp_repr_css_attr_new(); sp_repr_css_attr_add_from_string (style, stylestring); @@ -808,8 +803,7 @@ document_interface_move_to_layer (DocumentInterface *object, gchar *shape, return TRUE; } -GArray * -document_interface_get_node_coordinates (DocumentInterface *object, gchar *shape) +GArray *document_interface_get_node_coordinates(DocumentInterface * /*object*/, gchar * /*shape*/) { //FIXME: Needs lot's of work. /* @@ -855,29 +849,29 @@ document_interface_save (DocumentInterface *object, GError **error) return FALSE; } -gboolean -document_interface_load (DocumentInterface *object, - gchar *filename, GError **error) +gboolean document_interface_load(DocumentInterface *object, + gchar *filename, GError ** /*error*/) { - desktop_ensure_active (object->desk); + desktop_ensure_active(object->desk); const Glib::ustring file(filename); sp_file_open(file, NULL, TRUE, TRUE); - if (object->updates) + if (object->updates) { Inkscape::DocumentUndo::done(sp_desktop_document(object->desk), SP_VERB_FILE_OPEN, "Opened File"); + } return TRUE; } -gboolean -document_interface_save_as (DocumentInterface *object, - const gchar *filename, GError **error) +gboolean document_interface_save_as(DocumentInterface *object, + const gchar *filename, GError ** /*error*/) { SPDocument * doc = sp_desktop_document(object->desk); #ifdef WITH_GNOME_VFS const Glib::ustring file(filename); return file_save_remote(doc, file, NULL, TRUE, TRUE); #endif - if (!doc || strlen(filename)<1) //Safety check + if (!doc || strlen(filename)<1) { //Safety check return false; + } try { Inkscape::Extension::save(NULL, doc, filename, @@ -892,12 +886,12 @@ document_interface_save_as (DocumentInterface *object, return true; } -gboolean -document_interface_mark_as_unmodified (DocumentInterface *object, GError **error) +gboolean document_interface_mark_as_unmodified(DocumentInterface *object, GError ** /*error*/) { SPDocument * doc = sp_desktop_document(object->desk); - if (doc) + if (doc) { doc->modified_since_save = FALSE; + } return TRUE; } @@ -948,8 +942,7 @@ document_interface_redo (DocumentInterface *object, GError **error) Need to make sure it plays well with verbs because they are used so much. ****************************************************************************/ -void -document_interface_pause_updates (DocumentInterface *object, GError **error) +void document_interface_pause_updates(DocumentInterface *object, GError ** /*error*/) { object->updates = FALSE; object->desk->canvas->drawing_disabled = 1; @@ -959,8 +952,7 @@ document_interface_pause_updates (DocumentInterface *object, GError **error) //sp_desktop_document(object->desk)->root->mflags = FALSE; } -void -document_interface_resume_updates (DocumentInterface *object, GError **error) +void document_interface_resume_updates(DocumentInterface *object, GError ** /*error*/) { object->updates = TRUE; object->desk->canvas->drawing_disabled = 0; @@ -973,16 +965,15 @@ document_interface_resume_updates (DocumentInterface *object, GError **error) Inkscape::DocumentUndo::done(sp_desktop_document(object->desk), SP_VERB_CONTEXT_RECT, "Multiple actions"); } -void -document_interface_update (DocumentInterface *object, GError **error) +void document_interface_update(DocumentInterface *object, GError ** /*error*/) { - sp_desktop_document(object->desk)->root->uflags = TRUE; - sp_desktop_document(object->desk)->root->mflags = TRUE; + sp_desktop_document(object->desk)->getRoot()->uflags = TRUE; + sp_desktop_document(object->desk)->getRoot()->mflags = TRUE; object->desk->enableInteraction(); sp_desktop_document(object->desk)->_updateDocument(); object->desk->disableInteraction(); - sp_desktop_document(object->desk)->root->uflags = FALSE; - sp_desktop_document(object->desk)->root->mflags = FALSE; + sp_desktop_document(object->desk)->getRoot()->uflags = FALSE; + sp_desktop_document(object->desk)->getRoot()->mflags = FALSE; //Inkscape::DocumentUndo::done(sp_desktop_document(object->desk), SP_VERB_CONTEXT_RECT, "Multiple actions"); } @@ -990,8 +981,7 @@ document_interface_update (DocumentInterface *object, GError **error) SELECTION FUNCTIONS FIXME: use call_verb where appropriate (once update system is tested.) ****************************************************************************/ -gboolean -document_interface_selection_get (DocumentInterface *object, char ***out, GError **error) +gboolean document_interface_selection_get(DocumentInterface *object, char ***out, GError ** /*error*/) { Inkscape::Selection * sel = sp_desktop_selection(object->desk); GSList const *oldsel = sel->list(); @@ -1034,10 +1024,9 @@ document_interface_selection_add_list (DocumentInterface *object, return TRUE; } -gboolean -document_interface_selection_set (DocumentInterface *object, char *name, GError **error) +gboolean document_interface_selection_set(DocumentInterface *object, char *name, GError ** /*error*/) { - SPDocument * doc = sp_desktop_document (object->desk); + SPDocument * doc = sp_desktop_document(object->desk); Inkscape::Selection *selection = sp_desktop_selection(object->desk); selection->set(doc->getObjectById(name)); return TRUE; @@ -1055,8 +1044,7 @@ document_interface_selection_set_list (DocumentInterface *object, return TRUE; } -gboolean -document_interface_selection_rotate (DocumentInterface *object, int angle, GError **error) +gboolean document_interface_selection_rotate(DocumentInterface *object, int angle, GError ** /*error*/) { Inkscape::Selection *selection = sp_desktop_selection(object->desk); sp_selection_rotate(selection, angle); @@ -1070,8 +1058,7 @@ document_interface_selection_delete (DocumentInterface *object, GError **error) return dbus_call_verb (object, SP_VERB_EDIT_DELETE, error); } -gboolean -document_interface_selection_clear (DocumentInterface *object, GError **error) +gboolean document_interface_selection_clear(DocumentInterface *object, GError ** /*error*/) { sp_desktop_selection(object->desk)->clear(); return TRUE; @@ -1092,10 +1079,9 @@ document_interface_select_all_in_all_layers(DocumentInterface *object, return dbus_call_verb (object, SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, error); } -gboolean -document_interface_selection_box (DocumentInterface *object, int x, int y, - int x2, int y2, gboolean replace, - GError **error) +gboolean document_interface_selection_box(DocumentInterface * /*object*/, int /*x*/, int /*y*/, + int /*x2*/, int /*y2*/, gboolean /*replace*/, + GError ** /*error*/) { //FIXME: implement. return FALSE; @@ -1156,8 +1142,7 @@ document_interface_selection_paste (DocumentInterface *object, GError **error) return dbus_call_verb (object, SP_VERB_EDIT_PASTE, error); } -gboolean -document_interface_selection_scale (DocumentInterface *object, gdouble grow, GError **error) +gboolean document_interface_selection_scale(DocumentInterface *object, gdouble grow, GError ** /*error*/) { Inkscape::Selection *selection = sp_desktop_selection(object->desk); if (!selection) @@ -1168,15 +1153,13 @@ document_interface_selection_scale (DocumentInterface *object, gdouble grow, GEr return TRUE; } -gboolean -document_interface_selection_move (DocumentInterface *object, gdouble x, gdouble y, GError **error) +gboolean document_interface_selection_move(DocumentInterface *object, gdouble x, gdouble y, GError ** /*error*/) { - sp_selection_move (object->desk, x, 0 - y); //switching coordinate systems. + sp_selection_move(object->desk, x, 0 - y); //switching coordinate systems. return TRUE; } -gboolean -document_interface_selection_move_to (DocumentInterface *object, gdouble x, gdouble y, GError **error) +gboolean document_interface_selection_move_to(DocumentInterface *object, gdouble x, gdouble y, GError ** /*error*/) { Inkscape::Selection * sel = sp_desktop_selection(object->desk); @@ -1292,13 +1275,12 @@ document_interface_selection_change_level (DocumentInterface *object, gchar *cmd LAYER FUNCTIONS ****************************************************************************/ -gchar * -document_interface_layer_new (DocumentInterface *object, GError **error) +gchar *document_interface_layer_new(DocumentInterface *object, GError ** /*error*/) { SPDesktop * dt = object->desk; SPObject *new_layer = Inkscape::create_layer(dt->currentRoot(), dt->currentLayer(), Inkscape::LPOS_BELOW); dt->setCurrentLayer(new_layer); - return g_strdup(get_name_from_object (new_layer)); + return g_strdup(get_name_from_object(new_layer)); } gboolean @@ -1314,8 +1296,7 @@ document_interface_layer_set (DocumentInterface *object, return TRUE; } -gchar ** -document_interface_layer_get_all (DocumentInterface *object) +gchar **document_interface_layer_get_all(DocumentInterface * /*object*/) { //FIXME: implement. return NULL; @@ -1348,8 +1329,13 @@ document_interface_layer_previous (DocumentInterface *object, GError **error) return dbus_call_verb (object, SP_VERB_LAYER_PREV, error); } - - - - - +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/extension/dxf2svg/CMakeLists.txt b/src/extension/dxf2svg/CMakeLists.txt deleted file mode 100644 index b755d7f44..000000000 --- a/src/extension/dxf2svg/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -SET(extension_dxf2svg_SRC -#aci2rgb.cpp -#entities2elements.cpp -#tables2svg_info.cpp -#blocks.cpp -#entities.cpp -#tables.cpp -#dxf2svg.cpp -#read_dxf.cpp -#test_dxf.cpp -) diff --git a/src/extension/effect.h b/src/extension/effect.h index c02ce542b..28ebc5d96 100644 --- a/src/extension/effect.h +++ b/src/extension/effect.h @@ -15,7 +15,7 @@ #include <glibmm/i18n.h> #include <gtkmm/dialog.h> -#include <gtk/gtkdialog.h> +#include <gtk/gtk.h> #include "verbs.h" #include "prefdialog.h" diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index f9e099c26..b05685902 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -128,7 +128,7 @@ ExecutionEnv::createWorkingDialog (void) { SPDesktop *desktop = (SPDesktop *)_doc; GtkWidget *toplevel = gtk_widget_get_toplevel(&(desktop->canvas->widget)); - if (!toplevel || !GTK_WIDGET_TOPLEVEL (toplevel)) + if (!toplevel || !gtk_widget_is_toplevel (toplevel)) return; Gtk::Window *window = Glib::wrap(GTK_WINDOW(toplevel), false); @@ -141,7 +141,10 @@ ExecutionEnv::createWorkingDialog (void) { true); // modal _visibleDialog->signal_response().connect(sigc::mem_fun(this, &ExecutionEnv::workingCanceled)); g_free(dlgmessage); - _visibleDialog->show(); + + if (!_effect->is_silent()){ + _visibleDialog->show(); + } return; } diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index e67a4b95f..a70c79943 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -59,6 +59,7 @@ Parameter * get_param (const gchar * name); */ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) : _help(NULL) + , silent(false) , _gui(true) { repr = in_repr; @@ -105,6 +106,9 @@ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementat if (!strcmp(chname, "dependency")) { _deps.push_back(new Dependency(child_repr)); } /* dependency */ + if (!strcmp(chname, "options")) { + silent = !strcmp( child_repr->attribute("silent"), "true" ); + } child_repr = sp_repr_next(child_repr); } @@ -310,6 +314,16 @@ Extension::get_repr (void) } /** + \return bool + \brief Whether this extension should hide the "working, please wait" dialog +*/ +bool +Extension::is_silent (void) +{ + return silent; +} + +/** \return The textual id of this extension \brief Get the ID of this extension - not a copy don't delete! */ diff --git a/src/extension/extension.h b/src/extension/extension.h index 63981522e..eddddf62c 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -90,6 +90,7 @@ private: state_t _state; /**< Which state the Extension is currently in */ std::vector<Dependency *> _deps; /**< Dependencies for this extension */ static std::ofstream error_file; /**< This is the place where errors get reported */ + bool silent; bool _gui; protected: @@ -111,6 +112,7 @@ public: gchar * get_name (void); /** \brief Gets the help string for this extension */ gchar const * get_help (void) { return _help; } + bool is_silent (void); void deactivate (void); bool deactivated (void); void printFailure (Glib::ustring reason); diff --git a/src/extension/implementation/CMakeLists.txt b/src/extension/implementation/CMakeLists.txt deleted file mode 100644 index 87e1b2541..000000000 --- a/src/extension/implementation/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -SET(extension_implementation_SRC -implementation.cpp -xslt.cpp -script.cpp -) diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h index bf584b401..b9e417feb 100644 --- a/src/extension/implementation/implementation.h +++ b/src/extension/implementation/implementation.h @@ -12,7 +12,7 @@ #ifndef __INKSCAPE_EXTENSION_IMPLEMENTATION_H__ #define __INKSCAPE_EXTENSION_IMPLEMENTATION_H__ -#include <gtk/gtkdialog.h> +#include <gtk/gtk.h> #include <gdkmm/types.h> #include <gtkmm/widget.h> diff --git a/src/extension/input.h b/src/extension/input.h index 24cbc4896..8b198495e 100644 --- a/src/extension/input.h +++ b/src/extension/input.h @@ -16,7 +16,7 @@ #include "extension.h" #include "xml/repr.h" #include "document.h" -#include <gtk/gtkdialog.h> +#include <gtk/gtk.h> namespace Inkscape { namespace Extension { diff --git a/src/extension/internal/CMakeLists.txt b/src/extension/internal/CMakeLists.txt deleted file mode 100644 index 8b23cb0ac..000000000 --- a/src/extension/internal/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -IF(WIN32) -SET(EXT_INT_WIN -win32.cpp -) -ENDIF(WIN32) - -SET(extension_internal_SRC -bluredge.cpp -cairo-png-out.cpp -cairo-ps-out.cpp -cairo-render-context.cpp -cairo-renderer.cpp -cairo-renderer-pdf-out.cpp -emf-win32-inout.cpp -emf-win32-print.cpp -gdkpixbuf-input.cpp -gimpgrad.cpp -grid.cpp -latex-pstricks.cpp -latex-pstricks-out.cpp -odf.cpp -pdfinput -latex-text-renderer.cpp -pdf-input-cairo.cpp -pov-out.cpp -javafx-out.cpp -svg.cpp -svgz.cpp -wpg-input.cpp -${EXT_INT_WIN} -) diff --git a/src/extension/internal/bitmap/CMakeLists.txt b/src/extension/internal/bitmap/CMakeLists.txt deleted file mode 100644 index 8aec17492..000000000 --- a/src/extension/internal/bitmap/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -SET(extension_internal_bitmap_SRC -adaptiveThreshold.cpp -addNoise.cpp -blur.cpp -channel.cpp -charcoal.cpp -colorize.cpp -contrast.cpp -cycleColormap.cpp -despeckle.cpp -edge.cpp -emboss.cpp -enhance.cpp -equalize.cpp -gaussianBlur.cpp -imagemagick.cpp -implode.cpp -levelChannel.cpp -level.cpp -medianFilter.cpp -modulate.cpp -negate.cpp -normalize.cpp -oilPaint.cpp -opacity.cpp -raise.cpp -reduceNoise.cpp -sample.cpp -shade.cpp -sharpen.cpp -solarize.cpp -spread.cpp -swirl.cpp -threshold.cpp -unsharpmask.cpp -wave.cpp -) diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index 8ec09d11e..76582ab05 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -59,7 +59,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View int steps = module->get_param_int("num-steps"); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - double old_offset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0); + double old_offset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0, "px"); using Inkscape::Util::GSListConstIterator; // TODO need to properly refcount the items, at least @@ -97,10 +97,10 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View if (offset < 0.0) { /* Doing an inset here folks */ offset *= -1.0; - prefs->setDouble("/options/defaultoffsetwidth/value", offset); + prefs->setDoubleUnit("/options/defaultoffsetwidth/value", offset, "px"); sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_INSET)->get_action(desktop), NULL); } else if (offset > 0.0) { - prefs->setDouble("/options/defaultoffsetwidth/value", offset); + prefs->setDoubleUnit("/options/defaultoffsetwidth/value", offset, "px"); sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_OFFSET)->get_action(desktop), NULL); } @@ -110,7 +110,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View Inkscape::GC::release(new_group); } - prefs->setDouble("/options/defaultoffsetwidth/value", old_offset); + prefs->setDoubleUnit("/options/defaultoffsetwidth/value", old_offset, "px"); selection->clear(); selection->add(items.begin(), items.end()); diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 0e2194c17..b9c2a4488 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -1361,7 +1361,7 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con addClipPath(pathv, &style->fill_rule); } else { setPathVector(pathv); - if (style->fill_rule.value == SP_WIND_RULE_EVENODD) { + if (style->fill_rule.computed == SP_WIND_RULE_EVENODD) { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_EVEN_ODD); } else { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING); @@ -1391,7 +1391,7 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con _setFillStyle(style, pbox); setPathVector(pathv); - if (style->fill_rule.value == SP_WIND_RULE_EVENODD) { + if (style->fill_rule.computed == SP_WIND_RULE_EVENODD) { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_EVEN_ODD); } else { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING); @@ -1606,7 +1606,7 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const *font_ma if (_render_mode == RENDER_MODE_CLIP) { if (_clip_mode == CLIP_MODE_MASK) { - if (style->fill_rule.value == SP_WIND_RULE_EVENODD) { + if (style->fill_rule.computed == SP_WIND_RULE_EVENODD) { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_EVEN_ODD); } else { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING); diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index dbda82c28..bbafd7e94 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -170,11 +170,13 @@ static void sp_shape_render_invoke_marker_rendering(SPMarker* marker, Geom::Affi if (render) { SPItem* marker_item = sp_item_first_item_child(marker); - tr = (Geom::Affine)marker_item->transform * (Geom::Affine)marker->c2p * tr; - Geom::Affine old_tr = marker_item->transform; - marker_item->transform = tr; - ctx->getRenderer()->renderItem (ctx, marker_item); - marker_item->transform = old_tr; + if (marker_item) { + tr = (Geom::Affine)marker_item->transform * (Geom::Affine)marker->c2p * tr; + Geom::Affine old_tr = marker_item->transform; + marker_item->transform = tr; + ctx->getRenderer()->renderItem (ctx, marker_item); + marker_item->transform = old_tr; + } } } @@ -418,19 +420,18 @@ static void sp_symbol_render(SPItem *item, CairoRenderContext *ctx) ctx->popState(); } -static void sp_root_render(SPItem *item, CairoRenderContext *ctx) +static void sp_root_render(SPRoot *root, CairoRenderContext *ctx) { - SPRoot *root = SP_ROOT(item); CairoRenderer *renderer = ctx->getRenderer(); - if (!ctx->getCurrentState()->has_overflow && item->parent) + if (!ctx->getCurrentState()->has_overflow && root->parent) ctx->addClippingRect(root->x.computed, root->y.computed, root->width.computed, root->height.computed); ctx->pushState(); - renderer->setStateForItem(ctx, item); + renderer->setStateForItem(ctx, root); Geom::Affine tempmat (root->c2p); ctx->transform(&tempmat); - sp_group_render(item, ctx); + sp_group_render(root, ctx); ctx->popState(); } @@ -541,7 +542,10 @@ static void sp_item_invoke_render(SPItem *item, CairoRenderContext *ctx) if (SP_IS_ROOT(item)) { TRACE(("root\n")); - return sp_root_render(item, ctx); + return sp_root_render(SP_ROOT(item), ctx); + } else if (SP_IS_SYMBOL(item)) { + TRACE(("symbol\n")); + return sp_symbol_render(item, ctx); } else if (SP_IS_GROUP(item)) { TRACE(("group\n")); return sp_group_render(item, ctx); @@ -552,9 +556,6 @@ static void sp_item_invoke_render(SPItem *item, CairoRenderContext *ctx) TRACE(("use begin---\n")); sp_use_render(item, ctx); TRACE(("---use end\n")); - } else if (SP_IS_SYMBOL(item)) { - TRACE(("symbol\n")); - return sp_symbol_render(item, ctx); } else if (SP_IS_TEXT(item)) { TRACE(("text\n")); return sp_text_render(item, ctx); diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp index 2716faee2..646b33507 100644 --- a/src/extension/internal/emf-win32-inout.cpp +++ b/src/extension/internal/emf-win32-inout.cpp @@ -27,6 +27,8 @@ # include "config.h" #endif +//#include "inkscape.h" +#include "sp-root.h" #include "sp-path.h" #include "style.h" #include "print.h" @@ -59,6 +61,8 @@ namespace Extension { namespace Internal { static float device_scale = DEVICESCALE; +static RECTL rc_old; +static bool clipset = false; EmfWin32::EmfWin32 (void) // The null constructor { @@ -101,7 +105,7 @@ emf_print_document_to_file(SPDocument *doc, gchar const *filename) context.module = mod; /* fixme: This has to go into module constructor somehow */ /* Create new arena */ - mod->base = SP_ITEM(doc->getRoot()); + mod->base = doc->getRoot(); mod->arena = NRArena::create(); mod->dkey = SPItem::display_key_new(1); mod->root = mod->base->invoke_show(mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY); @@ -182,6 +186,7 @@ typedef struct emf_device_context { typedef struct emf_callback_data { Glib::ustring *outsvg; Glib::ustring *path; + Glib::ustring *outdef; EMF_DEVICE_CONTEXT dc[EMF_MAX_DC+1]; // FIXME: This should be dynamic.. int level; @@ -288,6 +293,9 @@ output_style(PEMF_CALLBACK_DATA d, int iType) tmp_style << "stroke-opacity:1;"; } tmp_style << "\" "; + if (clipset) + tmp_style << "\n\tclip-path=\"url(#clipEmfPath" << d->id << ")\" "; + clipset = false; *(d->outsvg) += tmp_style.str().c_str(); } @@ -747,19 +755,20 @@ myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const * { dbg_str << "<!-- EMR_HEADER -->\n"; - *(d->outsvg) += "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; + *(d->outdef) += "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; if (d->pDesc) { - *(d->outsvg) += "<!-- "; - *(d->outsvg) += d->pDesc; - *(d->outsvg) += " -->\n"; + *(d->outdef) += "<!-- "; + *(d->outdef) += d->pDesc; + *(d->outdef) += " -->\n"; } ENHMETAHEADER *pEmr = (ENHMETAHEADER *) lpEMFR; - tmp_outsvg << "<svg\n"; - tmp_outsvg << " xmlns:svg=\"http://www.w3.org/2000/svg\"\n"; - tmp_outsvg << " xmlns=\"http://www.w3.org/2000/svg\"\n"; - tmp_outsvg << " version=\"1.0\"\n"; + SVGOStringStream tmp_outdef; + tmp_outdef << "<svg\n"; + tmp_outdef << " xmlns:svg=\"http://www.w3.org/2000/svg\"\n"; + tmp_outdef << " xmlns=\"http://www.w3.org/2000/svg\"\n"; + tmp_outdef << " version=\"1.0\"\n"; d->xDPI = 2540; d->yDPI = 2540; @@ -777,15 +786,13 @@ myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const * if (pEmr->szlMillimeters.cx && pEmr->szlDevice.cx) device_scale = PX_PER_MM*pEmr->szlMillimeters.cx/pEmr->szlDevice.cx; - tmp_outsvg << + tmp_outdef << " width=\"" << d->MMX << "mm\"\n" << " height=\"" << d->MMY << "mm\">\n"; -// tmp_outsvg << -// " id=\"" << (d->id++) << "\">\n"; + *(d->outdef) += tmp_outdef.str().c_str(); + *(d->outdef) += "<defs>"; // temporary end of header - tmp_outsvg << "<g>\n"; -// "<g\n" << -// " id=\"" << (d->id++) << "\">\n"; + tmp_outsvg << "\n</defs>\n<g>\n"; // start of main body if (pEmr->nHandles) { d->n_obj = pEmr->nHandles; @@ -1129,6 +1136,7 @@ myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const * assert_empty_path(d, "EMR_EOF"); tmp_outsvg << "</g>\n"; tmp_outsvg << "</svg>\n"; + *(d->outsvg) = *(d->outdef) + *(d->outsvg); break; } case EMR_SETPIXELV: @@ -1211,8 +1219,37 @@ myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const * dbg_str << "<!-- EMR_EXCLUDECLIPRECT -->\n"; break; case EMR_INTERSECTCLIPRECT: + { dbg_str << "<!-- EMR_INTERSECTCLIPRECT -->\n"; + + PEMRINTERSECTCLIPRECT pEmr = (PEMRINTERSECTCLIPRECT) lpEMFR; + RECTL rc = pEmr->rclClip; + clipset = true; + if ((rc.left == rc_old.left) && (rc.top == rc_old.top) && (rc.right == rc_old.right) && (rc.bottom == rc_old.bottom)) + break; + rc_old = rc; + + double l = pix_to_x_point( d, rc.left, rc.top ); + double t = pix_to_y_point( d, rc.left, rc.top ); + double r = pix_to_x_point( d, rc.right, rc.bottom ); + double b = pix_to_y_point( d, rc.right, rc.bottom ); + + SVGOStringStream tmp_rectangle; + tmp_rectangle << "\n<clipPath\n\tclipPathUnits=\"userSpaceOnUse\" "; + tmp_rectangle << "\n\tid=\"clipEmfPath" << ++(d->id) << "\" >"; + tmp_rectangle << "\n<rect "; + tmp_rectangle << "\n\tx=\"" << l << "\" "; + tmp_rectangle << "\n\ty=\"" << t << "\" "; + tmp_rectangle << "\n\twidth=\"" << r-l << "\" "; + tmp_rectangle << "\n\theight=\"" << b-t << "\" />"; + tmp_rectangle << "\n</clipPath>"; + + assert_empty_path(d, "EMR_RECTANGLE"); + + *(d->outdef) += tmp_rectangle.str().c_str(); + *(d->path) = ""; break; + } case EMR_SCALEVIEWPORTEXTEX: dbg_str << "<!-- EMR_SCALEVIEWPORTEXTEX -->\n"; break; @@ -2250,6 +2287,7 @@ EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) d.outsvg = new Glib::ustring(""); d.path = new Glib::ustring(""); + d.outdef = new Glib::ustring(""); CHAR *ansi_uri = (CHAR *) local_fn; gunichar2 *unicode_fn = g_utf8_to_utf16( local_fn, -1, NULL, NULL, NULL ); @@ -2368,6 +2406,8 @@ EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) delete d.outsvg; if (d.path) delete d.path; + if (d.outdef) + delete d.outdef; if (local_fn) g_free(local_fn); if (unicode_fn) @@ -2409,6 +2449,7 @@ EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) delete d.outsvg; delete d.path; + delete d.outdef; if (d.emf_obj) { int i; diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp index eb6abeaca..e5d1b0681 100644 --- a/src/extension/internal/emf-win32-print.cpp +++ b/src/extension/internal/emf-win32-print.cpp @@ -42,9 +42,7 @@ #include "sp-item.h" //#include "glib.h" -//#include "gtk/gtkdialog.h" -//#include "gtk/gtkbox.h" -//#include "gtk/gtkstock.h" +//#include "gtk/gtk.h" //#include "glibmm/i18n.h" //#include "enums.h" @@ -52,6 +50,7 @@ #include "style.h" //#include "sp-paint-server.h" #include "inkscape-version.h" +#include "sp-root.h" //#include "libnrtype/FontFactory.h" //#include "libnrtype/font-instance.h" @@ -144,7 +143,7 @@ PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc) d.x1 = _width; d.y1 = _height; } else { - SPItem* doc_item = SP_ITEM(doc->getRoot()); + SPItem* doc_item = doc->getRoot(); doc_item->invoke_bbox(&d, doc_item->i2d_affine(), TRUE); } diff --git a/src/extension/internal/filter/CMakeLists.txt b/src/extension/internal/filter/CMakeLists.txt deleted file mode 100644 index 80a14ba3a..000000000 --- a/src/extension/internal/filter/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -SET(extension_internal_filter_SRC -drop-shadow.h -filter-all.cpp -filter.cpp -filter-file.cpp -filter.h -snow.h -) diff --git a/src/extension/internal/filter/experimental.h b/src/extension/internal/filter/experimental.h index 8d260f62e..f60a6b414 100755 --- a/src/extension/internal/filter/experimental.h +++ b/src/extension/internal/filter/experimental.h @@ -335,7 +335,7 @@ public: "<param name=\"simply\" gui-text=\"" N_("Strength:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">0.6</param>\n" "<param name=\"clean\" gui-text=\"" N_("Clean-up:") "\" type=\"int\" appearance=\"full\" min=\"1\" max=\"500\">10</param>\n" "<param name=\"erase\" gui-text=\"" N_("Erase:") "\" type=\"float\" appearance=\"full\" min=\"0\" max=\"60\">0</param>\n" - "<param name=\"transluscent\" gui-text=\"" N_("Transluscent") "\" type=\"boolean\" >false</param>\n" + "<param name=\"translucent\" gui-text=\"" N_("Translucent") "\" type=\"boolean\" >false</param>\n" "<_param name=\"smoothheader\" type=\"description\" appearance=\"header\">Smoothness</_param>\n" "<param name=\"smooth\" gui-text=\"" N_("Strength:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">0.6</param>\n" "<param name=\"dilat\" gui-text=\"" N_("Dilatation:") "\" type=\"float\" appearance=\"full\" min=\"1\" max=\"50\">6</param>\n" diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index 715278051..fb8d4de4b 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -133,7 +133,7 @@ Filter::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *d items.insert<GSListConstIterator<SPItem *> >(items.end(), selection->itemList(), NULL); Inkscape::XML::Document * xmldoc = document->doc()->getReprDoc(); - Inkscape::XML::Node * defsrepr = SP_DOCUMENT_DEFS(document->doc())->getRepr(); + Inkscape::XML::Node * defsrepr = document->doc()->getDefs()->getRepr(); for(std::list<SPItem *>::iterator item = items.begin(); item != items.end(); item++) { diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index 750849eb1..8399d602f 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -38,7 +38,7 @@ #include "helper/geom.h" #include "helper/geom-curves.h" #include <io/sys.h> - +#include "sp-root.h" #include <string> #include <stdio.h> @@ -758,7 +758,7 @@ bool JavaFXOutput::doTree(SPDocument *doc) miny = bignum; maxy = -bignum; - if (!doTreeRecursive(doc, doc->root)) { + if (!doTreeRecursive(doc, doc->getRoot())) { return false; } @@ -875,7 +875,7 @@ bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) out(" content: [\n"); idindex = 0; - doBody(doc, doc->root); + doBody(doc, doc->getRoot()); if (!doTail()) { return false; diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 1f9bdfef1..5d9fec905 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -10,7 +10,7 @@ * Jon A. Cruz <jon@joncruz.org> * Abhishek Sharma * - * Copyright (C) 2006-2010 Authors + * Copyright (C) 2006-2011 Authors * * Licensed under GNU GPL */ @@ -196,22 +196,22 @@ static char const preamble[] = "%% \n" "%% For more information, please see info/svg-inkscape on CTAN:\n" "%% http://tug.ctan.org/tex-archive/info/svg-inkscape\n" -"\n" -"\\begingroup\n" -" \\makeatletter\n" +"%%\n" +"\\begingroup%\n" +" \\makeatletter%\n" " \\providecommand\\color[2][]{%\n" -" \\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package \'color.sty\' is not loaded}\n" +" \\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package \'color.sty\' is not loaded}%\n" " \\renewcommand\\color[2][]{}%\n" -" }\n" +" }%\n" " \\providecommand\\transparent[1]{%\n" -" \\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package \'transparent.sty\' is not loaded}\n" +" \\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package \'transparent.sty\' is not loaded}%\n" " \\renewcommand\\transparent[1]{}%\n" -" }\n" -" \\providecommand\\rotatebox[2]{#2}\n"; +" }%\n" +" \\providecommand\\rotatebox[2]{#2}%\n"; static char const postamble[] = " \\end{picture}%\n" -"\\endgroup\n"; +"\\endgroup%\n"; void LaTeXTextRenderer::writePreamble() @@ -266,10 +266,15 @@ LaTeXTextRenderer::sp_text_render(SPItem *item) SPText *textobj = SP_TEXT (item); SPStyle *style = item->style; - gchar *str = sp_te_get_string_multiline(item); - if (!str) { + gchar *strtext = sp_te_get_string_multiline(item); + if (!strtext) { return; } + // replace carriage return with double slash + gchar ** splitstr = g_strsplit(strtext, "\n", -1); + gchar *str = g_strjoinv("\\\\ ", splitstr); + g_free(strtext); + g_strfreev(splitstr); // get position and alignment // Align vertically on the baseline of the font (retreived from the anchor point) @@ -340,7 +345,7 @@ LaTeXTextRenderer::sp_text_render(SPItem *item) li != le; li.nextStartOfSpan()) { SPStyle const &spanstyle = *(sp_te_style_at_position (item, li)); - bool is_bold = false, is_italic = false; + bool is_bold = false, is_italic = false, is_oblique = false; if (spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_500 || spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_600 || @@ -351,19 +356,34 @@ LaTeXTextRenderer::sp_text_render(SPItem *item) spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_BOLDER) { is_bold = true; - os << "{\\bfseries{}"; + os << "\\textbf{"; } if (spanstyle.font_style.computed == SP_CSS_FONT_STYLE_ITALIC) { is_italic = true; - os << "{\\itshape{}"; + os << "\\textit{"; + } + if (spanstyle.font_style.computed == SP_CSS_FONT_STYLE_OBLIQUE) + { + is_oblique = true; + os << "\\textsl{"; // this is an accurate choice if the LaTeX chosen font matches the font in Inkscape. Gives bad results when it is not so... } Inkscape::Text::Layout::iterator ln = li; ln.nextStartOfSpan(); - Glib::ustring spanstr = sp_te_get_string_multiline (item, li, ln); - os << spanstr; - + Glib::ustring uspanstr = sp_te_get_string_multiline (item, li, ln); + const gchar *spanstr = uspanstr.c_str(); + if (!spanstr) { + continue; + } + // replace carriage return with double slash + gchar ** splitstr = g_strsplit(spanstr, "\n", -1); + gchar *spanstr_new = g_strjoinv("\\\\ ", splitstr); + os << spanstr_new; + g_strfreev(splitstr); + g_free(spanstr_new); + + if (is_oblique) { os << "}"; } // oblique end if (is_italic) { os << "}"; } // italic end if (is_bold) { os << "}"; } // bold end } @@ -389,16 +409,6 @@ Flowing in rectangle is possible, not in arb shape. SPFlowtext *flowtext = SP_FLOWTEXT(item); SPStyle *style = item->style; - gchar *strtext = sp_te_get_string_multiline(item); - if (!strtext) { - return; - } - // replace carriage return with double slash - gchar ** splitstr = g_strsplit(strtext, "\n", -1); - gchar *str = g_strjoinv("\\\\ ", splitstr); - g_free(strtext); - g_strfreev(splitstr); - SPItem *frame_item = flowtext->get_frame(NULL); if (!frame_item || !SP_IS_RECT(frame_item)) { g_warning("LaTeX export: non-rectangular flowed text shapes are not supported, skipping text."); @@ -479,7 +489,7 @@ Flowing in rectangle is possible, not in arb shape. li != le; li.nextStartOfSpan()) { SPStyle const &spanstyle = *(sp_te_style_at_position (item, li)); - bool is_bold = false, is_italic = false; + bool is_bold = false, is_italic = false, is_oblique = false; if (spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_500 || spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_600 || @@ -490,19 +500,34 @@ Flowing in rectangle is possible, not in arb shape. spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_BOLDER) { is_bold = true; - os << "{\\bfseries{}"; + os << "\\textbf{"; } if (spanstyle.font_style.computed == SP_CSS_FONT_STYLE_ITALIC) { is_italic = true; - os << "{\\itshape{}"; + os << "\\textit{"; + } + if (spanstyle.font_style.computed == SP_CSS_FONT_STYLE_OBLIQUE) + { + is_oblique = true; + os << "\\textsl{"; // this is an accurate choice if the LaTeX chosen font matches the font in Inkscape. Gives bad results when it is not so... } Inkscape::Text::Layout::iterator ln = li; ln.nextStartOfSpan(); - Glib::ustring spanstr = sp_te_get_string_multiline (item, li, ln); - os << spanstr; - + Glib::ustring uspanstr = sp_te_get_string_multiline (item, li, ln); + const gchar *spanstr = uspanstr.c_str(); + if (!spanstr) { + continue; + } + // replace carriage return with double slash + gchar ** splitstr = g_strsplit(spanstr, "\n", -1); + gchar *spanstr_new = g_strjoinv("\\\\ ", splitstr); + os << spanstr_new; + g_strfreev(splitstr); + g_free(spanstr_new); + + if (is_oblique) { os << "}"; } // oblique end if (is_italic) { os << "}"; } // italic end if (is_bold) { os << "}"; } // bold end } @@ -517,13 +542,10 @@ Flowing in rectangle is possible, not in arb shape. fprintf(_stream, "%s", os.str().c_str()); } -void -LaTeXTextRenderer::sp_root_render(SPItem *item) +void LaTeXTextRenderer::sp_root_render(SPRoot *root) { - SPRoot *root = SP_ROOT(item); - push_transform(root->c2p); - sp_group_render(item); + sp_group_render(root); pop_transform(); } @@ -536,7 +558,7 @@ LaTeXTextRenderer::sp_item_invoke_render(SPItem *item) } if (SP_IS_ROOT(item)) { - return sp_root_render(item); + return sp_root_render(SP_ROOT(item)); } else if (SP_IS_GROUP(item)) { return sp_group_render(item); } else if (SP_IS_USE(item)) { @@ -598,19 +620,19 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem * // scaling of the image when including it in LaTeX - os << " \\ifx\\svgwidth\\undefined\n"; - os << " \\setlength{\\unitlength}{" << d->width() * PT_PER_PX << "pt}\n"; - os << " \\ifx\\svgscale\\undefined\n"; - os << " \\relax\n"; - os << " \\else\n"; - os << " \\setlength{\\unitlength}{\\unitlength * \\real{\\svgscale}}\n"; - os << " \\fi\n"; - os << " \\else\n"; - os << " \\setlength{\\unitlength}{\\svgwidth}\n"; - os << " \\fi\n"; - os << " \\global\\let\\svgwidth\\undefined\n"; - os << " \\global\\let\\svgscale\\undefined\n"; - os << " \\makeatother\n"; + os << " \\ifx\\svgwidth\\undefined%\n"; + os << " \\setlength{\\unitlength}{" << d->width() * PT_PER_PX << "bp}%\n"; // note: 'bp' is the Postscript pt unit in LaTeX, see LP bug #792384 + os << " \\ifx\\svgscale\\undefined%\n"; + os << " \\relax%\n"; + os << " \\else%\n"; + os << " \\setlength{\\unitlength}{\\unitlength * \\real{\\svgscale}}%\n"; + os << " \\fi%\n"; + os << " \\else%\n"; + os << " \\setlength{\\unitlength}{\\svgwidth}%\n"; + os << " \\fi%\n"; + os << " \\global\\let\\svgwidth\\undefined%\n"; + os << " \\global\\let\\svgscale\\undefined%\n"; + os << " \\makeatother%\n"; os << " \\begin{picture}(" << _width << "," << _height << ")%\n"; // strip pathname, as it is probably desired. Having a specific path in the TeX file is not convenient. diff --git a/src/extension/internal/latex-text-renderer.h b/src/extension/internal/latex-text-renderer.h index 2259427d6..66055a3bc 100644 --- a/src/extension/internal/latex-text-renderer.h +++ b/src/extension/internal/latex-text-renderer.h @@ -22,6 +22,7 @@ #include <stack> class SPItem; +struct SPRoot; namespace Inkscape { namespace Extension { @@ -60,7 +61,7 @@ protected: void writePostamble(); void sp_item_invoke_render(SPItem *item); - void sp_root_render(SPItem *item); + void sp_root_render(SPRoot *item); void sp_group_render(SPItem *item); void sp_use_render(SPItem *item); void sp_text_render(SPItem *item); diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp index 048b26bed..daa185268 100644 --- a/src/extension/internal/pdf-input-cairo.cpp +++ b/src/extension/internal/pdf-input-cairo.cpp @@ -31,6 +31,8 @@ #include <poppler/glib/poppler-document.h> #include <poppler/glib/poppler-page.h> +#include "ui/widget/spinbutton.h" + namespace Inkscape { namespace Extension { namespace Internal { @@ -67,7 +69,7 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc) // Page number int num_pages = poppler_document_get_n_pages(_poppler_doc); Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(new class Gtk::Adjustment(1, 1, num_pages, 1, 10, 0)); - _pageNumberSpin = Gtk::manage(new class Gtk::SpinButton(*_pageNumberSpin_adj, 1, 1)); + _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1)); _labelTotalPages = Gtk::manage(new class Gtk::Label()); hbox2 = Gtk::manage(new class Gtk::HBox(false, 0)); // Disable the page selector when there's only one page diff --git a/src/extension/internal/pdf-input-cairo.h b/src/extension/internal/pdf-input-cairo.h index ad7c884cb..7581cb0a5 100644 --- a/src/extension/internal/pdf-input-cairo.h +++ b/src/extension/internal/pdf-input-cairo.h @@ -20,7 +20,6 @@ #include <gtkmm/button.h> #include <gtkmm/buttonbox.h> #include <gtkmm/label.h> -#include <gtkmm/spinbutton.h> #include <gtkmm/box.h> #include <gtkmm/checkbutton.h> #include <gtkmm/comboboxtext.h> @@ -39,6 +38,13 @@ #include "../implementation/implementation.h" namespace Inkscape { + +namespace UI { +namespace Widget { + class SpinButton; +} +} + namespace Extension { namespace Internal { @@ -64,7 +70,7 @@ private: class Gtk::Button * cancelbutton; class Gtk::Button * okbutton; class Gtk::Label * _labelSelect; - class Gtk::SpinButton * _pageNumberSpin; + class Inkscape::UI::Widget::SpinButton * _pageNumberSpin; class Gtk::Label * _labelTotalPages; class Gtk::HBox * hbox2; class Gtk::CheckButton * _cropCheck; diff --git a/src/extension/internal/pdfinput/CMakeLists.txt b/src/extension/internal/pdfinput/CMakeLists.txt deleted file mode 100644 index 9a093a065..000000000 --- a/src/extension/internal/pdfinput/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -SET(extension_internal_pdfinput_SRC -pdf-input.cpp -pdf-parser.cpp -svg-builder.cpp -) diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index ae3e473a5..186f337c4 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -40,7 +40,8 @@ #include "inkscape.h" #include "dialogs/dialog-events.h" -#include <gtk/gtkdialog.h> +#include <gtk/gtk.h> +#include "ui/widget/spinbutton.h" namespace Inkscape { namespace Extension { @@ -75,7 +76,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar *uri) // Page number Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage( new class Gtk::Adjustment(1, 1, _pdf_doc->getNumPages(), 1, 10, 0)); - _pageNumberSpin = Gtk::manage(new class Gtk::SpinButton(*_pageNumberSpin_adj, 1, 1)); + _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1)); _labelTotalPages = Gtk::manage(new class Gtk::Label()); hbox2 = Gtk::manage(new class Gtk::HBox(false, 0)); // Disable the page selector when there's only one page diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h index 6bf0f11a2..c2fd0b6d8 100644 --- a/src/extension/internal/pdfinput/pdf-input.h +++ b/src/extension/internal/pdfinput/pdf-input.h @@ -24,7 +24,6 @@ #include <gtkmm/button.h> #include <gtkmm/buttonbox.h> #include <gtkmm/label.h> -#include <gtkmm/spinbutton.h> #include <gtkmm/box.h> #include <gtkmm/checkbutton.h> #include <gtkmm/comboboxtext.h> @@ -41,6 +40,13 @@ #endif namespace Inkscape { + +namespace UI { +namespace Widget { + class SpinButton; +} +} + namespace Extension { namespace Internal { @@ -66,7 +72,7 @@ private: class Gtk::Button * cancelbutton; class Gtk::Button * okbutton; class Gtk::Label * _labelSelect; - class Gtk::SpinButton * _pageNumberSpin; + class Inkscape::UI::Widget::SpinButton * _pageNumberSpin; class Gtk::Label * _labelTotalPages; class Gtk::HBox * hbox2; class Gtk::CheckButton * _cropCheck; diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 94edf826e..dc995b7aa 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -531,7 +531,7 @@ void SvgBuilder::setClipPath(GfxState *state, bool even_odd) { clip_path->appendChild(path); Inkscape::GC::release(path); // Append clipPath to defs and get id - SP_DOCUMENT_DEFS(_doc)->getRepr()->appendChild(clip_path); + _doc->getDefs()->getRepr()->appendChild(clip_path); gchar *urltext = g_strdup_printf ("url(#%s)", clip_path->attribute("id")); Inkscape::GC::release(clip_path); _container->setAttribute("clip-path", urltext); @@ -678,7 +678,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPattern *tiling_pattern, delete pattern_builder; // Append the pattern to defs - SP_DOCUMENT_DEFS(_doc)->getRepr()->appendChild(pattern_node); + _doc->getDefs()->getRepr()->appendChild(pattern_node); gchar *id = g_strdup(pattern_node->attribute("id")); Inkscape::GC::release(pattern_node); @@ -752,7 +752,7 @@ gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for return NULL; } - Inkscape::XML::Node *defs = SP_DOCUMENT_DEFS(_doc)->getRepr(); + Inkscape::XML::Node *defs = _doc->getDefs()->getRepr(); defs->appendChild(gradient); gchar *id = g_strdup(gradient->attribute("id")); Inkscape::GC::release(gradient); @@ -1635,9 +1635,9 @@ Inkscape::XML::Node *SvgBuilder::_createMask(double width, double height) { sp_repr_set_svg_double(mask_node, "height", height); // Append mask to defs if (_is_top_level) { - SP_DOCUMENT_DEFS(_doc)->getRepr()->appendChild(mask_node); + _doc->getDefs()->getRepr()->appendChild(mask_node); Inkscape::GC::release(mask_node); - return SP_DOCUMENT_DEFS(_doc)->getRepr()->lastChild(); + return _doc->getDefs()->getRepr()->lastChild(); } else { // Work around for renderer bug when mask isn't defined in pattern static int mask_count = 0; Inkscape::XML::Node *defs = _root->firstChild(); diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 1563d04c1..382f8cbfb 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -35,6 +35,7 @@ #include "helper/geom.h" #include "helper/geom-curves.h" #include <io/sys.h> +#include "sp-root.h" #include <string> #include <stdio.h> @@ -485,7 +486,7 @@ bool PovOutput::doTree(SPDocument *doc) miny = bignum; maxy = -bignum; - if (!doTreeRecursive(doc, doc->root)) + if (!doTreeRecursive(doc, doc->getRoot())) return false; //## Let's make a union of all of the Shapes diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index 946ff22fe..afc706e89 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -24,6 +24,7 @@ #include "extension/output.h" #include <vector> #include "xml/attribute-record.h" +#include "sp-root.h" #ifdef WITH_GNOME_VFS # include <libgnomevfs/gnome-vfs.h> diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index 70fa28967..3cd5044f7 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -49,9 +49,17 @@ #include "extension/input.h" #include "document.h" +// Take a guess and fallback to 0.1.x if no configure has run +#if !defined(WITH_LIBWPG01) && !defined(WITH_LIBWPG02) +#define WITH_LIBWPG01 1 +#endif + #include "libwpg/libwpg.h" +#if WITH_LIBWPG01 #include "libwpg/WPGStreamImplementation.h" - +#elif WITH_LIBWPG02 +#include "libwpd-stream/libwpd-stream.h" +#endif using namespace libwpg; @@ -62,9 +70,17 @@ namespace Internal { SPDocument * WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) { +#if WITH_LIBWPG01 WPXInputStream* input = new libwpg::WPGFileStream(uri); +#elif WITH_LIBWPG02 + WPXInputStream* input = new WPXFileStream(uri); +#endif if (input->isOLEStream()) { +#if WITH_LIBWPG01 WPXInputStream* olestream = input->getDocumentOLEStream(); +#elif WITH_LIBWPG02 + WPXInputStream* olestream = input->getDocumentOLEStream("PerfectOffice_MAIN"); +#endif if (olestream) { delete input; input = olestream; @@ -79,7 +95,11 @@ WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) { return NULL; } +#if WITH_LIBWPG01 libwpg::WPGString output; +#elif WITH_LIBWPG02 + WPXString output; +#endif if (!libwpg::WPGraphics::generateSVG(input, output)) { delete input; return NULL; diff --git a/src/extension/output.h b/src/extension/output.h index 584fafda8..5f6785b8b 100644 --- a/src/extension/output.h +++ b/src/extension/output.h @@ -13,7 +13,7 @@ #ifndef INKSCAPE_EXTENSION_OUTPUT_H__ #define INKSCAPE_EXTENSION_OUTPUT_H__ -#include <gtk/gtkdialog.h> +#include <gtk/gtk.h> #include "extension.h" struct SPDocument; diff --git a/src/extension/param/CMakeLists.txt b/src/extension/param/CMakeLists.txt deleted file mode 100644 index 2ef5d5005..000000000 --- a/src/extension/param/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -SET(extension_param_SRC -bool.cpp -color.cpp -description.cpp -groupheader.cpp -enum.cpp -parameter.cpp -float.cpp -int.cpp -notebook.cpp -radiobutton.cpp -string.cpp -) - diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index d94463a5b..4ef816d61 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -12,7 +12,7 @@ #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/scale.h> -#include <gtkmm/spinbutton.h> +#include "ui/widget/spinbutton.h" #include "xml/node.h" #include "extension/extension.h" @@ -172,7 +172,7 @@ ParamFloat::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::sign hbox->pack_start(*scale, false, false); } - Gtk::SpinButton * spin = Gtk::manage(new Gtk::SpinButton(*fadjust, 0.1, _precision)); + Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(*fadjust, 0.1, _precision)); spin->show(); hbox->pack_start(*spin, false, false); diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 69849c656..3ed8addd9 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -12,7 +12,7 @@ #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/scale.h> -#include <gtkmm/spinbutton.h> +#include "ui/widget/spinbutton.h" #include "xml/node.h" #include "extension/extension.h" @@ -157,7 +157,7 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal hbox->pack_start(*scale, false, false); } - Gtk::SpinButton * spin = Gtk::manage(new Gtk::SpinButton(*fadjust, 1.0, 0)); + Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(*fadjust, 1.0, 0)); spin->show(); hbox->pack_start(*spin, false, false); diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index a9935cfe6..455fcc3bb 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -19,10 +19,6 @@ # define ESCAPE_DOLLAR_COMMANDLINE #endif -#include <gtkmm/adjustment.h> -#include <gtkmm/box.h> -#include <gtkmm/spinbutton.h> - #include <xml/node.h> #include <extension/extension.h> @@ -358,7 +354,7 @@ Parameter::new_child (Inkscape::XML::Node * parent) Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) { Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::XML::Node * defs = SP_DOCUMENT_DEFS(doc)->getRepr(); + Inkscape::XML::Node * defs = doc->getDefs()->getRepr(); Inkscape::XML::Node * params = NULL; GQuark const name_quark = g_quark_from_string("inkscape:extension-params"); diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp index 09ee9be0b..6da310d30 100644 --- a/src/extension/patheffect.cpp +++ b/src/extension/patheffect.cpp @@ -42,7 +42,7 @@ PathEffect::processPathEffects (SPDocument * doc, Inkscape::XML::Node * path) return; gchar ** patheffects = g_strsplit(patheffectlist, ";", 128); - Inkscape::XML::Node * defs = SP_DOCUMENT_DEFS(doc)->getRepr(); + Inkscape::XML::Node * defs = doc->getDefs()->getRepr(); for (int i = 0; patheffects[i] != NULL && i < 128; i++) { gchar * patheffect = patheffects[i]; diff --git a/src/extension/script/CMakeLists.txt b/src/extension/script/CMakeLists.txt deleted file mode 100644 index 693948508..000000000 --- a/src/extension/script/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -SET(extension_script_SRC -InkscapeScript.cpp -) diff --git a/src/extension/system.cpp b/src/extension/system.cpp index cf58f2733..b3b64ca7d 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -35,6 +35,8 @@ #include "implementation/xslt.h" #include "xml/rebase-hrefs.h" #include "io/sys.h" +#include "inkscape.h" + /* #include "implementation/plugin.h" */ namespace Inkscape { @@ -64,8 +66,7 @@ static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementatio * * Lastly, the open function is called in the module itself. */ -SPDocument * -open(Extension *key, gchar const *filename) +SPDocument *open(Extension *key, gchar const *filename) { Input *imod = NULL; if (key == NULL) { @@ -93,8 +94,9 @@ open(Extension *key, gchar const *filename) throw Input::open_failed(); } - if (!imod->prefs(filename)) + if (!imod->prefs(filename)) { return NULL; + } SPDocument *doc = imod->open(filename); if (!doc) { @@ -102,11 +104,11 @@ open(Extension *key, gchar const *filename) } if (last_chance_svg) { - /* We can't call sp_ui_error_dialog because we may be - running from the console, in which case calling sp_ui - routines will cause a segfault. See bug 1000350 - bryce */ - // sp_ui_error_dialog(_("Format autodetect failed. The file is being opened as SVG.")); - g_warning(_("Format autodetect failed. The file is being opened as SVG.")); + if ( inkscape_use_gui() ) { + sp_ui_error_dialog(_("Format autodetect failed. The file is being opened as SVG.")); + } else { + g_warning(_("Format autodetect failed. The file is being opened as SVG.")); + } } /* This kinda overkill as most of these are already set, but I want @@ -588,10 +590,11 @@ Glib::ustring get_file_save_path (SPDocument *doc, FileSaveMethod method) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring path; + bool use_current_dir = true; switch (method) { case FILE_SAVE_METHOD_SAVE_AS: { - bool use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir", true); + use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir", true); if (doc->getURI() && use_current_dir) { path = Glib::path_get_dirname(doc->getURI()); } else { @@ -603,7 +606,12 @@ get_file_save_path (SPDocument *doc, FileSaveMethod method) { path = prefs->getString("/dialogs/save_as/path"); break; case FILE_SAVE_METHOD_SAVE_COPY: - path = prefs->getString("/dialogs/save_copy/path"); + use_current_dir = prefs->getBool("/dialogs/save_copy/use_current_dir", prefs->getBool("/dialogs/save_as/use_current_dir", true)); + if (doc->getURI() && use_current_dir) { + path = Glib::path_get_dirname(doc->getURI()); + } else { + path = prefs->getString("/dialogs/save_copy/path"); + } break; case FILE_SAVE_METHOD_INKSCAPE_SVG: if (doc->getURI()) { |
