Commit 90dae3ab authored by Claes Sjofors's avatar Claes Sjofors

Flow alloc color problem fixed

parent b2fceed0
...@@ -196,3 +196,4 @@ ...@@ -196,3 +196,4 @@
110120 cs ge wb_ge, execution of wtt initfile to get history log enable/disable setup added. 110120 cs ge wb_ge, execution of wtt initfile to get history log enable/disable setup added.
110121 cs xtt Languages zh_cn and fr_fr added. 110121 cs xtt Languages zh_cn and fr_fr added.
110121 rk rtmon Runtime Monitor, problem with restart timeout fixed. 110121 rk rtmon Runtime Monitor, problem with restart timeout fixed.
110202 cs flow Color alloc problem fixed.
...@@ -295,19 +295,34 @@ static GdkColor flow_allocate_color( FlowDrawGtk *draw_ctx, const char *named_co ...@@ -295,19 +295,34 @@ static GdkColor flow_allocate_color( FlowDrawGtk *draw_ctx, const char *named_co
{ {
GdkColor color; GdkColor color;
if ( draw_ctx->color_vect_cnt >= (int)(sizeof(draw_ctx->color_vect)/sizeof(draw_ctx->color_vect[0]))) { if ( draw_ctx->color_vect_cnt == 0) {
printf( "Flow allocate color error: max number of colors exceeded\n"); gdk_color_parse( "black", &draw_ctx->color_vect[0]);
return draw_ctx->color_vect[0]; gdk_colormap_alloc_color( draw_ctx->colormap, &draw_ctx->color_vect[0], FALSE, TRUE);
gdk_color_parse( "white", &draw_ctx->color_vect[1]);
gdk_colormap_alloc_color( draw_ctx->colormap, &draw_ctx->color_vect[1], FALSE, TRUE);
draw_ctx->color_vect_cnt = 2;
} }
if ( !gdk_color_parse( named_color, &color)) if ( strcmp( named_color, "black") == 0)
gdk_color_parse( "black", &color); return draw_ctx->color_vect[0];
gdk_colormap_alloc_color( draw_ctx->colormap, &color, FALSE, TRUE); else if ( strcmp( named_color, "white") == 0)
return draw_ctx->color_vect[1];
else {
if ( draw_ctx->color_vect_cnt >= (int)(sizeof(draw_ctx->color_vect)/sizeof(draw_ctx->color_vect[0]))) {
printf( "Flow allocate color error: max number of colors exceeded\n");
return draw_ctx->color_vect[0];
}
if ( !gdk_color_parse( named_color, &color))
gdk_color_parse( "black", &color);
gdk_colormap_alloc_color( draw_ctx->colormap, &color, FALSE, TRUE);
draw_ctx->color_vect[draw_ctx->color_vect_cnt] = color; draw_ctx->color_vect[draw_ctx->color_vect_cnt] = color;
draw_ctx->color_vect_cnt++; draw_ctx->color_vect_cnt++;
return color; return color;
}
} }
FlowDrawGtk::~FlowDrawGtk() FlowDrawGtk::~FlowDrawGtk()
......
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