+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>
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);
}
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;
}
}
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);
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"));
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"));
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;
pi = work->data;
work = work->prev;
- if (pi->fd)
+ if (pi->fd && (pi->type == type || type == ITEM_NONE))
{
struct tm *tl;
time_t t;
gchar *message;
gchar *buf;
+ ItemType type;
if (!text) return FALSE;
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)
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)
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)