atomes 1.1.16
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
w_record.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: 'w_record.c'
24*
25* Contains:
26*
27
28 - The functions to create the recording window
29
30*
31* List of functions:
32
33 void prepare_edition_windows (glwin * view, int status);
34
35 G_MODULE_EXPORT void rec_start (GtkButton * but, gpointer data);
36 G_MODULE_EXPORT void rec_stop (GtkButton * but, gpointer data);
37 G_MODULE_EXPORT void window_recorder (GtkWidget * widg, gpointer data);
38
39*/
40
41#include "global.h"
42#include "glview.h"
43
44extern void window_encode (glwin * view, gboolean video);
45
55{
56 GtkWidget * widg;
57 int i;
58 if (view -> atom_win != NULL)
59 {
60 if (view -> atom_win -> notebook != NULL)
61 {
62 if (GTK_IS_WIDGET(view -> atom_win -> notebook))
63 {
64 for (i=0; i<5; i++)
65 {
66 widg = gtk_notebook_get_nth_page (GTK_NOTEBOOK (view -> atom_win -> notebook), i);
68 }
69 }
70 }
71 }
72 if (view -> cell_win != NULL)
73 {
74 if (view -> cell_win -> notebook != NULL)
75 {
76 if (GTK_IS_WIDGET(view -> cell_win -> notebook))
77 {
78 widg = gtk_notebook_get_nth_page (GTK_NOTEBOOK (view -> cell_win -> notebook), 0);
80 widg = gtk_notebook_get_nth_page (GTK_NOTEBOOK (view -> cell_win -> notebook), 1);
82 widg = gtk_notebook_get_nth_page (GTK_NOTEBOOK (view -> cell_win -> notebook), 3);
84 widg = gtk_notebook_get_nth_page (GTK_NOTEBOOK (view -> cell_win -> notebook), 4);
86 widg = gtk_notebook_get_nth_page (GTK_NOTEBOOK (view -> cell_win -> notebook), 5);
88 }
89 }
90 }
91}
92
101G_MODULE_EXPORT void rec_start (GtkButton * but, gpointer data)
102{
103 glwin * view = (glwin *) data;
104 if (! view -> record)
105 {
106 button_set_image (GTK_BUTTON(view -> rec -> rec), NULL, IMG_STOCK, RECORD);
107 show_the_widgets (view -> rec -> rec);
108 widget_set_sensitive (view -> rec -> stop, 1);
109#ifdef GTK3
110 // GTK3 Menu Action To Check
111 widget_set_sensitive (view -> ogl_mode[1], 0);
112#endif
113 //gtk_widget_set_size_request (view -> plot, view -> pixels[0], view -> pixels[1]);
114 //gtk_window_set_resizable (GTK_WINDOW (view -> win), FALSE);
115 prepare_edition_windows (view, 0);
116 view -> record = TRUE;
117 }
118}
119
128G_MODULE_EXPORT void rec_stop (GtkButton * but, gpointer data)
129{
130 glwin * view = (glwin *) data;
131 view -> record = FALSE;
132 button_set_image (GTK_BUTTON(view -> rec -> rec), NULL, IMG_STOCK, YES);
133 show_the_widgets (view -> rec -> rec);
134 window_encode (view, TRUE);
135 widget_set_sensitive (view -> rec -> stop, 0);
136#ifdef GTK3
137 // GTK3 Menu Action To Check
138 widget_set_sensitive (view -> ogl_mode[1], 1);
139#endif
140 gtk_window_set_resizable (GTK_WINDOW (view -> win), TRUE);
141 prepare_edition_windows (view, 1);
142}
143
152G_MODULE_EXPORT void window_recorder (GtkWidget * widg, gpointer data)
153{
154 glwin * view = (glwin *) data;
155 if (view -> rec == NULL)
156 {
157 view -> rec = g_malloc0 (sizeof*view -> rec);
158 gchar * str = g_strdup_printf ("%s - record", get_project_by_id(view -> proj) -> name);
159 view -> rec -> win = create_win (str, view -> win, FALSE, FALSE);
160 g_free (str);
161 GtkWidget * hbox = create_hbox (0);
162 add_container_child (CONTAINER_WIN, view -> rec -> win, hbox);
163 // Record
164 view -> rec -> rec = create_button ("Record", IMG_STOCK, YES, -1, -1, GTK_RELIEF_NONE, G_CALLBACK(rec_start), data);
165 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, view -> rec -> rec, TRUE, TRUE, 0);
166 // Stop
167 view -> rec -> stop = create_button ("Stop", IMG_STOCK, MEDIA_STOP, -1, -1, GTK_RELIEF_NONE, G_CALLBACK(rec_stop), data);
168 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, view -> rec -> stop, TRUE, TRUE, 0);
169 widget_set_sensitive (view -> rec -> stop, view -> record);
170 add_gtk_close_event (view -> rec -> win, G_CALLBACK(hide_this_window), NULL);
171 show_the_widgets (view -> rec -> win);
172 }
173 else
174 {
175 show_the_widgets (view -> rec -> win);
176 }
177}
Global variable declarations Global convenience function declarations Global data structure defin...
@ IMG_STOCK
Definition global.h:264
GtkWidget * create_win(gchar *str, GtkWidget *parent, gboolean modal, gboolean resiz)
create a new GtkWindow
Definition gtk-misc.c:445
project * proj
G_MODULE_EXPORT gboolean hide_this_window(GtkWidget *win, GdkEvent *event, gpointer data)
hide a GtkWindow
Definition gtk-misc.c:2371
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:2387
#define YES
Definition global.h:201
@ CONTAINER_WIN
Definition global.h:250
GtkWidget * create_button(gchar *text, int image_format, gchar *image, int dimx, int dimy, int relief, GCallback handler, gpointer data)
create a simple button
Definition gtk-misc.c:1863
void button_set_image(GtkButton *but, gchar *text, int format, gpointer image)
Add an image to a GtkButton.
Definition gtk-misc.c:1677
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:299
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
Definition gtk-misc.c:206
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:813
#define RECORD
Definition global.h:200
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:226
#define MEDIA_STOP
Definition global.h:188
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:173
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
Definition glwin.h:875
int status
Definition w_advance.c:160
void window_encode(glwin *view, gboolean video)
encoding a movie - creating the dialog
Definition w_encode.c:319
G_MODULE_EXPORT void window_recorder(GtkWidget *widg, gpointer data)
create video recorder window
Definition w_record.c:152
void prepare_edition_windows(glwin *view, int status)
update the sensitivity of the edition window(s) if any are opened
Definition w_record.c:54
G_MODULE_EXPORT void rec_start(GtkButton *but, gpointer data)
start recording
Definition w_record.c:101
G_MODULE_EXPORT void rec_stop(GtkButton *but, gpointer data)
stop recording
Definition w_record.c:128
GtkWidget * hbox
Definition workspace.c:71