Revert changes committed by accident in 24168
authorMartin Poirier <theeth@yahoo.com>
Fri, 30 Oct 2009 17:50:45 +0000 (17:50 +0000)
committerMartin Poirier <theeth@yahoo.com>
Fri, 30 Oct 2009 17:50:45 +0000 (17:50 +0000)
(this was experimental code for "ladder-like" mouse adjustment of float values)

source/blender/editors/interface/interface_handlers.c

index c40c2aeb32cf0ec52876a8f056af8e9b6490eda6..5cdf3b9dcc8ad28bedfa78f951bf8d6eed4bd53d 100644 (file)
@@ -2034,10 +2034,9 @@ static float ui_numedit_apply_snap(int temp, float softmin, float softmax, int s
        return temp;
 }
 
-static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, int snap, int mx, int my)
+static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, int snap, int mx)
 {
        float deler, tempf, softmin, softmax, softrange;
-       float ladder = powf(10.0, floorf((my - data->dragstarty) / 100.0f));
        int lvalue, temp, changed= 0;
        
        if(mx == data->draglastx)
@@ -2063,7 +2062,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
                 * 2px == 1-int, or 1px == 1-ClickStep */
                if(ui_is_but_float(but)) {
                        fac *= 0.01*but->a1;
-                       tempf = data->startvalue + ((mx - data->dragstartx) * fac) * ladder;
+                       tempf = data->startvalue + ((mx - data->dragstartx) * fac);
                        tempf= ui_numedit_apply_snapf(tempf, softmin, softmax, softrange, snap);
 
 #if 1          /* fake moving the click start, nicer for dragging back after passing the limit */
@@ -2087,7 +2086,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
                else {
                        fac = 0.5; /* simple 2px == 1 */
 
-                       temp= data->startvalue + ((mx - data->dragstartx) * fac) * ladder;
+                       temp= data->startvalue + ((mx - data->dragstartx) * fac);
                        temp= ui_numedit_apply_snap(temp, softmin, softmax, snap);
 
 #if 1          /* fake moving the click start, nicer for dragging back after passing the limit */
@@ -2122,13 +2121,13 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
 
                if(ui_is_but_float(but) && softrange > 11) {
                        /* non linear change in mouse input- good for high precicsion */
-                       data->dragf+= (((float)(mx-data->draglastx))/deler) * (fabs(data->dragstartx-mx)*0.002)*ladder;
+                       data->dragf+= (((float)(mx-data->draglastx))/deler) * (fabs(data->dragstartx-mx)*0.002);
                } else if (!ui_is_but_float(but) && softrange > 129) { /* only scale large int buttons */
                        /* non linear change in mouse input- good for high precicsionm ints need less fine tuning */
-                       data->dragf+= (((float)(mx-data->draglastx))/deler) * (fabs(data->dragstartx-mx)*0.004)*ladder;
+                       data->dragf+= (((float)(mx-data->draglastx))/deler) * (fabs(data->dragstartx-mx)*0.004);
                } else {
                        /*no scaling */
-                       data->dragf+= ((float)(mx-data->draglastx))/deler*ladder ;
+                       data->dragf+= ((float)(mx-data->draglastx))/deler ;
                }
        
                if(data->dragf>1.0) data->dragf= 1.0;
@@ -2198,7 +2197,6 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
                        }
                        else if(event->type == LEFTMOUSE) {
                                data->dragstartx= data->draglastx= ui_is_a_warp_but(but) ? screen_mx:mx;
-                               data->dragstarty= data->draglasty= ui_is_a_warp_but(but) ? screen_my:my;
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
                                retval= WM_UI_HANDLER_BREAK;
                        }
@@ -2237,7 +2235,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
                        
                        snap= (event->ctrl)? (event->shift)? 2: 1: 0;
 
-                       if(ui_numedit_but_NUM(but, data, fac, snap, (ui_is_a_warp_but(but) ? screen_mx:mx), (ui_is_a_warp_but(but) ? screen_my:my)))
+                       if(ui_numedit_but_NUM(but, data, fac, snap, (ui_is_a_warp_but(but) ? screen_mx:mx)))
                                ui_numedit_apply(C, block, but, data);
                }
                retval= WM_UI_HANDLER_BREAK;
@@ -2423,9 +2421,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
                        }
                        else if(event->type == LEFTMOUSE) {
                                data->dragstartx= mx;
-                               data->dragstarty= my;
                                data->draglastx= mx;
-                               data->draglasty= my;
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
                                retval= WM_UI_HANDLER_BREAK;
                        }
@@ -2526,10 +2522,14 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
                if(event->val==KM_PRESS) {
                        if(event->type == LEFTMOUSE) {
-                               data->dragstartx= mx;
-                               data->draglastx= mx;
-                               data->dragstartx= my;
-                               data->draglastx= my;
+                               if(horizontal) {
+                                       data->dragstartx= mx;
+                                       data->draglastx= mx;
+                               }
+                               else {
+                                       data->dragstartx= my;
+                                       data->draglastx= my;
+                               }
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
                                retval= WM_UI_HANDLER_BREAK;
                        }