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.

48 lines
1.1KB

  1. #pragma once
  2. #include "ui.hpp"
  3. #include <jansson.h>
  4. namespace rack {
  5. static const float SVG_DPI = 75.0;
  6. static const float MM_PER_IN = 25.4;
  7. /** Converts inch measurements to pixels */
  8. inline float in2px(float in) {
  9. return in * SVG_DPI;
  10. }
  11. inline Vec in2px(Vec in) {
  12. return in.mult(SVG_DPI);
  13. }
  14. /** Converts millimeter measurements to pixels */
  15. inline float mm2px(float mm) {
  16. return mm * (SVG_DPI / MM_PER_IN);
  17. }
  18. inline Vec mm2px(Vec mm) {
  19. return mm.mult(SVG_DPI / MM_PER_IN);
  20. }
  21. // A 1HPx3U module should be 15x380 pixels. Thus the width of a module should be a factor of 15.
  22. static const float RACK_GRID_WIDTH = 15;
  23. static const float RACK_GRID_HEIGHT = 380;
  24. static const Vec RACK_GRID_SIZE = Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT);
  25. static const std::string PRESET_FILTERS = "VCV Rack module preset (.vcvm):vcvm";
  26. static const std::string PATCH_FILTERS = "VCV Rack patch (.vcv):vcv";
  27. /** Deprecated. Will be removed in v1 */
  28. json_t *colorToJson(NVGcolor color);
  29. /** Deprecated. Will be removed in v1 */
  30. NVGcolor jsonToColor(json_t *colorJ);
  31. } // namespace rack