2011-02-21 07:25:24 +00:00
|
|
|
/*
|
2010-02-20 20:29:09 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-21 07:25:24 +00:00
|
|
|
/** \file ED_numinput.h
|
|
|
|
|
* \ingroup editors
|
|
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __ED_NUMINPUT_H__
|
|
|
|
|
#define __ED_NUMINPUT_H__
|
2010-02-20 20:29:09 +00:00
|
|
|
|
2012-03-10 21:40:35 +00:00
|
|
|
/*
|
2012-04-22 11:54:53 +00:00
|
|
|
* The ctrl value has different meaning:
|
|
|
|
|
* 0 : No value has been typed
|
|
|
|
|
*
|
|
|
|
|
* otherwise, |value| - 1 is where the cursor is located after the period
|
|
|
|
|
* Positive : number is positive
|
|
|
|
|
* Negative : number is negative
|
|
|
|
|
*/
|
2012-03-10 21:40:35 +00:00
|
|
|
|
2010-02-20 20:29:09 +00:00
|
|
|
typedef struct NumInput {
|
2010-03-22 09:30:00 +00:00
|
|
|
short idx;
|
|
|
|
|
short idx_max;
|
|
|
|
|
short flag; /* Different flags to indicate different behaviors */
|
|
|
|
|
char inv[3]; /* If the value is inverted or not */
|
|
|
|
|
float val[3]; /* Direct value of the input */
|
|
|
|
|
int ctrl[3]; /* Control to indicate what to do with the numbers that are typed */
|
|
|
|
|
float increment;
|
2012-02-27 10:35:39 +00:00
|
|
|
} NumInput;
|
2010-02-20 20:29:09 +00:00
|
|
|
|
|
|
|
|
/* NUMINPUT FLAGS */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define NUM_NULL_ONE 2
|
|
|
|
|
#define NUM_NO_NEGATIVE 4
|
|
|
|
|
#define NUM_NO_ZERO 8
|
|
|
|
|
#define NUM_NO_FRACTION 16
|
|
|
|
|
#define NUM_AFFECT_ALL 32
|
2010-02-20 20:29:09 +00:00
|
|
|
|
|
|
|
|
/*********************** NumInput ********************************/
|
|
|
|
|
|
|
|
|
|
void initNumInput(NumInput *n);
|
2012-07-14 14:03:36 +00:00
|
|
|
#define NUM_STR_REP_LEN 20 /* str must be NUM_STR_LEN * (idx_max + 1) length. */
|
2010-02-20 20:29:09 +00:00
|
|
|
void outputNumInput(NumInput *n, char *str);
|
2013-10-23 06:48:36 +00:00
|
|
|
bool hasNumInput(const NumInput *n);
|
2010-02-20 20:29:09 +00:00
|
|
|
void applyNumInput(NumInput *n, float *vec);
|
2013-10-23 06:48:36 +00:00
|
|
|
bool handleNumInput(NumInput *n, const struct wmEvent *event);
|
2010-02-20 20:29:09 +00:00
|
|
|
|
|
|
|
|
#define NUM_MODAL_INCREMENT_UP 18
|
|
|
|
|
#define NUM_MODAL_INCREMENT_DOWN 19
|
|
|
|
|
|
2013-10-23 06:48:36 +00:00
|
|
|
#endif /* __ED_NUMINPUT_H__ */
|