From 0a1d8f89af7f71351d29980f592d305d41cde5ef Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 18 Nov 2018 00:41:37 -0600 Subject: [PATCH] Add reference to Slic3r::Print to PresetChooser. --- src/GUI/Plater/PresetChooser.cpp | 7 +++++-- src/GUI/Plater/PresetChooser.hpp | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/GUI/Plater/PresetChooser.cpp b/src/GUI/Plater/PresetChooser.cpp index f9fa1e10f..872a8d0bb 100644 --- a/src/GUI/Plater/PresetChooser.cpp +++ b/src/GUI/Plater/PresetChooser.cpp @@ -2,8 +2,11 @@ namespace Slic3r { namespace GUI { -PresetChooser::PresetChooser(wxWindow* parent) : - wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, "") +PresetChooser::PresetChooser(wxWindow* parent, Print& print) : PresetChooser(parent, print, SLIC3RAPP->settings) {} + +PresetChooser::PresetChooser(wxWindow* parent, Print& print, Settings& external) : + wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, ""), + _settings(external), _print(print) { for (auto group : { preset_t::Print, preset_t::Material, preset_t::Printer }) { wxString name = ""; diff --git a/src/GUI/Plater/PresetChooser.hpp b/src/GUI/Plater/PresetChooser.hpp index 1be0e9d5e..edd65bca6 100644 --- a/src/GUI/Plater/PresetChooser.hpp +++ b/src/GUI/Plater/PresetChooser.hpp @@ -20,7 +20,10 @@ using chooser_name_map = std::array; class PresetChooser : public wxPanel { public: - PresetChooser(wxWindow* parent); + + /// Build a panel to contain a sizer for dropdowns for preset selection. + PresetChooser(wxWindow* parent, Print& print); + PresetChooser(wxWindow* parent, Print& print, Settings& external); std::array preset_choosers; @@ -38,6 +41,8 @@ private: wxSizer* local_sizer {}; void _on_change_combobox(preset_t preset, wxBitmapComboBox* choice); chooser_name_map __chooser_names; + /// Reference to owning Plater's print + Print& _print; };