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.

139 lines
2.8KB

  1. #pragma once
  2. #include <set>
  3. #include <map>
  4. #include "util/math.hpp" // Vec
  5. #include "tags.hpp" // ModelTag enum
  6. #include "widgets.hpp"
  7. struct NVGcontext;
  8. namespace rack {
  9. struct Font;
  10. struct Widget;
  11. struct RackWidget;
  12. struct Toolbar;
  13. struct RackScene;
  14. struct Scene;
  15. struct Model;
  16. //
  17. // the structure fields reflect the original file locations
  18. // (e.g. 'window' was originally located in 'window.cpp')
  19. //
  20. struct GlobalUI {
  21. struct {
  22. void *lglw; // lglw_t
  23. NVGcontext *gVg;
  24. NVGcontext *gFramebufferVg;
  25. std::shared_ptr<Font> gGuiFont;
  26. float gPixelRatio;
  27. float gWindowRatio;
  28. bool gAllowCursorLock;
  29. int gGuiFrame;
  30. Vec gMousePos;
  31. std::string lastWindowTitle;
  32. int windowX;
  33. int windowY;
  34. int windowWidth;
  35. int windowHeight;
  36. std::map<std::string, std::weak_ptr<Font>> font_cache;
  37. std::map<std::string, std::weak_ptr<Image>> image_cache;
  38. std::map<std::string, std::weak_ptr<SVG>> svg_cache;
  39. } window;
  40. struct {
  41. Widget *gHoveredWidget;
  42. Widget *gDraggedWidget;
  43. Widget *gDragHoveredWidget;
  44. Widget *gFocusedWidget;
  45. Widget *gTempWidget;
  46. } widgets;
  47. struct {
  48. Scene *gScene;
  49. } ui;
  50. struct {
  51. std::set<Model*> sFavoriteModels;
  52. std::string sAuthorFilter;
  53. ModelTag sTagFilter;
  54. } module_browser;
  55. struct {
  56. std::string gApplicationName;
  57. std::string gApplicationVersion;
  58. std::string gApiHost;
  59. std::string gLatestVersion;
  60. bool gCheckVersion;
  61. RackWidget *gRackWidget;
  62. Toolbar *gToolbar;
  63. RackScene *gRackScene;
  64. std::mutex mtx_param;
  65. bool bLoadVSTUniqueParamBaseId; // temp. false while cloning ModuleWidget
  66. } app;
  67. struct {
  68. int bnd_icon_image;
  69. int bnd_font;
  70. } blendish;
  71. void init(void) {
  72. window.lglw = NULL;
  73. window.gVg = NULL;
  74. window.gFramebufferVg = NULL;
  75. window.gPixelRatio = 1.0;
  76. window.gWindowRatio = 1.0;
  77. window.gAllowCursorLock = true;
  78. window.gGuiFrame = 0;
  79. window.windowX = 0;
  80. window.windowY = 0;
  81. window.windowWidth = 0;
  82. window.windowHeight = 0;
  83. widgets.gHoveredWidget = NULL;
  84. widgets.gDraggedWidget = NULL;
  85. widgets.gDragHoveredWidget = NULL;
  86. widgets.gFocusedWidget = NULL;
  87. widgets.gTempWidget = NULL;
  88. ui.gScene = NULL;
  89. module_browser.sTagFilter = ModelTag::NO_TAG;
  90. app.gApplicationName = "VeeSeeVST Rack";
  91. app.gApplicationVersion = TOSTRING(VERSION);
  92. app.gApiHost = "https://api.vcvrack.com";
  93. // app.gApiHost = "http://localhost:8081";
  94. app.gCheckVersion = true;
  95. app.gRackWidget = NULL;
  96. app.gToolbar = NULL;
  97. app.gRackScene = NULL;
  98. app.bLoadVSTUniqueParamBaseId = true;
  99. blendish.bnd_icon_image = -1;
  100. blendish.bnd_font = -1;
  101. }
  102. };
  103. } // namespace rack