Restored oldstyle zoom in/out, and added a new userpref for denoting zoom
authorTon Roosendaal <ton@blender.org>
Wed, 16 Jun 2004 13:31:32 +0000 (13:31 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 16 Jun 2004 13:31:32 +0000 (13:31 +0000)
types:

- Continue: is default, old style
- Dolly: is like previous, but not continuous
- Scale: is the new method. Name is based on fact it scales view

source/blender/makesdna/DNA_userdef_types.h
source/blender/src/buttons_shading.c
source/blender/src/space.c
source/blender/src/view.c

index 67354720e6dd4448ac731192d125cbaec092397c..9696777ed4bbe083637a15449084b6c0d572c76b 100644 (file)
@@ -134,7 +134,7 @@ typedef struct UserDef {
        int gameflags;
        int wheellinescroll;
        short uiflag, language;
-       int userpref;
+       short userpref, viewzoom;
        short console_buffer;   //console vars here for tuhopuu compat, --phase
        short console_out;
        int mixbufsize;
@@ -170,6 +170,11 @@ extern UserDef U; /* from usiblender.c !!!! */
 #define USER_TWOBUTTONMOUSE            4096
 #define USER_NONUMPAD                  8192
 
+/* viewzom */
+#define USER_ZOOM_CONT                 0
+#define USER_ZOOM_SCALE                        1
+#define USER_ZOOM_DOLLY                        2
+
 /* uiflag */
 
 #define        USER_KEYINSERTACT               1
index 60dfd7164d488342c67183ec99df059ca7e1dff6..0af5857d1fe0363f422f4070b3fbfea1a6334e1e 100644 (file)
@@ -1686,7 +1686,7 @@ static void world_panel_mistaph(World *wrld)
        uiDefButF(block, NUM,REDRAWVIEW3D, "Sta:",10,70,140,19, &wrld->miststa, 0.0, 1000.0, 10, 0, "Specifies the starting distance of the mist");
        uiDefButF(block, NUM,REDRAWVIEW3D, "Di:",10,50,140,19, &wrld->mistdist, 0.0,1000.0, 10, 00, "Specifies the depth of the mist");
        uiDefButF(block, NUM,B_DIFF,"Hi:",              10,30,140,19, &wrld->misthi,0.0,100.0, 10, 0, "Specifies the factor for a less dense mist with increasing height");
-       uiDefButF(block, NUMSLI, 0, "Misi",             10,10,140,19,   &(wrld->misi), 0., 1.0, 0, 0, "Sets the mist intensity");
+       uiDefButF(block, NUMSLI, 0, "Misi ",            10,10,140,19,   &(wrld->misi), 0., 1.0, 0, 0, "Sets the mist intensity");
        uiBlockEndAlign(block);
 
        uiBlockSetCol(block, TH_BUT_SETTING1);
index 128d1ca07fc2df9a1f4abd6ac32d740cc9f05836..a0203e961c4cf11424379c07f1203a39d2362d58 100644 (file)
@@ -1973,31 +1973,31 @@ void drawinfospace(ScrArea *sa, void *spacedata)
        uiBlockSetCol(block, TH_BUT_SETTING1);
        uiBlockBeginAlign(block);
        
-       uiDefButI(block, ROW,B_USERPREF,"View & Controls",
+       uiDefButS(block, ROW,B_USERPREF,"View & Controls",
                xpos,ypostab,(short)dx,buth,
                &U.userpref,1.0,0.0, 0, 0,"");
                
-       uiDefButI(block, ROW,B_USERPREF,"Edit Methods",
+       uiDefButS(block, ROW,B_USERPREF,"Edit Methods",
                (short)(xpos+dx),ypostab,(short)dx,buth,
                &U.userpref,1.0,1.0, 0, 0,"");
 
-       uiDefButI(block, ROW,B_USERPREF,"Language & Font",
+       uiDefButS(block, ROW,B_USERPREF,"Language & Font",
                (short)(xpos+2*dx),ypostab,(short)dx,buth,
                &U.userpref,1.0,2.0, 0, 0,"");
 
-       uiDefButI(block, ROW,B_USERPREF,"Themes",
+       uiDefButS(block, ROW,B_USERPREF,"Themes",
                (short)(xpos+3*dx),ypostab,(short)dx,buth,
                &U.userpref,1.0,6.0, 0, 0,"");
 
-       uiDefButI(block, ROW,B_USERPREF,"Auto Save",
+       uiDefButS(block, ROW,B_USERPREF,"Auto Save",
                (short)(xpos+4*dx),ypostab,(short)dx,buth,
                &U.userpref,1.0,3.0, 0, 0,"");
 
-       uiDefButI(block, ROW,B_USERPREF,"System & OpenGL",
+       uiDefButS(block, ROW,B_USERPREF,"System & OpenGL",
                (short)(xpos+5*dx),ypostab,(short)dx,buth,
                &U.userpref,1.0,4.0, 0, 0,"");
                
-       uiDefButI(block, ROW,B_USERPREF,"File Paths",
+       uiDefButS(block, ROW,B_USERPREF,"File Paths",
                (short)(xpos+6*dx),ypostab,(short)dx,buth,
                &U.userpref,1.0,5.0, 0, 0,"");
 
@@ -2054,39 +2054,61 @@ void drawinfospace(ScrArea *sa, void *spacedata)
 
 
                uiDefBut(block, LABEL,0,"Menu Buttons:",
-                       (xpos+edgespace+medprefbut+(3*midspace)+(2*smallprefbut)),y3label,medprefbut,buth,
+                       (xpos+edgespace+medprefbut+(3*midspace)+(2*smallprefbut)),y4label,medprefbut,buth,
                        0, 0, 0, 0, 0, "");
 
                uiDefButBitS(block, TOG, USER_MENUOPENAUTO, 0, "Auto Open",
-                       (xpos+edgespace+medprefbut+(3*midspace)+(2*smallprefbut)),y2,smallprefbut,buth,
+                       (xpos+edgespace+medprefbut+(3*midspace)+(2*smallprefbut)),y3,smallprefbut,buth,
                        &(U.uiflag), 0, 0, 0, 0,
                        "Automatic opening of menu buttons");
 
                uiDefButS(block, NUM, 0, "ThresA:",
-                       (xpos+edgespace+medprefbut+(3*midspace)+(2*smallprefbut)),y1,smallprefbut,buth,
+                       (xpos+edgespace+medprefbut+(3*midspace)+(2*smallprefbut)),y2,smallprefbut,buth,
                        &(U.menuthreshold1), 1, 40, 0, 0,
                        "Time in 1/10 seconds for auto open");
 
                uiDefButS(block, NUM, 0, "ThresB:",
-                       (xpos+edgespace+medprefbut+(4*midspace)+(3*smallprefbut)),y1,smallprefbut,buth,
+                       (xpos+edgespace+medprefbut+(3*midspace)+(2*smallprefbut)),y1,smallprefbut,buth,
                        &(U.menuthreshold2), 1, 40, 0, 0,
                        "Time in 1/10 seconds for auto open sublevels");
 
 
-               uiDefBut(block, LABEL,0,"Toolbox Thresh.:",
-                       (xpos+edgespace+(3*midspace)+(3*medprefbut)),y3label,medprefbut,buth,
+
+               uiDefBut(block, LABEL,0,"Toolb. Thresh.:",
+                       (xpos+edgespace+medprefbut+(3*midspace)+(3*smallprefbut)),y4label,medprefbut,buth,
                        0, 0, 0, 0, 0, "");
 
                uiDefButS(block, NUM, 0, "LMB:",
-                       (xpos+edgespace+(3*midspace)+(3*medprefbut)),y2,smallprefbut,buth,
+                       (xpos+edgespace+medprefbut+(3*midspace)+(3*smallprefbut)),y2,smallprefbut,buth,
                        &(U.tb_leftmouse), 2, 40, 0, 0,
                        "Time in 1/10 seconds leftmouse hold to open toolbox");
 
                uiDefButS(block, NUM, 0, "RMB:",
-                       (xpos+edgespace+(3*midspace)+(3*medprefbut)),y1,smallprefbut,buth,
+                       (xpos+edgespace+medprefbut+(3*midspace)+(3*smallprefbut)),y1,smallprefbut,buth,
                        &(U.tb_rightmouse), 2, 40, 0, 0,
                        "Time in 1/10 seconds for rightmouse to open toolbox");
 
+
+               uiDefBut(block, LABEL,0,"View zoom:",
+                       (xpos+edgespace+medprefbut+(3*midspace)+(4*smallprefbut)),y4label,medprefbut,buth,
+                       0, 0, 0, 0, 0, "");
+
+               uiDefButS(block, ROW, 0, "Continue",
+                       (xpos+edgespace+medprefbut+(3*midspace)+(4*smallprefbut)),y3,smallprefbut,buth,
+                       &(U.viewzoom), 40, USER_ZOOM_CONT, 0, 0,
+                       "Old style zoom, continues while moving mouse up or down");
+
+               uiDefButS(block, ROW, 0, "Dolly",
+                       (xpos+edgespace+medprefbut+(3*midspace)+(4*smallprefbut)),y2,smallprefbut,buth,
+                       &(U.viewzoom), 40, USER_ZOOM_DOLLY, 0, 0,
+                       "Zooms in and out based on vertical mouse movement.");
+
+               uiDefButS(block, ROW, 0, "Scale",
+                       (xpos+edgespace+medprefbut+(3*midspace)+(4*smallprefbut)),y1,smallprefbut,buth,
+                       &(U.viewzoom), 40, USER_ZOOM_SCALE, 0, 0,
+                       "Zooms in and out like scaling the view, mouse movements relative to center.");
+
+
                        
                uiDefBut(block, LABEL,0,"View rotation:",
                        (xpos+edgespace+(3*midspace)+(3*medprefbut)+smallprefbut+2),y3label,medprefbut,buth,
@@ -2104,6 +2126,9 @@ void drawinfospace(ScrArea *sa, void *spacedata)
 
 
 
+               uiDefBut(block, LABEL,0,"Middle mouse button:",
+                       (xpos+edgespace+(3*midspace)+(4*medprefbut)),y3label,medprefbut,buth,
+                       0, 0, 0, 0, 0, "");
                uiDefButBitS(block, TOGN, USER_VIEWMOVE, B_DRAWINFO, "Rotate View",
                        (xpos+edgespace+(4*midspace)+(4*medprefbut)),y2,(smallprefbut+2),buth,
                        &(U.flag), 0, 0, 0, 0, "Default action for the middle mouse button");
@@ -2112,9 +2137,6 @@ void drawinfospace(ScrArea *sa, void *spacedata)
                        (xpos+edgespace+(4*midspace)+(4*medprefbut)+smallprefbut+2),y2,(smallprefbut+2),buth,
                        &(U.flag), 0, 0, 0, 0, "Default action for the middle mouse button");
 
-               uiDefBut(block, LABEL,0,"Middle mouse button:",
-                       (xpos+edgespace+(3*midspace)+(4*medprefbut)),y3label,medprefbut,buth,
-                       0, 0, 0, 0, 0, "");
                uiDefButBitS(block, TOG, USER_TWOBUTTONMOUSE, 0, "Emulate 3 Buttons",
                        (xpos+edgespace+(4*midspace)+(4*medprefbut)),y1,medprefbut,buth,
                        &(U.flag), 0, 0, 0, 0,
@@ -2122,7 +2144,6 @@ void drawinfospace(ScrArea *sa, void *spacedata)
 
 
 
-
                uiDefBut(block, LABEL,0,"Mousewheel:",
                        (xpos+edgespace+(4*midspace)+(5*medprefbut)),y3label,smallprefbut+15,buth,
                        0, 0, 0, 0, 0, "");
index ceeff4315271c144178313be620f8ad4ae9b80b4..d292f5a310c2dbd54e133a844389c6807431a943 100644 (file)
@@ -511,17 +511,28 @@ void viewmove(int mode)
                                }
                        }
                        else if(mode==2) {
-                               //the old method
-                               //G.vd->dist*= 1.0+(float)(mvalo[0]-mval[0]+mvalo[1]-mval[1])/1000.0;
-                               //my method which zooms based on how far you move the mouse
-                               int ctr[2], len1, len2;
-                               ctr[0] = (curarea->winrct.xmax + curarea->winrct.xmin)/2;
-                               ctr[1] = (curarea->winrct.ymax + curarea->winrct.ymin)/2;
-                               
-                               len1 = (int)sqrt((ctr[0] - mval[0])*(ctr[0] - mval[0]) + (ctr[1] - mval[1])*(ctr[1] - mval[1])) + 5;
-                               len2 = (int)sqrt((ctr[0] - mvalo[0])*(ctr[0] - mvalo[0]) + (ctr[1] - mvalo[1])*(ctr[1] - mvalo[1])) + 5;
-                               
-                               G.vd->dist= dist0 * ((float)len2/len1);
+                               if(U.viewzoom==USER_ZOOM_CONT) {
+                                       // oldstyle zoom
+                                       G.vd->dist*= 1.0+(float)(mvalo[0]-mval[0]+mvalo[1]-mval[1])/1000.0;
+                               }
+                               else if(U.viewzoom==USER_ZOOM_SCALE) {
+                                       int ctr[2], len1, len2;
+                                       // method which zooms based on how far you move the mouse
+                                       
+                                       ctr[0] = (curarea->winrct.xmax + curarea->winrct.xmin)/2;
+                                       ctr[1] = (curarea->winrct.ymax + curarea->winrct.ymin)/2;
+                                       
+                                       len1 = (int)sqrt((ctr[0] - mval[0])*(ctr[0] - mval[0]) + (ctr[1] - mval[1])*(ctr[1] - mval[1])) + 5;
+                                       len2 = (int)sqrt((ctr[0] - mvalo[0])*(ctr[0] - mvalo[0]) + (ctr[1] - mvalo[1])*(ctr[1] - mvalo[1])) + 5;
+                                       
+                                       G.vd->dist= dist0 * ((float)len2/len1);
+                               }
+                               else {  /* USER_ZOOM_DOLLY */
+                                       float len1 = (curarea->winrct.ymax - mval[1]) + 5;
+                                       float len2 = (curarea->winrct.ymax - mvalo[1]) + 5;
+                                       
+                                       G.vd->dist= dist0 * (2.0*((len2/len1)-1.0) + 1.0);
+                               }
                                
                                /* these limits are in toets.c too */
                                if(G.vd->dist<0.001*G.vd->grid) G.vd->dist= 0.001*G.vd->grid;