summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 15378e5)
raw | patch | inline | side by side (parent: 15378e5)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 21 Dec 2007 21:56:19 +0000 (21:56 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 21 Dec 2007 21:56:19 +0000 (21:56 +0000) |
src/dialogs/guidelinedialog.cpp | patch | blob | history | |
src/display/guideline.cpp | patch | blob | history | |
src/display/guideline.h | patch | blob | history | |
src/sp-guide.h | patch | blob | history |
index d0cdfdd2ab344de1c652e8a61bccb25b12414893..e3c2fd363ce4ab90c32c761d7a94a0a1ecf4cf4f 100644 (file)
gdouble const raw_dist = _spin_button.get_value();
SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(_unit_selector->gobj()));
gdouble const points = sp_units_get_pixels(raw_dist, unit);
- if (_guide->normal_to_line[Geom::Y] == 1.) {
+ if (_guide->is_horizontal()) {
gdouble const newpos = ( _mode ? points : _guide->point_on_line[Geom::Y] + points );
sp_guide_moveto(*_guide, Geom::Point(0, newpos), true);
} else {
- gdouble const newpos = ( _mode ? points : _guide->point_on_line[Geom::Y] + points );
+ gdouble const newpos = ( _mode ? points : _guide->point_on_line[Geom::X] + points );
sp_guide_moveto(*_guide, Geom::Point(newpos, 0), true);
}
sp_document_done(SP_OBJECT_DOCUMENT(_guide), SP_VERB_NONE,
signal_response().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_response));
// initialize dialog
- if (_guide->normal_to_line[Geom::Y] == 0.) {
+ if (_guide->is_vertical()) {
_oldpos = _guide->point_on_line[Geom::X];
} else {
_oldpos = _guide->point_on_line[Geom::Y];
index 376c1b988d96e4a3924f1e52ce5fa9c9be620574..51b2ec38deeeed821ad9a0243323d77643bb8bf8 100644 (file)
unsigned int const b = NR_RGBA32_B (gl->rgba);
unsigned int const a = NR_RGBA32_A (gl->rgba);
- if (gl->normal_to_line[Geom::Y] == 0.) {
+ if (gl->is_vertical()) {
int position = gl->point_on_line[Geom::X];
if (position < buf->rect.x0 || position >= buf->rect.x1) {
return;
d[2] = NR_COMPOSEN11_1111(b, a, d[2]);
d += step;
}
- } else if (gl->normal_to_line[Geom::X] == 0.) {
+ } else if (gl->is_horizontal()) {
int position = gl->point_on_line[Geom::Y];
if (position < buf->rect.y0 || position >= buf->rect.y1) {
return;
@@ -179,9 +179,9 @@ static void sp_guideline_update(SPCanvasItem *item, NR::Matrix const &affine, un
gl->point_on_line[Geom::X] = affine[4] +0.5;
gl->point_on_line[Geom::Y] = affine[5] -0.5;
- if (gl->normal_to_line[Geom::X] == 0.) {
+ if (gl->is_horizontal()) {
sp_canvas_update_bbox (item, -1000000, gl->point_on_line[Geom::Y], 1000000, gl->point_on_line[Geom::Y] + 1);
- } else if (gl->normal_to_line[Geom::Y] == 0.) {
+ } else if (gl->is_vertical()) {
sp_canvas_update_bbox (item, gl->point_on_line[Geom::X], -1000000, gl->point_on_line[Geom::X]+1, 1000000);
} else {
sp_canvas_update_bbox (item, -1000000, -1000000, 1000000, 1000000);
index 66e2ee50ee4305a972c1f1172e37817a0959a4bb..451aec1da24d5ca4db4a960618b7b3e35784917a 100644 (file)
--- a/src/display/guideline.h
+++ b/src/display/guideline.h
double angle;
unsigned int sensitive : 1;
+
+ inline bool is_horizontal() const { return (normal_to_line[Geom::X] == 0.); };
+ inline bool is_vertical() const { return (normal_to_line[Geom::Y] == 0.); };
};
struct SPGuideLineClass {
diff --git a/src/sp-guide.h b/src/sp-guide.h
index 4364284749eb1f1aab5e11535253673ccb0fb74a..819457cb7a776a95ce393fe6bb3fa55c8213c211 100644 (file)
--- a/src/sp-guide.h
+++ b/src/sp-guide.h
guint32 hicolor;
GSList *views;
std::vector<SPGuideAttachment> attached_items;
+
+ inline bool is_horizontal() const { return (normal_to_line[Geom::X] == 0.); };
+ inline bool is_vertical() const { return (normal_to_line[Geom::Y] == 0.); };
};
struct SPGuideClass {