From 1e3ca6a1112cce4aff05e349c5c7d392fc633660 Mon Sep 17 00:00:00 2001 From: John Ellis Date: Sat, 4 Nov 2006 02:20:32 +0000 Subject: [PATCH] Fri Nov 3 21:15:40 2006 John Ellis * 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. --- ChangeLog | 6 +++ TODO | 22 ++++---- src/pan-view.c | 141 +++++++++++++++++++++++++++++-------------------- 3 files changed, 101 insertions(+), 68 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1a43f9c1..c7c8904f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Nov 3 21:15:40 2006 John Ellis + + * 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 * bar_exif.[ch]: Make list of general exif tags available to rest of diff --git a/TODO b/TODO index 3a75a499..be3dbe36 100644 --- a/TODO +++ b/TODO @@ -61,7 +61,7 @@ d> figure out if crash when expanding a folder in the folder tree view when pess 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 @@ d> figure out if crash when expanding a folder in the folder tree view when pess > 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 @@ d> figure out if crash when expanding a folder in the folder tree view when pess > 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 icon used for window to the (not so) new icon 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 @@ d> allow multiple command line dirs to work as expected > 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. diff --git a/src/pan-view.c b/src/pan-view.c index 5b52d28e..ff3e8a53 100644 --- a/src/pan-view.c +++ b/src/pan-view.c @@ -302,6 +302,9 @@ static void pan_window_layout_update_idle(PanWindow *pw); 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 @@ static gint pan_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpoin 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 @@ static gint pan_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpoin 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 @@ static gint pan_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpoin } 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 @@ static gint pan_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpoin 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); + gtk_menu_popup(GTK_MENU(menu), NULL, NULL, + pan_window_menu_pos_cb, pw, 0, GDK_CURRENT_TIME); break; - default: - stop_signal = FALSE; + case '/': + pan_search_toggle_visible(pw, TRUE); 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; default: stop_signal = FALSE; break; @@ -3913,6 +3893,9 @@ static void pan_info_update(PanWindow *pw, PanItem *pi) 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 @@ static void pan_search_activate_cb(const gchar *text, gpointer data) 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_cb(GtkWidget *button, gpointer data) } } +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); + } + } +} + /* *----------------------------------------------------------------------------- -- 2.20.1