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.

42 lines
940B

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