iPlug2 - C++ Audio Plug-in Framework
IGraphicsConstants.h
1 /*
2  ==============================================================================
3 
4  This file is part of the iPlug 2 library. Copyright (C) the iPlug 2 developers.
5 
6  See LICENSE.txt for more info.
7 
8  ==============================================================================
9 */
10 
11 #pragma once
12 
13 #include "IPlugPlatform.h"
14 
15 BEGIN_IPLUG_NAMESPACE
16 BEGIN_IGRAPHICS_NAMESPACE
17 
18 static constexpr int DEFAULT_FPS = 60;
19 
20 // If not dirty for this many timer ticks, we call OnGUIIDle.
21 // Only looked at if USE_IDLE_CALLS is defined.
22 static constexpr int IDLE_TICKS = 20;
23 
24 static constexpr int DEFAULT_ANIMATION_DURATION = 100;
25 
26 #ifndef CONTROL_BOUNDS_COLOR
27 #define CONTROL_BOUNDS_COLOR COLOR_GREEN
28 #endif
29 
30 static constexpr float PARAM_EDIT_W = 40.f; // TODO: remove?
31 static constexpr float PARAM_EDIT_H = 16.f; // TODO: remove?
32 
33 #define MAX_URL_LEN 256
34 #define MAX_NET_ERR_MSG_LEN 1024
35 
36 static constexpr int MAX_IMG_SCALE = 3;
37 static constexpr int DEFAULT_TEXT_ENTRY_LEN = 7;
38 static constexpr double DEFAULT_GEARING = 4.0;
39 
40 //what is this stuff
41 #define TOOLWIN_BORDER_W 6
42 #define TOOLWIN_BORDER_H 23
43 #define MAX_CLASSNAME_LEN 128
44 //
45 
46 static constexpr float GRAYED_ALPHA = 0.25f;
47 
48 #ifndef DEFAULT_PATH
49 static const char* DEFAULT_PATH = "~/Desktop";
50 #endif
51 
52 #ifndef DEFAULT_FONT
53 const char* const DEFAULT_FONT = "Roboto-Regular";
54 #endif
55 
56 static constexpr float DEFAULT_TEXT_SIZE = 14.f;
57 static constexpr int FONT_LEN = 64;
58 
60 enum class EBlend
61 {
62  SrcOver,
63  SrcIn,
64  SrcOut,
65  SrcAtop,
66  DstOver,
67  DstIn,
68  DstOut,
69  DstAtop,
70  Add,
71  XOR,
72  Default = SrcOver
73 };
74 
76 enum class EFileAction { Open, Save };
77 
79 enum class EDirection { Vertical, Horizontal };
80 
82 enum class ETextStyle { Normal, Bold, Italic };
83 
85 enum class EAlign { Near, Center, Far };
86 
88 enum class EVAlign { Top, Middle, Bottom };
89 
91 static const char* kEAlignStrs[3] = { "Near", "Center", "Far" };
92 
94 static const char* kEVAlignStrs[3] = { "Top", "Middle", "Bottom" };
95 
97 enum class EGestureType { Unknown, DoubleTap, TripleTap, LongPress1, LongPress2, SwipeLeft, SwipeRight, SwipeUp, SwipeDown, Pinch, Rotate, Pan};
98 
100 static const char* kGestureTypeStrs[12] = { "Unknown", "DoubleTap", "TripleTap", "LongPress1", "LongPress2", "SwipeLeft", "SwipeRight", "SwipeUp", "SwipeDown", "Pinch", "Rotate", "Pan"};
101 
103 enum class EGestureState { Unknown, Began, InProcess, Ended };
104 
106 enum EVColor
107 {
108  kBG = 0, // background: transparent by default
109  kFG, kOFF = kFG, // foreground/OFF states
110  kPR, kON = kPR, // pressed/ON states
111  kFR, // frame: the stroke around a button or knob handle, or border around the outside of the control
112  kHL, // highlight: mouse over and splash click animation
113  kSH, // shadow
114  kX1, // extra1: typically used for indicator tracks on knobs and sliders
115  kX2, // extra2
116  kX3, // extra3
117  kNumVColors
118 };
119 
121 static const char* kVColorStrs[kNumVColors] =
122 {
123  "bg",
124  "fg/off ",
125  "pressed/on",
126  "frame",
127  "highlight",
128  "shadow",
129  "extra1",
130  "extra2",
131  "extra3"
132 };
133 
135 enum class EVShape { Rectangle, Ellipse, Triangle, EndsRounded, AllRounded };
136 
138 enum class EWinding { CW, CCW };
139 
141 enum class EFillRule { Winding, EvenOdd, Preserve };
142 
144 enum class ELineCap { Butt, Round, Square };
145 
147 enum class ELineJoin { Miter, Round, Bevel };
148 
150 enum class EPatternType { Solid, Linear, Radial, Sweep };
151 
153 enum class EPatternExtend { None, Pad, Reflect, Repeat };
154 
156 enum class EUIResizerMode { Scale, Size };
157 
159 enum class ECursor
160 {
161  ARROW,
162  IBEAM,
163  WAIT,
164  CROSS,
165  UPARROW,
166  SIZENWSE,
167  SIZENESW,
168  SIZEWE,
169  SIZENS,
170  SIZEALL,
171  INO,
172  HAND,
173  APPSTARTING,
174  HELP
175 };
176 
178 enum class ETouchEvent { Began, Moved, Ended, Cancelled, Invalid };
179 
180 // This enumeration must match win32 message box options
181 enum EMsgBoxType
182 {
183  kMB_OK = 0,
184  kMB_OKCANCEL = 1,
185  kMB_YESNOCANCEL = 3,
186  kMB_YESNO = 4,
187  kMB_RETRYCANCEL = 5
188 };
189 
190 // This enumeration must match win32 message box results
191  //If IGraphics::ShowMessageBox can't return inline, it returns kNoResult (e.g. because it requires an asynchronous call)
192 enum EMsgBoxResult
193 {
194  kNoResult,
195  kOK = 1,
196  kCANCEL = 2,
197  kABORT = 3,
198  kRETRY = 4,
199  kIGNORE = 5,
200  kYES = 6,
201  kNO = 7
202 };
203 
204 static const char* kMessageResultStrs[8] = {"", "OK", "CANCEL", "ABORT", "RETRY", "IGNORE", "YES", "NO"};
205 
206 END_IGRAPHICS_NAMESPACE
207 END_IPLUG_NAMESPACE
Include to get consistently named preprocessor macros for different platforms and logging functionali...