Commit 13674419 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Refactored FlowDraw: Combined similar drawing methods.

Instead of calling ctx->redraw() to redraw the window, call ctx->set_dirty().
The FlowCtx 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 91585a52
......@@ -1149,7 +1149,7 @@ int WGre::window_draw()
free((char*)node_list);
flow_ResetNodraw(flow_ctx);
flow_Redraw(flow_ctx);
flow_ctx->set_dirty();
return GRE__SUCCESS;
}
......@@ -2718,7 +2718,7 @@ int WGre::display()
flow_attr.display_level = flow_mDisplayLevel_1 | flow_mDisplayLevel_2;
mask = flow_eAttr_display_level;
flow_SetAttributes(flow_ctx, &flow_attr, mask);
flow_Redraw(flow_ctx);
flow_ctx->set_dirty();
return GRE__SUCCESS;
}
......@@ -2746,7 +2746,7 @@ int WGre::undisplay()
flow_attr.display_level = flow_mDisplayLevel_1;
mask = flow_eAttr_display_level;
flow_SetAttributes(flow_ctx, &flow_attr, mask);
flow_Redraw(flow_ctx);
flow_ctx->set_dirty();
return GRE__SUCCESS;
}
......
......@@ -1013,8 +1013,11 @@ static void EndPrint(flow_tCtx ctx, ctx_settings* settings)
ctx->offset_x = settings->offset_x;
ctx->offset_y = settings->offset_y;
ctx->a.zoom();
ctx->clear();
ctx->draw(0, 0, ctx->window_width, ctx->window_height);
int nav_backup = ctx->no_nav;
ctx->no_nav = true;
ctx->set_dirty();
ctx->redraw_if_dirty();
ctx->no_nav = nav_backup;
ctx->nav_zoom();
ctx->change_scrollbar();
}
......@@ -1040,11 +1043,15 @@ static void PrintPage(QPainter* painter, const char* title, flow_tCtx ctx, QImag
ctx->offset_x = ll_x * zoom;
ctx->offset_y = ll_y * zoom;
ctx->a.zoom();
ctx->clear();
double document_width = (ur_x - ll_x) * zoom + 2;
double document_height = (ur_y - ll_y) * zoom + 2;
ctx->draw(0, 0, document_width, document_height);
double width_backup = ctx->window_width;
double height_backup = ctx->window_height;
int nav_backup = ctx->no_nav;
ctx->window_width = (ur_x - ll_x) * zoom + 2;
ctx->window_height = (ur_y - ll_y) * zoom + 2;
ctx->no_nav = true;
ctx->set_dirty();
ctx->redraw_if_dirty();
double margin_y = GetPrintHeaderMargin(painter);
......@@ -1052,7 +1059,7 @@ static void PrintPage(QPainter* painter, const char* title, flow_tCtx ctx, QImag
QPen pen = QPen(QColor::fromRgbF(0, 0, 0));
pen.setWidthF(0.5);
painter->setPen(pen);
painter->drawLine(0, margin_y, document_width, margin_y);
painter->drawLine(0, margin_y, ctx->window_width, margin_y);
painter->setPen(tmpPen); // Restore pen
......@@ -1063,20 +1070,24 @@ static void PrintPage(QPainter* painter, const char* title, flow_tCtx ctx, QImag
if (page > 0) {
char page_str[40];
sprintf(page_str, "Page %d", page);
painter->drawText(document_width - fm.width(fl(page_str)), margin_y, fl(page_str));
painter->drawText(ctx->window_width - fm.width(fl(page_str)), margin_y, fl(page_str));
}
painter->drawText(document_width / 2.0 - fm.width(fl(title)) / 2.0, margin_y, fl(title));
painter->drawText(ctx->window_width / 2.0 - fm.width(fl(title)) / 2.0, margin_y, fl(title));
painter->setFont(tmpFont); // Restore font
painter->translate(0, margin_y);
painter->setClipRect(0, 0, document_width, document_height);
painter->setClipRect(0, 0, ctx->window_width, ctx->window_height);
painter->setClipping(true);
painter->drawImage(0, 0, *image);
painter->setClipping(false);
ctx->window_width = width_backup;
ctx->window_height = height_backup;
ctx->no_nav = nav_backup;
}
#include <assert.h>
......
This diff is collapsed.
......@@ -42,14 +42,21 @@
#include <gtk/gtk.h>
#include "flow_draw.h"
class DrawWind {
public:
GdkWindow* window = NULL;
GdkPixmap* buffer = NULL;
};
class FlowDrawGtk : public FlowDraw {
public:
GtkWidget* toplevel;
GtkWidget* nav_shell;
GtkWidget* nav_toplevel;
GdkDisplay* display;
GdkWindow* window;
GdkWindow* nav_window;
DrawWind m_wind;
DrawWind nav_wind;
DrawWind* w = NULL;
GdkScreen* screen;
GdkGC* gc;
GdkGC* gc_erase;
......@@ -73,122 +80,50 @@ public:
int (*init_proc)(GtkWidget* w, FlowCtx* ctx, void* client_data),
void* client_data, flow_eCtxType type);
~FlowDrawGtk();
int init_nav(GtkWidget* nav_widget, void* flow_ctx);
int event_handler(FlowCtx* ctx, GdkEvent event);
void init_nav(GtkWidget* nav_widget, void* flow_ctx);
void event_handler(FlowCtx* ctx, GdkEvent event);
void enable_event(FlowCtx* ctx, flow_eEvent event, flow_eEventType event_type,
int (*event_cb)(FlowCtx* ctx, flow_tEvent event));
void clear(FlowCtx* ctx);
void nav_clear(FlowCtx* ctx);
void create_buffer(DrawWind *wind);
void clear();
void get_window_size(DrawWind *wind, int* width, int* height);
void set_window_size(DrawWind *wind, int width, int height);
void get_window_size(FlowCtx* ctx, int* width, int* height);
void get_nav_window_size(FlowCtx* ctx, int* width, int* height);
void set_nav_window_size(FlowCtx* ctx, int width, int height);
int begin(DrawWind *wind);
void end();
int rect(FlowCtx* ctx, int x, int y, int width, int height,
flow_eDrawType gc_type, int idx, int highlight, int dimmed);
int rect_erase(FlowCtx* ctx, int x, int y, int width, int height, int idx);
int nav_rect(FlowCtx* ctx, int x, int y, int width, int height,
flow_eDrawType gc_type, int idx, int highlight);
int nav_rect_erase(
FlowCtx* ctx, int x, int y, int width, int height, int idx);
int triangle(FlowCtx* ctx, int x, int y, int width, int height,
flow_eDrawType gc_type, int idx, int highlight, int dimmed);
int triangle_erase(
FlowCtx* ctx, int x, int y, int width, int height, int idx);
int nav_triangle(FlowCtx* ctx, int x, int y, int width, int height,
flow_eDrawType gc_type, int idx, int highlight);
int nav_fill_triangle(FlowCtx* ctx, int x, int y, int width, int height,
flow_eDrawType gc_type);
int nav_triangle_erase(
FlowCtx* ctx, int x, int y, int width, int height, int idx);
int arrow(FlowCtx* ctx, int x1, int y1, int x2, int y2, int x3, int y3,
flow_eDrawType gc_type, int idx, int highlight);
int arrow_erase(
FlowCtx* ctx, int x1, int y1, int x2, int y2, int x3, int y3, int idx);
int nav_arrow(FlowCtx* ctx, int x1, int y1, int x2, int y2, int x3, int y3,
flow_eDrawType gc_type, int idx, int highlight);
int nav_arrow_erase(
FlowCtx* ctx, int x1, int y1, int x2, int y2, int x3, int y3, int idx);
int arc(FlowCtx* ctx, int x, int y, int width, int height, int angle1,
int angle2, flow_eDrawType gc_type, int idx, int highlight, int dimmed);
int arc_erase(FlowCtx* ctx, int x, int y, int width, int height, int angle1,
int angle2, int idx);
int nav_arc(FlowCtx* ctx, int x, int y, int width, int height, int angle1,
int angle2, flow_eDrawType gc_type, int idx, int highlight);
int nav_arc_erase(FlowCtx* ctx, int x, int y, int width, int height,
int angle1, int angle2, int idx);
int line(FlowCtx* ctx, int x1, int y1, int x2, int y2, flow_eDrawType gc_type,
int idx, int highlight, int dimmed);
int line_erase(FlowCtx* ctx, int x1, int y1, int x2, int y2, int idx);
int nav_line(FlowCtx* ctx, int x1, int y1, int x2, int y2,
flow_eDrawType gc_type, int idx, int highlight);
int nav_line_erase(FlowCtx* ctx, int x1, int y1, int x2, int y2, int idx);
int text(FlowCtx* ctx, int x, int y, char* text, int len,
flow_eDrawType gc_type, int idx, int highlight, int dimmed, int line,
double size);
int text_inverse(FlowCtx* ctx, int x, int y, char* text, int len,
flow_eDrawType gc_type, int idx, int line, double size);
int text_erase(FlowCtx* ctx, int x, int y, char* text, int len,
flow_eDrawType gc_type, int idx, int line, double size);
int nav_text(FlowCtx* ctx, int x, int y, char* text, int len,
flow_eDrawType gc_type, int idx, int highlight, int line, double size);
int nav_text_erase(FlowCtx* ctx, int x, int y, char* text, int len,
flow_eDrawType gc_type, int idx, int line, double size);
int fill_rect(FlowCtx* ctx, int x, int y, int width, int height,
flow_eDrawType gc_type);
int fill_triangle(FlowCtx* ctx, int x, int y, int width, int height,
flow_eDrawType gc_type);
int image(FlowCtx* ctx, int x, int y, int width, int height,
flow_tImImage image, flow_tPixmap pixmap, flow_tPixmap clip_mask);
int pixmaps_create(
FlowCtx* ctx, flow_sPixmapData* pixmap_data, void** pixmaps);
void pixmaps_delete(FlowCtx* ctx, void* pixmaps);
int pixmap(FlowCtx* ctx, int x, int y, flow_sPixmapData* pixmap_data,
void* pixmaps, flow_eDrawType gc_type, int idx, int highlight, int line);
int pixmap_inverse(FlowCtx* ctx, int x, int y, flow_sPixmapData* pixmap_data,
void* pixmaps, flow_eDrawType gc_type, int idx, int line);
int pixmap_erase(FlowCtx* ctx, int x, int y, flow_sPixmapData* pixmap_data,
void* pixmaps, flow_eDrawType gc_type, int idx, int line);
int nav_pixmap(FlowCtx* ctx, int x, int y, flow_sPixmapData* pixmap_data,
void* pixmaps, flow_eDrawType gc_type, int idx, int highlight, int line);
int nav_pixmap_erase(FlowCtx* ctx, int x, int y,
flow_sPixmapData* pixmap_data, void* pixmaps, flow_eDrawType gc_type,
int idx, int line);
void rect(int x, int y, int width, int height, flow_eDrawType gc_type,
int fill, int idx, int highlight = 0, int dimmed = 0);
void triangle(int x, int y, int width, int height, flow_eDrawType gc_type,
int fill, int idx, int highlight = 0, int dimmed = 0);
void arrow(int x1, int y1, int x2, int y2, int x3, int y3,
flow_eDrawType gc_type, int idx, int highlight = 0);
void arc(int x, int y, int width, int height, int angle1, int angle2,
flow_eDrawType gc_type, int idx, int highlight = 0, int dimmed = 0);
void line(int x1, int y1, int x2, int y2, flow_eDrawType gc_type, int idx,
int highlight = 0, int dimmed = 0);
void text(int x, int y, char* text, int len, flow_eDrawType gc_type, int idx,
double size, int highlight = 0, int dimmed = 0);
void image(int x, int y, int width, int height, flow_tImImage image,
flow_tPixmap pixmap, flow_tPixmap clip_mask);
void pixmaps_create(flow_sPixmapData* pixmap_data, void** pixmaps);
void pixmaps_delete(void* pixmaps);
void pixmap(int x, int y, flow_sPixmapData* pixmap_data, void* pixmaps,
flow_eDrawType gc_type, int idx);
void set_timer(FlowCtx* ctx, int time_ms, void (*callback_func)(FlowCtx* ctx),
void** id);
void cancel_timer(FlowCtx* ctx, void* id);
void set_cursor(FlowCtx* ctx, draw_eCursor cursor);
void set_nav_cursor(FlowCtx* ctx, draw_eCursor cursor);
int get_text_extent(FlowCtx* ctx, const char* text, int len,
flow_eDrawType gc_type, int idx, int* width, int* height, double size);
int create_input(FlowCtx* ctx, int x, int y, char* text, int len, int idx,
int width, int height, void* node, int number, void** data)
{
return 1;
}
int close_input(FlowCtx* ctx, void* data)
{
return 1;
}
int get_input(FlowCtx* ctx, void* data, char** text)
{
return 1;
}
void move_input(
FlowCtx* ctx, void* data, int x, int y, flow_ePosition pos_type)
{
}
void cancel_timer(void* id);
void set_cursor(DrawWind *wind, draw_eCursor cursor);
void get_text_extent(const char* text, int len, flow_eDrawType gc_type,
int idx, int* width, int* height, double size);
void delete_secondary_ctx(FlowCtx* ctx);
int create_secondary_ctx(FlowCtx* flow_ctx, void** secondary_flow_ctx,
void create_secondary_ctx(FlowCtx* flow_ctx, void** secondary_flow_ctx,
int (*init_proc)(FlowCtx*, void*), void* client_data, flow_eCtxType type);
int change_ctx(FlowCtx* from_ctx, FlowCtx* to_ctx);
void set_inputfocus(FlowCtx* ctx);
void set_click_sensitivity(FlowCtx* ctx, int value);
void set_image_clip_mask(FlowCtx* ctx, flow_tPixmap pixmap, int x, int y);
void reset_image_clip_mask(FlowCtx* ctx);
void set_white_background(FlowCtx* ctx);
int get_font_idx(int gc_type);
void change_ctx(FlowCtx* from_ctx, FlowCtx* to_ctx);
void set_click_sensitivity(int value);
void set_white_background();
int image_get_width(flow_tImImage image);
int image_get_height(flow_tImImage image);
void image_scale(float scale, flow_tImImage orig_im, flow_tImImage* im,
......@@ -197,15 +132,6 @@ public:
flow_tImImage* orig_im, flow_tImImage* im, flow_tPixmap* im_pixmap,
flow_tPixmap* im_mask, flow_tPixmap* im_nav_pixmap,
flow_tPixmap* im_nav_mask);
int text_pango(FlowCtx* ctx, int x, int y, char* text, int len,
flow_eDrawType gc_type, int idx, int highlight, int dimmed, int line,
double size);
int text_inverse_pango(FlowCtx* ctx, int x, int y, char* text, int len,
flow_eDrawType gc_type, int idx, int line, double size);
int text_erase_pango(FlowCtx* ctx, int x, int y, char* text, int len,
flow_eDrawType gc_type, int idx, int line, double size);
int get_text_extent_pango(FlowCtx* ctx, const char* text, int len,
flow_eDrawType gc_type, int idx, double size, int* width, int* height);
FlowPrintDraw* print_draw_new(void* context, const char* title, int page,
void* flow_ctx, int page_border, int* sts);
};
......
This diff is collapsed.
This diff is collapsed.
......@@ -248,7 +248,7 @@ void QtScrollWidgetFlow::handleEvent(QEvent* event)
FlowCtx* ctx = (FlowCtx*)parent_ctx;
FlowDrawQt* drawer = ((FlowDrawQt*)ctx->fdraw);
if (event->type() == QEvent::MouseMove) {
drawer->window->update();
drawer->m_wind.window->update();
}
drawer->event_handler((FlowCtx*)parent_ctx, event, this);
}
......
This diff is collapsed.
......@@ -52,7 +52,6 @@ public:
void zoom();
void nav_zoom();
void print_zoom();
void traverse(int x, int y);
void conpoint_select(void* pos, int x, int y, double* distance, void** cp){}
int event_handler(void* pos, flow_eEvent event, int x, int y, void* node);
void print(void* pos, void* node, int highlight);
......
......@@ -72,11 +72,6 @@ void FlowAnnotPixmap::print_zoom()
p.print_zoom();
}
void FlowAnnotPixmap::traverse(int x, int y)
{
p.traverse(x, y);
}
void FlowAnnotPixmap::print(void* pos, void* node, int highlight)
{
if (!((FlowNode*)node)->annotpixmapv[number])
......@@ -127,10 +122,10 @@ void FlowAnnotPixmap::draw(
((FlowNode*)node)->rel_annotpixmap_x[number] * ctx->zoom_factor));
} else
x = p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x;
ctx->fdraw->pixmap(ctx, x, p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
ctx->fdraw->pixmap(x, p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
&((FlowNode*)node)->annotpixmapv[number]->pixmap_data,
((FlowNode*)node)->annotpixmapv[number]->pixmaps, draw_type, idx,
highlight, 0);
((FlowNode*)node)->annotpixmapv[number]->pixmaps,
flow_eDrawType_LineErase, idx);
}
void FlowAnnotPixmap::draw_inverse(void* pos, int hot, void* node)
......@@ -150,11 +145,10 @@ void FlowAnnotPixmap::draw_inverse(void* pos, int hot, void* node)
((FlowNode*)node)->rel_annotpixmap_x[number] * ctx->zoom_factor));
} else
x = p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x;
ctx->fdraw->pixmap_inverse(ctx, x,
p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
ctx->fdraw->pixmap(x, p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
&((FlowNode*)node)->annotpixmapv[number]->pixmap_data,
((FlowNode*)node)->annotpixmapv[number]->pixmaps, ctx->inverse_color, idx,
0);
((FlowNode*)node)->annotpixmapv[number]->pixmaps, ctx->inverse_color,
idx);
}
void FlowAnnotPixmap::erase(void* pos, int hot, void* node)
......@@ -174,10 +168,10 @@ void FlowAnnotPixmap::erase(void* pos, int hot, void* node)
((FlowNode*)node)->rel_annotpixmap_x[number] * ctx->zoom_factor));
} else
x = p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x;
ctx->fdraw->pixmap_erase(ctx, x,
p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
&((FlowNode*)node)->annotpixmapv[number]->pixmap_data,
((FlowNode*)node)->annotpixmapv[number]->pixmaps, draw_type, idx, 0);
flow_sPixmapData* pixmap_data = &((FlowNode*)node)->annotpixmapv[number]->pixmap_data;
flow_sPixmapDataElem* pdata = (flow_sPixmapDataElem*)pixmap_data + idx;
ctx->fdraw->rect(x, p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
pdata->width, pdata->height, flow_eDrawType_LineErase, 1, 0);
}
void FlowAnnotPixmap::nav_draw(void* pos, int highlight, void* node)
......@@ -189,12 +183,10 @@ void FlowAnnotPixmap::nav_draw(void* pos, int highlight, void* node)
if (idx < 0)
return;
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->nav_pixmap(ctx,
p.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
ctx->fdraw->pixmap(p.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
p.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y,
&((FlowNode*)node)->annotpixmapv[number]->pixmap_data,
((FlowNode*)node)->annotpixmapv[number]->pixmaps, draw_type, idx,
highlight, 0);
((FlowNode*)node)->annotpixmapv[number]->pixmaps, draw_type, idx);
}
void FlowAnnotPixmap::nav_erase(void* pos, void* node)
......@@ -206,11 +198,11 @@ void FlowAnnotPixmap::nav_erase(void* pos, void* node)
if (idx < 0)
return;
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->nav_pixmap_erase(ctx,
p.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
flow_sPixmapData* pixmap_data = &((FlowNode*)node)->annotpixmapv[number]->pixmap_data;
flow_sPixmapDataElem* pdata = (flow_sPixmapDataElem*)pixmap_data + idx;
ctx->fdraw->rect(p.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
p.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y,
&((FlowNode*)node)->annotpixmapv[number]->pixmap_data,
((FlowNode*)node)->annotpixmapv[number]->pixmaps, draw_type, idx, 0);
pdata->width, pdata->height, flow_eDrawType_LineErase, 1, 0);
}
int FlowAnnotPixmap::event_handler(
......@@ -245,28 +237,21 @@ void FlowAnnotPixmap::get_borders(double pos_x, double pos_y, double* x_right,
void FlowAnnotPixmap::move(
void* pos, double x, double y, int highlight, int dimmed, int hot)
{
erase(pos, hot, NULL);
nav_erase(pos, NULL);
p.x = x;
p.y = y;
zoom();
nav_zoom();
draw(pos, highlight, dimmed, hot, NULL);
nav_draw(pos, highlight, NULL);
ctx->set_dirty();
}
void FlowAnnotPixmap::shift(void* pos, double delta_x, double delta_y,
int highlight, int dimmed, int hot)
{
erase(pos, hot, NULL);
nav_erase(pos, NULL);
p.x += delta_x;
p.y += delta_y;
zoom();
nav_zoom();
draw(pos, highlight, dimmed, hot, NULL);
nav_draw(pos, highlight, NULL);
ctx->set_dirty();
}
void FlowAnnotPixmap::configure_annotations(void* pos, void* node)
......@@ -298,11 +283,11 @@ void flow_annot_pixmap_create(
{
*pixmap = (flow_sAnnotPixmap*)calloc(1, sizeof(flow_sAnnotPixmap));
memcpy(&(*pixmap)->pixmap_data, pixmap_data, sizeof(flow_sPixmapData));
ctx->fdraw->pixmaps_create(ctx, pixmap_data, &(*pixmap)->pixmaps);
ctx->fdraw->pixmaps_create(pixmap_data, &(*pixmap)->pixmaps);
}
void flow_annot_pixmap_free(FlowCtx* ctx, flow_sAnnotPixmap* pixmap)
{
ctx->fdraw->pixmaps_delete(ctx, pixmap->pixmaps);
ctx->fdraw->pixmaps_delete(pixmap->pixmaps);
free(pixmap);
}
......@@ -50,7 +50,6 @@ public:
void zoom();
void nav_zoom();
void print_zoom();
void traverse(int x, int y);
int event_handler(void* pos, flow_eEvent event, int x, int y, void* node);
void conpoint_select(void* pos, int x, int y, double* distance, void** cp){}
void print(void* pos, void* node, int highlight);
......
......@@ -759,11 +759,6 @@ void flow_ResetNodraw(flow_tCtx ctx)
ctx->reset_nodraw();
}
void flow_Redraw(flow_tCtx ctx)
{
ctx->redraw();
}
int flow_FindByName(flow_tCtx ctx, char* name, flow_tObject* object)
{
return ctx->find_by_name(name, (FlowArrayElem**)object);
......@@ -787,7 +782,7 @@ int flow_GetConPoint(
void flow_SetClickSensitivity(flow_tCtx ctx, int value)
{
ctx->fdraw->set_click_sensitivity(ctx, value);
ctx->fdraw->set_click_sensitivity(value);
}
void flow_SetNoConObstacle(flow_tNodeClass nc, int no_obstacle)
......
......@@ -261,7 +261,6 @@ void flow_GetObjectName(flow_tObject object, char* name);
void flow_Reconfigure(flow_tCtx ctx);
void flow_SetNodraw(flow_tCtx ctx);
void flow_ResetNodraw(flow_tCtx ctx);
void flow_Redraw(flow_tCtx ctx);
int flow_FindByName(flow_tCtx ctx, char* name, flow_tObject* object);
int flow_FindByNameNoCase(flow_tCtx ctx, char* name, flow_tObject* object);
FlowTraceAttr flow_GetConPointTraceAttr(flow_tObject object, int num);
......
......@@ -56,12 +56,6 @@ void FlowArc::print_zoom()
ur.print_zoom();
}
void FlowArc::traverse(int x, int y)
{
ll.traverse(x, y);
ur.traverse(x, y);
}
void FlowArc::print(void* pos, void* node, int highlight)
{
double idx = ctx->print_zoom_factor / ctx->base_zoom_factor * line_width;
......@@ -135,7 +129,7 @@ void FlowArc::draw(void* pos, int highlight, int dimmed, int hot, void* node)
idx += hot;
idx = MAX(0, idx);
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->arc(ctx, ll.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
ctx->fdraw->arc(ll.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
ll.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y, ur.z_x - ll.z_x,
ur.z_y - ll.z_y, angle1, angle2, draw_type, idx, highlight, dimmed);
}
......@@ -146,9 +140,9 @@ void FlowArc::erase(void* pos, int hot, void* node)
idx += hot;
idx = MAX(0, idx);
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->arc_erase(ctx, ll.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
ctx->fdraw->arc(ll.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
ll.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y, ur.z_x - ll.z_x,
ur.z_y - ll.z_y, angle1, angle2, idx);
ur.z_y - ll.z_y, angle1, angle2, flow_eDrawType_LineErase, idx);
}
void FlowArc::nav_draw(void* pos, int highlight, void* node)
......@@ -156,8 +150,7 @@ void FlowArc::nav_draw(void* pos, int highlight, void* node)
int idx = int(ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx = MAX(0, idx);
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->nav_arc(ctx,
ll.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
ctx->fdraw->arc(ll.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
ll.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y,
ur.nav_z_x - ll.nav_z_x, ur.nav_z_y - ll.nav_z_y, angle1, angle2,
draw_type, idx, highlight);
......@@ -168,10 +161,10 @@ void FlowArc::nav_erase(void* pos, void* node)
int idx = int(ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx = MAX(0, idx);
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->nav_arc_erase(ctx,
ll.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
ctx->fdraw->arc(ll.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
ll.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y,
ur.nav_z_x - ll.nav_z_x, ur.nav_z_y - ll.nav_z_y, angle1, angle2, idx);
ur.nav_z_x - ll.nav_z_x, ur.nav_z_y - ll.nav_z_y, angle1, angle2,
flow_eDrawType_LineErase, idx);
}
int FlowArc::event_handler(
......@@ -205,8 +198,6 @@ void FlowArc::get_borders(double pos_x, double pos_y, double* x_right,
void FlowArc::move(void* pos, double x1, double y1, double x2, double y2,
int ang1, int ang2, int highlight, int dimmed, int hot)
{
erase(pos, hot, NULL);
nav_erase(pos, NULL);
ll.x = x1;
ll.y = y1;
ur.x = x2;
......@@ -215,24 +206,19 @@ void FlowArc::move(void* pos, double x1, double y1, double x2, double y2,
angle2 = ang2;
zoom();
nav_zoom();
draw(pos, highlight, dimmed, hot, NULL);
nav_draw(pos, highlight, NULL);
ctx->set_dirty();
}
void FlowArc::shift(void* pos, double delta_x, double delta_y, int highlight,
int dimmed, int hot)
{
erase(pos, hot, NULL);
nav_erase(pos, NULL);
ll.x += delta_x;
ll.y += delta_y;
ur.x += delta_x;
ur.y += delta_y;
zoom();
nav_zoom();
draw(pos, highlight, dimmed, hot, NULL);
nav_draw(pos, highlight, NULL);
ctx->set_dirty();
}
std::ostream& operator<<(std::ostream& o, const FlowArc a)
......
......@@ -51,7 +51,6 @@ public:
void zoom();
void nav_zoom();
void print_zoom();
void traverse(int x, int y);
int event_handler(void* pos, flow_eEvent event, int x, int y, void* node);
void conpoint_select(void* pos, int x, int y, double* distance, void** cp){}
void print(void* pos, void* node, int highlight);
......
This diff is collapsed.
......@@ -72,7 +72,6 @@ public:
void draw_inverse(void* pos, int hot, void* node);
void nav_draw(void* pos, int highlight, void* node);
void nav_erase(void* pos, void* node);
void traverse(int x, int y);
void get_borders(
double* x_right, double* x_left, double* y_high, double* y_low);
void get_borders();
......@@ -92,7 +91,6 @@ public:
void move(int delta_x, int delta_y, int grid);
void move_noerase(int delta_x, int delta_y, int grid);
void conpoint_refcon_redraw(void* node, int conpoint);
void conpoint_refcon_erase(void* node, int conpoint);
void set_inverse(int on);
void configure();
int brow_insert(
......
......@@ -48,10 +48,6 @@ void FlowArrayElem::print_zoom()
{
}
void FlowArrayElem::traverse(int x, int y)
{
}
void FlowArrayElem::get_borders(
double* x_right, double* x_left, double* y_high, double* y_low)
{
......@@ -224,14 +220,6 @@ int FlowArrayElem::in_horiz_line(double y, double l_x, double u_x)
return 0;
}
void FlowArrayElem::conpoint_refcon_redraw(void* node, int conpoint)
{
}
void FlowArrayElem::conpoint_refcon_erase(void* node, int conpoint)
{
}
void FlowArrayElem::remove_notify()
{
}
......
......@@ -54,7 +54,6 @@ public:
virtual void zoom();
virtual void nav_zoom();
virtual void print_zoom();
virtual void traverse(int x, int y);
virtual void get_borders(
double* x_right, double* x_left, double* y_high, double* y_low);
virtual void get_borders(double pos_x, double pos_y, double* x_right,
......@@ -99,8 +98,7 @@ public:
virtual int in_area_exact(double ll_x, double ll_y, double ur_x, double ur_y);
virtual int in_vert_line(double x, double l_y, double u_y);
virtual int in_horiz_line(double y, double l_x, double u_x);
virtual void conpoint_refcon_redraw(void* node, int conpoint);
virtual void conpoint_refcon_erase(void* node, int conpoint);
virtual void conpoint_refcon_redraw(void* node, int conpoint) {}
virtual void remove_notify();
virtual void set_user_data(void* data);
virtual void get_user_data(void** data);
......
......@@ -104,13 +104,6 @@ void FlowArrow::print_zoom()
p2.print_zoom();
}
void FlowArrow::traverse(int x, int y)
{
p_dest.traverse(x, y);
p1.traverse(x, y);
p2.traverse(x, y);
}
void FlowArrow::print(void* pos, void* node, int highlight)
{
double idx = ctx->print_zoom_factor / ctx->base_zoom_factor * line_width;
......@@ -192,7 +185,7 @@ void FlowArrow::draw(void* pos, int highlight, int dimmed, int hot, void* node)
idx += hot;
idx = MAX(0, idx);
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->arrow(ctx, p_dest.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
ctx->fdraw->arrow(p_dest.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
p_dest.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
p1.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
p1.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
......@@ -207,13 +200,13 @@ void FlowArrow::erase(void* pos, int hot, void* node)
idx += hot;
idx = MAX(0, idx);
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->arrow_erase(ctx,
p_dest.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
ctx->fdraw->arrow(p_dest.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
p_dest.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
p1.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
p1.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
p2.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
p2.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y, idx);
p2.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
flow_eDrawType_LineErase, idx);
}
void FlowArrow::nav_draw(void* pos, int highlight, void* node)
......@@ -221,7 +214,7 @@ void FlowArrow::nav_draw(void* pos, int highlight, void* node)
int idx = int(ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx = MAX(0, idx);
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->nav_arrow(ctx,
ctx->fdraw->arrow(
p_dest.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
p_dest.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y,
p1.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
......@@ -236,21 +229,19 @@ void FlowArrow::nav_erase(void* pos, void* node)
int idx = int(ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx = MAX(0, idx);
idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->nav_arrow_erase(ctx,
ctx->fdraw->arrow(
p_dest.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
p_dest.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y,
p1.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
p1.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y,
p2.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
p2.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y, idx);
p2.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y,
flow_eDrawType_LineErase, idx);
}
void FlowArrow::move(void* pos, double x1, double y1, double x2, double y2,
int highlight, int dimmed, int hot)
{
erase(pos, hot, NULL);
nav_erase(pos, NULL);
if (fabs(x2 - x1) < DBL_EPSILON) {
if (y1 > y2) {
p1.x = x2 + arrow_width / 2;
......@@ -286,15 +277,12 @@ void FlowArrow::move(void* pos, double x1, double y1, double x2, double y2,
p_dest.y = y2;
zoom();
nav_zoom();
draw(pos, highlight, dimmed, hot, NULL);
nav_draw(pos, highlight, NULL);
ctx->set_dirty();
}
void FlowArrow::shift(void* pos, double delta_x, double delta_y, int highlight,
int dimmed, int hot)
{
erase(pos, hot, NULL);
nav_erase(pos, NULL);
p_dest.x += delta_x;
p_dest.y += delta_y;
p1.x += delta_x;
......@@ -303,9 +291,7 @@ void FlowArrow::shift(void* pos, double delta_x, double delta_y, int highlight,
p2.y += delta_y;
zoom();
nav_zoom();
draw(pos, highlight, dimmed, hot, NULL);
nav_draw(pos, highlight, NULL);
ctx->set_dirty();
}
int FlowArrow::event_handler(
......
......@@ -46,7 +46,6 @@ public:
void zoom();
void nav_zoom();
void print_zoom();
void traverse(int x, int y);
int event_handler(void* pos, flow_eEvent event, int x, int y, void* node);
void conpoint_select(void* pos, int x, int y, double* distance, void** cp){}
void print(void* pos, void* node, int highlight);
......
......@@ -852,11 +852,11 @@ int brow_Page(brow_tCtx ctx, double factor)
return ctx->page(factor);
}
extern "C" int brow_CreateSecondaryCtx(brow_tCtx ctx, brow_tCtx* secondary_ctx,
extern "C" void brow_CreateSecondaryCtx(brow_tCtx ctx, brow_tCtx* secondary_ctx,
int (*init_proc)(brow_tCtx ctx, void* client_data), void* client_data,
flow_eCtxType type)
{
return ctx->fdraw->create_secondary_ctx((FlowCtx*)ctx, (void**)secondary_ctx,
ctx->fdraw->create_secondary_ctx((FlowCtx*)ctx, (void**)secondary_ctx,
(int (*)(FlowCtx*, void*))init_proc, client_data, type);
}
......@@ -865,24 +865,19 @@ void brow_DeleteSecondaryCtx(brow_tCtx ctx)
ctx->fdraw->delete_secondary_ctx((FlowCtx*)ctx);
}
int brow_ChangeCtx(brow_tCtx from_ctx, brow_tCtx to_ctx)
void brow_ChangeCtx(brow_tCtx from_ctx, brow_tCtx to_ctx)
{
return from_ctx->fdraw->change_ctx((FlowCtx*)from_ctx, (FlowCtx*)to_ctx);
}
void brow_SetInputFocus(brow_tCtx ctx)
{
ctx->fdraw->set_inputfocus((FlowCtx*)ctx);
from_ctx->fdraw->change_ctx((FlowCtx*)from_ctx, (FlowCtx*)to_ctx);
}
void brow_SetClickSensitivity(brow_tCtx ctx, int value)
{
ctx->fdraw->set_click_sensitivity((FlowCtx*)ctx, value);
ctx->fdraw->set_click_sensitivity(value);
}
void brow_SetWhiteBackground(brow_tCtx ctx)
{
ctx->fdraw->set_white_background((FlowCtx*)ctx);
ctx->fdraw->set_white_background();
}
void brow_SetFillColor(brow_tNode node, flow_eDrawType color)
......
......@@ -244,12 +244,11 @@ int brow_IsVisible(brow_tCtx ctx, brow_tObject object, flow_eVisible type);
int brow_GetFirstVisible(brow_tCtx ctx, brow_tObject* object);
int brow_GetLastVisible(brow_tCtx ctx, brow_tObject* object);
int brow_Page(brow_tCtx ctx, double factor);
int brow_CreateSecondaryCtx(brow_tCtx ctx, brow_tCtx* secondary_ctx,
void brow_CreateSecondaryCtx(brow_tCtx ctx, brow_tCtx* secondary_ctx,
int (*init_proc)(brow_tCtx ctx, void* client_data), void* client_data,
flow_eCtxType type);
void brow_DeleteSecondaryCtx(brow_tCtx ctx);
int brow_ChangeCtx(brow_tCtx from_ctx, brow_tCtx to_ctx);
void brow_SetInputFocus(brow_tCtx ctx);
void brow_ChangeCtx(brow_tCtx from_ctx, brow_tCtx to_ctx);
void brow_SetClickSensitivity(brow_tCtx ctx, int value);
void brow_SetWhiteBackground(brow_tCtx ctx);
void brow_SetFillColor(brow_tNode node, flow_eDrawType color);
......
......@@ -80,12 +80,12 @@ void BrowCtx::configure()
if (nodraw)
return;
fdraw->get_window_size(this, &window_width, &window_height);
fdraw->get_window_size(mw, &window_width, &window_height);
a.configure();
get_borders();
frame_x_right = MAX(x_right, 1.0 * (window_width + offset_x) / zoom_factor);
a.zoom();
redraw();
set_dirty();
change_scrollbar();
}
......@@ -116,14 +116,6 @@ void BrowCtx::change_scrollbar()
(scroll_callback)(&data);
}
void BrowCtx::redraw()
{
fdraw->get_window_size(this, &window_width, &window_height);
clear();
draw(0, 0, window_width, window_height);
nav_zoom();
}
void BrowCtx::zoom(double factor)
{
if (fabs(factor) < DBL_EPSILON)
......@@ -143,11 +135,10 @@ void BrowCtx::zoom(double factor)
if ((y_high - y_low) * zoom_factor <= window_height)
offset_y = 0;
a.zoom();
clear();
draw(0, 0, window_width, window_height);
nav_zoom();
a_nc.zoom(); // Zoom inactive nodeclasses
change_scrollbar();
set_dirty();
}
int BrowCtx::print(char* filename)
......@@ -400,7 +391,6 @@ void BrowCtx::zoom_absolute(double factor)
zoom_factor = factor;
a.zoom();
clear();
draw(0, 0, window_width, window_height);
nav_zoom();
set_dirty();
}
......@@ -53,7 +53,6 @@ public:
void remove(FlowArrayElem* element);
void configure();
void change_scrollbar();
void redraw();
void zoom(double factor);
void unzoom()
{
......
This diff is collapsed.
......@@ -73,10 +73,6 @@ public:
void zoom();
void nav_zoom();
void print_zoom();
void traverse(int x, int y)
{
line_a.traverse(x, y);
}
void get_borders(
double* x1_right, double* x1_left, double* y1_high, double* y1_low){}
void get_con_borders();
......@@ -101,9 +97,6 @@ public:
double dest_x, double dest_y, flow_eDirection dest_dir);
int con_route_grafcet(flow_eConType con_type, double src_x, double src_y,
double dest_x, double dest_y);
void draw_routed_roundcorner(int points, double* x, double* y);
void draw_routed(int points, double* x, double* y);
void draw_routed_trans(int points, double* x, double* y);
void set_highlight(int on);
int get_highlight()
{
......@@ -217,7 +210,6 @@ public:
double src_x, double src_y, flow_eDirection src_dir);
void move_ref(double x1, double y1, double x2, double y2);
void conpoint_refcon_redraw(void* node, int conpoint);
void conpoint_refcon_erase(void* node, int conpoint);
void remove_notify();
int ideal_line_cnt;
int current_line_cnt;
......
......@@ -49,7 +49,6 @@ public:
void zoom(){}
void nav_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,
double* y_high, double* y_low, void* node){}
int event_handler(void* pos, flow_eEvent event, int x, int y, void* node)
......
......@@ -122,11 +122,6 @@ void FlowConPoint::open(std::ifstream& fp)
}
}
void FlowConPoint::traverse(int x, int y)
{
p.traverse(x, y);
}
int FlowConPoint::event_handler(
void* pos, flow_eEvent event, int x, int y, void* node)
{
......@@ -211,8 +206,7 @@ void FlowConPoint::draw(
x = p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x - size / 2;
y = p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y - size / 2;
}
ctx->fdraw->arc(
ctx, x, y, size, size, 0, 360, flow_eDrawType_LineRed, idx, 0, 0);
ctx->fdraw->arc(x, y, size, size, 0, 360, flow_eDrawType_LineRed, idx, 0, 0);
}
}
......@@ -249,7 +243,7 @@ void FlowConPoint::erase(void* pos, int hot, void* node)
x = p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x - size / 2;
y = p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y - size / 2;
}
ctx->fdraw->arc_erase(ctx, x, y, size, size, 0, 360, idx);
ctx->fdraw->arc(x, y, size, size, 0, 360, flow_eDrawType_LineErase, idx);
}
}
......
......@@ -47,7 +47,6 @@ public:
void zoom();
void nav_zoom();
void print_zoom();
void traverse(int x, int y);
int event_handler(void* pos, flow_eEvent event, int x, int y, void* node);
void conpoint_select(void* pos, int x, int y, double* distance, void** cp);
void print(void* pos, void* node){}
......
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.
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