[#20700] Transformation Increments

Patch by Jonathan Smith

When using numerical input, up and down arrow keys increment and decrement the value by the transform increment amount (grid for grab and so on).
This commit is contained in:
Martin Poirier 2010-01-21 22:20:49 +00:00
parent b400703403
commit 52858b7e66
3 changed files with 10 additions and 4 deletions

@ -954,7 +954,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
}
// Numerical input events
t->redraw |= handleNumInput(&(t->num), event);
t->redraw |= handleNumInput(&(t->num), event, t->snap[1]);
// NDof input events
switch(handleNDofInput(&(t->ndof), event))

@ -677,7 +677,7 @@ void initNumInput(NumInput *n);
void outputNumInput(NumInput *n, char *str);
short hasNumInput(NumInput *n);
void applyNumInput(NumInput *n, float *vec);
char handleNumInput(NumInput *n, struct wmEvent *event);
char handleNumInput(NumInput *n, struct wmEvent *event, float increment);
/*********************** NDofInput ********************************/

@ -22,7 +22,7 @@
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
* Contributor(s): Jonathan Smith
*
* ***** END GPL LICENSE BLOCK *****
*/
@ -159,12 +159,18 @@ void applyNumInput(NumInput *n, float *vec)
}
}
char handleNumInput(NumInput *n, wmEvent *event)
char handleNumInput(NumInput *n, wmEvent *event, float increment)
{
float Val = 0;
short idx = n->idx, idx_max = n->idx_max;
switch (event->type) {
case DOWNARROWKEY: /* Increments down*/
n->val[idx] -= increment;
break;
case UPARROWKEY: /* Increments up*/
n->val[idx] += increment;
break;
case BACKSPACEKEY:
if (n->ctrl[idx] == 0) {
n->val[0] =