Debian Codegraph @

src/Gui/ViewParams.h

raw
1 /****************************************************************************
2 * Copyright (c) 2018 Zheng Lei (realthunder) <[email protected]> *
3 * *
4 * This file is part of the FreeCAD CAx development system. *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Library General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU Library General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Library General Public *
17 * License along with this library; see the file COPYING.LIB. If not, *
18 * write to the Free Software Foundation, Inc., 59 Temple Place, *
19 * Suite 330, Boston, MA 02111-1307, USA *
20 * *
21 ****************************************************************************/
22
23 #ifndef GUI_VIEW_PARAMS_H
24 #define GUI_VIEW_PARAMS_H
25
26
27 #include <Base/Parameter.h>
28
29 namespace Gui
30 {
31
32 /** Convenient class to obtain view provider related parameters
33 *
34 * The parameters are under group "User parameter:BaseApp/Preferences/View"
35 */
36 class GuiExport ViewParams: public ParameterGrp::ObserverType
37 {
38 public:
39 ViewParams();
40 ~ViewParams() override;
41 void OnChange(Base::Subject<const char*>&, const char* sReason) override;
42 static ViewParams* instance();
43
44 ParameterGrp::handle getHandle()
45 {
46 return handle;
47 }
48
49 #define FC_VIEW_PARAMS \
50 FC_VIEW_PARAM(UseNewSelection, bool, Bool, true) \
51 FC_VIEW_PARAM(UseSelectionRoot, bool, Bool, true) \
52 FC_VIEW_PARAM(EnableSelection, bool, Bool, true) \
53 FC_VIEW_PARAM(RenderCache, int, Int, 0) \
54 FC_VIEW_PARAM(RandomColor, bool, Bool, false) \
55 FC_VIEW_PARAM(BoundingBoxColor, unsigned long, Unsigned, 4294967295UL) \
56 FC_VIEW_PARAM(AnnotationTextColor, unsigned long, Unsigned, 4294967295UL) \
57 FC_VIEW_PARAM(MarkerSize, int, Int, 9) \
58 FC_VIEW_PARAM(DefaultLinkColor, unsigned long, Unsigned, 0x66FFFF00) \
59 FC_VIEW_PARAM(DefaultShapeLineColor, unsigned long, Unsigned, 421075455UL) \
60 FC_VIEW_PARAM(DefaultShapeVertexColor, unsigned long, Unsigned, 421075455UL) \
61 FC_VIEW_PARAM(DefaultShapeColor, unsigned long, Unsigned, 0xCCCCCC00) \
62 FC_VIEW_PARAM(DefaultShapeTransparency, int, Int, 0) \
63 FC_VIEW_PARAM(DefaultShapeLineWidth, int, Int, 2) \
64 FC_VIEW_PARAM(DefaultShapePointSize, int, Int, 2) \
65 FC_VIEW_PARAM(CoinCycleCheck, bool, Bool, true) \
66 FC_VIEW_PARAM(EnablePropertyViewForInactiveDocument, bool, Bool, true) \
67 FC_VIEW_PARAM(ShowSelectionBoundingBox, bool, Bool, false) \
68 FC_VIEW_PARAM(PropertyViewTimer, unsigned long, Unsigned, 100) \
69 FC_VIEW_PARAM(AxisXColor, unsigned long, Unsigned, 0xCC333300) \
70 FC_VIEW_PARAM(AxisYColor, unsigned long, Unsigned, 0x33CC3300) \
71 FC_VIEW_PARAM(AxisZColor, unsigned long, Unsigned, 0x3333CC00) \
72 FC_VIEW_PARAM(OriginColor, unsigned long, Unsigned, 0xFBD62900) \
73 FC_VIEW_PARAM(NeutralColor, unsigned long, Unsigned, 0xB3B38000) \
74 FC_VIEW_PARAM(PlacementIndicatorScale, double, Float, 40.0) \
75 FC_VIEW_PARAM(DraggerScale, double, Float, 0.03) \
76 FC_VIEW_PARAM(DatumScale, double, Float, 100.0) \
77 FC_VIEW_PARAM(DatumPlaneSize, double, Float, 62.0) \
78 FC_VIEW_PARAM(DatumLineSize, double, Float, 70.0) \
79 FC_VIEW_PARAM(DatumTemporaryScaleFactor, double, Float, 2.0)
80
81 #undef FC_VIEW_PARAM
82 #define FC_VIEW_PARAM(_name, _ctype, _type, _def) \
83 _ctype get##_name() const \
84 { \
85 return _name; \
86 } \
87 void set##_name(_ctype _v) \
88 { \
89 handle->Set##_type(#_name, _v); \
90 _name = _v; \
91 }
92
93 FC_VIEW_PARAMS
94
95 private:
96 #undef FC_VIEW_PARAM
97 #define FC_VIEW_PARAM(_name, _ctype, _type, _def) _ctype _name;
98
99 FC_VIEW_PARAMS
100 ParameterGrp::handle handle;
101 };
102
103 #undef FC_VIEW_PARAM
104
105 } // namespace Gui
106
107 #endif // GUI_VIEW_PARAMS_H