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.

164 lines
5.1KB

  1. // ----------------------------------------------------------------------
  2. //
  3. // Copyright (C) 2010-2014 Fons Adriaensen <fons@linuxaudio.org>
  4. // Modified by falkTX on Jan 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 "tmeter.h"
  23. #include "png2img.h"
  24. #include "CarlaString.hpp"
  25. namespace AT1 {
  26. XftColor *XftColors [NXFTCOLORS];
  27. XftFont *XftFonts [NXFTFONTS];
  28. X_textln_style tstyle1;
  29. X_button_style bstyle1;
  30. XImage *notesect_img;
  31. XImage *ctrlsect_img;
  32. XImage *redzita_img;
  33. ButtonImg b_note_img;
  34. ButtonImg b_midi_img;
  35. RotaryGeom r_tune_geom;
  36. RotaryGeom r_filt_geom;
  37. RotaryGeom r_bias_geom;
  38. RotaryGeom r_corr_geom;
  39. RotaryGeom r_offs_geom;
  40. int styles_init (X_display *disp, X_resman *xrm, const char *resdir)
  41. {
  42. XftColors [C_MAIN_BG] = disp->alloc_xftcolor (0.25f, 0.25f, 0.25f, 1.0f);
  43. XftColors [C_MAIN_FG] = disp->alloc_xftcolor (1.0f, 1.0f, 1.0f, 1.0f);
  44. XftColors [C_TEXT_BG] = disp->alloc_xftcolor (1.0f, 1.0f, 1.0f, 1.0f);
  45. XftColors [C_TEXT_FG] = disp->alloc_xftcolor (0.1f, 0.1f, 0.1f, 1.0f);
  46. XftFonts [F_TEXT] = disp->alloc_xftfont (xrm->get (".font.text", "luxi:bold::pixelsize=11"));
  47. XftFonts [F_BUTT] = disp->alloc_xftfont (xrm->get (".font.butt", "luxi:bold::pixelsize=11"));
  48. tstyle1.font = XftFonts [F_TEXT];
  49. tstyle1.color.normal.bgnd = XftColors [C_TEXT_BG]->pixel;
  50. tstyle1.color.normal.text = XftColors [C_TEXT_FG];
  51. bstyle1.font = XftFonts [F_BUTT];
  52. bstyle1.color.bg[0] = XftColors [C_MAIN_BG]->pixel;
  53. bstyle1.color.fg[0] = XftColors [C_MAIN_FG];
  54. bstyle1.type = X_button_style::PLAIN | X_button_style::ALEFT;
  55. const CarlaString SHARED = CarlaString(resdir)+"/at1";
  56. notesect_img = png2img (SHARED+"/notesect.png", disp, XftColors [C_MAIN_BG]);
  57. ctrlsect_img = png2img (SHARED+"/ctrlsect.png", disp, XftColors [C_MAIN_BG]);
  58. Tmeter::_scale = png2img (SHARED+"/hscale.png", disp, XftColors [C_MAIN_BG]);
  59. Tmeter::_imag0 = png2img (SHARED+"/hmeter0.png", disp, XftColors [C_MAIN_BG]);
  60. Tmeter::_imag1 = png2img (SHARED+"/hmeter1.png", disp, XftColors [C_MAIN_BG]);
  61. if ( !notesect_img || !ctrlsect_img
  62. || !Tmeter::_scale || !Tmeter::_imag0 || !Tmeter::_imag1)
  63. {
  64. fprintf (stderr, "Can't load images from '%s'.\n", SHARED.buffer());
  65. return 1;
  66. }
  67. b_midi_img._backg = XftColors [C_MAIN_BG];
  68. b_midi_img._ximage = png2img (SHARED+"/midi.png", disp, XftColors [C_MAIN_BG]);
  69. b_midi_img._x0 = 0;
  70. b_midi_img._y0 = 0;
  71. b_midi_img._dx = 40;
  72. b_midi_img._dy = 24;
  73. b_note_img._backg = XftColors [C_MAIN_BG];
  74. b_note_img._ximage = png2img (SHARED+"/note.png", disp, XftColors [C_MAIN_BG]);
  75. b_note_img._x0 = 0;
  76. b_note_img._y0 = 0;
  77. b_note_img._dx = 16;
  78. b_note_img._dy = 16;
  79. r_tune_geom._backg = XftColors [C_MAIN_BG];
  80. r_tune_geom._image [0] = ctrlsect_img;
  81. r_tune_geom._lncol [0] = 1;
  82. r_tune_geom._x0 = 26;
  83. r_tune_geom._y0 = 17;
  84. r_tune_geom._dx = 23;
  85. r_tune_geom._dy = 23;
  86. r_tune_geom._xref = 11.5;
  87. r_tune_geom._yref = 11.5;
  88. r_tune_geom._rad = 11;
  89. r_bias_geom._backg = XftColors [C_MAIN_BG];
  90. r_bias_geom._image [0] = ctrlsect_img;
  91. r_bias_geom._lncol [0] = 0;
  92. r_bias_geom._x0 = 86;
  93. r_bias_geom._y0 = 17;
  94. r_bias_geom._dx = 23;
  95. r_bias_geom._dy = 23;
  96. r_bias_geom._xref = 11.5;
  97. r_bias_geom._yref = 11.5;
  98. r_bias_geom._rad = 11;
  99. r_filt_geom._backg = XftColors [C_MAIN_BG];
  100. r_filt_geom._image [0] = ctrlsect_img;
  101. r_filt_geom._lncol [0] = 0;
  102. r_filt_geom._x0 = 146;
  103. r_filt_geom._y0 = 17;
  104. r_filt_geom._dx = 23;
  105. r_filt_geom._dy = 23;
  106. r_filt_geom._xref = 11.5;
  107. r_filt_geom._yref = 11.5;
  108. r_filt_geom._rad = 11;
  109. r_corr_geom._backg = XftColors [C_MAIN_BG];
  110. r_corr_geom._image [0] = ctrlsect_img;
  111. r_corr_geom._lncol [0] = 0;
  112. r_corr_geom._x0 = 206;
  113. r_corr_geom._y0 = 17;
  114. r_corr_geom._dx = 23;
  115. r_corr_geom._dy = 23;
  116. r_corr_geom._xref = 11.5;
  117. r_corr_geom._yref = 11.5;
  118. r_corr_geom._rad = 11;
  119. r_offs_geom._backg = XftColors [C_MAIN_BG];
  120. r_offs_geom._image [0] = ctrlsect_img;
  121. r_offs_geom._lncol [0] = 0;
  122. r_offs_geom._x0 = 266;
  123. r_offs_geom._y0 = 17;
  124. r_offs_geom._dx = 23;
  125. r_offs_geom._dy = 23;
  126. r_offs_geom._xref = 11.5;
  127. r_offs_geom._yref = 11.5;
  128. r_offs_geom._rad = 11;
  129. return 0;
  130. }
  131. void styles_fini (X_display *disp)
  132. {
  133. }
  134. }