Blender  V2.93
ED_numinput.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #pragma once
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #define NUM_STR_REP_LEN 64
28 #define NUM_MAX_ELEMENTS 3
29 
30 struct wmEvent;
31 
32 typedef struct NumInput {
34  short idx_max;
35  int unit_sys;
39 
41  short flag;
50 
52  short idx;
57  int str_cur;
59 
60 /* NumInput.flag */
61 enum {
62  NUM_AFFECT_ALL = (1 << 0),
63  /* (1 << 9) and above are reserved for internal flags! */
64 };
65 
66 /* NumInput.val_flag[] */
67 enum {
68  /* Public! */
69  NUM_NULL_ONE = (1 << 0),
70  NUM_NO_NEGATIVE = (1 << 1),
71  NUM_NO_ZERO = (1 << 2),
72  NUM_NO_FRACTION = (1 << 3),
73  /* (1 << 9) and above are reserved for internal flags! */
74 };
75 
76 struct UnitSettings;
77 
78 /* -------------------------------------------------------------------- */
96 void initNumInput(NumInput *n);
97 void outputNumInput(NumInput *n, char *str, struct UnitSettings *unit_settings);
98 bool hasNumInput(const NumInput *n);
99 bool applyNumInput(NumInput *n, float *vec);
100 bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event);
101 
103 #define NUM_MODAL_INCREMENT_UP 18
104 #define NUM_MODAL_INCREMENT_DOWN 19
105 
107  const char *str,
108  const struct UnitSettings *unit,
109  int type,
110  double *r_value,
111  const bool use_single_line_error,
112  char **r_error);
113 
116 #ifdef __cplusplus
117 }
118 #endif
void outputNumInput(NumInput *n, char *str, struct UnitSettings *unit_settings)
Definition: numinput.c:102
void initNumInput(NumInput *n)
Definition: numinput.c:83
#define NUM_STR_REP_LEN
Definition: ED_numinput.h:27
@ NUM_NO_NEGATIVE
Definition: ED_numinput.h:70
@ NUM_NULL_ONE
Definition: ED_numinput.h:69
@ NUM_NO_ZERO
Definition: ED_numinput.h:71
@ NUM_NO_FRACTION
Definition: ED_numinput.h:72
struct NumInput NumInput
#define NUM_MAX_ELEMENTS
Definition: ED_numinput.h:28
@ NUM_AFFECT_ALL
Definition: ED_numinput.h:62
bool applyNumInput(NumInput *n, float *vec)
Definition: numinput.c:207
bool hasNumInput(const NumInput *n)
Definition: numinput.c:185
bool user_string_to_number(bContext *C, const char *str, const struct UnitSettings *unit, int type, double *r_value, const bool use_single_line_error, char **r_error)
bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
#define C
Definition: RandGen.cpp:39
#define str(s)
short idx_max
Definition: ED_numinput.h:34
float val[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:45
short val_flag[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:43
int unit_sys
Definition: ED_numinput.h:35
float val_inc[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:49
char str[NUM_STR_REP_LEN]
Definition: ED_numinput.h:54
float val_org[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:47
int unit_type[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:37
short flag
Definition: ED_numinput.h:41
bool unit_use_radians
Definition: ED_numinput.h:38
int str_cur
Definition: ED_numinput.h:57
short idx
Definition: ED_numinput.h:52