Commit 6c2cbe2e authored by claes's avatar claes

Fill color on node added, and darkgray color

parent 0448a367
/*
* Proview $Id: flow_draw_gtk.cpp,v 1.8 2007-04-26 12:41:03 claes Exp $
* Proview $Id: flow_draw_gtk.cpp,v 1.9 2007-05-11 15:07:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -120,6 +120,7 @@ static int draw_free_gc( FlowDrawGtk *draw_ctx)
gdk_gc_unref( draw_ctx->gc_yellow);
gdk_gc_unref( draw_ctx->gc_green);
gdk_gc_unref( draw_ctx->gc_darkgray);
gdk_gc_unref( draw_ctx->gc_inverse);
for ( i = 0; i < flow_eDrawType__; i++) {
for ( j = 0; j < DRAW_TYPE_SIZE; j++)
......@@ -160,6 +161,12 @@ static int flow_create_gc( FlowDrawGtk *draw_ctx, GdkWindow *window)
draw_ctx->gc_green = gdk_gc_new_with_values(
window, &xgcv, (GdkGCValuesMask)(GDK_GC_FOREGROUND | GDK_GC_BACKGROUND));
/* DarkGray gc */
xgcv.foreground = flow_allocate_color( draw_ctx, "gray28");
xgcv.background = draw_ctx->background;
draw_ctx->gc_darkgray = gdk_gc_new_with_values(
window, &xgcv, (GdkGCValuesMask)(GDK_GC_FOREGROUND | GDK_GC_BACKGROUND));
/* Black line gc */
xgcv.foreground = draw_ctx->foreground;
xgcv.background = draw_ctx->background;
......@@ -1309,6 +1316,8 @@ int FlowDrawGtk::fill_rect( FlowCtx *ctx, int x, int y, int w, int h,
gdk_draw_rectangle( window, gc_green, 1, x, y, w, h);
else if ( gc_type == flow_eDrawType_Yellow)
gdk_draw_rectangle( window, gc_yellow, 1, x, y, w, h);
else if ( gc_type == flow_eDrawType_DarkGray)
gdk_draw_rectangle( window, gc_darkgray, 1, x, y, w, h);
else
gdk_draw_rectangle( window, gcs[gc_type][0], 1, x, y, w, h);
return 1;
......
/*
* Proview $Id: flow_draw_gtk.h,v 1.2 2007-01-11 11:40:30 claes Exp $
* Proview $Id: flow_draw_gtk.h,v 1.3 2007-05-11 15:07:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -39,6 +39,7 @@ class FlowDrawGtk : public FlowDraw {
GdkGC *gc_inverse;
GdkGC *gc_yellow;
GdkGC *gc_green;
GdkGC *gc_darkgray;
GdkGC *gcs[flow_eDrawType__][DRAW_TYPE_SIZE];
// XFontStruct *font_struct[draw_eFont__][DRAW_FONT_SIZE];
GdkFont *font[draw_eFont__][DRAW_FONT_SIZE];
......
/*
* Proview $Id: flow_draw_xlib.cpp,v 1.1 2007-01-04 07:57:00 claes Exp $
* Proview $Id: flow_draw_xlib.cpp,v 1.2 2007-05-11 15:07:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -139,6 +139,7 @@ static int draw_free_gc( FlowDrawXLib *draw_ctx)
XFreeGC( draw_ctx->display, draw_ctx->gc_yellow);
XFreeGC( draw_ctx->display, draw_ctx->gc_green);
XFreeGC( draw_ctx->display, draw_ctx->gc_drarkgray);
XFreeGC( draw_ctx->display, draw_ctx->gc_inverse);
for ( i = 0; i < flow_eDrawType__; i++)
{
......@@ -181,6 +182,12 @@ static int flow_create_gc( FlowDrawXLib *draw_ctx, Window window)
draw_ctx->gc_green = XCreateGC( draw_ctx->display,
window, GCForeground | GCBackground, &xgcv);
/* DarkGray gc */
xgcv.foreground = flow_allocate_color( draw_ctx, "gray20");
xgcv.background = draw_ctx->background;
draw_ctx->gc_darkgray = XCreateGC( draw_ctx->display,
window, GCForeground | GCBackground, &xgcv);
/* Black line gc */
xgcv.foreground = XBlackPixelOfScreen(draw_ctx->screen);
xgcv.background = draw_ctx->background;
......@@ -1292,6 +1299,9 @@ int FlowDrawXLib::fill_rect( FlowCtx *ctx, int x, int y, int w, int h,
else if ( gc_type == flow_eDrawType_Yellow)
XFillPolygon( display, window,
gc_yellow, p, 5, Convex, CoordModeOrigin);
else if ( gc_type == flow_eDrawType_DarkGray)
XFillPolygon( display, window,
gc_darkgray, p, 5, Convex, CoordModeOrigin);
else
XFillPolygon( display, window,
gcs[gc_type][0], p, 5, Convex, CoordModeOrigin);
......
/*
* Proview $Id: flow_draw_xlib.h,v 1.1 2007-01-04 07:57:00 claes Exp $
* Proview $Id: flow_draw_xlib.h,v 1.2 2007-05-11 15:07:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -67,6 +67,7 @@ class FlowDrawXLib : public FlowDraw {
GC gc_inverse;
GC gc_yellow;
GC gc_green;
GC gc_darkgray;
GC gcs[flow_eDrawType__][DRAW_TYPE_SIZE];
XFontStruct *font_struct[draw_eFont__][DRAW_FONT_SIZE];
Font font[draw_eFont__][DRAW_FONT_SIZE];
......
/*
* Proview $Id: flow.h,v 1.11 2007-01-04 07:53:34 claes Exp $
* Proview $Id: flow.h,v 1.12 2007-05-11 15:07:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -151,7 +151,9 @@ typedef enum {
flow_eDrawType_TextHelveticaEraseBold,
flow_eDrawType__,
flow_eDrawType_Green,
flow_eDrawType_Yellow
flow_eDrawType_Yellow,
flow_eDrawType_DarkGray,
flow_eDrawType_Inherit = 9999
} flow_eDrawType;
typedef enum {
......
/*
* Proview $Id: flow_browapi.cpp,v 1.9 2007-01-04 07:53:34 claes Exp $
* Proview $Id: flow_browapi.cpp,v 1.10 2007-05-11 15:07:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -750,3 +750,8 @@ void brow_SetWhiteBackground( brow_tCtx ctx)
{
ctx->fdraw->set_white_background( (FlowCtx *)ctx);
}
void brow_SetFillColor( brow_tNode node, flow_eDrawType color)
{
((FlowNode *)node)->set_fillcolor( color);
}
/*
* Proview $Id: flow_browapi.h,v 1.9 2007-01-04 07:53:34 claes Exp $
* Proview $Id: flow_browapi.h,v 1.10 2007-05-11 15:07:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -235,6 +235,7 @@ int brow_ChangeCtx( brow_tCtx from_ctx, brow_tCtx to_ctx);
void brow_SetInputFocus( brow_tCtx ctx);
void brow_SetClickSensitivity( brow_tCtx ctx, int value);
void brow_SetWhiteBackground( brow_tCtx ctx);
void brow_SetFillColor( brow_tNode node, flow_eDrawType color);
#if defined __cplusplus
}
......
/*
* Proview $Id: flow_node.cpp,v 1.8 2007-01-04 07:53:35 claes Exp $
* Proview $Id: flow_node.cpp,v 1.9 2007-05-11 15:07:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -39,7 +39,8 @@ FlowNode::FlowNode( FlowCtx *flow_ctx, char *name, FlowNodeClass *node_class,
highlight(0), inverse(0), trace_attr_type(flow_eTraceType_Boolean),
trace_inverted(0), trace_p(NULL), user_data(0),
level(0), node_open(0),
relative_annot_pos(rel_annot_pos), relative_annot_x(0)
relative_annot_pos(rel_annot_pos), relative_annot_x(0),
fill_color(flow_eDrawType_Inherit)
{
double x_grid, y_grid;
strncpy( n_name, name, sizeof(n_name));
......@@ -986,3 +987,16 @@ void FlowNode::get_borders()
obst_y_high = y_high;
}
}
void FlowNode::set_fillcolor( flow_eDrawType color)
{
fill_color = color;
ctx->draw( int(x_left * ctx->zoom_factor - ctx->offset_x - 20),
int(y_low * ctx->zoom_factor - ctx->offset_y - 20),
int(x_right * ctx->zoom_factor - ctx->offset_x + 20),
int(y_high * ctx->zoom_factor - ctx->offset_y + 20));
ctx->nav_draw( int(x_left * ctx->nav_zoom_factor - ctx->nav_offset_x - 1),
int(y_low * ctx->nav_zoom_factor - ctx->nav_offset_y - 1),
int(x_right * ctx->nav_zoom_factor - ctx->nav_offset_x + 1),
int(y_high * ctx->nav_zoom_factor - ctx->nav_offset_y + 1));
}
/*
* Proview $Id: flow_node.h,v 1.4 2005-10-21 16:11:22 claes Exp $
* Proview $Id: flow_node.h,v 1.5 2007-05-11 15:07:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -166,6 +166,8 @@ class FlowNode : public FlowArrayElem {
void get_radiobutton( int num, int *value);
int get_conpoint_trace_attr( int num, char *trace_attr, flow_eTraceType *type)
{ return nc->get_conpoint_trace_attr( num, trace_attr, type);};
void set_fillcolor( flow_eDrawType color);
int level;
int node_open;
int relative_annot_pos;
......@@ -175,6 +177,7 @@ class FlowNode : public FlowArrayElem {
int annotv_inputmode[10];
void *annotv_input[10];
int rbuttonv[10];
flow_eDrawType fill_color;
};
#endif
/*
* Proview $Id: flow_rect.cpp,v 1.6 2007-01-04 07:53:35 claes Exp $
* Proview $Id: flow_rect.cpp,v 1.7 2007-05-11 15:07:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -23,6 +23,7 @@
#include <iostream.h>
#include "flow_rect.h"
#include "flow_draw.h"
#include "flow_node.h"
void FlowRect::zoom()
{
......@@ -112,6 +113,19 @@ void FlowRect::open( ifstream& fp)
}
}
void FlowRect::draw_inverse( void *pos, int hot, void *node)
{
if ( fill &&
( draw_type == flow_eDrawType_LineGray ||
draw_type == flow_eDrawType_LineRed ||
draw_type == flow_eDrawType_Green ||
draw_type == flow_eDrawType_DarkGray ||
draw_type == flow_eDrawType_Yellow))
draw( pos, hot, 0, node);
else
erase( pos, hot, node);
}
void FlowRect::draw( void *pos, int highlight, int hot, void *node)
{
if ( !(display_level & ctx->display_level))
......@@ -138,10 +152,16 @@ void FlowRect::draw( void *pos, int highlight, int hot, void *node)
ctx->fdraw->rect( ctx, 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, draw_type, idx, highlight);
else
else {
flow_eDrawType dtype;
if ( node && ((FlowNode *)node)->fill_color != flow_eDrawType_Inherit)
dtype = ((FlowNode *)node)->fill_color;
else
dtype = draw_type;
ctx->fdraw->fill_rect( ctx, 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, draw_type);
ur.z_x - ll.z_x, ur.z_y - ll.z_y, dtype);
}
}
void FlowRect::erase( void *pos, int hot, void *node)
......
/*
* Proview $Id: flow_rect.h,v 1.3 2005-09-01 14:56:12 claes Exp $
* Proview $Id: flow_rect.h,v 1.4 2007-05-11 15:07:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -51,8 +51,7 @@ class FlowRect : public FlowArrayElem {
void open( ifstream& fp);
void draw( void *pos, int hightlight, int hot, void *node);
void nav_draw( void *pos, int highlight, void *node);
void draw_inverse( void *pos, int hot, void *node)
{ erase( pos, hot, node);};
void draw_inverse( void *pos, int hot, void *node);
void erase( void *pos, int hot, void *node);
void nav_erase( void *pos, void *node);
void get_borders( double pos_x, double pos_y, double *x_right,
......
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