Merge branch 'master' of https://github.com/prusa3d/Slic3r into svg_icons
This commit is contained in:
commit
76ee51fe8a
3 changed files with 39 additions and 15 deletions
|
@ -637,12 +637,25 @@ void Preview::update_double_slider(const std::vector<double>& layers_z, bool for
|
||||||
|
|
||||||
const auto& config = wxGetApp().preset_bundle->project_config;
|
const auto& config = wxGetApp().preset_bundle->project_config;
|
||||||
const std::vector<double> &ticks_from_config = (config.option<ConfigOptionFloats>("colorprint_heights"))->values;
|
const std::vector<double> &ticks_from_config = (config.option<ConfigOptionFloats>("colorprint_heights"))->values;
|
||||||
|
|
||||||
|
// Switch to the "Feature type" from the very beginning of a new object slicing after deleting of the old one
|
||||||
|
if (ticks_from_config.empty())
|
||||||
|
{
|
||||||
|
const int& type = m_choice_view_type->FindString(_(L("Feature type")));
|
||||||
|
if (m_choice_view_type->GetSelection() != type) {
|
||||||
|
m_choice_view_type->SetSelection(type);
|
||||||
|
if (0 <= type && type < int(GCodePreviewData::Extrusion::Num_View_Types))
|
||||||
|
m_gcode_preview_data->extrusion.view_type = GCodePreviewData::Extrusion::EViewType(type);
|
||||||
|
m_preferred_color_mode = "feature";
|
||||||
|
reload_print();
|
||||||
|
}
|
||||||
|
}
|
||||||
m_slider->SetTicksValues(ticks_from_config);
|
m_slider->SetTicksValues(ticks_from_config);
|
||||||
|
|
||||||
bool color_print_enable = (wxGetApp().plater()->printer_technology() == ptFFF);
|
bool color_print_enable = (wxGetApp().plater()->printer_technology() == ptFFF);
|
||||||
if (color_print_enable) {
|
if (color_print_enable) {
|
||||||
const auto& config = wxGetApp().preset_bundle->full_config();
|
const auto& cfg = wxGetApp().preset_bundle->full_config();
|
||||||
if (config.opt<ConfigOptionFloats>("nozzle_diameter")->values.size() > 1)
|
if (cfg.opt<ConfigOptionFloats>("nozzle_diameter")->values.size() > 1)
|
||||||
color_print_enable = false;
|
color_print_enable = false;
|
||||||
}
|
}
|
||||||
m_slider->EnableTickManipulation(color_print_enable);
|
m_slider->EnableTickManipulation(color_print_enable);
|
||||||
|
|
|
@ -1432,9 +1432,11 @@ PrusaDoubleSlider::PrusaDoubleSlider(wxWindow *parent,
|
||||||
m_min_value(minValue), m_max_value(maxValue),
|
m_min_value(minValue), m_max_value(maxValue),
|
||||||
m_style(style == wxSL_HORIZONTAL || style == wxSL_VERTICAL ? style: wxSL_HORIZONTAL)
|
m_style(style == wxSL_HORIZONTAL || style == wxSL_VERTICAL ? style: wxSL_HORIZONTAL)
|
||||||
{
|
{
|
||||||
#ifndef __WXOSX__ // SetDoubleBuffered exists on Win and Linux/GTK, but is missing on OSX
|
#ifdef __WXOSX__
|
||||||
SetDoubleBuffered(true);
|
is_osx = true;
|
||||||
#endif //__WXOSX__
|
#endif //__WXOSX__
|
||||||
|
if (!is_osx)
|
||||||
|
SetDoubleBuffered(true);// SetDoubleBuffered exists on Win and Linux/GTK, but is missing on OSX
|
||||||
|
|
||||||
m_bmp_thumb_higher = wxBitmap(create_scaled_bitmap(style == wxSL_HORIZONTAL ? "right_half_circle.png" : "up_half_circle.png"));
|
m_bmp_thumb_higher = wxBitmap(create_scaled_bitmap(style == wxSL_HORIZONTAL ? "right_half_circle.png" : "up_half_circle.png"));
|
||||||
m_bmp_thumb_lower = wxBitmap(create_scaled_bitmap(style == wxSL_HORIZONTAL ? "left_half_circle.png" : "down_half_circle.png"));
|
m_bmp_thumb_lower = wxBitmap(create_scaled_bitmap(style == wxSL_HORIZONTAL ? "left_half_circle.png" : "down_half_circle.png"));
|
||||||
|
@ -1480,6 +1482,10 @@ PrusaDoubleSlider::PrusaDoubleSlider(wxWindow *parent,
|
||||||
|
|
||||||
line_pens = { &DARK_GREY_PEN, &GREY_PEN, &LIGHT_GREY_PEN };
|
line_pens = { &DARK_GREY_PEN, &GREY_PEN, &LIGHT_GREY_PEN };
|
||||||
segm_pens = { &DARK_ORANGE_PEN, &ORANGE_PEN, &LIGHT_ORANGE_PEN };
|
segm_pens = { &DARK_ORANGE_PEN, &ORANGE_PEN, &LIGHT_ORANGE_PEN };
|
||||||
|
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
const wxFont& font = dc.GetFont();
|
||||||
|
m_font = is_osx ? font.Smaller().Smaller() : font.Smaller();
|
||||||
}
|
}
|
||||||
|
|
||||||
int PrusaDoubleSlider::GetActiveValue() const
|
int PrusaDoubleSlider::GetActiveValue() const
|
||||||
|
@ -1494,7 +1500,9 @@ wxSize PrusaDoubleSlider::DoGetBestSize() const
|
||||||
const wxSize size = wxControl::DoGetBestSize();
|
const wxSize size = wxControl::DoGetBestSize();
|
||||||
if (size.x > 1 && size.y > 1)
|
if (size.x > 1 && size.y > 1)
|
||||||
return size;
|
return size;
|
||||||
const int new_size = is_horizontal() ? 6 * Slic3r::GUI::wxGetApp().em_unit() : 8 * Slic3r::GUI::wxGetApp().em_unit();
|
const int new_size = is_horizontal() ?
|
||||||
|
(is_osx ? 8 : 6) * Slic3r::GUI::wxGetApp().em_unit() :
|
||||||
|
(is_osx ? 10 : 8) * Slic3r::GUI::wxGetApp().em_unit();
|
||||||
return wxSize(new_size, new_size);
|
return wxSize(new_size, new_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1558,7 +1566,7 @@ void PrusaDoubleSlider::draw_scroll_line(wxDC& dc, const int lower_pos, const in
|
||||||
wxCoord line_end_y = is_horizontal() ? height*0.5 - 1 : height - SLIDER_MARGIN + 1;
|
wxCoord line_end_y = is_horizontal() ? height*0.5 - 1 : height - SLIDER_MARGIN + 1;
|
||||||
|
|
||||||
wxCoord segm_beg_x = is_horizontal() ? lower_pos : width*0.5 - 1;
|
wxCoord segm_beg_x = is_horizontal() ? lower_pos : width*0.5 - 1;
|
||||||
wxCoord segm_beg_y = is_horizontal() ? height*0.5 - 1 : lower_pos-1;
|
wxCoord segm_beg_y = is_horizontal() ? height*0.5 - 1 : lower_pos/*-1*/;
|
||||||
wxCoord segm_end_x = is_horizontal() ? higher_pos : width*0.5 - 1;
|
wxCoord segm_end_x = is_horizontal() ? higher_pos : width*0.5 - 1;
|
||||||
wxCoord segm_end_y = is_horizontal() ? height*0.5 - 1 : higher_pos-1;
|
wxCoord segm_end_y = is_horizontal() ? height*0.5 - 1 : higher_pos-1;
|
||||||
|
|
||||||
|
@ -1619,8 +1627,11 @@ std::vector<double> PrusaDoubleSlider::GetTicksValues() const
|
||||||
std::vector<double> values;
|
std::vector<double> values;
|
||||||
|
|
||||||
if (!m_values.empty())
|
if (!m_values.empty())
|
||||||
for (auto tick : m_ticks)
|
for (auto tick : m_ticks) {
|
||||||
|
if (tick > m_values.size())
|
||||||
|
break;
|
||||||
values.push_back(m_values[tick].second);
|
values.push_back(m_values[tick].second);
|
||||||
|
}
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
@ -1673,9 +1684,7 @@ void PrusaDoubleSlider::render()
|
||||||
draw_focus_rect();
|
draw_focus_rect();
|
||||||
|
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
wxFont font = dc.GetFont();
|
dc.SetFont(m_font);
|
||||||
const wxFont smaller_font = font.Smaller();
|
|
||||||
dc.SetFont(smaller_font);
|
|
||||||
|
|
||||||
const wxCoord lower_pos = get_position_from_value(m_lower_value);
|
const wxCoord lower_pos = get_position_from_value(m_lower_value);
|
||||||
const wxCoord higher_pos = get_position_from_value(m_higher_value);
|
const wxCoord higher_pos = get_position_from_value(m_higher_value);
|
||||||
|
@ -1727,8 +1736,8 @@ void PrusaDoubleSlider::draw_info_line_with_icon(wxDC& dc, const wxPoint& pos, c
|
||||||
if (m_selection == selection) {
|
if (m_selection == selection) {
|
||||||
//draw info line
|
//draw info line
|
||||||
dc.SetPen(DARK_ORANGE_PEN);
|
dc.SetPen(DARK_ORANGE_PEN);
|
||||||
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);
|
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*/);
|
||||||
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);
|
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*/);
|
||||||
dc.DrawLine(pt_beg, pt_end);
|
dc.DrawLine(pt_beg, pt_end);
|
||||||
|
|
||||||
//draw action icon
|
//draw action icon
|
||||||
|
@ -1779,7 +1788,7 @@ void PrusaDoubleSlider::draw_thumb_item(wxDC& dc, const wxPoint& pos, const Sele
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x_draw = pos.x - int(0.5*m_thumb_size.x);
|
x_draw = pos.x - int(0.5*m_thumb_size.x);
|
||||||
y_draw = pos.y;
|
y_draw = pos.y+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -1850,9 +1859,9 @@ void PrusaDoubleSlider::draw_ticks(wxDC& dc)
|
||||||
const wxCoord pos = get_position_from_value(tick);
|
const wxCoord pos = get_position_from_value(tick);
|
||||||
|
|
||||||
is_horizontal() ? dc.DrawLine(pos, mid-14, pos, mid-9) :
|
is_horizontal() ? dc.DrawLine(pos, mid-14, pos, mid-9) :
|
||||||
dc.DrawLine(mid - 14, pos - 1, mid - 9, pos - 1);
|
dc.DrawLine(mid - 14, pos/* - 1*/, mid - 9, pos/* - 1*/);
|
||||||
is_horizontal() ? dc.DrawLine(pos, mid+14, pos, mid+9) :
|
is_horizontal() ? dc.DrawLine(pos, mid+14, pos, mid+9) :
|
||||||
dc.DrawLine(mid + 14, pos - 1, mid + 9, pos - 1);
|
dc.DrawLine(mid + 14, pos/* - 1*/, mid + 9, pos/* - 1*/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -791,6 +791,8 @@ protected:
|
||||||
double get_double_value(const SelectedSlider& selection);
|
double get_double_value(const SelectedSlider& selection);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool is_osx { false };
|
||||||
|
wxFont m_font;
|
||||||
int m_min_value;
|
int m_min_value;
|
||||||
int m_max_value;
|
int m_max_value;
|
||||||
int m_lower_value;
|
int m_lower_value;
|
||||||
|
|
Loading…
Reference in a new issue