ENABLE_GCODE_VIEWER -> Preview toolbar checkboxes moved into a new combo
This commit is contained in:
parent
e5c45405d4
commit
d8091b7ad7
@ -250,6 +250,23 @@ void GCodeViewer::set_toolpath_move_type_visible(GCodeProcessor::EMoveType type,
|
|||||||
m_buffers[id].visible = visible;
|
m_buffers[id].visible = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GCodeViewer::set_options_visibility_from_flags(unsigned int flags)
|
||||||
|
{
|
||||||
|
auto is_flag_set = [flags](unsigned int flag) {
|
||||||
|
return (flags& (1 << flag)) != 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Travel, is_flag_set(0));
|
||||||
|
set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Retract, is_flag_set(1));
|
||||||
|
set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Unretract, is_flag_set(2));
|
||||||
|
set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Tool_change, is_flag_set(3));
|
||||||
|
set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Color_change, is_flag_set(4));
|
||||||
|
set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Pause_Print, is_flag_set(5));
|
||||||
|
set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Custom_GCode, is_flag_set(6));
|
||||||
|
m_shells.visible = is_flag_set(7);
|
||||||
|
enable_legend(is_flag_set(8));
|
||||||
|
}
|
||||||
|
|
||||||
bool GCodeViewer::init_shaders()
|
bool GCodeViewer::init_shaders()
|
||||||
{
|
{
|
||||||
unsigned char begin_id = buffer_id(GCodeProcessor::EMoveType::Retract);
|
unsigned char begin_id = buffer_id(GCodeProcessor::EMoveType::Retract);
|
||||||
|
@ -194,9 +194,7 @@ public:
|
|||||||
bool is_toolpath_move_type_visible(GCodeProcessor::EMoveType type) const;
|
bool is_toolpath_move_type_visible(GCodeProcessor::EMoveType type) const;
|
||||||
void set_toolpath_move_type_visible(GCodeProcessor::EMoveType type, bool visible);
|
void set_toolpath_move_type_visible(GCodeProcessor::EMoveType type, bool visible);
|
||||||
void set_toolpath_role_visibility_flags(unsigned int flags) { m_extrusions.role_visibility_flags = flags; }
|
void set_toolpath_role_visibility_flags(unsigned int flags) { m_extrusions.role_visibility_flags = flags; }
|
||||||
|
void set_options_visibility_from_flags(unsigned int flags);
|
||||||
bool are_shells_visible() const { return m_shells.visible; }
|
|
||||||
void set_shells_visible(bool visible) { m_shells.visible = visible; }
|
|
||||||
|
|
||||||
bool is_legend_enabled() const { return m_legend_enabled; }
|
bool is_legend_enabled() const { return m_legend_enabled; }
|
||||||
void enable_legend(bool enable) { m_legend_enabled = enable; }
|
void enable_legend(bool enable) { m_legend_enabled = enable; }
|
||||||
|
@ -2332,9 +2332,9 @@ const std::vector<double>& GLCanvas3D::get_layers_zs() const
|
|||||||
return m_gcode_viewer.get_layers_zs();
|
return m_gcode_viewer.get_layers_zs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::set_toolpath_move_type_visible(GCodeProcessor::EMoveType type, bool visible)
|
void GLCanvas3D::set_gcode_options_visibility_from_flags(unsigned int flags)
|
||||||
{
|
{
|
||||||
m_gcode_viewer.set_toolpath_move_type_visible(type, visible);
|
m_gcode_viewer.set_options_visibility_from_flags(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::set_toolpath_role_visibility_flags(unsigned int flags)
|
void GLCanvas3D::set_toolpath_role_visibility_flags(unsigned int flags)
|
||||||
@ -2346,11 +2346,6 @@ void GLCanvas3D::set_toolpath_view_type(GCodeViewer::EViewType type)
|
|||||||
{
|
{
|
||||||
m_gcode_viewer.set_view_type(type);
|
m_gcode_viewer.set_view_type(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::set_shells_visible(bool visible)
|
|
||||||
{
|
|
||||||
m_gcode_viewer.set_shells_visible(visible);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
std::vector<double> GLCanvas3D::get_current_print_zs(bool active_only) const
|
std::vector<double> GLCanvas3D::get_current_print_zs(bool active_only) const
|
||||||
{
|
{
|
||||||
|
@ -647,10 +647,9 @@ public:
|
|||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
const std::vector<double>& get_layers_zs() const;
|
const std::vector<double>& get_layers_zs() const;
|
||||||
void set_toolpath_move_type_visible(GCodeProcessor::EMoveType type, bool visible);
|
void set_gcode_options_visibility_from_flags(unsigned int flags);
|
||||||
void set_toolpath_role_visibility_flags(unsigned int flags);
|
void set_toolpath_role_visibility_flags(unsigned int flags);
|
||||||
void set_toolpath_view_type(GCodeViewer::EViewType type);
|
void set_toolpath_view_type(GCodeViewer::EViewType type);
|
||||||
void set_shells_visible(bool visible);
|
|
||||||
#else
|
#else
|
||||||
std::vector<double> get_current_print_zs(bool active_only) const;
|
std::vector<double> get_current_print_zs(bool active_only) const;
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
@ -259,7 +259,7 @@ void warning_catcher(wxWindow* parent, const wxString& message)
|
|||||||
msg.ShowModal();
|
msg.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_combochecklist(wxComboCtrl* comboCtrl, std::string text, std::string items, bool initial_value)
|
void create_combochecklist(wxComboCtrl* comboCtrl, const std::string& text, const std::string& items)
|
||||||
{
|
{
|
||||||
if (comboCtrl == nullptr)
|
if (comboCtrl == nullptr)
|
||||||
return;
|
return;
|
||||||
@ -273,8 +273,9 @@ void create_combochecklist(wxComboCtrl* comboCtrl, std::string text, std::string
|
|||||||
|
|
||||||
comboCtrl->EnablePopupAnimation(false);
|
comboCtrl->EnablePopupAnimation(false);
|
||||||
comboCtrl->SetPopupControl(popup);
|
comboCtrl->SetPopupControl(popup);
|
||||||
popup->SetStringValue(from_u8(text));
|
wxString title = from_u8(text);
|
||||||
popup->Bind(wxEVT_CHECKLISTBOX, [popup](wxCommandEvent& evt) { popup->OnCheckListBox(evt); });
|
popup->SetStringValue(title);
|
||||||
|
popup->Bind(wxEVT_CHECKLISTBOX, [popup](wxCommandEvent& evt) { popup->OnCheckListBox(evt); });
|
||||||
popup->Bind(wxEVT_LISTBOX, [popup](wxCommandEvent& evt) { popup->OnListBoxSelection(evt); });
|
popup->Bind(wxEVT_LISTBOX, [popup](wxCommandEvent& evt) { popup->OnListBoxSelection(evt); });
|
||||||
popup->Bind(wxEVT_KEY_DOWN, [popup](wxKeyEvent& evt) { popup->OnKeyEvent(evt); });
|
popup->Bind(wxEVT_KEY_DOWN, [popup](wxKeyEvent& evt) { popup->OnKeyEvent(evt); });
|
||||||
popup->Bind(wxEVT_KEY_UP, [popup](wxKeyEvent& evt) { popup->OnKeyEvent(evt); });
|
popup->Bind(wxEVT_KEY_UP, [popup](wxKeyEvent& evt) { popup->OnKeyEvent(evt); });
|
||||||
@ -282,16 +283,16 @@ void create_combochecklist(wxComboCtrl* comboCtrl, std::string text, std::string
|
|||||||
std::vector<std::string> items_str;
|
std::vector<std::string> items_str;
|
||||||
boost::split(items_str, items, boost::is_any_of("|"), boost::token_compress_off);
|
boost::split(items_str, items, boost::is_any_of("|"), boost::token_compress_off);
|
||||||
|
|
||||||
for (const std::string& item : items_str)
|
// each item must be composed by 2 parts
|
||||||
{
|
assert(items_str.size() %2 == 0);
|
||||||
popup->Append(from_u8(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < popup->GetCount(); ++i)
|
for (size_t i = 0; i < items_str.size(); i += 2)
|
||||||
{
|
{
|
||||||
popup->Check(i, initial_value);
|
wxString label = from_u8(items_str[i]);
|
||||||
}
|
popup->Append(label);
|
||||||
}
|
popup->Check(i / 2, items_str[i + 1] == "1");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int combochecklist_get_flags(wxComboCtrl* comboCtrl)
|
int combochecklist_get_flags(wxComboCtrl* comboCtrl)
|
||||||
|
@ -49,9 +49,9 @@ inline void show_info(wxWindow* parent, const std::string& message,const std::st
|
|||||||
void warning_catcher(wxWindow* parent, const wxString& message);
|
void warning_catcher(wxWindow* parent, const wxString& message);
|
||||||
|
|
||||||
// Creates a wxCheckListBoxComboPopup inside the given wxComboCtrl, filled with the given text and items.
|
// Creates a wxCheckListBoxComboPopup inside the given wxComboCtrl, filled with the given text and items.
|
||||||
// Items are all initialized to the given value.
|
// Items data must be separated by '|', and contain the item name to be shown followed by its initial value (0 for false, 1 for true).
|
||||||
// Items must be separated by '|', for example "Item1|Item2|Item3", and so on.
|
// For example "Item1|0|Item2|1|Item3|0", and so on.
|
||||||
void create_combochecklist(wxComboCtrl* comboCtrl, std::string text, std::string items, bool initial_value);
|
void create_combochecklist(wxComboCtrl* comboCtrl, const std::string& text, const std::string& items);
|
||||||
|
|
||||||
// Returns the current state of the items listed in the wxCheckListBoxComboPopup contained in the given wxComboCtrl,
|
// Returns the current state of the items listed in the wxCheckListBoxComboPopup contained in the given wxComboCtrl,
|
||||||
// encoded inside an int.
|
// encoded inside an int.
|
||||||
|
@ -224,19 +224,17 @@ Preview::Preview(
|
|||||||
, m_double_slider_sizer(nullptr)
|
, m_double_slider_sizer(nullptr)
|
||||||
, m_label_view_type(nullptr)
|
, m_label_view_type(nullptr)
|
||||||
, m_choice_view_type(nullptr)
|
, m_choice_view_type(nullptr)
|
||||||
, m_label_show_features(nullptr)
|
, m_label_show(nullptr)
|
||||||
, m_combochecklist_features(nullptr)
|
, m_combochecklist_features(nullptr)
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
, m_combochecklist_options(nullptr)
|
||||||
|
#else
|
||||||
, m_checkbox_travel(nullptr)
|
, m_checkbox_travel(nullptr)
|
||||||
, m_checkbox_retractions(nullptr)
|
, m_checkbox_retractions(nullptr)
|
||||||
, m_checkbox_unretractions(nullptr)
|
, m_checkbox_unretractions(nullptr)
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
, m_checkbox_tool_changes(nullptr)
|
|
||||||
, m_checkbox_color_changes(nullptr)
|
|
||||||
, m_checkbox_pause_prints(nullptr)
|
|
||||||
, m_checkbox_custom_gcodes(nullptr)
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
, m_checkbox_shells(nullptr)
|
, m_checkbox_shells(nullptr)
|
||||||
, m_checkbox_legend(nullptr)
|
, m_checkbox_legend(nullptr)
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
, m_config(config)
|
, m_config(config)
|
||||||
, m_process(process)
|
, m_process(process)
|
||||||
, m_gcode_preview_data(gcode_preview_data)
|
, m_gcode_preview_data(gcode_preview_data)
|
||||||
@ -308,43 +306,53 @@ bool Preview::init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view
|
|||||||
m_choice_view_type->Append(_(L("Color Print")));
|
m_choice_view_type->Append(_(L("Color Print")));
|
||||||
m_choice_view_type->SetSelection(0);
|
m_choice_view_type->SetSelection(0);
|
||||||
|
|
||||||
m_label_show_features = new wxStaticText(this, wxID_ANY, _(L("Show")));
|
m_label_show = new wxStaticText(this, wxID_ANY, _(L("Show")));
|
||||||
|
|
||||||
m_combochecklist_features = new wxComboCtrl();
|
m_combochecklist_features = new wxComboCtrl();
|
||||||
m_combochecklist_features->Create(this, wxID_ANY, _(L("Feature types")), wxDefaultPosition, wxSize(15 * wxGetApp().em_unit(), -1), wxCB_READONLY);
|
m_combochecklist_features->Create(this, wxID_ANY, _(L("Feature types")), wxDefaultPosition, wxSize(15 * wxGetApp().em_unit(), -1), wxCB_READONLY);
|
||||||
std::string feature_text = GUI::into_u8(_(L("Feature types")));
|
|
||||||
std::string feature_items = GUI::into_u8(
|
std::string feature_items = GUI::into_u8(
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
_L("Unknown") + "|" +
|
_L("Unknown") + "|1|" +
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
_(L("Perimeter")) + "|" +
|
_(L("Perimeter")) + "|1|" +
|
||||||
_(L("External perimeter")) + "|" +
|
_(L("External perimeter")) + "|1|" +
|
||||||
_(L("Overhang perimeter")) + "|" +
|
_(L("Overhang perimeter")) + "|1|" +
|
||||||
_(L("Internal infill")) + "|" +
|
_(L("Internal infill")) + "|1|" +
|
||||||
_(L("Solid infill")) + "|" +
|
_(L("Solid infill")) + "|1|" +
|
||||||
_(L("Top solid infill")) + "|" +
|
_(L("Top solid infill")) + "|1|" +
|
||||||
_(L("Bridge infill")) + "|" +
|
_(L("Bridge infill")) + "|1|" +
|
||||||
_(L("Gap fill")) + "|" +
|
_(L("Gap fill")) + "|1|" +
|
||||||
_(L("Skirt")) + "|" +
|
_(L("Skirt")) + "|1|" +
|
||||||
_(L("Support material")) + "|" +
|
_(L("Support material")) + "|1|" +
|
||||||
_(L("Support material interface")) + "|" +
|
_(L("Support material interface")) + "|1|" +
|
||||||
_(L("Wipe tower")) + "|" +
|
_(L("Wipe tower")) + "|1|" +
|
||||||
_(L("Custom"))
|
_(L("Custom")) + "|1"
|
||||||
);
|
);
|
||||||
Slic3r::GUI::create_combochecklist(m_combochecklist_features, feature_text, feature_items, true);
|
Slic3r::GUI::create_combochecklist(m_combochecklist_features, GUI::into_u8(_(L("Feature types"))), feature_items);
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
m_combochecklist_options = new wxComboCtrl();
|
||||||
|
m_combochecklist_options->Create(this, wxID_ANY, _(L("Options")), wxDefaultPosition, wxSize(15 * wxGetApp().em_unit(), -1), wxCB_READONLY);
|
||||||
|
std::string options_items = GUI::into_u8(
|
||||||
|
_(L("Travel")) + "|0|" +
|
||||||
|
_(L("Retractions")) + "|0|" +
|
||||||
|
_(L("Unretractions")) + "|0|" +
|
||||||
|
_(L("Tool changes")) + "|0|" +
|
||||||
|
_(L("Color changes")) + "|0|" +
|
||||||
|
_(L("Pause prints")) + "|0|" +
|
||||||
|
_(L("Custom GCodes")) + "|0|" +
|
||||||
|
_(L("Shells")) + "|0|" +
|
||||||
|
_(L("Legend")) + "|1"
|
||||||
|
);
|
||||||
|
Slic3r::GUI::create_combochecklist(m_combochecklist_options, GUI::into_u8(_(L("Options"))), options_items);
|
||||||
|
#else
|
||||||
m_checkbox_travel = new wxCheckBox(this, wxID_ANY, _(L("Travel")));
|
m_checkbox_travel = new wxCheckBox(this, wxID_ANY, _(L("Travel")));
|
||||||
m_checkbox_retractions = new wxCheckBox(this, wxID_ANY, _(L("Retractions")));
|
m_checkbox_retractions = new wxCheckBox(this, wxID_ANY, _(L("Retractions")));
|
||||||
m_checkbox_unretractions = new wxCheckBox(this, wxID_ANY, _(L("Unretractions")));
|
m_checkbox_unretractions = new wxCheckBox(this, wxID_ANY, _(L("Unretractions")));
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
m_checkbox_tool_changes = new wxCheckBox(this, wxID_ANY, _(L("Tool changes")));
|
|
||||||
m_checkbox_color_changes = new wxCheckBox(this, wxID_ANY, _(L("Color changes")));
|
|
||||||
m_checkbox_pause_prints = new wxCheckBox(this, wxID_ANY, _(L("Pause prints")));
|
|
||||||
m_checkbox_custom_gcodes = new wxCheckBox(this, wxID_ANY, _(L("Custom GCodes")));
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
m_checkbox_shells = new wxCheckBox(this, wxID_ANY, _(L("Shells")));
|
m_checkbox_shells = new wxCheckBox(this, wxID_ANY, _(L("Shells")));
|
||||||
m_checkbox_legend = new wxCheckBox(this, wxID_ANY, _(L("Legend")));
|
m_checkbox_legend = new wxCheckBox(this, wxID_ANY, _(L("Legend")));
|
||||||
m_checkbox_legend->SetValue(true);
|
m_checkbox_legend->SetValue(true);
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
wxBoxSizer* top_sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer* top_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
top_sizer->Add(m_canvas_widget, 1, wxALL | wxEXPAND, 0);
|
top_sizer->Add(m_canvas_widget, 1, wxALL | wxEXPAND, 0);
|
||||||
@ -354,8 +362,11 @@ bool Preview::init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view
|
|||||||
bottom_sizer->Add(m_label_view_type, 0, wxALIGN_CENTER_VERTICAL, 5);
|
bottom_sizer->Add(m_label_view_type, 0, wxALIGN_CENTER_VERTICAL, 5);
|
||||||
bottom_sizer->Add(m_choice_view_type, 0, wxEXPAND | wxALL, 5);
|
bottom_sizer->Add(m_choice_view_type, 0, wxEXPAND | wxALL, 5);
|
||||||
bottom_sizer->AddSpacer(10);
|
bottom_sizer->AddSpacer(10);
|
||||||
bottom_sizer->Add(m_label_show_features, 0, wxALIGN_CENTER_VERTICAL, 5);
|
bottom_sizer->Add(m_label_show, 0, wxALIGN_CENTER_VERTICAL, 5);
|
||||||
bottom_sizer->Add(m_combochecklist_features, 0, wxEXPAND | wxALL, 5);
|
bottom_sizer->Add(m_combochecklist_features, 0, wxEXPAND | wxALL, 5);
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
bottom_sizer->Add(m_combochecklist_options, 0, wxEXPAND | wxALL, 5);
|
||||||
|
#else
|
||||||
bottom_sizer->AddSpacer(20);
|
bottom_sizer->AddSpacer(20);
|
||||||
bottom_sizer->Add(m_checkbox_travel, 0, wxEXPAND | wxALL, 5);
|
bottom_sizer->Add(m_checkbox_travel, 0, wxEXPAND | wxALL, 5);
|
||||||
bottom_sizer->AddSpacer(10);
|
bottom_sizer->AddSpacer(10);
|
||||||
@ -363,19 +374,10 @@ bool Preview::init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view
|
|||||||
bottom_sizer->AddSpacer(10);
|
bottom_sizer->AddSpacer(10);
|
||||||
bottom_sizer->Add(m_checkbox_unretractions, 0, wxEXPAND | wxALL, 5);
|
bottom_sizer->Add(m_checkbox_unretractions, 0, wxEXPAND | wxALL, 5);
|
||||||
bottom_sizer->AddSpacer(10);
|
bottom_sizer->AddSpacer(10);
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
bottom_sizer->Add(m_checkbox_tool_changes, 0, wxEXPAND | wxALL, 5);
|
|
||||||
bottom_sizer->AddSpacer(10);
|
|
||||||
bottom_sizer->Add(m_checkbox_color_changes, 0, wxEXPAND | wxALL, 5);
|
|
||||||
bottom_sizer->AddSpacer(10);
|
|
||||||
bottom_sizer->Add(m_checkbox_pause_prints, 0, wxEXPAND | wxALL, 5);
|
|
||||||
bottom_sizer->AddSpacer(10);
|
|
||||||
bottom_sizer->Add(m_checkbox_custom_gcodes, 0, wxEXPAND | wxALL, 5);
|
|
||||||
bottom_sizer->AddSpacer(10);
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
bottom_sizer->Add(m_checkbox_shells, 0, wxEXPAND | wxALL, 5);
|
bottom_sizer->Add(m_checkbox_shells, 0, wxEXPAND | wxALL, 5);
|
||||||
bottom_sizer->AddSpacer(20);
|
bottom_sizer->AddSpacer(20);
|
||||||
bottom_sizer->Add(m_checkbox_legend, 0, wxEXPAND | wxALL, 5);
|
bottom_sizer->Add(m_checkbox_legend, 0, wxEXPAND | wxALL, 5);
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
main_sizer->Add(top_sizer, 1, wxALL | wxEXPAND, 0);
|
main_sizer->Add(top_sizer, 1, wxALL | wxEXPAND, 0);
|
||||||
@ -552,17 +554,15 @@ void Preview::bind_event_handlers()
|
|||||||
this->Bind(wxEVT_SIZE, &Preview::on_size, this);
|
this->Bind(wxEVT_SIZE, &Preview::on_size, this);
|
||||||
m_choice_view_type->Bind(wxEVT_CHOICE, &Preview::on_choice_view_type, this);
|
m_choice_view_type->Bind(wxEVT_CHOICE, &Preview::on_choice_view_type, this);
|
||||||
m_combochecklist_features->Bind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_features, this);
|
m_combochecklist_features->Bind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_features, this);
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
m_combochecklist_options->Bind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_options, this);
|
||||||
|
#else
|
||||||
m_checkbox_travel->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_travel, this);
|
m_checkbox_travel->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_travel, this);
|
||||||
m_checkbox_retractions->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_retractions, this);
|
m_checkbox_retractions->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_retractions, this);
|
||||||
m_checkbox_unretractions->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_unretractions, this);
|
m_checkbox_unretractions->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_unretractions, this);
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
m_checkbox_tool_changes->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_tool_changes, this);
|
|
||||||
m_checkbox_color_changes->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_color_changes, this);
|
|
||||||
m_checkbox_pause_prints->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_pause_prints, this);
|
|
||||||
m_checkbox_custom_gcodes->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_custom_gcodes, this);
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
m_checkbox_shells->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_shells, this);
|
m_checkbox_shells->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_shells, this);
|
||||||
m_checkbox_legend->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_legend, this);
|
m_checkbox_legend->Bind(wxEVT_CHECKBOX, &Preview::on_checkbox_legend, this);
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preview::unbind_event_handlers()
|
void Preview::unbind_event_handlers()
|
||||||
@ -570,54 +570,48 @@ void Preview::unbind_event_handlers()
|
|||||||
this->Unbind(wxEVT_SIZE, &Preview::on_size, this);
|
this->Unbind(wxEVT_SIZE, &Preview::on_size, this);
|
||||||
m_choice_view_type->Unbind(wxEVT_CHOICE, &Preview::on_choice_view_type, this);
|
m_choice_view_type->Unbind(wxEVT_CHOICE, &Preview::on_choice_view_type, this);
|
||||||
m_combochecklist_features->Unbind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_features, this);
|
m_combochecklist_features->Unbind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_features, this);
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
m_combochecklist_options->Unbind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_options, this);
|
||||||
|
#else
|
||||||
m_checkbox_travel->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_travel, this);
|
m_checkbox_travel->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_travel, this);
|
||||||
m_checkbox_retractions->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_retractions, this);
|
m_checkbox_retractions->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_retractions, this);
|
||||||
m_checkbox_unretractions->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_unretractions, this);
|
m_checkbox_unretractions->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_unretractions, this);
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
m_checkbox_tool_changes->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_tool_changes, this);
|
|
||||||
m_checkbox_color_changes->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_color_changes, this);
|
|
||||||
m_checkbox_pause_prints->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_pause_prints, this);
|
|
||||||
m_checkbox_custom_gcodes->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_custom_gcodes, this);
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
m_checkbox_shells->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_shells, this);
|
m_checkbox_shells->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_shells, this);
|
||||||
m_checkbox_legend->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_legend, this);
|
m_checkbox_legend->Unbind(wxEVT_CHECKBOX, &Preview::on_checkbox_legend, this);
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preview::show_hide_ui_elements(const std::string& what)
|
void Preview::show_hide_ui_elements(const std::string& what)
|
||||||
{
|
{
|
||||||
bool enable = (what == "full");
|
bool enable = (what == "full");
|
||||||
m_label_show_features->Enable(enable);
|
m_label_show->Enable(enable);
|
||||||
m_combochecklist_features->Enable(enable);
|
m_combochecklist_features->Enable(enable);
|
||||||
m_checkbox_travel->Enable(enable);
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
m_combochecklist_options->Enable(enable);
|
||||||
|
#else
|
||||||
|
m_checkbox_travel->Enable(enable);
|
||||||
m_checkbox_retractions->Enable(enable);
|
m_checkbox_retractions->Enable(enable);
|
||||||
m_checkbox_unretractions->Enable(enable);
|
m_checkbox_unretractions->Enable(enable);
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
m_checkbox_tool_changes->Enable(enable);
|
|
||||||
m_checkbox_color_changes->Enable(enable);
|
|
||||||
m_checkbox_pause_prints->Enable(enable);
|
|
||||||
m_checkbox_custom_gcodes->Enable(enable);
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
m_checkbox_shells->Enable(enable);
|
m_checkbox_shells->Enable(enable);
|
||||||
m_checkbox_legend->Enable(enable);
|
m_checkbox_legend->Enable(enable);
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
enable = (what != "none");
|
enable = (what != "none");
|
||||||
m_label_view_type->Enable(enable);
|
m_label_view_type->Enable(enable);
|
||||||
m_choice_view_type->Enable(enable);
|
m_choice_view_type->Enable(enable);
|
||||||
|
|
||||||
bool visible = (what != "none");
|
bool visible = (what != "none");
|
||||||
m_label_show_features->Show(visible);
|
m_label_show->Show(visible);
|
||||||
m_combochecklist_features->Show(visible);
|
m_combochecklist_features->Show(visible);
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
m_combochecklist_options->Show(visible);
|
||||||
|
#else
|
||||||
m_checkbox_travel->Show(visible);
|
m_checkbox_travel->Show(visible);
|
||||||
m_checkbox_retractions->Show(visible);
|
m_checkbox_retractions->Show(visible);
|
||||||
m_checkbox_unretractions->Show(visible);
|
m_checkbox_unretractions->Show(visible);
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
m_checkbox_tool_changes->Show(visible);
|
|
||||||
m_checkbox_color_changes->Show(visible);
|
|
||||||
m_checkbox_pause_prints->Show(visible);
|
|
||||||
m_checkbox_custom_gcodes->Show(visible);
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
m_checkbox_shells->Show(visible);
|
m_checkbox_shells->Show(visible);
|
||||||
m_checkbox_legend->Show(visible);
|
m_checkbox_legend->Show(visible);
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
m_label_view_type->Show(visible);
|
m_label_view_type->Show(visible);
|
||||||
m_choice_view_type->Show(visible);
|
m_choice_view_type->Show(visible);
|
||||||
}
|
}
|
||||||
@ -676,72 +670,36 @@ void Preview::on_combochecklist_features(wxCommandEvent& evt)
|
|||||||
refresh_print();
|
refresh_print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
void Preview::on_combochecklist_options(wxCommandEvent& evt)
|
||||||
|
{
|
||||||
|
m_canvas->set_gcode_options_visibility_from_flags(static_cast<unsigned int>(Slic3r::GUI::combochecklist_get_flags(m_combochecklist_options)));
|
||||||
|
refresh_print();
|
||||||
|
}
|
||||||
|
#else
|
||||||
void Preview::on_checkbox_travel(wxCommandEvent& evt)
|
void Preview::on_checkbox_travel(wxCommandEvent& evt)
|
||||||
{
|
{
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
m_canvas->set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Travel, m_checkbox_travel->IsChecked());
|
|
||||||
refresh_print();
|
|
||||||
#else
|
|
||||||
m_gcode_preview_data->travel.is_visible = m_checkbox_travel->IsChecked();
|
m_gcode_preview_data->travel.is_visible = m_checkbox_travel->IsChecked();
|
||||||
m_gcode_preview_data->ranges.feedrate.set_mode(GCodePreviewData::FeedrateKind::TRAVEL, m_gcode_preview_data->travel.is_visible);
|
m_gcode_preview_data->ranges.feedrate.set_mode(GCodePreviewData::FeedrateKind::TRAVEL, m_gcode_preview_data->travel.is_visible);
|
||||||
// Rather than refresh, reload print so that speed color ranges get recomputed (affected by travel visibility)
|
// Rather than refresh, reload print so that speed color ranges get recomputed (affected by travel visibility)
|
||||||
reload_print();
|
reload_print();
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preview::on_checkbox_retractions(wxCommandEvent& evt)
|
void Preview::on_checkbox_retractions(wxCommandEvent& evt)
|
||||||
{
|
{
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
m_canvas->set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Retract, m_checkbox_retractions->IsChecked());
|
|
||||||
#else
|
|
||||||
m_gcode_preview_data->retraction.is_visible = m_checkbox_retractions->IsChecked();
|
m_gcode_preview_data->retraction.is_visible = m_checkbox_retractions->IsChecked();
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
refresh_print();
|
refresh_print();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preview::on_checkbox_unretractions(wxCommandEvent& evt)
|
void Preview::on_checkbox_unretractions(wxCommandEvent& evt)
|
||||||
{
|
{
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
m_canvas->set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Unretract, m_checkbox_unretractions->IsChecked());
|
|
||||||
#else
|
|
||||||
m_gcode_preview_data->unretraction.is_visible = m_checkbox_unretractions->IsChecked();
|
m_gcode_preview_data->unretraction.is_visible = m_checkbox_unretractions->IsChecked();
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
refresh_print();
|
refresh_print();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
void Preview::on_checkbox_tool_changes(wxCommandEvent& evt)
|
|
||||||
{
|
|
||||||
m_canvas->set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Tool_change, m_checkbox_tool_changes->IsChecked());
|
|
||||||
refresh_print();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Preview::on_checkbox_color_changes(wxCommandEvent& evt)
|
|
||||||
{
|
|
||||||
m_canvas->set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Color_change, m_checkbox_color_changes->IsChecked());
|
|
||||||
refresh_print();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Preview::on_checkbox_pause_prints(wxCommandEvent& evt)
|
|
||||||
{
|
|
||||||
m_canvas->set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Pause_Print, m_checkbox_pause_prints->IsChecked());
|
|
||||||
refresh_print();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Preview::on_checkbox_custom_gcodes(wxCommandEvent& evt)
|
|
||||||
{
|
|
||||||
m_canvas->set_toolpath_move_type_visible(GCodeProcessor::EMoveType::Custom_GCode, m_checkbox_custom_gcodes->IsChecked());
|
|
||||||
refresh_print();
|
|
||||||
}
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
|
|
||||||
void Preview::on_checkbox_shells(wxCommandEvent& evt)
|
void Preview::on_checkbox_shells(wxCommandEvent& evt)
|
||||||
{
|
{
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
m_canvas->set_shells_visible(m_checkbox_shells->IsChecked());
|
|
||||||
#else
|
|
||||||
m_gcode_preview_data->shell.is_visible = m_checkbox_shells->IsChecked();
|
m_gcode_preview_data->shell.is_visible = m_checkbox_shells->IsChecked();
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
refresh_print();
|
refresh_print();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,6 +708,7 @@ void Preview::on_checkbox_legend(wxCommandEvent& evt)
|
|||||||
m_canvas->enable_legend_texture(m_checkbox_legend->IsChecked());
|
m_canvas->enable_legend_texture(m_checkbox_legend->IsChecked());
|
||||||
m_canvas_widget->Refresh();
|
m_canvas_widget->Refresh();
|
||||||
}
|
}
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
void Preview::update_view_type(bool slice_completed)
|
void Preview::update_view_type(bool slice_completed)
|
||||||
{
|
{
|
||||||
@ -969,11 +928,13 @@ void Preview::update_double_slider_from_canvas(wxKeyEvent& event)
|
|||||||
m_slider->SetHigherValue(new_pos);
|
m_slider->SetHigherValue(new_pos);
|
||||||
if (event.ShiftDown() || m_slider->is_one_layer()) m_slider->SetLowerValue(m_slider->GetHigherValue());
|
if (event.ShiftDown() || m_slider->is_one_layer()) m_slider->SetLowerValue(m_slider->GetHigherValue());
|
||||||
}
|
}
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
else if (key == 'L') {
|
else if (key == 'L') {
|
||||||
m_checkbox_legend->SetValue(!m_checkbox_legend->GetValue());
|
m_checkbox_legend->SetValue(!m_checkbox_legend->GetValue());
|
||||||
auto evt = wxCommandEvent();
|
auto evt = wxCommandEvent();
|
||||||
on_checkbox_legend(evt);
|
on_checkbox_legend(evt);
|
||||||
}
|
}
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
else if (key == 'S')
|
else if (key == 'S')
|
||||||
m_slider->ChangeOneLayerLock();
|
m_slider->ChangeOneLayerLock();
|
||||||
else if (key == WXK_SHIFT)
|
else if (key == WXK_SHIFT)
|
||||||
@ -1078,6 +1039,7 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
m_canvas->load_gcode_preview(*m_gcode_result);
|
m_canvas->load_gcode_preview(*m_gcode_result);
|
||||||
m_canvas->refresh_gcode_preview(*m_gcode_result, colors);
|
m_canvas->refresh_gcode_preview(*m_gcode_result, colors);
|
||||||
|
show_hide_ui_elements(gcode_preview_data_valid ? "full" : "simple");
|
||||||
#else
|
#else
|
||||||
m_canvas->load_gcode_preview(*m_gcode_preview_data, colors);
|
m_canvas->load_gcode_preview(*m_gcode_preview_data, colors);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
@ -1085,12 +1047,14 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||||||
} else {
|
} else {
|
||||||
// Load the initial preview based on slices, not the final G-code.
|
// Load the initial preview based on slices, not the final G-code.
|
||||||
m_canvas->load_preview(colors, color_print_values);
|
m_canvas->load_preview(colors, color_print_values);
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
show_hide_ui_elements("none");
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
}
|
}
|
||||||
show_hide_ui_elements(gcode_preview_data_valid ? "full" : "simple");
|
|
||||||
// recalculates zs and update sliders accordingly
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
const std::vector<double>& zs = m_canvas->get_layers_zs();
|
const std::vector<double>& zs = m_canvas->get_layers_zs();
|
||||||
#else
|
#else
|
||||||
|
show_hide_ui_elements(gcode_preview_data_valid ? "full" : "simple");
|
||||||
std::vector<double> zs = m_canvas->get_current_print_zs(true);
|
std::vector<double> zs = m_canvas->get_current_print_zs(true);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
if (zs.empty()) {
|
if (zs.empty()) {
|
||||||
|
@ -93,19 +93,17 @@ class Preview : public wxPanel
|
|||||||
wxBoxSizer* m_double_slider_sizer;
|
wxBoxSizer* m_double_slider_sizer;
|
||||||
wxStaticText* m_label_view_type;
|
wxStaticText* m_label_view_type;
|
||||||
wxChoice* m_choice_view_type;
|
wxChoice* m_choice_view_type;
|
||||||
wxStaticText* m_label_show_features;
|
wxStaticText* m_label_show;
|
||||||
wxComboCtrl* m_combochecklist_features;
|
wxComboCtrl* m_combochecklist_features;
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
wxComboCtrl* m_combochecklist_options;
|
||||||
|
#else
|
||||||
wxCheckBox* m_checkbox_travel;
|
wxCheckBox* m_checkbox_travel;
|
||||||
wxCheckBox* m_checkbox_retractions;
|
wxCheckBox* m_checkbox_retractions;
|
||||||
wxCheckBox* m_checkbox_unretractions;
|
wxCheckBox* m_checkbox_unretractions;
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
wxCheckBox* m_checkbox_tool_changes;
|
|
||||||
wxCheckBox* m_checkbox_color_changes;
|
|
||||||
wxCheckBox* m_checkbox_pause_prints;
|
|
||||||
wxCheckBox* m_checkbox_custom_gcodes;
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
wxCheckBox* m_checkbox_shells;
|
wxCheckBox* m_checkbox_shells;
|
||||||
wxCheckBox* m_checkbox_legend;
|
wxCheckBox* m_checkbox_legend;
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
DynamicPrintConfig* m_config;
|
DynamicPrintConfig* m_config;
|
||||||
BackgroundSlicingProcess* m_process;
|
BackgroundSlicingProcess* m_process;
|
||||||
@ -192,17 +190,15 @@ private:
|
|||||||
void on_size(wxSizeEvent& evt);
|
void on_size(wxSizeEvent& evt);
|
||||||
void on_choice_view_type(wxCommandEvent& evt);
|
void on_choice_view_type(wxCommandEvent& evt);
|
||||||
void on_combochecklist_features(wxCommandEvent& evt);
|
void on_combochecklist_features(wxCommandEvent& evt);
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
void on_combochecklist_options(wxCommandEvent& evt);
|
||||||
|
#else
|
||||||
void on_checkbox_travel(wxCommandEvent& evt);
|
void on_checkbox_travel(wxCommandEvent& evt);
|
||||||
void on_checkbox_retractions(wxCommandEvent& evt);
|
void on_checkbox_retractions(wxCommandEvent& evt);
|
||||||
void on_checkbox_unretractions(wxCommandEvent& evt);
|
void on_checkbox_unretractions(wxCommandEvent& evt);
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
void on_checkbox_tool_changes(wxCommandEvent& evt);
|
|
||||||
void on_checkbox_color_changes(wxCommandEvent& evt);
|
|
||||||
void on_checkbox_pause_prints(wxCommandEvent& evt);
|
|
||||||
void on_checkbox_custom_gcodes(wxCommandEvent& evt);
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
void on_checkbox_shells(wxCommandEvent& evt);
|
void on_checkbox_shells(wxCommandEvent& evt);
|
||||||
void on_checkbox_legend(wxCommandEvent& evt);
|
void on_checkbox_legend(wxCommandEvent& evt);
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
// Create/Update/Reset double slider on 3dPreview
|
// Create/Update/Reset double slider on 3dPreview
|
||||||
void create_double_slider();
|
void create_double_slider();
|
||||||
|
Loading…
Reference in New Issue
Block a user