Commit d3fce4b2 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Glow: Merged move() and move_erase() where they were identical.

parent 5b5a2598
......@@ -322,20 +322,6 @@ void GlowArc::move(void* pos, double x1, double y1, double x2, double y2,
ctx->set_dirty();
}
void GlowArc::move_noerase(void* pos, double x1, double y1, double x2,
double y2, int ang1, int ang2, int highlight, int hot)
{
ll.x = x1;
ll.y = y1;
ur.x = x2;
ur.y = y2;
angle1 = ang1;
angle2 = ang2;
zoom();
nav_zoom();
ctx->set_dirty();
}
void GlowArc::shift(
void* pos, double delta_x, double delta_y, int highlight, int hot)
{
......
......@@ -189,25 +189,6 @@ public:
void move(void* pos, double x1, double y1, double x2, double y2, int ang1,
int ang2, int highlight, int hot);
//! Move the arc to the specified coordinates without erase.
/*!
\param pos Position. Should be zero.
\param x1 x coordinate of first point.
\param y1 y coordinate of first point.
\param x2 x coordinate of second point.
\param y2 y coordinate of second point.
\param ang1 Start angle in degrees.
\param ang2 Length of arc in degrees.
\param highlight Draw with highlight colors.
\param hot Draw as hot, with larger line width.
Both points are given new coordinates, so the direction and length of the
arc can
be entirely different.
*/
void move_noerase(void* pos, double x1, double y1, double x2, double y2,
int ang1, int ang2, int highlight, int hot);
//! Move the arc.
/*!
\param pos Position. Should be zero.
......
......@@ -113,7 +113,9 @@ public:
virtual void erase(DrawWind *w, GlowTransform* t, int hot, void* node){}
virtual void draw_inverse(void* pos, int hot, void* node){}
virtual void move(double delta_x, double delta_y, int grid){}
virtual void move_noerase(int delta_x, int delta_y, int grid){}
virtual void move_noerase(int delta_x, int delta_y, int grid) {
move(double(delta_x), double(delta_y), grid);
}
virtual void shift(
void* pos, double delta_x, double delta_y, int highlight, int hot){}
virtual void conpoint_select(
......
......@@ -2851,11 +2851,7 @@ void GlowCon::draw_routed(int points, double* x, double* y)
{
for (int i = 0; i < points - 1; i++) {
GlowLine* l = (GlowLine*)line_a[i];
if (i < l_num)
l->move(&cc->zero, x[i], y[i], x[i + 1], y[i + 1], highlight, hot);
else
l->move_noerase(
&cc->zero, x[i], y[i], x[i + 1], y[i + 1], highlight, hot);
l->move(&cc->zero, x[i], y[i], x[i + 1], y[i + 1], highlight, hot);
}
ctx->set_dirty();
......@@ -3103,21 +3099,13 @@ void GlowCon::draw_routed_roundcorner(int points, double* x, double* y)
for (int i = 0; i < points - 1; i++) {
l = (GlowLine*)line_a[i];
if (i < l_num)
l->move(&cc->zero, line_x1[i], line_y1[i], line_x2[i], line_y2[i],
highlight, hot);
else
l->move_noerase(&cc->zero, line_x1[i], line_y1[i], line_x2[i], line_y2[i],
l->move(&cc->zero, line_x1[i], line_y1[i], line_x2[i], line_y2[i],
highlight, hot);
}
for (int i = 0; i < points - 2; i++) {
a = (GlowArc*)arc_a[i];
if (i < a_num)
a->move(&cc->zero, arc_ll_x[i], arc_ll_y[i], arc_ur_x[i], arc_ur_y[i],
a->move(&cc->zero, arc_ll_x[i], arc_ll_y[i], arc_ur_x[i], arc_ur_y[i],
arc_angle1[i], arc_angle2[i], highlight, hot);
else
a->move_noerase(&cc->zero, arc_ll_x[i], arc_ll_y[i], arc_ur_x[i],
arc_ur_y[i], arc_angle1[i], arc_angle2[i], highlight, hot);
}
ctx->set_dirty();
l_num = points - 1;
......
......@@ -111,31 +111,6 @@ void GrowArc::move(double delta_x, double delta_y, int grid)
}
}
void GrowArc::move_noerase(int delta_x, int delta_y, int grid)
{
if (fixposition)
return;
if (grid) {
double x_grid, y_grid;
/* Move to closest grid point */
ctx->find_grid(x_left + double(delta_x) / ctx->mw->zoom_factor_x,
y_low + double(delta_y) / ctx->mw->zoom_factor_y, &x_grid, &y_grid);
trf.move(x_grid - x_left, y_grid - y_low);
get_node_borders();
} else {
double dx = double(delta_x) / ctx->mw->zoom_factor_x;
double dy = double(delta_y) / ctx->mw->zoom_factor_y;
trf.move(dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
}
ctx->set_dirty();
}
int GrowArc::local_event_handler(glow_eEvent event, double x, double y)
{
double ll_x, ur_x, ll_y, ur_y;
......
......@@ -225,14 +225,6 @@ public:
*/
void move(double delta_x, double delta_y, int grid);
//! Move the object without erase.
/*!
\param delta_x Moved distance in x direction.
\param delta_y Moved distance in y direction.
\param grid Position object on grid point.
*/
void move_noerase(int delta_x, int delta_y, int grid);
//! Set object highlight.
/*!
\param on If 1, set highlight. If 0, reset highlight.
......
......@@ -100,30 +100,6 @@ void GrowConPoint::move(double delta_x, double delta_y, int grid)
ctx->set_dirty();
}
void GrowConPoint::move_noerase(int delta_x, int delta_y, int grid)
{
if (grid) {
double x, y, x_grid, y_grid;
/* Move to closest grid point */
x = (x_right + x_left) / 2;
y = (y_high + y_low) / 2;
ctx->find_grid(x + double(delta_x) / ctx->mw->zoom_factor_x,
y + double(delta_y) / ctx->mw->zoom_factor_y, &x_grid, &y_grid);
trf.move(x_grid - x, y_grid - y);
get_node_borders();
} else {
double dx = double(delta_x) / ctx->mw->zoom_factor_x;
double dy = double(delta_y) / ctx->mw->zoom_factor_y;
trf.move(dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
}
ctx->set_dirty();
}
int GrowConPoint::event_handler(glow_eEvent event, int x, int y, double fx, double fy)
{
int sts;
......
......@@ -202,14 +202,6 @@ public:
*/
void move(double delta_x, double delta_y, int grid);
//! Move the object without erase.
/*!
\param delta_x Moved distance in x direction.
\param delta_y Moved distance in y direction.
\param grid Position object on grid point.
*/
void move_noerase(int delta_x, int delta_y, int grid);
//! Set object highlight.
/*!
\param on If 1, set highlight. If 0, reset highlight.
......
......@@ -277,31 +277,6 @@ void GrowImage::move(double delta_x, double delta_y, int grid)
ctx->set_dirty();
}
void GrowImage::move_noerase(int delta_x, int delta_y, int grid)
{
if (fixposition)
return;
if (grid) {
double x_grid, y_grid;
/* Move to closest grid point */
ctx->find_grid(x_left + double(delta_x) / ctx->mw->zoom_factor_x,
y_low + double(delta_y) / ctx->mw->zoom_factor_y, &x_grid, &y_grid);
trf.move(x_grid - x_left, y_grid - y_low);
get_node_borders();
} else {
double dx = double(delta_x) / ctx->mw->zoom_factor_x;
double dy = double(delta_y) / ctx->mw->zoom_factor_y;
trf.move(dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
}
ctx->set_dirty();
}
int GrowImage::local_event_handler(glow_eEvent event, double x, double y)
{
double ll_x, ur_x, ll_y, ur_y;
......
......@@ -212,14 +212,6 @@ public:
*/
void move(double delta_x, double delta_y, int grid);
//! Move the object without erase.
/*!
\param delta_x Moved distance in x direction.
\param delta_y Moved distance in y direction.
\param grid Position object on grid point.
*/
void move_noerase(int delta_x, int delta_y, int grid);
//! Set object highlight.
/*!
\param on If 1, set highlight. If 0, reset highlight.
......
......@@ -102,28 +102,6 @@ void GrowLine::move(double delta_x, double delta_y, int grid)
}
}
void GrowLine::move_noerase(int delta_x, int delta_y, int grid)
{
if (grid) {
double x_grid, y_grid;
/* Move to closest grid point */
ctx->find_grid(x_left + double(delta_x) / ctx->mw->zoom_factor_x,
y_low + double(delta_y) / ctx->mw->zoom_factor_y, &x_grid, &y_grid);
trf.move(x_grid - x_left, y_grid - y_low);
get_node_borders();
} else {
double dx = double(delta_x) / ctx->mw->zoom_factor_x;
double dy = double(delta_y) / ctx->mw->zoom_factor_y;
trf.move(dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
}
ctx->set_dirty();
}
int GrowLine::local_event_handler(glow_eEvent event, double x, double y) {
glow_sPoint tmp2 = trf.reverse(0.05 * line_width, 0.05 * line_width);
glow_sPoint tmp1 = trf.reverse(0, 0);
......
......@@ -211,14 +211,6 @@ public:
*/
void move(double delta_x, double delta_y, int grid);
//! Move the object without erase.
/*!
\param delta_x Moved distance in x direction.
\param delta_y Moved distance in y direction.
\param grid Position object on grid point.
*/
void move_noerase(int delta_x, int delta_y, int grid);
//! Set object highlight.
/*!
\param on If 1, set highlight. If 0, reset highlight.
......
......@@ -437,24 +437,12 @@ void GrowNode::move(double delta_x, double delta_y, int grid)
void GrowNode::move_noerase(int delta_x, int delta_y, int grid)
{
if (grid) {
double x_grid, y_grid;
/* Move to closest grid point */
ctx->find_grid(x_left + double(delta_x) / ctx->mw->zoom_factor_x,
y_low + double(delta_y) / ctx->mw->zoom_factor_y, &x_grid, &y_grid);
trf.move(x_grid - x_left, y_grid - y_low);
get_node_borders();
} else {
double dx = double(delta_x) / ctx->mw->zoom_factor_x;
double dy = double(delta_y) / ctx->mw->zoom_factor_y;
trf.move(dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
}
ctx->set_dirty();
double x1 = obst_x_left, y1 = obst_y_low, x2 = obst_x_right, y2 = obst_y_high;
move(double(delta_x), double(delta_y), grid);
obst_x_left = x1;
obst_y_low = y1;
obst_x_right = x2;
obst_y_high = y2;
}
void GrowNode::set_highlight(int on)
......
......@@ -575,31 +575,6 @@ GrowPolyLine::~GrowPolyLine()
ctx->gdraw->set_cursor(ctx->mw, glow_eDrawCursor_Normal);
}
void GrowPolyLine::move_noerase(int delta_x, int delta_y, int grid)
{
if (fixposition)
return;
if (grid) {
double x_grid, y_grid;
/* Move to closest grid point */
ctx->find_grid(x_left + double(delta_x) / ctx->mw->zoom_factor_x,
y_low + double(delta_y) / ctx->mw->zoom_factor_y, &x_grid, &y_grid);
trf.move(x_grid - x_left, y_grid - y_low);
get_node_borders();
} else {
double dx = double(delta_x) / ctx->mw->zoom_factor_x;
double dy = double(delta_y) / ctx->mw->zoom_factor_y;
trf.move(dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
}
ctx->set_dirty();
}
int GrowPolyLine::local_event_handler(glow_eEvent event, double x, double y)
{
if (ctx->edit_mode == grow_eMode_EditPolyLine && ctx->a_sel[0] == this) {
......
......@@ -223,14 +223,6 @@ public:
*/
void move(double delta_x, double delta_y, int grid);
//! Move the object without erase.
/*!
\param delta_x Moved distance in x direction.
\param delta_y Moved distance in y direction.
\param grid Position object on grid point.
*/
void move_noerase(int delta_x, int delta_y, int grid);
//! Move a single point
/*!
\param delta_x Moved distance in x direction.
......
......@@ -113,31 +113,6 @@ void GrowRect::move(double delta_x, double delta_y, int grid)
ctx->set_dirty();
}
void GrowRect::move_noerase(int delta_x, int delta_y, int grid)
{
if (fixposition)
return;
if (grid) {
double x_grid, y_grid;
/* Move to closest grid point */
ctx->find_grid(x_left + double(delta_x) / ctx->mw->zoom_factor_x,
y_low + double(delta_y) / ctx->mw->zoom_factor_y, &x_grid, &y_grid);
trf.move(x_grid - x_left, y_grid - y_low);
get_node_borders();
} else {
double dx = double(delta_x) / ctx->mw->zoom_factor_x;
double dy = double(delta_y) / ctx->mw->zoom_factor_y;
trf.move(dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
}
ctx->set_dirty();
}
int GrowRect::local_event_handler(glow_eEvent event, double x, double y)
{
double ll_x, ur_x, ll_y, ur_y;
......
......@@ -219,14 +219,6 @@ public:
*/
void move(double delta_x, double delta_y, int grid);
//! Move the object without erase.
/*!
\param delta_x Moved distance in x direction.
\param delta_y Moved distance in y direction.
\param grid Position object on grid point.
*/
void move_noerase(int delta_x, int delta_y, int grid);
//! Set object highlight.
/*!
\param on If 1, set highlight. If 0, reset highlight.
......
......@@ -110,31 +110,6 @@ void GrowRectRounded::move(double delta_x, double delta_y, int grid)
ctx->set_dirty();
}
void GrowRectRounded::move_noerase(int delta_x, int delta_y, int grid)
{
if (fixposition)
return;
if (grid) {
double x_grid, y_grid;
/* Move to closest grid point */
ctx->find_grid(x_left + double(delta_x) / ctx->mw->zoom_factor_x,
y_low + double(delta_y) / ctx->mw->zoom_factor_y, &x_grid, &y_grid);
trf.move(x_grid - x_left, y_grid - y_low);
get_node_borders();
} else {
double dx = double(delta_x) / ctx->mw->zoom_factor_x;
double dy = double(delta_y) / ctx->mw->zoom_factor_y;
trf.move(dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
}
ctx->set_dirty();
}
int GrowRectRounded::local_event_handler(glow_eEvent event, double x, double y)
{
double ll_x, ur_x, ll_y, ur_y;
......
......@@ -216,14 +216,6 @@ public:
*/
void move(double delta_x, double delta_y, int grid);
//! Move the object without erase.
/*!
\param delta_x Moved distance in x direction.
\param delta_y Moved distance in y direction.
\param grid Position object on grid point.
*/
void move_noerase(int delta_x, int delta_y, int grid);
//! Set object highlight.
/*!
\param on If 1, set highlight. If 0, reset highlight.
......
......@@ -106,31 +106,6 @@ void GrowSubAnnot::move(double delta_x, double delta_y, int grid)
ctx->set_dirty();
}
void GrowSubAnnot::move_noerase(int delta_x, int delta_y, int grid)
{
if (grid) {
double x_grid, y_grid;
/* Move to closest grid point */
ctx->find_grid(x_left + double(delta_x) / ctx->mw->zoom_factor_x,
y_low + double(delta_y) / ctx->mw->zoom_factor_y, &x_grid, &y_grid);
trf.move(x_grid - x_left, y_grid - y_low);
get_node_borders();
} else {
double dx = double(delta_x) / ctx->mw->zoom_factor_x;
double dy = double(delta_y) / ctx->mw->zoom_factor_y;
trf.move(dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
}
glow_sPoint p = trf * this->p;
rect.move((void*)&pzero, p.x, p.y - ctx->draw_delta, highlight, hot);
text.move((void*)&pzero, p.x, p.y, highlight, hot);
ctx->set_dirty();
}
int GrowSubAnnot::event_handler(glow_eEvent event, int x, int y, double fx, double fy)
{
int sts;
......
......@@ -75,7 +75,6 @@ public:
rect.erase(w, (void*)&pzero, hot, NULL);
}
void move(double delta_x, double delta_y, int grid);
void move_noerase(int delta_x, int delta_y, int grid);
void set_highlight(int on);
int get_highlight()
{
......
......@@ -109,28 +109,6 @@ void GrowText::move(double delta_x, double delta_y, int grid)
ctx->set_dirty();
}
void GrowText::move_noerase(int delta_x, int delta_y, int grid)
{
if (grid) {
double x_grid, y_grid;
/* Move to closest grid point */
ctx->find_grid(x_left + double(delta_x) / ctx->mw->zoom_factor_x,
y_low + double(delta_y) / ctx->mw->zoom_factor_y, &x_grid, &y_grid);
trf.move(x_grid - x_left, y_grid - y_low);
get_node_borders();
} else {
double dx = double(delta_x) / ctx->mw->zoom_factor_x;
double dy = double(delta_y) / ctx->mw->zoom_factor_y;
trf.move(dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
}
ctx->set_dirty();
}
int GrowText::local_event_handler(glow_eEvent event, double x, double y)
{
return (x_left <= x && x <= x_right && y_low <= y && y <= y_high);
......
......@@ -219,14 +219,6 @@ public:
*/
void move(double delta_x, double delta_y, int grid);
//! Move the object without erase.
/*!
\param delta_x Moved distance in x direction.
\param delta_y Moved distance in y direction.
\param grid Position object on grid point.
*/
void move_noerase(int delta_x, int delta_y, int grid);
//! Set object highlight.
/*!
\param on If 1, set highlight. If 0, reset highlight.
......
......@@ -304,18 +304,6 @@ void GlowLine::move(void* pos, double x1, double y1, double x2, double y2,
ctx->set_dirty();
}
void GlowLine::move_noerase(void* pos, double x1, double y1, double x2,
double y2, int highlight, int hot)
{
p1.x = x1;
p1.y = y1;
p2.x = x2;
p2.y = y2;
zoom();
nav_zoom();
ctx->set_dirty();
}
void GlowLine::shift(
void* pos, double delta_x, double delta_y, int highlight, int hot)
{
......
......@@ -179,22 +179,6 @@ public:
void move(void* pos, double x1, double y1, double x2, double y2,
int highlight, int hot);
//! Move the line to the specified coordinates without erase.
/*!
\param pos Position. Should be zero.
\param x1 x coordinate of first point.
\param y1 y coordinate of first point.
\param x2 x coordinate of second point.
\param y2 y coordinate of second point.
\param highlight Draw with highlight colors.
\param hot Draw as hot, with larger line width.
Both endpoints are given new coordinates, so the direction and length of the
line can be entirely different.
*/
void move_noerase(void* pos, double x1, double y1, double x2, double y2,
int highlight, int hot);
//! Move the line.
/*!
\param pos Position. Should be zero.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment