atomes 1.1.14
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
m_anim.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-2024 by CNRS and University of Strasbourg */
15
22/*
23* This file: 'm_anim.c'
24*
25* Contains:
26*
27
28 - The functions to create the 'Animate' submenu
29
30*
31* List of functions:
32
33 G_MODULE_EXPORT void to_spin (GSimpleAction * action, GVariant * parameter, gpointer data);
34 G_MODULE_EXPORT void to_seq (GSimpleAction * action, GVariant * parameter, gpointer data);
35 G_MODULE_EXPORT void to_rec (GSimpleAction * action, GVariant * parameter, gpointer data);
36
37 GtkWidget * menu_anim (glwin * view, int id);
38
39 GMenu * menu_anim (glwin * view, int popm);
40
41*/
42
43#include "global.h"
44#include "glwindow.h"
45
46extern G_MODULE_EXPORT void window_spinner (GtkWidget * widg, gpointer data);
47extern G_MODULE_EXPORT void window_recorder (GtkWidget * widg, gpointer data);
48extern G_MODULE_EXPORT void window_sequencer (GtkWidget * widg, gpointer data);
49
50#ifdef GTK3
59GtkWidget * menu_anim (glwin * view, int id)
60{
61 GtkWidget * menuanim = create_menu_item (FALSE, "Animate");
62 GtkWidget * menua = gtk_menu_new ();
63 gtk_menu_item_set_submenu ((GtkMenuItem *)menuanim, menua);
64 if (id == 0)
65 {
66 view -> ogl_anim[0] = gtk3_menu_item (menua, "Spin", IMG_STOCK, (gpointer)MEDIA_LOOP, G_CALLBACK(window_spinner), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
67 }
68 else
69 {
70 gtk3_menu_item (menua, "Spin", IMG_STOCK, (gpointer)MEDIA_LOOP, G_CALLBACK(window_spinner), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
71 }
72 GtkWidget * item = gtk3_menu_item (menua, "Sequencer", IMG_STOCK, (gpointer)MEDIA_PLAY, G_CALLBACK(window_sequencer), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
73 if (get_project_by_id(view -> proj) -> steps == 1)
74 {
75 widget_set_sensitive (item, 0);
76 }
77 if (id == 0)
78 {
79 view -> ogl_anim[1] = gtk3_menu_item (menua, "Recorder", IMG_STOCK, (gpointer)RECORD, G_CALLBACK(window_recorder), (gpointer)view, TRUE, GDK_KEY_r, GDK_CONTROL_MASK, FALSE, FALSE, FALSE);
80 }
81 else
82 {
83 gtk3_menu_item (menua, "Recorder", IMG_STOCK, (gpointer)RECORD, G_CALLBACK(window_recorder), (gpointer)view, TRUE, GDK_KEY_r, GDK_CONTROL_MASK, FALSE, FALSE, FALSE);
84 }
85 widget_set_sensitive (menuanim, get_project_by_id(view -> proj) -> natomes);
86 return (menuanim);
87}
88#else
98G_MODULE_EXPORT void to_spin (GSimpleAction * action, GVariant * parameter, gpointer data)
99{
100 window_spinner (NULL, data);
101}
102
112G_MODULE_EXPORT void to_seq (GSimpleAction * action, GVariant * parameter, gpointer data)
113{
114 window_sequencer (NULL, data);
115}
116
126G_MODULE_EXPORT void to_rec (GSimpleAction * action, GVariant * parameter, gpointer data)
127{
128 window_recorder (NULL, data);
129}
130
139GMenu * menu_anim (glwin * view, int popm)
140{
141 GMenu * menu = g_menu_new ();
142 append_opengl_item (view, menu, "Spin", "spin", popm, popm, NULL, IMG_STOCK, (gpointer)MEDIA_LOOP, FALSE, G_CALLBACK(to_spin), (gpointer)view, FALSE, FALSE, FALSE, TRUE);
143 append_opengl_item (view, menu, "Sequencer", "seq", popm, popm, NULL, IMG_STOCK, (gpointer)MEDIA_PLAY, FALSE, G_CALLBACK(to_seq), (gpointer)view, FALSE, FALSE, FALSE, TRUE);
144 append_opengl_item (view, menu, "Recorder", "rec", popm, popm, "<CTRL>R", IMG_STOCK, (gpointer)RECORD, FALSE, G_CALLBACK(to_rec), (gpointer)view, FALSE, FALSE, FALSE, TRUE);
145
146 return menu;
147}
148#endif
Global variable declarations Global convenience function declarations Global data structure defin...
@ IMG_STOCK
Definition global.h:236
GtkWidget * gtk3_menu_item(GtkWidget *menu, gchar *name, int icon_format, gpointer item_icon, GCallback handler, gpointer data, gboolean accel, guint key, GdkModifierType mod, gboolean check, gboolean radio, gboolean status)
#define MEDIA_LOOP
Definition global.h:161
project * proj
#define MEDIA_PLAY
Definition global.h:159
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
Definition gtk-misc.c:186
GtkWidget * create_menu_item(gboolean add_mnemo, gchar *action)
#define RECORD
Definition global.h:172
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
action
Definition glview.h:189
Function declarations for the creation of the OpenGL window.
void append_opengl_item(glwin *view, GMenu *menu, const gchar *name, gchar *key, int mpop, int item_id, gchar *accel, int image_format, gpointer icon, gboolean custom, GCallback handler, gpointer data, gboolean check, gboolean status, gboolean radio, gboolean sensitive)
G_MODULE_EXPORT void window_spinner(GtkWidget *widg, gpointer data)
create the spin window callback
Definition w_spiner.c:158
G_MODULE_EXPORT void to_rec(GSimpleAction *action, GVariant *parameter, gpointer data)
handle the recorder window creation signal
Definition m_anim.c:126
G_MODULE_EXPORT void to_spin(GSimpleAction *action, GVariant *parameter, gpointer data)
handle the spinner window creation signal
Definition m_anim.c:98
G_MODULE_EXPORT void window_recorder(GtkWidget *widg, gpointer data)
create video recorder window
Definition w_record.c:152
GMenu * menu_anim(glwin *view, int popm)
create the 'Animate' submenu elements
Definition m_anim.c:139
G_MODULE_EXPORT void to_seq(GSimpleAction *action, GVariant *parameter, gpointer data)
handle the sequencer window creation signal
Definition m_anim.c:112
G_MODULE_EXPORT void window_sequencer(GtkWidget *widg, gpointer data)
create the sequencer window
Definition glwin.h:875