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.

549 lines
12KB

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