Merge remote-tracking branch 'origin/master' into ys_ph_printers

This commit is contained in:
YuSanka 2020-07-22 15:53:31 +02:00
commit 631b15b7d3
8 changed files with 27 additions and 10 deletions

View file

@ -42,6 +42,8 @@ private:
// Base for Model, ModelObject, ModelVolume, ModelInstance or ModelMaterial to provide a unique ID // Base for Model, ModelObject, ModelVolume, ModelInstance or ModelMaterial to provide a unique ID
// to synchronize the front end (UI) with the back end (BackgroundSlicingProcess / Print / PrintObject). // to synchronize the front end (UI) with the back end (BackgroundSlicingProcess / Print / PrintObject).
// Also base for Print, PrintObject, SLAPrint, SLAPrintObject to provide a unique ID for matching Model / ModelObject
// with their corresponding Print / PrintObject objects by the notification center at the UI when processing back-end warnings.
// Achtung! The s_last_id counter is not thread safe, so it is expected, that the ObjectBase derived instances // Achtung! The s_last_id counter is not thread safe, so it is expected, that the ObjectBase derived instances
// are only instantiated from the main thread. // are only instantiated from the main thread.
class ObjectBase class ObjectBase

View file

@ -399,7 +399,7 @@ public:
// in the notification center. // in the notification center.
const PrintObject* get_object(ObjectID object_id) const { const PrintObject* get_object(ObjectID object_id) const {
auto it = std::find_if(m_objects.begin(), m_objects.end(), auto it = std::find_if(m_objects.begin(), m_objects.end(),
[object_id](const PrintObject *obj) { return *static_cast<const ObjectID*>(obj) == object_id; }); [object_id](const PrintObject *obj) { return obj->id() == object_id; });
return (it == m_objects.end()) ? nullptr : *it; return (it == m_objects.end()) ? nullptr : *it;
} }
const PrintRegionPtrs& regions() const { return m_regions; } const PrintRegionPtrs& regions() const { return m_regions; }

View file

@ -93,7 +93,7 @@ void PrintBase::status_update_warnings(ObjectID object_id, int step, PrintStateB
if (this->m_status_callback) if (this->m_status_callback)
m_status_callback(SlicingStatus(*this, step)); m_status_callback(SlicingStatus(*this, step));
else if (! message.empty()) else if (! message.empty())
printf("%s warning: %s\n", (object_id == ObjectID(*this)) ? "print" : "print object", message.c_str()); printf("%s warning: %s\n", (object_id == this->id()) ? "print" : "print object", message.c_str());
} }
tbb::mutex& PrintObjectBase::state_mutex(PrintBase *print) tbb::mutex& PrintObjectBase::state_mutex(PrintBase *print)
@ -108,7 +108,7 @@ std::function<void()> PrintObjectBase::cancel_callback(PrintBase *print)
void PrintObjectBase::status_update_warnings(PrintBase *print, int step, PrintStateBase::WarningLevel warning_level, const std::string &message) void PrintObjectBase::status_update_warnings(PrintBase *print, int step, PrintStateBase::WarningLevel warning_level, const std::string &message)
{ {
print->status_update_warnings(*this, step, warning_level, message); print->status_update_warnings(this->id(), step, warning_level, message);
} }
} // namespace Slic3r } // namespace Slic3r

View file

@ -304,7 +304,7 @@ private:
class PrintBase; class PrintBase;
class PrintObjectBase : public ObjectID class PrintObjectBase : public ObjectBase
{ {
public: public:
const ModelObject* model_object() const { return m_model_object; } const ModelObject* model_object() const { return m_model_object; }
@ -335,7 +335,7 @@ protected:
* The PrintBase class will abstract this flow for different technologies. * The PrintBase class will abstract this flow for different technologies.
* *
*/ */
class PrintBase : public ObjectID class PrintBase : public ObjectBase
{ {
public: public:
PrintBase() : m_placeholder_parser(&m_full_print_config) { this->restart(); } PrintBase() : m_placeholder_parser(&m_full_print_config) { this->restart(); }
@ -386,9 +386,9 @@ public:
struct SlicingStatus { struct SlicingStatus {
SlicingStatus(int percent, const std::string &text, unsigned int flags = 0) : percent(percent), text(text), flags(flags) {} SlicingStatus(int percent, const std::string &text, unsigned int flags = 0) : percent(percent), text(text), flags(flags) {}
SlicingStatus(const PrintBase &print, int warning_step) : SlicingStatus(const PrintBase &print, int warning_step) :
flags(UPDATE_PRINT_STEP_WARNINGS), warning_object_id(print), warning_step(warning_step) {} flags(UPDATE_PRINT_STEP_WARNINGS), warning_object_id(print.id()), warning_step(warning_step) {}
SlicingStatus(const PrintObjectBase &print_object, int warning_step) : SlicingStatus(const PrintObjectBase &print_object, int warning_step) :
flags(UPDATE_PRINT_OBJECT_STEP_WARNINGS), warning_object_id(print_object), warning_step(warning_step) {} flags(UPDATE_PRINT_OBJECT_STEP_WARNINGS), warning_object_id(print_object.id()), warning_step(warning_step) {}
int percent { -1 }; int percent { -1 };
std::string text; std::string text;
// Bitmap of flags. // Bitmap of flags.
@ -508,7 +508,7 @@ protected:
PrintStateBase::TimeStamp set_done(PrintStepEnum step) { PrintStateBase::TimeStamp set_done(PrintStepEnum step) {
std::pair<PrintStateBase::TimeStamp, bool> status = m_state.set_done(step, this->state_mutex(), [this](){ this->throw_if_canceled(); }); std::pair<PrintStateBase::TimeStamp, bool> status = m_state.set_done(step, this->state_mutex(), [this](){ this->throw_if_canceled(); });
if (status.second) if (status.second)
this->status_update_warnings(*this, static_cast<int>(step), PrintStateBase::WarningLevel::NON_CRITICAL, std::string()); this->status_update_warnings(this->id(), static_cast<int>(step), PrintStateBase::WarningLevel::NON_CRITICAL, std::string());
return status.first; return status.first;
} }
bool invalidate_step(PrintStepEnum step) bool invalidate_step(PrintStepEnum step)
@ -530,7 +530,7 @@ protected:
std::pair<PrintStepEnum, bool> active_step = m_state.active_step_add_warning(warning_level, message, message_id, this->state_mutex()); std::pair<PrintStepEnum, bool> active_step = m_state.active_step_add_warning(warning_level, message, message_id, this->state_mutex());
if (active_step.second) if (active_step.second)
// Update UI. // Update UI.
this->status_update_warnings(*this, static_cast<int>(active_step.first), warning_level, message); this->status_update_warnings(this->id(), static_cast<int>(active_step.first), warning_level, message);
} }
private: private:

View file

@ -1130,6 +1130,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("ironing_type", coEnum); def = this->add("ironing_type", coEnum);
def->label = L("Ironing Type"); def->label = L("Ironing Type");
def->category = L("Ironing");
def->tooltip = L("Ironing Type"); def->tooltip = L("Ironing Type");
def->enum_keys_map = &ConfigOptionEnum<IroningType>::get_enum_values(); def->enum_keys_map = &ConfigOptionEnum<IroningType>::get_enum_values();
def->enum_values.push_back("top"); def->enum_values.push_back("top");
@ -1153,6 +1154,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("ironing_spacing", coFloat); def = this->add("ironing_spacing", coFloat);
def->label = L("Spacing between ironing passes"); def->label = L("Spacing between ironing passes");
def->category = L("Ironing");
def->tooltip = L("Distance between ironing lines"); def->tooltip = L("Distance between ironing lines");
def->sidetext = L("mm"); def->sidetext = L("mm");
def->min = 0; def->min = 0;

View file

@ -433,7 +433,7 @@ public:
// in the notification center. // in the notification center.
const SLAPrintObject* get_object(ObjectID object_id) const { const SLAPrintObject* get_object(ObjectID object_id) const {
auto it = std::find_if(m_objects.begin(), m_objects.end(), auto it = std::find_if(m_objects.begin(), m_objects.end(),
[object_id](const SLAPrintObject *obj) { return *static_cast<const ObjectID*>(obj) == object_id; }); [object_id](const SLAPrintObject *obj) { return obj->id() == object_id; });
return (it == m_objects.end()) ? nullptr : *it; return (it == m_objects.end()) ? nullptr : *it;
} }

View file

@ -91,6 +91,7 @@ ObjectList::ObjectList(wxWindow* parent) :
// ptFFF // ptFFF
CATEGORY_ICON[L("Layers and Perimeters")] = create_scaled_bitmap("layers"); CATEGORY_ICON[L("Layers and Perimeters")] = create_scaled_bitmap("layers");
CATEGORY_ICON[L("Infill")] = create_scaled_bitmap("infill"); CATEGORY_ICON[L("Infill")] = create_scaled_bitmap("infill");
CATEGORY_ICON[L("Ironing")] = create_scaled_bitmap("infill"); // FIXME when the ironing icon is available
CATEGORY_ICON[L("Support material")] = create_scaled_bitmap("support"); CATEGORY_ICON[L("Support material")] = create_scaled_bitmap("support");
CATEGORY_ICON[L("Speed")] = create_scaled_bitmap("time"); CATEGORY_ICON[L("Speed")] = create_scaled_bitmap("time");
CATEGORY_ICON[L("Extruders")] = create_scaled_bitmap("funnel"); CATEGORY_ICON[L("Extruders")] = create_scaled_bitmap("funnel");
@ -641,6 +642,7 @@ void ObjectList::msw_rescale_icons()
// ptFFF // ptFFF
CATEGORY_ICON[L("Layers and Perimeters")] = create_scaled_bitmap("layers"); CATEGORY_ICON[L("Layers and Perimeters")] = create_scaled_bitmap("layers");
CATEGORY_ICON[L("Infill")] = create_scaled_bitmap("infill"); CATEGORY_ICON[L("Infill")] = create_scaled_bitmap("infill");
CATEGORY_ICON[L("Ironing")] = create_scaled_bitmap("infill"); // FIXME when the ironing icon is available
CATEGORY_ICON[L("Support material")] = create_scaled_bitmap("support"); CATEGORY_ICON[L("Support material")] = create_scaled_bitmap("support");
CATEGORY_ICON[L("Speed")] = create_scaled_bitmap("time"); CATEGORY_ICON[L("Speed")] = create_scaled_bitmap("time");
CATEGORY_ICON[L("Extruders")] = create_scaled_bitmap("funnel"); CATEGORY_ICON[L("Extruders")] = create_scaled_bitmap("funnel");

View file

@ -1515,6 +1515,7 @@ void MainFrame::load_config(const DynamicPrintConfig& config)
void MainFrame::select_tab(size_t tab/* = size_t(-1)*/) void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
{ {
bool tabpanel_was_hidden = false;
#if ENABLE_LAYOUT_NO_RESTART #if ENABLE_LAYOUT_NO_RESTART
if (m_layout == ESettingsLayout::Dlg) { if (m_layout == ESettingsLayout::Dlg) {
#else #else
@ -1545,6 +1546,7 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
if (m_settings_dialog.IsShown()) if (m_settings_dialog.IsShown())
m_settings_dialog.SetFocus(); m_settings_dialog.SetFocus();
else { else {
tabpanel_was_hidden = true;
m_tabpanel->Show(); m_tabpanel->Show();
m_settings_dialog.Show(); m_settings_dialog.Show();
} }
@ -1564,6 +1566,7 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
#if ENABLE_LAYOUT_NO_RESTART #if ENABLE_LAYOUT_NO_RESTART
else if (m_layout == ESettingsLayout::New) { else if (m_layout == ESettingsLayout::New) {
m_main_sizer->Show(m_plater, tab == 0); m_main_sizer->Show(m_plater, tab == 0);
tabpanel_was_hidden = !m_main_sizer->IsShown(m_tabpanel);
m_main_sizer->Show(m_tabpanel, tab != 0); m_main_sizer->Show(m_tabpanel, tab != 0);
#else #else
else if (m_layout == slNew) { else if (m_layout == slNew) {
@ -1577,6 +1580,14 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
Layout(); Layout();
} }
// When we run application in ESettingsLayout::New or ESettingsLayout::Dlg mode, tabpanel is hidden from the very beginning
// and as a result Tab::update_changed_tree_ui() function couldn't update m_is_nonsys_values values,
// which are used for update TreeCtrl and "revert_buttons".
// So, force the call of this function for Tabs, if tab panel was hidden
if (tabpanel_was_hidden)
for (auto tab : wxGetApp().tabs_list)
tab->update_changed_tree_ui();
// when tab == -1, it means we should show the last selected tab // when tab == -1, it means we should show the last selected tab
#if ENABLE_LAYOUT_NO_RESTART #if ENABLE_LAYOUT_NO_RESTART
m_tabpanel->SetSelection(tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == ESettingsLayout::Dlg && tab != 0) ? tab - 1 : tab); m_tabpanel->SetSelection(tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == ESettingsLayout::Dlg && tab != 0) ? tab - 1 : tab);