mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 10:29:08 +08:00
Tech ENABLE_PREVIEW_LAYOUT - A few fixes in the new legend layout
This commit is contained in:
parent
7f89a42be6
commit
cddfc8b690
@ -3346,21 +3346,26 @@ void GCodeViewer::render_legend(float& legend_height)
|
|||||||
|
|
||||||
#if ENABLE_PREVIEW_LAYOUT
|
#if ENABLE_PREVIEW_LAYOUT
|
||||||
// selection section
|
// selection section
|
||||||
bool selection_changed = false;
|
bool view_type_changed = false;
|
||||||
int view_type = static_cast<int>(get_view_type());
|
int old_view_type = static_cast<int>(get_view_type());
|
||||||
int old_view_type = view_type;
|
int view_type = old_view_type;
|
||||||
if (imgui.combo("", { _u8L("Feature type"),
|
ImGuiStyle& style = ImGui::GetStyle();
|
||||||
_u8L("Height (mm)"),
|
ImGui::PushItemWidth(ImGui::GetWindowWidth() - style.ItemSpacing.x - 2.0f * style.FramePadding.x);
|
||||||
_u8L("Width (mm)"),
|
imgui.combo("", { _u8L("Feature type"),
|
||||||
_u8L("Speed (mm/s)"),
|
_u8L("Height (mm)"),
|
||||||
_u8L("Fan speed (%)"),
|
_u8L("Width (mm)"),
|
||||||
_u8L("Temperature (°C)"),
|
_u8L("Speed (mm/s)"),
|
||||||
_u8L("Volumetric flow rate (mm³/s)"),
|
_u8L("Fan speed (%)"),
|
||||||
_u8L("Tool"),
|
_u8L("Temperature (°C)"),
|
||||||
_u8L("Color Print") }, view_type)) {
|
_u8L("Volumetric flow rate (mm³/s)"),
|
||||||
|
_u8L("Tool"),
|
||||||
|
_u8L("Color Print") }, view_type);
|
||||||
|
|
||||||
|
if (old_view_type != view_type) {
|
||||||
set_view_type(static_cast<EViewType>(view_type));
|
set_view_type(static_cast<EViewType>(view_type));
|
||||||
|
wxGetApp().plater()->set_keep_current_preview_type(true);
|
||||||
wxGetApp().plater()->refresh_print();
|
wxGetApp().plater()->refresh_print();
|
||||||
selection_changed = old_view_type != view_type;
|
view_type_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// extrusion paths section -> title
|
// extrusion paths section -> title
|
||||||
@ -3394,7 +3399,7 @@ void GCodeViewer::render_legend(float& legend_height)
|
|||||||
#endif // ENABLE_PREVIEW_LAYOUT
|
#endif // ENABLE_PREVIEW_LAYOUT
|
||||||
|
|
||||||
#if ENABLE_PREVIEW_LAYOUT
|
#if ENABLE_PREVIEW_LAYOUT
|
||||||
if (!selection_changed) {
|
if (!view_type_changed) {
|
||||||
#endif // ENABLE_PREVIEW_LAYOUT
|
#endif // ENABLE_PREVIEW_LAYOUT
|
||||||
// extrusion paths section -> items
|
// extrusion paths section -> items
|
||||||
switch (m_view_type)
|
switch (m_view_type)
|
||||||
|
@ -993,13 +993,21 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||||||
std::vector<Item> gcodes = wxGetApp().is_editor() ?
|
std::vector<Item> gcodes = wxGetApp().is_editor() ?
|
||||||
wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes :
|
wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes :
|
||||||
m_canvas->get_custom_gcode_per_print_z();
|
m_canvas->get_custom_gcode_per_print_z();
|
||||||
|
#if ENABLE_PREVIEW_LAYOUT
|
||||||
|
const GCodeViewer::EViewType choice = !gcodes.empty() ?
|
||||||
|
GCodeViewer::EViewType::ColorPrint :
|
||||||
|
(number_extruders > 1) ? GCodeViewer::EViewType::Tool : GCodeViewer::EViewType::FeatureType;
|
||||||
|
if (choice != gcode_view_type) {
|
||||||
|
m_canvas->set_gcode_view_preview_type(choice);
|
||||||
|
if (wxGetApp().is_gcode_viewer()) {
|
||||||
|
m_keep_current_preview_type = true;
|
||||||
|
refresh_print();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
const wxString choice = !gcodes.empty() ?
|
const wxString choice = !gcodes.empty() ?
|
||||||
_L("Color Print") :
|
_L("Color Print") :
|
||||||
(number_extruders > 1) ? _L("Tool") : _L("Feature type");
|
(number_extruders > 1) ? _L("Tool") : _L("Feature type");
|
||||||
|
|
||||||
#if ENABLE_PREVIEW_LAYOUT
|
|
||||||
GCodeViewer::EViewType view_type = m_canvas->get_gcode_view_type();
|
|
||||||
#else
|
|
||||||
int type = m_choice_view_type->FindString(choice);
|
int type = m_choice_view_type->FindString(choice);
|
||||||
if (m_choice_view_type->GetSelection() != type) {
|
if (m_choice_view_type->GetSelection() != type) {
|
||||||
if (0 <= type && type < static_cast<int>(GCodeViewer::EViewType::Count)) {
|
if (0 <= type && type < static_cast<int>(GCodeViewer::EViewType::Count)) {
|
||||||
|
@ -164,6 +164,10 @@ public:
|
|||||||
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; }
|
||||||
|
#endif // ENABLE_PREVIEW_LAYOUT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool init(wxWindow* parent, Model* model);
|
bool init(wxWindow* parent, Model* model);
|
||||||
|
|
||||||
|
@ -6606,6 +6606,12 @@ 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)
|
||||||
|
{
|
||||||
|
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)) {}
|
||||||
|
@ -403,6 +403,10 @@ 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);
|
||||||
|
#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);
|
||||||
bool PopupMenu(wxMenu *menu, int x, int y) { return this->PopupMenu(menu, wxPoint(x, y)); }
|
bool PopupMenu(wxMenu *menu, int x, int y) { return this->PopupMenu(menu, wxPoint(x, y)); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user