ENH:FilamentMapDialog add filament type
jira: nojira Change-Id: I08a3c037ffa6227602e71b97697a1bc61e3d5050
This commit is contained in:
parent
c565067954
commit
6621fd0e20
|
@ -8,6 +8,7 @@ struct CustomData
|
||||||
{
|
{
|
||||||
int filament_id;
|
int filament_id;
|
||||||
unsigned char r, g, b, a;
|
unsigned char r, g, b, a;
|
||||||
|
std::string type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,12 +36,13 @@ wxColor Hex2Color(const std::string& str)
|
||||||
class ColorDataObject : public wxCustomDataObject
|
class ColorDataObject : public wxCustomDataObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ColorDataObject(const wxColour &color = *wxBLACK, int filament_id = 0)
|
ColorDataObject(const wxColour &color = *wxBLACK, int filament_id = 0, const std::string &type = "PLA")
|
||||||
: wxCustomDataObject(wxDataFormat("application/customize_format"))
|
: wxCustomDataObject(wxDataFormat("application/customize_format"))
|
||||||
{
|
{
|
||||||
std::memset(&m_data, 0, sizeof(m_data));
|
std::memset(&m_data, 0, sizeof(m_data));
|
||||||
set_custom_data_filament_id(filament_id);
|
set_custom_data_filament_id(filament_id);
|
||||||
set_custom_data_color(color);
|
set_custom_data_color(color);
|
||||||
|
set_custom_data_type(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour GetColor() const { return wxColor(m_data.r, m_data.g, m_data.b, m_data.a); }
|
wxColour GetColor() const { return wxColor(m_data.r, m_data.g, m_data.b, m_data.a); }
|
||||||
|
@ -49,6 +51,13 @@ public:
|
||||||
int GetFilament() const { return m_data.filament_id; }
|
int GetFilament() const { return m_data.filament_id; }
|
||||||
void SetFilament(int label) { set_custom_data_filament_id(label); }
|
void SetFilament(int label) { set_custom_data_filament_id(label); }
|
||||||
|
|
||||||
|
std::string GetType() const { return m_data.type; }
|
||||||
|
void SetType(const std::string &type) { set_custom_data_type(type); }
|
||||||
|
|
||||||
|
void set_custom_data_type(const std::string& type) {
|
||||||
|
m_data.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
void set_custom_data_filament_id(int filament_id) {
|
void set_custom_data_filament_id(int filament_id) {
|
||||||
m_data.filament_id = filament_id;
|
m_data.filament_id = filament_id;
|
||||||
}
|
}
|
||||||
|
@ -81,8 +90,8 @@ private:
|
||||||
|
|
||||||
/////////////// ColorPanel start ////////////////////////
|
/////////////// ColorPanel start ////////////////////////
|
||||||
// The UI panel of drag item
|
// The UI panel of drag item
|
||||||
ColorPanel::ColorPanel(DragDropPanel *parent, const wxColour &color, int filament_id)
|
ColorPanel::ColorPanel(DragDropPanel *parent, const wxColour &color, int filament_id, const std::string &type)
|
||||||
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(32, 40), wxBORDER_NONE), m_parent(parent), m_color(color), m_filament_id(filament_id)
|
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(32, 40), wxBORDER_NONE), m_parent(parent), m_color(color), m_filament_id(filament_id), m_type(type)
|
||||||
{
|
{
|
||||||
Bind(wxEVT_LEFT_DOWN, &ColorPanel::OnLeftDown, this);
|
Bind(wxEVT_LEFT_DOWN, &ColorPanel::OnLeftDown, this);
|
||||||
Bind(wxEVT_LEFT_UP, &ColorPanel::OnLeftUp, this);
|
Bind(wxEVT_LEFT_UP, &ColorPanel::OnLeftUp, this);
|
||||||
|
@ -92,7 +101,7 @@ ColorPanel::ColorPanel(DragDropPanel *parent, const wxColour &color, int filamen
|
||||||
void ColorPanel::OnLeftDown(wxMouseEvent &event)
|
void ColorPanel::OnLeftDown(wxMouseEvent &event)
|
||||||
{
|
{
|
||||||
m_parent->set_is_draging(true);
|
m_parent->set_is_draging(true);
|
||||||
m_parent->DoDragDrop(this, GetColor(), GetFilamentId());
|
m_parent->DoDragDrop(this, GetColor(), GetType(), GetFilamentId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPanel::OnLeftUp(wxMouseEvent &event) { m_parent->set_is_draging(false); }
|
void ColorPanel::OnLeftUp(wxMouseEvent &event) { m_parent->set_is_draging(false); }
|
||||||
|
@ -101,16 +110,38 @@ void ColorPanel::OnPaint(wxPaintEvent &event)
|
||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
wxSize size = GetSize();
|
wxSize size = GetSize();
|
||||||
|
// If it matches the parent's width, it will not be displayed completely
|
||||||
|
int svg_size = size.GetWidth() - FromDIP(3);
|
||||||
|
int type_label_height = FromDIP(10);
|
||||||
|
wxString type_label(m_type);
|
||||||
|
int type_label_margin = FromDIP(6);
|
||||||
|
|
||||||
std::string replace_color = m_color.GetAsString(wxC2S_HTML_SYNTAX).ToStdString();
|
std::string replace_color = m_color.GetAsString(wxC2S_HTML_SYNTAX).ToStdString();
|
||||||
std::string svg_name = "outlined_rect";
|
std::string svg_name = "outlined_rect";
|
||||||
if (replace_color == "#FFFFFF00") {
|
if (replace_color == "#FFFFFF00") {
|
||||||
svg_name = "outlined_rect_transparent";
|
svg_name = "outlined_rect_transparent";
|
||||||
}
|
}
|
||||||
wxBitmap bmp = ScalableBitmap(this, svg_name, 35, false, false, false, { replace_color }).bmp();
|
wxBitmap bmp = ScalableBitmap(this, svg_name, svg_size, false, false, false, { replace_color }).bmp();
|
||||||
dc.DrawBitmap(bmp, wxPoint(0,0));
|
// ScalableBitmap is not drawn at position (0, 0) by default, why?
|
||||||
|
dc.DrawBitmap(bmp, wxPoint(-FromDIP(3), -FromDIP(3)));
|
||||||
|
|
||||||
|
//dc.SetPen(wxPen(*wxBLACK, 1));
|
||||||
|
//dc.DrawRectangle(0, 0, FromDIP(25), FromDIP(25));
|
||||||
|
|
||||||
wxString label = wxString::Format(wxT("%d"), m_filament_id);
|
wxString label = wxString::Format(wxT("%d"), m_filament_id);
|
||||||
dc.SetTextForeground(m_color.GetLuminance() < 0.51 ? *wxWHITE : *wxBLACK); // set text color
|
dc.SetTextForeground(m_color.GetLuminance() < 0.51 ? *wxWHITE : *wxBLACK); // set text color
|
||||||
dc.DrawLabel(label, wxRect(2, -3, size.GetWidth(), size.GetHeight()), wxALIGN_CENTER);
|
dc.DrawLabel(label, wxRect(0, 0, svg_size, svg_size), wxALIGN_CENTER);
|
||||||
|
|
||||||
|
dc.SetTextForeground(*wxBLACK);
|
||||||
|
if (type_label.length() > 4) {
|
||||||
|
// text is too long
|
||||||
|
wxString first = type_label.Mid(0, 4);
|
||||||
|
wxString rest = type_label.Mid(4);
|
||||||
|
dc.DrawLabel(first, wxRect(0, svg_size + type_label_margin, svg_size, type_label_height), wxALIGN_CENTER);
|
||||||
|
dc.DrawLabel(rest, wxRect(0, svg_size + type_label_height + type_label_margin, svg_size, type_label_height), wxALIGN_CENTER);
|
||||||
|
}else {
|
||||||
|
dc.DrawLabel(type_label, wxRect(0, svg_size + type_label_margin, svg_size, type_label_height), wxALIGN_CENTER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/////////////// ColorPanel end ////////////////////////
|
/////////////// ColorPanel end ////////////////////////
|
||||||
|
|
||||||
|
@ -119,10 +150,11 @@ void ColorPanel::OnPaint(wxPaintEvent &event)
|
||||||
class ColorDropSource : public wxDropSource
|
class ColorDropSource : public wxDropSource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ColorDropSource(wxPanel *parent, wxPanel *color_block, const wxColour &color, int filament_id) : wxDropSource(parent)
|
ColorDropSource(wxPanel *parent, wxPanel *color_block, const wxColour &color, const std::string& type, int filament_id) : wxDropSource(parent)
|
||||||
{
|
{
|
||||||
m_data.SetColor(color);
|
m_data.SetColor(color);
|
||||||
m_data.SetFilament(filament_id);
|
m_data.SetFilament(filament_id);
|
||||||
|
m_data.SetType(type);
|
||||||
SetData(m_data); // Set drag source data
|
SetData(m_data); // Set drag source data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +189,7 @@ wxDragResult ColorDropTarget::OnData(wxCoord x, wxCoord y, wxDragResult def)
|
||||||
return wxDragNone;
|
return wxDragNone;
|
||||||
|
|
||||||
ColorDataObject *dataObject = dynamic_cast<ColorDataObject *>(GetDataObject());
|
ColorDataObject *dataObject = dynamic_cast<ColorDataObject *>(GetDataObject());
|
||||||
m_panel->AddColorBlock(m_data->GetColor(), m_data->GetFilament());
|
m_panel->AddColorBlock(m_data->GetColor(), m_data->GetType(), m_data->GetFilament());
|
||||||
|
|
||||||
return wxDragCopy;
|
return wxDragCopy;
|
||||||
}
|
}
|
||||||
|
@ -184,10 +216,10 @@ DragDropPanel::DragDropPanel(wxWindow *parent, const wxString &label, bool is_au
|
||||||
title_sizer->Add(static_text, 0, wxALIGN_CENTER | wxALL, FromDIP(5));
|
title_sizer->Add(static_text, 0, wxALIGN_CENTER | wxALL, FromDIP(5));
|
||||||
|
|
||||||
m_sizer->Add(title_panel, 0, wxEXPAND);
|
m_sizer->Add(title_panel, 0, wxEXPAND);
|
||||||
m_sizer->AddSpacer(20);
|
m_sizer->AddSpacer(10);
|
||||||
|
|
||||||
m_grid_item_sizer = new wxGridSizer(0, 6, FromDIP(4),FromDIP(4)); // row = 0, col = 3, 10 10 is space
|
m_grid_item_sizer = new wxGridSizer(0, 6, FromDIP(8), FromDIP(8)); // row = 0, col = 3, 10 10 is space
|
||||||
m_sizer->Add(m_grid_item_sizer, 1, wxEXPAND);
|
m_sizer->Add(m_grid_item_sizer, 1, wxEXPAND | wxALL, FromDIP(8));
|
||||||
|
|
||||||
// set droptarget
|
// set droptarget
|
||||||
auto drop_target = new ColorDropTarget(this);
|
auto drop_target = new ColorDropTarget(this);
|
||||||
|
@ -198,10 +230,10 @@ DragDropPanel::DragDropPanel(wxWindow *parent, const wxString &label, bool is_au
|
||||||
Fit();
|
Fit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DragDropPanel::AddColorBlock(const wxColour &color, int filament_id, bool update_ui)
|
void DragDropPanel::AddColorBlock(const wxColour &color, const std::string &type, int filament_id, bool update_ui)
|
||||||
{
|
{
|
||||||
ColorPanel *panel = new ColorPanel(this, color, filament_id);
|
ColorPanel *panel = new ColorPanel(this, color, filament_id, type);
|
||||||
panel->SetMinSize(wxSize(FromDIP(32), FromDIP(40)));
|
panel->SetMinSize(wxSize(FromDIP(30), FromDIP(60)));
|
||||||
m_grid_item_sizer->Add(panel, 0);
|
m_grid_item_sizer->Add(panel, 0);
|
||||||
m_filament_blocks.push_back(panel);
|
m_filament_blocks.push_back(panel);
|
||||||
if (update_ui) {
|
if (update_ui) {
|
||||||
|
@ -222,12 +254,12 @@ void DragDropPanel::RemoveColorBlock(ColorPanel *panel, bool update_ui)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DragDropPanel::DoDragDrop(ColorPanel *panel, const wxColour &color, int filament_id)
|
void DragDropPanel::DoDragDrop(ColorPanel *panel, const wxColour &color, const std::string &type, int filament_id)
|
||||||
{
|
{
|
||||||
if (m_is_auto)
|
if (m_is_auto)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ColorDropSource source(this, panel, color, filament_id);
|
ColorDropSource source(this, panel, color, type, filament_id);
|
||||||
if (source.DoDragDrop(wxDrag_CopyOnly) == wxDragResult::wxDragCopy) {
|
if (source.DoDragDrop(wxDrag_CopyOnly) == wxDragResult::wxDragCopy) {
|
||||||
this->RemoveColorBlock(panel);
|
this->RemoveColorBlock(panel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ class DragDropPanel : public wxPanel
|
||||||
public:
|
public:
|
||||||
DragDropPanel(wxWindow *parent, const wxString &label, bool is_auto);
|
DragDropPanel(wxWindow *parent, const wxString &label, bool is_auto);
|
||||||
|
|
||||||
void AddColorBlock(const wxColour &color, int filament_id, bool update_ui = true);
|
void AddColorBlock(const wxColour &color, const std::string &type, int filament_id, bool update_ui = true);
|
||||||
void RemoveColorBlock(ColorPanel *panel, bool update_ui = true);
|
void RemoveColorBlock(ColorPanel *panel, bool update_ui = true);
|
||||||
void DoDragDrop(ColorPanel *panel, const wxColour &color, int filament_id);
|
void DoDragDrop(ColorPanel *panel, const wxColour &color, const std::string &type, int filament_id);
|
||||||
|
|
||||||
std::vector<int> GetAllFilaments() const;
|
std::vector<int> GetAllFilaments() const;
|
||||||
|
|
||||||
|
@ -46,10 +46,11 @@ private:
|
||||||
class ColorPanel : public wxPanel
|
class ColorPanel : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ColorPanel(DragDropPanel *parent, const wxColour &color, int filament_id);
|
ColorPanel(DragDropPanel *parent, const wxColour &color, int filament_id, const std::string& type);
|
||||||
|
|
||||||
wxColour GetColor() const { return m_color; }
|
wxColour GetColor() const { return m_color; }
|
||||||
int GetFilamentId() const { return m_filament_id; }
|
int GetFilamentId() const { return m_filament_id; }
|
||||||
|
std::string GetType() const { return m_type; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnLeftDown(wxMouseEvent &event);
|
void OnLeftDown(wxMouseEvent &event);
|
||||||
|
@ -58,7 +59,9 @@ private:
|
||||||
|
|
||||||
DragDropPanel *m_parent;
|
DragDropPanel *m_parent;
|
||||||
wxColor m_color;
|
wxColor m_color;
|
||||||
|
std::string m_type;
|
||||||
int m_filament_id;
|
int m_filament_id;
|
||||||
|
|
||||||
};
|
};
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ bool try_pop_up_before_slice(bool is_slice_all, Plater* plater_ref, PartPlate* p
|
||||||
bool sync_plate = true;
|
bool sync_plate = true;
|
||||||
|
|
||||||
std::vector<std::string> filament_colors = full_config.option<ConfigOptionStrings>("filament_colour")->values;
|
std::vector<std::string> filament_colors = full_config.option<ConfigOptionStrings>("filament_colour")->values;
|
||||||
|
std::vector<std::string> filament_types = full_config.option<ConfigOptionStrings>("filament_type")->values;
|
||||||
FilamentMapMode applied_mode = get_applied_map_mode(full_config, plater_ref,partplate_ref, sync_plate);
|
FilamentMapMode applied_mode = get_applied_map_mode(full_config, plater_ref,partplate_ref, sync_plate);
|
||||||
std::vector<int> applied_maps = get_applied_map(full_config, plater_ref, partplate_ref, sync_plate);
|
std::vector<int> applied_maps = get_applied_map(full_config, plater_ref, partplate_ref, sync_plate);
|
||||||
applied_maps.resize(filament_colors.size(), 1);
|
applied_maps.resize(filament_colors.size(), 1);
|
||||||
|
@ -65,6 +66,7 @@ bool try_pop_up_before_slice(bool is_slice_all, Plater* plater_ref, PartPlate* p
|
||||||
|
|
||||||
FilamentMapDialog map_dlg(plater_ref,
|
FilamentMapDialog map_dlg(plater_ref,
|
||||||
filament_colors,
|
filament_colors,
|
||||||
|
filament_types,
|
||||||
applied_maps,
|
applied_maps,
|
||||||
filament_lists,
|
filament_lists,
|
||||||
applied_mode,
|
applied_mode,
|
||||||
|
@ -126,13 +128,14 @@ static const StateColor btn_text_white(std::pair<wxColour, int>(wxColour(38, 46,
|
||||||
|
|
||||||
FilamentMapDialog::FilamentMapDialog(wxWindow *parent,
|
FilamentMapDialog::FilamentMapDialog(wxWindow *parent,
|
||||||
const std::vector<std::string> &filament_color,
|
const std::vector<std::string> &filament_color,
|
||||||
|
const std::vector<std::string> &filament_type,
|
||||||
const std::vector<int> &filament_map,
|
const std::vector<int> &filament_map,
|
||||||
const std::vector<int> &filaments,
|
const std::vector<int> &filaments,
|
||||||
const FilamentMapMode mode,
|
const FilamentMapMode mode,
|
||||||
bool machine_synced,
|
bool machine_synced,
|
||||||
bool show_default,
|
bool show_default,
|
||||||
bool with_checkbox)
|
bool with_checkbox)
|
||||||
: wxDialog(parent, wxID_ANY, _L("Filament grouping"), wxDefaultPosition, wxDefaultSize,wxDEFAULT_DIALOG_STYLE), m_filament_color(filament_color), m_filament_map(filament_map)
|
: wxDialog(parent, wxID_ANY, _L("Filament grouping"), wxDefaultPosition, wxDefaultSize,wxDEFAULT_DIALOG_STYLE), m_filament_color(filament_color), m_filament_type(filament_type), m_filament_map(filament_map)
|
||||||
{
|
{
|
||||||
SetBackgroundColour(*wxWHITE);
|
SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
|
@ -174,7 +177,7 @@ FilamentMapDialog::FilamentMapDialog(wxWindow *parent,
|
||||||
mode == fmmAutoForMatch && !machine_synced ? fmmAutoForFlush :
|
mode == fmmAutoForMatch && !machine_synced ? fmmAutoForFlush :
|
||||||
mode;
|
mode;
|
||||||
|
|
||||||
m_manual_map_panel = new FilamentMapManualPanel(this, m_filament_color, filaments, filament_map);
|
m_manual_map_panel = new FilamentMapManualPanel(this, m_filament_color, m_filament_type, filaments, filament_map);
|
||||||
m_auto_map_panel = new FilamentMapAutoPanel(this, default_auto_mode, machine_synced);
|
m_auto_map_panel = new FilamentMapAutoPanel(this, default_auto_mode, machine_synced);
|
||||||
if (show_default)
|
if (show_default)
|
||||||
m_default_map_panel = new FilamentMapDefaultPanel(this);
|
m_default_map_panel = new FilamentMapDefaultPanel(this);
|
||||||
|
|
|
@ -40,6 +40,7 @@ class FilamentMapDialog : public wxDialog
|
||||||
public:
|
public:
|
||||||
FilamentMapDialog(wxWindow *parent,
|
FilamentMapDialog(wxWindow *parent,
|
||||||
const std::vector<std::string>& filament_color,
|
const std::vector<std::string>& filament_color,
|
||||||
|
const std::vector<std::string>& filament_type,
|
||||||
const std::vector<int> &filament_map,
|
const std::vector<int> &filament_map,
|
||||||
const std::vector<int> &filaments,
|
const std::vector<int> &filaments,
|
||||||
const FilamentMapMode mode,
|
const FilamentMapMode mode,
|
||||||
|
@ -83,6 +84,7 @@ private:
|
||||||
private:
|
private:
|
||||||
std::vector<int> m_filament_map;
|
std::vector<int> m_filament_map;
|
||||||
std::vector<std::string> m_filament_color;
|
std::vector<std::string> m_filament_color;
|
||||||
|
std::vector<std::string> m_filament_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
|
|
@ -18,9 +18,10 @@ static const wxColour TextDisableColor = wxColour("#CECECE");
|
||||||
|
|
||||||
FilamentMapManualPanel::FilamentMapManualPanel(wxWindow *parent,
|
FilamentMapManualPanel::FilamentMapManualPanel(wxWindow *parent,
|
||||||
const std::vector<std::string> &color,
|
const std::vector<std::string> &color,
|
||||||
|
const std::vector<std::string> &type,
|
||||||
const std::vector<int> &filament_list,
|
const std::vector<int> &filament_list,
|
||||||
const std::vector<int> &filament_map)
|
const std::vector<int> &filament_map)
|
||||||
: wxPanel(parent), m_filament_map(filament_map), m_filament_color(color), m_filament_list(filament_list)
|
: wxPanel(parent), m_filament_map(filament_map), m_filament_color(color), m_filament_type(type), m_filament_list(filament_list)
|
||||||
{
|
{
|
||||||
SetBackgroundColour(BgNormalColor);
|
SetBackgroundColour(BgNormalColor);
|
||||||
|
|
||||||
|
@ -40,15 +41,16 @@ FilamentMapManualPanel::FilamentMapManualPanel(wxWindow *p
|
||||||
auto iter = std::find(m_filament_list.begin(), m_filament_list.end(), idx + 1);
|
auto iter = std::find(m_filament_list.begin(), m_filament_list.end(), idx + 1);
|
||||||
if (iter == m_filament_list.end()) continue;
|
if (iter == m_filament_list.end()) continue;
|
||||||
wxColor color = Hex2Color(m_filament_color[idx]);
|
wxColor color = Hex2Color(m_filament_color[idx]);
|
||||||
|
std::string type = m_filament_type[idx];
|
||||||
if (m_filament_map[idx] == 1) {
|
if (m_filament_map[idx] == 1) {
|
||||||
m_left_panel->AddColorBlock(color, idx + 1);
|
m_left_panel->AddColorBlock(color, type, idx + 1);
|
||||||
} else {
|
} else {
|
||||||
assert(m_filament_map[idx] == 2);
|
assert(m_filament_map[idx] == 2);
|
||||||
m_right_panel->AddColorBlock(color, idx + 1);
|
m_right_panel->AddColorBlock(color, type, idx + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_left_panel->SetMinSize({ FromDIP(220),-1 });
|
m_left_panel->SetMinSize({ FromDIP(260),-1 });
|
||||||
m_right_panel->SetMinSize({ FromDIP(220),-1 });
|
m_right_panel->SetMinSize({ FromDIP(260),-1 });
|
||||||
|
|
||||||
drag_sizer->AddStretchSpacer();
|
drag_sizer->AddStretchSpacer();
|
||||||
drag_sizer->Add(m_left_panel, 1, wxALIGN_CENTER | wxEXPAND);
|
drag_sizer->Add(m_left_panel, 1, wxALIGN_CENTER | wxEXPAND);
|
||||||
|
@ -80,12 +82,12 @@ void FilamentMapManualPanel::OnSwitchFilament(wxCommandEvent &)
|
||||||
auto right_blocks = m_right_panel->get_filament_blocks();
|
auto right_blocks = m_right_panel->get_filament_blocks();
|
||||||
|
|
||||||
for (auto &block : left_blocks) {
|
for (auto &block : left_blocks) {
|
||||||
m_right_panel->AddColorBlock(block->GetColor(), block->GetFilamentId(), false);
|
m_right_panel->AddColorBlock(block->GetColor(), block->GetType(), block->GetFilamentId(), false);
|
||||||
m_left_panel->RemoveColorBlock(block, false);
|
m_left_panel->RemoveColorBlock(block, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &block : right_blocks) {
|
for (auto &block : right_blocks) {
|
||||||
m_left_panel->AddColorBlock(block->GetColor(), block->GetFilamentId(), false);
|
m_left_panel->AddColorBlock(block->GetColor(), block->GetType(), block->GetFilamentId(), false);
|
||||||
m_right_panel->RemoveColorBlock(block, false);
|
m_right_panel->RemoveColorBlock(block, false);
|
||||||
}
|
}
|
||||||
this->GetParent()->Layout();
|
this->GetParent()->Layout();
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Slic3r { namespace GUI {
|
||||||
class FilamentMapManualPanel : public wxPanel
|
class FilamentMapManualPanel : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FilamentMapManualPanel(wxWindow *parent, const std::vector<std::string> &color, const std::vector<int> &filament_list, const std::vector<int> &filament_map);
|
FilamentMapManualPanel(wxWindow *parent, const std::vector<std::string> &color, const std::vector<std::string> &type, const std::vector<int> &filament_list, const std::vector<int> &filament_map);
|
||||||
|
|
||||||
std::vector<int> GetFilamentMaps() const { return m_filament_map; }
|
std::vector<int> GetFilamentMaps() const { return m_filament_map; }
|
||||||
std::vector<int> GetLeftFilaments() const { return m_left_panel->GetAllFilaments(); }
|
std::vector<int> GetLeftFilaments() const { return m_left_panel->GetAllFilaments(); }
|
||||||
|
@ -33,6 +33,7 @@ private:
|
||||||
std::vector<int> m_filament_map;
|
std::vector<int> m_filament_map;
|
||||||
std::vector<int> m_filament_list;
|
std::vector<int> m_filament_list;
|
||||||
std::vector<std::string> m_filament_color;
|
std::vector<std::string> m_filament_color;
|
||||||
|
std::vector<std::string> m_filament_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FilamentMapBtnPanel : public wxPanel
|
class FilamentMapBtnPanel : public wxPanel
|
||||||
|
|
|
@ -4735,7 +4735,7 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
|
||||||
filament_group_item_align_width = max(filament_group_item_align_width, text_size.x);
|
filament_group_item_align_width = max(filament_group_item_align_width, text_size.x);
|
||||||
text_line_height = max(text_line_height, text_size.y);
|
text_line_height = max(text_line_height, text_size.y);
|
||||||
}
|
}
|
||||||
container_height += (three_words_width * 1.5f + text_line_height );
|
container_height += (three_words_width * 1.2f + text_line_height );
|
||||||
}
|
}
|
||||||
container_height += 2 * line_height;
|
container_height += 2 * line_height;
|
||||||
ams_item_height = std::max(ams_item_height, container_height);
|
ams_item_height = std::max(ams_item_height, container_height);
|
||||||
|
|
|
@ -14929,9 +14929,12 @@ std::vector<std::array<float, 4>> Plater::get_extruders_colors()
|
||||||
bool Plater::update_filament_colors_in_full_config()
|
bool Plater::update_filament_colors_in_full_config()
|
||||||
{
|
{
|
||||||
DynamicPrintConfig& project_config = wxGetApp().preset_bundle->project_config;
|
DynamicPrintConfig& project_config = wxGetApp().preset_bundle->project_config;
|
||||||
|
const auto& full_config = wxGetApp().preset_bundle->full_config();
|
||||||
ConfigOptionStrings* color_opt = project_config.option<ConfigOptionStrings>("filament_colour");
|
ConfigOptionStrings* color_opt = project_config.option<ConfigOptionStrings>("filament_colour");
|
||||||
|
const ConfigOptionStrings* type_opt = full_config.option<ConfigOptionStrings>("filament_type");
|
||||||
|
|
||||||
p->config->option<ConfigOptionStrings>("filament_colour")->values = color_opt->values;
|
p->config->option<ConfigOptionStrings>("filament_colour")->values = color_opt->values;
|
||||||
|
p->config->option<ConfigOptionStrings>("filament_type")->values = type_opt->values;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16160,6 +16163,7 @@ void Plater::open_filament_map_setting_dialog(wxCommandEvent &evt)
|
||||||
|
|
||||||
const auto& project_config = wxGetApp().preset_bundle->project_config;
|
const auto& project_config = wxGetApp().preset_bundle->project_config;
|
||||||
auto filament_colors = config()->option<ConfigOptionStrings>("filament_colour")->values;
|
auto filament_colors = config()->option<ConfigOptionStrings>("filament_colour")->values;
|
||||||
|
auto filament_types = config()->option<ConfigOptionStrings>("filament_type")->values;
|
||||||
|
|
||||||
auto plate_filament_maps = curr_plate->get_real_filament_maps(project_config);
|
auto plate_filament_maps = curr_plate->get_real_filament_maps(project_config);
|
||||||
auto plate_filament_map_mode = curr_plate->get_filament_map_mode();
|
auto plate_filament_map_mode = curr_plate->get_filament_map_mode();
|
||||||
|
@ -16168,6 +16172,7 @@ void Plater::open_filament_map_setting_dialog(wxCommandEvent &evt)
|
||||||
|
|
||||||
FilamentMapDialog filament_dlg(this,
|
FilamentMapDialog filament_dlg(this,
|
||||||
filament_colors,
|
filament_colors,
|
||||||
|
filament_types,
|
||||||
plate_filament_maps,
|
plate_filament_maps,
|
||||||
curr_plate->get_extruders(true),
|
curr_plate->get_extruders(true),
|
||||||
plate_filament_map_mode,
|
plate_filament_map_mode,
|
||||||
|
|
Loading…
Reference in New Issue