Tech ENABLE_PREVIEW_LAYOUT set as default

This commit is contained in:
enricoturri1966 2022-09-29 14:23:41 +02:00
parent a44a4505b7
commit 3513b800a0
12 changed files with 100 additions and 564 deletions

View File

@ -39,8 +39,6 @@
//==================== //====================
#define ENABLE_2_5_0_ALPHA1 1 #define ENABLE_2_5_0_ALPHA1 1
// Enable changes in preview layout
#define ENABLE_PREVIEW_LAYOUT (1 && ENABLE_2_5_0_ALPHA1)
// Enable removal of wipe tower magic object_id equal to 1000 // Enable removal of wipe tower magic object_id equal to 1000
#define ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL (1 && ENABLE_2_5_0_ALPHA1) #define ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
// Enable removal of legacy OpenGL calls // Enable removal of legacy OpenGL calls

View File

@ -907,21 +907,10 @@ void GCodeViewer::refresh(const GCodeProcessorResult& gcode_result, const std::v
#endif // ENABLE_GCODE_VIEWER_STATISTICS #endif // ENABLE_GCODE_VIEWER_STATISTICS
// update buffers' render paths // update buffers' render paths
#if ENABLE_PREVIEW_LAYOUT
refresh_render_paths(false, false); refresh_render_paths(false, false);
#else
refresh_render_paths();
#endif // ENABLE_PREVIEW_LAYOUT
log_memory_used("Refreshed G-code extrusion paths, "); log_memory_used("Refreshed G-code extrusion paths, ");
} }
#if !ENABLE_PREVIEW_LAYOUT
void GCodeViewer::refresh_render_paths()
{
refresh_render_paths(false, false);
}
#endif // !ENABLE_PREVIEW_LAYOUT
void GCodeViewer::update_shells_color_by_extruder(const DynamicPrintConfig* config) void GCodeViewer::update_shells_color_by_extruder(const DynamicPrintConfig* config)
{ {
if (config != nullptr) if (config != nullptr)
@ -958,9 +947,7 @@ void GCodeViewer::reset()
m_statistics.reset_all(); m_statistics.reset_all();
#endif // ENABLE_GCODE_VIEWER_STATISTICS #endif // ENABLE_GCODE_VIEWER_STATISTICS
m_contained_in_bed = true; m_contained_in_bed = true;
#if ENABLE_PREVIEW_LAYOUT
m_legend_resizer.reset(); m_legend_resizer.reset();
#endif // ENABLE_PREVIEW_LAYOUT
} }
void GCodeViewer::render() void GCodeViewer::render()
@ -1073,9 +1060,6 @@ unsigned int GCodeViewer::get_options_visibility_flags() const
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::CenterOfGravity), m_cog.is_visible()); flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::CenterOfGravity), m_cog.is_visible());
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Shells), m_shells.visible); flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Shells), m_shells.visible);
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::ToolMarker), m_sequential_view.marker.is_visible()); flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::ToolMarker), m_sequential_view.marker.is_visible());
#if !ENABLE_PREVIEW_LAYOUT
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Legend), is_legend_enabled());
#endif // !ENABLE_PREVIEW_LAYOUT
return flags; return flags;
} }
@ -1097,9 +1081,6 @@ void GCodeViewer::set_options_visibility_from_flags(unsigned int flags)
m_cog.set_visible(is_flag_set(static_cast<unsigned int>(Preview::OptionType::CenterOfGravity))); m_cog.set_visible(is_flag_set(static_cast<unsigned int>(Preview::OptionType::CenterOfGravity)));
m_shells.visible = is_flag_set(static_cast<unsigned int>(Preview::OptionType::Shells)); m_shells.visible = is_flag_set(static_cast<unsigned int>(Preview::OptionType::Shells));
m_sequential_view.marker.set_visible(is_flag_set(static_cast<unsigned int>(Preview::OptionType::ToolMarker))); m_sequential_view.marker.set_visible(is_flag_set(static_cast<unsigned int>(Preview::OptionType::ToolMarker)));
#if !ENABLE_PREVIEW_LAYOUT
enable_legend(is_flag_set(static_cast<unsigned int>(Preview::OptionType::Legend)));
#endif // !ENABLE_PREVIEW_LAYOUT
} }
void GCodeViewer::set_layers_z_range(const std::array<unsigned int, 2>& layers_z_range) void GCodeViewer::set_layers_z_range(const std::array<unsigned int, 2>& layers_z_range)
@ -3434,11 +3415,7 @@ void GCodeViewer::render_legend(float& legend_height)
const float max_height = 0.75f * static_cast<float>(cnv_size.get_height()); const float max_height = 0.75f * static_cast<float>(cnv_size.get_height());
const float child_height = 0.3333f * max_height; const float child_height = 0.3333f * max_height;
ImGui::SetNextWindowSizeConstraints({ 0.0f, 0.0f }, { -1.0f, max_height }); ImGui::SetNextWindowSizeConstraints({ 0.0f, 0.0f }, { -1.0f, max_height });
#if ENABLE_PREVIEW_LAYOUT
imgui.begin(std::string("Legend"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove); imgui.begin(std::string("Legend"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove);
#else
imgui.begin(std::string("Legend"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove);
#endif // ENABLE_PREVIEW_LAYOUT
enum class EItemType : unsigned char enum class EItemType : unsigned char
{ {
@ -3792,7 +3769,6 @@ void GCodeViewer::render_legend(float& legend_height)
offsets = calculate_offsets(labels, times, { "Extruder NNN", longest_used_filament_string }, icon_size); offsets = calculate_offsets(labels, times, { "Extruder NNN", longest_used_filament_string }, icon_size);
} }
#if ENABLE_PREVIEW_LAYOUT
// selection section // selection section
bool view_type_changed = false; bool view_type_changed = false;
int old_view_type = static_cast<int>(get_view_type()); int old_view_type = static_cast<int>(get_view_type());
@ -3830,35 +3806,8 @@ void GCodeViewer::render_legend(float& legend_height)
append_headers({ _u8L(""), _u8L("Used filament"), _u8L(""), _u8L("") }, offsets); append_headers({ _u8L(""), _u8L("Used filament"), _u8L(""), _u8L("") }, offsets);
else else
ImGui::Separator(); ImGui::Separator();
#else
// extrusion paths section -> title
switch (m_view_type)
{
case EViewType::FeatureType:
{
append_headers({ _u8L("Feature type"), _u8L("Time"), _u8L("Percentage"), _u8L("Used filament") }, offsets);
break;
}
case EViewType::Height: { imgui.title(_u8L("Height (mm)")); break; }
case EViewType::Width: { imgui.title(_u8L("Width (mm)")); break; }
case EViewType::Feedrate: { imgui.title(_u8L("Speed (mm/s)")); break; }
case EViewType::FanSpeed: { imgui.title(_u8L("Fan Speed (%)")); break; }
case EViewType::Temperature: { imgui.title(_u8L("Temperature (°C)")); break; }
case EViewType::VolumetricRate: { imgui.title(_u8L("Volumetric flow rate (mm³/s)")); break; }
case EViewType::LayerTimeLinear: { imgui.title(_u8L("Layer time (linear)")); break; }
case EViewType::LayerTimeLogarithmic: { imgui.title(_u8L("Layer time (logarithmic)")); break; }
case EViewType::Tool: {
append_headers({ _u8L("Tool"), _u8L("Used filament") }, offsets);
break;
}
case EViewType::ColorPrint: { imgui.title(_u8L("Color Print")); break; }
default: { break; }
}
#endif // ENABLE_PREVIEW_LAYOUT
#if ENABLE_PREVIEW_LAYOUT
if (!view_type_changed) { if (!view_type_changed) {
#endif // ENABLE_PREVIEW_LAYOUT
// extrusion paths section -> items // extrusion paths section -> items
switch (m_view_type) switch (m_view_type)
{ {
@ -3878,9 +3827,6 @@ void GCodeViewer::render_legend(float& legend_height)
refresh_render_paths(false, false); refresh_render_paths(false, false);
wxGetApp().plater()->update_preview_moves_slider(); wxGetApp().plater()->update_preview_moves_slider();
wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); wxGetApp().plater()->get_current_canvas3D()->set_as_dirty();
#if !ENABLE_PREVIEW_LAYOUT
wxGetApp().plater()->update_preview_bottom_toolbar();
#endif // !ENABLE_PREVIEW_LAYOUT
} }
); );
} }
@ -3977,9 +3923,7 @@ void GCodeViewer::render_legend(float& legend_height)
} }
default: { break; } default: { break; }
} }
#if ENABLE_PREVIEW_LAYOUT
} }
#endif // ENABLE_PREVIEW_LAYOUT
// partial estimated printing time section // partial estimated printing time section
if (m_view_type == EViewType::ColorPrint) { if (m_view_type == EViewType::ColorPrint) {
@ -4156,89 +4100,6 @@ void GCodeViewer::render_legend(float& legend_height)
} }
} }
#if !ENABLE_PREVIEW_LAYOUT
// travel paths section
if (m_buffers[buffer_id(EMoveType::Travel)].visible) {
switch (m_view_type)
{
case EViewType::Feedrate:
case EViewType::Tool:
case EViewType::ColorPrint: {
break;
}
default: {
// title
ImGui::Spacing();
imgui.title(_u8L("Travel"));
// items
append_item(EItemType::Line, Travel_Colors[0], _u8L("Movement"));
append_item(EItemType::Line, Travel_Colors[1], _u8L("Extrusion"));
append_item(EItemType::Line, Travel_Colors[2], _u8L("Retraction"));
break;
}
}
}
// wipe paths section
if (m_buffers[buffer_id(EMoveType::Wipe)].visible) {
switch (m_view_type)
{
case EViewType::Feedrate:
case EViewType::Tool:
case EViewType::ColorPrint: { break; }
default: {
// title
ImGui::Spacing();
imgui.title(_u8L("Wipe"));
// items
append_item(EItemType::Line, Wipe_Color, _u8L("Wipe"));
break;
}
}
}
auto any_option_available = [this]() {
auto available = [this](EMoveType type) {
const TBuffer& buffer = m_buffers[buffer_id(type)];
return buffer.visible && buffer.has_data();
};
return available(EMoveType::Color_change) ||
available(EMoveType::Custom_GCode) ||
available(EMoveType::Pause_Print) ||
available(EMoveType::Retract) ||
available(EMoveType::Tool_change) ||
available(EMoveType::Unretract) ||
available(EMoveType::Seam);
};
auto add_option = [this, append_item](EMoveType move_type, EOptionsColors color, const std::string& text) {
const TBuffer& buffer = m_buffers[buffer_id(move_type)];
if (buffer.visible && buffer.has_data())
append_item(EItemType::Circle, Options_Colors[static_cast<unsigned int>(color)], text);
};
// options section
if (any_option_available()) {
// title
ImGui::Spacing();
imgui.title(_u8L("Options"));
// items
add_option(EMoveType::Retract, EOptionsColors::Retractions, _u8L("Retractions"));
add_option(EMoveType::Unretract, EOptionsColors::Unretractions, _u8L("Deretractions"));
add_option(EMoveType::Seam, EOptionsColors::Seams, _u8L("Seams"));
add_option(EMoveType::Tool_change, EOptionsColors::ToolChanges, _u8L("Tool changes"));
add_option(EMoveType::Color_change, EOptionsColors::ColorChanges, _u8L("Color changes"));
add_option(EMoveType::Pause_Print, EOptionsColors::PausePrints, _u8L("Print pauses"));
add_option(EMoveType::Custom_GCode, EOptionsColors::CustomGCodes, _u8L("Custom G-codes"));
}
#endif // !ENABLE_PREVIEW_LAYOUT
auto add_strings_row_to_table = [&imgui](const std::string& col_1, const ImVec4& col_1_color, const std::string& col_2, const ImVec4& col_2_color) { auto add_strings_row_to_table = [&imgui](const std::string& col_1, const ImVec4& col_1_color, const std::string& col_2, const ImVec4& col_2_color) {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(0);
@ -4361,7 +4222,6 @@ void GCodeViewer::render_legend(float& legend_height)
} }
} }
#if ENABLE_PREVIEW_LAYOUT
// toolbar section // toolbar section
auto toggle_button = [this, &imgui, icon_size](Preview::OptionType type, const std::string& name, auto toggle_button = [this, &imgui, icon_size](Preview::OptionType type, const std::string& name,
std::function<void(ImGuiWindow& window, const ImVec2& pos, float size)> draw_callback) { std::function<void(ImGuiWindow& window, const ImVec2& pos, float size)> draw_callback) {
@ -4472,7 +4332,6 @@ void GCodeViewer::render_legend(float& legend_height)
wxGetApp().plater()->get_current_canvas3D()->request_extra_frame(); wxGetApp().plater()->get_current_canvas3D()->request_extra_frame();
} }
m_legend_resizer.dirty = size_dirty; m_legend_resizer.dirty = size_dirty;
#endif // ENABLE_PREVIEW_LAYOUT
legend_height = ImGui::GetWindowHeight(); legend_height = ImGui::GetWindowHeight();

View File

@ -773,14 +773,12 @@ private:
COG m_cog; COG m_cog;
EViewType m_view_type{ EViewType::FeatureType }; EViewType m_view_type{ EViewType::FeatureType };
bool m_legend_enabled{ true }; bool m_legend_enabled{ true };
#if ENABLE_PREVIEW_LAYOUT
struct LegendResizer struct LegendResizer
{ {
bool dirty{ true }; bool dirty{ true };
void reset() { dirty = true; } void reset() { dirty = true; }
}; };
LegendResizer m_legend_resizer; LegendResizer m_legend_resizer;
#endif // ENABLE_PREVIEW_LAYOUT
PrintEstimatedStatistics m_print_statistics; PrintEstimatedStatistics m_print_statistics;
PrintEstimatedStatistics::ETimeMode m_time_estimate_mode{ PrintEstimatedStatistics::ETimeMode::Normal }; PrintEstimatedStatistics::ETimeMode m_time_estimate_mode{ PrintEstimatedStatistics::ETimeMode::Normal };
#if ENABLE_GCODE_VIEWER_STATISTICS #if ENABLE_GCODE_VIEWER_STATISTICS
@ -808,11 +806,7 @@ public:
#endif // ENABLE_LEGACY_OPENGL_REMOVAL #endif // ENABLE_LEGACY_OPENGL_REMOVAL
// recalculate ranges in dependence of what is visible and sets tool/print colors // recalculate ranges in dependence of what is visible and sets tool/print colors
void refresh(const GCodeProcessorResult& gcode_result, const std::vector<std::string>& str_tool_colors); void refresh(const GCodeProcessorResult& gcode_result, const std::vector<std::string>& str_tool_colors);
#if ENABLE_PREVIEW_LAYOUT
void refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const; void refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const;
#else
void refresh_render_paths();
#endif // ENABLE_PREVIEW_LAYOUT
void update_shells_color_by_extruder(const DynamicPrintConfig* config); void update_shells_color_by_extruder(const DynamicPrintConfig* config);
void reset(); void reset();
@ -857,9 +851,7 @@ public:
std::vector<CustomGCode::Item>& get_custom_gcode_per_print_z() { return m_custom_gcode_per_print_z; } std::vector<CustomGCode::Item>& get_custom_gcode_per_print_z() { return m_custom_gcode_per_print_z; }
size_t get_extruders_count() { return m_extruders_count; } size_t get_extruders_count() { return m_extruders_count; }
#if ENABLE_PREVIEW_LAYOUT
void invalidate_legend() { m_legend_resizer.reset(); } void invalidate_legend() { m_legend_resizer.reset(); }
#endif // ENABLE_PREVIEW_LAYOUT
private: private:
void load_toolpaths(const GCodeProcessorResult& gcode_result); void load_toolpaths(const GCodeProcessorResult& gcode_result);
@ -868,9 +860,6 @@ private:
#else #else
void load_shells(const Print& print, bool initialized); void load_shells(const Print& print, bool initialized);
#endif // ENABLE_LEGACY_OPENGL_REMOVAL #endif // ENABLE_LEGACY_OPENGL_REMOVAL
#if !ENABLE_PREVIEW_LAYOUT
void refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const;
#endif // !ENABLE_PREVIEW_LAYOUT
void render_toolpaths(); void render_toolpaths();
void render_shells(); void render_shells();
void render_legend(float& legend_height); void render_legend(float& legend_height);

View File

@ -2506,21 +2506,12 @@ void GLCanvas3D::load_gcode_preview(const GCodeProcessorResult& gcode_result, co
request_extra_frame(); request_extra_frame();
} }
#if ENABLE_PREVIEW_LAYOUT
void GLCanvas3D::refresh_gcode_preview_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) void GLCanvas3D::refresh_gcode_preview_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last)
{ {
m_gcode_viewer.refresh_render_paths(keep_sequential_current_first, keep_sequential_current_last); m_gcode_viewer.refresh_render_paths(keep_sequential_current_first, keep_sequential_current_last);
set_as_dirty(); set_as_dirty();
request_extra_frame(); request_extra_frame();
} }
#else
void GLCanvas3D::refresh_gcode_preview_render_paths()
{
m_gcode_viewer.refresh_render_paths();
set_as_dirty();
request_extra_frame();
}
#endif // ENABLE_PREVIEW_LAYOUT
void GLCanvas3D::load_sla_preview() void GLCanvas3D::load_sla_preview()
{ {
@ -2827,15 +2818,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
case 'k': { wxGetApp().plater()->get_camera().select_next_type(); m_dirty = true; break; } case 'k': { wxGetApp().plater()->get_camera().select_next_type(); m_dirty = true; break; }
case 'L': case 'L':
case 'l': { case 'l': {
if (!m_main_toolbar.is_enabled()) { if (!m_main_toolbar.is_enabled())
#if ENABLE_PREVIEW_LAYOUT
show_legend(!is_legend_shown()); show_legend(!is_legend_shown());
#else
m_gcode_viewer.enable_legend(!m_gcode_viewer.is_legend_enabled());
m_dirty = true;
wxGetApp().plater()->update_preview_bottom_toolbar();
#endif // ENABLE_PREVIEW_LAYOUT
}
break; break;
} }
case 'O': case 'O':
@ -4284,9 +4268,7 @@ void GLCanvas3D::set_cursor(ECursorType type)
void GLCanvas3D::msw_rescale() void GLCanvas3D::msw_rescale()
{ {
#if ENABLE_PREVIEW_LAYOUT
m_gcode_viewer.invalidate_legend(); m_gcode_viewer.invalidate_legend();
#endif // ENABLE_PREVIEW_LAYOUT
} }
void GLCanvas3D::update_tooltip_for_settings_item_in_main_toolbar() void GLCanvas3D::update_tooltip_for_settings_item_in_main_toolbar()

View File

@ -817,11 +817,7 @@ public:
void reload_scene(bool refresh_immediately, bool force_full_scene_refresh = false); void reload_scene(bool refresh_immediately, bool force_full_scene_refresh = false);
void load_gcode_preview(const GCodeProcessorResult& gcode_result, const std::vector<std::string>& str_tool_colors); void load_gcode_preview(const GCodeProcessorResult& gcode_result, const std::vector<std::string>& str_tool_colors);
#if ENABLE_PREVIEW_LAYOUT
void refresh_gcode_preview_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last); void refresh_gcode_preview_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last);
#else
void refresh_gcode_preview_render_paths();
#endif // ENABLE_PREVIEW_LAYOUT
void set_gcode_view_preview_type(GCodeViewer::EViewType type) { return m_gcode_viewer.set_view_type(type); } void set_gcode_view_preview_type(GCodeViewer::EViewType type) { return m_gcode_viewer.set_view_type(type); }
GCodeViewer::EViewType get_gcode_view_preview_type() const { return m_gcode_viewer.get_view_type(); } GCodeViewer::EViewType get_gcode_view_preview_type() const { return m_gcode_viewer.get_view_type(); }
void load_sla_preview(); void load_sla_preview();
@ -915,10 +911,8 @@ public:
bool are_labels_shown() const { return m_labels.is_shown(); } bool are_labels_shown() const { return m_labels.is_shown(); }
void show_labels(bool show) { m_labels.show(show); } void show_labels(bool show) { m_labels.show(show); }
#if ENABLE_PREVIEW_LAYOUT
bool is_legend_shown() const { return m_gcode_viewer.is_legend_enabled(); } bool is_legend_shown() const { return m_gcode_viewer.is_legend_enabled(); }
void show_legend(bool show) { m_gcode_viewer.enable_legend(show); m_dirty = true; } void show_legend(bool show) { m_gcode_viewer.enable_legend(show); m_dirty = true; }
#endif // ENABLE_PREVIEW_LAYOUT
bool is_using_slope() const { return m_slope.is_used(); } bool is_using_slope() const { return m_slope.is_used(); }
void use_slope(bool use) { m_slope.use(use); } void use_slope(bool use) { m_slope.use(use); }

View File

@ -208,73 +208,6 @@ bool Preview::init(wxWindow* parent, Bed3D& bed, Model* model)
m_layers_slider_sizer = create_layers_slider_sizer(); m_layers_slider_sizer = create_layers_slider_sizer();
wxGetApp().UpdateDarkUI(m_bottom_toolbar_panel = new wxPanel(this)); wxGetApp().UpdateDarkUI(m_bottom_toolbar_panel = new wxPanel(this));
#if !ENABLE_PREVIEW_LAYOUT
m_label_view_type = new wxStaticText(m_bottom_toolbar_panel, wxID_ANY, _L("View"));
#ifdef _WIN32
wxGetApp().UpdateDarkUI(m_choice_view_type = new BitmapComboBox(m_bottom_toolbar_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY));
#else
m_choice_view_type = new wxComboBox(m_bottom_toolbar_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY);
#endif
m_choice_view_type->Append(_L("Feature type"));
m_choice_view_type->Append(_L("Height"));
m_choice_view_type->Append(_L("Width"));
m_choice_view_type->Append(_L("Speed"));
m_choice_view_type->Append(_L("Fan speed"));
m_choice_view_type->Append(_L("Temperature"));
m_choice_view_type->Append(_L("Volumetric flow rate"));
m_choice_view_type->Append(_L("Layer time (linear)"));
m_choice_view_type->Append(_L("Layer time (logarithmic)"));
m_choice_view_type->Append(_L("Tool"));
m_choice_view_type->Append(_L("Color Print"));
m_choice_view_type->SetSelection(0);
m_label_show = new wxStaticText(m_bottom_toolbar_panel, wxID_ANY, _L("Show"));
#ifdef _WIN32
long combo_style = wxCB_READONLY | wxBORDER_SIMPLE; //set border allows use default color instead of theme color wich is allways light under MSW
#else
long combo_style = wxCB_READONLY;
#endif
m_combochecklist_features = new wxComboCtrl();
m_combochecklist_features->Create(m_bottom_toolbar_panel, wxID_ANY, _L("Feature types"), wxDefaultPosition, wxDefaultSize, combo_style);
std::string feature_items = GUI::into_u8(
_L("Unknown") + "|1|" +
_L("Perimeter") + "|1|" +
_L("External perimeter") + "|1|" +
_L("Overhang perimeter") + "|1|" +
_L("Internal infill") + "|1|" +
_L("Solid infill") + "|1|" +
_L("Top solid infill") + "|1|" +
_L("Ironing") + "|1|" +
_L("Bridge infill") + "|1|" +
_L("Gap fill") + "|1|" +
_L("Skirt/Brim") + "|1|" +
_L("Support material") + "|1|" +
_L("Support material interface") + "|1|" +
_L("Wipe tower") + "|1|" +
_L("Custom") + "|1"
);
Slic3r::GUI::create_combochecklist(m_combochecklist_features, GUI::into_u8(_L("Feature types")), feature_items);
m_combochecklist_options = new wxComboCtrl();
m_combochecklist_options->Create(m_bottom_toolbar_panel, wxID_ANY, _L("Options"), wxDefaultPosition, wxDefaultSize, combo_style);
std::string options_items = GUI::into_u8(
get_option_type_string(OptionType::Travel) + "|0|" +
get_option_type_string(OptionType::Wipe) + "|0|" +
get_option_type_string(OptionType::Retractions) + "|0|" +
get_option_type_string(OptionType::Unretractions) + "|0|" +
get_option_type_string(OptionType::Seams) + "|0|" +
get_option_type_string(OptionType::ToolChanges) + "|0|" +
get_option_type_string(OptionType::ColorChanges) + "|0|" +
get_option_type_string(OptionType::PausePrints) + "|0|" +
get_option_type_string(OptionType::CustomGCodes) + "|0|" +
get_option_type_string(OptionType::Shells) + "|0|" +
get_option_type_string(OptionType::ToolMarker) + "|1|" +
get_option_type_string(OptionType::Legend) + "|1"
);
Slic3r::GUI::create_combochecklist(m_combochecklist_options, GUI::into_u8(_L("Options")), options_items);
#endif // !ENABLE_PREVIEW_LAYOUT
m_left_sizer = new wxBoxSizer(wxVERTICAL); m_left_sizer = new wxBoxSizer(wxVERTICAL);
m_left_sizer->Add(m_canvas_widget, 1, wxALL | wxEXPAND, 0); m_left_sizer->Add(m_canvas_widget, 1, wxALL | wxEXPAND, 0);
@ -286,19 +219,6 @@ bool Preview::init(wxWindow* parent, Bed3D& bed, Model* model)
m_moves_slider->SetDrawMode(DoubleSlider::dmSequentialGCodeView); m_moves_slider->SetDrawMode(DoubleSlider::dmSequentialGCodeView);
wxBoxSizer* bottom_toolbar_sizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* bottom_toolbar_sizer = new wxBoxSizer(wxHORIZONTAL);
#if !ENABLE_PREVIEW_LAYOUT
bottom_toolbar_sizer->AddSpacer(5);
bottom_toolbar_sizer->Add(m_label_view_type, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
bottom_toolbar_sizer->Add(m_choice_view_type, 0, wxALIGN_CENTER_VERTICAL, 0);
bottom_toolbar_sizer->AddSpacer(5);
bottom_toolbar_sizer->Add(m_label_show, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
bottom_toolbar_sizer->Add(m_combochecklist_options, 0, wxALIGN_CENTER_VERTICAL, 0);
// change the following number if editing the layout of the bottom toolbar sizer. It is used into update_bottom_toolbar()
m_combochecklist_features_pos = 6;
bottom_toolbar_sizer->Add(m_combochecklist_features, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5);
bottom_toolbar_sizer->Hide(m_combochecklist_features);
bottom_toolbar_sizer->AddSpacer(5);
#endif // !ENABLE_PREVIEW_LAYOUT
bottom_toolbar_sizer->Add(m_moves_slider, 1, wxALL | wxEXPAND, 0); bottom_toolbar_sizer->Add(m_moves_slider, 1, wxALL | wxEXPAND, 0);
m_bottom_toolbar_panel->SetSizer(bottom_toolbar_sizer); m_bottom_toolbar_panel->SetSizer(bottom_toolbar_sizer);
@ -360,9 +280,6 @@ void Preview::load_print(bool keep_z_range)
else if (tech == ptSLA) else if (tech == ptSLA)
load_print_as_sla(); load_print_as_sla();
#if !ENABLE_PREVIEW_LAYOUT
update_bottom_toolbar();
#endif // !ENABLE_PREVIEW_LAYOUT
Layout(); Layout();
} }
@ -405,12 +322,6 @@ void Preview::refresh_print()
void Preview::msw_rescale() void Preview::msw_rescale()
{ {
#if !ENABLE_PREVIEW_LAYOUT
#ifdef _WIN32
m_choice_view_type->Rescale();
m_choice_view_type->SetMinSize(m_choice_view_type->GetSize());
#endif
#endif // !ENABLE_PREVIEW_LAYOUT
// rescale slider // rescale slider
if (m_layers_slider != nullptr) m_layers_slider->msw_rescale(); if (m_layers_slider != nullptr) m_layers_slider->msw_rescale();
if (m_moves_slider != nullptr) m_moves_slider->msw_rescale(); if (m_moves_slider != nullptr) m_moves_slider->msw_rescale();
@ -426,16 +337,8 @@ void Preview::sys_color_changed()
{ {
#ifdef _WIN32 #ifdef _WIN32
wxWindowUpdateLocker noUpdates(this); wxWindowUpdateLocker noUpdates(this);
wxGetApp().UpdateAllStaticTextDarkUI(m_bottom_toolbar_panel); wxGetApp().UpdateAllStaticTextDarkUI(m_bottom_toolbar_panel);
#if !ENABLE_PREVIEW_LAYOUT #endif // _WIN32
wxGetApp().UpdateDarkUI(m_choice_view_type);
wxGetApp().UpdateDarkUI(m_combochecklist_features);
wxGetApp().UpdateDarkUI(static_cast<wxCheckListBoxComboPopup*>(m_combochecklist_features->GetPopupControl()));
wxGetApp().UpdateDarkUI(m_combochecklist_options);
wxGetApp().UpdateDarkUI(static_cast<wxCheckListBoxComboPopup*>(m_combochecklist_options->GetPopupControl()));
#endif // !ENABLE_PREVIEW_LAYOUT
#endif
if (m_layers_slider != nullptr) if (m_layers_slider != nullptr)
m_layers_slider->sys_color_changed(); m_layers_slider->sys_color_changed();
@ -459,22 +362,12 @@ void Preview::edit_layers_slider(wxKeyEvent& evt)
void Preview::bind_event_handlers() void Preview::bind_event_handlers()
{ {
Bind(wxEVT_SIZE, &Preview::on_size, this); Bind(wxEVT_SIZE, &Preview::on_size, this);
#if !ENABLE_PREVIEW_LAYOUT
m_choice_view_type->Bind(wxEVT_COMBOBOX, &Preview::on_choice_view_type, this);
m_combochecklist_features->Bind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_features, this);
m_combochecklist_options->Bind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_options, this);
#endif // !ENABLE_PREVIEW_LAYOUT
m_moves_slider->Bind(wxEVT_SCROLL_CHANGED, &Preview::on_moves_slider_scroll_changed, this); m_moves_slider->Bind(wxEVT_SCROLL_CHANGED, &Preview::on_moves_slider_scroll_changed, this);
} }
void Preview::unbind_event_handlers() void Preview::unbind_event_handlers()
{ {
Unbind(wxEVT_SIZE, &Preview::on_size, this); Unbind(wxEVT_SIZE, &Preview::on_size, this);
#if !ENABLE_PREVIEW_LAYOUT
m_choice_view_type->Unbind(wxEVT_COMBOBOX, &Preview::on_choice_view_type, this);
m_combochecklist_features->Unbind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_features, this);
m_combochecklist_options->Unbind(wxEVT_CHECKLISTBOX, &Preview::on_combochecklist_options, this);
#endif // !ENABLE_PREVIEW_LAYOUT
m_moves_slider->Unbind(wxEVT_SCROLL_CHANGED, &Preview::on_moves_slider_scroll_changed, this); m_moves_slider->Unbind(wxEVT_SCROLL_CHANGED, &Preview::on_moves_slider_scroll_changed, this);
} }
@ -495,75 +388,6 @@ void Preview::on_size(wxSizeEvent& evt)
Refresh(); Refresh();
} }
#if !ENABLE_PREVIEW_LAYOUT
void Preview::on_choice_view_type(wxCommandEvent& evt)
{
int selection = m_choice_view_type->GetCurrentSelection();
if (0 <= selection && selection < static_cast<int>(GCodeViewer::EViewType::Count)) {
m_canvas->set_toolpath_view_type(static_cast<GCodeViewer::EViewType>(selection));
m_keep_current_preview_type = true;
}
refresh_print();
}
void Preview::on_combochecklist_features(wxCommandEvent& evt)
{
unsigned int flags = Slic3r::GUI::combochecklist_get_flags(m_combochecklist_features);
m_canvas->set_toolpath_role_visibility_flags(flags);
refresh_print();
}
void Preview::on_combochecklist_options(wxCommandEvent& evt)
{
const unsigned int curr_flags = m_canvas->get_gcode_options_visibility_flags();
const unsigned int new_flags = Slic3r::GUI::combochecklist_get_flags(m_combochecklist_options);
if (curr_flags == new_flags)
return;
m_canvas->set_gcode_options_visibility_from_flags(new_flags);
if (m_canvas->get_gcode_view_type() == GCodeViewer::EViewType::Feedrate) {
const unsigned int diff_flags = curr_flags ^ new_flags;
if ((diff_flags & (1 << static_cast<unsigned int>(Preview::OptionType::Travel))) != 0)
refresh_print();
else
m_canvas->refresh_gcode_preview_render_paths();
}
else
m_canvas->refresh_gcode_preview_render_paths();
update_moves_slider();
}
void Preview::update_bottom_toolbar()
{
combochecklist_set_flags(m_combochecklist_features, m_canvas->get_toolpath_role_visibility_flags());
combochecklist_set_flags(m_combochecklist_options, m_canvas->get_gcode_options_visibility_flags());
// updates visibility of features combobox
if (m_bottom_toolbar_panel->IsShown()) {
wxSizer* sizer = m_bottom_toolbar_panel->GetSizer();
bool show = !m_canvas->is_gcode_legend_enabled() || m_canvas->get_gcode_view_type() != GCodeViewer::EViewType::FeatureType;
if (show) {
if (sizer->GetItem(m_combochecklist_features) == nullptr) {
sizer->Insert(m_combochecklist_features_pos, m_combochecklist_features, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5);
sizer->Show(m_combochecklist_features);
sizer->Layout();
Refresh();
}
}
else {
if (sizer->GetItem(m_combochecklist_features) != nullptr) {
sizer->Hide(m_combochecklist_features);
sizer->Detach(m_combochecklist_features);
sizer->Layout();
Refresh();
}
}
}
}
#endif // !ENABLE_PREVIEW_LAYOUT
wxBoxSizer* Preview::create_layers_slider_sizer() wxBoxSizer* Preview::create_layers_slider_sizer()
{ {
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
@ -1022,7 +846,6 @@ void Preview::load_print_as_fff(bool keep_z_range)
m_canvas->get_custom_gcode_per_print_z(); m_canvas->get_custom_gcode_per_print_z();
const bool contains_color_gcodes = std::any_of(std::begin(gcodes), std::end(gcodes), const bool contains_color_gcodes = std::any_of(std::begin(gcodes), std::end(gcodes),
[] (auto const& item) { return item.type == CustomGCode::Type::ColorChange; }); [] (auto const& item) { return item.type == CustomGCode::Type::ColorChange; });
#if ENABLE_PREVIEW_LAYOUT
const GCodeViewer::EViewType choice = contains_color_gcodes ? const GCodeViewer::EViewType choice = contains_color_gcodes ?
GCodeViewer::EViewType::ColorPrint : GCodeViewer::EViewType::ColorPrint :
(number_extruders > 1) ? GCodeViewer::EViewType::Tool : GCodeViewer::EViewType::FeatureType; (number_extruders > 1) ? GCodeViewer::EViewType::Tool : GCodeViewer::EViewType::FeatureType;
@ -1032,21 +855,6 @@ void Preview::load_print_as_fff(bool keep_z_range)
m_keep_current_preview_type = true; m_keep_current_preview_type = true;
refresh_print(); refresh_print();
} }
#else
const wxString choice = contains_color_gcodes ?
_L("Color Print") :
(number_extruders > 1) ? _L("Tool") : _L("Feature type");
int type = m_choice_view_type->FindString(choice);
if (m_choice_view_type->GetSelection() != type) {
if (0 <= type && type < static_cast<int>(GCodeViewer::EViewType::Count)) {
m_choice_view_type->SetSelection(type);
m_canvas->set_gcode_view_preview_type(static_cast<GCodeViewer::EViewType>(type));
if (wxGetApp().is_gcode_viewer())
m_keep_current_preview_type = true;
refresh_print();
}
}
#endif // ENABLE_PREVIEW_LAYOUT
} }
if (zs.empty()) { if (zs.empty()) {
@ -1121,27 +929,5 @@ void Preview::on_moves_slider_scroll_changed(wxCommandEvent& event)
m_canvas->render(); m_canvas->render();
} }
#if !ENABLE_PREVIEW_LAYOUT
wxString Preview::get_option_type_string(OptionType type) const
{
switch (type)
{
case OptionType::Travel: { return _L("Travel"); }
case OptionType::Wipe: { return _L("Wipe"); }
case OptionType::Retractions: { return _L("Retractions"); }
case OptionType::Unretractions: { return _L("Deretractions"); }
case OptionType::Seams: { return _L("Seams"); }
case OptionType::ToolChanges: { return _L("Tool changes"); }
case OptionType::ColorChanges: { return _L("Color changes"); }
case OptionType::PausePrints: { return _L("Print pauses"); }
case OptionType::CustomGCodes: { return _L("Custom G-codes"); }
case OptionType::Shells: { return _L("Shells"); }
case OptionType::ToolMarker: { return _L("Tool marker"); }
case OptionType::Legend: { return _L("Legend/Estimated printing time"); }
default: { return ""; }
}
}
#endif // !ENABLE_PREVIEW_LAYOUT
} // namespace GUI } // namespace GUI
} // namespace Slic3r } // namespace Slic3r

View File

@ -80,18 +80,6 @@ class Preview : public wxPanel
wxBoxSizer* m_left_sizer { nullptr }; wxBoxSizer* m_left_sizer { nullptr };
wxBoxSizer* m_layers_slider_sizer { nullptr }; wxBoxSizer* m_layers_slider_sizer { nullptr };
wxPanel* m_bottom_toolbar_panel { nullptr }; wxPanel* m_bottom_toolbar_panel { nullptr };
#if !ENABLE_PREVIEW_LAYOUT
wxStaticText* m_label_view_type { nullptr };
#ifdef _WIN32
BitmapComboBox* m_choice_view_type { nullptr };
#else
wxComboBox* m_choice_view_type { nullptr };
#endif
wxStaticText* m_label_show{ nullptr };
wxComboCtrl* m_combochecklist_features { nullptr };
size_t m_combochecklist_features_pos { 0 };
wxComboCtrl* m_combochecklist_options { nullptr };
#endif // !ENABLE_PREVIEW_LAYOUT
DynamicPrintConfig* m_config; DynamicPrintConfig* m_config;
BackgroundSlicingProcess* m_process; BackgroundSlicingProcess* m_process;
@ -129,9 +117,6 @@ public:
CenterOfGravity, CenterOfGravity,
Shells, Shells,
ToolMarker, ToolMarker,
#if !ENABLE_PREVIEW_LAYOUT
Legend
#endif // !ENABLE_PREVIEW_LAYOUT
}; };
Preview(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process, Preview(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process,
@ -159,17 +144,12 @@ public:
bool is_loaded() const { return m_loaded; } bool is_loaded() const { return m_loaded; }
#if !ENABLE_PREVIEW_LAYOUT
void update_bottom_toolbar();
#endif // !ENABLE_PREVIEW_LAYOUT
void update_moves_slider(); void update_moves_slider();
void enable_moves_slider(bool enable); void enable_moves_slider(bool enable);
void move_moves_slider(wxKeyEvent& evt); void move_moves_slider(wxKeyEvent& evt);
void hide_layers_slider(); void hide_layers_slider();
#if ENABLE_PREVIEW_LAYOUT
void set_keep_current_preview_type(bool value) { m_keep_current_preview_type = value; } void set_keep_current_preview_type(bool value) { m_keep_current_preview_type = value; }
#endif // ENABLE_PREVIEW_LAYOUT
private: private:
bool init(wxWindow* parent, Bed3D& bed, Model* model); bool init(wxWindow* parent, Bed3D& bed, Model* model);
@ -178,11 +158,6 @@ private:
void unbind_event_handlers(); void unbind_event_handlers();
void on_size(wxSizeEvent& evt); void on_size(wxSizeEvent& evt);
#if !ENABLE_PREVIEW_LAYOUT
void on_choice_view_type(wxCommandEvent& evt);
void on_combochecklist_features(wxCommandEvent& evt);
void on_combochecklist_options(wxCommandEvent& evt);
#endif // !ENABLE_PREVIEW_LAYOUT
// Create/Update/Reset double slider on 3dPreview // Create/Update/Reset double slider on 3dPreview
wxBoxSizer* create_layers_slider_sizer(); wxBoxSizer* create_layers_slider_sizer();
@ -199,9 +174,6 @@ private:
void on_layers_slider_scroll_changed(wxCommandEvent& event); void on_layers_slider_scroll_changed(wxCommandEvent& event);
void on_moves_slider_scroll_changed(wxCommandEvent& event); void on_moves_slider_scroll_changed(wxCommandEvent& event);
#if !ENABLE_PREVIEW_LAYOUT
wxString get_option_type_string(OptionType type) const;
#endif // !ENABLE_PREVIEW_LAYOUT
}; };
} // namespace GUI } // namespace GUI

View File

@ -389,7 +389,6 @@ bool ImGuiWrapper::radio_button(const wxString &label, bool active)
return ImGui::RadioButton(label_utf8.c_str(), active); return ImGui::RadioButton(label_utf8.c_str(), active);
} }
#if ENABLE_PREVIEW_LAYOUT
bool ImGuiWrapper::draw_radio_button(const std::string& name, float size, bool active, bool ImGuiWrapper::draw_radio_button(const std::string& name, float size, bool active,
std::function<void(ImGuiWindow& window, const ImVec2& pos, float size)> draw_callback) std::function<void(ImGuiWindow& window, const ImVec2& pos, float size)> draw_callback)
{ {
@ -423,7 +422,6 @@ bool ImGuiWrapper::draw_radio_button(const std::string& name, float size, bool a
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window.DC.LastItemStatusFlags); IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window.DC.LastItemStatusFlags);
return pressed; return pressed;
} }
#endif // ENABLE_PREVIEW_LAYOUT
bool ImGuiWrapper::input_double(const std::string &label, const double &value, const std::string &format) bool ImGuiWrapper::input_double(const std::string &label, const double &value, const std::string &format)
{ {
@ -671,14 +669,10 @@ bool ImGuiWrapper::image_button(ImTextureID user_texture_id, const ImVec2& size,
bool ImGuiWrapper::combo(const wxString& label, const std::vector<std::string>& options, int& selection, ImGuiComboFlags flags) bool ImGuiWrapper::combo(const wxString& label, const std::vector<std::string>& options, int& selection, ImGuiComboFlags flags)
{ {
// this is to force the label to the left of the widget: // this is to force the label to the left of the widget:
#if ENABLE_PREVIEW_LAYOUT
if (!label.empty()) { if (!label.empty()) {
#endif // ENABLE_PREVIEW_LAYOUT
text(label); text(label);
ImGui::SameLine(); ImGui::SameLine();
#if ENABLE_PREVIEW_LAYOUT
} }
#endif // ENABLE_PREVIEW_LAYOUT
int selection_out = selection; int selection_out = selection;
bool res = false; bool res = false;

View File

@ -21,9 +21,7 @@ class wxString;
class wxMouseEvent; class wxMouseEvent;
class wxKeyEvent; class wxKeyEvent;
#if ENABLE_PREVIEW_LAYOUT
struct IMGUI_API ImGuiWindow; struct IMGUI_API ImGuiWindow;
#endif // ENABLE_PREVIEW_LAYOUT
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
@ -90,9 +88,7 @@ public:
bool button(const wxString &label); bool button(const wxString &label);
bool button(const wxString& label, float width, float height); bool button(const wxString& label, float width, float height);
bool radio_button(const wxString &label, bool active); bool radio_button(const wxString &label, bool active);
#if ENABLE_PREVIEW_LAYOUT
bool draw_radio_button(const std::string& name, float size, bool active, std::function<void(ImGuiWindow& window, const ImVec2& pos, float size)> draw_callback); bool draw_radio_button(const std::string& name, float size, bool active, std::function<void(ImGuiWindow& window, const ImVec2& pos, float size)> draw_callback);
#endif // ENABLE_PREVIEW_LAYOUT
bool input_double(const std::string &label, const double &value, const std::string &format = "%.3f"); bool input_double(const std::string &label, const double &value, const std::string &format = "%.3f");
bool input_double(const wxString &label, const double &value, const std::string &format = "%.3f"); bool input_double(const wxString &label, const double &value, const std::string &format = "%.3f");
bool input_vec3(const std::string &label, const Vec3d &value, float width, const std::string &format = "%.3f"); bool input_vec3(const std::string &label, const Vec3d &value, float width, const std::string &format = "%.3f");

View File

@ -1494,11 +1494,9 @@ void MainFrame::init_menubar_as_editor()
append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Labels") + sep + "E", _L("Show object/instance labels in 3D scene"), append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Labels") + sep + "E", _L("Show object/instance labels in 3D scene"),
[this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); }, this, [this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); }, this,
[this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->are_view3D_labels_shown(); }, this); [this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->are_view3D_labels_shown(); }, this);
#if ENABLE_PREVIEW_LAYOUT
append_menu_check_item(viewMenu, wxID_ANY, _L("Show Legen&d") + sep + "L", _L("Show legend in preview"), append_menu_check_item(viewMenu, wxID_ANY, _L("Show Legen&d") + sep + "L", _L("Show legend in preview"),
[this](wxCommandEvent&) { m_plater->show_legend(!m_plater->is_legend_shown()); }, this, [this](wxCommandEvent&) { m_plater->show_legend(!m_plater->is_legend_shown()); }, this,
[this]() { return m_plater->is_preview_shown(); }, [this]() { return m_plater->is_legend_shown(); }, this); [this]() { return m_plater->is_preview_shown(); }, [this]() { return m_plater->is_legend_shown(); }, this);
#endif // ENABLE_PREVIEW_LAYOUT
append_menu_check_item(viewMenu, wxID_ANY, _L("&Collapse Sidebar") + sep + "Shift+" + sep_space + "Tab", _L("Collapse sidebar"), append_menu_check_item(viewMenu, wxID_ANY, _L("&Collapse Sidebar") + sep + "Shift+" + sep_space + "Tab", _L("Collapse sidebar"),
[this](wxCommandEvent&) { m_plater->collapse_sidebar(!m_plater->is_sidebar_collapsed()); }, this, [this](wxCommandEvent&) { m_plater->collapse_sidebar(!m_plater->is_sidebar_collapsed()); }, this,
[]() { return true; }, [this]() { return m_plater->is_sidebar_collapsed(); }, this); []() { return true; }, [this]() { return m_plater->is_sidebar_collapsed(); }, this);
@ -1616,12 +1614,10 @@ void MainFrame::init_menubar_as_gcodeviewer()
if (m_plater != nullptr) { if (m_plater != nullptr) {
viewMenu = new wxMenu(); viewMenu = new wxMenu();
add_common_view_menu_items(viewMenu, this, std::bind(&MainFrame::can_change_view, this)); add_common_view_menu_items(viewMenu, this, std::bind(&MainFrame::can_change_view, this));
#if ENABLE_PREVIEW_LAYOUT
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
append_menu_check_item(viewMenu, wxID_ANY, _L("Show legen&d") + sep + "L", _L("Show legend"), append_menu_check_item(viewMenu, wxID_ANY, _L("Show legen&d") + sep + "L", _L("Show legend"),
[this](wxCommandEvent&) { m_plater->show_legend(!m_plater->is_legend_shown()); }, this, [this](wxCommandEvent&) { m_plater->show_legend(!m_plater->is_legend_shown()); }, this,
[this]() { return m_plater->is_preview_shown(); }, [this]() { return m_plater->is_legend_shown(); }, this); [this]() { return m_plater->is_preview_shown(); }, [this]() { return m_plater->is_legend_shown(); }, this);
#endif // ENABLE_PREVIEW_LAYOUT
} }
// helpmenu // helpmenu

View File

@ -1767,10 +1767,8 @@ struct Plater::priv
bool are_view3D_labels_shown() const { return (current_panel == view3D) && view3D->get_canvas3d()->are_labels_shown(); } bool are_view3D_labels_shown() const { return (current_panel == view3D) && view3D->get_canvas3d()->are_labels_shown(); }
void show_view3D_labels(bool show) { if (current_panel == view3D) view3D->get_canvas3d()->show_labels(show); } void show_view3D_labels(bool show) { if (current_panel == view3D) view3D->get_canvas3d()->show_labels(show); }
#if ENABLE_PREVIEW_LAYOUT
bool is_legend_shown() const { return (current_panel == preview) && preview->get_canvas3d()->is_legend_shown(); } bool is_legend_shown() const { return (current_panel == preview) && preview->get_canvas3d()->is_legend_shown(); }
void show_legend(bool show) { if (current_panel == preview) preview->get_canvas3d()->show_legend(show); } void show_legend(bool show) { if (current_panel == preview) preview->get_canvas3d()->show_legend(show); }
#endif // ENABLE_PREVIEW_LAYOUT
bool is_sidebar_collapsed() const { return sidebar->is_collapsed(); } bool is_sidebar_collapsed() const { return sidebar->is_collapsed(); }
void collapse_sidebar(bool collapse); void collapse_sidebar(bool collapse);
@ -1785,9 +1783,6 @@ struct Plater::priv
bool init_view_toolbar(); bool init_view_toolbar();
bool init_collapse_toolbar(); bool init_collapse_toolbar();
#if !ENABLE_PREVIEW_LAYOUT
void update_preview_bottom_toolbar();
#endif // !ENABLE_PREVIEW_LAYOUT
void update_preview_moves_slider(); void update_preview_moves_slider();
void enable_preview_moves_slider(bool enable); void enable_preview_moves_slider(bool enable);
@ -4740,13 +4735,6 @@ bool Plater::priv::init_collapse_toolbar()
return true; return true;
} }
#if !ENABLE_PREVIEW_LAYOUT
void Plater::priv::update_preview_bottom_toolbar()
{
preview->update_bottom_toolbar();
}
#endif // !ENABLE_PREVIEW_LAYOUT
void Plater::priv::update_preview_moves_slider() void Plater::priv::update_preview_moves_slider()
{ {
preview->update_moves_slider(); preview->update_moves_slider();
@ -5723,10 +5711,8 @@ bool Plater::is_view3D_shown() const { return p->is_view3D_shown(); }
bool Plater::are_view3D_labels_shown() const { return p->are_view3D_labels_shown(); } bool Plater::are_view3D_labels_shown() const { return p->are_view3D_labels_shown(); }
void Plater::show_view3D_labels(bool show) { p->show_view3D_labels(show); } void Plater::show_view3D_labels(bool show) { p->show_view3D_labels(show); }
#if ENABLE_PREVIEW_LAYOUT
bool Plater::is_legend_shown() const { return p->is_legend_shown(); } bool Plater::is_legend_shown() const { return p->is_legend_shown(); }
void Plater::show_legend(bool show) { p->show_legend(show); } void Plater::show_legend(bool show) { p->show_legend(show); }
#endif // ENABLE_PREVIEW_LAYOUT
bool Plater::is_sidebar_collapsed() const { return p->is_sidebar_collapsed(); } bool Plater::is_sidebar_collapsed() const { return p->is_sidebar_collapsed(); }
void Plater::collapse_sidebar(bool show) { p->collapse_sidebar(show); } void Plater::collapse_sidebar(bool show) { p->collapse_sidebar(show); }
@ -7084,13 +7070,6 @@ GLToolbar& Plater::get_collapse_toolbar()
return p->collapse_toolbar; return p->collapse_toolbar;
} }
#if !ENABLE_PREVIEW_LAYOUT
void Plater::update_preview_bottom_toolbar()
{
p->update_preview_bottom_toolbar();
}
#endif // !ENABLE_PREVIEW_LAYOUT
void Plater::update_preview_moves_slider() void Plater::update_preview_moves_slider()
{ {
p->update_preview_moves_slider(); p->update_preview_moves_slider();
@ -7199,12 +7178,10 @@ bool Plater::is_render_statistic_dialog_visible() const
return p->show_render_statistic_dialog; return p->show_render_statistic_dialog;
} }
#if ENABLE_PREVIEW_LAYOUT
void Plater::set_keep_current_preview_type(bool value) void Plater::set_keep_current_preview_type(bool value)
{ {
p->preview->set_keep_current_preview_type(value); p->preview->set_keep_current_preview_type(value);
} }
#endif // ENABLE_PREVIEW_LAYOUT
Plater::TakeSnapshot::TakeSnapshot(Plater *plater, const std::string &snapshot_name) Plater::TakeSnapshot::TakeSnapshot(Plater *plater, const std::string &snapshot_name)
: TakeSnapshot(plater, from_u8(snapshot_name)) {} : TakeSnapshot(plater, from_u8(snapshot_name)) {}

View File

@ -225,10 +225,8 @@ public:
bool are_view3D_labels_shown() const; bool are_view3D_labels_shown() const;
void show_view3D_labels(bool show); void show_view3D_labels(bool show);
#if ENABLE_PREVIEW_LAYOUT
bool is_legend_shown() const; bool is_legend_shown() const;
void show_legend(bool show); void show_legend(bool show);
#endif // ENABLE_PREVIEW_LAYOUT
bool is_sidebar_collapsed() const; bool is_sidebar_collapsed() const;
void collapse_sidebar(bool show); void collapse_sidebar(bool show);
@ -390,9 +388,6 @@ public:
const GLToolbar& get_collapse_toolbar() const; const GLToolbar& get_collapse_toolbar() const;
GLToolbar& get_collapse_toolbar(); GLToolbar& get_collapse_toolbar();
#if !ENABLE_PREVIEW_LAYOUT
void update_preview_bottom_toolbar();
#endif // !ENABLE_PREVIEW_LAYOUT
void update_preview_moves_slider(); void update_preview_moves_slider();
void enable_preview_moves_slider(bool enable); void enable_preview_moves_slider(bool enable);
@ -458,9 +453,7 @@ public:
void toggle_render_statistic_dialog(); void toggle_render_statistic_dialog();
bool is_render_statistic_dialog_visible() const; bool is_render_statistic_dialog_visible() const;
#if ENABLE_PREVIEW_LAYOUT
void set_keep_current_preview_type(bool value); void set_keep_current_preview_type(bool value);
#endif // ENABLE_PREVIEW_LAYOUT
// Wrapper around wxWindow::PopupMenu to suppress error messages popping out while tracking the popup menu. // Wrapper around wxWindow::PopupMenu to suppress error messages popping out while tracking the popup menu.
bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition); bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition);