Audio plugin host https://kx.studio/carla
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.

154 lines
4.4KB

  1. // ----------------------------------------------------------------------
  2. //
  3. // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org>
  4. // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla
  5. //
  6. // This program is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU General Public License as published by
  8. // the Free Software Foundation; either version 2 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // This program is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU General Public License
  17. // along with this program; if not, write to the Free Software
  18. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. //
  20. // ----------------------------------------------------------------------
  21. #include "styles.h"
  22. #include "png2img.h"
  23. #include "CarlaString.hpp"
  24. #include <dlfcn.h>
  25. namespace BLS1 {
  26. XftColor *XftColors [NXFTCOLORS];
  27. XftFont *XftFonts [NXFTFONTS];
  28. X_textln_style tstyle1;
  29. XImage *inputsect;
  30. XImage *shuffsect;
  31. XImage *lfshfsect;
  32. RotaryImg inpbal_img;
  33. RotaryImg hpfilt_img;
  34. RotaryImg shfreq_img;
  35. RotaryImg shgain_img;
  36. RotaryImg lffreq_img;
  37. RotaryImg lfgain_img;
  38. static CarlaString getResourceDir()
  39. {
  40. Dl_info exeInfo;
  41. dladdr((void*)getResourceDir, &exeInfo);
  42. CarlaString filename(exeInfo.dli_fname);
  43. return filename.truncate(filename.rfind("-ui"));
  44. }
  45. int styles_init (X_display *disp, X_resman *xrm)
  46. {
  47. CarlaString resourceDir(getResourceDir());
  48. XftColors [C_MAIN_BG] = disp->alloc_xftcolor (0.25f, 0.25f, 0.25f, 1.0f);
  49. XftColors [C_MAIN_FG] = disp->alloc_xftcolor (1.0f, 1.0f, 1.0f, 1.0f);
  50. XftColors [C_TEXT_BG] = disp->alloc_xftcolor (1.0f, 1.0f, 0.0f, 1.0f);
  51. XftColors [C_TEXT_FG] = disp->alloc_xftcolor (0.0f, 0.0f, 0.0f, 1.0f);
  52. XftFonts [F_TEXT] = disp->alloc_xftfont (xrm->get (".font.text", "luxi:bold::pixelsize=11"));
  53. tstyle1.font = XftFonts [F_TEXT];
  54. tstyle1.color.normal.bgnd = XftColors [C_TEXT_BG]->pixel;
  55. tstyle1.color.normal.text = XftColors [C_TEXT_FG];
  56. inputsect = png2img (resourceDir+"/inputsect.png", disp, XftColors [C_MAIN_BG]);
  57. shuffsect = png2img (resourceDir+"/shuffsect.png", disp, XftColors [C_MAIN_BG]);
  58. lfshfsect = png2img (resourceDir+"/lfshfsect.png", disp, XftColors [C_MAIN_BG]);
  59. if (!inputsect || !shuffsect || !lfshfsect) return 1;
  60. inpbal_img._backg = XftColors [C_MAIN_BG];
  61. inpbal_img._image [0] = inputsect;
  62. inpbal_img._lncol [0] = 1;
  63. inpbal_img._x0 = 28;
  64. inpbal_img._y0 = 17;
  65. inpbal_img._dx = 25;
  66. inpbal_img._dy = 25;
  67. inpbal_img._xref = 12.5;
  68. inpbal_img._yref = 12.5;
  69. inpbal_img._rad = 12;
  70. hpfilt_img._backg = XftColors [C_MAIN_BG];
  71. hpfilt_img._image [0] = inputsect;
  72. hpfilt_img._lncol [0] = 0;
  73. hpfilt_img._x0 = 87;
  74. hpfilt_img._y0 = 17;
  75. hpfilt_img._dx = 25;
  76. hpfilt_img._dy = 25;
  77. hpfilt_img._xref = 12.5;
  78. hpfilt_img._yref = 12.5;
  79. hpfilt_img._rad = 12;
  80. shgain_img._backg = XftColors [C_MAIN_BG];
  81. shgain_img._image [0] = shuffsect;
  82. shgain_img._lncol [0] = 0;
  83. shgain_img._x0 = 68;
  84. shgain_img._y0 = 17;
  85. shgain_img._dx = 25;
  86. shgain_img._dy = 25;
  87. shgain_img._xref = 12.5;
  88. shgain_img._yref = 12.5;
  89. shgain_img._rad = 12;
  90. shfreq_img._backg = XftColors [C_MAIN_BG];
  91. shfreq_img._image [0] = shuffsect;
  92. shfreq_img._lncol [0] = 0;
  93. shfreq_img._x0 = 127;
  94. shfreq_img._y0 = 17;
  95. shfreq_img._dx = 25;
  96. shfreq_img._dy = 25;
  97. shfreq_img._xref = 12.5;
  98. shfreq_img._yref = 12.5;
  99. shfreq_img._rad = 12;
  100. lffreq_img._backg = XftColors [C_MAIN_BG];
  101. lffreq_img._image [0] = lfshfsect;
  102. lffreq_img._lncol [0] = 0;
  103. lffreq_img._x0 = 14;
  104. lffreq_img._y0 = 31;
  105. lffreq_img._dx = 25;
  106. lffreq_img._dy = 25;
  107. lffreq_img._xref = 12.5;
  108. lffreq_img._yref = 12.5;
  109. lffreq_img._rad = 12;
  110. lfgain_img._backg = XftColors [C_MAIN_BG];
  111. lfgain_img._image [0] = lfshfsect;
  112. lfgain_img._lncol [0] = 1;
  113. lfgain_img._x0 = 63;
  114. lfgain_img._y0 = 17;
  115. lfgain_img._dx = 25;
  116. lfgain_img._dy = 25;
  117. lfgain_img._xref = 12.5;
  118. lfgain_img._yref = 12.5;
  119. lfgain_img._rad = 12;
  120. return 0;
  121. }
  122. void styles_fini (X_display *disp)
  123. {
  124. }
  125. }