1 // gui.c
2 // LiVES
3 // (c) G. Finch 2004 - 2020 <salsaman+lives@gmail.com>
4 // Released under the GNU GPL 3 or later
5 // see file ../COPYING for licensing details
6
7 // code for drawing the main window
8
9 #include "main.h"
10 #include "callbacks.h"
11 #include "interface.h"
12 #include "effects.h"
13 #include "rfx-builder.h"
14 #include "paramwindow.h"
15 #include "resample.h"
16 #include "rte_window.h"
17 #include "stream.h"
18 #include "startup.h"
19 #include "ce_thumbs.h"
20
21 #ifdef ENABLE_OSC
22 #include "omc-learn.h"
23 #endif
24
25 #ifdef HAVE_YUV4MPEG
26 #include "lives-yuv4mpeg.h"
27 #endif
28
29 #ifdef HAVE_UNICAP
30 #include "videodev.h"
31 #endif
32
33 #ifdef HAVE_LDVGRAB
34 #include "ldvgrab.h"
35 #endif
36
37 // closures for keys for fade/unfade background
38 static LiVESWidgetClosure *stop_closure;
39 static LiVESWidgetClosure *fullscreen_closure;
40 static LiVESWidgetClosure *dblsize_closure;
41 static LiVESWidgetClosure *sepwin_closure;
42 static LiVESWidgetClosure *loop_closure;
43 static LiVESWidgetClosure *loop_cont_closure;
44 static LiVESWidgetClosure *fade_closure;
45 static LiVESWidgetClosure *showfct_closure;
46 static LiVESWidgetClosure *showsubs_closure;
47 static LiVESWidgetClosure *rec_closure;
48 static LiVESWidgetClosure *mute_audio_closure;
49 static LiVESWidgetClosure *ping_pong_closure;
50
51 static void _resize_play_window(void);
52
53 static boolean pb_added = FALSE;
54
get_vspace(void)55 LIVES_GLOBAL_INLINE int get_vspace(void) {
56 static int vspace = -1;
57 if (vspace == -1) {
58 LiVESPixbuf *sepbuf = lives_image_get_pixbuf(LIVES_IMAGE(mainw->sep_image));
59 vspace = (sepbuf ? lives_pixbuf_get_height(sepbuf) : 0);
60 }
61 return vspace;
62 }
63
64
load_theme_images(void)65 void load_theme_images(void) {
66 // load the theme images
67 // TODO - set palette in here ?
68 LiVESError *error = NULL;
69 LiVESPixbuf *pixbuf;
70
71 int width, height;
72
73 pixbuf = lives_pixbuf_new_from_file(mainw->sepimg_path, &error);
74
75 if (mainw->imsep) lives_widget_object_unref(mainw->imsep);
76 mainw->imsep = NULL;
77 if (mainw->imframe) lives_widget_object_unref(mainw->imframe);
78 mainw->imframe = NULL;
79
80 if (error) {
81 palette->style = STYLE_PLAIN;
82 LIVES_ERROR("Theme Error !");
83 lives_snprintf(prefs->theme, 64, "%%ERROR%%");
84 lives_error_free(error);
85 } else {
86 if (pixbuf) {
87 //resize
88 width = lives_pixbuf_get_width(pixbuf);
89 height = lives_pixbuf_get_height(pixbuf);
90 if (width > IMSEP_MAX_WIDTH || height > IMSEP_MAX_HEIGHT)
91 calc_maxspect(IMSEP_MAX_WIDTH, IMSEP_MAX_HEIGHT,
92 &width, &height);
93 if (prefs->screen_scale < 1.) {
94 width *= prefs->screen_scale;
95 height *= prefs->screen_scale;
96 }
97 mainw->imsep = lives_pixbuf_scale_simple(pixbuf, width, height, LIVES_INTERP_BEST);
98 lives_widget_object_unref(pixbuf);
99 }
100
101 lives_image_set_from_pixbuf(LIVES_IMAGE(mainw->sep_image), mainw->imsep);
102 // imframe
103
104 pixbuf = lives_pixbuf_new_from_file(mainw->frameblank_path, &error);
105
106 if (error) {
107 lives_error_free(error);
108 } else {
109 if (pixbuf) {
110 width = lives_pixbuf_get_width(pixbuf);
111 height = lives_pixbuf_get_height(pixbuf);
112
113 if (width < FRAMEBLANK_MIN_WIDTH) width = FRAMEBLANK_MIN_WIDTH;
114 if (width > FRAMEBLANK_MAX_WIDTH) width = FRAMEBLANK_MAX_WIDTH;
115 if (height < FRAMEBLANK_MIN_HEIGHT) height = FRAMEBLANK_MIN_HEIGHT;
116 if (height > FRAMEBLANK_MAX_HEIGHT) height = FRAMEBLANK_MAX_HEIGHT;
117
118 mainw->imframe = lives_pixbuf_scale_simple(pixbuf, width, height, LIVES_INTERP_BEST);
119 lives_widget_object_unref(pixbuf);
120 // *INDENT-OFF*
121 }}}
122 // *INDENT-ON*
123 }
124
125
make_custom_submenus(void)126 void make_custom_submenus(void) {
127 mainw->custom_effects_submenu = lives_standard_menu_item_new_with_label(_("_Custom Effects"));
128 lives_widget_set_no_show_all(mainw->custom_effects_submenu, TRUE);
129 mainw->custom_gens_submenu = lives_standard_menu_item_new_with_label(_("_Custom Generators"));
130 lives_widget_set_no_show_all(mainw->custom_gens_submenu, TRUE);
131 mainw->custom_utilities_submenu = lives_standard_menu_item_new_with_label(_("Custom _Utilities"));
132 lives_widget_set_no_show_all(mainw->custom_utilities_submenu, TRUE);
133 }
134
135
136 #if GTK_CHECK_VERSION(3, 0, 0)
expose_sim(LiVESWidget * widget,lives_painter_t * cr,livespointer user_data)137 boolean expose_sim(LiVESWidget * widget, lives_painter_t *cr, livespointer user_data) {
138 if (mainw->is_generating) return TRUE;
139 if (LIVES_IS_PLAYING && mainw->fs && (!mainw->sep_win || ((widget_opts.monitor == prefs->play_monitor ||
140 capable->nmonitors == 1) && (!mainw->ext_playback ||
141 (mainw->vpp->capabilities & VPP_LOCAL_DISPLAY))))) return TRUE;
142 lives_painter_set_source_surface(cr, mainw->si_surface, 0., 0.);
143 lives_painter_paint(cr);
144 return FALSE;
145 }
146
expose_eim(LiVESWidget * widget,lives_painter_t * cr,livespointer user_data)147 boolean expose_eim(LiVESWidget * widget, lives_painter_t *cr, livespointer user_data) {
148 if (mainw->is_generating) return TRUE;
149 if (LIVES_IS_PLAYING && mainw->fs && (!mainw->sep_win || ((widget_opts.monitor == prefs->play_monitor ||
150 capable->nmonitors == 1) && (!mainw->ext_playback ||
151 (mainw->vpp->capabilities & VPP_LOCAL_DISPLAY))))) return TRUE;
152 lives_painter_set_source_surface(cr, mainw->ei_surface, 0., 0.);
153 lives_painter_paint(cr);
154 return FALSE;
155 }
156
expose_pim(LiVESWidget * widget,lives_painter_t * cr,livespointer user_data)157 boolean expose_pim(LiVESWidget * widget, lives_painter_t *cr, livespointer user_data) {
158 //if (LIVES_IS_PLAYING) return FALSE;
159 if (mainw->is_generating) return TRUE;
160 lives_painter_set_source_surface(cr, mainw->pi_surface, 0., 0.);
161 lives_painter_paint(cr);
162 return FALSE;
163 }
164
165 #endif
166
167
set_colours(LiVESWidgetColor * colf,LiVESWidgetColor * colb,LiVESWidgetColor * colf2,LiVESWidgetColor * colb2,LiVESWidgetColor * colt,LiVESWidgetColor * coli)168 void set_colours(LiVESWidgetColor * colf, LiVESWidgetColor * colb, LiVESWidgetColor * colf2,
169 LiVESWidgetColor * colb2, LiVESWidgetColor * colt, LiVESWidgetColor * coli) {
170 LiVESWidget *label;
171 lives_widget_apply_theme(LIVES_MAIN_WINDOW_WIDGET, LIVES_WIDGET_STATE_NORMAL);
172
173 if (palette->style & STYLE_1) {
174 lives_widget_apply_theme2(mainw->menubar, LIVES_WIDGET_STATE_NORMAL, FALSE);
175 lives_widget_apply_theme2(mainw->menu_hbox, LIVES_WIDGET_STATE_NORMAL, FALSE);
176 lives_widget_apply_theme(mainw->eventbox3, LIVES_WIDGET_STATE_NORMAL);
177 lives_widget_apply_theme(mainw->freventbox0, LIVES_WIDGET_STATE_NORMAL);
178 lives_widget_apply_theme(mainw->frame1, LIVES_WIDGET_STATE_NORMAL);
179 lives_widget_apply_theme(mainw->eventbox4, LIVES_WIDGET_STATE_NORMAL);
180 lives_widget_apply_theme(mainw->freventbox1, LIVES_WIDGET_STATE_NORMAL);
181 lives_widget_apply_theme(mainw->frame2, LIVES_WIDGET_STATE_NORMAL);
182 lives_widget_apply_theme(mainw->pf_grid, LIVES_WIDGET_STATE_NORMAL);
183
184 lives_widget_apply_theme(mainw->start_image, LIVES_WIDGET_STATE_NORMAL);
185 lives_widget_apply_theme(mainw->end_image, LIVES_WIDGET_STATE_NORMAL);
186 }
187
188 lives_widget_set_bg_color(mainw->sa_hbox, LIVES_WIDGET_STATE_NORMAL, colb);
189
190 if (palette->style & STYLE_1) {
191 lives_widget_apply_theme2(mainw->vol_toolitem, LIVES_WIDGET_STATE_NORMAL, FALSE);
192 lives_widget_apply_theme2(mainw->volume_scale, LIVES_WIDGET_STATE_NORMAL, FALSE);
193 }
194
195 if (mainw->plug) lives_widget_set_bg_color(mainw->plug, LIVES_WIDGET_STATE_NORMAL, colb);
196
197 lives_widget_set_bg_color(mainw->sel_label, LIVES_WIDGET_STATE_NORMAL, colb);
198 lives_widget_set_bg_color(mainw->vidbar, LIVES_WIDGET_STATE_NORMAL, colb);
199 lives_widget_set_bg_color(mainw->laudbar, LIVES_WIDGET_STATE_NORMAL, colb);
200 lives_widget_set_bg_color(mainw->raudbar, LIVES_WIDGET_STATE_NORMAL, colb);
201
202 if (palette->style & STYLE_1) {
203 set_submenu_colours(LIVES_MENU(mainw->files_menu), colf2, colb2);
204 set_submenu_colours(LIVES_MENU(mainw->edit_menu), colf2, colb2);
205 set_submenu_colours(LIVES_MENU(mainw->play_menu), colf2, colb2);
206 set_submenu_colours(LIVES_MENU(mainw->effects_menu), colf2, colb2);
207 set_submenu_colours(LIVES_MENU(mainw->tools_menu), colf2, colb2);
208 set_submenu_colours(LIVES_MENU(mainw->audio_menu), colf2, colb2);
209 set_submenu_colours(LIVES_MENU(mainw->info_menu), colf2, colb2);
210 set_submenu_colours(LIVES_MENU(mainw->clipsmenu), colf2, colb2);
211 set_submenu_colours(LIVES_MENU(mainw->advanced_menu), colf2, colb2);
212 set_submenu_colours(LIVES_MENU(mainw->vj_menu), colf2, colb2);
213 set_submenu_colours(LIVES_MENU(mainw->toys_menu), colf2, colb2);
214 set_submenu_colours(LIVES_MENU(mainw->help_menu), colf2, colb2);
215
216 lives_widget_apply_theme2(mainw->l2_tb, LIVES_WIDGET_STATE_NORMAL, TRUE);
217 lives_widget_apply_theme2(mainw->l3_tb, LIVES_WIDGET_STATE_NORMAL, TRUE);
218 lives_widget_apply_theme2(mainw->l2_tb, LIVES_WIDGET_STATE_INSENSITIVE, TRUE);
219 lives_widget_apply_theme2(mainw->l3_tb, LIVES_WIDGET_STATE_INSENSITIVE, TRUE);
220
221 lives_widget_apply_theme2(mainw->btoolbar, LIVES_WIDGET_STATE_NORMAL, TRUE);
222 #if GTK_CHECK_VERSION(3, 16, 0)
223 if (mainw->pretty_colours) {
224 char *colref2 = gdk_rgba_to_string(&palette->menu_and_bars);
225 char *colref = gdk_rgba_to_string(&palette->normal_back);
226 char *tmp = lives_strdup_printf("linear-gradient(%s, %s)", colref2, colref);
227 int mh = 8;
228
229 set_css_value_direct(mainw->btoolbar, LIVES_WIDGET_STATE_NORMAL, "", "background-image", tmp);
230 set_css_value_direct(mainw->volume_scale, LIVES_WIDGET_STATE_NORMAL, "", "background-image", tmp);
231 tmp = lives_strdup_printf("%dpx", mh);
232
233 lives_free(colref); lives_free(colref2);
234
235 lives_widget_set_size_request(mainw->volume_scale, -1, 12);
236
237 set_css_value_direct(mainw->int_audio_checkbutton, LIVES_WIDGET_STATE_NORMAL, "*", "min-height", tmp);
238 set_css_value_direct(mainw->ext_audio_checkbutton, LIVES_WIDGET_STATE_NORMAL, "*", "min-height", tmp);
239
240 set_css_value_direct(mainw->int_audio_checkbutton, LIVES_WIDGET_STATE_NORMAL, "button", "min-height", tmp);
241 set_css_value_direct(mainw->ext_audio_checkbutton, LIVES_WIDGET_STATE_NORMAL, "button", "min-height", tmp);
242 lives_free(tmp);
243
244 set_css_value_direct(mainw->l2_tb, LIVES_WIDGET_STATE_NORMAL, "", "opacity", "0.4");
245 set_css_value_direct(mainw->l2_tb, LIVES_WIDGET_STATE_INSENSITIVE, "", "opacity", "1.0");
246
247 set_css_value_direct(mainw->l3_tb, LIVES_WIDGET_STATE_NORMAL, "", "opacity", "0.4");
248 set_css_value_direct(mainw->l3_tb, LIVES_WIDGET_STATE_INSENSITIVE, "", "opacity", "1.0");
249
250 set_css_value_direct(lives_widget_get_parent(mainw->l2_tb), LIVES_WIDGET_STATE_INSENSITIVE, "", "opacity", "1.0");
251 set_css_value_direct(lives_widget_get_parent(lives_widget_get_parent(mainw->l2_tb)),
252 LIVES_WIDGET_STATE_INSENSITIVE, "", "opacity", "1.0");
253 set_css_value_direct(lives_widget_get_parent(mainw->l2_tb), LIVES_WIDGET_STATE_NORMAL, "", "opacity", "1.0");
254 set_css_value_direct(lives_widget_get_parent(lives_widget_get_parent(mainw->l2_tb)),
255 LIVES_WIDGET_STATE_NORMAL, "", "opacity", "1.0");
256 set_css_value_direct(lives_widget_get_parent(mainw->l3_tb), LIVES_WIDGET_STATE_INSENSITIVE, "", "opacity", "1.0");
257 set_css_value_direct(lives_widget_get_parent(lives_widget_get_parent(mainw->l3_tb)),
258 LIVES_WIDGET_STATE_INSENSITIVE, "", "opacity", "1.0");
259 set_css_value_direct(lives_widget_get_parent(mainw->l3_tb), LIVES_WIDGET_STATE_NORMAL, "", "opacity", "1.0");
260 set_css_value_direct(lives_widget_get_parent(lives_widget_get_parent(mainw->l3_tb)),
261 LIVES_WIDGET_STATE_NORMAL, "", "opacity", "1.0");
262
263 lives_widget_set_valign(mainw->int_audio_checkbutton, LIVES_ALIGN_START);
264 lives_widget_set_valign(mainw->ext_audio_checkbutton, LIVES_ALIGN_START);
265
266 lives_widget_set_valign(mainw->l1_tb, LIVES_ALIGN_START);
267 lives_widget_set_valign(mainw->l2_tb, LIVES_ALIGN_START);
268 lives_widget_set_valign(mainw->l3_tb, LIVES_ALIGN_START);
269 lives_widget_set_valign(mainw->volume_scale, LIVES_ALIGN_START);
270
271 gtk_button_set_image_position(LIVES_BUTTON(mainw->volume_scale), LIVES_POS_TOP);
272 set_css_value_direct(mainw->vol_toolitem, LIVES_WIDGET_STATE_NORMAL, "", "box-shadow", "none");
273 }
274 #endif
275 lives_widget_set_fg_color(mainw->l2_tb, LIVES_WIDGET_STATE_NORMAL, colf2);
276 lives_widget_set_fg_color(mainw->l3_tb, LIVES_WIDGET_STATE_NORMAL, colf2);
277 lives_widget_set_fg_color(mainw->l2_tb, LIVES_WIDGET_STATE_INSENSITIVE, colf2);
278 lives_widget_set_fg_color(mainw->l3_tb, LIVES_WIDGET_STATE_INSENSITIVE, colf2);
279
280 lives_widget_set_bg_color(mainw->eventbox, LIVES_WIDGET_STATE_NORMAL, colb);
281
282 lives_widget_set_base_color(lives_frame_get_label_widget(LIVES_FRAME(mainw->frame1)),
283 LIVES_WIDGET_STATE_NORMAL, colb);
284 lives_widget_set_text_color(lives_frame_get_label_widget(LIVES_FRAME(mainw->frame1)),
285 LIVES_WIDGET_STATE_NORMAL, colf);
286
287 lives_widget_set_bg_color(mainw->pl_eventbox, LIVES_WIDGET_STATE_NORMAL, colb);
288 lives_widget_set_bg_color(mainw->play_image, LIVES_WIDGET_STATE_NORMAL, colb);
289 lives_widget_set_bg_color(mainw->freventbox1, LIVES_WIDGET_STATE_NORMAL, colb);
290
291 lives_widget_set_bg_color(mainw->eventbox4, LIVES_WIDGET_STATE_NORMAL, colb);
292 lives_widget_set_fg_color(mainw->eventbox4, LIVES_WIDGET_STATE_NORMAL, colb);
293 }
294 lives_widget_set_bg_color(mainw->top_vbox, LIVES_WIDGET_STATE_NORMAL, colb);
295 lives_widget_apply_theme(mainw->eventbox2, LIVES_WIDGET_STATE_NORMAL);
296 if (mainw->eventbox5) lives_widget_set_bg_color(mainw->eventbox5,
297 LIVES_WIDGET_STATE_NORMAL, colb);
298
299 /// no theme !
300 lives_widget_set_bg_color(mainw->hruler, LIVES_WIDGET_STATE_NORMAL, colb);
301 lives_widget_set_fg_color(mainw->hruler, LIVES_WIDGET_STATE_NORMAL, colf);
302
303 lives_widget_set_bg_color(mainw->pf_grid, LIVES_WIDGET_STATE_NORMAL, colb);
304 lives_widget_set_bg_color(mainw->eventbox3, LIVES_WIDGET_STATE_NORMAL, colb);
305 lives_widget_set_bg_color(mainw->eventbox4, LIVES_WIDGET_STATE_NORMAL, colb);
306 lives_widget_set_bg_color(mainw->frame1, LIVES_WIDGET_STATE_NORMAL, colb);
307 lives_widget_set_bg_color(mainw->frame2, LIVES_WIDGET_STATE_NORMAL, colb);
308
309 lives_widget_set_fg_color(mainw->vidbar, LIVES_WIDGET_STATE_NORMAL, colf);
310 lives_widget_set_fg_color(mainw->laudbar, LIVES_WIDGET_STATE_NORMAL, colf);
311 lives_widget_set_fg_color(mainw->raudbar, LIVES_WIDGET_STATE_NORMAL, colf);
312
313 lives_widget_apply_theme(mainw->video_draw, LIVES_WIDGET_STATE_NORMAL);
314 lives_widget_apply_theme(mainw->laudio_draw, LIVES_WIDGET_STATE_NORMAL);
315 lives_widget_apply_theme(mainw->raudio_draw, LIVES_WIDGET_STATE_NORMAL);
316
317 lives_widget_apply_theme(mainw->vps_label, LIVES_WIDGET_STATE_NORMAL);
318
319 lives_widget_set_fg_color(mainw->banner, LIVES_WIDGET_STATE_NORMAL, colf);
320 lives_widget_set_fg_color(mainw->arrow1, LIVES_WIDGET_STATE_NORMAL, colf);
321
322 lives_widget_set_fg_color(mainw->sel_label, LIVES_WIDGET_STATE_NORMAL, colf);
323
324 lives_widget_set_fg_color(mainw->arrow2, LIVES_WIDGET_STATE_NORMAL, colf);
325
326 lives_widget_set_bg_color(mainw->playframe, LIVES_WIDGET_STATE_NORMAL, colb);
327
328 label = lives_frame_get_label_widget(LIVES_FRAME(mainw->playframe));
329 if (label) {
330 lives_widget_set_base_color(label, LIVES_WIDGET_STATE_NORMAL, colb);
331 lives_widget_set_text_color(label, LIVES_WIDGET_STATE_NORMAL, colf);
332 }
333
334 lives_widget_set_text_color(lives_frame_get_label_widget(LIVES_FRAME(mainw->frame1)), LIVES_WIDGET_STATE_NORMAL, colf);
335 lives_widget_set_text_color(lives_frame_get_label_widget(LIVES_FRAME(mainw->frame2)), LIVES_WIDGET_STATE_NORMAL, colf);
336
337 lives_widget_set_base_color(lives_frame_get_label_widget(LIVES_FRAME(mainw->frame2)), LIVES_WIDGET_STATE_NORMAL, colb);
338 lives_widget_set_base_color(lives_frame_get_label_widget(LIVES_FRAME(mainw->frame2)), LIVES_WIDGET_STATE_NORMAL, colb);
339
340 if (prefs->show_msg_area) {
341 lives_widget_set_fg_color(mainw->message_box, LIVES_WIDGET_STATE_NORMAL, colf);
342 lives_widget_set_bg_color(mainw->msg_scrollbar, LIVES_WIDGET_STATE_NORMAL, colb2);
343 }
344
345 lives_widget_set_fg_color(mainw->pf_grid, LIVES_WIDGET_STATE_NORMAL, colb);
346
347 lives_widget_set_bg_color(lives_widget_get_parent(mainw->framebar), LIVES_WIDGET_STATE_NORMAL, colb);
348 lives_widget_set_bg_color(mainw->framebar, LIVES_WIDGET_STATE_NORMAL, colb);
349
350 if (palette->style & STYLE_2) {
351 lives_widget_set_base_color(mainw->spinbutton_start, LIVES_WIDGET_STATE_NORMAL, colb);
352 lives_widget_set_base_color(mainw->spinbutton_start, LIVES_WIDGET_STATE_INSENSITIVE, colb);
353 lives_widget_set_base_color(mainw->spinbutton_end, LIVES_WIDGET_STATE_NORMAL, colb);
354 lives_widget_set_base_color(mainw->spinbutton_end, LIVES_WIDGET_STATE_INSENSITIVE, colb);
355 lives_widget_set_text_color(mainw->spinbutton_start, LIVES_WIDGET_STATE_NORMAL, colf);
356 lives_widget_set_text_color(mainw->spinbutton_end, LIVES_WIDGET_STATE_NORMAL, colf);
357 }
358
359 lives_widget_set_fg_color(mainw->sel_label, LIVES_WIDGET_STATE_NORMAL, colf);
360
361 lives_widget_set_bg_color(mainw->tb_hbox, LIVES_WIDGET_STATE_NORMAL, &palette->fade_colour);
362 lives_widget_set_bg_color(mainw->toolbar, LIVES_WIDGET_STATE_NORMAL, &palette->fade_colour);
363 }
364
365
create_LiVES(void)366 void create_LiVES(void) {
367 #ifdef GUI_GTK
368 #if !GTK_CHECK_VERSION(3, 0, 0)
369 LiVESWidget *alignment;
370 #endif
371 #endif
372 LiVESWidget *vbox;
373 LiVESWidget *hbox;
374 LiVESWidget *vbox2;
375 LiVESWidget *menuitem;
376 LiVESWidget *select_submenu_menu;
377 LiVESWidget *submenu_menu;
378 LiVESWidget *export_submenu_menu;
379 LiVESWidget *trimaudio_submenu_menu;
380 LiVESWidget *delaudio_submenu_menu;
381 LiVESWidget *menuitemsep;
382 #if LIVES_HAS_IMAGE_MENU_ITEM
383 LiVESWidget *image;
384 #endif
385 LiVESWidget *rfx_menu;
386 LiVESWidget *rfx_submenu;
387 LiVESWidget *midi_menu;
388 LiVESWidget *midi_submenu;
389 LiVESWidget *midi_load;
390 LiVESWidget *win;
391 LiVESWidget *about;
392 LiVESWidget *show_manual;
393 LiVESWidget *email_author;
394 LiVESWidget *donate;
395 LiVESWidget *report_bug;
396 LiVESWidget *suggest_feature;
397 LiVESWidget *help_translate;
398 LiVESWidget *vbox4;
399 LiVESWidget *vbox99;
400 LiVESWidget *label;
401 LiVESWidget *hseparator;
402 LiVESWidget *t_label;
403
404 #if defined HAVE_YUV4MPEG || defined HAVE_UNICAP
405 LiVESWidget *submenu;
406 #endif
407
408 LiVESWidget *new_test_rfx;
409 LiVESWidget *copy_rfx;
410 LiVESWidget *import_custom_rfx;
411 LiVESWidget *rebuild_rfx;
412 LiVESWidget *assign_rte_keys;
413
414 LiVESWidget *tmp_toolbar_icon;
415
416 LiVESAdjustment *adj;
417
418 char buff[32768];
419
420 char *tmp;
421
422 int i;
423 int dpw;
424 int woat;
425 boolean new_lives = FALSE;
426
427 mainw->configured = FALSE;
428 mainw->assumed_width = mainw->assumed_height = -1;
429
430 stop_closure = fullscreen_closure = dblsize_closure = sepwin_closure = loop_closure = NULL;
431 loop_cont_closure = fade_closure = showfct_closure = showsubs_closure = NULL;
432 rec_closure = mute_audio_closure = ping_pong_closure = NULL;
433
434 if (!LIVES_MAIN_WINDOW_WIDGET) {
435 new_lives = TRUE;
436 LIVES_MAIN_WINDOW_WIDGET = lives_window_new(LIVES_WINDOW_TOPLEVEL);
437 lives_container_set_border_width(LIVES_CONTAINER(LIVES_MAIN_WINDOW_WIDGET), 0);
438 lives_window_set_monitor(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET), widget_opts.monitor);
439 lives_widget_add_events(LIVES_MAIN_WINDOW_WIDGET, LIVES_KEY_PRESS_MASK | LIVES_KEY_RELEASE_MASK);
440 mainw->config_func = lives_signal_sync_connect(LIVES_GUI_OBJECT(LIVES_MAIN_WINDOW_WIDGET),
441 LIVES_WIDGET_CONFIGURE_EVENT, LIVES_GUI_CALLBACK(config_event), NULL);
442 }
443 ////////////////////////////////////
444
445 mainw->double_size = mainw->sep_win = FALSE;
446
447 mainw->current_file = -1;
448
449 if (!mainw->preview_box) mainw->preview_image = NULL;
450 mainw->sep_image = lives_image_new_from_pixbuf(NULL);
451 mainw->imframe = mainw->imsep = NULL;
452
453 mainw->start_image = lives_standard_drawing_area_new(LIVES_GUI_CALLBACK(expose_sim), &mainw->si_surface);
454 mainw->end_image = lives_standard_drawing_area_new(LIVES_GUI_CALLBACK(expose_eim), &mainw->ei_surface);
455
456 lives_widget_show(mainw->start_image); // needed to get size
457 lives_widget_show(mainw->end_image); // needed to get size
458
459 if (palette->style & STYLE_1) {
460 load_theme_images();
461 } else {
462 #ifdef GUI_GTK
463 LiVESWidgetColor normal;
464 #if !GTK_CHECK_VERSION(3, 0, 0)
465 if (!mainw->foreign) {
466 gtk_widget_ensure_style(LIVES_MAIN_WINDOW_WIDGET);
467 }
468 #endif
469 #endif
470
471 lives_widget_get_bg_state_color(LIVES_MAIN_WINDOW_WIDGET, LIVES_WIDGET_STATE_NORMAL, &normal);
472 lives_widget_color_copy((LiVESWidgetColor *)(&palette->normal_back), &normal);
473
474 lives_widget_get_fg_color(LIVES_MAIN_WINDOW_WIDGET, &normal);
475 lives_widget_color_copy((LiVESWidgetColor *)(&palette->normal_fore), &normal);
476 }
477
478 if (!new_lives) {
479 lives_window_remove_accel_group(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET), mainw->accel_group);
480 }
481 mainw->accel_group = LIVES_ACCEL_GROUP(lives_accel_group_new());
482
483 mainw->layout_textbuffer = lives_text_buffer_new();
484 lives_widget_object_ref(mainw->layout_textbuffer);
485 mainw->affected_layouts_map = NULL;
486
487 lives_window_set_hide_titlebar_when_maximized(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET), TRUE);
488
489 if (new_lives) {
490 #ifdef GUI_GTK
491 // TODO - can we use just DEFAULT_DROP ?
492 gtk_drag_dest_set(LIVES_MAIN_WINDOW_WIDGET, GTK_DEST_DEFAULT_ALL, mainw->target_table, 2,
493 (GdkDragAction)(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK));
494
495 lives_signal_connect(LIVES_GUI_OBJECT(LIVES_MAIN_WINDOW_WIDGET), LIVES_WIDGET_DRAG_DATA_RECEIVED_SIGNAL,
496 LIVES_GUI_CALLBACK(drag_from_outside), NULL);
497 #endif
498 lives_window_set_decorated(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET), prefs->open_decorated);
499 }
500 mainw->top_vbox = lives_vbox_new(FALSE, 0);
501 lives_container_add(LIVES_CONTAINER(LIVES_MAIN_WINDOW_WIDGET), mainw->top_vbox);
502 lives_container_set_border_width(LIVES_CONTAINER(mainw->top_vbox), 0);
503
504 //lives_widget_set_valign(mainw->top_vbox, LIVES_ALIGN_FILL);
505
506 // top_vbox contains the following:
507 // - menu_hbox -> menubar -> menuitems
508 //
509 // - tb_hbox -> toolbar -> buttons etc
510 //
511 // - eventbox (allows scrollwheel clip selection)
512 // - vbox99
513 // - vbox4
514 // - framebar (could probably become a direct child of top_vbox)
515 // - fps spin
516 // - banner (not always shown)
517 // - framecounter
518 //
519 // - pf_grid
520 // (- alignment : only for gtk+ 2.x)
521 // - eventbox3 (to allow context menu clicks)
522 // - frame1 (could probably become a direct child of pf_grid)
523 // - freventbox1
524 // - start_image
525 // - playframe
526 // - pl_eventbox
527 // - playarea --> can be reparented to multitrack play_box (or anywhere)
528 // - plug
529 // - play_image
530 // - eventbox4 (ditto)
531 // - frame2 (ditto)
532 // - freventbox2
533 // - end_image
534 // - hbox3
535 // - start_spinbutton
536 // - vbox
537 // - hbox
538 // - arrow1
539 // - sel_label
540 // - arrow2
541 // - sa_hbox
542 // - sa_button
543 // - end_spinbutton
544 // - sepimg / hseparator
545 //
546 // - hruler (timeline)
547 // - eventbox2 (mouse clicks etc)
548 // - vidbar
549 // - video_draw
550 // - video_drawable (cairo surface)
551 // - laudbar
552 // - laudio_draw
553 // - laudio_drawable (cairo surface)
554 // - raudbar
555 // - raudio_draw
556 // - raudio_drawable (cairo surface)
557 // - message_box
558 // - msg_area
559 // - msg_scrollbar
560
561 mainw->menu_hbox = lives_hbox_new(FALSE, 0);
562 lives_box_pack_start(LIVES_BOX(mainw->top_vbox), mainw->menu_hbox, FALSE, FALSE, 0);
563 lives_widget_set_valign(mainw->menu_hbox, LIVES_ALIGN_START);
564
565 if (!widget_opts.apply_theme) {
566 hseparator = lives_hseparator_new();
567 lives_box_pack_start(LIVES_BOX(mainw->top_vbox), hseparator, FALSE, FALSE, 0);
568 }
569
570 mainw->menubar = lives_menu_bar_new();
571 lives_box_pack_start(LIVES_BOX(mainw->menu_hbox), mainw->menubar, FALSE, FALSE, 0);
572
573 menuitem = lives_standard_menu_item_new_with_label(_("_File"));
574 lives_container_add(LIVES_CONTAINER(mainw->menubar), menuitem);
575
576 mainw->files_menu = lives_menu_new();
577 lives_menu_set_accel_group(LIVES_MENU(mainw->files_menu), mainw->accel_group);
578
579 lives_menu_item_set_submenu(LIVES_MENU_ITEM(menuitem), mainw->files_menu);
580
581 mainw->open = lives_standard_menu_item_new_with_label(_("_Open File/Directory"));
582 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->open);
583 lives_widget_add_accelerator(mainw->open, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
584 LIVES_KEY_o, LIVES_CONTROL_MASK,
585 LIVES_ACCEL_VISIBLE);
586
587 mainw->open_sel = lives_standard_menu_item_new_with_label(_("O_pen Part of File..."));
588
589 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->open_sel);
590
591 mainw->open_loc = lives_standard_menu_item_new_with_label(_("Play Remote _Stream..."));
592
593 mainw->open_loc_menu = lives_standard_menu_item_new_with_label(_("Open _Online Clip..."));
594 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->open_loc_menu);
595
596 mainw->open_loc_submenu = lives_menu_new();
597 lives_menu_item_set_submenu(LIVES_MENU_ITEM(mainw->open_loc_menu), mainw->open_loc_submenu);
598
599 mainw->open_utube = lives_standard_menu_item_new_with_label(_("Download from _Youtube or other site..."));
600 lives_container_add(LIVES_CONTAINER(mainw->open_loc_submenu), mainw->open_utube);
601
602 lives_container_add(LIVES_CONTAINER(mainw->open_loc_submenu), mainw->open_loc);
603
604 mainw->open_vcd_menu = lives_standard_menu_item_new_with_label(_("Import from _dvd/vcd..."));
605
606 // TODO: show these options, but give errors for no mplayer / mplayer2
607 // TODO - mpv
608 #ifdef ENABLE_DVD_GRAB
609 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->open_vcd_menu);
610 #endif
611
612 mainw->open_vcd_submenu = lives_menu_new();
613 lives_menu_item_set_submenu(LIVES_MENU_ITEM(mainw->open_vcd_menu), mainw->open_vcd_submenu);
614
615 mainw->open_dvd = lives_standard_menu_item_new_with_label(_("Import from _dvd"));
616 mainw->open_vcd = lives_standard_menu_item_new_with_label(_("Import from _vcd"));
617
618 lives_container_add(LIVES_CONTAINER(mainw->open_vcd_submenu), mainw->open_dvd);
619 lives_container_add(LIVES_CONTAINER(mainw->open_vcd_submenu), mainw->open_vcd);
620
621 mainw->open_device_menu = lives_standard_menu_item_new_with_label(_("_Import from Firewire"));
622 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->open_device_menu);
623 mainw->open_device_submenu = lives_menu_new();
624 lives_menu_item_set_submenu(LIVES_MENU_ITEM(mainw->open_device_menu), mainw->open_device_submenu);
625
626 mainw->open_firewire = lives_standard_menu_item_new_with_label(_("Import from _Firewire Device (dv)"));
627 mainw->open_hfirewire = lives_standard_menu_item_new_with_label(_("Import from _Firewire Device (hdv)"));
628
629 #ifdef HAVE_LDVGRAB
630 lives_container_add(LIVES_CONTAINER(mainw->open_device_submenu), mainw->open_firewire);
631 lives_container_add(LIVES_CONTAINER(mainw->open_device_submenu), mainw->open_hfirewire);
632 #endif
633
634 menuitem = lives_standard_menu_item_new_with_label(_("_Add Webcam/TV card..."));
635 mainw->unicap = lives_standard_menu_item_new_with_label(_("Add Webcam"));
636 mainw->firewire = lives_standard_menu_item_new_with_label(_("Add Live _Firewire Device"));
637 mainw->tvdev = lives_standard_menu_item_new_with_label(_("Add _TV Device"));
638
639 #if defined(HAVE_UNICAP) || defined(HAVE_YUV4MPEG)
640 lives_container_add(LIVES_CONTAINER(mainw->files_menu), menuitem);
641
642 submenu = lives_menu_new();
643 lives_menu_item_set_submenu(LIVES_MENU_ITEM(menuitem), submenu);
644
645 #ifdef HAVE_UNICAP
646 lives_container_add(LIVES_CONTAINER(submenu), mainw->unicap);
647 lives_signal_connect(LIVES_GUI_OBJECT(mainw->unicap), LIVES_WIDGET_ACTIVATE_SIGNAL,
648 LIVES_GUI_CALLBACK(on_open_vdev_activate), NULL);
649 #endif
650
651 #ifdef HAVE_YUV4MPEG
652 // TODO: mpv
653 if (capable->has_dvgrab) {
654 if (HAS_EXTERNAL_PLAYER && !USE_MPV) {
655 lives_container_add(LIVES_CONTAINER(submenu), mainw->firewire);
656
657 lives_signal_connect(LIVES_GUI_OBJECT(mainw->firewire), LIVES_WIDGET_ACTIVATE_SIGNAL,
658 LIVES_GUI_CALLBACK(on_live_fw_activate), NULL);
659 }
660
661 lives_container_add(LIVES_CONTAINER(submenu), mainw->tvdev);
662
663 lives_signal_connect(LIVES_GUI_OBJECT(mainw->tvdev), LIVES_WIDGET_ACTIVATE_SIGNAL,
664 LIVES_GUI_CALLBACK(on_live_tvcard_activate), NULL);
665 }
666
667 #endif
668 #endif // defined HAVE_UNICAP || defined HAVE_YUV4MPEG
669
670 mainw->recent_menu = lives_standard_menu_item_new_with_label(_("_Recent Files..."));
671 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->recent_menu);
672 mainw->recent_submenu = lives_menu_new();
673 lives_menu_item_set_submenu(LIVES_MENU_ITEM(mainw->recent_menu), mainw->recent_submenu);
674
675 buff[0] = 0;
676 widget_opts.mnemonic_label = FALSE;
677 for (i = 0; i < N_RECENT_FILES; i++) {
678 char *prefname = lives_strdup_printf("%s%d", PREF_RECENT, i + 1);
679 get_utf8_pref(prefname, buff, PATH_MAX * 2);
680 lives_free(prefname);
681 for (register int j = 0; buff[j]; j++) {
682 if (buff[j] == '\n') {
683 buff[j] = 0;
684 break;
685 }
686 }
687 mainw->recent[i] = lives_standard_menu_item_new_with_label(buff);
688 lives_widget_set_no_show_all(mainw->recent[i], TRUE);
689 lives_container_add(LIVES_CONTAINER(mainw->recent_submenu), mainw->recent[i]);
690 lives_signal_connect(LIVES_GUI_OBJECT(mainw->recent[i]), LIVES_WIDGET_ACTIVATE_SIGNAL,
691 LIVES_GUI_CALLBACK(on_recent_activate), LIVES_INT_TO_POINTER(i + 1));
692 }
693 widget_opts.mnemonic_label = TRUE;
694
695 lives_menu_add_separator(LIVES_MENU(mainw->files_menu));
696
697 mainw->vj_load_set = lives_standard_menu_item_new_with_label(_("_Reload Clip Set..."));
698 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->vj_load_set);
699
700 mainw->vj_save_set = lives_standard_menu_item_new_with_label(_("Close/Sa_ve All Clips"));
701 lives_widget_set_sensitive(mainw->vj_save_set, FALSE);
702 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->vj_save_set);
703
704 lives_menu_add_separator(LIVES_MENU(mainw->files_menu));
705
706 #ifdef LIBAV_TRANSCODE
707 mainw->transcode = lives_standard_menu_item_new_with_label(_("_Quick Transcode..."));
708 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->transcode);
709 lives_widget_set_sensitive(mainw->transcode, FALSE);
710
711 lives_menu_add_separator(LIVES_MENU(mainw->files_menu));
712 #endif
713
714 mainw->save_as = lives_standard_image_menu_item_new_from_stock(LIVES_STOCK_LABEL_SAVE, mainw->accel_group);
715 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->save_as);
716 lives_widget_set_sensitive(mainw->save_as, FALSE);
717 lives_menu_item_set_text(mainw->save_as, _("_Encode Clip As..."), TRUE);
718
719 mainw->save_selection = lives_standard_menu_item_new_with_label(_("Encode _Selection As..."));
720 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->save_selection);
721 lives_widget_set_sensitive(mainw->save_selection, FALSE);
722
723 mainw->close = lives_standard_menu_item_new_with_label(_("_Close This Clip"));
724 lives_widget_add_accelerator(mainw->close, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
725 LIVES_KEY_w, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
726
727 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->close);
728 lives_widget_set_sensitive(mainw->close, FALSE);
729
730 lives_menu_add_separator(LIVES_MENU(mainw->files_menu));
731
732 mainw->backup = lives_standard_menu_item_new_with_label((tmp = lives_strdup_printf(_("_Backup Clip as .%s..."),
733 LIVES_FILE_EXT_BACKUP)));
734 lives_free(tmp);
735 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->backup);
736 lives_widget_set_sensitive(mainw->backup, FALSE);
737
738 lives_widget_add_accelerator(mainw->backup, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
739 LIVES_KEY_b, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
740
741 mainw->restore = lives_standard_menu_item_new_with_label((tmp = lives_strdup_printf(_("_Restore Clip from .%s..."),
742 LIVES_FILE_EXT_BACKUP)));
743 lives_free(tmp);
744 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->restore);
745
746 lives_widget_add_accelerator(mainw->restore, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
747 LIVES_KEY_r, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
748
749 lives_menu_add_separator(LIVES_MENU(mainw->files_menu));
750
751 mainw->sw_sound = lives_standard_check_menu_item_new_with_label(_("Encode/Load/Backup _with Sound"), TRUE);
752 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->sw_sound);
753
754 if (prefs->vj_mode) {
755 lives_widget_set_sensitive(mainw->sw_sound, FALSE);
756 lives_check_menu_item_set_active(LIVES_CHECK_MENU_ITEM(mainw->sw_sound), FALSE);
757 }
758
759 mainw->aload_subs = lives_standard_check_menu_item_new_with_label(_("Auto load subtitles"), prefs->autoload_subs);
760 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->aload_subs);
761
762 lives_menu_add_separator(LIVES_MENU(mainw->files_menu));
763
764 mainw->clear_ds = lives_standard_menu_item_new_with_label(_("Clean _up Diskspace / Recover Missing Clips"));
765 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->clear_ds);
766
767 mainw->quit = lives_standard_image_menu_item_new_from_stock(LIVES_STOCK_LABEL_QUIT, mainw->accel_group);
768 lives_container_add(LIVES_CONTAINER(mainw->files_menu), mainw->quit);
769
770 menuitem = lives_standard_menu_item_new_with_label(_("_Edit"));
771 lives_container_add(LIVES_CONTAINER(mainw->menubar), menuitem);
772
773 mainw->edit_menu = lives_menu_new();
774 lives_menu_item_set_submenu(LIVES_MENU_ITEM(menuitem), mainw->edit_menu);
775
776 mainw->undo = lives_standard_image_menu_item_new_with_label(_("_Undo"));
777
778 lives_container_add(LIVES_CONTAINER(mainw->edit_menu), mainw->undo);
779 lives_widget_set_sensitive(mainw->undo, FALSE);
780
781 lives_widget_add_accelerator(mainw->undo, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
782 LIVES_KEY_u, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
783
784 #if LIVES_HAS_IMAGE_MENU_ITEM
785 image = lives_image_new_from_stock(LIVES_STOCK_UNDO, LIVES_ICON_SIZE_MENU);
786
787 lives_image_menu_item_set_image(LIVES_IMAGE_MENU_ITEM(mainw->undo), image);
788 #endif
789
790 mainw->redo = lives_standard_image_menu_item_new_with_label(_("_Redo"));
791 lives_container_add(LIVES_CONTAINER(mainw->edit_menu), mainw->redo);
792 lives_widget_set_sensitive(mainw->redo, FALSE);
793
794 lives_widget_add_accelerator(mainw->redo, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
795 LIVES_KEY_z, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
796
797 #if LIVES_HAS_IMAGE_MENU_ITEM
798 image = lives_image_new_from_stock(LIVES_STOCK_REDO, LIVES_ICON_SIZE_MENU);
799
800 lives_image_menu_item_set_image(LIVES_IMAGE_MENU_ITEM(mainw->redo), image);
801 #endif
802
803 lives_menu_add_separator(LIVES_MENU(mainw->edit_menu));
804
805 mainw->mt_menu = lives_standard_image_menu_item_new_with_label(_("_MULTITRACK mode"));
806 lives_container_add(LIVES_CONTAINER(mainw->edit_menu), mainw->mt_menu);
807
808 lives_menu_add_separator(LIVES_MENU(mainw->edit_menu));
809
810 lives_widget_add_accelerator(mainw->mt_menu, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
811 LIVES_KEY_m, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
812
813 mainw->copy = lives_standard_image_menu_item_new_with_label(_("_Copy Selection"));
814 lives_container_add(LIVES_CONTAINER(mainw->edit_menu), mainw->copy);
815 lives_widget_set_sensitive(mainw->copy, FALSE);
816
817 lives_widget_add_accelerator(mainw->copy, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
818 LIVES_KEY_c, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
819
820 mainw->cut = lives_standard_image_menu_item_new_with_label(_("Cu_t Selection"));
821 lives_container_add(LIVES_CONTAINER(mainw->edit_menu), mainw->cut);
822 lives_widget_set_sensitive(mainw->cut, FALSE);
823
824 lives_widget_add_accelerator(mainw->cut, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
825 LIVES_KEY_t, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
826
827 mainw->insert = lives_standard_image_menu_item_new_with_label(_("_Insert from Clipboard..."));
828 lives_container_add(LIVES_CONTAINER(mainw->edit_menu), mainw->insert);
829 lives_widget_set_sensitive(mainw->insert, FALSE);
830
831 lives_widget_add_accelerator(mainw->insert, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
832 LIVES_KEY_i, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
833
834 #if LIVES_HAS_IMAGE_MENU_ITEM
835 image = lives_image_new_from_stock(LIVES_STOCK_ADD, LIVES_ICON_SIZE_MENU);
836
837 lives_image_menu_item_set_image(LIVES_IMAGE_MENU_ITEM(mainw->insert), image);
838 #endif
839
840 mainw->paste_as_new = lives_standard_image_menu_item_new_with_label(_("Paste as _New"));
841 lives_container_add(LIVES_CONTAINER(mainw->edit_menu), mainw->paste_as_new);
842 lives_widget_set_sensitive(mainw->paste_as_new, FALSE);
843
844 lives_widget_add_accelerator(mainw->paste_as_new, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
845 LIVES_KEY_n, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
846
847 mainw->merge = lives_standard_menu_item_new_with_label(_("_Merge Clipboard with Selection..."));
848
849 lives_container_add(LIVES_CONTAINER(mainw->edit_menu), mainw->merge);
850 lives_widget_set_sensitive(mainw->merge, FALSE);
851
852 mainw->xdelete = lives_standard_image_menu_item_new_with_label(_("_Delete Selection"));
853 lives_container_add(LIVES_CONTAINER(mainw->edit_menu), mainw->xdelete);
854 lives_widget_set_sensitive(mainw->xdelete, FALSE);
855
856 #if LIVES_HAS_IMAGE_MENU_ITEM
857 image = lives_image_new_from_stock(LIVES_STOCK_DELETE, LIVES_ICON_SIZE_MENU);
858 lives_image_menu_item_set_image(LIVES_IMAGE_MENU_ITEM(mainw->xdelete), image);
859 #endif
860
861 lives_widget_add_accelerator(mainw->xdelete, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
862 LIVES_KEY_d, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
863
864 lives_menu_add_separator(LIVES_MENU(mainw->edit_menu));
865
866 mainw->ccpd_sound = lives_standard_check_menu_item_new_with_label(_("Decouple _Video from Audio"), !mainw->ccpd_with_sound);
867 lives_container_add(LIVES_CONTAINER(mainw->edit_menu), mainw->ccpd_sound);
868
869 if (prefs->vj_mode) {
870 lives_widget_set_sensitive(mainw->ccpd_sound, FALSE);
871 lives_check_menu_item_set_active(LIVES_CHECK_MENU_ITEM(mainw->ccpd_sound), TRUE);
872 }
873
874 lives_menu_add_separator(LIVES_MENU(mainw->edit_menu));
875
876 mainw->select_submenu = lives_standard_menu_item_new_with_label(_("_Select..."));
877 lives_container_add(LIVES_CONTAINER(mainw->edit_menu), mainw->select_submenu);
878
879 select_submenu_menu = lives_menu_new();
880
881 lives_menu_item_set_submenu(LIVES_MENU_ITEM(mainw->select_submenu), select_submenu_menu);
882 lives_widget_set_sensitive(mainw->select_submenu, FALSE);
883
884 mainw->select_all = lives_standard_menu_item_new_with_label(_("Select _All Frames"));
885 lives_container_add(LIVES_CONTAINER(select_submenu_menu), mainw->select_all);
886
887 lives_widget_add_accelerator(mainw->select_all, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
888 LIVES_KEY_a, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
889
890 mainw->select_start_only = lives_standard_image_menu_item_new_with_label(_("_Start Frame Only"));
891 lives_container_add(LIVES_CONTAINER(select_submenu_menu), mainw->select_start_only);
892
893 lives_widget_add_accelerator(mainw->select_start_only, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
894 LIVES_KEY_Home, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
895
896 mainw->select_end_only = lives_standard_image_menu_item_new_with_label(_("_End Frame Only"));
897 lives_container_add(LIVES_CONTAINER(select_submenu_menu), mainw->select_end_only);
898 lives_widget_add_accelerator(mainw->select_end_only, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
899 LIVES_KEY_End, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
900
901 lives_menu_add_separator(LIVES_MENU(select_submenu_menu));
902
903 mainw->select_from_start = lives_standard_image_menu_item_new_with_label(_("Select from _First Frame"));
904 lives_container_add(LIVES_CONTAINER(select_submenu_menu), mainw->select_from_start);
905
906 mainw->select_to_end = lives_standard_image_menu_item_new_with_label(_("Select to _Last Frame"));
907 lives_container_add(LIVES_CONTAINER(select_submenu_menu), mainw->select_to_end);
908
909 mainw->select_to_aend = lives_standard_image_menu_item_new_with_label(_("Select to _Audio End"));
910 lives_container_add(LIVES_CONTAINER(select_submenu_menu), mainw->select_to_aend);
911
912 mainw->select_new = lives_standard_image_menu_item_new_with_label(_("Select Last Insertion/_Merge"));
913 lives_container_add(LIVES_CONTAINER(select_submenu_menu), mainw->select_new);
914
915 mainw->select_last = lives_standard_image_menu_item_new_with_label(_("Select Last _Effect"));
916 lives_container_add(LIVES_CONTAINER(select_submenu_menu), mainw->select_last);
917
918 mainw->select_invert = lives_standard_image_menu_item_new_with_label(_("_Invert Selection"));
919 lives_container_add(LIVES_CONTAINER(select_submenu_menu), mainw->select_invert);
920
921 lives_widget_add_accelerator(mainw->select_invert, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
922 LIVES_KEY_Slash, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
923
924 mainw->lock_selwidth = lives_standard_check_menu_item_new_with_label(_("_Lock Selection Width"), FALSE);
925 lives_container_add(LIVES_CONTAINER(mainw->edit_menu), mainw->lock_selwidth);
926 lives_widget_set_sensitive(mainw->lock_selwidth, FALSE);
927
928 menuitem = lives_standard_menu_item_new_with_label(_("_Play"));
929 lives_container_add(LIVES_CONTAINER(mainw->menubar), menuitem);
930
931 mainw->play_menu = lives_menu_new();
932 lives_menu_item_set_submenu(LIVES_MENU_ITEM(menuitem), mainw->play_menu);
933
934 mainw->playall = lives_standard_image_menu_item_new_with_label(_("_Play All"));
935 lives_widget_add_accelerator(mainw->playall, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
936 LIVES_KEY_p, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
937
938 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->playall);
939 lives_widget_set_sensitive(mainw->playall, FALSE);
940
941 #if LIVES_HAS_IMAGE_MENU_ITEM
942 image = lives_image_new_from_stock(LIVES_STOCK_REFRESH, LIVES_ICON_SIZE_MENU);
943
944 lives_image_menu_item_set_image(LIVES_IMAGE_MENU_ITEM(mainw->playall), image);
945 #endif
946
947 mainw->playsel = lives_standard_image_menu_item_new_with_label(_("Pla_y Selection"));
948 lives_widget_add_accelerator(mainw->playsel, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
949 LIVES_KEY_y, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
950
951 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->playsel);
952 lives_widget_set_sensitive(mainw->playsel, FALSE);
953
954 mainw->playclip = lives_standard_image_menu_item_new_with_label(_("Play _Clipboard"));
955 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->playclip);
956 lives_widget_set_sensitive(mainw->playclip, FALSE);
957
958 lives_widget_add_accelerator(mainw->playclip, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
959 LIVES_KEY_c, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
960
961 #if LIVES_HAS_IMAGE_MENU_ITEM
962 image = lives_image_new_from_stock(LIVES_STOCK_MEDIA_PLAY, LIVES_ICON_SIZE_MENU);
963
964 lives_image_menu_item_set_image(LIVES_IMAGE_MENU_ITEM(mainw->playsel), image);
965 #endif
966
967 #if LIVES_HAS_IMAGE_MENU_ITEM
968 image = lives_image_new_from_stock(LIVES_STOCK_MEDIA_PLAY, LIVES_ICON_SIZE_MENU);
969
970 lives_image_menu_item_set_image(LIVES_IMAGE_MENU_ITEM(mainw->playclip), image);
971 #endif
972
973 mainw->stop = lives_standard_image_menu_item_new_with_label(_("_Stop"));
974 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->stop);
975 lives_widget_set_sensitive(mainw->stop, FALSE);
976 lives_widget_add_accelerator(mainw->stop, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
977 LIVES_KEY_q, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
978
979 #if LIVES_HAS_IMAGE_MENU_ITEM
980 image = lives_image_new_from_stock(LIVES_STOCK_MEDIA_STOP, LIVES_ICON_SIZE_MENU);
981 lives_image_menu_item_set_image(LIVES_IMAGE_MENU_ITEM(mainw->stop), image);
982 #endif
983
984 mainw->rewind = lives_standard_image_menu_item_new_with_label(_("Re_wind"));
985 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->rewind);
986 lives_widget_set_sensitive(mainw->rewind, FALSE);
987
988 #if LIVES_HAS_IMAGE_MENU_ITEM
989 image = lives_image_new_from_stock(LIVES_STOCK_MEDIA_REWIND, LIVES_ICON_SIZE_MENU);
990
991 lives_image_menu_item_set_image(LIVES_IMAGE_MENU_ITEM(mainw->rewind), image);
992 #endif
993
994 lives_widget_add_accelerator(mainw->rewind, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
995 LIVES_KEY_w, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
996
997 mainw->record_perf = lives_standard_check_menu_item_new_with_label("", FALSE);
998
999 disable_record();
1000
1001 lives_widget_add_accelerator(mainw->record_perf, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1002 LIVES_KEY_r, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
1003
1004 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->record_perf);
1005
1006 lives_menu_add_separator(LIVES_MENU(mainw->play_menu));
1007
1008 mainw->full_screen = lives_standard_check_menu_item_new_with_label(_("_Full Screen"), FALSE);
1009 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->full_screen);
1010
1011 lives_widget_add_accelerator(mainw->full_screen, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1012 LIVES_KEY_f, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
1013
1014 mainw->dsize = lives_standard_check_menu_item_new_with_label(_("_Double Size"), FALSE);
1015 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->dsize);
1016
1017 lives_widget_add_accelerator(mainw->dsize, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1018 LIVES_KEY_d, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
1019
1020 mainw->sepwin = lives_standard_check_menu_item_new_with_label(_("Play in _Separate Window"), FALSE);
1021 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->sepwin);
1022
1023 lives_widget_add_accelerator(mainw->sepwin, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1024 LIVES_KEY_s, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
1025
1026 mainw->fade = lives_standard_check_menu_item_new_with_label(_("_Blank Background"), FALSE);
1027
1028 lives_widget_add_accelerator(mainw->fade, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1029 LIVES_KEY_b, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
1030
1031 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->fade);
1032
1033 mainw->loop_video = lives_standard_check_menu_item_new_with_label(_("Stop on _Audio End"), mainw->loop);
1034 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->loop_video);
1035 lives_widget_set_sensitive(mainw->loop_video, FALSE);
1036 lives_widget_add_accelerator(mainw->loop_video, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1037 LIVES_KEY_l, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
1038
1039 mainw->loop_continue = lives_standard_check_menu_item_new_with_label(_("L_oop Continuously"), mainw->loop_cont);
1040 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->loop_continue);
1041 lives_widget_set_sensitive(mainw->loop_continue, FALSE);
1042
1043 lives_widget_add_accelerator(mainw->loop_continue, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1044 LIVES_KEY_o, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
1045
1046 mainw->loop_ping_pong = lives_standard_check_menu_item_new_with_label(_("Pin_g Pong Loops"), FALSE);
1047 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->loop_ping_pong);
1048
1049 lives_widget_add_accelerator(mainw->loop_ping_pong, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1050 LIVES_KEY_g, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
1051
1052 mainw->mute_audio = lives_standard_check_menu_item_new_with_label(_("_Mute"), FALSE);
1053 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->mute_audio);
1054 lives_widget_set_sensitive(mainw->mute_audio, FALSE);
1055
1056 lives_widget_add_accelerator(mainw->mute_audio, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1057 LIVES_KEY_z, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
1058
1059 lives_menu_add_separator(LIVES_MENU(mainw->play_menu));
1060
1061 mainw->sticky = lives_standard_check_menu_item_new_with_label(_("Separate Window 'S_ticky' Mode"),
1062 prefs->sepwin_type == SEPWIN_TYPE_STICKY);
1063
1064 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->sticky);
1065
1066 mainw->showfct = lives_standard_check_menu_item_new_with_label(_("S_how Frame Counter"), !prefs->hide_framebar);
1067 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->showfct);
1068
1069 lives_widget_add_accelerator(mainw->showfct, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1070 LIVES_KEY_h, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
1071
1072 mainw->showsubs = lives_standard_check_menu_item_new_with_label(_("Show Subtitles"), prefs->show_subtitles);
1073 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->showsubs);
1074
1075 lives_widget_add_accelerator(mainw->showsubs, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1076 LIVES_KEY_v, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
1077
1078 mainw->letter = lives_standard_check_menu_item_new_with_label(_("Letterbox Mode"), prefs->letterbox);
1079 lives_container_add(LIVES_CONTAINER(mainw->play_menu), mainw->letter);
1080
1081 menuitem = lives_standard_menu_item_new_with_label(_("Effect_s"));
1082 lives_container_add(LIVES_CONTAINER(mainw->menubar), menuitem);
1083 if (!prefs->vj_mode)
1084 lives_widget_set_tooltip_text(menuitem, (_("Effects are applied to the current selection.")));
1085
1086 // the dynamic effects menu
1087 mainw->effects_menu = lives_menu_new();
1088 lives_menu_item_set_submenu(LIVES_MENU_ITEM(menuitem), mainw->effects_menu);
1089
1090 mainw->custom_tools_submenu = lives_standard_menu_item_new_with_label(_("Custom _Tools"));
1091 lives_widget_set_no_show_all(mainw->custom_tools_submenu, TRUE);
1092
1093 if (!prefs->vj_mode) {
1094 if (!RFX_LOADED) {
1095 mainw->ldg_menuitem = lives_standard_menu_item_new_with_label(_("Loading..."));
1096 lives_container_add(LIVES_CONTAINER(mainw->effects_menu), mainw->ldg_menuitem);
1097 }
1098 } else {
1099 mainw->ldg_menuitem = lives_standard_menu_item_new_with_label(_("Rendered effects disabled in VJ Mode"));
1100 }
1101
1102 mainw->custom_effects_menu = NULL;
1103 mainw->custom_effects_separator = NULL;
1104
1105 mainw->run_test_rfx_submenu = lives_standard_menu_item_new_with_label(_("_Run Test Rendered Effect/Tool/Generator..."));
1106 mainw->run_test_rfx_menu = NULL;
1107
1108 mainw->num_rendered_effects_builtin = mainw->num_rendered_effects_custom = mainw->num_rendered_effects_test = 0;
1109
1110 menuitem = lives_standard_menu_item_new_with_label(_("_Tools"));
1111 lives_container_add(LIVES_CONTAINER(mainw->menubar), menuitem);
1112 if (!prefs->vj_mode)
1113 lives_widget_set_tooltip_text(menuitem, (_("Tools are applied to complete clips.")));
1114
1115 mainw->tools_menu = lives_menu_new();
1116 lives_menu_item_set_submenu(LIVES_MENU_ITEM(menuitem), mainw->tools_menu);
1117
1118 mainw->rev_clipboard = lives_standard_menu_item_new_with_label(_("_Reverse Clipboard"));
1119 lives_container_add(LIVES_CONTAINER(mainw->tools_menu), mainw->rev_clipboard);
1120 lives_widget_set_sensitive(mainw->rev_clipboard, FALSE);
1121
1122 lives_widget_add_accelerator(mainw->rev_clipboard, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1123 LIVES_KEY_x, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
1124
1125 mainw->change_speed = lives_standard_menu_item_new_with_label(_("_Change Playback/Save Speed..."));
1126 lives_container_add(LIVES_CONTAINER(mainw->tools_menu), mainw->change_speed);
1127 lives_widget_set_sensitive(mainw->change_speed, FALSE);
1128
1129 mainw->resample_video = lives_standard_menu_item_new_with_label(_("Resample _Video to New Frame Rate..."));
1130 lives_container_add(LIVES_CONTAINER(mainw->tools_menu), mainw->resample_video);
1131 lives_widget_set_sensitive(mainw->resample_video, FALSE);
1132
1133 mainw->utilities_menu = NULL;
1134 mainw->utilities_submenu = lives_standard_menu_item_new_with_label(_("_Utilities"));
1135
1136 mainw->custom_utilities_menu = NULL;
1137
1138 mainw->custom_tools_separator = lives_standard_menu_item_new();
1139 lives_widget_set_sensitive(mainw->custom_tools_separator, FALSE);
1140
1141 mainw->gens_menu = NULL;
1142 mainw->gens_submenu = lives_standard_menu_item_new_with_label(_("_Generate"));
1143
1144 // add RFX plugins
1145 mainw->rte_separator = mainw->custom_gens_menu = mainw->custom_gens_submenu = NULL;
1146 mainw->custom_tools_menu = NULL;
1147
1148 if (!mainw->foreign) {
1149 splash_msg(_("Starting GUI..."), SPLASH_LEVEL_START_GUI);
1150 }
1151
1152 lives_container_add(LIVES_CONTAINER(mainw->tools_menu), mainw->utilities_submenu);
1153 lives_container_add(LIVES_CONTAINER(mainw->tools_menu), mainw->custom_tools_separator);
1154 lives_container_add(LIVES_CONTAINER(mainw->tools_menu), mainw->custom_tools_submenu);
1155 lives_container_add(LIVES_CONTAINER(mainw->tools_menu), mainw->gens_submenu);
1156
1157 lives_menu_add_separator(LIVES_MENU(mainw->tools_menu));
1158
1159 mainw->load_subs = lives_standard_menu_item_new_with_label(_("Load _Subtitles from File..."));
1160 lives_container_add(LIVES_CONTAINER(mainw->tools_menu), mainw->load_subs);
1161 lives_widget_set_sensitive(mainw->load_subs, FALSE);
1162
1163 mainw->erase_subs = lives_standard_menu_item_new_with_label(_("Erase subtitles"));
1164 lives_container_add(LIVES_CONTAINER(mainw->tools_menu), mainw->erase_subs);
1165 lives_widget_set_sensitive(mainw->erase_subs, FALSE);
1166
1167 lives_menu_add_separator(LIVES_MENU(mainw->tools_menu));
1168
1169 mainw->capture = lives_standard_menu_item_new_with_label(_("Capture _External Window... "));
1170 lives_container_add(LIVES_CONTAINER(mainw->tools_menu), mainw->capture);
1171
1172 lives_menu_add_separator(LIVES_MENU(mainw->tools_menu));
1173
1174 mainw->preferences = lives_standard_image_menu_item_new_with_label(_("_Preferences..."));
1175 lives_container_add(LIVES_CONTAINER(mainw->tools_menu), mainw->preferences);
1176 lives_widget_add_accelerator(mainw->preferences, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1177 LIVES_KEY_p, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
1178
1179 #if LIVES_HAS_IMAGE_MENU_ITEM
1180 image = lives_image_new_from_stock(LIVES_STOCK_PREFERENCES, LIVES_ICON_SIZE_MENU);
1181 lives_image_menu_item_set_image(LIVES_IMAGE_MENU_ITEM(mainw->preferences), image);
1182 #endif
1183
1184 menuitem = lives_standard_menu_item_new_with_label(_("_Audio"));
1185 lives_container_add(LIVES_CONTAINER(mainw->menubar), menuitem);
1186
1187 mainw->audio_menu = lives_menu_new();
1188 lives_menu_item_set_submenu(LIVES_MENU_ITEM(menuitem), mainw->audio_menu);
1189
1190 mainw->load_audio = lives_standard_menu_item_new_with_label(_("Load _New Audio for Clip..."));
1191
1192 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->load_audio);
1193 lives_widget_set_sensitive(mainw->load_audio, FALSE);
1194
1195 mainw->load_cdtrack = lives_standard_menu_item_new_with_label(_("Load _CD Track..."));
1196 mainw->eject_cd = lives_standard_menu_item_new_with_label(_("E_ject CD"));
1197 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->load_cdtrack);
1198 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->eject_cd);
1199
1200 if (!check_for_executable(&capable->has_cdda2wav, EXEC_CDDA2WAV)
1201 && !check_for_executable(&capable->has_icedax, EXEC_ICEDAX)) {
1202 lives_widget_set_sensitive(mainw->load_cdtrack, FALSE);
1203 lives_widget_set_sensitive(mainw->eject_cd, FALSE);
1204 }
1205
1206 mainw->recaudio_submenu = lives_standard_menu_item_new_with_label(_("Record E_xternal Audio..."));
1207 if ((prefs->audio_player == AUD_PLAYER_JACK && capable->has_jackd) || (prefs->audio_player == AUD_PLAYER_PULSE &&
1208 capable->has_pulse_audio))
1209 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->recaudio_submenu);
1210
1211 submenu_menu = lives_menu_new();
1212 lives_menu_item_set_submenu(LIVES_MENU_ITEM(mainw->recaudio_submenu), submenu_menu);
1213
1214 mainw->recaudio_clip = lives_standard_menu_item_new_with_label(_("to New _Clip..."));
1215 lives_container_add(LIVES_CONTAINER(submenu_menu), mainw->recaudio_clip);
1216
1217 mainw->recaudio_sel = lives_standard_menu_item_new_with_label(_("to _Selection"));
1218 lives_container_add(LIVES_CONTAINER(submenu_menu), mainw->recaudio_sel);
1219 lives_widget_set_sensitive(mainw->recaudio_sel, FALSE);
1220
1221 lives_menu_add_separator(LIVES_MENU(mainw->audio_menu));
1222
1223 mainw->voladj = lives_standard_menu_item_new_with_label(_("Change clip volume..."));
1224 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->voladj);
1225
1226 mainw->fade_aud_in = lives_standard_menu_item_new_with_label(_("Fade Audio _In..."));
1227 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->fade_aud_in);
1228
1229 mainw->fade_aud_out = lives_standard_menu_item_new_with_label(_("Fade Audio _Out..."));
1230 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->fade_aud_out);
1231
1232 lives_widget_set_sensitive(mainw->voladj, FALSE);
1233 lives_widget_set_sensitive(mainw->fade_aud_in, FALSE);
1234 lives_widget_set_sensitive(mainw->fade_aud_out, FALSE);
1235
1236 lives_menu_add_separator(LIVES_MENU(mainw->audio_menu));
1237
1238 mainw->export_submenu = lives_standard_menu_item_new_with_label(_("_Export Audio..."));
1239 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->export_submenu);
1240
1241 export_submenu_menu = lives_menu_new();
1242 lives_widget_set_sensitive(export_submenu_menu, FALSE);
1243
1244 lives_menu_item_set_submenu(LIVES_MENU_ITEM(mainw->export_submenu), export_submenu_menu);
1245 lives_widget_set_sensitive(mainw->export_submenu, FALSE);
1246
1247 mainw->export_selaudio = lives_standard_menu_item_new_with_label(_("Export _Selected Audio..."));
1248 lives_container_add(LIVES_CONTAINER(export_submenu_menu), mainw->export_selaudio);
1249
1250 mainw->export_allaudio = lives_standard_menu_item_new_with_label(_("Export _All Audio..."));
1251 lives_container_add(LIVES_CONTAINER(export_submenu_menu), mainw->export_allaudio);
1252
1253 mainw->append_audio = lives_standard_menu_item_new_with_label(_("_Append Audio..."));
1254 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->append_audio);
1255 lives_widget_set_sensitive(mainw->append_audio, FALSE);
1256
1257 mainw->trim_submenu = lives_standard_menu_item_new_with_label(_("_Trim/Pad Audio..."));
1258 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->trim_submenu);
1259
1260 trimaudio_submenu_menu = lives_menu_new();
1261 lives_widget_set_sensitive(trimaudio_submenu_menu, FALSE);
1262
1263 lives_menu_item_set_submenu(LIVES_MENU_ITEM(mainw->trim_submenu), trimaudio_submenu_menu);
1264 lives_widget_set_sensitive(mainw->trim_submenu, FALSE);
1265
1266 mainw->trim_audio = lives_standard_menu_item_new_with_label(_("Trim/Pad Audio to _Selection"));
1267 lives_container_add(LIVES_CONTAINER(trimaudio_submenu_menu), mainw->trim_audio);
1268
1269 mainw->trim_to_pstart = lives_standard_menu_item_new_with_label(_("Trim/Pad Audio from Beginning to _Play Start"));
1270 lives_container_add(LIVES_CONTAINER(trimaudio_submenu_menu), mainw->trim_to_pstart);
1271
1272 mainw->delaudio_submenu = lives_standard_menu_item_new_with_label(_("_Delete Audio..."));
1273 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->delaudio_submenu);
1274 if (prefs->vj_mode) lives_widget_set_sensitive(mainw->delaudio_submenu, FALSE);
1275
1276 delaudio_submenu_menu = lives_menu_new();
1277
1278 lives_menu_item_set_submenu(LIVES_MENU_ITEM(mainw->delaudio_submenu), delaudio_submenu_menu);
1279 //lives_widget_set_sensitive(mainw->delaudio_submenu, FALSE);
1280
1281 mainw->delsel_audio = lives_standard_menu_item_new_with_label(_("Delete _Selected Audio"));
1282 lives_container_add(LIVES_CONTAINER(delaudio_submenu_menu), mainw->delsel_audio);
1283
1284 mainw->delall_audio = lives_standard_menu_item_new_with_label(_("Delete _All Audio"));
1285 lives_container_add(LIVES_CONTAINER(delaudio_submenu_menu), mainw->delall_audio);
1286
1287 mainw->ins_silence = lives_standard_menu_item_new_with_label(_("Insert _Silence in Selection"));
1288 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->ins_silence);
1289 lives_widget_set_sensitive(mainw->ins_silence, FALSE);
1290
1291 mainw->resample_audio = lives_standard_menu_item_new_with_label(_("_Resample Audio..."));
1292 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->resample_audio);
1293 lives_widget_set_sensitive(mainw->resample_audio, FALSE);
1294
1295 mainw->normalize_audio = lives_standard_menu_item_new_with_label(_("_Normalize Audio"));
1296 lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->normalize_audio);
1297 lives_widget_set_sensitive(mainw->normalize_audio, FALSE);
1298
1299 //mainw->adj_audio_sync = lives_standard_menu_item_new_with_label(_("_Adjust Audio Sync..."));
1300 //lives_container_add(LIVES_CONTAINER(mainw->audio_menu), mainw->adj_audio_sync);
1301 //lives_widget_set_sensitive(mainw->adj_audio_sync, FALSE);
1302
1303 menuitem = lives_standard_menu_item_new_with_label(_("_Info"));
1304 lives_container_add(LIVES_CONTAINER(mainw->menubar), menuitem);
1305
1306 mainw->info_menu = lives_menu_new();
1307 lives_menu_item_set_submenu(LIVES_MENU_ITEM(menuitem), mainw->info_menu);
1308
1309 mainw->show_file_info = lives_standard_image_menu_item_new_with_label(_("Show Clip _Info"));
1310 lives_widget_add_accelerator(mainw->show_file_info, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1311 LIVES_KEY_i, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
1312
1313 lives_container_add(LIVES_CONTAINER(mainw->info_menu), mainw->show_file_info);
1314 lives_widget_set_sensitive(mainw->show_file_info, FALSE);
1315
1316 mainw->show_file_comments = lives_standard_image_menu_item_new_with_label(_("Show/_Edit File Comments"));
1317 lives_container_add(LIVES_CONTAINER(mainw->info_menu), mainw->show_file_comments);
1318 lives_widget_set_sensitive(mainw->show_file_comments, FALSE);
1319
1320 mainw->show_clipboard_info = lives_standard_image_menu_item_new_with_label(_("Show _Clipboard Info"));
1321 lives_container_add(LIVES_CONTAINER(mainw->info_menu), mainw->show_clipboard_info);
1322 lives_widget_set_sensitive(mainw->show_clipboard_info, FALSE);
1323
1324 #if LIVES_HAS_IMAGE_MENU_ITEM
1325 image = lives_image_new_from_stock(LIVES_STOCK_DIALOG_INFO, LIVES_ICON_SIZE_MENU);
1326 lives_image_menu_item_set_image(LIVES_IMAGE_MENU_ITEM(mainw->show_file_info), image);
1327 #endif
1328
1329 mainw->show_messages = lives_standard_image_menu_item_new_with_label(_("Show _Messages"));
1330 lives_container_add(LIVES_CONTAINER(mainw->info_menu), mainw->show_messages);
1331
1332 mainw->show_layout_errors = lives_standard_image_menu_item_new_with_label(_("Show _Layout Errors"));
1333 lives_container_add(LIVES_CONTAINER(mainw->info_menu), mainw->show_layout_errors);
1334 lives_widget_set_sensitive(mainw->show_layout_errors, FALSE);
1335
1336 mainw->show_quota = lives_standard_image_menu_item_new_with_label(_("Show / Edit Disk _Quota Settings"));
1337 lives_container_add(LIVES_CONTAINER(mainw->info_menu), mainw->show_quota);
1338
1339 win = lives_standard_menu_item_new_with_label(_("_Clips"));
1340 lives_container_add(LIVES_CONTAINER(mainw->menubar), win);
1341
1342 mainw->clipsmenu = lives_menu_new();
1343 lives_menu_item_set_submenu(LIVES_MENU_ITEM(win), mainw->clipsmenu);
1344
1345 mainw->rename = lives_standard_image_menu_item_new_with_label(_("_Rename Current Clip in Menu..."));
1346 lives_container_add(LIVES_CONTAINER(mainw->clipsmenu), mainw->rename);
1347 lives_widget_set_sensitive(mainw->rename, FALSE);
1348
1349 lives_menu_add_separator(LIVES_MENU(mainw->clipsmenu));
1350
1351 menuitemsep = lives_standard_menu_item_new_with_label("|");
1352 lives_container_add(LIVES_CONTAINER(mainw->menubar), menuitemsep);
1353 lives_widget_set_sensitive(menuitemsep, FALSE);
1354
1355 menuitem = lives_standard_menu_item_new_with_label(_("A_dvanced"));
1356 lives_container_add(LIVES_CONTAINER(mainw->menubar), menuitem);
1357
1358 mainw->advanced_menu = lives_menu_new();
1359 lives_menu_item_set_submenu(LIVES_MENU_ITEM(menuitem), mainw->advanced_menu);
1360
1361 rfx_submenu = lives_standard_menu_item_new_with_label(_("_RFX Effects/Tools/Utilities"));
1362 lives_container_add(LIVES_CONTAINER(mainw->advanced_menu), rfx_submenu);
1363
1364 if (prefs->vj_mode) lives_widget_set_sensitive(rfx_submenu, FALSE);
1365
1366 rfx_menu = lives_menu_new();
1367 lives_menu_item_set_submenu(LIVES_MENU_ITEM(rfx_submenu), rfx_menu);
1368
1369 new_test_rfx = lives_standard_menu_item_new_with_label(_("_New Test RFX Script..."));
1370 lives_container_add(LIVES_CONTAINER(rfx_menu), new_test_rfx);
1371
1372 copy_rfx = lives_standard_menu_item_new_with_label(_("_Copy RFX Script to Test..."));
1373 lives_container_add(LIVES_CONTAINER(rfx_menu), copy_rfx);
1374
1375 mainw->edit_test_rfx = lives_standard_menu_item_new_with_label(_("_Edit Test RFX Script..."));
1376 lives_container_add(LIVES_CONTAINER(rfx_menu), mainw->edit_test_rfx);
1377
1378 mainw->rename_test_rfx = lives_standard_menu_item_new_with_label(_("Rena_me Test RFX Script..."));
1379 lives_container_add(LIVES_CONTAINER(rfx_menu), mainw->rename_test_rfx);
1380
1381 mainw->delete_test_rfx = lives_standard_menu_item_new_with_label(_("_Delete Test RFX Script..."));
1382 lives_container_add(LIVES_CONTAINER(rfx_menu), mainw->delete_test_rfx);
1383
1384 lives_menu_add_separator(LIVES_MENU(rfx_menu));
1385
1386 lives_container_add(LIVES_CONTAINER(rfx_menu), mainw->run_test_rfx_submenu);
1387
1388 mainw->promote_test_rfx = lives_standard_menu_item_new_with_label(_("_Promote Test Rendered Effect/Tool/Generator..."));
1389 lives_container_add(LIVES_CONTAINER(rfx_menu), mainw->promote_test_rfx);
1390
1391 lives_menu_add_separator(LIVES_MENU(rfx_menu));
1392
1393 import_custom_rfx = lives_standard_menu_item_new_with_label(_("_Import Custom RFX script..."));
1394 lives_container_add(LIVES_CONTAINER(rfx_menu), import_custom_rfx);
1395
1396 mainw->export_custom_rfx = lives_standard_menu_item_new_with_label(_("E_xport Custom RFX script..."));
1397 lives_container_add(LIVES_CONTAINER(rfx_menu), mainw->export_custom_rfx);
1398
1399 mainw->delete_custom_rfx = lives_standard_menu_item_new_with_label(_("De_lete Custom RFX Script..."));
1400 lives_container_add(LIVES_CONTAINER(rfx_menu), mainw->delete_custom_rfx);
1401
1402 lives_menu_add_separator(LIVES_MENU(rfx_menu));
1403
1404 rebuild_rfx = lives_standard_menu_item_new_with_label(_("Re_build test RFX plugins"));
1405 lives_container_add(LIVES_CONTAINER(rfx_menu), rebuild_rfx);
1406
1407 mainw->open_lives2lives = lives_standard_menu_item_new_with_label(_("Receive _LiVES Stream from..."));
1408
1409 lives_menu_add_separator(LIVES_MENU(mainw->advanced_menu));
1410
1411 mainw->send_lives2lives = lives_standard_menu_item_new_with_label(_("_Send LiVES Stream to..."));
1412 lives_widget_set_sensitive(mainw->send_lives2lives, FALSE); // buggy for now
1413
1414 lives_container_add(LIVES_CONTAINER(mainw->advanced_menu), mainw->send_lives2lives);
1415 lives_container_add(LIVES_CONTAINER(mainw->advanced_menu), mainw->open_lives2lives);
1416
1417 mainw->open_yuv4m = lives_standard_menu_item_new_with_label((tmp = (_("Open _yuv4mpeg stream..."))));
1418 lives_free(tmp);
1419 #ifdef HAVE_YUV4MPEG
1420 lives_menu_add_separator(LIVES_MENU(mainw->advanced_menu));
1421
1422 lives_container_add(LIVES_CONTAINER(mainw->advanced_menu), mainw->open_yuv4m);
1423
1424 // TODO - apply a deinterlace filter to yuv4mpeg frames
1425 /*mainw->yuv4m_deint = lives_standard_check_menu_item_new_with_label (_("_Deinterlace yuv4mpeg frames"));
1426 lives_widget_show (mainw->yuv4m_deint);
1427 lives_container_add (LIVES_CONTAINER (advance_menu), mainw->yuv4m_deint);
1428 lives_check_menu_item_set_active(LIVES_CHECK_MENU_ITEM(mainw->yu4m_deint),TRUE);*/
1429 #endif
1430
1431 lives_menu_add_separator(LIVES_MENU(mainw->advanced_menu));
1432
1433 mainw->import_proj = lives_standard_menu_item_new_with_label((tmp = lives_strdup_printf(_("_Import Project (.%s)..."),
1434 LIVES_FILE_EXT_PROJECT)));
1435 lives_free(tmp);
1436 lives_container_add(LIVES_CONTAINER(mainw->advanced_menu), mainw->import_proj);
1437
1438 mainw->export_proj = lives_standard_menu_item_new_with_label((tmp = lives_strdup_printf(_("E_xport Project (.%s)..."),
1439 LIVES_FILE_EXT_PROJECT)));
1440 lives_free(tmp);
1441 lives_container_add(LIVES_CONTAINER(mainw->advanced_menu), mainw->export_proj);
1442 lives_widget_set_sensitive(mainw->export_proj, FALSE);
1443
1444 lives_menu_add_separator(LIVES_MENU(mainw->advanced_menu));
1445
1446 mainw->import_theme = lives_standard_menu_item_new_with_label((tmp = lives_strdup_printf(_("_Import Custom Theme (.%s)..."),
1447 LIVES_FILE_EXT_TAR_GZ)));
1448 lives_free(tmp);
1449 lives_container_add(LIVES_CONTAINER(mainw->advanced_menu), mainw->import_theme);
1450
1451 mainw->export_theme = lives_standard_menu_item_new_with_label((tmp = lives_strdup_printf(_("E_xport Theme (.%s)..."),
1452 LIVES_FILE_EXT_TAR_GZ)));
1453 lives_free(tmp);
1454 lives_container_add(LIVES_CONTAINER(mainw->advanced_menu), mainw->export_theme);
1455 lives_widget_set_sensitive(mainw->export_theme, (palette->style & STYLE_1));
1456
1457 // VJ menu
1458
1459 menuitem = lives_standard_menu_item_new_with_label(_("_VJ"));
1460 lives_container_add(LIVES_CONTAINER(mainw->menubar), menuitem);
1461
1462 mainw->vj_menu = lives_menu_new();
1463 lives_menu_item_set_submenu(LIVES_MENU_ITEM(menuitem), mainw->vj_menu);
1464
1465 assign_rte_keys = lives_standard_menu_item_new_with_label(_("Real Time _Effect Mapping"));
1466 lives_container_add(LIVES_CONTAINER(mainw->vj_menu), assign_rte_keys);
1467 lives_widget_add_accelerator(assign_rte_keys, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
1468 LIVES_KEY_v, LIVES_CONTROL_MASK, LIVES_ACCEL_VISIBLE);
1469
1470 lives_widget_set_tooltip_text(assign_rte_keys, (_("Bind real time effects to ctrl-number keys.")));
1471
1472 mainw->rte_defs_menu = lives_standard_menu_item_new_with_label(_("Set Real Time Effect _Defaults"));
1473 lives_container_add(LIVES_CONTAINER(mainw->vj_menu), mainw->rte_defs_menu);
1474 lives_widget_set_tooltip_text(mainw->rte_defs_menu, (_("Set default parameter values for real time effects.")));
1475
1476 mainw->rte_defs = lives_menu_new();
1477 lives_menu_item_set_submenu(LIVES_MENU_ITEM(mainw->rte_defs_menu), mainw->rte_defs);
1478
1479 mainw->save_rte_defs = lives_standard_menu_item_new_with_label(_("Save Real Time Effect _Defaults"));
1480 lives_container_add(LIVES_CONTAINER(mainw->vj_menu), mainw->save_rte_defs);
1481 lives_widget_set_tooltip_text(mainw->save_rte_defs,
1482 (_("Save real time effect defaults so they will be restored each time you use LiVES.")));
1483
1484 lives_menu_add_separator(LIVES_MENU(mainw->vj_menu));
1485
1486 mainw->vj_realize = lives_standard_menu_item_new_with_label(_("_Pre-decode all frames (unlocks reverse playback)"));
1487 lives_container_add(LIVES_CONTAINER(mainw->vj_menu), mainw->vj_realize);
1488 lives_widget_set_tooltip_text(mainw->vj_realize,
1489 (_("Decode all frames to images. This will unlock reverse playback and can "
1490 "improve random seek times,\n"
1491 "but may require additional diskspace.")));
1492 lives_widget_set_sensitive(mainw->vj_realize, FALSE);
1493
1494 mainw->vj_reset = lives_standard_menu_item_new_with_label(_("_Reset All Playback Speeds and Positions"));
1495 lives_container_add(LIVES_CONTAINER(mainw->vj_menu), mainw->vj_reset);
1496 lives_widget_set_tooltip_text(mainw->vj_reset,
1497 (_("Reset all playback positions to frame 1, and reset all playback frame rates.")));
1498 lives_widget_set_sensitive(mainw->vj_reset, FALSE);
1499
1500 midi_submenu = lives_standard_menu_item_new_with_label(_("_MIDI/Joystick Interface"));
1501
1502 #ifdef ENABLE_OSC
1503 lives_container_add(LIVES_CONTAINER(mainw->vj_menu), midi_submenu);
1504 #endif
1505
1506 midi_menu = lives_menu_new();
1507 lives_menu_item_set_submenu(LIVES_MENU_ITEM(midi_submenu), midi_menu);
1508
1509 mainw->midi_learn = lives_standard_menu_item_new_with_label(_("_MIDI/Joystick Learner..."));
1510
1511 lives_container_add(LIVES_CONTAINER(midi_menu), mainw->midi_learn);
1512
1513 mainw->midi_save = lives_standard_menu_item_new_with_label(_("_Save Device Mapping..."));
1514
1515 lives_container_add(LIVES_CONTAINER(midi_menu), mainw->midi_save);
1516 lives_widget_set_sensitive(mainw->midi_save, FALSE);
1517
1518 midi_load = lives_standard_menu_item_new_with_label(_("_Load Device Mapping..."));
1519
1520 lives_container_add(LIVES_CONTAINER(midi_menu), midi_load);
1521
1522 lives_menu_add_separator(LIVES_MENU(mainw->vj_menu));
1523
1524 mainw->vj_show_keys = lives_standard_menu_item_new_with_label(_("Show VJ _Keys"));
1525 lives_container_add(LIVES_CONTAINER(mainw->vj_menu), mainw->vj_show_keys);
1526
1527 lives_menu_add_separator(LIVES_MENU(mainw->vj_menu));
1528
1529 mainw->vj_mode = lives_standard_check_menu_item_new_with_label(_("Restart in _VJ Mode"), future_prefs->vj_mode);
1530 lives_container_add(LIVES_CONTAINER(mainw->vj_menu), mainw->vj_mode);
1531 mainw->vj_mode_func = lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->vj_mode), LIVES_WIDGET_ACTIVATE_SIGNAL,
1532 LIVES_GUI_CALLBACK(vj_mode_toggled), NULL);
1533
1534 lives_menu_add_separator(LIVES_MENU(mainw->vj_menu));
1535
1536 mainw->autolives = lives_standard_check_menu_item_new_with_label(_("_Automatic Mode (autolives)..."), FALSE);
1537 #ifdef ENABLE_OSC
1538 lives_container_add(LIVES_CONTAINER(mainw->vj_menu), mainw->autolives);
1539 #endif
1540
1541 menuitem = lives_standard_menu_item_new_with_label(_("To_ys"));
1542 lives_container_add(LIVES_CONTAINER(mainw->menubar), menuitem);
1543
1544 mainw->toys_menu = lives_menu_new();
1545 lives_menu_item_set_submenu(LIVES_MENU_ITEM(menuitem), mainw->toys_menu);
1546
1547 mainw->toy_none = lives_standard_check_menu_item_new_with_label(_("_None"), TRUE);
1548 lives_container_add(LIVES_CONTAINER(mainw->toys_menu), mainw->toy_none);
1549
1550 mainw->toy_random_frames = lives_standard_check_menu_item_new_with_label(_("_Mad Frames"), FALSE);
1551 lives_container_add(LIVES_CONTAINER(mainw->toys_menu), mainw->toy_random_frames);
1552
1553 mainw->toy_tv = lives_standard_check_menu_item_new_with_label(_("_LiVES TV (broadband)"), FALSE);
1554
1555 if (0 && !prefs->vj_mode)
1556 lives_container_add(LIVES_CONTAINER(mainw->toys_menu), mainw->toy_tv);
1557
1558 menuitem = lives_standard_menu_item_new_with_label(_("_Help"));
1559 lives_container_add(LIVES_CONTAINER(mainw->menubar), menuitem);
1560
1561 mainw->help_menu = lives_menu_new();
1562 lives_menu_item_set_submenu(LIVES_MENU_ITEM(menuitem), mainw->help_menu);
1563
1564 show_manual = lives_standard_menu_item_new_with_label(_("_Manual (opens in browser)"));
1565 lives_container_add(LIVES_CONTAINER(mainw->help_menu), show_manual);
1566 if (prefs->vj_mode) lives_widget_set_sensitive(show_manual, FALSE);
1567
1568 lives_menu_add_separator(LIVES_MENU(mainw->help_menu));
1569
1570 donate = lives_standard_menu_item_new_with_label(_("_Donate to the Project !"));
1571 lives_container_add(LIVES_CONTAINER(mainw->help_menu), donate);
1572 if (prefs->vj_mode) lives_widget_set_sensitive(donate, FALSE);
1573
1574 email_author = lives_standard_menu_item_new_with_label(_("_Email the Author"));
1575 lives_container_add(LIVES_CONTAINER(mainw->help_menu), email_author);
1576 if (prefs->vj_mode) lives_widget_set_sensitive(email_author, FALSE);
1577
1578 report_bug = lives_standard_menu_item_new_with_label(_("Report a _Bug"));
1579 lives_container_add(LIVES_CONTAINER(mainw->help_menu), report_bug);
1580 if (prefs->vj_mode) lives_widget_set_sensitive(report_bug, FALSE);
1581
1582 suggest_feature = lives_standard_menu_item_new_with_label(_("Suggest a _Feature"));
1583 lives_container_add(LIVES_CONTAINER(mainw->help_menu), suggest_feature);
1584 if (prefs->vj_mode) lives_widget_set_sensitive(suggest_feature, FALSE);
1585
1586 help_translate = lives_standard_menu_item_new_with_label(_("Assist with _Translating"));
1587 lives_container_add(LIVES_CONTAINER(mainw->help_menu), help_translate);
1588 if (prefs->vj_mode) lives_widget_set_sensitive(help_translate, FALSE);
1589
1590 lives_menu_add_separator(LIVES_MENU(mainw->help_menu));
1591
1592 mainw->show_devopts = lives_standard_check_menu_item_new_with_label(_("Enable Developer Options"), prefs->show_dev_opts);
1593 lives_check_menu_item_set_active(LIVES_CHECK_MENU_ITEM(mainw->show_devopts), prefs->show_dev_opts);
1594
1595 lives_container_add(LIVES_CONTAINER(mainw->help_menu), mainw->show_devopts);
1596 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->show_devopts), LIVES_WIDGET_ACTIVATE_SIGNAL,
1597 LIVES_GUI_CALLBACK(toggle_sets_pref), (livespointer)PREF_SHOW_DEVOPTS);
1598
1599 mainw->dev_dabg = lives_standard_check_menu_item_new_for_var(_("Show drawing area backgrounds"),
1600 &prefs->dev_show_dabg, FALSE);
1601 lives_container_add(LIVES_CONTAINER(mainw->help_menu), mainw->dev_dabg);
1602 menu_sets_visible(LIVES_CHECK_MENU_ITEM(mainw->show_devopts), mainw->dev_dabg, FALSE);
1603
1604 mainw->dev_timing = lives_standard_check_menu_item_new_for_var(_("Show frame timings on console"),
1605 &prefs->dev_show_timing, FALSE);
1606 lives_container_add(LIVES_CONTAINER(mainw->help_menu), mainw->dev_timing);
1607 menu_sets_visible(LIVES_CHECK_MENU_ITEM(mainw->show_devopts), mainw->dev_timing, FALSE);
1608
1609 lives_menu_add_separator(LIVES_MENU(mainw->help_menu));
1610
1611 mainw->troubleshoot = lives_standard_menu_item_new_with_label(_("_Troubleshoot"));
1612 lives_container_add(LIVES_CONTAINER(mainw->help_menu), mainw->troubleshoot);
1613
1614 mainw->expl_missing = lives_standard_menu_item_new_with_label(_("Check for Optional Features"));
1615 if (!prefs->vj_mode) lives_container_add(LIVES_CONTAINER(mainw->help_menu), mainw->expl_missing);
1616
1617 lives_menu_add_separator(LIVES_MENU(mainw->help_menu));
1618
1619 about = lives_standard_menu_item_new_with_label(_("_About"));
1620 lives_container_add(LIVES_CONTAINER(mainw->help_menu), about);
1621
1622 mainw->btoolbar = lives_standard_toolbar_new();
1623
1624 ////
1625
1626 lives_box_pack_start(LIVES_BOX(mainw->top_vbox), mainw->btoolbar, FALSE, TRUE, 0);
1627 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_LIVES_STOCK_SEPWIN,
1628 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->btoolbar)));
1629
1630 mainw->m_sepwinbutton = lives_standard_tool_button_new(LIVES_TOOLBAR(mainw->btoolbar), LIVES_WIDGET(tmp_toolbar_icon), "",
1631 _("Show the play window (s)"));
1632 lives_widget_set_focus_on_click(mainw->m_sepwinbutton, FALSE);
1633 lives_widget_set_opacity(mainw->m_sepwinbutton, .75);
1634
1635 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_STOCK_MEDIA_REWIND,
1636 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->btoolbar)));
1637
1638 mainw->m_rewindbutton = lives_standard_tool_button_new(LIVES_TOOLBAR(mainw->btoolbar), LIVES_WIDGET(tmp_toolbar_icon), "",
1639 _("Rewind to start (w)"));
1640
1641 lives_widget_set_sensitive(mainw->m_rewindbutton, FALSE);
1642 lives_widget_set_focus_on_click(mainw->m_rewindbutton, FALSE);
1643
1644 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_STOCK_MEDIA_PLAY,
1645 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->btoolbar)));
1646
1647 mainw->m_playbutton = lives_standard_tool_button_new(LIVES_TOOLBAR(mainw->btoolbar), LIVES_WIDGET(tmp_toolbar_icon), "",
1648 _("Play all (p)"));
1649 lives_widget_set_sensitive(mainw->m_playbutton, FALSE);
1650
1651 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_STOCK_MEDIA_STOP,
1652 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->btoolbar)));
1653
1654 mainw->m_stopbutton = lives_standard_tool_button_new(LIVES_TOOLBAR(mainw->btoolbar), LIVES_WIDGET(tmp_toolbar_icon), "",
1655 _("Stop playback (q)"));
1656 lives_widget_set_sensitive(mainw->m_stopbutton, FALSE);
1657 lives_widget_set_focus_on_click(mainw->m_stopbutton, FALSE);
1658
1659 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_LIVES_STOCK_PLAY_SEL,
1660 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->btoolbar)));
1661 mainw->m_playselbutton = lives_standard_tool_button_new(LIVES_TOOLBAR(mainw->btoolbar), LIVES_WIDGET(tmp_toolbar_icon), "",
1662 _("Play selection (y)"));
1663
1664 lives_widget_set_sensitive(mainw->m_playselbutton, FALSE);
1665 lives_widget_set_focus_on_click(mainw->m_playselbutton, FALSE);
1666
1667 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_LIVES_STOCK_LOOP,
1668 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->btoolbar)));
1669
1670 mainw->m_loopbutton = lives_standard_tool_button_new(LIVES_TOOLBAR(mainw->btoolbar), LIVES_WIDGET(tmp_toolbar_icon), "",
1671 _("Switch continuous looping on (o)"));
1672 lives_widget_set_opacity(mainw->m_loopbutton, .75);
1673 lives_widget_set_focus_on_click(mainw->m_loopbutton, FALSE);
1674
1675 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_LIVES_STOCK_VOLUME_MUTE,
1676 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->btoolbar)));
1677
1678 mainw->m_mutebutton = lives_standard_tool_button_new(LIVES_TOOLBAR(mainw->btoolbar), LIVES_WIDGET(tmp_toolbar_icon), "",
1679 _("Mute the audio (z)"));
1680 lives_widget_set_opacity(mainw->m_mutebutton, .75);
1681 lives_widget_set_focus_on_click(mainw->m_mutebutton, FALSE);
1682
1683 for (i = 0; i < 3; i++) {
1684 lives_toolbar_insert_space(LIVES_TOOLBAR(mainw->btoolbar));
1685 }
1686 mainw->l1_tb = lives_toolbar_insert_label(LIVES_TOOLBAR(mainw->btoolbar), _("Audio Source: "), NULL);
1687 lives_widget_set_valign(mainw->l1_tb, LIVES_ALIGN_START);
1688
1689 widget_opts.expand = LIVES_EXPAND_NONE;
1690 lives_toolbar_insert_space(LIVES_TOOLBAR(mainw->btoolbar));
1691 widget_opts.expand = LIVES_EXPAND_DEFAULT;
1692
1693 mainw->int_audio_checkbutton = lives_toggle_tool_button_new();
1694
1695 #if GTK_CHECK_VERSION(3, 0, 0)
1696 // insert audio src buttons
1697 if (prefs->lamp_buttons) {
1698 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->int_audio_checkbutton), LIVES_WIDGET_EXPOSE_EVENT,
1699 LIVES_GUI_CALLBACK(draw_cool_toggle), NULL);
1700
1701 lives_widget_set_bg_color(mainw->int_audio_checkbutton, LIVES_WIDGET_STATE_ACTIVE, &palette->light_green);
1702 lives_widget_set_bg_color(mainw->int_audio_checkbutton, LIVES_WIDGET_STATE_NORMAL, &palette->dark_red);
1703
1704 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->int_audio_checkbutton), LIVES_WIDGET_TOGGLED_SIGNAL,
1705 LIVES_GUI_CALLBACK(lives_cool_toggled), NULL);
1706 lives_cool_toggled(mainw->int_audio_checkbutton, NULL);
1707 }
1708 #endif
1709
1710 if (!mainw->int_audio_checkbutton) mainw->int_audio_checkbutton = lives_toggle_tool_button_new();
1711
1712 lives_toolbar_insert(LIVES_TOOLBAR(mainw->btoolbar), LIVES_TOOL_ITEM(mainw->int_audio_checkbutton), -1);
1713
1714 woat = widget_opts.apply_theme;
1715
1716 widget_opts.expand = LIVES_EXPAND_NONE;
1717 widget_opts.apply_theme = 0;
1718 lives_toolbar_insert_label(LIVES_TOOLBAR(mainw->btoolbar), _(" Internal"), mainw->int_audio_checkbutton);
1719
1720 mainw->l2_tb = widget_opts.last_label;
1721 lives_widget_set_valign(mainw->l2_tb, LIVES_ALIGN_START);
1722
1723 widget_opts.apply_theme = woat;
1724 lives_toolbar_insert_space(LIVES_TOOLBAR(mainw->btoolbar));
1725 widget_opts.expand = LIVES_EXPAND_DEFAULT;
1726
1727 lives_widget_set_sensitive(mainw->l2_tb, prefs->audio_src != AUDIO_SRC_INT);
1728 lives_widget_set_sensitive(mainw->int_audio_checkbutton, prefs->audio_src != AUDIO_SRC_INT);
1729 lives_toggle_tool_button_set_active(LIVES_TOGGLE_TOOL_BUTTON(mainw->int_audio_checkbutton),
1730 prefs->audio_src == AUDIO_SRC_INT);
1731
1732 toggle_toolbutton_sets_sensitive(LIVES_TOGGLE_TOOL_BUTTON(mainw->int_audio_checkbutton), mainw->l2_tb, TRUE);
1733
1734 mainw->ext_audio_checkbutton = lives_toggle_tool_button_new();
1735
1736 mainw->int_audio_func = lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->int_audio_checkbutton),
1737 LIVES_WIDGET_TOGGLED_SIGNAL, LIVES_GUI_CALLBACK(on_audio_toggled), NULL);
1738
1739 #if GTK_CHECK_VERSION(3, 0, 0)
1740 // insert audio src buttons
1741 if (prefs->lamp_buttons) {
1742 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->ext_audio_checkbutton), LIVES_WIDGET_EXPOSE_EVENT,
1743 LIVES_GUI_CALLBACK(draw_cool_toggle), NULL);
1744
1745 lives_widget_set_bg_color(mainw->ext_audio_checkbutton, LIVES_WIDGET_STATE_ACTIVE, &palette->light_green);
1746 lives_widget_set_bg_color(mainw->ext_audio_checkbutton, LIVES_WIDGET_STATE_NORMAL, &palette->dark_red);
1747
1748 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->ext_audio_checkbutton), LIVES_WIDGET_TOGGLED_SIGNAL,
1749 LIVES_GUI_CALLBACK(lives_cool_toggled), NULL);
1750
1751 lives_cool_toggled(mainw->ext_audio_checkbutton, NULL);
1752 }
1753 #endif
1754
1755 lives_toolbar_insert(LIVES_TOOLBAR(mainw->btoolbar), LIVES_TOOL_ITEM(mainw->ext_audio_checkbutton), -1);
1756
1757 widget_opts.expand = LIVES_EXPAND_NONE;
1758 widget_opts.apply_theme = 0;
1759 lives_toolbar_insert_label(LIVES_TOOLBAR(mainw->btoolbar), _(" External"), mainw->ext_audio_checkbutton);
1760 widget_opts.apply_theme = woat;
1761 widget_opts.expand = LIVES_EXPAND_DEFAULT;
1762
1763 mainw->l3_tb = widget_opts.last_label;
1764 lives_widget_set_valign(mainw->l3_tb, LIVES_ALIGN_START);
1765
1766 lives_widget_set_sensitive(mainw->l3_tb, prefs->audio_src != AUDIO_SRC_EXT);
1767 lives_widget_set_sensitive(mainw->ext_audio_checkbutton, prefs->audio_src != AUDIO_SRC_EXT);
1768 lives_toggle_tool_button_set_active(LIVES_TOGGLE_TOOL_BUTTON(mainw->ext_audio_checkbutton),
1769 prefs->audio_src == AUDIO_SRC_EXT);
1770
1771 toggle_toolbutton_sets_sensitive(LIVES_TOGGLE_TOOL_BUTTON(mainw->ext_audio_checkbutton), mainw->l3_tb, TRUE);
1772
1773 mainw->ext_audio_func = lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->ext_audio_checkbutton),
1774 LIVES_WIDGET_TOGGLED_SIGNAL, LIVES_GUI_CALLBACK(on_audio_toggled), mainw->l3_tb);
1775
1776 if (!is_realtime_aplayer(prefs->audio_player) || prefs->audio_player == AUD_PLAYER_NONE) {
1777 lives_widget_set_sensitive(mainw->int_audio_checkbutton, FALSE);
1778 lives_widget_set_sensitive(mainw->ext_audio_checkbutton, FALSE);
1779 }
1780
1781 #if GTK_CHECK_VERSION(3, 0, 0)
1782 // insert audio src buttons
1783 if (prefs->lamp_buttons) {
1784 mainw->ext_audio_mon = lives_toggle_tool_button_new();
1785 lives_widget_set_size_request(mainw->ext_audio_mon, 8, 8);
1786
1787 lives_widget_set_sensitive(mainw->ext_audio_mon, FALSE);
1788 lives_toolbar_insert(LIVES_TOOLBAR(mainw->btoolbar), LIVES_TOOL_ITEM(mainw->ext_audio_mon), -1);
1789 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->ext_audio_mon), LIVES_WIDGET_EXPOSE_EVENT,
1790 LIVES_GUI_CALLBACK(draw_cool_toggle), NULL);
1791
1792 lives_widget_set_bg_color(mainw->ext_audio_mon, LIVES_WIDGET_STATE_ACTIVE, &palette->light_green);
1793 lives_widget_set_bg_color(mainw->ext_audio_mon, LIVES_WIDGET_STATE_NORMAL, &palette->dark_red);
1794 lives_cool_toggled(mainw->ext_audio_mon, NULL);
1795 }
1796 #endif
1797
1798 #ifdef TEST_VOL_LIGHTS
1799 #if GTK_CHECK_VERSION(3, 0, 0)
1800 widget_opts.expand = LIVES_EXPAND_NONE;
1801 lives_toolbar_insert_space(LIVES_TOOLBAR(mainw->btoolbar));
1802 widget_opts.expand = LIVES_EXPAND_DEFAULT;
1803 for (i = 0; i < NUM_VOL_LIGHTS; i++) {
1804 // insert audio src buttons
1805 if (prefs->lamp_buttons) {
1806 mainw->vol_checkbuttons[i][0] = lives_toggle_tool_button_new();
1807 lives_toolbar_insert(LIVES_TOOLBAR(mainw->btoolbar), LIVES_TOOL_ITEM(mainw->vol_checkbuttons[i][0]), -1);
1808
1809 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->vol_checkbuttons[i][0]), LIVES_WIDGET_EXPOSE_EVENT,
1810 LIVES_GUI_CALLBACK(draw_cool_toggle), NULL);
1811
1812 lives_widget_set_bg_color(mainw->vol_checkbuttons[i][0], LIVES_WIDGET_STATE_ACTIVE, &palette->light_green);
1813 lives_widget_set_bg_color(mainw->vol_checkbuttons[i][0], LIVES_WIDGET_STATE_NORMAL, &palette->dark_red);
1814
1815 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->vol_checkbuttons[i][0]), LIVES_WIDGET_TOGGLED_SIGNAL,
1816 LIVES_GUI_CALLBACK(lives_cool_toggled), NULL);
1817
1818 lives_cool_toggled(mainw->vol_checkbuttons[i][0], NULL);
1819 }
1820 }
1821 #endif
1822 #endif
1823
1824 adj = lives_adjustment_new(prefs->volume, 0., 1., 0.01, 0.01, 0.);
1825
1826 mainw->volume_scale = lives_volume_button_new(LIVES_ORIENTATION_HORIZONTAL, adj, prefs->volume);
1827
1828 mainw->vol_label = NULL;
1829
1830 if (LIVES_IS_RANGE(mainw->volume_scale)) {
1831 mainw->vol_label = LIVES_WIDGET(lives_tool_item_new());
1832 label = lives_label_new(_("Volume"));
1833 lives_container_add(LIVES_CONTAINER(mainw->vol_label), label);
1834 lives_toolbar_insert(LIVES_TOOLBAR(mainw->btoolbar), LIVES_TOOL_ITEM(mainw->vol_label), -1);
1835 } else lives_widget_object_unref(adj);
1836
1837 mainw->vol_toolitem = LIVES_WIDGET(lives_tool_item_new());
1838 lives_container_set_border_width(LIVES_CONTAINER(mainw->vol_toolitem), 0);
1839 lives_container_set_border_width(LIVES_CONTAINER(mainw->volume_scale), 0);
1840
1841 lives_button_set_relief(LIVES_BUTTON(mainw->volume_scale), LIVES_RELIEF_NORMAL);
1842
1843 #ifdef GUI_GTK
1844 gtk_tool_item_set_homogeneous(LIVES_TOOL_ITEM(mainw->vol_toolitem), FALSE);
1845 gtk_tool_item_set_expand(LIVES_TOOL_ITEM(mainw->vol_toolitem), TRUE);
1846 #endif
1847
1848 lives_container_add(LIVES_CONTAINER(mainw->vol_toolitem), mainw->volume_scale);
1849 lives_toolbar_insert_space(LIVES_TOOLBAR(mainw->btoolbar));
1850 lives_toolbar_insert(LIVES_TOOLBAR(mainw->btoolbar), LIVES_TOOL_ITEM(mainw->vol_toolitem), -1);
1851
1852 lives_widget_set_tooltip_text(mainw->vol_toolitem, _("Audio volume (1.00)"));
1853
1854 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->volume_scale), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
1855 LIVES_GUI_CALLBACK(on_volume_slider_value_changed), NULL);
1856
1857 mainw->tb_hbox = lives_hbox_new(FALSE, 0);
1858 mainw->toolbar = lives_toolbar_new();
1859 lives_widget_set_no_show_all(mainw->tb_hbox, TRUE);
1860
1861 lives_toolbar_set_show_arrow(LIVES_TOOLBAR(mainw->toolbar), FALSE);
1862
1863 lives_box_pack_start(LIVES_BOX(mainw->top_vbox), mainw->tb_hbox, FALSE, FALSE, 0);
1864 lives_box_pack_start(LIVES_BOX(mainw->tb_hbox), mainw->toolbar, FALSE, TRUE, 0);
1865
1866 lives_toolbar_set_style(LIVES_TOOLBAR(mainw->toolbar), LIVES_TOOLBAR_ICONS);
1867 lives_toolbar_set_icon_size(LIVES_TOOLBAR(mainw->toolbar), LIVES_ICON_SIZE_SMALL_TOOLBAR);
1868 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_STOCK_MEDIA_STOP,
1869 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->toolbar)));
1870
1871 mainw->t_stopbutton = LIVES_WIDGET(lives_tool_button_new(LIVES_WIDGET(tmp_toolbar_icon), ""));
1872 lives_toolbar_insert(LIVES_TOOLBAR(mainw->toolbar), LIVES_TOOL_ITEM(mainw->t_stopbutton), 0);
1873 lives_widget_set_tooltip_text(mainw->t_stopbutton, _("Stop playback (q)"));
1874
1875 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_LIVES_STOCK_SEPWIN,
1876 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->toolbar)));
1877
1878 mainw->t_sepwin = LIVES_WIDGET(lives_tool_button_new(LIVES_WIDGET(tmp_toolbar_icon), ""));
1879 lives_toolbar_insert(LIVES_TOOLBAR(mainw->toolbar), LIVES_TOOL_ITEM(mainw->t_sepwin), 2);
1880 lives_widget_set_tooltip_text(mainw->t_sepwin, _("Play in separate window (s)"));
1881 lives_widget_set_opacity(mainw->t_sepwin, .75);
1882
1883 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_LIVES_STOCK_FULLSCREEN,
1884 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->toolbar)));
1885
1886 mainw->t_fullscreen = LIVES_WIDGET(lives_tool_button_new(LIVES_WIDGET(tmp_toolbar_icon), ""));
1887 lives_toolbar_insert(LIVES_TOOLBAR(mainw->toolbar), LIVES_TOOL_ITEM(mainw->t_fullscreen), 4);
1888 lives_widget_set_tooltip_text(mainw->t_fullscreen, _("Fullscreen playback (f)"));
1889 lives_widget_set_opacity(mainw->t_fullscreen, .75);
1890
1891 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_STOCK_REMOVE, lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->toolbar)));
1892
1893 mainw->t_slower = LIVES_WIDGET(lives_tool_button_new(LIVES_WIDGET(tmp_toolbar_icon), ""));
1894 lives_toolbar_insert(LIVES_TOOLBAR(mainw->toolbar), LIVES_TOOL_ITEM(mainw->t_slower), 5);
1895 lives_widget_set_tooltip_text(mainw->t_slower, _("Play slower (ctrl-down)"));
1896
1897 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_STOCK_ADD,
1898 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->toolbar)));
1899
1900 mainw->t_faster = LIVES_WIDGET(lives_tool_button_new(LIVES_WIDGET(tmp_toolbar_icon), ""));
1901 lives_toolbar_insert(LIVES_TOOLBAR(mainw->toolbar), LIVES_TOOL_ITEM(mainw->t_faster), 6);
1902 lives_widget_set_tooltip_text(mainw->t_faster, _("Play faster (ctrl-up)"));
1903
1904 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_STOCK_GO_BACK,
1905 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->toolbar)));
1906
1907 mainw->t_back = LIVES_WIDGET(lives_tool_button_new(LIVES_WIDGET(tmp_toolbar_icon), ""));
1908 lives_toolbar_insert(LIVES_TOOLBAR(mainw->toolbar), LIVES_TOOL_ITEM(mainw->t_back), 7);
1909 lives_widget_set_tooltip_text(mainw->t_back, _("Skip back (ctrl-left)"));
1910
1911 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_STOCK_GO_FORWARD,
1912 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->toolbar)));
1913
1914 mainw->t_forward = LIVES_WIDGET(lives_tool_button_new(LIVES_WIDGET(tmp_toolbar_icon), ""));
1915 lives_toolbar_insert(LIVES_TOOLBAR(mainw->toolbar), LIVES_TOOL_ITEM(mainw->t_forward), 8);
1916 lives_widget_set_tooltip_text(mainw->t_forward, _("Skip forward (ctrl-right)"));
1917
1918 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_STOCK_DIALOG_INFO,
1919 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->toolbar)));
1920
1921 mainw->t_infobutton = LIVES_WIDGET(lives_tool_button_new(LIVES_WIDGET(tmp_toolbar_icon), ""));
1922 lives_toolbar_insert(LIVES_TOOLBAR(mainw->toolbar), LIVES_TOOL_ITEM(mainw->t_infobutton), 9);
1923 lives_widget_set_tooltip_text(mainw->t_infobutton, _("Show clip info (i)"));
1924
1925 tmp_toolbar_icon = lives_image_new_from_stock(LIVES_STOCK_CLOSE,
1926 lives_toolbar_get_icon_size(LIVES_TOOLBAR(mainw->toolbar)));
1927
1928 mainw->t_hide = LIVES_WIDGET(lives_tool_button_new(LIVES_WIDGET(tmp_toolbar_icon), ""));
1929 lives_toolbar_insert(LIVES_TOOLBAR(mainw->toolbar), LIVES_TOOL_ITEM(mainw->t_hide), 10);
1930 lives_widget_set_tooltip_text(mainw->t_hide, _("Hide this toolbar"));
1931
1932 t_label = lives_label_new(_("Press \"s\" to toggle separate play window for improved performance, \"q\" to stop."));
1933
1934 if (palette->style & STYLE_1) {
1935 lives_widget_set_fg_color(t_label, LIVES_WIDGET_STATE_NORMAL, &palette->banner_fade_text);
1936 }
1937
1938 lives_box_pack_start(LIVES_BOX(mainw->tb_hbox), t_label, FALSE, FALSE, 0);
1939
1940 // framebar menu bar
1941
1942 vbox99 = lives_vbox_new(FALSE, 0);
1943
1944 mainw->eventbox = lives_event_box_new();
1945 lives_box_pack_start(LIVES_BOX(mainw->top_vbox), mainw->eventbox, FALSE, FALSE, 0);
1946 lives_widget_add_events(mainw->eventbox, LIVES_SMOOTH_SCROLL_MASK | LIVES_SCROLL_MASK);
1947
1948 lives_container_add(LIVES_CONTAINER(mainw->eventbox), vbox99);
1949
1950 vbox4 = lives_vbox_new(FALSE, 0);
1951 lives_box_pack_start(LIVES_BOX(vbox99), vbox4, FALSE, TRUE, 0);
1952 lives_widget_set_vexpand(vbox4, FALSE);
1953
1954 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->eventbox), LIVES_WIDGET_SCROLL_EVENT,
1955 LIVES_GUI_CALLBACK(on_mouse_scroll), NULL);
1956
1957 mainw->framebar = lives_hbox_new(FALSE, 0);
1958 lives_box_pack_start(LIVES_BOX(vbox4), mainw->framebar, FALSE, FALSE, 0.);
1959
1960 mainw->vps_label = lives_standard_label_new(_("Video playback speed (frames per second)"));
1961 lives_box_pack_start(LIVES_BOX(mainw->framebar), mainw->vps_label, FALSE, FALSE, widget_opts.packing_width);
1962
1963 widget_opts.expand = LIVES_EXPAND_NONE;
1964 mainw->spinbutton_pb_fps = lives_standard_spin_button_new(NULL, 0., -FPS_MAX, FPS_MAX, 0.1, 1., 3,
1965 LIVES_BOX(mainw->framebar), _("Vary the video speed"));
1966 widget_opts.expand = LIVES_EXPAND_DEFAULT;
1967
1968 lives_widget_set_sensitive(mainw->spinbutton_pb_fps, FALSE);
1969
1970 if (palette->style == STYLE_PLAIN) {
1971 mainw->banner = lives_label_new(" = < L i V E S > = ");
1972 } else {
1973 mainw->banner = lives_label_new(" ");
1974 }
1975 lives_widget_set_halign(mainw->banner, LIVES_ALIGN_CENTER);
1976
1977 lives_box_pack_start(LIVES_BOX(mainw->framebar), mainw->banner, TRUE, TRUE, 0);
1978
1979 mainw->framecounter = lives_standard_entry_new("", "", FCWIDTHCHARS, FCWIDTHCHARS, NULL, NULL);
1980
1981 #if GTK_CHECK_VERSION(3, 16, 0)
1982 if (mainw->pretty_colours) {
1983 set_css_value_direct(LIVES_WIDGET(mainw->framecounter), LIVES_WIDGET_STATE_NORMAL, "", "border-top-left-radius", "16px");
1984 set_css_value_direct(LIVES_WIDGET(mainw->framecounter), LIVES_WIDGET_STATE_NORMAL, "", "border-top-right-radius", "16px");
1985 set_css_value_direct(LIVES_WIDGET(mainw->framecounter), LIVES_WIDGET_STATE_NORMAL, "", "border-bottom-right-radius", "16px");
1986 set_css_value_direct(LIVES_WIDGET(mainw->framecounter), LIVES_WIDGET_STATE_NORMAL, "", "border-bottom-left-radius", "16px");
1987 }
1988 #endif
1989
1990 lives_box_pack_start(LIVES_BOX(mainw->framebar), mainw->framecounter, FALSE, TRUE, 0);
1991 lives_entry_set_editable(LIVES_ENTRY(mainw->framecounter), FALSE);
1992 lives_widget_set_sensitive(mainw->framecounter, TRUE);
1993 lives_widget_set_can_focus(mainw->framecounter, FALSE);
1994
1995 add_fill_to_box(LIVES_BOX(mainw->framebar));
1996
1997 mainw->pf_grid = lives_table_new(1, 3, TRUE);
1998 lives_widget_set_vexpand(mainw->pf_grid, FALSE);
1999 lives_table_set_column_homogeneous(LIVES_TABLE(mainw->pf_grid), TRUE);
2000
2001 #ifdef GUI_GTK
2002 #if GTK_CHECK_VERSION(3, 0, 0)
2003 lives_box_pack_start(LIVES_BOX(vbox4), mainw->pf_grid, FALSE, FALSE, 0);
2004 #else
2005 // for gtk+ 2.x
2006 hbox = lives_hbox_new(FALSE, 0);
2007 lives_box_pack_start(LIVES_BOX(vbox4), hbox, FALSE, FALSE, 0);
2008 add_spring_to_box(LIVES_BOX(hbox), 0);
2009 alignment = lives_alignment_new(0.5, 0.5, 1.0, 1.0);
2010 lives_container_add(LIVES_CONTAINER(alignment), mainw->pf_grid);
2011 add_spring_to_box(LIVES_BOX(hbox), 0);
2012 lives_box_pack_start(LIVES_BOX(hbox), alignment, TRUE, TRUE, 0);
2013 lives_widget_set_halign(alignment, LIVES_ALIGN_CENTER);
2014 #endif
2015 #endif
2016
2017 mainw->eventbox3 = lives_event_box_new();
2018 lives_table_attach(LIVES_TABLE(mainw->pf_grid), mainw->eventbox3, 0, 1, 0, 1,
2019 (LiVESAttachOptions)(0), (LiVESAttachOptions)(0), 0, 0);
2020 lives_widget_set_halign(mainw->eventbox3, LIVES_ALIGN_CENTER);
2021
2022 lives_widget_set_margin_left(mainw->eventbox3, widget_opts.packing_width);
2023 lives_widget_set_margin_right(mainw->eventbox3, widget_opts.packing_width);
2024
2025 widget_opts.expand = LIVES_EXPAND_NONE;
2026 mainw->frame1 = lives_standard_frame_new(_("First Frame"), 0.25, TRUE);
2027 widget_opts.expand = LIVES_EXPAND_DEFAULT;
2028 lives_container_add(LIVES_CONTAINER(mainw->eventbox3), mainw->frame1);
2029
2030 mainw->freventbox0 = lives_event_box_new();
2031 lives_container_add(LIVES_CONTAINER(mainw->frame1), mainw->freventbox0);
2032 lives_container_add(LIVES_CONTAINER(mainw->freventbox0), mainw->start_image);
2033
2034 widget_opts.expand = LIVES_EXPAND_NONE;
2035 widget_opts.justify = LIVES_JUSTIFY_CENTER;
2036 mainw->playframe = lives_standard_frame_new(_("Play"), 0.5, TRUE);
2037 lives_widget_set_app_paintable(mainw->playframe, TRUE);
2038 widget_opts.justify = LIVES_JUSTIFY_DEFAULT;
2039 widget_opts.expand = LIVES_EXPAND_DEFAULT;
2040 mainw->pl_eventbox = lives_event_box_new();
2041
2042 lives_container_set_border_width(LIVES_CONTAINER(mainw->playframe), 0);
2043
2044 lives_widget_set_hexpand(mainw->playframe, TRUE);
2045
2046 lives_widget_set_margin_left(mainw->playframe, widget_opts.packing_width);
2047 lives_widget_set_margin_right(mainw->playframe, widget_opts.packing_width);
2048
2049 lives_container_add(LIVES_CONTAINER(mainw->playframe), mainw->pl_eventbox);
2050 //lives_widget_set_size_request(mainw->playframe, -1, GUI_SCREEN_HEIGHT / 4);
2051 lives_widget_set_hexpand(mainw->pl_eventbox, FALSE);
2052
2053 mainw->playarea = lives_event_box_new();
2054 lives_container_add(LIVES_CONTAINER(mainw->pl_eventbox), mainw->playarea);
2055 lives_widget_set_app_paintable(mainw->playarea, TRUE);
2056
2057 lives_table_attach(LIVES_TABLE(mainw->pf_grid), mainw->playframe, 1, 2, 0, 1,
2058 (LiVESAttachOptions)(0), (LiVESAttachOptions)(0), 0, 0);
2059
2060 lives_widget_set_halign(mainw->playframe, LIVES_ALIGN_CENTER);
2061
2062 mainw->eventbox4 = lives_event_box_new();
2063
2064 lives_widget_set_app_paintable(mainw->eventbox4, TRUE);
2065
2066 lives_table_attach(LIVES_TABLE(mainw->pf_grid), mainw->eventbox4, 2, 3, 0, 1,
2067 (LiVESAttachOptions)(0), (LiVESAttachOptions)(0), 0, 0);
2068
2069 lives_widget_set_halign(mainw->eventbox4, LIVES_ALIGN_CENTER);
2070
2071 lives_widget_set_margin_left(mainw->eventbox4, widget_opts.packing_width);
2072 lives_widget_set_margin_right(mainw->eventbox4, widget_opts.packing_width);
2073
2074 widget_opts.expand = LIVES_EXPAND_NONE;
2075 mainw->frame2 = lives_standard_frame_new(_("Last Frame"), 0.75, TRUE);
2076 widget_opts.expand = LIVES_EXPAND_DEFAULT;
2077
2078 lives_container_add(LIVES_CONTAINER(mainw->eventbox4), mainw->frame2);
2079
2080 mainw->freventbox1 = lives_event_box_new();
2081 lives_container_add(LIVES_CONTAINER(mainw->frame2), mainw->freventbox1);
2082 lives_container_add(LIVES_CONTAINER(mainw->freventbox1), mainw->end_image);
2083
2084 if (mainw->imframe) {
2085 if (lives_pixbuf_get_width(mainw->imframe) + H_RESIZE_ADJUST < mainw->def_width) {
2086 mainw->def_width = lives_pixbuf_get_width(mainw->imframe) + H_RESIZE_ADJUST;
2087 }
2088 if (lives_pixbuf_get_height(mainw->imframe) + V_RESIZE_ADJUST * mainw->foreign < mainw->def_height) {
2089 mainw->def_height = lives_pixbuf_get_height(mainw->imframe) + V_RESIZE_ADJUST * mainw->foreign;
2090 }
2091 }
2092
2093 // the actual playback image for the internal player
2094 mainw->play_image = lives_standard_drawing_area_new(NULL, &mainw->play_surface);
2095 lives_widget_show(mainw->play_image); // needed to get size
2096 lives_widget_apply_theme(mainw->play_image, LIVES_WIDGET_STATE_NORMAL);
2097
2098 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->play_image), LIVES_WIDGET_EXPOSE_EVENT,
2099 LIVES_GUI_CALLBACK(all_expose), (livespointer)&mainw->play_surface);
2100
2101 lives_widget_object_ref(mainw->play_image);
2102 lives_widget_object_ref_sink(mainw->play_image);
2103
2104 mainw->hbox3 = lives_hbox_new(FALSE, 0);
2105 lives_box_pack_start(LIVES_BOX(vbox4), mainw->hbox3, FALSE, FALSE, 0);
2106 add_spring_to_box(LIVES_BOX(mainw->hbox3), 0);
2107
2108 // "start" spin
2109
2110 dpw = widget_opts.packing_width;
2111 widget_opts.expand = LIVES_EXPAND_NONE;
2112 #if GTK_CHECK_VERSION(3, 0, 0)
2113 if (!(palette->style & STYLE_2)) {
2114 widget_opts.apply_theme = 0;
2115 }
2116 #else
2117 widget_opts.apply_theme = 0;
2118 #endif
2119 widget_opts.packing_width = MAIN_SPIN_SPACER;
2120 mainw->spinbutton_start = lives_standard_spin_button_new(NULL, 0., 0., 0., 1., 1., 0,
2121 LIVES_BOX(mainw->hbox3), _("The first selected frame in this clip"));
2122 widget_opts.expand = LIVES_EXPAND_DEFAULT;
2123 widget_opts.packing_width = dpw;
2124 widget_opts.apply_theme = woat;
2125
2126 if (woat) {
2127 set_css_value_direct(mainw->spinbutton_start, LIVES_WIDGET_STATE_INSENSITIVE, "", "opacity", "0.5");
2128 set_css_value_direct(mainw->spinbutton_start, LIVES_WIDGET_STATE_INSENSITIVE, "button", "opacity", "0.5");
2129 }
2130 lives_entry_set_width_chars(LIVES_ENTRY(mainw->spinbutton_start), 10);
2131 lives_widget_set_halign(mainw->spinbutton_start, LIVES_ALIGN_CENTER);
2132 add_spring_to_box(LIVES_BOX(mainw->hbox3), 0);
2133
2134 // arrows and label
2135
2136 vbox = lives_vbox_new(FALSE, 0);
2137 lives_box_pack_start(LIVES_BOX(mainw->hbox3), vbox, FALSE, FALSE, 0);
2138 lives_widget_set_halign(vbox, LIVES_ALIGN_CENTER);
2139
2140 //
2141
2142 hbox = lives_hbox_new(FALSE, 0.);
2143 lives_box_pack_start(LIVES_BOX(vbox), hbox, FALSE, FALSE, 0);
2144 lives_widget_set_valign(hbox, LIVES_ALIGN_START);
2145 lives_widget_set_halign(hbox, LIVES_ALIGN_CENTER);
2146
2147 mainw->arrow1 = lives_arrow_new(LIVES_ARROW_LEFT, LIVES_SHADOW_OUT);
2148 lives_box_pack_start(LIVES_BOX(hbox), mainw->arrow1, FALSE, FALSE, 0);
2149
2150 mainw->sel_label = lives_standard_label_new(NULL);
2151
2152 set_sel_label(mainw->sel_label);
2153
2154 lives_box_pack_start(LIVES_BOX(hbox), mainw->sel_label, FALSE, FALSE, 0);
2155
2156 mainw->arrow2 = lives_arrow_new(LIVES_ARROW_RIGHT, LIVES_SHADOW_OUT);
2157 lives_box_pack_start(LIVES_BOX(hbox), mainw->arrow2, FALSE, FALSE, 0);
2158
2159 mainw->sa_hbox = lives_hbox_new(TRUE, 0);
2160 add_fill_to_box(LIVES_BOX(mainw->sa_hbox));
2161 lives_box_pack_start(LIVES_BOX(vbox), mainw->sa_hbox, FALSE, FALSE,
2162 lives_widget_set_margin_top(mainw->sa_hbox, 4) ? 0 : 4);
2163
2164 mainw->sa_button = lives_standard_button_new_full(_("Select all Frames"), DEF_BUTTON_WIDTH,
2165 DEF_BUTTON_HEIGHT, LIVES_BOX(mainw->sa_hbox), TRUE,
2166 (tmp = (_("Select all frames in this clip"))));
2167 lives_free(tmp);
2168 add_fill_to_box(LIVES_BOX(mainw->sa_hbox));
2169 lives_widget_set_halign(mainw->sa_button, LIVES_ALIGN_CENTER);
2170
2171 add_spring_to_box(LIVES_BOX(mainw->hbox3), 0);
2172
2173 widget_opts.expand = LIVES_EXPAND_NONE;
2174 widget_opts.packing_width = MAIN_SPIN_SPACER;
2175 #if GTK_CHECK_VERSION(3, 0, 0)
2176 if (!(palette->style & STYLE_2)) {
2177 widget_opts.apply_theme = 0;
2178 }
2179 #else
2180 widget_opts.apply_theme = 0;
2181 #endif
2182 mainw->spinbutton_end = lives_standard_spin_button_new(NULL, 0., 0., 0., 1., 1., 0,
2183 LIVES_BOX(mainw->hbox3), _("The last selected frame in this clip"));
2184 widget_opts.expand = LIVES_EXPAND_DEFAULT;
2185 widget_opts.packing_width = dpw;
2186 widget_opts.apply_theme = woat;
2187 if (woat) {
2188 set_css_value_direct(mainw->spinbutton_end, LIVES_WIDGET_STATE_INSENSITIVE, "", "opacity", "0.5");
2189 set_css_value_direct(mainw->spinbutton_end, LIVES_WIDGET_STATE_INSENSITIVE, "button", "opacity", "0.5");
2190 }
2191
2192 add_spring_to_box(LIVES_BOX(mainw->hbox3), 0.);
2193 lives_entry_set_width_chars(LIVES_ENTRY(mainw->spinbutton_end), 10);
2194 lives_widget_set_halign(mainw->spinbutton_end, LIVES_ALIGN_CENTER);
2195
2196 lives_widget_set_sensitive(mainw->spinbutton_start, FALSE);
2197 lives_widget_set_sensitive(mainw->spinbutton_end, FALSE);
2198
2199 mainw->hseparator = lives_hseparator_new();
2200
2201 if (palette->style & STYLE_1) {
2202 lives_box_pack_start(LIVES_BOX(vbox4), mainw->sep_image, FALSE, FALSE, 4. * widget_opts.scale);
2203 } else {
2204 lives_box_pack_start(LIVES_BOX(vbox4), mainw->hseparator, TRUE, TRUE, 0);
2205 }
2206
2207 #ifdef ENABLE_GIW_3
2208 mainw->hruler = giw_timeline_new_with_adjustment(LIVES_ORIENTATION_HORIZONTAL, 0., 0., 1000000., 1000000.);
2209 lives_box_pack_start(LIVES_BOX(vbox99), mainw->hruler, FALSE, FALSE, 0);
2210 mainw->eventbox5 = NULL;
2211 #else
2212 mainw->eventbox5 = lives_event_box_new();
2213 lives_box_pack_start(LIVES_BOX(vbox99), mainw->eventbox5, FALSE, FALSE, 0);
2214 mainw->hruler = lives_standard_hruler_new();
2215 lives_ruler_set_range(LIVES_RULER(mainw->hruler), 0., 1000000., 0., 1000000.);
2216 lives_container_add(LIVES_CONTAINER(mainw->eventbox5), mainw->hruler);
2217 lives_widget_add_events(mainw->eventbox5, LIVES_BUTTON1_MOTION_MASK | LIVES_POINTER_MOTION_MASK
2218 | LIVES_BUTTON_RELEASE_MASK | LIVES_BUTTON_PRESS_MASK | LIVES_ENTER_NOTIFY_MASK);
2219 #endif
2220
2221 lives_widget_set_size_request(mainw->hruler, -1, CE_HRULE_HEIGHT);
2222
2223 mainw->eventbox2 = lives_event_box_new();
2224
2225 vbox2 = lives_vbox_new(FALSE, 0);
2226 lives_container_add(LIVES_CONTAINER(mainw->eventbox2), vbox2);
2227 lives_box_pack_start(LIVES_BOX(mainw->top_vbox), mainw->eventbox2, FALSE, TRUE, 0);
2228
2229 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->eventbox2), LIVES_WIDGET_EXPOSE_EVENT,
2230 LIVES_GUI_CALLBACK(all_expose_overlay), NULL);
2231
2232 widget_opts.justify = LIVES_JUSTIFY_CENTER;
2233 mainw->vidbar = lives_standard_label_new(_("Video"));
2234 widget_opts.justify = LIVES_JUSTIFY_DEFAULT;
2235
2236 lives_box_pack_start(LIVES_BOX(vbox2), mainw->vidbar, FALSE, FALSE,
2237 lives_widget_set_margin(mainw->vidbar,
2238 widget_opts.packing_height * 2) ? 0 : widget_opts.packing_height * 2);
2239
2240 widget_opts.apply_theme = 1;
2241 mainw->video_draw = lives_drawing_area_new();
2242 widget_opts.apply_theme = woat;
2243
2244 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->video_draw), LIVES_WIDGET_EXPOSE_EVENT,
2245 LIVES_GUI_CALLBACK(expose_vid_draw), NULL);
2246
2247 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->video_draw), LIVES_WIDGET_CONFIGURE_EVENT,
2248 LIVES_GUI_CALLBACK(config_vid_draw), NULL);
2249
2250 lives_widget_set_size_request(mainw->video_draw, -1, CE_VIDBAR_HEIGHT);
2251 lives_widget_set_hexpand(mainw->video_draw, TRUE);
2252 lives_box_pack_start(LIVES_BOX(vbox2), mainw->video_draw, FALSE, TRUE, widget_opts.packing_height / 2);
2253
2254 tmp = get_achannel_name(2, 0);
2255 widget_opts.justify = LIVES_JUSTIFY_CENTER;
2256 mainw->laudbar = lives_standard_label_new(tmp);
2257 widget_opts.justify = LIVES_JUSTIFY_DEFAULT;
2258 lives_free(tmp);
2259
2260 lives_box_pack_start(LIVES_BOX(vbox2), mainw->laudbar, FALSE, FALSE,
2261 lives_widget_set_margin_top(mainw->laudbar,
2262 widget_opts.packing_height + 4) ? 0 : widget_opts.packing_height + 4);
2263
2264 widget_opts.apply_theme = 1;
2265 mainw->laudio_draw = lives_drawing_area_new();
2266 widget_opts.apply_theme = woat;
2267
2268 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->laudio_draw), LIVES_WIDGET_EXPOSE_EVENT,
2269 LIVES_GUI_CALLBACK(expose_laud_draw), NULL);
2270
2271 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->laudio_draw), LIVES_WIDGET_CONFIGURE_EVENT,
2272 LIVES_GUI_CALLBACK(config_laud_draw), NULL);
2273
2274 lives_widget_set_size_request(mainw->laudio_draw, -1, CE_AUDBAR_HEIGHT);
2275 lives_widget_set_hexpand(mainw->laudio_draw, TRUE);
2276 lives_box_pack_start(LIVES_BOX(vbox2), mainw->laudio_draw, FALSE, TRUE, widget_opts.packing_height / 2);
2277
2278 tmp = get_achannel_name(2, 1);
2279 widget_opts.justify = LIVES_JUSTIFY_CENTER;
2280 mainw->raudbar = lives_standard_label_new(tmp);
2281 widget_opts.justify = LIVES_JUSTIFY_DEFAULT;
2282 lives_free(tmp);
2283
2284 lives_box_pack_start(LIVES_BOX(vbox2), mainw->raudbar, FALSE, FALSE, 0);
2285 /* lives_widget_set_margin_top(mainw->raudbar, */
2286 /* widget_opts.packing_height) ? 0 : widget_opts.packing_height); */
2287 widget_opts.apply_theme = 1;
2288 mainw->raudio_draw = lives_drawing_area_new();
2289 widget_opts.apply_theme = woat;
2290
2291 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->raudio_draw), LIVES_WIDGET_EXPOSE_EVENT,
2292 LIVES_GUI_CALLBACK(expose_raud_draw), NULL);
2293
2294 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->raudio_draw), LIVES_WIDGET_CONFIGURE_EVENT,
2295 LIVES_GUI_CALLBACK(config_raud_draw), NULL);
2296
2297 lives_widget_set_size_request(mainw->raudio_draw, -1, CE_AUDBAR_HEIGHT);
2298 lives_widget_set_hexpand(mainw->raudio_draw, TRUE);
2299 lives_box_pack_start(LIVES_BOX(vbox2), mainw->raudio_draw, FALSE, FALSE, 0);
2300
2301 if (prefs->show_msg_area) {
2302 mainw->message_box = lives_hbox_new(FALSE, 0);
2303 lives_widget_set_app_paintable(mainw->message_box, TRUE);
2304 //lives_widget_set_vexpand(mainw->message_box, TRUE);
2305 lives_box_pack_start(LIVES_BOX(mainw->top_vbox), mainw->message_box, FALSE, TRUE, 0);
2306
2307 mainw->msg_area = lives_standard_drawing_area_new(LIVES_GUI_CALLBACK(reshow_msg_area), &mainw->msg_surface);
2308
2309 lives_widget_add_events(mainw->msg_area, LIVES_SMOOTH_SCROLL_MASK | LIVES_SCROLL_MASK);
2310
2311 //lives_widget_set_vexpand(mainw->msg_area, TRUE);
2312 lives_container_set_border_width(LIVES_CONTAINER(mainw->message_box), 0);
2313 lives_widget_apply_theme3(mainw->msg_area, LIVES_WIDGET_STATE_NORMAL);
2314 lives_box_pack_start(LIVES_BOX(mainw->message_box), mainw->msg_area, TRUE, TRUE, 0);
2315
2316 mainw->msg_scrollbar = lives_vscrollbar_new(NULL);
2317 lives_box_pack_end(LIVES_BOX(mainw->message_box), mainw->msg_scrollbar, FALSE, TRUE, 0);
2318
2319 mainw->msg_adj = lives_range_get_adjustment(LIVES_RANGE(mainw->msg_scrollbar));
2320
2321 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->msg_adj), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
2322 LIVES_GUI_CALLBACK(msg_area_scroll), (livespointer)mainw->msg_area);
2323
2324 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->msg_area), LIVES_WIDGET_SCROLL_EVENT,
2325 LIVES_GUI_CALLBACK(on_msg_area_scroll), (livespointer)mainw->msg_adj);
2326 } else {
2327 mainw->message_box = mainw->msg_area = mainw->msg_scrollbar = NULL;
2328 mainw->msg_adj = NULL;
2329 }
2330
2331 // accel keys
2332 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Page_Up, LIVES_CONTROL_MASK,
2333 (LiVESAccelFlags)0,
2334 lives_cclosure_new(LIVES_GUI_CALLBACK(prevclip_callback), NULL, NULL));
2335
2336 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Page_Down, LIVES_CONTROL_MASK,
2337 (LiVESAccelFlags)0,
2338 lives_cclosure_new(LIVES_GUI_CALLBACK(nextclip_callback), NULL, NULL));
2339
2340 // Let the player handle this
2341
2342 // actually, for up and down, the user data doesn't matter since it is ignored when we create synthetic
2343 // key presses, and only the keymod counts. However it's added here as a guide.
2344 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Down,
2345 LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2346 lives_cclosure_new(LIVES_GUI_CALLBACK(slower_callback),
2347 LIVES_INT_TO_POINTER(SCREEN_AREA_FOREGROUND), NULL));
2348
2349 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Down,
2350 (LiVESXModifierType)(LIVES_CONTROL_MASK | LIVES_SHIFT_MASK),
2351 (LiVESAccelFlags)0, lives_cclosure_new(LIVES_GUI_CALLBACK(slower_callback),
2352 LIVES_INT_TO_POINTER(SCREEN_AREA_BACKGROUND), NULL));
2353
2354 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Down,
2355 (LIVES_CONTROL_MASK | LIVES_ALT_MASK), (LiVESAccelFlags)0,
2356 lives_cclosure_new(LIVES_GUI_CALLBACK(less_callback), NULL, NULL));
2357
2358 //////////////////////////
2359
2360 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Up,
2361 LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2362 lives_cclosure_new(LIVES_GUI_CALLBACK(faster_callback),
2363 LIVES_INT_TO_POINTER(SCREEN_AREA_FOREGROUND), NULL));
2364
2365 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Up,
2366 (LiVESXModifierType)(LIVES_CONTROL_MASK | LIVES_SHIFT_MASK),
2367 (LiVESAccelFlags)0,
2368 lives_cclosure_new(LIVES_GUI_CALLBACK(faster_callback),
2369 LIVES_INT_TO_POINTER(SCREEN_AREA_BACKGROUND), NULL));
2370
2371 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Up,
2372 (LiVESXModifierType)(LIVES_CONTROL_MASK | LIVES_ALT_MASK),
2373 (LiVESAccelFlags)0,
2374 lives_cclosure_new(LIVES_GUI_CALLBACK(more_callback), NULL, NULL));
2375
2376 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Left,
2377 LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2378 lives_cclosure_new(LIVES_GUI_CALLBACK(skip_back_callback), NULL, NULL));
2379
2380 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Right,
2381 LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2382 lives_cclosure_new(LIVES_GUI_CALLBACK(skip_forward_callback), NULL, NULL));
2383
2384 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Space,
2385 (LiVESXModifierType)(LIVES_CONTROL_MASK),
2386 (LiVESAccelFlags)0, lives_cclosure_new(LIVES_GUI_CALLBACK(dirchange_callback),
2387 LIVES_INT_TO_POINTER(SCREEN_AREA_FOREGROUND), NULL));
2388
2389 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Space,
2390 (LiVESXModifierType)(LIVES_CONTROL_MASK | LIVES_ALT_MASK),
2391 (LiVESAccelFlags)0, lives_cclosure_new(LIVES_GUI_CALLBACK(dirchange_lock_callback),
2392 LIVES_INT_TO_POINTER(SCREEN_AREA_FOREGROUND), NULL));
2393
2394 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), GDK_KEY_braceleft,
2395 (LiVESXModifierType)(LIVES_CONTROL_MASK),
2396 (LiVESAccelFlags)0, lives_cclosure_new(LIVES_GUI_CALLBACK(dirchange_lock_callback),
2397 LIVES_INT_TO_POINTER(SCREEN_AREA_FOREGROUND), NULL));
2398
2399 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Space,
2400 (LiVESXModifierType)(LIVES_CONTROL_MASK | LIVES_SHIFT_MASK),
2401 (LiVESAccelFlags)0, lives_cclosure_new(LIVES_GUI_CALLBACK(dirchange_callback),
2402 LIVES_INT_TO_POINTER(SCREEN_AREA_BACKGROUND), NULL));
2403
2404 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Return,
2405 LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2406 lives_cclosure_new(LIVES_GUI_CALLBACK(fps_reset_callback),
2407 LIVES_INT_TO_POINTER(SCREEN_AREA_FOREGROUND), NULL));
2408
2409 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Return,
2410 (LiVESXModifierType)(LIVES_CONTROL_MASK | LIVES_SHIFT_MASK), (LiVESAccelFlags)0,
2411 lives_cclosure_new(LIVES_GUI_CALLBACK(fps_reset_callback),
2412 LIVES_INT_TO_POINTER(SCREEN_AREA_BACKGROUND), NULL));
2413
2414 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Less, (LiVESXModifierType)LIVES_SHIFT_MASK,
2415 (LiVESAccelFlags)0, lives_cclosure_new(LIVES_GUI_CALLBACK(voldown_callback), NULL, NULL));
2416
2417 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Greater, (LiVESXModifierType)LIVES_SHIFT_MASK,
2418 (LiVESAccelFlags)0, lives_cclosure_new(LIVES_GUI_CALLBACK(volup_callback), NULL, NULL));
2419
2420 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_k, (LiVESXModifierType)0, (LiVESAccelFlags)0,
2421 lives_cclosure_new(LIVES_GUI_CALLBACK(grabkeys_callback), LIVES_INT_TO_POINTER(-1), NULL));
2422
2423 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_t, (LiVESXModifierType)0, (LiVESAccelFlags)0,
2424 lives_cclosure_new(LIVES_GUI_CALLBACK(textparm_callback), NULL, NULL));
2425
2426 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_m, (LiVESXModifierType)0, (LiVESAccelFlags)0,
2427 lives_cclosure_new(LIVES_GUI_CALLBACK(rtemode_callback), NULL,
2428 LIVES_INT_TO_POINTER(NEXT_MODE_CYCLE)));
2429
2430 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_m, (LiVESXModifierType)LIVES_SHIFT_MASK,
2431 (LiVESAccelFlags)0, lives_cclosure_new(LIVES_GUI_CALLBACK(rtemode_callback),
2432 LIVES_INT_TO_POINTER(PREV_MODE_CYCLE), NULL));
2433
2434 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_x, (LiVESXModifierType)0, (LiVESAccelFlags)0,
2435 lives_cclosure_new(LIVES_GUI_CALLBACK(swap_fg_bg_callback), NULL, NULL));
2436
2437 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_n, (LiVESXModifierType)0, (LiVESAccelFlags)0,
2438 lives_cclosure_new(LIVES_GUI_CALLBACK(nervous_callback), NULL, NULL));
2439
2440 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_w, (LiVESXModifierType)0, (LiVESAccelFlags)0,
2441 lives_cclosure_new(LIVES_GUI_CALLBACK(show_sync_callback), NULL, NULL));
2442
2443 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_a, (LiVESXModifierType)0, (LiVESAccelFlags)0,
2444 lives_cclosure_new(LIVES_GUI_CALLBACK(aud_lock_callback), LIVES_INT_TO_POINTER(TRUE), NULL));
2445
2446 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_a, (LiVESXModifierType)LIVES_SHIFT_MASK,
2447 (LiVESAccelFlags)0,
2448 lives_cclosure_new(LIVES_GUI_CALLBACK(aud_lock_callback), LIVES_INT_TO_POINTER(FALSE), NULL));
2449
2450 if (FN_KEYS > 0) {
2451 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_F1, (LiVESXModifierType)0, (LiVESAccelFlags)0,
2452 lives_cclosure_new(LIVES_GUI_CALLBACK(storeclip_callback), LIVES_INT_TO_POINTER(1), NULL));
2453 if (FN_KEYS > 1) {
2454 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_F2, (LiVESXModifierType)0, (LiVESAccelFlags)0,
2455 lives_cclosure_new(LIVES_GUI_CALLBACK(storeclip_callback), LIVES_INT_TO_POINTER(2), NULL));
2456 if (FN_KEYS > 2) {
2457 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_F3, (LiVESXModifierType)0, (LiVESAccelFlags)0,
2458 lives_cclosure_new(LIVES_GUI_CALLBACK(storeclip_callback), LIVES_INT_TO_POINTER(3), NULL));
2459 if (FN_KEYS > 3) {
2460 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_F4,
2461 (LiVESXModifierType)0, (LiVESAccelFlags)0,
2462 lives_cclosure_new(LIVES_GUI_CALLBACK(storeclip_callback), LIVES_INT_TO_POINTER(4), NULL));
2463 if (FN_KEYS > 4) {
2464 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_F5,
2465 (LiVESXModifierType)0, (LiVESAccelFlags)0,
2466 lives_cclosure_new(LIVES_GUI_CALLBACK(storeclip_callback), LIVES_INT_TO_POINTER(5), NULL));
2467 if (FN_KEYS > 5) {
2468 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_F6,
2469 (LiVESXModifierType)0, (LiVESAccelFlags)0,
2470 lives_cclosure_new(LIVES_GUI_CALLBACK(storeclip_callback),
2471 LIVES_INT_TO_POINTER(6), NULL));
2472 if (FN_KEYS > 6) {
2473 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_F7,
2474 (LiVESXModifierType)0, (LiVESAccelFlags)0,
2475 lives_cclosure_new(LIVES_GUI_CALLBACK(storeclip_callback),
2476 LIVES_INT_TO_POINTER(7), NULL));
2477 if (FN_KEYS > 7) {
2478 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_F8,
2479 (LiVESXModifierType)0, (LiVESAccelFlags)0,
2480 lives_cclosure_new(LIVES_GUI_CALLBACK(storeclip_callback),
2481 LIVES_INT_TO_POINTER(8), NULL));
2482 if (FN_KEYS > 8) {
2483 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_F9,
2484 (LiVESXModifierType)0, (LiVESAccelFlags)0,
2485 lives_cclosure_new(LIVES_GUI_CALLBACK(storeclip_callback),
2486 LIVES_INT_TO_POINTER(9), NULL));
2487 if (FN_KEYS > 9) {
2488 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_F10,
2489 (LiVESXModifierType)0, (LiVESAccelFlags)0,
2490 lives_cclosure_new(LIVES_GUI_CALLBACK(storeclip_callback),
2491 LIVES_INT_TO_POINTER(10), NULL));
2492 if (FN_KEYS > 10) {
2493 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_F11,
2494 (LiVESXModifierType)0, (LiVESAccelFlags)0,
2495 lives_cclosure_new(LIVES_GUI_CALLBACK(storeclip_callback),
2496 LIVES_INT_TO_POINTER(11), NULL));
2497 if (FN_KEYS > 11) {
2498 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_F12,
2499 (LiVESXModifierType)0, (LiVESAccelFlags)0,
2500 lives_cclosure_new(LIVES_GUI_CALLBACK(storeclip_callback),
2501 LIVES_INT_TO_POINTER(12), NULL));
2502 // ad nauseum...
2503 // *INDENT-OFF*
2504 }}}}}}}}}}}}
2505 // *INDENT-ON*
2506
2507 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_0, LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2508 lives_cclosure_new(LIVES_GUI_CALLBACK(rte_on_off_callback), LIVES_INT_TO_POINTER(0), NULL));
2509 if (FX_KEYS_PHYSICAL > 0) {
2510 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_1, LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2511 lives_cclosure_new(LIVES_GUI_CALLBACK(rte_on_off_callback), LIVES_INT_TO_POINTER(1), NULL));
2512 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_1, LIVES_CONTROL_MASK | LIVES_ALT_MASK,
2513 (LiVESAccelFlags)0,
2514 lives_cclosure_new(LIVES_GUI_CALLBACK(grabkeys_callback), LIVES_INT_TO_POINTER(0), NULL));
2515 if (FX_KEYS_PHYSICAL > 1) {
2516 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_2, LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2517 lives_cclosure_new(LIVES_GUI_CALLBACK(rte_on_off_callback), LIVES_INT_TO_POINTER(2), NULL));
2518 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_2, LIVES_CONTROL_MASK | LIVES_ALT_MASK,
2519 (LiVESAccelFlags)0,
2520 lives_cclosure_new(LIVES_GUI_CALLBACK(grabkeys_callback), LIVES_INT_TO_POINTER(1), NULL));
2521 if (FX_KEYS_PHYSICAL > 2) {
2522 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_3, LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2523 lives_cclosure_new(LIVES_GUI_CALLBACK(rte_on_off_callback), LIVES_INT_TO_POINTER(3), NULL));
2524 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_3, LIVES_CONTROL_MASK | LIVES_ALT_MASK,
2525 (LiVESAccelFlags)0,
2526 lives_cclosure_new(LIVES_GUI_CALLBACK(grabkeys_callback), LIVES_INT_TO_POINTER(2), NULL));
2527 if (FX_KEYS_PHYSICAL > 3) {
2528 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_4, LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2529 lives_cclosure_new(LIVES_GUI_CALLBACK(rte_on_off_callback), LIVES_INT_TO_POINTER(4), NULL));
2530 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_4, LIVES_CONTROL_MASK | LIVES_ALT_MASK,
2531 (LiVESAccelFlags)0,
2532 lives_cclosure_new(LIVES_GUI_CALLBACK(grabkeys_callback), LIVES_INT_TO_POINTER(3), NULL));
2533 if (FX_KEYS_PHYSICAL > 4) {
2534 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_5, LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2535 lives_cclosure_new(LIVES_GUI_CALLBACK(rte_on_off_callback), LIVES_INT_TO_POINTER(5), NULL));
2536 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_5, LIVES_CONTROL_MASK | LIVES_ALT_MASK,
2537 (LiVESAccelFlags)0,
2538 lives_cclosure_new(LIVES_GUI_CALLBACK(grabkeys_callback), LIVES_INT_TO_POINTER(4), NULL));
2539 if (FX_KEYS_PHYSICAL > 5) {
2540 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_6,
2541 LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2542 lives_cclosure_new(LIVES_GUI_CALLBACK(rte_on_off_callback),
2543 LIVES_INT_TO_POINTER(6), NULL));
2544 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_6, LIVES_CONTROL_MASK | LIVES_ALT_MASK,
2545 (LiVESAccelFlags)0,
2546 lives_cclosure_new(LIVES_GUI_CALLBACK(grabkeys_callback), LIVES_INT_TO_POINTER(5), NULL));
2547 if (FX_KEYS_PHYSICAL > 6) {
2548 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_7,
2549 LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2550 lives_cclosure_new(LIVES_GUI_CALLBACK(rte_on_off_callback),
2551 LIVES_INT_TO_POINTER(7), NULL));
2552 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_7, LIVES_CONTROL_MASK | LIVES_ALT_MASK,
2553 (LiVESAccelFlags)0,
2554 lives_cclosure_new(LIVES_GUI_CALLBACK(grabkeys_callback),
2555 LIVES_INT_TO_POINTER(6), NULL));
2556 if (FX_KEYS_PHYSICAL > 7) {
2557 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_8,
2558 LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2559 lives_cclosure_new(LIVES_GUI_CALLBACK(rte_on_off_callback),
2560 LIVES_INT_TO_POINTER(8), NULL));
2561 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_8,
2562 LIVES_CONTROL_MASK | LIVES_ALT_MASK,
2563 (LiVESAccelFlags)0,
2564 lives_cclosure_new(LIVES_GUI_CALLBACK(grabkeys_callback),
2565 LIVES_INT_TO_POINTER(7), NULL));
2566 if (FX_KEYS_PHYSICAL > 8) {
2567 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group),
2568 LIVES_KEY_9, LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2569 lives_cclosure_new(LIVES_GUI_CALLBACK(rte_on_off_callback),
2570 LIVES_INT_TO_POINTER(9), NULL));
2571 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_9,
2572 LIVES_CONTROL_MASK | LIVES_ALT_MASK,
2573 (LiVESAccelFlags)0,
2574 lives_cclosure_new(LIVES_GUI_CALLBACK(grabkeys_callback),
2575 LIVES_INT_TO_POINTER(8), NULL));
2576 // *INDENT-OFF*
2577 }}}}}}}}}
2578 // *INDENT-ON*
2579
2580 if (prefs->rte_keys_virtual > 9) {
2581 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Minus, LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2582 lives_cclosure_new(LIVES_GUI_CALLBACK(rte_on_off_callback), LIVES_INT_TO_POINTER(10), NULL));
2583 }
2584 if (prefs->rte_keys_virtual > 10) {
2585 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_Equal, LIVES_CONTROL_MASK, (LiVESAccelFlags)0,
2586 lives_cclosure_new(LIVES_GUI_CALLBACK(rte_on_off_callback), LIVES_INT_TO_POINTER(11), NULL));
2587 }
2588
2589 if (new_lives) {
2590 lives_signal_connect(LIVES_GUI_OBJECT(LIVES_MAIN_WINDOW_WIDGET), LIVES_WIDGET_DELETE_EVENT,
2591 LIVES_GUI_CALLBACK(on_LiVES_delete_event), NULL);
2592 lives_signal_connect(LIVES_GUI_OBJECT(LIVES_MAIN_WINDOW_WIDGET), LIVES_WIDGET_KEY_PRESS_EVENT,
2593 LIVES_GUI_CALLBACK(key_press_or_release), NULL);
2594 lives_signal_connect(LIVES_GUI_OBJECT(LIVES_MAIN_WINDOW_WIDGET), LIVES_WIDGET_KEY_RELEASE_EVENT,
2595 LIVES_GUI_CALLBACK(key_press_or_release), NULL);
2596 }
2597 mainw->pb_fps_func = lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->spinbutton_pb_fps),
2598 LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
2599 LIVES_GUI_CALLBACK(changed_fps_during_pb), NULL);
2600 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->open), LIVES_WIDGET_ACTIVATE_SIGNAL,
2601 LIVES_GUI_CALLBACK(on_open_activate), NULL);
2602 lives_signal_connect(LIVES_GUI_OBJECT(mainw->open_sel), LIVES_WIDGET_ACTIVATE_SIGNAL,
2603 LIVES_GUI_CALLBACK(on_open_sel_activate), NULL);
2604 lives_signal_connect(LIVES_GUI_OBJECT(mainw->open_dvd), LIVES_WIDGET_ACTIVATE_SIGNAL,
2605 LIVES_GUI_CALLBACK(on_open_vcd_activate),
2606 LIVES_INT_TO_POINTER(LIVES_DEVICE_DVD));
2607 lives_signal_connect(LIVES_GUI_OBJECT(mainw->open_vcd), LIVES_WIDGET_ACTIVATE_SIGNAL,
2608 LIVES_GUI_CALLBACK(on_open_vcd_activate),
2609 LIVES_INT_TO_POINTER(LIVES_DEVICE_VCD));
2610 lives_signal_connect(LIVES_GUI_OBJECT(mainw->open_loc), LIVES_WIDGET_ACTIVATE_SIGNAL,
2611 LIVES_GUI_CALLBACK(on_open_loc_activate), NULL);
2612 //#ifdef HAVE_WEBM
2613 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->open_utube), LIVES_WIDGET_ACTIVATE_SIGNAL,
2614 LIVES_GUI_CALLBACK(on_open_utube_activate), NULL);
2615
2616 #ifdef HAVE_LDVGRAB
2617 lives_signal_connect(LIVES_GUI_OBJECT(mainw->open_firewire), LIVES_WIDGET_ACTIVATE_SIGNAL,
2618 LIVES_GUI_CALLBACK(on_open_fw_activate),
2619 LIVES_INT_TO_POINTER(CAM_FORMAT_DV));
2620 lives_signal_connect(LIVES_GUI_OBJECT(mainw->open_hfirewire), LIVES_WIDGET_ACTIVATE_SIGNAL,
2621 LIVES_GUI_CALLBACK(on_open_fw_activate),
2622 LIVES_INT_TO_POINTER(CAM_FORMAT_HDV));
2623 #endif
2624
2625 #ifdef HAVE_YUV4MPEG
2626 lives_signal_connect(LIVES_GUI_OBJECT(mainw->open_yuv4m), LIVES_WIDGET_ACTIVATE_SIGNAL,
2627 LIVES_GUI_CALLBACK(on_open_yuv4m_activate), NULL);
2628 #endif
2629 lives_signal_connect(LIVES_GUI_OBJECT(mainw->open_lives2lives), LIVES_WIDGET_ACTIVATE_SIGNAL,
2630 LIVES_GUI_CALLBACK(on_open_lives2lives_activate), NULL);
2631 lives_signal_connect(LIVES_GUI_OBJECT(mainw->send_lives2lives), LIVES_WIDGET_ACTIVATE_SIGNAL,
2632 LIVES_GUI_CALLBACK(on_send_lives2lives_activate), NULL);
2633 lives_signal_connect(LIVES_GUI_OBJECT(mainw->backup), LIVES_WIDGET_ACTIVATE_SIGNAL,
2634 LIVES_GUI_CALLBACK(on_backup_activate), NULL);
2635 lives_signal_connect(LIVES_GUI_OBJECT(mainw->restore), LIVES_WIDGET_ACTIVATE_SIGNAL,
2636 LIVES_GUI_CALLBACK(on_restore_activate), NULL);
2637 lives_signal_connect(LIVES_GUI_OBJECT(mainw->save_as), LIVES_WIDGET_ACTIVATE_SIGNAL,
2638 LIVES_GUI_CALLBACK(on_save_as_activate), NULL);
2639 #ifdef LIBAV_TRANSCODE
2640 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->transcode), LIVES_WIDGET_ACTIVATE_SIGNAL,
2641 LIVES_GUI_CALLBACK(on_transcode_activate), NULL);
2642 #endif
2643 lives_signal_connect(LIVES_GUI_OBJECT(mainw->save_selection), LIVES_WIDGET_ACTIVATE_SIGNAL,
2644 LIVES_GUI_CALLBACK(on_save_selection_activate), NULL);
2645 lives_signal_connect(LIVES_GUI_OBJECT(mainw->close), LIVES_WIDGET_ACTIVATE_SIGNAL,
2646 LIVES_GUI_CALLBACK(on_close_activate), NULL);
2647 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->import_proj), LIVES_WIDGET_ACTIVATE_SIGNAL,
2648 LIVES_GUI_CALLBACK(on_import_proj_activate), NULL);
2649 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->export_proj), LIVES_WIDGET_ACTIVATE_SIGNAL,
2650 LIVES_GUI_CALLBACK(on_export_proj_activate), NULL);
2651 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->export_theme), LIVES_WIDGET_ACTIVATE_SIGNAL,
2652 LIVES_GUI_CALLBACK(on_export_theme_activate), NULL);
2653 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->import_theme), LIVES_WIDGET_ACTIVATE_SIGNAL,
2654 LIVES_GUI_CALLBACK(on_import_theme_activate), NULL);
2655 lives_signal_connect(LIVES_GUI_OBJECT(mainw->clear_ds), LIVES_WIDGET_ACTIVATE_SIGNAL,
2656 LIVES_GUI_CALLBACK(on_cleardisk_activate), NULL);
2657 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->quit), LIVES_WIDGET_ACTIVATE_SIGNAL,
2658 LIVES_GUI_CALLBACK(on_quit_activate),
2659 LIVES_INT_TO_POINTER(0));
2660 lives_signal_connect(LIVES_GUI_OBJECT(mainw->vj_save_set), LIVES_WIDGET_ACTIVATE_SIGNAL,
2661 LIVES_GUI_CALLBACK(on_quit_activate),
2662 LIVES_INT_TO_POINTER(1));
2663 lives_signal_connect(LIVES_GUI_OBJECT(mainw->undo), LIVES_WIDGET_ACTIVATE_SIGNAL,
2664 LIVES_GUI_CALLBACK(on_undo_activate), NULL);
2665 lives_signal_connect(LIVES_GUI_OBJECT(mainw->redo), LIVES_WIDGET_ACTIVATE_SIGNAL,
2666 LIVES_GUI_CALLBACK(on_redo_activate), NULL);
2667 lives_signal_connect(LIVES_GUI_OBJECT(mainw->copy), LIVES_WIDGET_ACTIVATE_SIGNAL,
2668 LIVES_GUI_CALLBACK(on_copy_activate), NULL);
2669 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->mt_menu), LIVES_WIDGET_ACTIVATE_SIGNAL,
2670 LIVES_GUI_CALLBACK(on_multitrack_activate), NULL);
2671 lives_signal_connect(LIVES_GUI_OBJECT(mainw->cut), LIVES_WIDGET_ACTIVATE_SIGNAL,
2672 LIVES_GUI_CALLBACK(on_cut_activate), NULL);
2673 lives_signal_connect(LIVES_GUI_OBJECT(mainw->insert), LIVES_WIDGET_ACTIVATE_SIGNAL,
2674 LIVES_GUI_CALLBACK(on_insert_pre_activate), NULL);
2675 lives_signal_connect(LIVES_GUI_OBJECT(mainw->merge), LIVES_WIDGET_ACTIVATE_SIGNAL,
2676 LIVES_GUI_CALLBACK(on_merge_activate), NULL);
2677 lives_signal_connect(LIVES_GUI_OBJECT(mainw->paste_as_new), LIVES_WIDGET_ACTIVATE_SIGNAL,
2678 LIVES_GUI_CALLBACK(on_paste_as_new_activate), NULL);
2679 lives_signal_connect(LIVES_GUI_OBJECT(mainw->xdelete), LIVES_WIDGET_ACTIVATE_SIGNAL,
2680 LIVES_GUI_CALLBACK(on_delete_activate), NULL);
2681 lives_signal_connect(LIVES_GUI_OBJECT(mainw->select_all), LIVES_WIDGET_ACTIVATE_SIGNAL,
2682 LIVES_GUI_CALLBACK(on_select_all_activate), NULL);
2683 lives_signal_connect(LIVES_GUI_OBJECT(mainw->select_start_only), LIVES_WIDGET_ACTIVATE_SIGNAL,
2684 LIVES_GUI_CALLBACK(on_select_start_only_activate), NULL);
2685 lives_signal_connect(LIVES_GUI_OBJECT(mainw->select_end_only), LIVES_WIDGET_ACTIVATE_SIGNAL,
2686 LIVES_GUI_CALLBACK(on_select_end_only_activate), NULL);
2687 lives_signal_connect(LIVES_GUI_OBJECT(mainw->select_invert), LIVES_WIDGET_ACTIVATE_SIGNAL,
2688 LIVES_GUI_CALLBACK(on_select_invert_activate), NULL);
2689 lives_signal_connect(LIVES_GUI_OBJECT(mainw->select_new), LIVES_WIDGET_ACTIVATE_SIGNAL,
2690 LIVES_GUI_CALLBACK(on_select_new_activate), NULL);
2691 lives_signal_connect(LIVES_GUI_OBJECT(mainw->select_to_end), LIVES_WIDGET_ACTIVATE_SIGNAL,
2692 LIVES_GUI_CALLBACK(on_select_to_end_activate), NULL);
2693 lives_signal_connect(LIVES_GUI_OBJECT(mainw->select_to_aend), LIVES_WIDGET_ACTIVATE_SIGNAL,
2694 LIVES_GUI_CALLBACK(on_select_to_aend_activate), NULL);
2695 lives_signal_connect(LIVES_GUI_OBJECT(mainw->select_from_start), LIVES_WIDGET_ACTIVATE_SIGNAL,
2696 LIVES_GUI_CALLBACK(on_select_from_start_activate), NULL);
2697 lives_signal_connect(LIVES_GUI_OBJECT(mainw->select_last), LIVES_WIDGET_ACTIVATE_SIGNAL,
2698 LIVES_GUI_CALLBACK(on_select_last_activate), NULL);
2699 lives_signal_connect(LIVES_GUI_OBJECT(mainw->lock_selwidth), LIVES_WIDGET_ACTIVATE_SIGNAL,
2700 LIVES_GUI_CALLBACK(on_lock_selwidth_activate), NULL);
2701 mainw->record_perf_func = lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->record_perf), LIVES_WIDGET_ACTIVATE_SIGNAL,
2702 LIVES_GUI_CALLBACK(on_record_perf_activate), NULL);
2703 lives_signal_connect(LIVES_GUI_OBJECT(mainw->playall), LIVES_WIDGET_ACTIVATE_SIGNAL,
2704 LIVES_GUI_CALLBACK(on_playall_activate), NULL);
2705 lives_signal_connect(LIVES_GUI_OBJECT(mainw->rewind), LIVES_WIDGET_ACTIVATE_SIGNAL,
2706 LIVES_GUI_CALLBACK(on_rewind_activate), NULL);
2707 lives_signal_connect(LIVES_GUI_OBJECT(mainw->playsel), LIVES_WIDGET_ACTIVATE_SIGNAL,
2708 LIVES_GUI_CALLBACK(on_playsel_activate), NULL);
2709 lives_signal_connect(LIVES_GUI_OBJECT(mainw->playclip), LIVES_WIDGET_ACTIVATE_SIGNAL,
2710 LIVES_GUI_CALLBACK(on_playclip_activate), NULL);
2711 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->stop), LIVES_WIDGET_ACTIVATE_SIGNAL,
2712 LIVES_GUI_CALLBACK(on_stop_activate),
2713 NULL); // connect after to stop keypress propagating to removed fs window
2714 mainw->fullscreen_cb_func = lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->full_screen), LIVES_WIDGET_ACTIVATE_SIGNAL,
2715 LIVES_GUI_CALLBACK(on_full_screen_activate), NULL);
2716 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->sw_sound), LIVES_WIDGET_ACTIVATE_SIGNAL,
2717 LIVES_GUI_CALLBACK(on_boolean_toggled),
2718 &mainw->save_with_sound); // TODO - make pref
2719 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->showsubs), LIVES_WIDGET_ACTIVATE_SIGNAL,
2720 LIVES_GUI_CALLBACK(on_showsubs_toggled), NULL);
2721 mainw->lb_func = lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->letter), LIVES_WIDGET_ACTIVATE_SIGNAL,
2722 LIVES_GUI_CALLBACK(toggle_sets_pref), PREF_LETTERBOX);
2723 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->aload_subs), LIVES_WIDGET_ACTIVATE_SIGNAL,
2724 LIVES_GUI_CALLBACK(on_boolean_toggled), &prefs->autoload_subs);
2725 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->ccpd_sound), LIVES_WIDGET_ACTIVATE_SIGNAL,
2726 LIVES_GUI_CALLBACK(on_boolean_toggled),
2727 &mainw->ccpd_with_sound); // TODO - make pref
2728 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->dsize), LIVES_WIDGET_ACTIVATE_SIGNAL,
2729 LIVES_GUI_CALLBACK(on_double_size_activate), NULL);
2730 mainw->sepwin_cb_func = lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->sepwin), LIVES_WIDGET_ACTIVATE_SIGNAL,
2731 LIVES_GUI_CALLBACK(on_sepwin_activate), NULL);
2732 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->fade), LIVES_WIDGET_ACTIVATE_SIGNAL,
2733 LIVES_GUI_CALLBACK(on_fade_activate), NULL);
2734 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->loop_video), LIVES_WIDGET_ACTIVATE_SIGNAL,
2735 LIVES_GUI_CALLBACK(on_loop_video_activate), NULL);
2736 mainw->loop_cont_func = lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->loop_continue), LIVES_WIDGET_ACTIVATE_SIGNAL,
2737 LIVES_GUI_CALLBACK(on_loop_cont_activate), NULL);
2738 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->loop_ping_pong), LIVES_WIDGET_ACTIVATE_SIGNAL,
2739 LIVES_GUI_CALLBACK(on_ping_pong_activate), NULL);
2740 mainw->mute_audio_func = lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->mute_audio), LIVES_WIDGET_ACTIVATE_SIGNAL,
2741 LIVES_GUI_CALLBACK(on_mute_activate), NULL);
2742 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->sticky), LIVES_WIDGET_ACTIVATE_SIGNAL,
2743 LIVES_GUI_CALLBACK(on_sticky_activate), NULL);
2744 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->showfct), LIVES_WIDGET_ACTIVATE_SIGNAL,
2745 LIVES_GUI_CALLBACK(on_showfct_activate), NULL);
2746 lives_signal_connect(LIVES_GUI_OBJECT(mainw->preferences), LIVES_WIDGET_ACTIVATE_SIGNAL,
2747 LIVES_GUI_CALLBACK(on_preferences_activate), NULL);
2748 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->change_speed), LIVES_WIDGET_ACTIVATE_SIGNAL,
2749 LIVES_GUI_CALLBACK(on_change_speed_activate), NULL);
2750 lives_signal_connect(LIVES_GUI_OBJECT(mainw->resample_video), LIVES_WIDGET_ACTIVATE_SIGNAL,
2751 LIVES_GUI_CALLBACK(on_resample_video_activate), NULL);
2752 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->load_subs), LIVES_WIDGET_ACTIVATE_SIGNAL,
2753 LIVES_GUI_CALLBACK(on_load_subs_activate), NULL);
2754 lives_signal_connect(LIVES_GUI_OBJECT(mainw->erase_subs), LIVES_WIDGET_ACTIVATE_SIGNAL,
2755 LIVES_GUI_CALLBACK(on_erase_subs_activate), NULL);
2756 lives_signal_connect(LIVES_GUI_OBJECT(mainw->capture), LIVES_WIDGET_ACTIVATE_SIGNAL,
2757 LIVES_GUI_CALLBACK(on_capture_activate), NULL);
2758 lives_signal_connect(LIVES_GUI_OBJECT(mainw->rev_clipboard), LIVES_WIDGET_ACTIVATE_SIGNAL,
2759 LIVES_GUI_CALLBACK(on_rev_clipboard_activate), NULL);
2760 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->export_selaudio), LIVES_WIDGET_ACTIVATE_SIGNAL,
2761 LIVES_GUI_CALLBACK(on_export_audio_activate), LIVES_INT_TO_POINTER(0));
2762 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->export_allaudio), LIVES_WIDGET_ACTIVATE_SIGNAL,
2763 LIVES_GUI_CALLBACK(on_export_audio_activate), LIVES_INT_TO_POINTER(1));
2764 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->append_audio), LIVES_WIDGET_ACTIVATE_SIGNAL,
2765 LIVES_GUI_CALLBACK(on_append_audio_activate), NULL);
2766 lives_signal_connect(LIVES_GUI_OBJECT(mainw->normalize_audio), LIVES_WIDGET_ACTIVATE_SIGNAL,
2767 LIVES_GUI_CALLBACK(on_normalise_audio_activate), NULL);
2768 lives_signal_connect(LIVES_GUI_OBJECT(mainw->trim_audio), LIVES_WIDGET_ACTIVATE_SIGNAL,
2769 LIVES_GUI_CALLBACK(on_trim_audio_activate), LIVES_INT_TO_POINTER(0));
2770 lives_signal_connect(LIVES_GUI_OBJECT(mainw->trim_to_pstart), LIVES_WIDGET_ACTIVATE_SIGNAL,
2771 LIVES_GUI_CALLBACK(on_trim_audio_activate), LIVES_INT_TO_POINTER(1));
2772 lives_signal_connect(LIVES_GUI_OBJECT(mainw->delsel_audio), LIVES_WIDGET_ACTIVATE_SIGNAL,
2773 LIVES_GUI_CALLBACK(on_del_audio_activate), LIVES_INT_TO_POINTER(0));
2774 lives_signal_connect(LIVES_GUI_OBJECT(mainw->voladj), LIVES_WIDGET_ACTIVATE_SIGNAL,
2775 LIVES_GUI_CALLBACK(on_voladj_activate), LIVES_INT_TO_POINTER(0));
2776 lives_signal_connect(LIVES_GUI_OBJECT(mainw->fade_aud_in), LIVES_WIDGET_ACTIVATE_SIGNAL,
2777 LIVES_GUI_CALLBACK(on_fade_audio_activate), LIVES_INT_TO_POINTER(0));
2778 lives_signal_connect(LIVES_GUI_OBJECT(mainw->fade_aud_out), LIVES_WIDGET_ACTIVATE_SIGNAL,
2779 LIVES_GUI_CALLBACK(on_fade_audio_activate), LIVES_INT_TO_POINTER(1));
2780 lives_signal_connect(LIVES_GUI_OBJECT(mainw->delall_audio), LIVES_WIDGET_ACTIVATE_SIGNAL,
2781 LIVES_GUI_CALLBACK(on_del_audio_activate), LIVES_INT_TO_POINTER(1));
2782 lives_signal_connect(LIVES_GUI_OBJECT(mainw->ins_silence), LIVES_WIDGET_ACTIVATE_SIGNAL,
2783 LIVES_GUI_CALLBACK(on_ins_silence_activate), NULL);
2784 lives_signal_connect(LIVES_GUI_OBJECT(mainw->recaudio_clip), LIVES_WIDGET_ACTIVATE_SIGNAL,
2785 LIVES_GUI_CALLBACK(on_recaudclip_activate), NULL);
2786 lives_signal_connect(LIVES_GUI_OBJECT(mainw->recaudio_sel), LIVES_WIDGET_ACTIVATE_SIGNAL,
2787 LIVES_GUI_CALLBACK(on_recaudsel_activate), NULL);
2788 lives_signal_connect(LIVES_GUI_OBJECT(mainw->resample_audio), LIVES_WIDGET_ACTIVATE_SIGNAL,
2789 LIVES_GUI_CALLBACK(on_resample_audio_activate), NULL);
2790 /* lives_signal_connect(LIVES_GUI_OBJECT(mainw->adj_audio_sync), LIVES_WIDGET_ACTIVATE_SIGNAL,
2791 LIVES_GUI_CALLBACK(on_adj_audio_sync_activate), NULL);*/
2792 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->load_audio), LIVES_WIDGET_ACTIVATE_SIGNAL,
2793 LIVES_GUI_CALLBACK(on_load_audio_activate), NULL);
2794 if (check_for_executable(&capable->has_cdda2wav, EXEC_CDDA2WAV)
2795 || check_for_executable(&capable->has_icedax, EXEC_ICEDAX)) {
2796 lives_signal_connect(LIVES_GUI_OBJECT(mainw->load_cdtrack), LIVES_WIDGET_ACTIVATE_SIGNAL,
2797 LIVES_GUI_CALLBACK(on_load_cdtrack_activate), NULL);
2798
2799 lives_signal_connect(LIVES_GUI_OBJECT(mainw->eject_cd), LIVES_WIDGET_ACTIVATE_SIGNAL,
2800 LIVES_GUI_CALLBACK(on_eject_cd_activate), NULL);
2801 }
2802
2803 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->show_file_info), LIVES_WIDGET_ACTIVATE_SIGNAL,
2804 LIVES_GUI_CALLBACK(on_show_file_info_activate), NULL);
2805 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->show_file_comments), LIVES_WIDGET_ACTIVATE_SIGNAL,
2806 LIVES_GUI_CALLBACK(on_show_file_comments_activate), NULL);
2807 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->show_clipboard_info), LIVES_WIDGET_ACTIVATE_SIGNAL,
2808 LIVES_GUI_CALLBACK(on_show_clipboard_info_activate), NULL);
2809 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->show_messages), LIVES_WIDGET_ACTIVATE_SIGNAL,
2810 LIVES_GUI_CALLBACK(on_show_messages_activate), NULL);
2811 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->show_layout_errors), LIVES_WIDGET_ACTIVATE_SIGNAL,
2812 LIVES_GUI_CALLBACK(popup_lmap_errors), NULL);
2813 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->show_quota), LIVES_WIDGET_ACTIVATE_SIGNAL,
2814 LIVES_GUI_CALLBACK(run_diskspace_dialog_cb), NULL);
2815 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->rename), LIVES_WIDGET_ACTIVATE_SIGNAL,
2816 LIVES_GUI_CALLBACK(on_rename_activate), NULL);
2817
2818 lives_signal_connect(LIVES_GUI_OBJECT(new_test_rfx), LIVES_WIDGET_ACTIVATE_SIGNAL,
2819 LIVES_GUI_CALLBACK(on_new_rfx_activate),
2820 LIVES_INT_TO_POINTER(RFX_STATUS_TEST));
2821 lives_signal_connect(LIVES_GUI_OBJECT(copy_rfx), LIVES_WIDGET_ACTIVATE_SIGNAL,
2822 LIVES_GUI_CALLBACK(on_copy_rfx_activate),
2823 LIVES_INT_TO_POINTER(RFX_STATUS_TEST));
2824 lives_signal_connect(LIVES_GUI_OBJECT(mainw->edit_test_rfx), LIVES_WIDGET_ACTIVATE_SIGNAL,
2825 LIVES_GUI_CALLBACK(on_edit_rfx_activate),
2826 LIVES_INT_TO_POINTER(RFX_STATUS_TEST));
2827 lives_signal_connect(LIVES_GUI_OBJECT(mainw->rename_test_rfx), LIVES_WIDGET_ACTIVATE_SIGNAL,
2828 LIVES_GUI_CALLBACK(on_rename_rfx_activate),
2829 LIVES_INT_TO_POINTER(RFX_STATUS_TEST));
2830 lives_signal_sync_connect(LIVES_GUI_OBJECT(rebuild_rfx), LIVES_WIDGET_ACTIVATE_SIGNAL,
2831 LIVES_GUI_CALLBACK(on_rebuild_rfx_activate),
2832 LIVES_INT_TO_POINTER(RFX_STATUS_TEST));
2833 lives_signal_connect(LIVES_GUI_OBJECT(mainw->delete_test_rfx), LIVES_WIDGET_ACTIVATE_SIGNAL,
2834 LIVES_GUI_CALLBACK(on_delete_rfx_activate),
2835 LIVES_INT_TO_POINTER(RFX_STATUS_TEST));
2836 lives_signal_connect(LIVES_GUI_OBJECT(mainw->delete_custom_rfx), LIVES_WIDGET_ACTIVATE_SIGNAL,
2837 LIVES_GUI_CALLBACK(on_delete_rfx_activate),
2838 LIVES_INT_TO_POINTER(RFX_STATUS_CUSTOM));
2839 lives_signal_connect(LIVES_GUI_OBJECT(import_custom_rfx), LIVES_WIDGET_ACTIVATE_SIGNAL,
2840 LIVES_GUI_CALLBACK(on_import_rfx_activate),
2841 LIVES_INT_TO_POINTER(RFX_STATUS_CUSTOM));
2842 lives_signal_connect(LIVES_GUI_OBJECT(mainw->export_custom_rfx), LIVES_WIDGET_ACTIVATE_SIGNAL,
2843 LIVES_GUI_CALLBACK(on_export_rfx_activate),
2844 LIVES_INT_TO_POINTER(RFX_STATUS_CUSTOM));
2845 lives_signal_connect(LIVES_GUI_OBJECT(mainw->promote_test_rfx), LIVES_WIDGET_ACTIVATE_SIGNAL,
2846 LIVES_GUI_CALLBACK(on_promote_rfx_activate),
2847 LIVES_INT_TO_POINTER(RFX_STATUS_TEST));
2848
2849 lives_signal_connect(LIVES_GUI_OBJECT(mainw->vj_load_set), LIVES_WIDGET_ACTIVATE_SIGNAL,
2850 LIVES_GUI_CALLBACK(on_load_set_activate), NULL);
2851 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->vj_show_keys), LIVES_WIDGET_ACTIVATE_SIGNAL,
2852 LIVES_GUI_CALLBACK(on_show_keys_activate), NULL);
2853 lives_signal_sync_connect(LIVES_GUI_OBJECT(assign_rte_keys), LIVES_WIDGET_ACTIVATE_SIGNAL,
2854 LIVES_GUI_CALLBACK(on_assign_rte_keys_activate), NULL);
2855 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->save_rte_defs), LIVES_WIDGET_ACTIVATE_SIGNAL,
2856 LIVES_GUI_CALLBACK(on_save_rte_defs_activate), NULL);
2857 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->vj_reset), LIVES_WIDGET_ACTIVATE_SIGNAL,
2858 LIVES_GUI_CALLBACK(on_vj_reset_activate), NULL);
2859 lives_signal_connect(LIVES_GUI_OBJECT(mainw->vj_realize), LIVES_WIDGET_ACTIVATE_SIGNAL,
2860 LIVES_GUI_CALLBACK(on_vj_realize_activate), NULL);
2861 #ifdef ENABLE_OSC
2862 lives_signal_connect(LIVES_GUI_OBJECT(mainw->midi_learn), LIVES_WIDGET_ACTIVATE_SIGNAL,
2863 LIVES_GUI_CALLBACK(on_midi_learn_activate), NULL);
2864 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->midi_save), LIVES_WIDGET_ACTIVATE_SIGNAL,
2865 LIVES_GUI_CALLBACK(on_devicemap_save_activate), NULL);
2866 lives_signal_sync_connect(LIVES_GUI_OBJECT(midi_load), LIVES_WIDGET_ACTIVATE_SIGNAL,
2867 LIVES_GUI_CALLBACK(on_devicemap_load_activate), NULL);
2868 #endif
2869
2870 mainw->toy_func_none = lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->toy_none), LIVES_WIDGET_ACTIVATE_SIGNAL,
2871 LIVES_GUI_CALLBACK(on_toy_activate), NULL);
2872
2873 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->autolives), LIVES_WIDGET_ACTIVATE_SIGNAL,
2874 LIVES_GUI_CALLBACK(autolives_toggle), NULL);
2875
2876 mainw->toy_func_random_frames = lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->toy_random_frames),
2877 LIVES_WIDGET_ACTIVATE_SIGNAL,
2878 LIVES_GUI_CALLBACK(on_toy_activate),
2879 LIVES_INT_TO_POINTER(LIVES_TOY_MAD_FRAMES));
2880
2881 mainw->toy_func_lives_tv = lives_signal_connect_after(LIVES_GUI_OBJECT(mainw->toy_tv), LIVES_WIDGET_ACTIVATE_SIGNAL,
2882 LIVES_GUI_CALLBACK(on_toy_activate), LIVES_INT_TO_POINTER(LIVES_TOY_TV));
2883
2884 lives_signal_sync_connect(LIVES_GUI_OBJECT(about), LIVES_WIDGET_ACTIVATE_SIGNAL,
2885 LIVES_GUI_CALLBACK(on_about_activate), NULL);
2886
2887 lives_signal_connect(LIVES_GUI_OBJECT(mainw->troubleshoot), LIVES_WIDGET_ACTIVATE_SIGNAL,
2888 LIVES_GUI_CALLBACK(on_troubleshoot_activate), NULL);
2889
2890 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->expl_missing), LIVES_WIDGET_ACTIVATE_SIGNAL,
2891 LIVES_GUI_CALLBACK(explain_missing_activate), NULL);
2892
2893 lives_signal_connect(LIVES_GUI_OBJECT(show_manual), LIVES_WIDGET_ACTIVATE_SIGNAL,
2894 LIVES_GUI_CALLBACK(show_manual_activate), NULL);
2895
2896 lives_signal_connect(LIVES_GUI_OBJECT(email_author), LIVES_WIDGET_ACTIVATE_SIGNAL,
2897 LIVES_GUI_CALLBACK(email_author_activate), NULL);
2898
2899 lives_signal_connect(LIVES_GUI_OBJECT(donate), LIVES_WIDGET_ACTIVATE_SIGNAL,
2900 LIVES_GUI_CALLBACK(donate_activate), NULL);
2901
2902 lives_signal_connect(LIVES_GUI_OBJECT(report_bug), LIVES_WIDGET_ACTIVATE_SIGNAL,
2903 LIVES_GUI_CALLBACK(report_bug_activate), NULL);
2904
2905 lives_signal_connect(LIVES_GUI_OBJECT(suggest_feature), LIVES_WIDGET_ACTIVATE_SIGNAL,
2906 LIVES_GUI_CALLBACK(suggest_feature_activate), NULL);
2907
2908 lives_signal_connect(LIVES_GUI_OBJECT(help_translate), LIVES_WIDGET_ACTIVATE_SIGNAL,
2909 LIVES_GUI_CALLBACK(help_translate_activate), NULL);
2910
2911 mainw->spin_start_func = lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->spinbutton_start),
2912 LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
2913 LIVES_GUI_CALLBACK(on_spinbutton_start_value_changed), NULL);
2914
2915 mainw->spin_end_func = lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->spinbutton_end),
2916 LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
2917 LIVES_GUI_CALLBACK(on_spinbutton_end_value_changed), NULL);
2918
2919 // these are for the menu transport buttons
2920 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->m_sepwinbutton), LIVES_WIDGET_CLICKED_SIGNAL,
2921 LIVES_GUI_CALLBACK(on_sepwin_pressed), NULL);
2922 lives_signal_connect(LIVES_GUI_OBJECT(mainw->m_playbutton), LIVES_WIDGET_CLICKED_SIGNAL,
2923 LIVES_GUI_CALLBACK(on_playall_activate), NULL);
2924 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->m_stopbutton), LIVES_WIDGET_CLICKED_SIGNAL,
2925 LIVES_GUI_CALLBACK(on_stop_activate), NULL);
2926 lives_signal_connect(LIVES_GUI_OBJECT(mainw->m_playselbutton), LIVES_WIDGET_CLICKED_SIGNAL,
2927 LIVES_GUI_CALLBACK(on_playsel_activate), NULL);
2928 lives_signal_connect(LIVES_GUI_OBJECT(mainw->m_rewindbutton), LIVES_WIDGET_CLICKED_SIGNAL,
2929 LIVES_GUI_CALLBACK(on_rewind_activate), NULL);
2930 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->m_mutebutton), LIVES_WIDGET_CLICKED_SIGNAL,
2931 LIVES_GUI_CALLBACK(on_mute_button_activate), NULL);
2932 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->m_loopbutton), LIVES_WIDGET_CLICKED_SIGNAL,
2933 LIVES_GUI_CALLBACK(on_loop_button_activate), NULL);
2934
2935 // these are 'invisible' buttons for the key accelerators
2936 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->t_stopbutton), LIVES_WIDGET_CLICKED_SIGNAL,
2937 LIVES_GUI_CALLBACK(on_stop_activate), NULL);
2938 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->t_sepwin), LIVES_WIDGET_CLICKED_SIGNAL,
2939 LIVES_GUI_CALLBACK(on_sepwin_pressed), NULL);
2940 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->t_fullscreen), LIVES_WIDGET_CLICKED_SIGNAL,
2941 LIVES_GUI_CALLBACK(on_full_screen_pressed), NULL);
2942 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->t_infobutton), LIVES_WIDGET_CLICKED_SIGNAL,
2943 LIVES_GUI_CALLBACK(on_show_file_info_activate), NULL);
2944 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->t_hide), LIVES_WIDGET_CLICKED_SIGNAL,
2945 LIVES_GUI_CALLBACK(on_toolbar_hide), NULL);
2946 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->t_slower), LIVES_WIDGET_CLICKED_SIGNAL,
2947 LIVES_GUI_CALLBACK(on_slower_pressed),
2948 LIVES_INT_TO_POINTER(SCREEN_AREA_FOREGROUND));
2949 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->t_faster), LIVES_WIDGET_CLICKED_SIGNAL,
2950 LIVES_GUI_CALLBACK(on_faster_pressed),
2951 LIVES_INT_TO_POINTER(SCREEN_AREA_FOREGROUND));
2952 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->t_back), LIVES_WIDGET_CLICKED_SIGNAL,
2953 LIVES_GUI_CALLBACK(on_back_pressed), NULL);
2954 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->t_forward), LIVES_WIDGET_CLICKED_SIGNAL,
2955 LIVES_GUI_CALLBACK(on_forward_pressed), NULL);
2956
2957 mainw->mouse_fn1 = lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->eventbox2), LIVES_WIDGET_MOTION_NOTIFY_EVENT,
2958 LIVES_GUI_CALLBACK(on_mouse_sel_update), NULL);
2959 lives_signal_handler_block(mainw->eventbox2, mainw->mouse_fn1);
2960 mainw->mouse_blocked = TRUE;
2961
2962 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->eventbox2), LIVES_WIDGET_BUTTON_RELEASE_EVENT,
2963 LIVES_GUI_CALLBACK(on_mouse_sel_reset), NULL);
2964
2965 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->eventbox2), LIVES_WIDGET_BUTTON_PRESS_EVENT,
2966 LIVES_GUI_CALLBACK(on_mouse_sel_start), NULL);
2967
2968 #ifdef ENABLE_GIW_3
2969 adj = giw_timeline_get_adjustment(GIW_TIMELINE(mainw->hruler));
2970 lives_signal_sync_connect_swapped(LIVES_GUI_OBJECT(adj), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
2971 LIVES_GUI_CALLBACK(on_hrule_value_changed), mainw->hruler);
2972 #else
2973 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->eventbox5), LIVES_WIDGET_MOTION_NOTIFY_EVENT,
2974 LIVES_GUI_CALLBACK(on_hrule_update), NULL);
2975 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->eventbox5), LIVES_WIDGET_BUTTON_RELEASE_EVENT,
2976 LIVES_GUI_CALLBACK(on_hrule_reset), NULL);
2977 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->eventbox5), LIVES_WIDGET_BUTTON_PRESS_EVENT,
2978 LIVES_GUI_CALLBACK(on_hrule_set), NULL);
2979 #endif
2980
2981 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->sa_button), LIVES_WIDGET_CLICKED_SIGNAL,
2982 LIVES_GUI_CALLBACK(on_select_all_activate), NULL);
2983 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->eventbox3), LIVES_WIDGET_BUTTON_PRESS_EVENT,
2984 LIVES_GUI_CALLBACK(frame_context), LIVES_INT_TO_POINTER(1));
2985 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->eventbox4), LIVES_WIDGET_BUTTON_PRESS_EVENT,
2986 LIVES_GUI_CALLBACK(frame_context), LIVES_INT_TO_POINTER(2));
2987
2988 lives_window_add_accel_group(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET), mainw->accel_group);
2989 mainw->plug = NULL;
2990
2991 if (prefs->show_msg_area) {
2992 lives_widget_set_can_focus(mainw->message_box, TRUE);
2993 if (new_lives) lives_widget_grab_focus(mainw->message_box); // TODO !prefs->show_msg_area
2994 }
2995
2996 if (RFX_LOADED) {
2997 if (mainw->ldg_menuitem) {
2998 lives_widget_destroy(mainw->ldg_menuitem);
2999 mainw->ldg_menuitem = NULL;
3000 }
3001 add_rfx_effects2(RFX_STATUS_ANY);
3002 }
3003 }
3004
3005
show_lives(void)3006 void show_lives(void) {
3007 lives_widget_show_all(mainw->top_vbox);
3008 gtk_window_set_position(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET), GTK_WIN_POS_CENTER_ALWAYS);
3009
3010 if (!prefs->show_gui && prefs->startup_interface == STARTUP_CE) {
3011 lives_widget_show_now(LIVES_MAIN_WINDOW_WIDGET); //this calls the config_event()
3012 } else {
3013 lives_widget_show_all(LIVES_MAIN_WINDOW_WIDGET);
3014 }
3015
3016 if (prefs->show_gui) {
3017 if (palette->style & STYLE_1) {
3018 set_colours(&palette->normal_fore, &palette->normal_back, &palette->menu_and_bars_fore, &palette->menu_and_bars, \
3019 &palette->info_text, &palette->info_base);
3020 } else {
3021 set_colours(&palette->normal_fore, &palette->normal_back, &palette->normal_fore, &palette->normal_back, \
3022 &palette->normal_fore, &palette->normal_back);
3023 }
3024 }
3025 lives_widget_hide(mainw->redo);
3026 #ifdef LIVES_TV_CHANNEL1
3027 lives_widget_show(mainw->toy_tv);
3028 #else
3029 lives_widget_hide(mainw->toy_tv);
3030 # endif
3031 lives_widget_hide(mainw->tb_hbox);
3032
3033 if (prefs->hide_framebar || prefs->hfbwnp) {
3034 lives_widget_hide(mainw->framebar);
3035 }
3036
3037 lives_widget_set_opacity(mainw->playframe, 0.);
3038
3039 if (prefs->show_recent) {
3040 lives_widget_show(mainw->recent_menu);
3041 } else {
3042 lives_widget_hide(mainw->recent_menu);
3043 }
3044
3045 for (int i = 0; i < N_RECENT_FILES; i++) {
3046 const char *mtext = lives_menu_item_get_text(mainw->recent[i]);
3047 if (*mtext) lives_widget_show(mainw->recent[i]);
3048 }
3049
3050 if (!capable->has_composite || !capable->has_convert) {
3051 lives_widget_hide(mainw->merge);
3052 }
3053
3054 if (!LIVES_IS_RANGE(mainw->hruler)) lives_widget_set_sensitive(mainw->hruler, FALSE);
3055
3056 if (palette->style & STYLE_1 && mainw->current_file == -1) {
3057 show_playbar_labels(-1);
3058 }
3059
3060 if (!((prefs->audio_player == AUD_PLAYER_JACK && capable->has_jackd) ||
3061 (prefs->audio_player == AUD_PLAYER_PULSE && capable->has_pulse_audio)))
3062 lives_widget_hide(mainw->vol_toolitem);
3063
3064 if (mainw->go_away)
3065 update_rfx_menus();
3066
3067 if (prefs->present && prefs->show_gui)
3068 lives_window_present(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET));
3069 }
3070
3071
set_interactive(boolean interactive)3072 void set_interactive(boolean interactive) {
3073 LiVESList *list;
3074 LiVESWidget *parent;
3075
3076 if (!interactive) {
3077 mainw->sense_state &= ~LIVES_SENSE_STATE_INTERACTIVE;
3078 if (!mainw->multitrack) {
3079 parent = lives_widget_get_parent(mainw->menubar);
3080 if (parent && LIVES_IS_CONTAINER(parent)) {
3081 lives_widget_object_ref(mainw->menubar);
3082 lives_widget_unparent(mainw->menubar);
3083 }
3084 lives_widget_hide(mainw->btoolbar);
3085 lives_widget_set_sensitive(mainw->menubar, FALSE);
3086 lives_widget_set_sensitive(mainw->btoolbar, FALSE);
3087 lives_set_cursor_style(LIVES_CURSOR_NORMAL, mainw->hruler);
3088 } else {
3089 parent = lives_widget_get_parent(mainw->multitrack->menubar);
3090 if (parent && LIVES_IS_CONTAINER(parent)) {
3091 lives_widget_object_ref(mainw->multitrack->menubar);
3092 lives_widget_unparent(mainw->multitrack->menubar);
3093 }
3094 lives_set_cursor_style(LIVES_CURSOR_NORMAL, mainw->multitrack->timeline);
3095 lives_widget_set_sensitive(mainw->multitrack->menubar, FALSE);
3096 lives_widget_set_sensitive(mainw->multitrack->spinbutton_start, FALSE);
3097 lives_widget_set_sensitive(mainw->multitrack->spinbutton_end, FALSE);
3098 lives_widget_set_sensitive(mainw->m_playbutton, FALSE);
3099 lives_widget_set_sensitive(mainw->m_stopbutton, FALSE);
3100 lives_widget_set_sensitive(mainw->m_loopbutton, FALSE);
3101 lives_widget_set_sensitive(mainw->m_rewindbutton, FALSE);
3102 lives_widget_set_sensitive(mainw->m_sepwinbutton, FALSE);
3103 lives_widget_set_sensitive(mainw->multitrack->btoolbar2, FALSE);
3104 lives_widget_set_sensitive(mainw->multitrack->btoolbar3, FALSE);
3105 lives_widget_set_sensitive(mainw->multitrack->snapo_checkbutton, FALSE);
3106 list = mainw->multitrack->cb_list;
3107 while (list) {
3108 lives_widget_set_sensitive((LiVESWidget *)list->data, FALSE);
3109 list = list->next;
3110 }
3111 }
3112 lives_widget_set_sensitive(mainw->int_audio_checkbutton, FALSE);
3113 lives_widget_set_sensitive(mainw->ext_audio_checkbutton, FALSE);
3114 lives_widget_set_sensitive(mainw->spinbutton_start, FALSE);
3115 lives_widget_set_sensitive(mainw->spinbutton_end, FALSE);
3116 lives_widget_set_sensitive(mainw->sa_button, FALSE);
3117
3118 if (CURRENT_CLIP_IS_VALID && mainw->proc_ptr) {
3119 lives_widget_set_sensitive(mainw->proc_ptr->cancel_button, FALSE);
3120 if (mainw->proc_ptr->stop_button)
3121 lives_widget_set_sensitive(mainw->proc_ptr->stop_button, FALSE);
3122 lives_widget_set_sensitive(mainw->proc_ptr->pause_button, FALSE);
3123 lives_widget_set_sensitive(mainw->proc_ptr->preview_button, FALSE);
3124 }
3125 } else {
3126 mainw->sense_state |= LIVES_SENSE_STATE_INTERACTIVE;
3127 lives_widget_show(mainw->btoolbar);
3128 lives_widget_set_sensitive(mainw->menubar, TRUE);
3129 lives_widget_set_sensitive(mainw->btoolbar, TRUE);
3130
3131 lives_set_cursor_style(LIVES_CURSOR_CENTER_PTR, mainw->hruler);
3132
3133 if (mainw->multitrack) {
3134 lives_set_cursor_style(LIVES_CURSOR_CENTER_PTR, mainw->multitrack->timeline);
3135 if (!lives_widget_get_parent(mainw->multitrack->menubar)) {
3136 lives_box_pack_start(LIVES_BOX(mainw->multitrack->menu_hbox), mainw->multitrack->menubar, FALSE, FALSE, 0);
3137 lives_widget_object_unref(mainw->multitrack->menubar);
3138 }
3139 lives_widget_show_all(mainw->multitrack->menubar);
3140
3141 if (!prefs->show_recent) {
3142 lives_widget_hide(mainw->multitrack->recent_menu);
3143 }
3144 if (!mainw->has_custom_gens) {
3145 if (mainw->custom_gens_menu) lives_widget_hide(mainw->custom_gens_menu);
3146 if (mainw->custom_gens_submenu) lives_widget_hide(mainw->custom_gens_submenu);
3147 }
3148
3149 lives_widget_hide(mainw->multitrack->aparam_separator); // no longer used
3150
3151 if (CURRENT_CLIP_HAS_AUDIO) add_aparam_menuitems(mainw->multitrack);
3152 else {
3153 lives_widget_hide(mainw->multitrack->render_sep);
3154 lives_widget_hide(mainw->multitrack->render_vid);
3155 lives_widget_hide(mainw->multitrack->render_aud);
3156 lives_widget_hide(mainw->multitrack->normalise_aud);
3157 lives_widget_hide(mainw->multitrack->view_audio);
3158 lives_widget_hide(mainw->multitrack->aparam_menuitem);
3159 lives_widget_hide(mainw->multitrack->aparam_separator);
3160 }
3161
3162 if (mainw->multitrack->opts.back_audio_tracks == 0) lives_widget_hide(mainw->multitrack->view_audio);
3163
3164 lives_widget_set_sensitive(mainw->multitrack->menubar, TRUE);
3165
3166 lives_widget_set_sensitive(mainw->multitrack->spinbutton_start, TRUE);
3167 lives_widget_set_sensitive(mainw->multitrack->spinbutton_end, TRUE);
3168
3169 lives_widget_set_sensitive(mainw->m_rewindbutton, mainw->multitrack->ptr_time > 0.);
3170 lives_widget_set_sensitive(mainw->m_stopbutton, mainw->multitrack->is_paused);
3171
3172 lives_widget_set_sensitive(mainw->m_playbutton, TRUE);
3173 lives_widget_set_sensitive(mainw->m_loopbutton, TRUE);
3174 lives_widget_set_sensitive(mainw->m_sepwinbutton, TRUE);
3175 lives_widget_set_sensitive(mainw->multitrack->btoolbar2, TRUE);
3176 lives_widget_set_sensitive(mainw->multitrack->btoolbar3, TRUE);
3177 lives_widget_set_sensitive(mainw->multitrack->insa_checkbutton, TRUE);
3178 lives_widget_set_sensitive(mainw->multitrack->snapo_checkbutton, TRUE);
3179 list = mainw->multitrack->cb_list;
3180 while (list) {
3181 lives_widget_set_sensitive((LiVESWidget *)list->data, TRUE);
3182 list = list->next;
3183 }
3184 }
3185
3186 if (is_realtime_aplayer(prefs->audio_player) && prefs->audio_player != AUD_PLAYER_NONE) {
3187 lives_widget_set_sensitive(mainw->int_audio_checkbutton, TRUE);
3188 lives_widget_set_sensitive(mainw->ext_audio_checkbutton, TRUE);
3189 }
3190 lives_widget_set_sensitive(mainw->spinbutton_start, TRUE);
3191 lives_widget_set_sensitive(mainw->spinbutton_end, TRUE);
3192 lives_widget_set_sensitive(mainw->sa_button, CURRENT_CLIP_HAS_VIDEO && (cfile->start > 1 || cfile->end < cfile->frames));
3193
3194 if (CURRENT_CLIP_IS_VALID && mainw->proc_ptr) {
3195 lives_widget_set_sensitive(mainw->proc_ptr->cancel_button, TRUE);
3196 if (mainw->proc_ptr->stop_button)
3197 lives_widget_set_sensitive(mainw->proc_ptr->stop_button, TRUE);
3198 lives_widget_set_sensitive(mainw->proc_ptr->pause_button, TRUE);
3199 lives_widget_set_sensitive(mainw->proc_ptr->preview_button, TRUE);
3200 }
3201 }
3202
3203 if (mainw->ce_thumbs) ce_thumbs_set_interactive(interactive);
3204 if (rte_window) rte_window_set_interactive(interactive);
3205
3206 if (mainw->sense_state & LIVES_SENSE_STATE_INSENSITIZED) {
3207 if (!mainw->multitrack) desensitize();
3208 else mt_desensitise(mainw->multitrack);
3209 }
3210 if (mainw->sense_state & LIVES_SENSE_STATE_PROC_INSENSITIZED) {
3211 procw_desensitize();
3212 }
3213 }
3214
3215
fade_background(void)3216 void fade_background(void) {
3217 if (palette->style == STYLE_PLAIN) {
3218 lives_label_set_text(LIVES_LABEL(mainw->banner), " = < L i V E S > = ");
3219 }
3220 lives_frame_set_label(LIVES_FRAME(mainw->playframe), NULL);
3221 if (mainw->foreign) {
3222 lives_label_set_text(LIVES_LABEL(mainw->banner), _(" Press 'q' to stop recording. DO NOT COVER THE PLAY WINDOW ! "));
3223 lives_widget_set_fg_color(mainw->banner, LIVES_WIDGET_STATE_NORMAL, &palette->banner_fade_text);
3224 lives_label_set_text(LIVES_LABEL(mainw->vps_label), (" "));
3225 } else {
3226 if (mainw->sep_win) {
3227 lives_widget_set_opacity(mainw->playframe, 0.);
3228 }
3229 }
3230
3231 set_colours(&palette->normal_fore, &palette->fade_colour, &palette->menu_and_bars_fore, &palette->menu_and_bars,
3232 &palette->info_base, &palette->info_text);
3233
3234 clear_widget_bg(mainw->play_image, mainw->play_surface);
3235
3236 lives_frame_set_label(LIVES_FRAME(mainw->frame1), NULL);
3237 lives_frame_set_label(LIVES_FRAME(mainw->frame2), NULL);
3238
3239 if (mainw->toy_type != LIVES_TOY_MAD_FRAMES || mainw->foreign) {
3240 lives_widget_hide(mainw->frame1);
3241 lives_widget_hide(mainw->frame2);
3242 }
3243 if (!mainw->foreign && prefs->show_tool) {
3244 lives_widget_set_no_show_all(mainw->tb_hbox, FALSE);
3245 lives_widget_show_all(mainw->tb_hbox);
3246 lives_widget_set_no_show_all(mainw->tb_hbox, TRUE);
3247 }
3248
3249 lives_widget_hide(mainw->menu_hbox);
3250 lives_widget_hide(mainw->btoolbar);
3251 lives_widget_hide(mainw->framebar);
3252 lives_widget_hide(mainw->hbox3);
3253 lives_widget_hide(mainw->hruler);
3254 lives_widget_hide(mainw->hseparator);
3255 lives_widget_hide(mainw->sep_image);
3256 lives_widget_hide(mainw->eventbox2);
3257 if (prefs->show_msg_area) lives_widget_hide(mainw->message_box);
3258
3259 if (!mainw->foreign) {
3260 lives_widget_show(mainw->t_forward);
3261 lives_widget_show(mainw->t_back);
3262 lives_widget_show(mainw->t_slower);
3263 lives_widget_show(mainw->t_faster);
3264 lives_widget_show(mainw->t_fullscreen);
3265 lives_widget_show(mainw->t_sepwin);
3266 }
3267
3268 // since the hidden menu buttons are not activatable on some window managers
3269 // we need to remove the accelerators and add accelerator keys instead
3270
3271 if (!stop_closure) {
3272 lives_widget_remove_accelerator(mainw->stop, mainw->accel_group, LIVES_KEY_q, (LiVESXModifierType)0);
3273 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_q, (LiVESXModifierType)0, (LiVESAccelFlags)0,
3274 (stop_closure = lives_cclosure_new(LIVES_GUI_CALLBACK(stop_callback), NULL, NULL)));
3275
3276 if (!mainw->foreign) {
3277 // TODO - do these checks in the end functions
3278 lives_widget_remove_accelerator(mainw->record_perf, mainw->accel_group, LIVES_KEY_r, (LiVESXModifierType)0);
3279 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_r, (LiVESXModifierType)0, (LiVESAccelFlags)0,
3280 (rec_closure = lives_cclosure_new(LIVES_GUI_CALLBACK(rec_callback), NULL, NULL)));
3281
3282 lives_widget_remove_accelerator(mainw->full_screen, mainw->accel_group, LIVES_KEY_f, (LiVESXModifierType)0);
3283 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_f, (LiVESXModifierType)0, (LiVESAccelFlags)0,
3284 (fullscreen_closure = lives_cclosure_new(LIVES_GUI_CALLBACK(fullscreen_callback), NULL, NULL)));
3285
3286 lives_widget_remove_accelerator(mainw->showfct, mainw->accel_group, LIVES_KEY_h, (LiVESXModifierType)0);
3287 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_h, (LiVESXModifierType)0, (LiVESAccelFlags)0,
3288 (showfct_closure = lives_cclosure_new(LIVES_GUI_CALLBACK(showfct_callback), NULL, NULL)));
3289
3290 lives_widget_remove_accelerator(mainw->sepwin, mainw->accel_group, LIVES_KEY_s, (LiVESXModifierType)0);
3291 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_s, (LiVESXModifierType)0, (LiVESAccelFlags)0,
3292 (sepwin_closure = lives_cclosure_new(LIVES_GUI_CALLBACK(sepwin_callback), NULL, NULL)));
3293
3294 if (!CURRENT_CLIP_HAS_AUDIO || mainw->mute || mainw->loop_cont || is_realtime_aplayer(prefs->audio_player)) {
3295 lives_widget_remove_accelerator(mainw->loop_video, mainw->accel_group, LIVES_KEY_l, (LiVESXModifierType)0);
3296 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_l, (LiVESXModifierType)0, (LiVESAccelFlags)0,
3297 (loop_closure = lives_cclosure_new(LIVES_GUI_CALLBACK(loop_callback), NULL, NULL)));
3298
3299 lives_widget_remove_accelerator(mainw->loop_continue, mainw->accel_group, LIVES_KEY_o, (LiVESXModifierType)0);
3300 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_o, (LiVESXModifierType)0, (LiVESAccelFlags)0,
3301 (loop_cont_closure = lives_cclosure_new(LIVES_GUI_CALLBACK(loop_cont_callback), NULL, NULL)));
3302
3303 }
3304 lives_widget_remove_accelerator(mainw->loop_ping_pong, mainw->accel_group, LIVES_KEY_g, (LiVESXModifierType)0);
3305 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_g, (LiVESXModifierType)0, (LiVESAccelFlags)0,
3306 (ping_pong_closure = lives_cclosure_new(LIVES_GUI_CALLBACK(ping_pong_callback), NULL, NULL)));
3307 lives_widget_remove_accelerator(mainw->mute_audio, mainw->accel_group, LIVES_KEY_z, (LiVESXModifierType)0);
3308 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_z, (LiVESXModifierType)0, (LiVESAccelFlags)0,
3309 (mute_audio_closure = lives_cclosure_new(LIVES_GUI_CALLBACK(mute_audio_callback), NULL, NULL)));
3310 lives_widget_remove_accelerator(mainw->dsize, mainw->accel_group, LIVES_KEY_d, (LiVESXModifierType)0);
3311 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_d, (LiVESXModifierType)0, (LiVESAccelFlags)0,
3312 (dblsize_closure = lives_cclosure_new(LIVES_GUI_CALLBACK(dblsize_callback), NULL, NULL)));
3313 lives_widget_remove_accelerator(mainw->fade, mainw->accel_group, LIVES_KEY_b, (LiVESXModifierType)0);
3314 lives_accel_group_connect(LIVES_ACCEL_GROUP(mainw->accel_group), LIVES_KEY_b, (LiVESXModifierType)0, (LiVESAccelFlags)0,
3315 (fade_closure = lives_cclosure_new(LIVES_GUI_CALLBACK(fade_callback), NULL, NULL)));
3316 }
3317 }
3318
3319 lives_widget_queue_draw(mainw->top_vbox);
3320 lives_widget_process_updates(LIVES_MAIN_WINDOW_WIDGET);
3321 }
3322
3323
unfade_background(void)3324 void unfade_background(void) {
3325 if (mainw->multitrack) return;
3326
3327 if (palette->style == STYLE_PLAIN) {
3328 lives_label_set_text(LIVES_LABEL(mainw->banner), " = < L i V E S > = ");
3329 } else {
3330 lives_label_set_text(LIVES_LABEL(mainw->banner), " ");
3331 }
3332
3333 lives_frame_set_label(LIVES_FRAME(mainw->frame1), _("First Frame"));
3334 if (!mainw->preview) {
3335 lives_frame_set_label(LIVES_FRAME(mainw->playframe), _("Play"));
3336 } else {
3337 lives_frame_set_label(LIVES_FRAME(mainw->playframe), _("Preview"));
3338 }
3339
3340 lives_frame_set_label(LIVES_FRAME(mainw->frame2), _("Last Frame"));
3341
3342 if (!prefs->hide_framebar && !(!LIVES_IS_PLAYING && prefs->hfbwnp)) {
3343 lives_widget_show(mainw->framebar);
3344 }
3345
3346 lives_widget_show_all(mainw->menu_hbox);
3347 lives_widget_show_all(mainw->hbox3);
3348 lives_widget_show(mainw->btoolbar);
3349
3350 lives_widget_hide(mainw->tb_hbox);
3351 if (!mainw->double_size) {
3352 if (palette->style & STYLE_1) {
3353 lives_widget_show_all(mainw->sep_image);
3354 }
3355 lives_widget_show_all(mainw->hseparator);
3356 if (prefs->show_msg_area) lives_widget_show_all(mainw->message_box);
3357 }
3358
3359 lives_widget_show_all(mainw->eventbox2);
3360 lives_widget_show_all(mainw->eventbox3);
3361 lives_widget_show_all(mainw->eventbox4);
3362
3363 if (!CURRENT_CLIP_IS_VALID || !cfile->opening) {
3364 lives_widget_show(mainw->hruler);
3365 }
3366
3367 if (CURRENT_CLIP_HAS_VIDEO && !mainw->sep_win) {
3368 lives_widget_show_all(mainw->playframe);
3369 lives_widget_set_opacity(mainw->playframe, 1.);
3370 }
3371
3372 if (stop_closure && prefs->show_gui) {
3373 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), stop_closure);
3374 lives_widget_add_accelerator(mainw->stop, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3375 LIVES_KEY_q, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3376
3377 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), rec_closure);
3378 lives_widget_add_accelerator(mainw->record_perf, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3379 LIVES_KEY_r, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3380
3381 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), fullscreen_closure);
3382 lives_widget_add_accelerator(mainw->full_screen, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3383 LIVES_KEY_f, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3384
3385 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), sepwin_closure);
3386 lives_widget_add_accelerator(mainw->sepwin, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3387 LIVES_KEY_s, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3388
3389 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), mute_audio_closure);
3390 lives_widget_add_accelerator(mainw->mute_audio, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3391 LIVES_KEY_z, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3392
3393 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), ping_pong_closure);
3394 lives_widget_add_accelerator(mainw->loop_ping_pong, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3395 LIVES_KEY_g, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3396
3397 if (!CURRENT_CLIP_HAS_AUDIO || mainw->mute || mainw->loop_cont || is_realtime_aplayer(prefs->audio_player)) {
3398 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), loop_closure);
3399 lives_widget_add_accelerator(mainw->loop_video, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3400 LIVES_KEY_l, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3401
3402 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), loop_cont_closure);
3403 lives_widget_add_accelerator(mainw->loop_continue, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3404 LIVES_KEY_o, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3405 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), showfct_closure);
3406 }
3407 lives_widget_add_accelerator(mainw->showfct, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3408 LIVES_KEY_h, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3409
3410 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), showsubs_closure);
3411 lives_widget_add_accelerator(mainw->showsubs, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3412 LIVES_KEY_v, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3413
3414 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), sepwin_closure);
3415 lives_widget_add_accelerator(mainw->sepwin, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3416 LIVES_KEY_s, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3417
3418 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), dblsize_closure);
3419 lives_widget_add_accelerator(mainw->dsize, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3420 LIVES_KEY_d, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3421
3422 lives_accel_group_disconnect(LIVES_ACCEL_GROUP(mainw->accel_group), fade_closure);
3423 lives_widget_add_accelerator(mainw->fade, LIVES_WIDGET_ACTIVATE_SIGNAL, mainw->accel_group,
3424 LIVES_KEY_b, (LiVESXModifierType)0, LIVES_ACCEL_VISIBLE);
3425 stop_closure = NULL;
3426 }
3427
3428 if (mainw->double_size && !mainw->play_window) {
3429 resize(2.);
3430 } else {
3431 resize(1.);
3432 }
3433
3434 set_colours(&palette->normal_fore, &palette->normal_back, &palette->menu_and_bars_fore, &palette->menu_and_bars,
3435 &palette->info_base, &palette->info_text);
3436 lives_widget_process_updates(LIVES_MAIN_WINDOW_WIDGET);
3437 }
3438
3439
fullscreen_internal(void)3440 void fullscreen_internal(void) {
3441 // resize for full screen, internal player, no separate window
3442 int width, height;
3443
3444 if (!mainw->multitrack) {
3445 lives_widget_hide(mainw->framebar);
3446
3447 // hide all except tb_hbox and pf_grid
3448 if (!mainw->faded) fade_background();
3449
3450 // hide start and end frames in pf_grid
3451 lives_table_set_column_homogeneous(LIVES_TABLE(mainw->pf_grid), FALSE);
3452
3453 lives_widget_hide(mainw->eventbox3);
3454 lives_widget_hide(mainw->eventbox4);
3455
3456 lives_frame_set_label(LIVES_FRAME(mainw->playframe), NULL);
3457
3458 if (prefs->show_msg_area) lives_widget_hide(mainw->message_box);
3459
3460 //lives_widget_context_update();
3461
3462 if (prefs->open_maximised) {
3463 lives_window_maximize(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET));
3464 lives_widget_queue_resize(LIVES_MAIN_WINDOW_WIDGET);
3465 lives_widget_process_updates(LIVES_MAIN_WINDOW_WIDGET);
3466 }
3467
3468 // try to get exact inner size of the main window
3469 lives_window_get_inner_size(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET), &width, &height);
3470
3471 height -= SCRN_BRDR; // necessary, or screen expands too much (!?)
3472
3473 // expand the inner box to fit this
3474 lives_widget_set_size_request(mainw->top_vbox, width, height);
3475 lives_widget_queue_resize(mainw->top_vbox);
3476 lives_widget_process_updates(LIVES_MAIN_WINDOW_WIDGET);
3477
3478 // this and pf_grid should be the only other widgets still visible
3479 if (prefs->show_tool) height -= lives_widget_get_allocation_height(mainw->tb_hbox);
3480
3481 // image loading size in some cases
3482 mainw->ce_frame_width = width;
3483 mainw->ce_frame_height = height;
3484
3485 if (!LIVES_IS_PLAYING) {
3486 set_drawing_area_from_pixbuf(mainw->play_image, NULL, mainw->play_surface);
3487 }
3488
3489 // visible contents of pf_grid
3490 lives_widget_set_size_request(mainw->pl_eventbox, width, height);
3491 lives_widget_set_size_request(mainw->playframe, width, height);
3492 lives_widget_set_size_request(mainw->playarea, width, height);
3493 lives_widget_set_size_request(mainw->play_image, width, height);
3494 lives_widget_set_margin_left(mainw->playframe, 0);
3495 lives_widget_set_margin_right(mainw->playframe, 0);
3496
3497 lives_widget_queue_resize(mainw->pf_grid);
3498 lives_widget_process_updates(LIVES_MAIN_WINDOW_WIDGET);
3499 } else {
3500 make_play_window();
3501 }
3502 }
3503
3504
set_preview_box_colours(void)3505 void set_preview_box_colours(void) {
3506 lives_widget_set_bg_color(mainw->preview_image, LIVES_WIDGET_STATE_NORMAL, &palette->normal_back);
3507 lives_widget_set_bg_color(mainw->preview_box, LIVES_WIDGET_STATE_NORMAL, &palette->normal_back);
3508 lives_widget_set_fg_color(mainw->preview_box, LIVES_WIDGET_STATE_NORMAL, &palette->normal_fore);
3509 lives_widget_set_bg_color(mainw->preview_hbox, LIVES_WIDGET_STATE_NORMAL, &palette->normal_back);
3510 lives_widget_set_fg_color(mainw->preview_hbox, LIVES_WIDGET_STATE_NORMAL, &palette->normal_fore);
3511 set_child_colour(mainw->preview_box, TRUE);
3512 }
3513
3514
make_preview_box(void)3515 void make_preview_box(void) {
3516 // create a box to show frames in, this will go in the sepwin when we are not playing
3517 LiVESWidget *eventbox;
3518 LiVESWidget *hbox_buttons;
3519 LiVESWidget *radiobutton_free;
3520 LiVESWidget *radiobutton_start;
3521 LiVESWidget *radiobutton_end;
3522 LiVESWidget *radiobutton_ptr;
3523 LiVESWidget *rewind_img;
3524 LiVESWidget *playsel_img;
3525 LiVESWidget *play_img;
3526 LiVESWidget *loop_img;
3527
3528 LiVESSList *radiobutton_group = NULL;
3529
3530 char *tmp, *tmp2;
3531
3532 mainw->preview_box = lives_vbox_new(FALSE, 0);
3533
3534 eventbox = lives_event_box_new();
3535 lives_widget_set_events(eventbox, LIVES_SCROLL_MASK | LIVES_SMOOTH_SCROLL_MASK);
3536
3537 lives_signal_sync_connect(LIVES_GUI_OBJECT(eventbox), LIVES_WIDGET_SCROLL_EVENT,
3538 LIVES_GUI_CALLBACK(on_mouse_scroll), NULL);
3539
3540 lives_box_pack_start(LIVES_BOX(mainw->preview_box), eventbox, TRUE, TRUE, 0);
3541
3542 lives_signal_sync_connect(LIVES_GUI_OBJECT(eventbox), LIVES_WIDGET_BUTTON_PRESS_EVENT,
3543 LIVES_GUI_CALLBACK(frame_context), LIVES_INT_TO_POINTER(3));
3544
3545 mainw->preview_image = lives_standard_drawing_area_new(LIVES_GUI_CALLBACK(expose_pim), &mainw->pi_surface);
3546
3547 lives_container_add(LIVES_CONTAINER(eventbox), mainw->preview_image);
3548 lives_widget_set_app_paintable(mainw->preview_image, TRUE);
3549
3550 if (mainw->play_window) {
3551 if (!CURRENT_CLIP_HAS_VIDEO) {
3552 if (mainw->imframe) {
3553 lives_widget_set_size_request(mainw->preview_image, lives_pixbuf_get_width(mainw->imframe),
3554 lives_pixbuf_get_height(mainw->imframe));
3555 }
3556 } else
3557 lives_widget_set_size_request(mainw->preview_image, MAX(mainw->pwidth, mainw->sepwin_minwidth), mainw->pheight);
3558 }
3559
3560 lives_widget_set_hexpand(mainw->preview_box, TRUE);
3561 lives_widget_set_vexpand(mainw->preview_box, TRUE);
3562
3563 mainw->preview_controls = lives_vbox_new(FALSE, 0);
3564 add_hsep_to_box(LIVES_BOX(mainw->preview_controls));
3565
3566 lives_box_pack_start(LIVES_BOX(mainw->preview_box), mainw->preview_controls, FALSE, FALSE, 0);
3567 lives_widget_set_vexpand(mainw->preview_controls, FALSE);
3568
3569 mainw->preview_hbox = lives_hbox_new(FALSE, 0);
3570 lives_widget_set_vexpand(mainw->preview_hbox, FALSE);
3571 lives_container_set_border_width(LIVES_CONTAINER(mainw->preview_hbox), 0);
3572
3573 lives_widget_set_bg_color(mainw->preview_hbox, LIVES_WIDGET_STATE_NORMAL, &palette->normal_back);
3574
3575 mainw->preview_spinbutton = lives_standard_spin_button_new(NULL, (CURRENT_CLIP_HAS_VIDEO) ? 1. : 0.,
3576 (CURRENT_CLIP_HAS_VIDEO) ? 1. : 0.,
3577 (CURRENT_CLIP_HAS_VIDEO) ? cfile->frames : 0., 1., 1., 0,
3578 LIVES_BOX(mainw->preview_hbox), _("Frame number to preview"));
3579
3580 mainw->preview_scale = lives_standard_hscale_new(lives_spin_button_get_adjustment(LIVES_SPIN_BUTTON(
3581 mainw->preview_spinbutton)));
3582
3583 lives_box_pack_start(LIVES_BOX(mainw->preview_controls), mainw->preview_scale, FALSE, FALSE, 0);
3584 lives_box_pack_start(LIVES_BOX(mainw->preview_controls), mainw->preview_hbox, FALSE, FALSE, 0);
3585
3586 lives_entry_set_width_chars(LIVES_ENTRY(mainw->preview_spinbutton), PREVSBWIDTHCHARS);
3587
3588 radiobutton_free = lives_standard_radio_button_new((tmp = (_("_Free"))), &radiobutton_group,
3589 LIVES_BOX(mainw->preview_hbox), (tmp2 = (_("Free choice of frame number"))));
3590 lives_free(tmp); lives_free(tmp2);
3591
3592 radiobutton_start = lives_standard_radio_button_new((tmp = (_("_Start"))), &radiobutton_group,
3593 LIVES_BOX(mainw->preview_hbox),
3594 (tmp2 = (_("Frame number is linked to start frame"))));
3595 lives_free(tmp); lives_free(tmp2);
3596
3597 lives_toggle_button_set_active(LIVES_TOGGLE_BUTTON(radiobutton_start), mainw->prv_link == PRV_START);
3598
3599 radiobutton_end = lives_standard_radio_button_new((tmp = (_("_End"))), &radiobutton_group,
3600 LIVES_BOX(mainw->preview_hbox),
3601 (tmp2 = (_("Frame number is linked to end frame"))));
3602 lives_free(tmp); lives_free(tmp2);
3603
3604 lives_toggle_button_set_active(LIVES_TOGGLE_BUTTON(radiobutton_end), mainw->prv_link == PRV_END);
3605
3606 radiobutton_ptr = lives_standard_radio_button_new((tmp = (_("_Pointer"))), &radiobutton_group,
3607 LIVES_BOX(mainw->preview_hbox),
3608 (tmp2 = (_("Frame number is linked to playback pointer"))));
3609 lives_free(tmp); lives_free(tmp2);
3610
3611 lives_toggle_button_set_active(LIVES_TOGGLE_BUTTON(radiobutton_ptr), mainw->prv_link == PRV_DEFAULT);
3612
3613 add_hsep_to_box(LIVES_BOX(mainw->preview_controls));
3614
3615 // buttons
3616 hbox_buttons = lives_hbox_new(FALSE, 0);
3617 lives_box_pack_start(LIVES_BOX(mainw->preview_controls), hbox_buttons, TRUE, TRUE, 0);
3618
3619 rewind_img = lives_image_new_from_stock(LIVES_STOCK_MEDIA_REWIND, LIVES_ICON_SIZE_LARGE_TOOLBAR);
3620 mainw->p_rewindbutton = lives_standard_button_new(DEF_BUTTON_WIDTH / 2, DEF_BUTTON_HEIGHT);
3621 lives_standard_button_set_image(LIVES_BUTTON(mainw->p_rewindbutton), rewind_img);
3622 lives_box_pack_start(LIVES_BOX(hbox_buttons), mainw->p_rewindbutton, TRUE, TRUE, 0);
3623 lives_widget_set_tooltip_text(mainw->p_rewindbutton, _("Rewind"));
3624 lives_widget_set_sensitive(mainw->p_rewindbutton, CURRENT_CLIP_IS_VALID && cfile->pointer_time > 0.);
3625 lives_widget_set_focus_on_click(mainw->p_rewindbutton, FALSE);
3626
3627 play_img = lives_image_new_from_stock(LIVES_STOCK_MEDIA_PLAY, LIVES_ICON_SIZE_LARGE_TOOLBAR);
3628 mainw->p_playbutton = lives_standard_button_new(DEF_BUTTON_WIDTH / 2, DEF_BUTTON_HEIGHT);
3629 lives_standard_button_set_image(LIVES_BUTTON(mainw->p_playbutton), play_img);
3630 lives_box_pack_start(LIVES_BOX(hbox_buttons), mainw->p_playbutton, TRUE, TRUE, 0);
3631 lives_widget_set_tooltip_text(mainw->p_playbutton, _("Play all"));
3632 lives_widget_set_focus_on_click(mainw->p_playbutton, FALSE);
3633
3634 playsel_img = lives_image_new_from_stock(LIVES_LIVES_STOCK_PLAY_SEL, LIVES_ICON_SIZE_LARGE_TOOLBAR);
3635 mainw->p_playselbutton = lives_standard_button_new(DEF_BUTTON_WIDTH / 2, DEF_BUTTON_HEIGHT);
3636 lives_standard_button_set_image(LIVES_BUTTON(mainw->p_playselbutton), playsel_img);
3637 lives_box_pack_start(LIVES_BOX(hbox_buttons), mainw->p_playselbutton, TRUE, TRUE, 0);
3638 lives_widget_set_tooltip_text(mainw->p_playselbutton, _("Play Selection"));
3639 lives_widget_set_sensitive(mainw->p_playselbutton, CURRENT_CLIP_IS_VALID && cfile->frames > 0);
3640 lives_widget_set_focus_on_click(mainw->p_playselbutton, FALSE);
3641
3642 loop_img = lives_image_new_from_stock(LIVES_STOCK_LOOP, LIVES_ICON_SIZE_LARGE_TOOLBAR);
3643 if (!loop_img) loop_img = lives_image_new_from_stock(LIVES_LIVES_STOCK_LOOP,
3644 LIVES_ICON_SIZE_LARGE_TOOLBAR);
3645 mainw->p_loopbutton = lives_standard_button_new(DEF_BUTTON_WIDTH / 2, DEF_BUTTON_HEIGHT);
3646 lives_box_pack_start(LIVES_BOX(hbox_buttons), mainw->p_loopbutton, TRUE, TRUE, 0);
3647 lives_widget_set_tooltip_text(mainw->p_loopbutton, _("Loop On/Off"));
3648 lives_widget_set_sensitive(mainw->p_loopbutton, TRUE);
3649 lives_widget_set_focus_on_click(mainw->p_loopbutton, FALSE);
3650 lives_widget_set_opacity(mainw->p_loopbutton, .75);
3651
3652 lives_standard_button_set_image(LIVES_BUTTON(mainw->p_loopbutton), loop_img);
3653
3654 mainw->p_mute_img = lives_image_new_from_stock(LIVES_LIVES_STOCK_VOLUME_MUTE,
3655 LIVES_ICON_SIZE_LARGE_TOOLBAR);
3656
3657 mainw->p_mutebutton = lives_standard_button_new(DEF_BUTTON_WIDTH / 2, DEF_BUTTON_HEIGHT);
3658 lives_standard_button_set_image(LIVES_BUTTON(mainw->p_mutebutton), mainw->p_mute_img);
3659 lives_box_pack_start(LIVES_BOX(hbox_buttons), mainw->p_mutebutton, TRUE, TRUE, 0);
3660 lives_widget_set_focus_on_click(mainw->p_mutebutton, FALSE);
3661
3662 if (!mainw->mute) {
3663 lives_widget_set_tooltip_text(mainw->p_mutebutton, _("Mute the audio (z)"));
3664 lives_widget_set_opacity(mainw->p_mutebutton, .75);
3665 } else {
3666 lives_widget_set_tooltip_text(mainw->p_mutebutton, _("Unmute the audio (z)"));
3667 lives_widget_set_opacity(mainw->p_mutebutton, 1.);
3668 }
3669
3670 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton_free), LIVES_WIDGET_TOGGLED_SIGNAL,
3671 LIVES_GUI_CALLBACK(on_prv_link_toggled),
3672 LIVES_INT_TO_POINTER(PRV_FREE));
3673 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton_start), LIVES_WIDGET_TOGGLED_SIGNAL,
3674 LIVES_GUI_CALLBACK(on_prv_link_toggled),
3675 LIVES_INT_TO_POINTER(PRV_START));
3676 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton_end), LIVES_WIDGET_TOGGLED_SIGNAL,
3677 LIVES_GUI_CALLBACK(on_prv_link_toggled),
3678 LIVES_INT_TO_POINTER(PRV_END));
3679 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton_ptr), LIVES_WIDGET_TOGGLED_SIGNAL,
3680 LIVES_GUI_CALLBACK(on_prv_link_toggled),
3681 LIVES_INT_TO_POINTER(PRV_PTR));
3682
3683 lives_signal_connect(LIVES_GUI_OBJECT(mainw->p_playbutton), LIVES_WIDGET_CLICKED_SIGNAL,
3684 LIVES_GUI_CALLBACK(on_playall_activate), NULL);
3685 lives_signal_connect(LIVES_GUI_OBJECT(mainw->p_playselbutton), LIVES_WIDGET_CLICKED_SIGNAL,
3686 LIVES_GUI_CALLBACK(on_playsel_activate), NULL);
3687 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->p_rewindbutton), LIVES_WIDGET_CLICKED_SIGNAL,
3688 LIVES_GUI_CALLBACK(on_rewind_activate), NULL);
3689 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->p_mutebutton), LIVES_WIDGET_CLICKED_SIGNAL,
3690 LIVES_GUI_CALLBACK(on_mute_button_activate), NULL);
3691 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->p_loopbutton), LIVES_WIDGET_CLICKED_SIGNAL,
3692 LIVES_GUI_CALLBACK(on_loop_button_activate), NULL);
3693
3694 mainw->preview_spin_func = lives_signal_sync_connect_after(LIVES_GUI_OBJECT(mainw->preview_spinbutton),
3695 LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
3696 LIVES_GUI_CALLBACK(on_preview_spinbutton_changed), NULL);
3697
3698 if (palette->style & STYLE_1) set_preview_box_colours();
3699
3700 lives_widget_show_all(mainw->preview_box);
3701 lives_widget_hide(mainw->preview_controls);
3702 lives_widget_set_no_show_all(mainw->preview_controls, TRUE);
3703 }
3704
3705
enable_record(void)3706 void enable_record(void) {
3707 lives_menu_item_set_text(mainw->record_perf, _("Start _recording"), TRUE);
3708 lives_widget_set_sensitive(mainw->record_perf, TRUE);
3709 }
3710
3711
toggle_record(void)3712 void toggle_record(void) {
3713 lives_menu_item_set_text(mainw->record_perf, _("Stop _recording"), TRUE);
3714 }
3715
3716
disable_record(void)3717 void disable_record(void) {
3718 lives_menu_item_set_text(mainw->record_perf, _("_Record Performance"), TRUE);
3719 }
3720
3721
play_window_set_title(void)3722 void play_window_set_title(void) {
3723 char *xtrabit;
3724 char *title = NULL;
3725 double sepwin_scale = sqrt(mainw->pwidth * mainw->pwidth + mainw->pheight * mainw->pheight) /
3726 sqrt(cfile->hsize * cfile->hsize + cfile->vsize * cfile->vsize);
3727 if (mainw->multitrack) return;
3728 if (!mainw->play_window) return;
3729
3730 if (!LIVES_IS_PLAYING)
3731 xtrabit = lives_strdup_printf(_(" (%.0f %% scale)"), sepwin_scale * 100.);
3732 else
3733 xtrabit = lives_strdup("");
3734
3735 if (LIVES_IS_PLAYING) {
3736 if (mainw->vpp && !(mainw->vpp->capabilities & VPP_LOCAL_DISPLAY) && mainw->fs)
3737 lives_window_set_title(LIVES_WINDOW(mainw->play_window), _("Streaming"));
3738 else {
3739 title = lives_strdup_printf(_("Play Window%s"), xtrabit);
3740 lives_window_set_title(LIVES_WINDOW(mainw->play_window), title);
3741 }
3742 } else {
3743 title = lives_strdup_printf(_("Preview Window%s"), xtrabit);
3744 lives_window_set_title(LIVES_WINDOW(mainw->play_window), title);
3745 }
3746
3747 if (title) lives_free(title);
3748 lives_free(xtrabit);
3749 }
3750
3751
resize_widgets_for_monitor(boolean do_get_play_times)3752 void resize_widgets_for_monitor(boolean do_get_play_times) {
3753 // resize widgets if we are aware that monitor resolution has changed
3754 // (or at least try our best...)
3755 LiVESList *list;
3756 int i, current_file = mainw->current_file;
3757 boolean need_mt = FALSE, fake_evlist;
3758
3759 mainw->reconfig = TRUE;
3760 mainw->suppress_dprint = TRUE;
3761 mainw->idlemax = 0;
3762 lives_widget_context_update();
3763
3764 get_monitors(TRUE);
3765
3766 if (mainw->multitrack) {
3767 if (!mainw->multitrack->event_list) {
3768 /// create a fake event list with no events
3769 /// this prevents problems like the multitrack window trying to auto reload from disk
3770 weed_plant_t *event_list = weed_plant_new(WEED_PLANT_EVENT_LIST);
3771 weed_set_int_value(event_list, WEED_LEAF_WEED_EVENT_API_VERSION, WEED_EVENT_API_VERSION);
3772 weed_set_voidptr_value(event_list, WEED_LEAF_FIRST, NULL);
3773 weed_set_voidptr_value(event_list, WEED_LEAF_LAST, NULL);
3774 mainw->multitrack->event_list = event_list;
3775 fake_evlist = TRUE;
3776 }
3777 multitrack_delete(mainw->multitrack, FALSE);
3778 need_mt = TRUE;
3779 }
3780
3781 if (LIVES_IS_WIDGET(mainw->top_vbox)) {
3782 lives_widget_destroy(mainw->top_vbox);
3783 lives_widget_context_update();
3784 }
3785
3786 create_LiVES();
3787
3788 for (i = 0; i < MAX_FX_CANDIDATE_TYPES; i++) {
3789 if (i == FX_CANDIDATE_AUDIO_VOL) continue;
3790 mainw->fx_candidates[i].delegate = -1;
3791 mainw->fx_candidates[i].list = NULL;
3792 mainw->fx_candidates[i].func = 0l;
3793 mainw->fx_candidates[i].rfx = NULL;
3794 }
3795
3796 mainw->resize_menuitem = NULL;
3797 replace_with_delegates();
3798
3799 show_lives();
3800
3801 list = mainw->cliplist;
3802 mainw->cliplist = NULL;
3803 while (list) {
3804 mainw->current_file = LIVES_POINTER_TO_INT(list->data);
3805 add_to_clipmenu();
3806 list = list->next;
3807 }
3808
3809 set_interactive(prefs->interactive);
3810
3811 mainw->is_ready = TRUE;
3812 mainw->go_away = FALSE;
3813
3814 if (!need_mt) {
3815 lives_widget_context_update();
3816 if (current_file != -1) switch_clip(1, current_file, TRUE);
3817 else {
3818 resize(1);
3819 }
3820 if (mainw->play_window) {
3821 resize_play_window();
3822 }
3823 } else {
3824 on_multitrack_activate(NULL, NULL);
3825 if (fake_evlist) {
3826 wipe_layout(mainw->multitrack);
3827 }
3828 }
3829
3830 lives_widget_context_update();
3831
3832 mainw->suppress_dprint = FALSE;
3833 d_print(_("GUI size changed to %d X %d\n"), GUI_SCREEN_WIDTH, GUI_SCREEN_HEIGHT);
3834
3835 if (prefs->open_maximised) {
3836 lives_window_maximize(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET));
3837 } else {
3838 lives_window_center(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET));
3839 }
3840 lives_widget_queue_resize(LIVES_MAIN_WINDOW_WIDGET);
3841 mainw->reconfig = FALSE;
3842
3843 if (LIVES_IS_PLAYING) mainw->cancelled = CANCEL_ERROR;
3844 }
3845
3846
_make_play_window(void)3847 static void _make_play_window(void) {
3848 // separate window
3849 pb_added = FALSE;
3850
3851 if (LIVES_IS_PLAYING) {
3852 unhide_cursor(lives_widget_get_xwindow(mainw->playarea));
3853 }
3854
3855 if (mainw->play_window) {
3856 // this shouldn't ever happen
3857 kill_play_window();
3858 }
3859
3860 mainw->play_window = lives_window_new(LIVES_WINDOW_TOPLEVEL);
3861 if (mainw->multitrack) lives_window_set_decorated(LIVES_WINDOW(mainw->play_window), FALSE);
3862 gtk_window_set_skip_taskbar_hint(LIVES_WINDOW(mainw->play_window), TRUE);
3863 gtk_window_set_skip_pager_hint(LIVES_WINDOW(mainw->play_window), TRUE);
3864
3865 if (prefs->show_gui) {
3866 lives_window_set_transient_for(LIVES_WINDOW(mainw->play_window), get_transient_full());
3867 }
3868 lives_widget_set_events(mainw->play_window, LIVES_SCROLL_MASK | LIVES_SMOOTH_SCROLL_MASK |
3869 LIVES_KEY_PRESS_MASK | LIVES_KEY_RELEASE_MASK);
3870
3871 // cannot do this or it forces showing on the GUI monitor
3872 //gtk_window_set_position(LIVES_WINDOW(mainw->play_window),GTK_WIN_POS_CENTER_ALWAYS);
3873
3874 if (!mainw->multitrack) lives_window_add_accel_group(LIVES_WINDOW(mainw->play_window), mainw->accel_group);
3875 else lives_window_add_accel_group(LIVES_WINDOW(mainw->play_window), mainw->multitrack->accel_group);
3876
3877 if (palette->style & STYLE_1) {
3878 lives_widget_set_bg_color(mainw->play_window, LIVES_WIDGET_STATE_NORMAL, &palette->normal_back);
3879 }
3880
3881 if ((!LIVES_IS_PLAYING && prefs->show_gui) || (LIVES_IS_PLAYING && prefs->show_playwin)) {
3882 // show the window (so we can hide its cursor !), and get its xwin
3883 if (!(mainw->fs && LIVES_IS_PLAYING && mainw->vpp)) {
3884 lives_widget_show_all(mainw->play_window);
3885 }
3886 _resize_play_window();
3887 }
3888
3889 if (!mainw->play_window) return;
3890
3891 if (!mainw->preview_box) {
3892 // create the preview box that shows frames
3893 make_preview_box();
3894 }
3895
3896 //lives_widget_show_all(mainw->play_window);
3897 lives_container_add(LIVES_CONTAINER(mainw->play_window), mainw->preview_box);
3898 lives_widget_object_ref(mainw->preview_box);
3899 pb_added = TRUE;
3900
3901 if (mainw->is_processing && (CURRENT_CLIP_IS_VALID && !cfile->nopreview))
3902 lives_widget_set_tooltip_text(mainw->p_playbutton, _("Preview"));
3903
3904 if (LIVES_IS_PLAYING) {
3905 lives_widget_hide(mainw->preview_controls);
3906 } else {
3907 if (mainw->is_processing && (mainw->prv_link == PRV_START || mainw->prv_link == PRV_END)) {
3908 // block spinbutton in play window
3909 lives_widget_set_sensitive(mainw->preview_spinbutton, FALSE);
3910 }
3911 if (CURRENT_CLIP_IS_VALID && cfile->is_loaded && prefs->show_gui) {
3912 lives_widget_set_no_show_all(mainw->preview_controls, FALSE);
3913 lives_widget_show_all(mainw->preview_box);
3914 lives_widget_show_now(mainw->preview_box);
3915 lives_widget_set_no_show_all(mainw->preview_controls, TRUE);
3916 }
3917 load_preview_image(FALSE);
3918 }
3919
3920 lives_widget_set_tooltip_text(mainw->m_sepwinbutton, _("Hide Play Window"));
3921
3922 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->play_window), LIVES_WIDGET_DELETE_EVENT,
3923 LIVES_GUI_CALLBACK(on_stop_activate_by_del), NULL);
3924 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->play_window), LIVES_WIDGET_KEY_PRESS_EVENT,
3925 LIVES_GUI_CALLBACK(key_press_or_release), NULL);
3926 lives_signal_sync_connect(LIVES_GUI_OBJECT(mainw->play_window), LIVES_WIDGET_KEY_RELEASE_EVENT,
3927 LIVES_GUI_CALLBACK(key_press_or_release), NULL);
3928
3929 lives_widget_set_sensitive(mainw->play_window, TRUE);
3930 }
3931
make_play_window(void)3932 void make_play_window(void) {
3933 main_thread_execute((lives_funcptr_t)_make_play_window, 0, NULL, "");
3934 }
3935
3936
get_play_screen_size(int * opwidth,int * opheight)3937 LIVES_GLOBAL_INLINE boolean get_play_screen_size(int *opwidth, int *opheight) {
3938 // get the size of the screen / player in fullscreen / sepwin mode
3939 // returns TRUE if we span multiple monitors, FALSE for single monitor mode
3940
3941 if (prefs->play_monitor == 0) {
3942 if (capable->nmonitors > 1) {
3943 // spread over all monitors
3944 #if !GTK_CHECK_VERSION(3, 22, 0)
3945 *opwidth = lives_screen_get_width(mainw->mgeom[0].screen);
3946 *opheight = lives_screen_get_height(mainw->mgeom[0].screen);
3947 #else
3948 /// TODO: no doubt this is wrong and should be done taking into account vertical monitor layouts as well
3949 *opheight = mainw->mgeom[0].height;
3950 *opwidth = 0;
3951 for (register int i = 0; i < capable->nmonitors; i++) {
3952 *opwidth += mainw->mgeom[i].width;
3953 }
3954 #endif
3955 return TRUE;
3956 } else {
3957 // but we only have one...
3958 *opwidth = mainw->mgeom[0].phys_width;
3959 *opheight = mainw->mgeom[0].phys_height;
3960 }
3961 } else {
3962 // single monitor
3963 *opwidth = mainw->mgeom[prefs->play_monitor - 1].phys_width;
3964 *opheight = mainw->mgeom[prefs->play_monitor - 1].phys_height;
3965 }
3966 return FALSE;
3967 }
3968
3969 #define TEST_CE_THUMBS 0
3970
_resize_play_window(void)3971 static void _resize_play_window(void) {
3972 int opwx, opwy, pmonitor = prefs->play_monitor;
3973
3974 boolean fullscreen = TRUE;
3975 boolean ext_audio = FALSE;
3976
3977 int width = -1, height = -1, nwidth, nheight = 0;
3978 int scr_width = GUI_SCREEN_WIDTH;
3979 int scr_height = GUI_SCREEN_HEIGHT;
3980 int scr_width_safety = SCR_WIDTH_SAFETY;
3981 int scr_height_safety = SCR_HEIGHT_SAFETY;
3982 int bx, by;
3983
3984 uint64_t xwinid = 0;
3985
3986 if (TEST_CE_THUMBS) {
3987 lives_widget_hide(mainw->play_window);
3988 start_ce_thumb_mode();
3989 return;
3990 }
3991
3992 #ifdef DEBUG_HANGS
3993 fullscreen = FALSE;
3994 #endif
3995
3996 if (!mainw->play_window) return;
3997
3998 get_border_size(LIVES_MAIN_WINDOW_WIDGET, &bx, &by);
3999
4000 scr_width_safety += 2 * bx;
4001 scr_height_safety += 2 * by;
4002
4003 if (!LIVES_IS_PLAYING && !mainw->multitrack)
4004 lives_window_set_decorated(LIVES_WINDOW(mainw->play_window), TRUE);
4005
4006 if (lives_widget_is_visible(mainw->play_window)) {
4007 width = lives_widget_get_allocation_width(mainw->play_window);
4008 height = lives_widget_get_allocation_height(mainw->play_window);
4009 }
4010
4011 if ((!CURRENT_CLIP_IS_VALID || (cfile->frames == 0 && !mainw->multitrack) ||
4012 (!cfile->is_loaded && !mainw->preview && cfile->clip_type != CLIP_TYPE_GENERATOR)) ||
4013 (mainw->multitrack && mainw->playing_file < 1 && !mainw->preview)) {
4014 if (mainw->imframe) {
4015 mainw->pwidth = lives_pixbuf_get_width(mainw->imframe);
4016 mainw->pheight = lives_pixbuf_get_height(mainw->imframe);
4017 } else {
4018 if (!mainw->multitrack) {
4019 mainw->pwidth = DEF_FRAME_HSIZE;
4020 mainw->pheight = DEF_FRAME_VSIZE;
4021 }
4022 }
4023 } else {
4024 if (!mainw->multitrack) {
4025 mainw->pwidth = cfile->hsize;
4026 mainw->pheight = cfile->vsize;
4027 } else {
4028 mainw->pwidth = mainw->files[mainw->multitrack->render_file]->hsize;
4029 mainw->pheight = mainw->files[mainw->multitrack->render_file]->vsize;
4030 }
4031 }
4032
4033 if ((mainw->double_size || mainw->multitrack) && (!mainw->fs || !LIVES_IS_PLAYING)) {
4034 // double size: maxspect to the screen size
4035 mainw->pwidth = cfile->hsize;
4036 mainw->pheight = cfile->vsize;
4037 if (LIVES_IS_PLAYING) {
4038 scr_width_safety >>= 1;
4039 scr_height_safety >>= 1;
4040 }
4041 }
4042
4043 if (!mainw->fs || !LIVES_IS_PLAYING) {
4044 if (pmonitor == 0) {
4045 if ((((mainw->double_size || mainw->multitrack) && (!mainw->fs || !LIVES_IS_PLAYING))) ||
4046 (mainw->pwidth > scr_width - scr_width_safety ||
4047 mainw->pheight > scr_height - scr_height_safety)) {
4048 calc_maxspect(scr_width - scr_width_safety, scr_height - scr_height_safety, &mainw->pwidth, &mainw->pheight);
4049 }
4050 } else {
4051 if ((((mainw->double_size || mainw->multitrack) && (!mainw->fs || !LIVES_IS_PLAYING))) ||
4052 (mainw->pwidth > mainw->mgeom[pmonitor - 1].width - scr_width_safety ||
4053 mainw->pheight > mainw->mgeom[pmonitor - 1].height - scr_height_safety)) {
4054 calc_maxspect(mainw->mgeom[pmonitor - 1].width - scr_width_safety,
4055 mainw->mgeom[pmonitor - 1].height - scr_height_safety,
4056 &mainw->pwidth, &mainw->pheight);
4057 }
4058 }
4059 }
4060
4061 if (LIVES_IS_PLAYING) {
4062 // fullscreen
4063 if (mainw->fs) {
4064 if (!lives_widget_is_visible(mainw->play_window)) {
4065 if (prefs->show_playwin) {
4066 lives_widget_show(mainw->play_window);
4067 }
4068 lives_widget_process_updates(LIVES_MAIN_WINDOW_WIDGET);
4069 mainw->opwx = mainw->opwy = -1;
4070 } else {
4071 if (pmonitor == 0) {
4072 mainw->opwx = (scr_width - mainw->pwidth) / 2;
4073 mainw->opwy = (scr_height - mainw->pheight) / 2;
4074 } else {
4075 mainw->opwx = mainw->mgeom[pmonitor - 1].x + (mainw->mgeom[pmonitor - 1].width - mainw->pwidth) / 2;
4076 mainw->opwy = mainw->mgeom[pmonitor - 1].y + (mainw->mgeom[pmonitor - 1].height - mainw->pheight) / 2;
4077 }
4078 }
4079
4080 get_play_screen_size(&mainw->pwidth, &mainw->pheight);
4081
4082 if (lives_widget_is_visible(mainw->play_window)) {
4083 // store old postion of window
4084 lives_window_get_position(LIVES_WINDOW(mainw->play_window), &opwx, &opwy);
4085 if (opwx * opwy > 0) {
4086 mainw->opwx = opwx;
4087 mainw->opwy = opwy;
4088 }
4089 }
4090
4091 if (pmonitor == 0) {
4092 if (mainw->vpp && mainw->vpp->fwidth > 0) {
4093 lives_window_move(LIVES_WINDOW(mainw->play_window), (scr_width - mainw->vpp->fwidth) / 2,
4094 (scr_height - mainw->vpp->fheight) / 2);
4095 } else lives_window_move(LIVES_WINDOW(mainw->play_window), 0, 0);
4096 } else {
4097 lives_window_set_monitor(LIVES_WINDOW(mainw->play_window), pmonitor - 1);
4098 if (mainw->vpp && mainw->vpp->fwidth > 0) {
4099 lives_window_move(LIVES_WINDOW(mainw->play_window), mainw->mgeom[pmonitor - 1].x +
4100 (mainw->mgeom[pmonitor - 1].width - mainw->vpp->fwidth) / 2,
4101 mainw->mgeom[pmonitor - 1].y + (mainw->mgeom[pmonitor - 1].height - mainw->vpp->fheight) / 2);
4102 } else lives_window_move(LIVES_WINDOW(mainw->play_window), mainw->mgeom[pmonitor - 1].x,
4103 mainw->mgeom[pmonitor - 1].y);
4104 }
4105 sched_yield();
4106 // leave this alone * !
4107 if (!(mainw->vpp && !(mainw->vpp->capabilities & VPP_LOCAL_DISPLAY))) {
4108 mainw->ignore_screen_size = TRUE;
4109 if (prefs->show_desktop_panel && (capable->wm_caps.pan_annoy & ANNOY_DISPLAY)
4110 && (capable->wm_caps.pan_annoy & ANNOY_FS) && (capable->wm_caps.pan_res & RES_HIDE) &&
4111 capable->wm_caps.pan_res & RESTYPE_ACTION) {
4112 hide_desktop_panel();
4113 }
4114 #if GTK_CHECK_VERSION(3, 20, 0)
4115 LiVESXWindow *xwin = lives_widget_get_xwindow(mainw->play_window);
4116 if (pmonitor == 0)
4117 gdk_window_set_fullscreen_mode(xwin, GDK_FULLSCREEN_ON_ALL_MONITORS);
4118 else
4119 gdk_window_set_fullscreen_mode(xwin, GDK_FULLSCREEN_ON_CURRENT_MONITOR);
4120
4121 gtk_window_fullscreen_on_monitor(LIVES_WINDOW(mainw->play_window),
4122 mainw->mgeom[pmonitor - 1].screen, pmonitor - 1);
4123 #else
4124 lives_widget_set_bg_color(mainw->play_window, LIVES_WIDGET_STATE_NORMAL, &palette->black);
4125 lives_window_fullscreen(LIVES_WINDOW(mainw->play_window));
4126 #endif
4127 lives_window_set_decorated(LIVES_WINDOW(mainw->play_window), FALSE);
4128 lives_window_center(LIVES_WINDOW(mainw->play_window));
4129 lives_window_resize(LIVES_WINDOW(mainw->play_window), mainw->pwidth, mainw->pheight);
4130 lives_window_set_position(LIVES_WINDOW(mainw->play_window), LIVES_WIN_POS_NONE);
4131 lives_window_move(LIVES_WINDOW(mainw->play_window), 0, 0);
4132 lives_widget_queue_resize(mainw->play_window);
4133 }
4134 sched_yield();
4135
4136 // init the playback plugin, unless the player cannot resize and there is a possibility of
4137 // wrongly sized frames (i.e. during a preview), or we are previewing and it's a remote display
4138 if (mainw->vpp && (!mainw->preview || ((mainw->vpp->capabilities & VPP_LOCAL_DISPLAY) &&
4139 (mainw->multitrack || (mainw->vpp->capabilities & VPP_CAN_RESIZE))))) {
4140 mainw->ptr_x = mainw->ptr_y = -1;
4141 if (pmonitor == 0) {
4142 // fullscreen playback on all screens (of first display)
4143 // get mouse position to warp it back after playback ends
4144 // in future we will handle multiple displays, so we will get the mouse device for the first screen of that display
4145 LiVESXDevice *device = mainw->mgeom[0].mouse_device;
4146 #if GTK_CHECK_VERSION(3, 0, 0)
4147 if (device) {
4148 #endif
4149 LiVESXScreen *screen;
4150 LiVESXDisplay *display = mainw->mgeom[0].disp;
4151 lives_display_get_pointer(device, display, &screen, &mainw->ptr_x, &mainw->ptr_y, NULL);
4152 #if GTK_CHECK_VERSION(3, 0, 0)
4153 }
4154 #endif
4155 }
4156 if (mainw->vpp->fheight > -1 && mainw->vpp->fwidth > -1) {
4157 // fixed o/p size for stream
4158 if (mainw->vpp->fwidth * mainw->vpp->fheight == 0) {
4159 mainw->vpp->fwidth = cfile->hsize;//DEF_VPP_HSIZE;
4160 mainw->vpp->fheight = cfile->vsize;//DEF_VPP_VSIZE;
4161 }
4162 if (!(mainw->vpp->capabilities & VPP_CAN_RESIZE)) {
4163 mainw->pwidth = mainw->vpp->fwidth;
4164 mainw->pheight = mainw->vpp->fheight;
4165
4166 // * leave this alone !
4167 lives_window_unfullscreen(LIVES_WINDOW(mainw->play_window));
4168 lives_window_resize(LIVES_WINDOW(mainw->play_window), mainw->pwidth, mainw->pheight);
4169 lives_widget_queue_resize(mainw->play_window);
4170 }
4171 }
4172
4173 if (pmonitor != 0) {
4174 fullscreen = FALSE;
4175 if (mainw->play_window) {
4176 if (prefs->show_playwin) {
4177 xwinid = lives_widget_get_xwinid(mainw->play_window, "Unsupported display type for playback plugin");
4178 if (xwinid == -1) return;
4179 } else xwinid = -1;
4180 }
4181 }
4182 if (mainw->ext_playback) {
4183 lives_grab_remove(LIVES_MAIN_WINDOW_WIDGET);
4184 #ifdef RT_AUDIO
4185 stop_audio_stream();
4186 #endif
4187 pthread_mutex_lock(&mainw->vpp_stream_mutex);
4188 mainw->ext_audio = FALSE;
4189 pthread_mutex_unlock(&mainw->vpp_stream_mutex);
4190
4191 if (mainw->vpp->exit_screen) {
4192 (*mainw->vpp->exit_screen)(mainw->ptr_x, mainw->ptr_y);
4193 }
4194 if (mainw->vpp->capabilities & VPP_LOCAL_DISPLAY && pmonitor == 0)
4195 lives_window_set_keep_below(LIVES_WINDOW(mainw->play_window), FALSE);
4196 }
4197
4198 #ifdef RT_AUDIO
4199 if (mainw->vpp->audio_codec != AUDIO_CODEC_NONE && prefs->stream_audio_out) {
4200 start_audio_stream();
4201 } else {
4202 //clear_audio_stream();
4203 }
4204 #endif
4205
4206 if (mainw->vpp->capabilities & VPP_LOCAL_DISPLAY && pmonitor == 0)
4207 lives_window_set_keep_below(LIVES_WINDOW(mainw->play_window), TRUE);
4208
4209 if (mainw->vpp->init_audio && prefs->stream_audio_out) {
4210 #ifdef HAVE_PULSE_AUDIO
4211 if (prefs->audio_player == AUD_PLAYER_PULSE && mainw->pulsed) {
4212 if ((*mainw->vpp->init_audio)(mainw->pulsed->out_arate, mainw->pulsed->out_achans, mainw->vpp->extra_argc,
4213 mainw->vpp->extra_argv))
4214 ext_audio = TRUE;
4215 }
4216 #endif
4217 #ifdef ENABLE_JACK
4218 if (prefs->audio_player == AUD_PLAYER_JACK && mainw->jackd) {
4219 if ((*mainw->vpp->init_audio)(mainw->jackd->sample_out_rate,
4220 mainw->jackd->num_output_channels, mainw->vpp->extra_argc,
4221 mainw->vpp->extra_argv))
4222 ext_audio = TRUE;
4223 }
4224 #endif
4225 }
4226
4227 if (!mainw->vpp->init_screen || ((*mainw->vpp->init_screen)
4228 (mainw->vpp->fwidth > 0 ? mainw->vpp->fwidth : mainw->pwidth,
4229 mainw->vpp->fheight > 0 ? mainw->vpp->fheight : mainw->pheight,
4230 fullscreen, xwinid, mainw->vpp->extra_argc, mainw->vpp->extra_argv))) {
4231 mainw->force_show = TRUE;
4232 mainw->ext_playback = TRUE;
4233 // the play window is still visible (in case it was 'always on top')
4234 // start key polling from ext plugin
4235
4236 mainw->ext_audio = ext_audio; // cannot set this until after init_screen()
4237
4238 if (mainw->vpp->capabilities & VPP_LOCAL_DISPLAY && (pmonitor == 0 || capable->nmonitors == 1)) {
4239 lives_grab_add(LIVES_MAIN_WINDOW_WIDGET);
4240 }
4241 } else if (mainw->vpp->init_screen) {
4242 LIVES_ERROR("Failed to start playback plugin");
4243 }
4244 }
4245
4246 if (TEST_CE_THUMBS || (prefs->show_gui && prefs->ce_thumb_mode && prefs->play_monitor != widget_opts.monitor &&
4247 prefs->play_monitor != 0 &&
4248 capable->nmonitors > 1 && !mainw->multitrack)) {
4249 start_ce_thumb_mode();
4250 }
4251 } else {
4252 // NON fullscreen
4253 if (mainw->ce_thumbs) {
4254 end_ce_thumb_mode();
4255 }
4256 if (pmonitor > 0 && pmonitor != widget_opts.monitor + 1)
4257 lives_window_set_monitor(LIVES_WINDOW(mainw->play_window), pmonitor - 1);
4258 lives_window_center(LIVES_WINDOW(mainw->play_window));
4259 }
4260 if (prefs->show_playwin) {
4261 lives_window_present(LIVES_WINDOW(mainw->play_window));
4262 lives_xwindow_raise(lives_widget_get_xwindow(mainw->play_window));
4263 }
4264 } else {
4265 // not playing
4266 if (mainw->fs && mainw->playing_file == -2 && mainw->sep_win && prefs->sepwin_type == SEPWIN_TYPE_STICKY) {
4267 if (mainw->ce_thumbs) {
4268 end_ce_thumb_mode();
4269 }
4270 if (!mainw->multitrack && mainw->opwx >= 0 && mainw->opwy >= 0) {
4271 // move window back to its old position after play
4272 if (pmonitor > 0) lives_window_set_monitor(LIVES_WINDOW(mainw->play_window),
4273 pmonitor - 1);
4274 lives_window_uncenter(LIVES_WINDOW(mainw->play_window));
4275 lives_window_move(LIVES_WINDOW(mainw->play_window), mainw->opwx, mainw->opwy);
4276 } else {
4277 if (pmonitor > 0) lives_window_set_monitor(LIVES_WINDOW(mainw->play_window), pmonitor - 1);
4278 lives_window_center(LIVES_WINDOW(mainw->play_window));
4279 }
4280 } else {
4281 if (pmonitor > 0) lives_window_set_monitor(LIVES_WINDOW(mainw->play_window), pmonitor - 1);
4282 lives_window_center(LIVES_WINDOW(mainw->play_window));
4283 }
4284 mainw->opwx = mainw->opwy = -1;
4285 }
4286
4287 if (!LIVES_IS_PLAYING && (CURRENT_CLIP_IS_VALID && !cfile->opening)) {
4288 nheight = mainw->sepwin_minheight;
4289 if (mainw->pheight < MIN_SEPWIN_HEIGHT) nheight += MIN_SEPWIN_HEIGHT - mainw->pheight;
4290 }
4291
4292 nwidth = mainw->pwidth;
4293 nheight += mainw->pheight;
4294
4295 if (!(LIVES_IS_PLAYING && mainw->fs) && !mainw->double_size) {
4296 int xnwidth, xnheight;
4297 if (!LIVES_IS_PLAYING && CURRENT_CLIP_HAS_VIDEO && CURRENT_CLIP_IS_NORMAL)
4298 nwidth = MAX(mainw->pwidth, mainw->sepwin_minwidth);
4299
4300 pmonitor = prefs->play_monitor;
4301 if (pmonitor == 0 || !LIVES_IS_PLAYING) {
4302 while (nwidth > GUI_SCREEN_WIDTH - scr_width_safety ||
4303 nheight > GUI_SCREEN_HEIGHT - scr_height_safety) {
4304 nheight = (nheight >> 2) << 1;
4305 nwidth = (nwidth >> 2) << 1;
4306 }
4307 } else {
4308 while (nwidth > mainw->mgeom[pmonitor - 1].width - scr_width_safety ||
4309 nheight > mainw->mgeom[pmonitor - 1].height - scr_height_safety) {
4310 nheight = (nheight >> 2) << 1;
4311 nwidth = (nwidth >> 2) << 1;
4312 }
4313 }
4314 xnwidth = nwidth;
4315 xnheight = nheight;
4316 calc_midspect(mainw->pwidth, mainw->pheight, &xnwidth, &xnheight);
4317 if (pmonitor == 0 || !LIVES_IS_PLAYING) {
4318 if (xnwidth <= GUI_SCREEN_WIDTH - scr_width_safety &&
4319 xnheight <= GUI_SCREEN_HEIGHT - scr_height_safety) {
4320 nwidth = xnwidth;
4321 nheight = xnheight;
4322 }
4323 } else {
4324 if (xnwidth <= mainw->mgeom[pmonitor - 1].width - scr_width_safety &&
4325 nheight <= mainw->mgeom[pmonitor - 1].height - scr_height_safety) {
4326 nwidth = xnwidth;
4327 nheight = xnheight;
4328 }
4329 }
4330 }
4331
4332 if (!LIVES_IS_PLAYING || !mainw->fs) {
4333 lives_window_unfullscreen(LIVES_WINDOW(mainw->play_window));
4334 lives_window_resize(LIVES_WINDOW(mainw->play_window), nwidth, nheight);
4335 mainw->pwidth = nwidth;
4336 mainw->pheight = nheight;
4337 }
4338
4339 if (!LIVES_IS_PLAYING) {
4340 if (pb_added && width != -1 && (width != nwidth || height != nheight) && mainw->preview_spinbutton) {
4341 load_preview_image(FALSE);
4342 }
4343 play_window_set_title();
4344 }
4345 clear_widget_bg(mainw->play_image, mainw->play_surface);
4346 }
4347
4348
resize_play_window(void)4349 void resize_play_window(void) {
4350 main_thread_execute((lives_funcptr_t)_resize_play_window, 0, NULL, "");
4351 }
4352
4353
_kill_play_window(void)4354 static void _kill_play_window(void) {
4355 // plug our player back into internal window
4356
4357 if (mainw->ce_thumbs) {
4358 end_ce_thumb_mode();
4359 }
4360
4361 if (mainw->play_window) {
4362 if (mainw->preview_box && lives_widget_get_parent(mainw->preview_box)) {
4363 // preview_box is refed, so it will survive
4364 if (mainw->pi_surface) {
4365 /// invalid the preview windo surface (IMPORTANT !)
4366 lives_painter_surface_destroy(mainw->pi_surface);
4367 mainw->pi_surface = NULL;
4368 }
4369 /// ref all the things and remove before destroying the window
4370 lives_widget_object_ref(mainw->preview_box);
4371 lives_widget_object_ref(mainw->preview_image);
4372 lives_container_remove(LIVES_CONTAINER(mainw->play_window), mainw->preview_box);
4373 }
4374 if (LIVES_IS_WINDOW(mainw->play_window)) {
4375 lives_widget_destroy(mainw->play_window);
4376 }
4377 mainw->play_window = NULL;
4378 }
4379 if ((!CURRENT_CLIP_IS_VALID || cfile->frames > 0) && !mainw->multitrack && LIVES_IS_PLAYING) {
4380 lives_widget_show_all(mainw->playframe);
4381 lives_widget_set_opacity(mainw->playframe, 1.);
4382 }
4383 lives_widget_set_tooltip_text(mainw->m_sepwinbutton, _("Show Play Window"));
4384 }
4385
kill_play_window(void)4386 void kill_play_window(void) {
4387 main_thread_execute((lives_funcptr_t)_kill_play_window, 0, NULL, "");
4388 }
4389
4390
4391 #define ASPECT_DIFF_LMT 0.01625f // (fabs) ratio differences in aspect ratios within this limit considered irrelevant
4392
4393 /**
4394 @brief calculate sizes for letterboxing
4395
4396 if the player can resize, then we only need to consider the aspect ratio.
4397 we will embed the image in a black rectangle to give it the same aspect ratio
4398 as the player; thus when it gets stretched to the player size the inner image wil not be distorted
4399 so here we check: if we keep the same height, and then set the width to the player a.r, does it increase ?
4400 if so then our outer rectangle will be wider, othewise it will be higher (or the same, in which case we dont do anything)
4401 - if either dimension ends up larger, then our outer rectangle is the player size, and we scale the inner image down so both
4402 width and height fit
4403
4404 widths should be in pixels (not macropixels)
4405 */
get_letterbox_sizes(int * pwidth,int * pheight,int * lb_width,int * lb_height,boolean player_can_upscale)4406 void get_letterbox_sizes(int *pwidth, int *pheight, int *lb_width, int *lb_height, boolean player_can_upscale) {
4407 float frame_aspect, player_aspect;
4408 if (!player_can_upscale) {
4409 calc_maxspect(*pwidth, *pheight, lb_width, lb_height);
4410 return;
4411 }
4412 frame_aspect = (float) * lb_width / (float) * lb_height;
4413 player_aspect = (float) * pwidth / (float) * pheight;
4414 if (fabs(1. - frame_aspect / player_aspect) < ASPECT_DIFF_LMT) {
4415 if (*lb_width > *pwidth) *lb_width = *pwidth;
4416 if (*lb_height > *pheight) *lb_height = *pheight;
4417 if (*pwidth > *lb_width) *pwidth = *lb_width;
4418 if (*pheight > *lb_height) *pheight = *lb_height;
4419 return;
4420 }
4421
4422 // *pwidth, *pheight are the outer dimensions, *lb_width, *lb_height are inner, widths are in pixels
4423 if (frame_aspect > player_aspect) {
4424 // width is relatively larger, so the height will need padding
4425 if (*lb_width > *pwidth) {
4426 /// inner frame needs scaling down
4427 *lb_width = *pwidth;
4428 *lb_height = (float) * lb_width / frame_aspect + .5;
4429 *lb_height = (*lb_height >> 1) << 1;
4430 return;
4431 } else {
4432 /// inner frame size OK, we will shrink wrap the outer frame
4433 *pwidth = *lb_width;
4434 *pheight = (float) * pwidth / player_aspect + .5;
4435 *pheight = (*pheight >> 1) << 1;
4436 }
4437 return;
4438 }
4439 if (*lb_height > *pheight) {
4440 *lb_height = *pheight;
4441 *lb_width = (float) * lb_height * frame_aspect + .5;;
4442 *lb_width = (*lb_width >> 2) << 2;
4443 } else {
4444 *pheight = *lb_height;
4445 *pwidth = (float) * pheight * player_aspect + .5;
4446 *pwidth = (*pwidth >> 2) << 2;
4447 }
4448 }
4449
4450
add_to_playframe(void)4451 void add_to_playframe(void) {
4452 if (LIVES_IS_PLAYING) lives_widget_show(mainw->playframe);
4453
4454 if (!mainw->plug && !mainw->foreign) {
4455 mainw->plug = lives_event_box_new();
4456 lives_widget_set_app_paintable(mainw->plug, TRUE);
4457 lives_container_add(LIVES_CONTAINER(mainw->playarea), mainw->plug);
4458 if (palette->style & STYLE_1) {
4459 lives_widget_set_bg_color(mainw->plug, LIVES_WIDGET_STATE_NORMAL, &palette->normal_back);
4460 }
4461 lives_widget_show(mainw->plug);
4462 lives_container_add(LIVES_CONTAINER(mainw->plug), mainw->play_image);
4463 lives_widget_set_halign(mainw->plug, LIVES_ALIGN_CENTER);
4464 lives_widget_set_halign(mainw->play_image, LIVES_ALIGN_CENTER);
4465 if (mainw->multitrack) {
4466 lives_widget_set_vexpand(mainw->play_image, TRUE); // centers it in mt
4467 lives_widget_set_hexpand(mainw->play_image, TRUE); // centers it in mt
4468 } else {
4469 lives_widget_set_vexpand(mainw->play_image, FALSE);
4470 lives_widget_set_hexpand(mainw->play_image, FALSE);
4471 }
4472 }
4473 resize(1);
4474 if (LIVES_IS_PLAYING) lives_widget_set_opacity(mainw->playframe, 1.);
4475 clear_widget_bg(mainw->play_image, mainw->play_surface);
4476 }
4477
4478
frame_size_update(void)4479 LIVES_GLOBAL_INLINE void frame_size_update(void) {
4480 // update widgets when the frame size changes
4481 on_double_size_activate(NULL, LIVES_INT_TO_POINTER(1));
4482 }
4483
4484
4485 #define MAX_DISP_SETNAME_LEN 10
4486
get_menu_name(lives_clip_t * sfile,boolean add_setname)4487 char *get_menu_name(lives_clip_t *sfile, boolean add_setname) {
4488 char *clipname;
4489 char *extra, *menuname;
4490
4491 if (!sfile) return NULL;
4492 if (add_setname && sfile->was_in_set) {
4493 char *shortened_set_name;
4494 if (strlen(mainw->set_name) > MAX_DISP_SETNAME_LEN) {
4495 char *tmp = lives_strndup(mainw->set_name, MAX_DISP_SETNAME_LEN);
4496 shortened_set_name = lives_strdup_printf("%s...", tmp);
4497 lives_free(tmp);
4498 } else shortened_set_name = lives_strdup(mainw->set_name);
4499 extra = lives_strdup_printf(" (%s)", shortened_set_name);
4500 lives_free(shortened_set_name);
4501 } else extra = lives_strdup("");
4502 if (sfile->clip_type == CLIP_TYPE_FILE || sfile->clip_type == CLIP_TYPE_DISK)
4503 clipname = lives_path_get_basename(sfile->name);
4504 else clipname = lives_strdup(sfile->name);
4505 menuname = lives_strdup_printf("%s%s", clipname, extra);
4506 lives_free(extra);
4507 lives_free(clipname);
4508 return menuname;
4509 }
4510
4511
add_to_clipmenu(void)4512 void add_to_clipmenu(void) {
4513 // TODO - indicate "opening"
4514 char *fname = NULL;
4515
4516 #ifdef TEST_NOTIFY
4517 char *tmp, *detail;
4518 #endif
4519
4520 #ifndef GTK_RADIO_MENU_BUG
4521 if (!CURRENT_CLIP_IS_VALID) return;
4522 widget_opts.mnemonic_label = FALSE;
4523 cfile->menuentry = lives_standard_radio_menu_item_new_with_label(mainw->clips_group, tmp = get_menu_name(cfile));
4524 lives_free(tmp);
4525 mainw->clips_group = lives_radio_menu_item_get_group(LIVES_RADIO_MENU_ITEM(cfile->menuentry));
4526 #else
4527 widget_opts.mnemonic_label = FALSE;
4528 cfile->menuentry = lives_standard_check_menu_item_new_with_label(fname = get_menu_name(cfile, TRUE), FALSE);
4529 lives_check_menu_item_set_draw_as_radio(LIVES_CHECK_MENU_ITEM(cfile->menuentry), TRUE);
4530 #endif
4531
4532 if (!CURRENT_CLIP_IS_VALID) return;
4533 widget_opts.mnemonic_label = TRUE;
4534 lives_widget_show(cfile->menuentry);
4535 lives_container_add(LIVES_CONTAINER(mainw->clipsmenu), cfile->menuentry);
4536
4537 lives_widget_set_sensitive(cfile->menuentry, TRUE);
4538 cfile->menuentry_func = lives_signal_sync_connect(LIVES_GUI_OBJECT(cfile->menuentry), LIVES_WIDGET_TOGGLED_SIGNAL,
4539 LIVES_GUI_CALLBACK(switch_clip_activate), NULL);
4540
4541 if (CURRENT_CLIP_IS_NORMAL) mainw->clips_available++;
4542 pthread_mutex_lock(&mainw->clip_list_mutex);
4543 mainw->cliplist = lives_list_append(mainw->cliplist, LIVES_INT_TO_POINTER(mainw->current_file));
4544 pthread_mutex_unlock(&mainw->clip_list_mutex);
4545 cfile->old_frames = cfile->frames;
4546 cfile->ratio_fps = check_for_ratio_fps(cfile->fps);
4547
4548 #ifdef TEST_NOTIFY
4549 detail = lives_strdup_printf(_("'LiVES opened the file' '%s'"), fname);
4550 tmp = lives_strdup_printf("notify-send %s", detail);
4551 lives_system(tmp, TRUE);
4552 lives_free(tmp);
4553 lives_free(detail);
4554 #endif
4555
4556 lives_freep((void **)&fname);
4557 }
4558
4559
remove_from_clipmenu(void)4560 void remove_from_clipmenu(void) {
4561 #ifndef GTK_RADIO_MENU_BUG
4562 LiVESList *list;
4563 int fileno;
4564 #endif
4565
4566 #ifdef TEST_NOTIFY
4567 char *fname = get_menu_name(cfile);
4568 char *detail = lives_strdup_printf(_("'LiVES closed the file' '%s'"), fname);
4569 char *tmp = lives_strdup_printf("notify-send %s", detail);
4570 if (!CURRENT_CLIP_IS_VALID) return;
4571 lives_system(tmp, TRUE);
4572 lives_free(tmp);
4573 lives_free(fname);
4574 lives_free(detail);
4575 #endif
4576
4577 if (!CURRENT_CLIP_IS_VALID) return;
4578 lives_widget_unparent(cfile->menuentry);
4579 pthread_mutex_lock(&mainw->clip_list_mutex);
4580 mainw->cliplist = lives_list_remove(mainw->cliplist, LIVES_INT_TO_POINTER(mainw->current_file));
4581 pthread_mutex_unlock(&mainw->clip_list_mutex);
4582 if (CURRENT_CLIP_IS_NORMAL) {
4583 mainw->clips_available--;
4584 if (prefs->crash_recovery) rewrite_recovery_file();
4585 }
4586
4587 #ifndef GTK_RADIO_MENU_BUG
4588 list = mainw->cliplist;
4589 mainw->clips_group = NULL;
4590
4591 while (list) {
4592 fileno = LIVES_POINTER_TO_INT(list->data);
4593 if (mainw->files[fileno] && mainw->files[fileno]->menuentrqy) {
4594 mainw->clips_group = lives_radio_menu_item_get_group(LIVES_RADIO_MENU_ITEM(mainw->files[fileno]->menuentry));
4595 break;
4596 }
4597 }
4598 #endif
4599 }
4600
4601 //////////////////////////////////////////////////////////////////////
4602
4603 // splash screen
4604
splash_init(void)4605 void splash_init(void) {
4606 LiVESWidget *vbox, *hbox;
4607 LiVESWidget *splash_img;
4608 LiVESPixbuf *splash_pix;
4609
4610 LiVESError *error = NULL;
4611 char *tmp = lives_strdup_printf("%s/%s/lives-splash.png", prefs->prefix_dir, THEME_DIR);
4612 lives_window_set_auto_startup_notification(FALSE);
4613
4614 mainw->splash_window = lives_window_new(LIVES_WINDOW_TOPLEVEL);
4615 lives_window_set_decorated(LIVES_WINDOW(mainw->splash_window), FALSE);
4616
4617 if (prefs->show_splash) {
4618 #ifdef GUI_GTK
4619 gtk_window_set_type_hint(LIVES_WINDOW(mainw->splash_window), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);
4620 #endif
4621
4622 vbox = lives_vbox_new(FALSE, widget_opts.packing_height);
4623 lives_container_add(LIVES_CONTAINER(mainw->splash_window), vbox);
4624 lives_container_set_border_width(LIVES_CONTAINER(vbox), widget_opts.border_width * 4);
4625
4626 if (palette->style & STYLE_1) {
4627 lives_widget_set_bg_color(mainw->splash_window, LIVES_WIDGET_STATE_NORMAL, &palette->normal_back);
4628 }
4629
4630 splash_pix = lives_pixbuf_new_from_file(tmp, &error);
4631 lives_free(tmp);
4632
4633 splash_img = lives_image_new_from_pixbuf(splash_pix);
4634
4635 lives_box_pack_start(LIVES_BOX(vbox), splash_img, TRUE, TRUE, 0);
4636 lives_widget_set_opacity(splash_img, .75);
4637
4638 if (splash_pix) lives_widget_object_unref(splash_pix);
4639
4640 mainw->splash_progress = lives_standard_progress_bar_new();
4641
4642 #ifdef PROGBAR_IS_ENTRY
4643 mainw->splash_label = mainw->splash_progress;
4644 #else
4645
4646 widget_opts.justify = LIVES_JUSTIFY_CENTER;
4647 mainw->splash_label = lives_standard_label_new("");
4648 widget_opts.justify = LIVES_JUSTIFY_DEFAULT;
4649
4650 lives_box_pack_start(LIVES_BOX(vbox), mainw->splash_label, TRUE, TRUE, 4. * widget_opts.scale);
4651 lives_widget_set_valign(vbox, LIVES_ALIGN_END);
4652 #endif
4653
4654 lives_progress_bar_set_pulse_step(LIVES_PROGRESS_BAR(mainw->splash_progress), .01);
4655
4656 if (palette->style & STYLE_1) {
4657 lives_widget_set_fg_color(mainw->splash_label, LIVES_WIDGET_STATE_NORMAL, &palette->normal_fore);
4658 lives_widget_set_fg_color(mainw->splash_progress, LIVES_WIDGET_STATE_NORMAL, &palette->normal_fore);
4659 }
4660
4661 hbox = lives_hbox_new(FALSE, widget_opts.packing_width);
4662
4663 lives_box_pack_start(LIVES_BOX(hbox), mainw->splash_progress, TRUE, TRUE, widget_opts.packing_width * 2);
4664
4665 lives_box_pack_start(LIVES_BOX(vbox), hbox, FALSE, FALSE, widget_opts.packing_height * 2);
4666
4667 lives_widget_show_all(mainw->splash_window);
4668
4669 lives_window_set_monitor(LIVES_WINDOW(mainw->splash_window), widget_opts.monitor);
4670
4671 lives_window_center(LIVES_WINDOW(mainw->splash_window));
4672 lives_window_present(LIVES_WINDOW(mainw->splash_window));
4673 if (mainw && LIVES_MAIN_WINDOW_WIDGET && prefs && prefs->startup_phase != 0)
4674 lives_widget_hide(LIVES_MAIN_WINDOW_WIDGET);
4675
4676 lives_widget_context_update();
4677 lives_set_cursor_style(LIVES_CURSOR_BUSY, mainw->splash_window);
4678 } else {
4679 lives_widget_destroy(mainw->splash_window);
4680 mainw->splash_window = NULL;
4681 }
4682
4683 lives_window_set_auto_startup_notification(TRUE);
4684 }
4685
4686
splash_msg(const char * msg,double pct)4687 void splash_msg(const char *msg, double pct) {
4688 if (mainw->foreign || !mainw->splash_window) return;
4689
4690 #ifdef PROGBAR_IS_ENTRY
4691 else {
4692 char *tmp = lives_strdup(msg);
4693 lives_chomp(tmp);
4694 lives_entry_set_text(LIVES_ENTRY(mainw->splash_label), tmp);
4695 lives_free(tmp);
4696 }
4697 #else
4698 widget_opts.mnemonic_label = FALSE;
4699 lives_label_set_text(LIVES_LABEL(mainw->splash_label), msg);
4700 widget_opts.mnemonic_label = TRUE;
4701 #endif
4702
4703 lives_progress_bar_set_fraction(LIVES_PROGRESS_BAR(mainw->splash_progress), pct);
4704
4705 lives_widget_queue_draw(mainw->splash_window);
4706 if (mainw && LIVES_MAIN_WINDOW_WIDGET && prefs && prefs->startup_phase != 0) lives_widget_hide(LIVES_MAIN_WINDOW_WIDGET);
4707
4708 lives_widget_context_update();
4709 }
4710
4711
splash_end(void)4712 void splash_end(void) {
4713 if (mainw->foreign) return;
4714
4715 if (mainw->splash_window) {
4716 lives_set_cursor_style(LIVES_CURSOR_NORMAL, mainw->splash_window);
4717 lives_widget_destroy(mainw->splash_window);
4718 }
4719
4720 mainw->threaded_dialog = FALSE;
4721 mainw->splash_window = NULL;
4722 //if (mainw && LIVES_MAIN_WINDOW_WIDGET && prefs && prefs->startup_phase != 0) lives_widget_hide(LIVES_MAIN_WINDOW_WIDGET);
4723 //lives_widget_context_update();
4724
4725 if (prefs->startup_interface == STARTUP_MT && prefs->startup_phase == 0 && !mainw->multitrack) {
4726 // realize the window so it gets added to wm toplevels
4727 //lives_widget_realize(LIVES_MAIN_WINDOW_WIDGET);
4728 on_multitrack_activate(NULL, NULL);
4729 mainw->is_ready = TRUE;
4730 }
4731 }
4732
4733
reset_message_area(void)4734 void reset_message_area(void) {
4735 if (!prefs->show_msg_area || mainw->multitrack) return;
4736 if (!mainw->is_ready || !prefs->show_gui) return;
4737 // need to shrink the message_box then re-expand it after redrawing the widgets
4738 // otherwise the main window can expand beyond the bottom of the screen
4739 lives_widget_set_size_request(mainw->message_box, 1, 1);
4740 lives_widget_set_size_request(mainw->msg_area, 1, 1);
4741 lives_widget_set_size_request(mainw->msg_scrollbar, 1, 1);
4742 }
4743
4744