##### Note: GQview CVS on sourceforge is not always up to date, please use #####
authorJohn Ellis <johne@verizon.net>
Wed, 2 Mar 2005 02:47:53 +0000 (02:47 +0000)
committerJohn Ellis <johne@verizon.net>
Wed, 2 Mar 2005 02:47:53 +0000 (02:47 +0000)
##### 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.

ChangeLog
src/image.c
src/image.h
src/pan-view.c

index 37842c0..51140b4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
index 35f9492..aad6af7 100644 (file)
@@ -3427,12 +3427,20 @@ void image_scroll(ImageWindow *imd, gint x, gint y)
        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;
+       gint ax, ay;
 
-       px = (gdouble)x * imd->scale - imd->x_scroll;
-       py = (gdouble)y * imd->scale - imd->y_scroll;
+       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);
 }
index b5c03a2..0d811a3 100644 (file)
@@ -56,7 +56,8 @@ void image_change_from_image(ImageWindow *imd, ImageWindow *source);
 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 */
index 3c5bcf9..aae7dee 100644 (file)
@@ -1674,8 +1674,8 @@ static void pan_window_layout_compute_folders_flower(PanWindow *pw, const gchar
        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 @@ static gint pan_window_layout_update_idle_cb(gpointer data)
 
        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 @@ static gint pan_search_by_path(PanWindow *pw, const gchar *path)
        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 @@ static gint pan_search_by_partial(PanWindow *pw, const gchar *text)
        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 @@ static gint valid_date_separator(gchar c)
        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 @@ static PanItem *pan_search_by_date_val(PanWindow *pw, gint year, gint month, gin
                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 @@ static gint pan_search_by_date(PanWindow *pw, const gchar *text)
        time_t t;
        gchar *message;
        gchar *buf;
+       ItemType type;
 
        if (!text) return FALSE;
 
@@ -3320,11 +3332,15 @@ static gint pan_search_by_date(PanWindow *pw, const gchar *text)
        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 @@ static void pan_window_scrollbar_h_value_cb(GtkRange *range, gpointer data)
 
        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 @@ static void pan_window_scrollbar_v_value_cb(GtkRange *range, gpointer data)
 
        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)