summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e17b4ad)
raw | patch | inline | side by side (parent: e17b4ad)
author | Krzysztof Kosiński <tweenk.pl@gmail.com> | |
Sat, 3 Apr 2010 01:56:36 +0000 (03:56 +0200) | ||
committer | Krzysztof Kosiński <tweenk.pl@gmail.com> | |
Sat, 3 Apr 2010 01:56:36 +0000 (03:56 +0200) |
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 52f1725779a2b0a00fd89c704b04bf6a8995920c..c45cf80044c3c238fbd0387c367cdb6742f4a761 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
_active( false ),
_w2d(),
_d2w(),
- _doc2dt( Geom::Scale(1, -1) ),
+ _doc2dt( Geom::identity() ),
grids_visible( false )
{
_d2w.setIdentity();
@@ -272,7 +272,6 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid
/* Connect event for page resize */
- _doc2dt[5] = sp_document_height (document);
sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), _doc2dt);
_modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this));
int clear = FALSE;
if (!NR_DF_TEST_CLOSE (newscale, scale, 1e-4 * scale)) {
// zoom changed - set new zoom factors
- _d2w = Geom::Scale(newscale, -newscale);
- _w2d = Geom::Scale(1/newscale, 1/-newscale);
+ _d2w = Geom::Scale(newscale);
+ _w2d = Geom::Scale(1/newscale);
sp_canvas_item_affine_absolute(SP_CANVAS_ITEM(main), _d2w);
clear = TRUE;
signal_zoom_changed.emit(_d2w.descrim());
@@ -802,10 +801,10 @@ SPDesktop::set_display_area (double x0, double y0, double x1, double y1, double
/* Calculate top left corner (in document pixels) */
x0 = cx - 0.5 * viewbox.dimensions()[Geom::X] / newscale;
- y1 = cy + 0.5 * viewbox.dimensions()[Geom::Y] / newscale;
+ y0 = cy - 0.5 * viewbox.dimensions()[Geom::Y] / newscale;
/* Scroll */
- sp_canvas_scroll_to (canvas, x0 * newscale - border, y1 * -newscale - border, clear);
+ sp_canvas_scroll_to (canvas, x0 * newscale - border, y0 * newscale - border, clear);
/* update perspective lines if we are in the 3D box tool (so that infinite ones are shown correctly) */
sp_box3d_context_update_lines(event_context);
double const scale = _d2w[0];
- return Geom::Rect(Geom::Point(viewbox.min()[Geom::X] / scale, viewbox.max()[Geom::Y] / -scale),
- Geom::Point(viewbox.max()[Geom::X] / scale, viewbox.min()[Geom::Y] / -scale));
+ return viewbox * (1./scale);
}
/**
index b1c135db02a2e5c3e2e63b910c79a9a32872c48e..8eb9e27bfa027779d4a684dbb75da0fb4ca6f248 100644 (file)
--- a/src/helper/png-write.cpp
+++ b/src/helper/png-write.cpp
sp_document_ensure_up_to_date(doc);
- /* Calculate translation by transforming to document coordinates (flipping Y)*/
- Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - sp_document_height(doc));
-
- /* This calculation is only valid when assumed that (x0,y0)= area.corner(0) and (x1,y1) = area.corner(2)
- * 1) a[0] * x0 + a[2] * y1 + a[4] = 0.0
- * 2) a[1] * x0 + a[3] * y1 + a[5] = 0.0
- * 3) a[0] * x1 + a[2] * y1 + a[4] = width
- * 4) a[1] * x0 + a[3] * y0 + a[5] = height
- * 5) a[1] = 0.0;
- * 6) a[2] = 0.0;
- *
- * (1,3) a[0] * x1 - a[0] * x0 = width
- * a[0] = width / (x1 - x0)
- * (2,4) a[3] * y0 - a[3] * y1 = height
- * a[3] = height / (y0 - y1)
- * (1) a[4] = -a[0] * x0
- * (2) a[5] = -a[3] * y1
- */
+ /* Calculate translation */
+ Geom::Point translation = Geom::Point(-area[Geom::X][0], -area[Geom::Y][0]);
+
Geom::Matrix const affine(Geom::Translate(translation)
* Geom::Scale(width / area.width(),
diff --git a/src/select-context.cpp b/src/select-context.cpp
index 028c8634b62435475a926670ec97082a881c66f7..8500e90846866472e3177afac6e7b03b94d0f3c6 100644 (file)
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
@@ -765,12 +765,12 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
if (MOD__ALT) { // alt
- if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*10); // shift
- else sp_selection_move_screen(desktop, 0, mul*1); // no shift
+ if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*-10); // shift
+ else sp_selection_move_screen(desktop, 0, mul*-1); // no shift
}
else { // no alt
- if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*10*nudge); // shift
- else sp_selection_move(desktop, 0, mul*nudge); // no shift
+ if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*-10*nudge); // shift
+ else sp_selection_move(desktop, 0, mul*-nudge); // no shift
}
ret = TRUE;
}
@@ -799,12 +799,12 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
if (MOD__ALT) { // alt
- if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*-10); // shift
- else sp_selection_move_screen(desktop, 0, mul*-1); // no shift
+ if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*10); // shift
+ else sp_selection_move_screen(desktop, 0, mul*1); // no shift
}
else { // no alt
- if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*-10*nudge); // shift
- else sp_selection_move(desktop, 0, mul*-nudge); // no shift
+ if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*10*nudge); // shift
+ else sp_selection_move(desktop, 0, mul*nudge); // no shift
}
ret = TRUE;
}
index 730467ee548bd90479e73f974addfe32c101eb49..7ac2e5471a432f25420ef283040fd95e205560ea 100644 (file)
Geom::Matrix t;
double shift_x = bbox.x0;
- double shift_y = bbox.y1;
+ double shift_y = bbox.y0;
if (res == PX_PER_IN) { // for default 90 dpi, snap it to pixel grid
shift_x = round(shift_x);
- shift_y = -round(-shift_y); // this gets correct rounding despite coordinate inversion, remove the negations when the inversion is gone
+ shift_y = round(shift_y);
}
- t = Geom::Scale(1, -1) * Geom::Translate(shift_x, shift_y) * eek.inverse();
+ t = Geom::Translate(shift_x, shift_y) * eek.inverse();
// Do the export
sp_export_png_file(document, filepath,
index 95b680c5e5fc81fbb5e7675f7cf46e39bba56896..ba18b2a5bd70f0953fdab393eb6299dc0fb3ec2e 100644 (file)
--- a/src/seltrans-handles.cpp
+++ b/src/seltrans-handles.cpp
SPSelTransHandle const handles_scale[] = {
//anchor cursor control action request x y
- {GTK_ANCHOR_SE, GDK_TOP_LEFT_CORNER, 0, sp_sel_trans_scale, sp_sel_trans_scale_request, 0, 1},
- {GTK_ANCHOR_S, GDK_TOP_SIDE, 3, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0.5, 1},
- {GTK_ANCHOR_SW, GDK_TOP_RIGHT_CORNER, 1, sp_sel_trans_scale, sp_sel_trans_scale_request, 1, 1},
+ {GTK_ANCHOR_NE, GDK_TOP_LEFT_CORNER, 1, sp_sel_trans_scale, sp_sel_trans_scale_request, 0, 1},
+ {GTK_ANCHOR_N, GDK_TOP_SIDE, 3, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0.5, 1},
+ {GTK_ANCHOR_NW, GDK_TOP_RIGHT_CORNER, 0, sp_sel_trans_scale, sp_sel_trans_scale_request, 1, 1},
{GTK_ANCHOR_W, GDK_RIGHT_SIDE, 2, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 1, 0.5},
- {GTK_ANCHOR_NW, GDK_BOTTOM_RIGHT_CORNER, 0, sp_sel_trans_scale, sp_sel_trans_scale_request, 1, 0},
- {GTK_ANCHOR_N, GDK_BOTTOM_SIDE, 3, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0.5, 0},
- {GTK_ANCHOR_NE, GDK_BOTTOM_LEFT_CORNER, 1, sp_sel_trans_scale, sp_sel_trans_scale_request, 0, 0},
+ {GTK_ANCHOR_SW, GDK_BOTTOM_RIGHT_CORNER, 1, sp_sel_trans_scale, sp_sel_trans_scale_request, 1, 0},
+ {GTK_ANCHOR_S, GDK_BOTTOM_SIDE, 3, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0.5, 0},
+ {GTK_ANCHOR_SE, GDK_BOTTOM_LEFT_CORNER, 0, sp_sel_trans_scale, sp_sel_trans_scale_request, 0, 0},
{GTK_ANCHOR_E, GDK_LEFT_SIDE, 2, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0, 0.5}
};
SPSelTransHandle const handles_rotate[] = {
- {GTK_ANCHOR_SE, GDK_EXCHANGE, 4, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 0, 1},
- {GTK_ANCHOR_S, GDK_SB_H_DOUBLE_ARROW, 5, sp_sel_trans_skew, sp_sel_trans_skew_request, 0.5, 1},
- {GTK_ANCHOR_SW, GDK_EXCHANGE, 6, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 1, 1},
+ {GTK_ANCHOR_NE, GDK_EXCHANGE, 10, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 0, 1},
+ {GTK_ANCHOR_N, GDK_SB_H_DOUBLE_ARROW, 5, sp_sel_trans_skew, sp_sel_trans_skew_request, 0.5, 1},
+ {GTK_ANCHOR_NW, GDK_EXCHANGE, 8, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 1, 1},
{GTK_ANCHOR_W, GDK_SB_V_DOUBLE_ARROW, 7, sp_sel_trans_skew, sp_sel_trans_skew_request, 1, 0.5},
- {GTK_ANCHOR_NW, GDK_EXCHANGE, 8, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 1, 0},
- {GTK_ANCHOR_N, GDK_SB_H_DOUBLE_ARROW, 9, sp_sel_trans_skew, sp_sel_trans_skew_request, 0.5, 0},
- {GTK_ANCHOR_NE, GDK_EXCHANGE, 10, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 0, 0},
+ {GTK_ANCHOR_SW, GDK_EXCHANGE, 6, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 1, 0},
+ {GTK_ANCHOR_S, GDK_SB_H_DOUBLE_ARROW, 9, sp_sel_trans_skew, sp_sel_trans_skew_request, 0.5, 0},
+ {GTK_ANCHOR_SE, GDK_EXCHANGE, 4, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 0, 0},
{GTK_ANCHOR_E, GDK_SB_V_DOUBLE_ARROW, 11, sp_sel_trans_skew, sp_sel_trans_skew_request, 0, 0.5}
};
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index c4411e47d2ed100f83b3a5290e0d62b51320a2f3..f60a2b27a6de18e9a93feb4fe3ae77551488e63b 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
g_assert(SP_IS_ITEM(item));
Geom::Matrix const ret( sp_item_i2doc_affine(item)
- * Geom::Scale(1, -1)
- * Geom::Translate(0, sp_document_height(SP_OBJECT_DOCUMENT(item))) );
+ );
return ret;
}
if (SP_OBJECT_PARENT(item)) {
dt2p = sp_item_i2d_affine((SPItem *) SP_OBJECT_PARENT(item)).inverse();
} else {
- dt2p = ( Geom::Translate(0, -sp_document_height(SP_OBJECT_DOCUMENT(item)))
- * Geom::Scale(1, -1) );
+ dt2p = ( Geom::identity() );
}
Geom::Matrix const i2p( i2dt * dt2p );
index f880d2ddfe2c9faf604f3add7c9588b7d1257951..dfbf1170a1c317eafb90b580841487729a95c683 100644 (file)
case GDK_Up:
case GDK_KP_Up:
case GDK_KP_8:
- return _keyboardMove(event->key, Geom::Point(0, 1));
+ return _keyboardMove(event->key, Geom::Point(0, -1));
case GDK_Down:
case GDK_KP_Down:
case GDK_KP_2:
- return _keyboardMove(event->key, Geom::Point(0, -1));
+ return _keyboardMove(event->key, Geom::Point(0, 1));
case GDK_Right:
case GDK_KP_Right:
case GDK_KP_6:
index 66f72f379ee985706ba107d7d4492da579804cee..a50be873a94d57cd3bcbe09b1c4ea407529156da 100644 (file)
Geom::Point at = j->pointAt(0.5);
Geom::Point ut = j->unitTangentAt(0.5);
// rotate the point
- ut *= Geom::Rotate(150.0 / 180.0 * M_PI);
+ ut *= Geom::Rotate(210.0 / 180.0 * M_PI);
Geom::Point arrow_end = _desktop->w2d(
_desktop->d2w(at) + Geom::unit_vector(_desktop->d2w(ut)) * 10.0);
index 1af848b964d0a0930d6088df5365ef150dfcc55b..4cbc5ed4d4e91b062d1975d1ebbe3340ae4a2404 100644 (file)
namespace {
Gtk::AnchorType corner_to_anchor(unsigned c) {
switch (c % 4) {
- case 0: return Gtk::ANCHOR_NE;
- case 1: return Gtk::ANCHOR_NW;
- case 2: return Gtk::ANCHOR_SW;
- default: return Gtk::ANCHOR_SE;
+ case 0: return Gtk::ANCHOR_SE;
+ case 1: return Gtk::ANCHOR_SW;
+ case 2: return Gtk::ANCHOR_NW;
+ default: return Gtk::ANCHOR_NE;
}
}
Gtk::AnchorType side_to_anchor(unsigned s) {
switch (s % 4) {
- case 0: return Gtk::ANCHOR_N;
+ case 0: return Gtk::ANCHOR_S;
case 1: return Gtk::ANCHOR_W;
- case 2: return Gtk::ANCHOR_S;
+ case 2: return Gtk::ANCHOR_N;
default: return Gtk::ANCHOR_E;
}
}
static Glib::RefPtr<Gdk::Pixbuf> _corner_to_pixbuf(unsigned c) {
sp_select_context_get_type();
switch (c % 2) {
- case 0: return Glib::wrap(handles[1], true);
- default: return Glib::wrap(handles[0], true);
+ case 0: return Glib::wrap(handles[0], true);
+ default: return Glib::wrap(handles[1], true);
}
}
Geom::Point _sc_center;
static Glib::RefPtr<Gdk::Pixbuf> _corner_to_pixbuf(unsigned c) {
sp_select_context_get_type();
switch (c % 4) {
- case 0: return Glib::wrap(handles[10], true);
- case 1: return Glib::wrap(handles[8], true);
- case 2: return Glib::wrap(handles[6], true);
- default: return Glib::wrap(handles[4], true);
+ case 0: return Glib::wrap(handles[4], true);
+ case 1: return Glib::wrap(handles[6], true);
+ case 2: return Glib::wrap(handles[8], true);
+ default: return Glib::wrap(handles[10], true);
}
}
Geom::Point _rot_center;
index ab440595f24e0e6a06c12e934cb8aa2e3698c4fa..48317aa3e027122c871b09caebb897da90a8526a 100644 (file)
NR::IRect viewbox = dtw->canvas->getViewboxIntegers();
double const scale = dtw->desktop->current_zoom();
- double s = viewbox.min()[Geom::Y] / -scale - dtw->ruler_origin[Geom::Y];
- double e = viewbox.max()[Geom::Y] / -scale - dtw->ruler_origin[Geom::Y];
+ double s = viewbox.min()[Geom::Y] / scale - dtw->ruler_origin[Geom::Y];
+ double e = viewbox.max()[Geom::Y] / scale - dtw->ruler_origin[Geom::Y];
gtk_ruler_set_range(GTK_RULER(dtw->vruler), s, e, GTK_RULER(dtw->vruler)->position, (e - s));
}
Geom::OptRect deskarea = Geom::unify(darea, sp_item_bbox_desktop(item));
/* Canvas region we always show unconditionally */
- Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64),
- Geom::Point(deskarea->max()[Geom::X] * scale + 64, deskarea->min()[Geom::Y] * -scale + 64) );
+ Geom::Rect carea( Geom::Point(deskarea->left() * scale - 64, deskarea->top() * scale - 64),
+ Geom::Point(deskarea->right() * scale + 64, deskarea->bottom() * scale + 64) );
Geom::Rect viewbox = dtw->canvas->getViewbox();