Config.pm 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #/|/ Copyright (c) Prusa Research 2016 - 2022 Vojtěch Bubník @bubnikv
  2. #/|/ Copyright (c) 2017 Joseph Lenox @lordofhyphens
  3. #/|/ Copyright (c) Slic3r 2011 - 2016 Alessandro Ranellucci @alranel
  4. #/|/ Copyright (c) 2015 Alexander Rössler @machinekoder
  5. #/|/ Copyright (c) 2012 Henrik Brix Andersen @henrikbrixandersen
  6. #/|/ Copyright (c) 2012 Mark Hindess
  7. #/|/ Copyright (c) 2012 Josh McCullough
  8. #/|/ Copyright (c) 2011 - 2012 Michael Moon
  9. #/|/ Copyright (c) 2012 Simon George
  10. #/|/ Copyright (c) 2012 Johannes Reinhardt
  11. #/|/ Copyright (c) 2011 Clarence Risher
  12. #/|/
  13. #/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
  14. #/|/
  15. # Extends C++ class Slic3r::DynamicPrintConfig
  16. # This perl class does not keep any perl class variables,
  17. # all the storage is handled by the underlying C++ code.
  18. package Slic3r::Config;
  19. use strict;
  20. use warnings;
  21. use utf8;
  22. use List::Util qw(first max);
  23. # C++ Slic3r::PrintConfigDef exported as a Perl hash of hashes.
  24. # The C++ counterpart is a constant singleton.
  25. our $Options = print_config_def();
  26. # Generate accessors.
  27. {
  28. no strict 'refs';
  29. for my $opt_key (keys %$Options) {
  30. *{$opt_key} = sub {
  31. #print "Slic3r::Config::accessor $opt_key\n";
  32. $_[0]->get($opt_key)
  33. };
  34. }
  35. }
  36. package Slic3r::Config::Static;
  37. use parent 'Slic3r::Config';
  38. sub Slic3r::Config::GCode::new { Slic3r::Config::Static::new_GCodeConfig }
  39. sub Slic3r::Config::Print::new { Slic3r::Config::Static::new_PrintConfig }
  40. 1;