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 
17 /** \file
18  * \ingroup editors
19  */
20 
21 #pragma once
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 struct KDTree_1d;
28 
29 enum {
30   SEL_TOGGLE = 0,
31   SEL_SELECT = 1,
32   SEL_DESELECT = 2,
33   SEL_INVERT = 3,
34 };
35 
36 typedef enum WalkSelectDirection {
37   UI_SELECT_WALK_UP,
38   UI_SELECT_WALK_DOWN,
39   UI_SELECT_WALK_LEFT,
40   UI_SELECT_WALK_RIGHT,
41 } WalkSelectDirections;
42 
43 /** See #WM_operator_properties_select_operation */
44 typedef enum {
45   SEL_OP_ADD = 1,
46   SEL_OP_SUB,
47   SEL_OP_SET,
48   SEL_OP_AND,
49   SEL_OP_XOR,
50 } eSelectOp;
51 
52 /* Select Similar */
53 enum {
54   SIM_CMP_EQ = 0,
55   SIM_CMP_GT,
56   SIM_CMP_LT,
57 };
58 
59 #define SEL_OP_USE_OUTSIDE(sel_op) (ELEM(sel_op, SEL_OP_AND))
60 #define SEL_OP_USE_PRE_DESELECT(sel_op) (ELEM(sel_op, SEL_OP_SET))
61 #define SEL_OP_CAN_DESELECT(sel_op) (!ELEM(sel_op, SEL_OP_ADD))
62 
63 /* Use when we've de-selected all first for 'SEL_OP_SET' */
64 int ED_select_op_action(const eSelectOp sel_op, const bool is_select, const bool is_inside);
65 int ED_select_op_action_deselected(const eSelectOp sel_op,
66                                    const bool is_select,
67                                    const bool is_inside);
68 
69 int ED_select_similar_compare_float(const float delta, const float thresh, const int compare);
70 bool ED_select_similar_compare_float_tree(const struct KDTree_1d *tree,
71                                           const float length,
72                                           const float thresh,
73                                           const int compare);
74 
75 eSelectOp ED_select_op_modal(const eSelectOp sel_op, const bool is_first);
76 
77 #ifdef __cplusplus
78 }
79 #endif
80