Hi all,
I'm sending my first patch to you. It enables full screen of an image in any
pan view mode.
I want to know if it fits geeqie programing style; and I want to know if I
have made the patch correctly. :)
This patch basically enables full screen of a clicked image in pan view mode
( until now, you only could enter full screen pan view mode ).
Let's say:
#Full screen mode: Pan view full screen mode ( no scrollbars , mouse
navigation , etc. ).
#Full screen image mode: You see a single image in the screen ( as in geeqie
normal view).
- If a pic is clicked; you can enter fullscreen mode with Return key.
- You can also enter fullscreen image mode when you do right mouse click on
a pic ( it will appear a new menu option).
- While you're viewing an image in full screen image mode; you can
manipulate it ( alter, zoom , copy, etc.)
- Once you've finished viewing a single image on full screen mode; you can
exit either by right mouse menu option, or pressing Return key again.
- Usual ways of returning from pan view full screen mode to pan view normal
mode; will also finish full screen image mode ( for exameple, if you're in
full screen image mode, and press ESC; full screen image mode will end).
*Know bugs,missing features,questions*
* To pass from "full screen mode" to "full screen image mode" ; first I must
return to pan view normal mode and then go to full screen image mode; so the
image "blinks" a little. I'm sure that with a little bit of more coding this
blink could be avoided.
* It has not been very tested; i'll do in next days if you like the patch.
If someone tests it; comments will be very welcome.
*Possible improvements*
+ : Start slideshow as in geeqie normal mode from selected pic of selected
day .
I'm not working much more on pan view because I want to make pan-calendar
with clutter.
I hope next week I'll be able to send you something about this!
Regards,
Oscar.
--- pan-view.old 2009-06-06 13:18:13.000000000 +0200
+++ pan-view.c 2009-06-08 17:59:47.000000000 +0200
@@ -62,15 +62,22 @@
static void pan_fullscreen_toggle(PanWindow *pw, gboolean force_off);
+static void pan_fullscreen_toggle_image(PanWindow *pw,gboolean force_off,FileData *fd);
+
static void pan_search_toggle_visible(PanWindow *pw, gboolean enable);
+
static void pan_search_activate(PanWindow *pw);
static void pan_window_close(PanWindow *pw);
static GtkWidget *pan_popup_menu(PanWindow *pw);
+static GtkWidget *pan_popup_fullscreen_menu(PanWindow *pw);
+
static void pan_window_dnd_init(PanWindow *pw);
+static void pan_view_alter_cb(GtkWidget *widget, gpointer data);
+
/*
*-----------------------------------------------------------------------------
@@ -1211,8 +1218,8 @@
pr = PIXBUF_RENDERER(pw->imd->pr);
fd = pan_menu_click_fd(pw);
-
- focused = (pw->fs || GTK_WIDGET_HAS_FOCUS(GTK_WIDGET(pw->imd->widget)));
+
+ focused = (pw->fs || pw->fs_image || GTK_WIDGET_HAS_FOCUS(GTK_WIDGET(pw->imd->widget)));
on_entry = (GTK_WIDGET_HAS_FOCUS(pw->path_entry) ||
GTK_WIDGET_HAS_FOCUS(pw->search_entry));
@@ -1245,6 +1252,9 @@
case GDK_End: case GDK_KP_End:
pixbuf_renderer_scroll(pr, pr->vis_width / 2, 0);
break;
+ case GDK_Return:
+ if (fd) pan_fullscreen_toggle_image(pw,FALSE,fd);
+ break;
default:
stop_signal = FALSE;
break;
@@ -1260,6 +1270,28 @@
keyboard_scroll_calc(&x, &y, event);
pixbuf_renderer_scroll(pr, x, y);
}
+
+ if (pw->fs_image && event->state & GDK_SHIFT_MASK)
+ {
+ switch(event->keyval)
+ {
+ case 'R': case 'r':
+ image_alter_orientation(pw->imd, ALTER_ROTATE_180);
+ break;
+ case 'M': case 'm':
+ image_alter_orientation(pw->imd, ALTER_MIRROR);
+ break;
+ case 'F': case 'f':
+ image_alter_orientation(pw->imd, ALTER_FLIP);
+ break;
+ case 'G': case 'g':
+ image_set_desaturate(pw->imd, !image_get_desaturate(pw->imd));
+ break;
+ default :
+ stop_signal = FALSE;
+ break;
+ }
+ }
}
if (stop_signal) return stop_signal;
@@ -1320,7 +1352,8 @@
pan_search_activate(pw);
break;
case 'W': case 'w':
- pan_window_close(pw);
+ if (!pw->fs_image) pan_window_close(pw);
+ else pan_fullscreen_toggle_image(pw,FALSE,NULL);
break;
default:
stop_signal = FALSE;
@@ -1343,7 +1376,13 @@
switch (event->keyval)
{
case GDK_Escape:
- if (pw->fs)
+
+ if (pw->fs_image)
+ {
+ pan_fullscreen_toggle_image(pw,FALSE,fd);
+ }
+
+ else if (pw->fs)
{
pan_fullscreen_toggle(pw, TRUE);
}
@@ -1394,7 +1433,7 @@
case 'F': case 'f':
case 'V': case 'v':
case GDK_F11:
- pan_fullscreen_toggle(pw, FALSE);
+ if (!pw->fs_image) pan_fullscreen_toggle(pw, FALSE);
break;
case 'I': case 'i':
#if 0
@@ -1405,7 +1444,8 @@
break;
case GDK_Menu:
case GDK_F10:
- menu = pan_popup_menu(pw);
+ if (!pw->fs_image) menu = pan_popup_menu(pw);
+ else menu = pan_popup_fullscreen_menu(pw);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
pan_window_menu_pos_cb, pw, 0, GDK_CURRENT_TIME);
break;
@@ -1497,7 +1537,7 @@
gint x1, y1, x2, y2, x3, y3;
gint x, y, w, h;
- if (pw->click_pi == pi) return;
+ if (pw->click_pi == pi || pw->fs_image) return;
if (pi && !pi->fd) pi = NULL;
while ((p = pan_item_find_by_key(pw, PAN_ITEM_NONE, "info"))) pan_item_remove(pw, p);
@@ -1985,7 +2025,7 @@
static void pan_search_toggle_visible(PanWindow *pw, gboolean enable)
{
- if (pw->fs) return;
+ if (pw->fs || pw->fs_image) return;
if (enable)
{
@@ -2057,7 +2097,8 @@
break;
case MOUSE_BUTTON_RIGHT:
pan_info_update(pw, pi);
- menu = pan_popup_menu(pw);
+ if (pw->fs_image) menu = pan_popup_fullscreen_menu(pw);
+ else menu = pan_popup_menu(pw);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
break;
default:
@@ -2131,29 +2172,63 @@
{
PanWindow *pw = data;
- pw->fs = NULL;
+ if (!pw->fs_image) pw->fs = NULL;
+ else pw->fs_image=NULL;
pw->imd = pw->imd_normal;
}
static void pan_fullscreen_toggle(PanWindow *pw, gboolean force_off)
{
- if (force_off && !pw->fs) return;
+ if ( (force_off && !pw->fs) || (pw->fs_image)) return;
if (pw->fs)
{
fullscreen_stop(pw->fs);
+ if (!(pw->fullscreen_mode & (~FULL_PAN_WINDOW))) pw->fullscreen_mode = FULL_NONE;
}
else
{
pw->fs = fullscreen_start(pw->window, pw->imd, pan_fullscreen_stop_func, pw);
+ pw->fullscreen_mode = FULL_PAN_WINDOW ;
pan_image_set_buttons(pw, pw->fs->imd);
g_signal_connect(G_OBJECT(pw->fs->window), "key_press_event",
G_CALLBACK(pan_window_key_press_cb), pw);
-
pw->imd = pw->fs->imd;
}
}
+static void pan_fullscreen_toggle_image(PanWindow *pw,gboolean force_off,FileData *fd)
+{
+ ImageWindow *imd;
+
+ imd = image_new(FALSE);
+ image_change_fd(imd, fd, image_zoom_get_default(NULL));
+
+ if (fd && !imd) return; /* could not initiate fullscreen */
+ if (force_off && !pw->fs_image) return;
+ if (pw->fs_image)
+ {
+ image_alter_orientation(pw->imd, ALTER_NONE);
+ fullscreen_stop(pw->fs_image);
+ pw->fullscreen_mode = (pw->fullscreen_mode & (~FULL_IMAGE));
+ if (pw->fullscreen_mode == FULL_PAN_WINDOW) pan_fullscreen_toggle(pw,FALSE);
+ }
+
+ else
+ {
+ pw->fullscreen_mode = pw->fullscreen_mode | FULL_IMAGE;
+ pan_fullscreen_toggle(pw,TRUE);
+ pw->fs_image = fullscreen_start(pw->window, imd, pan_fullscreen_stop_func, pw);
+ pan_image_set_buttons(pw, pw->fs_image->imd);
+ g_signal_connect(G_OBJECT(pw->fs_image->window), "key_press_event",
+ G_CALLBACK(pan_window_key_press_cb), pw);
+ pw->imd = pw->fs_image->imd;
+ }
+
+ /*g_free(imd); Is it necessary? */
+}
+
+
static void pan_window_image_zoom_cb(PixbufRenderer *pr, gdouble zoom, gpointer data)
{
PanWindow *pw = data;
@@ -2362,6 +2437,8 @@
}
pw->ignore_symlinks = TRUE;
+
+ pw->fullscreen_mode = FULL_NONE;
pw->idle_id = 0;
@@ -2765,10 +2842,17 @@
static void pan_fullscreen_cb(GtkWidget *widget, gpointer data)
{
PanWindow *pw = data;
+ if (pw->fs_image) pan_fullscreen_toggle_image(pw,FALSE,NULL);
+ else pan_fullscreen_toggle(pw, FALSE);
+}
- pan_fullscreen_toggle(pw, FALSE);
+static void pan_fullscreen_image_cb(GtkWidget *widget, gpointer data)
+{
+ PanWindow *pw = data;
+ pan_fullscreen_toggle_image(pw,FALSE,pw->click_pi->fd);
}
+
static void pan_close_cb(GtkWidget *widget, gpointer data)
{
PanWindow *pw = data;
@@ -2875,6 +2959,11 @@
menu_item_add_divider(menu);
+ if (active)
+ {
+ menu_item_add(menu, _("_View image on full screen"), G_CALLBACK(pan_fullscreen_image_cb), pw);
+ }
+
if (pw->fs)
{
menu_item_add(menu, _("Exit _full screen"), G_CALLBACK(pan_fullscreen_cb), pw);
@@ -2890,6 +2979,51 @@
return menu;
}
+static GtkWidget *pan_popup_fullscreen_menu(PanWindow *pw)
+{
+ GtkWidget *menu;
+ GtkWidget *submenu;
+ GtkWidget *item;
+ gboolean active;
+
+ active = (pw->click_pi != NULL);
+
+ menu = popup_menu_short_lived();
+ g_signal_connect(G_OBJECT(menu), "destroy",
+ G_CALLBACK(pan_popup_menu_destroy_cb), pw);
+
+ menu_item_add_stock(menu, _("Zoom _in"), GTK_STOCK_ZOOM_IN,
+ G_CALLBACK(pan_zoom_in_cb), pw);
+ menu_item_add_stock(menu, _("Zoom _out"), GTK_STOCK_ZOOM_OUT,
+ G_CALLBACK(pan_zoom_out_cb), pw);
+ menu_item_add_stock(menu, _("Zoom _1:1"), GTK_STOCK_ZOOM_100,
+ G_CALLBACK(pan_zoom_1_1_cb), pw);
+ menu_item_add_divider(menu);
+
+ pw->editmenu_fd_list = pan_view_get_fd_list(pw);
+ submenu_add_edit(menu, &item, G_CALLBACK(pan_edit_cb), pw, pw->editmenu_fd_list);
+ gtk_widget_set_sensitive(item, active);
+
+ item = submenu_add_alter(menu, G_CALLBACK(pan_view_alter_cb), pw);
+
+ menu_item_add_stock_sensitive(menu, _("View in _new window"), GTK_STOCK_NEW, active,
+ G_CALLBACK(pan_new_window_cb), pw);
+
+ menu_item_add_divider(menu);
+ menu_item_add_stock_sensitive(menu, _("_Copy..."), GTK_STOCK_COPY, active,
+ G_CALLBACK(pan_copy_cb), pw);
+ menu_item_add_sensitive(menu, _("_Move..."), active,
+ G_CALLBACK(pan_move_cb), pw);
+ menu_item_add_sensitive(menu, _("_Rename..."), active,
+ G_CALLBACK(pan_rename_cb), pw);
+ menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, active,
+ G_CALLBACK(pan_delete_cb), pw);
+ menu_item_add_divider(menu);
+
+ menu_item_add(menu, _("Exit _full screen"), G_CALLBACK(pan_fullscreen_cb), pw);
+
+ return menu;
+}
/*
*-----------------------------------------------------------------------------
@@ -2984,4 +3118,23 @@
G_CALLBACK(pan_window_get_dnd_data), pw);
}
+/*
+ *-----------------------------------------------------------------------------
+ * Callbacks
+ *-----------------------------------------------------------------------------
+ */
+
+static void pan_view_alter_cb(GtkWidget *widget, gpointer data)
+{
+ PanWindow *pw;
+ AlterType type;
+
+ pw = submenu_item_get_data(widget);
+ type = GPOINTER_TO_INT(data);
+
+ if (!pw) return;
+ image_alter_orientation(pw->imd, type);
+}
+
+
/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- pan-types.old 2009-06-06 13:21:04.000000000 +0200
+++ pan-types.h 2009-06-08 17:50:20.000000000 +0200
@@ -80,7 +80,11 @@
#define PAN_GROUP_MAX 16
+/* pan fullscreen modes */
+#define FULL_NONE 0
+#define FULL_PAN_WINDOW 1
+#define FULL_IMAGE 2
typedef enum {
PAN_LAYOUT_TIMELINE = 0,
@@ -175,6 +179,7 @@
ImageWindow *imd;
ImageWindow *imd_normal;
FullScreenData *fs;
+ FullScreenData *fs_image;
GtkWidget *path_entry;
@@ -205,6 +210,8 @@
gboolean ignore_symlinks;
+ guint8 fullscreen_mode;
+
GList *list;
GList *list_static;
GList *list_grid;
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel