mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-05 00:40:37 +08:00
Push Settings down so it's available to the plater (for color choices, etc).
This commit is contained in:
parent
16c4146764
commit
f44efd08b0
@ -12,9 +12,9 @@ wxEND_EVENT_TABLE()
|
||||
|
||||
MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
: MainFrame(title, pos, size, nullptr) {}
|
||||
MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr<Settings> config)
|
||||
MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr<Settings> _gui_config)
|
||||
: wxFrame(NULL, wxID_ANY, title, pos, size), loaded(false),
|
||||
tabpanel(nullptr), controller(nullptr), plater(nullptr), gui_config(config), preset_editor_tabs(std::map<wxWindowID, PresetEditor*>())
|
||||
tabpanel(nullptr), controller(nullptr), plater(nullptr), gui_config(_gui_config), preset_editor_tabs(std::map<wxWindowID, PresetEditor*>())
|
||||
{
|
||||
// Set icon to either the .ico if windows or png for everything else.
|
||||
if (the_os == OS::Windows)
|
||||
@ -105,7 +105,7 @@ void MainFrame::init_tabpanel()
|
||||
wxTheApp->CallAfter([=] { this->tabpanel->SetSelection(0); });
|
||||
}), panel->GetId());
|
||||
|
||||
this->plater = new Slic3r::GUI::Plater(panel, _("Plater"));
|
||||
this->plater = new Slic3r::GUI::Plater(panel, _("Plater"), gui_config);
|
||||
this->controller = new Slic3r::GUI::Controller(panel, _("Controller"));
|
||||
|
||||
panel->AddPage(this->plater, this->plater->GetName());
|
||||
|
@ -28,7 +28,7 @@ class MainFrame: public wxFrame
|
||||
{
|
||||
public:
|
||||
MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||
MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr<Settings> gui_config);
|
||||
MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr<Settings> _gui_config);
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <memory>
|
||||
|
||||
#include "Plater.hpp"
|
||||
#include "Log.hpp"
|
||||
|
||||
@ -5,8 +7,8 @@ namespace Slic3r { namespace GUI {
|
||||
|
||||
const auto PROGRESS_BAR_EVENT = wxNewEventType();
|
||||
|
||||
Plater::Plater(wxWindow* parent, const wxString& title) :
|
||||
wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title)
|
||||
Plater::Plater(wxWindow* parent, const wxString& title, std::shared_ptr<Settings> _settings) :
|
||||
wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title), settings(_settings)
|
||||
{
|
||||
|
||||
// Set callback for status event for worker threads
|
||||
@ -53,7 +55,7 @@ Plater::Plater(wxWindow* parent, const wxString& title) :
|
||||
});
|
||||
}
|
||||
*/
|
||||
canvas2D = new Plate2D(preview_notebook, wxDefaultSize, objects, model, config);
|
||||
canvas2D = new Plate2D(preview_notebook, wxDefaultSize, objects, model, config, settings);
|
||||
|
||||
/*
|
||||
# Initialize 2D preview canvas
|
||||
|
@ -16,22 +16,25 @@
|
||||
|
||||
#include "Plater/Plater2DObject.hpp"
|
||||
#include "Plater/Plate2D.hpp"
|
||||
#include "Settings.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
using UndoOperation = int;
|
||||
|
||||
class Plater2DObject;
|
||||
class Plate2D;
|
||||
|
||||
class Plater : public wxPanel
|
||||
{
|
||||
public:
|
||||
Plater(wxWindow* parent, const wxString& title);
|
||||
Plater(wxWindow* parent, const wxString& title, std::shared_ptr<Settings> _settings);
|
||||
void add();
|
||||
|
||||
private:
|
||||
std::shared_ptr<Slic3r::Print> print {std::make_shared<Print>(Slic3r::Print())};
|
||||
std::shared_ptr<Slic3r::Model> model {std::make_shared<Model>(Slic3r::Model())};
|
||||
std::shared_ptr<Settings> settings {};
|
||||
|
||||
std::shared_ptr<Slic3r::Config> config { Slic3r::Config::new_from_defaults(
|
||||
{"bed_shape", "complete_objects", "extruder_clearance_radius", "skirts", "skirt_distance",
|
||||
|
@ -0,0 +1,12 @@
|
||||
#include "Plater/Plate2D.hpp"
|
||||
|
||||
#include <wx/colour.h>
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
Plate2D::Plate2D(wxWindow* parent, const wxSize& size, std::vector<Plater2DObject>& _objects, std::shared_ptr<Model> _model, std::shared_ptr<Config> _config, std::shared_ptr<Settings> _settings) :
|
||||
wxPanel(parent, wxID_ANY, wxDefaultPosition, size, wxTAB_TRAVERSAL), objects(_objects), model(_model), config(_config), settings(_settings)
|
||||
{
|
||||
}
|
||||
|
||||
} } // Namespace Slic3r::GUI
|
@ -6,6 +6,8 @@
|
||||
#endif
|
||||
#include <vector>
|
||||
#include "Plater.hpp"
|
||||
#include "ColorScheme.hpp"
|
||||
#include "Settings.hpp"
|
||||
#include "Plater/Plater2DObject.hpp"
|
||||
|
||||
|
||||
@ -13,12 +15,14 @@ namespace Slic3r { namespace GUI {
|
||||
|
||||
class Plate2D : public wxPanel {
|
||||
public:
|
||||
Plate2D(wxWindow* parent, const wxSize& size, std::vector<Plater2DObject>& _objects, std::shared_ptr<Model> _model, std::shared_ptr<Config> _config) :
|
||||
wxPanel(parent, wxID_ANY, wxDefaultPosition, size, wxTAB_TRAVERSAL), objects(_objects), model(_model), config(_config) { }
|
||||
Plate2D(wxWindow* parent, const wxSize& size, std::vector<Plater2DObject>& _objects, std::shared_ptr<Model> _model, std::shared_ptr<Config> _config, std::shared_ptr<Settings> _settings);
|
||||
private:
|
||||
std::vector<Plater2DObject>& objects;
|
||||
std::shared_ptr<Slic3r::Model> model;
|
||||
std::shared_ptr<Slic3r::Config> config;
|
||||
std::shared_ptr<Settings> settings;
|
||||
|
||||
wxBrush objects_brush {};
|
||||
};
|
||||
|
||||
} } // Namespace Slic3r::GUI
|
||||
|
Loading…
x
Reference in New Issue
Block a user