Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorRob Haarsma <phaseIV@zonnet.nl>2003-01-31 20:22:20 +0300
committerRob Haarsma <phaseIV@zonnet.nl>2003-01-31 20:22:20 +0300
commitd1d3969d7dab76983cd91bba702518921d8c77be (patch)
tree2702adc26fe8058801022ad0065de71a4829e01d /source
parentfefaf2ff0f2d001f5b96710e5cf0de319c9442d6 (diff)
added mousewheel support for UV Image window
Diffstat (limited to 'source')
-rw-r--r--source/blender/src/drawimage.c49
-rw-r--r--source/blender/src/space.c24
2 files changed, 53 insertions, 20 deletions
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index 9c5370600e5..efe75fc4586 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -54,6 +54,7 @@
#include "DNA_packedFile_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
+#include "DNA_userdef_types.h"
#include "BKE_utildefines.h"
#include "BKE_global.h"
@@ -541,6 +542,54 @@ void image_viewmove(void)
}
}
+void image_viewzoom(unsigned short event)
+{
+ SpaceImage *sima= curarea->spacedata.first;
+ int width, height;
+
+ if(U.uiflag & WHEELZOOMDIR) {
+ if (event==WHEELDOWNMOUSE || event == PADPLUSKEY) {
+ sima->zoom *= 2;
+ } else {
+ sima->zoom /= 2;
+ /* Check if the image will still be visible after zooming out */
+ if (sima->zoom < 1) {
+ calc_image_view(G.sima, 'p');
+ if (sima->image) {
+ if (sima->image->ibuf) {
+ width = sima->image->ibuf->x * sima->zoom;
+ height = sima->image->ibuf->y * sima->zoom;
+ if ((width < 4) && (height < 4)) {
+ /* Image will become too small, reset value */
+ sima->zoom *= 2;
+ }
+ }
+ }
+ }
+ }
+ } else {
+ if (event==WHEELUPMOUSE || event == PADPLUSKEY) {
+ sima->zoom *= 2;
+ } else {
+ sima->zoom /= 2;
+ /* Check if the image will still be visible after zooming out */
+ if (sima->zoom < 1) {
+ calc_image_view(G.sima, 'p');
+ if (sima->image) {
+ if (sima->image->ibuf) {
+ width = sima->image->ibuf->x * sima->zoom;
+ height = sima->image->ibuf->y * sima->zoom;
+ if ((width < 4) && (height < 4)) {
+ /* Image will become too small, reset value */
+ sima->zoom *= 2;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
/**
* Updates the fields of the View2D member of the SpaceImage struct.
* Default behavior is to reset the position of the image and set the zoom to 1
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 4be129d5679..4bb247fafac 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -1999,7 +1999,6 @@ void winqreadimagespace(unsigned short event, short val, char ascii)
{
SpaceImage *sima= curarea->spacedata.first;
View2D *v2d= &sima->v2d;
- int width, height;
#ifdef NAN_TPT
IMG_BrushPtr brush;
IMG_CanvasPtr canvas;
@@ -2108,31 +2107,16 @@ void winqreadimagespace(unsigned short event, short val, char ascii)
case MIDDLEMOUSE:
image_viewmove();
break;
+ case WHEELUPMOUSE:
+ case WHEELDOWNMOUSE:
case PADPLUSKEY:
- sima->zoom *= 2;
+ case PADMINUS:
+ image_viewzoom(event);
scrarea_queue_winredraw(curarea);
break;
case HOMEKEY:
image_home();
break;
- case PADMINUS:
- sima->zoom /= 2;
- /* Check if the image will still be visible after zooming out */
- if (sima->zoom < 1) {
- calc_image_view(G.sima, 'p');
- if (sima->image) {
- if (sima->image->ibuf) {
- width = sima->image->ibuf->x * sima->zoom;
- height = sima->image->ibuf->y * sima->zoom;
- if ((width < 4) && (height < 4)) {
- /* Image will become too small, reset value */
- sima->zoom *= 2;
- }
- }
- }
- }
- scrarea_queue_winredraw(curarea);
- break;
}
}