diff options
Diffstat (limited to 'src/widgets')
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 16 | ||||
| -rw-r--r-- | src/widgets/icon.cpp | 10 | ||||
| -rw-r--r-- | src/widgets/select-toolbar.cpp | 20 | ||||
| -rw-r--r-- | src/widgets/toolbox.cpp | 22 |
4 files changed, 39 insertions, 29 deletions
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index f7e2c3f27..e4190b930 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1724,20 +1724,20 @@ sp_desktop_widget_update_scrollbars (SPDesktopWidget *dtw, double scale) /* The desktop region we always show unconditionally */ SPDocument *doc = dtw->desktop->doc(); - NR::Rect darea(Geom::Point(-sp_document_width(doc), -sp_document_height(doc)), - Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc))); - darea = NR::union_bounds(darea, sp_item_bbox_desktop(SP_ITEM(SP_DOCUMENT_ROOT(doc)))); + Geom::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)), + Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) ); + SPObject* root = doc->root; + SPItem* item = SP_ITEM(root); + boost::optional<Geom::Rect> deskarea = Geom::unify(darea, sp_item_bbox_desktop(item)); /* Canvas region we always show unconditionally */ - NR::Rect carea(Geom::Point(darea.min()[Geom::X] * scale - 64, - darea.max()[Geom::Y] * -scale - 64), - Geom::Point(darea.max()[Geom::X] * scale + 64, - darea.min()[Geom::Y] * -scale + 64)); + Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64), + Geom::Point(deskarea->max()[Geom::X] * scale + 64, deskarea->min()[Geom::Y] * -scale + 64) ); Geom::Rect viewbox = dtw->canvas->getViewbox(); /* Viewbox is always included into scrollable region */ - carea = NR::union_bounds(carea, from_2geom(viewbox)); + carea = Geom::unify(carea, viewbox); set_adjustment(dtw->hadj, carea.min()[Geom::X], carea.max()[Geom::X], viewbox.dimensions()[Geom::X], diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 183481cf6..401d76474 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -658,11 +658,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, if (object && SP_IS_ITEM(object)) { /* Find bbox in document */ Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object))); - boost::optional<NR::Rect> nrdbox = SP_ITEM(object)->getBounds(i2doc); - boost::optional<Geom::Rect> dbox; - if (nrdbox) { - dbox = to_2geom(*nrdbox); - } + boost::optional<Geom::Rect> dbox = SP_ITEM(object)->getBounds(i2doc); if ( SP_OBJECT_PARENT(object) == NULL ) { @@ -676,7 +672,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, /* Update to renderable state */ double sf = 1.0; nr_arena_item_set_transform(root, (Geom::Matrix)Geom::Scale(sf, sf)); - gc.transform.set_identity(); + gc.transform.setIdentity(); nr_arena_item_invoke_update( root, NULL, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE ); @@ -708,7 +704,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, sf = (double)psize / (double)block; nr_arena_item_set_transform(root, (Geom::Matrix)Geom::Scale(sf, sf)); - gc.transform.set_identity(); + gc.transform.setIdentity(); nr_arena_item_invoke_update( root, NULL, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE ); diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index e413aa39e..5f43f7925 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -68,7 +68,7 @@ sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel) int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0); SPItem::BBoxType bbox_type = (prefs_bbox ==0)? SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; - boost::optional<NR::Rect> const bbox(sel->bounds(bbox_type)); + boost::optional<Geom::Rect> const bbox(sel->bounds(bbox_type)); if ( bbox && !bbox->isEmpty() ) { UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(G_OBJECT(spw), "tracker")); SPUnit const &unit = *tracker->getActiveUnit(); @@ -76,8 +76,8 @@ sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel) struct { char const *key; double val; } const keyval[] = { { "X", bbox->min()[X] }, { "Y", bbox->min()[Y] }, - { "width", bbox->extent(X) }, - { "height", bbox->extent(Y) } + { "width", bbox->dimensions()[X] }, + { "height", bbox->dimensions()[Y] } }; if (unit.base == SP_UNIT_DIMENSIONLESS) { @@ -158,7 +158,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0); SPItem::BBoxType bbox_type = (prefs_bbox ==0)? SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; - boost::optional<NR::Rect> bbox = selection->bounds(bbox_type); + boost::optional<Geom::Rect> bbox = selection->bounds(bbox_type); if ( !bbox || bbox->isEmpty() ) { g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE)); @@ -182,27 +182,27 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) x0 = sp_units_get_pixels (a_x->value, unit); y0 = sp_units_get_pixels (a_y->value, unit); x1 = x0 + sp_units_get_pixels (a_w->value, unit); - xrel = sp_units_get_pixels (a_w->value, unit) / bbox->extent(Geom::X); + xrel = sp_units_get_pixels (a_w->value, unit) / bbox->dimensions()[Geom::X]; y1 = y0 + sp_units_get_pixels (a_h->value, unit); - yrel = sp_units_get_pixels (a_h->value, unit) / bbox->extent(Geom::Y); + yrel = sp_units_get_pixels (a_h->value, unit) / bbox->dimensions()[Geom::Y]; } else { double const x0_propn = a_x->value * unit.unittobase; x0 = bbox->min()[Geom::X] * x0_propn; double const y0_propn = a_y->value * unit.unittobase; y0 = y0_propn * bbox->min()[Geom::Y]; xrel = a_w->value * unit.unittobase; - x1 = x0 + xrel * bbox->extent(Geom::X); + x1 = x0 + xrel * bbox->dimensions()[Geom::X]; yrel = a_h->value * unit.unittobase; - y1 = y0 + yrel * bbox->extent(Geom::Y); + y1 = y0 + yrel * bbox->dimensions()[Geom::Y]; } // Keep proportions if lock is on GtkToggleAction *lock = GTK_TOGGLE_ACTION( g_object_get_data(G_OBJECT(spw), "lock") ); if ( gtk_toggle_action_get_active(lock) ) { if (adj == a_h) { - x1 = x0 + yrel * bbox->extent(Geom::X); + x1 = x0 + yrel * bbox->dimensions()[Geom::X]; } else if (adj == a_w) { - y1 = y0 + xrel * bbox->extent(Geom::Y); + y1 = y0 + xrel * bbox->dimensions()[Geom::Y]; } } diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 0749d4c66..b70684692 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -3774,6 +3774,14 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction 2, "tweak_colorjitter_mode", -1 ); + gtk_list_store_append( model, &iter ); + gtk_list_store_set( model, &iter, + 0, _("Blur mode"), + 1, _("Blur selected objects more; with Shift, blur less"), + 2, "tweak_blur_mode", + -1 ); + + EgeSelectOneAction* act = ege_select_one_action_new( "TweakModeAction", _("Mode"), (""), NULL, GTK_TREE_MODEL(model) ); g_object_set( act, "short_label", _("Mode:"), NULL ); gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); @@ -5007,7 +5015,7 @@ lpetool_toggle_set_bbox (GtkToggleAction *act, gpointer data) { SPDesktop *desktop = static_cast<SPDesktop *>(data); Inkscape::Selection *selection = desktop->selection; - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { Geom::Point A(bbox->min()); @@ -5230,6 +5238,13 @@ static void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActi //## Eraser ## //######################## +static void sp_erc_width_value_changed( GtkAdjustment *adj, GObject *tbl ) +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setDouble( "tools.eraser", "width", adj->value * 0.01 ); + update_presets_list(tbl); +} + static void sp_erasertb_mode_changed( EgeSelectOneAction *act, GObject *tbl ) { SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); @@ -5266,7 +5281,7 @@ static void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-eraser", 1, 100, 1.0, 0.0, labels, values, G_N_ELEMENTS(labels), - sp_ddc_width_value_changed, 0.01, 0, 100 ); + sp_erc_width_value_changed, 0.01, 0, 100 ); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); @@ -6401,8 +6416,7 @@ static void connector_spacing_changed(GtkAdjustment *adj, GObject* tbl) for ( GSList const *iter = items ; iter != NULL ; iter = iter->next ) { SPItem *item = reinterpret_cast<SPItem *>(iter->data); Geom::Matrix m = Geom::identity(); - NR::Matrix m_NR = from_2geom(m); - avoid_item_move(&m_NR, item); + avoid_item_move(&m, item); } if (items) { |
