Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_gcode_viewer

This commit is contained in:
enricoturri1966 2020-05-25 07:07:49 +02:00
commit ed252f1741
24 changed files with 209 additions and 17 deletions

17
deps/CMakeLists.txt vendored
View File

@ -129,6 +129,19 @@ else()
include("deps-linux.cmake") include("deps-linux.cmake")
endif() endif()
# Patch the boost::polygon library with a custom one.
ExternalProject_Add(dep_boost_polygon
EXCLUDE_FROM_ALL ON
GIT_REPOSITORY "https://github.com/prusa3d/polygon"
GIT_TAG prusaslicer_gmp
DEPENDS dep_boost
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_BINARY_DIR}/dep_boost_polygon-prefix/src/dep_boost_polygon/include/boost/polygon"
"${DESTDIR}/usr/local/include/boost/polygon"
)
set(ZLIB_PKG "") set(ZLIB_PKG "")
if (NOT ZLIB_FOUND) if (NOT ZLIB_FOUND)
include(ZLIB/ZLIB.cmake) include(ZLIB/ZLIB.cmake)
@ -152,7 +165,7 @@ include(MPFR/MPFR.cmake)
include(CGAL/CGAL.cmake) include(CGAL/CGAL.cmake)
include(wxWidgets/wxWidgets.cmake) include(wxWidgets/wxWidgets.cmake)
if (ZLIB_PKG) if (NOT "${ZLIB_PKG}" STREQUAL "")
add_dependencies(dep_blosc ${ZLIB_PKG}) add_dependencies(dep_blosc ${ZLIB_PKG})
add_dependencies(dep_openexr ${ZLIB_PKG}) add_dependencies(dep_openexr ${ZLIB_PKG})
endif () endif ()
@ -162,6 +175,7 @@ if (MSVC)
add_custom_target(deps ALL add_custom_target(deps ALL
DEPENDS DEPENDS
dep_boost dep_boost
dep_boost_polygon
dep_tbb dep_tbb
dep_libcurl dep_libcurl
dep_wxWidgets dep_wxWidgets
@ -182,6 +196,7 @@ else()
add_custom_target(deps ALL add_custom_target(deps ALL
DEPENDS DEPENDS
dep_boost dep_boost
dep_boost_polygon
dep_tbb dep_tbb
dep_libcurl dep_libcurl
dep_wxWidgets dep_wxWidgets

17
resources/icons/cog_.svg Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<g id="machine_x2B_cog">
<path fill="#FFFFFF" d="M13.77,6.39c-0.13-0.47-0.32-0.92-0.55-1.33l0.43-1.3l-1.41-1.41l-1.3,0.43c-0.42-0.23-0.86-0.42-1.33-0.55
L9,1H7L6.39,2.23C5.92,2.36,5.47,2.54,5.06,2.78l-1.3-0.43L2.34,3.76l0.43,1.3C2.54,5.47,2.36,5.92,2.23,6.39L1,7v2l1.23,0.61
c0.13,0.47,0.32,0.92,0.55,1.33l-0.43,1.3l1.41,1.41l1.3-0.43c0.42,0.23,0.86,0.42,1.33,0.55L7,15h2l0.61-1.23
c0.47-0.13,0.92-0.32,1.33-0.55l1.3,0.43l1.41-1.41l-0.43-1.3c0.23-0.42,0.42-0.86,0.55-1.33L15,9V7L13.77,6.39z M8,13
c-2.76,0-5-2.24-5-5s2.24-5,5-5s5,2.24,5,5S10.76,13,8,13z"/>
<path fill="#ED6B21" d="M11.3,7.08c-0.07-0.27-0.18-0.52-0.31-0.76l0.25-0.74l-0.81-0.81L9.68,5.01C9.45,4.88,9.19,4.78,8.92,4.7
L8.57,4H7.43L7.08,4.7C6.81,4.78,6.55,4.88,6.32,5.01L5.58,4.77L4.77,5.58l0.25,0.74C4.88,6.55,4.78,6.81,4.7,7.08L4,7.43v1.14
l0.7,0.35c0.07,0.27,0.18,0.52,0.31,0.76l-0.25,0.74l0.81,0.81l0.74-0.25c0.24,0.13,0.49,0.24,0.76,0.31L7.43,12h1.14l0.35-0.7
c0.27-0.07,0.52-0.18,0.76-0.31l0.74,0.25l0.81-0.81l-0.25-0.74c0.13-0.24,0.24-0.49,0.31-0.76L12,8.57V7.43L11.3,7.08z M8,10.86
c-1.58,0-2.86-1.28-2.86-2.86S6.42,5.14,8,5.14S10.86,6.42,10.86,8S9.58,10.86,8,10.86z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<g>
<circle fill="#FFFFFF" cx="8" cy="8" r="3"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 400 B

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<g id="modifer_x5F_bed">
<line fill="none" stroke="#ED6B21" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="2" y1="13" x2="13" y2="13"/>
<path fill="#FFFFFF" d="M10.87,7.48c-0.2,0-0.37,0.16-0.37,0.37v1.47v0.74c0,0.2-0.17,0.37-0.37,0.37H4.97
c-0.2,0-0.37-0.17-0.37-0.37L4.57,4.91c0-0.1,0.04-0.19,0.11-0.26c0.07-0.07,0.16-0.11,0.26-0.11l2.25,0v0
c0.2,0,0.37-0.16,0.37-0.37c0-0.2-0.16-0.37-0.37-0.37H5.71c0,0-0.01,0-0.01,0l-0.76,0c-0.3,0-0.57,0.12-0.78,0.33
C3.95,4.34,3.83,4.61,3.83,4.91l0.03,5.15c0,0.61,0.5,1.1,1.11,1.1h5.16c0.61,0,1.11-0.5,1.11-1.11V9.32V7.85
C11.24,7.65,11.07,7.48,10.87,7.48z"/>
<circle fill="#FFFFFF" stroke="#FFFFFF" stroke-miterlimit="10" cx="10.88" cy="4.12" r="2.12"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<g id="edit_x5F_uni">
<path fill="#FFFFFF" d="M8,1.85l5.29,3.53V7v3.62L8,14.15l-5.29-3.53V7V5.38L8,1.85 M8,1L2,5v2v4l6,4l6-4V7V5L8,1L8,1z"/>
<path fill="#ED6B21" d="M11.87,7.36l-0.43-0.22c-0.07-0.04-0.16-0.13-0.18-0.21l-0.2-0.48c-0.04-0.07-0.04-0.2-0.02-0.28l0.15-0.46
c0.03-0.08,0-0.19-0.06-0.25l-0.6-0.6c-0.06-0.06-0.17-0.08-0.25-0.06L9.83,4.97c-0.08,0.03-0.2,0.02-0.28-0.02l-0.48-0.2
C8.99,4.72,8.89,4.64,8.85,4.57L8.64,4.13C8.6,4.06,8.5,4,8.42,4H7.58C7.5,4,7.4,4.06,7.36,4.13L7.15,4.57
C7.11,4.64,7.01,4.72,6.94,4.75l-0.48,0.2c-0.07,0.04-0.2,0.04-0.28,0.02L5.72,4.81c-0.08-0.03-0.19,0-0.25,0.06l-0.6,0.6
C4.82,5.53,4.79,5.64,4.81,5.72l0.15,0.46c0.03,0.08,0.02,0.2-0.02,0.28l-0.2,0.48C4.72,7.01,4.64,7.11,4.57,7.15L4.13,7.36
C4.06,7.4,4,7.5,4,7.58v0.84C4,8.5,4.06,8.6,4.13,8.64l0.43,0.22c0.07,0.04,0.16,0.13,0.18,0.21l0.2,0.48
c0.04,0.07,0.04,0.2,0.02,0.28l-0.15,0.46c-0.03,0.08,0,0.19,0.06,0.25l0.6,0.6c0.06,0.06,0.17,0.08,0.25,0.06l0.46-0.15
c0.08-0.03,0.2-0.02,0.28,0.02l0.48,0.2c0.08,0.03,0.17,0.11,0.21,0.18l0.22,0.43C7.4,11.94,7.5,12,7.58,12h0.84
c0.08,0,0.18-0.06,0.22-0.13l0.22-0.43c0.04-0.07,0.13-0.16,0.21-0.18l0.48-0.2c0.07-0.04,0.2-0.04,0.28-0.02l0.46,0.15
c0.08,0.03,0.19,0,0.25-0.06l0.6-0.6c0.06-0.06,0.08-0.17,0.06-0.25l-0.15-0.46c-0.03-0.08-0.02-0.2,0.02-0.28l0.2-0.48
c0.03-0.08,0.11-0.17,0.18-0.21l0.43-0.22C11.94,8.6,12,8.5,12,8.42V7.58C12,7.5,11.94,7.4,11.87,7.36z M8,10.29
c-1.26,0-2.29-1.03-2.29-2.29c0-1.26,1.03-2.29,2.29-2.29S10.29,6.74,10.29,8C10.29,9.26,9.26,10.29,8,10.29z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<g id="eye_x5F_close">
<path fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M2,8c0,0,2,4,6,4s6-4,6-4s-2-4-6-4S2,8,2,8z"/>
<circle fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="8" cy="8" r="1"/>
<line fill="none" stroke="#ED6B21" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="2" y1="14" x2="14" y2="2"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 856 B

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<g id="eye_x5F_open">
<path fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M2,8c0,0,2,4,6,4s6-4,6-4s-2-4-6-4S2,8,2,8z"/>
<circle fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="8" cy="8" r="1"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 697 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<g id="lock_x5F_closed">
<path fill="none" stroke="#FFFFFF" stroke-width="3" stroke-miterlimit="9" d="M4,8V4c0,0,0-2,2-2c1,0,3,0,4,0c2,0,2,2,2,2v4"/>
<path fill="#FFFFFF" d="M13,8H3C2.45,8,2,8.45,2,9v5c0,0.55,0.45,1,1,1h10c0.55,0,1-0.45,1-1V9C14,8.45,13.55,8,13,8z M10,12H8.91
c-0.21,0.58-0.76,1-1.41,1C6.67,13,6,12.33,6,11.5S6.67,10,7.5,10c0.65,0,1.2,0.42,1.41,1H10V12z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 728 B

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px" height="24px">
<path fill="#FFFFFF" d="M 13.261719 14.867188 L 15.742188 17.347656 C 15.363281 18.070313 15.324219 18.789063 15.722656 19.1875 L 20.25 23.714844 C 20.820313 24.285156 22.0625 23.972656 23.015625 23.015625 C 23.972656 22.058594 24.285156 20.820313 23.714844 20.25 L 19.191406 15.722656 C 18.789063 15.324219 18.070313 15.363281 17.347656 15.738281 L 14.867188 13.261719 Z M 8.5 0 C 3.804688 0 0 3.804688 0 8.5 C 0 13.195313 3.804688 17 8.5 17 C 13.195313 17 17 13.195313 17 8.5 C 17 3.804688 13.195313 0 8.5 0 Z M 8.5 15 C 4.910156 15 2 12.089844 2 8.5 C 2 4.910156 4.910156 2 8.5 2 C 12.089844 2 15 4.910156 15 8.5 C 15 12.089844 12.089844 15 8.5 15 Z"/>
<path fill="#ED6B21" d="M 13.261719 14.867188 L 19.191406 15.722656 C 18.789063 15.324219 18.070313 15.363281 17.347656 15.738281 M 8.5 0 C 3.804688 0 0 3.804688 0 8.5 C 0 13.195313 3.804688 17 8.5 17 C 13.195313 17 17 13.195313 17 8.5 C 17 3.804688 13.195313 0 8.5 0 Z M 8.5 15 C 4.910156 15 2 12.089844 2 8.5 C 2 4.910156 4.910156 2 8.5 2 C 12.089844 2 15 4.910156 15 8.5 C 15 12.089844 12.089844 15 8.5 15 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -306,6 +306,12 @@ void Field::msw_rescale(bool rescale_sidetext)
} }
} }
void Field::sys_color_changed()
{
m_Undo_to_sys_btn->msw_rescale();
m_Undo_btn->msw_rescale();
}
template<class T> template<class T>
bool is_defined_input_value(wxWindow* win, const ConfigOptionType& type) bool is_defined_input_value(wxWindow* win, const ConfigOptionType& type)
{ {

View File

@ -221,6 +221,7 @@ public:
} }
virtual void msw_rescale(bool rescale_sidetext = false); virtual void msw_rescale(bool rescale_sidetext = false);
void sys_color_changed();
bool get_enter_pressed() const { return bEnterPressed; } bool get_enter_pressed() const { return bEnterPressed; }
void set_enter_pressed(bool pressed) { bEnterPressed = pressed; } void set_enter_pressed(bool pressed) { bEnterPressed = pressed; }

View File

@ -4947,7 +4947,7 @@ bool GLCanvas3D::_init_main_toolbar()
return false; return false;
item.name = "settings"; item.name = "settings";
item.icon_filename = "cog.svg"; item.icon_filename = "cog_.svg";
item.tooltip = _u8L("Switch to Settings") + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") + item.tooltip = _u8L("Switch to Settings") + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") +
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) +
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ; "\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ;
@ -5554,6 +5554,7 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale() const
m_main_toolbar.set_scale(sc); m_main_toolbar.set_scale(sc);
m_undoredo_toolbar.set_scale(sc); m_undoredo_toolbar.set_scale(sc);
m_collapse_toolbar.set_scale(sc); m_collapse_toolbar.set_scale(sc);
size *= m_retina_helper->get_scale_factor();
#else #else
m_main_toolbar.set_icons_size(size); m_main_toolbar.set_icons_size(size);
m_undoredo_toolbar.set_icons_size(size); m_undoredo_toolbar.set_icons_size(size);
@ -5574,6 +5575,9 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale() const
// set minimum scale as a auto scale for the toolbars // set minimum scale as a auto scale for the toolbars
float new_scale = std::min(new_h_scale, new_v_scale); float new_scale = std::min(new_h_scale, new_v_scale);
#if ENABLE_RETINA_GL
new_scale /= m_retina_helper->get_scale_factor();
#endif
if (fabs(new_scale - scale) > 0.01) // scale is changed by 1% and more if (fabs(new_scale - scale) > 0.01) // scale is changed by 1% and more
wxGetApp().set_auto_toolbar_icon_scale(new_scale); wxGetApp().set_auto_toolbar_icon_scale(new_scale);
} }

View File

@ -580,6 +580,11 @@ void GUI_App::set_label_clr_sys(const wxColour& clr) {
app_config->save(); app_config->save();
} }
wxSize GUI_App::get_min_size() const
{
return wxSize(76*m_em_unit, 49 * m_em_unit);
}
float GUI_App::toolbar_icon_scale(const bool is_limited/* = false*/) const float GUI_App::toolbar_icon_scale(const bool is_limited/* = false*/) const
{ {
#ifdef __APPLE__ #ifdef __APPLE__

View File

@ -138,6 +138,7 @@ public:
const wxFont& bold_font() { return m_bold_font; } const wxFont& bold_font() { return m_bold_font; }
const wxFont& normal_font() { return m_normal_font; } const wxFont& normal_font() { return m_normal_font; }
int em_unit() const { return m_em_unit; } int em_unit() const { return m_em_unit; }
wxSize get_min_size() const;
float toolbar_icon_scale(const bool is_limited = false) const; float toolbar_icon_scale(const bool is_limited = false) const;
void set_auto_toolbar_icon_scale(float scale) const; void set_auto_toolbar_icon_scale(float scale) const;

View File

@ -272,6 +272,33 @@ void ObjectLayers::msw_rescale()
m_grid_sizer->Layout(); m_grid_sizer->Layout();
} }
void ObjectLayers::sys_color_changed()
{
m_bmp_delete.msw_rescale();
m_bmp_add.msw_rescale();
m_grid_sizer->SetHGap(wxGetApp().em_unit());
// rescale edit-boxes
const int cells_cnt = m_grid_sizer->GetCols() * m_grid_sizer->GetEffectiveRowsCount();
for (int i = 0; i < cells_cnt; i++)
{
const wxSizerItem* item = m_grid_sizer->GetItem(i);
if (item->IsSizer()) {// case when we have editor with buttons
const std::vector<size_t> btns = {2, 3}; // del_btn, add_btn
for (auto btn : btns) {
wxSizerItem* b_item = item->GetSizer()->GetItem(btn);
if (b_item->IsWindow()) {
auto button = dynamic_cast<PlusMinusButton*>(b_item->GetWindow());
if (button != nullptr)
button->msw_rescale();
}
}
}
}
m_grid_sizer->Layout();
}
void ObjectLayers::reset_selection() void ObjectLayers::reset_selection()
{ {
m_selectable_range = { 0.0, 0.0 }; m_selectable_range = { 0.0, 0.0 };

View File

@ -94,6 +94,7 @@ public:
void UpdateAndShow(const bool show) override; void UpdateAndShow(const bool show) override;
void msw_rescale(); void msw_rescale();
void sys_color_changed();
void reset_selection(); void reset_selection();
void set_selectable_range(const t_layer_height_range& range) { m_selectable_range = range; } void set_selectable_range(const t_layer_height_range& range) { m_selectable_range = range; }

View File

@ -417,6 +417,8 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
m_main_grid_sizer->Add(editors_grid_sizer, 1, wxEXPAND); m_main_grid_sizer->Add(editors_grid_sizer, 1, wxEXPAND);
m_check_inch = new wxCheckBox(parent, wxID_ANY, "Inches"); m_check_inch = new wxCheckBox(parent, wxID_ANY, "Inches");
m_check_inch->SetFont(wxGetApp().normal_font());
m_check_inch->SetValue(m_imperial_units); m_check_inch->SetValue(m_imperial_units);
m_check_inch->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) { m_check_inch->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) {
wxGetApp().app_config->set("use_inches", m_check_inch->GetValue() ? "1" : "0"); wxGetApp().app_config->set("use_inches", m_check_inch->GetValue() ? "1" : "0");
@ -995,7 +997,7 @@ void ObjectManipulation::sys_color_changed()
for (int id = 0; id < 3; ++id) for (int id = 0; id < 3; ++id)
m_mirror_buttons[id].first->msw_rescale(); m_mirror_buttons[id].first->msw_rescale();
get_og()->msw_rescale(); get_og()->sys_color_changed();
} }
static const char axes[] = { 'x', 'y', 'z' }; static const char axes[] = { 'x', 'y', 'z' };

View File

@ -89,6 +89,19 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
m_loaded = true; m_loaded = true;
#ifdef __APPLE__
// Using SetMinSize() on Mac messes up the window position in some cases
// cf. https://groups.google.com/forum/#!topic/wx-users/yUKPBBfXWO0
// So, if we haven't possibility to set MinSize() for the MainFrame,
// set the MinSize() as a half of regular for the m_plater and m_tabpanel, when settings layout is in slNew mode
// Otherwise, MainFrame will be maximized by height
if (slNew) {
wxSize size = wxGetApp().get_min_size();
size.SetHeight(int(0.5*size.GetHeight()));
m_plater->SetMinSize(size);
m_tabpanel->SetMinSize(size);
}
#endif
// initialize layout // initialize layout
auto sizer = new wxBoxSizer(wxVERTICAL); auto sizer = new wxBoxSizer(wxVERTICAL);
if (m_plater && m_layout != slOld) if (m_plater && m_layout != slOld)
@ -101,7 +114,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
SetSizer(sizer); SetSizer(sizer);
Fit(); Fit();
const wxSize min_size = wxSize(76*wxGetApp().em_unit(), 49*wxGetApp().em_unit()); const wxSize min_size = wxGetApp().get_min_size(); //wxSize(76*wxGetApp().em_unit(), 49*wxGetApp().em_unit());
#ifdef __APPLE__ #ifdef __APPLE__
// Using SetMinSize() on Mac messes up the window position in some cases // Using SetMinSize() on Mac messes up the window position in some cases
// cf. https://groups.google.com/forum/#!topic/wx-users/yUKPBBfXWO0 // cf. https://groups.google.com/forum/#!topic/wx-users/yUKPBBfXWO0
@ -1471,7 +1484,7 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe)
// wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on Windows 10 // wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on Windows 10
// with multiple high resolution displays connected. // with multiple high resolution displays connected.
m_tabpanel = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME); m_tabpanel = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxGetApp().get_min_size(), wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList #ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font()); m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font());
#endif #endif

View File

@ -138,7 +138,7 @@ void ObjectDataViewModelNode::update_settings_digest_bitmaps()
std::map<std::string, wxBitmap>& categories_icon = Slic3r::GUI::wxGetApp().obj_list()->CATEGORY_ICON; std::map<std::string, wxBitmap>& categories_icon = Slic3r::GUI::wxGetApp().obj_list()->CATEGORY_ICON;
std::string scaled_bitmap_name = m_name.ToUTF8().data(); std::string scaled_bitmap_name = m_name.ToUTF8().data();
scaled_bitmap_name += "-em" + std::to_string(Slic3r::GUI::wxGetApp().em_unit()); scaled_bitmap_name += "-em" + std::to_string(wxGetApp().em_unit()) + (wxGetApp().dark_mode() ? "-dm" : "");
wxBitmap *bmp = m_bitmap_cache->find(scaled_bitmap_name); wxBitmap *bmp = m_bitmap_cache->find(scaled_bitmap_name);
if (bmp == nullptr) { if (bmp == nullptr) {

View File

@ -568,6 +568,18 @@ void ConfigOptionsGroup::msw_rescale()
} }
} }
void ConfigOptionsGroup::sys_color_changed()
{
// update bitmaps for near label widgets (like "Set uniform scale" button on settings panel)
if (rescale_near_label_widget)
for (auto near_label_widget : m_near_label_widget_ptrs)
rescale_near_label_widget(near_label_widget);
// update undo buttons : rescale bitmaps
for (const auto& field : m_fields)
field.second->sys_color_changed();
}
boost::any ConfigOptionsGroup::config_value(const std::string& opt_key, int opt_index, bool deserialize) { boost::any ConfigOptionsGroup::config_value(const std::string& opt_key, int opt_index, bool deserialize) {
if (deserialize) { if (deserialize) {

View File

@ -280,6 +280,7 @@ public:
void Show(const bool show); void Show(const bool show);
bool update_visibility(ConfigOptionMode mode); bool update_visibility(ConfigOptionMode mode);
void msw_rescale(); void msw_rescale();
void sys_color_changed();
boost::any config_value(const std::string& opt_key, int opt_index, bool deserialize); boost::any config_value(const std::string& opt_key, int opt_index, bool deserialize);
// return option value from config // return option value from config
boost::any get_config_value(const DynamicPrintConfig& config, const std::string& opt_key, int opt_index = -1); boost::any get_config_value(const DynamicPrintConfig& config, const std::string& opt_key, int opt_index = -1);

View File

@ -773,7 +773,9 @@ Sidebar::Sidebar(Plater *parent)
p->scrolled->SetScrollbars(0, 100, 1, 2); p->scrolled->SetScrollbars(0, 100, 1, 2);
SetFont(wxGetApp().normal_font()); SetFont(wxGetApp().normal_font());
#ifndef __APPLE__
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
#endif
// Sizer in the scrolled area // Sizer in the scrolled area
auto *scrolled_sizer = new wxBoxSizer(wxVERTICAL); auto *scrolled_sizer = new wxBoxSizer(wxVERTICAL);
@ -1110,7 +1112,7 @@ void Sidebar::sys_color_changed()
p->object_list->sys_color_changed(); p->object_list->sys_color_changed();
p->object_manipulation->sys_color_changed(); p->object_manipulation->sys_color_changed();
// p->object_settings->msw_rescale(); // p->object_settings->msw_rescale();
// p->object_layers->msw_rescale(); p->object_layers->sys_color_changed();
// btn...->msw_rescale() updates icon on button, so use it // btn...->msw_rescale() updates icon on button, so use it
p->btn_send_gcode->msw_rescale(); p->btn_send_gcode->msw_rescale();
@ -4382,7 +4384,7 @@ void Sidebar::set_btn_label(const ActionButtonType btn_type, const wxString& lab
// Plater / Public // Plater / Public
Plater::Plater(wxWindow *parent, MainFrame *main_frame) Plater::Plater(wxWindow *parent, MainFrame *main_frame)
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(76 * wxGetApp().em_unit(), 49 * wxGetApp().em_unit())) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxGetApp().get_min_size())
, p(new priv(this, main_frame)) , p(new priv(this, main_frame))
{ {
// Initialization performed in the private c-tor // Initialization performed in the private c-tor

View File

@ -190,15 +190,13 @@ void Tab::create_preset_tab()
add_scaled_button(panel, &m_search_btn, "search"); add_scaled_button(panel, &m_search_btn, "search");
m_search_btn->SetToolTip(format_wxstr(_L("Click to start a search or use %1% shortcut"), "Ctrl+F")); m_search_btn->SetToolTip(format_wxstr(_L("Click to start a search or use %1% shortcut"), "Ctrl+F"));
// Determine the theme color of OS (dark or light)
auto luma = wxGetApp().get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
// Bitmaps to be shown on the "Revert to system" aka "Lock to system" button next to each input field. // Bitmaps to be shown on the "Revert to system" aka "Lock to system" button next to each input field.
add_scaled_bitmap(this, m_bmp_value_lock , luma >= 128 ? "lock_closed" : "lock_closed_white"); add_scaled_bitmap(this, m_bmp_value_lock , "lock_closed");
add_scaled_bitmap(this, m_bmp_value_unlock, "lock_open"); add_scaled_bitmap(this, m_bmp_value_unlock, "lock_open");
m_bmp_non_system = &m_bmp_white_bullet; m_bmp_non_system = &m_bmp_white_bullet;
// Bitmaps to be shown on the "Undo user changes" button next to each input field. // Bitmaps to be shown on the "Undo user changes" button next to each input field.
add_scaled_bitmap(this, m_bmp_value_revert, "undo"); add_scaled_bitmap(this, m_bmp_value_revert, "undo");
add_scaled_bitmap(this, m_bmp_white_bullet, luma >= 128 ? "dot" : "dot_white"); add_scaled_bitmap(this, m_bmp_white_bullet, "dot");
fill_icon_descriptions(); fill_icon_descriptions();
set_tooltips_text(); set_tooltips_text();
@ -597,7 +595,7 @@ void TabPrinter::sys_color_changed()
// update missed options_groups // update missed options_groups
const std::vector<PageShp>& pages = m_printer_technology == ptFFF ? m_pages_sla : m_pages_fff; const std::vector<PageShp>& pages = m_printer_technology == ptFFF ? m_pages_sla : m_pages_fff;
for (auto page : pages) for (auto page : pages)
page->msw_rescale(); page->sys_color_changed();
Layout(); Layout();
} }
@ -890,8 +888,8 @@ void Tab::sys_color_changed()
btn->msw_rescale(); btn->msw_rescale();
for (const auto bmp : m_scaled_bitmaps) for (const auto bmp : m_scaled_bitmaps)
bmp->msw_rescale(); bmp->msw_rescale();
for (ScalableBitmap& bmp : m_mode_bitmap_cache) // for (ScalableBitmap& bmp : m_mode_bitmap_cache)
bmp.msw_rescale(); // bmp.msw_rescale();
// update icons for tree_ctrl // update icons for tree_ctrl
for (ScalableBitmap& bmp : m_scaled_icons_list) for (ScalableBitmap& bmp : m_scaled_icons_list)
@ -903,7 +901,6 @@ void Tab::sys_color_changed()
m_icons->Add(bmp.bmp()); m_icons->Add(bmp.bmp());
m_treectrl->AssignImageList(m_icons); m_treectrl->AssignImageList(m_icons);
// Colors for ui "decoration" // Colors for ui "decoration"
m_sys_label_clr = wxGetApp().get_label_clr_sys(); m_sys_label_clr = wxGetApp().get_label_clr_sys();
m_modified_label_clr = wxGetApp().get_label_clr_modified(); m_modified_label_clr = wxGetApp().get_label_clr_modified();
@ -911,7 +908,7 @@ void Tab::sys_color_changed()
// update options_groups // update options_groups
for (auto page : m_pages) for (auto page : m_pages)
page->msw_rescale(); page->sys_color_changed();
Layout(); Layout();
} }
@ -3606,6 +3603,12 @@ void Page::msw_rescale()
group->msw_rescale(); group->msw_rescale();
} }
void Page::sys_color_changed()
{
for (auto group : m_optgroups)
group->sys_color_changed();
}
Field* Page::get_field(const t_config_option_key& opt_key, int opt_index /*= -1*/) const Field* Page::get_field(const t_config_option_key& opt_key, int opt_index /*= -1*/) const
{ {
Field* field = nullptr; Field* field = nullptr;

View File

@ -81,6 +81,7 @@ public:
void reload_config(); void reload_config();
void update_visibility(ConfigOptionMode mode); void update_visibility(ConfigOptionMode mode);
void msw_rescale(); void msw_rescale();
void sys_color_changed();
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const; Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
bool set_value(const t_config_option_key& opt_key, const boost::any& value); bool set_value(const t_config_option_key& opt_key, const boost::any& value);
ConfigOptionsGroupShp new_optgroup(const wxString& title, int noncommon_label_width = -1); ConfigOptionsGroupShp new_optgroup(const wxString& title, int noncommon_label_width = -1);