summaryrefslogtreecommitdiffstats
path: root/src/dialogs
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2007-03-11 19:57:07 +0000
committermental <mental@users.sourceforge.net>2007-03-11 19:57:07 +0000
commit58b0e69b7336a8a06c447cf786f73df903120e53 (patch)
tree7b4e064fee2a8813127b3c1f3ee3a68425d8990c /src/dialogs
parentAdd ctrl+click to paint bucket to change clicked object's fill and stroke to ... (diff)
downloadinkscape-58b0e69b7336a8a06c447cf786f73df903120e53.tar.gz
inkscape-58b0e69b7336a8a06c447cf786f73df903120e53.zip
Switch selection bounds and center to use NR::Maybe, addressing most of the
recent bbox regressions. (bzr r2604)
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/export.cpp4
-rw-r--r--src/dialogs/object-properties.cpp24
-rw-r--r--src/dialogs/tiledialog.cpp8
3 files changed, 21 insertions, 15 deletions
diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp
index 4dfdbbb5e..c6d7e89d8 100644
--- a/src/dialogs/export.cpp
+++ b/src/dialogs/export.cpp
@@ -1402,10 +1402,10 @@ sp_export_detect_size(GtkObject * base) {
switch (this_test[i]) {
case SELECTION_SELECTION:
if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) {
- NR::Rect bbox = (sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds();
+ NR::Maybe<NR::Rect> bbox = (sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds();
//std::cout << "Selection " << bbox;
- if (sp_export_bbox_equal(bbox,current_bbox)) {
+ if ( bbox && sp_export_bbox_equal(*bbox,current_bbox)) {
key = SELECTION_SELECTION;
}
}
diff --git a/src/dialogs/object-properties.cpp b/src/dialogs/object-properties.cpp
index 53b9aa8cc..4db82385a 100644
--- a/src/dialogs/object-properties.cpp
+++ b/src/dialogs/object-properties.cpp
@@ -342,13 +342,15 @@ sp_fillstroke_selection_changed ( Inkscape::Application *inkscape,
case QUERY_STYLE_SINGLE:
case QUERY_STYLE_MULTIPLE_AVERAGED:
case QUERY_STYLE_MULTIPLE_SAME:
- NR::Rect bbox = sp_desktop_selection(SP_ACTIVE_DESKTOP)->bounds();
- double perimeter = bbox.extent(NR::X) + bbox.extent(NR::Y);
- gtk_widget_set_sensitive (b, TRUE);
- //update blur widget value
- float radius = query->filter_gaussianBlur_deviation.value;
- float percent = radius * 400 / perimeter; // so that for a square, 100% == half side
- gtk_adjustment_set_value(bluradjustment, percent);
+ NR::Maybe<NR::Rect> bbox = sp_desktop_selection(SP_ACTIVE_DESKTOP)->bounds();
+ if (bbox) {
+ double perimeter = bbox->extent(NR::X) + bbox->extent(NR::Y);
+ gtk_widget_set_sensitive (b, TRUE);
+ //update blur widget value
+ float radius = query->filter_gaussianBlur_deviation.value;
+ float percent = radius * 400 / perimeter; // so that for a square, 100% == half side
+ gtk_adjustment_set_value(bluradjustment, percent);
+ }
break;
}
@@ -411,13 +413,17 @@ sp_fillstroke_blur_changed (GtkAdjustment *a, SPWidget *base)
//get current selection
Inkscape::Selection *selection = sp_desktop_selection (desktop);
+
+ NR::Maybe<NR::Rect> bbox = selection->bounds();
+ if (!bbox) {
+ return;
+ }
//get list of selected items
GSList const *items = selection->itemList();
//get current document
SPDocument *document = sp_desktop_document (desktop);
- NR::Rect bbox = selection->bounds();
- double perimeter = bbox.extent(NR::X) + bbox.extent(NR::Y);
+ double perimeter = bbox->extent(NR::X) + bbox->extent(NR::Y);
double radius = a->value * perimeter / 400;
//apply created filter to every selected item
diff --git a/src/dialogs/tiledialog.cpp b/src/dialogs/tiledialog.cpp
index b10f952da..75311ddd0 100644
--- a/src/dialogs/tiledialog.cpp
+++ b/src/dialogs/tiledialog.cpp
@@ -268,14 +268,14 @@ void TileDialog::Grid_Arrange ()
}
+ NR::Maybe<NR::Rect> sel_bbox = selection->bounds();
// Fit to bbox, calculate padding between rows accordingly.
- if (!SpaceManualRadioButton.get_active()){
- NR::Rect b = selection->bounds();
+ if ( sel_bbox && !SpaceManualRadioButton.get_active() ){
#ifdef DEBUG_GRID_ARRANGE
g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_height,total_col_width, b.extent(NR::X), b.extent(NR::Y));
#endif
- paddingx = (b.extent(NR::X) - total_col_width) / (NoOfCols -1);
- paddingy = (b.extent(NR::Y) - total_row_height) / (NoOfRows -1);
+ paddingx = (sel_bbox->extent(NR::X) - total_col_width) / (NoOfCols -1);
+ paddingy = (sel_bbox->extent(NR::Y) - total_row_height) / (NoOfRows -1);
}
/*