Commit f78a435e authored by Christoffer Ackelman's avatar Christoffer Ackelman

Refactored GlowDraw: Combined similar drawing methods.

Instead of calling ctx->redraw() to redraw the window, call ctx->set_dirty().
The GlowCtx will redraw the window at the end of the event_handler if any event has marked it as dirty.
If you really need to redraw the window NOW (ex. after a timer triggered event),
call ctx->set_dirty followed by ctx->redraw_if_dirty().
parent 90bde1fd
...@@ -80,9 +80,6 @@ int main(int argc, char* argv[]) ...@@ -80,9 +80,6 @@ int main(int argc, char* argv[])
setlocale(LC_TIME, "en_US"); setlocale(LC_TIME, "en_US");
toplevel = new QWidget(); toplevel = new QWidget();
toplevel->setMinimumSize(100, 100);
toplevel->setWindowTitle("Pwr wb_ge");
toplevel->setAttribute(Qt::WA_DeleteOnClose);
// Create help window // Create help window
CoXHelpQt* xhelp = new CoXHelpQt(0, xhelp_eUtility_Wtt, &sts); CoXHelpQt* xhelp = new CoXHelpQt(0, xhelp_eUtility_Wtt, &sts);
...@@ -129,8 +126,6 @@ int main(int argc, char* argv[]) ...@@ -129,8 +126,6 @@ int main(int argc, char* argv[])
} }
fprintf(stderr, "\n"); fprintf(stderr, "\n");
toplevel->show();
new wb_log_qt(toplevel); new wb_log_qt(toplevel);
// Create message window // Create message window
...@@ -139,4 +134,4 @@ int main(int argc, char* argv[]) ...@@ -139,4 +134,4 @@ int main(int argc, char* argv[])
MsgWindow::set_default(msg_window); MsgWindow::set_default(msg_window);
return app.exec(); return app.exec();
} }
\ No newline at end of file
...@@ -2039,8 +2039,6 @@ static int attrnav_brow_cb(FlowCtx* ctx, flow_tEvent event) ...@@ -2039,8 +2039,6 @@ static int attrnav_brow_cb(FlowCtx* ctx, flow_tEvent event)
grow_OrderGroupObject( grow_OrderGroupObject(
parent_item->id, sel_item->id, dest_item->id, glow_eDest_Before); parent_item->id, sel_item->id, dest_item->id, glow_eDest_Before);
} }
grow_DrawObject(sel_item->id);
grow_DrawObject(dest_item->id);
attrnav->refresh_objects(attr_mRefresh_Objects); attrnav->refresh_objects(attr_mRefresh_Objects);
break; break;
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -249,7 +249,7 @@ void QtScrollWidgetGlow::handleEvent(QEvent* event) ...@@ -249,7 +249,7 @@ void QtScrollWidgetGlow::handleEvent(QEvent* event)
GlowCtx* ctx = (GlowCtx*)parent_ctx; GlowCtx* ctx = (GlowCtx*)parent_ctx;
GlowDrawQt* drawer = ((GlowDrawQt*)ctx->gdraw); GlowDrawQt* drawer = ((GlowDrawQt*)ctx->gdraw);
if (event->type() == QEvent::MouseMove) { if (event->type() == QEvent::MouseMove) {
drawer->m_wind->window->update(); drawer->m_wind.window->update();
} }
drawer->event_handler(event, this); drawer->event_handler(event, this);
} }
......
...@@ -133,7 +133,7 @@ void glow_measure_annot_text(GrowCtx* ctx, char* text, glow_eDrawType draw_type, ...@@ -133,7 +133,7 @@ void glow_measure_annot_text(GrowCtx* ctx, char* text, glow_eDrawType draw_type,
case glow_eAnnotType_OneLine: case glow_eAnnotType_OneLine:
ctx->gdraw->get_text_extent(text, strlen(text), draw_type, text_size, font, ctx->gdraw->get_text_extent(text, strlen(text), draw_type, text_size, font,
&z_width, &z_height, &z_descent, &z_width, &z_height, &z_descent,
ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor * (8 + 2 * text_size), ctx->mw->zoom_factor_y / ctx->mw->base_zoom_factor * (8 + 2 * text_size),
0); 0);
*rows = 1; *rows = 1;
break; break;
...@@ -148,8 +148,8 @@ void glow_measure_annot_text(GrowCtx* ctx, char* text, glow_eDrawType draw_type, ...@@ -148,8 +148,8 @@ void glow_measure_annot_text(GrowCtx* ctx, char* text, glow_eDrawType draw_type,
if (*s == 10) { if (*s == 10) {
if (len) { if (len) {
ctx->gdraw->get_text_extent(line, len, draw_type, text_size, font, ctx->gdraw->get_text_extent(line, len, draw_type, text_size, font,
&l_width, &l_height, &l_descent, ctx->mw.zoom_factor_y &l_width, &l_height, &l_descent, ctx->mw->zoom_factor_y
/ ctx->mw.base_zoom_factor * (8 + 2 * text_size), / ctx->mw->base_zoom_factor * (8 + 2 * text_size),
0); 0);
z_width = MAX(z_width, l_width); z_width = MAX(z_width, l_width);
} }
...@@ -161,8 +161,8 @@ void glow_measure_annot_text(GrowCtx* ctx, char* text, glow_eDrawType draw_type, ...@@ -161,8 +161,8 @@ void glow_measure_annot_text(GrowCtx* ctx, char* text, glow_eDrawType draw_type,
} }
if (len) { if (len) {
ctx->gdraw->get_text_extent(line, len, draw_type, text_size, font, ctx->gdraw->get_text_extent(line, len, draw_type, text_size, font,
&l_width, &l_height, &l_descent, ctx->mw.zoom_factor_y &l_width, &l_height, &l_descent, ctx->mw->zoom_factor_y
/ ctx->mw.base_zoom_factor * (8 + 2 * text_size), / ctx->mw->base_zoom_factor * (8 + 2 * text_size),
0); 0);
z_width = MAX(z_width, l_width); z_width = MAX(z_width, l_width);
line_cnt++; line_cnt++;
...@@ -172,6 +172,6 @@ void glow_measure_annot_text(GrowCtx* ctx, char* text, glow_eDrawType draw_type, ...@@ -172,6 +172,6 @@ void glow_measure_annot_text(GrowCtx* ctx, char* text, glow_eDrawType draw_type,
break; break;
} }
} }
*width = 1.0 * z_width / ctx->mw.base_zoom_factor; *width = 1.0 * z_width / ctx->mw->base_zoom_factor;
*height = 1.0 * z_height / ctx->mw.base_zoom_factor; *height = 1.0 * z_height / ctx->mw->base_zoom_factor;
} }
...@@ -52,10 +52,6 @@ public: ...@@ -52,10 +52,6 @@ public:
font(glow_eFont_Helvetica), protect(0){} font(glow_eFont_Helvetica), protect(0){}
void save(std::ofstream& fp, glow_eSaveMode mode); void save(std::ofstream& fp, glow_eSaveMode mode);
void open(std::ifstream& fp); void open(std::ifstream& fp);
void traverse(int x, int y)
{
p.traverse(x, y);
}
GrowCtx* ctx; GrowCtx* ctx;
int number; int number;
......
This diff is collapsed.
...@@ -93,8 +93,6 @@ public: ...@@ -93,8 +93,6 @@ public:
//! Adjust pixel coordinates for navigaion window to current zoom factor. //! Adjust pixel coordinates for navigaion window to current zoom factor.
void nav_zoom(); void nav_zoom();
void traverse(int x, int y); //!< Not used.
//! Event handler //! Event handler
/*! /*!
\param pos Position of object. Should be zero. \param pos Position of object. Should be zero.
...@@ -106,8 +104,7 @@ public: ...@@ -106,8 +104,7 @@ public:
Detects if the object is hit by the event. Detects if the object is hit by the event.
*/ */
int event_handler( int event_handler(void* pos, glow_eEvent event, int x, int y, void* node);
GlowWind* w, void* pos, glow_eEvent event, int x, int y, void* node);
//! Not implemented //! Not implemented
void conpoint_select(void* pos, int x, int y, double* distance, void** cp){} void conpoint_select(void* pos, int x, int y, double* distance, void** cp){}
...@@ -134,7 +131,7 @@ public: ...@@ -134,7 +131,7 @@ public:
Draw the object, without borders or shadow. Draw the object, without borders or shadow.
*/ */
void draw(GlowWind* w, void* pos, int highlight, int hot, void* node); void draw(DrawWind *w, void* pos, int highlight, int hot, void* node);
//! Draw border and shadow of the arc. //! Draw border and shadow of the arc.
/*! /*!
...@@ -147,7 +144,7 @@ public: ...@@ -147,7 +144,7 @@ public:
linewidth 1 pixel. linewidth 1 pixel.
The shadow also always has linewith 1 pixel. The shadow also always has linewith 1 pixel.
*/ */
void draw_shadow(GlowWind* w, int border, int shadow, int highlight, int hot); void draw_shadow(DrawWind *w, int border, int shadow, int highlight, int hot);
//! Erase the object. //! Erase the object.
/*! /*!
...@@ -155,7 +152,7 @@ public: ...@@ -155,7 +152,7 @@ public:
\param hot Draw as hot, with larger line width. \param hot Draw as hot, with larger line width.
\param node Parent node. Can be zero. \param node Parent node. Can be zero.
*/ */
void erase(GlowWind* w, void* pos, int hot, void* node); void erase(DrawWind *w, void* pos, int hot, void* node);
//! Calculate the border for a set of objects or for a parent node. //! Calculate the border for a set of objects or for a parent node.
/*! /*!
......
This diff is collapsed.
...@@ -148,31 +148,23 @@ public: ...@@ -148,31 +148,23 @@ public:
void print(void* pos, void* node); void print(void* pos, void* node);
void save(std::ofstream& fp, glow_eSaveMode mode); void save(std::ofstream& fp, glow_eSaveMode mode);
void open(GrowCtx* ctx, std::ifstream& fp); void open(GrowCtx* ctx, std::ifstream& fp);
void draw(GlowWind* w, void* pos, int highlight, int hot, void* node); void draw(DrawWind *w, void* pos, int highlight, int hot, void* node);
void erase(GlowWind* w, void* pos, int hot, void* node); void erase(DrawWind *w, void* pos, int hot, void* node);
void draw(GlowWind* w, GlowTransform* t, int highlight, int hot, void* node, void draw(DrawWind *w, GlowTransform* t, int highlight, int hot, void* node,
void* colornode); void* colornode);
void erase(GlowWind* w, GlowTransform* t, int hot, void* node); void erase(DrawWind *w, GlowTransform* t, int hot, void* node);
void draw_inverse(void* pos, int hot, void* node); void draw_inverse(void* pos, int hot, void* node);
void nav_draw(void* pos, int highlight, void* node);
void nav_draw(GlowTransform* t, int highlight, void* node, void* colornode);
void nav_erase(void* pos, void* node);
void nav_erase(GlowTransform* t, void* node);
void traverse(int x, int y);
void get_borders( void get_borders(
double* x_right, double* x_left, double* y_high, double* y_low); double* x_right, double* x_left, double* y_high, double* y_low);
void get_borders(double pos_x, double pos_y, double* x_right, double* x_left, void get_borders(double pos_x, double pos_y, double* x_right, double* x_left,
double* y_high, double* y_low, void* node); double* y_high, double* y_low, void* node);
void get_borders(GlowTransform* t, double* x_right, double* x_left, void get_borders(GlowTransform* t, double* x_right, double* x_left,
double* y_high, double* y_low); double* y_high, double* y_low);
int event_handler(GlowWind* w, glow_eEvent event, int x, int y); int event_handler(glow_eEvent event, int x, int y);
int event_handler( int event_handler(glow_eEvent event, int x, int y, double fx, double fy);
GlowWind* w, glow_eEvent event, int x, int y, double fx, double fy); int event_handler(glow_eEvent event, double fx, double fy);
int event_handler(GlowWind* w, glow_eEvent event, double fx, double fy); int event_handler(void* pos, glow_eEvent event, int x, int y, void* node);
int event_handler( int event_handler(void* pos, glow_eEvent event, int x, int y, int num);
GlowWind* w, void* pos, glow_eEvent event, int x, int y, void* node);
int event_handler(
GlowWind* w, void* pos, glow_eEvent event, int x, int y, int num);
void conpoint_select(void* pos, int x, int y, double* distance, void** cp); void conpoint_select(void* pos, int x, int y, double* distance, void** cp);
void conpoint_select(GlowTransform* t, int x, int y, double* distance, void conpoint_select(GlowTransform* t, int x, int y, double* distance,
void** cp, int* pix_x, int* pix_y); void** cp, int* pix_x, int* pix_y);
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
/*! \addtogroup Glow */ /*! \addtogroup Glow */
/*@{*/ /*@{*/
class GlowWind; class DrawWind;
class GlowExportFlow; class GlowExportFlow;
//! Base class for all drawing objects and components. //! Base class for all drawing objects and components.
...@@ -74,29 +74,27 @@ public: ...@@ -74,29 +74,27 @@ public:
virtual void zoom(){} virtual void zoom(){}
virtual void nav_zoom(){} virtual void nav_zoom(){}
virtual void print_zoom(){} virtual void print_zoom(){}
virtual void traverse(int x, int y){}
virtual void get_borders( virtual void get_borders(
double* x_right, double* x_left, double* y_high, double* y_low){} double* x_right, double* x_left, double* y_high, double* y_low){}
virtual void get_borders(GlowTransform* t, double* x_right, double* x_left, virtual void get_borders(GlowTransform* t, double* x_right, double* x_left,
double* y_high, double* y_low){} double* y_high, double* y_low){}
virtual void get_borders(double pos_x, double pos_y, double* x_right, virtual void get_borders(double pos_x, double pos_y, double* x_right,
double* x_left, double* y_high, double* y_low, void* node){} double* x_left, double* y_high, double* y_low, void* node){}
virtual int event_handler(GlowWind* w, glow_eEvent event, int x, int y) virtual int event_handler(glow_eEvent event, int x, int y)
{ {
return 0; return 0;
} }
virtual int event_handler( virtual int event_handler(glow_eEvent event, int x, int y, double fx,
GlowWind* w, glow_eEvent event, int x, int y, double fx, double fy) double fy)
{ {
return 0; return 0;
} }
virtual int event_handler( virtual int event_handler(glow_eEvent event, double fx, double fy)
GlowWind* w, glow_eEvent event, double fx, double fy)
{ {
return 0; return 0;
} }
virtual int event_handler( virtual int event_handler(void* pos, glow_eEvent event, int x, int y,
GlowWind* w, void* pos, glow_eEvent event, int x, int y, void* node) void* node)
{ {
return 0; return 0;
} }
...@@ -105,28 +103,19 @@ public: ...@@ -105,28 +103,19 @@ public:
virtual void open(std::ifstream& fp){} virtual void open(std::ifstream& fp){}
virtual void print(void* pos, void* node){} virtual void print(void* pos, void* node){}
virtual void draw(){} virtual void draw(){}
virtual void draw(GlowWind* w, int ll_x, int ll_y, int ur_x, int ur_y){} virtual void draw(DrawWind *w, int ll_x, int ll_y, int ur_x, int ur_y){}
virtual void draw(GlowWind* w, int* ll_x, int* ll_y, int* ur_x, int* ur_y){} virtual void draw(DrawWind *w, int* ll_x, int* ll_y, int* ur_x, int* ur_y){}
virtual void draw( virtual void draw(DrawWind *w, void* pos, int highlight, int hot, void* node){}
GlowWind* w, void* pos, int highlight, int hot, void* node){} virtual void draw(DrawWind *w, GlowTransform* t, int highlight, int hot,
virtual void draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
void* node, void* colornode){} void* node, void* colornode){}
virtual void erase(){} virtual void erase(){}
virtual void erase(GlowWind* w, void* pos, int hot, void* node){} virtual void erase(DrawWind *w, void* pos, int hot, void* node){}
virtual void erase(GlowWind* w, GlowTransform* t, int hot, void* node){} virtual void erase(DrawWind *w, GlowTransform* t, int hot, void* node){}
virtual void draw_inverse(void* pos, 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(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){}
virtual void shift( virtual void shift(
void* pos, double delta_x, double delta_y, int highlight, int hot){} void* pos, double delta_x, double delta_y, int highlight, int hot){}
virtual void nav_draw(int ll_x, int ll_y, int ur_x, int ur_y){}
virtual void nav_draw(int* ll_x, int* ll_y, int* ur_x, int* ur_y){}
virtual void nav_draw(void* pos, int highlight, void* node){}
virtual void nav_draw(
GlowTransform* t, int highlight, void* node, void* colornode){}
virtual void nav_erase(){}
virtual void nav_erase(void* pos, void* node){}
virtual void nav_erase(GlowTransform* t, void* node){}
virtual void conpoint_select( virtual void conpoint_select(
void* pos, int x, int y, double* distance, void** cp){} void* pos, int x, int y, double* distance, void** cp){}
virtual void conpoint_select(GlowTransform* t, int x, int y, double* distance, virtual void conpoint_select(GlowTransform* t, int x, int y, double* distance,
......
...@@ -160,12 +160,10 @@ void GlowArrow::open(std::ifstream& fp) ...@@ -160,12 +160,10 @@ void GlowArrow::open(std::ifstream& fp)
} }
} }
void GlowArrow::draw(GlowWind* w, void* pos, int highlight, int hot, void* node) void GlowArrow::draw(DrawWind *w, void* pos, int highlight, int hot, void* node)
{ {
int p1_x, p1_y, p2_x, p2_y, p_dest_x, p_dest_y; int p1_x, p1_y, p2_x, p2_y, p_dest_x, p_dest_y;
if (w == &ctx->navw) { if (w == ctx->navw) {
if (ctx->no_nav)
return;
hot = 0; hot = 0;
p1_x = p1.nav_z_x; p1_x = p1.nav_z_x;
p1_y = p1.nav_z_y; p1_y = p1.nav_z_y;
...@@ -185,7 +183,7 @@ void GlowArrow::draw(GlowWind* w, void* pos, int highlight, int hot, void* node) ...@@ -185,7 +183,7 @@ void GlowArrow::draw(GlowWind* w, void* pos, int highlight, int hot, void* node)
idx += hot; idx += hot;
idx = MAX(0, idx); idx = MAX(0, idx);
idx = MIN(idx, DRAW_TYPE_SIZE - 1); idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->gdraw->arrow(w, p_dest_x + ((GlowPoint*)pos)->z_x - w->offset_x, ctx->gdraw->arrow(p_dest_x + ((GlowPoint*)pos)->z_x - w->offset_x,
p_dest_y + ((GlowPoint*)pos)->z_y - w->offset_y, p_dest_y + ((GlowPoint*)pos)->z_y - w->offset_y,
p1_x + ((GlowPoint*)pos)->z_x - w->offset_x, p1_x + ((GlowPoint*)pos)->z_x - w->offset_x,
p1_y + ((GlowPoint*)pos)->z_y - w->offset_y, p1_y + ((GlowPoint*)pos)->z_y - w->offset_y,
...@@ -193,12 +191,10 @@ void GlowArrow::draw(GlowWind* w, void* pos, int highlight, int hot, void* node) ...@@ -193,12 +191,10 @@ void GlowArrow::draw(GlowWind* w, void* pos, int highlight, int hot, void* node)
p2_y + ((GlowPoint*)pos)->z_y - w->offset_y, draw_type, idx, highlight); p2_y + ((GlowPoint*)pos)->z_y - w->offset_y, draw_type, idx, highlight);
} }
void GlowArrow::erase(GlowWind* w, void* pos, int hot, void* node) void GlowArrow::erase(DrawWind *w, void* pos, int hot, void* node)
{ {
int p1_x, p1_y, p2_x, p2_y, p_dest_x, p_dest_y; int p1_x, p1_y, p2_x, p2_y, p_dest_x, p_dest_y;
if (w == &ctx->navw) { if (w == ctx->navw) {
if (ctx->no_nav)
return;
hot = 0; hot = 0;
p1_x = p1.nav_z_x; p1_x = p1.nav_z_x;
p1_y = p1.nav_z_y; p1_y = p1.nav_z_y;
...@@ -218,30 +214,25 @@ void GlowArrow::erase(GlowWind* w, void* pos, int hot, void* node) ...@@ -218,30 +214,25 @@ void GlowArrow::erase(GlowWind* w, void* pos, int hot, void* node)
idx += hot; idx += hot;
idx = MAX(0, idx); idx = MAX(0, idx);
idx = MIN(idx, DRAW_TYPE_SIZE - 1); idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->gdraw->arrow_erase(w, p_dest_x + ((GlowPoint*)pos)->z_x - w->offset_x, ctx->gdraw->arrow(p_dest_x + ((GlowPoint*)pos)->z_x - w->offset_x,
p_dest_y + ((GlowPoint*)pos)->z_y - w->offset_y, p_dest_y + ((GlowPoint*)pos)->z_y - w->offset_y,
p1_x + ((GlowPoint*)pos)->z_x - w->offset_x, p1_x + ((GlowPoint*)pos)->z_x - w->offset_x,
p1_y + ((GlowPoint*)pos)->z_y - w->offset_y, p1_y + ((GlowPoint*)pos)->z_y - w->offset_y,
p2_x + ((GlowPoint*)pos)->z_x - w->offset_x, p2_x + ((GlowPoint*)pos)->z_x - w->offset_x,
p2_y + ((GlowPoint*)pos)->z_y - w->offset_y, idx); p2_y + ((GlowPoint*)pos)->z_y - w->offset_y, glow_eDrawType_LineErase, idx);
} }
void GlowArrow::move(void* pos, double x1, double y1, double x2, double y2, void GlowArrow::move(void* pos, double x1, double y1, double x2, double y2,
int highlight, int hot) int highlight, int hot)
{ {
erase(&ctx->mw, pos, hot, NULL);
erase(&ctx->navw, pos, 0, NULL);
if (fabs(x2 - x1) < DBL_EPSILON) { if (fabs(x2 - x1) < DBL_EPSILON) {
p1.x = x2 + arrow_width / 2;
p2.x = x2 - arrow_width / 2;
if (y1 > y2) { if (y1 > y2) {
p1.x = x2 + arrow_width / 2;
p1.y = y2 + arrow_length; p1.y = y2 + arrow_length;
p2.x = x2 - arrow_width / 2;
p2.y = y2 + arrow_length; p2.y = y2 + arrow_length;
} else { } else {
p1.x = x2 + arrow_width / 2;
p1.y = y2 - arrow_length; p1.y = y2 - arrow_length;
p2.x = x2 - arrow_width / 2;
p2.y = y2 - arrow_length; p2.y = y2 - arrow_length;
} }
} else if (fabs(y2 - y1) < DBL_EPSILON) { } else if (fabs(y2 - y1) < DBL_EPSILON) {
...@@ -267,15 +258,13 @@ void GlowArrow::move(void* pos, double x1, double y1, double x2, double y2, ...@@ -267,15 +258,13 @@ void GlowArrow::move(void* pos, double x1, double y1, double x2, double y2,
p_dest.y = y2; p_dest.y = y2;
zoom(); zoom();
nav_zoom(); nav_zoom();
draw(&ctx->mw, pos, highlight, hot, NULL);
draw(&ctx->navw, pos, highlight, 0, NULL); ctx->set_dirty();
} }
void GlowArrow::shift( void GlowArrow::shift(
void* pos, double delta_x, double delta_y, int highlight, int hot) void* pos, double delta_x, double delta_y, int highlight, int hot)
{ {
erase(&ctx->mw, pos, hot, NULL);
erase(&ctx->navw, pos, 0, NULL);
p_dest.x += delta_x; p_dest.x += delta_x;
p_dest.y += delta_y; p_dest.y += delta_y;
p1.x += delta_x; p1.x += delta_x;
...@@ -285,12 +274,11 @@ void GlowArrow::shift( ...@@ -285,12 +274,11 @@ void GlowArrow::shift(
zoom(); zoom();
nav_zoom(); nav_zoom();
draw(&ctx->mw, pos, highlight, hot, NULL); ctx->set_dirty();
draw(&ctx->navw, pos, highlight, 0, NULL);
} }
int GlowArrow::event_handler( int GlowArrow::event_handler(
GlowWind* w, void* pos, glow_eEvent event, int x, int y, void* node) void* pos, glow_eEvent event, int x, int y, void* node)
{ {
return 0; return 0;
} }
...@@ -81,8 +81,7 @@ public: ...@@ -81,8 +81,7 @@ public:
Detects if the object is hit by the event. Detects if the object is hit by the event.
*/ */
int event_handler( int event_handler(void* pos, glow_eEvent event, int x, int y, void* node);
GlowWind* w, void* pos, glow_eEvent event, int x, int y, void* node);
//! Not implemented //! Not implemented
void conpoint_select(void* pos, int x, int y, double* distance, void** cp){} void conpoint_select(void* pos, int x, int y, double* distance, void** cp){}
...@@ -109,7 +108,7 @@ public: ...@@ -109,7 +108,7 @@ public:
Draw the object, without borders or shadow. Draw the object, without borders or shadow.
*/ */
void draw(GlowWind* w, void* pos, int highlight, int hot, void* node); void draw(DrawWind *w, void* pos, int highlight, int hot, void* node);
//! Erase the object. //! Erase the object.
/*! /*!
...@@ -117,7 +116,7 @@ public: ...@@ -117,7 +116,7 @@ public:
\param hot Draw as hot, with larger line width. \param hot Draw as hot, with larger line width.
\param node Parent node. Can be zero. \param node Parent node. Can be zero.
*/ */
void erase(GlowWind* w, void* pos, int hot, void* node); void erase(DrawWind *w, void* pos, int hot, void* node);
//! Calculate the border for a set of objects or for a parent node. //! Calculate the border for a set of objects or for a parent node.
/*! /*!
......
...@@ -77,7 +77,7 @@ void BrowCtx::configure() ...@@ -77,7 +77,7 @@ void BrowCtx::configure()
a.configure(); a.configure();
get_borders(); get_borders();
frame_x_right frame_x_right
= MAX(x_right, 1.0 * (mw.window_width + mw.offset_x) / mw.zoom_factor_x); = MAX(x_right, 1.0 * (mw->window_width + mw->offset_x) / mw->zoom_factor_x);
a.zoom(); a.zoom();
change_scrollbar(); change_scrollbar();
} }
...@@ -93,56 +93,53 @@ void BrowCtx::change_scrollbar() ...@@ -93,56 +93,53 @@ void BrowCtx::change_scrollbar()
if (a.size() == 0) if (a.size() == 0)
return; return;
((GlowNode*)a[0])->measure(&ll_x, &ll_y, &ur_x, &ur_y); ((GlowNode*)a[0])->measure(&ll_x, &ll_y, &ur_x, &ur_y);
scroll_size = ur_y - ll_y + 1.0 / mw.zoom_factor_y; scroll_size = ur_y - ll_y + 1.0 / mw->zoom_factor_y;
} }
data.scroll_data = scroll_data; data.scroll_data = scroll_data;
data.total_width = int((x_right - x_left) / scroll_size); data.total_width = int((x_right - x_left) / scroll_size);
data.total_height = int((y_high - y_low) / scroll_size); data.total_height = int((y_high - y_low) / scroll_size);
data.window_width = int(mw.window_width / scroll_size / mw.zoom_factor_x); data.window_width = int(mw->window_width / scroll_size / mw->zoom_factor_x);
data.window_height data.window_height
= int(mw.window_height / scroll_size / mw.zoom_factor_y + 1); = int(mw->window_height / scroll_size / mw->zoom_factor_y + 1);
data.offset_x = int( data.offset_x = int(
mw.offset_x / scroll_size / mw.zoom_factor_x - x_left / scroll_size); mw->offset_x / scroll_size / mw->zoom_factor_x - x_left / scroll_size);
data.offset_y data.offset_y
= int(mw.offset_y / scroll_size / mw.zoom_factor_y - y_low / scroll_size); = int(mw->offset_y / scroll_size / mw->zoom_factor_y - y_low / scroll_size);
(scroll_callback)(&data); (scroll_callback)(&data);
} }
void BrowCtx::redraw()
{
clear(&mw);
draw(&mw, 0, 0, mw.window_width, mw.window_height);
nav_zoom();
}
void BrowCtx::zoom(double factor) void BrowCtx::zoom(double factor)
{ {
if (fabs(factor) < DBL_EPSILON) if (fabs(factor) < DBL_EPSILON)
return; return;
mw.zoom_factor_x *= factor; mw->zoom_factor_x *= factor;
mw.zoom_factor_y *= factor; mw->zoom_factor_y *= factor;
if (mw.offset_x != 0) if (mw->offset_x != 0)
mw.offset_x = int( mw->offset_x = int(
(mw.offset_x - mw.window_width / 2.0 * (1.0 / factor - 1)) * factor); (mw->offset_x - mw->window_width / 2.0 * (1.0 / factor - 1)) * factor);
if (mw.offset_y != 0) if (mw->offset_y != 0)
mw.offset_y = int( mw->offset_y = int(
(mw.offset_y - mw.window_height / 2.0 * (1.0 / factor - 1)) * factor); (mw->offset_y - mw->window_height / 2.0 * (1.0 / factor - 1)) * factor);
mw.offset_x = MAX(mw.offset_x, 0); mw->offset_x = MAX(mw->offset_x, 0);
mw.offset_y = MAX(mw.offset_y, 0); mw->offset_y = MAX(mw->offset_y, 0);
if ((x_right - x_left) * mw.zoom_factor_x <= mw.window_width) if ((x_right - x_left) * mw->zoom_factor_x <= mw->window_width)
mw.offset_x = 0; mw->offset_x = 0;
if ((y_high - y_low) * mw.zoom_factor_y <= mw.window_height) if ((y_high - y_low) * mw->zoom_factor_y <= mw->window_height)
mw.offset_y = 0; mw->offset_y = 0;
a.zoom(); a.zoom();
clear(&mw); set_dirty();
draw(&mw, 0, 0, mw.window_width, mw.window_height);
nav_zoom(); nav_zoom();
change_scrollbar(); change_scrollbar();
} }
void BrowCtx::unzoom()
{
zoom(mw->base_zoom_factor / mw->zoom_factor_y);
}
void BrowCtx::print(char* filename) void BrowCtx::print(char* filename)
{ {
int i; int i;
...@@ -176,8 +173,8 @@ int BrowCtx::is_visible(GlowArrayElem* element) ...@@ -176,8 +173,8 @@ int BrowCtx::is_visible(GlowArrayElem* element)
double window_low, window_high; double window_low, window_high;
((GlowNode*)element)->measure(&ll_x, &ll_y, &ur_x, &ur_y); ((GlowNode*)element)->measure(&ll_x, &ll_y, &ur_x, &ur_y);
window_low = double(mw.offset_y) / mw.zoom_factor_y; window_low = double(mw->offset_y) / mw->zoom_factor_y;
window_high = double(mw.offset_y + mw.window_height) / mw.zoom_factor_y; window_high = double(mw->offset_y + mw->window_height) / mw->zoom_factor_y;
if (ll_y >= window_low && ur_y <= window_high) if (ll_y >= window_low && ur_y <= window_high)
return 1; return 1;
else else
...@@ -191,11 +188,11 @@ void BrowCtx::center_object(GlowArrayElem* object, double factor) ...@@ -191,11 +188,11 @@ void BrowCtx::center_object(GlowArrayElem* object, double factor)
int y_pix; int y_pix;
((GlowNode*)object)->measure(&ll_x, &ll_y, &ur_x, &ur_y); ((GlowNode*)object)->measure(&ll_x, &ll_y, &ur_x, &ur_y);
new_offset_y = int(ll_y * mw.zoom_factor_y - factor * mw.window_height); new_offset_y = int(ll_y * mw->zoom_factor_y - factor * mw->window_height);
if (new_offset_y <= 0) if (new_offset_y <= 0)
y_pix = mw.offset_y; y_pix = mw->offset_y;
else else
y_pix = -(new_offset_y - mw.offset_y); y_pix = -(new_offset_y - mw->offset_y);
scroll(0, y_pix); scroll(0, y_pix);
change_scrollbar(); change_scrollbar();
} }
...@@ -204,8 +201,8 @@ void brow_scroll_horizontal(BrowCtx* ctx, int value, int bottom) ...@@ -204,8 +201,8 @@ void brow_scroll_horizontal(BrowCtx* ctx, int value, int bottom)
{ {
int x_pix; int x_pix;
x_pix = int(-value * ctx->scroll_size * ctx->mw.zoom_factor_x x_pix = int(-value * ctx->scroll_size * ctx->mw->zoom_factor_x
+ (ctx->mw.offset_x - ctx->x_left * ctx->mw.zoom_factor_x)); + (ctx->mw->offset_x - ctx->x_left * ctx->mw->zoom_factor_x));
ctx->scroll(x_pix, 0); ctx->scroll(x_pix, 0);
} }
...@@ -213,15 +210,15 @@ void brow_scroll_vertical(BrowCtx* ctx, int value, int bottom) ...@@ -213,15 +210,15 @@ void brow_scroll_vertical(BrowCtx* ctx, int value, int bottom)
{ {
int y_pix; int y_pix;
y_pix = int(-value * ctx->scroll_size * ctx->mw.zoom_factor_y y_pix = int(-value * ctx->scroll_size * ctx->mw->zoom_factor_y
+ (ctx->mw.offset_y - ctx->y_low * ctx->mw.zoom_factor_y)); + (ctx->mw->offset_y - ctx->y_low * ctx->mw->zoom_factor_y));
// Correction for the bottom position // Correction for the bottom position
if (bottom if (bottom
&& (y_pix >= 0 && (y_pix >= 0
|| ctx->mw.window_height + y_pix || ctx->mw->window_height + y_pix
< ctx->y_high * ctx->mw.zoom_factor_y - ctx->mw.offset_y)) < ctx->y_high * ctx->mw->zoom_factor_y - ctx->mw->offset_y))
// mw.window_height >= (y_high - y_low) * mw.zoom_factor_y) // mw->window_height >= (y_high - y_low) * mw->zoom_factor_y)
y_pix = int(ctx->mw.window_height + ctx->mw.offset_y y_pix = int(ctx->mw->window_height + ctx->mw->offset_y
- ctx->y_high * ctx->mw.zoom_factor_y); - ctx->y_high * ctx->mw->zoom_factor_y);
ctx->scroll(0, y_pix); ctx->scroll(0, y_pix);
} }
...@@ -56,12 +56,8 @@ public: ...@@ -56,12 +56,8 @@ public:
void remove(GlowArrayElem* element); void remove(GlowArrayElem* element);
void configure(); void configure();
void change_scrollbar(); void change_scrollbar();
void redraw();
void zoom(double factor); void zoom(double factor);
void unzoom() void unzoom();
{
zoom(mw.base_zoom_factor / mw.zoom_factor_y);
}
void print(char* filename); void print(char* filename);
int get_first(GlowArrayElem** first) int get_first(GlowArrayElem** first)
{ {
...@@ -90,7 +86,4 @@ public: ...@@ -90,7 +86,4 @@ public:
double annotation_space; double annotation_space;
}; };
// void brow_scroll_horizontal( BrowCtx *ctx, int value, int bottom);
// void brow_scroll_vertical( BrowCtx *ctx, int value, int bottom);
#endif #endif
This diff is collapsed.
...@@ -93,19 +93,11 @@ public: ...@@ -93,19 +93,11 @@ public:
//! Update the layout of the scrollbars. //! Update the layout of the scrollbars.
void change_scrollbar(); void change_scrollbar();
//! Redraw the window.
/*! Redraw all objects in the window.
*/
void redraw();
//! Adjust the pixel coordinates to the current zoomfactor. //! Adjust the pixel coordinates to the current zoomfactor.
void zoom(double factor); void zoom(double factor);
//! Reset to base zoomfactor. //! Reset to base zoomfactor.
void unzoom() void unzoom();
{
zoom(mw.base_zoom_factor / mw.zoom_factor_y);
}
//! Not used. //! Not used.
void print(char* filename); void print(char* filename);
......
This diff is collapsed.
...@@ -116,11 +116,10 @@ public: ...@@ -116,11 +116,10 @@ public:
void get_borders( void get_borders(
double* x1_right, double* x1_left, double* y1_high, double* y1_low){} double* x1_right, double* x1_left, double* y1_high, double* y1_low){}
void get_con_borders(); void get_con_borders();
int event_handler(GlowWind* w, glow_eEvent event, int x, int y); int event_handler(glow_eEvent event, int x, int y);
int event_handler( int event_handler(glow_eEvent event, int x, int y, double fx, double fy)
GlowWind* w, glow_eEvent event, int x, int y, double fx, double fy)
{ {
return event_handler(w, event, x, y); return event_handler(event, x, y);
} }
//! Save the content of the object to file. //! Save the content of the object to file.
...@@ -135,9 +134,8 @@ public: ...@@ -135,9 +134,8 @@ public:
\param fp Input file. \param fp Input file.
*/ */
void open(std::ifstream& fp); void open(std::ifstream& fp);
void draw(GlowWind* w, int ll_x, int ll_y, int ur_x, int ur_y); void draw(DrawWind* w, int ll_x, int ll_y, int ur_x, int ur_y);
void draw(GlowWind* w, int* ll_x, int* ll_y, int* ur_x, int* ur_y); void draw(DrawWind* w, int* ll_x, int* ll_y, int* ur_x, int* ur_y);
void draw();
void erase(){} void erase(){}
void move(double delta_x, double delta_y, int grid); void move(double delta_x, double delta_y, int grid);
void move_noerase(int delta_x, int delta_y, int move); void move_noerase(int delta_x, int delta_y, int move);
......
...@@ -76,7 +76,6 @@ public: ...@@ -76,7 +76,6 @@ public:
void zoom(){} void zoom(){}
void nav_zoom(){} void nav_zoom(){}
void print_zoom(){} void print_zoom(){}
void traverse(int x, int y){}
void get_borders(double pos_x, double pos_y, double* x_right, double* x_left, void get_borders(double pos_x, double pos_y, double* x_right, double* x_left,
double* y_high, double* y_low, void* node){} double* y_high, double* y_low, void* node){}
int event_handler(void* pos, glow_eEvent event, int x, int y, void* node) int event_handler(void* pos, glow_eEvent event, int x, int y, void* node)
...@@ -98,7 +97,6 @@ public: ...@@ -98,7 +97,6 @@ public:
*/ */
void open(std::ifstream& fp); void open(std::ifstream& fp);
void draw(GlowPoint* pos, int highlight, int hot, void* node){} void draw(GlowPoint* pos, int highlight, int hot, void* node){}
void nav_draw(GlowPoint* pos, int highlight, void* node){}
void erase(GlowPoint* pos, int hot, void* node){} void erase(GlowPoint* pos, int hot, void* node){}
void nav_erase(GlowPoint* pos, void* node){} void nav_erase(GlowPoint* pos, void* node){}
......
...@@ -132,11 +132,6 @@ void GlowConPoint::open(std::ifstream& fp) ...@@ -132,11 +132,6 @@ void GlowConPoint::open(std::ifstream& fp)
} }
} }
void GlowConPoint::traverse(int x, int y)
{
p.traverse(x, y);
}
int GlowConPoint::event_handler( int GlowConPoint::event_handler(
void* pos, glow_eEvent event, int x, int y, void* node) void* pos, glow_eEvent event, int x, int y, void* node)
{ {
...@@ -146,13 +141,10 @@ int GlowConPoint::event_handler( ...@@ -146,13 +141,10 @@ int GlowConPoint::event_handler(
void GlowConPoint::conpoint_select( void GlowConPoint::conpoint_select(
void* pos, int x, int y, double* distance, void** cp) void* pos, int x, int y, double* distance, void** cp)
{ {
int px, py; int px = ((GlowPoint*)pos)->z_x - ctx->mw->offset_x + p.z_x;
double dist; int py = ((GlowPoint*)pos)->z_y - ctx->mw->offset_y + p.z_y;
px = ((GlowPoint*)pos)->z_x - ctx->mw.offset_x + p.z_x; double dist = sqrt(1.0 * (x - px) * (x - px) + 1.0 * (y - py) * (y - py));
py = ((GlowPoint*)pos)->z_y - ctx->mw.offset_y + p.z_y;
dist = sqrt(1.0 * (x - px) * (x - px) + 1.0 * (y - py) * (y - py));
if (dist < *distance) { if (dist < *distance) {
*distance = dist; *distance = dist;
*cp = (void*)this; *cp = (void*)this;
...@@ -162,16 +154,10 @@ void GlowConPoint::conpoint_select( ...@@ -162,16 +154,10 @@ void GlowConPoint::conpoint_select(
void GlowConPoint::conpoint_select(GlowTransform* t, int x, int y, void GlowConPoint::conpoint_select(GlowTransform* t, int x, int y,
double* distance, void** cp, int* pix_x, int* pix_y) double* distance, void** cp, int* pix_x, int* pix_y)
{ {
int px, py; int px = int(trf.x(t, p.x, p.y) * ctx->mw->zoom_factor_x - ctx->mw->offset_x);
double dist; int py = int(trf.y(t, p.x, p.y) * ctx->mw->zoom_factor_y - ctx->mw->offset_y);
double x1, y1;
x1 = trf.x(t, p.x, p.y);
y1 = trf.y(t, p.x, p.y);
px = int(x1 * ctx->mw.zoom_factor_x - ctx->mw.offset_x);
py = int(y1 * ctx->mw.zoom_factor_y - ctx->mw.offset_y);
dist = sqrt(1.0 * (x - px) * (x - px) + 1.0 * (y - py) * (y - py)); double dist = sqrt(1.0 * (x - px) * (x - px) + 1.0 * (y - py) * (y - py));
if (dist < *distance) { if (dist < *distance) {
*distance = dist; *distance = dist;
*cp = (void*)this; *cp = (void*)this;
......
...@@ -47,7 +47,6 @@ public: ...@@ -47,7 +47,6 @@ public:
void zoom(); void zoom();
void nav_zoom(); void nav_zoom();
void print_zoom(); void print_zoom();
void traverse(int x, int y);
int event_handler(void* pos, glow_eEvent event, int x, int y, void* node); int event_handler(void* pos, glow_eEvent event, int x, int y, void* node);
void conpoint_select(void* pos, int x, int y, double* distance, void** cp); void conpoint_select(void* pos, int x, int y, double* distance, void** cp);
void conpoint_select(GlowTransform* t, int x, int y, double* distance, void conpoint_select(GlowTransform* t, int x, int y, double* distance,
......
This diff is collapsed.
...@@ -57,53 +57,6 @@ public: ...@@ -57,53 +57,6 @@ public:
char text[100][200]; char text[100][200];
}; };
//! Main or navigation window
class GlowWind {
public:
DrawWind* window; //!< Window context.
double zoom_factor_x; //!< Zoom factor in x direction.
double zoom_factor_y; //!< Zoom factor in y direction.
double base_zoom_factor; //!< Original zoom factor.
int offset_x; //!< Offset in pixel between origo and displayed window in x
//! direction.
int offset_y; //!< Offset in pixel between origo and displayde window in y
//! direction.
int window_width; //!< Window width in pixel.
int window_height; //!< Window height in pixel.
int subwindow_x; //!< Subwindow x coordinate in pixel.
int subwindow_y; //!< Subwindow y coordinate in pixel.
double subwindow_scale; //!< Subwindow scale.
int defered_x_low; //!< Left border of defered redrawing area.
int defered_x_high; //!< Right border of defered redrawing area.
int defered_y_low; //!< Low border of defered redrawing area.
int defered_y_high; //!< High border of defered redrawing area.
GlowWind(double zoom_fact_x, double zoom_fact_y, double base_zoom_fact,
int offs_x, int offs_y)
: window(0), zoom_factor_x(zoom_fact_x), zoom_factor_y(zoom_fact_y),
base_zoom_factor(base_zoom_fact), offset_x(offs_x), offset_y(offs_y),
window_width(0), window_height(0), subwindow_x(0), subwindow_y(0),
subwindow_scale(1)
{
}
//! Draw in the double buffering buffer only.
/*! Increase the draw_buffer_only count. As long as this is > 0, no drawing is
* made to the screen, only in the buffer. */
void set_draw_buffer_only();
//! Reset draw in the double buffering buffer only.
/*! Decrease the draw_buffer_only count. As long as this is > 0, no drawing is
* made to the screen, only in the buffer. */
void reset_draw_buffer_only();
int draw_buffer_only();
int double_buffer_on();
int double_buffered();
void set_double_buffered(int val);
void set_double_buffer_on(int val);
};
//! Backcall data for scrollbar reconfiguration //! Backcall data for scrollbar reconfiguration
typedef struct { typedef struct {
void* scroll_data; //!< Scrollbar data (growwidget_sScroll). void* scroll_data; //!< Scrollbar data (growwidget_sScroll).
...@@ -145,21 +98,14 @@ public: ...@@ -145,21 +98,14 @@ public:
int offs_y = 0); int offs_y = 0);
glow_eCtxType ctx_type; //!< Type of context glow_eCtxType ctx_type; //!< Type of context
GlowWind mw; //!< Main window data. DrawWind* mw; //!< Main window data.
GlowWind navw; //!< Navigation window data. DrawWind* navw; //!< Navigation window data.
double print_zoom_factor; //!< Zoom factor when printing to postscript. double print_zoom_factor; //!< Zoom factor when printing to postscript.
double x_right; //!< Right border of work area. double x_right; //!< Right border of work area.
double x_left; //!< Left border of work area. double x_left; //!< Left border of work area.
double y_high; //!< High border of work area. double y_high; //!< High border of work area.
double y_low; //!< Low border of work area. double y_low; //!< Low border of work area.
int nav_rect_ll_x; //!< x coordinate for lower left corner of navigation int nav_rect_ll_x, nav_rect_ll_y, nav_rect_ur_x, nav_rect_ur_y;
//! rectangle in nav window.
int nav_rect_ll_y; //!< y coordinate for lower left corner of navigation
//! rectangle in nav window.
int nav_rect_ur_x; //!< x coordinate for upper right corner of navigation
//! rectangle in nav window.
int nav_rect_ur_y; //!< y coordinate for upper right corner of navigation
//! rectangle in nav window.
int nav_rect_hot; //!< Cursor is in navigation rectangle in navigation window. int nav_rect_hot; //!< Cursor is in navigation rectangle in navigation window.
GlowDraw* gdraw; //!< Draw context. GlowDraw* gdraw; //!< Draw context.
...@@ -604,7 +550,7 @@ public: ...@@ -604,7 +550,7 @@ public:
\param ur_y y coordiate for upper right corner of area to draw in \param ur_y y coordiate for upper right corner of area to draw in
pixel. pixel.
*/ */
void draw(GlowWind* w, int ll_x, int ll_y, int ur_x, int ur_y); virtual void draw(DrawWind* w, int ll_x, int ll_y, int ur_x, int ur_y);
//! Redraw an area of the window. Arguments in double. //! Redraw an area of the window. Arguments in double.
/*! /*!
...@@ -617,15 +563,11 @@ public: ...@@ -617,15 +563,11 @@ public:
\param ur_y y coordiate for upper right corner of area to draw in \param ur_y y coordiate for upper right corner of area to draw in
pixel. pixel.
*/ */
void draw(GlowWind* w, double ll_x, double ll_y, double ur_x, double ur_y) void draw(DrawWind* w, double ll_x, double ll_y, double ur_x, double ur_y)
{ {
draw(w, (int)ll_x, (int)ll_y, (int)ur_x, (int)ur_y); draw(w, (int)ll_x, (int)ll_y, (int)ur_x, (int)ur_y);
} }
//! Clear the window.
/*! Draw background color. */
void clear(GlowWind* w);
//! Update zoom of navigation window. //! Update zoom of navigation window.
/*! The zoomfactor of the navigation window is updated to match the extent of /*! The zoomfactor of the navigation window is updated to match the extent of
* the working space. */ * the working space. */
...@@ -634,39 +576,6 @@ public: ...@@ -634,39 +576,6 @@ public:
//! Zoom to appropriate scale for postscript output. //! Zoom to appropriate scale for postscript output.
void print_zoom(); void print_zoom();
//! Clear the navigation window.
/*! Draw background color. */
void nav_clear();
//! Redraw an area of the navigation window.
/*!
\param ll_x x coordiate for lower left corner of area to draw in
pixel.
\param ll_y y coordiate for lower left corner of area to draw in
pixel.
\param ur_x x coordiate for upper right corner of area to draw in
pixel.
\param ur_y y coordiate for upper right corner of area to draw in
pixel.
*/
void nav_draw(GlowWind* w, int ll_x, int ll_y, int ur_x, int ur_y);
//! Redraw an area of the navigation window. Arguments in double.
/*!
\param ll_x x coordiate for lower left corner of area to draw in
pixel.
\param ll_y y coordiate for lower left corner of area to draw in
pixel.
\param ur_x x coordiate for upper right corner of area to draw in
pixel.
\param ur_y y coordiate for upper right corner of area to draw in
pixel.
*/
void nav_draw(GlowWind* w, double ll_x, double ll_y, double ur_x, double ur_y)
{
nav_draw(w, (int)ll_x, (int)ll_y, (int)ur_x, (int)ur_y);
}
//! Handle events. //! Handle events.
/*! Calls the event handler of GrowCtx. */ /*! Calls the event handler of GrowCtx. */
int event_handler(glow_eEvent event, int x, int y, int w, int h); int event_handler(glow_eEvent event, int x, int y, int w, int h);
...@@ -700,16 +609,15 @@ public: ...@@ -700,16 +609,15 @@ public:
/*! \param node Node.*/ /*! \param node Node.*/
void delete_node_cons(void* node); void delete_node_cons(void* node);
//! Set defered redraw. //! Mark that window needs to be redrawn.
/*! The redraw will be deferd until a call to redraw_defered() is made. */ /*! The window will be redrawn when a call to redraw_if_dirty() is made. */
void set_defered_redraw(); void set_dirty();
//! Execute the defered redrawings. //! Redraw the window if it is dirty.
/*! Execute redrawing the defered redrawing area since the call to /*! Redraw the window if it has been marked as dirty by set_dirty() */
* set_defered_redraw(). */ void redraw_if_dirty();
void redraw_defered();
int defered_redraw_active; //!< Defered redraw is active. int is_dirty; //!< Defered redraw is active.
GlowArray a_nc; //!< Array of nodeclasses. GlowArray a_nc; //!< Array of nodeclasses.
GlowArray a_cc; //!< Array of connection classes. GlowArray a_cc; //!< Array of connection classes.
GlowArray a; //!< Object array. GlowArray a; //!< Object array.
...@@ -906,18 +814,11 @@ public: ...@@ -906,18 +814,11 @@ public:
\param pix_x x coordinate in pixel. \param pix_x x coordinate in pixel.
\param pix_y y coordinate in pixel. \param pix_y y coordinate in pixel.
*/ */
void position_to_pixel(double x, double y, int* pix_x, int* pix_y) void position_to_pixel(double x, double y, int* pix_x, int* pix_y);
{
*pix_x = int(x * mw.zoom_factor_x - mw.offset_x);
*pix_y = int(y * mw.zoom_factor_y - mw.offset_y);
}
//! Unzoom. //! Unzoom.
/*! Return to base zoom factor. */ /*! Return to base zoom factor. */
void unzoom() void unzoom();
{
zoom(mw.base_zoom_factor / mw.zoom_factor_x);
}
//! Position the view so that the specified object is in the center of the //! Position the view so that the specified object is in the center of the
//! window. //! window.
...@@ -936,23 +837,18 @@ public: ...@@ -936,23 +837,18 @@ public:
/*! No drawing is performed. */ /*! No drawing is performed. */
void set_nodraw() void set_nodraw()
{ {
nodraw++; nodraw = 1;
} }
//! Reset nodraw. //! Reset nodraw.
/*! Drawing is resumed when the nodraw counter is zero. */ /*! Drawing is resumed when the nodraw counter is zero. */
void reset_nodraw() void reset_nodraw()
{ {
if (nodraw) nodraw = 0;
nodraw--;
} }
void reconfigure(); void reconfigure();
//! Redraw the window.
/*! The window is cleard and all objects are redrawn. */
void redraw();
//! Send an object deleted event callback if this event is registred. //! Send an object deleted event callback if this event is registred.
/*! \param object Object that is to be deleted. */ /*! \param object Object that is to be deleted. */
void object_deleted(GlowArrayElem* object); void object_deleted(GlowArrayElem* object);
...@@ -1089,7 +985,7 @@ public: ...@@ -1089,7 +985,7 @@ public:
\param ur_x x coordinate for upper right corner of area in pixel. \param ur_x x coordinate for upper right corner of area in pixel.
\param ur_y y coordinate for upper right corner of area in pixel. \param ur_y y coordinate for upper right corner of area in pixel.
*/ */
void draw_grid(GlowWind* w, int ll_x, int ll_y, int ur_x, int ur_y); void draw_grid(DrawWind* w, int ll_x, int ll_y, int ur_x, int ur_y);
//! Register callback functions for userdata handling. //! Register callback functions for userdata handling.
/*! /*!
...@@ -1140,7 +1036,7 @@ public: ...@@ -1140,7 +1036,7 @@ public:
//! Destructor //! Destructor
/*! Delete all objects in the context. */ /*! Delete all objects in the context. */
~GlowCtx(); virtual ~GlowCtx();
}; };
//! Start autoscrolling. //! Start autoscrolling.
......
This diff is collapsed.
...@@ -49,10 +49,7 @@ public: ...@@ -49,10 +49,7 @@ public:
int layout_adjusted; int layout_adjusted;
void configure(); void configure();
void zoom(double factor); void zoom(double factor);
void unzoom() void unzoom();
{
zoom(mw.base_zoom_factor / mw.zoom_factor_x);
}
void nav_zoom(); void nav_zoom();
void get_zoom(double* factor_x, double* factor_y); void get_zoom(double* factor_x, double* factor_y);
void get_prefered_zoom_y(int height, double* factor_y); void get_prefered_zoom_y(int height, double* factor_y);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -123,7 +123,7 @@ public: ...@@ -123,7 +123,7 @@ public:
multiplied with the parentnodes transform, to give the appropriate multiplied with the parentnodes transform, to give the appropriate
coordinates for the drawing. coordinates for the drawing.
*/ */
void draw(GlowWind* w, GlowTransform* t, int highlight, int hot, void* node, void draw(DrawWind* w, GlowTransform* t, int highlight, int hot, void* node,
void* colornode); void* colornode);
//! Erase the object. //! Erase the object.
...@@ -132,7 +132,7 @@ public: ...@@ -132,7 +132,7 @@ public:
\param hot Draw as hot, with larger line width. \param hot Draw as hot, with larger line width.
\param node Parent node. Can be zero. \param node Parent node. Can be zero.
*/ */
void erase(GlowWind* w, GlowTransform* t, int hot, void* node); void erase(DrawWind* w, GlowTransform* t, int hot, void* node);
//! Redraw the background of the annotation //! Redraw the background of the annotation
/*! /*!
...@@ -140,7 +140,7 @@ public: ...@@ -140,7 +140,7 @@ public:
\param hot Draw as hot, with larger line width. \param hot Draw as hot, with larger line width.
\param node Parent node. Can be zero. \param node Parent node. Can be zero.
*/ */
void erase_background(GlowWind* w, GlowTransform* t, int hot, void* node); void erase_background(DrawWind* w, GlowTransform* t, int hot, void* node);
//! Calculate the border for a set of objects or for a parent node. //! Calculate the border for a set of objects or for a parent node.
/*! /*!
......
This diff is collapsed.
...@@ -843,8 +843,6 @@ void grow_RedrawDefered(grow_tCtx ctx); ...@@ -843,8 +843,6 @@ void grow_RedrawDefered(grow_tCtx ctx);
/*! \param ctx Grow context. */ /*! \param ctx Grow context. */
void grow_Redraw(grow_tCtx ctx); void grow_Redraw(grow_tCtx ctx);
void grow_SetInputFocus(grow_tCtx ctx);
//! Set editing mode of grow. //! Set editing mode of grow.
/*! /*!
\param ctx Grow context. \param ctx Grow context.
...@@ -3345,7 +3343,6 @@ int grow_SetObjectClass(grow_tObject object, grow_tNodeClass nodeclass); ...@@ -3345,7 +3343,6 @@ int grow_SetObjectClass(grow_tObject object, grow_tNodeClass nodeclass);
int grow_CheckObjectName(grow_tCtx ctx, char* name); int grow_CheckObjectName(grow_tCtx ctx, char* name);
int grow_KeyPressed(grow_tCtx ctx, int key); int grow_KeyPressed(grow_tCtx ctx, int key);
void grow_SignalSend(grow_tCtx ctx, char* signalname); void grow_SignalSend(grow_tCtx ctx, char* signalname);
void grow_DrawObject(grow_tObject object);
void grow_NavRedraw(grow_tCtx ctx); void grow_NavRedraw(grow_tCtx ctx);
/*@}*/ /*@}*/
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
void open(std::ifstream& fp); void open(std::ifstream& fp);
//! Erase the object //! Erase the object
void erase(GlowWind* w) void erase(DrawWind* w)
{ {
erase(w, (GlowTransform*)NULL, hot, NULL); erase(w, (GlowTransform*)NULL, hot, NULL);
} }
...@@ -104,7 +104,7 @@ public: ...@@ -104,7 +104,7 @@ public:
\param ur_x Upper right x coordinate of drawing area. \param ur_x Upper right x coordinate of drawing area.
\param ur_y Upper right y coordinate of drawing area. \param ur_y Upper right y coordinate of drawing area.
*/ */
void draw(GlowWind* w, int ll_x, int ll_y, int ur_x, int ur_y); void draw(DrawWind* w, int ll_x, int ll_y, int ur_x, int ur_y);
//! Draw the objects if any part is inside the drawing area, and extends the //! Draw the objects if any part is inside the drawing area, and extends the
//! drawing area. //! drawing area.
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
drawing area, drawing area,
the drawingarea is extended so it contains the whole objects. the drawingarea is extended so it contains the whole objects.
*/ */
void draw(GlowWind* w, int* ll_x, int* ll_y, int* ur_x, int* ur_y); void draw(DrawWind* w, int* ll_x, int* ll_y, int* ur_x, int* ur_y);
//! Set object highlight. //! Set object highlight.
/*! /*!
...@@ -154,7 +154,7 @@ public: ...@@ -154,7 +154,7 @@ public:
\param hot Draw as hot, with larger line width. \param hot Draw as hot, with larger line width.
\param node Parent node. Can be zero. \param node Parent node. Can be zero.
*/ */
void erase(GlowWind* w, GlowTransform* t, int hot, void* node); void erase(DrawWind* w, GlowTransform* t, int hot, void* node);
//! Draw the object. //! Draw the object.
/*! /*!
...@@ -170,12 +170,9 @@ public: ...@@ -170,12 +170,9 @@ public:
multiplied with the parentnodes transform, to give the appropriate multiplied with the parentnodes transform, to give the appropriate
coordinates for the drawing. coordinates for the drawing.
*/ */
void draw(GlowWind* w, GlowTransform* t, int highlight, int hot, void* node, void draw(DrawWind* w, GlowTransform* t, int highlight, int hot, void* node,
void* colornode); void* colornode);
//! Redraw the area inside the objects border.
void draw();
//! Configure the axis //! Configure the axis
/*! Calculate the layout for the axis, length of lines and which values that /*! Calculate the layout for the axis, length of lines and which values that
* should be dislayed. * should be dislayed.
...@@ -278,7 +275,7 @@ public: ...@@ -278,7 +275,7 @@ public:
void set_original_text_color(glow_eDrawType drawtype) void set_original_text_color(glow_eDrawType drawtype)
{ {
text_color_drawtype = drawtype; text_color_drawtype = drawtype;
draw(); ctx->set_dirty();
} }
//! Format axis text. //! Format axis text.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -157,11 +157,9 @@ public: ...@@ -157,11 +157,9 @@ public:
strcpy(nc->n_name, name); strcpy(nc->n_name, name);
} }
int event_handler(GlowWind* w, glow_eEvent event, double fx, double fy); int event_handler(glow_eEvent event, double fx, double fy);
int event_handler( int event_handler(glow_eEvent event, int x, int y, double fx, double fy);
GlowWind* w, glow_eEvent event, int x, int y, double fx, double fy); int nc_event_handler(glow_eEvent event, double x, double y, int* idx);
int nc_event_handler(
GlowWind* w, glow_eEvent event, double x, double y, int* idx);
void configure(char* tools1, char* tools2, int tools1_cnt, int tools2_cnt, void configure(char* tools1, char* tools2, int tools1_cnt, int tools2_cnt,
unsigned int show_mask1, unsigned int show_mask2, unsigned int show_mask1, unsigned int show_mask2,
unsigned int insensitive_mask1, unsigned int insensitive_mask2); unsigned int insensitive_mask1, unsigned int insensitive_mask2);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -55,7 +55,6 @@ public: ...@@ -55,7 +55,6 @@ public:
void zoom(); void zoom();
void nav_zoom(); void nav_zoom();
void print_zoom(); void print_zoom();
void traverse(int x, int y);
void posit(double x, double y); void posit(double x, double y);
void posit_z(int x, int y); void posit_z(int x, int y);
void save(std::ofstream& fp, glow_eSaveMode mode); void save(std::ofstream& fp, glow_eSaveMode mode);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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