summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-08-05 22:40:31 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-08-05 22:40:31 +0000
commit900577c7e71534ec32dcb4e0677a509a6e517b12 (patch)
tree8d5b4c6201b0728bff338e89106d1a8c5a0b7fef /src/ui
parentcodedread's patch for bug 254850 (fixes handling of description field in Obje... (diff)
downloadinkscape-900577c7e71534ec32dcb4e0677a509a6e517b12.tar.gz
inkscape-900577c7e71534ec32dcb4e0677a509a6e517b12.zip
NR::Maybe => boost::optional
(bzr r6569)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/clipboard.cpp8
-rw-r--r--src/ui/dialog/align-and-distribute.cpp24
-rw-r--r--src/ui/dialog/align-and-distribute.h2
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp2
-rw-r--r--src/ui/dialog/transformation.cpp30
-rw-r--r--src/ui/widget/object-composite-settings.cpp4
-rw-r--r--src/ui/widget/style-subject.cpp8
-rw-r--r--src/ui/widget/style-subject.h8
8 files changed, 43 insertions, 43 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 537277afc..013882327 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -405,14 +405,14 @@ bool ClipboardManagerImpl::pasteSize(bool separately, bool apply_x, bool apply_y
if (separately) {
for (GSList *i = const_cast<GSList*>(selection->itemList()) ; i ; i = i->next) {
SPItem *item = SP_ITEM(i->data);
- NR::Maybe<NR::Rect> obj_size = sp_item_bbox_desktop(item);
+ boost::optional<NR::Rect> obj_size = sp_item_bbox_desktop(item);
if ( !obj_size || obj_size->isEmpty() ) continue;
sp_item_scale_rel(item, _getScale(min, max, to_2geom(*obj_size), apply_x, apply_y));
}
}
// resize the selection as a whole
else {
- NR::Maybe<NR::Rect> sel_size = selection->bounds();
+ boost::optional<NR::Rect> sel_size = selection->bounds();
if ( sel_size && !sel_size->isEmpty() ) {
sp_selection_scale_relative(selection, sel_size->midpoint(),
_getScale(min, max, to_2geom(*sel_size), apply_x, apply_y));
@@ -569,7 +569,7 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection)
}
}
- NR::Maybe<NR::Rect> size = selection->bounds();
+ boost::optional<NR::Rect> size = selection->bounds();
if (size) {
sp_repr_set_point(_clipnode, "min", size->min());
sp_repr_set_point(_clipnode, "max", size->max());
@@ -774,7 +774,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDocument *clipdoc, bool in_place)
// copied from former sp_selection_paste in selection-chemistry.cpp
else {
sp_document_ensure_up_to_date(target_document);
- NR::Maybe<NR::Rect> sel_size = selection->bounds();
+ boost::optional<NR::Rect> sel_size = selection->bounds();
Geom::Point m( desktop->point() );
if (sel_size) {
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 7d4820663..e83907f49 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -153,7 +153,7 @@ private :
SPItem * thing = *master;
selected.erase(master);
//Compute the anchor point
- NR::Maybe<NR::Rect> b = sp_item_bbox_desktop (thing);
+ boost::optional<NR::Rect> b = sp_item_bbox_desktop (thing);
if (b) {
mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
@@ -170,7 +170,7 @@ private :
case AlignAndDistribute::DRAWING:
{
- NR::Maybe<NR::Rect> b = sp_item_bbox_desktop
+ boost::optional<NR::Rect> b = sp_item_bbox_desktop
( (SPItem *) sp_document_root (sp_desktop_document (desktop)) );
if (b) {
mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
@@ -183,7 +183,7 @@ private :
case AlignAndDistribute::SELECTION:
{
- NR::Maybe<NR::Rect> b = selection->bounds();
+ boost::optional<NR::Rect> b = selection->bounds();
if (b) {
mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
@@ -214,7 +214,7 @@ private :
it++)
{
sp_document_ensure_up_to_date(sp_desktop_document (desktop));
- NR::Maybe<NR::Rect> b = sp_item_bbox_desktop (*it);
+ boost::optional<NR::Rect> b = sp_item_bbox_desktop (*it);
if (b) {
Geom::Point const sp(a.sx0 * b->min()[Geom::X] + a.sx1 * b->max()[Geom::X],
a.sy0 * b->min()[Geom::Y] + a.sy1 * b->max()[Geom::Y]);
@@ -318,7 +318,7 @@ private :
it != selected.end();
++it)
{
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it);
+ boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(*it);
if (bbox) {
sorted.push_back(BBoxSort(*it, to_2geom(*bbox), _orientation, _kBegin, _kEnd));
}
@@ -590,7 +590,7 @@ private :
//Check 2 or more selected objects
if (selected.size() < 2) return;
- NR::Maybe<NR::Rect> sel_bbox = selection->bounds();
+ boost::optional<NR::Rect> sel_bbox = selection->bounds();
if (!sel_bbox) {
return;
}
@@ -611,7 +611,7 @@ private :
++it)
{
sp_document_ensure_up_to_date(sp_desktop_document (desktop));
- NR::Maybe<NR::Rect> item_box = sp_item_bbox_desktop (*it);
+ boost::optional<NR::Rect> item_box = sp_item_bbox_desktop (*it);
if (item_box) {
// find new center, staying within bbox
double x = _dialog.randomize_bbox->min()[Geom::X] + (*item_box).extent(Geom::X)/2 +
@@ -762,7 +762,7 @@ void on_tool_changed(Inkscape::Application */*inkscape*/, SPEventContext */*cont
void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, AlignAndDistribute *daad)
{
- daad->randomize_bbox = NR::Nothing();
+ daad->randomize_bbox = boost::optional<Geom::Rect>();
}
/////////////////////////////////////////////////////////
@@ -772,7 +772,7 @@ void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selecti
AlignAndDistribute::AlignAndDistribute()
: UI::Widget::Panel ("", "dialogs.align", SP_VERB_DIALOG_ALIGN_DISTRIBUTE),
- randomize_bbox(NR::Nothing()),
+ randomize_bbox(),
_alignFrame(_("Align")),
_distributeFrame(_("Distribute")),
_removeOverlapFrame(_("Remove overlaps")),
@@ -935,7 +935,7 @@ AlignAndDistribute::AlignAndDistribute()
// Connect to the global selection change, to invalidate cached randomize_bbox
g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this);
- randomize_bbox = NR::Nothing();
+ randomize_bbox = boost::optional<Geom::Rect>();
show_all_children();
@@ -1073,7 +1073,7 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem
{
gdouble max = -1e18;
for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); it++) {
- NR::Maybe<NR::Rect> b = sp_item_bbox_desktop (*it);
+ boost::optional<NR::Rect> b = sp_item_bbox_desktop (*it);
if (b) {
gdouble dim = (*b).extent(horizontal ? Geom::X : Geom::Y);
if (dim > max) {
@@ -1090,7 +1090,7 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem
{
gdouble max = 1e18;
for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); it++) {
- NR::Maybe<NR::Rect> b = sp_item_bbox_desktop (*it);
+ boost::optional<NR::Rect> b = sp_item_bbox_desktop (*it);
if (b) {
gdouble dim = (*b).extent(horizontal ? Geom::X : Geom::Y);
if (dim < max) {
diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h
index c29fd7c0d..e4fdf9604 100644
--- a/src/ui/dialog/align-and-distribute.h
+++ b/src/ui/dialog/align-and-distribute.h
@@ -65,7 +65,7 @@ public:
std::list<SPItem *>::iterator find_master(std::list <SPItem *> &list, bool horizontal);
void setMode(bool nodeEdit);
- NR::Maybe<Geom::Rect> randomize_bbox;
+ boost::optional<Geom::Rect> randomize_bbox;
protected:
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index c726b0454..a512f9849 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -866,7 +866,7 @@ bool FileOpenDialogImplWin32::set_svg_preview()
NRRectL bbox = {0, 0, scaledSvgWidth, scaledSvgHeight};
// write object bbox to area
- NR::Maybe<NR::Rect> maybeArea(from_2geom(area));
+ boost::optional<NR::Rect> maybeArea(from_2geom(area));
sp_document_ensure_up_to_date (svgDoc);
sp_item_invoke_bbox((SPItem *) svgDoc->root, &maybeArea,
from_2geom(sp_item_i2r_affine((SPItem *)(svgDoc->root))), TRUE);
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp
index 8c12df558..ed89bf6aa 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -457,7 +457,7 @@ Transformation::updatePageMove(Inkscape::Selection *selection)
{
if (selection && !selection->isEmpty()) {
if (!_check_move_relative.get_active()) {
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
double x = bbox->min()[Geom::X];
double y = bbox->min()[Geom::Y];
@@ -478,7 +478,7 @@ void
Transformation::updatePageScale(Inkscape::Selection *selection)
{
if (selection && !selection->isEmpty()) {
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
double w = bbox->extent(Geom::X);
double h = bbox->extent(Geom::Y);
@@ -508,7 +508,7 @@ void
Transformation::updatePageSkew(Inkscape::Selection *selection)
{
if (selection && !selection->isEmpty()) {
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
double w = bbox->extent(Geom::X);
double h = bbox->extent(Geom::Y);
@@ -604,7 +604,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
if (_check_move_relative.get_active()) {
sp_selection_move_relative(selection, x, y);
} else {
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
sp_selection_move_relative(selection,
x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
@@ -625,7 +625,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
it != selected.end();
++it)
{
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it);
+ boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(*it);
if (bbox) {
sorted.push_back(BBoxSort(*it, to_2geom(*bbox), Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.));
}
@@ -649,7 +649,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
it != selected.end();
++it)
{
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it);
+ boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(*it);
if (bbox) {
sorted.push_back(BBoxSort(*it, to_2geom(*bbox), Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.));
}
@@ -668,7 +668,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
}
}
} else {
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
sp_selection_move_relative(selection,
x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
@@ -692,7 +692,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
NR::scale scale (0,0);
// the values are increments!
if (_units_scale.isAbsolute()) {
- NR::Maybe<NR::Rect> bbox(sp_item_bbox_desktop(item));
+ boost::optional<NR::Rect> bbox(sp_item_bbox_desktop(item));
if (bbox) {
double new_width = scaleX;
if (fabs(new_width) < 1e-6) new_width = 1e-6; // not 0, as this would result in a nasty no-bbox object
@@ -710,7 +710,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
sp_item_scale_rel (item, scale);
}
} else {
- NR::Maybe<NR::Rect> bbox(selection->bounds());
+ boost::optional<NR::Rect> bbox(selection->bounds());
if (bbox) {
Geom::Point center(bbox->midpoint()); // use rotation center?
NR::scale scale (0,0);
@@ -747,7 +747,7 @@ Transformation::applyPageRotate(Inkscape::Selection *selection)
sp_item_rotate_rel(item, NR::rotate (angle*M_PI/180.0));
}
} else {
- NR::Maybe<NR::Point> center = selection->center();
+ boost::optional<NR::Point> center = selection->center();
if (center) {
sp_selection_rotate_relative(selection, *center, angle);
}
@@ -777,7 +777,7 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
} else { // absolute displacement
double skewX = _scalar_skew_horizontal.getValue("px");
double skewY = _scalar_skew_vertical.getValue("px");
- NR::Maybe<NR::Rect> bbox(sp_item_bbox_desktop(item));
+ boost::optional<NR::Rect> bbox(sp_item_bbox_desktop(item));
if (bbox) {
double width = bbox->extent(Geom::X);
double height = bbox->extent(Geom::Y);
@@ -786,8 +786,8 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
}
}
} else { // transform whole selection
- NR::Maybe<NR::Rect> bbox = selection->bounds();
- NR::Maybe<NR::Point> center = selection->center();
+ boost::optional<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Point> center = selection->center();
if ( bbox && center ) {
double width = bbox->extent(Geom::X);
@@ -869,7 +869,7 @@ Transformation::onMoveRelativeToggled()
//g_message("onMoveRelativeToggled: %f, %f px\n", x, y);
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
if (_check_move_relative.get_active()) {
@@ -1009,7 +1009,7 @@ Transformation::onClear()
_scalar_move_horizontal.setValue(0);
_scalar_move_vertical.setValue(0);
} else {
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
_scalar_move_horizontal.setValue(bbox->min()[Geom::X], "px");
_scalar_move_vertical.setValue(bbox->min()[Geom::Y], "px");
diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp
index 638f1a70c..d4c1bb705 100644
--- a/src/ui/widget/object-composite-settings.cpp
+++ b/src/ui/widget/object-composite-settings.cpp
@@ -114,7 +114,7 @@ ObjectCompositeSettings::_blendBlurValueChanged()
// FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed; here it results in crash 1580903
sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(desktop), 0);
- NR::Maybe<NR::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX);
+ boost::optional<NR::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX);
double radius;
if (bbox) {
double perimeter = bbox->extent(Geom::X) + bbox->extent(Geom::Y);
@@ -260,7 +260,7 @@ ObjectCompositeSettings::_subjectChanged() {
case QUERY_STYLE_SINGLE:
case QUERY_STYLE_MULTIPLE_AVERAGED:
case QUERY_STYLE_MULTIPLE_SAME:
- NR::Maybe<NR::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX);
+ boost::optional<NR::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX);
if (bbox) {
double perimeter = bbox->extent(Geom::X) + bbox->extent(Geom::Y);
_fe_cb.set_blur_sensitive(true);
diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp
index 46d33abb7..39081b005 100644
--- a/src/ui/widget/style-subject.cpp
+++ b/src/ui/widget/style-subject.cpp
@@ -65,12 +65,12 @@ StyleSubject::iterator StyleSubject::Selection::begin() {
}
}
-NR::Maybe<NR::Rect> StyleSubject::Selection::getBounds(SPItem::BBoxType type) {
+boost::optional<NR::Rect> StyleSubject::Selection::getBounds(SPItem::BBoxType type) {
Inkscape::Selection *selection = _getSelection();
if (selection) {
return selection->bounds(type);
} else {
- return NR::Nothing();
+ return boost::optional<NR::Rect>();
}
}
@@ -143,12 +143,12 @@ StyleSubject::iterator StyleSubject::CurrentLayer::begin() {
return iterator(_getLayerSList());
}
-NR::Maybe<NR::Rect> StyleSubject::CurrentLayer::getBounds(SPItem::BBoxType type) {
+boost::optional<NR::Rect> StyleSubject::CurrentLayer::getBounds(SPItem::BBoxType type) {
SPObject *layer = _getLayer();
if (layer && SP_IS_ITEM(layer)) {
return sp_item_bbox_desktop(SP_ITEM(layer), type);
} else {
- return NR::Nothing();
+ return boost::optional<NR::Rect>();
}
}
diff --git a/src/ui/widget/style-subject.h b/src/ui/widget/style-subject.h
index f9c544976..9204a8163 100644
--- a/src/ui/widget/style-subject.h
+++ b/src/ui/widget/style-subject.h
@@ -10,7 +10,7 @@
#define SEEN_INKSCAPE_UI_WIDGET_STYLE_SUBJECT_H
#include "util/glib-list-iterators.h"
-#include "libnr/nr-maybe.h"
+#include <boost/optional.hpp>
#include "libnr/nr-rect.h"
#include "sp-item.h"
#include <sigc++/sigc++.h>
@@ -43,7 +43,7 @@ public:
virtual iterator begin() = 0;
virtual iterator end() { return iterator(NULL); }
- virtual NR::Maybe<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) = 0;
+ virtual boost::optional<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) = 0;
virtual int queryStyle(SPStyle *query, int property) = 0;
virtual void setCSS(SPCSSAttr *css) = 0;
@@ -66,7 +66,7 @@ public:
~Selection();
virtual iterator begin();
- virtual NR::Maybe<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
+ virtual boost::optional<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
virtual int queryStyle(SPStyle *query, int property);
virtual void setCSS(SPCSSAttr *css);
@@ -87,7 +87,7 @@ public:
~CurrentLayer();
virtual iterator begin();
- virtual NR::Maybe<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
+ virtual boost::optional<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
virtual int queryStyle(SPStyle *query, int property);
virtual void setCSS(SPCSSAttr *css);