Added some logic to layers editor selection

This commit is contained in:
YuSanka 2019-06-12 16:28:25 +02:00
parent 26fb68ba45
commit 1694204687
4 changed files with 136 additions and 64 deletions

View file

@ -19,18 +19,32 @@ class ConfigOptionsGroup;
typedef double coordf_t;
typedef std::pair<coordf_t, coordf_t> t_layer_height_range;
enum EditorType
{
etUndef = 0,
etMinZ = 1,
etMaxZ = 2,
etLayerHeight = 4,
};
class LayerRangeEditor : public wxTextCtrl
{
bool m_enter_pressed { false };
bool m_call_kill_focus { false };
wxString m_valid_value;
EditorType m_type;
public:
LayerRangeEditor( wxWindow* parent,
const wxString& value = wxEmptyString,
std::function<bool(coordf_t val)> edit_fn = [](coordf_t) {return false; }
EditorType type = etUndef,
std::function<void(EditorType)> set_focus_fn = [](EditorType) {;},
std::function<bool(coordf_t, bool)> edit_fn = [](coordf_t, bool) {return false; }
);
~LayerRangeEditor() {}
EditorType type() const {return m_type;}
private:
coordf_t get_value();
};
@ -43,19 +57,13 @@ class ObjectLayers : public OG_Settings
wxFlexGridSizer* m_grid_sizer;
t_layer_height_range m_last_edited_range;
enum SelectedItemType
{
sitUndef,
sitMinZ,
sitMaxZ,
sitLayerHeight,
} m_selection_type {sitUndef};
EditorType m_selection_type {etUndef};
public:
ObjectLayers(wxWindow* parent);
~ObjectLayers() {}
void select_editor(LayerRangeEditor* editor, const bool is_last_edited_range);
wxSizer* create_layer(const t_layer_height_range& range); // without_buttons
void create_layers_list();
void update_layers_list();