atomes 1.3.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
w_curve.c
Go to the documentation of this file.
1/* This file is part of the 'atomes' software
2
3'atomes' is free software: you can redistribute it and/or modify it under the terms
4of the GNU Affero General Public License as published by the Free Software Foundation,
5either version 3 of the License, or (at your option) any later version.
6
7'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9See the GNU General Public License for more details.
10
11You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12If not, see <https://www.gnu.org/licenses/>
13
14Copyright (C) 2022-2026 by CNRS and University of Strasbourg */
15
21
22/*
23* This file: 'w_curve.c'
24*
25* Contains:
26*
27
28 - The functions to create the graph/curve window
29
30*
31* List of functions:
32
33 int get_curve_shift (Curve * this_curve);
34
35 G_MODULE_EXPORT gboolean view_curve_popup (GtkWidget * widget, gpointer data);
36 G_MODULE_EXPORT gboolean on_motion_notify_event (GtkWidget * widget, GdkEventMotion * event, gpointer data);
37 G_MODULE_EXPORT gboolean on_curve_button_event (GtkWidget * widget, GdkEvent * event, gpointer data);
38 G_MODULE_EXPORT gboolean on_curve_key_pressed (GtkWidget * widg, GdkEventKey * event, gpointer data);
39 G_MODULE_EXPORT gboolean on_curve_key_pressed (GtkEventControllerKey * self, guint keyval, guint keycode, GdkModifierType state, gpointer data);
40
41 void curve_zoom_in_out (gboolean state, gdouble event_x, gdouble event_y, gpointer data);
42 void curve_button_event (double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data);
43 void curve_button_event (GdkEvent * event, double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data);
44 void curve_key_pressed (guint keyval, GdkModifierType state, gpointer data);
45
46 static void on_curve_pointer_motion (GtkEventControllerMotion * motion, gdouble x, gdouble y, gpointer data);
47
48 G_MODULE_EXPORT void on_curve_button_pressed (GtkGesture * gesture, int n_press, double x, double y, gpointer data);
49 G_MODULE_EXPORT void on_curve_button_released (GtkGesture * gesture, int n_press, double x, double y, gpointer data);
50 G_MODULE_EXPORT void on_curve_realize (GtkWidget * widg, gpointer data);
51
52 GtkWidget * create_curve (tint * data);
53
54*/
55
56#include <stdlib.h>
57#include <math.h>
58#include <gtk/gtk.h>
59#include <gdk/gdk.h>
60#include <cairo.h>
61
62#include "global.h"
63#include "callbacks.h"
64#include "curve.h"
65#include "cedit.h"
66#include "datab.h"
67
68extern void autoscale (gpointer data);
69extern void curve_menu_bar_action (GSimpleAction * action, GVariant * parameter, gpointer data);
70
72
73#ifdef GTK3
82G_MODULE_EXPORT gboolean view_curve_popup (GtkWidget * widget, gpointer data)
83{
85 return TRUE;
86}
87#endif
88
99void curve_zoom_in_out (gboolean state, gdouble event_x, gdouble event_y, gpointer data)
100{
101 int x, y;
102 double r, g, d;
103 double tmp, xp, yp;
104 gchar * str;
105 gint width, height;
106 CurveState * cstate = (CurveState *)data;
107 Curve * this_curve = get_curve_from_pointer ((gpointer)(cstate -> id));
108 int curve_shift = get_curve_shift (this_curve);
109#ifdef GTK4
110 event_y -= (double) curve_shift;
111#endif
112 if (state && cstate -> mouseState.MouseIsDown)
113 {
114 cairo_t * rec;
115 cairo_region_t * reg;
116#ifdef GTK3
117 GdkWindow * win = gtk_widget_get_window (this_curve -> plot);
118 reg = gdk_window_get_visible_region (win);
119 GdkDrawingContext * curve_context = gdk_window_begin_draw_frame (win, reg);
120 if (gdk_drawing_context_is_valid (curve_context))
121 {
122 rec = gdk_drawing_context_get_cairo_context (curve_context);
123 if (event_x >= x_min && event_x <= x_max && event_y <= y_min && event_y >= y_max)
124#else
125 GtkNative * native = gtk_widget_get_native (this_curve -> plot);
126 GdkSurface * surf = gtk_native_get_surface (native);
127 cairo_surface_t * csurf = cairo_surface_create_for_rectangle (this_curve -> surface, 0.0, (double)curve_shift,
128 (double)gtk_widget_get_width(this_curve -> plot),
129 (double)gtk_widget_get_height(this_curve -> plot));
130 reg = gdk_cairo_region_create_from_surface (csurf);
131 GdkDrawContext * curve_context = (GdkDrawContext *) gdk_surface_create_cairo_context (surf);
132 gdk_draw_context_begin_frame (curve_context, reg);
133 if (gdk_draw_context_is_in_frame (curve_context))
134 {
135 rec = gdk_cairo_context_cairo_create ((GdkCairoContext *)curve_context);
136 if (event_x >= x_min && event_x <= x_max && event_y <= y_min+(double)curve_shift && event_y >= y_max)
137#endif
138 {
139 width = event_x - cstate -> mouseState.start_x;
140 height = event_y - cstate -> mouseState.start_y;
141#ifdef GTK3
142 cairo_set_source_surface (rec, this_curve -> surface, 0, -curve_shift);
143#else
144 height += (double) curve_shift;
145 cairo_set_source_surface (rec, this_curve -> surface, 0, +curve_shift);
146#endif
147 cairo_paint (rec);
148 if (event_x < cstate -> mouseState.start_x)
149 {
150 r=0.0;
151 x = cstate -> mouseState.start_x + 2;
152 if (event_y < cstate -> mouseState.start_y)
153 {
154 g=0.0;
155 d=1.0;
156 y = cstate -> mouseState.start_y + 8;
157 str = g_strdup_printf (_("zoom: out (x) / in (y)"));
158 }
159 else
160 {
161 g=1.0;
162 d=0.0;
163 y = cstate -> mouseState.start_y - 4;
164 str = g_strdup_printf (_("zoom: out (x) / out (y)"));
165 }
166 }
167 else
168 {
169 r=1.0;
170 x = cstate -> mouseState.start_x - 100;
171 if (event_y < cstate -> mouseState.start_y)
172 {
173 g=0.0;
174 d=0.0;
175 y = cstate -> mouseState.start_y + 8;
176 str = g_strdup_printf (_("zoom: in (x) / in (y)"));
177 }
178 else
179 {
180 g=0.0;
181 d=1.0;
182 y = cstate -> mouseState.start_y - 4;
183 str = g_strdup_printf (_("zoom: in (x) / out (y)"));
184 }
185 }
186 cairo_set_source_rgba (rec, r, g, d, 0.05);
187 cairo_rectangle (rec, cstate -> mouseState.start_x, cstate -> mouseState.start_y, width, height);
188 cairo_fill (rec);
189 cairo_set_source_rgba (rec, r, g, d, 1.0);
190 cairo_set_line_width (rec, 1.0);
191 cairo_move_to (rec, cstate -> mouseState.start_x, cstate -> mouseState.start_y);
192#ifdef GTK4
193 event_y += (double) curve_shift;
194#endif
195 cairo_line_to (rec, cstate -> mouseState.start_x, event_y);
196 cairo_line_to (rec, event_x, event_y);
197 cairo_line_to (rec, event_x, cstate -> mouseState.start_y);
198 cairo_line_to (rec, cstate -> mouseState.start_x, cstate -> mouseState.start_y);
199 cairo_stroke (rec);
200 if (abs(width) > 10 && abs(height) > 5)
201 {
202 cairo_move_to (rec, x, y);
203 cairo_show_text (rec, str);
204 }
205 g_free (str);
206 width = event_x - x_min;
207 tmp = this_curve -> axmax[0] - this_curve -> axmin[0];
208 xp = this_curve -> axmin[0] + width * tmp / XDRAW;
209#ifdef GTK4
210 event_y -= (double) curve_shift;
211#endif
212 height = event_y - y_max;
213 tmp = this_curve -> axmax[1] - this_curve -> axmin[1];
214 yp = this_curve -> axmax[1] + height * tmp / YDRAW;
215 str = g_strdup_printf ("(x= %f, y= %f)", xp, yp);
216 }
217 else
218 {
219 str = g_strdup_printf (_("(Not in plot)"));
220 }
221 gtk_label_set_text (GTK_LABEL(this_curve -> pos), str);
222 g_free (str);
223 }
224#ifdef GTK3
225 gdk_window_end_draw_frame (win, curve_context);
226#else
227 gdk_draw_context_end_frame (curve_context);
228#endif
229 }
230 else if (! cstate -> mouseState.MouseIsDown)
231 {
232#ifdef GTK3
233 // gtk_widget_get_size_request (this_curve -> plot, & this_curve -> wsize[0], & this_curve -> wsize[1]);
234 gtk_window_get_size (GTK_WINDOW(this_curve -> window), & this_curve -> wsize[0], & y);
235 this_curve -> wsize[1] = y - curve_shift;
236#else
237 this_curve -> wsize[0] = gtk_widget_get_width (this_curve -> plot);
238 this_curve -> wsize[1] = gtk_widget_get_height (this_curve -> plot);
239#endif
240 prep_plot (this_curve);
241#ifdef GTK4
242 if (event_x >= x_min && event_x <= x_max && event_y <= y_min+(double)curve_shift && event_y >= y_max)
243#else
244 if (event_x >= x_min && event_x <= x_max && event_y <= y_min && event_y >= y_max)
245#endif
246 {
247 width = event_x - x_min;
248 tmp = this_curve -> axmax[0] - this_curve -> axmin[0];
249 xp = this_curve -> axmin[0] + width * tmp / XDRAW;
250 height = event_y - y_max;
251 tmp = this_curve -> axmax[1] - this_curve -> axmin[1];
252 yp = this_curve -> axmax[1] + height * tmp / YDRAW;
253 str = g_strdup_printf ("(x= %f, y= %f)", xp, yp);
254 }
255 else
256 {
257 str = g_strdup_printf (_("Not in plot"));
258 }
259 gtk_label_set_text (GTK_LABEL(this_curve -> pos), str);
260 g_free (str);
261 }
262}
263
264#ifdef GTK3
274G_MODULE_EXPORT gboolean on_motion_notify_event (GtkWidget * widget, GdkEventMotion * event, gpointer data)
275{
276 curve_zoom_in_out ((event -> state & GDK_BUTTON1_MASK) ? TRUE : FALSE, event -> x, event -> y, data);
277 return TRUE;
278}
279#else
290static void on_curve_pointer_motion (GtkEventControllerMotion * motion, gdouble x, gdouble y, gpointer data)
291{
292 curve_zoom_in_out (((CurveState *)data) -> mouseState.MouseIsDown, x, y, data);
293}
294#endif
295
296#ifdef GTK4
309void curve_button_event (double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data)
310#else
324void curve_button_event (GdkEvent * event, double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data)
325#endif
326{
327 int x1, x2, y1, y2;
328 double tmp;
329 CurveState * cstate = (CurveState *)data;
330 Curve * this_curve = get_curve_from_pointer ((gpointer)cstate -> id);
331#ifdef GTK4
332 int curve_shift = get_curve_shift (this_curve);
333#endif
334 if (event_type == GDK_BUTTON_PRESS)
335 {
336 if (event_button == 1)
337 {
338#ifdef GTK3
339 /*
340 The following is not working:
341 gtk_widget_get_size_request (this_curve -> plot, & this_curve -> wsize[0], & this_curve -> wsize[1]);
342 */
343 gtk_window_get_size (GTK_WINDOW(this_curve -> window), & this_curve -> wsize[0], & y1);
344 this_curve -> wsize[1] = y1 - get_curve_shift (this_curve);
345#else
346 this_curve -> wsize[0] = gtk_widget_get_width (this_curve -> plot);
347 this_curve -> wsize[1] = gtk_widget_get_height (this_curve -> plot);
348#endif
349 prep_plot (this_curve);
350#ifdef GTK4
351 if (event_x >= x_min && event_x <= x_max && event_y <= y_min+(double)curve_shift && event_y >= y_max)
352#else
353 if (event_x >= x_min && event_x <= x_max && event_y <= y_min && event_y >= y_max)
354#endif
355 {
356 cstate -> mouseState.start_x = event_x;
357 cstate -> mouseState.start_y = event_y;
358 cstate -> mouseState.time = event_time;
359 cstate -> mouseState.MouseIsDown = TRUE;
360 }
361 }
362 else if (event_button == 3)
363 {
364#ifdef GTK4
365 pop_menu_at_pointer (curve_popup_menu(data), event_x, event_y);
366#else
368#endif
369 }
370 }
371 else if (event_type == GDK_BUTTON_RELEASE)
372 {
373 cstate -> mouseState.MouseIsDown = FALSE;
374 if (event_button == 1)
375 {
376 etime = event_time - cstate -> mouseState.time;
377 if (event_x >= x_min && event_x <= x_max && event_y <= y_min && event_y >= y_max)
378 {
379 if (event_x != cstate -> mouseState.start_x && event_y != cstate -> mouseState.start_y)
380 {
381 if (etime > 500 && etime < 50000)
382 {
383 x1 = cstate -> mouseState.start_x - x_min;
384 y1 = cstate -> mouseState.start_y - y_max;
385 x2 = event_x - x_min;
386 y2 = event_y - y_max;
387#ifdef GTK4
388 y1 -= curve_shift;
389 y2 -= curve_shift;
390#endif
391 tmp = this_curve -> axmax[0] - this_curve -> axmin[0];
392 if (x2 > x1)
393 {
394 // zoom-in on X
395 this_curve -> axmax[0] = this_curve -> axmin[0] + x2 * tmp / XDRAW;
396 this_curve -> axmin[0] = this_curve -> axmin[0] + x1 * tmp / XDRAW;
397 }
398 else
399 {
400 // zoom-out on X
401 this_curve -> axmin[0] = this_curve -> axmin[0] - (x1 - x2) * tmp / XDRAW;
402 this_curve -> axmax[0] = this_curve -> axmax[0] + (x1 - x2) * tmp / XDRAW;
403 }
404 tmp = this_curve -> axmax[1] - this_curve -> axmin[1];
405 if (y1 > y2)
406 {
407 // zoom-in on Y
408 this_curve -> axmin[1] = this_curve -> axmax[1] + y1 * tmp / YDRAW;
409 this_curve -> axmax[1] = this_curve -> axmax[1] + y2 * tmp / YDRAW;
410 }
411 else
412 {
413 // zoom-out on Y
414 this_curve -> axmin[1] = this_curve -> axmin[1] + (y2 - y1) * tmp / YDRAW;
415 this_curve -> axmax[1] = this_curve -> axmax[1] - (y2 - y1) * tmp / YDRAW;
416 }
417 }
418 }
419 }
420 update_curve ((gpointer)cstate -> id);
421 }
422 }
423}
424
425#ifdef GTK4
437G_MODULE_EXPORT void on_curve_button_pressed (GtkGesture * gesture, int n_press, double x, double y, gpointer data)
438{
439 curve_button_event (x, y, gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture), GDK_BUTTON_PRESS, gtk_event_controller_get_current_event_time((GtkEventController *)gesture), data);
440}
441
453G_MODULE_EXPORT void on_curve_button_released (GtkGesture * gesture, int n_press, double x, double y, gpointer data)
454{
455 curve_button_event (x, y, gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture), GDK_BUTTON_RELEASE, gtk_event_controller_get_current_event_time((GtkEventController *)gesture), data);
456}
457#else
467G_MODULE_EXPORT gboolean on_curve_button_event (GtkWidget * widget, GdkEvent * event, gpointer data)
468{
469 GdkEventButton * bevent = (GdkEventButton *)event;
470 curve_button_event (event, bevent -> x, bevent -> y, bevent -> button, bevent -> type, bevent -> time, data);
471 return TRUE;
472}
473#endif
474
484void curve_key_pressed (guint keyval, GdkModifierType state, gpointer data)
485{
486 if (state & GDK_CONTROL_MASK)
487 {
488 switch (keyval)
489 {
490 case GDK_KEY_a:
491 autoscale (data);
492 break;
493 case GDK_KEY_c:
494 hide_curve (data);
495 break;
496 case GDK_KEY_e:
497 edit_curve (data);
498 break;
499 case GDK_KEY_i:
500 save_image (data);
501 break;
502 case GDK_KEY_s:
503 write_curve (data);
504 break;
505 }
506 }
507}
508
509#ifdef GTK3
519G_MODULE_EXPORT gboolean on_curve_key_pressed (GtkWidget * widg, GdkEventKey * event, gpointer data)
520{
521 if (event -> type == GDK_KEY_PRESS)
522 {
523 //GdkModifierType accel_mask = gtk_accelerator_get_default_mod_mask ();
524 // if ((event -> state & accel_mask) == GDK_CONTROL_MASK)
525 curve_key_pressed (event -> keyval, event -> state, data);
526 }
527 return FALSE;
528}
529#else
541G_MODULE_EXPORT gboolean on_curve_key_pressed (GtkEventControllerKey * self, guint keyval, guint keycode, GdkModifierType state, gpointer data)
542{
543 curve_key_pressed (keyval, state, data);
544 return TRUE;
545}
546#endif
547
555int get_curve_shift (Curve * this_curve)
556{
557 return get_widget_height (this_curve -> window) - get_widget_height (this_curve -> plot);
558}
559
568G_MODULE_EXPORT void on_curve_realize (GtkWidget * widg, gpointer data)
569{
570 Curve * this_curve = get_curve_from_pointer (data);
571 resize_this_window (this_curve -> window, this_curve -> wsize[0], this_curve -> wsize[1] + get_curve_shift (this_curve));
572}
573
581GtkWidget * create_curve (tint * data)
582{
583 GtkWidget * curve_win, * vbox;
584
585 activeg = data -> a;
586 activer = data -> b;
587 activec = data -> c;
588
589 Curve * this_curve = get_curve_from_pointer ((gpointer)data);
590 gchar * str = g_strdup_printf ("%s - %s", prepare_for_title (get_project_by_id(data -> a) -> name), this_curve -> name);
591 curve_win = create_win (str, MainWindow, FALSE, TRUE);
592 g_free (str);
595 this_curve -> curve_vbox = create_vbox (BSEP);
596 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, this_curve -> curve_vbox, FALSE, FALSE, 0);
597
599 this_curve -> action_id = curve_action_id;
600 this_curve -> action_group = g_simple_action_group_new ();
601 GSimpleAction * curve_action[5];
602 curve_action[0] = g_simple_action_new ("save.data", NULL);
603 curve_action[1] = g_simple_action_new ("close.curve", NULL);
604 curve_action[2] = g_simple_action_new ("edit.curve", NULL);
605 curve_action[3] = g_simple_action_new ("save.image", NULL);
606 curve_action[4] = g_simple_action_new ("shortcuts.curve", NULL);
607 int i;
608 for (i=0; i<5; i++)
609 {
610 g_action_map_add_action (G_ACTION_MAP(this_curve -> action_group), G_ACTION(curve_action[i]));
611 g_signal_connect (curve_action[i], "activate", G_CALLBACK(curve_menu_bar_action), data);
612 }
613 str = g_strdup_printf ("c-%d", this_curve -> action_id);
614 gtk_widget_insert_action_group (curve_win, str, G_ACTION_GROUP(this_curve -> action_group));
615 g_free (str);
617
618 this_curve -> datatree = NULL;
619 this_curve -> state.id = data;
620 this_curve -> plot = gtk_drawing_area_new ();
621 gtk_widget_set_size_request (this_curve -> plot, 100, 100);
622 gtk_widget_set_hexpand (this_curve -> plot, TRUE);
623 gtk_widget_set_vexpand (this_curve -> plot, TRUE);
624#ifdef GTK3
625 gtk_widget_add_events (GTK_WIDGET (this_curve -> plot),
626 GDK_EXPOSURE_MASK | GDK_SMOOTH_SCROLL_MASK |
627 GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
628 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
629 g_signal_connect (G_OBJECT(this_curve -> plot), "motion_notify_event", G_CALLBACK(on_motion_notify_event), & this_curve -> state);
630 g_signal_connect (G_OBJECT(this_curve -> plot), "button_press_event", G_CALLBACK(on_curve_button_event), & this_curve -> state);
631 g_signal_connect (G_OBJECT(this_curve -> plot), "button_release_event", G_CALLBACK(on_curve_button_event),& this_curve -> state);
632 g_signal_connect (G_OBJECT(this_curve -> plot), "popup-menu", G_CALLBACK(view_curve_popup), & this_curve -> state);
633#else
634 add_widget_gesture_and_key_action (curve_win, "curve-button-pressed", G_CALLBACK(on_curve_button_pressed), & this_curve -> state,
635 "curve-button-released", G_CALLBACK(on_curve_button_released), & this_curve -> state,
636 "curve-key-pressed", G_CALLBACK(on_curve_key_pressed), data,
637 "curve-pointer-motion", G_CALLBACK(on_curve_pointer_motion), & this_curve -> state,
638 NULL, NULL, NULL);
639#endif
640
641 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, this_curve -> plot, FALSE, TRUE, 0);
642
643#ifdef GTK3
644 g_signal_connect (G_OBJECT(this_curve -> plot), "draw", G_CALLBACK(show_curve), data);
645 g_signal_connect (G_OBJECT(curve_win), "key-press-event", G_CALLBACK(on_curve_key_pressed), data);
646#else
647 gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA(this_curve -> plot), (GtkDrawingAreaDrawFunc)show_curve, data, NULL);
648#endif
649 g_signal_connect (G_OBJECT(curve_win), "realize", G_CALLBACK(on_curve_realize), data);
650 add_gtk_close_event (curve_win, G_CALLBACK(to_hide_curve), data);
651 return curve_win;
652}
Callback declarations for main window.
int activer
Definition cedit.c:77
int activec
Definition cedit.c:76
void edit_curve(gpointer data)
create the curve edition dialog
Definition cedit.c:348
int activeg
Definition cedit.c:75
Variable declarations for the curve layout edition window.
gint32 etime
Definition curve.c:64
void prep_plot(Curve *this_curve)
prepare curve plot (setting up variables for the plot)
Definition curve.c:326
double YDRAW
Definition curve.c:66
Curve * get_curve_from_pointer(gpointer data)
get Curve pointer from pointer
Definition curve.c:313
double XDRAW
Definition curve.c:66
double y_max
Definition curve.c:70
double x_max
Definition curve.c:69
void update_curve(gpointer data)
update curve rendering
Definition curve.c:635
double y_min
Definition curve.c:70
double x_min
Definition curve.c:69
Variable declarations for the curve widget Functions for interactions with the curve widget.
GtkWidget * curve_popup_menu(gpointer data)
create curve popup menu
Definition m_curve.c:719
G_MODULE_EXPORT gboolean to_hide_curve(GtkWindow *thecurve, gpointer data)
void hide_curve(gpointer data)
hide curve
Definition show.c:312
int get_curve_shift(Curve *this_curve)
get cruve window size shift
Definition w_curve.c:555
void save_image(gpointer cdata)
export curve window plot to image - creating the dialog
Definition w_img.c:309
void curve_window_add_menu_bar(tint *data)
add menu bar to the curve window
Definition m_curve.c:625
void show_curve(GtkDrawingArea *area, cairo_t *cr, int width, int height, gpointer curve)
show curve callback GTK3
Definition show.c:77
void write_curve(gpointer idata)
save curve data - creating the dialog
Definition w_data.c:170
Variable declarations for the curve data edition window.
GtkWidget * MainWindow
Definition global.c:207
Global variable declarations Global convenience function declarations Global data structure defin...
void resize_this_window(GtkWidget *window, int x, int y)
resize this GtkWindow
Definition gtk-misc.c:636
GtkWidget * create_win(gchar *str, GtkWidget *parent, gboolean modal, gboolean resiz)
create a new GtkWindow
Definition gtk-misc.c:486
int get_widget_height(GtkWidget *widg)
retrive GtkWidget height
Definition gtk-misc.c:2589
#define BSEP
Definition global.h:261
void pop_menu_at_pointer(GtkWidget *widg, GdkEvent *event)
popup a menu at pointer location
Definition gtk-misc.c:2471
void add_gtk_close_event(GtkWidget *widg, GCallback handler, gpointer data)
add a close event signal and callback to a GtkWidget
Definition gtk-misc.c:2557
@ CONTAINER_WIN
Definition global.h:266
void add_box_child_start(int orientation, GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the initial position.
Definition gtk-misc.c:340
gchar * prepare_for_title(gchar *init)
prepare a string for a window title, getting rid of all markup
Definition tools.c:71
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:267
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
Definition gtk-misc.c:837
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
void motion(glwin *view, gint x, gint y, GdkModifierType state)
mouse motion in the OpenGL window
Definition glview.c:648
image * plot
Definition ogl_draw.c:72
action
Definition glview.h:198
G_MODULE_EXPORT void curve_menu_bar_action(GSimpleAction *action, GVariant *parameter, gpointer data)
curve menu action callback
Definition m_curve.c:300
double y
Definition ogl_draw.c:63
double x
Definition ogl_draw.c:63
Definition global.h:118
void curve_key_pressed(guint keyval, GdkModifierType state, gpointer data)
the keyboard shortcut actions for the curve window
Definition w_curve.c:484
void autoscale(gpointer data)
autoscale callback
Definition m_curve.c:99
int get_curve_shift(Curve *this_curve)
get cruve window size shift
Definition w_curve.c:555
void curve_button_event(GdkEvent *event, double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data)
handle mouse button event on the curve window GTK3
Definition w_curve.c:324
G_MODULE_EXPORT gboolean on_curve_key_pressed(GtkEventControllerKey *self, guint keyval, guint keycode, GdkModifierType state, gpointer data)
keyboard key press event for the curve window GTK4
Definition w_curve.c:541
void curve_zoom_in_out(gboolean state, gdouble event_x, gdouble event_y, gpointer data)
curve zoom in or out
Definition w_curve.c:99
G_MODULE_EXPORT gboolean on_curve_button_event(GtkWidget *widget, GdkEvent *event, gpointer data)
mouse button event on the curve window
Definition w_curve.c:467
int curve_action_id
Definition w_curve.c:71
G_MODULE_EXPORT void on_curve_realize(GtkWidget *widg, gpointer data)
curve window realize callback
Definition w_curve.c:568
void curve_menu_bar_action(GSimpleAction *action, GVariant *parameter, gpointer data)
curve menu action callback
Definition m_curve.c:300
GtkWidget * create_curve(tint *data)
create the curve data plot window
Definition w_curve.c:581
GtkWidget * vbox
Definition workspace.c:72