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.

554 lines
12KB

  1. #pragma once
  2. #include "app.hpp"
  3. #include "asset.hpp"
  4. namespace rack {
  5. ////////////////////
  6. // Colors
  7. ////////////////////
  8. static const NVGcolor COLOR_BLACK_TRANSPARENT = nvgRGBA(0x00, 0x00, 0x00, 0x00);
  9. static const NVGcolor COLOR_BLACK = nvgRGB(0x00, 0x00, 0x00);
  10. static const NVGcolor COLOR_WHITE = nvgRGB(0xff, 0xff, 0xff);
  11. static const NVGcolor COLOR_RED = nvgRGB(0xed, 0x2c, 0x24);
  12. static const NVGcolor COLOR_ORANGE = nvgRGB(0xf2, 0xb1, 0x20);
  13. static const NVGcolor COLOR_YELLOW = nvgRGB(0xf9, 0xdf, 0x1c);
  14. static const NVGcolor COLOR_GREEN = nvgRGB(0x90, 0xc7, 0x3e);
  15. static const NVGcolor COLOR_CYAN = nvgRGB(0x22, 0xe6, 0xef);
  16. static const NVGcolor COLOR_BLUE = nvgRGB(0x29, 0xb2, 0xef);
  17. static const NVGcolor COLOR_PURPLE = nvgRGB(0xd5, 0x2b, 0xed);
  18. static const NVGcolor COLOR_LIGHT_PANEL = nvgRGB(0xe6, 0xe6, 0xe6);
  19. static const NVGcolor COLOR_DARK_PANEL = nvgRGB(0x17, 0x17, 0x17);
  20. ////////////////////
  21. // Knobs
  22. ////////////////////
  23. struct RoundKnob : SVGKnob {
  24. RoundKnob() {
  25. minAngle = -0.83*M_PI;
  26. maxAngle = 0.83*M_PI;
  27. }
  28. };
  29. struct RoundBlackKnob : RoundKnob {
  30. RoundBlackKnob() {
  31. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/RoundBlack.svg")));
  32. box.size = Vec(38, 38);
  33. }
  34. };
  35. struct RoundSmallBlackKnob : RoundBlackKnob {
  36. RoundSmallBlackKnob() {
  37. box.size = Vec(28, 28);
  38. }
  39. };
  40. struct RoundLargeBlackKnob : RoundBlackKnob {
  41. RoundLargeBlackKnob() {
  42. box.size = Vec(46, 46);
  43. }
  44. };
  45. struct RoundHugeBlackKnob : RoundBlackKnob {
  46. RoundHugeBlackKnob() {
  47. box.size = Vec(56, 56);
  48. }
  49. };
  50. struct RoundSmallBlackSnapKnob : RoundSmallBlackKnob {
  51. RoundSmallBlackSnapKnob() {
  52. snap = true;
  53. }
  54. };
  55. struct Davies1900hKnob : SVGKnob {
  56. Davies1900hKnob() {
  57. minAngle = -0.83*M_PI;
  58. maxAngle = 0.83*M_PI;
  59. }
  60. };
  61. struct Davies1900hWhiteKnob : Davies1900hKnob {
  62. Davies1900hWhiteKnob() {
  63. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hWhite.svg")));
  64. }
  65. };
  66. struct Davies1900hBlackKnob : Davies1900hKnob {
  67. Davies1900hBlackKnob() {
  68. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hBlack.svg")));
  69. }
  70. };
  71. struct Davies1900hRedKnob : Davies1900hKnob {
  72. Davies1900hRedKnob() {
  73. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hRed.svg")));
  74. }
  75. };
  76. struct Davies1900hLargeWhiteKnob : Davies1900hKnob {
  77. Davies1900hLargeWhiteKnob() {
  78. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeWhite.svg")));
  79. }
  80. };
  81. struct Davies1900hLargeBlackKnob : Davies1900hKnob {
  82. Davies1900hLargeBlackKnob() {
  83. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeBlack.svg")));
  84. }
  85. };
  86. struct Davies1900hLargeRedKnob : Davies1900hKnob {
  87. Davies1900hLargeRedKnob() {
  88. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeRed.svg")));
  89. }
  90. };
  91. struct Rogan : SVGKnob {
  92. Rogan() {
  93. minAngle = -0.83*M_PI;
  94. maxAngle = 0.83*M_PI;
  95. }
  96. };
  97. struct Rogan6PSWhite : Rogan {
  98. Rogan6PSWhite() {
  99. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan6PSWhite.svg")));
  100. }
  101. };
  102. struct Rogan5PSGray : Rogan {
  103. Rogan5PSGray() {
  104. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan5PSGray.svg")));
  105. }
  106. };
  107. struct Rogan3PSBlue : Rogan {
  108. Rogan3PSBlue() {
  109. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSBlue.svg")));
  110. }
  111. };
  112. struct Rogan3PSRed : Rogan {
  113. Rogan3PSRed() {
  114. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSRed.svg")));
  115. }
  116. };
  117. struct Rogan3PSGreen : Rogan {
  118. Rogan3PSGreen() {
  119. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSGreen.svg")));
  120. }
  121. };
  122. struct Rogan3PSWhite : Rogan {
  123. Rogan3PSWhite() {
  124. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSWhite.svg")));
  125. }
  126. };
  127. struct Rogan3PBlue : Rogan {
  128. Rogan3PBlue() {
  129. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PBlue.svg")));
  130. }
  131. };
  132. struct Rogan3PRed : Rogan {
  133. Rogan3PRed() {
  134. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PRed.svg")));
  135. }
  136. };
  137. struct Rogan3PGreen : Rogan {
  138. Rogan3PGreen() {
  139. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PGreen.svg")));
  140. }
  141. };
  142. struct Rogan3PWhite : Rogan {
  143. Rogan3PWhite() {
  144. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PWhite.svg")));
  145. }
  146. };
  147. struct Rogan2SGray : Rogan {
  148. Rogan2SGray() {
  149. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2SGray.svg")));
  150. }
  151. };
  152. struct Rogan2PSBlue : Rogan {
  153. Rogan2PSBlue() {
  154. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSBlue.svg")));
  155. }
  156. };
  157. struct Rogan2PSRed : Rogan {
  158. Rogan2PSRed() {
  159. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSRed.svg")));
  160. }
  161. };
  162. struct Rogan2PSGreen : Rogan {
  163. Rogan2PSGreen() {
  164. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSGreen.svg")));
  165. }
  166. };
  167. struct Rogan2PSWhite : Rogan {
  168. Rogan2PSWhite() {
  169. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSWhite.svg")));
  170. }
  171. };
  172. struct Rogan2PBlue : Rogan {
  173. Rogan2PBlue() {
  174. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PBlue.svg")));
  175. }
  176. };
  177. struct Rogan2PRed : Rogan {
  178. Rogan2PRed() {
  179. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PRed.svg")));
  180. }
  181. };
  182. struct Rogan2PGreen : Rogan {
  183. Rogan2PGreen() {
  184. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PGreen.svg")));
  185. }
  186. };
  187. struct Rogan2PWhite : Rogan {
  188. Rogan2PWhite() {
  189. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PWhite.svg")));
  190. }
  191. };
  192. struct Rogan1PSBlue : Rogan {
  193. Rogan1PSBlue() {
  194. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSBlue.svg")));
  195. }
  196. };
  197. struct Rogan1PSRed : Rogan {
  198. Rogan1PSRed() {
  199. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSRed.svg")));
  200. }
  201. };
  202. struct Rogan1PSGreen : Rogan {
  203. Rogan1PSGreen() {
  204. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSGreen.svg")));
  205. }
  206. };
  207. struct Rogan1PSWhite : Rogan {
  208. Rogan1PSWhite() {
  209. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSWhite.svg")));
  210. }
  211. };
  212. struct Rogan1PBlue : Rogan {
  213. Rogan1PBlue() {
  214. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PBlue.svg")));
  215. }
  216. };
  217. struct Rogan1PRed : Rogan {
  218. Rogan1PRed() {
  219. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PRed.svg")));
  220. }
  221. };
  222. struct Rogan1PGreen : Rogan {
  223. Rogan1PGreen() {
  224. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PGreen.svg")));
  225. }
  226. };
  227. struct Rogan1PWhite : Rogan {
  228. Rogan1PWhite() {
  229. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PWhite.svg")));
  230. }
  231. };
  232. struct SynthTechAlco : SVGKnob {
  233. SynthTechAlco() {
  234. minAngle = -0.82*M_PI;
  235. maxAngle = 0.82*M_PI;
  236. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/SynthTechAlco.svg")));
  237. SVGWidget *cap = new SVGWidget();
  238. cap->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/SynthTechAlco_cap.svg")));
  239. addChild(cap);
  240. }
  241. };
  242. struct Trimpot : SVGKnob {
  243. Trimpot() {
  244. box.size = Vec(17, 17);
  245. minAngle = -0.75*M_PI;
  246. maxAngle = 0.75*M_PI;
  247. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Trimpot.svg")));
  248. }
  249. };
  250. struct BefacoBigKnob : SVGKnob {
  251. BefacoBigKnob() {
  252. box.size = Vec(75, 75);
  253. minAngle = -0.75*M_PI;
  254. maxAngle = 0.75*M_PI;
  255. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/BefacoBigKnob.svg")));
  256. }
  257. };
  258. struct BefacoBigSnapKnob : BefacoBigKnob {
  259. BefacoBigSnapKnob() {
  260. snap = true;
  261. }
  262. };
  263. struct BefacoTinyKnob : SVGKnob {
  264. BefacoTinyKnob() {
  265. box.size = Vec(26, 26);
  266. minAngle = -0.75*M_PI;
  267. maxAngle = 0.75*M_PI;
  268. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/BefacoTinyKnob.svg")));
  269. }
  270. };
  271. struct BefacoSlidePot : SVGFader {
  272. BefacoSlidePot() {
  273. Vec margin = Vec(3.5, 3.5);
  274. maxHandlePos = Vec(-1, -2).plus(margin);
  275. minHandlePos = Vec(-1, 87).plus(margin);
  276. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/BefacoSlidePot.svg"));
  277. background->wrap();
  278. background->box.pos = margin;
  279. box.size = background->box.size.plus(margin.mult(2));
  280. handle->svg = SVG::load(assetGlobal("res/ComponentLibrary/BefacoSlidePotHandle.svg"));
  281. handle->wrap();
  282. }
  283. };
  284. ////////////////////
  285. // Jacks
  286. ////////////////////
  287. struct PJ301MPort : SVGPort {
  288. PJ301MPort() {
  289. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/PJ301M.svg"));
  290. background->wrap();
  291. box.size = background->box.size;
  292. }
  293. };
  294. struct PJ3410Port : SVGPort {
  295. PJ3410Port() {
  296. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/PJ3410.svg"));
  297. background->wrap();
  298. box.size = background->box.size;
  299. }
  300. };
  301. struct CL1362Port : SVGPort {
  302. CL1362Port() {
  303. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/CL1362.svg"));
  304. background->wrap();
  305. box.size = background->box.size;
  306. }
  307. };
  308. ////////////////////
  309. // Lights
  310. ////////////////////
  311. struct RedLight : ModuleLightWidget {
  312. RedLight() {
  313. addBaseColor(COLOR_RED);
  314. }
  315. };
  316. struct GreenLight : ModuleLightWidget {
  317. GreenLight() {
  318. addBaseColor(COLOR_GREEN);
  319. }
  320. };
  321. struct YellowLight : ModuleLightWidget {
  322. YellowLight() {
  323. addBaseColor(COLOR_YELLOW);
  324. }
  325. };
  326. struct BlueLight : ModuleLightWidget {
  327. BlueLight() {
  328. addBaseColor(COLOR_BLUE);
  329. }
  330. };
  331. /** Reads two adjacent lightIds, so `lightId` and `lightId + 1` must be defined */
  332. struct GreenRedLight : ModuleLightWidget {
  333. GreenRedLight() {
  334. addBaseColor(COLOR_GREEN);
  335. addBaseColor(COLOR_RED);
  336. }
  337. };
  338. struct RedGreenBlueLight : ModuleLightWidget {
  339. RedGreenBlueLight() {
  340. addBaseColor(COLOR_RED);
  341. addBaseColor(COLOR_GREEN);
  342. addBaseColor(COLOR_BLUE);
  343. }
  344. };
  345. /** Based on the size of 5mm LEDs */
  346. template <typename BASE>
  347. struct LargeLight : BASE {
  348. LargeLight() {
  349. this->box.size = mm2px(Vec(5.179, 5.179));
  350. }
  351. };
  352. /** Based on the size of 3mm LEDs */
  353. template <typename BASE>
  354. struct MediumLight : BASE {
  355. MediumLight() {
  356. this->box.size = mm2px(Vec(3.176, 3.176));
  357. }
  358. };
  359. /** Based on the size of 2mm LEDs */
  360. template <typename BASE>
  361. struct SmallLight : BASE {
  362. SmallLight() {
  363. this->box.size = mm2px(Vec(2.176, 2.176));
  364. }
  365. };
  366. /** Based on the size of 1mm LEDs */
  367. template <typename BASE>
  368. struct TinyLight : BASE {
  369. TinyLight() {
  370. this->box.size = mm2px(Vec(1.088, 1.088));
  371. }
  372. };
  373. ////////////////////
  374. // Switches and Buttons
  375. ////////////////////
  376. struct NKK : SVGSwitch, ToggleSwitch {
  377. NKK() {
  378. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_0.svg")));
  379. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_1.svg")));
  380. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_2.svg")));
  381. }
  382. };
  383. struct CKSS : SVGSwitch, ToggleSwitch {
  384. CKSS() {
  385. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSS_0.svg")));
  386. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSS_1.svg")));
  387. }
  388. };
  389. struct CKSSThree : SVGSwitch, ToggleSwitch {
  390. CKSSThree() {
  391. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_0.svg")));
  392. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_1.svg")));
  393. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_2.svg")));
  394. }
  395. };
  396. struct CKD6 : SVGSwitch, MomentarySwitch {
  397. CKD6() {
  398. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_0.svg")));
  399. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_1.svg")));
  400. }
  401. };
  402. struct TL1105 : SVGSwitch, MomentarySwitch {
  403. TL1105() {
  404. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/TL1105_0.svg")));
  405. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/TL1105_1.svg")));
  406. }
  407. };
  408. struct LEDButton : SVGSwitch, MomentarySwitch {
  409. LEDButton() {
  410. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/LEDButton.svg")));
  411. }
  412. };
  413. struct BefacoSwitch : SVGSwitch, ToggleSwitch {
  414. BefacoSwitch() {
  415. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_0.svg")));
  416. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_1.svg")));
  417. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_2.svg")));
  418. }
  419. };
  420. struct BefacoPush : SVGSwitch, MomentarySwitch {
  421. BefacoPush() {
  422. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoPush_0.svg")));
  423. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoPush_1.svg")));
  424. }
  425. };
  426. struct PB61303 : SVGSwitch, MomentarySwitch {
  427. PB61303() {
  428. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/PB61303.svg")));
  429. }
  430. };
  431. struct LEDBezel : SVGSwitch, MomentarySwitch {
  432. LEDBezel() {
  433. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/LEDBezel.svg")));
  434. }
  435. };
  436. ////////////////////
  437. // Misc
  438. ////////////////////
  439. struct ScrewSilver : SVGScrew {
  440. ScrewSilver() {
  441. sw->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/ScrewSilver.svg")));
  442. box.size = sw->box.size;
  443. }
  444. };
  445. struct ScrewBlack : SVGScrew {
  446. ScrewBlack() {
  447. sw->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/ScrewBlack.svg")));
  448. box.size = sw->box.size;
  449. }
  450. };
  451. struct LightPanel : Panel {
  452. LightPanel() {
  453. backgroundColor = COLOR_LIGHT_PANEL;
  454. }
  455. };
  456. struct DarkPanel : Panel {
  457. DarkPanel() {
  458. backgroundColor = COLOR_DARK_PANEL;
  459. }
  460. };
  461. } // namespace rack