comparison src/image.c @ 14:25335c62cd9b

##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. ##### Thu Mar 3 01:16:23 2005 John Ellis <johne@verizon.net> * pan-view.c: Add 'dots' image size option, fix up border size at edge of grid, and make drag and drop work to/from the window. Wed Mar 2 23:34:30 2005 John Ellis <johne@verizon.net> * globals.c, gqview.h, rcfile.c: Add thumbnail_fast option variable. * image-load.c, typedefs.h: Add shrunk flag to determine if an image was scaled down using image_loader_set_requested_size. * image.c: Make panning with mouse scroll more when holding shift key. * preferences.c: Add option for 'Fast jpeg thumbnailing' and disabled xvpics option in the gui - now a hidden option. * thumb.c, thumb_standard.c: Add support for thumbnail_fast option..
author gqview
date Thu, 03 Mar 2005 06:32:53 +0000
parents ef790149ae21
children 17acca639a86
comparison
equal deleted inserted replaced
13:ef790149ae21 14:25335c62cd9b
21 #include "ui_fileops.h" 21 #include "ui_fileops.h"
22 22
23 #include <math.h> 23 #include <math.h>
24 24
25 25
26 /* size to use when breaking up image pane for rendering */
26 #define IMAGE_TILE_SIZE 512 27 #define IMAGE_TILE_SIZE 512
28
29 /* default min and max zoom */
27 #define IMAGE_ZOOM_MIN -32.0 30 #define IMAGE_ZOOM_MIN -32.0
28 #define IMAGE_ZOOM_MAX 32.0 31 #define IMAGE_ZOOM_MAX 32.0
29 32
30 /* size of the image loader buffer (512 bytes x defined number) */ 33 /* size of the image loader buffer (512 bytes x defined number) */
31 #define IMAGE_LOAD_BUFFER_COUNT 8 34 #define IMAGE_LOAD_BUFFER_COUNT 8
39 /* the file size at which throttling take place */ 42 /* the file size at which throttling take place */
40 #define IMAGE_THROTTLE_THRESHOLD 1048576 43 #define IMAGE_THROTTLE_THRESHOLD 1048576
41 44
42 /* distance to drag mouse to disable image flip */ 45 /* distance to drag mouse to disable image flip */
43 #define IMAGE_DRAG_SCROLL_THRESHHOLD 4 46 #define IMAGE_DRAG_SCROLL_THRESHHOLD 4
47
48 /* increase pan rate when holding down shift */
49 #define IMAGE_PAN_SHIFT_MULTIPLIER 6
44 50
45 /* alpha channel checkerboard background (same as gimp) */ 51 /* alpha channel checkerboard background (same as gimp) */
46 #define IMAGE_ALPHA_CHECK1 0x00999999 52 #define IMAGE_ALPHA_CHECK1 0x00999999
47 #define IMAGE_ALPHA_CHECK2 0x00666666 53 #define IMAGE_ALPHA_CHECK2 0x00666666
48 #define IMAGE_ALPHA_CHECK_SIZE 16 54 #define IMAGE_ALPHA_CHECK_SIZE 16
2999 */ 3005 */
3000 3006
3001 static gint image_mouse_motion_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) 3007 static gint image_mouse_motion_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
3002 { 3008 {
3003 ImageWindow *imd = data; 3009 ImageWindow *imd = data;
3010 gint accel;
3004 3011
3005 if (imd->scroller_id != -1) 3012 if (imd->scroller_id != -1)
3006 { 3013 {
3007 imd->scroller_xpos = bevent->x; 3014 imd->scroller_xpos = bevent->x;
3008 imd->scroller_ypos = bevent->y; 3015 imd->scroller_ypos = bevent->y;
3017 else 3024 else
3018 { 3025 {
3019 widget_set_cursor (imd->image, GDK_FLEUR); 3026 widget_set_cursor (imd->image, GDK_FLEUR);
3020 } 3027 }
3021 3028
3029 if (bevent->state & GDK_SHIFT_MASK)
3030 {
3031 accel = IMAGE_PAN_SHIFT_MULTIPLIER;
3032 }
3033 else
3034 {
3035 accel = 1;
3036 }
3037
3022 /* do the scroll */ 3038 /* do the scroll */
3023 image_scroll_real(imd, imd->drag_last_x - bevent->x, imd->drag_last_y - bevent->y); 3039 image_scroll_real(imd, (imd->drag_last_x - bevent->x) * accel,
3040 (imd->drag_last_y - bevent->y) * accel);
3024 3041
3025 imd->drag_last_x = bevent->x; 3042 imd->drag_last_x = bevent->x;
3026 imd->drag_last_y = bevent->y; 3043 imd->drag_last_y = bevent->y;
3027 3044
3028 return FALSE; 3045 return FALSE;
3076 gtk_grab_remove(imd->image); 3093 gtk_grab_remove(imd->image);
3077 gdk_pointer_ungrab(bevent->time); 3094 gdk_pointer_ungrab(bevent->time);
3078 widget_set_cursor(imd->image, -1); 3095 widget_set_cursor(imd->image, -1);
3079 } 3096 }
3080 3097
3081 if (bevent->button == 1 && (bevent->state & GDK_SHIFT_MASK)) 3098 if (imd->drag_moved < IMAGE_DRAG_SCROLL_THRESHHOLD)
3082 { 3099 {
3083 image_scroller_start(imd, bevent->x, bevent->y); 3100 if (bevent->button == 1 && (bevent->state & GDK_SHIFT_MASK))
3084 } 3101 {
3085 else if (bevent->button == 1 || bevent->button == 2) 3102 image_scroller_start(imd, bevent->x, bevent->y);
3086 { 3103 }
3087 if (imd->drag_moved < IMAGE_DRAG_SCROLL_THRESHHOLD) image_button_do(imd, bevent); 3104 else if (bevent->button == 1 || bevent->button == 2)
3105 {
3106 image_button_do(imd, bevent);
3107 }
3088 } 3108 }
3089 3109
3090 imd->in_drag = FALSE; 3110 imd->in_drag = FALSE;
3091 3111
3092 return FALSE; 3112 return FALSE;