diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-07-06 01:59:32 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2011-07-06 01:59:32 +0000 |
| commit | e65a02ed32b78534739aba24929ece7c44dd967f (patch) | |
| tree | 13cf022f18f6b5bae46aad4bc339e512f069a514 /src/ui/widget | |
| parent | Pull 2Geom revision 2013 (extra constructors for Rect). (diff) | |
| parent | Text edit dialog: Apply button should grab default only after adding to window (diff) | |
| download | inkscape-e65a02ed32b78534739aba24929ece7c44dd967f.tar.gz inkscape-e65a02ed32b78534739aba24929ece7c44dd967f.zip | |
Merge from trunk
(bzr r10347.1.5)
Diffstat (limited to 'src/ui/widget')
| -rw-r--r-- | src/ui/widget/page-sizer.cpp | 32 | ||||
| -rw-r--r-- | src/ui/widget/page-sizer.h | 1 | ||||
| -rw-r--r-- | src/ui/widget/registered-widget.h | 3 | ||||
| -rw-r--r-- | src/ui/widget/selected-style.cpp | 2 | ||||
| -rw-r--r-- | src/ui/widget/svg-canvas.cpp | 2 |
5 files changed, 22 insertions, 18 deletions
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 626be7625..f7759f103 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -236,7 +236,7 @@ PageSizer::PageSizer(Registry & _wr) _marginLeft( _("L_eft:"), _("Left margin"), "fit-margin-left", _wr), _marginRight( _("Ri_ght:"), _("Right margin"), "fit-margin-right", _wr), _marginBottom( _("Botto_m:"), _("Bottom margin"), "fit-margin-bottom", _wr), - + _lockMarginUpdate(false), _widgetRegistry(&_wr) { //# Set up the Paper Size combo box @@ -465,18 +465,20 @@ PageSizer::setDim (double w, double h, bool changeList) void PageSizer::updateFitMarginsUI(Inkscape::XML::Node *nv_repr) { - double value = 0.0; - if (sp_repr_get_double(nv_repr, "fit-margin-top", &value)) { - _marginTop.setValue(value); - } - if (sp_repr_get_double(nv_repr, "fit-margin-left", &value)) { - _marginLeft.setValue(value); - } - if (sp_repr_get_double(nv_repr, "fit-margin-right", &value)) { - _marginRight.setValue(value); - } - if (sp_repr_get_double(nv_repr, "fit-margin-bottom", &value)) { - _marginBottom.setValue(value); + if (!_lockMarginUpdate) { + double value = 0.0; + if (sp_repr_get_double(nv_repr, "fit-margin-top", &value)) { + _marginTop.setValue(value); + } + if (sp_repr_get_double(nv_repr, "fit-margin-left", &value)) { + _marginLeft.setValue(value); + } + if (sp_repr_get_double(nv_repr, "fit-margin-right", &value)) { + _marginRight.setValue(value); + } + if (sp_repr_get_double(nv_repr, "fit-margin-bottom", &value)) { + _marginBottom.setValue(value); + } } } @@ -538,14 +540,18 @@ PageSizer::fire_fit_canvas_to_selection_or_drawing() SPDocument *doc; SPNamedView *nv; Inkscape::XML::Node *nv_repr; + if ((doc = sp_desktop_document(SP_ACTIVE_DESKTOP)) && (nv = sp_document_namedview(doc, 0)) && (nv_repr = nv->getRepr())) { + _lockMarginUpdate = true; sp_repr_set_svg_double(nv_repr, "fit-margin-top", _marginTop.getValue()); sp_repr_set_svg_double(nv_repr, "fit-margin-left", _marginLeft.getValue()); sp_repr_set_svg_double(nv_repr, "fit-margin-right", _marginRight.getValue()); sp_repr_set_svg_double(nv_repr, "fit-margin-bottom", _marginBottom.getValue()); + _lockMarginUpdate = false; } + Verb *verb = Verb::get( SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING ); if (verb) { SPAction *action = verb->get_action(dt); diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h index 2072aeccd..cb7f8a069 100644 --- a/src/ui/widget/page-sizer.h +++ b/src/ui/widget/page-sizer.h @@ -219,6 +219,7 @@ protected: RegisteredScalar _marginBottom; Gtk::Alignment _fitPageButtonAlign; Gtk::Button _fitPageButton; + bool _lockMarginUpdate; //callback void on_value_changed(); diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index 560c63dd4..f05eb176a 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -62,9 +62,6 @@ public: bool is_updating() {if (_wr) return _wr->isUpdating(); else return false;} - // provide automatic 'upcast' for ease of use. (do it 'dynamic_cast' instead of 'static' because who knows what W is) - operator const Gtk::Widget () { return dynamic_cast<Gtk::Widget*>(this); } - protected: RegisteredWidget() : W() { construct(); } template< typename A > diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index ae8cd564e..0aa65b1a9 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -412,7 +412,7 @@ void SelectedStyle::setDesktop(SPDesktop *desktop) { _desktop = desktop; - gtk_object_set_data (GTK_OBJECT(_opacity_sb.gobj()), "dtw", _desktop->canvas); + g_object_set_data (G_OBJECT(_opacity_sb.gobj()), "dtw", _desktop->canvas); Inkscape::Selection *selection = sp_desktop_selection (desktop); diff --git a/src/ui/widget/svg-canvas.cpp b/src/ui/widget/svg-canvas.cpp index 7d37ec355..f0eb24a10 100644 --- a/src/ui/widget/svg-canvas.cpp +++ b/src/ui/widget/svg-canvas.cpp @@ -22,7 +22,7 @@ namespace Widget { SVGCanvas::SVGCanvas() { - void *canvas = gtk_type_new (sp_canvas_get_type ()); + void *canvas = g_object_new (sp_canvas_get_type (), NULL); _spcanvas = static_cast<SPCanvas*>(canvas); _widget = Glib::wrap (static_cast<GtkWidget*> (canvas)); _dt = 0; |
