2019-05-28 14:38:04 +00:00
|
|
|
#ifndef slic3r_GUI_ObjectLayers_hpp_
|
|
|
|
#define slic3r_GUI_ObjectLayers_hpp_
|
|
|
|
|
|
|
|
#include "GUI_ObjectSettings.hpp"
|
|
|
|
#include "wxExtensions.hpp"
|
|
|
|
|
2019-06-05 11:52:53 +00:00
|
|
|
#ifdef __WXOSX__
|
2019-06-05 14:47:09 +00:00
|
|
|
#include "../libslic3r/PrintConfig.hpp"
|
2019-06-05 11:52:53 +00:00
|
|
|
#endif
|
|
|
|
|
2019-05-28 14:38:04 +00:00
|
|
|
class wxBoxSizer;
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
class ModelObject;
|
|
|
|
|
2019-06-05 11:52:53 +00:00
|
|
|
namespace GUI {
|
|
|
|
class ConfigOptionsGroup;
|
|
|
|
|
2019-06-06 12:14:29 +00:00
|
|
|
typedef double coordf_t;
|
|
|
|
typedef std::pair<coordf_t, coordf_t> t_layer_height_range;
|
2019-06-05 09:50:59 +00:00
|
|
|
|
2019-06-26 11:30:20 +00:00
|
|
|
class ObjectLayers;
|
|
|
|
|
2019-06-12 14:28:25 +00:00
|
|
|
enum EditorType
|
|
|
|
{
|
|
|
|
etUndef = 0,
|
|
|
|
etMinZ = 1,
|
|
|
|
etMaxZ = 2,
|
|
|
|
etLayerHeight = 4,
|
|
|
|
};
|
|
|
|
|
2019-06-04 13:22:29 +00:00
|
|
|
class LayerRangeEditor : public wxTextCtrl
|
|
|
|
{
|
2019-06-05 09:03:46 +00:00
|
|
|
bool m_enter_pressed { false };
|
|
|
|
bool m_call_kill_focus { false };
|
2019-06-12 14:28:25 +00:00
|
|
|
wxString m_valid_value;
|
|
|
|
EditorType m_type;
|
2019-06-05 09:03:46 +00:00
|
|
|
|
2019-06-26 11:30:20 +00:00
|
|
|
std::function<void(EditorType)> m_set_focus_data;
|
2019-06-13 09:37:03 +00:00
|
|
|
|
2019-06-04 13:22:29 +00:00
|
|
|
public:
|
2019-06-26 11:30:20 +00:00
|
|
|
LayerRangeEditor( ObjectLayers* parent,
|
2019-06-04 13:22:29 +00:00
|
|
|
const wxString& value = wxEmptyString,
|
2019-06-12 14:28:25 +00:00
|
|
|
EditorType type = etUndef,
|
2019-06-26 11:30:20 +00:00
|
|
|
std::function<void(EditorType)> set_focus_data_fn = [](EditorType) {;},
|
|
|
|
std::function<bool(coordf_t, bool)> edit_fn = [](coordf_t, bool) {return false; }
|
2019-06-04 13:22:29 +00:00
|
|
|
);
|
|
|
|
~LayerRangeEditor() {}
|
|
|
|
|
2019-06-12 14:28:25 +00:00
|
|
|
EditorType type() const {return m_type;}
|
2019-06-26 11:30:20 +00:00
|
|
|
void set_focus_data() const { m_set_focus_data(m_type);}
|
2019-09-17 11:41:44 +00:00
|
|
|
void msw_rescale();
|
2019-06-12 14:28:25 +00:00
|
|
|
|
2019-06-04 13:22:29 +00:00
|
|
|
private:
|
|
|
|
coordf_t get_value();
|
|
|
|
};
|
|
|
|
|
2019-05-28 14:38:04 +00:00
|
|
|
class ObjectLayers : public OG_Settings
|
|
|
|
{
|
2019-05-30 10:41:16 +00:00
|
|
|
ScalableBitmap m_bmp_delete;
|
|
|
|
ScalableBitmap m_bmp_add;
|
|
|
|
ModelObject* m_object {nullptr};
|
2019-05-28 14:38:04 +00:00
|
|
|
|
2019-06-05 09:50:59 +00:00
|
|
|
wxFlexGridSizer* m_grid_sizer;
|
2019-06-13 09:37:03 +00:00
|
|
|
t_layer_height_range m_selectable_range;
|
2019-06-12 14:28:25 +00:00
|
|
|
EditorType m_selection_type {etUndef};
|
2019-05-28 14:38:04 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
ObjectLayers(wxWindow* parent);
|
|
|
|
~ObjectLayers() {}
|
|
|
|
|
2019-06-12 14:28:25 +00:00
|
|
|
void select_editor(LayerRangeEditor* editor, const bool is_last_edited_range);
|
2019-06-06 12:14:29 +00:00
|
|
|
wxSizer* create_layer(const t_layer_height_range& range); // without_buttons
|
2019-06-04 09:51:25 +00:00
|
|
|
void create_layers_list();
|
2019-05-28 14:38:04 +00:00
|
|
|
void update_layers_list();
|
|
|
|
|
2019-07-02 13:26:11 +00:00
|
|
|
void update_scene_from_editor_selection() const;
|
2019-06-26 11:30:20 +00:00
|
|
|
|
2019-05-28 14:38:04 +00:00
|
|
|
void UpdateAndShow(const bool show) override;
|
|
|
|
void msw_rescale();
|
2019-07-02 13:26:11 +00:00
|
|
|
void reset_selection();
|
|
|
|
void set_selectable_range(const t_layer_height_range& range) { m_selectable_range = range; }
|
2019-07-02 08:34:30 +00:00
|
|
|
|
2019-06-26 11:30:20 +00:00
|
|
|
friend class LayerRangeEditor;
|
2019-05-28 14:38:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
#endif // slic3r_GUI_ObjectLayers_hpp_
|