summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-08-04 22:32:05 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-08-04 22:32:05 +0000
commit176622db4325921b8a52e4d4605452ef9ce41e5f (patch)
tree255086561d52361e075bafe4e452755f2e745d00 /src/ui
parentWhile drawing and constraining to specific angles (using CTRL): don't try a f... (diff)
downloadinkscape-176622db4325921b8a52e4d4605452ef9ce41e5f.tar.gz
inkscape-176622db4325921b8a52e4d4605452ef9ce41e5f.zip
NR:: => Geom:: for much of src/ui and src/widgets
(bzr r6561)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/cache/svg_preview_cache.cpp14
-rw-r--r--src/ui/cache/svg_preview_cache.h2
-rw-r--r--src/ui/clipboard.cpp19
-rw-r--r--src/ui/dialog/align-and-distribute.cpp130
-rw-r--r--src/ui/dialog/align-and-distribute.h12
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp6
-rw-r--r--src/ui/dialog/transformation.cpp56
-rw-r--r--src/ui/view/edit-widget-interface.h8
-rw-r--r--src/ui/view/edit-widget.cpp86
-rw-r--r--src/ui/view/edit-widget.h8
-rw-r--r--src/ui/view/view.cpp4
-rw-r--r--src/ui/view/view.h3
-rw-r--r--src/ui/widget/object-composite-settings.cpp4
-rw-r--r--src/ui/widget/rotateable.cpp2
-rw-r--r--src/ui/widget/ruler.cpp14
-rw-r--r--src/ui/widget/ruler.h2
-rw-r--r--src/ui/widget/zoom-status.cpp5
17 files changed, 188 insertions, 187 deletions
diff --git a/src/ui/cache/svg_preview_cache.cpp b/src/ui/cache/svg_preview_cache.cpp
index a930cfc99..aa9d045e4 100644
--- a/src/ui/cache/svg_preview_cache.cpp
+++ b/src/ui/cache/svg_preview_cache.cpp
@@ -32,11 +32,11 @@
#include "ui/cache/svg_preview_cache.h"
-GdkPixbuf* render_pixbuf(NRArenaItem* root, double scale_factor, const NR::Rect& dbox, unsigned psize) {
+GdkPixbuf* render_pixbuf(NRArenaItem* root, double scale_factor, const Geom::Rect& dbox, unsigned psize) {
NRGC gc(NULL);
- NR::Matrix t(NR::scale(scale_factor, scale_factor));
- nr_arena_item_set_transform(root, t);
+ Geom::Matrix t(Geom::Scale(scale_factor, scale_factor));
+ nr_arena_item_set_transform(root, from_2geom(t));
gc.transform.set_identity();
nr_arena_item_invoke_update( root, NULL, &gc,
@@ -45,10 +45,10 @@ GdkPixbuf* render_pixbuf(NRArenaItem* root, double scale_factor, const NR::Rect&
/* Item integer bbox in points */
NRRectL ibox;
- ibox.x0 = (int) floor(scale_factor * dbox.min()[NR::X] + 0.5);
- ibox.y0 = (int) floor(scale_factor * dbox.min()[NR::Y] + 0.5);
- ibox.x1 = (int) floor(scale_factor * dbox.max()[NR::X] + 0.5);
- ibox.y1 = (int) floor(scale_factor * dbox.max()[NR::Y] + 0.5);
+ ibox.x0 = (int) floor(scale_factor * dbox.min()[Geom::X] + 0.5);
+ ibox.y0 = (int) floor(scale_factor * dbox.min()[Geom::Y] + 0.5);
+ ibox.x1 = (int) floor(scale_factor * dbox.max()[Geom::X] + 0.5);
+ ibox.y1 = (int) floor(scale_factor * dbox.max()[Geom::Y] + 0.5);
/* Find visible area */
int width = ibox.x1 - ibox.x0;
diff --git a/src/ui/cache/svg_preview_cache.h b/src/ui/cache/svg_preview_cache.h
index 79ea80239..0b4d52774 100644
--- a/src/ui/cache/svg_preview_cache.h
+++ b/src/ui/cache/svg_preview_cache.h
@@ -11,7 +11,7 @@
*
*/
-GdkPixbuf* render_pixbuf(NRArenaItem* root, double scale_factor, const NR::Rect& dbox, unsigned psize);
+GdkPixbuf* render_pixbuf(NRArenaItem* root, double scale_factor, const Geom::Rect& dbox, unsigned psize);
namespace Inkscape {
namespace UI {
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 1b9968f89..537277afc 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -44,6 +44,9 @@
#include "extension/output.h"
#include "selection-chemistry.h"
#include "libnr/nr-rect.h"
+#include "libnr/nr-convert2geom.h"
+#include <2geom/rect.h>
+#include <2geom/transforms.h>
#include "box3d.h"
#include "gradient-drag.h"
#include "sp-item.h"
@@ -137,7 +140,7 @@ private:
void _createInternalClipboard();
void _discardInternalClipboard();
Inkscape::XML::Node *_createClipNode();
- NR::scale _getScale(Geom::Point &, Geom::Point &, NR::Rect &, bool, bool);
+ NR::scale _getScale(Geom::Point const &, Geom::Point const &, Geom::Rect const &, bool, bool);
Glib::ustring _getBestTarget();
void _setClipboardTargets();
void _setClipboardColor(guint32);
@@ -404,7 +407,7 @@ bool ClipboardManagerImpl::pasteSize(bool separately, bool apply_x, bool apply_y
SPItem *item = SP_ITEM(i->data);
NR::Maybe<NR::Rect> obj_size = sp_item_bbox_desktop(item);
if ( !obj_size || obj_size->isEmpty() ) continue;
- sp_item_scale_rel(item, _getScale(min, max, *obj_size, apply_x, apply_y));
+ sp_item_scale_rel(item, _getScale(min, max, to_2geom(*obj_size), apply_x, apply_y));
}
}
// resize the selection as a whole
@@ -412,7 +415,7 @@ bool ClipboardManagerImpl::pasteSize(bool separately, bool apply_x, bool apply_y
NR::Maybe<NR::Rect> sel_size = selection->bounds();
if ( sel_size && !sel_size->isEmpty() ) {
sp_selection_scale_relative(selection, sel_size->midpoint(),
- _getScale(min, max, *sel_size, apply_x, apply_y));
+ _getScale(min, max, to_2geom(*sel_size), apply_x, apply_y));
}
}
pasted = true;
@@ -765,7 +768,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDocument *clipdoc, bool in_place)
// this formula was discovered empyrically
min[Geom::Y] += ((max[Geom::Y] - min[Geom::Y]) - sp_document_height(target_document));
- sp_selection_move_relative(selection, NR::Point(min));
+ sp_selection_move_relative(selection, Geom::Point(min));
}
}
// copied from former sp_selection_paste in selection-chemistry.cpp
@@ -773,7 +776,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDocument *clipdoc, bool in_place)
sp_document_ensure_up_to_date(target_document);
NR::Maybe<NR::Rect> sel_size = selection->bounds();
- NR::Point m( desktop->point() );
+ Geom::Point m( desktop->point() );
if (sel_size) {
m -= sel_size->midpoint();
}
@@ -1135,17 +1138,17 @@ void ClipboardManagerImpl::_discardInternalClipboard()
/**
* @brief Get the scale to resize an item, based on the command and desktop state
*/
-NR::scale ClipboardManagerImpl::_getScale(Geom::Point &min, Geom::Point &max, NR::Rect &obj_rect, bool apply_x, bool apply_y)
+NR::scale ClipboardManagerImpl::_getScale(Geom::Point const &min, Geom::Point const &max, Geom::Rect const &obj_rect, bool apply_x, bool apply_y)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
double scale_x = 1.0;
double scale_y = 1.0;
if (apply_x) {
- scale_x = (max[Geom::X] - min[Geom::X]) / obj_rect.extent(NR::X);
+ scale_x = (max[Geom::X] - min[Geom::X]) / obj_rect[Geom::X].extent();
}
if (apply_y) {
- scale_y = (max[Geom::Y] - min[Geom::Y]) / obj_rect.extent(NR::Y);
+ scale_y = (max[Geom::Y] - min[Geom::Y]) / obj_rect[Geom::Y].extent();
}
// If the "lock aspect ratio" button is pressed and we paste only a single coordinate,
// resize the second one by the same ratio too
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 8c154d87a..7d4820663 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -127,7 +127,7 @@ private :
selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL);
if (selected.empty()) return;
- NR::Point mp; //Anchor point
+ Geom::Point mp; //Anchor point
AlignAndDistribute::AlignTarget target = _dialog.getAlignTarget();
const Coeffs &a= _allCoeffs[_index];
switch (target)
@@ -155,8 +155,8 @@ private :
//Compute the anchor point
NR::Maybe<NR::Rect> b = sp_item_bbox_desktop (thing);
if (b) {
- mp = NR::Point(a.mx0 * b->min()[NR::X] + a.mx1 * b->max()[NR::X],
- a.my0 * b->min()[NR::Y] + a.my1 * b->max()[NR::Y]);
+ 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]);
} else {
return;
}
@@ -164,7 +164,7 @@ private :
}
case AlignAndDistribute::PAGE:
- mp = NR::Point(a.mx1 * sp_document_width(sp_desktop_document(desktop)),
+ mp = Geom::Point(a.mx1 * sp_document_width(sp_desktop_document(desktop)),
a.my1 * sp_document_height(sp_desktop_document(desktop)));
break;
@@ -173,8 +173,8 @@ private :
NR::Maybe<NR::Rect> b = sp_item_bbox_desktop
( (SPItem *) sp_document_root (sp_desktop_document (desktop)) );
if (b) {
- mp = NR::Point(a.mx0 * b->min()[NR::X] + a.mx1 * b->max()[NR::X],
- a.my0 * b->min()[NR::Y] + a.my1 * b->max()[NR::Y]);
+ 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]);
} else {
return;
}
@@ -185,8 +185,8 @@ private :
{
NR::Maybe<NR::Rect> b = selection->bounds();
if (b) {
- mp = NR::Point(a.mx0 * b->min()[NR::X] + a.mx1 * b->max()[NR::X],
- a.my0 * b->min()[NR::Y] + a.my1 * b->max()[NR::Y]);
+ 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]);
} else {
return;
}
@@ -216,9 +216,9 @@ private :
sp_document_ensure_up_to_date(sp_desktop_document (desktop));
NR::Maybe<NR::Rect> b = sp_item_bbox_desktop (*it);
if (b) {
- NR::Point const sp(a.sx0 * b->min()[NR::X] + a.sx1 * b->max()[NR::X],
- a.sy0 * b->min()[NR::Y] + a.sy1 * b->max()[NR::Y]);
- NR::Point const mp_rel( mp - sp );
+ 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]);
+ Geom::Point const mp_rel( mp - sp );
if (LInfty(mp_rel) > 1e-9) {
sp_item_move_rel(*it, NR::translate(mp_rel));
changed = true;
@@ -255,7 +255,7 @@ ActionAlign::Coeffs const ActionAlign::_allCoeffs[10] = {
{0., 0., 1., 0., 0., 0., 0., 1.}
};
-BBoxSort::BBoxSort(SPItem *pItem, NR::Rect bounds, NR::Dim2 orientation, double kBegin, double kEnd) :
+BBoxSort::BBoxSort(SPItem *pItem, Geom::Rect bounds, Geom::Dim2 orientation, double kBegin, double kEnd) :
item(pItem),
bbox (bounds)
{
@@ -281,7 +281,7 @@ public :
guint row, guint column,
AlignAndDistribute &dialog,
bool onInterSpace,
- NR::Dim2 orientation,
+ Geom::Dim2 orientation,
double kBegin, double kEnd
):
Action(id, tiptext, row, column,
@@ -320,7 +320,7 @@ private :
{
NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it);
if (bbox) {
- sorted.push_back(BBoxSort(*it, *bbox, _orientation, _kBegin, _kEnd));
+ sorted.push_back(BBoxSort(*it, to_2geom(*bbox), _orientation, _kBegin, _kEnd));
}
}
//sort bbox by anchors
@@ -341,7 +341,7 @@ private :
float span = 0;
for (unsigned int i = 0; i < len; i++)
{
- span += sorted[i].bbox.extent(_orientation);
+ span += sorted[i].bbox[_orientation].extent();
}
//new distance between each bbox
float step = (dist - span) / (len - 1);
@@ -351,12 +351,12 @@ private :
it ++ )
{
if (!NR_DF_TEST_CLOSE (pos, it->bbox.min()[_orientation], 1e-6)) {
- NR::Point t(0.0, 0.0);
+ Geom::Point t(0.0, 0.0);
t[_orientation] = pos - it->bbox.min()[_orientation];
sp_item_move_rel(it->item, NR::translate(t));
changed = true;
}
- pos += it->bbox.extent(_orientation);
+ pos += it->bbox[_orientation].extent();
pos += step;
}
}
@@ -375,7 +375,7 @@ private :
//Don't move if we are really close
if (!NR_DF_TEST_CLOSE (pos, it.anchor, 1e-6)) {
//Compute translation
- NR::Point t(0.0, 0.0);
+ Geom::Point t(0.0, 0.0);
t[_orientation] = pos - it.anchor;
//translate
sp_item_move_rel(it.item, NR::translate(t));
@@ -395,7 +395,7 @@ private :
guint _index;
AlignAndDistribute &_dialog;
bool _onInterSpace;
- NR::Dim2 _orientation;
+ Geom::Dim2 _orientation;
double _kBegin;
double _kEnd;
@@ -409,7 +409,7 @@ public :
const Glib::ustring &tiptext,
guint column,
AlignAndDistribute &dialog,
- NR::Dim2 orientation, bool distribute):
+ Geom::Dim2 orientation, bool distribute):
Action(id, tiptext, 0, column,
dialog.nodes_table(), dialog.tooltips(), dialog),
_orientation(orientation),
@@ -417,7 +417,7 @@ public :
{}
private :
- NR::Dim2 _orientation;
+ Geom::Dim2 _orientation;
bool _distribute;
virtual void on_button_click()
{
@@ -427,9 +427,9 @@ private :
if (!SP_IS_NODE_CONTEXT (event_context)) return ;
if (_distribute)
- SP_NODE_CONTEXT (event_context)->shape_editor->distribute(_orientation);
+ SP_NODE_CONTEXT (event_context)->shape_editor->distribute((NR::Dim2)_orientation);
else
- SP_NODE_CONTEXT (event_context)->shape_editor->align(_orientation);
+ SP_NODE_CONTEXT (event_context)->shape_editor->align((NR::Dim2)_orientation);
}
};
@@ -599,7 +599,7 @@ private :
// nor drift on sequential randomizations. Discard cache on global (or better active
// desktop's) selection_change signal.
if (!_dialog.randomize_bbox) {
- _dialog.randomize_bbox = *sel_bbox;
+ _dialog.randomize_bbox = to_2geom(*sel_bbox);
}
// see comment in ActionAlign above
@@ -614,10 +614,10 @@ private :
NR::Maybe<NR::Rect> item_box = sp_item_bbox_desktop (*it);
if (item_box) {
// find new center, staying within bbox
- double x = _dialog.randomize_bbox->min()[NR::X] + item_box->extent(NR::X)/2 +
- g_random_double_range (0, _dialog.randomize_bbox->extent(NR::X) - item_box->extent(NR::X));
- double y = _dialog.randomize_bbox->min()[NR::Y] + item_box->extent(NR::Y)/2 +
- g_random_double_range (0, _dialog.randomize_bbox->extent(NR::Y) - item_box->extent(NR::Y));
+ double x = _dialog.randomize_bbox->min()[Geom::X] + (*item_box).extent(Geom::X)/2 +
+ g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::X].extent() - (*item_box).extent(Geom::X));
+ double y = _dialog.randomize_bbox->min()[Geom::Y] + (*item_box).extent(Geom::Y)/2 +
+ g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::Y].extent() - (*item_box).extent(Geom::Y));
// displacement is the new center minus old:
NR::Point t = NR::Point (x, y) - 0.5*(item_box->max() + item_box->min());
sp_item_move_rel(*it, NR::translate(t));
@@ -635,9 +635,9 @@ private :
struct Baselines
{
SPItem *_item;
- NR::Point _base;
- NR::Dim2 _orientation;
- Baselines(SPItem *item, NR::Point base, NR::Dim2 orientation) :
+ Geom::Point _base;
+ Geom::Dim2 _orientation;
+ Baselines(SPItem *item, Geom::Point base, Geom::Dim2 orientation) :
_item (item),
_base (base),
_orientation (orientation)
@@ -657,7 +657,7 @@ public :
guint column,
AlignAndDistribute &dialog,
Gtk::Table &table,
- NR::Dim2 orientation, bool distribute):
+ Geom::Dim2 orientation, bool distribute):
Action(id, tiptext, row, column,
table, dialog.tooltips(), dialog),
_orientation(orientation),
@@ -665,7 +665,7 @@ public :
{}
private :
- NR::Dim2 _orientation;
+ Geom::Dim2 _orientation;
bool _distribute;
virtual void on_button_click()
{
@@ -683,8 +683,8 @@ private :
//Check 2 or more selected objects
if (selected.size() < 2) return;
- NR::Point b_min = NR::Point (HUGE_VAL, HUGE_VAL);
- NR::Point b_max = NR::Point (-HUGE_VAL, -HUGE_VAL);
+ Geom::Point b_min = Geom::Point (HUGE_VAL, HUGE_VAL);
+ Geom::Point b_max = Geom::Point (-HUGE_VAL, -HUGE_VAL);
std::vector<Baselines> sorted;
@@ -694,11 +694,11 @@ private :
{
if (SP_IS_TEXT (*it) || SP_IS_FLOWTEXT (*it)) {
Inkscape::Text::Layout const *layout = te_get_layout(*it);
- NR::Point base = layout->characterAnchorPoint(layout->begin()) * from_2geom(sp_item_i2d_affine(*it));
- if (base[NR::X] < b_min[NR::X]) b_min[NR::X] = base[NR::X];
- if (base[NR::Y] < b_min[NR::Y]) b_min[NR::Y] = base[NR::Y];
- if (base[NR::X] > b_max[NR::X]) b_max[NR::X] = base[NR::X];
- if (base[NR::Y] > b_max[NR::Y]) b_max[NR::Y] = base[NR::Y];
+ Geom::Point base = layout->characterAnchorPoint(layout->begin()) * from_2geom(sp_item_i2d_affine(*it));
+ if (base[Geom::X] < b_min[Geom::X]) b_min[Geom::X] = base[Geom::X];
+ if (base[Geom::Y] < b_min[Geom::Y]) b_min[Geom::Y] = base[Geom::Y];
+ if (base[Geom::X] > b_max[Geom::X]) b_max[Geom::X] = base[Geom::X];
+ if (base[Geom::Y] > b_max[Geom::Y]) b_max[Geom::Y] = base[Geom::Y];
Baselines b (*it, base, _orientation);
sorted.push_back(b);
@@ -716,8 +716,8 @@ private :
double step = (b_max[_orientation] - b_min[_orientation])/(sorted.size() - 1);
for (unsigned int i = 0; i < sorted.size(); i++) {
SPItem *item = sorted[i]._item;
- NR::Point base = sorted[i]._base;
- NR::Point t(0.0, 0.0);
+ Geom::Point base = sorted[i]._base;
+ Geom::Point t(0.0, 0.0);
t[_orientation] = b_min[_orientation] + step * i - base[_orientation];
sp_item_move_rel(item, NR::translate(t));
changed = true;
@@ -735,8 +735,8 @@ private :
{
if (SP_IS_TEXT (*it) || SP_IS_FLOWTEXT (*it)) {
Inkscape::Text::Layout const *layout = te_get_layout(*it);
- NR::Point base = layout->characterAnchorPoint(layout->begin()) * from_2geom(sp_item_i2d_affine(*it));
- NR::Point t(0.0, 0.0);
+ Geom::Point base = layout->characterAnchorPoint(layout->begin()) * from_2geom(sp_item_i2d_affine(*it));
+ Geom::Point t(0.0, 0.0);
t[_orientation] = b_min[_orientation] - base[_orientation];
sp_item_move_rel(*it, NR::translate(t));
changed = true;
@@ -821,47 +821,47 @@ AlignAndDistribute::AlignAndDistribute()
//Baseline aligns
addBaselineButton("al_baselines_vert",
_("Align baseline anchors of texts vertically"),
- 0, 5, this->align_table(), NR::X, false);
+ 0, 5, this->align_table(), Geom::X, false);
addBaselineButton("al_baselines_hor",
_("Align baseline anchors of texts horizontally"),
- 1, 5, this->align_table(), NR::Y, false);
+ 1, 5, this->align_table(), Geom::Y, false);
//The distribute buttons
addDistributeButton("distribute_hdist",
_("Make horizontal gaps between objects equal"),
- 0, 4, true, NR::X, .5, .5);
+ 0, 4, true, Geom::X, .5, .5);
addDistributeButton("distribute_left",
_("Distribute left sides equidistantly"),
- 0, 1, false, NR::X, 1., 0.);
+ 0, 1, false, Geom::X, 1., 0.);
addDistributeButton("distribute_hcentre",
_("Distribute centers equidistantly horizontally"),
- 0, 2, false, NR::X, .5, .5);
+ 0, 2, false, Geom::X, .5, .5);
addDistributeButton("distribute_right",
_("Distribute right sides equidistantly"),
- 0, 3, false, NR::X, 0., 1.);
+ 0, 3, false, Geom::X, 0., 1.);
addDistributeButton("distribute_vdist",
_("Make vertical gaps between objects equal"),
- 1, 4, true, NR::Y, .5, .5);
+ 1, 4, true, Geom::Y, .5, .5);
addDistributeButton("distribute_top",
_("Distribute tops equidistantly"),
- 1, 1, false, NR::Y, 0, 1);
+ 1, 1, false, Geom::Y, 0, 1);
addDistributeButton("distribute_vcentre",
_("Distribute centers equidistantly vertically"),
- 1, 2, false, NR::Y, .5, .5);
+ 1, 2, false, Geom::Y, .5, .5);
addDistributeButton("distribute_bottom",
_("Distribute bottoms equidistantly"),
- 1, 3, false, NR::Y, 1., 0.);
+ 1, 3, false, Geom::Y, 1., 0.);
//Baseline distribs
addBaselineButton("distribute_baselines_hor",
_("Distribute baseline anchors of texts horizontally"),
- 0, 5, this->distribute_table(), NR::X, true);
+ 0, 5, this->distribute_table(), Geom::X, true);
addBaselineButton("distribute_baselines_vert",
_("Distribute baseline anchors of texts vertically"),
- 1, 5, this->distribute_table(), NR::Y, true);
+ 1, 5, this->distribute_table(), Geom::Y, true);
//Randomize & Unclump
addRandomizeButton("distribute_randomize",
@@ -883,16 +883,16 @@ AlignAndDistribute::AlignAndDistribute()
//Node Mode buttons
addNodeButton("node_halign",
_("Align selected nodes horizontally"),
- 0, NR::X, false);
+ 0, Geom::X, false);
addNodeButton("node_valign",
_("Align selected nodes vertically"),
- 1, NR::Y, false);
+ 1, Geom::Y, false);
addNodeButton("node_hdistribute",
_("Distribute selected nodes horizontally"),
- 2, NR::X, true);
+ 2, Geom::X, true);
addNodeButton("node_vdistribute",
_("Distribute selected nodes vertically"),
- 3, NR::Y, true);
+ 3, Geom::Y, true);
//Rest of the widgetry
@@ -990,7 +990,7 @@ void AlignAndDistribute::addAlignButton(const Glib::ustring &id, const Glib::ust
}
void AlignAndDistribute::addDistributeButton(const Glib::ustring &id, const Glib::ustring tiptext,
guint row, guint col, bool onInterSpace,
- NR::Dim2 orientation, float kBegin, float kEnd)
+ Geom::Dim2 orientation, float kBegin, float kEnd)
{
_actionList.push_back(
new ActionDistribute(
@@ -1002,7 +1002,7 @@ void AlignAndDistribute::addDistributeButton(const Glib::ustring &id, const Glib
}
void AlignAndDistribute::addNodeButton(const Glib::ustring &id, const Glib::ustring tiptext,
- guint col, NR::Dim2 orientation, bool distribute)
+ guint col, Geom::Dim2 orientation, bool distribute)
{
_actionList.push_back(
new ActionNode(
@@ -1047,7 +1047,7 @@ void AlignAndDistribute::addRandomizeButton(const Glib::ustring &id, const Glib:
}
void AlignAndDistribute::addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext,
- guint row, guint col, Gtk::Table &table, NR::Dim2 orientation, bool distribute)
+ guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute)
{
_actionList.push_back(
new ActionBaseline(
@@ -1075,7 +1075,7 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem
for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); it++) {
NR::Maybe<NR::Rect> b = sp_item_bbox_desktop (*it);
if (b) {
- gdouble dim = b->extent(horizontal ? NR::X : NR::Y);
+ gdouble dim = (*b).extent(horizontal ? Geom::X : Geom::Y);
if (dim > max) {
max = dim;
master = it;
@@ -1092,7 +1092,7 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem
for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); it++) {
NR::Maybe<NR::Rect> b = sp_item_bbox_desktop (*it);
if (b) {
- gdouble dim = b->extent(horizontal ? NR::X : NR::Y);
+ gdouble dim = (*b).extent(horizontal ? Geom::X : Geom::Y);
if (dim < max) {
max = dim;
master = it;
diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h
index d6cbd377f..c29fd7c0d 100644
--- a/src/ui/dialog/align-and-distribute.h
+++ b/src/ui/dialog/align-and-distribute.h
@@ -65,18 +65,18 @@ public:
std::list<SPItem *>::iterator find_master(std::list <SPItem *> &list, bool horizontal);
void setMode(bool nodeEdit);
- NR::Maybe<NR::Rect> randomize_bbox;
+ NR::Maybe<Geom::Rect> randomize_bbox;
protected:
void on_ref_change();
void addDistributeButton(const Glib::ustring &id, const Glib::ustring tiptext,
guint row, guint col, bool onInterSpace,
- NR::Dim2 orientation, float kBegin, float kEnd);
+ Geom::Dim2 orientation, float kBegin, float kEnd);
void addAlignButton(const Glib::ustring &id, const Glib::ustring tiptext,
guint row, guint col);
void addNodeButton(const Glib::ustring &id, const Glib::ustring tiptext,
- guint col, NR::Dim2 orientation, bool distribute);
+ guint col, Geom::Dim2 orientation, bool distribute);
void addRemoveOverlapsButton(const Glib::ustring &id,
const Glib::ustring tiptext,
guint row, guint col);
@@ -88,7 +88,7 @@ protected:
void addRandomizeButton(const Glib::ustring &id, const Glib::ustring tiptext,
guint row, guint col);
void addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext,
- guint row, guint col, Gtk::Table &table, NR::Dim2 orientation, bool distribute);
+ guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute);
std::list<Action *> _actionList;
Gtk::Frame _alignFrame, _distributeFrame, _removeOverlapFrame, _graphLayoutFrame, _nodesFrame;
@@ -109,8 +109,8 @@ struct BBoxSort
{
SPItem *item;
float anchor;
- NR::Rect bbox;
- BBoxSort(SPItem *pItem, NR::Rect bounds, NR::Dim2 orientation, double kBegin, double kEnd);
+ Geom::Rect bbox;
+ BBoxSort(SPItem *pItem, Geom::Rect bounds, Geom::Dim2 orientation, double kBegin, double kEnd);
BBoxSort(const BBoxSort &rhs);
};
bool operator< (const BBoxSort &a, const BBoxSort &b);
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index d6624828c..c726b0454 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -861,12 +861,12 @@ bool FileOpenDialogImplWin32::set_svg_preview()
const double scaledSvgWidth = scaleFactor * svgWidth;
const double scaledSvgHeight = scaleFactor * svgHeight;
- NR::Rect area(NR::Point(0, 0), NR::Point(scaledSvgWidth, scaledSvgHeight));
+ Geom::Rect area(Geom::Point(0, 0), Geom::Point(scaledSvgWidth, scaledSvgHeight));
NRRectL areaL = {0, 0, scaledSvgWidth, scaledSvgHeight};
NRRectL bbox = {0, 0, scaledSvgWidth, scaledSvgHeight};
// write object bbox to area
- NR::Maybe<NR::Rect> maybeArea(area);
+ NR::Maybe<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);
@@ -879,7 +879,7 @@ bool FileOpenDialogImplWin32::set_svg_preview()
arena, key, SP_ITEM_SHOW_DISPLAY);
NRGC gc(NULL);
- gc.transform = NR::Matrix(NR::scale(scaleFactor, scaleFactor));
+ gc.transform = from_2geom(Geom::Matrix(Geom::Scale(scaleFactor, scaleFactor)));
nr_arena_item_invoke_update (root, NULL, &gc,
NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE);
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp
index 8dcda8dfb..8c12df558 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -459,8 +459,8 @@ Transformation::updatePageMove(Inkscape::Selection *selection)
if (!_check_move_relative.get_active()) {
NR::Maybe<NR::Rect> bbox = selection->bounds();
if (bbox) {
- double x = bbox->min()[NR::X];
- double y = bbox->min()[NR::Y];
+ double x = bbox->min()[Geom::X];
+ double y = bbox->min()[Geom::Y];
_scalar_move_horizontal.setValue(x, "px");
_scalar_move_vertical.setValue(y, "px");
@@ -480,8 +480,8 @@ Transformation::updatePageScale(Inkscape::Selection *selection)
if (selection && !selection->isEmpty()) {
NR::Maybe<NR::Rect> bbox = selection->bounds();
if (bbox) {
- double w = bbox->extent(NR::X);
- double h = bbox->extent(NR::Y);
+ double w = bbox->extent(Geom::X);
+ double h = bbox->extent(Geom::Y);
_scalar_scale_horizontal.setHundredPercent(w);
_scalar_scale_vertical.setHundredPercent(h);
onScaleXValueChanged(); // to update x/y proportionality if switch is on
@@ -510,8 +510,8 @@ Transformation::updatePageSkew(Inkscape::Selection *selection)
if (selection && !selection->isEmpty()) {
NR::Maybe<NR::Rect> bbox = selection->bounds();
if (bbox) {
- double w = bbox->extent(NR::X);
- double h = bbox->extent(NR::Y);
+ double w = bbox->extent(Geom::X);
+ double h = bbox->extent(Geom::Y);
_scalar_skew_vertical.setHundredPercent(w);
_scalar_skew_horizontal.setHundredPercent(h);
_page_skew.set_sensitive(true);
@@ -528,9 +528,9 @@ Transformation::updatePageTransform(Inkscape::Selection *selection)
{
if (selection && !selection->isEmpty()) {
if (_check_replace_matrix.get_active()) {
- NR::Matrix current (SP_ITEM(selection->itemList()->data)->transform); // take from the first item in selection
+ Geom::Matrix current (to_2geom(SP_ITEM(selection->itemList()->data)->transform)); // take from the first item in selection
- NR::Matrix new_displayed = current;
+ Geom::Matrix new_displayed = current;
_scalar_transform_a.setValue(new_displayed[0]);
_scalar_transform_b.setValue(new_displayed[1]);
@@ -607,7 +607,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
NR::Maybe<NR::Rect> bbox = selection->bounds();
if (bbox) {
sp_selection_move_relative(selection,
- x - bbox->min()[NR::X], y - bbox->min()[NR::Y]);
+ x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
}
}
} else {
@@ -627,7 +627,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
{
NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it);
if (bbox) {
- sorted.push_back(BBoxSort(*it, *bbox, NR::X, x > 0? 1. : 0., x > 0? 0. : 1.));
+ sorted.push_back(BBoxSort(*it, to_2geom(*bbox), Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.));
}
}
//sort bbox by anchors
@@ -651,7 +651,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
{
NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it);
if (bbox) {
- sorted.push_back(BBoxSort(*it, *bbox, NR::Y, y > 0? 1. : 0., y > 0? 0. : 1.));
+ sorted.push_back(BBoxSort(*it, to_2geom(*bbox), Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.));
}
}
//sort bbox by anchors
@@ -671,7 +671,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
NR::Maybe<NR::Rect> bbox = selection->bounds();
if (bbox) {
sp_selection_move_relative(selection,
- x - bbox->min()[NR::X], y - bbox->min()[NR::Y]);
+ x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
}
}
}
@@ -698,7 +698,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
if (fabs(new_width) < 1e-6) new_width = 1e-6; // not 0, as this would result in a nasty no-bbox object
double new_height = scaleY;
if (fabs(new_height) < 1e-6) new_height = 1e-6;
- scale = NR::scale(new_width / bbox->extent(NR::X), new_height / bbox->extent(NR::Y));
+ scale = NR::scale(new_width / bbox->extent(Geom::X), new_height / bbox->extent(Geom::Y));
}
} else {
double new_width = scaleX;
@@ -712,7 +712,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
} else {
NR::Maybe<NR::Rect> bbox(selection->bounds());
if (bbox) {
- NR::Point center(bbox->midpoint()); // use rotation center?
+ Geom::Point center(bbox->midpoint()); // use rotation center?
NR::scale scale (0,0);
// the values are increments!
if (_units_scale.isAbsolute()) {
@@ -720,7 +720,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
if (fabs(new_width) < 1e-6) new_width = 1e-6;
double new_height = scaleY;
if (fabs(new_height) < 1e-6) new_height = 1e-6;
- scale = NR::scale(new_width / bbox->extent(NR::X), new_height / bbox->extent(NR::Y));
+ scale = NR::scale(new_width / bbox->extent(Geom::X), new_height / bbox->extent(Geom::Y));
} else {
double new_width = scaleX;
if (fabs(new_width) < 1e-6) new_width = 1e-6;
@@ -779,8 +779,8 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
double skewY = _scalar_skew_vertical.getValue("px");
NR::Maybe<NR::Rect> bbox(sp_item_bbox_desktop(item));
if (bbox) {
- double width = bbox->extent(NR::X);
- double height = bbox->extent(NR::Y);
+ double width = bbox->extent(Geom::X);
+ double height = bbox->extent(Geom::Y);
sp_item_skew_rel (item, skewX/height, skewY/width);
}
}
@@ -790,8 +790,8 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
NR::Maybe<NR::Point> center = selection->center();
if ( bbox && center ) {
- double width = bbox->extent(NR::X);
- double height = bbox->extent(NR::Y);
+ double width = bbox->extent(Geom::X);
+ double height = bbox->extent(Geom::Y);
if (!_units_skew.isAbsolute()) { // percentage
double skewX = _scalar_skew_horizontal.getValue("%");
@@ -874,12 +874,12 @@ Transformation::onMoveRelativeToggled()
if (bbox) {
if (_check_move_relative.get_active()) {
// From absolute to relative
- _scalar_move_horizontal.setValue(x - bbox->min()[NR::X], "px");
- _scalar_move_vertical.setValue( y - bbox->min()[NR::Y], "px");
+ _scalar_move_horizontal.setValue(x - bbox->min()[Geom::X], "px");
+ _scalar_move_vertical.setValue( y - bbox->min()[Geom::Y], "px");
} else {
// From relative to absolute
- _scalar_move_horizontal.setValue(bbox->min()[NR::X] + x, "px");
- _scalar_move_vertical.setValue( bbox->min()[NR::Y] + y, "px");
+ _scalar_move_horizontal.setValue(bbox->min()[Geom::X] + x, "px");
+ _scalar_move_vertical.setValue( bbox->min()[Geom::Y] + y, "px");
}
}
@@ -972,10 +972,10 @@ Transformation::onReplaceMatrixToggled()
double e = _scalar_transform_e.getValue();
double f = _scalar_transform_f.getValue();
- NR::Matrix displayed (a, b, c, d, e, f);
- NR::Matrix current (SP_ITEM(selection->itemList()->data)->transform); // take from the first item in selection
+ Geom::Matrix displayed (a, b, c, d, e, f);
+ Geom::Matrix current = to_2geom(SP_ITEM(selection->itemList()->data)->transform); // take from the first item in selection
- NR::Matrix new_displayed;
+ Geom::Matrix new_displayed;
if (_check_replace_matrix.get_active()) {
new_displayed = current;
} else {
@@ -1011,8 +1011,8 @@ Transformation::onClear()
} else {
NR::Maybe<NR::Rect> bbox = selection->bounds();
if (bbox) {
- _scalar_move_horizontal.setValue(bbox->min()[NR::X], "px");
- _scalar_move_vertical.setValue(bbox->min()[NR::Y], "px");
+ _scalar_move_horizontal.setValue(bbox->min()[Geom::X], "px");
+ _scalar_move_vertical.setValue(bbox->min()[Geom::Y], "px");
}
}
break;
diff --git a/src/ui/view/edit-widget-interface.h b/src/ui/view/edit-widget-interface.h
index f148bb715..7456f4adf 100644
--- a/src/ui/view/edit-widget-interface.h
+++ b/src/ui/view/edit-widget-interface.h
@@ -50,13 +50,13 @@ struct EditWidgetInterface
virtual void setSize (gint w, gint h) = 0;
/// Move widget to specified position
- virtual void setPosition (NR::Point p) = 0;
+ virtual void setPosition (Geom::Point p) = 0;
/// Transientize widget
virtual void setTransient (void*, int) = 0;
/// Return mouse position in widget
- virtual NR::Point getPointer() = 0;
+ virtual Geom::Point getPointer() = 0;
/// Make widget iconified
virtual void setIconified() = 0;
@@ -96,7 +96,7 @@ struct EditWidgetInterface
virtual void deactivateDesktop() = 0;
/// Set rulers to position
- virtual void viewSetPosition (NR::Point p) = 0;
+ virtual void viewSetPosition (Geom::Point p) = 0;
/// Update rulers from current values
virtual void updateRulers() = 0;
@@ -132,7 +132,7 @@ struct EditWidgetInterface
virtual bool isToolboxButtonActive (gchar const*) = 0;
/// Set the coordinate display
- virtual void setCoordinateStatus (NR::Point p) = 0;
+ virtual void setCoordinateStatus (Geom::Point p) = 0;
/// Message widget will get no content
virtual void setMessage (Inkscape::MessageType type, gchar const* msg) = 0;
diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp
index c32b5f9de..423d8e820 100644
--- a/src/ui/view/edit-widget.cpp
+++ b/src/ui/view/edit-widget.cpp
@@ -1149,9 +1149,9 @@ EditWidget::setSize (gint w, gint h)
}
void
-EditWidget::setPosition (NR::Point p)
+EditWidget::setPosition (Geom::Point p)
{
- move (int(p[NR::X]), int(p[NR::Y]));
+ move (int(p[Geom::X]), int(p[Geom::Y]));
}
/// \param p is already gobj()!
@@ -1163,12 +1163,12 @@ EditWidget::setTransient (void* p, int i)
this->Gtk::Window::present();
}
-NR::Point
+Geom::Point
EditWidget::getPointer()
{
int x, y;
get_pointer (x, y);
- return NR::Point (x, y);
+ return Geom::Point (x, y);
}
void
@@ -1357,34 +1357,34 @@ EditWidget::deactivateDesktop()
}
void
-EditWidget::viewSetPosition (NR::Point p)
+EditWidget::viewSetPosition (Geom::Point p)
{
// p -= _namedview->gridorigin;
/// \todo Why was the origin corrected for the grid origin? (johan)
double lo, up, pos, max;
_top_ruler.get_range (lo, up, pos, max);
- _top_ruler.set_range (lo, up, p[NR::X], max);
+ _top_ruler.set_range (lo, up, p[Geom::X], max);
_left_ruler.get_range (lo, up, pos, max);
- _left_ruler.set_range (lo, up, p[NR::Y], max);
+ _left_ruler.set_range (lo, up, p[Geom::Y], max);
}
void
EditWidget::updateRulers()
{
- //NR::Point gridorigin = _namedview->gridorigin;
+ //Geom::Point gridorigin = _namedview->gridorigin;
/// \todo Why was the origin corrected for the grid origin? (johan)
- NR::Rect const viewbox = _svg_canvas.spobj()->getViewbox();
+ Geom::Rect const viewbox = to_2geom(_svg_canvas.spobj()->getViewbox());
double lo, up, pos, max;
double const scale = _desktop->current_zoom();
- double s = viewbox.min()[NR::X] / scale; //- gridorigin[NR::X];
- double e = viewbox.max()[NR::X] / scale; //- gridorigin[NR::X];
+ double s = viewbox.min()[Geom::X] / scale; //- gridorigin[Geom::X];
+ double e = viewbox.max()[Geom::X] / scale; //- gridorigin[Geom::X];
_top_ruler.get_range(lo, up, pos, max);
_top_ruler.set_range(s, e, pos, e);
- s = viewbox.min()[NR::Y] / -scale; //- gridorigin[NR::Y];
- e = viewbox.max()[NR::Y] / -scale; //- gridorigin[NR::Y];
- _left_ruler.set_range(s, e, 0 /*gridorigin[NR::Y]*/, e);
+ s = viewbox.min()[Geom::Y] / -scale; //- gridorigin[Geom::Y];
+ e = viewbox.max()[Geom::Y] / -scale; //- gridorigin[Geom::Y];
+ _left_ruler.set_range(s, e, 0 /*gridorigin[Geom::Y]*/, e);
/// \todo is that correct?
}
@@ -1400,17 +1400,13 @@ EditWidget::updateScrollbars (double scale)
/* The desktop region we always show unconditionally */
SPDocument *doc = _desktop->doc();
- NR::Rect darea = NR::Rect(NR::Point(-sp_document_width(doc),
- -sp_document_height(doc)),
- NR::Point(2 * sp_document_width(doc),
- 2 * sp_document_height(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))));
/* Canvas region we always show unconditionally */
- NR::Rect carea(NR::Point(darea.min()[NR::X] * scale - 64,
- darea.max()[NR::Y] * -scale - 64),
- NR::Point(darea.max()[NR::X] * scale + 64,
- darea.min()[NR::Y] * -scale + 64));
+ 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) );
NR::Rect const viewbox = _svg_canvas.spobj()->getViewbox();
@@ -1418,20 +1414,20 @@ EditWidget::updateScrollbars (double scale)
carea = NR::union_bounds(carea, viewbox);
Gtk::Adjustment *adj = _bottom_scrollbar.get_adjustment();
- adj->set_value(viewbox.min()[NR::X]);
- adj->set_lower(carea.min()[NR::X]);
- adj->set_upper(carea.max()[NR::X]);
- adj->set_page_increment(viewbox.dimensions()[NR::X]);
- adj->set_step_increment(0.1 * (viewbox.dimensions()[NR::X]));
- adj->set_page_size(viewbox.dimensions()[NR::X]);
+ adj->set_value(viewbox.min()[Geom::X]);
+ adj->set_lower(carea.min()[Geom::X]);
+ adj->set_upper(carea.max()[Geom::X]);
+ adj->set_page_increment(viewbox.dimensions()[Geom::X]);
+ adj->set_step_increment(0.1 * (viewbox.dimensions()[Geom::X]));
+ adj->set_page_size(viewbox.dimensions()[Geom::X]);
adj = _right_scrollbar.get_adjustment();
- adj->set_value(viewbox.min()[NR::Y]);
- adj->set_lower(carea.min()[NR::Y]);
- adj->set_upper(carea.max()[NR::Y]);
- adj->set_page_increment(viewbox.dimensions()[NR::Y]);
- adj->set_step_increment(0.1 * viewbox.dimensions()[NR::Y]);
- adj->set_page_size(viewbox.dimensions()[NR::Y]);
+ adj->set_value(viewbox.min()[Geom::Y]);
+ adj->set_lower(carea.min()[Geom::Y]);
+ adj->set_upper(carea.max()[Geom::Y]);
+ adj->set_page_increment(viewbox.dimensions()[Geom::Y]);
+ adj->set_step_increment(0.1 * viewbox.dimensions()[Geom::Y]);
+ adj->set_page_size(viewbox.dimensions()[Geom::Y]);
_update_s_f = false;
}
@@ -1509,12 +1505,12 @@ EditWidget::isToolboxButtonActive (gchar const*)
}
void
-EditWidget::setCoordinateStatus (NR::Point p)
+EditWidget::setCoordinateStatus (Geom::Point p)
{
- gchar *cstr = g_strdup_printf ("%6.2f", _dt2r * p[NR::X]);
+ gchar *cstr = g_strdup_printf ("%6.2f", _dt2r * p[Geom::X]);
_coord_status_x.property_label() = cstr;
g_free (cstr);
- cstr = g_strdup_printf ("%6.2f", _dt2r * p[NR::Y]);
+ cstr = g_strdup_printf ("%6.2f", _dt2r * p[Geom::Y]);
_coord_status_y.property_label() = cstr;
g_free (cstr);
}
@@ -1646,32 +1642,32 @@ EditWidget::onWindowSizeAllocate (Gtk::Allocation &newall)
return;
}
- NR::Rect const area = _desktop->get_display_area();
+ Geom::Rect const area = to_2geom(_desktop->get_display_area());
double zoom = _desktop->current_zoom();
if (_sticky_zoom.get_active()) {
/* Calculate zoom per pixel */
- double const zpsp = zoom / hypot(area.dimensions()[NR::X], area.dimensions()[NR::Y]);
+ double const zpsp = zoom / hypot(area.dimensions()[Geom::X], area.dimensions()[Geom::Y]);
/* Find new visible area */
- NR::Rect const newarea = _desktop->get_display_area();
+ Geom::Rect const newarea = to_2geom(_desktop->get_display_area());
/* Calculate adjusted zoom */
- zoom = zpsp * hypot(newarea.dimensions()[NR::X], newarea.dimensions()[NR::Y]);
+ zoom = zpsp * hypot(newarea.dimensions()[Geom::X], newarea.dimensions()[Geom::Y]);
}
- _desktop->zoom_absolute(area.midpoint()[NR::X], area.midpoint()[NR::Y], zoom);
+ _desktop->zoom_absolute(area.midpoint()[Geom::X], area.midpoint()[Geom::Y], zoom);
}
void
EditWidget::onWindowRealize()
{
- NR::Rect d(NR::Point(0, 0),
- NR::Point(sp_document_width(_desktop->doc()), sp_document_height(_desktop->doc())));
+ NR::Rect d(Geom::Point(0, 0),
+ Geom::Point(sp_document_width(_desktop->doc()), sp_document_height(_desktop->doc())));
if (d.isEmpty(1.0)) {
return;
}
- _desktop->set_display_area(d.min()[NR::X], d.min()[NR::Y], d.max()[NR::X], d.max()[NR::Y], 10);
+ _desktop->set_display_area(d.min()[Geom::X], d.min()[Geom::Y], d.max()[Geom::X], d.max()[Geom::Y], 10);
_namedview_modified(_desktop->namedview, SP_OBJECT_MODIFIED_FLAG);
setTitle (SP_DOCUMENT_NAME(_desktop->doc()));
}
diff --git a/src/ui/view/edit-widget.h b/src/ui/view/edit-widget.h
index e665b2fae..ea3205696 100644
--- a/src/ui/view/edit-widget.h
+++ b/src/ui/view/edit-widget.h
@@ -104,9 +104,9 @@ public:
virtual void present();
virtual void getGeometry (gint &x, gint &y, gint &w, gint &h);
virtual void setSize (gint w, gint h);
- virtual void setPosition (NR::Point p);
+ virtual void setPosition (Geom::Point p);
virtual void setTransient (void*, int);
- virtual NR::Point getPointer();
+ virtual Geom::Point getPointer();
virtual void setIconified();
virtual void setMaximized();
virtual void setFullscreen();
@@ -118,7 +118,7 @@ public:
virtual void disableInteraction();
virtual void activateDesktop();
virtual void deactivateDesktop();
- virtual void viewSetPosition (NR::Point p);
+ virtual void viewSetPosition (Geom::Point p);
virtual void updateRulers();
virtual void updateScrollbars (double scale);
virtual void toggleRulers();
@@ -130,7 +130,7 @@ public:
virtual void setToolboxAdjustmentValue (const gchar *, double);
virtual void setToolboxSelectOneValue (const gchar *, gint);
virtual bool isToolboxButtonActive (gchar const*);
- virtual void setCoordinateStatus (NR::Point p);
+ virtual void setCoordinateStatus (Geom::Point p);
virtual void setMessage (Inkscape::MessageType type, gchar const* msg);
virtual bool warnDialog (gchar*);
diff --git a/src/ui/view/view.cpp b/src/ui/view/view.cpp
index 6b6e0b8b6..75b6c453b 100644
--- a/src/ui/view/view.cpp
+++ b/src/ui/view/view.cpp
@@ -112,9 +112,9 @@ void View::setPosition (double x, double y)
_position_set_signal.emit (x,y);
}
-void View::setPosition(NR::Point const &p)
+void View::setPosition(Geom::Point const &p)
{
- setPosition (double(p[NR::X]), double(p[NR::Y]));
+ setPosition (double(p[Geom::X]), double(p[Geom::Y]));
}
void View::emitResized (double width, double height)
diff --git a/src/ui/view/view.h b/src/ui/view/view.h
index 63a138f67..882746cea 100644
--- a/src/ui/view/view.h
+++ b/src/ui/view/view.h
@@ -21,6 +21,7 @@
#include "gc-finalized.h"
#include "gc-anchored.h"
#include <libnr/nr-forward.h>
+#include <2geom/forward.h>
/**
* Iterates until true or returns false.
@@ -89,7 +90,7 @@ public:
{ return _tips_message_context; }
void setPosition(gdouble x, gdouble y);
- void setPosition(NR::Point const &p);
+ void setPosition(Geom::Point const &p);
void emitResized(gdouble width, gdouble height);
void requestRedraw();
diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp
index 088af176a..638f1a70c 100644
--- a/src/ui/widget/object-composite-settings.cpp
+++ b/src/ui/widget/object-composite-settings.cpp
@@ -117,7 +117,7 @@ ObjectCompositeSettings::_blendBlurValueChanged()
NR::Maybe<NR::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX);
double radius;
if (bbox) {
- double perimeter = bbox->extent(NR::X) + bbox->extent(NR::Y);
+ double perimeter = bbox->extent(Geom::X) + bbox->extent(Geom::Y);
radius = _fe_cb.get_blur_value() * perimeter / 400;
} else {
radius = 0;
@@ -262,7 +262,7 @@ ObjectCompositeSettings::_subjectChanged() {
case QUERY_STYLE_MULTIPLE_SAME:
NR::Maybe<NR::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX);
if (bbox) {
- double perimeter = bbox->extent(NR::X) + bbox->extent(NR::Y);
+ double perimeter = bbox->extent(Geom::X) + bbox->extent(Geom::Y);
_fe_cb.set_blur_sensitive(true);
//update blur widget value
float radius = query->filter_gaussianBlur_deviation.value;
diff --git a/src/ui/widget/rotateable.cpp b/src/ui/widget/rotateable.cpp
index 8615df7a9..396280aee 100644
--- a/src/ui/widget/rotateable.cpp
+++ b/src/ui/widget/rotateable.cpp
@@ -86,7 +86,7 @@ guint Rotateable::get_single_modifier(guint old, guint state) {
bool Rotateable::on_motion(GdkEventMotion *event) {
if (dragging) {
- double dist = NR::L2(NR::Point(event->x, event->y) - NR::Point(drag_started_x, drag_started_y));
+ double dist = Geom::L2(Geom::Point(event->x, event->y) - Geom::Point(drag_started_x, drag_started_y));
double angle = atan2(event->y - drag_started_y, event->x - drag_started_x);
if (dist > 20) {
working = true;
diff --git a/src/ui/widget/ruler.cpp b/src/ui/widget/ruler.cpp
index c6fb4395f..0afc0da3e 100644
--- a/src/ui/widget/ruler.cpp
+++ b/src/ui/widget/ruler.cpp
@@ -84,13 +84,13 @@ Ruler::canvas_get_pointer(int &x, int &y)
(void) _canvas_widget->get_window()->get_pointer(x, y, mask);
}
-NR::Point
+Geom::Point
Ruler::get_event_dt()
{
int wx, wy;
canvas_get_pointer(wx, wy);
- NR::Point const event_win(wx, wy);
- NR::Point const event_w(sp_canvas_window_to_world(_dt->canvas, event_win));
+ Geom::Point const event_win(wx, wy);
+ Geom::Point const event_w(sp_canvas_window_to_world(_dt->canvas, event_win));
return _dt->w2d(event_w);
}
@@ -98,7 +98,7 @@ bool
Ruler::on_button_press_event(GdkEventButton *evb)
{
g_assert(_dt);
- NR::Point const &event_dt = get_event_dt();
+ Geom::Point const &event_dt = get_event_dt();
Inkscape::XML::Node *repr = SP_OBJECT_REPR(_dt->namedview);
if (evb->button == 1) {
@@ -120,7 +120,7 @@ bool
Ruler::on_motion_notify_event(GdkEventMotion *)
{
g_assert(_dt);
- NR::Point const &event_dt = get_event_dt();
+ Geom::Point const &event_dt = get_event_dt();
if (_dragging) {
sp_guideline_set_position(SP_GUIDELINE(_guide), event_dt);
@@ -136,7 +136,7 @@ Ruler::on_button_release_event(GdkEventButton *evb)
g_assert(_dt);
int wx, wy;
canvas_get_pointer(wx, wy);
- NR::Point const &event_dt = get_event_dt();
+ Geom::Point const &event_dt = get_event_dt();
if (_dragging && evb->button == 1) {
Gdk::Window::pointer_ungrab(evb->time);
@@ -148,7 +148,7 @@ Ruler::on_button_release_event(GdkEventButton *evb)
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(_dt->doc());
Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide");
repr->setAttribute("orientation", _horiz_f ? "horizontal" : "vertical");
- double const guide_pos_dt = event_dt[ _horiz_f ? NR::Y : NR::X ];
+ double const guide_pos_dt = event_dt[ _horiz_f ? Geom::Y : Geom::X ];
sp_repr_set_svg_double(repr, "position", guide_pos_dt);
SP_OBJECT_REPR(_dt->namedview)->appendChild(repr);
Inkscape::GC::release(repr);
diff --git a/src/ui/widget/ruler.h b/src/ui/widget/ruler.h
index 74dbf028c..c315418d8 100644
--- a/src/ui/widget/ruler.h
+++ b/src/ui/widget/ruler.h
@@ -49,7 +49,7 @@ protected:
private:
void canvas_get_pointer (int&, int&);
- NR::Point get_event_dt();
+ Geom::Point get_event_dt();
};
/// Horizontal ruler
diff --git a/src/ui/widget/zoom-status.cpp b/src/ui/widget/zoom-status.cpp
index e7320102c..fbe7c0642 100644
--- a/src/ui/widget/zoom-status.cpp
+++ b/src/ui/widget/zoom-status.cpp
@@ -20,6 +20,7 @@
#include "desktop.h"
#include "desktop-handles.h"
#include "widgets/spw-utilities.h"
+#include "libnr/nr-convert2geom.h"
namespace Inkscape {
namespace UI {
@@ -107,8 +108,8 @@ ZoomStatus::on_value_changed()
_upd_f = true;
g_assert(_dt);
double zoom_factor = pow(2, get_value());
- NR::Rect const d =_dt->get_display_area();
- _dt->zoom_absolute(d.midpoint()[NR::X], d.midpoint()[NR::Y], zoom_factor);
+ Geom::Rect const d = to_2geom(_dt->get_display_area());
+ _dt->zoom_absolute(d.midpoint()[Geom::X], d.midpoint()[Geom::Y], zoom_factor);
gtk_widget_grab_focus(static_cast<GtkWidget*>((void*)_dt->canvas)); /// \todo this no love song
_upd_f = false;
}