[gthumb/ext: 7/79] Added a fullscreen toolbar, hide the pointer after a timeout
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext: 7/79] Added a fullscreen toolbar, hide the pointer after a timeout
- Date: Sun, 2 Aug 2009 20:23:17 +0000 (UTC)
commit 233d2d143c583144d949fae1acaba1bae0f12ed1
Author: Paolo Bacchilega <paobac src gnome org>
Date: Mon Jun 15 13:26:11 2009 +0200
Added a fullscreen toolbar, hide the pointer after a timeout
extensions/file_viewer/gth-file-viewer-page.c | 9 ++
extensions/image_viewer/gth-image-viewer-page.c | 29 ++++-
gthumb/gth-browser-actions-entries.h | 5 +
gthumb/gth-browser-ui.h | 5 +-
gthumb/gth-browser.c | 131 ++++++++++++++++++--
gthumb/gth-browser.h | 1 +
gthumb/gth-nav-window.c | 151 ++++++++++++-----------
gthumb/gth-nav-window.h | 6 +-
gthumb/gth-viewer-page.c | 9 ++
gthumb/gth-viewer-page.h | 4 +
10 files changed, 263 insertions(+), 87 deletions(-)
---
diff --git a/extensions/file_viewer/gth-file-viewer-page.c b/extensions/file_viewer/gth-file-viewer-page.c
index 28b4618..e7d186d 100644
--- a/extensions/file_viewer/gth-file-viewer-page.c
+++ b/extensions/file_viewer/gth-file-viewer-page.c
@@ -131,6 +131,14 @@ gth_file_viewer_page_real_fullscreen (GthViewerPage *base,
static void
+gth_file_viewer_page_real_show_pointer (GthViewerPage *base,
+ gboolean show)
+{
+ /* void */
+}
+
+
+static void
gth_file_viewer_page_real_update_sensitivity (GthViewerPage *base)
{
}
@@ -170,6 +178,7 @@ gth_viewer_page_interface_init (GthViewerPageIface *iface)
iface->can_view = gth_file_viewer_page_real_can_view;
iface->view = gth_file_viewer_page_real_view;
iface->fullscreen = gth_file_viewer_page_real_fullscreen;
+ iface->show_pointer = gth_file_viewer_page_real_show_pointer;
iface->update_sensitivity = gth_file_viewer_page_real_update_sensitivity;
iface->can_save = gth_file_viewer_page_real_can_save;
}
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index 3eb2d0f..967b68c 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -33,6 +33,7 @@
struct _GthImageViewerPagePrivate {
GthBrowser *browser;
+ GtkWidget *nav_window;
GtkWidget *viewer;
GthImagePreloader *preloader;
GtkActionGroup *actions;
@@ -41,6 +42,9 @@ struct _GthImageViewerPagePrivate {
GthFileData *file_data;
gulong preloader_sig_id;
guint cnxn_id[GCONF_NOTIFICATIONS];
+ guint hide_mouse_timeout;
+ guint motion_signal;
+
};
static gpointer gth_image_viewer_page_parent_class = NULL;
@@ -376,7 +380,6 @@ gth_image_viewer_page_real_activate (GthViewerPage *base,
GthBrowser *browser)
{
GthImageViewerPage *self;
- GtkWidget *nav_window;
int i;
self = (GthImageViewerPage*) base;
@@ -429,10 +432,10 @@ gth_image_viewer_page_real_activate (GthViewerPage *base,
G_CALLBACK (viewer_key_press_cb),
self);
- nav_window = gth_nav_window_new (GTH_IMAGE_VIEWER (self->priv->viewer));
- gtk_widget_show (nav_window);
+ self->priv->nav_window = gth_nav_window_new (GTH_IMAGE_VIEWER (self->priv->viewer));
+ gtk_widget_show (self->priv->nav_window);
- gth_browser_set_viewer_widget (browser, nav_window);
+ gth_browser_set_viewer_widget (browser, self->priv->nav_window);
/* gconf notifications */
@@ -586,15 +589,32 @@ gth_image_viewer_page_real_fullscreen (GthViewerPage *base,
self = (GthImageViewerPage *) base;
if (active) {
+ gth_nav_window_set_scrollbars_visible (GTH_NAV_WINDOW (self->priv->nav_window), FALSE);
gth_image_viewer_set_black_background (GTH_IMAGE_VIEWER (self->priv->viewer), TRUE);
}
else {
+ gth_nav_window_set_scrollbars_visible (GTH_NAV_WINDOW (self->priv->nav_window), TRUE);
gth_image_viewer_set_black_background (GTH_IMAGE_VIEWER (self->priv->viewer), eel_gconf_get_boolean (PREF_BLACK_BACKGROUND, FALSE));
}
}
static void
+gth_image_viewer_page_real_show_pointer (GthViewerPage *base,
+ gboolean show)
+{
+ GthImageViewerPage *self;
+
+ self = (GthImageViewerPage *) base;
+
+ if (show)
+ gth_image_viewer_show_cursor (GTH_IMAGE_VIEWER (self->priv->viewer));
+ else
+ gth_image_viewer_hide_cursor (GTH_IMAGE_VIEWER (self->priv->viewer));
+}
+
+
+static void
_set_action_sensitive (GthImageViewerPage *self,
const char *action_name,
gboolean sensitive)
@@ -984,6 +1004,7 @@ gth_viewer_page_interface_init (GthViewerPageIface *iface)
iface->can_view = gth_image_viewer_page_real_can_view;
iface->view = gth_image_viewer_page_real_view;
iface->fullscreen = gth_image_viewer_page_real_fullscreen;
+ iface->show_pointer = gth_image_viewer_page_real_show_pointer;
iface->update_sensitivity = gth_image_viewer_page_real_update_sensitivity;
iface->can_save = gth_image_viewer_page_real_can_save;
iface->save = gth_image_viewer_page_real_save;
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index 31e0bda..d48e261 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -120,6 +120,11 @@ static GtkActionEntry gth_browser_action_entries[] = {
NULL,
G_CALLBACK (gth_browser_activate_action_view_fullscreen) },
+ { "View_Leave_Fullscreen", GTK_STOCK_LEAVE_FULLSCREEN,
+ NULL, NULL,
+ NULL,
+ G_CALLBACK (gth_browser_activate_action_view_fullscreen) },
+
{ "Go_Back", GTK_STOCK_GO_BACK,
NULL, "<alt>Left",
N_("Go to the previous visited location"),
diff --git a/gthumb/gth-browser-ui.h b/gthumb/gth-browser-ui.h
index 385be14..55ea3ba 100644
--- a/gthumb/gth-browser-ui.h
+++ b/gthumb/gth-browser-ui.h
@@ -119,6 +119,10 @@ static const char *fixed_ui_info =
" <toolitem action='Viewer_Properties'/>"
" </toolbar>"
+" <toolbar name='Fullscreen_ToolBar'>"
+" <toolitem action='View_Leave_Fullscreen'/>"
+" </toolbar>"
+
" <popup name='GoBackHistoryPopup'>"
" </popup>"
@@ -204,5 +208,4 @@ static const char *viewer_ui_info =
" </menubar>"
"</ui>";
-
#endif /* GTH_BROWSER_UI_H */
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index c347399..7cbed32 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -63,6 +63,8 @@
#define DEF_PROPERTIES_HEIGHT 128
#define DEF_THUMBNAIL_SIZE 128
#define LOAD_FILE_DELAY 150
+#define HIDE_MOUSE_DELAY 1000
+#define MOTION_THRESHOLD 0
typedef void (*GthBrowserCallback) (GthBrowser *, gboolean cancelled, gpointer user_data);
@@ -137,7 +139,15 @@ struct _GthBrowserPrivateData {
gulong task_completed;
GList *load_data_queue;
guint load_file_timeout;
+
+ /* fulscreen */
+
gboolean fullscreen;
+ GtkWidget *fullscreen_toolbar;
+ guint hide_mouse_timeout;
+ guint motion_signal;
+ gdouble last_mouse_x;
+ gdouble last_mouse_y;
/* history */
@@ -3500,6 +3510,10 @@ _gth_browser_load_file (GthBrowser *browser,
if (view) {
gth_viewer_page_show (browser->priv->viewer_page);
+ if (browser->priv->fullscreen) {
+ gth_viewer_page_fullscreen (browser->priv->viewer_page, TRUE);
+ gth_viewer_page_show_pointer (browser->priv->viewer_page, FALSE);
+ }
gth_window_set_current_page (GTH_WINDOW (browser), GTH_BROWSER_PAGE_VIEWER);
}
@@ -3776,28 +3790,125 @@ gth_browser_get_image_preloader (GthBrowser *browser)
}
+static void
+_gth_browser_create_fullscreen_toolbar (GthBrowser *browser)
+{
+ GdkScreen *screen;
+
+ if (browser->priv->fullscreen_toolbar != NULL)
+ return;
+
+ browser->priv->fullscreen_toolbar = gtk_window_new (GTK_WINDOW_POPUP);
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (browser));
+ gtk_window_set_screen (GTK_WINDOW (browser->priv->fullscreen_toolbar), screen);
+ gtk_window_set_default_size (GTK_WINDOW (browser->priv->fullscreen_toolbar), gdk_screen_get_width (screen), -1);
+ gtk_container_set_border_width (GTK_CONTAINER (browser->priv->fullscreen_toolbar), 0);
+
+ gtk_container_add (GTK_CONTAINER (browser->priv->fullscreen_toolbar), gtk_ui_manager_get_widget (browser->priv->ui, "/Fullscreen_ToolBar"));
+}
+
+
+static gboolean
+hide_mouse_pointer_cb (gpointer data)
+{
+ GthBrowser *browser = data;
+ int x, y, w, h, px, py;
+
+ gdk_window_get_pointer (browser->priv->fullscreen_toolbar->window, &px, &py, 0);
+ gdk_window_get_geometry (browser->priv->fullscreen_toolbar->window, &x, &y, &w, &h, NULL);
+
+ if ((px >= x) && (px <= x + w) && (py >= y) && (py <= y + h))
+ return FALSE;
+
+ gtk_widget_hide (browser->priv->fullscreen_toolbar);
+ if (browser->priv->viewer_page != NULL)
+ gth_viewer_page_show_pointer (GTH_VIEWER_PAGE (browser->priv->viewer_page), FALSE);
+
+ browser->priv->hide_mouse_timeout = 0;
+
+ return FALSE;
+}
+
+
+static gboolean
+fullscreen_motion_notify_event_cb (GtkWidget *widget,
+ GdkEventMotion *event,
+ gpointer data)
+{
+ GthBrowser *browser = data;
+
+ if (browser->priv->last_mouse_x == 0.0)
+ browser->priv->last_mouse_x = event->x;
+ if (browser->priv->last_mouse_y == 0.0)
+ browser->priv->last_mouse_y = event->y;
+
+ if ((abs (browser->priv->last_mouse_x - event->x) > MOTION_THRESHOLD) || (abs (browser->priv->last_mouse_y - event->y) > MOTION_THRESHOLD))
+ if (! GTK_WIDGET_VISIBLE (browser->priv->fullscreen_toolbar)) {
+ gtk_widget_show (browser->priv->fullscreen_toolbar);
+ if (browser->priv->viewer_page != NULL)
+ gth_viewer_page_show_pointer (GTH_VIEWER_PAGE (browser->priv->viewer_page), TRUE);
+ }
+
+ if (browser->priv->hide_mouse_timeout != 0)
+ g_source_remove (browser->priv->hide_mouse_timeout);
+ browser->priv->hide_mouse_timeout = g_timeout_add (HIDE_MOUSE_DELAY,
+ hide_mouse_pointer_cb,
+ browser);
+
+ browser->priv->last_mouse_x = event->x;
+ browser->priv->last_mouse_y = event->y;
+
+ return FALSE;
+}
+
+
void
gth_browser_fullscreen (GthBrowser *browser)
{
- if (browser->priv->viewer_page == NULL)
+ browser->priv->fullscreen = ! browser->priv->fullscreen;
+
+ if (! browser->priv->fullscreen) {
+ gth_browser_unfullscreen (browser);
return;
+ }
- browser->priv->fullscreen = ! browser->priv->fullscreen;
+ if (browser->priv->current_file == NULL)
+ gth_browser_show_first_image (browser, FALSE, FALSE);
- if (browser->priv->fullscreen) {
- gtk_window_fullscreen (GTK_WINDOW (browser));
+ _gth_browser_create_fullscreen_toolbar (browser);
+ gtk_window_fullscreen (GTK_WINDOW (browser));
+ gth_window_set_current_page (GTH_WINDOW (browser), GTH_BROWSER_PAGE_VIEWER);
+ gth_window_show_only_content (GTH_WINDOW (browser), TRUE);
+ if (browser->priv->viewer_page != NULL) {
gth_viewer_page_show (browser->priv->viewer_page);
- gth_window_set_current_page (GTH_WINDOW (browser), GTH_BROWSER_PAGE_VIEWER);
- gth_window_show_only_content (GTH_WINDOW (browser), TRUE);
gth_viewer_page_fullscreen (browser->priv->viewer_page, TRUE);
+ gth_viewer_page_show_pointer (browser->priv->viewer_page, FALSE);
}
- else {
- gtk_window_unfullscreen (GTK_WINDOW (browser));
- gth_window_show_only_content (GTH_WINDOW (browser), FALSE);
+ gth_browser_update_sensitivity (browser);
+
+ browser->priv->last_mouse_x = 0.0;
+ browser->priv->last_mouse_y = 0.0;
+ browser->priv->motion_signal = g_signal_connect (browser,
+ "motion_notify_event",
+ G_CALLBACK (fullscreen_motion_notify_event_cb),
+ browser);
+}
+
+
+void
+gth_browser_unfullscreen (GthBrowser *browser)
+{
+ gtk_widget_hide (browser->priv->fullscreen_toolbar);
+ gtk_window_unfullscreen (GTK_WINDOW (browser));
+ gth_window_show_only_content (GTH_WINDOW (browser), FALSE);
+ if (browser->priv->viewer_page != NULL)
gth_viewer_page_fullscreen (browser->priv->viewer_page, FALSE);
- }
gth_browser_update_sensitivity (browser);
+
+ if (browser->priv->motion_signal != 0)
+ g_signal_handler_disconnect (browser, browser->priv->motion_signal);
}
diff --git a/gthumb/gth-browser.h b/gthumb/gth-browser.h
index 76bcf6b..5e93a03 100644
--- a/gthumb/gth-browser.h
+++ b/gthumb/gth-browser.h
@@ -143,6 +143,7 @@ void gth_browser_show_filterbar (GthBrowser *browser,
gboolean show);
gpointer gth_browser_get_image_preloader (GthBrowser *browser);
void gth_browser_fullscreen (GthBrowser *browser);
+void gth_browser_unfullscreen (GthBrowser *browser);
G_END_DECLS
diff --git a/gthumb/gth-nav-window.c b/gthumb/gth-nav-window.c
index 5b4aa02..af25725 100644
--- a/gthumb/gth-nav-window.c
+++ b/gthumb/gth-nav-window.c
@@ -30,7 +30,7 @@
#define GTH_NAV_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTH_TYPE_NAV_WINDOW, GthNavWindowPrivate))
-#define PEN_WIDTH 3 /* Square border width. */
+#define PEN_WIDTH 3 /* Square border width. */
#define B 4 /* Window border width. */
#define B2 8 /* Window border width * 2. */
#define NAV_WIN_MAX_WIDTH 112 /* Max window size. */
@@ -42,6 +42,7 @@ struct _GthNavWindowPrivate {
GtkWidget *viewer_vscr;
GtkWidget *viewer_hscr;
GtkWidget *viewer_nav_event_box;
+ gboolean scrollbars_visible;
};
@@ -55,7 +56,7 @@ gth_nav_window_class_init (GthNavWindowClass *class)
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (GthNavWindowPrivate));
-
+
object_class = G_OBJECT_CLASS (class);
}
@@ -64,6 +65,7 @@ static void
gth_nav_window_init (GthNavWindow *nav_window)
{
nav_window->priv = GTH_NAV_WINDOW_GET_PRIVATE (nav_window);
+ nav_window->priv->scrollbars_visible = TRUE;
}
@@ -96,7 +98,7 @@ gth_nav_window_get_type ()
static gboolean
-size_changed_cb (GtkWidget *widget,
+size_changed_cb (GtkWidget *widget,
GthNavWindow *nav_window)
{
GtkAdjustment *vadj, *hadj;
@@ -110,18 +112,18 @@ size_changed_cb (GtkWidget *widget,
hide_vscr = (vadj->upper <= vadj->page_size);
hide_hscr = (hadj->upper <= hadj->page_size);
- if (hide_vscr && hide_hscr) {
- gtk_widget_hide (nav_window->priv->viewer_vscr);
- gtk_widget_hide (nav_window->priv->viewer_hscr);
+ if (! nav_window->priv->scrollbars_visible || (hide_vscr && hide_hscr)) {
+ gtk_widget_hide (nav_window->priv->viewer_vscr);
+ gtk_widget_hide (nav_window->priv->viewer_hscr);
gtk_widget_hide (nav_window->priv->viewer_nav_event_box);
- }
+ }
else {
gtk_widget_show (nav_window->priv->viewer_vscr);
gtk_widget_show (nav_window->priv->viewer_hscr);
gtk_widget_show (nav_window->priv->viewer_nav_event_box);
}
- return TRUE;
+ return TRUE;
}
@@ -141,7 +143,7 @@ typedef struct {
int sqr_x, sqr_y, sqr_width, sqr_height;
double factor;
double sqr_x_d, sqr_y_d;
-} NavWindow;
+} NavWindow;
static void
@@ -153,27 +155,27 @@ nav_window_draw_sqr (NavWindow *nav_win,
if ((nav_win->sqr_x == x) && (nav_win->sqr_y == y) && undraw)
return;
- if ((nav_win->sqr_x == 0)
+ if ((nav_win->sqr_x == 0)
&& (nav_win->sqr_y == 0)
- && (nav_win->sqr_width == nav_win->popup_width)
- && (nav_win->sqr_height == nav_win->popup_height))
+ && (nav_win->sqr_width == nav_win->popup_width)
+ && (nav_win->sqr_height == nav_win->popup_height))
{
return;
}
-
+
if (undraw) {
- gdk_draw_rectangle (nav_win->preview->window,
- nav_win->gc, FALSE,
- nav_win->sqr_x + 1,
+ gdk_draw_rectangle (nav_win->preview->window,
+ nav_win->gc, FALSE,
+ nav_win->sqr_x + 1,
nav_win->sqr_y + 1,
nav_win->sqr_width - PEN_WIDTH,
nav_win->sqr_height - PEN_WIDTH);
}
-
- gdk_draw_rectangle (nav_win->preview->window,
- nav_win->gc, FALSE,
- x + 1,
- y + 1,
+
+ gdk_draw_rectangle (nav_win->preview->window,
+ nav_win->gc, FALSE,
+ x + 1,
+ y + 1,
nav_win->sqr_width - PEN_WIDTH,
nav_win->sqr_height - PEN_WIDTH);
@@ -192,12 +194,12 @@ get_sqr_origin_as_double (NavWindow *nav_win,
*x = MIN (mx - B, nav_win->window_max_width);
*y = MIN (my - B, nav_win->window_max_height);
- if (*x - nav_win->sqr_width / 2.0 < 0.0)
+ if (*x - nav_win->sqr_width / 2.0 < 0.0)
*x = nav_win->sqr_width / 2.0;
-
+
if (*y - nav_win->sqr_height / 2.0 < 0.0)
*y = nav_win->sqr_height / 2.0;
-
+
if (*x + nav_win->sqr_width / 2.0 > nav_win->popup_width - 0)
*x = nav_win->popup_width - 0 - nav_win->sqr_width / 2.0;
@@ -226,7 +228,7 @@ update_view (NavWindow *nav_win)
nav_win->window_max_width = MIN (w, NAV_WIN_MAX_WIDTH);
nav_win->window_max_height = MIN (w, NAV_WIN_MAX_HEIGHT);
- factor = MIN ((double) (nav_win->window_max_width) / w,
+ factor = MIN ((double) (nav_win->window_max_width) / w,
(double) (nav_win->window_max_height) / h);
nav_win->factor = factor;
@@ -241,7 +243,7 @@ update_view (NavWindow *nav_win)
image_pixbuf = gth_image_viewer_get_current_pixbuf (nav_win->viewer);
g_return_if_fail (image_pixbuf != NULL);
- if (nav_win->pixbuf != NULL)
+ if (nav_win->pixbuf != NULL)
g_object_unref (nav_win->pixbuf);
nav_win->pixbuf = gdk_pixbuf_scale_simple (image_pixbuf,
popup_width,
@@ -255,8 +257,8 @@ update_view (NavWindow *nav_win)
nav_win->sqr_width = MIN (nav_win->sqr_width, popup_width);
nav_win->sqr_height = gdk_height * factor;
- nav_win->sqr_height = MAX (nav_win->sqr_height, B);
- nav_win->sqr_height = MIN (nav_win->sqr_height, popup_height);
+ nav_win->sqr_height = MAX (nav_win->sqr_height, B);
+ nav_win->sqr_height = MIN (nav_win->sqr_height, popup_height);
gth_image_viewer_get_scroll_offset (nav_win->viewer, &x_offset, &y_offset);
nav_win->sqr_x = x_offset * factor;
@@ -264,11 +266,11 @@ update_view (NavWindow *nav_win)
/* Popup window position. */
- popup_x = MIN ((int) nav_win->x_root - nav_win->sqr_x
- - B
+ popup_x = MIN ((int) nav_win->x_root - nav_win->sqr_x
+ - B
- nav_win->sqr_width / 2,
gdk_screen_width () - popup_width - B2);
- popup_y = MIN ((int) nav_win->y_root - nav_win->sqr_y
+ popup_y = MIN ((int) nav_win->y_root - nav_win->sqr_y
- B
- nav_win->sqr_height / 2,
gdk_screen_height () - popup_height - B2);
@@ -311,18 +313,18 @@ nav_window_expose (GtkWidget *widget,
112, /* FIXME */
GDK_RGB_DITHER_MAX,
0, 0);
-
- nav_window_draw_sqr (nav_win, FALSE,
- nav_win->sqr_x,
+
+ nav_window_draw_sqr (nav_win, FALSE,
+ nav_win->sqr_x,
nav_win->sqr_y);
return TRUE;
}
-
+
static int
-nav_window_events (GtkWidget *widget,
- GdkEvent *event,
+nav_window_events (GtkWidget *widget,
+ GdkEvent *event,
gpointer data)
{
NavWindow *nav_win = data;
@@ -333,10 +335,10 @@ nav_window_events (GtkWidget *widget,
switch (event->type) {
case GDK_BUTTON_RELEASE:
- /* Release keyboard focus. */
+ /* Release keyboard focus. */
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
gtk_grab_remove (nav_win->popup_win);
-
+
g_object_unref (nav_win->gc);
gtk_widget_destroy (nav_win->popup_win);
g_object_unref (nav_win->pixbuf);
@@ -344,7 +346,7 @@ nav_window_events (GtkWidget *widget,
return TRUE;
- case GDK_MOTION_NOTIFY:
+ case GDK_MOTION_NOTIFY:
gdk_window_get_pointer (widget->window, &mx, &my, &mask);
get_sqr_origin_as_double (nav_win, mx, my, &x, &y);
@@ -363,15 +365,15 @@ nav_window_events (GtkWidget *widget,
case GDK_plus:
case GDK_minus:
case GDK_1:
- nav_window_draw_sqr (nav_win, FALSE,
- nav_win->sqr_x,
+ nav_window_draw_sqr (nav_win, FALSE,
+ nav_win->sqr_x,
nav_win->sqr_y);
switch (event->key.keyval) {
- case GDK_plus:
- gth_image_viewer_zoom_in (viewer);
+ case GDK_plus:
+ gth_image_viewer_zoom_in (viewer);
break;
case GDK_minus:
- gth_image_viewer_zoom_out (viewer);
+ gth_image_viewer_zoom_out (viewer);
break;
case GDK_1:
gth_image_viewer_set_zoom (viewer, 1.0);
@@ -385,8 +387,8 @@ nav_window_events (GtkWidget *widget,
nav_win->sqr_y = MAX (nav_win->sqr_y, 0);
nav_win->sqr_y = MIN (nav_win->sqr_y, nav_win->popup_height - nav_win->sqr_height);
- nav_window_draw_sqr (nav_win, FALSE,
- nav_win->sqr_x,
+ nav_window_draw_sqr (nav_win, FALSE,
+ nav_win->sqr_x,
nav_win->sqr_y);
break;
@@ -410,17 +412,17 @@ nav_window_grab_pointer (NavWindow *nav_win)
gtk_grab_add (nav_win->popup_win);
- cursor = gdk_cursor_new (GDK_FLEUR);
- gdk_pointer_grab (nav_win->popup_win->window,
+ cursor = gdk_cursor_new (GDK_FLEUR);
+ gdk_pointer_grab (nav_win->popup_win->window,
TRUE,
- (GDK_BUTTON_RELEASE_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_MOTION_MASK
+ (GDK_BUTTON_RELEASE_MASK
+ | GDK_POINTER_MOTION_HINT_MASK
+ | GDK_BUTTON_MOTION_MASK
| GDK_EXTENSION_EVENTS_ALL),
- nav_win->preview->window,
- cursor,
+ nav_win->preview->window,
+ cursor,
0);
- gdk_cursor_unref (cursor);
+ gdk_cursor_unref (cursor);
/* Capture keyboard events. */
@@ -452,19 +454,19 @@ nav_window_new (GthImageViewer *viewer)
nav_window->preview = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (in_frame), nav_window->preview);
- g_signal_connect (G_OBJECT (nav_window->preview),
- "expose_event",
- G_CALLBACK (nav_window_expose),
+ g_signal_connect (G_OBJECT (nav_window->preview),
+ "expose_event",
+ G_CALLBACK (nav_window_expose),
nav_window);
/* gc needed to draw the preview square */
nav_window->gc = gdk_gc_new (GTK_WIDGET (viewer)->window);
gdk_gc_set_function (nav_window->gc, GDK_INVERT);
- gdk_gc_set_line_attributes (nav_window->gc,
- PEN_WIDTH,
- GDK_LINE_SOLID,
- GDK_CAP_BUTT,
+ gdk_gc_set_line_attributes (nav_window->gc,
+ PEN_WIDTH,
+ GDK_LINE_SOLID,
+ GDK_CAP_BUTT,
GDK_JOIN_MITER);
return nav_window;
@@ -472,7 +474,7 @@ nav_window_new (GthImageViewer *viewer)
void
-nav_button_clicked_cb (GtkWidget *widget,
+nav_button_clicked_cb (GtkWidget *widget,
GdkEventButton *event,
GthImageViewer *viewer)
{
@@ -493,15 +495,15 @@ nav_button_clicked_cb (GtkWidget *widget,
g_signal_connect (G_OBJECT (nav_win->popup_win),
"event",
- G_CALLBACK (nav_window_events),
+ G_CALLBACK (nav_window_events),
nav_win);
gtk_window_move (GTK_WINDOW (nav_win->popup_win),
nav_win->popup_x,
nav_win->popup_y);
- gtk_window_set_default_size (GTK_WINDOW (nav_win->popup_win),
- nav_win->popup_width + B2,
+ gtk_window_set_default_size (GTK_WINDOW (nav_win->popup_win),
+ nav_win->popup_width + B2,
nav_win->popup_height + B2);
gtk_widget_show_all (nav_win->popup_win);
@@ -511,7 +513,7 @@ nav_button_clicked_cb (GtkWidget *widget,
static void
-gth_nav_window_construct (GthNavWindow *nav_window,
+gth_nav_window_construct (GthNavWindow *nav_window,
GthImageViewer *viewer)
{
GtkAdjustment *vadj = NULL, *hadj = NULL;
@@ -519,7 +521,7 @@ gth_nav_window_construct (GthNavWindow *nav_window,
GtkWidget *table;
nav_window->priv->viewer = viewer;
- g_signal_connect (G_OBJECT (nav_window->priv->viewer),
+ g_signal_connect (G_OBJECT (nav_window->priv->viewer),
"size_changed",
G_CALLBACK (size_changed_cb),
nav_window);
@@ -531,9 +533,9 @@ gth_nav_window_construct (GthNavWindow *nav_window,
nav_window->priv->viewer_nav_event_box = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (nav_window->priv->viewer_nav_event_box), _gtk_image_new_from_xpm_data (nav_button_xpm));
- g_signal_connect (G_OBJECT (nav_window->priv->viewer_nav_event_box),
+ g_signal_connect (G_OBJECT (nav_window->priv->viewer_nav_event_box),
"button_press_event",
- G_CALLBACK (nav_button_clicked_cb),
+ G_CALLBACK (nav_button_clicked_cb),
nav_window->priv->viewer);
hbox = gtk_hbox_new (FALSE, 0);
@@ -572,3 +574,12 @@ gth_nav_window_new (GthImageViewer *viewer)
return (GtkWidget*) nav_window;
}
+
+
+void
+gth_nav_window_set_scrollbars_visible (GthNavWindow *window,
+ gboolean visible)
+{
+ window->priv->scrollbars_visible = visible;
+ size_changed_cb (NULL, window);
+}
diff --git a/gthumb/gth-nav-window.h b/gthumb/gth-nav-window.h
index 6b39ca9..5e5e8d0 100644
--- a/gthumb/gth-nav-window.h
+++ b/gthumb/gth-nav-window.h
@@ -48,8 +48,10 @@ struct _GthNavWindowClass {
GtkHBoxClass __parent;
};
-GType gth_nav_window_get_type (void);
-GtkWidget * gth_nav_window_new (GthImageViewer *viewer);
+GType gth_nav_window_get_type (void);
+GtkWidget * gth_nav_window_new (GthImageViewer *viewer);
+void gth_nav_window_set_scrollbars_visible (GthNavWindow *window,
+ gboolean visible);
G_END_DECLS
diff --git a/gthumb/gth-viewer-page.c b/gthumb/gth-viewer-page.c
index 6c8ee76..792b57a 100644
--- a/gthumb/gth-viewer-page.c
+++ b/gthumb/gth-viewer-page.c
@@ -99,6 +99,15 @@ gth_viewer_page_fullscreen (GthViewerPage *self,
GTH_VIEWER_PAGE_GET_INTERFACE (self)->fullscreen (self, active);
}
+
+void
+gth_viewer_page_show_pointer (GthViewerPage *self,
+ gboolean show)
+{
+ GTH_VIEWER_PAGE_GET_INTERFACE (self)->show_pointer (self, show);
+}
+
+
void
gth_viewer_page_update_sensitivity (GthViewerPage *self)
{
diff --git a/gthumb/gth-viewer-page.h b/gthumb/gth-viewer-page.h
index 0377d2b..f4ef68c 100644
--- a/gthumb/gth-viewer-page.h
+++ b/gthumb/gth-viewer-page.h
@@ -56,6 +56,8 @@ struct _GthViewerPageIface {
GthFileData *file_data);
void (*fullscreen) (GthViewerPage *self,
gboolean active);
+ void (*show_pointer) (GthViewerPage *self,
+ gboolean show);
void (*update_sensitivity) (GthViewerPage *self);
gboolean (*can_save) (GthViewerPage *self);
void (*save) (GthViewerPage *self,
@@ -79,6 +81,8 @@ void gth_viewer_page_view (GthViewerPage *self,
GthFileData *file_data);
void gth_viewer_page_fullscreen (GthViewerPage *self,
gboolean active);
+void gth_viewer_page_show_pointer (GthViewerPage *self,
+ gboolean show);
void gth_viewer_page_update_sensitivity (GthViewerPage *self);
gboolean gth_viewer_page_can_save (GthViewerPage *self);
void gth_viewer_page_save (GthViewerPage *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]