From 8d4d6b6c891084432c19e7cab93704afe1003949 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 15 Dec 2020 14:58:34 +0100 Subject: [PATCH 1/3] UnsavedChangesDialog: Fixed default text color in respect to the system text color (Related to #5444) --- src/slic3r/GUI/UnsavedChangesDialog.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 946bdd8c1..b4b38b4bd 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -51,7 +51,12 @@ static std::string get_icon_name(Preset::Type type, PrinterTechnology pt) { return pt == ptSLA && type == Preset::TYPE_PRINTER ? "sla_printer" : type_icon_names.at(type); } -static std::string black = "#000000"; +static std::string def_text_color() +{ + wxColour def_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); + auto clr_str = wxString::Format(wxT("#%02X%02X%02X"), def_colour.Red(), def_colour.Green(), def_colour.Blue()); + return clr_str.ToStdString(); +} static std::string grey = "#808080"; static std::string orange = "#ed6b21"; @@ -158,7 +163,7 @@ ModelNode::ModelNode(ModelNode* parent, const wxString& text, const wxString& ol } // "color" strings - color_string(m_old_value, black); + color_string(m_old_value, def_text_color()); color_string(m_new_value, orange); UpdateIcons(); @@ -176,13 +181,13 @@ void ModelNode::UpdateEnabling() }; if (!m_toggle) { - change_text_color(m_text, black, grey); - change_text_color(m_old_value, black, grey); + change_text_color(m_text, def_text_color(), grey); + change_text_color(m_old_value, def_text_color(), grey); change_text_color(m_new_value, orange,grey); } else { - change_text_color(m_text, grey, black); - change_text_color(m_old_value, grey, black); + change_text_color(m_text, grey, def_text_color()); + change_text_color(m_old_value, grey, def_text_color()); change_text_color(m_new_value, grey, orange); } // update icons for the colors @@ -227,7 +232,7 @@ UnsavedChangesModel::~UnsavedChangesModel() wxDataViewItem UnsavedChangesModel::AddPreset(Preset::Type type, wxString preset_name, PrinterTechnology pt) { // "color" strings - color_string(preset_name, black); + color_string(preset_name, def_text_color()); make_string_bold(preset_name); auto preset = new ModelNode(type, m_parent_win, preset_name, get_icon_name(type, pt)); @@ -274,9 +279,9 @@ wxDataViewItem UnsavedChangesModel::AddOption(Preset::Type type, wxString catego wxString old_value, wxString new_value, const std::string category_icon_name) { // "color" strings - color_string(category_name, black); - color_string(group_name, black); - color_string(option_name, black); + color_string(category_name, def_text_color()); + color_string(group_name, def_text_color()); + color_string(option_name, def_text_color()); // "make" strings bold make_string_bold(category_name); From dcd69b4ef8f98ac20fe4dbf2fb897afffe907d58 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 15 Dec 2020 15:57:22 +0100 Subject: [PATCH 2/3] #5415 - Fixed preview when volumetric extrusion is turned on --- src/libslic3r/GCode/GCodeProcessor.cpp | 30 ++++++++++++++++++++++++-- src/libslic3r/GCode/GCodeProcessor.hpp | 3 +++ src/libslic3r/Technologies.hpp | 8 +++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 2a5a08ce8..c045cbcc2 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -562,6 +562,10 @@ void GCodeProcessor::apply_config(const PrintConfig& config) } m_time_processor.export_remaining_time_enabled = config.remaining_times.value; + +#if ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING + m_use_volumetric_e = config.use_volumetric_e; +#endif // ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING } void GCodeProcessor::apply_config(const DynamicPrintConfig& config) @@ -719,6 +723,12 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config) m_time_processor.machines[i].max_acceleration = max_acceleration; m_time_processor.machines[i].acceleration = (max_acceleration > 0.0f) ? max_acceleration : DEFAULT_ACCELERATION; } + +#if ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING + const ConfigOptionBool* use_volumetric_e = config.option("use_volumetric_e"); + if (use_volumetric_e != nullptr) + m_use_volumetric_e = use_volumetric_e->value; +#endif // ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING } void GCodeProcessor::enable_stealth_time_estimator(bool enabled) @@ -773,6 +783,10 @@ void GCodeProcessor::reset() m_result.reset(); m_result.id = ++s_result_id; +#if ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING + m_use_volumetric_e = false; +#endif // ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING + #if ENABLE_GCODE_VIEWER_DATA_CHECKING m_mm3_per_mm_compare.reset(); m_height_compare.reset(); @@ -1653,8 +1667,14 @@ void GCodeProcessor::process_G0(const GCodeReader::GCodeLine& line) void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) { - auto absolute_position = [this](Axis axis, const GCodeReader::GCodeLine& lineG1) - { +#if ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING + float filament_diameter = (static_cast(m_extruder_id) < m_filament_diameters.size()) ? m_filament_diameters[m_extruder_id] : m_filament_diameters.back(); + float filament_radius = 0.5f * filament_diameter; + float area_filament_cross_section = static_cast(M_PI) * sqr(filament_radius); + auto absolute_position = [this, area_filament_cross_section](Axis axis, const GCodeReader::GCodeLine& lineG1) { +#else + auto absolute_position = [this](Axis axis, const GCodeReader::GCodeLine& lineG1) { +#endif // ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING bool is_relative = (m_global_positioning_type == EPositioningType::Relative); if (axis == E) is_relative |= (m_e_local_positioning_type == EPositioningType::Relative); @@ -1662,6 +1682,10 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) if (lineG1.has(Slic3r::Axis(axis))) { float lengthsScaleFactor = (m_units == EUnits::Inches) ? INCHES_TO_MM : 1.0f; float ret = lineG1.value(Slic3r::Axis(axis)) * lengthsScaleFactor; +#if ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING + if (axis == E && m_use_volumetric_e) + ret /= area_filament_cross_section; +#endif // ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING return is_relative ? m_start_position[axis] + ret : m_origin[axis] + ret; } else @@ -1719,9 +1743,11 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) if (type == EMoveType::Extrude) { float delta_xyz = std::sqrt(sqr(delta_pos[X]) + sqr(delta_pos[Y]) + sqr(delta_pos[Z])); +#if !ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING float filament_diameter = (static_cast(m_extruder_id) < m_filament_diameters.size()) ? m_filament_diameters[m_extruder_id] : m_filament_diameters.back(); float filament_radius = 0.5f * filament_diameter; float area_filament_cross_section = static_cast(M_PI) * sqr(filament_radius); +#endif // !ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING float volume_extruded_filament = area_filament_cross_section * delta_pos[E]; float area_toolpath_cross_section = volume_extruded_filament / delta_xyz; diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index db221a360..4cb2092e8 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -421,6 +421,9 @@ namespace Slic3r { unsigned int m_g1_line_id; unsigned int m_layer_id; CpColor m_cp_color; +#if ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING + bool m_use_volumetric_e; +#endif // ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING enum class EProducer { diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 15098b1b2..e360e85fe 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -99,4 +99,12 @@ #define ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE (1 && ENABLE_2_3_0_BETA3) #define ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE (1 && ENABLE_2_3_0_BETA3) + +//================= +// 2.3.0.rc1 techs +//================= +#define ENABLE_2_3_0_RC1 1 + +#define ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING (1 && ENABLE_2_3_0_RC1) + #endif // _prusaslicer_technologies_h_ From c9da06e44a10ecadfa55ac2e1df4f63a48d5d685 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 15 Dec 2020 16:02:59 +0100 Subject: [PATCH 3/3] Fix for text color for the mode buttons under Linux with GTK2 (related to #5444) --- src/slic3r/GUI/wxExtensions.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 0ebe5ae2f..c52864db3 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -16,10 +16,7 @@ #include "Plater.hpp" #include "../Utils/MacDarkMode.hpp" -#ifdef __linux__ -#define wxLinux true -#else -#define wxLinux false +#ifndef __linux__ // msw_menuitem_bitmaps is used for MSW and OSX static std::map msw_menuitem_bitmaps; #ifdef __WXMSW__ @@ -660,7 +657,13 @@ void ModeButton::focus_button(const bool focus) Slic3r::GUI::wxGetApp().normal_font(); SetFont(new_font); - SetForegroundColour(wxSystemSettings::GetColour(focus ? wxSYS_COLOUR_BTNTEXT : wxLinux ? wxSYS_COLOUR_GRAYTEXT : wxSYS_COLOUR_BTNSHADOW)); + SetForegroundColour(wxSystemSettings::GetColour(focus ? wxSYS_COLOUR_BTNTEXT : +#if defined (__linux__) && defined (__WXGTK3__) + wxSYS_COLOUR_GRAYTEXT +#else + wxSYS_COLOUR_BTNSHADOW +#endif + )); Refresh(); Update();