From 1636c1dd1651780d01759676b194312529f211f7 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Sat, 25 Jun 2016 22:24:26 +0200 Subject: Moved next functions, added namespace, renamed range functions (bzr r14954.1.10) --- src/extension/execution-env.cpp | 2 +- src/extension/implementation/implementation.cpp | 2 +- src/extension/implementation/script.cpp | 2 +- src/extension/internal/bitmap/imagemagick.cpp | 4 ++-- src/extension/internal/bluredge.cpp | 2 +- src/extension/internal/filter/filter.cpp | 2 +- src/extension/internal/grid.cpp | 2 +- src/extension/plugins/grid2/grid.cpp | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/extension') diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index d5c80f26e..2b0183d4b 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -58,7 +58,7 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Imp sp_namedview_document_from_window(desktop); if (desktop != NULL) { - std::vector selected = desktop->getSelection()->itemList(); + std::vector selected = desktop->getSelection()->items(); for(std::vector::const_iterator x = selected.begin(); x != selected.end(); ++x){ Glib::ustring selected_id; selected_id = (*x)->getId(); diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 92a8a2833..eb1213a84 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -46,7 +46,7 @@ Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, I SPDocument * current_document = view->doc(); - std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); + std::vector selected = ((SPDesktop *) view)->getSelection()->items(); Inkscape::XML::Node const* first_select = NULL; if (!selected.empty()) { const SPItem * item = selected[0]; diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 01323bee2..0acc99aed 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -690,7 +690,7 @@ void Script::effect(Inkscape::Extension::Effect *module, } std::vector selected = - desktop->getSelection()->itemList(); //desktop should not be NULL since doc was checked and desktop is a casted pointer + desktop->getSelection()->items(); //desktop should not be NULL since doc was checked and desktop is a casted pointer for(std::vector::const_iterator x = selected.begin(); x != selected.end(); ++x){ Glib::ustring selected_id; selected_id += "--id="; diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index a235dcb0f..707cd763d 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -65,7 +65,7 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) : _imageItems(NULL) { SPDesktop *desktop = (SPDesktop*)view; - const std::vector selectedItemList = desktop->selection->itemList(); + const std::vector selectedItemList = desktop->selection->items(); int selectCount = selectedItemList.size(); // Init the data-holders @@ -235,7 +235,7 @@ ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::Vie { SPDocument * current_document = view->doc(); - std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); + std::vector selected = ((SPDesktop *) view)->getSelection()->items(); Inkscape::XML::Node * first_select = NULL; if (!selected.empty()) { first_select = (selected.front())->getRepr(); diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index 4a04e3c33..6dc788f17 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -62,7 +62,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View double old_offset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0, "px"); // TODO need to properly refcount the items, at least - std::vector items(selection->itemList()); + std::vector items(selection->items()); selection->clear(); for(std::vector::iterator item = items.begin(); diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index 25e89bbf3..acfcaed0e 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -125,7 +125,7 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie Inkscape::Selection * selection = ((SPDesktop *)document)->selection; // TODO need to properly refcount the items, at least - std::vector items(selection->itemList()); + std::vector items(selection->items()); Inkscape::XML::Document * xmldoc = document->doc()->getReprDoc(); Inkscape::XML::Node * defsrepr = document->doc()->getDefs()->getRepr(); diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index c766bd828..fd1b311a8 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -180,7 +180,7 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View { SPDocument * current_document = view->doc(); - std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); + std::vector selected = ((SPDesktop *) view)->getSelection()->items(); Inkscape::XML::Node * first_select = NULL; if (!selected.empty()) { first_select = selected[0]->getRepr(); diff --git a/src/extension/plugins/grid2/grid.cpp b/src/extension/plugins/grid2/grid.cpp index 6880c574d..c938d1ec4 100644 --- a/src/extension/plugins/grid2/grid.cpp +++ b/src/extension/plugins/grid2/grid.cpp @@ -186,7 +186,7 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View { SPDocument * current_document = view->doc(); - std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); + std::vector selected = ((SPDesktop *) view)->getSelection()->items(); Inkscape::XML::Node * first_select = NULL; if (!selected.empty()) { first_select = selected[0]->getRepr(); -- cgit v1.2.3 From d1947e768272c703674129d5c583204ff2b59251 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 13 Jul 2016 13:36:19 +0200 Subject: Second part of new SPObject children list (bzr r14954.1.19) --- src/extension/internal/cairo-render-context.cpp | 23 +++++++++++------------ src/extension/internal/cairo-renderer.cpp | 8 ++++---- src/extension/internal/emf-print.cpp | 14 +++++++++++--- src/extension/internal/javafx-out.cpp | 8 ++++---- src/extension/internal/pov-out.cpp | 4 ++-- 5 files changed, 32 insertions(+), 25 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 5d8b0e076..bedf2fa7f 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -986,13 +986,12 @@ void CairoRenderContext::popState(void) static bool pattern_hasItemChildren(SPPattern *pat) { - bool hasItems = false; - for ( SPObject *child = pat->firstChild() ; child && !hasItems; child = child->getNext() ) { - if (SP_IS_ITEM (child)) { - hasItems = true; + for (auto& child: pat->_children) { + if (SP_IS_ITEM (&child)) { + return true; } } - return hasItems; + return false; } cairo_pattern_t* @@ -1087,10 +1086,10 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver // show items and render them for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children - for ( SPObject *child = pat_i->firstChild() ; child; child = child->getNext() ) { - if (SP_IS_ITEM(child)) { - SP_ITEM(child)->invoke_show(drawing, dkey, SP_ITEM_REFERENCE_FLAGS); - _renderer->renderItem(pattern_ctx, SP_ITEM(child)); + for (auto& child: pat_i->_children) { + if (SP_IS_ITEM(&child)) { + SP_ITEM(&child)->invoke_show(drawing, dkey, SP_ITEM_REFERENCE_FLAGS); + _renderer->renderItem(pattern_ctx, SP_ITEM(&child)); } } break; // do not go further up the chain if children are found @@ -1116,9 +1115,9 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver // hide all items for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children - for ( SPObject *child = pat_i->firstChild() ; child; child = child->getNext() ) { - if (SP_IS_ITEM(child)) { - SP_ITEM(child)->invoke_hide(dkey); + for (auto& child: pat_i->_children) { + if (SP_IS_ITEM(&child)) { + SP_ITEM(&child)->invoke_hide(dkey); } } break; // do not go further up the chain if children are found diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 5dc20ab06..088eaf11d 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -741,8 +741,8 @@ CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp) TRACE(("BEGIN clip\n")); SPObject const *co = cp; - for ( SPObject const *child = co->firstChild() ; child; child = child->getNext() ) { - SPItem const *item = dynamic_cast(child); + for (auto& child: co->_children) { + SPItem const *item = dynamic_cast(&child); if (item) { // combine transform of the item in clippath and the item using clippath: @@ -800,8 +800,8 @@ CairoRenderer::applyMask(CairoRenderContext *ctx, SPMask const *mask) TRACE(("BEGIN mask\n")); SPObject const *co = mask; - for ( SPObject const *child = co->firstChild() ; child; child = child->getNext() ) { - SPItem const *item = dynamic_cast(child); + for (auto& child: co->_children) { + SPItem const *item = dynamic_cast(&child); if (item) { // TODO fix const correctness: renderItem(ctx, const_cast(item)); diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 9f3b5475f..c0c086c7a 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -1042,8 +1042,12 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ /* find the clipping path */ Geom::PathVector combined_pathvector; Geom::Affine tfc; // clipping transform, generally not the same as item transform - for(item = SP_ITEM(scp->firstChild()); item; item=SP_ITEM(item->getNext())){ - if (SP_IS_GROUP(item)) { // not implemented + for (auto& child: scp->_children) { + item = SP_ITEM(&child); + if (!item) { + break; + } + if (SP_IS_GROUP(item)) { // not implemented // return sp_group_render(item); combined_pathvector = merge_PathVector_with_group(combined_pathvector, item, tfc); } else if (SP_IS_SHAPE(item)) { @@ -1081,7 +1085,11 @@ Geom::PathVector PrintEmf::merge_PathVector_with_group(Geom::PathVector const &c new_combined_pathvector = combined_pathvector; SPGroup *group = SP_GROUP(item); Geom::Affine tfc = item->transform * transform; - for(SPItem *item = SP_ITEM(group->firstChild()); item; item=SP_ITEM(item->getNext())){ + for (auto& child: group->_children) { + item = SP_ITEM(&child); + if (!item) { + break; + } if (SP_IS_GROUP(item)) { new_combined_pathvector = merge_PathVector_with_group(new_combined_pathvector, item, tfc); // could be endlessly recursive on a badly formed SVG } else if (SP_IS_SHAPE(item)) { diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index 386bde1d6..51608e4fa 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -732,9 +732,9 @@ bool JavaFXOutput::doTreeRecursive(SPDocument *doc, SPObject *obj) /** * Descend into children */ - for (SPObject *child = obj->firstChild() ; child ; child = child->next) + for (auto &child: obj->_children) { - if (!doTreeRecursive(doc, child)) { + if (!doTreeRecursive(doc, &child)) { return false; } } @@ -804,9 +804,9 @@ bool JavaFXOutput::doBody(SPDocument *doc, SPObject *obj) /** * Descend into children */ - for (SPObject *child = obj->firstChild() ; child ; child = child->next) + for (auto &child: obj->_children) { - if (!doBody(doc, child)) { + if (!doBody(doc, &child)) { return false; } } diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index bd2168b68..08f533010 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -479,9 +479,9 @@ bool PovOutput::doTreeRecursive(SPDocument *doc, SPObject *obj) /** * Descend into children */ - for (SPObject *child = obj->firstChild() ; child ; child = child->next) + for (auto &child: obj->_children) { - if (!doTreeRecursive(doc, child)) + if (!doTreeRecursive(doc, &child)) return false; } -- cgit v1.2.3 From 9e210a6d1333c3366681547e3e81593ef69ff73e Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 12:56:49 +0200 Subject: Last part of new SPObject children list (bzr r14954.1.20) --- src/extension/internal/metafile-print.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp index 47ba5971c..5c10f7dd9 100644 --- a/src/extension/internal/metafile-print.cpp +++ b/src/extension/internal/metafile-print.cpp @@ -293,20 +293,22 @@ void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf } // still looking? Look at this pattern's children, if there are any - SPObject *child = pat_i->firstChild(); - while (child && !(*epixbuf) && (*hatchType == -1)) { - brush_classify(child, depth, epixbuf, hatchType, hatchColor, bkColor); - child = child->getNext(); + for (auto& child: pat_i->_children) { + if (*epixbuf || *hatchType != -1) { + break; + } + brush_classify(&child, depth, epixbuf, hatchType, hatchColor, bkColor); } } } else if (SP_IS_IMAGE(parent)) { *epixbuf = ((SPImage *)parent)->pixbuf; return; } else { // some inkscape rearrangements pass through nodes between pattern and image which are not classified as either. - SPObject *child = parent->firstChild(); - while (child && !(*epixbuf) && (*hatchType == -1)) { - brush_classify(child, depth, epixbuf, hatchType, hatchColor, bkColor); - child = child->getNext(); + for (auto& child: parent->_children) { + if (*epixbuf || *hatchType != -1) { + break; + } + brush_classify(&child, depth, epixbuf, hatchType, hatchColor, bkColor); } } } -- cgit v1.2.3 From 24d3f50003ca3cec6a03a7f5267cc4fe5588c69f Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 13:17:21 +0200 Subject: Renamed children list in SPObject (bzr r14954.1.21) --- src/extension/internal/cairo-render-context.cpp | 6 +++--- src/extension/internal/cairo-renderer.cpp | 4 ++-- src/extension/internal/emf-print.cpp | 4 ++-- src/extension/internal/javafx-out.cpp | 4 ++-- src/extension/internal/metafile-print.cpp | 4 ++-- src/extension/internal/pov-out.cpp | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index bedf2fa7f..1310bb343 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -986,7 +986,7 @@ void CairoRenderContext::popState(void) static bool pattern_hasItemChildren(SPPattern *pat) { - for (auto& child: pat->_children) { + for (auto& child: pat->children) { if (SP_IS_ITEM (&child)) { return true; } @@ -1086,7 +1086,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver // show items and render them for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children - for (auto& child: pat_i->_children) { + for (auto& child: pat_i->children) { if (SP_IS_ITEM(&child)) { SP_ITEM(&child)->invoke_show(drawing, dkey, SP_ITEM_REFERENCE_FLAGS); _renderer->renderItem(pattern_ctx, SP_ITEM(&child)); @@ -1115,7 +1115,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver // hide all items for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children - for (auto& child: pat_i->_children) { + for (auto& child: pat_i->children) { if (SP_IS_ITEM(&child)) { SP_ITEM(&child)->invoke_hide(dkey); } diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 088eaf11d..cd96a7f58 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -741,7 +741,7 @@ CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp) TRACE(("BEGIN clip\n")); SPObject const *co = cp; - for (auto& child: co->_children) { + for (auto& child: co->children) { SPItem const *item = dynamic_cast(&child); if (item) { @@ -800,7 +800,7 @@ CairoRenderer::applyMask(CairoRenderContext *ctx, SPMask const *mask) TRACE(("BEGIN mask\n")); SPObject const *co = mask; - for (auto& child: co->_children) { + for (auto& child: co->children) { SPItem const *item = dynamic_cast(&child); if (item) { // TODO fix const correctness: diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index c0c086c7a..d4c5d95a3 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -1042,7 +1042,7 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ /* find the clipping path */ Geom::PathVector combined_pathvector; Geom::Affine tfc; // clipping transform, generally not the same as item transform - for (auto& child: scp->_children) { + for (auto& child: scp->children) { item = SP_ITEM(&child); if (!item) { break; @@ -1085,7 +1085,7 @@ Geom::PathVector PrintEmf::merge_PathVector_with_group(Geom::PathVector const &c new_combined_pathvector = combined_pathvector; SPGroup *group = SP_GROUP(item); Geom::Affine tfc = item->transform * transform; - for (auto& child: group->_children) { + for (auto& child: group->children) { item = SP_ITEM(&child); if (!item) { break; diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index 51608e4fa..d7ad7e6f7 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -732,7 +732,7 @@ bool JavaFXOutput::doTreeRecursive(SPDocument *doc, SPObject *obj) /** * Descend into children */ - for (auto &child: obj->_children) + for (auto &child: obj->children) { if (!doTreeRecursive(doc, &child)) { return false; @@ -804,7 +804,7 @@ bool JavaFXOutput::doBody(SPDocument *doc, SPObject *obj) /** * Descend into children */ - for (auto &child: obj->_children) + for (auto &child: obj->children) { if (!doBody(doc, &child)) { return false; diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp index 5c10f7dd9..061eb634d 100644 --- a/src/extension/internal/metafile-print.cpp +++ b/src/extension/internal/metafile-print.cpp @@ -293,7 +293,7 @@ void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf } // still looking? Look at this pattern's children, if there are any - for (auto& child: pat_i->_children) { + for (auto& child: pat_i->children) { if (*epixbuf || *hatchType != -1) { break; } @@ -304,7 +304,7 @@ void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf *epixbuf = ((SPImage *)parent)->pixbuf; return; } else { // some inkscape rearrangements pass through nodes between pattern and image which are not classified as either. - for (auto& child: parent->_children) { + for (auto& child: parent->children) { if (*epixbuf || *hatchType != -1) { break; } diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 08f533010..8df883069 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -479,7 +479,7 @@ bool PovOutput::doTreeRecursive(SPDocument *doc, SPObject *obj) /** * Descend into children */ - for (auto &child: obj->_children) + for (auto &child: obj->children) { if (!doTreeRecursive(doc, &child)) return false; -- cgit v1.2.3 From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/extension/db.cpp | 2 +- src/extension/dependency.cpp | 4 +--- src/extension/effect.cpp | 1 - src/extension/error-file.cpp | 2 +- src/extension/execution-env.cpp | 5 +---- src/extension/extension.cpp | 2 +- src/extension/implementation/implementation.cpp | 3 +-- src/extension/implementation/xslt.cpp | 4 +--- src/extension/input.cpp | 2 -- src/extension/loader.cpp | 1 - src/extension/loader.h | 3 ++- src/extension/patheffect.cpp | 1 - src/extension/system.cpp | 4 +--- 13 files changed, 10 insertions(+), 24 deletions(-) (limited to 'src/extension') diff --git a/src/extension/db.cpp b/src/extension/db.cpp index a3c54915d..f17b784a9 100644 --- a/src/extension/db.cpp +++ b/src/extension/db.cpp @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "db.h" #include "input.h" diff --git a/src/extension/dependency.cpp b/src/extension/dependency.cpp index 624be12f9..837520381 100644 --- a/src/extension/dependency.cpp +++ b/src/extension/dependency.cpp @@ -9,14 +9,12 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include #include #include -#include "config.h" -#include "path-prefix.h" #include "dependency.h" #include "db.h" #include "extension.h" diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index e7299ba51..ef254f623 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -13,7 +13,6 @@ #include "helper/action.h" #include "ui/view/view.h" -#include "selection.h" #include "sp-namedview.h" #include "desktop.h" #include "implementation/implementation.h" diff --git a/src/extension/error-file.cpp b/src/extension/error-file.cpp index db354c0ce..9ec643759 100644 --- a/src/extension/error-file.cpp +++ b/src/extension/error-file.cpp @@ -9,7 +9,7 @@ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include "ui/dialog/extensions.h" diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index d5c80f26e..569e2c762 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -8,10 +8,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include - #ifdef HAVE_CONFIG_H -# include +#include #endif #include "gtkmm/messagedialog.h" @@ -25,7 +23,6 @@ #include "document.h" #include "document-undo.h" #include "desktop.h" -#include "ui/view/view.h" #include "sp-namedview.h" #include "display/sp-canvas.h" diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 6f7539360..56ff0a5f4 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -16,7 +16,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 92a8a2833..995d3d9ad 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "implementation.h" @@ -22,7 +22,6 @@ #include "selection.h" #include "desktop.h" -#include "ui/view/view.h" namespace Inkscape { namespace Extension { diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp index 85ae9efde..373378d97 100644 --- a/src/extension/implementation/xslt.cpp +++ b/src/extension/implementation/xslt.cpp @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "file.h" @@ -22,13 +22,11 @@ #include "../output.h" #include "extension/input.h" -#include "xml/repr.h" #include "io/sys.h" #include #include #include "document.h" -#include #include #include diff --git a/src/extension/input.cpp b/src/extension/input.cpp index 5cef38009..2ba48ffda 100644 --- a/src/extension/input.cpp +++ b/src/extension/input.cpp @@ -8,14 +8,12 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" #endif #include "prefdialog.h" #include "implementation/implementation.h" #include "timer.h" #include "input.h" -#include "io/sys.h" /* Inkscape::Extension::Input */ diff --git a/src/extension/loader.cpp b/src/extension/loader.cpp index 863a176ca..3bea0e1e6 100644 --- a/src/extension/loader.cpp +++ b/src/extension/loader.cpp @@ -11,7 +11,6 @@ #include "loader.h" #include "system.h" -#include #include #include "dependency.h" #include "inkscape-version.h" diff --git a/src/extension/loader.h b/src/extension/loader.h index 0d3a69061..cd362f87b 100644 --- a/src/extension/loader.h +++ b/src/extension/loader.h @@ -1,4 +1,5 @@ -/** @file +/** @file#include + * Loader for external plug-ins. *//* * diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp index bedab7fd8..e30ec97df 100644 --- a/src/extension/patheffect.cpp +++ b/src/extension/patheffect.cpp @@ -8,7 +8,6 @@ */ #include "document-private.h" -#include "sp-object.h" #include "patheffect.h" #include "db.h" diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 3c623455a..9d7d5fbc9 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -17,12 +17,10 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "ui/interface.h" -#include -#include #include "system.h" #include "preferences.h" -- cgit v1.2.3 From cebbe5b970cba85a5e21f8347f0a20e78351d394 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 28 Jul 2016 11:22:07 +0100 Subject: extensions: Drop GTKMM2 fallbacks (bzr r15023.2.5) --- src/extension/error-file.cpp | 6 +---- src/extension/extension.cpp | 22 ++-------------- src/extension/extension.h | 9 ------- src/extension/implementation/script.cpp | 6 +---- src/extension/internal/cdr-input.cpp | 11 +------- src/extension/internal/pdfinput/pdf-input.cpp | 36 +-------------------------- src/extension/internal/pdfinput/pdf-input.h | 15 +---------- src/extension/internal/vsd-input.cpp | 12 +-------- src/extension/param/bool.cpp | 6 +---- src/extension/param/float.cpp | 12 ++------- src/extension/param/int.cpp | 13 ++-------- src/extension/param/notebook.cpp | 8 ------ src/extension/param/radiobutton.cpp | 9 ++----- src/extension/prefdialog.cpp | 27 +------------------- 14 files changed, 16 insertions(+), 176 deletions(-) (limited to 'src/extension') diff --git a/src/extension/error-file.cpp b/src/extension/error-file.cpp index db354c0ce..467ff95be 100644 --- a/src/extension/error-file.cpp +++ b/src/extension/error-file.cpp @@ -56,11 +56,7 @@ ErrorFileNotice::ErrorFileNotice (void) : g_free(ext_error_file); set_message(dialog_text, true); -#if WITH_GTKMM_3_0 - Gtk::Box * vbox = get_content_area(); -#else - Gtk::Box * vbox = get_vbox(); -#endif + auto vbox = get_content_area(); /* This is some filler text, needs to change before relase */ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 6f7539360..5d150b703 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -22,12 +22,7 @@ #include #include #include - -#if WITH_GTKMM_3_0 -# include -#else -# include -#endif +#include #include #include "inkscape.h" @@ -766,11 +761,7 @@ Extension::get_info_widget(void) Gtk::Frame * info = Gtk::manage(new Gtk::Frame("General Extension Information")); retval->pack_start(*info, true, true, 5); -#if WITH_GTKMM_3_0 - Gtk::Grid * table = Gtk::manage(new Gtk::Grid()); -#else - Gtk::Table * table = Gtk::manage(new Gtk::Table()); -#endif + auto table = Gtk::manage(new Gtk::Grid()); info->add(*table); @@ -784,11 +775,7 @@ Extension::get_info_widget(void) return retval; } -#if WITH_GTKMM_3_0 void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Grid * table, int * row) -#else -void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * table, int * row) -#endif { Gtk::Label * label; Gtk::Label * value; @@ -797,13 +784,8 @@ void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Tab label = Gtk::manage(new Gtk::Label(labelstr)); value = Gtk::manage(new Gtk::Label(valuestr)); -#if WITH_GTKMM_3_0 table->attach(*label, 0, (*row) - 1, 1, 1); table->attach(*value, 1, (*row) - 1, 1, 1); -#else - table->attach(*label, 0, 1, (*row) - 1, *row); - table->attach(*value, 1, 2, (*row) - 1, *row); -#endif label->show(); value->show(); diff --git a/src/extension/extension.h b/src/extension/extension.h index 1fb8bdfec..cd29e1636 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -22,12 +22,7 @@ #include namespace Gtk { -#if WITH_GTKMM_3_0 class Grid; -#else - class Table; -#endif - class VBox; class Widget; } @@ -300,11 +295,7 @@ public: Gtk::VBox * get_help_widget(void); Gtk::VBox * get_params_widget(void); protected: -#if WITH_GTKMM_3_0 inline static void add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Grid * table, int * row); -#else - inline static void add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * table, int * row); -#endif }; diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 01323bee2..72a189c3f 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -942,11 +942,7 @@ void Script::checkStderr (const Glib::ustring &data, GtkWidget *dlg = GTK_WIDGET(warning.gobj()); sp_transientize(dlg); -#if WITH_GTKMM_3_0 - Gtk::Box * vbox = warning.get_content_area(); -#else - Gtk::Box * vbox = warning.get_vbox(); -#endif + auto vbox = warning.get_content_area(); /* Gtk::TextView * textview = new Gtk::TextView(Gtk::TextBuffer::create()); */ Gtk::TextView * textview = new Gtk::TextView(); diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index a26af2078..b94b6d019 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -111,11 +111,7 @@ CdrImportDialog::CdrImportDialog(const std::vector &vec) _previewArea = Gtk::manage(new class Gtk::VBox()); vbox1 = Gtk::manage(new class Gtk::VBox()); vbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 0); -#if WITH_GTKMM_3_0 this->get_content_area()->pack_start(*vbox1); -#else - this->get_vbox()->pack_start(*vbox1); -#endif // CONTROLS @@ -137,13 +133,8 @@ CdrImportDialog::CdrImportDialog(const std::vector &vec) g_free(label_text); // Adjustment + spinner -#if WITH_GTKMM_3_0 - Glib::RefPtr _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0); + auto _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0); _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(_pageNumberSpin_adj, 1, 0)); -#else - Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(new class Gtk::Adjustment(1, 1, _vec.size(), 1, 10, 0)); - _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(*_pageNumberSpin_adj, 1, 0)); -#endif _pageNumberSpin->set_can_focus(); _pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS); _pageNumberSpin->set_numeric(true); diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index c1940b16a..0c22fa399 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -39,10 +39,8 @@ #include #include -#if WITH_GTKMM_3_0 #include #include -#endif #include "extension/system.h" #include "extension/input.h" @@ -92,14 +90,8 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:"))); // Page number -#if WITH_GTKMM_3_0 - Glib::RefPtr _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _pdf_doc->getNumPages(), 1, 10, 0); + auto _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _pdf_doc->getNumPages(), 1, 10, 0); _pageNumberSpin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(_pageNumberSpin_adj, 1, 1)); -#else - Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage( - new class Gtk::Adjustment(1, 1, _pdf_doc->getNumPages(), 1, 10, 0)); - _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1)); -#endif _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 @@ -137,13 +129,8 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _labelViaInternal = Gtk::manage(new class Gtk::Label(_("Import via internal (Poppler derived) library. Text is stored as text but white space is missing. Meshes are converted to tiles, the number depends on the precision set below."))); #endif -#if WITH_GTKMM_3_0 _fallbackPrecisionSlider_adj = Gtk::Adjustment::create(2, 1, 256, 1, 10, 10); _fallbackPrecisionSlider = Gtk::manage(new class Gtk::Scale(_fallbackPrecisionSlider_adj)); -#else - _fallbackPrecisionSlider_adj = Gtk::manage(new class Gtk::Adjustment(2, 1, 256, 1, 10, 10)); - _fallbackPrecisionSlider = Gtk::manage(new class Gtk::HScale(*_fallbackPrecisionSlider_adj)); -#endif _fallbackPrecisionSlider->set_value(2.0); _labelPrecisionComment = Gtk::manage(new class Gtk::Label(_("rough"))); hbox6 = Gtk::manage(new class Gtk::HBox(false, 4)); @@ -278,15 +265,9 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) hbox1->pack_start(*vbox1); hbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 4); -#if WITH_GTKMM_3_0 get_content_area()->set_homogeneous(false); get_content_area()->set_spacing(0); get_content_area()->pack_start(*hbox1); -#else - this->get_vbox()->set_homogeneous(false); - this->get_vbox()->set_spacing(0); - this->get_vbox()->pack_start(*hbox1); -#endif this->set_title(_("PDF Import Settings")); this->set_modal(true); @@ -300,12 +281,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) this->show_all(); // Connect signals -#if WITH_GTKMM_3_0 _previewArea->signal_draw().connect(sigc::mem_fun(*this, &PdfImportDialog::_onDraw)); -#else - _previewArea->signal_expose_event().connect(sigc::mem_fun(*this, &PdfImportDialog::_onExposePreview)); -#endif - _pageNumberSpin_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PdfImportDialog::_onPageNumberChanged)); _cropCheck->signal_toggled().connect(sigc::mem_fun(*this, &PdfImportDialog::_onToggleCropping)); _fallbackPrecisionSlider_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PdfImportDialog::_onPrecisionChanged)); @@ -527,16 +503,6 @@ static void copy_cairo_surface_to_pixbuf (cairo_surface_t *surface, #endif -/** - * \brief Updates the preview area with the previously rendered thumbnail - */ -#if !WITH_GTKMM_3_0 -bool PdfImportDialog::_onExposePreview(GdkEventExpose * /*event*/) { - Cairo::RefPtr cr = _previewArea->get_window()->create_cairo_context(); - return _onDraw(cr); -} -#endif - bool PdfImportDialog::_onDraw(const Cairo::RefPtr& cr) { // Check if we have a thumbnail at all if (!_thumb_data) { diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h index 6e36603c3..c338207c1 100644 --- a/src/extension/internal/pdfinput/pdf-input.h +++ b/src/extension/internal/pdfinput/pdf-input.h @@ -39,11 +39,7 @@ namespace Gtk { class DrawingArea; class Frame; class HBox; -#if WITH_GTKMM_3_0 class Scale; -#else - class HScale; -#endif class RadioButton; class VBox; class Label; @@ -79,10 +75,6 @@ private: void _setPreviewPage(int page); // Signal handlers -#if !WITH_GTKMM_3_0 - bool _onExposePreview(GdkEventExpose *event); -#endif - bool _onDraw(const Cairo::RefPtr& cr); void _onPageNumberChanged(); void _onToggleCropping(); @@ -110,13 +102,8 @@ private: class Gtk::RadioButton * _importViaInternal; // Use native (poppler based) importing class Gtk::Label * _labelViaInternal; #endif -#if WITH_GTKMM_3_0 - class Gtk::Scale * _fallbackPrecisionSlider; + Gtk::Scale * _fallbackPrecisionSlider; Glib::RefPtr _fallbackPrecisionSlider_adj; -#else - class Gtk::HScale * _fallbackPrecisionSlider; - class Gtk::Adjustment *_fallbackPrecisionSlider_adj; -#endif class Gtk::Label * _labelPrecisionComment; class Gtk::HBox * hbox6; class Gtk::Label * _labelText; diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index a3d4aad37..2de2d0ec6 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -113,12 +113,7 @@ VsdImportDialog::VsdImportDialog(const std::vector &vec) _previewArea = Gtk::manage(new class Gtk::VBox()); vbox1 = Gtk::manage(new class Gtk::VBox()); vbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 0); -#if WITH_GTKMM_3_0 this->get_content_area()->pack_start(*vbox1); -#else - this->get_vbox()->pack_start(*vbox1); -#endif - // CONTROLS @@ -140,13 +135,8 @@ VsdImportDialog::VsdImportDialog(const std::vector &vec) g_free(label_text); // Adjustment + spinner -#if WITH_GTKMM_3_0 - Glib::RefPtr _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0); + auto _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0); _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(_pageNumberSpin_adj, 1, 0)); -#else - Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(new class Gtk::Adjustment(1, 1, _vec.size(), 1, 10, 0)); - _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(*_pageNumberSpin_adj, 1, 0)); -#endif _pageNumberSpin->set_can_focus(); _pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS); _pageNumberSpin->set_numeric(true); diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index d64f798ba..e67d3e3f5 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -129,12 +129,8 @@ Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node, return NULL; } -#if WITH_GTKMM_3_0 - Gtk::Box * hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); + auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); hbox->set_homogeneous(false); -#else - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); -#endif Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); label->show(); diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index dff7cbf46..d4c33ec94 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -176,12 +176,8 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); -#if WITH_GTKMM_3_0 - ParamFloatAdjustment * pfa = new ParamFloatAdjustment(this, doc, node, changeSignal); + auto pfa = new ParamFloatAdjustment(this, doc, node, changeSignal); Glib::RefPtr fadjust(pfa); -#else - ParamFloatAdjustment * fadjust = Gtk::manage(new ParamFloatAdjustment(this, doc, node, changeSignal)); -#endif if (_mode == FULL) { @@ -197,11 +193,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod label->show(); hbox->pack_start(*label, true, true, _indent); -#if WITH_GTKMM_3_0 - Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 0.1, _precision)); -#else - Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(*fadjust, 0.1, _precision)); -#endif + auto 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 dda801282..533ee3886 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -157,13 +157,8 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - -#if WITH_GTKMM_3_0 - ParamIntAdjustment * pia = new ParamIntAdjustment(this, doc, node, changeSignal); + auto pia = new ParamIntAdjustment(this, doc, node, changeSignal); Glib::RefPtr fadjust(pia); -#else - ParamIntAdjustment * fadjust = Gtk::manage(new ParamIntAdjustment(this, doc, node, changeSignal)); -#endif if (_mode == FULL) { @@ -178,11 +173,7 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal label->show(); hbox->pack_start(*label, true, true, _indent); -#if WITH_GTKMM_3_0 - Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 1.0, 0)); -#else - Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(*fadjust, 1.0, 0)); -#endif + auto 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/notebook.cpp b/src/extension/param/notebook.cpp index 20c8e8481..957d12d06 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -353,11 +353,7 @@ public: // hook function this->signal_switch_page().connect(sigc::mem_fun(this, &ParamNotebookWdg::changed_page)); }; -#if WITH_GTKMM_3_0 void changed_page(Gtk::Widget *page, guint pagenum); -#else - void changed_page(GtkNotebookPage *page, guint pagenum); -#endif bool activated; }; @@ -368,11 +364,7 @@ public: * is actually visible. This to exclude 'fake' changes when the * notebookpages are added or removed. */ -#if WITH_GTKMM_3_0 void ParamNotebookWdg::changed_page(Gtk::Widget * /*page*/, guint pagenum) -#else -void ParamNotebookWdg::changed_page(GtkNotebookPage * /*page*/, guint pagenum) -#endif { if (get_visible()) { _pref->set((int)pagenum, _doc, _node); diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 1d1b860c6..ed28c0d75 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -303,15 +303,10 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node return NULL; } -#if WITH_GTKMM_3_0 - Gtk::Box * hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); + auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); hbox->set_homogeneous(false); - Gtk::Box * vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0)); + auto vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0)); vbox->set_homogeneous(false); -#else - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox(false, 0)); -#endif Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START, Gtk::ALIGN_START)); label->show(); diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index 2521dc1de..1ca590e85 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -41,11 +41,7 @@ namespace Extension { them. It also places the passed-in widgets into the dialog. */ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * controls, Effect * effect) : -#if WITH_GTKMM_3_0 Gtk::Dialog(_(name.c_str()), true), -#else - Gtk::Dialog(_(name.c_str()), true, true), -#endif _help(help), _name(name), _button_ok(NULL), @@ -68,11 +64,7 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co hbox->pack_start(*controls, true, true, 6); hbox->show(); -#if WITH_GTKMM_3_0 this->get_content_area()->pack_start(*hbox, true, true, 6); -#else - this->get_vbox()->pack_start(*hbox, true, true, 6); -#endif /* Gtk::Button * help_button = add_button(Gtk::Stock::HELP, Gtk::RESPONSE_HELP); @@ -97,19 +89,10 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co _param_preview = Parameter::make(doc->root(), _effect); } -#if WITH_GTKMM_3_0 - Gtk::Separator * sep = Gtk::manage(new Gtk::Separator()); -#else - Gtk::HSeparator * sep = Gtk::manage(new Gtk::HSeparator()); -#endif - + auto sep = Gtk::manage(new Gtk::Separator()); sep->show(); -#if WITH_GTKMM_3_0 this->get_content_area()->pack_start(*sep, true, true, 4); -#else - this->get_vbox()->pack_start(*sep, true, true, 4); -#endif hbox = Gtk::manage(new Gtk::HBox()); _button_preview = _param_preview->get_widget(NULL, NULL, &_signal_preview); @@ -117,19 +100,11 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co hbox->pack_start(*_button_preview, true, true,6); hbox->show(); -#if WITH_GTKMM_3_0 this->get_content_area()->pack_start(*hbox, true, true, 6); -#else - this->get_vbox()->pack_start(*hbox, true, true, 6); -#endif Gtk::Box * hbox = dynamic_cast(_button_preview); if (hbox != NULL) { -#if WITH_GTKMM_3_0 _checkbox_preview = dynamic_cast(hbox->get_children().front()); -#else - _checkbox_preview = dynamic_cast(hbox->children().back().get_widget()); -#endif } preview_toggle(); -- cgit v1.2.3 From 96b9bde181430fc6d34f05cda90539acc0edfb89 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:07:49 +0200 Subject: Fixed failed build (bzr r15026) --- src/extension/system.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 9d7d5fbc9..df9e967bc 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -38,7 +38,7 @@ #include "inkscape.h" #include "document-undo.h" #include "loader.h" - +#include namespace Inkscape { namespace Extension { -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/extension/db.cpp | 2 +- src/extension/dependency.cpp | 4 +++- src/extension/effect.cpp | 1 + src/extension/error-file.cpp | 2 +- src/extension/execution-env.cpp | 5 ++++- src/extension/extension.cpp | 2 +- src/extension/implementation/implementation.cpp | 3 ++- src/extension/implementation/xslt.cpp | 4 +++- src/extension/input.cpp | 2 ++ src/extension/loader.cpp | 1 + src/extension/loader.h | 3 +-- src/extension/patheffect.cpp | 1 + src/extension/system.cpp | 6 ++++-- 13 files changed, 25 insertions(+), 11 deletions(-) (limited to 'src/extension') diff --git a/src/extension/db.cpp b/src/extension/db.cpp index f17b784a9..a3c54915d 100644 --- a/src/extension/db.cpp +++ b/src/extension/db.cpp @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "db.h" #include "input.h" diff --git a/src/extension/dependency.cpp b/src/extension/dependency.cpp index 837520381..624be12f9 100644 --- a/src/extension/dependency.cpp +++ b/src/extension/dependency.cpp @@ -9,12 +9,14 @@ */ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include #include #include +#include "config.h" +#include "path-prefix.h" #include "dependency.h" #include "db.h" #include "extension.h" diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index ef254f623..e7299ba51 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -13,6 +13,7 @@ #include "helper/action.h" #include "ui/view/view.h" +#include "selection.h" #include "sp-namedview.h" #include "desktop.h" #include "implementation/implementation.h" diff --git a/src/extension/error-file.cpp b/src/extension/error-file.cpp index 9ec643759..db354c0ce 100644 --- a/src/extension/error-file.cpp +++ b/src/extension/error-file.cpp @@ -9,7 +9,7 @@ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include "ui/dialog/extensions.h" diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 569e2c762..d5c80f26e 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -8,8 +8,10 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#ifdef HAVE_CONFIG_H #include + +#ifdef HAVE_CONFIG_H +# include #endif #include "gtkmm/messagedialog.h" @@ -23,6 +25,7 @@ #include "document.h" #include "document-undo.h" #include "desktop.h" +#include "ui/view/view.h" #include "sp-namedview.h" #include "display/sp-canvas.h" diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 56ff0a5f4..6f7539360 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -16,7 +16,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 995d3d9ad..92a8a2833 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "implementation.h" @@ -22,6 +22,7 @@ #include "selection.h" #include "desktop.h" +#include "ui/view/view.h" namespace Inkscape { namespace Extension { diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp index 373378d97..85ae9efde 100644 --- a/src/extension/implementation/xslt.cpp +++ b/src/extension/implementation/xslt.cpp @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "file.h" @@ -22,11 +22,13 @@ #include "../output.h" #include "extension/input.h" +#include "xml/repr.h" #include "io/sys.h" #include #include #include "document.h" +#include #include #include diff --git a/src/extension/input.cpp b/src/extension/input.cpp index 2ba48ffda..5cef38009 100644 --- a/src/extension/input.cpp +++ b/src/extension/input.cpp @@ -8,12 +8,14 @@ */ #ifdef HAVE_CONFIG_H +# include "config.h" #endif #include "prefdialog.h" #include "implementation/implementation.h" #include "timer.h" #include "input.h" +#include "io/sys.h" /* Inkscape::Extension::Input */ diff --git a/src/extension/loader.cpp b/src/extension/loader.cpp index 3bea0e1e6..863a176ca 100644 --- a/src/extension/loader.cpp +++ b/src/extension/loader.cpp @@ -11,6 +11,7 @@ #include "loader.h" #include "system.h" +#include #include #include "dependency.h" #include "inkscape-version.h" diff --git a/src/extension/loader.h b/src/extension/loader.h index cd362f87b..0d3a69061 100644 --- a/src/extension/loader.h +++ b/src/extension/loader.h @@ -1,5 +1,4 @@ -/** @file#include - +/** @file * Loader for external plug-ins. *//* * diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp index e30ec97df..bedab7fd8 100644 --- a/src/extension/patheffect.cpp +++ b/src/extension/patheffect.cpp @@ -8,6 +8,7 @@ */ #include "document-private.h" +#include "sp-object.h" #include "patheffect.h" #include "db.h" diff --git a/src/extension/system.cpp b/src/extension/system.cpp index df9e967bc..3c623455a 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -17,10 +17,12 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "ui/interface.h" +#include +#include #include "system.h" #include "preferences.h" @@ -38,7 +40,7 @@ #include "inkscape.h" #include "document-undo.h" #include "loader.h" -#include + namespace Inkscape { namespace Extension { -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/extension/db.cpp | 2 +- src/extension/dependency.cpp | 4 +--- src/extension/effect.cpp | 1 - src/extension/error-file.cpp | 2 +- src/extension/execution-env.cpp | 5 +---- src/extension/extension.cpp | 2 +- src/extension/implementation/implementation.cpp | 3 +-- src/extension/implementation/xslt.cpp | 4 +--- src/extension/input.cpp | 2 -- src/extension/loader.cpp | 1 - src/extension/loader.h | 3 ++- src/extension/patheffect.cpp | 1 - src/extension/system.cpp | 5 ++--- 13 files changed, 11 insertions(+), 24 deletions(-) (limited to 'src/extension') diff --git a/src/extension/db.cpp b/src/extension/db.cpp index a3c54915d..f17b784a9 100644 --- a/src/extension/db.cpp +++ b/src/extension/db.cpp @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "db.h" #include "input.h" diff --git a/src/extension/dependency.cpp b/src/extension/dependency.cpp index 624be12f9..837520381 100644 --- a/src/extension/dependency.cpp +++ b/src/extension/dependency.cpp @@ -9,14 +9,12 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include #include #include -#include "config.h" -#include "path-prefix.h" #include "dependency.h" #include "db.h" #include "extension.h" diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index e7299ba51..ef254f623 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -13,7 +13,6 @@ #include "helper/action.h" #include "ui/view/view.h" -#include "selection.h" #include "sp-namedview.h" #include "desktop.h" #include "implementation/implementation.h" diff --git a/src/extension/error-file.cpp b/src/extension/error-file.cpp index db354c0ce..9ec643759 100644 --- a/src/extension/error-file.cpp +++ b/src/extension/error-file.cpp @@ -9,7 +9,7 @@ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include "ui/dialog/extensions.h" diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index d5c80f26e..569e2c762 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -8,10 +8,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include - #ifdef HAVE_CONFIG_H -# include +#include #endif #include "gtkmm/messagedialog.h" @@ -25,7 +23,6 @@ #include "document.h" #include "document-undo.h" #include "desktop.h" -#include "ui/view/view.h" #include "sp-namedview.h" #include "display/sp-canvas.h" diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 6f7539360..56ff0a5f4 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -16,7 +16,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 92a8a2833..995d3d9ad 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "implementation.h" @@ -22,7 +22,6 @@ #include "selection.h" #include "desktop.h" -#include "ui/view/view.h" namespace Inkscape { namespace Extension { diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp index 85ae9efde..373378d97 100644 --- a/src/extension/implementation/xslt.cpp +++ b/src/extension/implementation/xslt.cpp @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "file.h" @@ -22,13 +22,11 @@ #include "../output.h" #include "extension/input.h" -#include "xml/repr.h" #include "io/sys.h" #include #include #include "document.h" -#include #include #include diff --git a/src/extension/input.cpp b/src/extension/input.cpp index 5cef38009..2ba48ffda 100644 --- a/src/extension/input.cpp +++ b/src/extension/input.cpp @@ -8,14 +8,12 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" #endif #include "prefdialog.h" #include "implementation/implementation.h" #include "timer.h" #include "input.h" -#include "io/sys.h" /* Inkscape::Extension::Input */ diff --git a/src/extension/loader.cpp b/src/extension/loader.cpp index 863a176ca..3bea0e1e6 100644 --- a/src/extension/loader.cpp +++ b/src/extension/loader.cpp @@ -11,7 +11,6 @@ #include "loader.h" #include "system.h" -#include #include #include "dependency.h" #include "inkscape-version.h" diff --git a/src/extension/loader.h b/src/extension/loader.h index 0d3a69061..cd362f87b 100644 --- a/src/extension/loader.h +++ b/src/extension/loader.h @@ -1,4 +1,5 @@ -/** @file +/** @file#include + * Loader for external plug-ins. *//* * diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp index bedab7fd8..e30ec97df 100644 --- a/src/extension/patheffect.cpp +++ b/src/extension/patheffect.cpp @@ -8,7 +8,6 @@ */ #include "document-private.h" -#include "sp-object.h" #include "patheffect.h" #include "db.h" diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 3c623455a..afa8346df 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -17,12 +17,10 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "ui/interface.h" -#include -#include #include "system.h" #include "preferences.h" @@ -41,6 +39,7 @@ #include "document-undo.h" #include "loader.h" +#include namespace Inkscape { namespace Extension { -- cgit v1.2.3 From 4af5b7293e6b4ec6bb945aa4be6014060091c356 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Wed, 3 Aug 2016 16:12:14 +0100 Subject: Fix broken headers (bzr r15035) --- src/extension/loader.cpp | 3 +++ src/extension/loader.h | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/extension') diff --git a/src/extension/loader.cpp b/src/extension/loader.cpp index 3bea0e1e6..164a5cecf 100644 --- a/src/extension/loader.cpp +++ b/src/extension/loader.cpp @@ -10,6 +10,9 @@ */ #include "loader.h" + +#include + #include "system.h" #include #include "dependency.h" diff --git a/src/extension/loader.h b/src/extension/loader.h index cd362f87b..0eecc02b9 100644 --- a/src/extension/loader.h +++ b/src/extension/loader.h @@ -1,5 +1,4 @@ -/** @file#include - +/** @file * Loader for external plug-ins. *//* * @@ -15,8 +14,6 @@ #define INKSCAPE_EXTENSION_LOADER_H_ #include "extension.h" -#include "implementation/implementation.h" -#include namespace Inkscape { -- cgit v1.2.3 From e471a664f923f517b68071f2e33fbb6ce070f8b7 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 8 Aug 2016 13:56:40 +0100 Subject: Remove deprecated Autotools and btool files. Please use CMake instead (bzr r15046) --- src/extension/Makefile_insert | 54 --------- src/extension/dbus/Makefile_insert | 111 ----------------- src/extension/implementation/Makefile_insert | 9 -- src/extension/internal/Makefile_insert | 173 --------------------------- 4 files changed, 347 deletions(-) delete mode 100644 src/extension/Makefile_insert delete mode 100644 src/extension/dbus/Makefile_insert delete mode 100644 src/extension/implementation/Makefile_insert delete mode 100644 src/extension/internal/Makefile_insert (limited to 'src/extension') diff --git a/src/extension/Makefile_insert b/src/extension/Makefile_insert deleted file mode 100644 index fb9713904..000000000 --- a/src/extension/Makefile_insert +++ /dev/null @@ -1,54 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - extension/extension.cpp \ - extension/extension.h \ - extension/db.cpp \ - extension/db.h \ - extension/dependency.cpp \ - extension/dependency.h \ - extension/error-file.cpp \ - extension/error-file.h \ - extension/execution-env.cpp \ - extension/execution-env.h \ - extension/init.cpp \ - extension/init.h \ - extension/loader.h \ - extension/loader.cpp \ - extension/param/parameter.h \ - extension/param/parameter.cpp \ - extension/param/notebook.h \ - extension/param/notebook.cpp \ - extension/param/bool.h \ - extension/param/bool.cpp \ - extension/param/color.h \ - extension/param/color.cpp \ - extension/param/description.h \ - extension/param/description.cpp \ - extension/param/enum.h \ - extension/param/enum.cpp \ - extension/param/float.h \ - extension/param/float.cpp \ - extension/param/int.h \ - extension/param/int.cpp \ - extension/param/radiobutton.h \ - extension/param/radiobutton.cpp \ - extension/param/string.h \ - extension/param/string.cpp \ - extension/prefdialog.cpp \ - extension/prefdialog.h \ - extension/system.cpp \ - extension/system.h \ - extension/timer.cpp \ - extension/timer.h \ - extension/input.h \ - extension/input.cpp \ - extension/output.h \ - extension/output.cpp \ - extension/effect.h \ - extension/effect.cpp \ - extension/patheffect.h \ - extension/patheffect.cpp \ - extension/print.h \ - extension/print.cpp - diff --git a/src/extension/dbus/Makefile_insert b/src/extension/dbus/Makefile_insert deleted file mode 100644 index 192651d87..000000000 --- a/src/extension/dbus/Makefile_insert +++ /dev/null @@ -1,111 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -if WITH_DBUS - -############################# -# Sources for DBus interface -############################# - -ink_common_sources += \ - extension/dbus/dbus-init.cpp \ - extension/dbus/dbus-init.h \ - extension/dbus/application-interface.cpp \ - extension/dbus/application-interface.h \ - extension/dbus/document-interface.cpp \ - extension/dbus/document-interface.h \ - extension/dbus/org.inkscape.service.in - -########################### -# Build DBus wrapper files -########################### - -extension/dbus/application-server-glue.h: extension/dbus/application-interface.xml - dbus-binding-tool --mode=glib-server --output=$@ --prefix=application_interface $^ - -extension/dbus/document-server-glue.h: extension/dbus/document-interface.xml - dbus-binding-tool --mode=glib-server --output=$@ --prefix=document_interface $^ - -extension/dbus/document-client-glue.h: extension/dbus/document-interface.xml - dbus-binding-tool --mode=glib-client --output=$@ --prefix=document_interface $^ - -BUILT_SOURCES += \ - extension/dbus/application-server-glue.h \ - extension/dbus/document-server-glue.h \ - extension/dbus/document-client-glue.h - -########################### -# Distribut DBus interface -########################### - -EXTRA_DIST += \ - extension/dbus/application-interface.xml \ - extension/dbus/document-interface.xml - -########################### -# DBus Activation Service -########################### - -# Dbus service file -servicedir = $(DBUSSERVICEDIR) -service_in_files = extension/dbus/org.inkscape.service.in -service_DATA = $(service_in_files:.service.in=.service) - -# Rule to make the service file with bindir expanded -$(service_DATA): $(service_in_files) Makefile - @sed -e "s|bindir|$(prefix)|" $<> $@ - -############################ -# DBus Interface Helper Lib -############################ - -lib_LTLIBRARIES = \ - libinkdbus.la - -libinkdbusincludedir = $(includedir)/libinkdbus-0.48/libinkdbus -libinkdbusinclude_HEADERS = \ - extension/dbus/wrapper/inkscape-dbus-wrapper.h - -libinkdbus_la_SOURCES = \ - extension/dbus/wrapper/inkscape-dbus-wrapper.h \ - extension/dbus/wrapper/inkscape-dbus-wrapper.c - -libinkdbus_la_LDFLAGS = \ - -version-info 0:0:0 \ - -no-undefined \ - -export-symbols-regex "^[^_d].*" - -libinkdbus_la_CFLAGS = \ - $(DBUS_CFLAGS) \ - $(INKSCAPE_CFLAGS) \ - -I$(builddir)/extension/dbus \ - -Wall - -libinkdbus_la_LIBADD = \ - $(DBUS_LIBS) \ - $(INKSCAPE_LIBS) - -############################ -# DBus Pkgconfig file -############################ - -pkgconfig_DATA = extension/dbus/wrapper/inkdbus.pc -pkgconfigdir = $(libdir)/pkgconfig - -else # WITH_DBUS - -EXTRA_DIST += \ - extension/dbus/dbus-init.cpp \ - extension/dbus/dbus-init.h \ - extension/dbus/application-interface.cpp \ - extension/dbus/application-interface.h \ - extension/dbus/document-interface.cpp \ - extension/dbus/document-interface.h \ - extension/dbus/wrapper/inkscape-dbus-wrapper.h \ - extension/dbus/wrapper/inkscape-dbus-wrapper.c \ - extension/dbus/wrapper/inkdbus.pc \ - extension/dbus/org.inkscape.service.in \ - extension/dbus/application-interface.xml \ - extension/dbus/document-interface.xml - -endif - diff --git a/src/extension/implementation/Makefile_insert b/src/extension/implementation/Makefile_insert deleted file mode 100644 index 1b9080f1a..000000000 --- a/src/extension/implementation/Makefile_insert +++ /dev/null @@ -1,9 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - extension/implementation/implementation.cpp \ - extension/implementation/implementation.h \ - extension/implementation/script.cpp \ - extension/implementation/script.h \ - extension/implementation/xslt.cpp \ - extension/implementation/xslt.h diff --git a/src/extension/internal/Makefile_insert b/src/extension/internal/Makefile_insert deleted file mode 100644 index 125776d41..000000000 --- a/src/extension/internal/Makefile_insert +++ /dev/null @@ -1,173 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -if WITH_LIBWPG -ink_common_sources += \ - extension/internal/wpg-input.cpp \ - extension/internal/wpg-input.h -endif - -if WITH_LIBVISIO -ink_common_sources += \ - extension/internal/vsd-input.cpp \ - extension/internal/vsd-input.h -endif - -if WITH_LIBCDR -ink_common_sources += \ - extension/internal/cdr-input.cpp \ - extension/internal/cdr-input.h -endif - -if USE_IMAGE_MAGICK -ink_common_sources += \ - extension/internal/bitmap/imagemagick.cpp \ - extension/internal/bitmap/imagemagick.h \ - extension/internal/bitmap/adaptiveThreshold.cpp \ - extension/internal/bitmap/adaptiveThreshold.h \ - extension/internal/bitmap/addNoise.cpp \ - extension/internal/bitmap/addNoise.h \ - extension/internal/bitmap/blur.cpp \ - extension/internal/bitmap/blur.h \ - extension/internal/bitmap/channel.cpp \ - extension/internal/bitmap/channel.h \ - extension/internal/bitmap/charcoal.cpp \ - extension/internal/bitmap/charcoal.h \ - extension/internal/bitmap/colorize.cpp \ - extension/internal/bitmap/colorize.h \ - extension/internal/bitmap/contrast.cpp \ - extension/internal/bitmap/contrast.h \ - extension/internal/bitmap/crop.cpp \ - extension/internal/bitmap/crop.h \ - extension/internal/bitmap/cycleColormap.cpp \ - extension/internal/bitmap/cycleColormap.h \ - extension/internal/bitmap/despeckle.cpp \ - extension/internal/bitmap/despeckle.h \ - extension/internal/bitmap/edge.cpp \ - extension/internal/bitmap/edge.h \ - extension/internal/bitmap/emboss.cpp \ - extension/internal/bitmap/emboss.h \ - extension/internal/bitmap/enhance.cpp \ - extension/internal/bitmap/enhance.h \ - extension/internal/bitmap/equalize.cpp \ - extension/internal/bitmap/equalize.h \ - extension/internal/bitmap/gaussianBlur.cpp \ - extension/internal/bitmap/gaussianBlur.h \ - extension/internal/bitmap/implode.cpp \ - extension/internal/bitmap/implode.h \ - extension/internal/bitmap/level.cpp \ - extension/internal/bitmap/level.h \ - extension/internal/bitmap/levelChannel.cpp \ - extension/internal/bitmap/levelChannel.h \ - extension/internal/bitmap/medianFilter.cpp \ - extension/internal/bitmap/medianFilter.h \ - extension/internal/bitmap/modulate.cpp \ - extension/internal/bitmap/modulate.h \ - extension/internal/bitmap/negate.cpp \ - extension/internal/bitmap/negate.h \ - extension/internal/bitmap/normalize.cpp \ - extension/internal/bitmap/normalize.h \ - extension/internal/bitmap/oilPaint.cpp \ - extension/internal/bitmap/oilPaint.h \ - extension/internal/bitmap/opacity.cpp \ - extension/internal/bitmap/opacity.h \ - extension/internal/bitmap/raise.cpp \ - extension/internal/bitmap/raise.h \ - extension/internal/bitmap/reduceNoise.cpp \ - extension/internal/bitmap/reduceNoise.h \ - extension/internal/bitmap/sample.cpp \ - extension/internal/bitmap/sample.h \ - extension/internal/bitmap/shade.cpp \ - extension/internal/bitmap/shade.h \ - extension/internal/bitmap/sharpen.cpp \ - extension/internal/bitmap/sharpen.h \ - extension/internal/bitmap/solarize.cpp \ - extension/internal/bitmap/solarize.h \ - extension/internal/bitmap/spread.cpp \ - extension/internal/bitmap/spread.h \ - extension/internal/bitmap/swirl.cpp \ - extension/internal/bitmap/swirl.h \ - extension/internal/bitmap/threshold.cpp \ - extension/internal/bitmap/threshold.h \ - extension/internal/bitmap/unsharpmask.cpp \ - extension/internal/bitmap/unsharpmask.h \ - extension/internal/bitmap/wave.cpp \ - extension/internal/bitmap/wave.h -endif - -ink_common_sources += \ - extension/internal/bluredge.h \ - extension/internal/bluredge.cpp \ - extension/internal/clear-n_.h \ - extension/internal/grid.h \ - extension/internal/grid.cpp \ - extension/internal/gimpgrad.h \ - extension/internal/gimpgrad.cpp \ - extension/internal/svg.h \ - extension/internal/svg.cpp \ - extension/internal/svgz.h \ - extension/internal/svgz.cpp \ - extension/internal/cairo-ps-out.h \ - extension/internal/cairo-ps-out.cpp \ - extension/internal/cairo-render-context.h \ - extension/internal/cairo-render-context.cpp \ - extension/internal/cairo-renderer.h \ - extension/internal/cairo-renderer.cpp \ - extension/internal/cairo-renderer-pdf-out.h \ - extension/internal/cairo-renderer-pdf-out.cpp \ - extension/internal/cairo-png-out.h \ - extension/internal/cairo-png-out.cpp \ - extension/internal/javafx-out.cpp \ - extension/internal/javafx-out.h \ - extension/internal/gdkpixbuf-input.h \ - extension/internal/gdkpixbuf-input.cpp \ - extension/internal/latex-text-renderer.h \ - extension/internal/latex-text-renderer.cpp \ - extension/internal/pdfinput/svg-builder.h \ - extension/internal/pdfinput/svg-builder.cpp \ - extension/internal/pdfinput/pdf-parser.h \ - extension/internal/pdfinput/pdf-parser.cpp \ - extension/internal/pdfinput/pdf-input.h \ - extension/internal/pdfinput/pdf-input.cpp \ - extension/internal/pov-out.cpp \ - extension/internal/pov-out.h \ - extension/internal/odf.cpp \ - extension/internal/odf.h \ - extension/internal/latex-pstricks.cpp \ - extension/internal/latex-pstricks.h \ - extension/internal/latex-pstricks-out.cpp \ - extension/internal/latex-pstricks-out.h \ - extension/internal/filter/bevels.h \ - extension/internal/filter/blurs.h \ - extension/internal/filter/bumps.h \ - extension/internal/filter/color.h \ - extension/internal/filter/distort.h \ - extension/internal/filter/filter.h \ - extension/internal/filter/image.h \ - extension/internal/filter/morphology.h \ - extension/internal/filter/overlays.h \ - extension/internal/filter/paint.h \ - extension/internal/filter/protrusions.h \ - extension/internal/filter/shadows.h \ - extension/internal/filter/textures.h \ - extension/internal/filter/transparency.h \ - extension/internal/filter/filter-all.cpp \ - extension/internal/filter/filter-file.cpp \ - extension/internal/filter/filter.cpp \ - extension/internal/filter/filter.h \ - extension/internal/text_reassemble.c \ - extension/internal/text_reassemble.h \ - extension/internal/emf-print.h \ - extension/internal/emf-print.cpp \ - extension/internal/emf-inout.h \ - extension/internal/emf-inout.cpp \ - extension/internal/metafile-inout.h \ - extension/internal/metafile-inout.cpp \ - extension/internal/metafile-print.h \ - extension/internal/metafile-print.cpp \ - extension/internal/wmf-print.h \ - extension/internal/wmf-print.cpp \ - extension/internal/wmf-inout.h \ - extension/internal/wmf-inout.cpp \ - extension/internal/image-resolution.h \ - extension/internal/image-resolution.cpp - -- cgit v1.2.3 From 2f53e4dbb4620edcabaffc964c55cb71090912f8 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 17 Aug 2016 09:39:43 +0200 Subject: Use M_PI, M_PI_2. We use these constants everywhere so if they are not defined we are already in trouble. No need to define them ourselves (except maybe in shared libraries). (bzr r15063) --- src/extension/dbus/document-interface.cpp | 2 +- src/extension/internal/odf.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src/extension') diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index 5a8fb0918..667830997 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -405,7 +405,7 @@ document_interface_polygon (DocumentInterface *doc_interface, int cx, int cy, int radius, int rotation, int sides, GError **error) { - gdouble rot = ((rotation / 180.0) * 3.14159265) - ( 3.14159265 / 2.0); + gdouble rot = ((rotation / 180.0) * M_PI) - M_PI_2; Inkscape::XML::Node *newNode = dbus_create_node(doc_interface->target.getDocument(), "svg:path"); newNode->setAttribute("inkscape:flatsided", "true"); newNode->setAttribute("sodipodi:type", "star"); diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 6904eb2fd..f885ef5e5 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -873,11 +873,8 @@ int SingularValueDecomposition::rank() -#define pi 3.14159 //#define pxToCm 0.0275 #define pxToCm 0.03 -#define piToRad 0.0174532925 -#define docHeightCm 22.86 //######################################################################## @@ -1565,7 +1562,7 @@ bool OdfOutput::processGradient(SPItem *item, output += buf; //TODO: apply maths, to define begin of gradient, taking gradient begin and end, as well as object boundary into account double angle = (gi.y2-gi.y1); - angle = (angle != 0.) ? (atan((gi.x2-gi.x1)/(gi.y2-gi.y1))* 180. / pi) : 90; + angle = (angle != 0.) ? (atan((gi.x2-gi.x1)/(gi.y2-gi.y1))* 180. / M_PI) : 90; angle = (angle < 0)?(180+angle):angle; angle = angle * 10; //why do we need this: precision????????????? output += Glib::ustring::compose(" draw:start-intensity=\"%1\" draw:end-intensity=\"%2\" draw:angle=\"%3\"/>\n", -- cgit v1.2.3 From 374c7f42864e24f5be723107e36569405c907de0 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sat, 3 Sep 2016 01:25:47 +0300 Subject: Remove a pointless == for bool (bzr r15100.1.2) --- src/extension/internal/cairo-renderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index cd96a7f58..5caf3e798 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -542,7 +542,7 @@ static void sp_item_invoke_render(SPItem *item, CairoRenderContext *ctx) } SPStyle* style = item->style; - if((ctx->getFilterToBitmap() == TRUE) && (style->filter.set != 0)) { + if(ctx->getFilterToBitmap() && (style->filter.set != 0)) { return sp_asbitmap_render(item, ctx); } -- cgit v1.2.3 From 2ce118d19a45638cf5389ffa282cc401a2bfce71 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sat, 3 Sep 2016 01:34:00 +0300 Subject: Inline two "style" variables. They were used only once and completely unnecessary, so I just replaced them with their expressions. (bzr r15100.1.3) --- src/extension/internal/cairo-renderer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 5caf3e798..a2b8fb22f 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -541,8 +541,7 @@ static void sp_item_invoke_render(SPItem *item, CairoRenderContext *ctx) return; } - SPStyle* style = item->style; - if(ctx->getFilterToBitmap() && (style->filter.set != 0)) { + if(ctx->getFilterToBitmap() && (item->style->filter.set != 0)) { return sp_asbitmap_render(item, ctx); } @@ -599,8 +598,7 @@ static void sp_item_invoke_render(SPItem *item, CairoRenderContext *ctx) void CairoRenderer::setStateForItem(CairoRenderContext *ctx, SPItem const *item) { - SPStyle const *style = item->style; - ctx->setStateForStyle(style); + ctx->setStateForStyle(item->style); CairoRenderState *state = ctx->getCurrentState(); state->clip_path = item->clip_ref->getObject(); -- cgit v1.2.3 From c2056bd9ce3f1150252db333e0a512ab3c4a08dd Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 16 Sep 2016 00:37:40 +0200 Subject: adds a layer to put things in when opening raster files Fixed bugs: - https://launchpad.net/bugs/394503 (bzr r15119) --- src/extension/internal/gdkpixbuf-input.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index b30c67a4d..e0dc90981 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -134,8 +134,13 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) } // Add it to the current layer - doc->getRoot()->appendChildRepr(image_node); + Inkscape::XML::Node *layer_node = xml_doc->createElement("svg:g"); + layer_node->setAttribute("inkscape:groupmode", "layer"); + layer_node->setAttribute("inkscape:label", "Image"); + doc->getRoot()->appendChildRepr(layer_node); + layer_node->appendChild(image_node); Inkscape::GC::release(image_node); + Inkscape::GC::release(layer_node); fit_canvas_to_drawing(doc); // Set viewBox if it doesn't exist -- cgit v1.2.3 From f9ec83dbb254701f39d3b7a30c0bacb5eaae9ee9 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 27 Sep 2016 10:51:26 +0200 Subject: Rename to per SVG 2 CR specificiation. Note: has been repurposed to be a special shape that tightly wraps a mesh gradient. (bzr r15137) --- src/extension/internal/cairo-render-context.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 1310bb343..e65752c84 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -42,7 +42,7 @@ #include "sp-hatch.h" #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" -#include "sp-mesh.h" +#include "sp-mesh-gradient.h" #include "sp-pattern.h" #include "sp-mask.h" #include "sp-clippath.h" @@ -1257,8 +1257,8 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain sp_color_get_rgb_floatv(&rg->vector.stops[i].color, rgb); cairo_pattern_add_color_stop_rgba(pattern, rg->vector.stops[i].offset, rgb[0], rgb[1], rgb[2], rg->vector.stops[i].opacity * alpha); } - } else if (SP_IS_MESH (paintserver)) { - SPMesh *mg = SP_MESH(paintserver); + } else if (SP_IS_MESHGRADIENT (paintserver)) { + SPMeshGradient *mg = SP_MESHGRADIENT(paintserver); pattern = mg->pattern_new(_cr, pbox, 1.0); } else if (SP_IS_PATTERN (paintserver)) { -- cgit v1.2.3 From 7d1184c85c47f1272da5b2ed7816efa685a73e83 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Sat, 1 Oct 2016 17:30:34 -0400 Subject: Add a prune method to saving svg files that removes Adobe's i:pgf tag. Fixed bugs: - https://launchpad.net/bugs/179679 (bzr r15141) --- src/extension/internal/svg.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/extension') diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index a94bc2141..9cde90519 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -78,6 +78,28 @@ static void pruneExtendedNamespaces( Inkscape::XML::Node *repr ) } } +/* + * Similar to the above sodipodi and inkscape prune, but used on all documents + * to remove problematic elements (for example Adobe's i:pgf tag) only removes + * known garbage tags. + */ +static void pruneProprietaryGarbage( Inkscape::XML::Node *repr ) +{ + if (repr) { + std::vector nodesRemoved; + for ( Node *child = repr->firstChild(); child; child = child->next() ) { + if((strncmp("i:pgf", child->name(), 5) == 0)) { + nodesRemoved.push_back(child); + g_warning( "An Adobe proprietary tag was found which is known to cause issues. It was removed before saving."); + } else { + pruneProprietaryGarbage(child); + } + } + for ( std::vector::iterator it = nodesRemoved.begin(); it != nodesRemoved.end(); ++it ) { + repr->removeChild(*it); + } + } +} /** \return None @@ -246,6 +268,10 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena || !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE) || !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVGZ_INKSCAPE)); + // We prune the in-use document and deliberately loose data, because there + // is no known use for this data at the present time. + pruneProprietaryGarbage(rdoc->root()); + if (!exportExtensions) { // We make a duplicate document so we don't prune the in-use document // and loose data. Perhaps the user intends to save as inkscape-svg next. -- cgit v1.2.3 From 7f1268617b2cdcff5f54dce879213160e478a48e Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Mon, 7 Nov 2016 20:23:12 +0000 Subject: Remove embedded build date, to allow reproducible building. Reproducible Builds is a ongoing project which aims at having "packages" "build" (as in, every build step, be it code compilation, doc generation, etc) be bit-by-bit reproducible regardless of the build environment. With this commit inkscape can be built reproducibly. See https://reproducible-builds.org for more info about the project. (bzr r15222.1.1) --- src/extension/internal/emf-print.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index d4c5d95a3..7f62fd1d7 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -205,7 +205,7 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) } else { p = ansi_uri; } - snprintf(buff, sizeof(buff) - 1, "Inkscape %s (%s)\1%s\1", Inkscape::version_string, __DATE__, p); + snprintf(buff, sizeof(buff) - 1, "Inkscape %s \1%s\1", Inkscape::version_string, p); uint16_t *Description = U_Utf8ToUtf16le(buff, 0, NULL); int cbDesc = 2 + wchar16len(Description); // also count the final terminator (void) U_Utf16leEdit(Description, '\1', '\0'); // swap the temporary \1 characters for nulls -- cgit v1.2.3 From 36435bdf4c0a4531effae1d7aee9d88a5d9b60b6 Mon Sep 17 00:00:00 2001 From: mathog <> Date: Thu, 10 Nov 2016 10:05:49 -0800 Subject: patch for bug 1405292, start clipping with COPY instead of OR so GDI clipping works (bzr r15235) --- src/extension/internal/emf-print.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 7f62fd1d7..826176bc0 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -1064,7 +1064,7 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ g_error("Fatal programming error in PrintEmf::image at U_EMRSAVEDC_set"); } (void) draw_pathv_to_EMF(combined_pathvector, tf); - rec = U_EMRSELECTCLIPPATH_set(U_RGN_OR); + rec = U_EMRSELECTCLIPPATH_set(U_RGN_COPY); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::do_clip_if_present at U_EMRSELECTCLIPPATH_set"); } -- cgit v1.2.3 From 74c0eb314373a78bb69473a21bc98ebd12be0d38 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 11 Nov 2016 21:05:31 +0100 Subject: Fix filter editor update Fixed bugs: - https://launchpad.net/bugs/1639985 (bzr r15238) --- src/extension/internal/filter/filter.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/extension') diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index 0907845f8..0408d516e 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -143,6 +143,7 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie Inkscape::XML::Node * newfilterroot = xmldoc->createElement("svg:filter"); merge_filters(newfilterroot, filterdoc->root(), xmldoc); defsrepr->appendChild(newfilterroot); + document->doc()->priv->resources_changed_signals[g_quark_from_string("filter")].emit(); Glib::ustring url = "url(#"; url += newfilterroot->attribute("id"); url += ")"; -- cgit v1.2.3 From 532f77b14a76fc04e6bdeca3625f9a55b5f11bdf Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 25 Oct 2016 00:58:43 +0200 Subject: CPPification: almost all sp_object_set_whatever and sp_selection_whatever global functions are now methods of ObjectSet*, with these additional benefits: - They can now act on any SelectionSet, not just the current selection; - Whenever possible, they don't need a desktop anymore and can run if called from GUI. I hope I did not break too many things in the process. *: So instead of callink sp_selection_move(desktop,x,y), you call myobjectset->move(x,y) (bzr r15189) --- src/extension/dbus/document-interface.cpp | 16 ++++++++-------- src/extension/internal/bluredge.cpp | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/extension') diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index 667830997..d3a06b81c 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -713,7 +713,7 @@ document_interface_move (DocumentInterface *doc_interface, gchar *name, gdouble std::vector oldsel = selection_swap(doc_interface->target.getSelection(), name, error); if (oldsel.empty()) return FALSE; - sp_selection_move (doc_interface->target.getSelection(), x, 0 - y); + doc_interface->target.getSelection()->move(x, 0 - y); selection_restore(doc_interface->target.getSelection(), oldsel); return TRUE; } @@ -726,7 +726,7 @@ document_interface_move_to (DocumentInterface *doc_interface, gchar *name, gdoub if (oldsel.empty()) return FALSE; Inkscape::Selection * sel = doc_interface->target.getSelection(); - sp_selection_move (doc_interface->target.getSelection(), x - selection_get_center_x(sel), + doc_interface->target.getSelection()->move(x - selection_get_center_x(sel), 0 - (y - selection_get_center_y(sel))); selection_restore(doc_interface->target.getSelection(), oldsel); return TRUE; @@ -1150,7 +1150,7 @@ document_interface_selection_set_list (DocumentInterface *doc_interface, gboolean document_interface_selection_rotate(DocumentInterface *doc_interface, int angle, GError ** /*error*/) { Inkscape::Selection *selection = doc_interface->target.getSelection(); - sp_selection_rotate(selection, angle); + selection->rotate(angle); return TRUE; } @@ -1235,13 +1235,13 @@ gboolean document_interface_selection_scale(DocumentInterface *doc_interface, gd { return FALSE; } - sp_selection_scale (selection, grow); + selection->scale(grow); return TRUE; } gboolean document_interface_selection_move(DocumentInterface *doc_interface, gdouble x, gdouble y, GError ** /*error*/) { - sp_selection_move(doc_interface->target.getSelection(), x, 0 - y); //switching coordinate systems. + doc_interface->target.getSelection()->move(x, 0 - y); //switching coordinate systems. return TRUE; } @@ -1252,7 +1252,7 @@ gboolean document_interface_selection_move_to(DocumentInterface *doc_interface, Geom::OptRect sel_bbox = sel->visualBounds(); if (sel_bbox) { Geom::Point m( x - selection_get_center_x(sel) , 0 - (y - selection_get_center_y(sel)) ); - sp_object_set_move_relative(sel, m, true); + sel->moveRelative(m, true); } return TRUE; } @@ -1279,8 +1279,8 @@ document_interface_selection_move_to_layer (DocumentInterface *doc_interface, return FALSE; if (strcmp("layer", (next->getRepr())->attribute("inkscape:groupmode")) == 0) { - - sp_selection_cut(dt); + + dt->selection->cut(); doc_interface->target.getSelection()->layers()->setCurrentLayer(next); diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index 4f66b39fc..8aa982810 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -90,7 +90,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View new_group->appendChild(new_items[i]); selection->add(new_items[i]); - sp_selected_path_to_curves(selection, static_cast(desktop)); + selection->toCurves(); if (offset < 0.0) { /* Doing an inset here folks */ -- cgit v1.2.3 From 647b3ccad1fd3b178e92341fdc92fd276a234dff Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 22:29:03 +0100 Subject: Add exporters (bzr r15142.1.32) --- src/extension/internal/cairo-png-out.cpp | 4 ++-- src/extension/internal/cairo-ps-out.cpp | 7 +++++-- src/extension/internal/cairo-renderer-pdf-out.cpp | 4 +++- src/extension/internal/emf-inout.cpp | 5 +++-- src/extension/internal/javafx-out.cpp | 9 +++++++-- src/extension/internal/latex-pstricks-out.cpp | 2 ++ src/extension/internal/odf.cpp | 9 ++++++++- src/extension/internal/pov-out.cpp | 13 ++++++++++--- src/extension/internal/wmf-inout.cpp | 7 +++++-- 9 files changed, 45 insertions(+), 15 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/cairo-png-out.cpp b/src/extension/internal/cairo-png-out.cpp index 956fcce9a..5859a82da 100644 --- a/src/extension/internal/cairo-png-out.cpp +++ b/src/extension/internal/cairo-png-out.cpp @@ -53,11 +53,10 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename) { CairoRenderer *renderer; CairoRenderContext *ctx; - + doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; doc->ensureUpToDate(); /* Start */ - SPItem *base = doc->getRoot(); Inkscape::Drawing drawing; unsigned dkey = SPItem::display_key_new(1); @@ -77,6 +76,7 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename) renderer->destroyContext(ctx); base->invoke_hide(dkey); + doc->getRoot()->c2p *= doc->getRoot()->rotation; /* end */ delete renderer; diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index e8f47e79e..809125266 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -68,6 +68,7 @@ static bool ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int level, bool texttopath, bool omittext, bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, float bleedmargin_px, bool eps = false) { + doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; doc->ensureUpToDate(); SPItem *base = NULL; @@ -84,9 +85,10 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l pageBoundingBox = !exportDrawing; } - if (!base) + if (!base) { + doc->getRoot()->c2p *= doc->getRoot()->rotation; return false; - + } Inkscape::Drawing drawing; unsigned dkey = SPItem::display_key_new(1); base->invoke_show(drawing, dkey, SP_ITEM_SHOW_DISPLAY); @@ -115,6 +117,7 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l renderer->destroyContext(ctx); delete renderer; + doc->getRoot()->c2p *= doc->getRoot()->rotation; return ret; } diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index 5576676b2..5558fe1ad 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -61,6 +61,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int bool texttopath, bool omittext, bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, float bleedmargin_px) { + doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; doc->ensureUpToDate(); /* Start */ @@ -80,6 +81,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int } if (!base) { + doc->getRoot()->c2p *= doc->getRoot()->rotation; return false; } @@ -112,7 +114,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int renderer->destroyContext(ctx); delete renderer; - + doc->getRoot()->c2p *= doc->getRoot()->rotation; return ret; } diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 12751c5ec..198c18ff2 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -94,7 +94,7 @@ Emf::print_document_to_file(SPDocument *doc, const gchar *filename) const gchar *oldconst; gchar *oldoutput; unsigned int ret; - + doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; doc->ensureUpToDate(); mod = Inkscape::Extension::get_print(PRINT_EMF); @@ -114,6 +114,7 @@ Emf::print_document_to_file(SPDocument *doc, const gchar *filename) /* Print document */ ret = mod->begin(doc); if (ret) { + doc->getRoot()->c2p *= doc->getRoot()->rotation; g_free(oldoutput); throw Inkscape::Extension::Output::save_failed(); } @@ -127,7 +128,7 @@ Emf::print_document_to_file(SPDocument *doc, const gchar *filename) mod->set_param_string("destination", oldoutput); g_free(oldoutput); - + doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index d7ad7e6f7..c95434939 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -843,7 +843,8 @@ void JavaFXOutput::reset() bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) { reset(); - + doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; + doc->ensureUpToDate(); name = Glib::path_get_basename(filename_utf8); int pos = name.find('.'); @@ -856,12 +857,14 @@ bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) //# Lets do the curves first, to get the stats if (!doTree(doc)) { + doc->getRoot()->c2p *= doc->getRoot()->rotation; return false; } String curveBuf = outbuf; outbuf.clear(); if (!doHeader()) { + doc->getRoot()->c2p *= doc->getRoot()->rotation; return false; } @@ -875,6 +878,7 @@ bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) doBody(doc, doc->getRoot()); if (!doTail()) { + doc->getRoot()->c2p *= doc->getRoot()->rotation; return false; } @@ -884,6 +888,7 @@ bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) FILE *f = Inkscape::IO::fopen_utf8name(filename_utf8, "w"); if (!f) { + doc->getRoot()->c2p *= doc->getRoot()->rotation; err("Could open JavaFX file '%s' for writing", filename_utf8); return false; } @@ -894,7 +899,7 @@ bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) } fclose(f); - + doc->getRoot()->c2p *= doc->getRoot()->rotation; return true; } diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp index 3ce2c5531..aa6ea6963 100644 --- a/src/extension/internal/latex-pstricks-out.cpp +++ b/src/extension/internal/latex-pstricks-out.cpp @@ -49,6 +49,7 @@ bool LatexOutput::check(Inkscape::Extension::Extension * /*module*/) void LatexOutput::save(Inkscape::Extension::Output * /*mod2*/, SPDocument *doc, gchar const *filename) { SPPrintContext context; + doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; doc->ensureUpToDate(); Inkscape::Extension::Print *mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_LATEX); @@ -76,6 +77,7 @@ void LatexOutput::save(Inkscape::Extension::Output * /*mod2*/, SPDocument *doc, mod->set_param_string("destination", oldoutput); g_free(oldoutput); + doc->getRoot()->c2p *= doc->getRoot()->rotation; } #include "clear-n_.h" diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index f885ef5e5..66d370357 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -72,6 +72,7 @@ #include "sp-path.h" #include "sp-text.h" #include "sp-flowtext.h" +#include "sp-root.h" #include "svg/svg.h" #include "text-editing.h" #include "util/units.h" @@ -2095,7 +2096,8 @@ void OdfOutput::reset() void OdfOutput::save(Inkscape::Extension::Output */*mod*/, SPDocument *doc, gchar const *filename) { reset(); - + doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; + doc->ensureUpToDate(); documentUri = Inkscape::URI(filename); ZipFile zf; @@ -2104,25 +2106,30 @@ void OdfOutput::save(Inkscape::Extension::Output */*mod*/, SPDocument *doc, gcha if (!writeManifest(zf)) { g_warning("Failed to write manifest"); + doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } if (!writeContent(zf, doc->rroot)) { g_warning("Failed to write content"); + doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } if (!writeMeta(zf)) { g_warning("Failed to write metafile"); + doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } if (!zf.writeFile(filename)) { + doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } + doc->getRoot()->c2p *= doc->getRoot()->rotation; } diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 8df883069..03a2ecd62 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -616,11 +616,13 @@ void PovOutput::reset() void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) { reset(); - + doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; + doc->ensureUpToDate(); //###### SAVE IN POV FORMAT TO BUFFER //# Lets do the curves first, to get the stats if (!doTree(doc)) { + doc->getRoot()->c2p *= doc->getRoot()->rotation; err("Could not output curves for %s", filename_utf8); return; } @@ -630,6 +632,7 @@ void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) if (!doHeader()) { + doc->getRoot()->c2p *= doc->getRoot()->rotation; err("Could not write header for %s", filename_utf8); return; } @@ -638,6 +641,7 @@ void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) if (!doTail()) { + doc->getRoot()->c2p *= doc->getRoot()->rotation; err("Could not write footer for %s", filename_utf8); return; } @@ -648,9 +652,11 @@ void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) //###### WRITE TO FILE Inkscape::IO::dump_fopen_call(filename_utf8, "L"); FILE *f = Inkscape::IO::fopen_utf8name(filename_utf8, "w"); - if (!f) + if (!f){ + doc->getRoot()->c2p *= doc->getRoot()->rotation; return; - + } + for (String::iterator iter = outbuf.begin() ; iter!=outbuf.end(); ++iter) { int ch = *iter; @@ -658,6 +664,7 @@ void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) } fclose(f); + doc->getRoot()->c2p *= doc->getRoot()->rotation; } diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index c7226a58a..a79af5ec1 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -95,7 +95,7 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) SPPrintContext context; const gchar *oldconst; gchar *oldoutput; - + doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; doc->ensureUpToDate(); mod = Inkscape::Extension::get_print(PRINT_WMF); @@ -115,6 +115,7 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) /* Print document */ if (mod->begin(doc)) { g_free(oldoutput); + doc->getRoot()->c2p *= doc->getRoot()->rotation; throw Inkscape::Extension::Output::save_failed(); } mod->base->invoke_print(&context); @@ -127,7 +128,7 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) mod->set_param_string("destination", oldoutput); g_free(oldoutput); - + doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } @@ -135,6 +136,8 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) void Wmf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) { + doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; + doc->ensureUpToDate(); Inkscape::Extension::Extension * ext; ext = Inkscape::Extension::db.get(PRINT_WMF); -- cgit v1.2.3 From 9e177c7e5303ef24f23eb87037f7089b57813523 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 26 Dec 2016 17:04:49 +0000 Subject: Fix Gtkmm deprecations in extensions (bzr r15359) --- src/extension/param/description.cpp | 3 ++- src/extension/prefdialog.cpp | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 326e75e4a..07aaa07cc 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -81,7 +81,8 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node int padding = 12 + _indent; if (_mode == HEADER) { label = Gtk::manage(new Gtk::Label(Glib::ustring("") +newguitext + Glib::ustring(""), Gtk::ALIGN_START)); - label->set_padding(0,5); + label->set_margin_top(5); + label->set_margin_bottom(5); label->set_use_markup(true); padding = _indent; } else { diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index 1ca590e85..5ce2f69cc 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -71,11 +71,8 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co if (_help == NULL) help_button->set_sensitive(false); */ - _button_cancel = add_button(_effect == NULL ? Gtk::Stock::CANCEL : Gtk::Stock::CLOSE, Gtk::RESPONSE_CANCEL); - _button_cancel->set_use_stock(true); - - _button_ok = add_button(_effect == NULL ? Gtk::Stock::OK : Gtk::Stock::APPLY, Gtk::RESPONSE_OK); - _button_ok->set_use_stock(true); + _button_cancel = add_button(_effect == NULL ? _("_Cancel") : _("_Close"), Gtk::RESPONSE_CANCEL); + _button_ok = add_button(_effect == NULL ? _("_OK") : _("_Apply"), Gtk::RESPONSE_OK); set_default_response(Gtk::RESPONSE_OK); _button_ok->grab_focus(); -- cgit v1.2.3 From a58cfbc08b8c4e649faebcf5b9181ddd79b9527e Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 26 Dec 2016 18:38:27 +0000 Subject: pdf-input: Gtk3 fixes (bzr r15360) --- src/extension/internal/pdfinput/pdf-input.cpp | 71 +++++++++++++++++++++------ src/extension/internal/pdfinput/pdf-input.h | 1 - 2 files changed, 56 insertions(+), 16 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index 0c22fa399..a57396b17 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -85,8 +85,8 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _poppler_doc = NULL; #endif // HAVE_POPPLER_CAIRO _pdf_doc = doc; - cancelbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-cancel"))); - okbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))); + cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true)); + okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true)); _labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:"))); // Page number @@ -157,9 +157,50 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) okbutton->set_can_focus(); okbutton->set_can_default(); okbutton->set_relief(Gtk::RELIEF_NORMAL); - this->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END); + +#if GTK_CHECK_VERSION(3,16,0) + _labelSelect->set_xalign(0.5); + _labelSelect->set_yalign(0.5); + _labelTotalPages->set_xalign(0.5); + _labelTotalPages->set_yalign(0.5); + _labelPrecision->set_xalign(0.0); + _labelPrecision->set_yalign(0.5); + _labelPrecisionWarning->set_xalign(0.0); + _labelPrecisionWarning->set_yalign(0.5); + _labelPrecisionComment->set_xalign(0.5); + _labelPrecisionComment->set_yalign(0.5); +#else _labelSelect->set_alignment(0.5,0.5); - _labelSelect->set_padding(4,0); + _labelTotalPages->set_alignment(0.5,0.5); + _labelPrecision->set_alignment(0,0.5); + _labelPrecisionWarning->set_alignment(0,0.5); + _labelPrecisionComment->set_alignment(0.5,0.5); +#endif + +#if GTK_CHECK_VERSION(3,12,0) + _labelSelect->set_margin_start(4); + _labelSelect->set_margin_end(4); + _labelTotalPages->set_margin_start(4); + _labelTotalPages->set_margin_end(4); + _labelPrecision->set_margin_start(4); + _labelPrecision->set_margin_end(4); + _labelPrecisionWarning->set_margin_start(4); + _labelPrecisionWarning->set_margin_end(4); + _labelPrecisionComment->set_margin_start(4); + _labelPrecisionComment->set_margin_end(4); +#else + _labelSelect->set_margin_left(4); + _labelSelect->set_margin_right(4); + _labelTotalPages->set_margin_left(4); + _labelTotalPages->set_margin_right(4); + _labelPrecision->set_margin_left(4); + _labelPrecision->set_margin_right(4); + _labelPrecisionWarning->set_margin_left(4); + _labelPrecisionWarning->set_margin_right(4); + _labelPrecisionComment->set_margin_left(4); + _labelPrecisionComment->set_margin_right(4); +#endif + _labelSelect->set_justify(Gtk::JUSTIFY_LEFT); _labelSelect->set_line_wrap(false); _labelSelect->set_use_markup(false); @@ -169,8 +210,6 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _pageNumberSpin->set_numeric(true); _pageNumberSpin->set_digits(0); _pageNumberSpin->set_wrap(false); - _labelTotalPages->set_alignment(0.5,0.5); - _labelTotalPages->set_padding(4,0); _labelTotalPages->set_justify(Gtk::JUSTIFY_LEFT); _labelTotalPages->set_line_wrap(false); _labelTotalPages->set_use_markup(false); @@ -189,14 +228,10 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) vbox2->pack_start(*hbox3); _pageSettingsFrame->add(*vbox2); _pageSettingsFrame->set_border_width(4); - _labelPrecision->set_alignment(0,0.5); - _labelPrecision->set_padding(4,0); _labelPrecision->set_justify(Gtk::JUSTIFY_LEFT); _labelPrecision->set_line_wrap(true); _labelPrecision->set_use_markup(false); _labelPrecision->set_selectable(false); - _labelPrecisionWarning->set_alignment(0,0.5); - _labelPrecisionWarning->set_padding(4,0); _labelPrecisionWarning->set_justify(Gtk::JUSTIFY_LEFT); _labelPrecisionWarning->set_line_wrap(true); _labelPrecisionWarning->set_use_markup(true); @@ -213,6 +248,14 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _importViaInternal->set_active(true); _labelViaPoppler->set_line_wrap(true); _labelViaInternal->set_line_wrap(true); + +# if GTK_CHECK_VERSION(3,16,0) + _labelViaPoppler->set_xalign(0); + _labelViaInternal->set_xalign(0); +# else + _labelViaPoppler->set_alignment(0, 0.5); + _labelViaInternal->set_alignment(0, 0.5); +# endif #endif _fallbackPrecisionSlider->set_size_request(180,-1); @@ -222,8 +265,6 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _fallbackPrecisionSlider->set_draw_value(true); _fallbackPrecisionSlider->set_value_pos(Gtk::POS_TOP); _labelPrecisionComment->set_size_request(90,-1); - _labelPrecisionComment->set_alignment(0.5,0.5); - _labelPrecisionComment->set_padding(4,0); _labelPrecisionComment->set_justify(Gtk::JUSTIFY_LEFT); _labelPrecisionComment->set_line_wrap(false); _labelPrecisionComment->set_use_markup(false); @@ -260,10 +301,10 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) // vbox3->pack_start(*hbox5, Gtk::PACK_SHRINK, 4); _importSettingsFrame->add(*vbox3); _importSettingsFrame->set_border_width(4); - vbox1->pack_start(*_pageSettingsFrame, Gtk::PACK_EXPAND_PADDING, 0); - vbox1->pack_start(*_importSettingsFrame, Gtk::PACK_EXPAND_PADDING, 0); + vbox1->pack_start(*_pageSettingsFrame, Gtk::PACK_SHRINK, 0); + vbox1->pack_start(*_importSettingsFrame, Gtk::PACK_SHRINK, 0); hbox1->pack_start(*vbox1); - hbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 4); + hbox1->pack_start(*_previewArea, Gtk::PACK_SHRINK, 4); get_content_area()->set_homogeneous(false); get_content_area()->set_spacing(0); diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h index c338207c1..a70d40a23 100644 --- a/src/extension/internal/pdfinput/pdf-input.h +++ b/src/extension/internal/pdfinput/pdf-input.h @@ -32,7 +32,6 @@ class Page; class PDFDoc; namespace Gtk { - class Alignment; class Button; class CheckButton; class ComboBoxText; -- cgit v1.2.3 From c57bca7b486b2967428c6e5c5409a8d5ddf21cdf Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 26 Dec 2016 19:51:01 +0000 Subject: cdr-import: Gtk3 fixes (bzr r15362) --- src/extension/internal/cdr-input.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index b94b6d019..92a11a6ac 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -116,8 +116,8 @@ CdrImportDialog::CdrImportDialog(const std::vector &vec) // CONTROLS // Buttons - cancelbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-cancel"))); - okbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))); + cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true)); + okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true)); // Labels _labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:"))); -- cgit v1.2.3 From 02e2c977fea54d4146fb4208f33508702f4e506d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 26 Dec 2016 20:01:35 +0000 Subject: vsd-input: Gtk3 fixes (bzr r15363) --- src/extension/internal/vsd-input.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index 2de2d0ec6..8876fb4e6 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -118,8 +118,8 @@ VsdImportDialog::VsdImportDialog(const std::vector &vec) // CONTROLS // Buttons - cancelbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-cancel"))); - okbutton = Gtk::manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))); + cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true)); + okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true))l // Labels _labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:"))); -- cgit v1.2.3 From b5b707ecca91724291d9e13776ce834e82afa686 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 26 Dec 2016 22:10:32 +0000 Subject: Fix typo (bzr r15364) --- src/extension/internal/vsd-input.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index 8876fb4e6..2fb4acf22 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -119,7 +119,7 @@ VsdImportDialog::VsdImportDialog(const std::vector &vec) // Buttons cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true)); - okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true))l + okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true)); // Labels _labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:"))); -- cgit v1.2.3 From 2e8438d76a5f26719d381843cd3ce3fa694809fb Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 27 Dec 2016 15:49:22 +0000 Subject: Rm remaining Gtk::Stock usage (bzr r15368) --- src/extension/prefdialog.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index 5ce2f69cc..fcc88853d 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -8,7 +8,6 @@ */ #include "prefdialog.h" -#include #include #include #include -- cgit v1.2.3 From bfcc1fb5a5142a71469834cac2d507f15626a8b5 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Wed, 4 Jan 2017 03:32:40 +0200 Subject: Extract some common code into a routine. (bzr r15369.1.8) --- src/extension/find_extension_by_mime.h | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/extension/find_extension_by_mime.h (limited to 'src/extension') diff --git a/src/extension/find_extension_by_mime.h b/src/extension/find_extension_by_mime.h new file mode 100644 index 000000000..1686c62e4 --- /dev/null +++ b/src/extension/find_extension_by_mime.h @@ -0,0 +1,36 @@ +/** + * @file + * Find an extension by its mime type. + */ +/* Authors: + * Lauris Kaplinski + * Frank Felfe + * bulia byak + * Jon A. Cruz + * Abhishek Sharma + * Kris De Gussem + * + * Copyright (C) 2012 Kris De Gussem + * Copyright (C) 2010 authors + * Copyright (C) 1999-2005 authors + * Copyright (C) 2004 David Turner + * Copyright (C) 2001-2002 Ximian, Inc. + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +namespace Inkscape { +namespace Extension { +static inline Inkscape::Extension::Extension *find_by_mime(const char *const mime) +{ + + Inkscape::Extension::DB::InputList o; + Inkscape::Extension::db.get_input_list(o); + Inkscape::Extension::DB::InputList::const_iterator i = o.begin(); + while (i != o.end() && strcmp((*i)->get_mimetype(), mime) != 0) { + ++i; + } + return *i; +} +} +} -- cgit v1.2.3 From 1dbe6c746f9f5b0ddbce22e228835010c000d67b Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Tue, 17 Jan 2017 23:06:15 +0100 Subject: Partially fix opening of librevenge based input formats (cdr/vsd/wpg) on Windows if the filename contains non-ASCII characters The problem is that "RVNGFileStream" uses "fopen()" internally which only supports ANSI filenames on Windows (i.e. a complete fix would require upstream code changes). By using "g_win32_locale_filename_from_utf8()" the problem can be worked around in most cases, though: * the filename is converted to the current codepage (i.e. all 255 characters that are available in the current character encoding are allowed in the filename) * even if the filename contains a character that's not available in the current character encoding it's attempted to use the alternative short (8.3) file name instead Therefore the input operation will only fail in the unlikely case that the filename contains a character not available in the current ANSI code page while at the same time short file names are disabled on the file system (which is not the case in standard configurations). Fixed bugs: - https://launchpad.net/bugs/1656763 - https://launchpad.net/bugs/1656763 (bzr r15421) --- src/extension/internal/cdr-input.cpp | 7 +++++++ src/extension/internal/vsd-input.cpp | 7 +++++++ src/extension/internal/wpg-input.cpp | 7 +++++++ 3 files changed, 21 insertions(+) (limited to 'src/extension') diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index 92a11a6ac..0435f1396 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -214,6 +214,13 @@ void CdrImportDialog::_setPreviewPage() SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) { + #ifdef WIN32 + // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows + // therefore attempt to convert uri to the system codepage + // even if this is not possible the alternate short (8.3) file name will be used if available + uri = g_win32_locale_filename_from_utf8(uri); + #endif + RVNGFileStream input(uri); if (!libcdr::CDRDocument::isSupported(&input)) { diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index 2fb4acf22..78783aa2d 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -216,6 +216,13 @@ void VsdImportDialog::_setPreviewPage() SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) { + #ifdef WIN32 + // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows + // therefore attempt to convert uri to the system codepage + // even if this is not possible the alternate short (8.3) file name will be used if available + uri = g_win32_locale_filename_from_utf8(uri); + #endif + RVNGFileStream input(uri); if (!libvisio::VisioDocument::isSupported(&input)) { diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index 54a14fc72..12457791b 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -81,6 +81,13 @@ namespace Internal { SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) { + #ifdef WIN32 + // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows + // therefore attempt to convert uri to the system codepage + // even if this is not possible the alternate short (8.3) file name will be used if available + uri = g_win32_locale_filename_from_utf8(uri); + #endif + RVNGInputStream* input = new RVNGFileStream(uri); #if WITH_LIBWPG03 if (input->isStructured()) { -- cgit v1.2.3 From b2c6a66276f5df743c5b78ef0e78c11051200df8 Mon Sep 17 00:00:00 2001 From: tghs <> Date: Wed, 25 Jan 2017 10:49:49 +0100 Subject: [Bug #1537497] Icon preview doesn't render background. Fixed bugs: - https://launchpad.net/bugs/1537497 (bzr r15446) --- src/extension/internal/cairo-render-context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index e65752c84..06711bca4 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -865,7 +865,7 @@ CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t cairo_scale(_cr, Inkscape::Util::Quantity::convert(1, "px", "pt"), Inkscape::Util::Quantity::convert(1, "px", "pt")); } else if (cairo_surface_get_content(_surface) != CAIRO_CONTENT_ALPHA) { // set background color on non-alpha surfaces - // TODO: bgcolor should be derived from SPDocument + // TODO: bgcolor should be derived from SPDocument (see IconImpl) cairo_set_source_rgb(_cr, 1.0, 1.0, 1.0); cairo_rectangle(_cr, 0, 0, _width, _height); cairo_fill(_cr); -- cgit v1.2.3 From a8d79dede01f2d3b38ea375bca310cd3f25796d1 Mon Sep 17 00:00:00 2001 From: peregrine Date: Wed, 8 Feb 2017 00:01:27 +0100 Subject: fix two memory leaks Fixed bugs: - https://launchpad.net/bugs/1662686 - https://launchpad.net/bugs/1662683 (bzr r15493) --- src/extension/implementation/script.cpp | 3 +++ src/extension/internal/bitmap/imagemagick.cpp | 1 + 2 files changed, 4 insertions(+) (limited to 'src/extension') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index d2319c2e0..b1058d415 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -963,6 +963,9 @@ void Script::checkStderr (const Glib::ustring &data, warning.run(); + delete textview; + delete scrollwindow; + return; } diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index 472c2db91..cc5b3d1bc 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -213,6 +213,7 @@ ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::Vi dc->_nodes[i]->setAttribute("xlink:href", dc->_caches[i], true); dc->_nodes[i]->setAttribute("sodipodi:absref", NULL, true); + delete blob; } catch (Magick::Exception &error_) { printf("Caught exception: %s \n", error_.what()); -- cgit v1.2.3 From 9faf941d45ce7d23f5cb0d066bd23346f7e3aedf Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 11 Feb 2017 01:16:53 +0100 Subject: Fix a memory leak introduced in r15421 and r15501 respectively (bzr r15505) --- src/extension/internal/cdr-input.cpp | 8 +++++--- src/extension/internal/vsd-input.cpp | 8 +++++--- src/extension/internal/wpg-input.cpp | 7 +++++-- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index 0435f1396..dbe88c668 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -218,11 +218,13 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows // therefore attempt to convert uri to the system codepage // even if this is not possible the alternate short (8.3) file name will be used if available - uri = g_win32_locale_filename_from_utf8(uri); + gchar * converted_uri = g_win32_locale_filename_from_utf8(uri); + RVNGFileStream input(converted_uri); + g_free(converted_uri); + #else + RVNGFileStream input(uri); #endif - RVNGFileStream input(uri); - if (!libcdr::CDRDocument::isSupported(&input)) { return NULL; } diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index 78783aa2d..85698387a 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -220,11 +220,13 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows // therefore attempt to convert uri to the system codepage // even if this is not possible the alternate short (8.3) file name will be used if available - uri = g_win32_locale_filename_from_utf8(uri); + gchar * converted_uri = g_win32_locale_filename_from_utf8(uri); + RVNGFileStream input(converted_uri); + g_free(converted_uri); + #else + RVNGFileStream input(uri); #endif - RVNGFileStream input(uri); - if (!libvisio::VisioDocument::isSupported(&input)) { return NULL; } diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index 12457791b..299614c94 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -85,10 +85,13 @@ SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows // therefore attempt to convert uri to the system codepage // even if this is not possible the alternate short (8.3) file name will be used if available - uri = g_win32_locale_filename_from_utf8(uri); + gchar * converted_uri = g_win32_locale_filename_from_utf8(uri); + RVNGInputStream* input = new RVNGFileStream(converted_uri); + g_free(converted_uri); + #else + RVNGInputStream* input = new RVNGFileStream(uri); #endif - RVNGInputStream* input = new RVNGFileStream(uri); #if WITH_LIBWPG03 if (input->isStructured()) { RVNGInputStream* olestream = input->getSubStreamByName("PerfectOffice_MAIN"); -- cgit v1.2.3 From a65a0a21e5452ced77123a8b846ff10cc1bc74b0 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 12 Feb 2017 15:59:14 +0100 Subject: Extensions: Make "indent" attribute a common attribute for all parameters that behaves more consistent and predictable than before. - Every "Parameter" now has an "_indent" member variable (specifying the indentation level; set in "Parameter::make()", see parameter.cpp) - Indentation is achieved by using "set_margin_left()" on the parameter's widget. This fixes bug #1662035 (comment #4 contains some more details about this patch). - Specifying "indent" on a parameter will now work consistently for all parameters. Previously the "indent" attribute often had no effect at all, e.g. for notebooks but also for parameters with 'appearance="full"' which was reasonable in most cases but made the outcome of using this attribute often unpredictable and is unnecessarily restrictive. - Most visible change: "description"s always used an indentation level of at least one (even if no indentation was specified). For the sake of consistency this discrepancy was dropped. Previous appearance can easily be restored by setting 'indent="1"'. Fixed bugs: - https://launchpad.net/bugs/1662035 (bzr r15508) --- src/extension/extension.cpp | 32 ++++++++++++++------------- src/extension/extension.h | 2 +- src/extension/param/bool.cpp | 23 +++++++++++--------- src/extension/param/bool.h | 11 ++++++++-- src/extension/param/color.cpp | 16 ++++++++++---- src/extension/param/color.h | 11 ++++++++-- src/extension/param/description.cpp | 39 +++++++++++++++------------------ src/extension/param/description.h | 5 +++-- src/extension/param/enum.cpp | 24 ++++++++++----------- src/extension/param/enum.h | 12 +++++++++-- src/extension/param/float.cpp | 35 +++++++++++++++--------------- src/extension/param/float.h | 21 +++++++++--------- src/extension/param/int.cpp | 35 +++++++++++++++--------------- src/extension/param/int.h | 20 ++++++++--------- src/extension/param/notebook.cpp | 39 +++++++++++++++++++++++++++------ src/extension/param/notebook.h | 11 +++++++++- src/extension/param/parameter.cpp | 43 ++++++++++++++++++++++++------------- src/extension/param/parameter.h | 9 +++++++- src/extension/param/radiobutton.cpp | 32 +++++++++++++-------------- src/extension/param/radiobutton.h | 3 ++- src/extension/param/string.cpp | 23 +++++++++++--------- src/extension/param/string.h | 13 ++++++++--- 22 files changed, 276 insertions(+), 183 deletions(-) (limited to 'src/extension') diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index c6dee1b70..2d020aa0e 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -1,6 +1,6 @@ /** \file * - * Inkscape::Extension::Extension: + * Inkscape::Extension::Extension: * the ability to have features that are more modular so that they * can be added and removed easily. This is the basis for defining * those actions. @@ -144,15 +144,15 @@ Extension::~Extension (void) delete timer; timer = NULL; /** \todo Need to do parameters here */ - - // delete parameters: + + // delete parameters: for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { Parameter * param = reinterpret_cast(list->data); delete param; } g_slist_free(parameters); - - + + for (unsigned int i = 0 ; i < _deps.size(); i++) { delete _deps[i]; } @@ -330,7 +330,7 @@ Extension::get_repr (void) } /** - \return bool + \return bool \brief Whether this extension should hide the "working, please wait" dialog */ bool @@ -444,7 +444,7 @@ Extension::get_param_enum (const gchar * name, const SPDocument * doc, const Ink /** * This is useful to find out, if a given string \c value is selectable in a ComboBox named \cname. - * + * * @param name The name of the enum parameter to get. * @param doc The document to look in for document specific parameters. * @param node The node to look in for a specific parameter. @@ -692,8 +692,9 @@ public: * @param widg Widget to add. * @param tooltip Tooltip for the widget. */ - void addWidget(Gtk::Widget *widg, gchar const *tooltip) { + void addWidget(Gtk::Widget *widg, gchar const *tooltip, int indent) { if (widg) { + widg->set_margin_left(indent*12); this->pack_start(*widg, false, false, 2); if (tooltip) { widg->set_tooltip_text(_(tooltip)); @@ -713,7 +714,7 @@ public: a Gtk::VBox, which is then returned to the calling function. If there are no visible parameters, this function just returns NULL. - If all parameters are gui_visible = false NULL is returned as well. + If all parameters are gui_visible = false NULL is returned as well. */ Gtk::Widget * Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) @@ -728,9 +729,10 @@ Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signalget_gui_hidden()) continue; //Ignore hidden parameters Gtk::Widget * widg = param->get_widget(doc, node, changeSignal); gchar const * tip = param->get_tooltip(); - agui->addWidget(widg, tip); - } - + int indent = param->get_indent(); + agui->addWidget(widg, tip, indent); + } + agui->show(); return agui; }; @@ -780,7 +782,7 @@ void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Gri Gtk::Label * label; Gtk::Label * value; - (*row)++; + (*row)++; label = Gtk::manage(new Gtk::Label(labelstr)); value = Gtk::manage(new Gtk::Label(valuestr)); @@ -824,13 +826,13 @@ Extension::get_params_widget(void) return retval; } -unsigned int Extension::param_visible_count ( ) +unsigned int Extension::param_visible_count ( ) { unsigned int _visible_count = 0; for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { Parameter * param = reinterpret_cast(list->data); if (!param->get_gui_hidden()) _visible_count++; - } + } return _visible_count; } diff --git a/src/extension/extension.h b/src/extension/extension.h index cd29e1636..bbd6d068b 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -176,7 +176,7 @@ public: private: void make_param (Inkscape::XML::Node * paramrepr); - + /** * This function looks through the linked list for a parameter * structure with the name of the passed in name. diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index ca61d8c51..833215546 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -24,9 +24,17 @@ namespace Inkscape { namespace Extension { -ParamBool::ParamBool(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), - _value(false), _indent(0) +ParamBool::ParamBool(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + , _value(false) { const char * defaultval = NULL; if (xml->firstChild() != NULL) { @@ -39,11 +47,6 @@ ParamBool::ParamBool(const gchar * name, const gchar * guitext, const gchar * de _value = false; } - const char * indent = xml->attribute("indent"); - if (indent != NULL) { - _indent = atoi(indent) * 12; - } - gchar * pref_name = this->pref_name(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); _value = prefs->getBool(extension_pref_root + pref_name, _value); @@ -66,7 +69,7 @@ bool ParamBool::set( bool in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node bool ParamBool::get(const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) const { - return _value; + return _value; } /** @@ -139,7 +142,7 @@ Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node, ParamBoolCheckButton * checkbox = Gtk::manage(new ParamBoolCheckButton(this, doc, node, changeSignal)); checkbox->show(); - hbox->pack_start(*checkbox, false, false, _indent); + hbox->pack_start(*checkbox, false, false); hbox->show(); diff --git a/src/extension/param/bool.h b/src/extension/param/bool.h index 5d190b9d3..0af12b105 100644 --- a/src/extension/param/bool.h +++ b/src/extension/param/bool.h @@ -32,7 +32,15 @@ public: /** * Use the superclass' allocator and set the \c _value. */ - ParamBool(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); + ParamBool(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml); /** * Returns the current state/value. @@ -69,7 +77,6 @@ public: private: /** Internal value. */ bool _value; - int _indent; }; } // namespace Extension diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index 0b58c5011..041cd5509 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -52,9 +52,17 @@ guint32 ParamColor::set( guint32 in, SPDocument * /*doc*/, Inkscape::XML::Node * return in; } -ParamColor::ParamColor (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), - _changeSignal(0) +ParamColor::ParamColor(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + , _changeSignal(0) { const char * defaulthex = NULL; if (xml->firstChild() != NULL) @@ -86,7 +94,7 @@ Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * { using Inkscape::UI::Widget::ColorNotebook; - if (_gui_hidden) return NULL; + if (_gui_hidden) return NULL; if (changeSignal) { _changeSignal = new sigc::signal(*changeSignal); diff --git a/src/extension/param/color.h b/src/extension/param/color.h index ed2e57ceb..d6e9d1fbe 100644 --- a/src/extension/param/color.h +++ b/src/extension/param/color.h @@ -31,8 +31,15 @@ private: Inkscape::UI::SelectedColor _color; sigc::connection _color_changed; public: - ParamColor(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); - + ParamColor(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml); virtual ~ParamColor(void); /** Returns \c _value, with a \i const to protect it. */ diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 07aaa07cc..7f7d2d976 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -26,17 +26,19 @@ namespace Extension { /** \brief Initialize the object, to do that, copy the data. */ -ParamDescription::ParamDescription (const gchar * name, - const gchar * guitext, - const gchar * desc, - const Parameter::_scope_t scope, - bool gui_hidden, - const gchar * gui_tip, - Inkscape::Extension::Extension * ext, - Inkscape::XML::Node * xml, - AppearanceMode mode) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), - _value(NULL), _mode(mode), _indent(0) +ParamDescription::ParamDescription(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml, + AppearanceMode mode) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + , _value(NULL) + , _mode(mode) { // printf("Building Description\n"); const char * defaultval = NULL; @@ -50,11 +52,6 @@ ParamDescription::ParamDescription (const gchar * name, _context = xml->attribute("msgctxt"); - const char * indent = xml->attribute("indent"); - if (indent != NULL) { - _indent = atoi(indent) * 12; - } - return; } @@ -76,15 +73,13 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node } else { newguitext = _(_value); } - + Gtk::Label * label; - int padding = 12 + _indent; if (_mode == HEADER) { label = Gtk::manage(new Gtk::Label(Glib::ustring("") +newguitext + Glib::ustring(""), Gtk::ALIGN_START)); - label->set_margin_top(5); - label->set_margin_bottom(5); + label->set_margin_top(5); + label->set_margin_bottom(5); label->set_use_markup(true); - padding = _indent; } else { label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_START)); } @@ -92,7 +87,7 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node label->show(); Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - hbox->pack_start(*label, true, true, padding); + hbox->pack_start(*label, true, true); hbox->show(); return hbox; diff --git a/src/extension/param/description.h b/src/extension/param/description.h index 3a72c4112..aa3c3a798 100644 --- a/src/extension/param/description.h +++ b/src/extension/param/description.h @@ -34,16 +34,17 @@ public: const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, + const gchar * gui_tip, + int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); private: /** \brief Internal value. */ gchar * _value; AppearanceMode _mode; - int _indent; const gchar* _context; }; diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 8bc0fbda7..9f254041a 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -46,12 +46,17 @@ public: }; -ParamComboBox::ParamComboBox(const gchar *name, const gchar *guitext, const gchar *desc, - const Parameter::_scope_t scope, bool gui_hidden, const gchar *gui_tip, - Inkscape::Extension::Extension *ext, Inkscape::XML::Node *xml) - : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext) +ParamComboBox::ParamComboBox(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) , _value(NULL) - , _indent(0) , choices(NULL) { const char *xmlval = NULL; // the value stored in XML @@ -94,17 +99,12 @@ ParamComboBox::ParamComboBox(const gchar *name, const gchar *guitext, const gcha } } } - + // Initialize _value with the default value from xml // for simplicity : default to the contents of the first xml-child if (xml->firstChild() && xml->firstChild()->firstChild()) { xmlval = xml->firstChild()->attribute("value"); } - - const char *indent = xml->attribute("indent"); - if (indent != NULL) { - _indent = atoi(indent) * 12; - } } gchar * pref_name = this->pref_name(); @@ -253,7 +253,7 @@ Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * n Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); - hbox->pack_start(*label, false, false, _indent); + hbox->pack_start(*label, false, false); ParamComboBoxEntry * combo = Gtk::manage(new ParamComboBoxEntry(this, doc, node, changeSignal)); // add choice strings: diff --git a/src/extension/param/enum.h b/src/extension/param/enum.h index 52e018469..f9d3d75f7 100644 --- a/src/extension/param/enum.h +++ b/src/extension/param/enum.h @@ -34,12 +34,20 @@ private: been allocated in memory. And should be free'd. It is the value of the current selected string */ gchar * _value; - int _indent; GSList * choices; /**< A table to store the choice strings */ public: - ParamComboBox(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); + ParamComboBox(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml); virtual ~ParamComboBox(void); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); // Explicitly call superclass version to avoid method being hidden. diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 23a03ea8f..fd82ab312 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -27,17 +27,21 @@ namespace Extension { /** Use the superclass' allocator and set the \c _value. */ -ParamFloat::ParamFloat (const gchar * name, - const gchar * guitext, - const gchar * desc, - const Parameter::_scope_t scope, - bool gui_hidden, - const gchar * gui_tip, - Inkscape::Extension::Extension * ext, - Inkscape::XML::Node * xml, - AppearanceMode mode) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), - _value(0.0), _mode(mode), _indent(0), _min(0.0), _max(10.0) +ParamFloat::ParamFloat(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml, + AppearanceMode mode) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + , _value(0.0) + , _mode(mode) + , _min(0.0) + , _max(10.0) { const gchar * defaultval = NULL; if (xml->firstChild() != NULL) { @@ -69,11 +73,6 @@ ParamFloat::ParamFloat (const gchar * name, _min = 0.0; } - const char * indent = xml->attribute("indent"); - if (indent != NULL) { - _indent = atoi(indent) * 12; - } - gchar * pref_name = this->pref_name(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); _value = prefs->getDouble(extension_pref_root + pref_name, _value); @@ -179,7 +178,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod auto pfa = new ParamFloatAdjustment(this, doc, node, changeSignal); Glib::RefPtr fadjust(pfa); - + if (_mode == FULL) { UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, _precision); @@ -192,7 +191,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); - hbox->pack_start(*label, true, true, _indent); + hbox->pack_start(*label, true, true); auto spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 0.1, _precision)); spin->show(); diff --git a/src/extension/param/float.h b/src/extension/param/float.h index 42b1698b1..7fd86cea7 100644 --- a/src/extension/param/float.h +++ b/src/extension/param/float.h @@ -29,15 +29,17 @@ public: enum AppearanceMode { FULL, MINIMAL }; - ParamFloat (const gchar * name, - const gchar * guitext, - const gchar * desc, - const Parameter::_scope_t scope, - bool gui_hidden, - const gchar * gui_tip, - Inkscape::Extension::Extension * ext, - Inkscape::XML::Node * xml, - AppearanceMode mode); + ParamFloat(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml, + AppearanceMode mode); + /** Returns \c _value. */ float get(const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) const { return _value; } @@ -60,7 +62,6 @@ private: /** Internal value. */ float _value; AppearanceMode _mode; - int _indent; float _min; float _max; int _precision; diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 222d4f243..24b1390d1 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -27,17 +27,21 @@ namespace Extension { /** Use the superclass' allocator and set the \c _value. */ -ParamInt::ParamInt (const gchar * name, - const gchar * guitext, - const gchar * desc, - const Parameter::_scope_t scope, - bool gui_hidden, - const gchar * gui_tip, - Inkscape::Extension::Extension * ext, - Inkscape::XML::Node * xml, - AppearanceMode mode) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), - _value(0), _mode(mode), _indent(0), _min(0), _max(10) +ParamInt::ParamInt(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml, + AppearanceMode mode) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + , _value(0) + , _mode(mode) + , _min(0) + , _max(10) { const char * defaultval = NULL; if (xml->firstChild() != NULL) { @@ -62,11 +66,6 @@ ParamInt::ParamInt (const gchar * name, _min = 0; } - const char * indent = xml->attribute("indent"); - if (indent != NULL) { - _indent = atoi(indent) * 12; - } - gchar *pref_name = this->pref_name(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); _value = prefs->getInt(extension_pref_root + pref_name, _value); @@ -169,10 +168,10 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal hbox->pack_start(*scale, false, false); } else if (_mode == MINIMAL) { - + Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); - hbox->pack_start(*label, true, true, _indent); + hbox->pack_start(*label, true, true); auto spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 1.0, 0)); spin->show(); diff --git a/src/extension/param/int.h b/src/extension/param/int.h index 3fd6cea9b..40c0395ec 100644 --- a/src/extension/param/int.h +++ b/src/extension/param/int.h @@ -29,15 +29,16 @@ public: enum AppearanceMode { FULL, MINIMAL }; - ParamInt (const gchar * name, - const gchar * guitext, - const gchar * desc, - const Parameter::_scope_t scope, - bool gui_hidden, - const gchar * gui_tip, - Inkscape::Extension::Extension * ext, - Inkscape::XML::Node * xml, - AppearanceMode mode); + ParamInt(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml, + AppearanceMode mode); /** Returns \c _value. */ int get(const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) const { return _value; } @@ -59,7 +60,6 @@ private: /** Internal value. */ int _value; AppearanceMode _mode; - int _indent; int _min; int _max; }; diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 957d12d06..bfdff885a 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -54,8 +54,16 @@ private: public: static ParamNotebookPage * makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext); - ParamNotebookPage(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); + ParamNotebookPage(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml); ~ParamNotebookPage(void); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void paramString (std::list &list); gchar * get_guitext (void) {return _text;}; @@ -63,8 +71,15 @@ public: }; /* class ParamNotebookPage */ -ParamNotebookPage::ParamNotebookPage (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext) +ParamNotebookPage::ParamNotebookPage(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, /*indent*/ 0, ext) { parameters = NULL; @@ -206,9 +221,11 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod Parameter * param = reinterpret_cast(list->data); Gtk::Widget * widg = param->get_widget(doc, node, changeSignal); if (widg) { - gchar const * tip = param->get_tooltip(); - // printf("Tip: '%s'\n", tip); + int indent = param->get_indent(); + widg->set_margin_left(indent*12); vbox->pack_start(*widg, false, false, 2); + + gchar const * tip = param->get_tooltip(); if (tip) { widg->set_tooltip_text(_(tip)); } else { @@ -224,8 +241,16 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod } -ParamNotebook::ParamNotebook (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext) +ParamNotebook::ParamNotebook(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) { pages = NULL; diff --git a/src/extension/param/notebook.h b/src/extension/param/notebook.h index 3c90964fd..278c4de12 100644 --- a/src/extension/param/notebook.h +++ b/src/extension/param/notebook.h @@ -41,8 +41,17 @@ private: This only gets created if there are pages in this notebook */ public: - ParamNotebook(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); + ParamNotebook(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml); virtual ~ParamNotebook(void); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); /** diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index a5632a39a..c8b30863b 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -78,6 +78,17 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex /* else stays false */ } } + int indent = 0; + { + const char *indent_attr = in_repr->attribute("indent"); + if (indent_attr != NULL) { + if (strcmp(indent_attr, "true") == 0) { + indent = 1; + } else { + indent = atoi(indent_attr); + } + } + } const gchar* appearance = in_repr->attribute("appearance"); Parameter::_scope_t scope = Parameter::SCOPE_USER; @@ -96,21 +107,21 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex Parameter * param = NULL; if (!strcmp(type, "boolean")) { - param = new ParamBool(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); + param = new ParamBool(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr); } else if (!strcmp(type, "int")) { if (appearance && !strcmp(appearance, "full")) { - param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamInt::FULL); + param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamInt::FULL); } else { - param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamInt::MINIMAL); + param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamInt::MINIMAL); } } else if (!strcmp(type, "float")) { if (appearance && !strcmp(appearance, "full")) { - param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamFloat::FULL); + param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamFloat::FULL); } else { - param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamFloat::MINIMAL); + param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamFloat::MINIMAL); } } else if (!strcmp(type, "string")) { - param = new ParamString(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); + param = new ParamString(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr); gchar const * max_length = in_repr->attribute("max_length"); if (max_length != NULL) { ParamString * ps = dynamic_cast(param); @@ -118,22 +129,22 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex } } else if (!strcmp(type, "description")) { if (appearance && !strcmp(appearance, "header")) { - param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamDescription::HEADER); + param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamDescription::HEADER); } else { - param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamDescription::DESC); - } + param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamDescription::DESC); + } } else if (!strcmp(type, "enum")) { - param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); + param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr); } else if (!strcmp(type, "notebook")) { - param = new ParamNotebook(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); + param = new ParamNotebook(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr); } else if (!strcmp(type, "optiongroup")) { if (appearance && !strcmp(appearance, "minimal")) { - param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamRadioButton::MINIMAL); + param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamRadioButton::MINIMAL); } else { - param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamRadioButton::FULL); + param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamRadioButton::FULL); } } else if (!strcmp(type, "color")) { - param = new ParamColor(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); + param = new ParamColor(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr); } // Note: param could equal NULL @@ -280,12 +291,13 @@ Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node) /** Oop, now that we need a parameter, we need it's name. */ -Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * desc, const Parameter::_scope_t scope, bool gui_hidden, gchar const * gui_tip, Inkscape::Extension::Extension * ext) : +Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * desc, const Parameter::_scope_t scope, bool gui_hidden, gchar const * gui_tip, int indent, Inkscape::Extension::Extension * ext) : _desc(0), _scope(scope), _text(0), _gui_hidden(gui_hidden), _gui_tip(0), + _indent(indent), extension(ext), _name(0) { @@ -316,6 +328,7 @@ Parameter::Parameter (gchar const * name, gchar const * guitext, Inkscape::Exten _text(0), _gui_hidden(false), _gui_tip(0), + _indent(0), extension(ext), _name(0) { diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h index 5e1e3897f..c787a7c97 100644 --- a/src/extension/param/parameter.h +++ b/src/extension/param/parameter.h @@ -37,7 +37,7 @@ class Extension; */ extern Glib::ustring const extension_pref_root; -/** +/** * A class to represent the parameter of an extension. * * This is really a super class that allows them to abstract all @@ -62,6 +62,7 @@ public: const Parameter::_scope_t scope, bool gui_hidden, gchar const *gui_tip, + int indent, Inkscape::Extension::Extension * ext); Parameter(gchar const *name, @@ -144,6 +145,9 @@ public: /** Indicates if the GUI for this parameter is hidden or not */ bool get_gui_hidden() const { return _gui_hidden; } + /** Indentation level of the parameter */ + int get_indent() const { return _indent; } + virtual void string(std::list &list) const; /** @@ -171,6 +175,9 @@ protected: /** A tip for the GUI if there is one. */ gchar * _gui_tip; + /** Indentation level of the parameter. */ + int _indent; + /* **** funcs **** */ diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index c54cc0ec3..fd1b6e04e 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -57,17 +57,20 @@ public: Glib::ustring * guitext; }; -ParamRadioButton::ParamRadioButton (const gchar * name, - const gchar * guitext, - const gchar * desc, - const Parameter::_scope_t scope, - bool gui_hidden, - const gchar * gui_tip, - Inkscape::Extension::Extension * ext, - Inkscape::XML::Node * xml, - AppearanceMode mode) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), - _value(0), _mode(mode), _indent(0), choices(0) +ParamRadioButton::ParamRadioButton(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml, + AppearanceMode mode) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + , _value(0) + , _mode(mode) + , choices(0) { // Read XML tree to add enumeration items: // printf("Extension Constructor: "); @@ -118,11 +121,6 @@ ParamRadioButton::ParamRadioButton (const gchar * name, defaultval = (static_cast (choices->data))->value->c_str(); } - const char *indent = xml ? xml->attribute("indent") : NULL; - if (indent != NULL) { - _indent = atoi(indent) * 12; - } - gchar * pref_name = this->pref_name(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring paramval = prefs->getString(extension_pref_root + pref_name); @@ -310,7 +308,7 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START, Gtk::ALIGN_START)); label->show(); - hbox->pack_start(*label, false, false, _indent); + hbox->pack_start(*label, false, false); Gtk::ComboBoxText* cbt = 0; bool comboSet = false; diff --git a/src/extension/param/radiobutton.h b/src/extension/param/radiobutton.h index 0e0f643c9..5e15dcb57 100644 --- a/src/extension/param/radiobutton.h +++ b/src/extension/param/radiobutton.h @@ -40,10 +40,12 @@ public: const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, + int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode); virtual ~ParamRadioButton(void); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); // Explicitly call superclass version to avoid method being hidden. @@ -63,7 +65,6 @@ private: It is the value of the current selected string */ gchar * _value; AppearanceMode _mode; - int _indent; GSList * choices; /**< A table to store the choice strings */ }; /* class ParamRadioButton */ diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index 1d9205502..f7d3c9662 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -24,7 +24,7 @@ namespace Inkscape { namespace Extension { - + /** Free the allocated data. */ ParamString::~ParamString(void) @@ -76,20 +76,23 @@ void ParamString::string(std::string &string) const } /** Initialize the object, to do that, copy the data. */ -ParamString::ParamString (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), - _value(NULL), _indent(0) +ParamString::ParamString(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + , _value(NULL) { const char * defaultval = NULL; if (xml->firstChild() != NULL) { defaultval = xml->firstChild()->content(); } - const char * indent = xml->attribute("indent"); - if (indent != NULL) { - _indent = atoi(indent) * 12; - } - gchar * pref_name = this->pref_name(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring paramval = prefs->getString(extension_pref_root + pref_name); @@ -168,7 +171,7 @@ Gtk::Widget * ParamString::get_widget(SPDocument * doc, Inkscape::XML::Node * no Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); - hbox->pack_start(*label, false, false, _indent); + hbox->pack_start(*label, false, false); ParamStringEntry * textbox = new ParamStringEntry(this, doc, node, changeSignal); textbox->show(); diff --git a/src/extension/param/string.h b/src/extension/param/string.h index 3b137aeac..f5412ebcc 100644 --- a/src/extension/param/string.h +++ b/src/extension/param/string.h @@ -19,12 +19,19 @@ private: /** \brief Internal value. This should point to a string that has been allocated in memory. And should be free'd. */ gchar * _value; - /** \brief Internal value. This indicates the maximum leght of the string. Zero meaning unlimited. + /** \brief Internal value. This indicates the maximum lenth of the string. Zero meaning unlimited. */ - int _indent; gint _max_length; public: - ParamString(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); + ParamString(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml); virtual ~ParamString(void); /** \brief Returns \c _value, with a \i const to protect it. */ -- cgit v1.2.3 From 2295a47ec000543b6316213e54f715dc4d1e64c9 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 12 Feb 2017 19:51:27 +0100 Subject: Extensions: Harmonize appearance and try to simplify layouting a bit (bzr r15509) --- src/extension/extension.cpp | 6 ++++-- src/extension/param/notebook.cpp | 7 ++++--- src/extension/param/parameter.h | 9 +++++++++ src/extension/prefdialog.cpp | 12 ++++++------ 4 files changed, 23 insertions(+), 11 deletions(-) (limited to 'src/extension') diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 2d020aa0e..8b5a687ef 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -694,8 +694,8 @@ public: */ void addWidget(Gtk::Widget *widg, gchar const *tooltip, int indent) { if (widg) { - widg->set_margin_left(indent*12); - this->pack_start(*widg, false, false, 2); + widg->set_margin_left(indent * Parameter::GUI_INDENTATION); + this->pack_start(*widg, false, false, 0); if (tooltip) { widg->set_tooltip_text(_(tooltip)); } else { @@ -722,6 +722,8 @@ Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signalset_border_width(Parameter::GUI_BOX_MARGIN); + agui->set_spacing(Parameter::GUI_BOX_SPACING); //go through the list of parameters to see if there are any non-hidden ones for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index bfdff885a..8ef48926e 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -214,7 +214,8 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod } Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox); - vbox->set_border_width(5); + vbox->set_border_width(Parameter::GUI_BOX_MARGIN); + vbox->set_spacing(Parameter::GUI_BOX_SPACING); // add parameters onto page (if any) for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { @@ -222,8 +223,8 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod Gtk::Widget * widg = param->get_widget(doc, node, changeSignal); if (widg) { int indent = param->get_indent(); - widg->set_margin_left(indent*12); - vbox->pack_start(*widg, false, false, 2); + widg->set_margin_left(indent * Parameter::GUI_INDENTATION); + vbox->pack_start(*widg, false, false, 0); gchar const * tip = param->get_tooltip(); if (tip) { diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h index c787a7c97..edbd9ce08 100644 --- a/src/extension/param/parameter.h +++ b/src/extension/param/parameter.h @@ -159,6 +159,15 @@ public: /** All the code in Notebook::get_param to get the notebook content. */ virtual Parameter *get_param(gchar const *name); + + /** Recommended margin of boxes containing parameters */ + const static int GUI_BOX_MARGIN = 10; + /** Recommended spacing between individual parameters when packing into boxes */ + const static int GUI_BOX_SPACING = 4; + /** Recommended indentation width of parameters */ + const static int GUI_INDENTATION = 12; + + protected: /** Description of the parameter. */ gchar * _desc; diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index fcc88853d..e98d88b2d 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -59,11 +59,10 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co controls = _effect->get_imp()->prefs_effect(_effect, SP_ACTIVE_DESKTOP, &_signal_param_change, NULL); _signal_param_change.connect(sigc::mem_fun(this, &PrefDialog::param_change)); } - - hbox->pack_start(*controls, true, true, 6); + hbox->pack_start(*controls, true, true, 0); hbox->show(); - this->get_content_area()->pack_start(*hbox, true, true, 6); + this->get_content_area()->pack_start(*hbox, true, true, 0); /* Gtk::Button * help_button = add_button(Gtk::Stock::HELP, Gtk::RESPONSE_HELP); @@ -88,15 +87,16 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co auto sep = Gtk::manage(new Gtk::Separator()); sep->show(); - this->get_content_area()->pack_start(*sep, true, true, 4); + this->get_content_area()->pack_start(*sep, false, false, Parameter::GUI_BOX_SPACING); hbox = Gtk::manage(new Gtk::HBox()); + hbox->set_border_width(Parameter::GUI_BOX_MARGIN); _button_preview = _param_preview->get_widget(NULL, NULL, &_signal_preview); _button_preview->show(); - hbox->pack_start(*_button_preview, true, true,6); + hbox->pack_start(*_button_preview, true, true, 0); hbox->show(); - this->get_content_area()->pack_start(*hbox, true, true, 6); + this->get_content_area()->pack_start(*hbox, false, false, 0); Gtk::Box * hbox = dynamic_cast(_button_preview); if (hbox != NULL) { -- cgit v1.2.3 From c85e99bd33de9d7d2129bf21cd29cca9f4c50f79 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 13 Feb 2017 02:39:21 +0100 Subject: Extensions: Make "int" and "float" parameters specifying 'appearance="full"'expand in horizontal direction when the window is expanded (bzr r15510) --- src/extension/param/float.cpp | 2 +- src/extension/param/int.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index fd82ab312..dd7087968 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -184,7 +184,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, _precision); scale->set_size_request(400, -1); scale->show(); - hbox->pack_start(*scale, false, false); + hbox->pack_start(*scale, true, true); } else if (_mode == MINIMAL) { diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 24b1390d1..ba51df2a3 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -165,7 +165,7 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, 0); scale->set_size_request(400, -1); scale->show(); - hbox->pack_start(*scale, false, false); + hbox->pack_start(*scale, true, true); } else if (_mode == MINIMAL) { -- cgit v1.2.3 From a2e57d792590665163dd07eb5e926017e40ccb90 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 13 Feb 2017 02:46:19 +0100 Subject: Extensions: Work around gtk3 width/height calculation bug for long labels Also use constants for most dimensions so they can easily be chaned in future. (bzr r15511) --- src/extension/param/bool.cpp | 2 +- src/extension/param/color.cpp | 4 ++-- src/extension/param/description.cpp | 15 ++++++++++++++- src/extension/param/enum.cpp | 2 +- src/extension/param/float.cpp | 2 +- src/extension/param/int.cpp | 2 +- src/extension/param/parameter.h | 10 +++++++--- src/extension/param/radiobutton.cpp | 2 +- src/extension/param/string.cpp | 2 +- src/extension/prefdialog.cpp | 2 ++ 10 files changed, 31 insertions(+), 12 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index 833215546..9f8d3dcc0 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -133,7 +133,7 @@ Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node, return NULL; } - auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); + auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING)); hbox->set_homogeneous(false); Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index 041cd5509..fd88e9adb 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -106,9 +106,9 @@ Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * _color_changed.block(false); } - Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, 4)); + Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); Gtk::Widget *selector = Gtk::manage(new ColorNotebook(_color)); - hbox->pack_start (*selector, true, true, 0); + hbox->pack_start(*selector, true, true, 0); selector->show(); hbox->show(); return hbox; diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 7f7d2d976..898544e94 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -84,9 +84,22 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_START)); } label->set_line_wrap(); + label->set_xalign(0); + + // TODO: Ugly "fix" for gtk3 width/height calculation of labels. + // - If not applying any limits long labels will make the window grow horizontally until it uses up + // most of the available space (i.e. most of the screen area) which is ridicously wide + // - By using "set_default_size(0,0)" in prefidalog.cpp we tell the window to shrink as much as possible, + // however this can result in a much to narrow dialog instead and much unnecessary wrapping + // - Here we set a lower limit of GUI_MAX_LINE_LENGTH characters per line that long texts will always use + // This means texts can not shrink anymore (they can still grow, though) and it's also necessary + // to prevent https://bugzilla.gnome.org/show_bug.cgi?id=773572 + int len = newguitext.length(); + label->set_width_chars(len > Parameter::GUI_MAX_LINE_LENGTH ? Parameter::GUI_MAX_LINE_LENGTH : len); + label->show(); - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox()); hbox->pack_start(*label, true, true); hbox->show(); diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 9f254041a..a26458c35 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -250,7 +250,7 @@ Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * n return NULL; } - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false); diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index dd7087968..e3fdba826 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -174,7 +174,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod return NULL; } - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); auto pfa = new ParamFloatAdjustment(this, doc, node, changeSignal); Glib::RefPtr fadjust(pfa); diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index ba51df2a3..538ddc08d 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -155,7 +155,7 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal return NULL; } - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); auto pia = new ParamIntAdjustment(this, doc, node, changeSignal); Glib::RefPtr fadjust(pia); diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h index edbd9ce08..c107f24f9 100644 --- a/src/extension/param/parameter.h +++ b/src/extension/param/parameter.h @@ -160,12 +160,16 @@ public: virtual Parameter *get_param(gchar const *name); - /** Recommended margin of boxes containing parameters */ + /** Recommended margin of boxes containing multiple Parameters (in px) */ const static int GUI_BOX_MARGIN = 10; - /** Recommended spacing between individual parameters when packing into boxes */ + /** Recommended spacing between multiple Parameters packed into a box (in px) */ const static int GUI_BOX_SPACING = 4; - /** Recommended indentation width of parameters */ + /** Recommended spacing between the widgets making up a signle Parameter (e.g. label and input) (in px) */ + const static int GUI_PARAM_WIDGETS_SPACING = 4; + /** Recommended indentation width of parameters (in px) */ const static int GUI_INDENTATION = 12; + /** Recommended maximum line lenght for wrapping textual parameters (in chars) */ + const static int GUI_MAX_LINE_LENGTH = 60; protected: diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index fd1b6e04e..178dc20e8 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -301,7 +301,7 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node return NULL; } - auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); + auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING)); hbox->set_homogeneous(false); auto vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0)); vbox->set_homogeneous(false); diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index f7d3c9662..0c5238f99 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -168,7 +168,7 @@ Gtk::Widget * ParamString::get_widget(SPDocument * doc, Inkscape::XML::Node * no return NULL; } - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false); diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index e98d88b2d..2bdbb081e 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -50,6 +50,8 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co _effect(effect), _exEnv(NULL) { + this->set_default_size(0,0); // we want the window to be as small as possible instead of clobbering up space + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox()); if (controls == NULL) { if (_effect == NULL) { -- cgit v1.2.3 From dbb6ce3b9bd176281fba0f41b4a7aa92b6d35ff3 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 13 Feb 2017 05:25:05 +0100 Subject: Extensions: Fix for old versions of gtkmm Use "Gtk::Misc::set_alignment()" as "Gtk::Label::set_xalign()" is only available since gtkmm 3.16 (bzr r15512) --- src/extension/param/description.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 898544e94..5923adea8 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -84,7 +84,8 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_START)); } label->set_line_wrap(); - label->set_xalign(0); + //label->set_xalign(0); // requires gtkmm 3.16 + label->set_alignment(0); // TODO: Ugly "fix" for gtk3 width/height calculation of labels. // - If not applying any limits long labels will make the window grow horizontally until it uses up -- cgit v1.2.3 From 435717a3469ebb96ce8b8d30fc50d6151f9cbfbb Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 13 Feb 2017 22:35:48 +0100 Subject: Extensions: Do not require name for pure UI elements (i.e. parameters that do not store a value and therefore do not need to have a name) (bzr r15515) --- src/extension/param/parameter.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index c8b30863b..9fbe662f7 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -50,10 +50,17 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex const char *name = in_repr->attribute("name"); const char *type = in_repr->attribute("type"); - // In this case we just don't have enough information - if (!name || !type) { + // we can't create a parameter without type + if (!type) { return NULL; } + // also require name unless it's a pure UI element that does not store its value + if (!name) { + static std::vector ui_elements = {"description"}; + if (std::find(ui_elements.begin(), ui_elements.end(), type) == ui_elements.end()) { + return NULL; + } + } const char *guitext = in_repr->attribute("gui-text"); if (guitext == NULL) { -- cgit v1.2.3 From 419d9545814cb07c252422b20a77063f0f6101d1 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Tue, 14 Feb 2017 00:01:59 +0100 Subject: Extensions: Fix potential security issue with "description" parameters. When using 'appearance="header"' arbitrary markup could be inlcuded (including URLs) (bzr r15518) --- src/extension/param/description.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 5923adea8..3d970b204 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include "xml/node.h" #include "extension/extension.h" @@ -74,18 +75,17 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node newguitext = _(_value); } - Gtk::Label * label; + Gtk::Label * label = Gtk::manage(new Gtk::Label()); if (_mode == HEADER) { - label = Gtk::manage(new Gtk::Label(Glib::ustring("") +newguitext + Glib::ustring(""), Gtk::ALIGN_START)); + label->set_markup(Glib::ustring("") + Glib::Markup::escape_text(newguitext) + Glib::ustring("")); label->set_margin_top(5); label->set_margin_bottom(5); - label->set_use_markup(true); } else { - label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_START)); + label->set_text(newguitext); } label->set_line_wrap(); //label->set_xalign(0); // requires gtkmm 3.16 - label->set_alignment(0); + label->set_alignment(Gtk::ALIGN_START); // TODO: Ugly "fix" for gtk3 width/height calculation of labels. // - If not applying any limits long labels will make the window grow horizontally until it uses up -- cgit v1.2.3 From 24d66b5173963dcb69545614449de91da5397db6 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Tue, 14 Feb 2017 00:42:11 +0100 Subject: Extensions: Add 'appearance="url"' to desccription parameters. It allows to create and add a clickable plain text link to extensions The description parameter's text is escaped and converted to a URL as-is preventing potential security issues The Scour extension shows a first example implementation (bzr r15519) --- src/extension/param/description.cpp | 3 +++ src/extension/param/description.h | 2 +- src/extension/param/parameter.cpp | 12 ++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 3d970b204..7cf818280 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -80,6 +80,9 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node label->set_markup(Glib::ustring("") + Glib::Markup::escape_text(newguitext) + Glib::ustring("")); label->set_margin_top(5); label->set_margin_bottom(5); + } else if (_mode == URL) { + Glib::ustring escaped_url = Glib::Markup::escape_text(newguitext); + label->set_markup(Glib::ustring::compose("%1", escaped_url)); } else { label->set_text(newguitext); } diff --git a/src/extension/param/description.h b/src/extension/param/description.h index aa3c3a798..c6c5f4013 100644 --- a/src/extension/param/description.h +++ b/src/extension/param/description.h @@ -27,7 +27,7 @@ namespace Extension { class ParamDescription : public Parameter { public: enum AppearanceMode { - DESC, HEADER + DESC, HEADER, URL }; ParamDescription(const gchar * name, const gchar * guitext, diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 9fbe662f7..0eb491078 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -135,11 +135,15 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex ps->setMaxLength(atoi(max_length)); } } else if (!strcmp(type, "description")) { - if (appearance && !strcmp(appearance, "header")) { - param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamDescription::HEADER); - } else { - param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamDescription::DESC); + ParamDescription::AppearanceMode appearance_mode = ParamDescription::DESC; + if (appearance) { + if (!strcmp(appearance, "header")) { + appearance_mode = ParamDescription::HEADER; + } else if (!strcmp(appearance, "url")) { + appearance_mode = ParamDescription::URL; + } } + param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, appearance_mode); } else if (!strcmp(type, "enum")) { param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr); } else if (!strcmp(type, "notebook")) { -- cgit v1.2.3 From f4784ce3e582db53e07361f50eafc3762bf03398 Mon Sep 17 00:00:00 2001 From: mathog <> Date: Fri, 17 Feb 2017 09:25:09 -0800 Subject: resolve bug 1665421 (bzr r15525) --- src/extension/internal/wmf-inout.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/extension') diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index a79af5ec1..42ec2f2bb 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -1765,11 +1765,20 @@ std::cout << "BEFORE DRAW" << " test0 " << ( d->mask & U_DRAW_VISIBLE) << " test1 " << ( d->mask & U_DRAW_FORCE) << " test2 " << (wmr_mask & U_DRAW_ALTERS) + << " test2.5 " << ((d->mask & U_DRAW_NOFILL) != (wmr_mask & U_DRAW_NOFILL) ) << " test3 " << (wmr_mask & U_DRAW_VISIBLE) << " test4 " << !(d->mask & U_DRAW_ONLYTO) << " test5 " << ((d->mask & U_DRAW_ONLYTO) && !(wmr_mask & U_DRAW_ONLYTO) ) << std::endl; */ + /* spurious moveto records should not affect the drawing. However, they set the NOFILL + bit and that messes up the logic about when to emit a path. So prune out any + stray moveto records. That is those which were never followed by a lineto. + */ + if((d->mask & U_DRAW_NOFILL) && !(d->mask & U_DRAW_VISIBLE) && + !(wmr_mask & U_DRAW_ONLYTO) && (wmr_mask & U_DRAW_VISIBLE)){ + d->mask ^= U_DRAW_NOFILL; + } if( (wmr_mask != U_WMR_INVALID) && // next record is valid type @@ -1777,6 +1786,7 @@ std::cout << "BEFORE DRAW" ( (d->mask & U_DRAW_FORCE) || // This draw is forced by STROKE/FILL/STROKEANDFILL PATH (wmr_mask & U_DRAW_ALTERS) || // Next record would alter the drawing environment in some way + ((d->mask & U_DRAW_NOFILL) != (wmr_mask & U_DRAW_NOFILL)) || // Fill<->!Fill requires a draw between ( (wmr_mask & U_DRAW_VISIBLE) && // Next record is visible... ( ( !(d->mask & U_DRAW_ONLYTO) ) || // Non *TO records cannot be followed by any Visible -- cgit v1.2.3 From ec50243a7a1731517e2fac792d7feb67e87e8889 Mon Sep 17 00:00:00 2001 From: mathog <> Date: Fri, 17 Feb 2017 09:27:30 -0800 Subject: improve dot dash support in wmf export (bzr r15526) --- src/extension/internal/wmf-print.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index 3d913bf1e..6dd9d895e 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -598,7 +598,28 @@ int PrintWmf::create_pen(SPStyle const *style, const Geom::Affine &transform) if (!style->stroke_dasharray.values.empty()) { if (!FixPPTDashLine) { // if this is set code elsewhere will break dots/dashes into many smaller lines. - penstyle = U_PS_DASH;// userstyle not supported apparently, for now map all Inkscape dot/dash to just dash + int n_dash = style->stroke_dasharray.values.size(); + /* options are dash, dot, dashdot and dashdotdot. Try to pick the closest one. */ + int mark_short=INT_MAX; + int mark_long =0; + int i; + for (i=0;istroke_dasharray.values[i]; + if (mark>mark_long) { mark_long = mark; } + if (mark Date: Sat, 18 Feb 2017 21:46:44 +0100 Subject: [Bug #1664372] preset filter names inconsistent. Fixed bugs: - https://launchpad.net/bugs/1664372 (bzr r15532) --- src/extension/internal/filter/color.h | 2 +- src/extension/internal/filter/protrusions.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index a6b777d20..6324dafa9 100644 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -1480,7 +1480,7 @@ public: static void init (void) { Inkscape::Extension::build_from_mem( "\n" - "" N_("Quadritone fantasy") "\n" + "" N_("Quadritone Fantasy") "\n" "org.inkscape.effect.filter.Quadritone\n" "280\n" "100\n" diff --git a/src/extension/internal/filter/protrusions.h b/src/extension/internal/filter/protrusions.h index ad75d8896..d6fd315db 100644 --- a/src/extension/internal/filter/protrusions.h +++ b/src/extension/internal/filter/protrusions.h @@ -45,7 +45,7 @@ public: static void init (void) { Inkscape::Extension::build_from_mem( "\n" - "" N_("Snow crest") "\n" + "" N_("Snow Crest") "\n" "org.inkscape.effect.filter.snow\n" "3.5\n" "\n" -- cgit v1.2.3 From 80cdddd1120a4922257039847978f50d660f31f2 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 26 Feb 2017 17:31:58 +0000 Subject: Gtk+ 3 deprecation fixes (bzr r15547) --- src/extension/extension.cpp | 4 ++++ src/extension/param/description.cpp | 2 +- src/extension/param/notebook.cpp | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 8b5a687ef..6c6e2d71e 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -694,7 +694,11 @@ public: */ void addWidget(Gtk::Widget *widg, gchar const *tooltip, int indent) { if (widg) { +#if GTK_CHECK_VERSION(3,12,0) + widg->set_margin_start(indent * Parameter::GUI_INDENTATION); +#else widg->set_margin_left(indent * Parameter::GUI_INDENTATION); +#endif this->pack_start(*widg, false, false, 0); if (tooltip) { widg->set_tooltip_text(_(tooltip)); diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 7cf818280..d0698a00e 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -88,7 +88,7 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node } label->set_line_wrap(); //label->set_xalign(0); // requires gtkmm 3.16 - label->set_alignment(Gtk::ALIGN_START); + label->set_halign(Gtk::ALIGN_START); // TODO: Ugly "fix" for gtk3 width/height calculation of labels. // - If not applying any limits long labels will make the window grow horizontally until it uses up diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 8ef48926e..de86d1005 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -223,7 +223,11 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod Gtk::Widget * widg = param->get_widget(doc, node, changeSignal); if (widg) { int indent = param->get_indent(); +#if GTK_CHECK_VERSION(3,12,0) + widg->set_margin_start(indent * Parameter::GUI_INDENTATION); +#else widg->set_margin_left(indent * Parameter::GUI_INDENTATION); +#endif vbox->pack_start(*widg, false, false, 0); gchar const * tip = param->get_tooltip(); -- cgit v1.2.3 From 677ee6d0e188fd994975b9295a4069db8918a73e Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 5 Mar 2017 16:06:23 +0100 Subject: Fix ACLs (bzr r15567) --- src/extension/dbus/builddocs.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/extension/dbus/builddocs.sh (limited to 'src/extension') diff --git a/src/extension/dbus/builddocs.sh b/src/extension/dbus/builddocs.sh old mode 100755 new mode 100644 -- cgit v1.2.3 From 940e63b3a27e3dc7a30f5c72c445b4323f570e1a Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 6 Mar 2017 02:00:39 +0100 Subject: EMF/WFM export: Fix crash when selecting "Convert gradients to colored polygon series" The problem where calls of "sprintf()" to format SVG path data. Unfortunately depending on the locale set at this point via "setlocale()" the output could contain commas (,) instead of dots (.) as decimal spearator resulting in invalid path data. Fixed bugs: - https://launchpad.net/bugs/1549015 (bzr r15568) --- src/extension/internal/metafile-print.cpp | 34 +++++++++++++++++++++++++------ src/extension/internal/metafile-print.h | 1 + 2 files changed, 29 insertions(+), 6 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp index 061eb634d..11567ceb3 100644 --- a/src/extension/internal/metafile-print.cpp +++ b/src/extension/internal/metafile-print.cpp @@ -355,6 +355,27 @@ int PrintMetafile::hold_gradient(void *gr, int mode) return 1; } +/* behaves like snprintf() but makes sure decimal separators are formatted as dots + otherwise invalid strings can be produced depending on the set locale +*/ +int PrintMetafile::snprintf_dots(char * s, size_t n, const char * format, ...) +{ + int nChars; + + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + setlocale(LC_NUMERIC, "C"); + + va_list argptr; + va_start(argptr, format); + nChars = vsnprintf(s, n, format, argptr); + va_end(argptr); + + setlocale(LC_NUMERIC, oldlocale); + g_free(oldlocale); + + return nChars; +} + /* convert from center ellipse to SVGEllipticalArc ellipse From: @@ -390,7 +411,8 @@ Geom::PathVector PrintMetafile::center_ellipse_as_SVG_PathV(Geom::Point ctr, dou y2 = ctr[Y] + sin(F) * rx * cos(M_PI) + cos(F) * ry * sin(M_PI); char text[256]; - sprintf(text, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z", x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1); + snprintf_dots(text, 256, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z", + x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1); Geom::PathVector outres = Geom::parse_svg_path(text); return outres; } @@ -418,9 +440,9 @@ Geom::PathVector PrintMetafile::center_elliptical_ring_as_SVG_PathV(Geom::Point y22 = ctr[Y] + sin(F) * rx2 * cos(M_PI) + cos(F) * ry2 * sin(M_PI); char text[512]; - sprintf(text, " M %f,%f A %f %f %f 0 1 %f %f A %f %f %f 0 1 %f %f z M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z", - x11, y11, rx1, ry1, degrot, x12, y12, rx1, ry1, degrot, x11, y11, - x21, y21, rx2, ry2, degrot, x22, y22, rx2, ry2, degrot, x21, y21); + snprintf_dots(text, 512, " M %f,%f A %f %f %f 0 1 %f %f A %f %f %f 0 1 %f %f z M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z", + x11, y11, rx1, ry1, degrot, x12, y12, rx1, ry1, degrot, x11, y11, + x21, y21, rx2, ry2, degrot, x22, y22, rx2, ry2, degrot, x21, y21); Geom::PathVector outres = Geom::parse_svg_path(text); return outres; @@ -440,8 +462,8 @@ Geom::PathVector PrintMetafile::center_elliptical_hole_as_SVG_PathV(Geom::Point y2 = ctr[Y] + sin(F) * rx * cos(M_PI) + cos(F) * ry * sin(M_PI); char text[256]; - sprintf(text, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z M 50000,50000 50000,-50000 -50000,-50000 -50000,50000 z", - x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1); + snprintf_dots(text, 256, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z M 50000,50000 50000,-50000 -50000,-50000 -50000,50000 z", + x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1); Geom::PathVector outres = Geom::parse_svg_path(text); return outres; } diff --git a/src/extension/internal/metafile-print.h b/src/extension/internal/metafile-print.h index d184b72b7..9903cbb98 100644 --- a/src/extension/internal/metafile-print.h +++ b/src/extension/internal/metafile-print.h @@ -101,6 +101,7 @@ protected: static void swapRBinRGBA(char *px, int pixels); int hold_gradient(void *gr, int mode); + static int snprintf_dots(char * s, size_t n, const char * format, ...); static Geom::PathVector center_ellipse_as_SVG_PathV(Geom::Point ctr, double rx, double ry, double F); static Geom::PathVector center_elliptical_ring_as_SVG_PathV(Geom::Point ctr, double rx1, double ry1, double rx2, double ry2, double F); static Geom::PathVector center_elliptical_hole_as_SVG_PathV(Geom::Point ctr, double rx, double ry, double F); -- cgit v1.2.3 From b2b013b1cce5a39a532c9a822b4f30ee1ca54c0e Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Wed, 8 Mar 2017 23:42:43 +0100 Subject: Repair functionality broken by Alex Valvani's "Gtk+ 3 deprecation fixes" (see in r15547 [1]) Gtk::Label::set_halign() is *not* the same as Gtk::Label::set_xalign() or the deprecated Gtk::Label::set_alignment() The former sets the alignment of the widget itself while the latter two set the alignment of the text within the widget's size allocation. Is it really more important to eradicate deprecations then to have working code? http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/15547 (bzr r15580) --- src/extension/param/description.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index d0698a00e..f0a4abdae 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -87,8 +87,11 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node label->set_text(newguitext); } label->set_line_wrap(); - //label->set_xalign(0); // requires gtkmm 3.16 - label->set_halign(Gtk::ALIGN_START); +#if GTK_CHECK_VERSION(3,16,0) + label->set_xalign(0); +#else + label->set_alignment(Gtk::ALIGN_START); +#endif // TODO: Ugly "fix" for gtk3 width/height calculation of labels. // - If not applying any limits long labels will make the window grow horizontally until it uses up -- cgit v1.2.3 From dfb0fa36b9a98a9bda5f04cee9836d915c6b2fe4 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sat, 11 Mar 2017 17:17:58 +0000 Subject: Use Gtkmm version test instead of Gtk+ (bzr r15584) --- src/extension/param/description.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index f0a4abdae..3c29b7c49 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -87,7 +87,7 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node label->set_text(newguitext); } label->set_line_wrap(); -#if GTK_CHECK_VERSION(3,16,0) +#if (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION >= 16) label->set_xalign(0); #else label->set_alignment(Gtk::ALIGN_START); -- cgit v1.2.3 From 67a62b251990df46e683c8277a51db4755689e96 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sat, 11 Mar 2017 18:35:56 +0000 Subject: Fix Gtkmm deprecation warnings in CDR import dialog (bzr r15585) --- src/extension/internal/cdr-input.cpp | 37 ++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index dbe88c668..70bf84ef4 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -41,6 +41,7 @@ #endif #include +#include #include #include "extension/system.h" @@ -83,6 +84,8 @@ private: class Gtk::Widget * _previewArea; class Gtk::Button * cancelbutton; class Gtk::Button * okbutton; + + class Gtk::HBox * _page_selector_box; class Gtk::Label * _labelSelect; class Gtk::Label * _labelTotalPages; class Gtk::SpinButton * _pageNumberSpin; @@ -114,36 +117,38 @@ CdrImportDialog::CdrImportDialog(const std::vector &vec) this->get_content_area()->pack_start(*vbox1); // CONTROLS + _page_selector_box = Gtk::manage(new Gtk::HBox()); - // Buttons - cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true)); - okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true)); - - // Labels + // "Select page:" label _labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:"))); _labelTotalPages = Gtk::manage(new class Gtk::Label()); _labelSelect->set_line_wrap(false); _labelSelect->set_use_markup(false); _labelSelect->set_selectable(false); + _page_selector_box->pack_start(*_labelSelect, Gtk::PACK_SHRINK); + + // Adjustment + spinner + auto pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0); + _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(pageNumberSpin_adj, 1, 0)); + _pageNumberSpin->set_can_focus(); + _pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS); + _pageNumberSpin->set_numeric(true); + _pageNumberSpin->set_wrap(false); + _page_selector_box->pack_start(*_pageNumberSpin, Gtk::PACK_SHRINK); + _labelTotalPages->set_line_wrap(false); _labelTotalPages->set_use_markup(false); _labelTotalPages->set_selectable(false); gchar *label_text = g_strdup_printf(_("out of %i"), num_pages); _labelTotalPages->set_label(label_text); g_free(label_text); + _page_selector_box->pack_start(*_labelTotalPages, Gtk::PACK_SHRINK); - // Adjustment + spinner - auto _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0); - _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(_pageNumberSpin_adj, 1, 0)); - _pageNumberSpin->set_can_focus(); - _pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS); - _pageNumberSpin->set_numeric(true); - _pageNumberSpin->set_wrap(false); + vbox1->pack_end(*_page_selector_box, Gtk::PACK_SHRINK); - this->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END); - this->get_action_area()->add(*_labelSelect); - this->add_action_widget(*_pageNumberSpin, Gtk::RESPONSE_ACCEPT); - this->get_action_area()->add(*_labelTotalPages); + // Buttons + cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true)); + okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true)); this->add_action_widget(*cancelbutton, Gtk::RESPONSE_CANCEL); this->add_action_widget(*okbutton, Gtk::RESPONSE_OK); -- cgit v1.2.3 From ef42c8efd428c3210225dce5c700e85608dcf3eb Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sat, 11 Mar 2017 18:43:34 +0000 Subject: Fix Gtkmm deprecation warnings in VSD import dialog (bzr r15586) --- src/extension/internal/vsd-input.cpp | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index 85698387a..b7277b99e 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -84,6 +84,8 @@ private: class Gtk::Widget * _previewArea; class Gtk::Button * cancelbutton; class Gtk::Button * okbutton; + + class Gtk::HBox * _page_selector_box; class Gtk::Label * _labelSelect; class Gtk::Label * _labelTotalPages; class Gtk::SpinButton * _pageNumberSpin; @@ -116,10 +118,7 @@ VsdImportDialog::VsdImportDialog(const std::vector &vec) this->get_content_area()->pack_start(*vbox1); // CONTROLS - - // Buttons - cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true)); - okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true)); + _page_selector_box = Gtk::manage(new Gtk::HBox()); // Labels _labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:"))); @@ -127,12 +126,7 @@ VsdImportDialog::VsdImportDialog(const std::vector &vec) _labelSelect->set_line_wrap(false); _labelSelect->set_use_markup(false); _labelSelect->set_selectable(false); - _labelTotalPages->set_line_wrap(false); - _labelTotalPages->set_use_markup(false); - _labelTotalPages->set_selectable(false); - gchar *label_text = g_strdup_printf(_("out of %i"), num_pages); - _labelTotalPages->set_label(label_text); - g_free(label_text); + _page_selector_box->pack_start(*_labelSelect, Gtk::PACK_SHRINK); // Adjustment + spinner auto _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0); @@ -141,11 +135,21 @@ VsdImportDialog::VsdImportDialog(const std::vector &vec) _pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS); _pageNumberSpin->set_numeric(true); _pageNumberSpin->set_wrap(false); + _page_selector_box->pack_start(*_pageNumberSpin, Gtk::PACK_SHRINK); - this->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END); - this->get_action_area()->add(*_labelSelect); - this->add_action_widget(*_pageNumberSpin, Gtk::RESPONSE_ACCEPT); - this->get_action_area()->add(*_labelTotalPages); + _labelTotalPages->set_line_wrap(false); + _labelTotalPages->set_use_markup(false); + _labelTotalPages->set_selectable(false); + gchar *label_text = g_strdup_printf(_("out of %i"), num_pages); + _labelTotalPages->set_label(label_text); + g_free(label_text); + _page_selector_box->pack_start(*_labelTotalPages, Gtk::PACK_SHRINK); + + vbox1->pack_end(*_page_selector_box, Gtk::PACK_SHRINK); + + // Buttons + cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true)); + okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true)); this->add_action_widget(*cancelbutton, Gtk::RESPONSE_CANCEL); this->add_action_widget(*okbutton, Gtk::RESPONSE_OK); -- cgit v1.2.3 From e0626ac2b4137fbfcd474b234f93e21da55dfd62 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 13 Mar 2017 21:23:59 +0100 Subject: Attempt to fix build with dbus enabled. (bzr r15593) --- src/extension/dbus/document-interface.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/extension') diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index d3a06b81c..353ed324c 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -606,11 +606,7 @@ document_interface_document_set_display_area (DocumentInterface *doc_interface, { SPDesktop *desk = doc_interface->target.getDesktop(); g_return_val_if_fail(ensure_desktop_valid(desk, error), FALSE); - desk->set_display_area (x0, - y0, - x1, - y1, - border, false); + desk->set_display_area (Geom::Rect( Geom::Point(x0,y0), Geom::Point(x1,y1), border, false )); return TRUE; } -- cgit v1.2.3 From ebe61d9d29d8a20628f45c74041771791af43e1a Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 14 Mar 2017 21:47:24 +0100 Subject: Fix typo. (bzr r15597) --- src/extension/dbus/document-interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index 353ed324c..435e347d0 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -606,7 +606,7 @@ document_interface_document_set_display_area (DocumentInterface *doc_interface, { SPDesktop *desk = doc_interface->target.getDesktop(); g_return_val_if_fail(ensure_desktop_valid(desk, error), FALSE); - desk->set_display_area (Geom::Rect( Geom::Point(x0,y0), Geom::Point(x1,y1), border, false )); + desk->set_display_area (Geom::Rect( Geom::Point(x0,y0), Geom::Point(x1,y1)), border, false ); return TRUE; } -- cgit v1.2.3 From f47466c701b2256b2ce232f6d311d2be47136eab Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 20 Mar 2017 21:12:31 +0100 Subject: Implement rotation via desktop to window affine. Remove rotation via viewbox. Still some work to do... (bzr r15603) --- src/extension/internal/cairo-png-out.cpp | 4 ++-- src/extension/internal/cairo-ps-out.cpp | 7 ++----- src/extension/internal/cairo-renderer-pdf-out.cpp | 4 +--- src/extension/internal/emf-inout.cpp | 5 ++--- src/extension/internal/javafx-out.cpp | 9 ++------- src/extension/internal/latex-pstricks-out.cpp | 2 -- src/extension/internal/odf.cpp | 9 +-------- src/extension/internal/pov-out.cpp | 13 +++---------- src/extension/internal/wmf-inout.cpp | 7 ++----- 9 files changed, 15 insertions(+), 45 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/cairo-png-out.cpp b/src/extension/internal/cairo-png-out.cpp index 5859a82da..956fcce9a 100644 --- a/src/extension/internal/cairo-png-out.cpp +++ b/src/extension/internal/cairo-png-out.cpp @@ -53,10 +53,11 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename) { CairoRenderer *renderer; CairoRenderContext *ctx; - doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; + doc->ensureUpToDate(); /* Start */ + SPItem *base = doc->getRoot(); Inkscape::Drawing drawing; unsigned dkey = SPItem::display_key_new(1); @@ -76,7 +77,6 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename) renderer->destroyContext(ctx); base->invoke_hide(dkey); - doc->getRoot()->c2p *= doc->getRoot()->rotation; /* end */ delete renderer; diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index 809125266..e8f47e79e 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -68,7 +68,6 @@ static bool ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int level, bool texttopath, bool omittext, bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, float bleedmargin_px, bool eps = false) { - doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; doc->ensureUpToDate(); SPItem *base = NULL; @@ -85,10 +84,9 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l pageBoundingBox = !exportDrawing; } - if (!base) { - doc->getRoot()->c2p *= doc->getRoot()->rotation; + if (!base) return false; - } + Inkscape::Drawing drawing; unsigned dkey = SPItem::display_key_new(1); base->invoke_show(drawing, dkey, SP_ITEM_SHOW_DISPLAY); @@ -117,7 +115,6 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l renderer->destroyContext(ctx); delete renderer; - doc->getRoot()->c2p *= doc->getRoot()->rotation; return ret; } diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index 5558fe1ad..5576676b2 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -61,7 +61,6 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int bool texttopath, bool omittext, bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, float bleedmargin_px) { - doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; doc->ensureUpToDate(); /* Start */ @@ -81,7 +80,6 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int } if (!base) { - doc->getRoot()->c2p *= doc->getRoot()->rotation; return false; } @@ -114,7 +112,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int renderer->destroyContext(ctx); delete renderer; - doc->getRoot()->c2p *= doc->getRoot()->rotation; + return ret; } diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 198c18ff2..12751c5ec 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -94,7 +94,7 @@ Emf::print_document_to_file(SPDocument *doc, const gchar *filename) const gchar *oldconst; gchar *oldoutput; unsigned int ret; - doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; + doc->ensureUpToDate(); mod = Inkscape::Extension::get_print(PRINT_EMF); @@ -114,7 +114,6 @@ Emf::print_document_to_file(SPDocument *doc, const gchar *filename) /* Print document */ ret = mod->begin(doc); if (ret) { - doc->getRoot()->c2p *= doc->getRoot()->rotation; g_free(oldoutput); throw Inkscape::Extension::Output::save_failed(); } @@ -128,7 +127,7 @@ Emf::print_document_to_file(SPDocument *doc, const gchar *filename) mod->set_param_string("destination", oldoutput); g_free(oldoutput); - doc->getRoot()->c2p *= doc->getRoot()->rotation; + return; } diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index c95434939..d7ad7e6f7 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -843,8 +843,7 @@ void JavaFXOutput::reset() bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) { reset(); - doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; - doc->ensureUpToDate(); + name = Glib::path_get_basename(filename_utf8); int pos = name.find('.'); @@ -857,14 +856,12 @@ bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) //# Lets do the curves first, to get the stats if (!doTree(doc)) { - doc->getRoot()->c2p *= doc->getRoot()->rotation; return false; } String curveBuf = outbuf; outbuf.clear(); if (!doHeader()) { - doc->getRoot()->c2p *= doc->getRoot()->rotation; return false; } @@ -878,7 +875,6 @@ bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) doBody(doc, doc->getRoot()); if (!doTail()) { - doc->getRoot()->c2p *= doc->getRoot()->rotation; return false; } @@ -888,7 +884,6 @@ bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) FILE *f = Inkscape::IO::fopen_utf8name(filename_utf8, "w"); if (!f) { - doc->getRoot()->c2p *= doc->getRoot()->rotation; err("Could open JavaFX file '%s' for writing", filename_utf8); return false; } @@ -899,7 +894,7 @@ bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) } fclose(f); - doc->getRoot()->c2p *= doc->getRoot()->rotation; + return true; } diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp index aa6ea6963..3ce2c5531 100644 --- a/src/extension/internal/latex-pstricks-out.cpp +++ b/src/extension/internal/latex-pstricks-out.cpp @@ -49,7 +49,6 @@ bool LatexOutput::check(Inkscape::Extension::Extension * /*module*/) void LatexOutput::save(Inkscape::Extension::Output * /*mod2*/, SPDocument *doc, gchar const *filename) { SPPrintContext context; - doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; doc->ensureUpToDate(); Inkscape::Extension::Print *mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_LATEX); @@ -77,7 +76,6 @@ void LatexOutput::save(Inkscape::Extension::Output * /*mod2*/, SPDocument *doc, mod->set_param_string("destination", oldoutput); g_free(oldoutput); - doc->getRoot()->c2p *= doc->getRoot()->rotation; } #include "clear-n_.h" diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 66d370357..f885ef5e5 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -72,7 +72,6 @@ #include "sp-path.h" #include "sp-text.h" #include "sp-flowtext.h" -#include "sp-root.h" #include "svg/svg.h" #include "text-editing.h" #include "util/units.h" @@ -2096,8 +2095,7 @@ void OdfOutput::reset() void OdfOutput::save(Inkscape::Extension::Output */*mod*/, SPDocument *doc, gchar const *filename) { reset(); - doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; - doc->ensureUpToDate(); + documentUri = Inkscape::URI(filename); ZipFile zf; @@ -2106,30 +2104,25 @@ void OdfOutput::save(Inkscape::Extension::Output */*mod*/, SPDocument *doc, gcha if (!writeManifest(zf)) { g_warning("Failed to write manifest"); - doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } if (!writeContent(zf, doc->rroot)) { g_warning("Failed to write content"); - doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } if (!writeMeta(zf)) { g_warning("Failed to write metafile"); - doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } if (!zf.writeFile(filename)) { - doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } - doc->getRoot()->c2p *= doc->getRoot()->rotation; } diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 03a2ecd62..8df883069 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -616,13 +616,11 @@ void PovOutput::reset() void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) { reset(); - doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; - doc->ensureUpToDate(); + //###### SAVE IN POV FORMAT TO BUFFER //# Lets do the curves first, to get the stats if (!doTree(doc)) { - doc->getRoot()->c2p *= doc->getRoot()->rotation; err("Could not output curves for %s", filename_utf8); return; } @@ -632,7 +630,6 @@ void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) if (!doHeader()) { - doc->getRoot()->c2p *= doc->getRoot()->rotation; err("Could not write header for %s", filename_utf8); return; } @@ -641,7 +638,6 @@ void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) if (!doTail()) { - doc->getRoot()->c2p *= doc->getRoot()->rotation; err("Could not write footer for %s", filename_utf8); return; } @@ -652,11 +648,9 @@ void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) //###### WRITE TO FILE Inkscape::IO::dump_fopen_call(filename_utf8, "L"); FILE *f = Inkscape::IO::fopen_utf8name(filename_utf8, "w"); - if (!f){ - doc->getRoot()->c2p *= doc->getRoot()->rotation; + if (!f) return; - } - + for (String::iterator iter = outbuf.begin() ; iter!=outbuf.end(); ++iter) { int ch = *iter; @@ -664,7 +658,6 @@ void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) } fclose(f); - doc->getRoot()->c2p *= doc->getRoot()->rotation; } diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 42ec2f2bb..8e602652a 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -95,7 +95,7 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) SPPrintContext context; const gchar *oldconst; gchar *oldoutput; - doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; + doc->ensureUpToDate(); mod = Inkscape::Extension::get_print(PRINT_WMF); @@ -115,7 +115,6 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) /* Print document */ if (mod->begin(doc)) { g_free(oldoutput); - doc->getRoot()->c2p *= doc->getRoot()->rotation; throw Inkscape::Extension::Output::save_failed(); } mod->base->invoke_print(&context); @@ -128,7 +127,7 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) mod->set_param_string("destination", oldoutput); g_free(oldoutput); - doc->getRoot()->c2p *= doc->getRoot()->rotation; + return; } @@ -136,8 +135,6 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) void Wmf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) { - doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; - doc->ensureUpToDate(); Inkscape::Extension::Extension * ext; ext = Inkscape::Extension::db.get(PRINT_WMF); -- cgit v1.2.3 From 65fd4f5343e321dad33b3c8394a419cd0fef4a23 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 25 Mar 2017 17:23:44 +0100 Subject: Extensions: Correctly handle the xml:space="preserve" attribute for "description"s This also fixes multiline descriptions (and other descriptions containing additional whitespace) not being translatable if xml:space="preserve" is not specified. Fixed bugs: - https://launchpad.net/bugs/1668115 (bzr r15607) --- src/extension/param/description.cpp | 42 +++++++++++++++++++++++++++++-------- src/extension/param/description.h | 1 + 2 files changed, 34 insertions(+), 9 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 3c29b7c49..480a0898a 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include "xml/node.h" #include "extension/extension.h" @@ -40,19 +41,29 @@ ParamDescription::ParamDescription(const gchar * name, : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) , _value(NULL) , _mode(mode) + , _preserve_whitespace(false) { - // printf("Building Description\n"); - const char * defaultval = NULL; - if (xml->firstChild() != NULL) { - defaultval = xml->firstChild()->content(); + Glib::ustring defaultval; + Inkscape::XML::Node * cur_child = xml->firstChild(); + while (cur_child != NULL) { + if (cur_child->type() == XML::TEXT_NODE && cur_child->content() != NULL) { + defaultval += cur_child->content(); + } else if (cur_child->type() == XML::ELEMENT_NODE && !g_strcmp0(cur_child->name(), "extension:br")) { + defaultval += "
"; + } + cur_child = cur_child->next(); } - if (defaultval != NULL) { - _value = g_strdup(defaultval); + if (defaultval != Glib::ustring("")) { + _value = g_strdup(defaultval.c_str()); } _context = xml->attribute("msgctxt"); + if (g_strcmp0(xml->attribute("xml:space"), "preserve") == 0) { + _preserve_whitespace = true; + } + return; } @@ -67,14 +78,27 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node return NULL; } - Glib::ustring newguitext; + Glib::ustring newguitext = _value; + + // do replacements in the source string matching those performed by xgettext to allow for proper translation + if (_preserve_whitespace) { + // xgettext copies the source string verbatim in this case, so no changes needed + } else { + // remove all whitespace from start/end of string and replace intermediate whitespace with a single space + newguitext = Glib::Regex::create("^\\s+|\\s+$")->replace_literal(newguitext, 0, "", (Glib::RegexMatchFlags)0); + newguitext = Glib::Regex::create("\\s+")->replace_literal(newguitext, 0, " ", (Glib::RegexMatchFlags)0); + } + // translate if (_context != NULL) { - newguitext = g_dpgettext2(NULL, _context, _value); + newguitext = g_dpgettext2(NULL, _context, newguitext.c_str()); } else { - newguitext = _(_value); + newguitext = _(newguitext.c_str()); } + // finally replace all remaining
with a real newline character + newguitext = Glib::Regex::create("
")->replace_literal(newguitext, 0, "\n", (Glib::RegexMatchFlags)0); + Gtk::Label * label = Gtk::manage(new Gtk::Label()); if (_mode == HEADER) { label->set_markup(Glib::ustring("") + Glib::Markup::escape_text(newguitext) + Glib::ustring("")); diff --git a/src/extension/param/description.h b/src/extension/param/description.h index c6c5f4013..91342fa6a 100644 --- a/src/extension/param/description.h +++ b/src/extension/param/description.h @@ -46,6 +46,7 @@ private: gchar * _value; AppearanceMode _mode; const gchar* _context; + bool _preserve_whitespace; }; } /* namespace Extension */ -- cgit v1.2.3 From 03139d14786d177512f8d4ed953bf493f1bc2524 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Fri, 7 Apr 2017 00:16:21 +0200 Subject: EMF/WMF: Hopefully resolve locale issues with decimal separator for good This unconditionally sets "LC_NUMERIC" to "C" to use dots (.) in all scanf/printf-like functions to prevent parsing issues with locales that would use a comma (,) instead. Fixed bugs: - https://launchpad.net/bugs/1549015 - https://launchpad.net/bugs/1675755 - https://launchpad.net/bugs/1335660 - https://launchpad.net/bugs/1089857 - https://launchpad.net/bugs/1599763 (bzr r15617) --- src/extension/internal/emf-inout.cpp | 16 ++++++++++++++++ src/extension/internal/emf-print.cpp | 4 ---- src/extension/internal/metafile-print.cpp | 27 +++------------------------ src/extension/internal/wmf-inout.cpp | 16 ++++++++++++++++ 4 files changed, 35 insertions(+), 28 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 12751c5ec..92deb2e19 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -165,8 +165,16 @@ Emf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena ext->set_param_bool("FixImageRot",new_FixImageRot); ext->set_param_bool("textToPath", new_val); + // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + setlocale(LC_NUMERIC, "C"); + print_document_to_file(doc, filename); + // restore decimal separator used in scanf/printf functions to initial value + setlocale(LC_NUMERIC, oldlocale); + g_free(oldlocale); + return; } @@ -3524,6 +3532,10 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) return NULL; } + // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + setlocale(LC_NUMERIC, "C"); + EMF_CALLBACK_DATA d; d.n_obj = 0; //these might not be set otherwise if the input file is corrupt @@ -3588,6 +3600,10 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // in earlier versions no viewbox was generated and a call to setViewBoxIfMissing() was needed here. + // restore decimal separator used in scanf/printf functions to initial value + setlocale(LC_NUMERIC, oldlocale); + g_free(oldlocale); + return doc; } diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 826176bc0..147324b4f 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -251,11 +251,7 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) g_error("Fatal programming error in PrintEmf::begin at textcomment_set 1"); } - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); - setlocale(LC_NUMERIC, "C"); snprintf(buff, sizeof(buff) - 1, "Drawing=%.1fx%.1fpx, %.1fx%.1fmm", _width, _height, Inkscape::Util::Quantity::convert(dwInchesX, "in", "mm"), Inkscape::Util::Quantity::convert(dwInchesY, "in", "mm")); - setlocale(LC_NUMERIC, oldlocale); - g_free(oldlocale); rec = textcomment_set(buff); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::begin at textcomment_set 1"); diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp index 11567ceb3..68a425d85 100644 --- a/src/extension/internal/metafile-print.cpp +++ b/src/extension/internal/metafile-print.cpp @@ -355,27 +355,6 @@ int PrintMetafile::hold_gradient(void *gr, int mode) return 1; } -/* behaves like snprintf() but makes sure decimal separators are formatted as dots - otherwise invalid strings can be produced depending on the set locale -*/ -int PrintMetafile::snprintf_dots(char * s, size_t n, const char * format, ...) -{ - int nChars; - - char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); - setlocale(LC_NUMERIC, "C"); - - va_list argptr; - va_start(argptr, format); - nChars = vsnprintf(s, n, format, argptr); - va_end(argptr); - - setlocale(LC_NUMERIC, oldlocale); - g_free(oldlocale); - - return nChars; -} - /* convert from center ellipse to SVGEllipticalArc ellipse From: @@ -411,7 +390,7 @@ Geom::PathVector PrintMetafile::center_ellipse_as_SVG_PathV(Geom::Point ctr, dou y2 = ctr[Y] + sin(F) * rx * cos(M_PI) + cos(F) * ry * sin(M_PI); char text[256]; - snprintf_dots(text, 256, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z", + snprintf(text, 256, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z", x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1); Geom::PathVector outres = Geom::parse_svg_path(text); return outres; @@ -440,7 +419,7 @@ Geom::PathVector PrintMetafile::center_elliptical_ring_as_SVG_PathV(Geom::Point y22 = ctr[Y] + sin(F) * rx2 * cos(M_PI) + cos(F) * ry2 * sin(M_PI); char text[512]; - snprintf_dots(text, 512, " M %f,%f A %f %f %f 0 1 %f %f A %f %f %f 0 1 %f %f z M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z", + snprintf(text, 512, " M %f,%f A %f %f %f 0 1 %f %f A %f %f %f 0 1 %f %f z M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z", x11, y11, rx1, ry1, degrot, x12, y12, rx1, ry1, degrot, x11, y11, x21, y21, rx2, ry2, degrot, x22, y22, rx2, ry2, degrot, x21, y21); Geom::PathVector outres = Geom::parse_svg_path(text); @@ -462,7 +441,7 @@ Geom::PathVector PrintMetafile::center_elliptical_hole_as_SVG_PathV(Geom::Point y2 = ctr[Y] + sin(F) * rx * cos(M_PI) + cos(F) * ry * sin(M_PI); char text[256]; - snprintf_dots(text, 256, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z M 50000,50000 50000,-50000 -50000,-50000 -50000,50000 z", + snprintf(text, 256, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z M 50000,50000 50000,-50000 -50000,-50000 -50000,50000 z", x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1); Geom::PathVector outres = Geom::parse_svg_path(text); return outres; diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 8e602652a..e2d1433e4 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -161,8 +161,16 @@ Wmf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena ext->set_param_bool("FixPPTPatternAsHatch",new_FixPPTPatternAsHatch); ext->set_param_bool("textToPath", new_val); + // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + setlocale(LC_NUMERIC, "C"); + print_document_to_file(doc, filename); + // restore decimal separator used in scanf/printf functions to initial value + setlocale(LC_NUMERIC, oldlocale); + g_free(oldlocale); + return; } @@ -3097,6 +3105,10 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) return NULL; } + // ensure usage of dot as decimal separator in scanf/printf functions (indepentendly of current locale) + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + setlocale(LC_NUMERIC, "C"); + WMF_CALLBACK_DATA d; d.n_obj = 0; //these might not be set otherwise if the input file is corrupt @@ -3177,6 +3189,10 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // in earlier versions no viewbox was generated and a call to setViewBoxIfMissing() was needed here. + // restore decimal separator used in scanf/printf functions to initial value + setlocale(LC_NUMERIC, oldlocale); + g_free(oldlocale); + return doc; } -- cgit v1.2.3 From bab6dfe02bd9556c931973a272e154251764e88e Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 24 Apr 2017 20:59:06 +0200 Subject: Restore r14955 which was reverted in r15047 due to messed up merge http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/14955 http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/15047 Fixed bugs: - https://launchpad.net/bugs/1669951 (bzr r15633) --- src/extension/param/bool.cpp | 2 +- src/extension/param/enum.cpp | 2 +- src/extension/param/float.cpp | 4 ++-- src/extension/param/int.cpp | 5 ++--- src/extension/param/parameter.cpp | 11 +++++++++++ src/extension/param/radiobutton.cpp | 2 +- src/extension/param/string.cpp | 2 +- 7 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index 9f8d3dcc0..a2f4f82c2 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -136,7 +136,7 @@ Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node, auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING)); hbox->set_homogeneous(false); - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); label->show(); hbox->pack_end(*label, true, true); diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index a26458c35..7a79e32bb 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -251,7 +251,7 @@ Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * n } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false); diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index e3fdba826..e9bb45c2e 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -181,7 +181,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod if (_mode == FULL) { - UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, _precision); + UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_text, fadjust, _precision); scale->set_size_request(400, -1); scale->show(); hbox->pack_start(*scale, true, true); @@ -189,7 +189,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod } else if (_mode == MINIMAL) { - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, true, true); diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 538ddc08d..e81b0a526 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -162,14 +162,13 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal if (_mode == FULL) { - UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, 0); + UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_text, fadjust, 0); scale->set_size_request(400, -1); scale->show(); hbox->pack_start(*scale, true, true); } else if (_mode == MINIMAL) { - - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, true, true); diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 0eb491078..2c72c61df 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -20,6 +20,7 @@ #endif #include +#include #include "ui/widget/color-notebook.h" #include @@ -65,6 +66,16 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex const char *guitext = in_repr->attribute("gui-text"); if (guitext == NULL) { guitext = in_repr->attribute("_gui-text"); + if (guitext == NULL) { + // guitext = ""; // propably better to require devs to explicitly set an empty gui-text if this is what they want + } else { + const char *context = in_repr->attribute("msgctxt"); + if (context != NULL) { + guitext = g_dpgettext2(NULL, context, guitext); + } else { + guitext = _(guitext); + } + } } const char *gui_tip = in_repr->attribute("gui-tip"); if (gui_tip == NULL) { diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 178dc20e8..df3c37e55 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -306,7 +306,7 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node auto vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0)); vbox->set_homogeneous(false); - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START, Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START, Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false); diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index 0c5238f99..86895f217 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -169,7 +169,7 @@ Gtk::Widget * ParamString::get_widget(SPDocument * doc, Inkscape::XML::Node * no } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false); -- cgit v1.2.3 From 34a1f9ad048c2aec2149e0bdaca5e66fca8de442 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 9 Apr 2017 15:20:24 +0200 Subject: Remove unused field "gui_tip" ("gui_description" does now what "gui_tip" was supposed to do) (bzr r15633.1.1) --- src/extension/param/bool.cpp | 3 +-- src/extension/param/bool.h | 1 - src/extension/param/color.cpp | 3 +-- src/extension/param/color.h | 1 - src/extension/param/description.cpp | 3 +-- src/extension/param/description.h | 1 - src/extension/param/enum.cpp | 3 +-- src/extension/param/enum.h | 1 - src/extension/param/float.cpp | 3 +-- src/extension/param/float.h | 1 - src/extension/param/int.cpp | 3 +-- src/extension/param/int.h | 1 - src/extension/param/notebook.cpp | 13 +++--------- src/extension/param/notebook.h | 1 - src/extension/param/parameter.cpp | 40 +++++++++++++------------------------ src/extension/param/parameter.h | 4 ---- src/extension/param/radiobutton.cpp | 3 +-- src/extension/param/radiobutton.h | 1 - src/extension/param/string.cpp | 3 +-- src/extension/param/string.h | 1 - 20 files changed, 25 insertions(+), 65 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index a2f4f82c2..612bf0331 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -29,11 +29,10 @@ ParamBool::ParamBool(const gchar * name, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) , _value(false) { const char * defaultval = NULL; diff --git a/src/extension/param/bool.h b/src/extension/param/bool.h index 0af12b105..8a7887cc6 100644 --- a/src/extension/param/bool.h +++ b/src/extension/param/bool.h @@ -37,7 +37,6 @@ public: const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index fd88e9adb..6f6582b82 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -57,11 +57,10 @@ ParamColor::ParamColor(const gchar * name, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) , _changeSignal(0) { const char * defaulthex = NULL; diff --git a/src/extension/param/color.h b/src/extension/param/color.h index d6e9d1fbe..184d57b28 100644 --- a/src/extension/param/color.h +++ b/src/extension/param/color.h @@ -36,7 +36,6 @@ public: const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 480a0898a..0f3c92dd8 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -33,12 +33,11 @@ ParamDescription::ParamDescription(const gchar * name, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) - : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) , _value(NULL) , _mode(mode) , _preserve_whitespace(false) diff --git a/src/extension/param/description.h b/src/extension/param/description.h index 91342fa6a..c065e5415 100644 --- a/src/extension/param/description.h +++ b/src/extension/param/description.h @@ -34,7 +34,6 @@ public: const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 7a79e32bb..d93ed4b5a 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -51,11 +51,10 @@ ParamComboBox::ParamComboBox(const gchar * name, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) , _value(NULL) , choices(NULL) { diff --git a/src/extension/param/enum.h b/src/extension/param/enum.h index f9d3d75f7..b54815227 100644 --- a/src/extension/param/enum.h +++ b/src/extension/param/enum.h @@ -42,7 +42,6 @@ public: const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index e9bb45c2e..574c147b6 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -32,12 +32,11 @@ ParamFloat::ParamFloat(const gchar * name, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) - : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) , _value(0.0) , _mode(mode) , _min(0.0) diff --git a/src/extension/param/float.h b/src/extension/param/float.h index 7fd86cea7..b81b7ff08 100644 --- a/src/extension/param/float.h +++ b/src/extension/param/float.h @@ -34,7 +34,6 @@ public: const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index e81b0a526..c76493a26 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -32,12 +32,11 @@ ParamInt::ParamInt(const gchar * name, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) - : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) , _value(0) , _mode(mode) , _min(0) diff --git a/src/extension/param/int.h b/src/extension/param/int.h index 40c0395ec..ae307c371 100644 --- a/src/extension/param/int.h +++ b/src/extension/param/int.h @@ -34,7 +34,6 @@ public: const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index de86d1005..2e216e967 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -59,7 +59,6 @@ public: const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); ~ParamNotebookPage(void); @@ -76,10 +75,9 @@ ParamNotebookPage::ParamNotebookPage(const gchar * name, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, /*indent*/ 0, ext) + : Parameter(name, guitext, desc, scope, gui_hidden, /*indent*/ 0, ext) { parameters = NULL; @@ -157,15 +155,11 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: Parameter::_scope_t scope = Parameter::SCOPE_USER; bool gui_hidden = false; const char * gui_hide; - const char * gui_tip; name = in_repr->attribute("name"); guitext = in_repr->attribute("gui-text"); if (guitext == NULL) guitext = in_repr->attribute("_gui-text"); - gui_tip = in_repr->attribute("gui-tip"); - if (gui_tip == NULL) - gui_tip = in_repr->attribute("_gui-tip"); desc = in_repr->attribute("gui-description"); if (desc == NULL) desc = in_repr->attribute("_gui-description"); @@ -194,7 +188,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: } } - ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); + ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, scope, gui_hidden, in_ext, in_repr); /* Note: page could equal NULL */ return page; @@ -251,11 +245,10 @@ ParamNotebook::ParamNotebook(const gchar * name, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) { pages = NULL; diff --git a/src/extension/param/notebook.h b/src/extension/param/notebook.h index 278c4de12..0b3a2ba85 100644 --- a/src/extension/param/notebook.h +++ b/src/extension/param/notebook.h @@ -46,7 +46,6 @@ public: const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 2c72c61df..a0488142e 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -77,10 +77,6 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex } } } - const char *gui_tip = in_repr->attribute("gui-tip"); - if (gui_tip == NULL) { - gui_tip = in_repr->attribute("_gui-tip"); - } const char *desc = in_repr->attribute("gui-description"); if (desc == NULL) { desc = in_repr->attribute("_gui-description"); @@ -125,21 +121,21 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex Parameter * param = NULL; if (!strcmp(type, "boolean")) { - param = new ParamBool(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr); + param = new ParamBool(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr); } else if (!strcmp(type, "int")) { if (appearance && !strcmp(appearance, "full")) { - param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamInt::FULL); + param = new ParamInt(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, ParamInt::FULL); } else { - param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamInt::MINIMAL); + param = new ParamInt(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, ParamInt::MINIMAL); } } else if (!strcmp(type, "float")) { if (appearance && !strcmp(appearance, "full")) { - param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamFloat::FULL); + param = new ParamFloat(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, ParamFloat::FULL); } else { - param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamFloat::MINIMAL); + param = new ParamFloat(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, ParamFloat::MINIMAL); } } else if (!strcmp(type, "string")) { - param = new ParamString(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr); + param = new ParamString(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr); gchar const * max_length = in_repr->attribute("max_length"); if (max_length != NULL) { ParamString * ps = dynamic_cast(param); @@ -154,19 +150,19 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex appearance_mode = ParamDescription::URL; } } - param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, appearance_mode); + param = new ParamDescription(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, appearance_mode); } else if (!strcmp(type, "enum")) { - param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr); + param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr); } else if (!strcmp(type, "notebook")) { - param = new ParamNotebook(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr); + param = new ParamNotebook(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr); } else if (!strcmp(type, "optiongroup")) { if (appearance && !strcmp(appearance, "minimal")) { - param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamRadioButton::MINIMAL); + param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, ParamRadioButton::MINIMAL); } else { - param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamRadioButton::FULL); + param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, ParamRadioButton::FULL); } } else if (!strcmp(type, "color")) { - param = new ParamColor(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr); + param = new ParamColor(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr); } // Note: param could equal NULL @@ -313,12 +309,11 @@ Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node) /** Oop, now that we need a parameter, we need it's name. */ -Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * desc, const Parameter::_scope_t scope, bool gui_hidden, gchar const * gui_tip, int indent, Inkscape::Extension::Extension * ext) : +Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * desc, const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext) : _desc(0), _scope(scope), _text(0), _gui_hidden(gui_hidden), - _gui_tip(0), _indent(indent), extension(ext), _name(0) @@ -326,12 +321,9 @@ Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * de if (name != NULL) { _name = g_strdup(name); } + if (desc != NULL) { _desc = g_strdup(desc); -// printf("Adding description: '%s' on '%s'\n", _desc, _name); - } - if (gui_tip != NULL) { - _gui_tip = g_strdup(gui_tip); } if (guitext != NULL) { @@ -349,7 +341,6 @@ Parameter::Parameter (gchar const * name, gchar const * guitext, Inkscape::Exten _scope(Parameter::SCOPE_USER), _text(0), _gui_hidden(false), - _gui_tip(0), _indent(0), extension(ext), _name(0) @@ -374,9 +365,6 @@ Parameter::~Parameter(void) g_free(_text); _text = 0; - g_free(_gui_tip); - _gui_tip = 0; - g_free(_desc); _desc = 0; } diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h index c107f24f9..8888fb15b 100644 --- a/src/extension/param/parameter.h +++ b/src/extension/param/parameter.h @@ -61,7 +61,6 @@ public: gchar const *desc, const Parameter::_scope_t scope, bool gui_hidden, - gchar const *gui_tip, int indent, Inkscape::Extension::Extension * ext); @@ -185,9 +184,6 @@ protected: /** Whether the GUI is visible. */ bool _gui_hidden; - /** A tip for the GUI if there is one. */ - gchar * _gui_tip; - /** Indentation level of the parameter. */ int _indent; diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index df3c37e55..37d580381 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -62,12 +62,11 @@ ParamRadioButton::ParamRadioButton(const gchar * name, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) - : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) , _value(0) , _mode(mode) , choices(0) diff --git a/src/extension/param/radiobutton.h b/src/extension/param/radiobutton.h index 5e15dcb57..185ec6a26 100644 --- a/src/extension/param/radiobutton.h +++ b/src/extension/param/radiobutton.h @@ -39,7 +39,6 @@ public: const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index 86895f217..ad2968503 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -81,11 +81,10 @@ ParamString::ParamString(const gchar * name, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) , _value(NULL) { const char * defaultval = NULL; diff --git a/src/extension/param/string.h b/src/extension/param/string.h index f5412ebcc..e2721582b 100644 --- a/src/extension/param/string.h +++ b/src/extension/param/string.h @@ -28,7 +28,6 @@ public: const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); -- cgit v1.2.3 From f0ad38f6fd0d18f48d92df4b55ff8352747e6b2c Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 9 Apr 2017 15:39:40 +0200 Subject: Remove unused field "scope" (bzr r15633.1.2) --- src/extension/internal/bluredge.cpp | 4 ++-- src/extension/param/bool.cpp | 3 +-- src/extension/param/bool.h | 1 - src/extension/param/color.cpp | 3 +-- src/extension/param/color.h | 1 - src/extension/param/description.cpp | 3 +-- src/extension/param/description.h | 1 - src/extension/param/enum.cpp | 3 +-- src/extension/param/enum.h | 1 - src/extension/param/float.cpp | 3 +-- src/extension/param/float.h | 1 - src/extension/param/int.cpp | 3 +-- src/extension/param/int.h | 1 - src/extension/param/notebook.cpp | 22 +++---------------- src/extension/param/notebook.h | 1 - src/extension/param/parameter.cpp | 42 ++++++++++++------------------------- src/extension/param/parameter.h | 12 ----------- src/extension/param/radiobutton.cpp | 3 +-- src/extension/param/radiobutton.h | 1 - src/extension/param/string.cpp | 3 +-- src/extension/param/string.h | 1 - src/extension/prefdialog.cpp | 2 +- 22 files changed, 27 insertions(+), 88 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index 8aa982810..d1fe357da 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -131,8 +131,8 @@ BlurEdge::init (void) "\n" "" N_("Inset/Outset Halo") "\n" "org.inkscape.effect.bluredge\n" - "1.0\n" - "11\n" + "1.0\n" + "11\n" "\n" "all\n" "\n" diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index 612bf0331..05f896a2d 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -27,12 +27,11 @@ namespace Extension { ParamBool::ParamBool(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) + : Parameter(name, guitext, desc, gui_hidden, indent, ext) , _value(false) { const char * defaultval = NULL; diff --git a/src/extension/param/bool.h b/src/extension/param/bool.h index 8a7887cc6..de6542d64 100644 --- a/src/extension/param/bool.h +++ b/src/extension/param/bool.h @@ -35,7 +35,6 @@ public: ParamBool(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index 6f6582b82..064a465b7 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -55,12 +55,11 @@ guint32 ParamColor::set( guint32 in, SPDocument * /*doc*/, Inkscape::XML::Node * ParamColor::ParamColor(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) + : Parameter(name, guitext, desc, gui_hidden, indent, ext) , _changeSignal(0) { const char * defaulthex = NULL; diff --git a/src/extension/param/color.h b/src/extension/param/color.h index 184d57b28..222eb13f3 100644 --- a/src/extension/param/color.h +++ b/src/extension/param/color.h @@ -34,7 +34,6 @@ public: ParamColor(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 0f3c92dd8..48e95aa2a 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -31,13 +31,12 @@ namespace Extension { ParamDescription::ParamDescription(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) - : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) + : Parameter(name, guitext, desc, gui_hidden, indent, ext) , _value(NULL) , _mode(mode) , _preserve_whitespace(false) diff --git a/src/extension/param/description.h b/src/extension/param/description.h index c065e5415..64fbef5e5 100644 --- a/src/extension/param/description.h +++ b/src/extension/param/description.h @@ -32,7 +32,6 @@ public: ParamDescription(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index d93ed4b5a..377bb0f57 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -49,12 +49,11 @@ public: ParamComboBox::ParamComboBox(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) + : Parameter(name, guitext, desc, gui_hidden, indent, ext) , _value(NULL) , choices(NULL) { diff --git a/src/extension/param/enum.h b/src/extension/param/enum.h index b54815227..e66274485 100644 --- a/src/extension/param/enum.h +++ b/src/extension/param/enum.h @@ -40,7 +40,6 @@ public: ParamComboBox(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 574c147b6..8c54d4a4a 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -30,13 +30,12 @@ namespace Extension { ParamFloat::ParamFloat(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) - : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) + : Parameter(name, guitext, desc, gui_hidden, indent, ext) , _value(0.0) , _mode(mode) , _min(0.0) diff --git a/src/extension/param/float.h b/src/extension/param/float.h index b81b7ff08..0f0078dae 100644 --- a/src/extension/param/float.h +++ b/src/extension/param/float.h @@ -32,7 +32,6 @@ public: ParamFloat(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index c76493a26..e179484d3 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -30,13 +30,12 @@ namespace Extension { ParamInt::ParamInt(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) - : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) + : Parameter(name, guitext, desc, gui_hidden, indent, ext) , _value(0) , _mode(mode) , _min(0) diff --git a/src/extension/param/int.h b/src/extension/param/int.h index ae307c371..7b6588139 100644 --- a/src/extension/param/int.h +++ b/src/extension/param/int.h @@ -32,7 +32,6 @@ public: ParamInt(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 2e216e967..c61733d26 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -57,7 +57,6 @@ public: ParamNotebookPage(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); @@ -73,11 +72,10 @@ public: ParamNotebookPage::ParamNotebookPage(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, /*indent*/ 0, ext) + : Parameter(name, guitext, desc, gui_hidden, /*indent*/ 0, ext) { parameters = NULL; @@ -151,8 +149,6 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: const char * name; const char * guitext; const char * desc; - const char * scope_str; - Parameter::_scope_t scope = Parameter::SCOPE_USER; bool gui_hidden = false; const char * gui_hide; @@ -163,7 +159,6 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: desc = in_repr->attribute("gui-description"); if (desc == NULL) desc = in_repr->attribute("_gui-description"); - scope_str = in_repr->attribute("scope"); gui_hide = in_repr->attribute("gui-hidden"); if (gui_hide != NULL) { if (strcmp(gui_hide, "1") == 0 || @@ -178,17 +173,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: return NULL; } - if (scope_str != NULL) { - if (!strcmp(scope_str, "user")) { - scope = Parameter::SCOPE_USER; - } else if (!strcmp(scope_str, "document")) { - scope = Parameter::SCOPE_DOCUMENT; - } else if (!strcmp(scope_str, "node")) { - scope = Parameter::SCOPE_NODE; - } - } - - ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, scope, gui_hidden, in_ext, in_repr); + ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, gui_hidden, in_ext, in_repr); /* Note: page could equal NULL */ return page; @@ -243,12 +228,11 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod ParamNotebook::ParamNotebook(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) + : Parameter(name, guitext, desc, gui_hidden, indent, ext) { pages = NULL; diff --git a/src/extension/param/notebook.h b/src/extension/param/notebook.h index 0b3a2ba85..cfecdbbb3 100644 --- a/src/extension/param/notebook.h +++ b/src/extension/param/notebook.h @@ -44,7 +44,6 @@ public: ParamNotebook(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index a0488142e..8d77830c4 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -105,37 +105,23 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex } const gchar* appearance = in_repr->attribute("appearance"); - Parameter::_scope_t scope = Parameter::SCOPE_USER; - { - const char *scope_str = in_repr->attribute("scope"); - if (scope_str != NULL) { - if (!strcmp(scope_str, "user")) { - scope = Parameter::SCOPE_USER; - } else if (!strcmp(scope_str, "document")) { - scope = Parameter::SCOPE_DOCUMENT; - } else if (!strcmp(scope_str, "node")) { - scope = Parameter::SCOPE_NODE; - } - } - } - Parameter * param = NULL; if (!strcmp(type, "boolean")) { - param = new ParamBool(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr); + param = new ParamBool(name, guitext, desc, gui_hidden, indent, in_ext, in_repr); } else if (!strcmp(type, "int")) { if (appearance && !strcmp(appearance, "full")) { - param = new ParamInt(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, ParamInt::FULL); + param = new ParamInt(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, ParamInt::FULL); } else { - param = new ParamInt(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, ParamInt::MINIMAL); + param = new ParamInt(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, ParamInt::MINIMAL); } } else if (!strcmp(type, "float")) { if (appearance && !strcmp(appearance, "full")) { - param = new ParamFloat(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, ParamFloat::FULL); + param = new ParamFloat(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, ParamFloat::FULL); } else { - param = new ParamFloat(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, ParamFloat::MINIMAL); + param = new ParamFloat(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, ParamFloat::MINIMAL); } } else if (!strcmp(type, "string")) { - param = new ParamString(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr); + param = new ParamString(name, guitext, desc, gui_hidden, indent, in_ext, in_repr); gchar const * max_length = in_repr->attribute("max_length"); if (max_length != NULL) { ParamString * ps = dynamic_cast(param); @@ -150,19 +136,19 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex appearance_mode = ParamDescription::URL; } } - param = new ParamDescription(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, appearance_mode); + param = new ParamDescription(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, appearance_mode); } else if (!strcmp(type, "enum")) { - param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr); + param = new ParamComboBox(name, guitext, desc, gui_hidden, indent, in_ext, in_repr); } else if (!strcmp(type, "notebook")) { - param = new ParamNotebook(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr); + param = new ParamNotebook(name, guitext, desc, gui_hidden, indent, in_ext, in_repr); } else if (!strcmp(type, "optiongroup")) { if (appearance && !strcmp(appearance, "minimal")) { - param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, ParamRadioButton::MINIMAL); + param = new ParamRadioButton(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, ParamRadioButton::MINIMAL); } else { - param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr, ParamRadioButton::FULL); + param = new ParamRadioButton(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, ParamRadioButton::FULL); } } else if (!strcmp(type, "color")) { - param = new ParamColor(name, guitext, desc, scope, gui_hidden, indent, in_ext, in_repr); + param = new ParamColor(name, guitext, desc, gui_hidden, indent, in_ext, in_repr); } // Note: param could equal NULL @@ -309,9 +295,8 @@ Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node) /** Oop, now that we need a parameter, we need it's name. */ -Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * desc, const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext) : +Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * desc, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext) : _desc(0), - _scope(scope), _text(0), _gui_hidden(gui_hidden), _indent(indent), @@ -338,7 +323,6 @@ Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * de /** Oop, now that we need a parameter, we need it's name. */ Parameter::Parameter (gchar const * name, gchar const * guitext, Inkscape::Extension::Extension * ext) : _desc(0), - _scope(Parameter::SCOPE_USER), _text(0), _gui_hidden(false), _indent(0), diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h index 8888fb15b..4994a6971 100644 --- a/src/extension/param/parameter.h +++ b/src/extension/param/parameter.h @@ -47,19 +47,10 @@ extern Glib::ustring const extension_pref_root; */ class Parameter { -protected: - /** List of possible scopes. */ - typedef enum { - SCOPE_USER, /**< Parameter value is saved in the user's configuration file. (default) */ - SCOPE_DOCUMENT, /**< Parameter value is saved in the document. */ - SCOPE_NODE /**< Parameter value is attached to the node. */ - } _scope_t; - public: Parameter(gchar const *name, gchar const *guitext, gchar const *desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext); @@ -175,9 +166,6 @@ protected: /** Description of the parameter. */ gchar * _desc; - /** Scope of the parameter. */ - _scope_t _scope; - /** Text for the GUI selection of this. */ gchar * _text; diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 37d580381..166167fda 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -60,13 +60,12 @@ public: ParamRadioButton::ParamRadioButton(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) - : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) + : Parameter(name, guitext, desc, gui_hidden, indent, ext) , _value(0) , _mode(mode) , choices(0) diff --git a/src/extension/param/radiobutton.h b/src/extension/param/radiobutton.h index 185ec6a26..f41852baa 100644 --- a/src/extension/param/radiobutton.h +++ b/src/extension/param/radiobutton.h @@ -37,7 +37,6 @@ public: ParamRadioButton(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index ad2968503..22893cd0a 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -79,12 +79,11 @@ void ParamString::string(std::string &string) const ParamString::ParamString(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) + : Parameter(name, guitext, desc, gui_hidden, indent, ext) , _value(NULL) { const char * defaultval = NULL; diff --git a/src/extension/param/string.h b/src/extension/param/string.h index e2721582b..2dc1bd483 100644 --- a/src/extension/param/string.h +++ b/src/extension/param/string.h @@ -26,7 +26,6 @@ public: ParamString(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index 2bdbb081e..92ddd3050 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -246,7 +246,7 @@ PrefDialog::on_response (int signal) { #include "internal/clear-n_.h" -const char * PrefDialog::live_param_xml = "false"; +const char * PrefDialog::live_param_xml = "false"; }; }; /* namespace Inkscape, Extension */ -- cgit v1.2.3 From bc1ecf9dd11d0b3bb6939114ce6aec229fc86548 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 9 Apr 2017 16:46:33 +0200 Subject: Some code refactoring for consistency (notably "gui_hidden" -> hidden", "guitext" -> "text", "desc" -> "description") (bzr r15633.1.3) --- src/extension/extension.cpp | 6 +-- src/extension/param/bool.cpp | 10 ++--- src/extension/param/bool.h | 6 +-- src/extension/param/color.cpp | 10 ++--- src/extension/param/color.h | 6 +-- src/extension/param/description.cpp | 30 ++++++------- src/extension/param/description.h | 8 ++-- src/extension/param/enum.cpp | 44 +++++++++---------- src/extension/param/enum.h | 10 ++--- src/extension/param/float.cpp | 10 ++--- src/extension/param/float.h | 6 +-- src/extension/param/int.cpp | 10 ++--- src/extension/param/int.h | 6 +-- src/extension/param/notebook.cpp | 62 +++++++++++++------------- src/extension/param/notebook.h | 6 +-- src/extension/param/parameter.cpp | 88 ++++++++++++++++++------------------- src/extension/param/parameter.h | 26 +++++------ src/extension/param/radiobutton.cpp | 34 +++++++------- src/extension/param/radiobutton.h | 6 +-- src/extension/param/string.cpp | 10 ++--- src/extension/param/string.h | 6 +-- 21 files changed, 200 insertions(+), 200 deletions(-) (limited to 'src/extension') diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 6c6e2d71e..ebdc83b94 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -718,7 +718,7 @@ public: a Gtk::VBox, which is then returned to the calling function. If there are no visible parameters, this function just returns NULL. - If all parameters are gui_visible = false NULL is returned as well. + If all parameters are gui_hidden = true NULL is returned as well. */ Gtk::Widget * Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) @@ -732,7 +732,7 @@ Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal(list->data); - if (param->get_gui_hidden()) continue; //Ignore hidden parameters + if (param->get_hidden()) continue; //Ignore hidden parameters Gtk::Widget * widg = param->get_widget(doc, node, changeSignal); gchar const * tip = param->get_tooltip(); int indent = param->get_indent(); @@ -837,7 +837,7 @@ unsigned int Extension::param_visible_count ( ) unsigned int _visible_count = 0; for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { Parameter * param = reinterpret_cast(list->data); - if (!param->get_gui_hidden()) _visible_count++; + if (!param->get_hidden()) _visible_count++; } return _visible_count; } diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index 05f896a2d..bfff6015c 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -25,13 +25,13 @@ namespace Inkscape { namespace Extension { ParamBool::ParamBool(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, gui_hidden, indent, ext) + : Parameter(name, text, description, hidden, indent, ext) , _value(false) { const char * defaultval = NULL; @@ -127,7 +127,7 @@ void ParamBool::string(std::string &string) const Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { - if (_gui_hidden) { + if (_hidden) { return NULL; } diff --git a/src/extension/param/bool.h b/src/extension/param/bool.h index de6542d64..826a98927 100644 --- a/src/extension/param/bool.h +++ b/src/extension/param/bool.h @@ -33,9 +33,9 @@ public: * Use the superclass' allocator and set the \c _value. */ ParamBool(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index 064a465b7..035c43ba8 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -53,13 +53,13 @@ guint32 ParamColor::set( guint32 in, SPDocument * /*doc*/, Inkscape::XML::Node * } ParamColor::ParamColor(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, gui_hidden, indent, ext) + : Parameter(name, text, description, hidden, indent, ext) , _changeSignal(0) { const char * defaulthex = NULL; @@ -92,7 +92,7 @@ Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * { using Inkscape::UI::Widget::ColorNotebook; - if (_gui_hidden) return NULL; + if (_hidden) return NULL; if (changeSignal) { _changeSignal = new sigc::signal(*changeSignal); diff --git a/src/extension/param/color.h b/src/extension/param/color.h index 222eb13f3..890f5ba5f 100644 --- a/src/extension/param/color.h +++ b/src/extension/param/color.h @@ -32,9 +32,9 @@ private: sigc::connection _color_changed; public: ParamColor(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 48e95aa2a..1b3f64ec6 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -29,14 +29,14 @@ namespace Extension { /** \brief Initialize the object, to do that, copy the data. */ ParamDescription::ParamDescription(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) - : Parameter(name, guitext, desc, gui_hidden, indent, ext) + : Parameter(name, text, description, hidden, indent, ext) , _value(NULL) , _mode(mode) , _preserve_whitespace(false) @@ -69,44 +69,44 @@ ParamDescription::ParamDescription(const gchar * name, Gtk::Widget * ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) { - if (_gui_hidden) { + if (_hidden) { return NULL; } if (_value == NULL) { return NULL; } - Glib::ustring newguitext = _value; + Glib::ustring newtext = _value; // do replacements in the source string matching those performed by xgettext to allow for proper translation if (_preserve_whitespace) { // xgettext copies the source string verbatim in this case, so no changes needed } else { // remove all whitespace from start/end of string and replace intermediate whitespace with a single space - newguitext = Glib::Regex::create("^\\s+|\\s+$")->replace_literal(newguitext, 0, "", (Glib::RegexMatchFlags)0); - newguitext = Glib::Regex::create("\\s+")->replace_literal(newguitext, 0, " ", (Glib::RegexMatchFlags)0); + newtext = Glib::Regex::create("^\\s+|\\s+$")->replace_literal(newtext, 0, "", (Glib::RegexMatchFlags)0); + newtext = Glib::Regex::create("\\s+")->replace_literal(newtext, 0, " ", (Glib::RegexMatchFlags)0); } // translate if (_context != NULL) { - newguitext = g_dpgettext2(NULL, _context, newguitext.c_str()); + newtext = g_dpgettext2(NULL, _context, newtext.c_str()); } else { - newguitext = _(newguitext.c_str()); + newtext = _(newtext.c_str()); } // finally replace all remaining
with a real newline character - newguitext = Glib::Regex::create("
")->replace_literal(newguitext, 0, "\n", (Glib::RegexMatchFlags)0); + newtext = Glib::Regex::create("
")->replace_literal(newtext, 0, "\n", (Glib::RegexMatchFlags)0); Gtk::Label * label = Gtk::manage(new Gtk::Label()); if (_mode == HEADER) { - label->set_markup(Glib::ustring("") + Glib::Markup::escape_text(newguitext) + Glib::ustring("")); + label->set_markup(Glib::ustring("") + Glib::Markup::escape_text(newtext) + Glib::ustring("")); label->set_margin_top(5); label->set_margin_bottom(5); } else if (_mode == URL) { - Glib::ustring escaped_url = Glib::Markup::escape_text(newguitext); + Glib::ustring escaped_url = Glib::Markup::escape_text(newtext); label->set_markup(Glib::ustring::compose("%1", escaped_url)); } else { - label->set_text(newguitext); + label->set_text(newtext); } label->set_line_wrap(); #if (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION >= 16) @@ -123,7 +123,7 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node // - Here we set a lower limit of GUI_MAX_LINE_LENGTH characters per line that long texts will always use // This means texts can not shrink anymore (they can still grow, though) and it's also necessary // to prevent https://bugzilla.gnome.org/show_bug.cgi?id=773572 - int len = newguitext.length(); + int len = newtext.length(); label->set_width_chars(len > Parameter::GUI_MAX_LINE_LENGTH ? Parameter::GUI_MAX_LINE_LENGTH : len); label->show(); diff --git a/src/extension/param/description.h b/src/extension/param/description.h index 64fbef5e5..67985470c 100644 --- a/src/extension/param/description.h +++ b/src/extension/param/description.h @@ -27,12 +27,12 @@ namespace Extension { class ParamDescription : public Parameter { public: enum AppearanceMode { - DESC, HEADER, URL + DESCRIPTION, HEADER, URL }; ParamDescription(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 377bb0f57..7cd860465 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -33,27 +33,27 @@ namespace Inkscape { namespace Extension { /* For internal use only. - Note that value and guitext MUST be non-NULL. This is ensured by newing only at one location in the code where non-NULL checks are made. */ + Note that value and text MUST be non-NULL. This is ensured by newing only at one location in the code where non-NULL checks are made. */ class enumentry { public: enumentry (Glib::ustring &val, Glib::ustring &text) : value(val), - guitext(text) + text(text) {} Glib::ustring value; - Glib::ustring guitext; + Glib::ustring text; }; ParamComboBox::ParamComboBox(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, gui_hidden, indent, ext) + : Parameter(name, text, description, hidden, indent, ext) , _value(NULL) , choices(NULL) { @@ -64,7 +64,7 @@ ParamComboBox::ParamComboBox(const gchar * name, for (Inkscape::XML::Node *node = xml->firstChild(); node; node = node->next()) { char const * chname = node->name(); if (!strcmp(chname, INKSCAPE_EXTENSION_NS "item") || !strcmp(chname, INKSCAPE_EXTENSION_NS "_item")) { - Glib::ustring newguitext, newvalue; + Glib::ustring newtext, newvalue; const char * contents = NULL; if (node->firstChild()) { contents = node->firstChild()->content(); @@ -75,12 +75,12 @@ ParamComboBox::ParamComboBox(const gchar * name, // still need to include if are to be localized if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_item")) { if (node->attribute("msgctxt") != NULL) { - newguitext = g_dpgettext2(NULL, node->attribute("msgctxt"), contents); + newtext = g_dpgettext2(NULL, node->attribute("msgctxt"), contents); } else { - newguitext = _(contents); + newtext = _(contents); } } else { - newguitext = contents; + newtext = contents; } } else continue; @@ -92,8 +92,8 @@ ParamComboBox::ParamComboBox(const gchar * name, newvalue = contents; } - if ( (!newguitext.empty()) && (!newvalue.empty()) ) { // logical error if this is not true here - choices = g_slist_append( choices, new enumentry(newvalue, newguitext) ); + if ( (!newtext.empty()) && (!newvalue.empty()) ) { // logical error if this is not true here + choices = g_slist_append( choices, new enumentry(newvalue, newtext) ); } } } @@ -153,7 +153,7 @@ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape Glib::ustring settext; for (GSList * list = choices; list != NULL; list = g_slist_next(list)) { enumentry * entr = reinterpret_cast(list->data); - if ( !entr->guitext.compare(in) ) { + if ( !entr->text.compare(in) ) { settext = entr->value; break; // break out of for loop } @@ -173,20 +173,20 @@ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape } /** - * function to test if \c guitext is selectable + * function to test if \c text is selectable */ -bool ParamComboBox::contains(const gchar * guitext, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const +bool ParamComboBox::contains(const gchar * text, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const { - if (guitext == NULL) { + if (text == NULL) { return false; /* Can't have NULL string */ } for (GSList * list = choices; list != NULL; list = g_slist_next(list)) { enumentry * entr = reinterpret_cast(list->data); - if ( !entr->guitext.compare(guitext) ) + if ( !entr->text.compare(text) ) return true; } - // if we did not find the guitext in this ParamComboBox: + // if we did not find the text in this ParamComboBox: return false; } @@ -244,7 +244,7 @@ ParamComboBoxEntry::changed (void) */ Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { - if (_gui_hidden) { + if (_hidden) { return NULL; } @@ -258,11 +258,11 @@ Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * n Glib::ustring settext; for (GSList * list = choices; list != NULL; list = g_slist_next(list)) { enumentry * entr = reinterpret_cast(list->data); - Glib::ustring text = entr->guitext; + Glib::ustring text = entr->text; combo->append(text); if ( _value && !entr->value.compare(_value) ) { - settext = entr->guitext; + settext = entr->text; } } if (!settext.empty()) { diff --git a/src/extension/param/enum.h b/src/extension/param/enum.h index e66274485..143a648d7 100644 --- a/src/extension/param/enum.h +++ b/src/extension/param/enum.h @@ -38,9 +38,9 @@ private: public: ParamComboBox(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); @@ -58,9 +58,9 @@ public: const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); /** - * @returns true if guitext is part of this enum + * @returns true if text is part of this enum */ - bool contains(const gchar * guitext, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const; + bool contains(const gchar * text, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const; void changed (void); }; /* class ParamComboBox */ diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 8c54d4a4a..765644185 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -28,14 +28,14 @@ namespace Extension { /** Use the superclass' allocator and set the \c _value. */ ParamFloat::ParamFloat(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) - : Parameter(name, guitext, desc, gui_hidden, indent, ext) + : Parameter(name, text, description, hidden, indent, ext) , _value(0.0) , _mode(mode) , _min(0.0) @@ -168,7 +168,7 @@ void ParamFloatAdjustment::val_changed(void) */ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { - if (_gui_hidden) { + if (_hidden) { return NULL; } diff --git a/src/extension/param/float.h b/src/extension/param/float.h index 0f0078dae..d58253ccb 100644 --- a/src/extension/param/float.h +++ b/src/extension/param/float.h @@ -30,9 +30,9 @@ public: FULL, MINIMAL }; ParamFloat(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index e179484d3..4d17827f1 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -28,14 +28,14 @@ namespace Extension { /** Use the superclass' allocator and set the \c _value. */ ParamInt::ParamInt(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) - : Parameter(name, guitext, desc, gui_hidden, indent, ext) + : Parameter(name, text, description, hidden, indent, ext) , _value(0) , _mode(mode) , _min(0) @@ -149,7 +149,7 @@ void ParamIntAdjustment::val_changed(void) Gtk::Widget * ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { - if (_gui_hidden) { + if (_hidden) { return NULL; } diff --git a/src/extension/param/int.h b/src/extension/param/int.h index 7b6588139..fcb1ef3f1 100644 --- a/src/extension/param/int.h +++ b/src/extension/param/int.h @@ -30,9 +30,9 @@ public: FULL, MINIMAL }; ParamInt(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index c61733d26..a31dda421 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -55,27 +55,27 @@ public: static ParamNotebookPage * makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext); ParamNotebookPage(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); ~ParamNotebookPage(void); Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void paramString (std::list &list); - gchar * get_guitext (void) {return _text;}; + gchar * get_text (void) {return _text;}; Parameter * get_param (const gchar * name); }; /* class ParamNotebookPage */ ParamNotebookPage::ParamNotebookPage(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, gui_hidden, /*indent*/ 0, ext) + : Parameter(name, text, description, hidden, /*indent*/ 0, ext) { parameters = NULL; @@ -147,23 +147,23 @@ ParamNotebookPage * ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext) { const char * name; - const char * guitext; - const char * desc; - bool gui_hidden = false; - const char * gui_hide; + const char * text; + const char * description; + bool hidden = false; + const char * hide; name = in_repr->attribute("name"); - guitext = in_repr->attribute("gui-text"); - if (guitext == NULL) - guitext = in_repr->attribute("_gui-text"); - desc = in_repr->attribute("gui-description"); - if (desc == NULL) - desc = in_repr->attribute("_gui-description"); - gui_hide = in_repr->attribute("gui-hidden"); - if (gui_hide != NULL) { - if (strcmp(gui_hide, "1") == 0 || - strcmp(gui_hide, "true") == 0) { - gui_hidden = true; + text = in_repr->attribute("gui-text"); + if (text == NULL) + text = in_repr->attribute("_gui-text"); + description = in_repr->attribute("gui-description"); + if (description == NULL) + description = in_repr->attribute("_gui-description"); + hide = in_repr->attribute("gui-hidden"); + if (hide != NULL) { + if (strcmp(hide, "1") == 0 || + strcmp(hide, "true") == 0) { + hidden = true; } /* else stays false */ } @@ -173,7 +173,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: return NULL; } - ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, gui_hidden, in_ext, in_repr); + ParamNotebookPage * page = new ParamNotebookPage(name, text, description, hidden, in_ext, in_repr); /* Note: page could equal NULL */ return page; @@ -188,7 +188,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: */ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { - if (_gui_hidden) { + if (_hidden) { return NULL; } @@ -226,13 +226,13 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod ParamNotebook::ParamNotebook(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, gui_hidden, indent, ext) + : Parameter(name, text, description, hidden, indent, ext) { pages = NULL; @@ -423,7 +423,7 @@ Parameter *ParamNotebookPage::get_param(const gchar * name) */ Gtk::Widget * ParamNotebook::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { - if (_gui_hidden) { + if (_hidden) { return NULL; } @@ -436,7 +436,7 @@ Gtk::Widget * ParamNotebook::get_widget(SPDocument * doc, Inkscape::XML::Node * i++; ParamNotebookPage * page = reinterpret_cast(list->data); Gtk::Widget * widg = page->get_widget(doc, node, changeSignal); - nb->append_page(*widg, _(page->get_guitext())); + nb->append_page(*widg, _(page->get_text())); if (!strcmp(_value, page->name())) { pagenr = i; // this is the page to be displayed? } diff --git a/src/extension/param/notebook.h b/src/extension/param/notebook.h index cfecdbbb3..8475de61d 100644 --- a/src/extension/param/notebook.h +++ b/src/extension/param/notebook.h @@ -42,9 +42,9 @@ private: notebook */ public: ParamNotebook(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 8d77830c4..eeffbecf2 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -63,31 +63,31 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex } } - const char *guitext = in_repr->attribute("gui-text"); - if (guitext == NULL) { - guitext = in_repr->attribute("_gui-text"); - if (guitext == NULL) { - // guitext = ""; // propably better to require devs to explicitly set an empty gui-text if this is what they want + const char *text = in_repr->attribute("gui-text"); + if (text == NULL) { + text = in_repr->attribute("_gui-text"); + if (text == NULL) { + // text = ""; // propably better to require devs to explicitly set an empty gui-text if this is what they want } else { const char *context = in_repr->attribute("msgctxt"); if (context != NULL) { - guitext = g_dpgettext2(NULL, context, guitext); + text = g_dpgettext2(NULL, context, text); } else { - guitext = _(guitext); + text = _(text); } } } - const char *desc = in_repr->attribute("gui-description"); - if (desc == NULL) { - desc = in_repr->attribute("_gui-description"); + const char *description = in_repr->attribute("gui-description"); + if (description == NULL) { + description = in_repr->attribute("_gui-description"); } - bool gui_hidden = false; + bool hidden = false; { const char *gui_hide = in_repr->attribute("gui-hidden"); if (gui_hide != NULL) { if (strcmp(gui_hide, "1") == 0 || strcmp(gui_hide, "true") == 0) { - gui_hidden = true; + hidden = true; } /* else stays false */ } @@ -107,28 +107,28 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex Parameter * param = NULL; if (!strcmp(type, "boolean")) { - param = new ParamBool(name, guitext, desc, gui_hidden, indent, in_ext, in_repr); + param = new ParamBool(name, text, description, hidden, indent, in_ext, in_repr); } else if (!strcmp(type, "int")) { if (appearance && !strcmp(appearance, "full")) { - param = new ParamInt(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, ParamInt::FULL); + param = new ParamInt(name, text, description, hidden, indent, in_ext, in_repr, ParamInt::FULL); } else { - param = new ParamInt(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, ParamInt::MINIMAL); + param = new ParamInt(name, text, description, hidden, indent, in_ext, in_repr, ParamInt::MINIMAL); } } else if (!strcmp(type, "float")) { if (appearance && !strcmp(appearance, "full")) { - param = new ParamFloat(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, ParamFloat::FULL); + param = new ParamFloat(name, text, description, hidden, indent, in_ext, in_repr, ParamFloat::FULL); } else { - param = new ParamFloat(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, ParamFloat::MINIMAL); + param = new ParamFloat(name, text, description, hidden, indent, in_ext, in_repr, ParamFloat::MINIMAL); } } else if (!strcmp(type, "string")) { - param = new ParamString(name, guitext, desc, gui_hidden, indent, in_ext, in_repr); + param = new ParamString(name, text, description, hidden, indent, in_ext, in_repr); gchar const * max_length = in_repr->attribute("max_length"); if (max_length != NULL) { ParamString * ps = dynamic_cast(param); ps->setMaxLength(atoi(max_length)); } } else if (!strcmp(type, "description")) { - ParamDescription::AppearanceMode appearance_mode = ParamDescription::DESC; + ParamDescription::AppearanceMode appearance_mode = ParamDescription::DESCRIPTION; if (appearance) { if (!strcmp(appearance, "header")) { appearance_mode = ParamDescription::HEADER; @@ -136,19 +136,19 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex appearance_mode = ParamDescription::URL; } } - param = new ParamDescription(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, appearance_mode); + param = new ParamDescription(name, text, description, hidden, indent, in_ext, in_repr, appearance_mode); } else if (!strcmp(type, "enum")) { - param = new ParamComboBox(name, guitext, desc, gui_hidden, indent, in_ext, in_repr); + param = new ParamComboBox(name, text, description, hidden, indent, in_ext, in_repr); } else if (!strcmp(type, "notebook")) { - param = new ParamNotebook(name, guitext, desc, gui_hidden, indent, in_ext, in_repr); + param = new ParamNotebook(name, text, description, hidden, indent, in_ext, in_repr); } else if (!strcmp(type, "optiongroup")) { if (appearance && !strcmp(appearance, "minimal")) { - param = new ParamRadioButton(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, ParamRadioButton::MINIMAL); + param = new ParamRadioButton(name, text, description, hidden, indent, in_ext, in_repr, ParamRadioButton::MINIMAL); } else { - param = new ParamRadioButton(name, guitext, desc, gui_hidden, indent, in_ext, in_repr, ParamRadioButton::FULL); + param = new ParamRadioButton(name, text, description, hidden, indent, in_ext, in_repr, ParamRadioButton::FULL); } } else if (!strcmp(type, "color")) { - param = new ParamColor(name, guitext, desc, gui_hidden, indent, in_ext, in_repr); + param = new ParamColor(name, text, description, hidden, indent, in_ext, in_repr); } // Note: param could equal NULL @@ -295,24 +295,24 @@ Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node) /** Oop, now that we need a parameter, we need it's name. */ -Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * desc, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext) : - _desc(0), +Parameter::Parameter(gchar const * name, gchar const * text, gchar const * description, bool hidden, int indent, Inkscape::Extension::Extension * ext) : + _description(0), _text(0), - _gui_hidden(gui_hidden), + _hidden(hidden), _indent(indent), - extension(ext), + _extension(ext), _name(0) { if (name != NULL) { _name = g_strdup(name); } - if (desc != NULL) { - _desc = g_strdup(desc); + if (description != NULL) { + _description = g_strdup(description); } - if (guitext != NULL) { - _text = g_strdup(guitext); + if (text != NULL) { + _text = g_strdup(text); } else { _text = g_strdup(name); } @@ -321,19 +321,19 @@ Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * de } /** Oop, now that we need a parameter, we need it's name. */ -Parameter::Parameter (gchar const * name, gchar const * guitext, Inkscape::Extension::Extension * ext) : - _desc(0), +Parameter::Parameter (gchar const * name, gchar const * text, Inkscape::Extension::Extension * ext) : + _description(0), _text(0), - _gui_hidden(false), + _hidden(false), _indent(0), - extension(ext), + _extension(ext), _name(0) { if (name != NULL) { _name = g_strdup(name); } - if (guitext != NULL) { - _text = g_strdup(guitext); + if (text != NULL) { + _text = g_strdup(text); } else { _text = g_strdup(name); } @@ -349,13 +349,13 @@ Parameter::~Parameter(void) g_free(_text); _text = 0; - g_free(_desc); - _desc = 0; + g_free(_description); + _description = 0; } gchar *Parameter::pref_name(void) const { - return g_strdup_printf("%s.%s", extension->get_id(), _name); + return g_strdup_printf("%s.%s", _extension->get_id(), _name); } Inkscape::XML::Node * @@ -388,7 +388,7 @@ Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) child != NULL; child = child->next()) { if ((GQuark)child->code() == name_quark && - !strcmp(child->attribute("extension"), extension->get_id())) { + !strcmp(child->attribute("extension"), _extension->get_id())) { params = child; break; } @@ -396,7 +396,7 @@ Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) if (params == NULL) { params = xml_doc->createElement("inkscape:extension-param"); - params->setAttribute("extension", extension->get_id()); + params->setAttribute("extension", _extension->get_id()); defs->appendChild(params); Inkscape::GC::release(params); } diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h index 4994a6971..96cc055d8 100644 --- a/src/extension/param/parameter.h +++ b/src/extension/param/parameter.h @@ -49,14 +49,14 @@ class Parameter { public: Parameter(gchar const *name, - gchar const *guitext, - gchar const *desc, - bool gui_hidden, + gchar const *text, + gchar const *description, + bool hidden, int indent, Inkscape::Extension::Extension * ext); Parameter(gchar const *name, - gchar const *guitext, + gchar const *text, Inkscape::Extension::Extension * ext); virtual ~Parameter(void); @@ -130,10 +130,10 @@ public: virtual Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); - gchar const * get_tooltip(void) const { return _desc; } + gchar const * get_tooltip(void) const { return _description; } /** Indicates if the GUI for this parameter is hidden or not */ - bool get_gui_hidden() const { return _gui_hidden; } + bool get_hidden() const { return _hidden; } /** Indentation level of the parameter */ int get_indent() const { return _indent; } @@ -163,14 +163,14 @@ public: protected: - /** Description of the parameter. */ - gchar * _desc; + /** Parameter text to show as the GUI label. */ + gchar * _text; - /** Text for the GUI selection of this. */ - gchar * _text; + /** Extended description of the parameter (crrently shown as tooltip on hover). */ + gchar * _description; - /** Whether the GUI is visible. */ - bool _gui_hidden; + /** Whether the parameter is visible. */ + bool _hidden; /** Indentation level of the parameter. */ int _indent; @@ -191,7 +191,7 @@ protected: private: /** Which extension is this parameter attached to. */ - Inkscape::Extension::Extension *extension; + Inkscape::Extension::Extension *_extension; /** The name of this parameter. */ gchar *_name; diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 166167fda..2e757febe 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -41,31 +41,31 @@ namespace Inkscape { namespace Extension { /* For internal use only. - Note that value and guitext MUST be non-NULL. This is ensured by newing only at one location in the code where non-NULL checks are made. */ + Note that value and text MUST be non-NULL. This is ensured by newing only at one location in the code where non-NULL checks are made. */ class optionentry { public: optionentry (Glib::ustring * val, Glib::ustring * text) { value = val; - guitext = text; + text = text; } ~optionentry() { delete value; - delete guitext; + delete text; } Glib::ustring * value; - Glib::ustring * guitext; + Glib::ustring * text; }; ParamRadioButton::ParamRadioButton(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) - : Parameter(name, guitext, desc, gui_hidden, indent, ext) + : Parameter(name, text, description, hidden, indent, ext) , _value(0) , _mode(mode) , choices(0) @@ -77,7 +77,7 @@ ParamRadioButton::ParamRadioButton(const gchar * name, while (child_repr != NULL) { char const * chname = child_repr->name(); if (!strcmp(chname, INKSCAPE_EXTENSION_NS "option") || !strcmp(chname, INKSCAPE_EXTENSION_NS "_option")) { - Glib::ustring * newguitext = NULL; + Glib::ustring * newtext = NULL; Glib::ustring * newvalue = NULL; const char * contents = child_repr->firstChild()->content(); @@ -85,12 +85,12 @@ ParamRadioButton::ParamRadioButton(const gchar * name, // don't translate when 'item' but do translate when '_option' if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_option")) { if (child_repr->attribute("msgctxt") != NULL) { - newguitext = new Glib::ustring(g_dpgettext2(NULL, child_repr->attribute("msgctxt"), contents)); + newtext = new Glib::ustring(g_dpgettext2(NULL, child_repr->attribute("msgctxt"), contents)); } else { - newguitext = new Glib::ustring(_(contents)); + newtext = new Glib::ustring(_(contents)); } } else { - newguitext = new Glib::ustring(contents); + newtext = new Glib::ustring(contents); } } else { continue; @@ -104,8 +104,8 @@ ParamRadioButton::ParamRadioButton(const gchar * name, newvalue = new Glib::ustring(contents); } - if ( (newguitext) && (newvalue) ) { // logical error if this is not true here - choices = g_slist_append( choices, new optionentry(newvalue, newguitext) ); + if ( (newtext) && (newvalue) ) { // logical error if this is not true here + choices = g_slist_append( choices, new optionentry(newvalue, newtext) ); } } child_repr = child_repr->next(); @@ -280,7 +280,7 @@ Glib::ustring ParamRadioButton::value_from_label(const Glib::ustring label) for (GSList * list = choices; list != NULL; list = g_slist_next(list)) { optionentry * entr = reinterpret_cast(list->data); - if ( !entr->guitext->compare(label) ) { + if ( !entr->text->compare(label) ) { value = *(entr->value); break; } @@ -295,7 +295,7 @@ Glib::ustring ParamRadioButton::value_from_label(const Glib::ustring label) */ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { - if (_gui_hidden) { + if (_hidden) { return NULL; } @@ -321,7 +321,7 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node Gtk::RadioButtonGroup group; for (GSList * list = choices; list != NULL; list = g_slist_next(list)) { optionentry * entr = reinterpret_cast(list->data); - Glib::ustring * text = entr->guitext; + Glib::ustring * text = entr->text; switch ( _mode ) { case MINIMAL: { diff --git a/src/extension/param/radiobutton.h b/src/extension/param/radiobutton.h index f41852baa..b91b11ea3 100644 --- a/src/extension/param/radiobutton.h +++ b/src/extension/param/radiobutton.h @@ -35,9 +35,9 @@ public: }; ParamRadioButton(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index 22893cd0a..51b5dfdf3 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -77,13 +77,13 @@ void ParamString::string(std::string &string) const /** Initialize the object, to do that, copy the data. */ ParamString::ParamString(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, gui_hidden, indent, ext) + : Parameter(name, text, description, hidden, indent, ext) , _value(NULL) { const char * defaultval = NULL; @@ -162,7 +162,7 @@ void ParamStringEntry::changed_text(void) */ Gtk::Widget * ParamString::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { - if (_gui_hidden) { + if (_hidden) { return NULL; } diff --git a/src/extension/param/string.h b/src/extension/param/string.h index 2dc1bd483..d338f83b9 100644 --- a/src/extension/param/string.h +++ b/src/extension/param/string.h @@ -24,9 +24,9 @@ private: gint _max_length; public: ParamString(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); -- cgit v1.2.3 From bcd53f13e2f8547266a915dac0fc4c0012bfcf87 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 24 Apr 2017 21:43:24 +0200 Subject: Extensions: Fixes and improvements for "gui-description" parameter attribute along the lines of r14955 - "gui-description" was always translated (as opposed to only "_gui-description") - Added possibility to specify "msgctxt" for "_gui-description" (bzr r15635) --- src/extension/extension.cpp | 2 +- src/extension/param/notebook.cpp | 2 +- src/extension/param/parameter.cpp | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/extension') diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index ebdc83b94..497f98431 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -701,7 +701,7 @@ public: #endif this->pack_start(*widg, false, false, 0); if (tooltip) { - widg->set_tooltip_text(_(tooltip)); + widg->set_tooltip_text(tooltip); } else { widg->set_tooltip_text(""); widg->set_has_tooltip(false); diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index a31dda421..4e94b5216 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -211,7 +211,7 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod gchar const * tip = param->get_tooltip(); if (tip) { - widg->set_tooltip_text(_(tip)); + widg->set_tooltip_text(tip); } else { widg->set_tooltip_text(""); widg->set_has_tooltip(false); diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index eeffbecf2..e2093158d 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -80,6 +80,14 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex const char *description = in_repr->attribute("gui-description"); if (description == NULL) { description = in_repr->attribute("_gui-description"); + if (description != NULL) { + const char *context = in_repr->attribute("msgctxt"); + if (context != NULL) { + description = g_dpgettext2(NULL, context, description); + } else { + description = _(description); + } + } } bool hidden = false; { -- cgit v1.2.3 From 0567ff4516388537e06ecfbe5058ad0da7d94d5f Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 24 Apr 2017 22:33:04 +0200 Subject: Extensions: Fix "param"s of type "description" were always translated (as opposed to only the underscored variant "_param") (bzr r15636) --- src/extension/param/description.cpp | 57 +++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 27 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 1b3f64ec6..0a534d382 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -41,27 +41,49 @@ ParamDescription::ParamDescription(const gchar * name, , _mode(mode) , _preserve_whitespace(false) { - Glib::ustring defaultval; + // construct the text content by concatenating all (non-empty) text nodes, + // removing all other nodes (e.g. comment nodes) and replacing elements with "
" + Glib::ustring value; Inkscape::XML::Node * cur_child = xml->firstChild(); while (cur_child != NULL) { if (cur_child->type() == XML::TEXT_NODE && cur_child->content() != NULL) { - defaultval += cur_child->content(); + value += cur_child->content(); } else if (cur_child->type() == XML::ELEMENT_NODE && !g_strcmp0(cur_child->name(), "extension:br")) { - defaultval += "
"; + value += "
"; } cur_child = cur_child->next(); } - if (defaultval != Glib::ustring("")) { - _value = g_strdup(defaultval.c_str()); + // if there is no text content we can return immediately (the description will be invisible) + if (value == Glib::ustring("")) { + return; } - _context = xml->attribute("msgctxt"); - + // do replacements in the source string to account for the attribute xml:space="preserve" + // (those should match replacements potentially performed by xgettext to allow for proper translation) if (g_strcmp0(xml->attribute("xml:space"), "preserve") == 0) { - _preserve_whitespace = true; + // xgettext copies the source string verbatim in this case, so no changes needed + } else { + // remove all whitespace from start/end of string and replace intermediate whitespace with a single space + value = Glib::Regex::create("^\\s+|\\s+$")->replace_literal(value, 0, "", (Glib::RegexMatchFlags)0); + value = Glib::Regex::create("\\s+")->replace_literal(value, 0, " ", (Glib::RegexMatchFlags)0); + } + + // translate if underscored version (_param) was used + if (g_str_has_prefix(xml->name(), "extension:_")) { + _context = xml->attribute("msgctxt"); + if (_context != NULL) { + value = g_dpgettext2(NULL, _context, value.c_str()); + } else { + value = _(value.c_str()); + } } + // finally replace all remaining
with a real newline character + value = Glib::Regex::create("
")->replace_literal(value, 0, "\n", (Glib::RegexMatchFlags)0); + + _value = g_strdup(value.c_str()); + return; } @@ -78,25 +100,6 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node Glib::ustring newtext = _value; - // do replacements in the source string matching those performed by xgettext to allow for proper translation - if (_preserve_whitespace) { - // xgettext copies the source string verbatim in this case, so no changes needed - } else { - // remove all whitespace from start/end of string and replace intermediate whitespace with a single space - newtext = Glib::Regex::create("^\\s+|\\s+$")->replace_literal(newtext, 0, "", (Glib::RegexMatchFlags)0); - newtext = Glib::Regex::create("\\s+")->replace_literal(newtext, 0, " ", (Glib::RegexMatchFlags)0); - } - - // translate - if (_context != NULL) { - newtext = g_dpgettext2(NULL, _context, newtext.c_str()); - } else { - newtext = _(newtext.c_str()); - } - - // finally replace all remaining
with a real newline character - newtext = Glib::Regex::create("
")->replace_literal(newtext, 0, "\n", (Glib::RegexMatchFlags)0); - Gtk::Label * label = Gtk::manage(new Gtk::Label()); if (_mode == HEADER) { label->set_markup(Glib::ustring("") + Glib::Markup::escape_text(newtext) + Glib::ustring("")); -- cgit v1.2.3 From 7d95624fa3769bb7e660cabff62df6cbb33e2317 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 24 Apr 2017 23:03:51 +0200 Subject: Cleanup for previous commit (bzr r15637) --- src/extension/param/description.cpp | 7 +++---- src/extension/param/description.h | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 0a534d382..cf94918f7 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -39,7 +39,6 @@ ParamDescription::ParamDescription(const gchar * name, : Parameter(name, text, description, hidden, indent, ext) , _value(NULL) , _mode(mode) - , _preserve_whitespace(false) { // construct the text content by concatenating all (non-empty) text nodes, // removing all other nodes (e.g. comment nodes) and replacing elements with "
" @@ -71,9 +70,9 @@ ParamDescription::ParamDescription(const gchar * name, // translate if underscored version (_param) was used if (g_str_has_prefix(xml->name(), "extension:_")) { - _context = xml->attribute("msgctxt"); - if (_context != NULL) { - value = g_dpgettext2(NULL, _context, value.c_str()); + const gchar * context = xml->attribute("msgctxt"); + if (context != NULL) { + value = g_dpgettext2(NULL, context, value.c_str()); } else { value = _(value.c_str()); } diff --git a/src/extension/param/description.h b/src/extension/param/description.h index 67985470c..599c4db78 100644 --- a/src/extension/param/description.h +++ b/src/extension/param/description.h @@ -43,8 +43,6 @@ private: /** \brief Internal value. */ gchar * _value; AppearanceMode _mode; - const gchar* _context; - bool _preserve_whitespace; }; } /* namespace Extension */ -- cgit v1.2.3 From c091b4dad5c911f23eb657130ba260a2b664e944 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 24 Apr 2017 23:37:16 +0200 Subject: Restore r14978 which was reverted in r15047 due to messed up merge http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/14978 http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/15047 (bzr r15638) --- src/extension/param/bool.cpp | 1 - src/extension/param/float.cpp | 1 - src/extension/param/int.cpp | 1 - src/extension/param/parameter.cpp | 1 - 4 files changed, 4 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index bfff6015c..2c7e32480 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include "xml/node.h" #include "../extension.h" diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 765644185..69283a572 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -15,7 +15,6 @@ #include #include "ui/widget/spinbutton.h" #include "ui/widget/spin-scale.h" -#include #include "xml/node.h" #include "extension/extension.h" diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 4d17827f1..357f98590 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -15,7 +15,6 @@ #include #include "ui/widget/spinbutton.h" #include "ui/widget/spin-scale.h" -#include #include "xml/node.h" #include "extension/extension.h" diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index e2093158d..5c4fe591f 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -20,7 +20,6 @@ #endif #include -#include #include "ui/widget/color-notebook.h" #include -- cgit v1.2.3 From 42f4d5a56491249f38fd879bc0b651fbb454ac1b Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Fri, 28 Apr 2017 19:05:51 +0200 Subject: Fix regression introduced in r15634 Fixed bugs: - https://launchpad.net/bugs/1686549 (bzr r15647) --- src/extension/param/radiobutton.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/extension') diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 2e757febe..a08ba6860 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -44,9 +44,9 @@ namespace Extension { Note that value and text MUST be non-NULL. This is ensured by newing only at one location in the code where non-NULL checks are made. */ class optionentry { public: - optionentry (Glib::ustring * val, Glib::ustring * text) { + optionentry (Glib::ustring * val, Glib::ustring * txt) { value = val; - text = text; + text = txt; } ~optionentry() { delete value; -- cgit v1.2.3 From 957df000b3fe2c65d773ef5117a4a3dd376d42aa Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 30 Apr 2017 17:40:28 +0200 Subject: CDR/VSD input: Avoid crash when preview image can not be rendered and show a placeholder instead (bzr r15653) --- src/extension/internal/cdr-input.cpp | 13 +++++++++++++ src/extension/internal/vsd-input.cpp | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index 70bf84ef4..b94408b36 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -210,6 +210,19 @@ void CdrImportDialog::_setPreviewPage() } SPDocument *doc = SPDocument::createNewDocFromMem(_vec[_current_page-1].cstr(), strlen(_vec[_current_page-1].cstr()), 0); + if(!doc) { + g_warning("CDR import: Could not create preview for page %d", _current_page); + gchar const *no_preview_template = + "" + " " + " " + " %s" + ""; + gchar * no_preview = g_strdup_printf(no_preview_template, _("No preview")); + doc = SPDocument::createNewDocFromMem(no_preview, strlen(no_preview), 0); + g_free(no_preview); + } + Gtk::Widget * tmpPreviewArea = Glib::wrap(sp_svg_view_widget_new(doc)); std::swap(_previewArea, tmpPreviewArea); delete tmpPreviewArea; diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index b7277b99e..c1cfb5cc6 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -146,7 +146,7 @@ VsdImportDialog::VsdImportDialog(const std::vector &vec) _page_selector_box->pack_start(*_labelTotalPages, Gtk::PACK_SHRINK); vbox1->pack_end(*_page_selector_box, Gtk::PACK_SHRINK); - + // Buttons cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true)); okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true)); @@ -211,6 +211,19 @@ void VsdImportDialog::_setPreviewPage() } SPDocument *doc = SPDocument::createNewDocFromMem(_vec[_current_page-1].cstr(), strlen(_vec[_current_page-1].cstr()), 0); + if(!doc) { + g_warning("VSD import: Could not create preview for page %d", _current_page); + gchar const *no_preview_template = + "" + " " + " " + " %s" + ""; + gchar * no_preview = g_strdup_printf(no_preview_template, _("No preview")); + doc = SPDocument::createNewDocFromMem(no_preview, strlen(no_preview), 0); + g_free(no_preview); + } + Gtk::Widget * tmpPreviewArea = Glib::wrap(sp_svg_view_widget_new(doc)); std::swap(_previewArea, tmpPreviewArea); delete tmpPreviewArea; -- cgit v1.2.3 From e8a4f74636bade09da8613a09e80809f6824f944 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 29 May 2017 15:26:04 +0200 Subject: Fix PDF export with respect to 'image-rendering'. (bzr r15715) --- src/extension/internal/cairo-render-context.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 06711bca4..21902db7d 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -1580,13 +1580,13 @@ bool CairoRenderContext::renderImage(Inkscape::Pixbuf *pb, // http://www.w3.org/TR/css4-images/#the-image-rendering // style.h/style.cpp switch (style->image_rendering.computed) { - case SP_CSS_COLOR_RENDERING_AUTO: - // Do nothing - break; - case SP_CSS_COLOR_RENDERING_OPTIMIZEQUALITY: + case SP_CSS_IMAGE_RENDERING_AUTO: + case SP_CSS_IMAGE_RENDERING_OPTIMIZEQUALITY: + case SP_CSS_IMAGE_RENDERING_CRISPEDGES: cairo_pattern_set_filter(cairo_get_source(_cr), CAIRO_FILTER_BEST ); break; - case SP_CSS_COLOR_RENDERING_OPTIMIZESPEED: + case SP_CSS_IMAGE_RENDERING_OPTIMIZESPEED: + case SP_CSS_IMAGE_RENDERING_PIXELATED: default: cairo_pattern_set_filter(cairo_get_source(_cr), CAIRO_FILTER_NEAREST ); break; -- cgit v1.2.3 From f1d04e193de10384953849721a4d8839b4e6d1e2 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 31 May 2017 13:59:57 +0200 Subject: Sort File Save and File Input file type menus. (bzr r15720) --- src/extension/db.cpp | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 3 deletions(-) (limited to 'src/extension') diff --git a/src/extension/db.cpp b/src/extension/db.cpp index f17b784a9..e885d3531 100644 --- a/src/extension/db.cpp +++ b/src/extension/db.cpp @@ -35,6 +35,76 @@ DB db; DB::DB (void) { } + +struct ModuleInputCmp { + bool operator()(Input* module1, Input* module2) const { + + // Ensure SVG files are at top + int n1 = 0; + int n2 = 0; + // 12345678901234567890123456789012 + if (strncmp(module1->get_id(),"org.inkscape.input.svg", 22) == 0) n1 = 1; + if (strncmp(module2->get_id(),"org.inkscape.input.svg", 22) == 0) n2 = 1; + if (strncmp(module1->get_id(),"org.inkscape.input.svgz", 23) == 0) n1 = 2; + if (strncmp(module2->get_id(),"org.inkscape.input.svgz", 23) == 0) n2 = 2; + + if (n1 != 0 && n2 != 0) return (n1 < n2); + if (n1 != 0) return true; + if (n2 != 0) return false; + + // GDK filetypenames begin with lower case letters and thus are sorted at the end. + // Special case "sK1" which starts with a lower case letter to keep it out of GDK region. + if (strncmp(module1->get_id(),"org.inkscape.input.sk1", 22) == 0) { + return ( strcmp("SK1", module2->get_filetypename()) <= 0 ); + } + if (strncmp(module2->get_id(),"org.inkscape.input.sk1", 22) == 0) { + return ( strcmp(module1->get_filetypename(), "SK1" ) <= 0 ); + } + + return ( strcmp(module1->get_filetypename(), module2->get_filetypename()) <= 0 ); + } +}; + + +struct ModuleOutputCmp { + bool operator()(Output* module1, Output* module2) const { + + // Ensure SVG files are at top + int n1 = 0; + int n2 = 0; + // 12345678901234567890123456789012 + if (strncmp(module1->get_id(),"org.inkscape.output.svg.inkscape", 32) == 0) n1 = 1; + if (strncmp(module2->get_id(),"org.inkscape.output.svg.inkscape", 32) == 0) n2 = 1; + if (strncmp(module1->get_id(),"org.inkscape.output.svg.plain", 29) == 0) n1 = 2; + if (strncmp(module2->get_id(),"org.inkscape.output.svg.plain", 29) == 0) n2 = 2; + if (strncmp(module1->get_id(),"org.inkscape.output.svgz.inkscape", 33) == 0) n1 = 3; + if (strncmp(module2->get_id(),"org.inkscape.output.svgz.inkscape", 33) == 0) n2 = 3; + if (strncmp(module1->get_id(),"org.inkscape.output.svgz.plain", 30) == 0) n1 = 4; + if (strncmp(module2->get_id(),"org.inkscape.output.svgz.plain", 30) == 0) n2 = 4; + if (strncmp(module1->get_id(),"org.inkscape.output.scour", 25) == 0) n1 = 5; + if (strncmp(module2->get_id(),"org.inkscape.output.scour", 25) == 0) n2 = 5; + if (strncmp(module1->get_id(),"org.inkscape.output.ZIP", 23) == 0) n1 = 6; + if (strncmp(module2->get_id(),"org.inkscape.output.ZIP", 23) == 0) n2 = 6; + if (strncmp(module1->get_id(),"org.inkscape.output.LAYERS", 26) == 0) n1 = 7; + if (strncmp(module2->get_id(),"org.inkscape.output.LAYERS", 26) == 0) n2 = 7; + + if (n1 != 0 && n2 != 0) return (n1 < n2); + if (n1 != 0) return true; + if (n2 != 0) return false; + + // Special case "sK1" which starts with a lower case letter. + if (strncmp(module1->get_id(),"org.inkscape.output.sk1", 23) == 0) { + return ( strcmp("SK1", module2->get_filetypename()) <= 0 ); + } + if (strncmp(module2->get_id(),"org.inkscape.output.sk1", 23) == 0) { + return ( strcmp(module1->get_filetypename(), "SK1" ) <= 0 ); + } + + return ( strcmp(module1->get_filetypename(), module2->get_filetypename()) <= 0 ); + } +}; + + /** \brief Add a module to the module database \param module The module to be registered. @@ -49,10 +119,12 @@ DB::register_ext (Extension *module) bool add_to_list = ( moduledict.find(module->get_id()) == moduledict.end()); - //printf("Registering: '%s' add:%d\n", module->get_id(), add_to_list); + //printf("Registering: '%s' '%s' add:%d\n", module->get_id(), module->get_name(), add_to_list); moduledict[module->get_id()] = module; - if (add_to_list) modulelist.push_back(module); + if (add_to_list) { + modulelist.push_back( module ); + } } /** @@ -85,7 +157,7 @@ DB::unregister_ext (Extension * module) Extension * DB::get (const gchar *key) { - if (key == NULL) return NULL; + if (key == NULL) return NULL; Extension *mod = moduledict[key]; if ( !mod || mod->deactivated() ) @@ -207,6 +279,7 @@ DB::InputList & DB::get_input_list (DB::InputList &ou_list) { foreach(input_internal, (gpointer)&ou_list); + ou_list.sort( ModuleInputCmp() ); return ou_list; } @@ -220,6 +293,7 @@ DB::OutputList & DB::get_output_list (DB::OutputList &ou_list) { foreach(output_internal, (gpointer)&ou_list); + ou_list.sort( ModuleOutputCmp() ); return ou_list; } -- cgit v1.2.3 From de697807d5fdd8702f49fed8168393215e0b7414 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 1 Jun 2017 10:36:34 +0200 Subject: Use uniform name for input and output (and PDF is an ISO standard and no longer tied to Adobe). (bzr r15723) --- src/extension/internal/pdfinput/pdf-input.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index a57396b17..2ee713085 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -946,8 +946,8 @@ void PdfInput::init(void) { "\n" ".pdf\n" "application/pdf\n" - "" N_("Adobe PDF (*.pdf)") "\n" - "" N_("Adobe Portable Document Format") "\n" + "" N_("Portable Document Format (*.pdf)") "\n" + "" N_("Portable Document Format") "\n" "\n" "
", new PdfInput()); -- cgit v1.2.3 From 038293f7984fa8bfd89a0451d3d77fce3f62610c Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 1 Jun 2017 11:46:21 +0200 Subject: Avoid name conflict with libwmf (wmf_free). (bzr r15724) --- src/extension/internal/wmf-print.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index 6dd9d895e..29dfa2716 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -312,7 +312,7 @@ unsigned int PrintWmf::finish(Inkscape::Extension::Print * /*mod*/) g_error("Fatal programming error in PrintWmf::finish"); } (void) wmf_finish(wt); // Finalize and write out the WMF - wmf_free(&wt); // clean up + uwmf_free(&wt); // clean up wmf_htable_free(&wht); // clean up return 0; -- cgit v1.2.3