Mercurial > geeqie
changeset 13:ef790149ae21
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
##### an offical release when making enhancements and translation updates. #####
Tue Mar 1 21:39:42 2005 John Ellis <johne@verizon.net>
* image.[ch] (image_scroll_to_point): Add alignment for location of
point within visible region.
* pan-view.c: Use alignment for scrolling above, and fix date search
to only search thumbs and images.
author | gqview |
---|---|
date | Wed, 02 Mar 2005 02:47:53 +0000 |
parents | 147f4c4b9025 |
children | 25335c62cd9b |
files | ChangeLog src/image.c src/image.h src/pan-view.c |
diffstat | 4 files changed, 54 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Mar 01 17:16:34 2005 +0000 +++ b/ChangeLog Wed Mar 02 02:47:53 2005 +0000 @@ -1,15 +1,23 @@ +Tue Mar 1 21:39:42 2005 John Ellis <johne@verizon.net> + + * image.[ch] (image_scroll_to_point): Add alignment for location of + point within visible region. + * pan-view.c: Use alignment for scrolling above, and fix date search + to only search thumbs and images. + Tue Mar 1 11:32:26 2005 John Ellis <johne@verizon.net> * src/Makefile.am: Add pan-view.[ch]: - * image.[ch]: Add support for using a grid of tiles as soource image. Added - scroll_notify callback for when the viewable regionis scrolled. Added ability - to set min and max for the zoom range. Removed unnecessary - gtk_widget_size_request from image_size_sync. Added image_scroll_to_point. + * image.[ch]: Add support for using a grid of tiles as soource image. + Added scroll_notify callback for when the viewable regionis scrolled. + Added ability to set min and max for the zoom range. Removed + unnecessary gtk_widget_size_request from image_size_sync. Added + image_scroll_to_point. * layout_util.c: Add menu item and callback for the new 'Pan view'. * pixbuf_util.c (pixbuf_draw_layout): Fix for when offset is non-zero. * typedefs.h: Add source tile stuff for ImageWindow. * ui_tabcomp.c: Fix tab completion pop-up menu placement. - * pan-view.[ch]: New files for the pan view - 2.1 is officially started :) + * pan-view.[ch]: New files for pan view - 2.1 is officially started :) Sat Feb 26 14:42:42 2005 John Ellis <johne@verizon.net>
--- a/src/image.c Tue Mar 01 17:16:34 2005 +0000 +++ b/src/image.c Wed Mar 02 02:47:53 2005 +0000 @@ -3427,12 +3427,20 @@ image_scroll_real(imd, x, y); } -void image_scroll_to_point(ImageWindow *imd, gint x, gint y) +void image_scroll_to_point(ImageWindow *imd, gint x, gint y, + gdouble x_align, gdouble y_align) { gint px, py; - - px = (gdouble)x * imd->scale - imd->x_scroll; - py = (gdouble)y * imd->scale - imd->y_scroll; + gint ax, ay; + + x_align = CLAMP(x_align, 0.0, 1.0); + y_align = CLAMP(y_align, 0.0, 1.0); + + ax = (gdouble)imd->vis_width * x_align; + ay = (gdouble)imd->vis_height * y_align; + + px = (gdouble)x * imd->scale - (imd->x_scroll + ax); + py = (gdouble)y * imd->scale - (imd->y_scroll + ay); image_scroll(imd, px, py); }
--- a/src/image.h Tue Mar 01 17:16:34 2005 +0000 +++ b/src/image.h Wed Mar 02 02:47:53 2005 +0000 @@ -56,7 +56,8 @@ void image_area_changed(ImageWindow *imd, gint x, gint y, gint width, gint height); void image_reload(ImageWindow *imd); void image_scroll(ImageWindow *imd, gint x, gint y); -void image_scroll_to_point(ImageWindow *imd, gint x, gint y); +void image_scroll_to_point(ImageWindow *imd, gint x, gint y, + gdouble x_align, gdouble y_align); void image_alter(ImageWindow *imd, AlterType type); /* zoom */
--- a/src/pan-view.c Tue Mar 01 17:16:34 2005 +0000 +++ b/src/pan-view.c Wed Mar 02 02:47:53 2005 +0000 @@ -1674,8 +1674,8 @@ pi = pan_item_find_by_path(pw, ITEM_BOX, path, FALSE, FALSE); if (pi) { - *scroll_x = pi->x - PAN_FOLDER_BOX_BORDER; - *scroll_y = pi->y - PAN_FOLDER_BOX_BORDER; + *scroll_x = pi->x + pi->width / 2; + *scroll_y = pi->y + pi->height / 2; } } @@ -2783,11 +2783,22 @@ if (width > 0 && height > 0) { + gdouble align; + image_set_image_as_tiles(pw->imd, width, height, PAN_TILE_SIZE, PAN_TILE_SIZE, 8, pan_window_request_tile_cb, pan_window_dispose_tile_cb, pw, 1.0); - image_scroll_to_point(pw->imd, scroll_x, scroll_y); + + if (scroll_x == 0 && scroll_y == 0) + { + align = 0.0; + } + else + { + align = 0.5; + } + image_scroll_to_point(pw->imd, scroll_x, scroll_y, align, align); } pan_window_message(pw, NULL); @@ -3161,7 +3172,7 @@ if (!pi) return FALSE; pan_info_update(pw, pi); - image_scroll_to_point(pw->imd, pi->x - PAN_THUMB_GAP, pi->y - PAN_THUMB_GAP); + image_scroll_to_point(pw->imd, pi->x + pi->width / 2, pi->y + pi->height / 2, 0.5, 0.5); pan_search_status(pw, (path[0] == '/') ? _("path found") : _("filename found")); @@ -3188,7 +3199,7 @@ if (!pi) return FALSE; pan_info_update(pw, pi); - image_scroll_to_point(pw->imd, pi->x - PAN_THUMB_GAP, pi->y - PAN_THUMB_GAP); + image_scroll_to_point(pw->imd, pi->x + pi->width / 2, pi->y + pi->height / 2, 0.5, 0.5); pan_search_status(pw, _("partial match")); @@ -3200,7 +3211,7 @@ return (c == '/' || c == '-' || c == ' ' || c == '.' || c == ','); } -static PanItem *pan_search_by_date_val(PanWindow *pw, gint year, gint month, gint day) +static PanItem *pan_search_by_date_val(PanWindow *pw, ItemType type, gint year, gint month, gint day) { GList *work; @@ -3212,7 +3223,7 @@ pi = work->data; work = work->prev; - if (pi->fd) + if (pi->fd && (pi->type == type || type == ITEM_NONE)) { struct tm *tl; @@ -3245,6 +3256,7 @@ time_t t; gchar *message; gchar *buf; + ItemType type; if (!text) return FALSE; @@ -3320,11 +3332,15 @@ t = date_to_time(year, month, day); if (t < 0) return FALSE; - pi = pan_search_by_date_val(pw, year, month, day); + type = (pw->size > LAYOUT_SIZE_THUMB_LARGE) ? ITEM_IMAGE : ITEM_THUMB; + + pi = pan_search_by_date_val(pw, type, year, month, day); if (pi) { pan_info_update(pw, pi); - image_scroll_to_point(pw->imd, pi->x - PAN_THUMB_GAP, pi->y - PAN_THUMB_GAP); + image_scroll_to_point(pw->imd, + pi->x - PAN_FOLDER_BOX_BORDER * 5 / 2, + pi->y, 0.0, 0.5); } if (month > 0) @@ -3587,7 +3603,7 @@ x = (gint)gtk_range_get_value(range); - image_scroll_to_point(pw->imd, x, (gint)((gdouble)pw->imd->y_scroll / pw->imd->scale)); + image_scroll_to_point(pw->imd, x, (gint)((gdouble)pw->imd->y_scroll / pw->imd->scale), 0.0, 0.0); } static void pan_window_scrollbar_v_value_cb(GtkRange *range, gpointer data) @@ -3599,7 +3615,7 @@ y = (gint)gtk_range_get_value(range); - image_scroll_to_point(pw->imd, (gint)((gdouble)pw->imd->x_scroll / pw->imd->scale), y); + image_scroll_to_point(pw->imd, (gint)((gdouble)pw->imd->x_scroll / pw->imd->scale), y, 0.0, 0.0); } static void pan_window_layout_change_cb(GtkWidget *combo, gpointer data)