changeset 97:ddde49aace00

Fri Nov 3 21:15:40 2006 John Ellis <johne@verizon.net> * pan-view.c: Fix shortcuts to work regardless of what has the focus. Make [Control]+F (in addition to [/] show the find bar and [Control]+G go to next match. Add folder location field to info popup.
author gqview
date Sat, 04 Nov 2006 02:20:32 +0000
parents 8c0bec943cdc
children e639afdc1c60
files ChangeLog TODO src/pan-view.c
diffstat 3 files changed, 102 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Nov 03 16:53:56 2006 +0000
+++ b/ChangeLog	Sat Nov 04 02:20:32 2006 +0000
@@ -1,3 +1,9 @@
+Fri Nov  3 21:15:40 2006  John Ellis  <johne@verizon.net>
+
+	* pan-view.c: Fix shortcuts to work regardless of what has the focus.
+	Make [Control]+F (in addition to [/] show the find bar and [Control]+G
+	go to next match. Add folder location field to info popup.
+
 Fri Nov  3 11:40:48 2006  John Ellis  <johne@verizon.net>
 
 	* bar_exif.[ch]: Make list of general exif tags available to rest of
--- a/TODO	Fri Nov 03 16:53:56 2006 +0000
+++ b/TODO	Sat Nov 04 02:20:32 2006 +0000
@@ -61,7 +61,7 @@
     w> fix search. (UPDATE: still can not find day containing name/path/partial)
      > supports thumbnail size images only, should grey out actual size items in size menu or something...
     w> allow use of file date or EXIF (embedded) date.
-     > fix scrolling when 'day' popup appears outsize of canvas.
+    d> fix scrolling when 'day' popup appears outsize of canvas.
 
    > grid view:
      > allow sorting by name, date, size, dimensions, etc.
@@ -80,14 +80,9 @@
  > folder tree view shortcuts for expanding/collapsing leak through to the main
    window (+,-,*,/, etc.), figure what behavior is desired and fix this.
 
-  --- Doc updates:
-
- > default edit commands not described.
- > add formatted rename option.
-
  -------------
 
- > update translations: eu(x)
+ > update translations:
 
  > document recent additions/changes:
    > Added 'Fast jpeg thumbnailing'.
@@ -96,9 +91,17 @@
    > add --geometry command line option
    > add [shift]+G grayscale alteration
    > add F11 for full screen toggle
+   > default edit commands not described.
+   > add formatted rename option.
+   > [Control]+V now shows image in new window
+   > [Shift]+P print shortcut added to collection and img-view windows.
+     (fixme, forgot to add it to find dialog).
 
    > add blurb about moving images between collections with shift+drag
 
+   > start documenting the pan view, at least the basic options
+     and how search works/what's supported
+
 
 Minor (non blockers):
 ----------------------------------------------
@@ -110,9 +113,6 @@
 
 d> update .desktop MimeType list to match Fedora's patch for missing formats
 
-d> allow multiple command line dirs to work as expected
-   (ie contents of each are treated as given on command line)
-
  > allow editor commands to be interrupted (via SIGTERM?)
  > fix hanging editor commands that await user input (how to handle, or even detect this?)
 
@@ -122,7 +122,7 @@
 
  > fix printing of transparent images to not use black for transparency (white or user settable).
 
- > add [control]+G to display as greyscale
+d> add [shift]+G to display as greyscale
 
  > fix comment field in keywords bar to a height of 2 or 3 text lines.
 
--- a/src/pan-view.c	Fri Nov 03 16:53:56 2006 +0000
+++ b/src/pan-view.c	Sat Nov 04 02:20:32 2006 +0000
@@ -302,6 +302,9 @@
 static GtkWidget *pan_popup_menu(PanWindow *pw);
 static void pan_fullscreen_toggle(PanWindow *pw, gint force_off);
 
+static void pan_search_toggle_visible(PanWindow *pw, gint enable);
+static void pan_search_activate(PanWindow *pw);
+
 static void pan_window_close(PanWindow *pw);
 
 static void pan_window_dnd_init(PanWindow *pw);
@@ -3423,11 +3426,14 @@
 	gint x = 0;
 	gint y = 0;
 	gint focused;
+	gint on_entry;
 
 	pr = PIXBUF_RENDERER(pw->imd->pr);
 	path = pan_menu_click_path(pw);
 
 	focused = (pw->fs || 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));
 
 	if (focused)
 		{
@@ -3529,6 +3535,12 @@
 			case 'P': case 'p':
 				if (path) info_window_new(path, NULL);
 				break;
+			case 'F': case 'f':
+				pan_search_toggle_visible(pw, TRUE);
+				break;
+			case 'G': case 'g':
+				pan_search_activate(pw);
+				break;
 			case 'W': case 'w':
 				pan_window_close(pw);
 				break;
@@ -3548,7 +3560,27 @@
 		}
 	else
 		{
-		if (focused)
+		stop_signal = TRUE;
+		switch (event->keyval)
+			{
+			case GDK_Escape:
+				if (pw->fs)
+					{
+					pan_fullscreen_toggle(pw, TRUE);
+					}
+				else
+					{
+					pan_search_toggle_visible(pw, FALSE);
+					}
+				break;
+			default:
+				stop_signal = FALSE;
+				break;
+			}
+
+		if (stop_signal) return stop_signal;
+
+		if (!on_entry)
 			{
 			stop_signal = TRUE;
 			switch (event->keyval)
@@ -3592,67 +3624,15 @@
 					break;
 				case GDK_Delete: case GDK_KP_Delete:
 					break;
-				case '/':
-					if (!pw->fs)
-						{
-						if (GTK_WIDGET_VISIBLE(pw->search_box))
-							{
-							gtk_widget_grab_focus(pw->search_entry);
-							}
-						else
-							{
-							gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pw->search_button), TRUE);
-							}
-						}
-					else
-						{
-						stop_signal = FALSE;
-						}
-					break;
-				case GDK_Escape:
-					if (pw->fs)
-						{
-						pan_fullscreen_toggle(pw, TRUE);
-						}
-					else if (GTK_WIDGET_VISIBLE(pw->search_entry))
-						{
-						gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pw->search_button), FALSE);
-						}
-					else
-						{
-						stop_signal = FALSE;
-						}
-					break;
 				case GDK_Menu:
 				case GDK_F10:
 					menu = pan_popup_menu(pw);
-					gtk_menu_popup(GTK_MENU(menu), NULL, NULL, pan_window_menu_pos_cb, pw, 0, GDK_CURRENT_TIME);
-					break;
-				default:
-					stop_signal = FALSE;
+					gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
+						       pan_window_menu_pos_cb, pw, 0, GDK_CURRENT_TIME);
 					break;
-				}
-			}
-		else
-			{
-			stop_signal = TRUE;
-			switch (event->keyval)
-				{
-				case GDK_Escape:
-					if (pw->fs)
-						{
-						pan_fullscreen_toggle(pw, TRUE);
-						}
-					else if (GTK_WIDGET_HAS_FOCUS(pw->search_entry))
-						{
-						gtk_widget_grab_focus(GTK_WIDGET(pw->imd->widget));
-						gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pw->search_button), FALSE);
-						}
-					else
-						{
-						stop_signal = FALSE;
-						}
-				break;
+				case '/':
+					pan_search_toggle_visible(pw, TRUE);
+					break;
 				default:
 					stop_signal = FALSE;
 					break;
@@ -3913,6 +3893,9 @@
 	ta = pan_text_alignment_new(pw, pbox->x + PREF_PAD_BORDER, pbox->y + PREF_PAD_BORDER, "info");
 
 	pan_text_alignment_add(ta, _("Filename:"), pi->fd->name);
+	buf = remove_level_from_path(pi->fd->path);
+	pan_text_alignment_add(ta, _("Location:"), buf);
+	g_free(buf);
 	pan_text_alignment_add(ta, _("Date:"), text_from_time(pi->fd->date));
 	buf = text_from_size(pi->fd->size);
 	pan_text_alignment_add(ta, _("Size:"), buf);
@@ -4288,6 +4271,22 @@
 	pan_search_status(pw, _("no match"));
 }
 
+static void pan_search_activate(PanWindow *pw)
+{
+	gchar *text;
+
+#if 0
+	if (!GTK_WIDGET_VISIBLE(pw->search_box))
+		{
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pw->search_button), TRUE);
+		}
+#endif
+
+	text = g_strdup(gtk_entry_get_text(GTK_ENTRY(pw->search_entry)));
+	pan_search_activate_cb(text, pw);
+	g_free(text);
+}
+
 static void pan_search_toggle_cb(GtkWidget *button, gpointer data)
 {
 	PanWindow *pw = data;
@@ -4309,6 +4308,34 @@
 		}
 }
 
+static void pan_search_toggle_visible(PanWindow *pw, gint enable)
+{
+	if (pw->fs) return;
+
+	if (enable)
+		{
+		if (GTK_WIDGET_VISIBLE(pw->search_box))
+			{
+			gtk_widget_grab_focus(pw->search_entry);
+			}
+		else
+			{
+			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pw->search_button), TRUE);
+			}
+		}
+	else
+		{
+		if (GTK_WIDGET_VISIBLE(pw->search_entry))
+			{
+			if (GTK_WIDGET_HAS_FOCUS(pw->search_entry))
+				{
+				gtk_widget_grab_focus(GTK_WIDGET(pw->imd->widget));
+				}
+			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pw->search_button), FALSE);
+			}
+		}
+}
+
 
 /*
  *-----------------------------------------------------------------------------