Skip to content

Commit 4e0919b

Browse files
README, config, main, callbacks: added tool options -A, -T, moved comment in config.h, free default colors when exiting, add missing snap minlen maxangle simplify to callbacks
1 parent 048ec6a commit 4e0919b

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ Usage:
9898
gromit-mpx --redo
9999
will redo the last undone drawing stroke (or "-y")
100100
gromit-mpx --change-tool <definition>
101-
will redefine a tool, using the same syntax as in the .cfg file
101+
will redefine a tool, using the same syntax as in the .cfg file (or "-T")
102102
e.g. gromit-mpx --change-tool '"default"=RECT(color="yellow" size=2)'
103103
gromit-mpx --change-attribute <definition>
104104
will change one or several attributes of a tool, keeping the others
105-
as they were. This can be used to change e.g. to color or type of a tool
105+
as they were. This can be used to change e.g. to color or type of a tool (or "-A")
106106
e.g. gromit-mpx --change-attribute '"default"=(color="cyan")'
107107
gromit-mpx --change-attribute '"default"=LINE'
108108
gromit-mpx --line <startX> <startY> <endX> <endY> <color> <thickness>

src/callbacks.c

+21-1
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,21 @@ void on_mainapp_selection_received (GtkWidget *widget,
759759
case SYM_MAXSIZE:
760760
context->maxwidth = style.maxwidth;
761761
break;
762+
case SYM_MINLEN:
763+
context->minlen = style.minlen;
764+
break;
765+
case SYM_MAXANGLE:
766+
context->maxangle = style.maxangle;
767+
break;
768+
case SYM_RADIUS:
769+
context->radius = style.radius;
770+
break;
771+
case SYM_SIMPLIFY:
772+
context->simplify = style.simplify;
773+
break;
774+
case SYM_SNAP:
775+
context->snapdist = style.snapdist;
776+
break;
762777
case SYM_ERROR:
763778
break;
764779
}
@@ -776,12 +791,17 @@ void on_mainapp_selection_received (GtkWidget *widget,
776791
if (g_scanner_cur_token(scanner) != G_TOKEN_EOF) goto cleanup;
777792

778793
context->type = style.type;
779-
*context->paint_color = *style.paint_color;
780794
context->width = style.width;
781795
context->arrowsize = style.arrowsize;
782796
context->arrow_type = style.arrow_type;
783797
context->minwidth = style.minwidth;
784798
context->maxwidth = style.maxwidth;
799+
context->radius = style.radius;
800+
context->minlen = style.minlen;
801+
context->maxangle = style.maxangle;
802+
context->simplify = style.simplify;
803+
context->snapdist = style.snapdist;
804+
*context->paint_color = *style.paint_color;
785805

786806
cairo_set_source_rgba(context->paint_ctx,
787807
style.paint_color->red,

src/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
Select and parse system or user .cfg file.
3434
Returns TRUE if something got parsed successfully, FALSE otherwise.
3535
*/
36+
gboolean parse_config (GromitData *data);
3637

3738
typedef enum {
3839
SYM_ERROR = 0,
@@ -51,7 +52,6 @@ typedef enum {
5152

5253
void scanner_init(GScanner *scanner);
5354
gboolean parse_tool(GromitData *data, GScanner *scanner, GromitPaintContext *style);
54-
gboolean parse_config (GromitData *data);
5555
gchar* parse_name (GScanner *scanner);
5656
gfloat parse_get_float(GScanner *scanner, const gchar *msg);
5757
gboolean parse_style(GScanner *scanner, GromitPaintContext *style);

src/main.c

+3
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,9 @@ int main (int argc, char **argv)
12931293
gtk_main ();
12941294
shutdown_input_devices(data);
12951295
write_keyfile(data); // save keyfile config
1296+
g_free(data->red);
1297+
g_free(data->white);
1298+
g_free(data->black);
12961299
g_free (data);
12971300
return 0;
12981301
}

0 commit comments

Comments
 (0)