From: <enl...@li...> - 2002-01-06 10:22:32
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : apps/e Dir : e17/apps/e/src Modified Files: scrollbar.c view.c Log Message: Allow scrollbars with width/height other than 12 Click in trough scrolls to that point. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/scrollbar.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- scrollbar.c 2001/11/03 14:55:21 1.9 +++ scrollbar.c 2002/01/06 10:22:31 1.10 @@ -83,7 +83,13 @@ } if (sb->base) { + int w, h; + ebits_add_to_evas(sb->base, sb->evas); + ebits_get_min_size(sb->base, &w, &h); + sb->w = w; + sb->h = h; + ebits_set_classed_bit_callback(sb->base, "Scrollbar_Trough", CALLBACK_MOUSE_DOWN, e_sb_base_down_cb, sb); ebits_set_classed_bit_callback(sb->base, "Scrollbar_Trough", CALLBACK_MOUSE_UP, e_sb_base_up_cb, sb); ebits_set_classed_bit_callback(sb->base, "Scrollbar_Arrow1", CALLBACK_MOUSE_DOWN, e_sb_base_down_cb, sb); @@ -127,6 +133,13 @@ } else if (!strcmp(class, "Scrollbar_Trough")) { + if (sb->direction) + sb->val = ( y - sb->bar_area.y ); + else + sb->val = ( x - sb->bar_area.x ); + + if (sb->val < 0) sb->val = 0; + if ((sb->val + sb->range) > sb->max) sb->val = sb->max - sb->range; } e_scrollbar_recalc(sb); if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y); @@ -205,7 +218,6 @@ double prev; D_ENTER; - sb = data; if (!sb->mouse_down) D_RETURN; dx = x - sb->mouse_x; =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/view.c,v retrieving revision 1.107 retrieving revision 1.108 diff -u -3 -r1.107 -r1.108 --- view.c 2002/01/05 05:01:08 1.107 +++ view.c 2002/01/06 10:22:31 1.108 @@ -635,6 +635,7 @@ D_ENTER; e_view_icons_get_extents(v, &min_x, &min_y, &max_x, &max_y); + if (sx < v->size.w - v->spacing.window.r - max_x) sx = v->size.w - v->spacing.window.r - max_x; if (sx > v->spacing.window.l - min_x) @@ -643,6 +644,7 @@ sy = v->size.h - v->spacing.window.b - max_y; if (sy > v->spacing.window.t - min_y) sy = v->spacing.window.t - min_y; + if ((sx == v->scroll.x) && (v->scroll.y == sy)) D_RETURN; v->scroll.x = sx; v->scroll.y = sy; @@ -673,6 +675,7 @@ e_view_icons_get_extents(v, &min_x, &min_y, &max_x, &max_y); sx = (psx * ((double)max_x - (double)min_x)) - min_x; sy = (psy * ((double)max_y - (double)min_y)) - min_y; + if (sx < v->size.w - v->spacing.window.r - max_x) sx = v->size.w - v->spacing.window.r - max_x; if (sx > v->spacing.window.l - min_x) @@ -681,6 +684,7 @@ sy = v->size.h - v->spacing.window.b - max_y; if (sy > v->spacing.window.t - min_y) sy = v->spacing.window.t - min_y; + if ((sx == v->scroll.x) && (v->scroll.y == sy)) D_RETURN; v->scroll.x = sx; v->scroll.y = sy; @@ -899,10 +903,10 @@ e_view_scroll_to(v, v->scroll.x, v->scroll.y); e_view_arrange(v); e_view_queue_geometry_record(v); - e_scrollbar_move(v->scrollbar.v, v->size.w - 12, 0); - e_scrollbar_resize(v->scrollbar.v, 12, v->size.h - 12); - e_scrollbar_move(v->scrollbar.h, 0, v->size.h - 12); - e_scrollbar_resize(v->scrollbar.h, v->size.w - 12, 12); + e_scrollbar_move(v->scrollbar.v, v->size.w - v->scrollbar.v->w, 0); + e_scrollbar_resize(v->scrollbar.v, v->scrollbar.v->w, v->size.h - v->scrollbar.h->h); + e_scrollbar_move(v->scrollbar.h, 0, v->size.h - v->scrollbar.h->h); + e_scrollbar_resize(v->scrollbar.h, v->size.w - v->scrollbar.v->w, v->scrollbar.h->h); if (v->iconbar) e_iconbar_fix(v->iconbar); } } @@ -1499,6 +1503,7 @@ x = v->spacing.window.l; y = v->spacing.window.t; + for (l = v->icons; l; l = l->next) { E_Icon *ic; @@ -1976,10 +1981,10 @@ e_scrollbar_set_range(v->scrollbar.h, 1.0); e_scrollbar_set_max(v->scrollbar.h, 1.0); - e_scrollbar_move(v->scrollbar.v, v->size.w - 12, 0); - e_scrollbar_resize(v->scrollbar.v, 12, v->size.h - 12); - e_scrollbar_move(v->scrollbar.h, 0, v->size.h - 12); - e_scrollbar_resize(v->scrollbar.h, v->size.w - 12, 12); + e_scrollbar_move(v->scrollbar.v, v->size.w - v->scrollbar.v->w, 0); + e_scrollbar_resize(v->scrollbar.v, v->scrollbar.v->w, v->size.h - v->scrollbar.h->h); + e_scrollbar_move(v->scrollbar.h, 0, v->size.h - v->scrollbar.h->h); + e_scrollbar_resize(v->scrollbar.h, v->size.w - v->scrollbar.v->w, v->scrollbar.h->h); /* I support dnd */ ecore_window_dnd_advertise(v->win.base); |