2018-04-20 10:58:07 +00:00
|
|
|
#ifndef slic3r_BedShapeDialog_hpp_
|
|
|
|
#define slic3r_BedShapeDialog_hpp_
|
2018-01-25 12:46:04 +00:00
|
|
|
// The bed shape dialog.
|
|
|
|
// The dialog opens from Print Settins tab->Bed Shape : Set...
|
|
|
|
|
|
|
|
#include "OptionsGroup.hpp"
|
|
|
|
#include "2DBed.hpp"
|
2018-11-26 13:41:58 +00:00
|
|
|
#include "I18N.hpp"
|
2018-01-25 12:46:04 +00:00
|
|
|
|
|
|
|
#include <wx/dialog.h>
|
|
|
|
#include <wx/choicebk.h>
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
using ConfigOptionsGroupShp = std::shared_ptr<ConfigOptionsGroup>;
|
|
|
|
class BedShapePanel : public wxPanel
|
|
|
|
{
|
2019-07-18 09:12:11 +00:00
|
|
|
static const std::string NONE;
|
|
|
|
static const std::string EMPTY_STRING;
|
|
|
|
|
2019-06-12 08:00:51 +00:00
|
|
|
Bed_2D* m_canvas;
|
2019-07-18 09:12:11 +00:00
|
|
|
std::vector<Vec2d> m_shape;
|
|
|
|
std::vector<Vec2d> m_loaded_shape;
|
|
|
|
std::string m_custom_texture;
|
2019-07-18 10:56:52 +00:00
|
|
|
std::string m_custom_model;
|
2018-01-25 12:46:04 +00:00
|
|
|
|
|
|
|
public:
|
2019-07-18 10:56:52 +00:00
|
|
|
BedShapePanel(wxWindow* parent) : wxPanel(parent, wxID_ANY), m_custom_texture(NONE), m_custom_model(NONE) {}
|
|
|
|
|
|
|
|
void build_panel(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model);
|
2019-07-17 12:53:02 +00:00
|
|
|
|
2019-07-09 11:33:15 +00:00
|
|
|
// Returns the resulting bed shape polygon. This value will be stored to the ini file.
|
2019-07-18 09:12:11 +00:00
|
|
|
const std::vector<Vec2d>& get_shape() const { return m_shape; }
|
|
|
|
const std::string& get_custom_texture() const { return (m_custom_texture != NONE) ? m_custom_texture : EMPTY_STRING; }
|
2019-07-18 10:56:52 +00:00
|
|
|
const std::string& get_custom_model() const { return (m_custom_model != NONE) ? m_custom_model : EMPTY_STRING; }
|
2019-07-09 11:33:15 +00:00
|
|
|
|
|
|
|
private:
|
2019-06-12 08:00:51 +00:00
|
|
|
ConfigOptionsGroupShp init_shape_options_page(const wxString& title);
|
2019-07-18 09:12:11 +00:00
|
|
|
wxPanel* init_texture_panel();
|
2019-07-18 10:56:52 +00:00
|
|
|
wxPanel* init_model_panel();
|
2019-07-17 12:53:02 +00:00
|
|
|
void set_shape(const ConfigOptionPoints& points);
|
|
|
|
void update_preview();
|
2018-01-25 12:46:04 +00:00
|
|
|
void update_shape();
|
|
|
|
void load_stl();
|
2019-07-18 09:12:11 +00:00
|
|
|
void load_texture();
|
2019-07-18 10:56:52 +00:00
|
|
|
void load_model();
|
2019-07-18 09:12:11 +00:00
|
|
|
|
2019-04-18 00:03:40 +00:00
|
|
|
wxChoicebook* m_shape_options_book;
|
|
|
|
std::vector <ConfigOptionsGroupShp> m_optgroups;
|
|
|
|
|
2019-07-09 11:33:15 +00:00
|
|
|
friend class BedShapeDialog;
|
2018-01-25 12:46:04 +00:00
|
|
|
};
|
|
|
|
|
2019-04-18 00:03:40 +00:00
|
|
|
class BedShapeDialog : public DPIDialog
|
2018-01-25 12:46:04 +00:00
|
|
|
{
|
2018-02-05 15:12:16 +00:00
|
|
|
BedShapePanel* m_panel;
|
2018-01-25 12:46:04 +00:00
|
|
|
public:
|
2019-04-18 00:03:40 +00:00
|
|
|
BedShapeDialog(wxWindow* parent) : DPIDialog(parent, wxID_ANY, _(L("Bed Shape")),
|
2019-02-06 08:49:32 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {}
|
2018-01-25 12:46:04 +00:00
|
|
|
|
2019-07-18 10:56:52 +00:00
|
|
|
void build_dialog(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model);
|
|
|
|
|
2019-07-18 09:12:11 +00:00
|
|
|
const std::vector<Vec2d>& get_shape() const { return m_panel->get_shape(); }
|
|
|
|
const std::string& get_custom_texture() const { return m_panel->get_custom_texture(); }
|
2019-07-18 10:56:52 +00:00
|
|
|
const std::string& get_custom_model() const { return m_panel->get_custom_model(); }
|
2019-04-18 00:03:40 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void on_dpi_changed(const wxRect &suggested_rect) override;
|
2018-01-25 12:46:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // GUI
|
|
|
|
} // Slic3r
|
2018-04-20 10:58:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* slic3r_BedShapeDialog_hpp_ */
|