diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-02-23 22:17:37 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-02-23 22:17:37 +0000 |
| commit | ed54c75dc7f31deae37ab89162da9127fb0e3b9a (patch) | |
| tree | fe5809ff5f17199e7fa773cd47ef877b4a8125d3 /src | |
| parent | Added flexible/fixed to fillet chamfer and fix bugs (diff) | |
| parent | on a File->Open, set the viewBox if it did not previously exist, same as was ... (diff) | |
| download | inkscape-ed54c75dc7f31deae37ab89162da9127fb0e3b9a.tar.gz inkscape-ed54c75dc7f31deae37ab89162da9127fb0e3b9a.zip | |
update to trunk
(bzr r13645.1.21)
Diffstat (limited to 'src')
| -rw-r--r-- | src/attributes-test.h | 11 | ||||
| -rw-r--r-- | src/desktop-style.cpp | 4 | ||||
| -rw-r--r-- | src/file.cpp | 6 | ||||
| -rw-r--r-- | src/object-test.h | 1 | ||||
| -rw-r--r-- | src/selection-chemistry.cpp | 99 | ||||
| -rw-r--r-- | src/selection-chemistry.h | 8 | ||||
| -rw-r--r-- | src/sp-item-group.cpp | 12 | ||||
| -rw-r--r-- | src/sp-item-group.h | 2 | ||||
| -rw-r--r-- | src/sp-object.cpp | 12 | ||||
| -rw-r--r-- | src/sp-object.h | 5 | ||||
| -rw-r--r-- | src/svg/svg-length-test.h | 5 | ||||
| -rw-r--r-- | src/ui/clipboard.cpp | 10 | ||||
| -rw-r--r-- | src/ui/dialog/clonetiler.cpp | 11 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 55 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.cpp | 42 | ||||
| -rw-r--r-- | src/ui/dialog/objects.cpp | 68 | ||||
| -rw-r--r-- | src/ui/dialog/tags.cpp | 33 | ||||
| -rw-r--r-- | src/ui/dialog/tags.h | 2 | ||||
| -rw-r--r-- | src/ui/dialog/xml-tree.cpp | 16 | ||||
| -rw-r--r-- | src/ui/interface.cpp | 2 | ||||
| -rw-r--r-- | src/ui/widget/addtoicon.cpp | 17 | ||||
| -rw-r--r-- | src/ui/widget/addtoicon.h | 2 | ||||
| -rw-r--r-- | src/widgets/gradient-selector.cpp | 37 |
23 files changed, 177 insertions, 283 deletions
diff --git a/src/attributes-test.h b/src/attributes-test.h index ba34717ea..7379e4e85 100644 --- a/src/attributes-test.h +++ b/src/attributes-test.h @@ -38,6 +38,8 @@ public: attindex.html lacks attributeName, begin, additive, font, marker; I've added these manually. + + SVG 2: white-space, shape-inside, shape-outside, shape-padding, shape-margin */ struct {char const *attr; bool supported;} const all_attrs[] = { {"attributeName", true}, @@ -163,7 +165,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = { {"keySplines", true}, {"keyTimes", true}, {"lang", true}, - {"lengthAdjust", false}, + {"lengthAdjust", true}, {"letter-spacing", true}, {"lighting-color", true}, {"limitingConeAngle", true}, @@ -246,6 +248,10 @@ struct {char const *attr; bool supported;} const all_attrs[] = { {"ry", true}, {"scale", true}, {"seed", true}, + {"shape-inside", true}, + {"shape-margin", true}, + {"shape-outside", true}, + {"shape-padding", true}, {"shape-rendering", true}, {"slope", true}, {"spacing", false}, @@ -285,7 +291,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = { {"text-indent", true}, {"text-rendering", true}, {"text-transform", true}, - {"textLength", false}, + {"textLength", true}, {"title", false}, {"to", true}, {"transform", true}, @@ -310,6 +316,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = { {"viewBox", true}, {"viewTarget", false}, {"visibility", true}, + {"white-space", true}, {"width", true}, {"widths", true}, {"word-spacing", true}, diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index ee9fa39ec..c713e0d61 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -1031,7 +1031,7 @@ objects_query_fontnumbers (GSList *objects, SPStyle *style_res) letterspacing_normal = true; } } else { - letterspacing += style->letter_spacing.computed; /// \todo FIXME: we assume non-% units here + letterspacing += style->letter_spacing.computed * Geom::Affine(item->i2dt_affine()).descrim(); /// \todo FIXME: we assume non-% units here letterspacing_normal = false; } @@ -1040,7 +1040,7 @@ objects_query_fontnumbers (GSList *objects, SPStyle *style_res) wordspacing_normal = true; } } else { - wordspacing += style->word_spacing.computed; /// \todo FIXME: we assume non-% units here + wordspacing += style->word_spacing.computed * Geom::Affine(item->i2dt_affine()).descrim(); /// \todo FIXME: we assume non-% units here wordspacing_normal = false; } diff --git a/src/file.cpp b/src/file.cpp index 72516d776..f9e259fe2 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -288,6 +288,12 @@ bool sp_file_open(const Glib::ustring &uri, } if (doc) { + // Set viewBox if it doesn't exist + if (!doc->getRoot()->viewBox_set) { + DocumentUndo::setUndoSensitive(doc, false); + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDisplayUnit()), doc->getHeight().value(doc->getDisplayUnit()))); + DocumentUndo::setUndoSensitive(doc, true); + } SPDocument *existing = desktop ? desktop->getDocument() : NULL; diff --git a/src/object-test.h b/src/object-test.h index d6a9dbbd3..06363c372 100644 --- a/src/object-test.h +++ b/src/object-test.h @@ -208,6 +208,7 @@ public: end = clock(); std::cout << "Took " << double(end - begin) / double(CLOCKS_PER_SEC) << " seconds to ungroup a <g> with " << num_elements << " elements\n"; + std::cout << " Note: sp_item_group_ungroup_handle_clones() is responsible\n for most of the time as it is linear in number of elements\n which results in quadratic behavior for ungrouping." << std::endl; begin = clock(); // Remove those elements diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 17b31f8b7..5e8fd5e07 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -202,7 +202,7 @@ void SelectionHelper::selectSameStrokeColor(SPDesktop *dt) void SelectionHelper::selectSameStrokeStyle(SPDesktop *dt) { - sp_select_same_stroke_style(dt); + sp_select_same_fill_stroke_style(dt, false, false, true); } void SelectionHelper::selectSameObjectType(SPDesktop *dt) @@ -1332,8 +1332,7 @@ void sp_selection_change_layer_maintain_clones(GSList const *items,SPObject *whe if (item) { SPItem *oldparent = dynamic_cast<SPItem *>(item->parent); SPItem *newparent = dynamic_cast<SPItem *>(where); - sp_item_group_ungroup_handle_clones(item->document->getRoot(), - item, + sp_item_group_ungroup_handle_clones(item, (oldparent->i2doc_affine()) *((newparent->i2doc_affine()).inverse())); } @@ -1880,16 +1879,17 @@ void sp_select_same_fill_stroke_style(SPDesktop *desktop, gboolean fill, gboolea for (GSList const* sel_iter = selection->itemList(); sel_iter; sel_iter = sel_iter->next) { SPItem *sel = dynamic_cast<SPItem *>(static_cast<SPObject *>(sel_iter->data)); GSList *matches = all_list; - if (fill) { - matches = sp_get_same_fill_or_stroke_color(sel, matches, SP_FILL_COLOR); + if (fill && stroke && style) { + matches = sp_get_same_style(sel, matches); } - if (stroke) { - matches = sp_get_same_fill_or_stroke_color(sel, matches, SP_STROKE_COLOR); + else if (fill) { + matches = sp_get_same_style(sel, matches, SP_FILL_COLOR); } - if (style) { - matches = sp_get_same_stroke_style(sel, matches, SP_STROKE_STYLE_WIDTH); - matches = sp_get_same_stroke_style(sel, matches, SP_STROKE_STYLE_DASHES); - matches = sp_get_same_stroke_style(sel, matches, SP_STROKE_STYLE_MARKERS); + else if (stroke) { + matches = sp_get_same_style(sel, matches, SP_STROKE_COLOR); + } + else if (style) { + matches = sp_get_same_style(sel, matches,SP_STROKE_STYLE_ALL); } all_matches = g_slist_concat (all_matches, matches); } @@ -1950,49 +1950,7 @@ void sp_select_same_object_type(SPDesktop *desktop) } } -/* - * Selects all the visible items with the same stroke style as the items in the current selection - * - * Params: - * desktop - set the selection on this desktop - */ -void sp_select_same_stroke_style(SPDesktop *desktop) -{ - if (!desktop) { - return; - } - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - bool onlyvisible = prefs->getBool("/options/kbselection/onlyvisible", true); - bool onlysensitive = prefs->getBool("/options/kbselection/onlysensitive", true); - bool ingroups = TRUE; - - GSList *all_list = get_all_items(NULL, desktop->currentRoot(), desktop, onlyvisible, onlysensitive, ingroups, NULL); - GSList *matches = all_list; - - Inkscape::Selection *selection = desktop->getSelection(); - - for (GSList const* sel_iter = selection->itemList(); sel_iter; sel_iter = sel_iter->next) { - SPItem *sel = dynamic_cast<SPItem *>(static_cast<SPObject *>(sel_iter->data)); - if (sel) { - matches = sp_get_same_stroke_style(sel, matches, SP_STROKE_STYLE_WIDTH); - matches = sp_get_same_stroke_style(sel, matches, SP_STROKE_STYLE_DASHES); - matches = sp_get_same_stroke_style(sel, matches, SP_STROKE_STYLE_MARKERS); - } else { - g_assert_not_reached(); - } - } - - selection->clear(); - selection->setList(matches); - - if (matches) { - g_slist_free(matches); - } - if (all_list) { - g_slist_free(all_list); - } -} /* * Find all items in src list that have the same fill or stroke style as sel @@ -2102,7 +2060,7 @@ GSList *sp_get_same_object_type(SPItem *sel, GSList *src) for (GSList *i = src; i != NULL; i = i->next) { SPItem *item = dynamic_cast<SPItem *>(static_cast<SPObject *>(i->data)); - if (item && item_type_match(sel, item)) { + if (item && item_type_match(sel, item) && !item->cloned) { matches = g_slist_prepend (matches, item); } } @@ -2110,19 +2068,24 @@ GSList *sp_get_same_object_type(SPItem *sel, GSList *src) return matches; } +GSList *sp_get_same_fill_or_stroke_color(SPItem *sel, GSList *src, SPSelectStrokeStyleType type); + /* * Find all items in src list that have the same stroke style as sel by type * Return the list of matching items */ -GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleType type) +GSList *sp_get_same_style(SPItem *sel, GSList *src, SPSelectStrokeStyleType type) { GSList *matches = NULL; - gboolean match = false; + bool match = false; SPStyle *sel_style = sel->style; - if (type == SP_FILL_COLOR || type == SP_STROKE_COLOR) { - return sp_get_same_fill_or_stroke_color(sel, src, type); + if (type == SP_FILL_COLOR || type == SP_STYLE_ALL) { + src = sp_get_same_fill_or_stroke_color(sel, src, SP_FILL_COLOR); + } + if (type == SP_STROKE_COLOR || type == SP_STYLE_ALL) { + src = sp_get_same_fill_or_stroke_color(sel, src, SP_STROKE_COLOR); } /* @@ -2131,19 +2094,20 @@ GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleTy */ GSList *objects = NULL; SPStyle *sel_style_for_width = NULL; - if (type == SP_STROKE_STYLE_WIDTH) { + if (type == SP_STROKE_STYLE_WIDTH || type == SP_STROKE_STYLE_ALL || type==SP_STYLE_ALL ) { objects = g_slist_prepend(objects, sel); sel_style_for_width = new SPStyle(SP_ACTIVE_DOCUMENT); objects_query_strokewidth (objects, sel_style_for_width); } - + bool match_g; for (GSList *i = src; i != NULL; i = i->next) { SPItem *iter = dynamic_cast<SPItem *>(static_cast<SPObject *>(i->data)); if (iter) { + match_g=true; SPStyle *iter_style = iter->style; - match = false; + match = true; - if (type == SP_STROKE_STYLE_WIDTH) { + if (type == SP_STROKE_STYLE_WIDTH|| type == SP_STROKE_STYLE_ALL|| type==SP_STYLE_ALL) { match = (sel_style->stroke_width.set == iter_style->stroke_width.set); if (sel_style->stroke_width.set && iter_style->stroke_width.set) { GSList *objects = NULL; @@ -2157,13 +2121,15 @@ GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleTy g_slist_free(objects); } } - else if (type == SP_STROKE_STYLE_DASHES ) { + match_g = match_g && match; + if (type == SP_STROKE_STYLE_DASHES|| type == SP_STROKE_STYLE_ALL || type==SP_STYLE_ALL) { match = (sel_style->stroke_dasharray.set == iter_style->stroke_dasharray.set); if (sel_style->stroke_dasharray.set && iter_style->stroke_dasharray.set) { match = (sel_style->stroke_dasharray.values == iter_style->stroke_dasharray.values); } } - else if (type == SP_STROKE_STYLE_MARKERS) { + match_g = match_g && match; + if (type == SP_STROKE_STYLE_MARKERS|| type == SP_STROKE_STYLE_ALL|| type==SP_STYLE_ALL) { match = true; int len = sizeof(sel_style->marker)/sizeof(SPIString); for (int i = 0; i < len; i++) { @@ -2175,8 +2141,9 @@ GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleTy } } } - - if (match) { + match_g = match_g && match; + if (match_g) { + while (iter->cloned) iter=dynamic_cast<SPItem *>(iter->parent); matches = g_slist_prepend(matches, iter); } } else { diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h index d86906548..4ee7a5200 100644 --- a/src/selection-chemistry.h +++ b/src/selection-chemistry.h @@ -136,14 +136,14 @@ enum SPSelectStrokeStyleType { SP_STROKE_COLOR = 1, SP_STROKE_STYLE_WIDTH = 2, SP_STROKE_STYLE_DASHES = 3, - SP_STROKE_STYLE_MARKERS = 4 + SP_STROKE_STYLE_MARKERS = 4, + SP_STROKE_STYLE_ALL = 5, + SP_STYLE_ALL = 6 }; void sp_select_same_fill_stroke_style(SPDesktop *desktop, gboolean fill, gboolean strok, gboolean style); -void sp_select_same_stroke_style(SPDesktop *desktop); void sp_select_same_object_type(SPDesktop *desktop); -GSList *sp_get_same_fill_or_stroke_color(SPItem *sel, GSList *src, SPSelectStrokeStyleType type); -GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleType type); +GSList *sp_get_same_style(SPItem *sel, GSList *src, SPSelectStrokeStyleType type=SP_STYLE_ALL); GSList *sp_get_same_object_type(SPItem *sel, GSList *src); void scroll_to_show_item(SPDesktop *desktop, SPItem *item); diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 3c2053cb2..0f76051bc 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -399,10 +399,10 @@ void SPGroup::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape: } } -void sp_item_group_ungroup_handle_clones(SPGroup *group,SPItem *parent, Geom::Affine const g) +void sp_item_group_ungroup_handle_clones(SPItem *parent, Geom::Affine const g) { - for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { - SPItem *citem = dynamic_cast<SPItem *>(child); + for(std::list<SPObject*>::const_iterator refd=parent->hrefList.begin();refd!=parent->hrefList.end();refd++){ + SPItem *citem = dynamic_cast<SPItem *>(*refd); if (citem) { SPUse *useitem = dynamic_cast<SPUse *>(citem); if (useitem && useitem->get_original() == parent) { @@ -412,10 +412,6 @@ void sp_item_group_ungroup_handle_clones(SPGroup *group,SPItem *parent, Geom::Af citem->setAttribute("transform", affinestr); g_free(affinestr); } - SPGroup *groupitem = dynamic_cast<SPGroup *>(citem); - if (groupitem) { - sp_item_group_ungroup_handle_clones(groupitem,parent,g); - } } } } @@ -459,7 +455,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) if (SPItem *citem = dynamic_cast<SPItem *>(child)) - sp_item_group_ungroup_handle_clones(root,citem,g); + sp_item_group_ungroup_handle_clones(citem,g); for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { diff --git a/src/sp-item-group.h b/src/sp-item-group.h index 4bac0b269..f9a8b88f5 100644 --- a/src/sp-item-group.h +++ b/src/sp-item-group.h @@ -102,7 +102,7 @@ public: * @param parent original parent * @param g transform */ -void sp_item_group_ungroup_handle_clones(SPGroup *group,SPItem *parent, Geom::Affine const g); +void sp_item_group_ungroup_handle_clones(SPItem *parent, Geom::Affine const g); void sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done = true); diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 7d24a978e..1094b88a7 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -115,7 +115,7 @@ static gchar *sp_object_get_unique_id(SPObject *object, SPObject::SPObject() : cloned(0), uflags(0), mflags(0), hrefcount(0), _total_hrefcount(0), document(NULL), parent(NULL), children(NULL), _last_child(NULL), - next(NULL), id(NULL), repr(NULL), refCount(1), + next(NULL), id(NULL), repr(NULL), refCount(1),hrefList(std::list<SPObject*>()), _successor(NULL), _collection_policy(SPObject::COLLECT_WITH_PARENT), _label(NULL), _default_label(NULL) { @@ -254,7 +254,7 @@ SPObject *sp_object_unref(SPObject *object, SPObject *owner) return NULL; } -SPObject *sp_object_href(SPObject *object, gpointer /*owner*/) +SPObject *sp_object_href(SPObject *object, SPObject* owner) { g_return_val_if_fail(object != NULL, NULL); g_return_val_if_fail(SP_IS_OBJECT(object), NULL); @@ -262,10 +262,13 @@ SPObject *sp_object_href(SPObject *object, gpointer /*owner*/) object->hrefcount++; object->_updateTotalHRefCount(1); + if(owner) + object->hrefList.push_front(owner); + return object; } -SPObject *sp_object_hunref(SPObject *object, gpointer /*owner*/) +SPObject *sp_object_hunref(SPObject *object, SPObject* owner) { g_return_val_if_fail(object != NULL, NULL); g_return_val_if_fail(SP_IS_OBJECT(object), NULL); @@ -274,6 +277,9 @@ SPObject *sp_object_hunref(SPObject *object, gpointer /*owner*/) object->hrefcount--; object->_updateTotalHRefCount(-1); + if(owner) + object->hrefList.remove(owner); + return NULL; } diff --git a/src/sp-object.h b/src/sp-object.h index ff80eaefc..ab0b444b6 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -157,7 +157,7 @@ SPObject *sp_object_unref(SPObject *object, SPObject *owner=NULL); * \pre object points to real object * @todo need to move this to be a member of SPObject. */ -SPObject *sp_object_href(SPObject *object, void* owner); +SPObject *sp_object_href(SPObject *object, SPObject* owner); /** * Decrease weak refcount. @@ -169,7 +169,7 @@ SPObject *sp_object_href(SPObject *object, void* owner); * \pre object points to real object and hrefcount>0 * @todo need to move this to be a member of SPObject. */ -SPObject *sp_object_hunref(SPObject *object, void* owner); +SPObject *sp_object_hunref(SPObject *object, SPObject* owner); /** * SPObject is an abstract base class of all of the document nodes at the @@ -218,6 +218,7 @@ private: Inkscape::XML::Node *repr; /* Our xml representation */ public: int refCount; + std::list<SPObject*> hrefList; /** * Returns the objects current ID string. diff --git a/src/svg/svg-length-test.h b/src/svg/svg-length-test.h index 796943e45..0dac4854a 100644 --- a/src/svg/svg-length-test.h +++ b/src/svg/svg-length-test.h @@ -102,7 +102,10 @@ public: for ( int i = (static_cast<int>(SVGLength::NONE) + 1); i <= static_cast<int>(SVGLength::LAST_UNIT); i++ ) { SVGLength::Unit target = static_cast<SVGLength::Unit>(i); // PX is a special case where we don't have a unit string - if ( (target != SVGLength::PX) && (target != SVGLength::FOOT) ) { + // FOOT and MITRE are not CSS/SVG Units + if ( (target != SVGLength::PX) && + (target != SVGLength::FOOT) && + (target != SVGLength::MITRE) ) { gchar const* val = sp_svg_length_get_css_units(target); TSM_ASSERT_DIFFERS(i, val, ""); } diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 94a1eb2dc..5802a1be3 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -685,10 +685,18 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) sp_repr_css_set(obj_copy, css, "style"); sp_repr_css_attr_unref(css); + Geom::Affine transform=item->i2doc_affine(); + // write the complete accumulated transform passed to us // (we're dealing with unattached representations, so we write to their attributes // instead of using sp_item_set_transform) - gchar *transform_str = sp_svg_transform_write(item->i2doc_affine()); + SPUse *use=dynamic_cast<SPUse *>(item); + if( use && selection->includes(use->get_original()) ){//we are copying something whose parent is also copied (!) + transform = ((SPItem*)(use->get_original()->parent))->i2doc_affine().inverse() * transform; + } + gchar *transform_str = sp_svg_transform_write(transform ); + + obj_copy->setAttribute("transform", transform_str); g_free(transform_str); } diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index fede30b26..bd3ad0254 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -2409,7 +2409,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) // Note: We create a clone at 0,0 too, right over the original, in case our clones are colored // Get transform from symmetry, shift, scale, rotation - Geom::Affine t = clonetiler_get_transform (type, i, j, center[Geom::X], center[Geom::Y], w, h, + Geom::Affine orig_t = clonetiler_get_transform (type, i, j, center[Geom::X], center[Geom::Y], w, h, shiftx_per_i, shifty_per_i, shiftx_per_j, shifty_per_j, shiftx_rand, shifty_rand, @@ -2428,7 +2428,8 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) rotate_rand, rotate_alternatei, rotate_alternatej, rotate_cumulatei, rotate_cumulatej ); - + Geom::Affine parent_transform = (((SPItem*)item->parent)->i2doc_affine())*(item->document->getRoot()->c2p.inverse()); + Geom::Affine t = parent_transform*orig_t*parent_transform.inverse(); cur = center * t - center; if (fillrect) { if ((cur[Geom::X] > fillwidth) || (cur[Geom::Y] > fillheight)) { // off limits @@ -2562,7 +2563,9 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) } } if (pick_to_size) { - t = Geom::Translate(-center[Geom::X], -center[Geom::Y]) * Geom::Scale (val, val) * Geom::Translate(center[Geom::X], center[Geom::Y]) * t; + t = parent_transform * Geom::Translate(-center[Geom::X], -center[Geom::Y]) + * Geom::Scale (val, val) * Geom::Translate(center[Geom::X], center[Geom::Y]) + * parent_transform.inverse() * t; } if (pick_to_opacity) { opacity *= val; @@ -2590,7 +2593,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) Geom::Point new_center; bool center_set = false; if (obj_repr->attribute("inkscape:transform-center-x") || obj_repr->attribute("inkscape:transform-center-y")) { - new_center = scale_units*desktop->dt2doc(item->getCenter()) * t; + new_center = scale_units*desktop->dt2doc(item->getCenter()) * orig_t; center_set = true; } diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index af7ca678a..f324f285d 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -87,6 +87,13 @@ static Inkscape::XML::NodeEventVector const _repr_events = { NULL // order_changed }; +static void docprops_style_button(Gtk::Button& btn, char const* iconName) +{ + GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + gtk_widget_show( child ); + btn.add(*Gtk::manage(Glib::wrap(child))); + btn.set_relief(Gtk::RELIEF_NONE); +} DocumentProperties& DocumentProperties::getInstance() { @@ -615,22 +622,10 @@ void DocumentProperties::build_cms() label_avail->set_markup (_("<b>Available Color Profiles:</b>")); _link_btn.set_tooltip_text(_("Link Profile")); -#if WITH_GTKMM_3_10 - _link_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - Gtk::Image *image_link = Gtk::manage(new Gtk::Image()); - image_link->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - _link_btn.set_image(*image_link); -#endif + docprops_style_button(_link_btn, INKSCAPE_ICON("list-add")); _unlink_btn.set_tooltip_text(_("Unlink Profile")); -#if WITH_GTKMM_3_10 - _unlink_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - Gtk::Image *image_unlink = Gtk::manage(new Gtk::Image()); - image_unlink->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - _unlink_btn.set_image(*image_unlink); -#endif + docprops_style_button(_unlink_btn, INKSCAPE_ICON("list-remove")); _page_cms->set_spacing(4); gint row = 0; @@ -752,22 +747,10 @@ void DocumentProperties::build_scripting() label_external->set_markup (_("<b>External script files:</b>")); _external_add_btn.set_tooltip_text(_("Add the current file name or browse for a file")); -#if WITH_GTKMM_3_10 - _external_add_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - Gtk::Image *image_ext_add = Gtk::manage(new Gtk::Image()); - image_ext_add->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - _external_add_btn.set_image(*image_ext_add); -#endif + docprops_style_button(_external_add_btn, INKSCAPE_ICON("list-add")); _external_remove_btn.set_tooltip_text(_("Remove")); -#if WITH_GTKMM_3_10 - _external_remove_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - Gtk::Image *image_ext_rm = Gtk::manage(new Gtk::Image()); - image_ext_rm->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - _external_remove_btn.set_image(*image_ext_rm); -#endif + docprops_style_button(_external_remove_btn, INKSCAPE_ICON("list-remove")); _page_external_scripts->set_spacing(4); gint row = 0; @@ -841,22 +824,10 @@ void DocumentProperties::build_scripting() label_embedded->set_markup (_("<b>Embedded script files:</b>")); _embed_new_btn.set_tooltip_text(_("New")); -#if WITH_GTKMM_3_10 - _embed_new_btn.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - Gtk::Image *image_embed_new = Gtk::manage(new Gtk::Image()); - image_embed_new->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - _embed_new_btn.set_image(*image_embed_new); -#endif + docprops_style_button(_embed_new_btn, INKSCAPE_ICON("list-add")); _embed_remove_btn.set_tooltip_text(_("Remove")); -#if WITH_GTKMM_3_10 - _embed_remove_btn.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - Gtk::Image *image_embed_rm = Gtk::manage(new Gtk::Image()); - image_embed_rm->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - _embed_remove_btn.set_image(*image_embed_rm); -#endif + docprops_style_button(_embed_remove_btn, INKSCAPE_ICON("list-remove")); #if !WITH_GTKMM_3_0 // TODO: This has been removed from Gtkmm 3.0. Check that diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 3b87597c8..422ec10ae 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -27,6 +27,7 @@ #include "document.h" #include "document-undo.h" #include "gtkmm/widget.h" +#include "helper/action.h" #include "inkscape.h" #include "live_effects/effect.h" #include "live_effects/lpeobject.h" @@ -44,6 +45,7 @@ #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" #include "verbs.h" +#include "widgets/icon.h" #include "xml/node.h" #include "livepatheffect-add.h" @@ -68,6 +70,14 @@ static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint lpeeditor->onSelectionChanged(selection); } +static void lpe_style_button(Gtk::Button& btn, char const* iconName) +{ + GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + gtk_widget_show( child ); + btn.add(*Gtk::manage(Glib::wrap(child))); + btn.set_relief(Gtk::RELIEF_NONE); +} + /* * LivePathEffectEditor @@ -107,43 +117,19 @@ LivePathEffectEditor::LivePathEffectEditor() effectcontrol_frame.add(effectcontrol_vbox); button_add.set_tooltip_text(_("Add path effect")); -#if WITH_GTKMM_3_10 - button_add.set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - Gtk::Image *image_add = Gtk::manage(new Gtk::Image()); - image_add->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - button_add.set_image(*image_add); -#endif + lpe_style_button(button_add, INKSCAPE_ICON("list-add")); button_add.set_relief(Gtk::RELIEF_NONE); button_remove.set_tooltip_text(_("Delete current path effect")); -#if WITH_GTKMM_3_10 - button_remove.set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - Gtk::Image *image_remove = Gtk::manage(new Gtk::Image()); - image_remove->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - button_remove.set_image(*image_remove); -#endif + lpe_style_button(button_remove, INKSCAPE_ICON("list-remove")); button_remove.set_relief(Gtk::RELIEF_NONE); button_up.set_tooltip_text(_("Raise the current path effect")); -#if WITH_GTKMM_3_10 - button_up.set_image_from_icon_name(INKSCAPE_ICON("go-up"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - Gtk::Image *image_up = Gtk::manage(new Gtk::Image()); - image_up->set_from_icon_name(INKSCAPE_ICON("go-up"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - button_up.set_image(*image_up); -#endif + lpe_style_button(button_up, INKSCAPE_ICON("go-up")); button_up.set_relief(Gtk::RELIEF_NONE); button_down.set_tooltip_text(_("Lower the current path effect")); -#if WITH_GTKMM_3_10 - button_down.set_image_from_icon_name(INKSCAPE_ICON("go-down"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - Gtk::Image *image_down = Gtk::manage(new Gtk::Image()); - image_down->set_from_icon_name(INKSCAPE_ICON("go-down"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - button_down.set_image(*image_down); -#endif + lpe_style_button(button_down, INKSCAPE_ICON("go-down")); button_down.set_relief(Gtk::RELIEF_NONE); // Add toolbar items to toolbar diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index c95529a56..9db0285d7 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -231,15 +231,13 @@ public: /** * Stylizes a button using the given icon name and tooltip */ -void ObjectsPanel::_styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip ) +void ObjectsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip) { GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName ); gtk_widget_show( child ); btn.add( *Gtk::manage(Glib::wrap(child)) ); btn.set_relief(Gtk::RELIEF_NONE); - btn.set_tooltip_text (tooltip); - } /** @@ -1799,29 +1797,14 @@ ObjectsPanel::ObjectsPanel() : //Add object/layer Gtk::Button* btn = Gtk::manage( new Gtk::Button() ); - btn->set_tooltip_text(_("Add layer...")); -#if GTK_CHECK_VERSION(3,10,0) - btn->set_image_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - Gtk::Image *image_add = Gtk::manage(new Gtk::Image()); - image_add->set_from_icon_name(INKSCAPE_ICON("list-add"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - btn->set_image(*image_add); -#endif + _styleButton(*btn, INKSCAPE_ICON("list-add"), _("Add layer...")); btn->set_relief(Gtk::RELIEF_NONE); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_NEW) ); _buttonsSecondary.pack_start(*btn, Gtk::PACK_SHRINK); - //Remove object btn = Gtk::manage( new Gtk::Button() ); - btn->set_tooltip_text(_("Remove object")); -#if GTK_CHECK_VERSION(3,10,0) - btn->set_image_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - Gtk::Image *image_remove = Gtk::manage(new Gtk::Image()); - image_remove->set_from_icon_name(INKSCAPE_ICON("list-remove"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - btn->set_image(*image_remove); -#endif + _styleButton(*btn, INKSCAPE_ICON("list-remove"), _("Remove object")); btn->set_relief(Gtk::RELIEF_NONE); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_DELETE) ); _watching.push_back( btn ); @@ -1829,14 +1812,7 @@ ObjectsPanel::ObjectsPanel() : //Move to bottom btn = Gtk::manage( new Gtk::Button() ); - btn->set_tooltip_text(_("Move To Bottom")); -#if GTK_CHECK_VERSION(3,10,0) - btn->set_image_from_icon_name(INKSCAPE_ICON("go-bottom"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - image_remove = Gtk::manage(new Gtk::Image()); - image_remove->set_from_icon_name(INKSCAPE_ICON("go-bottom"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - btn->set_image(*image_remove); -#endif + _styleButton(*btn, INKSCAPE_ICON("go-bottom"), _("Move To Bottom")); btn->set_relief(Gtk::RELIEF_NONE); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_BOTTOM) ); _watchingNonBottom.push_back( btn ); @@ -1844,14 +1820,7 @@ ObjectsPanel::ObjectsPanel() : //Move down btn = Gtk::manage( new Gtk::Button() ); - btn->set_tooltip_text(_("Move Down")); -#if GTK_CHECK_VERSION(3,10,0) - btn->set_image_from_icon_name(INKSCAPE_ICON("go-down"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - image_remove = Gtk::manage(new Gtk::Image()); - image_remove->set_from_icon_name(INKSCAPE_ICON("go-down"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - btn->set_image(*image_remove); -#endif + _styleButton(*btn, INKSCAPE_ICON("go-down"), _("Move Down")); btn->set_relief(Gtk::RELIEF_NONE); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_DOWN) ); _watchingNonBottom.push_back( btn ); @@ -1859,14 +1828,7 @@ ObjectsPanel::ObjectsPanel() : //Move up btn = Gtk::manage( new Gtk::Button() ); - btn->set_tooltip_text(_("Move Up")); -#if GTK_CHECK_VERSION(3,10,0) - btn->set_image_from_icon_name(INKSCAPE_ICON("go-up"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - image_remove = Gtk::manage(new Gtk::Image()); - image_remove->set_from_icon_name(INKSCAPE_ICON("go-up"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - btn->set_image(*image_remove); -#endif + _styleButton(*btn, INKSCAPE_ICON("go-up"), _("Move Up")); btn->set_relief(Gtk::RELIEF_NONE); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_UP) ); _watchingNonTop.push_back( btn ); @@ -1874,14 +1836,7 @@ ObjectsPanel::ObjectsPanel() : //Move to top btn = Gtk::manage( new Gtk::Button() ); - btn->set_tooltip_text(_("Move To Top")); -#if GTK_CHECK_VERSION(3,10,0) - btn->set_image_from_icon_name(INKSCAPE_ICON("go-top"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - image_remove = Gtk::manage(new Gtk::Image()); - image_remove->set_from_icon_name(INKSCAPE_ICON("go-top"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - btn->set_image(*image_remove); -#endif + _styleButton(*btn, INKSCAPE_ICON("go-top"), _("Move To Top")); btn->set_relief(Gtk::RELIEF_NONE); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_TOP) ); _watchingNonTop.push_back( btn ); @@ -1889,14 +1844,7 @@ ObjectsPanel::ObjectsPanel() : //Collapse all btn = Gtk::manage( new Gtk::Button() ); - btn->set_tooltip_text(_("Collapse All")); -#if GTK_CHECK_VERSION(3,10,0) - btn->set_image_from_icon_name(INKSCAPE_ICON("gtk-unindent-ltr"), Gtk::ICON_SIZE_SMALL_TOOLBAR); -#else - image_remove = Gtk::manage(new Gtk::Image()); - image_remove->set_from_icon_name(INKSCAPE_ICON("gtk-unindent-ltr"), Gtk::ICON_SIZE_SMALL_TOOLBAR); - btn->set_image(*image_remove); -#endif + _styleButton(*btn, INKSCAPE_ICON("format-indent-less"), _("Collapse All")); btn->set_relief(Gtk::RELIEF_NONE); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &ObjectsPanel::_takeAction), (int)BUTTON_COLLAPSE_ALL) ); _watchingNonBottom.push_back( btn ); diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index 8a104d137..7d3edaffb 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -145,31 +145,12 @@ public: int _actionCode; }; -void TagsPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* tooltip ) +void TagsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip) { - bool set = false; - - if ( iconName ) { - GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName ); - gtk_widget_show( child ); - btn.add( *manage(Glib::wrap(child)) ); - btn.set_relief(Gtk::RELIEF_NONE); - set = true; - } - - if ( desktop ) { - Verb *verb = Verb::get( code ); - if ( verb ) { - SPAction *action = verb->get_action(desktop); - if ( !set && action && action->image ) { - GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, action->image ); - gtk_widget_show( child ); - btn.add( *manage(Glib::wrap(child)) ); - set = true; - } - } - } - + GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + gtk_widget_show(child); + btn.add(*manage(Glib::wrap(child))); + btn.set_relief(Gtk::RELIEF_NONE); btn.set_tooltip_text (tooltip); } @@ -1013,7 +994,7 @@ TagsPanel::TagsPanel() : SPDesktop* targetDesktop = getDesktop(); Gtk::Button* btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_TAG_NEW, GTK_STOCK_ADD, _("Add a new selection set") ); + _styleButton(*btn, "list-add", _("Add a new selection set") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &TagsPanel::_takeAction), (int)BUTTON_NEW) ); _buttonsSecondary.pack_start(*btn, Gtk::PACK_SHRINK); @@ -1022,7 +1003,7 @@ TagsPanel::TagsPanel() : // _buttonsRow.add( *btn ); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_DELETE, GTK_STOCK_REMOVE, _("Remove Item/Set") ); + _styleButton( *btn, "list-remove", _("Remove Item/Set") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &TagsPanel::_takeAction), (int)BUTTON_DELETE) ); _watching.push_back( btn ); _buttonsSecondary.pack_start(*btn, Gtk::PACK_SHRINK); diff --git a/src/ui/dialog/tags.h b/src/ui/dialog/tags.h index d35dfba01..3576bd111 100644 --- a/src/ui/dialog/tags.h +++ b/src/ui/dialog/tags.h @@ -62,7 +62,7 @@ private: TagsPanel(TagsPanel const &); // no copy TagsPanel &operator=(TagsPanel const &); // no assign - void _styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* tooltip ); + void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip ); void _fireAction( unsigned int code ); Gtk::MenuItem& _addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id ); diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index c02520218..99a4acc69 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -71,10 +71,10 @@ XmlTree::XmlTree (void) : xml_text_new_button ( _("New text node")), xml_node_delete_button ( Q_("nodeAsInXMLdialogTooltip|Delete node")), xml_node_duplicate_button ( _("Duplicate node")), - unindent_node_button (Gtk::Stock::UNINDENT), - indent_node_button (Gtk::Stock::INDENT), - raise_node_button (Gtk::Stock::GO_UP), - lower_node_button (Gtk::Stock::GO_DOWN), + unindent_node_button(), + indent_node_button(), + raise_node_button(), + lower_node_button(), attr_toolbar(), xml_attribute_delete_button (_("Delete attribute")), text_container (), @@ -149,21 +149,29 @@ XmlTree::XmlTree (void) : tree_toolbar.add(separator2); + unindent_node_button.set_icon_widget(*Gtk::manage(Glib::wrap( + sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("format-indent-less"))))); unindent_node_button.set_label(_("Unindent node")); unindent_node_button.set_tooltip_text(_("Unindent node")); unindent_node_button.set_sensitive(false); tree_toolbar.add(unindent_node_button); + indent_node_button.set_icon_widget(*Gtk::manage(Glib::wrap( + sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("format-indent-more"))))); indent_node_button.set_label(_("Indent node")); indent_node_button.set_tooltip_text(_("Indent node")); indent_node_button.set_sensitive(false); tree_toolbar.add(indent_node_button); + raise_node_button.set_icon_widget(*Gtk::manage(Glib::wrap( + sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("go-up"))))); raise_node_button.set_label(_("Raise node")); raise_node_button.set_tooltip_text(_("Raise node")); raise_node_button.set_sensitive(false); tree_toolbar.add(raise_node_button); + lower_node_button.set_icon_widget(*Gtk::manage(Glib::wrap( + sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("go-down"))))); lower_node_button.set_label(_("Lower node")); lower_node_button.set_tooltip_text(_("Lower node")); lower_node_button.set_sensitive(false); diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 28a65e0b4..87438ac01 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -1815,7 +1815,7 @@ void ContextMenu::SelectSameStrokeColor(void) void ContextMenu::SelectSameStrokeStyle(void) { - sp_select_same_stroke_style(_desktop); + sp_select_same_fill_stroke_style(_desktop, false, false, true); } void ContextMenu::SelectSameObjectType(void) diff --git a/src/ui/widget/addtoicon.cpp b/src/ui/widget/addtoicon.cpp index 0798d1c98..f15d7abf7 100644 --- a/src/ui/widget/addtoicon.cpp +++ b/src/ui/widget/addtoicon.cpp @@ -23,6 +23,7 @@ #include "widgets/icon.h" #include "widgets/toolbox.h" #include "ui/icon-names.h" +#include "preferences.h" #include "layertypeicon.h" #include "addtoicon.h" @@ -39,6 +40,7 @@ AddToIcon::AddToIcon() : { property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE; phys = sp_icon_get_phys_size((int)Inkscape::ICON_SIZE_BUTTON); + // Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default(); // // if (!icon_theme->has_icon(_pixAddName)) { @@ -50,7 +52,8 @@ AddToIcon::AddToIcon() : // // _property_pixbuf_add = Gtk::Widget:: - property_stock_id() = GTK_STOCK_ADD; + //property_stock_id() = GTK_STOCK_ADD; + set_pixbuf(); } @@ -118,7 +121,7 @@ void AddToIcon::render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window, Gtk::CellRendererState flags ) #endif { - property_stock_id() = property_active().get_value() ? GTK_STOCK_ADD : GTK_STOCK_DELETE; + set_pixbuf(); #if WITH_GTKMM_3_0 Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags ); @@ -137,6 +140,14 @@ bool AddToIcon::activate_vfunc(GdkEvent* /*event*/, return false; } +void AddToIcon::set_pixbuf() +{ + bool active = property_active().get_value(); + + GdkPixbuf *pixbuf = sp_pixbuf_new(Inkscape::ICON_SIZE_BUTTON, active ? INKSCAPE_ICON("list-add") : INKSCAPE_ICON("edit-delete")); + property_pixbuf() = Glib::wrap(pixbuf); +} + } // namespace Widget } // namespace UI @@ -152,5 +163,3 @@ bool AddToIcon::activate_vfunc(GdkEvent* /*event*/, End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : - - diff --git a/src/ui/widget/addtoicon.h b/src/ui/widget/addtoicon.h index 9c134d231..a8d900d1f 100644 --- a/src/ui/widget/addtoicon.h +++ b/src/ui/widget/addtoicon.h @@ -74,7 +74,7 @@ private: Glib::Property<bool> _property_active; // Glib::Property< Glib::RefPtr<Gdk::Pixbuf> > _property_pixbuf_add; - + void set_pixbuf(); }; diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp index a5e16aed2..42e59cbfe 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -30,6 +30,7 @@ #include "helper/action.h" #include "helper/action-context.h" #include "preferences.h" +#include "widgets/icon.h" #include <glibmm/i18n.h> #include <xml/repr.h> @@ -101,6 +102,15 @@ static void sp_gradient_selector_class_init(SPGradientSelectorClass *klass) object_class->dispose = sp_gradient_selector_dispose; } +static void gradsel_style_button(GtkWidget *gtkbtn, char const *iconName) +{ + Gtk::Button *btn = Glib::wrap(GTK_BUTTON(gtkbtn)); + GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + gtk_widget_show(child); + btn->add(*manage(Glib::wrap(child))); + btn->set_relief(Gtk::RELIEF_NONE); +} + static void sp_gradient_selector_init(SPGradientSelector *sel) { sel->safelyInit = true; @@ -179,13 +189,8 @@ static void sp_gradient_selector_init(SPGradientSelector *sel) //sel->nonsolid.push_back(hb); gtk_box_pack_start( GTK_BOX(sel), hb, FALSE, FALSE, 0 ); -#if GTK_CHECK_VERSION(3,10,0) - sel->add = gtk_button_new_from_icon_name(INKSCAPE_ICON("list-add"), GTK_ICON_SIZE_SMALL_TOOLBAR); -#else - sel->add = gtk_button_new (); - GtkWidget *img = gtk_image_new_from_icon_name(INKSCAPE_ICON("list-add"), GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_button_set_image(GTK_BUTTON(sel->add), img); -#endif + sel->add = gtk_button_new(); + gradsel_style_button(sel->add, INKSCAPE_ICON("list-add")); sel->nonsolid.push_back(sel->add); gtk_box_pack_start (GTK_BOX (hb), sel->add, FALSE, FALSE, 0); @@ -196,13 +201,8 @@ static void sp_gradient_selector_init(SPGradientSelector *sel) gtk_widget_set_tooltip_text( sel->add, _("Create a duplicate gradient")); // FIXME: Probably better to either use something from the icon naming spec or ship our own "edit-gradient" icon -#if GTK_CHECK_VERSION(3,10,0) - sel->edit = gtk_button_new_from_icon_name(INKSCAPE_ICON("gtk-edit"), GTK_ICON_SIZE_SMALL_TOOLBAR); -#else - sel->edit = gtk_button_new (); - img = gtk_image_new_from_icon_name(INKSCAPE_ICON("gtk-edit"), GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_button_set_image(GTK_BUTTON(sel->edit), img); -#endif + sel->edit = gtk_button_new(); + gradsel_style_button(sel->edit, INKSCAPE_ICON("gtk-edit")); sel->nonsolid.push_back(sel->edit); gtk_box_pack_start (GTK_BOX (hb), sel->edit, FALSE, FALSE, 0); @@ -211,13 +211,8 @@ static void sp_gradient_selector_init(SPGradientSelector *sel) gtk_button_set_relief(GTK_BUTTON(sel->edit), GTK_RELIEF_NONE); gtk_widget_set_tooltip_text( sel->edit, _("Edit gradient")); -#if GTK_CHECK_VERSION(3,10,0) - sel->del = gtk_button_new_from_icon_name(INKSCAPE_ICON("list-remove"), GTK_ICON_SIZE_SMALL_TOOLBAR); -#else sel->del = gtk_button_new (); - img = gtk_image_new_from_icon_name(INKSCAPE_ICON("list-remove"), GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_button_set_image(GTK_BUTTON(sel->del), img); -#endif + gradsel_style_button(sel->del, INKSCAPE_ICON("list-remove")); sel->swatch_widgets.push_back(sel->del); gtk_box_pack_start (GTK_BOX (hb), sel->del, FALSE, FALSE, 0); @@ -227,8 +222,6 @@ static void sp_gradient_selector_init(SPGradientSelector *sel) gtk_widget_set_tooltip_text( sel->del, _("Delete swatch")); gtk_widget_show_all(hb); - - } static void sp_gradient_selector_dispose(GObject *object) |
