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.

552 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. SVGWidget *cap = new SVGWidget();
  236. cap->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/SynthTechAlco_cap.svg")));
  237. addChild(cap);
  238. }
  239. };
  240. struct Trimpot : SVGKnob {
  241. Trimpot() {
  242. box.size = Vec(17, 17);
  243. minAngle = -0.75*M_PI;
  244. maxAngle = 0.75*M_PI;
  245. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Trimpot.svg")));
  246. }
  247. };
  248. struct BefacoBigKnob : SVGKnob {
  249. BefacoBigKnob() {
  250. box.size = Vec(75, 75);
  251. minAngle = -0.75*M_PI;
  252. maxAngle = 0.75*M_PI;
  253. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/BefacoBigKnob.svg")));
  254. }
  255. };
  256. struct BefacoBigSnapKnob : BefacoBigKnob {
  257. BefacoBigSnapKnob() {
  258. snap = true;
  259. }
  260. };
  261. struct BefacoTinyKnob : SVGKnob {
  262. BefacoTinyKnob() {
  263. box.size = Vec(26, 26);
  264. minAngle = -0.75*M_PI;
  265. maxAngle = 0.75*M_PI;
  266. setSVG(SVG::load(assetGlobal("res/ComponentLibrary/BefacoTinyKnob.svg")));
  267. }
  268. };
  269. struct BefacoSlidePot : SVGFader {
  270. BefacoSlidePot() {
  271. Vec margin = Vec(3.5, 3.5);
  272. maxHandlePos = Vec(-1, -2).plus(margin);
  273. minHandlePos = Vec(-1, 87).plus(margin);
  274. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/BefacoSlidePot.svg"));
  275. background->wrap();
  276. background->box.pos = margin;
  277. box.size = background->box.size.plus(margin.mult(2));
  278. handle->svg = SVG::load(assetGlobal("res/ComponentLibrary/BefacoSlidePotHandle.svg"));
  279. handle->wrap();
  280. }
  281. };
  282. ////////////////////
  283. // Jacks
  284. ////////////////////
  285. struct PJ301MPort : SVGPort {
  286. PJ301MPort() {
  287. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/PJ301M.svg"));
  288. background->wrap();
  289. box.size = background->box.size;
  290. }
  291. };
  292. struct PJ3410Port : SVGPort {
  293. PJ3410Port() {
  294. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/PJ3410.svg"));
  295. background->wrap();
  296. box.size = background->box.size;
  297. }
  298. };
  299. struct CL1362Port : SVGPort {
  300. CL1362Port() {
  301. background->svg = SVG::load(assetGlobal("res/ComponentLibrary/CL1362.svg"));
  302. background->wrap();
  303. box.size = background->box.size;
  304. }
  305. };
  306. ////////////////////
  307. // Lights
  308. ////////////////////
  309. struct RedLight : ModuleLightWidget {
  310. RedLight() {
  311. addBaseColor(COLOR_RED);
  312. }
  313. };
  314. struct GreenLight : ModuleLightWidget {
  315. GreenLight() {
  316. addBaseColor(COLOR_GREEN);
  317. }
  318. };
  319. struct YellowLight : ModuleLightWidget {
  320. YellowLight() {
  321. addBaseColor(COLOR_YELLOW);
  322. }
  323. };
  324. struct BlueLight : ModuleLightWidget {
  325. BlueLight() {
  326. addBaseColor(COLOR_BLUE);
  327. }
  328. };
  329. /** Reads two adjacent lightIds, so `lightId` and `lightId + 1` must be defined */
  330. struct GreenRedLight : ModuleLightWidget {
  331. GreenRedLight() {
  332. addBaseColor(COLOR_GREEN);
  333. addBaseColor(COLOR_RED);
  334. }
  335. };
  336. struct RedGreenBlueLight : ModuleLightWidget {
  337. RedGreenBlueLight() {
  338. addBaseColor(COLOR_RED);
  339. addBaseColor(COLOR_GREEN);
  340. addBaseColor(COLOR_BLUE);
  341. }
  342. };
  343. /** Based on the size of 5mm LEDs */
  344. template <typename BASE>
  345. struct LargeLight : BASE {
  346. LargeLight() {
  347. this->box.size = mm2px(Vec(5.179, 5.179));
  348. }
  349. };
  350. /** Based on the size of 3mm LEDs */
  351. template <typename BASE>
  352. struct MediumLight : BASE {
  353. MediumLight() {
  354. this->box.size = mm2px(Vec(3.176, 3.176));
  355. }
  356. };
  357. /** Based on the size of 2mm LEDs */
  358. template <typename BASE>
  359. struct SmallLight : BASE {
  360. SmallLight() {
  361. this->box.size = mm2px(Vec(2.176, 2.176));
  362. }
  363. };
  364. /** Based on the size of 1mm LEDs */
  365. template <typename BASE>
  366. struct TinyLight : BASE {
  367. TinyLight() {
  368. this->box.size = mm2px(Vec(1.088, 1.088));
  369. }
  370. };
  371. ////////////////////
  372. // Switches and Buttons
  373. ////////////////////
  374. struct NKK : SVGSwitch, ToggleSwitch {
  375. NKK() {
  376. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_0.svg")));
  377. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_1.svg")));
  378. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_2.svg")));
  379. }
  380. };
  381. struct CKSS : SVGSwitch, ToggleSwitch {
  382. CKSS() {
  383. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSS_0.svg")));
  384. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSS_1.svg")));
  385. }
  386. };
  387. struct CKSSThree : SVGSwitch, ToggleSwitch {
  388. CKSSThree() {
  389. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_0.svg")));
  390. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_1.svg")));
  391. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_2.svg")));
  392. }
  393. };
  394. struct CKD6 : SVGSwitch, MomentarySwitch {
  395. CKD6() {
  396. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_0.svg")));
  397. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_1.svg")));
  398. }
  399. };
  400. struct TL1105 : SVGSwitch, MomentarySwitch {
  401. TL1105() {
  402. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/TL1105_0.svg")));
  403. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/TL1105_1.svg")));
  404. }
  405. };
  406. struct LEDButton : SVGSwitch, MomentarySwitch {
  407. LEDButton() {
  408. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/LEDButton.svg")));
  409. }
  410. };
  411. struct BefacoSwitch : SVGSwitch, ToggleSwitch {
  412. BefacoSwitch() {
  413. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_0.svg")));
  414. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_1.svg")));
  415. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_2.svg")));
  416. }
  417. };
  418. struct BefacoPush : SVGSwitch, MomentarySwitch {
  419. BefacoPush() {
  420. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoPush_0.svg")));
  421. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoPush_1.svg")));
  422. }
  423. };
  424. struct PB61303 : SVGSwitch, MomentarySwitch {
  425. PB61303() {
  426. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/PB61303.svg")));
  427. }
  428. };
  429. struct LEDBezel : SVGSwitch, MomentarySwitch {
  430. LEDBezel() {
  431. addFrame(SVG::load(assetGlobal("res/ComponentLibrary/LEDBezel.svg")));
  432. }
  433. };
  434. ////////////////////
  435. // Misc
  436. ////////////////////
  437. struct ScrewSilver : SVGScrew {
  438. ScrewSilver() {
  439. sw->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/ScrewSilver.svg")));
  440. box.size = sw->box.size;
  441. }
  442. };
  443. struct ScrewBlack : SVGScrew {
  444. ScrewBlack() {
  445. sw->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/ScrewBlack.svg")));
  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