Code

tweaking for bbyak
authoracspike <acspike@users.sourceforge.net>
Wed, 19 Apr 2006 13:00:36 +0000 (13:00 +0000)
committeracspike <acspike@users.sourceforge.net>
Wed, 19 Apr 2006 13:00:36 +0000 (13:00 +0000)
src/selection-chemistry.cpp
src/ui/dialog/document-properties.cpp

index c87817a40ee8f32d48ae345ab7d7d796a2acd3bb..19f6c4751d569f211766ce1d066934625c8491c2 100644 (file)
@@ -2554,9 +2554,9 @@ void fit_canvas_to_selection(SPDesktop *desktop) {
     NRRect bbox = {0,0,0,0};
 
     desktop->selection->bounds(&bbox);
-    g_return_if_fail(!empty(bbox));
-
-    doc->fitToRect(bbox);
+    if (!empty(bbox)) {
+        doc->fitToRect(bbox);
+    }
 };
 
 void fit_canvas_to_drawing(SPDocument *doc) {
@@ -2566,9 +2566,9 @@ void fit_canvas_to_drawing(SPDocument *doc) {
     sp_document_ensure_up_to_date (doc);
     sp_item_invoke_bbox(SP_ITEM(doc->root), &bbox, sp_item_i2r_affine(SP_ITEM(doc->root)), TRUE);
 
-    g_return_if_fail(!empty(bbox));
-
-    doc->fitToRect(bbox);
+    if (!empty(bbox)) {
+        doc->fitToRect(bbox);
+    }
 };
 
 void fit_canvas_to_selection_or_drawing(SPDesktop *desktop) {
index 4d7b8abc7aaf3315dff19724e674d55d7a7ed573..9a9deac9f5f7d0fac880757285c774bccdae7465 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "ui/widget/color-picker.h"
 #include "ui/widget/scalar-unit.h"
+#include "ui/widget/button.h"
 
 #include "xml/node-event-vector.h"
 #include "helper/units.h"
@@ -193,7 +194,8 @@ DocumentProperties::build_page()
                     "bordercolor", "borderopacity", _wr);
     _rcb_shad.init (_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false);
     _rum_deflt.init (_("Default _units:"), "inkscape:document-units", _wr);
-    Gtk::Button* fit_canv = manage(new Gtk::Button(_("Fit canvas to current selection")));
+    Inkscape::UI::Widget::Button* fit_canv = manage(new Inkscape::UI::Widget::Button(_("Fit canvas to selection"),
+                    _("Fit the canvas to the current selection or fit to the drawing when there is no selection.")));
     fit_canv->signal_clicked().connect(sigc::ptr_fun(fire_fit_canvas_to_selection_or_drawing));
     Gtk::Label* label_gen = manage (new Gtk::Label);
     label_gen->set_markup (_("<b>General</b>"));