You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

484 lines
16KB

  1. #ifndef WIDGET_OSCCV_HPP
  2. #define WIDGET_OSCCV_HPP
  3. #include "widgets.hpp"
  4. #include "TSSModuleWidgetBase.hpp"
  5. #include "TSOSCConfigWidget.hpp"
  6. #include "Module_oscCV.hpp"
  7. #include "rack.hpp"
  8. #include <vector>
  9. using namespace rack;
  10. #define TROWA_SCROLLING_MSG_TOTAL_SIZE 256
  11. #define TROWA_OSCCV_NUM_COLORS 8
  12. struct oscCV;
  13. struct TSOscCVTopDisplay;
  14. struct TSOscCVMiddleDisplay;
  15. struct TSOscCVLabels;
  16. struct TSOscCVChannelConfigScreen;
  17. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  18. // oscCVWidget
  19. // Open Sound Control <==> Control Voltage widget.
  20. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  21. struct oscCVWidget : TSSModuleWidgetBase {
  22. // OSC configuration widget.
  23. TSOSCConfigWidget* oscConfigurationScreen;
  24. // The top display.
  25. TSOscCVTopDisplay* display;
  26. // The middle display
  27. TSOscCVMiddleDisplay* middleDisplay;
  28. // Screen for the channel configuration.
  29. TSOscCVChannelConfigScreen* oscChannelConfigScreen;
  30. // Number of channels. Should be in the module instance, but since we are no longer guaranteed a non-NULL reference, we will store the # channels here.
  31. int numberChannels;
  32. // Rack CV Input (osc trans messge path)
  33. std::vector<TSTextField*> tbOscInputPaths;
  34. // Rack CV Output (osc recv message path)
  35. std::vector<TSTextField*> tbOscOutputPaths;
  36. // If we should color the channels.
  37. bool colorizeChannels = true;
  38. // Advanced channel configs
  39. std::vector<TS_ScreenBtn*> btnDrawInputAdvChConfig;
  40. // Advanced channel configs
  41. std::vector<TS_ScreenBtn*> btnDrawOutputAdvChConfig;
  42. // Channel colors
  43. /// TODO: Move this to someplace else
  44. static const NVGcolor CHANNEL_COLORS[TROWA_OSCCV_NUM_COLORS];
  45. // Plug lights
  46. bool plugLightsEnabled = true;
  47. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  48. // oscCVWidget()
  49. // Instantiate a oscCV widget. v0.60 must have module as param.
  50. // @oscModule : (IN) Pointer to the osc module.
  51. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  52. oscCVWidget(oscCV* oscModule);
  53. ~oscCVWidget()
  54. {
  55. oscConfigurationScreen = NULL;
  56. display = NULL;
  57. middleDisplay = NULL;
  58. oscChannelConfigScreen = NULL;
  59. btnDrawInputAdvChConfig.clear();
  60. btnDrawOutputAdvChConfig.clear();
  61. return;
  62. }
  63. // Step
  64. void step() override;
  65. // Show or hide the channel configuration
  66. void toggleChannelPathConfig(bool show);
  67. // Read the channel path configs and store in module's channels.
  68. void readChannelPathConfig();
  69. // Set the channel path text boxes.
  70. void setChannelPathConfig();
  71. };
  72. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  73. // Labels for oscCV widget.
  74. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  75. struct TSOscCVLabels : TransparentWidget {
  76. std::shared_ptr<Font> font;
  77. int fontSize;
  78. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  79. // TSOscCVLabels(void)
  80. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  81. TSOscCVLabels()
  82. {
  83. font = Font::load(assetPlugin(plugin, TROWA_LABEL_FONT));
  84. fontSize = 12;
  85. return;
  86. }
  87. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  88. // draw()
  89. // @vg : (IN) NVGcontext to draw on
  90. // Draw labels on our widget.
  91. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  92. void draw(/*in*/ NVGcontext *vg) override;
  93. }; // end TSOscCVLabels
  94. // Button to chose OSC data type
  95. struct TSOscCVDataTypeSelectBtn : ChoiceButton {
  96. // The selected value.
  97. int selectedVal;
  98. int selectedIndex;
  99. int numVals;
  100. int* itemVals;
  101. std::string* itemStrs;
  102. bool visible = false;
  103. std::shared_ptr<Font> font;
  104. Vec textOffset;
  105. NVGcolor color;
  106. // Font size
  107. float fontSize;
  108. std::string displayStr;
  109. int borderWidth = 0;
  110. NVGcolor borderColor;
  111. NVGcolor backgroundColor;
  112. int showNumChars = 15;
  113. TSOscCVChannelConfigScreen* parentScreen = NULL;
  114. TSOscCVDataTypeSelectBtn(int numVals, int* itemVals, std::string* itemStrs, int selVal) {
  115. font = Font::load(assetPlugin(plugin, TROWA_MONOSPACE_FONT));
  116. fontSize = 14.0f;
  117. backgroundColor = FORMS_DEFAULT_BG_COLOR;
  118. color = FORMS_DEFAULT_TEXT_COLOR;
  119. textOffset = Vec(5, 3);
  120. borderWidth = 1;
  121. borderColor = FORMS_DEFAULT_BORDER_COLOR;
  122. this->numVals = numVals;
  123. this->selectedVal = selVal;
  124. this->itemVals = itemVals;
  125. this->itemStrs = itemStrs;
  126. for (int i = 0; i < numVals; i++)
  127. {
  128. if (itemVals[i] == selectedVal)
  129. selectedIndex = i;
  130. }
  131. return;
  132. }
  133. // When the selected index changes.
  134. void onSelectedIndexChanged();
  135. // Set the selected value.
  136. void setSelectedValue(int selVal) {
  137. this->selectedVal = selVal;
  138. for (int i = 0; i < numVals; i++)
  139. {
  140. if (itemVals[i] == selectedVal)
  141. selectedIndex = i;
  142. }
  143. onSelectedIndexChanged();
  144. return;
  145. }
  146. // Set the selected index.
  147. void setSelectedIndex(int selIx) {
  148. this->selectedIndex = selIx;
  149. this->selectedVal = itemVals[selectedIndex];
  150. onSelectedIndexChanged();
  151. return;
  152. }
  153. void step() override {
  154. text = stringEllipsize(itemStrs[selectedIndex], showNumChars);
  155. }
  156. void onAction(EventAction &e) override;
  157. // Draw if visible
  158. void draw(NVGcontext *vg) override;
  159. };
  160. // An OSC client option in dropdown.
  161. struct TSOscCVDataTypeItem : MenuItem {
  162. int itemVal;
  163. int index;
  164. TSOscCVDataTypeSelectBtn* parentButton;
  165. TSOscCVDataTypeItem(TSOscCVDataTypeSelectBtn* parent, int index)
  166. {
  167. parentButton = parent;
  168. this->index = index;
  169. return;
  170. }
  171. void onAction(EventAction &e) override {
  172. parentButton->setSelectedIndex(index);
  173. }
  174. };
  175. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  176. // Single Channel configuration (advanced) widget.
  177. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  178. struct TSOscCVChannelConfigScreen : OpaqueWidget {
  179. oscCVWidget* parentWidget;
  180. std::shared_ptr<Font> font;
  181. std::shared_ptr<Font> labelFont;
  182. int fontSize;
  183. bool visible = false;
  184. // If this is an input or output channel.
  185. bool isInput = false;
  186. enum TextBoxIx {
  187. // Minimum CV voltage
  188. MinCVVolt,
  189. // Maximum CV voltage
  190. MaxCVVolt,
  191. // Minimum OSC value
  192. MinOSCVal,
  193. // Maximum OSC value
  194. MaxOSCVal,
  195. NumTextBoxes
  196. };
  197. // The text boxes for min/max values.
  198. TSTextField* tbNumericBounds[TextBoxIx::NumTextBoxes];
  199. std::string tbErrors[TextBoxIx::NumTextBoxes];
  200. const int numDataTypes = 3;
  201. TSOSCCVChannel::ArgDataType oscDataTypeVals[3] = { TSOSCCVChannel::ArgDataType::OscFloat, TSOSCCVChannel::ArgDataType::OscInt, TSOSCCVChannel::ArgDataType::OscBool };
  202. std::string oscDataTypeStr[3] = { std::string("Float"), std::string("Int"), std::string("Bool") };
  203. // The selected data type.
  204. TSOSCCVChannel::ArgDataType selectedDataType = TSOSCCVChannel::ArgDataType::OscFloat;
  205. // Label buffer
  206. char buffer[50];
  207. // OSC Data Type select/dropdown
  208. TSOscCVDataTypeSelectBtn* btnSelectDataType;
  209. // Turn on / off translating values.
  210. bool translateValsEnabled = false;
  211. //HideableLEDButton* btnToggleTranslateVals;
  212. TS_ScreenCheckBox* btnToggleTranslateVals;
  213. //ColorValueLight* lightTranslateVals;
  214. SchmittTrigger translateTrigger;
  215. // Save button
  216. TS_ScreenBtn* btnSave;
  217. // Cancel button
  218. TS_ScreenBtn* btnCancel;
  219. SchmittTrigger saveTrigger;
  220. SchmittTrigger cancelTrigger;
  221. // Pointer to the current channel information.
  222. TSOSCCVChannel* currentChannelPtr = NULL;
  223. int startX = 6;
  224. int startY = 6;
  225. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  226. // TSOscCVChannelConfigScreen(void)
  227. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  228. TSOscCVChannelConfigScreen() : TSOscCVChannelConfigScreen(NULL, Vec(0,0), Vec(300, 300)) {
  229. return;
  230. }
  231. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  232. // TSOscCVChannelConfigScreen()
  233. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  234. TSOscCVChannelConfigScreen(oscCVWidget* widget, Vec pos, Vec boxSize);
  235. ~TSOscCVChannelConfigScreen()
  236. {
  237. parentWidget = NULL;
  238. return;
  239. }
  240. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  241. // Set visible or not.
  242. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  243. void setVisibility(bool visible) {
  244. //debug("setVisibility(%d)", visible);
  245. this->visible = visible;
  246. try
  247. {
  248. //debug("setVisibility(%d) - btn", visible);
  249. if (btnToggleTranslateVals)
  250. btnToggleTranslateVals->visible = visible;
  251. //debug("setVisibility(%d) - light", visible);
  252. //if (lightTranslateVals)
  253. // lightTranslateVals->visible = visible;
  254. //debug("setVisibility(%d) - dropdown", visible);
  255. this->btnSelectDataType->visible = visible;
  256. //debug("setVisibility(%d) - buttons", visible);
  257. btnSave->visible = visible;
  258. btnCancel->visible = visible;
  259. //debug("setVisibility(%d) - text boxes", visible);
  260. for (int i = 0; i < TextBoxIx::NumTextBoxes; i++)
  261. {
  262. tbNumericBounds[i]->visible = visible;
  263. }
  264. }
  265. catch (const std::exception& e)
  266. {
  267. warn("Error %s.", e.what());
  268. }
  269. //debug("setVisibility(%d) - Done", visible);
  270. return;
  271. } // end setVisibility()
  272. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  273. // Save the values to the ptr.
  274. // @channelPtr : (OUT) Place to save the values.
  275. // @returns : True if saved, false if there was an error.
  276. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  277. bool saveValues(/*out*/ TSOSCCVChannel* channelPtr);
  278. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  279. // Save the values to current ptr.
  280. // @returns : True if saved, false if there was an error.
  281. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  282. bool saveValues() {
  283. return saveValues(this->currentChannelPtr);
  284. }
  285. void setDataType(TSOSCCVChannel::ArgDataType dataType)
  286. {
  287. if (dataType == TSOSCCVChannel::ArgDataType::OscBool)
  288. {
  289. // Bools have to be false/true....
  290. tbNumericBounds[TextBoxIx::MinOSCVal]->enabled = false;
  291. tbNumericBounds[TextBoxIx::MaxOSCVal]->enabled = false;
  292. tbNumericBounds[TextBoxIx::MinOSCVal]->text = std::string("0");
  293. tbNumericBounds[TextBoxIx::MaxOSCVal]->text = std::string("1");
  294. }
  295. else
  296. {
  297. tbNumericBounds[TextBoxIx::MinOSCVal]->enabled = true;
  298. tbNumericBounds[TextBoxIx::MaxOSCVal]->enabled = true;
  299. }
  300. return;
  301. }
  302. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  303. // validateValues(void)
  304. // @returns : True if valid, false if not.
  305. // POST CONDITION: tbErrors is set and errors may be displayed on the screen.
  306. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  307. bool validateValues();
  308. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  309. // showControl()
  310. // @channel: (IN) The channel which we are configuring.
  311. // @isInput: (IN) If this an input or output.
  312. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  313. void showControl(TSOSCCVChannel* channel, bool isInput);
  314. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  315. // Process
  316. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  317. void step() override;
  318. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  319. // draw()
  320. // @vg : (IN) NVGcontext to draw on
  321. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  322. void draw(/*in*/ NVGcontext *vg) override;
  323. };
  324. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  325. // Top Display for oscCV widget.
  326. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  327. struct TSOscCVTopDisplay : TransparentWidget {
  328. oscCVWidget* parentWidget;
  329. std::shared_ptr<Font> font;
  330. std::shared_ptr<Font> labelFont;
  331. int fontSize;
  332. char messageStr[TROWA_DISP_MSG_SIZE]; // tmp buffer for our strings.
  333. bool showDisplay = true;
  334. char scrollingMsg[TROWA_SCROLLING_MSG_TOTAL_SIZE];
  335. int scrollIx = 0;
  336. std::string lastIp = std::string("");
  337. float dt = 0.0f;
  338. float scrollTime_sec = 0.05f;
  339. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  340. // TSOscCVTopDisplay(void)
  341. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  342. TSOscCVTopDisplay() : TSOscCVTopDisplay(NULL) {
  343. return;
  344. }
  345. ~TSOscCVTopDisplay() {
  346. parentWidget = NULL;
  347. return;
  348. }
  349. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  350. // TSOscCVMiddleDisplay(void)
  351. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  352. TSOscCVTopDisplay(oscCVWidget* widget)
  353. {
  354. parentWidget = widget;
  355. font = Font::load(assetPlugin(plugin, TROWA_DIGITAL_FONT));
  356. labelFont = Font::load(assetPlugin(plugin, TROWA_LABEL_FONT));
  357. fontSize = 12;
  358. memset(messageStr, '\0', sizeof(char)*TROWA_DISP_MSG_SIZE);
  359. memset(scrollingMsg, '\0', sizeof(char)*TROWA_SCROLLING_MSG_TOTAL_SIZE);
  360. showDisplay = true;
  361. return;
  362. }
  363. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  364. // step()
  365. // Calculate scrolling and stuff?
  366. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  367. void step() override;
  368. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  369. // draw()
  370. // @vg : (IN) NVGcontext to draw on
  371. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  372. void draw(/*in*/ NVGcontext *vg) override;
  373. }; // end struct TSOscCVTopDisplay
  374. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  375. // Middle Display for oscCV widget.
  376. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  377. struct TSOscCVMiddleDisplay : TransparentWidget {
  378. oscCVWidget* parentWidget;
  379. std::shared_ptr<Font> font;
  380. std::shared_ptr<Font> labelFont;
  381. int fontSize;
  382. char messageStr[TROWA_DISP_MSG_SIZE]; // tmp buffer for our strings.
  383. //bool showDisplay = true;
  384. enum DisplayMode {
  385. None = 0,
  386. Default = 1
  387. };
  388. DisplayMode displayMode = DisplayMode::Default;
  389. // Current channel path position (for paths that are too large and need some scrolling).
  390. float chPathPosition = 0.0f;
  391. // Amt of time that has passed.
  392. float dt = 0.0f;
  393. // Scrolling time
  394. float scrollTime = 0.05f;
  395. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  396. // TSOscCVMiddleDisplay(void)
  397. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  398. TSOscCVMiddleDisplay(oscCVWidget* widget)
  399. {
  400. parentWidget = widget;
  401. font = Font::load(assetPlugin(plugin, TROWA_DIGITAL_FONT));
  402. labelFont = Font::load(assetPlugin(plugin, TROWA_LABEL_FONT));
  403. fontSize = 12;
  404. for (int i = 0; i < TROWA_DISP_MSG_SIZE; i++)
  405. messageStr[i] = '\0';
  406. return;
  407. }
  408. ~TSOscCVMiddleDisplay() {
  409. parentWidget = NULL;
  410. return;
  411. }
  412. void setDisplayMode(DisplayMode mode) {
  413. displayMode = mode;
  414. if (displayMode == DisplayMode::Default)
  415. {
  416. chPathPosition = 0.0f; // reset
  417. dt = 0.0f; // reset
  418. }
  419. return;
  420. }
  421. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  422. // Process
  423. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  424. void step() override;
  425. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  426. // draw()
  427. // @vg : (IN) NVGcontext to draw on
  428. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  429. void draw(/*in*/ NVGcontext *vg) override;
  430. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  431. // drawChannelChart()
  432. // Draw the channel data.
  433. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  434. void drawChannelChart(/*in*/ NVGcontext *vg, /*in*/ TSOSCCVChannel* channelData, /*in*/ int x, /*in*/ int y, /*in*/ int width, /*in*/ int height, /*in*/ NVGcolor lineColor);
  435. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  436. // drawChannelBar()
  437. // Draw the channel data.
  438. //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  439. void drawChannelBar(/*in*/ NVGcontext *vg, /*in*/ TSOSCCVChannel* channelData, /*in*/ int x, /*in*/ int y, /*in*/ int width, /*in*/ int height, /*in*/ NVGcolor lineColor);
  440. }; // end struct TSOscCVMiddleDisplay
  441. #endif // !WIDGET_OSCCV_HPP