From aed277089beaaec1a7a5a9936d0ba309f7057b21 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 9 Jan 2020 16:38:59 +0100 Subject: Updated tooltips and context menus for 3 manipulation mode of DoubleSlider + Some code refactoring --- src/slic3r/GUI/wxExtensions.hpp | 50 +++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 27 deletions(-) (limited to 'src/slic3r/GUI/wxExtensions.hpp') diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index 31e60d7d6..87cc922cf 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -821,20 +821,15 @@ public: EnableTickManipulation(false); } - enum ManipulationState { - msSingleExtruder, // single extruder printer preset is selected - msMultiAsSingle, // multiple extruder printer preset is selected, but + enum ManipulationMode { + mmSingleExtruder, // single extruder printer preset is selected + mmMultiAsSingle, // multiple extruder printer preset is selected, but // this mode works just for Single extruder print // (For all print from objects settings is used just one extruder) - msMultiExtruder // multiple extruder printer preset is selected + mmMultiExtruder // multiple extruder printer preset is selected }; - void SetManipulationState(ManipulationState state) { - m_state = state; - } - void SetManipulationState(int extruders_cnt) { - m_state = extruders_cnt ==1 ? msSingleExtruder : msMultiExtruder; - } - ManipulationState GetManipulationState() const { return m_state; } + void SetManipulationMode(ManipulationMode mode) { m_mode = mode; } + ManipulationMode GetManipulationMode() const { return m_mode; } bool is_horizontal() const { return m_style == wxSL_HORIZONTAL; } bool is_one_layer() const { return m_is_one_layer; } @@ -860,6 +855,17 @@ public: void change_extruder(int extruder); void edit_extruder_sequence(); + struct TICK_CODE + { + bool operator<(const TICK_CODE& other) const { return other.tick > this->tick; } + bool operator>(const TICK_CODE& other) const { return other.tick < this->tick; } + + int tick = 0; + std::string gcode = Slic3r::ColorChangeCode; + int extruder = 0; + std::string color; + }; + protected: void render(); @@ -881,7 +887,6 @@ protected: void detect_selected_slider(const wxPoint& pt); void correct_lower_value(); void correct_higher_value(); - wxString get_tooltip(IconFocus icon_focus); void move_current_thumb(const bool condition); void action_tick(const TicksAction action); void enter_window(wxMouseEvent& event, const bool enter); @@ -897,6 +902,10 @@ protected: wxSize get_size(); void get_size(int *w, int *h); double get_double_value(const SelectedSlider& selection); + wxString get_tooltip(IconFocus icon_focus); + bool get_color_for_tick( wxColour& color, + std::set::const_iterator tick_it, + const std::vector& colors) const; private: bool is_osx { false }; @@ -929,7 +938,7 @@ private: bool m_show_edit_menu = false; bool m_edit_extruder_sequence = false; bool m_suppress_add_code = false; - ManipulationState m_state = msSingleExtruder; + ManipulationMode m_mode = mmSingleExtruder; std::string m_custom_gcode = ""; std::string m_pause_print_msg; @@ -960,21 +969,8 @@ private: std::vector m_line_pens; std::vector m_segm_pens; - std::set m_ticks; std::vector m_values; - - struct TICK_CODE - { - bool operator<(const TICK_CODE& other) const { return other.tick > this->tick; } - bool operator>(const TICK_CODE& other) const { return other.tick < this->tick; } - - int tick = 0; - std::string gcode = Slic3r::ColorChangeCode; - int extruder = 0; - std::string color; - }; - - std::set m_ticks_; + std::set m_ticks; public: struct ExtrudersSequence -- cgit v1.2.3