This commit is contained in:
bubnikv 2019-01-10 18:08:46 +01:00
commit 3d2c7f05ee
4 changed files with 58 additions and 1 deletions

View File

@ -115,6 +115,7 @@ void KBShortcutsDialog::fill_shortcuts()
main_shortcuts.push_back(Shortcut(ctrl+"5" ,L("Switch to 3D")));
main_shortcuts.push_back(Shortcut(ctrl+"6" ,L("Switch to Preview")));
main_shortcuts.push_back(Shortcut(ctrl+"P" ,L("Preferences")));
main_shortcuts.push_back(Shortcut(ctrl+"J" ,L("Print host upload queue")));
main_shortcuts.push_back(Shortcut("0-6" ,L("Camera view ")));
main_shortcuts.push_back(Shortcut("+" ,L("Add Instance to selected object ")));
main_shortcuts.push_back(Shortcut("-" ,L("Remove Instance from selected object")));

View File

@ -363,7 +363,7 @@ void MainFrame::init_menubar()
#endif // _WIN32
windowMenu->AppendSeparator();
append_menu_item(windowMenu, wxID_ANY, L("Print Host Upload Queue"), L("Display the Print Host Upload Queue window"),
append_menu_item(windowMenu, wxID_ANY, L("Print Host Upload Queue\tCtrl+J"), L("Display the Print Host Upload Queue window"),
[this](wxCommandEvent&) { m_printhost_queue_dlg->Show(); }, "arrow_up.png");
}

View File

@ -12,6 +12,7 @@
#include "GUI.hpp"
#include "GUI_App.hpp"
#include "GUI_ObjectList.hpp"
#include "libslic3r/GCode/PreviewData.hpp"
using Slic3r::GUI::from_u8;
@ -1665,6 +1666,10 @@ void PrusaDoubleSlider::render()
const wxCoord lower_pos = get_position_from_value(m_lower_value);
const wxCoord higher_pos = get_position_from_value(m_higher_value);
// draw colored band on the background of a scroll line
// and only in a case of no-empty m_values
draw_colored_band(dc);
// draw line
draw_scroll_line(dc, lower_pos, higher_pos);
@ -1837,6 +1842,56 @@ void PrusaDoubleSlider::draw_ticks(wxDC& dc)
}
}
void PrusaDoubleSlider::draw_colored_band(wxDC& dc)
{
int height, width;
get_size(&width, &height);
wxRect main_band = m_rect_lower_thumb;
if (is_horizontal()) {
main_band.SetLeft(SLIDER_MARGIN);
main_band.SetRight(width - SLIDER_MARGIN + 1);
}
else {
const int cut = 2;
main_band.x += cut;
main_band.width -= 2*cut;
main_band.SetTop(SLIDER_MARGIN);
main_band.SetBottom(height - SLIDER_MARGIN + 1);
}
if (m_ticks.empty()) {
dc.SetPen(GetParent()->GetBackgroundColour());
dc.SetBrush(GetParent()->GetBackgroundColour());
dc.DrawRectangle(main_band);
return;
}
const std::vector<unsigned char>& clr_bytes = Slic3r::GCodePreviewData::Range::Default_Colors[0].as_bytes();
wxColour clr = wxColour(clr_bytes[0], clr_bytes[1], clr_bytes[2], clr_bytes[3]);
dc.SetPen(clr);
dc.SetBrush(clr);
dc.DrawRectangle(main_band);
int i = 1;
for (auto tick : m_ticks)
{
if (i == Slic3r::GCodePreviewData::Range::Colors_Count)
i = 0;
const wxCoord pos = get_position_from_value(tick);
is_horizontal() ? main_band.SetLeft(SLIDER_MARGIN + pos) :
main_band.SetBottom(pos-1);
const std::vector<unsigned char>& clr_b = Slic3r::GCodePreviewData::Range::Default_Colors[i].as_bytes();
clr = wxColour(clr_b[0], clr_b[1], clr_b[2], clr_b[3]);
dc.SetPen(clr);
dc.SetBrush(clr);
dc.DrawRectangle(main_band);
i++;
}
}
void PrusaDoubleSlider::draw_one_layer_icon(wxDC& dc)
{
wxBitmap* icon = m_is_one_layer ?

View File

@ -756,6 +756,7 @@ protected:
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(wxDC& dc);
void draw_colored_band(wxDC& dc);
void draw_one_layer_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);