Skip to content

Commit db97c73

Browse files
committed
config, main: print options of FRAME tool, add transparent to default colors
1 parent 9deeb9e commit db97c73

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

src/config.c

+7-8
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ gboolean parse_config (GromitData *data)
294294
xlength = 0;
295295
ylength = 0;
296296
fg_color = data->red;
297-
fill_color = NULL;
297+
fill_color = data->transparent;
298298

299299
if (token == G_TOKEN_SYMBOL)
300300
{
@@ -345,7 +345,6 @@ gboolean parse_config (GromitData *data)
345345
if (token == G_TOKEN_LEFT_PAREN)
346346
{
347347
GdkRGBA *color = NULL;
348-
GdkRGBA *fillcolor = NULL;
349348
g_scanner_set_scope (scanner, 2);
350349
scanner->config->int_2_float = 1;
351350
token = g_scanner_get_next_token (scanner);
@@ -487,22 +486,22 @@ gboolean parse_config (GromitData *data)
487486
token = g_scanner_get_next_token (scanner);
488487
if (token != G_TOKEN_STRING)
489488
{
490-
g_printerr ("Missing Fillcolor (string)... "
489+
g_printerr ("Missing fillcolor (string)... "
491490
"aborting\n");
492491
goto cleanup;
493492
}
494-
fillcolor = g_malloc (sizeof (GdkRGBA));
495-
if (gdk_rgba_parse (fillcolor, scanner->value.v_string))
493+
color = g_malloc (sizeof (GdkRGBA));
494+
if (gdk_rgba_parse (color, scanner->value.v_string))
496495
{
497-
fill_color = fillcolor;
496+
fill_color = color;
498497
}
499498
else
500499
{
501500
g_printerr ("Unable to parse fillcolor. "
502501
"Keeping default.\n");
503-
g_free (fillcolor);
502+
g_free (color);
504503
}
505-
fillcolor = NULL;
504+
color = NULL;
506505
}
507506
else
508507
{

src/main.c

+12-5
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void paint_context_print (gchar *name,
108108
case GROMIT_RECT:
109109
g_printerr ("Rect, "); break;
110110
case GROMIT_FRAME:
111-
g_printerr ("Frame, "); break;
111+
g_printerr ("Frame, "); break;
112112
case GROMIT_SMOOTH:
113113
g_printerr ("Smooth, "); break;
114114
case GROMIT_ORTHOGONAL:
@@ -139,7 +139,7 @@ void paint_context_print (gchar *name,
139139
break;
140140
}
141141
}
142-
if (context->type == GROMIT_SMOOTH || context->type == GROMIT_ORTHOGONAL || context->type == GROMIT_FRAME)
142+
if (context->type == GROMIT_SMOOTH || context->type == GROMIT_ORTHOGONAL)
143143
{
144144
g_printerr(" simplify: %u, ", context->simplify);
145145
if (context->snapdist > 0)
@@ -150,6 +150,11 @@ void paint_context_print (gchar *name,
150150
g_printerr(" radius: %u, minlen: %u, maxangle: %u ",
151151
context->radius, context->minlen, context->maxangle);
152152
}
153+
if (context->type == GROMIT_FRAME)
154+
{
155+
g_printerr("xlength: %u, ylength: %u, radius: %u, ", context->xlength, context->ylength, context->radius);
156+
g_printerr("fillcolor: %s, ", gdk_rgba_to_string(context->fill_color));
157+
}
153158
g_printerr ("color: %s\n", gdk_rgba_to_string(context->paint_color));
154159
}
155160

@@ -650,13 +655,15 @@ void setup_main_app (GromitData *data, int argc, char ** argv)
650655
g_free(data->white);
651656
g_free(data->black);
652657
g_free(data->red);
658+
g_free(data->transparent);
653659
data->white = g_malloc (sizeof (GdkRGBA));
654660
data->black = g_malloc (sizeof (GdkRGBA));
655661
data->red = g_malloc (sizeof (GdkRGBA));
662+
data->transparent = g_malloc (sizeof (GdkRGBA));
656663
gdk_rgba_parse(data->white, "#FFFFFF");
657664
gdk_rgba_parse(data->black, "#000000");
658665
gdk_rgba_parse(data->red, "#FF0000");
659-
666+
gdk_rgba_parse(data->transparent, "rgba(0, 0, 0, 0.0)");
660667

661668
/*
662669
CURSORS
@@ -860,10 +867,10 @@ void setup_main_app (GromitData *data, int argc, char ** argv)
860867
data->modified = 0;
861868

862869
data->default_pen =
863-
paint_context_new (data, GROMIT_PEN, data->red, NULL, 7, 0, GROMIT_ARROW_END,
870+
paint_context_new (data, GROMIT_PEN, data->red, data->transparent, 7, 0, GROMIT_ARROW_END,
864871
5, 10, 15, 25, 0, 0, 0, 1, G_MAXUINT);
865872
data->default_eraser =
866-
paint_context_new (data, GROMIT_ERASER, data->red, NULL, 75, 0, GROMIT_ARROW_END,
873+
paint_context_new (data, GROMIT_ERASER, data->red, data->transparent, 75, 0, GROMIT_ARROW_END,
867874
5, 10, 15, 25, 0, 0, 0, 1, G_MAXUINT);
868875

869876
gdk_event_handler_set ((GdkEventFunc) main_do_event, data, NULL);

src/main.h

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ typedef struct
139139
GdkRGBA *white;
140140
GdkRGBA *black;
141141
GdkRGBA *red;
142+
GdkRGBA *transparent;
142143

143144
GromitPaintContext *default_pen;
144145
GromitPaintContext *default_eraser;

0 commit comments

Comments
 (0)