diff options
author | jstebbins <[email protected]> | 2015-07-29 22:30:58 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2015-07-29 22:30:58 +0000 |
commit | 74a6af7510b51516a34fd8fa18d909c6e4f90ce6 (patch) | |
tree | d890b195dd9ffdc3dd8953b399502a80c8862560 | |
parent | 5f632706de566f8576787e234ca3bb3772de87ee (diff) |
LinGui: simplify preview overlay
Don't use gdk_display_supports_composite or gdk_window_set_composited.
They have been deprecated.
Unfortunately, this means I lose some functionality. I can give the HUD
round corners or I can make it translucent. It appears there is no way
to do both in the latest gtk+-3 :(
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7384 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | gtk/src/Makefile.am | 2 | ||||
-rw-r--r-- | gtk/src/composite_example.c | 78 | ||||
-rw-r--r-- | gtk/src/ghb-3.12.ui | 436 | ||||
-rw-r--r-- | gtk/src/ghb-3.14.ui | 438 | ||||
-rw-r--r-- | gtk/src/ghb.ui | 436 | ||||
-rw-r--r-- | gtk/src/ghbcompositor.c | 713 | ||||
-rw-r--r-- | gtk/src/ghbcompositor.h | 74 | ||||
-rw-r--r-- | gtk/src/main.c | 48 | ||||
-rw-r--r-- | gtk/src/preview.c | 257 |
9 files changed, 817 insertions, 1665 deletions
diff --git a/gtk/src/Makefile.am b/gtk/src/Makefile.am index e72ba59af..21801977d 100644 --- a/gtk/src/Makefile.am +++ b/gtk/src/Makefile.am @@ -73,8 +73,6 @@ ghb_SOURCES = \ renderer_button.c \ ghbcellrenderertext.c \ ghbcellrenderertext.h \ - ghbcompositor.c \ - ghbcompositor.h \ ghb-dvd.c \ ghb-dvd.h \ marshalers.c \ diff --git a/gtk/src/composite_example.c b/gtk/src/composite_example.c deleted file mode 100644 index 7918b3083..000000000 --- a/gtk/src/composite_example.c +++ /dev/null @@ -1,78 +0,0 @@ -#include <gtk/gtk.h> -#include "ghbcompositor.h" - -// GhbCompositor example -int -main(gint argc, gchar *argv[]) -{ - GtkWidget *window; - GtkWidget *blender; - GtkWidget *eb_bottom; - GtkWidget *eb_top1; - GtkWidget *eb_top2; - GtkWidget *eb_top3; - GtkWidget *bottom; - GtkWidget *top1; - GtkWidget *top2; - GtkWidget *top3; - GtkWidget *table; - GtkWidget *image; - - gtk_init(&argc, &argv); - - // Make the top level window - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - - // Only widgets that have a GdkDrawing area can be composited - // These would be GtkEventBox or GtkDrawingArea - // Create the widgets that will be composited - eb_bottom = gtk_event_box_new(); - eb_top1 = gtk_event_box_new(); - eb_top2 = gtk_event_box_new(); - eb_top3 = gtk_event_box_new(); - - // Create the compositor - blender = ghb_compositor_new(); - - // Create an button to put on the bottom layer - bottom = gtk_button_new_with_label("Bottom"); - image = gtk_image_new_from_stock("gtk-help", 6); - gtk_button_set_image(GTK_BUTTON(bottom), image); - - // The button must be placed inside an event box since - // buttons do not have their own window. - gtk_container_add(GTK_CONTAINER(eb_bottom), bottom); - - // Create the buttons that will be visible on the top layer - top1 = gtk_button_new_with_label("Top 1"); - top2 = gtk_button_new_with_label("Top 2"); - top3 = gtk_button_new_with_label("Top 3"); - - // The buttons must be placed inside an event box since - // buttons do not have their own window. - gtk_container_add(GTK_CONTAINER(eb_top1), top1); - gtk_container_add(GTK_CONTAINER(eb_top2), top2); - gtk_container_add(GTK_CONTAINER(eb_top3), top3); - - // Create the table that will be the top layer - // Using a layout widget gives flexibility in the layout of the layer - table = gtk_table_new(3, 3, TRUE); - gtk_table_attach(GTK_TABLE(table), eb_top1, 0, 1, 0, 1, 0, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), eb_top2, 1, 2, 1, 2, 0, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), eb_top3, 2, 3, 2, 3, 0, 0, 0, 0); - - // Add the blender to the main window. - gtk_container_add(GTK_CONTAINER(window), blender); - - // Set the blenders zlist, with opacity values - // Bottom layer is opaque, top layer 60% - ghb_compositor_zlist_insert(GHB_COMPOSITOR(blender), eb_bottom, 1, 1); - ghb_compositor_zlist_insert(GHB_COMPOSITOR(blender), table, 2, 0.6); - - // Start the show - gtk_widget_show_all(window); - - gtk_main(); - return 0; -} - diff --git a/gtk/src/ghb-3.12.ui b/gtk/src/ghb-3.12.ui index 6b886d6c1..5163cb986 100644 --- a/gtk/src/ghb-3.12.ui +++ b/gtk/src/ghb-3.12.ui @@ -8131,243 +8131,259 @@ Setting this to 0 means there is no maximum height.</property> <action-widget response="-5">preset_ok</action-widget> </action-widgets> </object> - <object class="GtkDrawingArea" id="preview_image"> - <property name="visible">True</property> - <property name="app_paintable">True</property> - <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK</property> - <signal name="leave-notify-event" handler="preview_leave_cb" swapped="no"/> - <signal name="motion-notify-event" handler="preview_motion_cb" swapped="no"/> - </object> <object class="GtkAdjustment" id="preview_progress_adj"> <property name="upper">100</property> <property name="step_increment">1</property> <property name="page_increment">10</property> </object> - <object class="GtkEventBox" id="preview_hud"> - <property name="visible">True</property> - <property name="app_paintable">True</property> + <object class="GtkWindow" id="preview_window"> <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="valign">end</property> - <property name="margin-bottom">30</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property> - <signal name="enter-notify-event" handler="hud_enter_cb" swapped="no"/> - <signal name="size-allocate" handler="preview_hud_size_alloc_cb" swapped="no"/> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_STRUCTURE_MASK</property> + <property name="title" translatable="yes">Preview</property> + <property name="resizable">False</property> + <property name="window_position">center</property> + <property name="type_hint">utility</property> + <property name="skip_taskbar_hint">True</property> + <property name="skip_pager_hint">True</property> + <property name="transient_for">hb_window</property> + <signal name="configure-event" handler="preview_configure_cb" swapped="no"/> + <signal name="delete-event" handler="preview_window_delete_cb" swapped="no"/> <child> - <object class="GtkBox" id="vbox35"> - <property name="orientation">vertical</property> + <object class="GtkBox" id="preview_window_box"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin-top">5</property> - <property name="margin-bottom">5</property> - <property name="margin-left">10</property> - <property name="margin-right">10</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkScale" id="preview_frame"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Select preview frames.</property> - <property name="adjustment">adjustment19</property> - <property name="digits">0</property> - <property name="value_pos">bottom</property> - <signal name="value-changed" handler="preview_frame_value_changed_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkBox" id="live_preview_box"> - <property name="orientation">horizontal</property> + <object class="GtkLayout" id="preview_image"> <property name="visible">True</property> + <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="spacing">5</property> + <property name="halign">center</property> + <property name="valign">center</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK</property> + <signal name="leave-notify-event" handler="preview_leave_cb" swapped="no"/> + <signal name="motion-notify-event" handler="preview_motion_cb" swapped="no"/> + <signal name="draw" handler="preview_draw_cb" swapped="no"/> <child> - <object class="GtkButton" id="live_preview_play"> - <property name="height_request">30</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Encode and play a short sequence of video starting from the current preview position.</property> - <property name="relief">none</property> - <signal name="clicked" handler="live_preview_start_cb" swapped="no"/> - <child> - <object class="GtkImage" id="live_preview_play_image"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">gtk-media-play</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkScale" id="live_preview_progress"> - <property name="can_focus">True</property> - <property name="adjustment">preview_progress_adj</property> - <property name="draw_value">False</property> - <property name="value_pos">right</property> - <signal name="value-changed" handler="live_preview_seek_cb" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="live_progress_box"> + <object class="GtkBox" id="preview_hud_box"> <property name="orientation">vertical</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkProgressBar" id="live_encode_progress"> - <property name="height_request">20</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="hbox26"> - <property name="orientation">horizontal</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">10</property> - <child> - <object class="GtkBox" id="live_preview_duration_box"> - <property name="orientation">horizontal</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">2</property> <child> - <object class="GtkLabel" id="label37"> + <object class="GtkEventBox" id="preview_hud"> <property name="visible">True</property> + <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Duration:</b></property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="live_duration"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Set the duration of the live preview in seconds.</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> - <property name="adjustment">adjustment21</property> - <property name="numeric">True</property> - <signal name="value-changed" handler="preview_duration_changed_cb" swapped="no"/> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="hexpand-set">True</property> + <property name="vexpand-set">True</property> + <property name="halign">center</property> + <property name="valign">end</property> + <property name="margin-bottom">30</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK</property> + <signal name="enter-notify-event" handler="hud_enter_cb" swapped="no"/> + <signal name="leave-notify-event" handler="hud_leave_cb" swapped="no"/> + <signal name="size-allocate" handler="hud_size_alloc_cb" swapped="no"/> + <child> + <object class="GtkBox" id="vbox35"> + <property name="orientation">vertical</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin-top">5</property> + <property name="margin-bottom">5</property> + <property name="margin-left">10</property> + <property name="margin-right">10</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <child> + <object class="GtkScale" id="preview_frame"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Select preview frames.</property> + <property name="adjustment">adjustment19</property> + <property name="digits">0</property> + <property name="value_pos">bottom</property> + <signal name="value-changed" handler="preview_frame_value_changed_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="live_preview_box"> + <property name="orientation">horizontal</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">5</property> + <child> + <object class="GtkButton" id="live_preview_play"> + <property name="height_request">30</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Encode and play a short sequence of video starting from the current preview position.</property> + <property name="relief">none</property> + <signal name="clicked" handler="live_preview_start_cb" swapped="no"/> + <child> + <object class="GtkImage" id="live_preview_play_image"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">gtk-media-play</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkScale" id="live_preview_progress"> + <property name="can_focus">True</property> + <property name="adjustment">preview_progress_adj</property> + <property name="draw_value">False</property> + <property name="value_pos">right</property> + <signal name="value-changed" handler="live_preview_seek_cb" swapped="no"/> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="live_progress_box"> + <property name="orientation">vertical</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkProgressBar" id="live_encode_progress"> + <property name="height_request">20</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="hbox26"> + <property name="orientation">horizontal</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">10</property> + <child> + <object class="GtkBox" id="live_preview_duration_box"> + <property name="orientation">horizontal</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">2</property> + <child> + <object class="GtkLabel" id="label37"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b>Duration:</b></property> + <property name="use_markup">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="live_duration"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Set the duration of the live preview in seconds.</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="adjustment">adjustment21</property> + <property name="numeric">True</property> + <signal name="value-changed" handler="preview_duration_changed_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="preview_show_crop"> + <property name="label" translatable="yes">Show Crop</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Show Cropped area of the preview</property> + <property name="halign">start</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="show_crop_changed_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkToggleButton" id="preview_fullscreen"> + <property name="label" translatable="yes">Fullscreen</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">View Fullscreen Preview</property> + <property name="relief">none</property> + <signal name="toggled" handler="fullscreen_clicked_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> </child> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="preview_show_crop"> - <property name="label" translatable="yes">Show Crop</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Show Cropped area of the preview</property> - <property name="halign">start</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="show_crop_changed_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkToggleButton" id="preview_fullscreen"> - <property name="label" translatable="yes">Fullscreen</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">View Fullscreen Preview</property> - <property name="relief">none</property> - <signal name="toggled" handler="fullscreen_clicked_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> </child> </object> </child> </object> - <object class="GtkWindow" id="preview_window"> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_STRUCTURE_MASK</property> - <property name="title" translatable="yes">Preview</property> - <property name="resizable">False</property> - <property name="window_position">center</property> - <property name="type_hint">utility</property> - <property name="skip_taskbar_hint">True</property> - <property name="skip_pager_hint">True</property> - <property name="transient_for">hb_window</property> - <signal name="configure-event" handler="preview_configure_cb" swapped="no"/> - <signal name="delete-event" handler="preview_window_delete_cb" swapped="no"/> - <child> - <object class="GtkBox" id="preview_window_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - </child> - </object> <object class="GtkFileChooserDialog" id="source_dialog"> <property name="can_focus">False</property> <property name="border_width">5</property> diff --git a/gtk/src/ghb-3.14.ui b/gtk/src/ghb-3.14.ui index 000ad6867..e5c3d5f35 100644 --- a/gtk/src/ghb-3.14.ui +++ b/gtk/src/ghb-3.14.ui @@ -8139,243 +8139,263 @@ Setting this to 0 means there is no maximum height.</property> <action-widget response="-5">preset_ok</action-widget> </action-widgets> </object> - <object class="GtkDrawingArea" id="preview_image"> - <property name="visible">True</property> - <property name="app_paintable">True</property> - <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK</property> - <signal name="leave-notify-event" handler="preview_leave_cb" swapped="no"/> - <signal name="motion-notify-event" handler="preview_motion_cb" swapped="no"/> - </object> <object class="GtkAdjustment" id="preview_progress_adj"> <property name="upper">100</property> <property name="step_increment">1</property> <property name="page_increment">10</property> </object> - <object class="GtkEventBox" id="preview_hud"> - <property name="visible">True</property> - <property name="app_paintable">True</property> + <object class="GtkWindow" id="preview_window"> <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="valign">end</property> - <property name="margin-bottom">30</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property> - <signal name="enter-notify-event" handler="hud_enter_cb" swapped="no"/> - <signal name="size-allocate" handler="preview_hud_size_alloc_cb" swapped="no"/> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_STRUCTURE_MASK</property> + <property name="title" translatable="yes">Preview</property> + <property name="resizable">False</property> + <property name="window_position">center</property> + <property name="type_hint">utility</property> + <property name="skip_taskbar_hint">True</property> + <property name="skip_pager_hint">True</property> + <property name="transient_for">hb_window</property> + <signal name="configure-event" handler="preview_configure_cb" swapped="no"/> + <signal name="delete-event" handler="preview_window_delete_cb" swapped="no"/> <child> - <object class="GtkBox" id="vbox35"> - <property name="orientation">vertical</property> + <object class="GtkBox" id="preview_window_box"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin-top">5</property> - <property name="margin-bottom">5</property> - <property name="margin-start">10</property> - <property name="margin-end">10</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkScale" id="preview_frame"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Select preview frames.</property> - <property name="adjustment">adjustment19</property> - <property name="digits">0</property> - <property name="value_pos">bottom</property> - <signal name="value-changed" handler="preview_frame_value_changed_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkBox" id="live_preview_box"> - <property name="orientation">horizontal</property> + <object class="GtkLayout" id="preview_image"> <property name="visible">True</property> + <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="spacing">5</property> + <property name="halign">center</property> + <property name="valign">center</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK</property> + <signal name="leave-notify-event" handler="preview_leave_cb" swapped="no"/> + <signal name="motion-notify-event" handler="preview_motion_cb" swapped="no"/> + <signal name="draw" handler="preview_draw_cb" swapped="no"/> <child> - <object class="GtkButton" id="live_preview_play"> - <property name="height_request">30</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Encode and play a short sequence of video starting from the current preview position.</property> - <property name="relief">none</property> - <signal name="clicked" handler="live_preview_start_cb" swapped="no"/> - <child> - <object class="GtkImage" id="live_preview_play_image"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">gtk-media-play</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkScale" id="live_preview_progress"> - <property name="can_focus">True</property> - <property name="adjustment">preview_progress_adj</property> - <property name="draw_value">False</property> - <property name="value_pos">right</property> - <signal name="value-changed" handler="live_preview_seek_cb" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="live_progress_box"> + <object class="GtkBox" id="preview_hud_box"> <property name="orientation">vertical</property> <property name="visible">True</property> - <property name="can_focus">False</property> <child> - <object class="GtkProgressBar" id="live_encode_progress"> - <property name="height_request">20</property> - <property name="visible">True</property> + <object class="GtkEventBox" id="preview_hud"> + <property name="visible">False</property> + <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="hbox26"> - <property name="orientation">horizontal</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">10</property> - <child> - <object class="GtkBox" id="live_preview_duration_box"> - <property name="orientation">horizontal</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">2</property> - <child> - <object class="GtkLabel" id="label37"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Duration:</b></property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="live_duration"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Set the duration of the live preview in seconds.</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> - <property name="adjustment">adjustment21</property> - <property name="numeric">True</property> - <signal name="value-changed" handler="preview_duration_changed_cb" swapped="no"/> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="hexpand-set">True</property> + <property name="vexpand-set">True</property> + <property name="halign">center</property> + <property name="valign">end</property> + <property name="margin-bottom">30</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK</property> + <signal name="enter-notify-event" handler="hud_enter_cb" swapped="no"/> + <signal name="leave-notify-event" handler="hud_leave_cb" swapped="no"/> + <signal name="size-allocate" handler="hud_size_alloc_cb" swapped="no"/> + <child> + <object class="GtkBox" id="vbox35"> + <property name="orientation">vertical</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin-top">5</property> + <property name="margin-bottom">5</property> + <property name="margin-start">10</property> + <property name="margin-end">10</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <child> + <object class="GtkScale" id="preview_frame"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Select preview frames.</property> + <property name="adjustment">adjustment19</property> + <property name="digits">0</property> + <property name="value_pos">bottom</property> + <signal name="value-changed" handler="preview_frame_value_changed_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="live_preview_box"> + <property name="orientation">horizontal</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">5</property> + <child> + <object class="GtkButton" id="live_preview_play"> + <property name="height_request">30</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Encode and play a short sequence of video starting from the current preview position.</property> + <property name="relief">none</property> + <signal name="clicked" handler="live_preview_start_cb" swapped="no"/> + <child> + <object class="GtkImage" id="live_preview_play_image"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">gtk-media-play</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkScale" id="live_preview_progress"> + <property name="can_focus">True</property> + <property name="adjustment">preview_progress_adj</property> + <property name="draw_value">False</property> + <property name="value_pos">right</property> + <signal name="value-changed" handler="live_preview_seek_cb" swapped="no"/> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="live_progress_box"> + <property name="orientation">vertical</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkProgressBar" id="live_encode_progress"> + <property name="height_request">20</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="hbox26"> + <property name="orientation">horizontal</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">10</property> + <child> + <object class="GtkBox" id="live_preview_duration_box"> + <property name="orientation">horizontal</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">2</property> + <child> + <object class="GtkLabel" id="label37"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b>Duration:</b></property> + <property name="use_markup">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="live_duration"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Set the duration of the live preview in seconds.</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="adjustment">adjustment21</property> + <property name="numeric">True</property> + <signal name="value-changed" handler="preview_duration_changed_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="preview_show_crop"> + <property name="label" translatable="yes">Show Crop</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Show Cropped area of the preview</property> + <property name="halign">start</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="show_crop_changed_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkToggleButton" id="preview_fullscreen"> + <property name="label" translatable="yes">Fullscreen</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">View Fullscreen Preview</property> + <property name="relief">none</property> + <signal name="toggled" handler="fullscreen_clicked_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> </child> </object> <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="preview_show_crop"> - <property name="label" translatable="yes">Show Crop</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Show Cropped area of the preview</property> - <property name="halign">start</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="show_crop_changed_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkToggleButton" id="preview_fullscreen"> - <property name="label" translatable="yes">Fullscreen</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">View Fullscreen Preview</property> - <property name="relief">none</property> - <signal name="toggled" handler="fullscreen_clicked_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> + <property name="x">0</property> + <property name="y">0</property> </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> </child> </object> </child> </object> - <object class="GtkWindow" id="preview_window"> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_STRUCTURE_MASK</property> - <property name="title" translatable="yes">Preview</property> - <property name="resizable">False</property> - <property name="window_position">center</property> - <property name="type_hint">utility</property> - <property name="skip_taskbar_hint">True</property> - <property name="skip_pager_hint">True</property> - <property name="transient_for">hb_window</property> - <signal name="configure-event" handler="preview_configure_cb" swapped="no"/> - <signal name="delete-event" handler="preview_window_delete_cb" swapped="no"/> - <child> - <object class="GtkBox" id="preview_window_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - </child> - </object> <object class="GtkFileChooserDialog" id="source_dialog"> <property name="can_focus">False</property> <property name="border_width">5</property> diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index 03524f78e..27c6b5ccf 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -8131,243 +8131,259 @@ Setting this to 0 means there is no maximum height.</property> <action-widget response="-5">preset_ok</action-widget> </action-widgets> </object> - <object class="GtkDrawingArea" id="preview_image"> - <property name="visible">True</property> - <property name="app_paintable">True</property> - <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK</property> - <signal name="leave-notify-event" handler="preview_leave_cb" swapped="no"/> - <signal name="motion-notify-event" handler="preview_motion_cb" swapped="no"/> - </object> <object class="GtkAdjustment" id="preview_progress_adj"> <property name="upper">100</property> <property name="step_increment">1</property> <property name="page_increment">10</property> </object> - <object class="GtkEventBox" id="preview_hud"> - <property name="visible">True</property> - <property name="app_paintable">True</property> + <object class="GtkWindow" id="preview_window"> <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="valign">end</property> - <property name="margin-bottom">30</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property> - <signal name="enter-notify-event" handler="hud_enter_cb" swapped="no"/> - <signal name="size-allocate" handler="preview_hud_size_alloc_cb" swapped="no"/> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_STRUCTURE_MASK</property> + <property name="title" translatable="yes">Preview</property> + <property name="resizable">False</property> + <property name="window_position">center</property> + <property name="type_hint">utility</property> + <property name="skip_taskbar_hint">True</property> + <property name="skip_pager_hint">True</property> + <property name="transient_for">hb_window</property> + <signal name="configure-event" handler="preview_configure_cb" swapped="no"/> + <signal name="delete-event" handler="preview_window_delete_cb" swapped="no"/> <child> - <object class="GtkBox" id="vbox35"> - <property name="orientation">vertical</property> + <object class="GtkBox" id="preview_window_box"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin-top">5</property> - <property name="margin-bottom">5</property> - <property name="margin-left">10</property> - <property name="margin-right">10</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkScale" id="preview_frame"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Select preview frames.</property> - <property name="adjustment">adjustment19</property> - <property name="digits">0</property> - <property name="value_pos">bottom</property> - <signal name="value-changed" handler="preview_frame_value_changed_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkBox" id="live_preview_box"> - <property name="orientation">horizontal</property> + <object class="GtkLayout" id="preview_image"> <property name="visible">True</property> + <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="spacing">5</property> + <property name="halign">center</property> + <property name="valign">center</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK</property> + <signal name="leave-notify-event" handler="preview_leave_cb" swapped="no"/> + <signal name="motion-notify-event" handler="preview_motion_cb" swapped="no"/> + <signal name="draw" handler="preview_draw_cb" swapped="no"/> <child> - <object class="GtkButton" id="live_preview_play"> - <property name="height_request">30</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Encode and play a short sequence of video starting from the current preview position.</property> - <property name="relief">none</property> - <signal name="clicked" handler="live_preview_start_cb" swapped="no"/> - <child> - <object class="GtkImage" id="live_preview_play_image"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">gtk-media-play</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkScale" id="live_preview_progress"> - <property name="can_focus">True</property> - <property name="adjustment">preview_progress_adj</property> - <property name="draw_value">False</property> - <property name="value_pos">right</property> - <signal name="value-changed" handler="live_preview_seek_cb" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="live_progress_box"> + <object class="GtkBox" id="preview_hud_box"> <property name="orientation">vertical</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkProgressBar" id="live_encode_progress"> - <property name="height_request">20</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="hbox26"> - <property name="orientation">horizontal</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">10</property> - <child> - <object class="GtkBox" id="live_preview_duration_box"> - <property name="orientation">horizontal</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">2</property> <child> - <object class="GtkLabel" id="label37"> + <object class="GtkEventBox" id="preview_hud"> <property name="visible">True</property> + <property name="app_paintable">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Duration:</b></property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="live_duration"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Set the duration of the live preview in seconds.</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> - <property name="adjustment">adjustment21</property> - <property name="numeric">True</property> - <signal name="value-changed" handler="preview_duration_changed_cb" swapped="no"/> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="hexpand-set">True</property> + <property name="vexpand-set">True</property> + <property name="halign">center</property> + <property name="valign">end</property> + <property name="margin-bottom">30</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK</property> + <signal name="enter-notify-event" handler="hud_enter_cb" swapped="no"/> + <signal name="leave-notify-event" handler="hud_leave_cb" swapped="no"/> + <signal name="size-allocate" handler="hud_size_alloc_cb" swapped="no"/> + <child> + <object class="GtkBox" id="vbox35"> + <property name="orientation">vertical</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin-top">5</property> + <property name="margin-bottom">5</property> + <property name="margin-left">10</property> + <property name="margin-right">10</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <child> + <object class="GtkScale" id="preview_frame"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Select preview frames.</property> + <property name="adjustment">adjustment19</property> + <property name="digits">0</property> + <property name="value_pos">bottom</property> + <signal name="value-changed" handler="preview_frame_value_changed_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="live_preview_box"> + <property name="orientation">horizontal</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">5</property> + <child> + <object class="GtkButton" id="live_preview_play"> + <property name="height_request">30</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Encode and play a short sequence of video starting from the current preview position.</property> + <property name="relief">none</property> + <signal name="clicked" handler="live_preview_start_cb" swapped="no"/> + <child> + <object class="GtkImage" id="live_preview_play_image"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">gtk-media-play</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkScale" id="live_preview_progress"> + <property name="can_focus">True</property> + <property name="adjustment">preview_progress_adj</property> + <property name="draw_value">False</property> + <property name="value_pos">right</property> + <signal name="value-changed" handler="live_preview_seek_cb" swapped="no"/> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="live_progress_box"> + <property name="orientation">vertical</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkProgressBar" id="live_encode_progress"> + <property name="height_request">20</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="hbox26"> + <property name="orientation">horizontal</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">10</property> + <child> + <object class="GtkBox" id="live_preview_duration_box"> + <property name="orientation">horizontal</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">2</property> + <child> + <object class="GtkLabel" id="label37"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b>Duration:</b></property> + <property name="use_markup">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="live_duration"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Set the duration of the live preview in seconds.</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="adjustment">adjustment21</property> + <property name="numeric">True</property> + <signal name="value-changed" handler="preview_duration_changed_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="preview_show_crop"> + <property name="label" translatable="yes">Show Crop</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Show Cropped area of the preview</property> + <property name="halign">start</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="show_crop_changed_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkToggleButton" id="preview_fullscreen"> + <property name="label" translatable="yes">Fullscreen</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">View Fullscreen Preview</property> + <property name="relief">none</property> + <signal name="toggled" handler="fullscreen_clicked_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> </child> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="preview_show_crop"> - <property name="label" translatable="yes">Show Crop</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Show Cropped area of the preview</property> - <property name="halign">start</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="show_crop_changed_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkToggleButton" id="preview_fullscreen"> - <property name="label" translatable="yes">Fullscreen</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">View Fullscreen Preview</property> - <property name="relief">none</property> - <signal name="toggled" handler="fullscreen_clicked_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> </child> </object> </child> </object> - <object class="GtkWindow" id="preview_window"> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_STRUCTURE_MASK</property> - <property name="title" translatable="yes">Preview</property> - <property name="resizable">False</property> - <property name="window_position">center</property> - <property name="type_hint">utility</property> - <property name="skip_taskbar_hint">True</property> - <property name="skip_pager_hint">True</property> - <property name="transient_for">hb_window</property> - <signal name="configure-event" handler="preview_configure_cb" swapped="no"/> - <signal name="delete-event" handler="preview_window_delete_cb" swapped="no"/> - <child> - <object class="GtkBox" id="preview_window_box"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - </child> - </object> <object class="GtkFileChooserDialog" id="source_dialog"> <property name="can_focus">False</property> <property name="border_width">5</property> diff --git a/gtk/src/ghbcompositor.c b/gtk/src/ghbcompositor.c deleted file mode 100644 index 4e7353da3..000000000 --- a/gtk/src/ghbcompositor.c +++ /dev/null @@ -1,713 +0,0 @@ -/* "Borrowed" from: */ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#include <config.h> -#include <stdlib.h> -#include "ghbcompat.h" -#include "ghbcompositor.h" - -enum { - PROP_0, -}; - -enum { - CHILD_PROP_0, - CHILD_PROP_Z_POS, - CHILD_PROP_OPACITY -}; - -#define GHB_COMPOSITOR_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE((obj), GHB_TYPE_COMPOSITOR, GhbCompositorPrivate) - -static void ghb_compositor_finalize (GObject *object); -static void ghb_compositor_realize (GtkWidget *widget); -static void ghb_compositor_unrealize (GtkWidget *widget); -static void ghb_compositor_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static gboolean ghb_compositor_draw (GtkWidget *widget, - cairo_t *cr); -static void ghb_compositor_get_preferred_width(GtkWidget *widget, - gint *minimum_size, - gint *natural_size); -static void ghb_compositor_get_preferred_height(GtkWidget *widget, - gint *minimum_size, - gint *natural_size); -static void ghb_compositor_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void ghb_compositor_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void ghb_compositor_add (GtkContainer *container, - GtkWidget *widget); -static void ghb_compositor_remove (GtkContainer *container, - GtkWidget *widget); -static void ghb_compositor_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer data); -static GType ghb_compositor_child_type (GtkContainer *container); -static void ghb_compositor_set_child_property (GtkContainer *container, - GtkWidget *child, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void ghb_compositor_get_child_property (GtkContainer *container, - GtkWidget *child, - guint prop_id, - GValue *value, - GParamSpec *pspec); - -G_DEFINE_TYPE (GhbCompositor, ghb_compositor, GTK_TYPE_BIN) - -static void -ghb_compositor_class_init (GhbCompositorClass *class) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (class); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); - GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class); - - gobject_class->finalize = ghb_compositor_finalize; - - gobject_class->set_property = ghb_compositor_set_property; - gobject_class->get_property = ghb_compositor_get_property; - - widget_class->draw = ghb_compositor_draw; - widget_class->get_preferred_width = ghb_compositor_get_preferred_width; - widget_class->get_preferred_height = ghb_compositor_get_preferred_height; - widget_class->size_allocate = ghb_compositor_size_allocate; - - widget_class->realize = ghb_compositor_realize; - widget_class->unrealize = ghb_compositor_unrealize; - - container_class->add = ghb_compositor_add; - container_class->remove = ghb_compositor_remove; - container_class->forall = ghb_compositor_forall; - container_class->child_type = ghb_compositor_child_type; - container_class->set_child_property = ghb_compositor_set_child_property; - container_class->get_child_property = ghb_compositor_get_child_property; - - gtk_container_class_install_child_property (container_class, - CHILD_PROP_Z_POS, - g_param_spec_uint ("z-pos", - "Position in Z-List", - "Sets the blending order of the child.", - 0, 65535, 0, - G_PARAM_READWRITE)); - - gtk_container_class_install_child_property (container_class, - CHILD_PROP_OPACITY, - g_param_spec_double ("opacity", - "Opacity", - "Sets the opacity of the child.", - 0.0, 1.0, 1.0, - G_PARAM_READWRITE)); - -} - -static GType -ghb_compositor_child_type(GtkContainer *container) -{ - return GTK_TYPE_WIDGET; -} - -static void -ghb_compositor_get_property ( - GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - switch (prop_id) - { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -ghb_compositor_set_property ( - GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - switch (prop_id) - { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static gint -zsort(gconstpointer a, gconstpointer b) -{ - GhbCompositorChild *cca, *ccb; - - cca = (GhbCompositorChild*)a; - ccb = (GhbCompositorChild*)b; - - return (cca->z_pos - ccb->z_pos); -} - -static void -ghb_compositor_set_child_property( - GtkContainer *container, - GtkWidget *child, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GhbCompositor *compositor; - GhbCompositorChild *cc; - GList *link; - - compositor = GHB_COMPOSITOR(container); - - for (link = compositor->children; link != NULL; link = link->next) - { - cc = (GhbCompositorChild*)link->data; - if (cc->widget == child) - break; - } - if (link == NULL) - { - GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(container, prop_id, pspec); - return; - } - - switch (prop_id) - { - case CHILD_PROP_Z_POS: - { - cc->z_pos = g_value_get_uint(value); - compositor->children = g_list_sort(compositor->children, zsort); - } break; - case CHILD_PROP_OPACITY: - { - cc->opacity = g_value_get_double(value); - } break; - default: - GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(container, prop_id, pspec); - break; - } - - if (gtk_widget_get_visible (child) && - gtk_widget_get_visible (GTK_WIDGET(compositor))) - { - gtk_widget_queue_resize (child); - } - -} - -static void -ghb_compositor_get_child_property( - GtkContainer *container, - GtkWidget *child, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - GhbCompositor *compositor; - GhbCompositorChild *cc; - GList *link; - - compositor = GHB_COMPOSITOR(container); - - for (link = compositor->children; link != NULL; link = link->next) - { - cc = (GhbCompositorChild*)link->data; - if (cc->widget == child) - break; - } - if (link == NULL) - { - GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(container, prop_id, pspec); - return; - } - - switch (prop_id) - { - case CHILD_PROP_Z_POS: - { - g_value_set_uint(value, cc->z_pos); - } break; - case CHILD_PROP_OPACITY: - { - g_value_set_double(value, cc->opacity); - } break; - default: - GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(container, prop_id, pspec); - break; - } -} - -static void -ghb_compositor_init (GhbCompositor *compositor) -{ - gtk_widget_set_has_window(GTK_WIDGET(compositor), TRUE); -} - -GtkWidget* -ghb_compositor_new (void) -{ - return GTK_WIDGET(g_object_new (GHB_TYPE_COMPOSITOR, NULL)); -} - -#if 0 -static void -showtype(const gchar *msg, GtkWidget *widget) -{ - GType type; - gchar *str; - - type = G_OBJECT_TYPE(widget); - if (type == GTK_TYPE_DRAWING_AREA) - str = "drawing area"; - else if (type == GTK_TYPE_ALIGNMENT) - str = "alignment"; - else if (type == GTK_TYPE_EVENT_BOX) - str = "event box"; - else if (type == GTK_TYPE_EVENT_BOX) - str = "event box"; - else - str = "unknown"; - g_message("%s: %s", msg, str); -} -#endif - -static void -find_drawables(GtkWidget *widget, gpointer data) -{ - GList *drawables, **pdrawables; - pdrawables = (GList**)data; - drawables = *pdrawables; - - if (gtk_widget_get_has_window(widget)) - { - drawables = g_list_append(drawables, widget); - *pdrawables = drawables; - return; - } - if (GTK_IS_CONTAINER(widget)) - { - gtk_container_forall(GTK_CONTAINER(widget), find_drawables, data); - } -} - - -/** - * ghb_compositor_zlist_insert: - * @compositor: a #GhbCompositor - * @child: widgets to insert - * @z_pos: position - * @opacity: global opacity for this widget - * - * Insert in the given position of the zlist in the compositor. - * All children in the zlist must have associated GdkDrawable's - * This means they must be GtkDrawingArea or GtkEventBox - * - **/ -void -ghb_compositor_zlist_insert ( - GhbCompositor *compositor, - GtkWidget *child, - gint z_pos, - gdouble opacity) -{ - GhbCompositorChild *cc; - GdkDisplay *display; - - g_return_if_fail (GHB_IS_COMPOSITOR (compositor)); - g_return_if_fail (GTK_IS_WIDGET (child)); - g_return_if_fail (gtk_widget_get_parent(child) == NULL); - - gtk_widget_set_parent(child, GTK_WIDGET(compositor)); - - display = gtk_widget_get_display (GTK_WIDGET(compositor)); - - cc = g_new(GhbCompositorChild, 1); - cc->widget = child; - cc->z_pos = z_pos; - cc->opacity = opacity; - cc->drawables = NULL; - compositor->children = g_list_insert_sorted( - compositor->children, cc, zsort); - - if (gdk_display_supports_composite(display)) - { - GList *link; - - cc->drawables = NULL; - find_drawables(cc->widget, &cc->drawables); - - for (link = cc->drawables; link != NULL; link = link->next) - { - gtk_widget_realize(GTK_WIDGET(link->data)); - gdk_window_set_composited(gtk_widget_get_window(GTK_WIDGET(link->data)), TRUE); - } - } -} - -static void -ghb_compositor_add(GtkContainer *container, GtkWidget *child) -{ - GhbCompositor *compositor = GHB_COMPOSITOR(container); - GhbCompositorChild *cc; - gint z_pos = 0; - GList *last = g_list_last(compositor->children); - - if (last != NULL) - { - cc = (GhbCompositorChild*)last->data; - z_pos = cc->z_pos + 1; - } - ghb_compositor_zlist_insert(compositor, child, z_pos, 1.0); -} - -static void -ghb_compositor_remove(GtkContainer *container, GtkWidget *child) -{ - GhbCompositor *compositor = GHB_COMPOSITOR(container); - GhbCompositorChild *cc; - GList *link; - - for (link = compositor->children; link != NULL; link = link->next) - { - cc = (GhbCompositorChild*)link->data; - if (cc->widget == child) - { - gboolean was_visible = gtk_widget_get_visible( child ); - gtk_widget_unparent(child); - compositor->children = g_list_remove_link( - compositor->children, link); - g_list_free(link); - g_free(cc); - - if (was_visible && gtk_widget_get_visible (GTK_WIDGET(container))) - gtk_widget_queue_resize(GTK_WIDGET(container)); - break; - } - } -} - -static void -ghb_compositor_forall( - GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer data) -{ - GhbCompositor *compositor = GHB_COMPOSITOR (container); - GhbCompositorChild *cc; - GList *link, *next; - - for (link = compositor->children; link != NULL; ) - { - // The callback may cause the link to be removed from the list. - // So find next before calling callback - next = link->next; - cc = (GhbCompositorChild*)link->data; - (*callback)(cc->widget, data); - link = next; - } -} - -static void -ghb_compositor_finalize (GObject *object) -{ - GhbCompositor *compositor = GHB_COMPOSITOR (object); - GhbCompositorChild *cc; - GList *link; - - for (link = compositor->children; link != NULL; link = link->next) - { - cc = (GhbCompositorChild*)link->data; - g_list_free(cc->drawables); - g_free(cc); - } - g_list_free(compositor->children); - G_OBJECT_CLASS (ghb_compositor_parent_class)->finalize (object); -} - - -static void -ghb_compositor_realize (GtkWidget *widget) -{ - GdkWindowAttr attributes; - gint attributes_mask; - gint border_width; - gboolean visible_window; - - gtk_widget_set_realized(widget, TRUE); - - border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); - - GtkAllocation allocation; - gtk_widget_get_allocation(widget, &allocation); - - attributes.x = allocation.x + border_width; - attributes.y = allocation.y + border_width; - attributes.width = allocation.width - 2*border_width; - attributes.height = allocation.height - 2*border_width; - attributes.window_type = GDK_WINDOW_CHILD; - attributes.event_mask = gtk_widget_get_events (widget) - | GDK_BUTTON_MOTION_MASK - | GDK_BUTTON_PRESS_MASK - | GDK_BUTTON_RELEASE_MASK - | GDK_EXPOSURE_MASK - | GDK_ENTER_NOTIFY_MASK - | GDK_LEAVE_NOTIFY_MASK; - - visible_window = gtk_widget_get_has_window(widget); - - GdkWindow *window; - if (visible_window) - { - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; - attributes.visual = gtk_widget_get_visual (widget); - attributes.wclass = GDK_INPUT_OUTPUT; - - - window = gdk_window_new(gtk_widget_get_parent_window (widget), - &attributes, attributes_mask); - gtk_widget_set_window(widget, window); - gdk_window_set_user_data(window, widget); - } - else - { - window = gtk_widget_get_parent_window (widget); - gtk_widget_set_window(widget, window); - g_object_ref (window); - } -} - -static void -ghb_compositor_unrealize (GtkWidget *widget) -{ - GTK_WIDGET_CLASS (ghb_compositor_parent_class)->unrealize (widget); -} - -static void -ghb_compositor_get_preferred_width( - GtkWidget *widget, - gint *minimum_size, - gint *natural_size) -{ - GhbCompositor *compositor = GHB_COMPOSITOR (widget); - GList *link; - GhbCompositorChild *cc; - gint width = 0; - GtkRequisition min_size, size; - - for (link = compositor->children; link != NULL; link = link->next) - { - cc = (GhbCompositorChild*)link->data; - if (gtk_widget_get_visible(cc->widget)) - { - gtk_widget_get_preferred_size(cc->widget, &min_size, &size); - width = MAX(MAX(min_size.width, size.width), width); - } - } - - *minimum_size = width + gtk_container_get_border_width(GTK_CONTAINER (widget)) * 2; - *natural_size = width + gtk_container_get_border_width(GTK_CONTAINER (widget)) * 2; -} - -static void -ghb_compositor_get_preferred_height( - GtkWidget *widget, - gint *minimum_size, - gint *natural_size) -{ - GhbCompositor *compositor = GHB_COMPOSITOR (widget); - GList *link; - GhbCompositorChild *cc; - gint height = 0; - GtkRequisition min_size, size; - - for (link = compositor->children; link != NULL; link = link->next) - { - cc = (GhbCompositorChild*)link->data; - if (gtk_widget_get_visible(cc->widget)) - { - gtk_widget_get_preferred_size(cc->widget, &min_size, &size); - height = MAX(MAX(min_size.height, size.height), height); - } - } - - *minimum_size = height + gtk_container_get_border_width(GTK_CONTAINER (widget)) * 2; - *natural_size = height + gtk_container_get_border_width(GTK_CONTAINER (widget)) * 2; -} - -static void -ghb_compositor_size_allocate (GtkWidget *widget, GtkAllocation *allocation) -{ - GhbCompositor *compositor; - GtkAllocation child_allocation; - GhbCompositorChild *cc; - GList *link; - - gtk_widget_set_allocation(widget, allocation); - compositor = GHB_COMPOSITOR (widget); - - if (!gtk_widget_get_has_window(widget)) - { - child_allocation.x = allocation->x + - gtk_container_get_border_width(GTK_CONTAINER(widget)); - child_allocation.y = allocation->y + - gtk_container_get_border_width(GTK_CONTAINER(widget)); - } - else - { - child_allocation.x = 0; - child_allocation.y = 0; - } - - child_allocation.width = MAX (allocation->width - - gtk_container_get_border_width(GTK_CONTAINER (widget)) * 2, 0); - child_allocation.height = MAX (allocation->height - - gtk_container_get_border_width(GTK_CONTAINER (widget)) * 2, 0); - - if (gtk_widget_get_realized(widget)) - { - if (gtk_widget_get_has_window(widget)) - { - gdk_window_move_resize (gtk_widget_get_window(widget), - allocation->x + gtk_container_get_border_width(GTK_CONTAINER (widget)), - allocation->y + gtk_container_get_border_width(GTK_CONTAINER (widget)), - child_allocation.width, - child_allocation.height); - } - } - for (link = compositor->children; link != NULL; link = link->next) - { - cc = (GhbCompositorChild*)link->data; - if (gtk_widget_get_realized (cc->widget)) - gtk_widget_size_allocate (cc->widget, &child_allocation); - } -} - -#if 0 -static void showrects(cairo_region_t *region) -{ - cairo_rectangle_int_t rect; - int ii; - int count = cairo_region_num_rectangles(region); - - printf("rect count %d\n", count); - for (ii = 0; ii < count; ii++) - { - cairo_region_get_rectangle(region, ii, &rect); - printf("rect %d: %d,%d %dx%d\n", - ii, rect.x, rect.y, rect.width, rect.height); - } -} -#endif - -static void -ghb_compositor_blend (GtkWidget *widget, cairo_t *cr) -{ - GhbCompositor *compositor = GHB_COMPOSITOR (widget); - GList *link, *draw; - cairo_region_t *region; - GtkWidget *child; - GhbCompositorChild *cc; - - if (compositor->children == NULL) return; - /* create a cairo context to draw to the window */ - - for (link = compositor->children; link != NULL; link = link->next) - { - cc = (GhbCompositorChild*)link->data; - for (draw = cc->drawables; draw != NULL; draw = draw->next) - { - GtkAllocation child_alloc; - - /* get our child */ - child = GTK_WIDGET(draw->data); - - if ( -//!gtk_cairo_should_draw_window(cr, gtk_widget_get_window(child)) || - !gtk_widget_get_visible(cc->widget) || - !gtk_widget_get_visible(child)) - continue; - - gtk_widget_get_allocation(child, &child_alloc); - cairo_save(cr); - - /* the source data is the (composited) event box */ - gdk_cairo_set_source_window(cr, gtk_widget_get_window(child), - child_alloc.x, - child_alloc.y); - - cairo_rectangle_int_t rect; - - rect.x = child_alloc.x; - rect.y = child_alloc.y; - rect.width = child_alloc.width; - rect.height = child_alloc.height; - - /* draw no more than our expose event intersects our child */ - region = cairo_region_create_rectangle(&rect); - - cairo_region_t *dregion = gdk_window_get_visible_region( - gtk_widget_get_window(child)); - cairo_region_translate(dregion, child_alloc.x, child_alloc.y); - cairo_region_intersect(region, dregion); - cairo_region_destroy(dregion); - - gdk_cairo_region(cr, region); - cairo_region_destroy(region); - cairo_clip(cr); - - /* composite, with an opacity */ - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); - cairo_paint_with_alpha(cr, cc->opacity); - - cairo_restore(cr); - } - } - /* we're done */ -} - -static gboolean -ghb_compositor_draw(GtkWidget *widget, cairo_t *cr) -{ - if (gtk_widget_is_drawable(widget)) - { - if (gtk_widget_get_has_window(widget)) - ghb_compositor_blend (widget, cr); - - } - GTK_WIDGET_CLASS(ghb_compositor_parent_class)->draw(widget, cr); - - return FALSE; -} diff --git a/gtk/src/ghbcompositor.h b/gtk/src/ghbcompositor.h deleted file mode 100644 index 7f6914e93..000000000 --- a/gtk/src/ghbcompositor.h +++ /dev/null @@ -1,74 +0,0 @@ -/* "Borrowed" from: */ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ -#ifndef __GHB_COMPOSITOR_H__ -#define __GHB_COMPOSITOR_H__ - - -#include <gtk/gtk.h> - - -G_BEGIN_DECLS - -#define GHB_TYPE_COMPOSITOR (ghb_compositor_get_type ()) -#define GHB_COMPOSITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHB_TYPE_COMPOSITOR, GhbCompositor)) -#define GHB_COMPOSITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHB_TYPE_COMPOSITOR, GhbCompositorClass)) -#define GHB_IS_COMPOSITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHB_TYPE_COMPOSITOR)) -#define GHB_IS_COMPOSITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GHB_TYPE_COMPOSITOR)) -#define GHB_COMPOSITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GHB_TYPE_COMPOSITOR, GhbCompositorClass)) - -typedef struct _GhbCompositor GhbCompositor; -typedef struct _GhbCompositorClass GhbCompositorClass; -typedef struct _GhbCompositorChild GhbCompositorChild; - -struct _GhbCompositor -{ - GtkBin bin; - GList *children; -}; - -struct _GhbCompositorClass -{ - GtkBinClass parent_class; -}; - -struct _GhbCompositorChild -{ - GtkWidget *widget; - GList *drawables; - guint z_pos; - gdouble opacity; -}; - -GType ghb_compositor_get_type (void) G_GNUC_CONST; -GtkWidget* ghb_compositor_new (void); -void ghb_compositor_zlist_insert (GhbCompositor *compositor, - GtkWidget *child, - gint z_pos, gdouble opacity); - -G_END_DECLS - -#endif /* __GHB_COMPOSITOR_H__ */ diff --git a/gtk/src/main.c b/gtk/src/main.c index 2ccee63c3..255bcae9a 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -66,7 +66,6 @@ #include "resources.h" #include "presets.h" #include "preview.h" -#include "ghbcompositor.h" #include "ui_res.h" @@ -912,8 +911,8 @@ main(int argc, char *argv[]) // Since GtkBuilder no longer assigns object ids to widget names // Assign a few that are necessary for style overrides to work - GtkWidget *widget; #if defined(_NO_UPDATE_CHECK) + GtkWidget *widget; widget = GHB_WIDGET(ud->builder, "check_updates_box"); gtk_widget_hide(widget); #endif @@ -929,51 +928,6 @@ main(int argc, char *argv[]) gtk_widget_set_name(GHB_WIDGET(ud->builder, "preview_show_crop"), "preview_show_crop"); gtk_widget_set_name(GHB_WIDGET(ud->builder, "preview_fullscreen"), "preview_fullscreen"); gtk_widget_set_name(GHB_WIDGET(ud->builder, "activity_view"), "activity_view"); - widget = GHB_WIDGET(ud->builder, "preview_hud"); - gtk_widget_set_name(widget, "preview_hud"); - widget = GHB_WIDGET(ud->builder, "preview_window"); - gtk_widget_set_name(widget, "preview_window"); - - // Set up the "hud" control overlay for the preview window - GtkWidget *preview_box, *draw, *hud, *blender; - - preview_box = GHB_WIDGET(ud->builder, "preview_window_box"); - draw = GHB_WIDGET(ud->builder, "preview_image"); - hud = GHB_WIDGET(ud->builder, "preview_hud"); - -#if 0 // GTK_CHECK_VERSION(3, 0, 0) - // This uses the new GtkOverlay widget. - // - // Unfortunately, GtkOverlay is broken in a couple of ways. - // - // First, it doesn't respect gtk_widget_shape_combine_region() - // on it's child overlays. It appears to just ignore the clip - // mask of the child. - // - // Second, it doesn't respect window opacity. - // - // So for now, I'll just continue using my home-grown overlay - // widget (GhbCompositor). - blender = gtk_overlay_new(); - gtk_container_add(GTK_CONTAINER(preview_box), blender); - gtk_container_add(GTK_CONTAINER(blender), draw); - gtk_widget_set_valign (hud, GTK_ALIGN_END); - gtk_widget_set_halign (hud, GTK_ALIGN_CENTER); - gtk_overlay_add_overlay(GTK_OVERLAY(blender), hud); - - g_signal_connect(G_OBJECT(blender), "get-child-position", - G_CALLBACK(position_overlay_cb), ud); - - gtk_widget_show(blender); -#else - // Set up compositing for hud - blender = ghb_compositor_new(); - - gtk_container_add(GTK_CONTAINER(preview_box), blender); - ghb_compositor_zlist_insert(GHB_COMPOSITOR(blender), draw, 1, 1); - ghb_compositor_zlist_insert(GHB_COMPOSITOR(blender), hud, 2, .85); - gtk_widget_show(blender); -#endif // Redirect stderr to the activity window ghb_preview_init(ud); diff --git a/gtk/src/preview.c b/gtk/src/preview.c index b4bcc4fe2..656bd18a5 100644 --- a/gtk/src/preview.c +++ b/gtk/src/preview.c @@ -77,9 +77,6 @@ static GstBusSyncReply create_window(GstBus *bus, GstMessage *msg, gpointer data); #endif -G_MODULE_EXPORT gboolean preview_expose_cb(GtkWidget *widget, GdkEventExpose *event, - signal_user_data_t *ud); - void ghb_screen_par(signal_user_data_t *ud, gint *par_n, gint *par_d) { @@ -152,6 +149,27 @@ ghb_par_scale(signal_user_data_t *ud, gint *width, gint *height, gint par_n, gin *height = *height * den / num; } +static GdkWindow* +preview_window(GtkWidget *widget) +{ + return gtk_layout_get_bin_window(GTK_LAYOUT(widget)); +} + +void +preview_set_size(signal_user_data_t *ud, int width, int height) +{ + GtkWidget *widget; + + widget = GHB_WIDGET (ud->builder, "preview_image"); + gtk_widget_set_size_request(widget, width, height); + gtk_layout_set_size(GTK_LAYOUT(widget), width, height); + widget = GHB_WIDGET (ud->builder, "preview_hud_box"); + gtk_widget_set_size_request(widget, width, height); + + ud->preview->width = width; + ud->preview->height = height; +} + void ghb_preview_init(signal_user_data_t *ud) { @@ -160,20 +178,18 @@ ghb_preview_init(signal_user_data_t *ud) ud->preview = g_malloc0(sizeof(preview_t)); ud->preview->view = GHB_WIDGET(ud->builder, "preview_image"); gtk_widget_realize(ud->preview->view); - g_signal_connect(G_OBJECT(ud->preview->view), "draw", - G_CALLBACK(preview_expose_cb), ud); ud->preview->pause = TRUE; ud->preview->encode_frame = -1; ud->preview->live_id = -1; - widget = GHB_WIDGET (ud->builder, "preview_button_image"); + widget = GHB_WIDGET(ud->builder, "preview_button_image"); gtk_widget_get_size_request(widget, &ud->preview->button_width, &ud->preview->button_height); #if defined(_ENABLE_GST) GstBus *bus; GstElement *xover; - if (!gdk_window_ensure_native(gtk_widget_get_window(ud->preview->view))) + if (!gdk_window_ensure_native(preview_window(ud->preview->view))) { g_message("Couldn't create native window for GstXOverlay. Disabling live preview."); GtkWidget *widget = GHB_WIDGET(ud->builder, "live_preview_box"); @@ -182,11 +198,19 @@ ghb_preview_init(signal_user_data_t *ud) gtk_widget_hide (widget); return; } + widget = GHB_WIDGET(ud->builder, "preview_hud"); + gtk_widget_realize(widget); + // Use a native window for the HUD. Client side windows don't get + // updated properly as video changes benieth them. + if (!gdk_window_ensure_native(gtk_widget_get_window(widget))) + { + g_message("Couldn't create native window for HUD."); + } #if !defined(_WIN32) - ud->preview->xid = GDK_WINDOW_XID(gtk_widget_get_window(ud->preview->view)); + ud->preview->xid = GDK_WINDOW_XID(preview_window(ud->preview->view)); #else - ud->preview->xid = GDK_WINDOW_HWND(gtk_widget_get_window(ud->preview->view)); + ud->preview->xid = GDK_WINDOW_HWND(preview_window(ud->preview->view)); #endif ud->preview->play = gst_element_factory_make("playbin", "play"); xover = gst_element_factory_make("gconfvideosink", "xover"); @@ -331,9 +355,7 @@ caps_set(GstCaps *caps, signal_user_data_t *ud) if (width != ud->preview->width || height != ud->preview->height) { - gtk_widget_set_size_request(ud->preview->view, width, height); - ud->preview->width = width; - ud->preview->height = height; + preview_set_size(ud, width, height); } } } @@ -909,14 +931,10 @@ live_preview_seek_cb(GtkWidget *widget, signal_user_data_t *ud) #endif } -static void _draw_pixbuf(GdkWindow *window, GdkPixbuf *pixbuf) +static void _draw_pixbuf(cairo_t *cr, GdkPixbuf *pixbuf) { - cairo_t *cr; - - cr = gdk_cairo_create(window); gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); cairo_paint(cr); - cairo_destroy(cr); } void @@ -965,11 +983,9 @@ ghb_set_preview_image(signal_user_data_t *ud) if (preview_width != ud->preview->width || preview_height != ud->preview->height) { - gtk_widget_set_size_request(widget, preview_width, preview_height); - ud->preview->width = preview_width; - ud->preview->height = preview_height; + preview_set_size(ud, preview_width, preview_height); } - _draw_pixbuf(gtk_widget_get_window(widget), ud->preview->pix); + gtk_widget_queue_draw(widget); gchar *text = g_strdup_printf("%d x %d", width, height); widget = GHB_WIDGET (ud->builder, "preview_dims"); @@ -1000,6 +1016,75 @@ ghb_set_preview_image(signal_user_data_t *ud) } } +static cairo_region_t* +curved_rect_mask(GtkWidget *widget) +{ + GdkWindow *window; + cairo_region_t *shape; + cairo_surface_t *surface; + cairo_t *cr; + double w, h; + int radius; + + if (!gtk_widget_get_realized(widget)) + return NULL; + + window = gtk_widget_get_window(widget); + w = gdk_window_get_width(window); + h = gdk_window_get_height(window); + if (w <= 50 || h <= 50) + return NULL; + radius = h / 4; + surface = gdk_window_create_similar_surface(window, + CAIRO_CONTENT_COLOR_ALPHA, + w, h); + cr = cairo_create (surface); + + if (radius > w / 2) + radius = w / 2; + if (radius > h / 2) + radius = h / 2; + + // fill shape with black + cairo_save(cr); + cairo_rectangle (cr, 0, 0, w, h); + cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); + cairo_fill (cr); + cairo_restore (cr); + + cairo_move_to (cr, 0, radius); + cairo_curve_to (cr, 0 , 0, 0 , 0, radius, 0); + cairo_line_to (cr, w - radius, 0); + cairo_curve_to (cr, w, 0, w, 0, w, radius); + cairo_line_to (cr, w , h - radius); + cairo_curve_to (cr, w, h, w, h, w - radius, h); + cairo_line_to (cr, 0 + radius, h); + cairo_curve_to (cr, 0, h, 0, h, 0, h - radius); + + cairo_close_path(cr); + + cairo_set_source_rgb(cr, 1, 1, 1); + cairo_fill(cr); + + cairo_destroy(cr); + shape = gdk_cairo_region_create_from_surface(surface); + cairo_surface_destroy(surface); + + return shape; +} + +static void +hud_update_shape(GtkWidget *widget) +{ + cairo_region_t *shape; + shape = curved_rect_mask(widget); + if (shape != NULL) + { + gtk_widget_shape_combine_region(widget, shape); + cairo_region_destroy(shape); + } +} + #if defined(_ENABLE_GST) #if GST_CHECK_VERSION(1, 0, 0) G_MODULE_EXPORT gboolean @@ -1052,33 +1137,10 @@ delayed_expose_cb(signal_user_data_t *ud) #endif #endif -#if 0 // GTK_CHECK_VERSION(3, 0, 0) -// -// Only needed if the problems with GtkOverlay are ever resolved -// G_MODULE_EXPORT gboolean -position_overlay_cb( - GtkWidget *overlay, +preview_draw_cb( GtkWidget *widget, - GdkRectangle *rect, - signal_user_data_t *ud) -{ - GtkRequisition min_size, size; - gtk_widget_get_preferred_size(widget, &min_size, &size); - - rect->width = MAX(min_size.width, size.width); - rect->height = MAX(min_size.height, size.height); - rect->x = MAX(0, ud->preview->width / 2 - rect->width / 2); - rect->y = MAX(0, ud->preview->height - rect->height - 50); - - return TRUE; -} -#endif - -G_MODULE_EXPORT gboolean -preview_expose_cb( - GtkWidget *widget, - GdkEventExpose *event, + cairo_t *cr, signal_user_data_t *ud) { #if defined(_ENABLE_GST) @@ -1101,9 +1163,8 @@ preview_expose_cb( // cleaned up here. But a delayed gst_x_overlay_expose() // takes care of it. g_idle_add((GSourceFunc)delayed_expose_cb, ud); - return FALSE; } - return TRUE; + return FALSE; } #else if (ud->preview->live_enabled && ud->preview->state == PREVIEW_STATE_LIVE) @@ -1124,19 +1185,17 @@ preview_expose_cb( // cleaned up here. But a delayed gst_x_overlay_expose() // takes care of it. g_idle_add((GSourceFunc)delayed_expose_cb, ud); - return FALSE; } - return TRUE; + return FALSE; } #endif #endif if (ud->preview->pix != NULL) { - _draw_pixbuf(gtk_widget_get_window(ud->preview->view), ud->preview->pix); - //_draw_pixbuf(gtk_widget_get_window(widget), ud->preview->pix); + _draw_pixbuf(cr, ud->preview->pix); } - return TRUE; + return FALSE; } G_MODULE_EXPORT void @@ -1293,13 +1352,14 @@ hud_timeout(signal_user_data_t *ud) return FALSE; } +static gboolean in_hud = FALSE; + G_MODULE_EXPORT gboolean hud_enter_cb( GtkWidget *widget, GdkEventCrossing *event, signal_user_data_t *ud) { - g_debug("hud_enter_cb()"); if (hud_timeout_id != 0) { GMainContext *mc; @@ -1311,8 +1371,22 @@ hud_enter_cb( g_source_destroy(source); } widget = GHB_WIDGET(ud->builder, "preview_hud"); - gtk_widget_show(widget); + if (!gtk_widget_get_visible(widget)) + { + gtk_widget_show(widget); + } hud_timeout_id = 0; + in_hud = TRUE; + return FALSE; +} + +G_MODULE_EXPORT gboolean +hud_leave_cb( + GtkWidget *widget, + GdkEventCrossing *event, + signal_user_data_t *ud) +{ + in_hud = FALSE; return FALSE; } @@ -1322,7 +1396,6 @@ preview_leave_cb( GdkEventCrossing *event, signal_user_data_t *ud) { - g_debug("hud_leave_cb()"); if (hud_timeout_id != 0) { GMainContext *mc; @@ -1343,7 +1416,6 @@ preview_motion_cb( GdkEventMotion *event, signal_user_data_t *ud) { - //g_debug("hud_motion_cb %d", hud_timeout_id); if (hud_timeout_id != 0) { GMainContext *mc; @@ -1359,78 +1431,20 @@ preview_motion_cb( { gtk_widget_show(widget); } - hud_timeout_id = g_timeout_add_seconds(4, (GSourceFunc)hud_timeout, ud); + if (!in_hud) + { + hud_timeout_id = g_timeout_add_seconds(4, (GSourceFunc)hud_timeout, ud); + } return FALSE; } -cairo_region_t* -ghb_curved_rect_mask(gint width, gint height, gint radius) -{ - cairo_region_t *shape; - cairo_surface_t *surface; - cairo_t *cr; - double w, h; - - if (!width || !height) - return NULL; - - surface = cairo_image_surface_create(CAIRO_FORMAT_A8, width, height); - cr = cairo_create (surface); - - w = width; - h = height; - if (radius > width / 2) - radius = width / 2; - if (radius > height / 2) - radius = height / 2; - - // fill shape with black - cairo_save(cr); - cairo_rectangle (cr, 0, 0, width, height); - cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); - cairo_fill (cr); - cairo_restore (cr); - - cairo_move_to (cr, 0, radius); - cairo_curve_to (cr, 0 , 0, 0 , 0, radius, 0); - cairo_line_to (cr, w - radius, 0); - cairo_curve_to (cr, w, 0, w, 0, w, radius); - cairo_line_to (cr, w , h - radius); - cairo_curve_to (cr, w, h, w, h, w - radius, h); - cairo_line_to (cr, 0 + radius, h); - cairo_curve_to (cr, 0, h, 0, h, 0, h - radius); - - cairo_close_path(cr); - - cairo_set_source_rgb(cr, 1, 1, 1); - cairo_fill(cr); - - cairo_destroy(cr); - shape = gdk_cairo_region_create_from_surface(surface); - cairo_surface_destroy(surface); - - return shape; -} - G_MODULE_EXPORT void -preview_hud_size_alloc_cb( +hud_size_alloc_cb( GtkWidget *widget, GtkAllocation *allocation, signal_user_data_t *ud) { - cairo_region_t *shape; - - //g_message("preview_hud_size_alloc_cb()"); - if (gtk_widget_get_visible(widget) && allocation->height > 50) - { - shape = ghb_curved_rect_mask(allocation->width, - allocation->height, allocation->height/4); - if (shape != NULL) - { - gtk_widget_shape_combine_region(widget, shape); - cairo_region_destroy(shape); - } - } + hud_update_shape(widget); } G_MODULE_EXPORT gboolean @@ -1441,7 +1455,6 @@ preview_configure_cb( { gint x, y; - //g_message("preview_configure_cb()"); if (gtk_widget_get_visible(widget)) { gtk_window_get_position(GTK_WINDOW(widget), &x, &y); |