Skip to content

Commit

Permalink
parser.[ch] removed from CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-niklaus committed Mar 31, 2024
1 parent 074531a commit 048ec6a
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 384 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ set(sources
src/callbacks.h
src/config.c
src/config.h
src/parser.c
src/parser.h
src/drawing.c
src/drawing.h
src/coordlist_ops.c
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,17 @@ Usage:
will undo the last drawing stroke (or "-z")
gromit-mpx --redo
will redo the last undone drawing stroke (or "-y")
gromit-mpx --change-tool <definition>
will redefine a tool, using the same syntax as in the .cfg file
e.g. gromit-mpx --change-tool '"default"=RECT(color="yellow" size=2)'
gromit-mpx --change-attribute <definition>
will change one or several attributes of a tool, keeping the others
as they were. This can be used to change e.g. to color or type of a tool
e.g. gromit-mpx --change-attribute '"default"=(color="cyan")'
gromit-mpx --change-attribute '"default"=LINE'
gromit-mpx --line <startX> <startY> <endX> <endY> <color> <thickness>
will draw a straight line with characteristics specified by the arguments (or "-l")
eg: gromit-mpx -l 200 200 400 400 '#C4A7E7' 6
e.g.: gromit-mpx -l 200 200 400 400 '#C4A7E7' 6

If activated Gromit-MPX prevents you from using other programs with the
mouse. You can press the button and paint on the screen. Key presses
Expand Down
11 changes: 7 additions & 4 deletions gromit-mpx.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" Hey, vim: ft=nroff
.TH GROMIT-MPX 1 "November 3, 2018"
.TH GROMIT-MPX 1 "March 31, 2024"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
Expand Down Expand Up @@ -95,9 +95,6 @@ running Gromit-MPX process, see above for the options available to start Gromit-
.B \-c, \-\-clear
will clear the screen.
.TP
.B \-l <x1> <y1> <x2> <y2> <color> <width>, \-\-line <x1> <y1> <x2> <y2> <color> <width>
will draw a line from (x1,y1) to (x2,y2) with color <color> and width <width>.
.TP
.B \-q, \-\-quit
will cause the main Gromit-MPX process to quit.
.TP
Expand All @@ -107,6 +104,12 @@ will toggle the grabbing of the cursor.
.B \-T <definition>, \-\-change-tool <definition>
will change the definition of a tool. The syntax is as in the .cfg file
read at startup, except for the trailing semicolon.
(example: gromit-mpx -T '"default"=RECT(color="yellow" size=2)'
.TP
.B \-A <definition>, \-\-change-attribute <definition>
will change one or several attributes of a tool, keeping the other settings.
(example 1: change just the color: gromit-mpx -A '"default"=(color="yellow")';
example 2: change tool type, keeping color, size etc: gromit-mpx -A '"default"=LINE')
.TP
.B \-v, \-\-visibility
will toggle the visibility of the window.
Expand Down
53 changes: 7 additions & 46 deletions src/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include "cairo.h"
#include "main.h"
#include "input.h"
#include "callbacks.h"
Expand Down Expand Up @@ -142,18 +141,10 @@ void on_monitors_changed ( GdkScreen *screen,

parse_config(data); // also calls paint_context_new() :-(


<<<<<<< HEAD
data->default_pen = paint_context_new (data, GROMIT_PEN, data->red, 7, 0, GROMIT_ARROW_END,
data->default_pen = paint_context_new (data, GROMIT_PEN, gdk_rgba_copy(data->red), 7, 0, GROMIT_ARROW_END,
5, 10, 15, 25, 1, 0, G_MAXUINT);
data->default_eraser = paint_context_new (data, GROMIT_ERASER, data->red, 75, 0, GROMIT_ARROW_END,
data->default_eraser = paint_context_new (data, GROMIT_ERASER, gdk_rgba_copy(data->red), 75, 0, GROMIT_ARROW_END,
5, 10, 15, 25, 1, 0, G_MAXUINT);
=======
data->default_pen = paint_context_new (data, GROMIT_PEN, gdk_rgba_copy(data->red), 7,
0, GROMIT_ARROW_END, 1, G_MAXUINT);
data->default_eraser = paint_context_new (data, GROMIT_ERASER, gdk_rgba_copy(data->red), 75,
0, GROMIT_ARROW_END, 1, G_MAXUINT);
>>>>>>> 5385d7b (config, callbacks: add option to change tool definitions and individual tool attributes)

if(!data->composited) // set shape
{
Expand Down Expand Up @@ -221,7 +212,7 @@ void on_clientapp_selection_get (GtkWidget *widget,

if (gtk_selection_data_get_target(selection_data) == GA_TOGGLEDATA ||
gtk_selection_data_get_target(selection_data) == GA_LINEDATA ||
gtk_selection_data_get_target(selection_data) == GA_DEFTOOLDATA ||
gtk_selection_data_get_target(selection_data) == GA_CHGTOOLDATA ||
gtk_selection_data_get_target(selection_data) == GA_CHGATTRDATA)
{
ans = data->clientdata;
Expand Down Expand Up @@ -292,11 +283,7 @@ gboolean on_buttonpress (GtkWidget *win,
GromitPaintType type = devdata->cur_context->type;

// store original state to have dynamic update of line and rect
<<<<<<< HEAD
if (type == GROMIT_LINE || type == GROMIT_RECT || type == GROMIT_SMOOTH || type == GROMIT_ORTHOGONAL)
=======
if (type == GROMIT_LINE || type == GROMIT_RECT)
>>>>>>> 5385d7b (config, callbacks: add option to change tool definitions and individual tool attributes)
{
copy_surface(data->aux_backbuffer, data->backbuffer);
}
Expand Down Expand Up @@ -413,12 +400,8 @@ gboolean on_motion (GtkWidget *win,
}
if (type == GROMIT_LINE)
{
<<<<<<< HEAD
GromitArrowType atype = devdata->cur_context->arrow_type;
=======
>>>>>>> 5385d7b (config, callbacks: add option to change tool definitions and individual tool attributes)
draw_line (data, ev->device, devdata->lastx, devdata->lasty, ev->x, ev->y);
if (devdata->cur_context->arrowsize > 0)
if (devdata->cur_context->arrowsize > 0.0)
{
GromitArrowType atype = devdata->cur_context->arrow_type;
gint width = devdata->cur_context->arrowsize * devdata->cur_context->width / 2;
Expand Down Expand Up @@ -467,14 +450,8 @@ gboolean on_buttonrelease (GtkWidget *win,

gfloat direction = 0;
gint width = 0;
<<<<<<< HEAD
if(ctx)
width = ctx->arrowsize * ctx->width / 2;
=======
if(devdata->cur_context)
width = devdata->cur_context->arrowsize * devdata->cur_context->width / 2;

>>>>>>> 5385d7b (config, callbacks: add option to change tool definitions and individual tool attributes)

if ((ev->x != devdata->lastx) ||
(ev->y != devdata->lasty))
Expand All @@ -483,7 +460,6 @@ gboolean on_buttonrelease (GtkWidget *win,
if (!devdata->is_grabbed)
return FALSE;

<<<<<<< HEAD
GromitPaintType type = ctx->type;

if (type == GROMIT_SMOOTH || type == GROMIT_ORTHOGONAL)
Expand Down Expand Up @@ -517,13 +493,6 @@ gboolean on_buttonrelease (GtkWidget *win,
if (ctx->arrowsize != 0)
{
GromitArrowType atype = ctx->arrow_type;
=======
GromitPaintType type = devdata->cur_context->type;

if (devdata->cur_context->arrowsize != 0)
{
GromitArrowType atype = devdata->cur_context->arrow_type;
>>>>>>> 5385d7b (config, callbacks: add option to change tool definitions and individual tool attributes)
if (type == GROMIT_LINE)
{
direction = atan2 (ev->y - devdata->lasty, ev->x - devdata->lastx);
Expand Down Expand Up @@ -590,9 +559,9 @@ void on_mainapp_selection_get (GtkWidget *widget,
undo_drawing (data);
else if (action == GA_REDO)
redo_drawing (data);
else if (action == GA_DEFTOOL)
else if (action == GA_CHGTOOL)
{
gtk_selection_convert(data->win, GA_DATA, GA_DEFTOOLDATA, time);
gtk_selection_convert(data->win, GA_DATA, GA_CHGTOOLDATA, time);
gtk_main();
}
else if (action == GA_CHGATTR)
Expand Down Expand Up @@ -687,13 +656,8 @@ void on_mainapp_selection_received (GtkWidget *widget,
"Keeping default.\n");
}
GromitPaintContext* line_ctx =
<<<<<<< HEAD
paint_context_new(data, GROMIT_PEN, fg_color, thickness, 0, GROMIT_ARROW_END,
5, 10, 15, 25, 0, thickness, thickness);
=======
paint_context_new(data, GROMIT_PEN, fg_color, thickness,
0, GROMIT_ARROW_END, thickness, thickness);
>>>>>>> 5385d7b (config, callbacks: add option to change tool definitions and individual tool attributes)

GdkRectangle rect;
rect.x = MIN (startX,endX) - thickness / 2;
Expand All @@ -719,7 +683,7 @@ void on_mainapp_selection_received (GtkWidget *widget,
else
{
GdkAtom atom = gtk_selection_data_get_target(selection_data);
if (atom == GA_DEFTOOLDATA || atom == GA_CHGATTRDATA)
if (atom == GA_CHGTOOLDATA || atom == GA_CHGATTRDATA)
{
gchar *a = (gchar *)gtk_selection_data_get_data(selection_data);
if(data->debug) g_printerr("DEBUG: define tool: %s\n", a);
Expand Down Expand Up @@ -1100,7 +1064,6 @@ void on_intro(GtkMenuItem *menuitem,
gtk_widget_show_all (assistant);
}

<<<<<<< HEAD
void on_edit_config(GtkMenuItem *menuitem,
gpointer user_data)
{
Expand Down Expand Up @@ -1155,8 +1118,6 @@ void on_edit_config(GtkMenuItem *menuitem,
}


=======
>>>>>>> 5385d7b (config, callbacks: add option to change tool definitions and individual tool attributes)
void on_issues(GtkMenuItem *menuitem,
gpointer user_data)
{
Expand Down
3 changes: 0 additions & 3 deletions src/callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,9 @@ void on_about(GtkMenuItem *menuitem,
void on_intro(GtkMenuItem *menuitem,
gpointer user_data);

<<<<<<< HEAD
void on_edit_config(GtkMenuItem *menuitem,
gpointer user_data);

=======
>>>>>>> 5385d7b (config, callbacks: add option to change tool definitions and individual tool attributes)
void on_issues(GtkMenuItem *menuitem,
gpointer user_data);

Expand Down
Loading

0 comments on commit 048ec6a

Please sign in to comment.