mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-05 18:40:46 +08:00
refactor: allow tests to attach a preset store to a PresetChooser (instead of pulling from SLIC3RAPP)
This commit is contained in:
parent
4d23ea916e
commit
e8f98e424f
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
PresetChooser::PresetChooser(wxWindow* parent, Print& print) : PresetChooser(parent, print, SLIC3RAPP->settings) {}
|
PresetChooser::PresetChooser(wxWindow* parent, Print& print) : PresetChooser(parent, print, SLIC3RAPP->settings, SLIC3RAPP->presets) {}
|
||||||
|
|
||||||
PresetChooser::PresetChooser(wxWindow* parent, Print& print, Settings& external) :
|
PresetChooser::PresetChooser(wxWindow* parent, Print& print, Settings& external_settings, preset_store& external_presets) :
|
||||||
wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, ""),
|
wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, ""),
|
||||||
_settings(external), _print(print)
|
_settings(external_settings), _print(print), _presets(external_presets)
|
||||||
{
|
{
|
||||||
for (auto group : { preset_t::Print, preset_t::Material, preset_t::Printer }) {
|
for (auto group : { preset_t::Print, preset_t::Material, preset_t::Printer }) {
|
||||||
wxString name = "";
|
wxString name = "";
|
||||||
|
@ -23,7 +23,7 @@ public:
|
|||||||
|
|
||||||
/// Build a panel to contain a sizer for dropdowns for preset selection.
|
/// Build a panel to contain a sizer for dropdowns for preset selection.
|
||||||
PresetChooser(wxWindow* parent, Print& print);
|
PresetChooser(wxWindow* parent, Print& print);
|
||||||
PresetChooser(wxWindow* parent, Print& print, Settings& external);
|
PresetChooser(wxWindow* parent, Print& print, Settings& external_settings, preset_store& external_presets);
|
||||||
|
|
||||||
std::array<Choosers, preset_types> preset_choosers;
|
std::array<Choosers, preset_types> preset_choosers;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ public:
|
|||||||
void load(std::array<Presets, preset_types> presets);
|
void load(std::array<Presets, preset_types> presets);
|
||||||
|
|
||||||
/// Call load() with the app's own presets
|
/// Call load() with the app's own presets
|
||||||
void load() { this->load(SLIC3RAPP->presets); }
|
void load() { this->load(this->_presets); }
|
||||||
|
|
||||||
/// Const reference to internal name map (used for testing)
|
/// Const reference to internal name map (used for testing)
|
||||||
const chooser_name_map& _chooser_names() const { return this->__chooser_names; }
|
const chooser_name_map& _chooser_names() const { return this->__chooser_names; }
|
||||||
@ -48,6 +48,9 @@ private:
|
|||||||
/// Reference to owning Plater's print
|
/// Reference to owning Plater's print
|
||||||
Print& _print;
|
Print& _print;
|
||||||
|
|
||||||
|
/// Reference to owning Application's preset database.
|
||||||
|
preset_store& _presets;
|
||||||
|
|
||||||
void _on_select_preset(preset_t preset);
|
void _on_select_preset(preset_t preset);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user