From 2a896e6ba1ee0d01bc3448d54ebc2ab08fcf6609 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 10 Jan 2019 17:24:23 +0100 Subject: [PATCH 1/2] Added a colored band for DoubleSlider --- src/slic3r/GUI/wxExtensions.cpp | 55 +++++++++++++++++++++++++++++++++ src/slic3r/GUI/wxExtensions.hpp | 1 + 2 files changed, 56 insertions(+) diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 01c61899e..cec19427f 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -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& 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& 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 ? diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index d151a7afa..fcce18e10 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -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); From 6fc1e5e6b60cb5ba6f6192e870eb0dcd8b154834 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Thu, 10 Jan 2019 17:52:14 +0100 Subject: [PATCH 2/2] PrintHost: Add upload queue keyboard shortcut --- src/slic3r/GUI/KBShortcutsDialog.cpp | 1 + src/slic3r/GUI/MainFrame.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index 303f3dae8..939301635 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -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"))); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 6181010cf..e7b44aab0 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -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"); }