Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::DoubleSlider::Control Class Reference

#include <src/slic3r/GUI/DoubleSlider.hpp>

+ Inheritance diagram for Slic3r::DoubleSlider::Control:
+ Collaboration diagram for Slic3r::DoubleSlider::Control:

Classes

class  Ruler
 

Public Member Functions

 Control (wxWindow *parent, wxWindowID id, int lowerValue, int higherValue, int minValue, int maxValue, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSL_VERTICAL, const wxValidator &val=wxDefaultValidator, const wxString &name=wxEmptyString)
 
 ~Control ()
 
void msw_rescale ()
 
void sys_color_changed ()
 
int GetMinValue () const
 
int GetMaxValue () const
 
double GetMinValueD ()
 
double GetMaxValueD ()
 
int GetLowerValue () const
 
int GetHigherValue () const
 
int GetActiveValue () const
 
double GetLowerValueD ()
 
double GetHigherValueD ()
 
wxSize DoGetBestSize () const override
 
wxSize get_min_size () const
 
void SetLowerValue (const int lower_val)
 
void SetHigherValue (const int higher_val)
 
void SetSelectionSpan (const int lower_val, const int higher_val)
 
void SetMaxValue (const int max_value)
 
void SetKoefForLabels (const double koef)
 
void SetSliderValues (const std::vector< double > &values)
 
void ChangeOneLayerLock ()
 
void SetSliderAlternateValues (const std::vector< double > &values)
 
Info GetTicksValues () const
 
void SetTicksValues (const Info &custom_gcode_per_print_z)
 
void SetLayersTimes (const std::vector< float > &layers_times, float total_time)
 
void SetLayersTimes (const std::vector< double > &layers_times)
 
void SetDrawMode (bool is_sla_print, bool is_sequential_print)
 
void SetDrawMode (DrawMode mode)
 
void SetManipulationMode (Mode mode)
 
Mode GetManipulationMode () const
 
void SetModeAndOnlyExtruder (const bool is_one_extruder_printed_model, const int only_extruder)
 
void SetExtruderColors (const std::vector< std::string > &extruder_colors)
 
bool IsNewPrint ()
 
void set_render_as_disabled (bool value)
 
bool is_rendering_as_disabled () const
 
bool is_horizontal () const
 
bool is_one_layer () const
 
bool is_lower_at_min () const
 
bool is_higher_at_max () const
 
bool is_full_span () const
 
void OnPaint (wxPaintEvent &)
 
void OnLeftDown (wxMouseEvent &event)
 
void OnMotion (wxMouseEvent &event)
 
void OnLeftUp (wxMouseEvent &event)
 
void OnEnterWin (wxMouseEvent &event)
 
void OnLeaveWin (wxMouseEvent &event)
 
void UseDefaultColors (bool def_colors_on)
 
void OnWheel (wxMouseEvent &event)
 
void OnKeyDown (wxKeyEvent &event)
 
void OnKeyUp (wxKeyEvent &event)
 
void OnChar (wxKeyEvent &event)
 
void OnRightDown (wxMouseEvent &event)
 
void OnRightUp (wxMouseEvent &event)
 
void add_code_as_tick (Type type, int selected_extruder=-1)
 
void add_current_tick (bool call_from_keyboard=false)
 
void delete_current_tick ()
 
void edit_tick (int tick=-1)
 
void switch_one_layer_mode ()
 
void discard_all_thicks ()
 
void move_current_thumb_to_pos (wxPoint pos)
 
void edit_extruder_sequence ()
 
void jump_to_value ()
 
void enable_action_icon (bool enable)
 
void show_add_context_menu ()
 
void show_edit_context_menu ()
 
void show_cog_icon_context_menu ()
 
void auto_color_change ()
 

Public Attributes

ExtrudersSequence m_extruders_sequence
 

Protected Member Functions

void render ()
 
void draw_focus_rect (wxDC &dc)
 
void draw_action_icon (wxDC &dc, const wxPoint pt_beg, const wxPoint pt_end)
 
void draw_scroll_line (wxDC &dc, const int lower_pos, const int higher_pos)
 
void draw_thumb (wxDC &dc, const wxCoord &pos_coord, const SelectedSlider &selection)
 
void draw_thumbs (wxDC &dc, const wxCoord &lower_pos, const wxCoord &higher_pos)
 
void draw_ticks_pair (wxDC &dc, wxCoord pos, wxCoord mid, int tick_len)
 
void draw_ticks (wxDC &dc)
 
void draw_colored_band (wxDC &dc)
 
void draw_ruler (wxDC &dc)
 
void draw_one_layer_icon (wxDC &dc)
 
void draw_revert_icon (wxDC &dc)
 
void draw_cog_icon (wxDC &dc)
 
void draw_thumb_item (wxDC &dc, const wxPoint &pos, const SelectedSlider &selection)
 
void draw_info_line_with_icon (wxDC &dc, const wxPoint &pos, SelectedSlider selection)
 
void draw_tick_on_mouse_position (wxDC &dc)
 
void draw_tick_text (wxDC &dc, const wxPoint &pos, int tick, LabelType label_type=ltHeight, bool right_side=true) const
 
void draw_thumb_text (wxDC &dc, const wxPoint &pos, const SelectedSlider &selection) const
 
void update_thumb_rect (const wxCoord begin_x, const wxCoord begin_y, const SelectedSlider &selection)
 
bool is_lower_thumb_editable ()
 
bool detect_selected_slider (const wxPoint &pt)
 
void correct_lower_value ()
 
void correct_higher_value ()
 
void move_current_thumb (const bool condition)
 
void enter_window (wxMouseEvent &event, const bool enter)
 
bool is_wipe_tower_layer (int tick) const
 

Private Member Functions

bool is_point_in_rect (const wxPoint &pt, const wxRect &rect)
 
int get_tick_near_point (const wxPoint &pt)
 
double get_scroll_step ()
 
wxString get_label (int tick, LabelType label_type=ltHeightWithLayer) const
 
void get_lower_and_higher_position (int &lower_pos, int &higher_pos)
 
int get_value_from_position (const wxCoord x, const wxCoord y)
 
int get_value_from_position (const wxPoint pos)
 
wxCoord get_position_from_value (const int value)
 
wxSize get_size () const
 
void get_size (int *w, int *h) const
 
double get_double_value (const SelectedSlider &selection)
 
int get_tick_from_value (double value, bool force_lower_bound=false)
 
wxString get_tooltip (int tick=-1)
 
int get_edited_tick_for_position (wxPoint pos, Type type=ColorChange)
 
std::string get_color_for_tool_change_tick (std::set< TickCode >::const_iterator it) const
 
std::string get_color_for_color_change_tick (std::set< TickCode >::const_iterator it) const
 
wxRect get_colored_band_rect ()
 
std::array< int, 2 > get_active_extruders_for_tick (int tick) const
 
void post_ticks_changed_event (Type type=Custom)
 
bool check_ticks_changed_event (Type type)
 
void append_change_extruder_menu_item (wxMenu *, bool switch_current_code=false)
 
void append_add_color_change_menu_item (wxMenu *, bool switch_current_code=false)
 

Private Attributes

bool is_osx { false }
 
wxFont m_font
 
int m_min_value
 
int m_max_value
 
int m_lower_value
 
int m_higher_value
 
bool m_render_as_disabled { false }
 
ScalableBitmap m_bmp_thumb_higher
 
ScalableBitmap m_bmp_thumb_lower
 
ScalableBitmap m_bmp_add_tick_on
 
ScalableBitmap m_bmp_add_tick_off
 
ScalableBitmap m_bmp_del_tick_on
 
ScalableBitmap m_bmp_del_tick_off
 
ScalableBitmap m_bmp_one_layer_lock_on
 
ScalableBitmap m_bmp_one_layer_lock_off
 
ScalableBitmap m_bmp_one_layer_unlock_on
 
ScalableBitmap m_bmp_one_layer_unlock_off
 
ScalableBitmap m_bmp_revert
 
ScalableBitmap m_bmp_cog
 
SelectedSlider m_selection
 
bool m_is_left_down = false
 
bool m_is_right_down = false
 
bool m_is_one_layer = false
 
bool m_is_focused = false
 
bool m_force_mode_apply = true
 
bool m_enable_action_icon = true
 
bool m_is_wipe_tower = false
 
DrawMode m_draw_mode = dmRegular
 
Mode m_mode = SingleExtruder
 
int m_only_extruder = -1
 
MouseAction m_mouse = maNone
 
FocusedItem m_focus = fiNone
 
wxPoint m_moving_pos = wxDefaultPosition
 
wxRect m_rect_lower_thumb
 
wxRect m_rect_higher_thumb
 
wxRect m_rect_tick_action
 
wxRect m_rect_one_layer_icon
 
wxRect m_rect_revert_icon
 
wxRect m_rect_cog_icon
 
wxSize m_thumb_size
 
int m_tick_icon_dim
 
int m_lock_icon_dim
 
int m_revert_icon_dim
 
int m_cog_icon_dim
 
long m_style
 
long m_extra_style
 
float m_label_koef { 1.0 }
 
std::vector< double > m_values
 
TickCodeInfo m_ticks
 
std::vector< double > m_layers_times
 
std::vector< double > m_layers_values
 
std::vector< std::string > m_extruder_colors
 
std::string m_print_obj_idxs
 
std::vector< double > m_alternate_values
 
wxCoord SLIDER_MARGIN
 
wxPen DARK_ORANGE_PEN
 
wxPen ORANGE_PEN
 
wxPen LIGHT_ORANGE_PEN
 
wxPen DARK_GREY_PEN
 
wxPen GREY_PEN
 
wxPen LIGHT_GREY_PEN
 
wxPen FOCUS_RECT_PEN
 
wxBrush FOCUS_RECT_BRUSH
 
std::vector< wxPen * > m_line_pens
 
std::vector< wxPen * > m_segm_pens
 
class Slic3r::DoubleSlider::Control::Ruler m_ruler
 

Detailed Description

Constructor & Destructor Documentation

◆ Control()

Slic3r::DoubleSlider::Control::Control ( wxWindow *  parent,
wxWindowID  id,
int  lowerValue,
int  higherValue,
int  minValue,
int  maxValue,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxSL_VERTICAL,
const wxValidator &  val = wxDefaultValidator,
const wxString &  name = wxEmptyString 
)
72 :
73 wxControl(parent, id, pos, size, wxWANTS_CHARS | wxBORDER_NONE),
74 m_lower_value(lowerValue),
75 m_higher_value (higherValue),
76 m_min_value(minValue),
77 m_max_value(maxValue),
78 m_style(style == wxSL_HORIZONTAL || style == wxSL_VERTICAL ? style: wxSL_HORIZONTAL),
79 m_extra_style(style == wxSL_VERTICAL ? wxSL_AUTOTICKS | wxSL_VALUE_LABEL : 0)
80{
81#ifdef __WXOSX__
82 is_osx = true;
83#endif //__WXOSX__
84 if (!is_osx)
85 SetDoubleBuffered(true);// SetDoubleBuffered exists on Win and Linux/GTK, but is missing on OSX
86
87 m_bmp_thumb_higher = (style == wxSL_HORIZONTAL ? ScalableBitmap(this, "thumb_right") : ScalableBitmap(this, "thumb_up"));
88 m_bmp_thumb_lower = (style == wxSL_HORIZONTAL ? ScalableBitmap(this, "thumb_left") : ScalableBitmap(this, "thumb_down"));
90
91 m_bmp_add_tick_on = ScalableBitmap(this, "colorchange_add");
92 m_bmp_add_tick_off = ScalableBitmap(this, "colorchange_add_f");
93 m_bmp_del_tick_on = ScalableBitmap(this, "colorchange_del");
94 m_bmp_del_tick_off = ScalableBitmap(this, "colorchange_del_f");
96
97 m_bmp_one_layer_lock_on = ScalableBitmap(this, "lock_closed");
98 m_bmp_one_layer_lock_off = ScalableBitmap(this, "lock_closed_f");
99 m_bmp_one_layer_unlock_on = ScalableBitmap(this, "lock_open");
100 m_bmp_one_layer_unlock_off = ScalableBitmap(this, "lock_open_f");
102
103 m_bmp_revert = ScalableBitmap(this, "undo");
105 m_bmp_cog = ScalableBitmap(this, "cog");
107
109 m_ticks.set_pause_print_msg(_u8L("Place bearings in slots and resume printing"));
111
112 // slider events
113 this->Bind(wxEVT_PAINT, &Control::OnPaint, this);
114 this->Bind(wxEVT_CHAR, &Control::OnChar, this);
115 this->Bind(wxEVT_LEFT_DOWN, &Control::OnLeftDown, this);
116 this->Bind(wxEVT_MOTION, &Control::OnMotion, this);
117 this->Bind(wxEVT_LEFT_UP, &Control::OnLeftUp, this);
118 this->Bind(wxEVT_MOUSEWHEEL, &Control::OnWheel, this);
119 this->Bind(wxEVT_ENTER_WINDOW,&Control::OnEnterWin, this);
120 this->Bind(wxEVT_LEAVE_WINDOW,&Control::OnLeaveWin, this);
121 this->Bind(wxEVT_KEY_DOWN, &Control::OnKeyDown, this);
122 this->Bind(wxEVT_KEY_UP, &Control::OnKeyUp, this);
123 this->Bind(wxEVT_RIGHT_DOWN, &Control::OnRightDown,this);
124 this->Bind(wxEVT_RIGHT_UP, &Control::OnRightUp, this);
125 this->Bind(wxEVT_SIZE, [this](wxSizeEvent& event) {
127 event.Skip();
128 });
129
130 // control's view variables
131 SLIDER_MARGIN = 4 + GUI::wxGetApp().em_unit();
132
133 DARK_ORANGE_PEN = wxPen(wxColour(237, 107, 33));
134 ORANGE_PEN = wxPen(wxColour(253, 126, 66));
135 LIGHT_ORANGE_PEN = wxPen(wxColour(254, 177, 139));
136
137 DARK_GREY_PEN = wxPen(wxColour(128, 128, 128));
138 GREY_PEN = wxPen(wxColour(164, 164, 164));
139 LIGHT_GREY_PEN = wxPen(wxColour(204, 204, 204));
140
143
144 FOCUS_RECT_PEN = wxPen(wxColour(128, 128, 10), 1, wxPENSTYLE_DOT);
145 FOCUS_RECT_BRUSH = wxBrush(wxColour(0, 0, 0), wxBRUSHSTYLE_TRANSPARENT);
146
147 m_font = GetFont();
148 this->SetMinSize(get_min_size());
149
150 if (style == wxSL_VERTICAL)
151 m_ruler.set_parent(this->GetParent());
152}
#define _u8L(s)
macro used to mark string used at localization, return same string
Definition SLAPrint.cpp:29
#define style
Definition WipeTowerDialog.cpp:68
Definition wxExtensions.hpp:136
int GetWidth() const
Definition wxExtensions.hpp:161
wxSize GetSize() const
Definition wxExtensions.hpp:154
void update(const std::vector< double > &values, double scroll_step)
Definition DoubleSlider.cpp:1069
void set_parent(wxWindow *parent)
Definition DoubleSlider.cpp:1057
ScalableBitmap m_bmp_one_layer_lock_on
Definition DoubleSlider.hpp:382
long m_style
Definition DoubleSlider.hpp:417
void OnMotion(wxMouseEvent &event)
Definition DoubleSlider.cpp:1591
int m_higher_value
Definition DoubleSlider.hpp:372
wxPen LIGHT_GREY_PEN
Definition DoubleSlider.hpp:439
SelectedSlider m_selection
Definition DoubleSlider.hpp:388
long m_extra_style
Definition DoubleSlider.hpp:418
ScalableBitmap m_bmp_one_layer_unlock_off
Definition DoubleSlider.hpp:385
wxPen DARK_GREY_PEN
Definition DoubleSlider.hpp:437
std::vector< std::string > m_extruder_colors
Definition DoubleSlider.hpp:425
void OnPaint(wxPaintEvent &)
Definition DoubleSlider.hpp:270
ScalableBitmap m_bmp_del_tick_off
Definition DoubleSlider.hpp:381
ScalableBitmap m_bmp_add_tick_off
Definition DoubleSlider.hpp:379
void OnEnterWin(wxMouseEvent &event)
Definition DoubleSlider.hpp:274
ScalableBitmap m_bmp_add_tick_on
Definition DoubleSlider.hpp:378
void OnKeyDown(wxKeyEvent &event)
Definition DoubleSlider.cpp:1825
void OnWheel(wxMouseEvent &event)
Definition DoubleSlider.cpp:1803
ScalableBitmap m_bmp_thumb_lower
Definition DoubleSlider.hpp:377
wxPen ORANGE_PEN
Definition DoubleSlider.hpp:434
void OnChar(wxKeyEvent &event)
Definition DoubleSlider.cpp:1892
int m_min_value
Definition DoubleSlider.hpp:369
int m_revert_icon_dim
Definition DoubleSlider.hpp:415
class Slic3r::DoubleSlider::Control::Ruler m_ruler
std::vector< wxPen * > m_segm_pens
Definition DoubleSlider.hpp:445
void OnLeftDown(wxMouseEvent &event)
Definition DoubleSlider.cpp:1391
double get_scroll_step()
Definition DoubleSlider.cpp:298
std::vector< double > m_values
Definition DoubleSlider.hpp:421
wxPen FOCUS_RECT_PEN
Definition DoubleSlider.hpp:441
wxFont m_font
Definition DoubleSlider.hpp:368
wxPen GREY_PEN
Definition DoubleSlider.hpp:438
std::vector< wxPen * > m_line_pens
Definition DoubleSlider.hpp:444
wxSize m_thumb_size
Definition DoubleSlider.hpp:412
wxSize get_min_size() const
Definition DoubleSlider.cpp:198
TickCodeInfo m_ticks
Definition DoubleSlider.hpp:422
int m_max_value
Definition DoubleSlider.hpp:370
ScalableBitmap m_bmp_thumb_higher
Definition DoubleSlider.hpp:376
void OnKeyUp(wxKeyEvent &event)
Definition DoubleSlider.cpp:1880
int m_tick_icon_dim
Definition DoubleSlider.hpp:413
int m_lower_value
Definition DoubleSlider.hpp:371
ScalableBitmap m_bmp_cog
Definition DoubleSlider.hpp:387
ScalableBitmap m_bmp_one_layer_lock_off
Definition DoubleSlider.hpp:383
wxCoord SLIDER_MARGIN
Definition DoubleSlider.hpp:431
wxPen DARK_ORANGE_PEN
Definition DoubleSlider.hpp:433
ScalableBitmap m_bmp_one_layer_unlock_on
Definition DoubleSlider.hpp:384
int m_cog_icon_dim
Definition DoubleSlider.hpp:416
std::vector< double > m_layers_values
Definition DoubleSlider.hpp:424
void OnRightUp(wxMouseEvent &event)
Definition DoubleSlider.cpp:2203
bool is_osx
Definition DoubleSlider.hpp:367
int m_lock_icon_dim
Definition DoubleSlider.hpp:414
void OnLeaveWin(wxMouseEvent &event)
Definition DoubleSlider.hpp:275
void OnRightDown(wxMouseEvent &event)
Definition DoubleSlider.cpp:1909
wxPen LIGHT_ORANGE_PEN
Definition DoubleSlider.hpp:435
void OnLeftUp(wxMouseEvent &event)
Definition DoubleSlider.cpp:1718
ScalableBitmap m_bmp_revert
Definition DoubleSlider.hpp:386
wxBrush FOCUS_RECT_BRUSH
Definition DoubleSlider.hpp:442
ScalableBitmap m_bmp_del_tick_on
Definition DoubleSlider.hpp:380
void set_extruder_colors(std::vector< std::string > *extruder_colors)
Definition DoubleSlider.hpp:151
void set_pause_print_msg(const std::string &message)
Definition DoubleSlider.hpp:129
IMGUI_API ImFont * GetFont()
Definition imgui.cpp:6932
@ ssUndef
Definition DoubleSlider.hpp:43

References _u8L, DARK_GREY_PEN, DARK_ORANGE_PEN, FOCUS_RECT_BRUSH, FOCUS_RECT_PEN, get_min_size(), get_scroll_step(), ScalableBitmap::GetSize(), ScalableBitmap::GetWidth(), GREY_PEN, is_osx, LIGHT_GREY_PEN, LIGHT_ORANGE_PEN, m_bmp_add_tick_off, m_bmp_add_tick_on, m_bmp_cog, m_bmp_del_tick_off, m_bmp_del_tick_on, m_bmp_one_layer_lock_off, m_bmp_one_layer_lock_on, m_bmp_one_layer_unlock_off, m_bmp_one_layer_unlock_on, m_bmp_revert, m_bmp_thumb_higher, m_bmp_thumb_lower, m_cog_icon_dim, m_extruder_colors, m_font, m_layers_values, m_line_pens, m_lock_icon_dim, m_revert_icon_dim, m_ruler, m_segm_pens, m_selection, m_thumb_size, m_tick_icon_dim, m_ticks, m_values, OnChar(), OnEnterWin(), OnKeyDown(), OnKeyUp(), OnLeaveWin(), OnLeftDown(), OnLeftUp(), OnMotion(), OnPaint(), OnRightDown(), OnRightUp(), OnWheel(), ORANGE_PEN, Slic3r::DoubleSlider::TickCodeInfo::set_extruder_colors(), Slic3r::DoubleSlider::Control::Ruler::set_parent(), Slic3r::DoubleSlider::TickCodeInfo::set_pause_print_msg(), SLIDER_MARGIN, Slic3r::DoubleSlider::ssUndef, style, and Slic3r::DoubleSlider::Control::Ruler::update().

+ Here is the call graph for this function:

◆ ~Control()

Slic3r::DoubleSlider::Control::~Control ( )
inline
218{}

Member Function Documentation

◆ add_code_as_tick()

void Slic3r::DoubleSlider::Control::add_code_as_tick ( Type  type,
int  selected_extruder = -1 
)
2339{
2340 if (m_selection == ssUndef)
2341 return;
2342 const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
2343
2344 if ( !check_ticks_changed_event(type) )
2345 return;
2346
2347 if (type == ColorChange && gcode(ColorChange).empty())
2348 GUI::wxGetApp().plater()->get_notification_manager()->push_notification(GUI::NotificationType::EmptyColorChangeCode);
2349
2350 const int extruder = selected_extruder > 0 ? selected_extruder : std::max<int>(1, m_only_extruder);
2351 const auto it = m_ticks.ticks.find(TickCode{ tick });
2352
2353 if ( it == m_ticks.ticks.end() ) {
2354 // try to add tick
2355 if (!m_ticks.add_tick(tick, type, extruder, m_values[tick]))
2356 return;
2357 }
2358 else if (type == ToolChange || type == ColorChange) {
2359 // try to switch tick code to ToolChange or ColorChange accordingly
2360 if (!m_ticks.switch_code_for_tick(it, type, extruder))
2361 return;
2362 }
2363 else
2364 return;
2365
2367}
int m_only_extruder
Definition DoubleSlider.hpp:400
bool check_ticks_changed_event(Type type)
Definition DoubleSlider.cpp:2569
void post_ticks_changed_event(Type type=Custom)
Definition DoubleSlider.cpp:2562
bool add_tick(const int tick, Type type, int extruder, double print_z)
Definition DoubleSlider.cpp:2728
std::set< TickCode > ticks
Definition DoubleSlider.hpp:125
bool switch_code_for_tick(std::set< TickCode >::iterator it, Type type_to, const int extruder)
Definition DoubleSlider.cpp:2809
@ ToolChange
Definition CustomGCode.hpp:17
@ ColorChange
Definition CustomGCode.hpp:15
static std::string gcode(Type type)
Definition DoubleSlider.cpp:51
@ ssLower
Definition DoubleSlider.hpp:44
bool empty(const BoundingBoxBase< PointType, PointsType > &bb)
Definition BoundingBox.hpp:229

References Slic3r::DoubleSlider::TickCodeInfo::add_tick(), check_ticks_changed_event(), Slic3r::CustomGCode::ColorChange, Slic3r::empty(), Slic3r::GUI::EmptyColorChangeCode, Slic3r::DoubleSlider::gcode(), m_higher_value, m_lower_value, m_only_extruder, m_selection, m_ticks, m_values, post_ticks_changed_event(), Slic3r::DoubleSlider::ssLower, Slic3r::DoubleSlider::ssUndef, Slic3r::DoubleSlider::TickCodeInfo::switch_code_for_tick(), Slic3r::DoubleSlider::TickCodeInfo::ticks, and Slic3r::CustomGCode::ToolChange.

Referenced by add_current_tick(), append_add_color_change_menu_item(), append_change_extruder_menu_item(), and show_add_context_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_current_tick()

void Slic3r::DoubleSlider::Control::add_current_tick ( bool  call_from_keyboard = false)
2370{
2371 if (m_selection == ssUndef)
2372 return;
2373 const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
2374 auto it = m_ticks.ticks.find(TickCode{ tick });
2375
2376 if (it != m_ticks.ticks.end() || // this tick is already exist
2378 return;
2379
2380 if (m_mode == SingleExtruder)
2382 else
2383 {
2384 wxMenu menu;
2385
2386 if (m_mode == MultiAsSingle)
2388 else
2390
2391 wxPoint pos = wxDefaultPosition;
2392 /* Menu position will be calculated from mouse click position, but...
2393 * if function is called from keyboard (pressing "+"), we should to calculate it
2394 * */
2395 if (call_from_keyboard) {
2396 int width, height;
2397 get_size(&width, &height);
2398
2399 const wxCoord coord = 0.75 * (is_horizontal() ? height : width);
2400 this->GetPosition(&width, &height);
2401
2402 pos = is_horizontal() ?
2403 wxPoint(get_position_from_value(tick), height + coord) :
2404 wxPoint(width + coord, get_position_from_value(tick));
2405 }
2406
2407 GUI::wxGetApp().plater()->PopupMenu(&menu, pos);
2408 }
2409}
wxCoord get_position_from_value(const int value)
Definition DoubleSlider.cpp:306
Mode m_mode
Definition DoubleSlider.hpp:399
void add_code_as_tick(Type type, int selected_extruder=-1)
Definition DoubleSlider.cpp:2338
wxSize get_size() const
Definition DoubleSlider.cpp:313
void append_add_color_change_menu_item(wxMenu *, bool switch_current_code=false)
Definition DoubleSlider.cpp:1690
void append_change_extruder_menu_item(wxMenu *, bool switch_current_code=false)
Definition DoubleSlider.cpp:1659
bool is_horizontal() const
Definition DoubleSlider.hpp:264
@ MultiAsSingle
Definition CustomGCode.hpp:51
@ SingleExtruder
Definition CustomGCode.hpp:50
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:539
coord_t height(const BoundingBox &box)
Definition Arrange.cpp:540
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:14

References add_code_as_tick(), append_add_color_change_menu_item(), append_change_extruder_menu_item(), check_ticks_changed_event(), Slic3r::CustomGCode::ColorChange, get_position_from_value(), get_size(), is_horizontal(), m_higher_value, m_lower_value, m_mode, m_selection, m_ticks, Slic3r::CustomGCode::MultiAsSingle, Slic3r::CustomGCode::SingleExtruder, Slic3r::DoubleSlider::ssLower, Slic3r::DoubleSlider::ssUndef, Slic3r::DoubleSlider::TickCodeInfo::ticks, and Slic3r::CustomGCode::ToolChange.

Referenced by OnChar(), OnKeyDown(), and OnLeftUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ append_add_color_change_menu_item()

void Slic3r::DoubleSlider::Control::append_add_color_change_menu_item ( wxMenu *  menu,
bool  switch_current_code = false 
)
private
1691{
1692 const int extruders_cnt = GUI::wxGetApp().extruders_edited_cnt();
1693 if (extruders_cnt > 1) {
1695 std::set<int> used_extruders_for_tick = m_ticks.get_used_extruders_for_tick(tick, m_only_extruder, m_values[tick]);
1696
1697 wxMenu* add_color_change_menu = new wxMenu();
1698
1699 for (int i = 1; i <= extruders_cnt; i++) {
1700 const bool is_used_extruder = used_extruders_for_tick.empty() ? true : // #ys_FIXME till used_extruders_for_tick doesn't filled correct for mmMultiExtruder
1701 used_extruders_for_tick.find(i) != used_extruders_for_tick.end();
1702 const wxString item_name = wxString::Format(_L("Extruder %d"), i) +
1703 (is_used_extruder ? " (" + _L("used") + ")" : "");
1704
1705 append_menu_item(add_color_change_menu, wxID_ANY, item_name, "",
1706 [this, i](wxCommandEvent&) { add_code_as_tick(ColorChange, i); }, "", menu,
1707 []() { return true; }, GUI::wxGetApp().plater());
1708 }
1709
1710 const wxString menu_name = switch_current_code ?
1711 format_wxstr(_L("Switch code to Color change (%1%) for:"), gcode(ColorChange)) :
1712 format_wxstr(_L("Add color change (%1%) for:"), gcode(ColorChange));
1713 wxMenuItem* add_color_change_menu_item = menu->AppendSubMenu(add_color_change_menu, menu_name, "");
1714 add_color_change_menu_item->SetBitmap(*get_bmp_bundle("colorchange_add_m"));
1715 }
1716}
std::set< int > get_used_extruders_for_tick(int tick, int only_extruder, double print_z, Mode force_mode=Undef) const
Definition DoubleSlider.cpp:1974
wxString format_wxstr(const char *fmt, TArgs &&... args)
Definition format.hpp:42
#define _L(s)
Definition I18N.hpp:3
wxMenuItem * append_menu_item(wxMenu *menu, int id, const wxString &string, const wxString &description, std::function< void(wxCommandEvent &event)> cb, wxBitmapBundle *icon, wxEvtHandler *event_handler, std::function< bool()> const cb_condition, wxWindow *parent, int insert_pos)
Definition wxExtensions.cpp:55
wxBitmapBundle * get_bmp_bundle(const std::string &bmp_name_in, int px_cnt, const std::string &new_color)
Definition wxExtensions.cpp:420

References _L, add_code_as_tick(), append_menu_item(), Slic3r::CustomGCode::ColorChange, Slic3r::DoubleSlider::gcode(), get_bmp_bundle(), Slic3r::DoubleSlider::TickCodeInfo::get_used_extruders_for_tick(), m_higher_value, m_lower_value, m_only_extruder, m_selection, m_ticks, m_values, and Slic3r::DoubleSlider::ssLower.

Referenced by add_current_tick(), show_add_context_menu(), and show_edit_context_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ append_change_extruder_menu_item()

void Slic3r::DoubleSlider::Control::append_change_extruder_menu_item ( wxMenu *  menu,
bool  switch_current_code = false 
)
private
1660{
1661 const int extruders_cnt = GUI::wxGetApp().extruders_edited_cnt();
1662 if (extruders_cnt > 1) {
1663 std::array<int, 2> active_extruders = get_active_extruders_for_tick(m_selection == ssLower ? m_lower_value : m_higher_value);
1664
1665 std::vector<wxBitmapBundle*> icons = get_extruder_color_icons(true);
1666
1667 wxMenu* change_extruder_menu = new wxMenu();
1668
1669 for (int i = 1; i <= extruders_cnt; i++) {
1670 const bool is_active_extruder = i == active_extruders[0] || i == active_extruders[1];
1671 const wxString item_name = wxString::Format(_L("Extruder %d"), i) +
1672 (is_active_extruder ? " (" + _L("active") + ")" : "");
1673
1674 if (m_mode == MultiAsSingle)
1675 append_menu_item(change_extruder_menu, wxID_ANY, item_name, "",
1676 [this, i](wxCommandEvent&) { add_code_as_tick(ToolChange, i); }, icons[i-1], menu,
1677 [is_active_extruder]() { return !is_active_extruder; }, GUI::wxGetApp().plater());
1678 }
1679
1680 const wxString change_extruder_menu_name = m_mode == MultiAsSingle ?
1681 (switch_current_code ? _L("Switch code to Change extruder") : _L("Change extruder") ) :
1682 _L("Change extruder (N/A)");
1683
1684 append_submenu(menu, change_extruder_menu, wxID_ANY, change_extruder_menu_name, _L("Use another extruder"),
1685 active_extruders[1] > 0 ? "edit_uni" : "change_extruder",
1686 [this]() {return m_mode == MultiAsSingle && !GUI::wxGetApp().obj_list()->has_paint_on_segmentation(); }, GUI::wxGetApp().plater());
1687 }
1688}
std::array< int, 2 > get_active_extruders_for_tick(int tick) const
Definition DoubleSlider.cpp:1949
wxMenuItem * append_submenu(wxMenu *menu, wxMenu *sub_menu, int id, const wxString &string, const wxString &description, const std::string &icon, std::function< bool()> const cb_condition, wxWindow *parent)
Definition wxExtensions.cpp:103
std::vector< wxBitmapBundle * > get_extruder_color_icons(bool thin_icon)
Definition wxExtensions.cpp:462

References _L, add_code_as_tick(), append_menu_item(), append_submenu(), get_active_extruders_for_tick(), get_extruder_color_icons(), m_higher_value, m_lower_value, m_mode, m_selection, Slic3r::CustomGCode::MultiAsSingle, Slic3r::DoubleSlider::ssLower, and Slic3r::CustomGCode::ToolChange.

Referenced by add_current_tick(), show_add_context_menu(), and show_edit_context_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ auto_color_change()

void Slic3r::DoubleSlider::Control::auto_color_change ( )
2153{
2154 if (!m_ticks.empty()) {
2155 wxString msg_text = _L("This action will cause deletion of all ticks on vertical slider.") + "\n\n" +
2156 _L("This action is not revertible.\nDo you want to proceed?");
2157 GUI::WarningDialog dialog(m_parent, msg_text, _L("Warning"), wxYES | wxNO);
2158 if (dialog.ShowModal() == wxID_NO)
2159 return;
2160 m_ticks.ticks.clear();
2161 }
2162
2163 int extruders_cnt = GUI::wxGetApp().extruders_edited_cnt();
2164// int extruder = 2;
2165
2166 const Print& print = GUI::wxGetApp().plater()->fff_print();
2167 for (auto object : print.objects()) {
2168 // An object should to have at least 2 layers to apply an auto color change
2169 if (object->layer_count() < 2)
2170 continue;
2171
2172 check_color_change(object, 1, object->layers().size(), false, [this, extruders_cnt](const Layer* layer)
2173 {
2174 int tick = get_tick_from_value(layer->print_z);
2175 if (tick >= 0 && !m_ticks.has_tick(tick)) {
2176 if (m_mode == SingleExtruder) {
2177 m_ticks.set_default_colors(true);
2178 m_ticks.add_tick(tick, ColorChange, 1, layer->print_z);
2179 }
2180 else {
2181 int extruder = 2;
2182 if (!m_ticks.empty()) {
2183 auto it = m_ticks.ticks.end();
2184 it--;
2185 extruder = it->extruder + 1;
2186 if (extruder > extruders_cnt)
2187 extruder = 1;
2188 }
2189 m_ticks.add_tick(tick, ToolChange, extruder, layer->print_z);
2190 }
2191 }
2192 // allow max 3 auto color changes
2193 return m_ticks.ticks.size() > 2;
2194 });
2195 }
2196
2197 if (m_ticks.empty())
2198 GUI::wxGetApp().plater()->get_notification_manager()->push_notification(GUI::NotificationType::EmptyAutoColorChange);
2199
2201}
bool empty() const
Definition DoubleSlider.hpp:128
bool check_color_change(const PrintObject *object, size_t frst_layer_id, size_t layers_cnt, bool check_overhangs, std::function< bool(const Layer *)> break_condition)
Definition DoubleSlider.cpp:2126

References _L, Slic3r::DoubleSlider::check_color_change(), Slic3r::DoubleSlider::TickCodeInfo::empty(), Slic3r::PrintObject::layer_count(), Slic3r::PrintObject::layers(), m_ticks, Slic3r::Print::objects(), and Slic3r::DoubleSlider::TickCodeInfo::ticks.

Referenced by show_cog_icon_context_menu(), and Slic3r::GUI::Preview::update_layers_slider().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ChangeOneLayerLock()

void Slic3r::DoubleSlider::Control::ChangeOneLayerLock ( )
1378{
1382
1383 Refresh();
1384 Update();
1385
1386 wxCommandEvent e(wxEVT_SCROLL_CHANGED);
1387 e.SetEventObject(this);
1388 ProcessWindowEvent(e);
1389}
void correct_higher_value()
Definition DoubleSlider.cpp:1432
bool m_is_one_layer
Definition DoubleSlider.hpp:391
void correct_lower_value()
Definition DoubleSlider.cpp:1421
@ ssHigher
Definition DoubleSlider.hpp:45

References correct_higher_value(), correct_lower_value(), m_is_one_layer, m_selection, Slic3r::DoubleSlider::ssHigher, and Slic3r::DoubleSlider::ssLower.

Referenced by Slic3r::GUI::Preview::update_layers_slider_from_canvas().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_ticks_changed_event()

bool Slic3r::DoubleSlider::Control::check_ticks_changed_event ( Type  type)
private
2570{
2571 if ( m_ticks.mode == m_mode ||
2572 (type != ColorChange && type != ToolChange) ||
2573 (m_ticks.mode == SingleExtruder && m_mode == MultiAsSingle) || // All ColorChanges will be applied for 1st extruder
2574 (m_ticks.mode == MultiExtruder && m_mode == MultiAsSingle) ) // Just mark ColorChanges for all unused extruders
2575 return true;
2576
2579 {
2581 return true;
2582
2583 wxString message = (m_ticks.mode == SingleExtruder ?
2584 _L("The last color change data was saved for a single extruder printing.") :
2585 _L("The last color change data was saved for a multi extruder printing.")
2586 ) + "\n" +
2587 _L("Your current changes will delete all saved color changes.") + "\n\n\t" +
2588 _L("Are you sure you want to continue?");
2589
2590 //wxMessageDialog msg(this, message, _L("Notice"), wxYES_NO);
2591 GUI::MessageDialog msg(this, message, _L("Notice"), wxYES_NO);
2592 if (msg.ShowModal() == wxID_YES) {
2595 }
2596 return false;
2597 }
2598 // m_ticks_mode == MultiAsSingle
2600 wxString message = m_mode == SingleExtruder ? (
2601 _L("The last color change data was saved for a multi extruder printing.") + "\n\n" +
2602 _L("Select YES if you want to delete all saved tool changes, \n"
2603 "NO if you want all tool changes switch to color changes, \n"
2604 "or CANCEL to leave it unchanged.") + "\n\n\t" +
2605 _L("Do you want to delete all saved tool changes?")
2606 ): ( // MultiExtruder
2607 _L("The last color change data was saved for a multi extruder printing with tool changes for whole print.") + "\n\n" +
2608 _L("Your current changes will delete all saved extruder (tool) changes.") + "\n\n\t" +
2609 _L("Are you sure you want to continue?") ) ;
2610
2611 //wxMessageDialog msg(this, message, _L("Notice"), wxYES_NO | (m_mode == SingleExtruder ? wxCANCEL : 0));
2612 GUI::MessageDialog msg(this, message, _L("Notice"), wxYES_NO | (m_mode == SingleExtruder ? wxCANCEL : 0));
2613 const int answer = msg.ShowModal();
2614 if (answer == wxID_YES) {
2617 }
2618 else if (m_mode == SingleExtruder && answer == wxID_NO) {
2621 }
2622 return false;
2623 }
2624
2625 return true;
2626}
bool has_tick_with_code(Type type)
Definition DoubleSlider.cpp:2836
void switch_code(Type type_from, Type type_to)
Definition DoubleSlider.cpp:2795
void erase_all_ticks_with_code(Type type)
Definition DoubleSlider.cpp:2826
Mode mode
Definition DoubleSlider.hpp:126
@ MultiExtruder
Definition CustomGCode.hpp:54

References _L, Slic3r::CustomGCode::ColorChange, Slic3r::DoubleSlider::TickCodeInfo::erase_all_ticks_with_code(), Slic3r::DoubleSlider::TickCodeInfo::has_tick_with_code(), m_mode, m_ticks, Slic3r::DoubleSlider::TickCodeInfo::mode, Slic3r::CustomGCode::MultiAsSingle, Slic3r::CustomGCode::MultiExtruder, post_ticks_changed_event(), Slic3r::CustomGCode::SingleExtruder, Slic3r::DoubleSlider::TickCodeInfo::switch_code(), and Slic3r::CustomGCode::ToolChange.

Referenced by add_code_as_tick(), add_current_tick(), delete_current_tick(), edit_extruder_sequence(), and edit_tick().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ correct_higher_value()

void Slic3r::DoubleSlider::Control::correct_higher_value ( )
protected
1433{
1436 else if (m_higher_value < m_min_value)
1438
1439 if ((m_higher_value <= m_lower_value && m_higher_value >= m_min_value) || m_is_one_layer)
1441}

References m_higher_value, m_is_one_layer, m_lower_value, m_max_value, and m_min_value.

Referenced by ChangeOneLayerLock(), discard_all_thicks(), get_double_value(), move_current_thumb(), move_current_thumb_to_pos(), OnMotion(), SetHigherValue(), and switch_one_layer_mode().

+ Here is the caller graph for this function:

◆ correct_lower_value()

void Slic3r::DoubleSlider::Control::correct_lower_value ( )
protected

References m_higher_value, m_is_one_layer, m_lower_value, m_max_value, and m_min_value.

Referenced by ChangeOneLayerLock(), discard_all_thicks(), move_current_thumb(), move_current_thumb_to_pos(), OnMotion(), SetLowerValue(), and switch_one_layer_mode().

+ Here is the caller graph for this function:

◆ delete_current_tick()

void Slic3r::DoubleSlider::Control::delete_current_tick ( )
2412{
2413 if (m_selection == ssUndef)
2414 return;
2415
2416 auto it = m_ticks.ticks.find(TickCode{ m_selection == ssLower ? m_lower_value : m_higher_value });
2417 if (it == m_ticks.ticks.end() ||
2418 !check_ticks_changed_event(it->type))
2419 return;
2420
2421 Type type = it->type;
2422 m_ticks.ticks.erase(it);
2424}
Type
Definition CustomGCode.hpp:14

References check_ticks_changed_event(), m_higher_value, m_lower_value, m_selection, m_ticks, post_ticks_changed_event(), Slic3r::DoubleSlider::ssLower, Slic3r::DoubleSlider::ssUndef, and Slic3r::DoubleSlider::TickCodeInfo::ticks.

Referenced by OnChar(), OnKeyDown(), OnLeftUp(), and show_edit_context_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ detect_selected_slider()

bool Slic3r::DoubleSlider::Control::detect_selected_slider ( const wxPoint &  pt)
protected
1344{
1349 else
1350 return false; // pt doesn't referenced to any thumb
1351 return true;
1352}
bool is_point_in_rect(const wxPoint &pt, const wxRect &rect)
Definition DoubleSlider.cpp:1354
wxRect m_rect_higher_thumb
Definition DoubleSlider.hpp:407
wxRect m_rect_lower_thumb
Definition DoubleSlider.hpp:406
bool is_lower_thumb_editable()
Definition DoubleSlider.cpp:1336

References is_lower_thumb_editable(), is_point_in_rect(), m_rect_higher_thumb, m_rect_lower_thumb, m_selection, Slic3r::DoubleSlider::ssHigher, Slic3r::DoubleSlider::ssLower, and Slic3r::DoubleSlider::ssUndef.

Referenced by OnLeftDown(), and OnRightDown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ discard_all_thicks()

void Slic3r::DoubleSlider::Control::discard_all_thicks ( )
2455{
2458
2461
2462 m_ticks.ticks.clear();
2464
2465}
void SetLowerValue(const int lower_val)
Definition DoubleSlider.cpp:212
void SetHigherValue(const int higher_val)
Definition DoubleSlider.cpp:225

References correct_higher_value(), correct_lower_value(), m_max_value, m_min_value, m_selection, m_ticks, post_ticks_changed_event(), SetHigherValue(), SetLowerValue(), Slic3r::DoubleSlider::ssHigher, Slic3r::DoubleSlider::ssLower, Slic3r::DoubleSlider::ssUndef, and Slic3r::DoubleSlider::TickCodeInfo::ticks.

Referenced by OnLeftUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoGetBestSize()

wxSize Slic3r::DoubleSlider::Control::DoGetBestSize ( ) const
override
205{
206 const wxSize size = wxControl::DoGetBestSize();
207 if (size.x > 1 && size.y > 1)
208 return size;
209 return get_min_size();
210}
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183

References get_min_size().

+ Here is the call graph for this function:

◆ draw_action_icon()

void Slic3r::DoubleSlider::Control::draw_action_icon ( wxDC &  dc,
const wxPoint  pt_beg,
const wxPoint  pt_end 
)
protected
573{
574 const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
575
577 return;
578
579 // suppress add tick on first layer
580 if (tick == 0)
581 return;
582
583 if (is_wipe_tower_layer(tick)) {
584 m_rect_tick_action = wxRect();
585 return;
586 }
587
588 //wxBitmap* icon = m_focus == fiActionIcon ? &m_bmp_add_tick_off.bmp() : &m_bmp_add_tick_on.bmp();
589 //if (m_ticks.ticks.find(TickCode{tick}) != m_ticks.ticks.end())
590 // icon = m_focus == fiActionIcon ? &m_bmp_del_tick_off.bmp() : &m_bmp_del_tick_on.bmp();
592 if (m_ticks.ticks.find(TickCode{tick}) != m_ticks.ticks.end())
594
595 wxCoord x_draw, y_draw;
596 is_horizontal() ? x_draw = pt_beg.x - 0.5*m_tick_icon_dim : y_draw = pt_beg.y - 0.5*m_tick_icon_dim;
597 if (m_selection == ssLower)
598 is_horizontal() ? y_draw = pt_end.y + 3 : x_draw = pt_beg.x - m_tick_icon_dim-2;
599 else
600 is_horizontal() ? y_draw = pt_beg.y - m_tick_icon_dim-2 : x_draw = pt_end.x + 3;
601
603 wxBitmap disabled_add = get_bmp_bundle("colorchange_add")->GetBitmapFor(this).ConvertToDisabled();
604 dc.DrawBitmap(disabled_add, x_draw, y_draw);
605 }
606 else
607 dc.DrawBitmap((*icon).get_bitmap(), x_draw, y_draw);
608
609 //update rect of the tick action icon
610 m_rect_tick_action = wxRect(x_draw, y_draw, m_tick_icon_dim, m_tick_icon_dim);
611}
FocusedItem m_focus
Definition DoubleSlider.hpp:403
wxRect m_rect_tick_action
Definition DoubleSlider.hpp:408
bool is_wipe_tower_layer(int tick) const
Definition DoubleSlider.cpp:559
DrawMode m_draw_mode
Definition DoubleSlider.hpp:397
bool m_enable_action_icon
Definition DoubleSlider.hpp:394
@ fiActionIcon
Definition DoubleSlider.hpp:54
@ dmSequentialFffPrint
Definition DoubleSlider.hpp:88

References Slic3r::DoubleSlider::dmSequentialFffPrint, Slic3r::DoubleSlider::fiActionIcon, get_bmp_bundle(), is_horizontal(), is_wipe_tower_layer(), m_bmp_add_tick_off, m_bmp_add_tick_on, m_bmp_del_tick_off, m_bmp_del_tick_on, m_draw_mode, m_enable_action_icon, m_focus, m_higher_value, m_lower_value, m_rect_tick_action, m_selection, m_tick_icon_dim, m_ticks, Slic3r::DoubleSlider::ssLower, and Slic3r::DoubleSlider::TickCodeInfo::ticks.

Referenced by draw_info_line_with_icon().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_cog_icon()

void Slic3r::DoubleSlider::Control::draw_cog_icon ( wxDC &  dc)
protected
1290{
1292 return;
1293
1294 int width, height;
1295 get_size(&width, &height);
1296
1297 wxCoord x_draw, y_draw;
1299 is_horizontal() ? x_draw = width - 2 : x_draw = 0.5 * width - 0.5 * m_cog_icon_dim;
1300 is_horizontal() ? y_draw = 0.5 * height - 0.5 * m_cog_icon_dim : y_draw = height - 2;
1301 }
1302 else {
1303 is_horizontal() ? x_draw = width - 2 : x_draw = width - m_cog_icon_dim - 2;
1304 is_horizontal() ? y_draw = height - m_cog_icon_dim - 2 : y_draw = height - 2;
1305 }
1306
1307 dc.DrawBitmap(m_bmp_cog.get_bitmap(), x_draw, y_draw);
1308
1309 //update rect of the lock/unlock icon
1310 m_rect_cog_icon = wxRect(x_draw, y_draw, m_cog_icon_dim, m_cog_icon_dim);
1311}
wxBitmap get_bitmap()
Definition wxExtensions.hpp:149
wxRect m_rect_cog_icon
Definition DoubleSlider.hpp:411
@ dmSequentialGCodeView
Definition DoubleSlider.hpp:89

References Slic3r::DoubleSlider::dmSequentialGCodeView, ScalableBitmap::get_bitmap(), get_size(), is_horizontal(), m_bmp_cog, m_cog_icon_dim, m_draw_mode, and m_rect_cog_icon.

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_colored_band()

void Slic3r::DoubleSlider::Control::draw_colored_band ( wxDC &  dc)
protected
995{
996 if (m_draw_mode != dmRegular)
997 return;
998
999 auto draw_band = [](wxDC& dc, const wxColour& clr, const wxRect& band_rc)
1000 {
1001 dc.SetPen(clr);
1002 dc.SetBrush(clr);
1003 dc.DrawRectangle(band_rc);
1004 };
1005
1006 wxRect main_band = get_colored_band_rect();
1007
1008 // don't color a band for MultiExtruder mode
1009 if (m_ticks.empty() || m_mode == MultiExtruder) {
1010 draw_band(dc, GetParent()->GetBackgroundColour(), main_band);
1011 return;
1012 }
1013
1014 const int default_color_idx = m_mode==MultiAsSingle ? std::max<int>(m_only_extruder - 1, 0) : 0;
1015 draw_band(dc, wxColour(m_extruder_colors[default_color_idx]), main_band);
1016
1017 std::set<TickCode>::const_iterator tick_it = m_ticks.ticks.begin();
1018
1019 while (tick_it != m_ticks.ticks.end())
1020 {
1021 if ( (m_mode == SingleExtruder && tick_it->type == ColorChange ) ||
1022 (m_mode == MultiAsSingle && (tick_it->type == ToolChange || tick_it->type == ColorChange)) )
1023 {
1024 const wxCoord pos = get_position_from_value(tick_it->tick);
1025 is_horizontal() ? main_band.SetLeft(SLIDER_MARGIN + pos) :
1026 main_band.SetBottom(pos - 1);
1027
1028 const std::string clr_str = m_mode == SingleExtruder ? tick_it->color :
1029 tick_it->type == ToolChange ?
1032
1033 if (!clr_str.empty())
1034 draw_band(dc, wxColour(clr_str), main_band);
1035 }
1036 ++tick_it;
1037 }
1038}
std::string get_color_for_color_change_tick(std::set< TickCode >::const_iterator it) const
Definition DoubleSlider.cpp:958
wxRect get_colored_band_rect()
Definition DoubleSlider.cpp:980
std::string get_color_for_tool_change_tick(std::set< TickCode >::const_iterator it) const
Definition DoubleSlider.cpp:944
@ dmRegular
Definition DoubleSlider.hpp:86

References Slic3r::CustomGCode::ColorChange, Slic3r::DoubleSlider::dmRegular, Slic3r::DoubleSlider::TickCodeInfo::empty(), get_color_for_color_change_tick(), get_color_for_tool_change_tick(), get_colored_band_rect(), get_position_from_value(), is_horizontal(), m_draw_mode, m_extruder_colors, m_mode, m_only_extruder, m_ticks, Slic3r::CustomGCode::MultiAsSingle, Slic3r::CustomGCode::MultiExtruder, Slic3r::CustomGCode::SingleExtruder, SLIDER_MARGIN, Slic3r::DoubleSlider::TickCodeInfo::ticks, and Slic3r::CustomGCode::ToolChange.

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_focus_rect()

void Slic3r::DoubleSlider::Control::draw_focus_rect ( wxDC &  dc)
protected
499{
500 if (!m_is_focused)
501 return;
502 const wxSize sz = GetSize();
503// wxPaintDC dc(this);
504 //const wxPen pen = wxPen(wxColour(128, 128, 10), 1, wxPENSTYLE_DOT);
505 //dc.SetPen(pen);
506 //dc.SetBrush(wxBrush(wxColour(0, 0, 0), wxBRUSHSTYLE_TRANSPARENT));
507 dc.SetPen(FOCUS_RECT_PEN);
508 dc.SetBrush(FOCUS_RECT_BRUSH);
509 dc.DrawRectangle(1, 1, sz.x - 2, sz.y - 2);
510}
bool m_is_focused
Definition DoubleSlider.hpp:392

References FOCUS_RECT_BRUSH, FOCUS_RECT_PEN, and m_is_focused.

Referenced by render().

+ Here is the caller graph for this function:

◆ draw_info_line_with_icon()

void Slic3r::DoubleSlider::Control::draw_info_line_with_icon ( wxDC &  dc,
const wxPoint &  pos,
SelectedSlider  selection 
)
protected
614{
615 if (m_selection == selection) {
616 //draw info line
617 dc.SetPen(DARK_ORANGE_PEN);
618 const wxPoint pt_beg = is_horizontal() ? wxPoint(pos.x, pos.y - m_thumb_size.y) : wxPoint(pos.x - m_thumb_size.x, pos.y/* - 1*/);
619 const wxPoint pt_end = is_horizontal() ? wxPoint(pos.x, pos.y + m_thumb_size.y) : wxPoint(pos.x + m_thumb_size.x, pos.y/* - 1*/);
620 dc.DrawLine(pt_beg, pt_end);
621
622 //draw action icon
624 draw_action_icon(dc, pt_beg, pt_end);
625 }
626}
void draw_action_icon(wxDC &dc, const wxPoint pt_beg, const wxPoint pt_end)
Definition DoubleSlider.cpp:572
const Scalar & y
Definition MathFunctions.h:552
TCoord< P > x(const P &p)
Definition geometry_traits.hpp:297

References DARK_ORANGE_PEN, Slic3r::DoubleSlider::dmRegular, Slic3r::DoubleSlider::dmSequentialFffPrint, draw_action_icon(), is_horizontal(), m_draw_mode, m_selection, and m_thumb_size.

Referenced by draw_thumb(), and draw_thumbs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_one_layer_icon()

void Slic3r::DoubleSlider::Control::draw_one_layer_icon ( wxDC &  dc)
protected
1247{
1249 return;
1250
1251 //const wxBitmap& icon = m_is_one_layer ?
1252 // m_focus == fiOneLayerIcon ? m_bmp_one_layer_lock_off.bmp() : m_bmp_one_layer_lock_on.bmp() :
1253 // m_focus == fiOneLayerIcon ? m_bmp_one_layer_unlock_off.bmp() : m_bmp_one_layer_unlock_on.bmp();
1254 const ScalableBitmap& icon = m_is_one_layer ?
1257
1258 int width, height;
1259 get_size(&width, &height);
1260
1261 wxCoord x_draw, y_draw;
1262 is_horizontal() ? x_draw = width-2 : x_draw = 0.5*width - 0.5*m_lock_icon_dim;
1263 is_horizontal() ? y_draw = 0.5*height - 0.5*m_lock_icon_dim : y_draw = height-2;
1264
1265 dc.DrawBitmap(icon.bmp().GetBitmapFor(this), x_draw, y_draw);
1266
1267 //update rect of the lock/unlock icon
1268 m_rect_one_layer_icon = wxRect(x_draw, y_draw, m_lock_icon_dim, m_lock_icon_dim);
1269}
const wxBitmapBundle & bmp() const
Definition wxExtensions.hpp:148
wxRect m_rect_one_layer_icon
Definition DoubleSlider.hpp:409
@ fiOneLayerIcon
Definition DoubleSlider.hpp:51

References ScalableBitmap::bmp(), Slic3r::DoubleSlider::dmSequentialGCodeView, Slic3r::DoubleSlider::fiOneLayerIcon, get_size(), is_horizontal(), m_bmp_one_layer_lock_off, m_bmp_one_layer_lock_on, m_bmp_one_layer_unlock_off, m_bmp_one_layer_unlock_on, m_draw_mode, m_focus, m_is_one_layer, m_lock_icon_dim, and m_rect_one_layer_icon.

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_revert_icon()

void Slic3r::DoubleSlider::Control::draw_revert_icon ( wxDC &  dc)
protected
1272{
1273 if (m_ticks.empty() || m_draw_mode != dmRegular)
1274 return;
1275
1276 int width, height;
1277 get_size(&width, &height);
1278
1279 wxCoord x_draw, y_draw;
1280 is_horizontal() ? x_draw = width-2 : x_draw = 0.25*SLIDER_MARGIN;
1281 is_horizontal() ? y_draw = 0.25*SLIDER_MARGIN: y_draw = height-2;
1282
1283 dc.DrawBitmap(m_bmp_revert.get_bitmap(), x_draw, y_draw);
1284
1285 //update rect of the lock/unlock icon
1286 m_rect_revert_icon = wxRect(x_draw, y_draw, m_revert_icon_dim, m_revert_icon_dim);
1287}
wxRect m_rect_revert_icon
Definition DoubleSlider.hpp:410

References Slic3r::DoubleSlider::dmRegular, Slic3r::DoubleSlider::TickCodeInfo::empty(), ScalableBitmap::get_bitmap(), get_size(), is_horizontal(), m_bmp_revert, m_draw_mode, m_rect_revert_icon, m_revert_icon_dim, m_ticks, and SLIDER_MARGIN.

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_ruler()

void Slic3r::DoubleSlider::Control::draw_ruler ( wxDC &  dc)
protected
1125{
1126 if (m_values.empty() || !m_ruler.can_draw())
1127 return;
1128 // When "No sparce layer" is enabled, use m_layers_values for ruler update.
1129 // Because of m_values has duplicate values in this case.
1130// m_ruler.update(this->GetParent(), m_layers_values.empty() ? m_values : m_layers_values, get_scroll_step());
1131
1132 int height, width;
1133 get_size(&width, &height);
1134 const wxCoord mid = is_horizontal() ? 0.5 * height : 0.5 * width;
1135
1136 dc.SetPen(GREY_PEN);
1137 wxColour old_clr = dc.GetTextForeground();
1138 dc.SetTextForeground(GREY_PEN.GetColour());
1139
1140 auto draw_short_ticks = [this, mid](wxDC& dc, double& current_tick, int max_tick) {
1141 if (m_ruler.short_step <= 0.0)
1142 return;
1143 while (current_tick < max_tick) {
1144 wxCoord pos = get_position_from_value(lround(current_tick));
1145 draw_ticks_pair(dc, pos, mid, 2);
1146 current_tick += m_ruler.short_step;
1147 if (current_tick > m_max_value)
1148 break;
1149 }
1150 };
1151
1152 double short_tick = NaNd;
1153 int tick = 0;
1154 double value = 0.0;
1155 size_t sequence = 0;
1156 int prev_y_pos = -1;
1157 wxCoord label_height = dc.GetMultiLineTextExtent("0").y - 2;
1158 int values_size = (int)m_values.size();
1159
1160 if (m_ruler.long_step < 0) {
1161 // sequential print when long_step wasn't detected because of a lot of printed objects
1162 if (m_ruler.max_values.size() > 1) {
1163 while (tick <= m_max_value && sequence < m_ruler.count()) {
1164 // draw just ticks with max value
1165 value = m_ruler.max_values[sequence];
1166 short_tick = tick;
1167
1168 for (; tick < values_size; tick++) {
1169 if (m_values[tick] == value)
1170 break;
1171 if (m_values[tick] > value) {
1172 if (tick > 0)
1173 tick--;
1174 break;
1175 }
1176 }
1177 if (tick > m_max_value)
1178 break;
1179
1180 wxCoord pos = get_position_from_value(tick);
1181 draw_ticks_pair(dc, pos, mid, 5);
1182 if (prev_y_pos < 0 || prev_y_pos - pos >= label_height) {
1183 draw_tick_text(dc, wxPoint(mid, pos), tick);
1184 prev_y_pos = pos;
1185 }
1186 draw_short_ticks(dc, short_tick, tick);
1187
1188 sequence++;
1189 tick++;
1190 }
1191 }
1192 // very short object or some non-trivial ruler with non-regular step (see https://github.com/prusa3d/PrusaSlicer/issues/7263)
1193 else {
1194 if (get_scroll_step() < 1) // step less then 1 px indicates very tall object with non-regular laayer step (probably in vase mode)
1195 return;
1196 for (size_t tick = 1; tick < m_values.size(); tick++) {
1197 wxCoord pos = get_position_from_value(tick);
1198 draw_ticks_pair(dc, pos, mid, 5);
1199 draw_tick_text(dc, wxPoint(mid, pos), tick);
1200 }
1201 }
1202 }
1203 else {
1204 while (tick <= m_max_value) {
1205 value += m_ruler.long_step;
1206
1207 if (sequence < m_ruler.count() && value > m_ruler.max_values[sequence])
1208 value = m_ruler.max_values[sequence];
1209
1210 short_tick = tick;
1211
1212 for (; tick < values_size; tick++) {
1213 if (m_values[tick] == value)
1214 break;
1215 if (m_values[tick] > value) {
1216 if (tick > 0)
1217 tick--;
1218 break;
1219 }
1220 }
1221 if (tick > m_max_value)
1222 break;
1223
1224 wxCoord pos = get_position_from_value(tick);
1225 draw_ticks_pair(dc, pos, mid, 5);
1226 if (prev_y_pos < 0 || prev_y_pos - pos >= label_height) {
1227 draw_tick_text(dc, wxPoint(mid, pos), tick);
1228 prev_y_pos = pos;
1229 }
1230
1231 draw_short_ticks(dc, short_tick, tick);
1232
1233 if (sequence < m_ruler.count() && value == m_ruler.max_values[sequence]) {
1234 value = 0.0;
1235 sequence++;
1236 tick++;
1237 }
1238 }
1239 // short ticks from the last tick to the end
1240 draw_short_ticks(dc, short_tick, m_max_value);
1241 }
1242
1243 dc.SetTextForeground(old_clr);
1244}
double long_step
Definition DoubleSlider.hpp:459
bool can_draw()
Definition DoubleSlider.hpp:470
std::vector< double > max_values
Definition DoubleSlider.hpp:461
size_t count()
Definition DoubleSlider.hpp:469
double short_step
Definition DoubleSlider.hpp:460
void draw_tick_text(wxDC &dc, const wxPoint &pos, int tick, LabelType label_type=ltHeight, bool right_side=true) const
Definition DoubleSlider.cpp:789
void draw_ticks_pair(wxDC &dc, wxCoord pos, wxCoord mid, int tick_len)
Definition DoubleSlider.cpp:887
constexpr double NaNd
Definition libslic3r.h:365

References Slic3r::DoubleSlider::Control::Ruler::can_draw(), Slic3r::DoubleSlider::Control::Ruler::count(), draw_tick_text(), draw_ticks_pair(), get_position_from_value(), get_scroll_step(), get_size(), GREY_PEN, is_horizontal(), Slic3r::DoubleSlider::Control::Ruler::long_step, m_max_value, m_ruler, m_values, Slic3r::DoubleSlider::Control::Ruler::max_values, Slic3r::NaNd, and Slic3r::DoubleSlider::Control::Ruler::short_step.

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_scroll_line()

void Slic3r::DoubleSlider::Control::draw_scroll_line ( wxDC &  dc,
const int  lower_pos,
const int  higher_pos 
)
protected
271{
272 int width;
273 int height;
274 get_size(&width, &height);
275
276 wxCoord line_beg_x = is_horizontal() ? SLIDER_MARGIN : width*0.5 - 1;
277 wxCoord line_beg_y = is_horizontal() ? height*0.5 - 1 : SLIDER_MARGIN;
278 wxCoord line_end_x = is_horizontal() ? width - SLIDER_MARGIN + 1 : width*0.5 - 1;
279 wxCoord line_end_y = is_horizontal() ? height*0.5 - 1 : height - SLIDER_MARGIN + 1;
280
281 wxCoord segm_beg_x = is_horizontal() ? lower_pos : width*0.5 - 1;
282 wxCoord segm_beg_y = is_horizontal() ? height*0.5 - 1 : lower_pos/*-1*/;
283 wxCoord segm_end_x = is_horizontal() ? higher_pos : width*0.5 - 1;
284 wxCoord segm_end_y = is_horizontal() ? height*0.5 - 1 : higher_pos-1;
285
286 for (size_t id = 0; id < m_line_pens.size(); id++) {
287 dc.SetPen(*m_line_pens[id]);
288 dc.DrawLine(line_beg_x, line_beg_y, line_end_x, line_end_y);
289 dc.SetPen(*m_segm_pens[id]);
290 dc.DrawLine(segm_beg_x, segm_beg_y, segm_end_x, segm_end_y);
291 if (is_horizontal())
292 line_beg_y = line_end_y = segm_beg_y = segm_end_y += 1;
293 else
294 line_beg_x = line_end_x = segm_beg_x = segm_end_x += 1;
295 }
296}

References get_size(), is_horizontal(), m_line_pens, m_segm_pens, and SLIDER_MARGIN.

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_thumb()

void Slic3r::DoubleSlider::Control::draw_thumb ( wxDC &  dc,
const wxCoord &  pos_coord,
const SelectedSlider selection 
)
protected
847{
848 //calculate thumb position on slider line
849 int width, height;
850 get_size(&width, &height);
851 const wxPoint pos = is_horizontal() ? wxPoint(pos_coord, height*0.5) : wxPoint(0.5*width, pos_coord);
852
853 // Draw thumb
854 draw_thumb_item(dc, pos, selection);
855
856 // Draw info_line
857 draw_info_line_with_icon(dc, pos, selection);
858
859 // Draw thumb text
860 draw_thumb_text(dc, pos, selection);
861}
void draw_info_line_with_icon(wxDC &dc, const wxPoint &pos, SelectedSlider selection)
Definition DoubleSlider.cpp:613
void draw_thumb_item(wxDC &dc, const wxPoint &pos, const SelectedSlider &selection)
Definition DoubleSlider.cpp:836
void draw_thumb_text(wxDC &dc, const wxPoint &pos, const SelectedSlider &selection) const
Definition DoubleSlider.cpp:831

References draw_info_line_with_icon(), draw_thumb_item(), draw_thumb_text(), get_size(), and is_horizontal().

+ Here is the call graph for this function:

◆ draw_thumb_item()

void Slic3r::DoubleSlider::Control::draw_thumb_item ( wxDC &  dc,
const wxPoint &  pos,
const SelectedSlider selection 
)
protected
837{
838 wxCoord x_draw = pos.x - int(0.5 * m_thumb_size.x);
839 wxCoord y_draw = pos.y - int(0.5 * m_thumb_size.y);
840 dc.DrawBitmap(selection == ssLower ? m_bmp_thumb_lower.get_bitmap() : m_bmp_thumb_higher.get_bitmap(), x_draw, y_draw);
841
842 // Update thumb rect
843 update_thumb_rect(x_draw, y_draw, selection);
844}
void update_thumb_rect(const wxCoord begin_x, const wxCoord begin_y, const SelectedSlider &selection)
Definition DoubleSlider.cpp:1313

References ScalableBitmap::get_bitmap(), m_bmp_thumb_higher, m_bmp_thumb_lower, m_thumb_size, Slic3r::DoubleSlider::ssLower, and update_thumb_rect().

Referenced by draw_thumb(), and draw_thumbs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_thumb_text()

void Slic3r::DoubleSlider::Control::draw_thumb_text ( wxDC &  dc,
const wxPoint &  pos,
const SelectedSlider selection 
) const
protected
832{
833 draw_tick_text(dc, pos, selection == ssLower ? m_lower_value : m_higher_value, ltHeightWithLayer, selection == ssLower);
834}
@ ltHeightWithLayer
Definition DoubleSlider.hpp:94

References draw_tick_text(), Slic3r::DoubleSlider::ltHeightWithLayer, m_higher_value, m_lower_value, and Slic3r::DoubleSlider::ssLower.

Referenced by draw_thumb(), and draw_thumbs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_thumbs()

void Slic3r::DoubleSlider::Control::draw_thumbs ( wxDC &  dc,
const wxCoord &  lower_pos,
const wxCoord &  higher_pos 
)
protected
864{
865 //calculate thumb position on slider line
866 int width, height;
867 get_size(&width, &height);
868 const wxPoint pos_l = is_horizontal() ? wxPoint(lower_pos, height*0.5) : wxPoint(0.5*width, lower_pos);
869 const wxPoint pos_h = is_horizontal() ? wxPoint(higher_pos, height*0.5) : wxPoint(0.5*width, higher_pos);
870
871 // Draw lower thumb
872 draw_thumb_item(dc, pos_l, ssLower);
873 // Draw lower info_line
875
876 // Draw higher thumb
877 draw_thumb_item(dc, pos_h, ssHigher);
878 // Draw higher info_line
880 // Draw higher thumb text
881 draw_thumb_text(dc, pos_h, ssHigher);
882
883 // Draw lower thumb text
884 draw_thumb_text(dc, pos_l, ssLower);
885}

References draw_info_line_with_icon(), draw_thumb_item(), draw_thumb_text(), get_size(), is_horizontal(), Slic3r::DoubleSlider::ssHigher, and Slic3r::DoubleSlider::ssLower.

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_tick_on_mouse_position()

void Slic3r::DoubleSlider::Control::draw_tick_on_mouse_position ( wxDC &  dc)
protected
629{
630 if (!m_is_focused || m_moving_pos == wxDefaultPosition)
631 return;
632
633 //calculate thumb position on slider line
634 int width, height;
635 get_size(&width, &height);
636
638 if (tick == m_higher_value || tick == m_lower_value)
639 return ;
640
641 auto draw_ticks = [this](wxDC& dc, wxPoint pos, int margin=0 )
642 {
643 wxPoint pt_beg = is_horizontal() ? wxPoint(pos.x+margin, pos.y - m_thumb_size.y) : wxPoint(pos.x - m_thumb_size.x , pos.y+margin);
644 wxPoint pt_end = is_horizontal() ? wxPoint(pos.x+margin, pos.y + m_thumb_size.y) : wxPoint(pos.x - 0.5 * m_thumb_size.x + 1, pos.y+margin);
645 dc.DrawLine(pt_beg, pt_end);
646
647 pt_beg = is_horizontal() ? wxPoint(pos.x + margin, pos.y - m_thumb_size.y) : wxPoint(pos.x + 0.5 * m_thumb_size.x, pos.y+margin);
648 pt_end = is_horizontal() ? wxPoint(pos.x + margin, pos.y + m_thumb_size.y) : wxPoint(pos.x + m_thumb_size.x + 1, pos.y+margin);
649 dc.DrawLine(pt_beg, pt_end);
650 };
651
652 auto draw_touch = [this](wxDC& dc, wxPoint pos, int margin, bool right_side )
653 {
654 int mult = right_side ? 1 : -1;
655 wxPoint pt_beg = is_horizontal() ? wxPoint(pos.x - margin, pos.y + mult * m_thumb_size.y) : wxPoint(pos.x + mult * m_thumb_size.x, pos.y - margin);
656 wxPoint pt_end = is_horizontal() ? wxPoint(pos.x + margin, pos.y + mult * m_thumb_size.y) : wxPoint(pos.x + mult * m_thumb_size.x, pos.y + margin);
657 dc.DrawLine(pt_beg, pt_end);
658 };
659
660 if (tick > 0) // this tick exists and should be marked as a focused
661 {
662 wxCoord new_pos = get_position_from_value(tick);
663 const wxPoint pos = is_horizontal() ? wxPoint(new_pos, height * 0.5) : wxPoint(0.5 * width, new_pos);
664
665 dc.SetPen(DARK_ORANGE_PEN);
666
667 draw_ticks(dc, pos, -2);
668 draw_ticks(dc, pos, 2 );
669 draw_touch(dc, pos, 2, true);
670 draw_touch(dc, pos, 2, false);
671
672 return;
673 }
674
676 if (tick > m_max_value || tick < m_min_value || tick == m_higher_value || tick == m_lower_value)
677 return;
678
679 wxCoord new_pos = get_position_from_value(tick);
680 const wxPoint pos = is_horizontal() ? wxPoint(new_pos, height * 0.5) : wxPoint(0.5 * width, new_pos);
681
682 //draw info line
683 dc.SetPen(LIGHT_GREY_PEN);
684 draw_ticks(dc, pos);
685
686 if (m_extra_style & wxSL_VALUE_LABEL) {
687 wxColour old_clr = dc.GetTextForeground();
688 dc.SetTextForeground(GREY_PEN.GetColour());
689 draw_tick_text(dc, pos, tick, ltEstimatedTime, false);
690 dc.SetTextForeground(old_clr);
691 }
692}
wxPoint m_moving_pos
Definition DoubleSlider.hpp:404
int get_tick_near_point(const wxPoint &pt)
Definition DoubleSlider.cpp:1360
void draw_ticks(wxDC &dc)
Definition DoubleSlider.cpp:896
int get_value_from_position(const wxCoord x, const wxCoord y)
Definition DoubleSlider.cpp:1325
@ ltEstimatedTime
Definition DoubleSlider.hpp:96

References DARK_ORANGE_PEN, draw_tick_text(), draw_ticks(), get_position_from_value(), get_size(), get_tick_near_point(), get_value_from_position(), GREY_PEN, is_horizontal(), LIGHT_GREY_PEN, Slic3r::DoubleSlider::ltEstimatedTime, m_extra_style, m_higher_value, m_is_focused, m_lower_value, m_max_value, m_min_value, m_moving_pos, and m_thumb_size.

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_tick_text()

void Slic3r::DoubleSlider::Control::draw_tick_text ( wxDC &  dc,
const wxPoint &  pos,
int  tick,
LabelType  label_type = ltHeight,
bool  right_side = true 
) const
protected
790{
791 wxCoord text_width, text_height;
792 const wxString label = get_label(tick, label_type);
793 dc.GetMultiLineTextExtent(label, &text_width, &text_height);
794 wxPoint text_pos;
795 if (right_side) {
796 if (is_horizontal()) {
797 int width;
798 int height;
799 get_size(&width, &height);
800
801 int x_right = pos.x + 1 + text_width;
802 int xx = (x_right < width) ? pos.x + 1 : pos.x - text_width - 1;
803 text_pos = wxPoint(xx, pos.y + m_thumb_size.x / 2 + 1);
804 }
805 else
806 text_pos = wxPoint(pos.x + m_thumb_size.x + 1, pos.y - 0.5 * text_height - 1);
807 }
808 else {
809 if (is_horizontal()) {
810 int x = pos.x - text_width - 1;
811 int xx = (x > 0) ? x : pos.x + 1;
812 text_pos = wxPoint(xx, pos.y - m_thumb_size.x / 2 - text_height - 1);
813 }
814 else
815 text_pos = wxPoint(std::max(2, pos.x - text_width - 1 - m_thumb_size.x), pos.y - 0.5 * text_height + 1);
816 }
817
818 wxColour old_clr = dc.GetTextForeground();
819 const wxPen& pen = is_wipe_tower_layer(tick) && (tick == m_lower_value || tick == m_higher_value) ? DARK_ORANGE_PEN : /*wxPen(old_clr)*/GREY_PEN;
820 dc.SetPen(pen);
821 dc.SetTextForeground(pen.GetColour());
822
823 if (label_type == ltEstimatedTime)
824 dc.DrawLabel(label, wxRect(text_pos, wxSize(text_width, text_height)), wxALIGN_RIGHT);
825 else
826 dc.DrawText(label, text_pos);
827
828 dc.SetTextForeground(old_clr);
829}
wxString get_label(int tick, LabelType label_type=ltHeightWithLayer) const
Definition DoubleSlider.cpp:735

References DARK_ORANGE_PEN, get_label(), get_size(), GREY_PEN, is_horizontal(), is_wipe_tower_layer(), Slic3r::DoubleSlider::ltEstimatedTime, m_higher_value, m_lower_value, and m_thumb_size.

Referenced by draw_ruler(), draw_thumb_text(), and draw_tick_on_mouse_position().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_ticks()

void Slic3r::DoubleSlider::Control::draw_ticks ( wxDC &  dc)
protected
897{
898 if (m_draw_mode == dmSlaPrint)
899 return;
900
902 int height, width;
903 get_size(&width, &height);
904 const wxCoord mid = is_horizontal() ? 0.5*height : 0.5*width;
905 for (const TickCode& tick : m_ticks.ticks) {
906 if (size_t(tick.tick) >= m_values.size()) {
907 // The case when OnPaint is called before m_ticks.ticks data are updated (specific for the vase mode)
908 break;
909 }
910
911 const wxCoord pos = get_position_from_value(tick.tick);
912 draw_ticks_pair(dc, pos, mid, 7);
913
914 // if current tick if focused, we should to use a specific "focused" icon
915 bool focused_tick = m_moving_pos != wxDefaultPosition && tick.tick == get_tick_near_point(m_moving_pos);
916
917 // get icon name if it is
918 std::string icon_name;
919
920 // if we have non-regular draw mode, all ticks should be marked with error icon
921 if (m_draw_mode != dmRegular)
922 icon_name = focused_tick ? "error_tick_f" : "error_tick";
923 else if (tick.type == ColorChange || tick.type == ToolChange) {
925 icon_name = focused_tick ? "error_tick_f" : "error_tick";
926 }
927 else if (tick.type == PausePrint)
928 icon_name = focused_tick ? "pause_print_f" : "pause_print";
929 else
930 icon_name = focused_tick ? "edit_gcode_f" : "edit_gcode";
931
932 // Draw icon for "Pause print", "Custom Gcode" or conflict tick
933 if (!icon_name.empty()) {
934 wxBitmapBundle* icon = get_bmp_bundle(icon_name);
935 wxCoord x_draw, y_draw;
936 is_horizontal() ? x_draw = pos - 0.5 * m_tick_icon_dim : y_draw = pos - 0.5 * m_tick_icon_dim;
937 is_horizontal() ? y_draw = mid + 22 : x_draw = mid + m_thumb_size.x + 3;
938
939 dc.DrawBitmap(icon->GetBitmapFor(this), x_draw, y_draw);
940 }
941 }
942}
ConflictType is_conflict_tick(const TickCode &tick, Mode out_mode, int only_extruder, double print_z)
Definition DoubleSlider.cpp:2850
@ PausePrint
Definition CustomGCode.hpp:16
@ dmSlaPrint
Definition DoubleSlider.hpp:87

References Slic3r::CustomGCode::ColorChange, DARK_GREY_PEN, Slic3r::DoubleSlider::dmRegular, Slic3r::DoubleSlider::dmSlaPrint, draw_ticks_pair(), get_bmp_bundle(), get_position_from_value(), get_size(), get_tick_near_point(), Slic3r::DoubleSlider::TickCodeInfo::is_conflict_tick(), is_horizontal(), LIGHT_GREY_PEN, m_draw_mode, m_mode, m_moving_pos, m_only_extruder, m_thumb_size, m_tick_icon_dim, m_ticks, m_values, Slic3r::CustomGCode::PausePrint, Slic3r::DoubleSlider::TickCodeInfo::ticks, and Slic3r::CustomGCode::ToolChange.

Referenced by draw_tick_on_mouse_position(), and render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_ticks_pair()

void Slic3r::DoubleSlider::Control::draw_ticks_pair ( wxDC &  dc,
wxCoord  pos,
wxCoord  mid,
int  tick_len 
)
protected
888{
889 int mid_space = 9;
890 is_horizontal() ? dc.DrawLine(pos, mid - (mid_space + tick_len), pos, mid - mid_space) :
891 dc.DrawLine(mid - (mid_space + tick_len), pos, mid - mid_space, pos);
892 is_horizontal() ? dc.DrawLine(pos, mid + (mid_space + tick_len), pos, mid + mid_space) :
893 dc.DrawLine(mid + (mid_space + tick_len), pos, mid + mid_space, pos);
894}

References is_horizontal().

Referenced by draw_ruler(), and draw_ticks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit_extruder_sequence()

void Slic3r::DoubleSlider::Control::edit_extruder_sequence ( )
2487{
2489 return;
2490
2491 GUI::ExtruderSequenceDialog dlg(m_extruders_sequence);
2492 if (dlg.ShowModal() != wxID_OK)
2493 return;
2494 m_extruders_sequence = dlg.GetValue();
2495
2497
2498 const int extr_cnt = m_extruders_sequence.extruders.size();
2499 if (extr_cnt == 1)
2500 return;
2501
2502 int tick = 0;
2503 double value = 0.0;
2504 int extruder = -1;
2505
2506 std::random_device rd; //Will be used to obtain a seed for the random number engine
2507 std::mt19937 gen(rd()); //Standard mersenne_twister_engine seeded with rd()
2508 std::uniform_int_distribution<> distrib(0, extr_cnt-1);
2509
2510 while (tick <= m_max_value)
2511 {
2512 bool color_repetition = false;
2514 int rand_extr = distrib(gen);
2516 color_repetition = rand_extr == extruder;
2517 else
2518 while (rand_extr == extruder)
2519 rand_extr = distrib(gen);
2520 extruder = rand_extr;
2521 }
2522 else {
2523 extruder++;
2524 if (extruder == extr_cnt)
2525 extruder = 0;
2526 }
2527
2528 const int cur_extruder = m_extruders_sequence.extruders[extruder];
2529
2530 bool meaningless_tick = tick == 0.0 && cur_extruder == extruder;
2531 if (!meaningless_tick && !color_repetition)
2532 m_ticks.ticks.emplace(TickCode{tick, ToolChange,cur_extruder + 1, m_extruder_colors[cur_extruder]});
2533
2536 tick = get_tick_from_value(value, true);
2537 if (tick < 0)
2538 break;
2539 }
2540 else
2542 }
2543
2545}
ExtrudersSequence m_extruders_sequence
Definition DoubleSlider.hpp:301
int get_tick_from_value(double value, bool force_lower_bound=false)
Definition DoubleSlider.cpp:339
bool is_mm_intervals
Definition DoubleSlider.hpp:157
bool random_sequence
Definition DoubleSlider.hpp:160
bool color_repetition
Definition DoubleSlider.hpp:161
int interval_by_layers
Definition DoubleSlider.hpp:159
double interval_by_mm
Definition DoubleSlider.hpp:158
std::vector< size_t > extruders
Definition DoubleSlider.hpp:162

References check_ticks_changed_event(), Slic3r::DoubleSlider::ExtrudersSequence::color_repetition, Slic3r::DoubleSlider::TickCodeInfo::erase_all_ticks_with_code(), Slic3r::DoubleSlider::ExtrudersSequence::extruders, get_tick_from_value(), Slic3r::GUI::ExtruderSequenceDialog::GetValue(), Slic3r::DoubleSlider::ExtrudersSequence::interval_by_layers, Slic3r::DoubleSlider::ExtrudersSequence::interval_by_mm, Slic3r::DoubleSlider::ExtrudersSequence::is_mm_intervals, m_extruder_colors, m_extruders_sequence, m_max_value, m_ticks, post_ticks_changed_event(), Slic3r::DoubleSlider::ExtrudersSequence::random_sequence, Slic3r::DoubleSlider::TickCodeInfo::ticks, and Slic3r::CustomGCode::ToolChange.

Referenced by show_cog_icon_context_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit_tick()

void Slic3r::DoubleSlider::Control::edit_tick ( int  tick = -1)
2427{
2428 if (tick < 0)
2430 const std::set<TickCode>::iterator it = m_ticks.ticks.find(TickCode{ tick });
2431
2432 if (it == m_ticks.ticks.end() ||
2433 !check_ticks_changed_event(it->type))
2434 return;
2435
2436 Type type = it->type;
2437 if (m_ticks.edit_tick(it, m_values[it->tick]))
2439}
bool edit_tick(std::set< TickCode >::iterator it, double print_z)
Definition DoubleSlider.cpp:2758

References check_ticks_changed_event(), Slic3r::DoubleSlider::TickCodeInfo::edit_tick(), m_higher_value, m_lower_value, m_selection, m_ticks, m_values, post_ticks_changed_event(), Slic3r::DoubleSlider::ssLower, and Slic3r::DoubleSlider::TickCodeInfo::ticks.

Referenced by OnRightUp(), and show_edit_context_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enable_action_icon()

void Slic3r::DoubleSlider::Control::enable_action_icon ( bool  enable)
inline
295{ m_enable_action_icon = enable; }

References m_enable_action_icon.

Referenced by Slic3r::GUI::Preview::create_layers_slider_sizer().

+ Here is the caller graph for this function:

◆ enter_window()

void Slic3r::DoubleSlider::Control::enter_window ( wxMouseEvent &  event,
const bool  enter 
)
protected
1758{
1759 m_is_focused = enter;
1760 Refresh();
1761 Update();
1762 event.Skip();
1763}

References m_is_focused.

Referenced by OnEnterWin(), and OnLeaveWin().

+ Here is the caller graph for this function:

◆ get_active_extruders_for_tick()

std::array< int, 2 > Slic3r::DoubleSlider::Control::get_active_extruders_for_tick ( int  tick) const
private
1950{
1951 int default_initial_extruder = m_mode == MultiAsSingle ? std::max<int>(1, m_only_extruder) : 1;
1952 std::array<int, 2> extruders = { default_initial_extruder, -1 };
1953 if (m_ticks.empty())
1954 return extruders;
1955
1956 auto it = m_ticks.ticks.lower_bound(TickCode{tick});
1957
1958 if (it != m_ticks.ticks.end() && it->tick == tick) // current tick exists
1959 extruders[1] = it->extruder;
1960
1961 while (it != m_ticks.ticks.begin()) {
1962 --it;
1963 if(it->type == ToolChange) {
1964 extruders[0] = it->extruder;
1965 break;
1966 }
1967 }
1968
1969 return extruders;
1970}

References Slic3r::DoubleSlider::TickCodeInfo::empty(), m_mode, m_only_extruder, m_ticks, Slic3r::CustomGCode::MultiAsSingle, Slic3r::DoubleSlider::TickCodeInfo::ticks, and Slic3r::CustomGCode::ToolChange.

Referenced by append_change_extruder_menu_item().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_color_for_color_change_tick()

std::string Slic3r::DoubleSlider::Control::get_color_for_color_change_tick ( std::set< TickCode >::const_iterator  it) const
private
959{
960 const int def_extruder = std::max<int>(1, m_only_extruder);
961 auto it_n = it;
962 bool is_tool_change = false;
963 while (it_n != m_ticks.ticks.begin()) {
964 --it_n;
965 if (it_n->type == ToolChange) {
966 is_tool_change = true;
967 if (it_n->extruder == it->extruder)
968 return it->color;
969 break;
970 }
971 if (it_n->type == ColorChange && it_n->extruder == it->extruder)
972 return it->color;
973 }
974 if (!is_tool_change && it->extruder == def_extruder)
975 return it->color;
976
977 return "";
978}

References Slic3r::CustomGCode::ColorChange, m_only_extruder, m_ticks, Slic3r::DoubleSlider::TickCodeInfo::ticks, and Slic3r::CustomGCode::ToolChange.

Referenced by draw_colored_band().

+ Here is the caller graph for this function:

◆ get_color_for_tool_change_tick()

std::string Slic3r::DoubleSlider::Control::get_color_for_tool_change_tick ( std::set< TickCode >::const_iterator  it) const
private
945{
946 const int current_extruder = it->extruder == 0 ? std::max<int>(m_only_extruder, 1) : it->extruder;
947
948 auto it_n = it;
949 while (it_n != m_ticks.ticks.begin()) {
950 --it_n;
951 if (it_n->type == ColorChange && it_n->extruder == current_extruder)
952 return it_n->color;
953 }
954
955 return m_extruder_colors[current_extruder-1]; // return a color for a specific extruder from the colors list
956}

References Slic3r::CustomGCode::ColorChange, m_extruder_colors, m_only_extruder, m_ticks, and Slic3r::DoubleSlider::TickCodeInfo::ticks.

Referenced by draw_colored_band().

+ Here is the caller graph for this function:

◆ get_colored_band_rect()

wxRect Slic3r::DoubleSlider::Control::get_colored_band_rect ( )
private
981{
982 int height, width;
983 get_size(&width, &height);
984
985 const wxCoord mid = is_horizontal() ? 0.5 * height : 0.5 * width;
986
987 return is_horizontal() ?
988 wxRect(SLIDER_MARGIN, lround(mid - 0.375 * m_thumb_size.y),
989 width - 2 * SLIDER_MARGIN + 1, lround(0.75 * m_thumb_size.y)) :
990 wxRect(lround(mid - 0.375 * m_thumb_size.x), SLIDER_MARGIN,
991 lround(0.75 * m_thumb_size.x), height - 2 * SLIDER_MARGIN + 1);
992}

References get_size(), is_horizontal(), m_thumb_size, and SLIDER_MARGIN.

Referenced by draw_colored_band(), OnMotion(), and OnRightDown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_double_value()

double Slic3r::DoubleSlider::Control::get_double_value ( const SelectedSlider selection)
private
329{
330 if (m_values.empty() || m_lower_value<0)
331 return 0.0;
332 if (m_values.size() <= size_t(m_higher_value)) {
334 return m_values.back();
335 }
336 return m_values[selection == ssLower ? m_lower_value : m_higher_value];
337}

References correct_higher_value(), m_higher_value, m_lower_value, m_values, and Slic3r::DoubleSlider::ssLower.

Referenced by GetHigherValueD(), and GetLowerValueD().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_edited_tick_for_position()

int Slic3r::DoubleSlider::Control::get_edited_tick_for_position ( wxPoint  pos,
Type  type = ColorChange 
)
private
1575{
1576 if (m_ticks.empty())
1577 return -1;
1578
1579 int tick = get_value_from_position(pos);
1580 auto it = std::lower_bound(m_ticks.ticks.begin(), m_ticks.ticks.end(), TickCode{ tick });
1581
1582 while (it != m_ticks.ticks.begin()) {
1583 --it;
1584 if (it->type == type)
1585 return it->tick;
1586 }
1587
1588 return -1;
1589}

References Slic3r::DoubleSlider::TickCodeInfo::empty(), get_value_from_position(), m_ticks, and Slic3r::DoubleSlider::TickCodeInfo::ticks.

Referenced by OnMotion(), and OnRightUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_label()

wxString Slic3r::DoubleSlider::Control::get_label ( int  tick,
LabelType  label_type = ltHeightWithLayer 
) const
private
736{
737 const size_t value = tick;
738
739 if (m_label_koef == 1.0 && m_values.empty())
740 return wxString::Format("%lu", static_cast<unsigned long>(value));
741 if (value >= m_values.size())
742 return "ErrVal";
743
744 // When "Print Settings -> Multiple Extruders -> No sparse layer" is enabled, then "Smart" Wipe Tower is used for wiping.
745 // As a result, each layer with tool changes is splited for min 3 parts: first tool, wiping, second tool ...
746 // So, vertical slider have to respect to this case.
747 // see https://github.com/prusa3d/PrusaSlicer/issues/6232.
748 // m_values contains data for all layer's parts,
749 // but m_layers_values contains just unique Z values.
750 // Use this function for correct conversion slider position to number of printed layer
751 auto get_layer_number = [this](int value, LabelType label_type) {
752 if (label_type == ltEstimatedTime && m_layers_times.empty())
753 return size_t(-1);
754 double layer_print_z = m_values[is_wipe_tower_layer(value) ? std::max<int>(value - 1, 0) : value];
755 auto it = std::lower_bound(m_layers_values.begin(), m_layers_values.end(), layer_print_z - epsilon());
756 if (it == m_layers_values.end()) {
757 it = std::lower_bound(m_values.begin(), m_values.end(), layer_print_z - epsilon());
758 if (it == m_values.end())
759 return size_t(-1);
760 return size_t(value);
761 }
762 return size_t(it - m_layers_values.begin());
763 };
764
766 return wxString::Format("%lu", static_cast<unsigned long>(m_alternate_values[value]));
767 else {
768 if (label_type == ltEstimatedTime) {
769 if (m_is_wipe_tower) {
770 size_t layer_number = get_layer_number(value, label_type);
771 return (layer_number == size_t(-1) || layer_number == m_layers_times.size()) ? "" : short_and_splitted_time(get_time_dhms(m_layers_times[layer_number]));
772 }
773 return value < m_layers_times.size() ? short_and_splitted_time(get_time_dhms(m_layers_times[value])) : "";
774 }
775 wxString str = m_values.empty() ?
776 wxString::Format("%.*f", 2, m_label_koef * value) :
777 wxString::Format("%.*f", 2, m_values[value]);
778 if (label_type == ltHeight)
779 return str;
780 if (label_type == ltHeightWithLayer) {
781 size_t layer_number = m_is_wipe_tower ? get_layer_number(value, label_type) + 1 : (m_values.empty() ? value : value + 1);
782 return format_wxstr("%1%\n(%2%)", str, layer_number);
783 }
784 }
785
786 return wxEmptyString;
787}
std::vector< double > m_alternate_values
Definition DoubleSlider.hpp:428
bool m_is_wipe_tower
Definition DoubleSlider.hpp:395
float m_label_koef
Definition DoubleSlider.hpp:419
std::vector< double > m_layers_times
Definition DoubleSlider.hpp:423
LabelType
Definition DoubleSlider.hpp:93
@ ltHeight
Definition DoubleSlider.hpp:95
constexpr double epsilon()
Definition DoubleSlider.hpp:28
static wxString short_and_splitted_time(const std::string &time)
Definition DoubleSlider.cpp:694
std::string get_time_dhms(float time_in_secs)
Definition Utils.hpp:315

References Slic3r::DoubleSlider::dmSequentialGCodeView, Slic3r::DoubleSlider::epsilon(), Slic3r::get_time_dhms(), is_wipe_tower_layer(), Slic3r::DoubleSlider::ltEstimatedTime, Slic3r::DoubleSlider::ltHeight, Slic3r::DoubleSlider::ltHeightWithLayer, m_alternate_values, m_draw_mode, m_is_wipe_tower, m_label_koef, m_layers_times, m_layers_values, m_values, and Slic3r::DoubleSlider::short_and_splitted_time().

Referenced by draw_tick_text().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_lower_and_higher_position()

void Slic3r::DoubleSlider::Control::get_lower_and_higher_position ( int &  lower_pos,
int &  higher_pos 
)
private
486{
487 const double step = get_scroll_step();
488 if (is_horizontal()) {
489 lower_pos = SLIDER_MARGIN + int(m_lower_value*step + 0.5);
490 higher_pos = SLIDER_MARGIN + int(m_higher_value*step + 0.5);
491 }
492 else {
493 lower_pos = SLIDER_MARGIN + int((m_max_value - m_lower_value)*step + 0.5);
494 higher_pos = SLIDER_MARGIN + int((m_max_value - m_higher_value)*step + 0.5);
495 }
496}
Coord step(const Coord &crd, Dir d)
Definition MarchingSquares.hpp:137

References get_scroll_step(), is_horizontal(), m_higher_value, m_lower_value, m_max_value, and SLIDER_MARGIN.

+ Here is the call graph for this function:

◆ get_min_size()

wxSize Slic3r::DoubleSlider::Control::get_min_size ( ) const
199{
200 const int min_side = GUI::wxGetApp().em_unit() * ( is_horizontal() ? 5 : 11 );
201 return wxSize(min_side, min_side);
202}

References is_horizontal().

Referenced by Control(), DoGetBestSize(), and msw_rescale().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_position_from_value()

wxCoord Slic3r::DoubleSlider::Control::get_position_from_value ( const int  value)
private
307{
308 const double step = get_scroll_step();
309 const int val = is_horizontal() ? value : m_max_value - value;
310 return wxCoord(SLIDER_MARGIN + int(val*step + 0.5));
311}

References get_scroll_step(), is_horizontal(), m_max_value, and SLIDER_MARGIN.

Referenced by add_current_tick(), draw_colored_band(), draw_ruler(), draw_tick_on_mouse_position(), draw_ticks(), get_tick_near_point(), and render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_scroll_step()

double Slic3r::DoubleSlider::Control::get_scroll_step ( )
private
299{
300 const wxSize sz = get_size();
301 const int& slider_len = m_style == wxSL_HORIZONTAL ? sz.x : sz.y;
302 return double(slider_len - SLIDER_MARGIN * 2) / (m_max_value - m_min_value);
303}

References get_size(), m_max_value, m_min_value, m_style, and SLIDER_MARGIN.

Referenced by Control(), draw_ruler(), get_lower_and_higher_position(), get_position_from_value(), get_value_from_position(), msw_rescale(), SetLayersTimes(), and SetSliderValues().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_size() [1/2]

wxSize Slic3r::DoubleSlider::Control::get_size ( ) const
private
314{
315 int w, h;
316 get_size(&w, &h);
317 return wxSize(w, h);
318}

References get_size().

Referenced by add_current_tick(), draw_cog_icon(), draw_one_layer_icon(), draw_revert_icon(), draw_ruler(), draw_scroll_line(), draw_thumb(), draw_thumbs(), draw_tick_on_mouse_position(), draw_tick_text(), draw_ticks(), get_colored_band_rect(), get_scroll_step(), get_size(), and get_value_from_position().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_size() [2/2]

void Slic3r::DoubleSlider::Control::get_size ( int *  w,
int *  h 
) const
private
321{
322 GetSize(w, h);
324 return; // we have no more icons for drawing
326}

References Slic3r::DoubleSlider::dmSequentialGCodeView, is_horizontal(), m_draw_mode, and m_lock_icon_dim.

+ Here is the call graph for this function:

◆ get_tick_from_value()

int Slic3r::DoubleSlider::Control::get_tick_from_value ( double  value,
bool  force_lower_bound = false 
)
private
340{
341 std::vector<double>::iterator it;
342 if (m_is_wipe_tower && !force_lower_bound)
343 it = std::find_if(m_values.begin(), m_values.end(),
344 [value](const double & val) { return fabs(value - val) <= epsilon(); });
345 else
346 it = std::lower_bound(m_values.begin(), m_values.end(), value - epsilon());
347
348 if (it == m_values.end())
349 return -1;
350 return int(it - m_values.begin());
351}

References Slic3r::DoubleSlider::epsilon(), m_is_wipe_tower, and m_values.

Referenced by edit_extruder_sequence(), jump_to_value(), and SetTicksValues().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_tick_near_point()

int Slic3r::DoubleSlider::Control::get_tick_near_point ( const wxPoint &  pt)
private
1361{
1362 for (auto tick : m_ticks.ticks) {
1363 const wxCoord pos = get_position_from_value(tick.tick);
1364
1365 if (is_horizontal()) {
1366 if (pos - 4 <= pt.x && pt.x <= pos + 4)
1367 return tick.tick;
1368 }
1369 else {
1370 if (pos - 4 <= pt.y && pt.y <= pos + 4)
1371 return tick.tick;
1372 }
1373 }
1374 return -1;
1375}

References get_position_from_value(), is_horizontal(), m_ticks, and Slic3r::DoubleSlider::TickCodeInfo::ticks.

Referenced by draw_tick_on_mouse_position(), draw_ticks(), move_current_thumb_to_pos(), and OnMotion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_tooltip()

wxString Slic3r::DoubleSlider::Control::get_tooltip ( int  tick = -1)
private
1444{
1445 if (m_focus == fiNone)
1446 return "";
1447 if (m_focus == fiOneLayerIcon)
1448 return _L("One layer mode");
1449 if (m_focus == fiRevertIcon)
1450 return _L("Discard all custom changes");
1451 if (m_focus == fiCogIcon)
1452 {
1454 return _L("Jump to move") + " (Shift + G)";
1455 else
1456 return m_mode == MultiAsSingle ?
1457 GUI::from_u8((boost::format(_u8L("Jump to height %s\n"
1458 "Set ruler mode\n"
1459 "or Set extruder sequence for the entire print")) % "(Shift + G)").str()) :
1460 GUI::from_u8((boost::format(_u8L("Jump to height %s\n"
1461 "or Set ruler mode")) % "(Shift + G)").str());
1462 }
1463 if (m_focus == fiColorBand)
1464 return m_mode != SingleExtruder ? "" :
1465 _L("Edit current color - Right click the colored slider segment");
1467 return _L("This is wipe tower layer");
1468 if (m_draw_mode == dmSlaPrint)
1469 return ""; // no drawn ticks and no tooltips for them in SlaPrinting mode
1470
1471 wxString tooltip;
1472 const auto tick_code_it = m_ticks.ticks.find(TickCode{tick});
1473
1474 if (tick_code_it == m_ticks.ticks.end() && m_focus == fiActionIcon) // tick doesn't exist
1475 {
1477 return (_L("The sequential print is on.\n"
1478 "It's impossible to apply any custom G-code for objects printing sequentually.") + "\n");
1479
1480 // Show mode as a first string of tooltop
1481 tooltip = " " + _L("Print mode") + ": ";
1482 tooltip += (m_mode == SingleExtruder ? SingleExtruderMode :
1485 tooltip += "\n\n";
1486
1487 /* Note: just on OSX!!!
1488 * Right click event causes a little scrolling.
1489 * So, as a workaround we use Ctrl+LeftMouseClick instead of RightMouseClick
1490 * Show this information in tooltip
1491 * */
1492
1493 // Show list of actions with new tick
1494 tooltip += ( m_mode == MultiAsSingle ?
1495 _L("Add extruder change - Left click") :
1497 _L("Add color change - Left click for predefined color or "
1498 "Shift + Left click for custom color selection") :
1499 _L("Add color change - Left click") ) + " " +
1500 _L("or press \"+\" key") + "\n" + (
1501 is_osx ?
1502 _L("Add another code - Ctrl + Left click") :
1503 _L("Add another code - Right click") );
1504 }
1505
1506 if (tick_code_it != m_ticks.ticks.end()) // tick exists
1507 {
1509 return _L("The sequential print is on.\n"
1510 "It's impossible to apply any custom G-code for objects printing sequentually.\n"
1511 "This code won't be processed during G-code generation.");
1512
1513 // Show custom Gcode as a first string of tooltop
1514 std::string space = " ";
1515 tooltip = space;
1516 auto format_gcode = [space](std::string gcode) {
1517 // when the tooltip is too long, it starts to flicker, see: https://github.com/prusa3d/PrusaSlicer/issues/7368
1518 // so we limit the number of lines shown
1519 std::vector<std::string> lines;
1520 boost::split(lines, gcode, boost::is_any_of("\n"), boost::token_compress_off);
1521 static const size_t MAX_LINES = 10;
1522 if (lines.size() > MAX_LINES) {
1523 gcode = lines.front() + '\n';
1524 for (size_t i = 1; i < MAX_LINES; ++i) {
1525 gcode += lines[i] + '\n';
1526 }
1527 gcode += "[" + into_u8(_L("continue")) + "]\n";
1528 }
1529 boost::replace_all(gcode, "\n", "\n" + space);
1530 return gcode;
1531 };
1532 tooltip +=
1533 tick_code_it->type == ColorChange ?
1535 format_wxstr(_L("Color change (\"%1%\")"), gcode(ColorChange)) :
1536 format_wxstr(_L("Color change (\"%1%\") for Extruder %2%"), gcode(ColorChange), tick_code_it->extruder)) :
1537 tick_code_it->type == PausePrint ?
1538 format_wxstr(_L("Pause print (\"%1%\")"), gcode(PausePrint)) :
1539 tick_code_it->type == Template ?
1540 format_wxstr(_L("Custom template (\"%1%\")"), gcode(Template)) :
1541 tick_code_it->type == ToolChange ?
1542 format_wxstr(_L("Extruder (tool) is changed to Extruder \"%1%\""), tick_code_it->extruder) :
1543 from_u8(format_gcode(tick_code_it->extra));// tick_code_it->type == Custom
1544
1545 // If tick is marked as a conflict (exclamation icon),
1546 // we should to explain why
1547 ConflictType conflict = m_ticks.is_conflict_tick(*tick_code_it, m_mode, m_only_extruder, m_values[tick]);
1548 if (conflict != ctNone)
1549 tooltip += "\n\n" + _L("Note") + "! ";
1550 if (conflict == ctModeConflict)
1551 tooltip += _L("G-code associated to this tick mark is in a conflict with print mode.\n"
1552 "Editing it will cause changes of Slider data.");
1553 else if (conflict == ctMeaninglessColorChange)
1554 tooltip += _L("There is a color change for extruder that won't be used till the end of print job.\n"
1555 "This code won't be processed during G-code generation.");
1556 else if (conflict == ctMeaninglessToolChange)
1557 tooltip += _L("There is an extruder change set to the same extruder.\n"
1558 "This code won't be processed during G-code generation.");
1559 else if (conflict == ctRedundant)
1560 tooltip += _L("There is a color change for extruder that has not been used before.\n"
1561 "Check your settings to avoid redundant color changes.");
1562
1563 // Show list of actions with existing tick
1564 if (m_focus == fiActionIcon)
1565 tooltip += "\n\n" + _L("Delete tick mark - Left click or press \"-\" key") + "\n" + (
1566 is_osx ?
1567 _L("Edit tick mark - Ctrl + Left click") :
1568 _L("Edit tick mark - Right click") );
1569 }
1570 return tooltip;
1571
1572}
static constexpr char SingleExtruderMode[]
Definition CustomGCode.hpp:58
static constexpr char MultiAsSingleMode[]
Definition CustomGCode.hpp:59
static constexpr char MultiExtruderMode[]
Definition CustomGCode.hpp:60
@ Template
Definition CustomGCode.hpp:18
@ fiCogIcon
Definition DoubleSlider.hpp:52
@ fiSmartWipeTower
Definition DoubleSlider.hpp:57
@ fiNone
Definition DoubleSlider.hpp:49
@ fiRevertIcon
Definition DoubleSlider.hpp:50
@ fiColorBand
Definition DoubleSlider.hpp:53
ConflictType
Definition DoubleSlider.hpp:62
@ ctRedundant
Definition DoubleSlider.hpp:67
@ ctMeaninglessToolChange
Definition DoubleSlider.hpp:66
@ ctMeaninglessColorChange
Definition DoubleSlider.hpp:65
@ ctNone
Definition DoubleSlider.hpp:63
@ ctModeConflict
Definition DoubleSlider.hpp:64
std::string into_u8(const wxString &str)
Definition GUI.cpp:442
wxString from_u8(const std::string &str)
Definition GUI.cpp:437
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:44
Definition args.hpp:18

References _L, _u8L, Slic3r::CustomGCode::ColorChange, Slic3r::DoubleSlider::ctMeaninglessColorChange, Slic3r::DoubleSlider::ctMeaninglessToolChange, Slic3r::DoubleSlider::ctModeConflict, Slic3r::DoubleSlider::ctNone, Slic3r::DoubleSlider::ctRedundant, Slic3r::DoubleSlider::dmSequentialFffPrint, Slic3r::DoubleSlider::dmSequentialGCodeView, Slic3r::DoubleSlider::dmSlaPrint, Slic3r::DoubleSlider::fiActionIcon, Slic3r::DoubleSlider::fiCogIcon, Slic3r::DoubleSlider::fiColorBand, Slic3r::DoubleSlider::fiNone, Slic3r::DoubleSlider::fiOneLayerIcon, Slic3r::DoubleSlider::fiRevertIcon, Slic3r::DoubleSlider::fiSmartWipeTower, Slic3r::GUI::from_u8(), Slic3r::DoubleSlider::gcode(), Slic3r::DoubleSlider::TickCodeInfo::is_conflict_tick(), is_osx, m_draw_mode, m_focus, m_mode, m_only_extruder, m_ticks, m_values, Slic3r::CustomGCode::MultiAsSingle, Slic3r::CustomGCode::MultiAsSingleMode, Slic3r::CustomGCode::MultiExtruderMode, Slic3r::CustomGCode::PausePrint, Slic3r::CustomGCode::SingleExtruder, Slic3r::CustomGCode::SingleExtruderMode, Slic3r::CustomGCode::Template, Slic3r::DoubleSlider::TickCodeInfo::ticks, and Slic3r::CustomGCode::ToolChange.

Referenced by OnMotion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_value_from_position() [1/2]

int Slic3r::DoubleSlider::Control::get_value_from_position ( const wxCoord  x,
const wxCoord  y 
)
private
1326{
1327 const int height = get_size().y;
1328 const double step = get_scroll_step();
1329
1330 if (is_horizontal())
1331 return int(double(x - SLIDER_MARGIN) / step + 0.5);
1332
1333 return int(m_min_value + double(height - SLIDER_MARGIN - y) / step + 0.5);
1334}

References get_scroll_step(), get_size(), is_horizontal(), m_min_value, and SLIDER_MARGIN.

Referenced by draw_tick_on_mouse_position(), get_edited_tick_for_position(), move_current_thumb_to_pos(), and OnMotion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_value_from_position() [2/2]

int Slic3r::DoubleSlider::Control::get_value_from_position ( const wxPoint  pos)
inlineprivate
342{ return get_value_from_position(pos.x, pos.y); }

References get_value_from_position().

Referenced by get_value_from_position().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetActiveValue()

int Slic3r::DoubleSlider::Control::GetActiveValue ( ) const

◆ GetHigherValue()

int Slic3r::DoubleSlider::Control::GetHigherValue ( ) const
inline
228{ return m_higher_value; }

References m_higher_value.

Referenced by Slic3r::GUI::Preview::on_layers_slider_scroll_changed(), and Slic3r::GUI::Preview::update_layers_slider_from_canvas().

+ Here is the caller graph for this function:

◆ GetHigherValueD()

double Slic3r::DoubleSlider::Control::GetHigherValueD ( )
inline
231{ return get_double_value(ssHigher); }
double get_double_value(const SelectedSlider &selection)
Definition DoubleSlider.cpp:328

References get_double_value(), and Slic3r::DoubleSlider::ssHigher.

Referenced by Slic3r::GUI::Preview::on_layers_slider_scroll_changed(), Slic3r::GUI::Preview::on_moves_slider_scroll_changed(), and Slic3r::GUI::Preview::update_layers_slider().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLowerValue()

int Slic3r::DoubleSlider::Control::GetLowerValue ( ) const
inline
227{ return m_lower_value; }

References m_lower_value.

Referenced by Slic3r::GUI::Preview::on_layers_slider_scroll_changed().

+ Here is the caller graph for this function:

◆ GetLowerValueD()

double Slic3r::DoubleSlider::Control::GetLowerValueD ( )
inline
230{ return get_double_value(ssLower); }

References get_double_value(), and Slic3r::DoubleSlider::ssLower.

Referenced by Slic3r::GUI::Preview::on_layers_slider_scroll_changed(), Slic3r::GUI::Preview::on_moves_slider_scroll_changed(), and Slic3r::GUI::Preview::update_layers_slider().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetManipulationMode()

Mode Slic3r::DoubleSlider::Control::GetManipulationMode ( ) const
inline
255{ return m_mode; }

References m_mode.

◆ GetMaxValue()

int Slic3r::DoubleSlider::Control::GetMaxValue ( ) const
inline
224{ return m_max_value; }

References m_max_value.

Referenced by Slic3r::GUI::Preview::set_layers_slider_values_range(), and Slic3r::GUI::Preview::update_layers_slider().

+ Here is the caller graph for this function:

◆ GetMaxValueD()

double Slic3r::DoubleSlider::Control::GetMaxValueD ( )
inline
226{ return m_values.empty() ? 0. : m_values[m_max_value]; }

References m_max_value, and m_values.

Referenced by Slic3r::GUI::Preview::update_layers_slider().

+ Here is the caller graph for this function:

◆ GetMinValue()

int Slic3r::DoubleSlider::Control::GetMinValue ( ) const
inline
223{ return m_min_value; }

References m_min_value.

Referenced by Slic3r::GUI::Preview::set_layers_slider_values_range(), and Slic3r::GUI::Preview::update_layers_slider().

+ Here is the caller graph for this function:

◆ GetMinValueD()

double Slic3r::DoubleSlider::Control::GetMinValueD ( )
inline
225{ return m_values.empty() ? 0. : m_values[m_min_value]; }

References m_min_value, and m_values.

◆ GetTicksValues()

Info Slic3r::DoubleSlider::Control::GetTicksValues ( ) const
354{
355 Info custom_gcode_per_print_z;
356 std::vector<CustomGCode::Item>& values = custom_gcode_per_print_z.gcodes;
357
358 const int val_size = m_values.size();
359 if (!m_values.empty())
360 for (const TickCode& tick : m_ticks.ticks) {
361 if (tick.tick > val_size)
362 break;
363 values.emplace_back(CustomGCode::Item{ m_values[tick.tick], tick.type, tick.extruder, tick.color, tick.extra });
364 }
365
367 custom_gcode_per_print_z.mode = m_mode;
368
369 return custom_gcode_per_print_z;
370}
bool m_force_mode_apply
Definition DoubleSlider.hpp:393

References Slic3r::CustomGCode::Info::gcodes, m_force_mode_apply, m_mode, m_ticks, m_values, Slic3r::CustomGCode::Info::mode, and Slic3r::DoubleSlider::TickCodeInfo::ticks.

Referenced by Slic3r::GUI::Preview::create_layers_slider_sizer().

+ Here is the caller graph for this function:

◆ is_full_span()

bool Slic3r::DoubleSlider::Control::is_full_span ( ) const
inline
268{ return this->is_lower_at_min() && this->is_higher_at_max(); }
bool is_higher_at_max() const
Definition DoubleSlider.hpp:267
bool is_lower_at_min() const
Definition DoubleSlider.hpp:266

References is_higher_at_max(), and is_lower_at_min().

+ Here is the call graph for this function:

◆ is_higher_at_max()

bool Slic3r::DoubleSlider::Control::is_higher_at_max ( ) const
inline
267{ return m_higher_value == m_max_value; }

References m_higher_value, and m_max_value.

Referenced by is_full_span(), and Slic3r::GUI::Preview::update_layers_slider().

+ Here is the caller graph for this function:

◆ is_horizontal()

bool Slic3r::DoubleSlider::Control::is_horizontal ( ) const
inline

◆ is_lower_at_min()

bool Slic3r::DoubleSlider::Control::is_lower_at_min ( ) const
inline
266{ return m_lower_value == m_min_value; }

References m_lower_value, and m_min_value.

Referenced by is_full_span(), and Slic3r::GUI::Preview::update_layers_slider().

+ Here is the caller graph for this function:

◆ is_lower_thumb_editable()

bool Slic3r::DoubleSlider::Control::is_lower_thumb_editable ( )
protected
1337{
1339 return Slic3r::GUI::get_app_config()->get("seq_top_layer_only") == "0";
1340 return true;
1341}
bool get(const std::string &section, const std::string &key, std::string &value) const
Definition AppConfig.hpp:47
AppConfig * get_app_config()
Definition GUI.cpp:432

References Slic3r::DoubleSlider::dmSequentialGCodeView, Slic3r::AppConfig::get(), Slic3r::GUI::get_app_config(), and m_draw_mode.

Referenced by detect_selected_slider(), OnKeyDown(), and OnWheel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_one_layer()

bool Slic3r::DoubleSlider::Control::is_one_layer ( ) const
inline
265{ return m_is_one_layer; }

References m_is_one_layer.

Referenced by Slic3r::GUI::Preview::update_layers_slider_from_canvas().

+ Here is the caller graph for this function:

◆ is_point_in_rect()

bool Slic3r::DoubleSlider::Control::is_point_in_rect ( const wxPoint &  pt,
const wxRect &  rect 
)
private
1355{
1356 return rect.GetLeft() <= pt.x && pt.x <= rect.GetRight() &&
1357 rect.GetTop() <= pt.y && pt.y <= rect.GetBottom();
1358}

Referenced by detect_selected_slider(), OnLeftDown(), OnMotion(), and OnRightDown().

+ Here is the caller graph for this function:

◆ is_rendering_as_disabled()

bool Slic3r::DoubleSlider::Control::is_rendering_as_disabled ( ) const
inline
262{ return m_render_as_disabled; }
bool m_render_as_disabled
Definition DoubleSlider.hpp:374

References m_render_as_disabled.

Referenced by Slic3r::GUI::Preview::enable_moves_slider().

+ Here is the caller graph for this function:

◆ is_wipe_tower_layer()

bool Slic3r::DoubleSlider::Control::is_wipe_tower_layer ( int  tick) const
protected
560{
561 if (!m_is_wipe_tower || tick >= (int)m_values.size())
562 return false;
563 if (tick == 0 || (tick == (int)m_values.size() - 1 && m_values[tick] > m_values[tick - 1]))
564 return false;
565 if ((m_values[tick - 1] == m_values[tick + 1] && m_values[tick] < m_values[tick + 1]) ||
566 (tick > 0 && m_values[tick] < m_values[tick - 1]) ) // if there is just one wiping on the layer
567 return true;
568
569 return false;
570}

References m_is_wipe_tower, and m_values.

Referenced by draw_action_icon(), draw_tick_text(), get_label(), and OnMotion().

+ Here is the caller graph for this function:

◆ IsNewPrint()

bool Slic3r::DoubleSlider::Control::IsNewPrint ( )
470{
471 if (GUI::wxGetApp().plater()->printer_technology() == ptSLA)
472 return false;
473 const Print& print = GUI::wxGetApp().plater()->fff_print();
474 std::string idxs;
475 for (auto object : print.objects())
476 idxs += std::to_string(object->id().id) + "_";
477
478 if (idxs == m_print_obj_idxs)
479 return false;
480
481 m_print_obj_idxs = idxs;
482 return true;
483}
std::string m_print_obj_idxs
Definition DoubleSlider.hpp:426
@ ptSLA
Definition Config.hpp:209
printer_technology((ConfigOptionPoints, bed_shape))((ConfigOptionFloat
std::string to_string(const Vec2crd &pt)
Definition Point.hpp:139
STL namespace.

References m_print_obj_idxs, Slic3r::Print::objects(), Slic3r::printer_technology(), and Slic3r::ptSLA.

Referenced by Slic3r::GUI::Preview::update_layers_slider().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ jump_to_value()

void Slic3r::DoubleSlider::Control::jump_to_value ( )
2548{
2551 if (value < 0.0)
2552 return;
2553
2554 int tick_value = get_tick_from_value(value);
2555
2556 if (m_selection == ssLower)
2557 SetLowerValue(tick_value);
2558 else
2559 SetHigherValue(tick_value);
2560}
static double get_value_to_jump(double active_value, double min_z, double max_z, DrawMode mode)
Definition DoubleSlider.cpp:2321

References get_tick_from_value(), Slic3r::DoubleSlider::get_value_to_jump(), m_draw_mode, m_higher_value, m_lower_value, m_max_value, m_min_value, m_selection, m_values, SetHigherValue(), SetLowerValue(), and Slic3r::DoubleSlider::ssLower.

Referenced by OnChar(), and show_cog_icon_context_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move_current_thumb()

void Slic3r::DoubleSlider::Control::move_current_thumb ( const bool  condition)
protected
1769{
1770// m_is_one_layer = wxGetKeyState(WXK_CONTROL);
1771 int delta = condition ? -1 : 1;
1772 if (is_horizontal())
1773 delta *= -1;
1774
1775 // accelerators
1776 int accelerator = 0;
1777 if (wxGetKeyState(WXK_SHIFT))
1778 accelerator += 5;
1779 if (wxGetKeyState(WXK_CONTROL))
1780 accelerator += 5;
1781 if (accelerator > 0)
1782 delta *= accelerator;
1783
1784 if (m_selection == ssUndef)
1786
1787 if (m_selection == ssLower) {
1788 m_lower_value -= delta;
1790 }
1791 else if (m_selection == ssHigher) {
1792 m_higher_value -= delta;
1794 }
1795 Refresh();
1796 Update();
1797
1798 wxCommandEvent e(wxEVT_SCROLL_CHANGED);
1799 e.SetEventObject(this);
1800 ProcessWindowEvent(e);
1801}

References correct_higher_value(), correct_lower_value(), is_horizontal(), m_higher_value, m_lower_value, m_selection, Slic3r::DoubleSlider::ssHigher, Slic3r::DoubleSlider::ssLower, and Slic3r::DoubleSlider::ssUndef.

Referenced by OnKeyDown(), and OnWheel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move_current_thumb_to_pos()

void Slic3r::DoubleSlider::Control::move_current_thumb_to_pos ( wxPoint  pos)
2470{
2471 const int tick_val = get_tick_near_point(pos);
2472 const int mouse_val = tick_val >= 0 && m_draw_mode == dmRegular ? tick_val :
2474 if (mouse_val >= 0) {
2475 if (m_selection == ssLower) {
2476 SetLowerValue(mouse_val);
2478 }
2479 else { // even m_selection is ssUndef, upper thumb should be selected
2480 SetHigherValue(mouse_val);
2482 }
2483 }
2484}

References correct_higher_value(), correct_lower_value(), Slic3r::DoubleSlider::dmRegular, get_tick_near_point(), get_value_from_position(), m_draw_mode, m_selection, SetHigherValue(), SetLowerValue(), and Slic3r::DoubleSlider::ssLower.

Referenced by OnLeftUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ msw_rescale()

void Slic3r::DoubleSlider::Control::msw_rescale ( )
155{
156 m_font = GUI::wxGetApp().normal_font();
157
163
164 SLIDER_MARGIN = 4 + GUI::wxGetApp().em_unit();
165
166 SetMinSize(get_min_size());
167 GetParent()->Layout();
168
171}
void update_dpi()
Definition DoubleSlider.cpp:1063

References get_min_size(), get_scroll_step(), ScalableBitmap::GetSize(), ScalableBitmap::GetWidth(), m_bmp_add_tick_on, m_bmp_cog, m_bmp_one_layer_lock_on, m_bmp_revert, m_bmp_thumb_lower, m_cog_icon_dim, m_font, m_layers_values, m_lock_icon_dim, m_revert_icon_dim, m_ruler, m_thumb_size, m_tick_icon_dim, m_values, SLIDER_MARGIN, Slic3r::DoubleSlider::Control::Ruler::update(), and Slic3r::DoubleSlider::Control::Ruler::update_dpi().

Referenced by Slic3r::GUI::Preview::msw_rescale().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnChar()

void Slic3r::DoubleSlider::Control::OnChar ( wxKeyEvent &  event)
1893{
1894 const int key = event.GetKeyCode();
1896 if (key == '+' && !m_ticks.suppressed_plus()) {
1897 add_current_tick(true);
1898 m_ticks.suppress_plus(false);
1899 }
1900 else if (key == '-' && !m_ticks.suppressed_minus()) {
1902 m_ticks.suppress_minus(false);
1903 }
1904 }
1905 if (key == 'G')
1906 jump_to_value();
1907}
void delete_current_tick()
Definition DoubleSlider.cpp:2411
void add_current_tick(bool call_from_keyboard=false)
Definition DoubleSlider.cpp:2369
void jump_to_value()
Definition DoubleSlider.cpp:2547
bool suppressed_minus()
Definition DoubleSlider.hpp:148
bool suppressed_plus()
Definition DoubleSlider.hpp:147
void suppress_minus(bool suppress)
Definition DoubleSlider.hpp:146
void suppress_plus(bool suppress)
Definition DoubleSlider.hpp:145

References add_current_tick(), delete_current_tick(), Slic3r::DoubleSlider::dmSequentialGCodeView, jump_to_value(), m_draw_mode, m_ticks, Slic3r::DoubleSlider::TickCodeInfo::suppress_minus(), Slic3r::DoubleSlider::TickCodeInfo::suppress_plus(), Slic3r::DoubleSlider::TickCodeInfo::suppressed_minus(), and Slic3r::DoubleSlider::TickCodeInfo::suppressed_plus().

Referenced by Control(), Slic3r::GUI::Preview::edit_layers_slider(), and Slic3r::GUI::Preview::jump_layers_slider().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnEnterWin()

void Slic3r::DoubleSlider::Control::OnEnterWin ( wxMouseEvent &  event)
inline
274{ enter_window(event, true); }
void enter_window(wxMouseEvent &event, const bool enter)
Definition DoubleSlider.cpp:1757

References enter_window().

Referenced by Control().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnKeyDown()

void Slic3r::DoubleSlider::Control::OnKeyDown ( wxKeyEvent &  event)
1826{
1827 const int key = event.GetKeyCode();
1828 if (m_draw_mode != dmSequentialGCodeView && key == WXK_NUMPAD_ADD) {
1829 // OnChar() is called immediately after OnKeyDown(), which can cause call of add_tick() twice.
1830 // To avoid this case we should suppress second add_tick() call.
1831 m_ticks.suppress_plus(true);
1832 add_current_tick(true);
1833 }
1834 else if (m_draw_mode != dmSequentialGCodeView && (key == WXK_NUMPAD_SUBTRACT || key == WXK_DELETE || key == WXK_BACK)) {
1835 // OnChar() is called immediately after OnKeyDown(), which can cause call of delete_tick() twice.
1836 // To avoid this case we should suppress second delete_tick() call.
1837 m_ticks.suppress_minus(true);
1839 }
1840 else if (m_draw_mode != dmSequentialGCodeView && event.GetKeyCode() == WXK_SHIFT)
1841 UseDefaultColors(false);
1842 else if (is_horizontal()) {
1843 if (m_is_focused) {
1844 if (key == WXK_LEFT || key == WXK_RIGHT)
1845 move_current_thumb(key == WXK_LEFT);
1846 else if (key == WXK_UP || key == WXK_DOWN) {
1847 if (key == WXK_DOWN)
1849 else if (key == WXK_UP && is_lower_thumb_editable())
1851 Refresh();
1852 }
1853 }
1854 else {
1855 if (key == WXK_LEFT || key == WXK_RIGHT)
1856 move_current_thumb(key == WXK_LEFT);
1857 }
1858 }
1859 else {
1860 if (m_is_focused) {
1861 if (key == WXK_LEFT || key == WXK_RIGHT) {
1862 if (key == WXK_LEFT)
1864 else if (key == WXK_RIGHT && is_lower_thumb_editable())
1866 Refresh();
1867 }
1868 else if (key == WXK_UP || key == WXK_DOWN)
1869 move_current_thumb(key == WXK_UP);
1870 }
1871 else {
1872 if (key == WXK_UP || key == WXK_DOWN)
1873 move_current_thumb(key == WXK_UP);
1874 }
1875 }
1876
1877 event.Skip(); // !Needed to have EVT_CHAR generated as well
1878}
void UseDefaultColors(bool def_colors_on)
Definition DoubleSlider.hpp:276
void move_current_thumb(const bool condition)
Definition DoubleSlider.cpp:1768

References add_current_tick(), delete_current_tick(), Slic3r::DoubleSlider::dmSequentialGCodeView, is_horizontal(), is_lower_thumb_editable(), m_draw_mode, m_is_focused, m_selection, m_ticks, move_current_thumb(), Slic3r::DoubleSlider::ssHigher, Slic3r::DoubleSlider::ssLower, Slic3r::DoubleSlider::TickCodeInfo::suppress_minus(), Slic3r::DoubleSlider::TickCodeInfo::suppress_plus(), and UseDefaultColors().

Referenced by Control(), Slic3r::GUI::Preview::move_layers_slider(), and Slic3r::GUI::Preview::move_moves_slider().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnKeyUp()

void Slic3r::DoubleSlider::Control::OnKeyUp ( wxKeyEvent &  event)
1881{
1882 if (event.GetKeyCode() == WXK_CONTROL)
1883 m_is_one_layer = false;
1884 else if (event.GetKeyCode() == WXK_SHIFT)
1885 UseDefaultColors(true);
1886
1887 Refresh();
1888 Update();
1889 event.Skip();
1890}

References m_is_one_layer, and UseDefaultColors().

Referenced by Control().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnLeaveWin()

void Slic3r::DoubleSlider::Control::OnLeaveWin ( wxMouseEvent &  event)
inline
275{ enter_window(event, false); }

References enter_window().

Referenced by Control().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnLeftDown()

void Slic3r::DoubleSlider::Control::OnLeftDown ( wxMouseEvent &  event)
1392{
1393 if (HasCapture())
1394 return;
1395 this->CaptureMouse();
1396
1397 m_is_left_down = true;
1398 m_mouse = maNone;
1399
1400 wxPoint pos = event.GetLogicalPosition(wxClientDC(this));
1401
1404 else if (is_point_in_rect(pos, m_rect_cog_icon))
1406 else if (m_draw_mode == dmRegular) {
1408 auto it = m_ticks.ticks.find(TickCode{ m_selection == ssLower ? m_lower_value : m_higher_value });
1409 m_mouse = it == m_ticks.ticks.end() ? maAddTick : maDeleteTick;
1410 }
1411 else if (is_point_in_rect(pos, m_rect_revert_icon))
1413 }
1414
1415 if (m_mouse == maNone)
1417
1418 event.Skip();
1419}
bool m_is_left_down
Definition DoubleSlider.hpp:389
MouseAction m_mouse
Definition DoubleSlider.hpp:402
bool detect_selected_slider(const wxPoint &pt)
Definition DoubleSlider.cpp:1343
@ maRevertIconClick
Definition DoubleSlider.hpp:81
@ maCogIconClick
Definition DoubleSlider.hpp:79
@ maOneLayerIconClick
Definition DoubleSlider.hpp:80
@ maAddTick
Definition DoubleSlider.hpp:77
@ maNone
Definition DoubleSlider.hpp:72
@ maDeleteTick
Definition DoubleSlider.hpp:78

References detect_selected_slider(), Slic3r::DoubleSlider::dmRegular, is_point_in_rect(), m_draw_mode, m_higher_value, m_is_left_down, m_lower_value, m_mouse, m_rect_cog_icon, m_rect_one_layer_icon, m_rect_revert_icon, m_rect_tick_action, m_selection, m_ticks, Slic3r::DoubleSlider::maAddTick, Slic3r::DoubleSlider::maCogIconClick, Slic3r::DoubleSlider::maDeleteTick, Slic3r::DoubleSlider::maNone, Slic3r::DoubleSlider::maOneLayerIconClick, Slic3r::DoubleSlider::maRevertIconClick, Slic3r::DoubleSlider::ssLower, and Slic3r::DoubleSlider::TickCodeInfo::ticks.

Referenced by Control().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnLeftUp()

void Slic3r::DoubleSlider::Control::OnLeftUp ( wxMouseEvent &  event)
1719{
1720 if (!HasCapture())
1721 return;
1722 this->ReleaseMouse();
1723 m_is_left_down = false;
1724
1725 switch (m_mouse) {
1726 case maNone :
1727 move_current_thumb_to_pos(event.GetLogicalPosition(wxClientDC(this)));
1728 break;
1729 case maDeleteTick :
1731 break;
1732 case maAddTick :
1734 break;
1735 case maCogIconClick :
1737 break;
1740 break;
1741 case maRevertIconClick:
1743 break;
1744 default :
1745 break;
1746 }
1747
1748 Refresh();
1749 Update();
1750 event.Skip();
1751
1752 wxCommandEvent e(wxEVT_SCROLL_CHANGED);
1753 e.SetEventObject(this);
1754 ProcessWindowEvent(e);
1755}
void switch_one_layer_mode()
Definition DoubleSlider.cpp:2442
void move_current_thumb_to_pos(wxPoint pos)
Definition DoubleSlider.cpp:2469
void discard_all_thicks()
Definition DoubleSlider.cpp:2454
void show_cog_icon_context_menu()
Definition DoubleSlider.cpp:2090

References add_current_tick(), delete_current_tick(), discard_all_thicks(), m_is_left_down, m_mouse, Slic3r::DoubleSlider::maAddTick, Slic3r::DoubleSlider::maCogIconClick, Slic3r::DoubleSlider::maDeleteTick, Slic3r::DoubleSlider::maNone, Slic3r::DoubleSlider::maOneLayerIconClick, Slic3r::DoubleSlider::maRevertIconClick, move_current_thumb_to_pos(), show_cog_icon_context_menu(), and switch_one_layer_mode().

Referenced by Control().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnMotion()

void Slic3r::DoubleSlider::Control::OnMotion ( wxMouseEvent &  event)
1592{
1593 bool action = false;
1594
1595 const wxPoint pos = event.GetLogicalPosition(wxClientDC(this));
1596 int tick = -1;
1597
1601 else if (is_point_in_rect(pos, m_rect_tick_action)) {
1604 }
1605 else if (!m_ticks.empty() && is_point_in_rect(pos, m_rect_revert_icon))
1607 else if (is_point_in_rect(pos, m_rect_cog_icon))
1612 else if (is_point_in_rect(pos, m_rect_lower_thumb))
1616 else {
1617 tick = get_tick_near_point(pos);
1618 if (tick < 0 && m_is_wipe_tower) {
1619 tick = get_value_from_position(pos);
1620 m_focus = tick > 0 && is_wipe_tower_layer(tick) && (tick == m_lower_value || tick == m_higher_value) ?
1622 }
1623 else
1624 m_focus = fiTick;
1625 }
1626 m_moving_pos = pos;
1627 }
1628 else if (m_is_left_down || m_is_right_down) {
1629 if (m_selection == ssLower) {
1630 int current_value = m_lower_value;
1633 action = (current_value != m_lower_value);
1634 }
1635 else if (m_selection == ssHigher) {
1636 int current_value = m_higher_value;
1639 action = (current_value != m_higher_value);
1640 }
1641 m_moving_pos = wxDefaultPosition;
1642 }
1643 Refresh();
1644 Update();
1645 event.Skip();
1646
1647 // Set tooltips with information for each icon
1648 if (GUI::wxGetApp().is_editor())
1649 this->SetToolTip(get_tooltip(tick));
1650
1651 if (action) {
1652 wxCommandEvent e(wxEVT_SCROLL_CHANGED);
1653 e.SetEventObject(this);
1654 e.SetString("moving");
1655 ProcessWindowEvent(e);
1656 }
1657}
wxString get_tooltip(int tick=-1)
Definition DoubleSlider.cpp:1443
int get_edited_tick_for_position(wxPoint pos, Type type=ColorChange)
Definition DoubleSlider.cpp:1574
bool m_is_right_down
Definition DoubleSlider.hpp:390
@ fiTick
Definition DoubleSlider.hpp:58
@ fiLowerThumb
Definition DoubleSlider.hpp:55
@ fiHigherThumb
Definition DoubleSlider.hpp:56

References correct_higher_value(), correct_lower_value(), Slic3r::DoubleSlider::TickCodeInfo::empty(), Slic3r::DoubleSlider::fiActionIcon, Slic3r::DoubleSlider::fiCogIcon, Slic3r::DoubleSlider::fiColorBand, Slic3r::DoubleSlider::fiHigherThumb, Slic3r::DoubleSlider::fiLowerThumb, Slic3r::DoubleSlider::fiOneLayerIcon, Slic3r::DoubleSlider::fiRevertIcon, Slic3r::DoubleSlider::fiSmartWipeTower, Slic3r::DoubleSlider::fiTick, get_colored_band_rect(), get_edited_tick_for_position(), get_tick_near_point(), get_tooltip(), get_value_from_position(), is_point_in_rect(), is_wipe_tower_layer(), m_focus, m_higher_value, m_is_left_down, m_is_right_down, m_is_wipe_tower, m_lower_value, m_mode, m_moving_pos, m_rect_cog_icon, m_rect_higher_thumb, m_rect_lower_thumb, m_rect_one_layer_icon, m_rect_revert_icon, m_rect_tick_action, m_selection, m_ticks, Slic3r::CustomGCode::SingleExtruder, Slic3r::DoubleSlider::ssHigher, and Slic3r::DoubleSlider::ssLower.

Referenced by Control().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnPaint()

void Slic3r::DoubleSlider::Control::OnPaint ( wxPaintEvent &  )
inline
270{ render(); }
void render()
Definition DoubleSlider.cpp:512

References render().

Referenced by Control().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnRightDown()

void Slic3r::DoubleSlider::Control::OnRightDown ( wxMouseEvent &  event)
1910{
1911 if (HasCapture() || m_is_left_down)
1912 return;
1913 this->CaptureMouse();
1914
1915 const wxPoint pos = event.GetLogicalPosition(wxClientDC(this));
1916
1917 m_mouse = maNone;
1918 if (m_draw_mode == dmRegular) {
1920 const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
1921 m_mouse = m_ticks.ticks.find(TickCode{ tick }) == m_ticks.ticks.end() ?
1923 }
1928 }
1929 if (m_mouse != maNone || !detect_selected_slider(pos))
1930 return;
1931
1932 if (m_selection == ssLower)
1934 else
1936
1937 // set slider to "one layer" mode
1939
1940 Refresh();
1941 Update();
1942 event.Skip();
1943}
@ maCogIconMenu
Definition DoubleSlider.hpp:75
@ maEditMenu
Definition DoubleSlider.hpp:74
@ maForceColorEdit
Definition DoubleSlider.hpp:76
@ maAddMenu
Definition DoubleSlider.hpp:73

References detect_selected_slider(), Slic3r::DoubleSlider::dmRegular, get_colored_band_rect(), is_point_in_rect(), m_draw_mode, m_higher_value, m_is_left_down, m_is_one_layer, m_is_right_down, m_lower_value, m_mode, m_mouse, m_rect_cog_icon, m_rect_tick_action, m_selection, m_ticks, Slic3r::DoubleSlider::maAddMenu, Slic3r::DoubleSlider::maCogIconMenu, Slic3r::DoubleSlider::maEditMenu, Slic3r::DoubleSlider::maForceColorEdit, Slic3r::DoubleSlider::maNone, Slic3r::CustomGCode::MultiAsSingle, Slic3r::CustomGCode::SingleExtruder, Slic3r::DoubleSlider::ssLower, and Slic3r::DoubleSlider::TickCodeInfo::ticks.

Referenced by Control().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnRightUp()

void Slic3r::DoubleSlider::Control::OnRightUp ( wxMouseEvent &  event)
2204{
2205 if (!HasCapture() || m_is_left_down)
2206 return;
2207 this->ReleaseMouse();
2209
2210 if (m_mouse == maForceColorEdit) {
2211 wxPoint pos = event.GetLogicalPosition(wxClientDC(this));
2212 int edited_tick = get_edited_tick_for_position(pos);
2213 if (edited_tick >= 0)
2214 edit_tick(edited_tick);
2215 }
2216 else if (m_mouse == maAddMenu)
2218 else if (m_mouse == maEditMenu)
2220 else if (m_mouse == maCogIconMenu)
2222
2223 Refresh();
2224 Update();
2225 event.Skip();
2226}
void edit_tick(int tick=-1)
Definition DoubleSlider.cpp:2426
void show_edit_context_menu()
Definition DoubleSlider.cpp:2061
void show_add_context_menu()
Definition DoubleSlider.cpp:2032

References edit_tick(), get_edited_tick_for_position(), m_is_left_down, m_is_one_layer, m_is_right_down, m_mouse, Slic3r::DoubleSlider::maAddMenu, Slic3r::DoubleSlider::maCogIconMenu, Slic3r::DoubleSlider::maEditMenu, Slic3r::DoubleSlider::maForceColorEdit, show_add_context_menu(), show_cog_icon_context_menu(), and show_edit_context_menu().

Referenced by Control().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnWheel()

void Slic3r::DoubleSlider::Control::OnWheel ( wxMouseEvent &  event)
1804{
1805 // Set nearest to the mouse thumb as a selected, if there is not selected thumb
1806 if (m_selection == ssUndef) {
1807 const wxPoint& pt = event.GetLogicalPosition(wxClientDC(this));
1808
1809 if (is_horizontal())
1810 m_selection = abs(pt.x - m_rect_lower_thumb.GetRight()) <=
1811 abs(pt.x - m_rect_higher_thumb.GetLeft()) ?
1812 ssLower : ssHigher;
1813 else
1814 m_selection = abs(pt.y - m_rect_lower_thumb.GetTop()) <=
1815 abs(pt.y - m_rect_higher_thumb.GetBottom()) ?
1816 ssLower : ssHigher;
1817 }
1818
1821
1822 move_current_thumb((m_draw_mode == dmSequentialGCodeView) ? event.GetWheelRotation() < 0 : event.GetWheelRotation() > 0);
1823}
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half abs(const half &a)
Definition Half.h:445

References Slic3r::DoubleSlider::dmSequentialGCodeView, is_horizontal(), is_lower_thumb_editable(), m_draw_mode, m_rect_higher_thumb, m_rect_lower_thumb, m_selection, move_current_thumb(), Slic3r::DoubleSlider::ssHigher, Slic3r::DoubleSlider::ssLower, and Slic3r::DoubleSlider::ssUndef.

Referenced by Control().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ post_ticks_changed_event()

void Slic3r::DoubleSlider::Control::post_ticks_changed_event ( Type  type = Custom)
private
2563{
2564// m_force_mode_apply = type != ToolChange; // It looks like this condition is no needed now. Leave it for the testing
2565
2566 wxPostEvent(this->GetParent(), wxCommandEvent(wxCUSTOMEVT_TICKSCHANGED));
2567}

Referenced by add_code_as_tick(), check_ticks_changed_event(), delete_current_tick(), discard_all_thicks(), edit_extruder_sequence(), edit_tick(), and SetTicksValues().

+ Here is the caller graph for this function:

◆ render()

void Slic3r::DoubleSlider::Control::render ( )
protected
513{
514#ifdef _WIN32
515 GUI::wxGetApp().UpdateDarkUI(this);
516#else
517 SetBackgroundColour(GetParent()->GetBackgroundColour());
518#endif // _WIN32
519
520 wxPaintDC dc(this);
521 dc.SetFont(m_font);
522
523 draw_focus_rect(dc);
524
525 const wxCoord lower_pos = get_position_from_value(m_lower_value);
526 const wxCoord higher_pos = get_position_from_value(m_higher_value);
527
528 // draw colored band on the background of a scroll line
529 // and only in a case of no-empty m_values
531
532 if (m_extra_style & wxSL_AUTOTICKS)
533 draw_ruler(dc);
534
536 // draw line
537 draw_scroll_line(dc, lower_pos, higher_pos);
538
539 // draw color print ticks
540 draw_ticks(dc);
541
542 // draw both sliders
543 draw_thumbs(dc, lower_pos, higher_pos);
544
545 // draw lock/unlock
547
548 // draw revert bitmap (if it's shown)
550
551 // draw cog bitmap (if it's shown)
552 draw_cog_icon(dc);
553
554 // draw mouse position
556 }
557}
void draw_scroll_line(wxDC &dc, const int lower_pos, const int higher_pos)
Definition DoubleSlider.cpp:270
void draw_revert_icon(wxDC &dc)
Definition DoubleSlider.cpp:1271
void draw_colored_band(wxDC &dc)
Definition DoubleSlider.cpp:994
void draw_ruler(wxDC &dc)
Definition DoubleSlider.cpp:1124
void draw_tick_on_mouse_position(wxDC &dc)
Definition DoubleSlider.cpp:628
void draw_thumbs(wxDC &dc, const wxCoord &lower_pos, const wxCoord &higher_pos)
Definition DoubleSlider.cpp:863
void draw_cog_icon(wxDC &dc)
Definition DoubleSlider.cpp:1289
void draw_one_layer_icon(wxDC &dc)
Definition DoubleSlider.cpp:1246
void draw_focus_rect(wxDC &dc)
Definition DoubleSlider.cpp:498

References draw_cog_icon(), draw_colored_band(), draw_focus_rect(), draw_one_layer_icon(), draw_revert_icon(), draw_ruler(), draw_scroll_line(), draw_thumbs(), draw_tick_on_mouse_position(), draw_ticks(), get_position_from_value(), m_extra_style, m_font, m_higher_value, m_lower_value, and m_render_as_disabled.

Referenced by OnPaint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_render_as_disabled()

void Slic3r::DoubleSlider::Control::set_render_as_disabled ( bool  value)
inline
261{ m_render_as_disabled = value; }

References m_render_as_disabled.

Referenced by Slic3r::GUI::Preview::enable_moves_slider().

+ Here is the caller graph for this function:

◆ SetDrawMode() [1/2]

void Slic3r::DoubleSlider::Control::SetDrawMode ( bool  is_sla_print,
bool  is_sequential_print 
)
444{
445 m_draw_mode = is_sla_print ? dmSlaPrint :
446 is_sequential_print ? dmSequentialFffPrint :
447 dmRegular;
448}

References Slic3r::DoubleSlider::dmRegular, Slic3r::DoubleSlider::dmSequentialFffPrint, Slic3r::DoubleSlider::dmSlaPrint, and m_draw_mode.

Referenced by Slic3r::GUI::Preview::create_layers_slider_sizer(), Slic3r::GUI::Preview::init(), and Slic3r::GUI::Preview::update_layers_slider().

+ Here is the caller graph for this function:

◆ SetDrawMode() [2/2]

void Slic3r::DoubleSlider::Control::SetDrawMode ( DrawMode  mode)
inline
252{ m_draw_mode = mode; }
IGL_INLINE void mode(const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &X, const int d, Eigen::Matrix< T, Eigen::Dynamic, 1 > &M)
Definition mode.cpp:14

References m_draw_mode.

◆ SetExtruderColors()

void Slic3r::DoubleSlider::Control::SetExtruderColors ( const std::vector< std::string > &  extruder_colors)
465{
466 m_extruder_colors = extruder_colors;
467}

References m_extruder_colors.

Referenced by Slic3r::GUI::Preview::update_layers_slider().

+ Here is the caller graph for this function:

◆ SetHigherValue()

void Slic3r::DoubleSlider::Control::SetHigherValue ( const int  higher_val)
226{
228 m_higher_value = higher_val;
230 Refresh();
231 Update();
232
233 wxCommandEvent e(wxEVT_SCROLL_CHANGED);
234 e.SetEventObject(this);
235 ProcessWindowEvent(e);
236}

References correct_higher_value(), m_higher_value, m_selection, and Slic3r::DoubleSlider::ssHigher.

Referenced by discard_all_thicks(), jump_to_value(), move_current_thumb_to_pos(), Slic3r::GUI::Preview::reset_layers_slider(), Slic3r::GUI::Preview::set_layers_slider_values_range(), switch_one_layer_mode(), and Slic3r::GUI::Preview::update_layers_slider_from_canvas().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetKoefForLabels()

void Slic3r::DoubleSlider::Control::SetKoefForLabels ( const double  koef)
inline
241{ m_label_koef = koef; }

References m_label_koef.

◆ SetLayersTimes() [1/2]

void Slic3r::DoubleSlider::Control::SetLayersTimes ( const std::vector< double > &  layers_times)
436{
437 m_is_wipe_tower = false;
438 m_layers_times = layers_times;
439 for (size_t i = 1; i < m_layers_times.size(); i++)
440 m_layers_times[i] += m_layers_times[i - 1];
441}

References m_is_wipe_tower, and m_layers_times.

◆ SetLayersTimes() [2/2]

void Slic3r::DoubleSlider::Control::SetLayersTimes ( const std::vector< float > &  layers_times,
float  total_time 
)
405{
406 m_layers_times.clear();
407 if (layers_times.empty())
408 return;
409 m_layers_times.resize(layers_times.size(), 0.0);
410 m_layers_times[0] = layers_times[0];
411 for (size_t i = 1; i < layers_times.size(); i++)
412 m_layers_times[i] = m_layers_times[i - 1] + layers_times[i];
413
414 // Erase duplicates values from m_values and save it to the m_layers_values
415 // They will be used for show the correct estimated time for MM print, when "No sparce layer" is enabled
416 // See https://github.com/prusa3d/PrusaSlicer/issues/6232
417 if (m_is_wipe_tower && m_values.size() != m_layers_times.size()) {
419 sort(m_layers_values.begin(), m_layers_values.end());
421
422 // When whipe tower is used to the end of print, there is one layer which is not marked in layers_times
423 // So, add this value from the total print time value
424 if (m_layers_values.size() != m_layers_times.size())
425 for (size_t i = m_layers_times.size(); i < m_layers_values.size(); i++)
426 m_layers_times.push_back(total_time);
428 Refresh();
429 Update();
430 }
431 else
433}
IGL_INLINE void sort(const Eigen::DenseBase< DerivedX > &X, const int dim, const bool ascending, Eigen::PlainObjectBase< DerivedY > &Y, Eigen::PlainObjectBase< DerivedIX > &IX)
Definition sort.cpp:21
IGL_INLINE void unique(const std::vector< T > &A, std::vector< T > &C, std::vector< size_t > &IA, std::vector< size_t > &IC)
Definition unique.cpp:21

References get_scroll_step(), m_is_wipe_tower, m_layers_times, m_layers_values, m_ruler, m_values, and Slic3r::DoubleSlider::Control::Ruler::update().

Referenced by Slic3r::GUI::Preview::update_layers_slider().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetLowerValue()

void Slic3r::DoubleSlider::Control::SetLowerValue ( const int  lower_val)
213{
215 m_lower_value = lower_val;
217 Refresh();
218 Update();
219
220 wxCommandEvent e(wxEVT_SCROLL_CHANGED);
221 e.SetEventObject(this);
222 ProcessWindowEvent(e);
223}

References correct_lower_value(), m_lower_value, m_selection, and Slic3r::DoubleSlider::ssLower.

Referenced by discard_all_thicks(), jump_to_value(), move_current_thumb_to_pos(), Slic3r::GUI::Preview::reset_layers_slider(), Slic3r::GUI::Preview::set_layers_slider_values_range(), switch_one_layer_mode(), and Slic3r::GUI::Preview::update_layers_slider_from_canvas().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetManipulationMode()

void Slic3r::DoubleSlider::Control::SetManipulationMode ( Mode  mode)
inline
254{ m_mode = mode; }

References m_mode.

◆ SetMaxValue()

void Slic3r::DoubleSlider::Control::SetMaxValue ( const int  max_value)
254{
255 m_max_value = max_value;
256 Refresh();
257 Update();
258}

References m_max_value.

Referenced by Slic3r::GUI::Preview::update_layers_slider(), and Slic3r::GUI::Preview::update_moves_slider().

+ Here is the caller graph for this function:

◆ SetModeAndOnlyExtruder()

void Slic3r::DoubleSlider::Control::SetModeAndOnlyExtruder ( const bool  is_one_extruder_printed_model,
const int  only_extruder 
)
451{
452 m_mode = !is_one_extruder_printed_model ? MultiExtruder :
453 only_extruder < 0 ? SingleExtruder :
455 if (!m_ticks.mode || (m_ticks.empty() && m_ticks.mode != m_mode))
457 m_only_extruder = only_extruder;
458
460
462}

References Slic3r::DoubleSlider::TickCodeInfo::empty(), m_is_wipe_tower, m_mode, m_only_extruder, m_ticks, Slic3r::DoubleSlider::TickCodeInfo::mode, Slic3r::CustomGCode::MultiAsSingle, Slic3r::CustomGCode::MultiExtruder, Slic3r::CustomGCode::SingleExtruder, and UseDefaultColors().

Referenced by Slic3r::GUI::Preview::update_layers_slider_mode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetSelectionSpan()

void Slic3r::DoubleSlider::Control::SetSelectionSpan ( const int  lower_val,
const int  higher_val 
)
239{
240 m_lower_value = std::max(lower_val, m_min_value);
241 m_higher_value = std::max(std::min(higher_val, m_max_value), m_lower_value);
243 m_is_one_layer = false;
244
245 Refresh();
246 Update();
247
248 wxCommandEvent e(wxEVT_SCROLL_CHANGED);
249 e.SetEventObject(this);
250 ProcessWindowEvent(e);
251}

References m_higher_value, m_is_one_layer, m_lower_value, m_max_value, and m_min_value.

Referenced by Slic3r::GUI::Preview::update_layers_slider(), and Slic3r::GUI::Preview::update_moves_slider().

+ Here is the caller graph for this function:

◆ SetSliderAlternateValues()

void Slic3r::DoubleSlider::Control::SetSliderAlternateValues ( const std::vector< double > &  values)
inline
244{ m_alternate_values = values; }

References m_alternate_values.

Referenced by Slic3r::GUI::Preview::update_moves_slider().

+ Here is the caller graph for this function:

◆ SetSliderValues()

void Slic3r::DoubleSlider::Control::SetSliderValues ( const std::vector< double > &  values)
261{
262 m_values = values;
264
265 // When "No sparce layer" is enabled, use m_layers_values for ruler update.
266 // Because of m_values has duplicate values in this case.
267// m_ruler.update(this->GetParent(), m_layers_values.empty() ? m_values : m_layers_values, get_scroll_step());
268}
void init(const std::vector< double > &values, double scroll_step)
Definition DoubleSlider.cpp:1040

References get_scroll_step(), Slic3r::DoubleSlider::Control::Ruler::init(), m_ruler, and m_values.

Referenced by Slic3r::GUI::Preview::update_layers_slider(), and Slic3r::GUI::Preview::update_moves_slider().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetTicksValues()

void Slic3r::DoubleSlider::Control::SetTicksValues ( const Info custom_gcode_per_print_z)
373{
374 if (m_values.empty()) {
376 return;
377 }
378
379 const bool was_empty = m_ticks.empty();
380
381 m_ticks.ticks.clear();
382 const std::vector<CustomGCode::Item>& heights = custom_gcode_per_print_z.gcodes;
383 for (auto h : heights) {
384 int tick = get_tick_from_value(h.print_z);
385 if (tick >=0)
386 m_ticks.ticks.emplace(TickCode{ tick, h.type, h.extruder, h.color, h.extra });
387 }
388
389 if (!was_empty && m_ticks.empty())
390 // Switch to the "Feature type"/"Tool" from the very beginning of a new object slicing after deleting of the old one
392
393 // init extruder sequence in respect to the extruders count
394 if (m_ticks.empty())
396
397 if (custom_gcode_per_print_z.mode && !custom_gcode_per_print_z.gcodes.empty())
398 m_ticks.mode = custom_gcode_per_print_z.mode;
399
400 Refresh();
401 Update();
402}
void init(size_t extruders_count)
Definition DoubleSlider.hpp:195

References Slic3r::DoubleSlider::TickCodeInfo::empty(), Slic3r::CustomGCode::Info::gcodes, get_tick_from_value(), Slic3r::DoubleSlider::ExtrudersSequence::init(), m_extruder_colors, m_extruders_sequence, m_mode, m_ticks, m_values, Slic3r::CustomGCode::Info::mode, Slic3r::DoubleSlider::TickCodeInfo::mode, post_ticks_changed_event(), Slic3r::DoubleSlider::TickCodeInfo::ticks, and Slic3r::DoubleSlider::TickCode::type.

Referenced by Slic3r::GUI::Preview::update_layers_slider().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_add_context_menu()

void Slic3r::DoubleSlider::Control::show_add_context_menu ( )
2033{
2034 wxMenu menu;
2035
2036 if (m_mode == SingleExtruder) {
2037 append_menu_item(&menu, wxID_ANY, _L("Add color change") + " (" + gcode(ColorChange) + ")", "",
2038 [this](wxCommandEvent&) { add_code_as_tick(ColorChange); }, "colorchange_add_m", &menu);
2039
2040 UseDefaultColors(false);
2041 }
2042 else {
2045 }
2046
2047 if (!gcode(PausePrint).empty())
2048 append_menu_item(&menu, wxID_ANY, _L("Add pause print") + " (" + gcode(PausePrint) + ")", "",
2049 [this](wxCommandEvent&) { add_code_as_tick(PausePrint); }, "pause_print", &menu);
2050
2051 if (!gcode(Template).empty())
2052 append_menu_item(&menu, wxID_ANY, _L("Add custom template") + " (" + gcode(Template) + ")", "",
2053 [this](wxCommandEvent&) { add_code_as_tick(Template); }, "edit_gcode", &menu);
2054
2055 append_menu_item(&menu, wxID_ANY, _L("Add custom G-code"), "",
2056 [this](wxCommandEvent&) { add_code_as_tick(Custom); }, "edit_gcode", &menu);
2057
2058 GUI::wxGetApp().plater()->PopupMenu(&menu);
2059}
@ Custom
Definition CustomGCode.hpp:19

References _L, add_code_as_tick(), append_add_color_change_menu_item(), append_change_extruder_menu_item(), append_menu_item(), Slic3r::CustomGCode::ColorChange, Slic3r::CustomGCode::Custom, Slic3r::empty(), Slic3r::DoubleSlider::gcode(), m_mode, Slic3r::CustomGCode::PausePrint, Slic3r::CustomGCode::SingleExtruder, Slic3r::CustomGCode::Template, and UseDefaultColors().

Referenced by OnRightUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_cog_icon_context_menu()

void Slic3r::DoubleSlider::Control::show_cog_icon_context_menu ( )
2091{
2092 wxMenu menu;
2093
2094 append_menu_item(&menu, wxID_ANY, _L("Jump to height") + " (Shift+G)", "",
2095 [this](wxCommandEvent&) { jump_to_value(); }, "", & menu);
2096
2097 wxMenu* ruler_mode_menu = new wxMenu();
2098 if (ruler_mode_menu) {
2099 append_menu_check_item(ruler_mode_menu, wxID_ANY, _L("None"), _L("Hide ruler"),
2100 [this](wxCommandEvent&) { if (m_extra_style != 0) m_extra_style = 0; }, ruler_mode_menu,
2101 []() { return true; }, [this]() { return m_extra_style == 0; }, GUI::wxGetApp().plater());
2102
2103 append_menu_check_item(ruler_mode_menu, wxID_ANY, _L("Show object height"), _L("Show object height on the ruler"),
2104 [this](wxCommandEvent&) { m_extra_style & wxSL_AUTOTICKS ? m_extra_style ^= wxSL_AUTOTICKS : m_extra_style |= wxSL_AUTOTICKS; }, ruler_mode_menu,
2105 []() { return true; }, [this]() { return m_extra_style & wxSL_AUTOTICKS; }, GUI::wxGetApp().plater());
2106
2107 append_menu_check_item(ruler_mode_menu, wxID_ANY, _L("Show estimated print time"), _L("Show estimated print time on the ruler"),
2108 [this](wxCommandEvent&) { m_extra_style & wxSL_VALUE_LABEL ? m_extra_style ^= wxSL_VALUE_LABEL : m_extra_style |= wxSL_VALUE_LABEL; }, ruler_mode_menu,
2109 []() { return true; }, [this]() { return m_extra_style & wxSL_VALUE_LABEL; }, GUI::wxGetApp().plater());
2110
2111 append_submenu(&menu, ruler_mode_menu, wxID_ANY, _L("Ruler mode"), _L("Set ruler mode"), "",
2112 []() { return true; }, this);
2113 }
2114
2116 append_menu_item(&menu, wxID_ANY, _L("Set extruder sequence for the entire print"), "",
2117 [this](wxCommandEvent&) { edit_extruder_sequence(); }, "", &menu);
2118
2119 if (GUI::wxGetApp().is_editor() && m_mode != MultiExtruder && m_draw_mode == dmRegular)
2120 append_menu_item(&menu, wxID_ANY, _L("Set auto color changes"), "",
2121 [this](wxCommandEvent&) { auto_color_change(); }, "", &menu);
2122
2123 GUI::wxGetApp().plater()->PopupMenu(&menu);
2124}
void auto_color_change()
Definition DoubleSlider.cpp:2152
void edit_extruder_sequence()
Definition DoubleSlider.cpp:2486
wxMenuItem * append_menu_check_item(wxMenu *menu, int id, const wxString &string, const wxString &description, std::function< void(wxCommandEvent &event)> cb, wxEvtHandler *event_handler, std::function< bool()> const enable_condition, std::function< bool()> const check_condition, wxWindow *parent)
Definition wxExtensions.cpp:147

References _L, append_menu_check_item(), append_menu_item(), append_submenu(), auto_color_change(), Slic3r::DoubleSlider::dmRegular, edit_extruder_sequence(), jump_to_value(), m_draw_mode, m_extra_style, m_mode, Slic3r::CustomGCode::MultiAsSingle, and Slic3r::CustomGCode::MultiExtruder.

Referenced by OnLeftUp(), and OnRightUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_edit_context_menu()

void Slic3r::DoubleSlider::Control::show_edit_context_menu ( )
2062{
2063 wxMenu menu;
2064
2065 std::set<TickCode>::iterator it = m_ticks.ticks.find(TickCode{ m_selection == ssLower ? m_lower_value : m_higher_value });
2066
2067 if (it->type == ToolChange) {
2068 if (m_mode == MultiAsSingle)
2071 }
2072 else
2073 append_menu_item(&menu, wxID_ANY, it->type == ColorChange ? _L("Edit color") :
2074 it->type == PausePrint ? _L("Edit pause print message") :
2075 _L("Edit custom G-code"), "",
2076 [this](wxCommandEvent&) { edit_tick(); }, "edit_uni", &menu);
2077
2078 if (it->type == ColorChange && m_mode == MultiAsSingle)
2080
2081 append_menu_item(&menu, wxID_ANY, it->type == ColorChange ? _L("Delete color change") :
2082 it->type == ToolChange ? _L("Delete tool change") :
2083 it->type == PausePrint ? _L("Delete pause print") :
2084 _L("Delete custom G-code"), "",
2085 [this](wxCommandEvent&) { delete_current_tick();}, "colorchange_del_f", &menu);
2086
2087 GUI::wxGetApp().plater()->PopupMenu(&menu);
2088}

References _L, append_add_color_change_menu_item(), append_change_extruder_menu_item(), append_menu_item(), Slic3r::CustomGCode::ColorChange, delete_current_tick(), edit_tick(), m_higher_value, m_lower_value, m_mode, m_selection, m_ticks, Slic3r::CustomGCode::MultiAsSingle, Slic3r::CustomGCode::PausePrint, Slic3r::DoubleSlider::ssLower, Slic3r::DoubleSlider::TickCodeInfo::ticks, and Slic3r::CustomGCode::ToolChange.

Referenced by OnRightUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ switch_one_layer_mode()

void Slic3r::DoubleSlider::Control::switch_one_layer_mode ( )

References correct_higher_value(), correct_lower_value(), m_is_one_layer, m_max_value, m_min_value, m_selection, SetHigherValue(), SetLowerValue(), Slic3r::DoubleSlider::ssHigher, Slic3r::DoubleSlider::ssLower, and Slic3r::DoubleSlider::ssUndef.

Referenced by OnLeftUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sys_color_changed()

void Slic3r::DoubleSlider::Control::sys_color_changed ( )

References m_bmp_add_tick_off, m_bmp_add_tick_on, m_bmp_cog, m_bmp_del_tick_off, m_bmp_del_tick_on, m_bmp_one_layer_lock_off, m_bmp_one_layer_lock_on, m_bmp_one_layer_unlock_off, m_bmp_one_layer_unlock_on, m_bmp_revert, and ScalableBitmap::sys_color_changed().

Referenced by Slic3r::GUI::Preview::sys_color_changed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_thumb_rect()

void Slic3r::DoubleSlider::Control::update_thumb_rect ( const wxCoord  begin_x,
const wxCoord  begin_y,
const SelectedSlider selection 
)
protected
1314{
1315 const wxRect rect = is_horizontal() ?
1316 wxRect(begin_x + (selection == ssHigher ? m_thumb_size.x / 2 : 0), begin_y, m_thumb_size.x / 2, m_thumb_size.y) :
1317 wxRect(begin_x, begin_y + (selection == ssLower ? m_thumb_size.y / 2 : 0), m_thumb_size.x, m_thumb_size.y / 2);
1318
1319 if (selection == ssLower)
1320 m_rect_lower_thumb = rect;
1321 else
1322 m_rect_higher_thumb = rect;
1323}

References is_horizontal(), m_rect_higher_thumb, m_rect_lower_thumb, m_thumb_size, Slic3r::DoubleSlider::ssHigher, and Slic3r::DoubleSlider::ssLower.

Referenced by draw_thumb_item().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UseDefaultColors()

void Slic3r::DoubleSlider::Control::UseDefaultColors ( bool  def_colors_on)
inline
276{ m_ticks.set_default_colors(def_colors_on); }
void set_default_colors(bool default_colors_on)
Definition DoubleSlider.hpp:149

References m_ticks, and Slic3r::DoubleSlider::TickCodeInfo::set_default_colors().

Referenced by Slic3r::GUI::Preview::create_layers_slider_sizer(), OnKeyDown(), OnKeyUp(), SetModeAndOnlyExtruder(), show_add_context_menu(), and Slic3r::GUI::Preview::update_layers_slider_from_canvas().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ DARK_GREY_PEN

wxPen Slic3r::DoubleSlider::Control::DARK_GREY_PEN
private

Referenced by Control(), and draw_ticks().

◆ DARK_ORANGE_PEN

wxPen Slic3r::DoubleSlider::Control::DARK_ORANGE_PEN
private

◆ FOCUS_RECT_BRUSH

wxBrush Slic3r::DoubleSlider::Control::FOCUS_RECT_BRUSH
private

Referenced by Control(), and draw_focus_rect().

◆ FOCUS_RECT_PEN

wxPen Slic3r::DoubleSlider::Control::FOCUS_RECT_PEN
private

Referenced by Control(), and draw_focus_rect().

◆ GREY_PEN

wxPen Slic3r::DoubleSlider::Control::GREY_PEN
private

◆ is_osx

bool Slic3r::DoubleSlider::Control::is_osx { false }
private

Referenced by Control(), and get_tooltip().

◆ LIGHT_GREY_PEN

wxPen Slic3r::DoubleSlider::Control::LIGHT_GREY_PEN
private

◆ LIGHT_ORANGE_PEN

wxPen Slic3r::DoubleSlider::Control::LIGHT_ORANGE_PEN
private

Referenced by Control().

◆ m_alternate_values

std::vector<double> Slic3r::DoubleSlider::Control::m_alternate_values
private

◆ m_bmp_add_tick_off

ScalableBitmap Slic3r::DoubleSlider::Control::m_bmp_add_tick_off
private

◆ m_bmp_add_tick_on

ScalableBitmap Slic3r::DoubleSlider::Control::m_bmp_add_tick_on
private

◆ m_bmp_cog

ScalableBitmap Slic3r::DoubleSlider::Control::m_bmp_cog
private

◆ m_bmp_del_tick_off

ScalableBitmap Slic3r::DoubleSlider::Control::m_bmp_del_tick_off
private

◆ m_bmp_del_tick_on

ScalableBitmap Slic3r::DoubleSlider::Control::m_bmp_del_tick_on
private

◆ m_bmp_one_layer_lock_off

ScalableBitmap Slic3r::DoubleSlider::Control::m_bmp_one_layer_lock_off
private

◆ m_bmp_one_layer_lock_on

ScalableBitmap Slic3r::DoubleSlider::Control::m_bmp_one_layer_lock_on
private

◆ m_bmp_one_layer_unlock_off

ScalableBitmap Slic3r::DoubleSlider::Control::m_bmp_one_layer_unlock_off
private

◆ m_bmp_one_layer_unlock_on

ScalableBitmap Slic3r::DoubleSlider::Control::m_bmp_one_layer_unlock_on
private

◆ m_bmp_revert

ScalableBitmap Slic3r::DoubleSlider::Control::m_bmp_revert
private

◆ m_bmp_thumb_higher

ScalableBitmap Slic3r::DoubleSlider::Control::m_bmp_thumb_higher
private

Referenced by Control(), and draw_thumb_item().

◆ m_bmp_thumb_lower

ScalableBitmap Slic3r::DoubleSlider::Control::m_bmp_thumb_lower
private

◆ m_cog_icon_dim

int Slic3r::DoubleSlider::Control::m_cog_icon_dim
private

Referenced by Control(), draw_cog_icon(), and msw_rescale().

◆ m_draw_mode

◆ m_enable_action_icon

bool Slic3r::DoubleSlider::Control::m_enable_action_icon = true
private

◆ m_extra_style

long Slic3r::DoubleSlider::Control::m_extra_style
private

◆ m_extruder_colors

std::vector<std::string> Slic3r::DoubleSlider::Control::m_extruder_colors
private

◆ m_extruders_sequence

ExtrudersSequence Slic3r::DoubleSlider::Control::m_extruders_sequence

◆ m_focus

FocusedItem Slic3r::DoubleSlider::Control::m_focus = fiNone
private

◆ m_font

wxFont Slic3r::DoubleSlider::Control::m_font
private

Referenced by Control(), msw_rescale(), and render().

◆ m_force_mode_apply

bool Slic3r::DoubleSlider::Control::m_force_mode_apply = true
private

Referenced by GetTicksValues().

◆ m_higher_value

◆ m_is_focused

bool Slic3r::DoubleSlider::Control::m_is_focused = false
private

◆ m_is_left_down

bool Slic3r::DoubleSlider::Control::m_is_left_down = false
private

◆ m_is_one_layer

◆ m_is_right_down

bool Slic3r::DoubleSlider::Control::m_is_right_down = false
private

Referenced by OnMotion(), OnRightDown(), and OnRightUp().

◆ m_is_wipe_tower

bool Slic3r::DoubleSlider::Control::m_is_wipe_tower = false
private

◆ m_label_koef

float Slic3r::DoubleSlider::Control::m_label_koef { 1.0 }
private

Referenced by get_label(), and SetKoefForLabels().

◆ m_layers_times

std::vector<double> Slic3r::DoubleSlider::Control::m_layers_times
private

◆ m_layers_values

std::vector<double> Slic3r::DoubleSlider::Control::m_layers_values
private

◆ m_line_pens

std::vector<wxPen*> Slic3r::DoubleSlider::Control::m_line_pens
private

Referenced by Control(), and draw_scroll_line().

◆ m_lock_icon_dim

int Slic3r::DoubleSlider::Control::m_lock_icon_dim
private

◆ m_lower_value

◆ m_max_value

◆ m_min_value

◆ m_mode

◆ m_mouse

MouseAction Slic3r::DoubleSlider::Control::m_mouse = maNone
private

◆ m_moving_pos

wxPoint Slic3r::DoubleSlider::Control::m_moving_pos = wxDefaultPosition
private

◆ m_only_extruder

◆ m_print_obj_idxs

std::string Slic3r::DoubleSlider::Control::m_print_obj_idxs
private

Referenced by IsNewPrint().

◆ m_rect_cog_icon

wxRect Slic3r::DoubleSlider::Control::m_rect_cog_icon
private

◆ m_rect_higher_thumb

wxRect Slic3r::DoubleSlider::Control::m_rect_higher_thumb
private

◆ m_rect_lower_thumb

wxRect Slic3r::DoubleSlider::Control::m_rect_lower_thumb
private

◆ m_rect_one_layer_icon

wxRect Slic3r::DoubleSlider::Control::m_rect_one_layer_icon
private

◆ m_rect_revert_icon

wxRect Slic3r::DoubleSlider::Control::m_rect_revert_icon
private

◆ m_rect_tick_action

wxRect Slic3r::DoubleSlider::Control::m_rect_tick_action
private

◆ m_render_as_disabled

bool Slic3r::DoubleSlider::Control::m_render_as_disabled { false }
private

◆ m_revert_icon_dim

int Slic3r::DoubleSlider::Control::m_revert_icon_dim
private

◆ m_ruler

class Slic3r::DoubleSlider::Control::Ruler Slic3r::DoubleSlider::Control::m_ruler
private

◆ m_segm_pens

std::vector<wxPen*> Slic3r::DoubleSlider::Control::m_segm_pens
private

Referenced by Control(), and draw_scroll_line().

◆ m_selection

◆ m_style

long Slic3r::DoubleSlider::Control::m_style
private

Referenced by get_scroll_step(), and is_horizontal().

◆ m_thumb_size

◆ m_tick_icon_dim

int Slic3r::DoubleSlider::Control::m_tick_icon_dim
private

◆ m_ticks

◆ m_values

◆ ORANGE_PEN

wxPen Slic3r::DoubleSlider::Control::ORANGE_PEN
private

Referenced by Control().

◆ SLIDER_MARGIN


The documentation for this class was generated from the following files: