Improvement of extruder selection for the object/part according to the actually extruders count
This commit is contained in:
parent
f0095d19be
commit
3e549c153d
@ -8,7 +8,6 @@
|
|||||||
#include "../../libslic3r/Utils.hpp"
|
#include "../../libslic3r/Utils.hpp"
|
||||||
|
|
||||||
#include <wx/msgdlg.h>
|
#include <wx/msgdlg.h>
|
||||||
#include <wx/frame.h>
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include "Geometry.hpp"
|
#include "Geometry.hpp"
|
||||||
@ -210,6 +209,18 @@ wxPoint get_mouse_position_in_control() {
|
|||||||
pt.y - win->GetScreenPosition().y);
|
pt.y - win->GetScreenPosition().y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxDataViewColumn* object_ctrl_create_extruder_column(int extruders_count)
|
||||||
|
{
|
||||||
|
wxArrayString choices;
|
||||||
|
choices.Add("default");
|
||||||
|
for (int i = 1; i <= extruders_count; ++i)
|
||||||
|
choices.Add(wxString::Format("%d", i));
|
||||||
|
wxDataViewChoiceRenderer *c =
|
||||||
|
new wxDataViewChoiceRenderer(choices, wxDATAVIEW_CELL_EDITABLE, wxALIGN_CENTER_HORIZONTAL);
|
||||||
|
wxDataViewColumn* column = new wxDataViewColumn(_(L("Extruder")), c, 3, 60, wxALIGN_CENTER_HORIZONTAL, wxDATAVIEW_COL_RESIZABLE);
|
||||||
|
return column;
|
||||||
|
}
|
||||||
|
|
||||||
void create_objects_ctrl(wxWindow* win, wxBoxSizer*& objects_sz)
|
void create_objects_ctrl(wxWindow* win, wxBoxSizer*& objects_sz)
|
||||||
{
|
{
|
||||||
m_objects_ctrl = new wxDataViewCtrl(win, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
m_objects_ctrl = new wxDataViewCtrl(win, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
@ -238,17 +249,7 @@ void create_objects_ctrl(wxWindow* win, wxBoxSizer*& objects_sz)
|
|||||||
wxALIGN_CENTER_HORIZONTAL, wxDATAVIEW_COL_RESIZABLE);
|
wxALIGN_CENTER_HORIZONTAL, wxDATAVIEW_COL_RESIZABLE);
|
||||||
|
|
||||||
// column 3 of the view control:
|
// column 3 of the view control:
|
||||||
wxArrayString choices;
|
m_objects_ctrl->AppendColumn(object_ctrl_create_extruder_column(4));
|
||||||
choices.Add("default");
|
|
||||||
choices.Add("1");
|
|
||||||
choices.Add("2");
|
|
||||||
choices.Add("3");
|
|
||||||
choices.Add("4");
|
|
||||||
wxDataViewChoiceRenderer *c =
|
|
||||||
new wxDataViewChoiceRenderer(choices, wxDATAVIEW_CELL_EDITABLE, wxALIGN_CENTER_HORIZONTAL);
|
|
||||||
wxDataViewColumn *column3 =
|
|
||||||
new wxDataViewColumn(_(L("Extruder")), c, 3, 60, wxALIGN_CENTER_HORIZONTAL, wxDATAVIEW_COL_RESIZABLE);
|
|
||||||
m_objects_ctrl->AppendColumn(column3);
|
|
||||||
|
|
||||||
// column 4 of the view control:
|
// column 4 of the view control:
|
||||||
m_objects_ctrl->AppendBitmapColumn(" ", 4, wxDATAVIEW_CELL_INERT, 25,
|
m_objects_ctrl->AppendBitmapColumn(" ", 4, wxDATAVIEW_CELL_INERT, 25,
|
||||||
@ -1608,5 +1609,15 @@ void on_drop(wxDataViewEvent &event)
|
|||||||
g_prevent_list_events = false;
|
g_prevent_list_events = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void update_objects_list_extruder_column(const int extruders_count)
|
||||||
|
{
|
||||||
|
// delete old 3rd column
|
||||||
|
m_objects_ctrl->DeleteColumn(m_objects_ctrl->GetColumnAt(3));
|
||||||
|
// insert new created 3rd column
|
||||||
|
m_objects_ctrl->InsertColumn(3, object_ctrl_create_extruder_column(extruders_count));
|
||||||
|
// set show/hide for this column
|
||||||
|
set_extruder_column_hidden(extruders_count <= 1);
|
||||||
|
}
|
||||||
|
|
||||||
} //namespace GUI
|
} //namespace GUI
|
||||||
} //namespace Slic3r
|
} //namespace Slic3r
|
@ -118,6 +118,9 @@ void on_begin_drag(wxDataViewEvent &event);
|
|||||||
void on_drop_possible(wxDataViewEvent &event);
|
void on_drop_possible(wxDataViewEvent &event);
|
||||||
void on_drop(wxDataViewEvent &event);
|
void on_drop(wxDataViewEvent &event);
|
||||||
|
|
||||||
|
// update extruder column for objects_ctrl according to extruders count
|
||||||
|
void update_objects_list_extruder_column(const int extruders_count);
|
||||||
|
|
||||||
} //namespace GUI
|
} //namespace GUI
|
||||||
} //namespace Slic3r
|
} //namespace Slic3r
|
||||||
#endif //slic3r_GUI_ObjectParts_hpp_
|
#endif //slic3r_GUI_ObjectParts_hpp_
|
@ -1698,6 +1698,7 @@ void TabPrinter::extruders_count_changed(size_t extruders_count){
|
|||||||
build_extruder_pages();
|
build_extruder_pages();
|
||||||
reload_config();
|
reload_config();
|
||||||
on_value_change("extruders_count", extruders_count);
|
on_value_change("extruders_count", extruders_count);
|
||||||
|
update_objects_list_extruder_column(extruders_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabPrinter::append_option_line(ConfigOptionsGroupShp optgroup, const std::string opt_key)
|
void TabPrinter::append_option_line(ConfigOptionsGroupShp optgroup, const std::string opt_key)
|
||||||
@ -2010,7 +2011,6 @@ void Tab::load_current_preset()
|
|||||||
const Preset* parent_preset = m_presets->get_selected_preset_parent();
|
const Preset* parent_preset = m_presets->get_selected_preset_parent();
|
||||||
static_cast<TabPrinter*>(this)->m_sys_extruders_count = parent_preset == nullptr ? 0 :
|
static_cast<TabPrinter*>(this)->m_sys_extruders_count = parent_preset == nullptr ? 0 :
|
||||||
static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size();
|
static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size();
|
||||||
set_extruder_column_hidden(static_cast<TabPrinter*>(this)->m_sys_extruders_count <= 1);
|
|
||||||
}
|
}
|
||||||
m_opt_status_value = (m_presets->get_selected_preset_parent() ? osSystemValue : 0) | osInitValue;
|
m_opt_status_value = (m_presets->get_selected_preset_parent() ? osSystemValue : 0) | osInitValue;
|
||||||
init_options_list();
|
init_options_list();
|
||||||
|
Loading…
Reference in New Issue
Block a user