<property name="icon-name">hb-picture</property>
<property name="name">show_preview_menu</property>
<property name="label" translatable="yes">_Picture Settings</property>
- <signal handler="preview_menu_clicked_cb" name="activate"/>
+ <signal handler="picture_settings_alt_clicked_cb" name="activate"/>
</object>
</child>
<child>
<property name="tooltip-text" translatable="yes">Open Picture Settings</property>
<property name="label" translatable="yes">Picture Settings</property>
<property name="icon_name">hb-picture</property>
- <signal name="toggled" handler="preview_button_clicked_cb"/>
+ <signal name="toggled" handler="picture_settings_clicked_cb"/>
</object>
<packing>
<property name="expand">False</property>
<object class="GtkFrame" id="presets_frame">
<property name="visible">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="border_width">3</property>
<property name="label_xalign">0</property>
<property name="shadow_type">out</property>
<signal handler="presets_frame_size_allocate_cb" name="size_allocate"/>
</object>
</child>
</object>
- <object class="GtkWindow" id="preview_window">
- <property name="title" translatable="yes">Preview</property>
- <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <object class="GtkWindow" id="settings_window">
+ <property name="title" translatable="yes">Picture Settings</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
- <signal handler="preview_window_delete_cb" name="delete_event"/>
+ <property name="allow-grow">False</property>
+ <property name="transient-for">preview_window</property>
+ <property name="events">GDK_STRUCTURE_MASK</property>
+ <signal handler="settings_configure_cb" name="configure-event"/>
+ <signal handler="settings_window_delete_cb" name="delete_event"/>
<child>
- <object class="GtkHBox" id="hbox2">
+ <object class="GtkVBox" id="vbox40">
<property name="visible">True</property>
- <property name="spacing">4</property>
- <child>
- <object class="GtkVBox" id="vbox40">
- <property name="visible">True</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkAlignment" id="alignment52">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">2</property>
- <property name="bottom_padding">2</property>
- <property name="left_padding">2</property>
- <property name="right_padding">2</property>
- <child>
- <object class="GtkDrawingArea" id="preview_image">
- <property name="visible">True</property>
- <property name="app_paintable">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment53">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="left_padding">10</property>
- <property name="right_padding">10</property>
- <child>
- <object class="GtkHBox" id="hbox70">
- <property name="visible">True</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="relief">none</property>
- <signal name="clicked" handler="live_preview_start_cb"/>
- <child>
- <object class="GtkImage" id="live_preview_play_image">
- <property name="visible">True</property>
- <property name="stock">gtk-media-play</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHScale" 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"/>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="live_progress_box">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label71">
- <property name="height_request">1</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkProgressBar" id="live_encode_progress">
- <property name="height_request">16</property>
- <property name="visible">True</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="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label72">
- <property name="height_request">1</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment7">
- <property name="visible">True</property>
- <property name="bottom_padding">4</property>
- <property name="left_padding">10</property>
- <property name="right_padding">10</property>
- <child>
- <object class="GtkHBox" id="hbox26">
- <property name="visible">True</property>
- <property name="spacing">10</property>
- <child>
- <object class="GtkHBox" id="hbox27">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkLabel" id="label36">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Preview Frame:</b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="preview_frame">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="max_length">2</property>
- <property name="shadow_type">none</property>
- <property name="adjustment">adjustment19</property>
- <property name="numeric">True</property>
- <signal name="value_changed" handler="preview_frame_value_changed_cb"/>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox60">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkLabel" id="label37">
- <property name="visible">True</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="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="adjustment">adjustment21</property>
- <property name="numeric">True</property>
- <signal name="value_changed" handler="preview_duration_changed_cb"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="spacing">5</property>
<child>
- <object class="GtkVSeparator" id="vseparator2">
+ <object class="GtkCheckButton" id="show_preview">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip-text" translatable="yes">Open Preview Window</property>
+ <property name="label" translatable="yes">Show Preview</property>
+ <signal name="toggled" handler="preview_button_clicked_cb"/>
</object>
<packing>
<property name="expand">False</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
-
<child>
<object class="GtkNotebook" id="notebook1">
<property name="visible">True</property>
<property name="can_focus">True</property>
+
<child>
<object class="GtkAlignment" id="alignment54">
<property name="visible">True</property>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+
+ <object class="GtkWindow" id="preview_window">
+ <property name="title" translatable="yes">Preview</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="allow-grow">False</property>
+ <property name="events">GDK_STRUCTURE_MASK</property>
+ <signal handler="preview_configure_cb" name="configure-event"/>
+ <signal handler="preview_window_delete_cb" name="delete_event"/>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkVBox" id="vbox40">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkAlignment" id="alignment52">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">2</property>
+ <property name="bottom_padding">2</property>
+ <property name="left_padding">2</property>
+ <property name="right_padding">2</property>
+ <child>
+ <object class="GtkDrawingArea" id="preview_image">
+ <property name="visible">True</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>
+ <property name="app_paintable">True</property>
+ <signal name="motion-notify-event" handler="preview_motion_cb"/>
+ <signal name="leave-notify-event" handler="preview_leave_cb"/>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVSeparator" id="vseparator2">
+ <property name="visible">True</property>
+ </object>
+ <packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
+
+ </object>
+ </child>
+ </object>
+ <object class="GtkWindow" id="preview_hud">
+ <property name="default_width">500</property>
+ <property name="decorated">False</property>
+ <property name="opacity">.50</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</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"/>
+ <child>
+ <object class="GtkAlignment" id="alignment53">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="left_padding">10</property>
+ <property name="right_padding">10</property>
+ <property name="top_padding">5</property>
+ <property name="bottom_padding">5</property>
+
+ <child>
+ <object class="GtkVBox" id="vbox35">
+ <property name="visible">True</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="GtkHScale" id="preview_frame">
+ <property name="visible">True</property>
+ <property name="can_focus">True</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"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox70">
+ <property name="visible">True</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="relief">none</property>
+ <signal name="clicked" handler="live_preview_start_cb"/>
+ <child>
+ <object class="GtkImage" id="live_preview_play_image">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-play</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHScale" 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"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="live_progress_box">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label71">
+ <property name="height_request">1</property>
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkProgressBar" id="live_encode_progress">
+ <property name="height_request">16</property>
+ <property name="visible">True</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="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label72">
+ <property name="height_request">1</property>
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox26">
+ <property name="visible">True</property>
+ <property name="spacing">10</property>
+ <child>
+ <object class="GtkHBox" id="hbox60">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkLabel" id="label37">
+ <property name="visible">True</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="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="adjustment">adjustment21</property>
+ <property name="numeric">True</property>
+ <signal name="value_changed" handler="preview_duration_changed_cb"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="settings_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip-text" translatable="yes">Open Picture Settings</property>
+ <property name="label" translatable="yes">Settings</property>
+ <signal handler="picture_settings_alt2_clicked_cb" name="clicked"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+
</object>
</child>
</object>
return TRUE;
}
- gdk_draw_pixbuf(
- widget->window, NULL, ud->preview->pix, 0, 0, 0, 0,
- -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
+ if (ud->preview->pix != NULL)
+ {
+ gdk_draw_pixbuf(
+ widget->window, NULL, ud->preview->pix, 0, 0, 0, 0,
+ -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
+ }
return TRUE;
}
}
}
-void
+G_MODULE_EXPORT void
preview_button_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *widget = GHB_WIDGET (ud->builder, "preview_window");
- set_visible(widget, gtk_toggle_tool_button_get_active(
- GTK_TOGGLE_TOOL_BUTTON(xwidget)));
+ gint titleindex;
+
+ g_debug("preview_button_clicked_cb()");
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+ if (titleindex >= 0)
+ {
+ gint x, y;
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "preview_window");
+ x = ghb_settings_get_int(ud->settings, "preview_x");
+ y = ghb_settings_get_int(ud->settings, "preview_y");
+ if (x >= 0 && y >= 0)
+ gtk_window_move(GTK_WINDOW(widget), x, y);
+ set_visible(widget, gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(xwidget)));
+ }
+ ghb_widget_to_setting (ud->settings, xwidget);
+ ghb_check_dependency(ud, xwidget);
+ const gchar *name = gtk_widget_get_name(xwidget);
+ ghb_pref_save(ud->settings, name);
}
-void
-preview_menu_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+G_MODULE_EXPORT void
+picture_settings_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
- GtkWidget *widget = GHB_WIDGET (ud->builder, "preview_window");
- set_visible(widget, TRUE);
- widget = GHB_WIDGET (ud->builder, "show_picture");
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
+ GtkWidget *widget;
+ gboolean active;
+ gint x, y;
+
+ g_debug("picture_settings_clicked_cb()");
+ widget = GHB_WIDGET (ud->builder, "settings_window");
+ active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(xwidget));
+ x = ghb_settings_get_int(ud->settings, "settings_x");
+ y = ghb_settings_get_int(ud->settings, "settings_y");
+ if (x >= 0 && y >= 0)
+ gtk_window_move(GTK_WINDOW(widget), x, y);
+ set_visible(widget, active);
+ if (ghb_settings_get_boolean(ud->settings, "show_preview"))
+ {
+ widget = GHB_WIDGET (ud->builder, "preview_window");
+ x = ghb_settings_get_int(ud->settings, "preview_x");
+ y = ghb_settings_get_int(ud->settings, "preview_y");
+ if (x >= 0 && y >= 0)
+ gtk_window_move(GTK_WINDOW(widget), x, y);
+ set_visible(widget, active);
+ }
+}
+
+G_MODULE_EXPORT void
+picture_settings_alt_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+{
+ GtkWidget *toggle;
+ gboolean active;
+
+ g_debug("picture_settings_alt_clicked_cb()");
+ toggle = GHB_WIDGET (ud->builder, "show_picture");
+ active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(toggle));
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(toggle), !active);
+}
+
+G_MODULE_EXPORT void
+picture_settings_alt2_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+{
+ GtkWidget *toggle;
+ gboolean active;
+ gint signal_id;
+ gint handler_id = 0;
+
+ g_debug("picture_settings_alt2_clicked_cb()");
+ toggle = GHB_WIDGET (ud->builder, "show_picture");
+ active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(toggle));
+ if (active)
+ {
+ // I don't want deleting the settings window to also remove the
+ // preview window, but changing the toggle will do this, so temporarily
+ // ignore the toggled signal
+ signal_id = g_signal_lookup("toggled", GTK_TYPE_TOGGLE_TOOL_BUTTON);
+ if (signal_id > 0)
+ {
+ // Valid signal id found. This should always succeed.
+ handler_id = g_signal_handler_find((gpointer)toggle,
+ G_SIGNAL_MATCH_ID,
+ signal_id, 0, 0, 0, 0);
+ if (handler_id > 0)
+ {
+ // This should also always succeed
+ g_signal_handler_block ((gpointer)toggle, handler_id);
+ }
+ }
+ }
+
+ GtkWidget *widget = GHB_WIDGET (ud->builder, "settings_window");
+ gint x, y;
+
+ x = ghb_settings_get_int(ud->settings, "settings_x");
+ y = ghb_settings_get_int(ud->settings, "settings_y");
+ if (x >= 0 && y >= 0)
+ gtk_window_move(GTK_WINDOW(widget), x, y);
+ set_visible(widget, !active);
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(toggle), !active);
+
+ if (handler_id > 0)
+ {
+ g_signal_handler_unblock ((gpointer)toggle, handler_id);
+ }
}
void
{
live_preview_stop(ud);
gtk_widget_hide(widget);
+ return TRUE;
+}
+
+gboolean
+settings_window_delete_cb(
+ GtkWidget *widget,
+ GdkEvent *event,
+ signal_user_data_t *ud)
+{
+ gint signal_id;
+ gint handler_id = 0;
+
+ gtk_widget_hide(widget);
widget = GHB_WIDGET (ud->builder, "show_picture");
+
+ // I don't want deleting the settings window to also remove the
+ // preview window, but changing the toggle will do this, so temporarily
+ // ignore the toggled signal
+ signal_id = g_signal_lookup("toggled", GTK_TYPE_TOGGLE_TOOL_BUTTON);
+ if (signal_id > 0)
+ {
+ // Valid signal id found. This should always succeed.
+ handler_id = g_signal_handler_find((gpointer)widget, G_SIGNAL_MATCH_ID,
+ signal_id, 0, 0, 0, 0);
+ if (handler_id > 0)
+ {
+ // This should also always succeed
+ g_signal_handler_block ((gpointer)widget, handler_id);
+ }
+ }
+
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE);
+
+ if (handler_id > 0)
+ {
+ g_signal_handler_unblock ((gpointer)widget, handler_id);
+ }
return TRUE;
}
ghb_pref_save(ud->settings, name);
}
+static guint hud_timeout_id = 0;
+
+static gboolean
+hud_timeout(signal_user_data_t *ud)
+{
+ GtkWidget *widget;
+
+ widget = GHB_WIDGET(ud->builder, "preview_hud");
+ gtk_widget_hide(widget);
+ hud_timeout_id = 0;
+ return FALSE;
+}
+
+G_MODULE_EXPORT gboolean
+hud_enter_cb(
+ GtkWidget *widget,
+ GdkEventCrossing *event,
+ signal_user_data_t *ud)
+{
+ if (hud_timeout_id != 0)
+ {
+ GMainContext *mc;
+ GSource *source;
+
+ mc = g_main_context_default();
+ source = g_main_context_find_source_by_id(mc, hud_timeout_id);
+ if (source != NULL)
+ g_source_destroy(source);
+ }
+ widget = GHB_WIDGET(ud->builder, "preview_hud");
+ gtk_widget_show(widget);
+ hud_timeout_id = 0;
+ return FALSE;
+}
+
+G_MODULE_EXPORT gboolean
+preview_leave_cb(
+ GtkWidget *widget,
+ GdkEventCrossing *event,
+ signal_user_data_t *ud)
+{
+ if (hud_timeout_id != 0)
+ {
+ GMainContext *mc;
+ GSource *source;
+
+ mc = g_main_context_default();
+ source = g_main_context_find_source_by_id(mc, hud_timeout_id);
+ if (source != NULL)
+ g_source_destroy(source);
+ }
+ hud_timeout_id = g_timeout_add(300, (GSourceFunc)hud_timeout, ud);
+ return FALSE;
+}
+
+G_MODULE_EXPORT gboolean
+preview_motion_cb(
+ GtkWidget *widget,
+ GdkEventMotion *event,
+ signal_user_data_t *ud)
+{
+ if (hud_timeout_id != 0)
+ {
+ GMainContext *mc;
+ GSource *source;
+
+ mc = g_main_context_default();
+ source = g_main_context_find_source_by_id(mc, hud_timeout_id);
+ if (source != NULL)
+ g_source_destroy(source);
+ }
+ else
+ {
+ GtkWidget *widget;
+ GdkWindow *parent, *win;
+ gint pw, ph, w, h, x, y;
+
+ widget = GHB_WIDGET(ud->builder, "preview_image");
+ parent = gtk_widget_get_window(widget);
+ widget = GHB_WIDGET(ud->builder, "preview_hud");
+ win = gtk_widget_get_window(widget);
+ gtk_widget_show(widget);
+ gdk_drawable_get_size(GDK_DRAWABLE(parent), &pw, &ph);
+ gdk_drawable_get_size(GDK_DRAWABLE(win), &w, &h);
+ x = pw/2 - w/2;
+ if (ph/4 > h/2)
+ y = ph - ph/4 - h/2;
+ else
+ y = ph - h;
+ gdk_window_move(win, x, y);
+ }
+ hud_timeout_id = g_timeout_add_seconds(10, (GSourceFunc)hud_timeout, ud);
+ return FALSE;
+}
+
+G_MODULE_EXPORT gboolean
+preview_configure_cb(
+ GtkWidget *widget,
+ GdkEventConfigure *event,
+ signal_user_data_t *ud)
+{
+ gint x, y;
+
+ g_debug("preview_configure_cb()");
+ if (GTK_WIDGET_VISIBLE(widget))
+ {
+ gtk_window_get_position(GTK_WINDOW(widget), &x, &y);
+ ghb_settings_set_int(ud->settings, "preview_x", x);
+ ghb_settings_set_int(ud->settings, "preview_y", y);
+ ghb_pref_set(ud->settings, "preview_x");
+ ghb_pref_set(ud->settings, "preview_y");
+ ghb_prefs_store();
+ }
+ return FALSE;
+}
+
+G_MODULE_EXPORT gboolean
+settings_configure_cb(
+ GtkWidget *widget,
+ GdkEventConfigure *event,
+ signal_user_data_t *ud)
+{
+ gint x, y;
+
+ g_debug("settings_configure_cb()");
+ if (GTK_WIDGET_VISIBLE(widget))
+ {
+ gtk_window_get_position(GTK_WINDOW(widget), &x, &y);
+ ghb_settings_set_int(ud->settings, "settings_x", x);
+ ghb_settings_set_int(ud->settings, "settings_y", y);
+ ghb_pref_set(ud->settings, "settings_x");
+ ghb_pref_set(ud->settings, "settings_y");
+ ghb_prefs_store();
+ }
+ return FALSE;
+}
+