Skip to content

Commit f446416

Browse files
tool change
1 parent 0c06510 commit f446416

File tree

6 files changed

+204
-147
lines changed

6 files changed

+204
-147
lines changed

gromit-mpx.1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,19 @@ running Gromit-MPX process, see above for the options available to start Gromit-
9595
.B \-c, \-\-clear
9696
will clear the screen.
9797
.TP
98+
.B \-l <x1> <y1> <x2> <y2> <color> <width>, \-\-line <x1> <y1> <x2> <y2> <color> <width>
99+
will draw a line from (x1,y1) to (x2,y2) with color <color> and width <width>.
100+
.TP
98101
.B \-q, \-\-quit
99102
will cause the main Gromit-MPX process to quit.
100103
.TP
101104
.B \-t, \-\-toggle
102105
will toggle the grabbing of the cursor.
103106
.TP
107+
.B \-T <definition>, \-\-change-tool <definition>
108+
will change the definition of a tool. The syntax is as in the .cfg file
109+
read at startup, except for the trailing semicolon.
110+
.TP
104111
.B \-v, \-\-visibility
105112
will toggle the visibility of the window.
106113
.TP

src/callbacks.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,8 @@ void on_mainapp_selection_received (GtkWidget *widget,
680680
else if (gtk_selection_data_get_target(selection_data) == GA_CHGTOOLDATA)
681681
{
682682
gchar *a = (gchar *)gtk_selection_data_get_data(selection_data);
683-
g_printerr("DEFTOOL argument: %s\n", a);
683+
if(data->debug)
684+
g_printerr("DEBUG: define tool: %s\n", a);
684685

685686
GScanner *scanner;
686687
scanner = g_scanner_new(NULL);
@@ -690,8 +691,7 @@ void on_mainapp_selection_received (GtkWidget *widget,
690691
GTokenType token;
691692
token = g_scanner_get_next_token (scanner);
692693

693-
gchar *name, *copy;
694-
GromitPaintContext *context_template=NULL;
694+
gchar *name;
695695

696696
GromitStyleDef style;
697697

@@ -702,7 +702,7 @@ void on_mainapp_selection_received (GtkWidget *widget,
702702
name = parse_name (scanner);
703703

704704
if(!name)
705-
goto cleanup;
705+
goto cleanup;
706706

707707
if (!parse_tool(data, scanner, &style))
708708
goto cleanup;
@@ -716,7 +716,6 @@ void on_mainapp_selection_received (GtkWidget *widget,
716716
token = g_scanner_cur_token(scanner);
717717
}
718718

719-
// by now nothing should follow
720719
if (token != G_TOKEN_EOF)
721720
{
722721
g_printerr ("End of tool definition expected !\n");
@@ -729,20 +728,18 @@ void on_mainapp_selection_received (GtkWidget *widget,
729728
paint_context_new (data, style.type, style.paint_color,
730729
style.width, style.arrowsize,
731730
style.minwidth, style.maxwidth);
732-
*context = *new_context;
733731

732+
g_free(context->paint_color);
733+
*context = *new_context;
734734
g_free(new_context);
735735
}
736-
737736
token = g_scanner_get_next_token (scanner);
738737
}
739738

740739
cleanup:
741-
742740
g_scanner_destroy (scanner);
743741
}
744742
}
745-
746743
gtk_main_quit ();
747744
}
748745

src/config.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ void read_keyfile(GromitData *data)
730730
{
731731
gchar *filename = g_strjoin (G_DIR_SEPARATOR_S,
732732
g_get_user_config_dir(), "gromit-mpx.ini", NULL);
733-
734733
/*
735734
set defaults
736735
*/
@@ -756,7 +755,7 @@ void read_keyfile(GromitData *data)
756755
if(data->opacity == 0)
757756
data->opacity = DEFAULT_OPACITY;
758757

759-
cleanup:
758+
cleanup:
760759
g_free(filename);
761760
g_key_file_free(key_file);
762761
}

src/main.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,6 @@ void main_do_event (GdkEventAny *event,
599599

600600

601601

602-
603-
604602
void setup_main_app (GromitData *data, int argc, char ** argv)
605603
{
606604
gboolean activate;
@@ -1060,7 +1058,6 @@ void parse_print_help (gpointer key, gpointer value, gpointer user_data)
10601058
}
10611059

10621060

1063-
10641061
/*
10651062
* Main programs
10661063
*/
@@ -1157,13 +1154,13 @@ int main_client (int argc, char **argv, GromitData *data)
11571154
{
11581155
action = GA_REDO;
11591156
}
1160-
else if (strcmp (arg, "--deftool") == 0)
1157+
else if (strcmp (arg, "--change-tool") == 0 ||
1158+
strcmp(arg, "-T") == 0)
11611159
{
1162-
g_printerr("argc=%d i=%d\n",argc,i);
11631160
if (argc <= i+1)
11641161
{
11651162
wrong_arg = TRUE;
1166-
g_printerr("--deftool requires an argument\n");
1163+
g_printerr("--change-tool requires an argument\n");
11671164
}
11681165
else
11691166
{

0 commit comments

Comments
 (0)