diff options
| author | Marc Jeanmougin <mc@localhost.localdomain> | 2015-02-23 22:16:39 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <mc@localhost.localdomain> | 2015-02-23 22:16:39 +0000 |
| commit | edf52983916101c08cd2150c935ed2976832ddf0 (patch) | |
| tree | 552bb1fb32a634b40e1daa8b8e4c452f138752b3 /src | |
| parent | Removed eclipse files, added removed pot file (diff) | |
| parent | on a File->Open, set the viewBox if it did not previously exist, same as was ... (diff) | |
| download | inkscape-edf52983916101c08cd2150c935ed2976832ddf0.tar.gz inkscape-edf52983916101c08cd2150c935ed2976832ddf0.zip | |
Merge, resolved conflicts
(bzr r13922.1.8)
Diffstat (limited to 'src')
| -rw-r--r-- | src/attributes-test.h | 11 | ||||
| -rw-r--r-- | src/desktop-style.cpp | 4 | ||||
| -rw-r--r-- | src/display/snap-indicator.cpp | 2 | ||||
| -rw-r--r-- | src/file.cpp | 6 | ||||
| -rw-r--r-- | src/object-test.h | 1 | ||||
| -rw-r--r-- | src/selection-chemistry.cpp | 112 | ||||
| -rw-r--r-- | src/selection-chemistry.h | 9 | ||||
| -rw-r--r-- | src/sp-item-group.cpp | 46 | ||||
| -rw-r--r-- | src/sp-item-group.h | 11 | ||||
| -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/filedialogimpl-win32.cpp | 2 | ||||
| -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/ui/widget/licensor.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/gradient-selector.cpp | 37 |
26 files changed, 235 insertions, 288 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 0c661ebfb..e1a81f00a 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -1031,7 +1031,7 @@ objects_query_fontnumbers (const std::vector<SPItem*> &objects, SPStyle *style_r 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 (const std::vector<SPItem*> &objects, SPStyle *style_r 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/display/snap-indicator.cpp b/src/display/snap-indicator.cpp index bcce81f0b..8c0c8163f 100644 --- a/src/display/snap-indicator.cpp +++ b/src/display/snap-indicator.cpp @@ -256,7 +256,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap "shape", SP_KNOT_SHAPE_CROSS, NULL ); - const int timeout_val = 1200; // TODO add preference for snap indicator timeout? + const int timeout_val = 4000; SP_CTRL(canvasitem)->moveto(p.getPoint()); _snaptarget = _desktop->add_temporary_canvasitem(canvasitem, timeout_val); diff --git a/src/file.cpp b/src/file.cpp index f9dbe00a7..f33e284b2 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 736e020dd..3c91392cf 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) @@ -1311,6 +1311,25 @@ void sp_selection_paste_size_separately(SPDesktop *desktop, bool apply_x, bool a } } +/** + * Ensures that the clones of objects are not modified when moving objects between layers. + * Calls the same function as ungroup + */ +void sp_selection_change_layer_maintain_clones(std::vector<SPItem*> const &items,SPObject *where) +{ + for (std::vector<SPItem*>::const_iterator i = items.begin(); i != items.end(); i++) { + SPItem *item = dynamic_cast<SPItem *>(SP_OBJECT(*i)); + if (item) { + SPItem *oldparent = dynamic_cast<SPItem *>(item->parent); + SPItem *newparent = dynamic_cast<SPItem *>(where); + sp_item_group_ungroup_handle_clones(item, + (oldparent->i2doc_affine()) + *((newparent->i2doc_affine()).inverse())); + } + } +} + + void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone) { Inkscape::Selection *selection = dt->getSelection(); @@ -1326,6 +1345,7 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone) bool no_more = false; // Set to true, if no more layers above SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer()); if (next) { + sp_selection_change_layer_maintain_clones(items,next); std::vector<SPItem*> temp_clip; sp_selection_copy_impl(items, temp_clip, dt->doc()->getReprDoc()); sp_selection_delete_impl(items, false, false); @@ -1371,6 +1391,7 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone) bool no_more = false; // Set to true, if no more layers below SPObject *next=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer()); if (next) { + sp_selection_change_layer_maintain_clones(items,next); std::vector<SPItem*> temp_clip; sp_selection_copy_impl(items, temp_clip, dt->doc()->getReprDoc()); // we're in the same doc, so no need to copy defs sp_selection_delete_impl(items, false, false); @@ -1412,6 +1433,7 @@ void sp_selection_to_layer(SPDesktop *dt, SPObject *moveto, bool suppressDone) std::vector<SPItem*> items(selection->itemList()); if (moveto) { + sp_selection_change_layer_maintain_clones(items,moveto); std::vector<SPItem*> temp_clip; sp_selection_copy_impl(items, temp_clip, dt->doc()->getReprDoc()); // we're in the same doc, so no need to copy defs sp_selection_delete_impl(items, false, false); @@ -1843,16 +1865,17 @@ void sp_select_same_fill_stroke_style(SPDesktop *desktop, gboolean fill, gboolea for (std::vector<SPItem*>::const_iterator sel_iter=items.begin();sel_iter!=items.end();sel_iter++) { SPItem *sel = dynamic_cast<SPItem *>(static_cast<SPObject *>(*sel_iter)); std::vector<SPItem*> 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); + } + else if (fill) { + matches = sp_get_same_style(sel, matches, SP_FILL_COLOR); } - if (stroke) { - matches = sp_get_same_fill_or_stroke_color(sel, matches, SP_STROKE_COLOR); + else if (stroke) { + matches = sp_get_same_style(sel, matches, SP_STROKE_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 (style) { + matches = sp_get_same_style(sel, matches,SP_STROKE_STYLE_ALL); } all_matches.insert(all_matches.end(), matches.begin(),matches.end()); } @@ -1901,44 +1924,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; - - std::vector<SPItem*> x,y; - std::vector<SPItem*> matches = get_all_items(x, desktop->currentRoot(), desktop, onlyvisible, onlysensitive, ingroups, y); - - Inkscape::Selection *selection = desktop->getSelection(); - std::vector<SPItem*> items=selection->itemList(); - - for (std::vector<SPItem*>::const_iterator sel_iter=items.begin();sel_iter!=items.end();sel_iter++) { - SPItem *sel = dynamic_cast<SPItem *>(static_cast<SPObject *>(*sel_iter)); - 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); -} /* * Find all items in src list that have the same fill or stroke style as sel @@ -2048,26 +2034,31 @@ std::vector<SPItem*> sp_get_same_object_type(SPItem *sel, std::vector<SPItem*> & for (std::vector<SPItem*>::const_reverse_iterator i=src.rbegin();i!=src.rend();i++) { SPItem *item = dynamic_cast<SPItem *>(static_cast<SPObject *>(*i)); - if (item && item_type_match(sel, item)) { + if (item && item_type_match(sel, item) && !item->cloned) { matches.push_back(item); } } 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 */ -std::vector<SPItem*> sp_get_same_stroke_style(SPItem *sel, std::vector<SPItem*> &src, SPSelectStrokeStyleType type) +std::vector<SPItem*> sp_get_same_style(SPItem *sel, std::vector<SPItem*> &src, SPSelectStrokeStyleType type) { std::vector<SPItem*> matches; - 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); } /* @@ -2076,18 +2067,20 @@ std::vector<SPItem*> sp_get_same_stroke_style(SPItem *sel, std::vector<SPItem*> */ std::vector<SPItem*> objects; 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.push_back(sel); sel_style_for_width = new SPStyle(SP_ACTIVE_DOCUMENT); objects_query_strokewidth (objects, sel_style_for_width); } + bool match_g; for (std::vector<SPItem*>::const_iterator i=src.begin();i!=src.end();i++) { SPItem *iter = dynamic_cast<SPItem *>(static_cast<SPObject *>(*i)); 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) { std::vector<SPItem*> objects; @@ -2101,13 +2094,15 @@ std::vector<SPItem*> sp_get_same_stroke_style(SPItem *sel, std::vector<SPItem*> objects.clear(); } } - 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++) { @@ -2119,8 +2114,9 @@ std::vector<SPItem*> sp_get_same_stroke_style(SPItem *sel, std::vector<SPItem*> } } } - - if (match) { + match_g = match_g && match; + if (match_g) { + while (iter->cloned) iter=dynamic_cast<SPItem *>(iter->parent); matches.insert(matches.begin(),iter); } } else { diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h index 2acd62c02..ce0b5d3da 100644 --- a/src/selection-chemistry.h +++ b/src/selection-chemistry.h @@ -137,14 +137,15 @@ 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); -std::vector<SPItem*> sp_get_same_fill_or_stroke_color(SPItem *sel, std::vector<SPItem*> &src, SPSelectStrokeStyleType type); -std::vector<SPItem*> sp_get_same_stroke_style(SPItem *sel, std::vector<SPItem*> &src, SPSelectStrokeStyleType type); + +std::vector<SPItem*> sp_get_same_style(SPItem *sel, std::vector<SPItem*> &src, SPSelectStrokeStyleType type=SP_STYLE_ALL); std::vector<SPItem*> sp_get_same_object_type(SPItem *sel, std::vector<SPItem*> &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 8a40df5ed..d58676235 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -381,6 +381,22 @@ void SPGroup::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape: } } +void sp_item_group_ungroup_handle_clones(SPItem *parent, Geom::Affine const g) +{ + 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) { + Geom::Affine ctrans; + ctrans = g.inverse() * citem->transform; + gchar *affinestr = sp_svg_transform_write(ctrans); + citem->setAttribute("transform", affinestr); + g_free(affinestr); + } + } + } +} void sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_done) @@ -417,8 +433,14 @@ sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_d /* Step 1 - generate lists of children objects */ GSList *items = NULL; GSList *objects = NULL; - for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { + Geom::Affine const g(group->transform); + for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) + if (SPItem *citem = dynamic_cast<SPItem *>(child)) + sp_item_group_ungroup_handle_clones(citem,g); + + + for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { SPItem *citem = dynamic_cast<SPItem *>(child); if (citem) { /* Merging of style */ @@ -454,13 +476,6 @@ sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_d // Merging transform Geom::Affine ctrans; - Geom::Affine const g(group->transform); - SPUse *useitem = dynamic_cast<SPUse *>(citem); - if (useitem && useitem->get_original() && - useitem->get_original()->parent == dynamic_cast<SPObject *>(group)) { - // make sure a clone's effective transform is the same as was under group - ctrans = g.inverse() * citem->transform * g; - } else { // We should not apply the group's transformation to both a linked offset AND to its source if (dynamic_cast<SPOffset *>(citem)) { // Do we have an offset at hand (whether it's dynamic or linked)? SPItem *source = sp_offset_get_source(dynamic_cast<SPOffset *>(citem)); @@ -479,7 +494,6 @@ sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_d } else { ctrans = citem->transform * g; } - } // FIXME: constructing a transform that would fully preserve the appearance of a // textpath if it is ungrouped with its path seems to be impossible in general @@ -689,21 +703,16 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo subItem = dynamic_cast<SPItem *>(item->clip_ref->getObject()->firstChild()); } if (subItem != NULL) { - Geom::Affine tdoc2dt = Geom::Scale(1, -1) * Geom::Translate(p); // re-create doc2dt() - Geom::Affine ti2doc = item->i2doc_affine(); - subItem->set_i2d_affine(ti2doc * sc * ti2doc.inverse() * tdoc2dt); - subItem->doWriteTransform(subItem->getRepr(), subItem->transform, NULL, true); + subItem->doWriteTransform(subItem->getRepr(), subItem->transform*sc, NULL, true); } subItem = NULL; if (item->mask_ref->getObject()) { subItem = dynamic_cast<SPItem *>(item->mask_ref->getObject()->firstChild()); } if (subItem != NULL) { - Geom::Affine tdoc2dt = Geom::Scale(1, -1) * Geom::Translate(p); // re-create doc2dt() - Geom::Affine ti2doc = item->i2doc_affine(); - subItem->set_i2d_affine(ti2doc * sc * ti2doc.inverse() * tdoc2dt); - subItem->doWriteTransform(item->getRepr(), item->transform, NULL, true); + subItem->doWriteTransform(subItem->getRepr(), subItem->transform*sc, NULL, true); } + item->doWriteTransform(item->getRepr(), sc.inverse()*item->transform*sc, NULL, true); group->scaleChildItemsRec(sc, p, false); } } else { @@ -757,8 +766,7 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo Geom::Affine move = final.inverse() * item->transform * final; item->doWriteTransform(item->getRepr(), move, &move, true); } else { - item->set_i2d_affine(item->i2dt_affine() * final); - item->doWriteTransform(item->getRepr(), item->transform, NULL, true); + item->doWriteTransform(item->getRepr(), item->transform*sc, NULL, true); } if (conn_type != NULL) { diff --git a/src/sp-item-group.h b/src/sp-item-group.h index dcabea78c..2258c2133 100644 --- a/src/sp-item-group.h +++ b/src/sp-item-group.h @@ -96,10 +96,21 @@ public: virtual void update_patheffect(bool write); }; + +/** + * finds clones of a child of the group going out of the group; and inverse the group transform on its clones + * Also called when moving objects between different layers + * @param group current group + * @param parent original parent + * @param g transform + */ +void sp_item_group_ungroup_handle_clones(SPItem *parent, Geom::Affine const g); + void sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_done = true); std::vector<SPItem*> sp_item_group_item_list (SPGroup *group); + SPObject *sp_item_group_get_child_by_name (SPGroup *group, SPObject *ref, const char *name); #endif diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 6cc5d7114..4b4b05963 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 7c189b01b..8651258bd 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -163,7 +163,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. @@ -175,7 +175,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 @@ -224,6 +224,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 6c15121c2..52bc24f5f 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -687,10 +687,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 680757373..b348bdcad 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -2408,7 +2408,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, @@ -2427,7 +2427,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 @@ -2561,7 +2562,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; @@ -2589,7 +2592,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/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index ee6a0ef3a..34339dab2 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -1949,7 +1949,7 @@ UINT_PTR CALLBACK FileSaveDialogImplWin32::GetSaveFileName_hookproc( pImpl = reinterpret_cast<FileSaveDialogImplWin32*>(ofn->lCustData); // Create the Title label and edit control - pImpl->_title_label = CreateWindowEx(0, "STATIC", "Title:", + pImpl->_title_label = CreateWindowEx(0, "STATIC", _("Title:"), WS_VISIBLE|WS_CHILD, CW_USEDEFAULT, CW_USEDEFAULT, rCB1.left-rST.left, rST.bottom-rST.top, hParentWnd, NULL, hInstance, NULL); 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 d60780f78..6e09be2ba 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 bd34c7c66..b677711ff 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); } @@ -1014,7 +995,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); @@ -1023,7 +1004,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 43e35df9d..193dff33c 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/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index 7429bb07e..d21e848f2 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -69,7 +69,7 @@ void LicenseItem::on_toggled() SPDocument *doc = SP_ACTIVE_DOCUMENT; rdf_set_license (doc, _lic->details ? _lic : 0); if (doc->priv->sensitive) { - DocumentUndo::done(doc, SP_VERB_NONE, "Document license updated"); + DocumentUndo::done(doc, SP_VERB_NONE, _("Document license updated")); } _wr.setUpdating (false); static_cast<Gtk::Entry*>(_eep->_packable)->set_text (_lic->uri); 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) |
