Tech ENABLE_PREVIEW_LAYOUT - Replace options combo in bottom toolbar with toolbar in legend
This commit is contained in:
parent
fee31084bd
commit
e12cf58c91
@ -959,7 +959,9 @@ unsigned int GCodeViewer::get_options_visibility_flags() const
|
||||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::CustomGCodes), is_toolpath_move_type_visible(EMoveType::Custom_GCode));
|
||||
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());
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Legend), is_legend_enabled());
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -980,7 +982,9 @@ void GCodeViewer::set_options_visibility_from_flags(unsigned int flags)
|
||||
set_toolpath_move_type_visible(EMoveType::Custom_GCode, is_flag_set(static_cast<unsigned int>(Preview::OptionType::CustomGCodes)));
|
||||
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)));
|
||||
#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)
|
||||
@ -3575,7 +3579,9 @@ void GCodeViewer::render_legend(float& legend_height)
|
||||
refresh_render_paths(false, false);
|
||||
wxGetApp().plater()->update_preview_moves_slider();
|
||||
wxGetApp().plater()->get_current_canvas3D()->set_as_dirty();
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
wxGetApp().plater()->update_preview_bottom_toolbar();
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -3846,6 +3852,7 @@ 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)
|
||||
@ -3930,6 +3937,7 @@ void GCodeViewer::render_legend(float& legend_height)
|
||||
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
|
||||
|
||||
// settings section
|
||||
bool has_settings = false;
|
||||
@ -4050,17 +4058,123 @@ void GCodeViewer::render_legend(float& legend_height)
|
||||
|
||||
switch (m_time_estimate_mode) {
|
||||
case PrintEstimatedStatistics::ETimeMode::Normal: {
|
||||
show_mode_button(_L("Show stealth mode"), PrintEstimatedStatistics::ETimeMode::Stealth);
|
||||
show_mode_button(_u8L("Show stealth mode"), PrintEstimatedStatistics::ETimeMode::Stealth);
|
||||
break;
|
||||
}
|
||||
case PrintEstimatedStatistics::ETimeMode::Stealth: {
|
||||
show_mode_button(_L("Show normal mode"), PrintEstimatedStatistics::ETimeMode::Normal);
|
||||
show_mode_button(_u8L("Show normal mode"), PrintEstimatedStatistics::ETimeMode::Normal);
|
||||
break;
|
||||
}
|
||||
default : { assert(false); break; }
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
// toolbar section
|
||||
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) {
|
||||
auto is_flag_set = [](unsigned int flags, unsigned int flag) {
|
||||
return (flags & (1 << flag)) != 0;
|
||||
};
|
||||
|
||||
auto set_flag = [](unsigned int flags, unsigned int flag, bool active) {
|
||||
return active ? (flags | (1 << flag)) : (flags & ~(1 << flag));
|
||||
};
|
||||
|
||||
unsigned int flags = get_options_visibility_flags();
|
||||
unsigned int flag = static_cast<unsigned int>(type);
|
||||
bool active = is_flag_set(flags, flag);
|
||||
|
||||
if (imgui.draw_radio_button(name, 1.5f * icon_size, active, draw_callback)) {
|
||||
unsigned int new_flags = set_flag(flags, flag, !active);
|
||||
set_options_visibility_from_flags(new_flags);
|
||||
|
||||
wxGetApp().plater()->get_current_canvas3D()->refresh_gcode_preview_render_paths();
|
||||
wxGetApp().plater()->update_preview_moves_slider();
|
||||
}
|
||||
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BACKGROUND);
|
||||
ImGui::BeginTooltip();
|
||||
imgui.text(name);
|
||||
ImGui::EndTooltip();
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
};
|
||||
|
||||
auto circle_icon = [](ImGuiWindow& window, const ImVec2& pos, float size, const Color& color) {
|
||||
const float margin = 3.0f;
|
||||
const ImVec2 center(0.5f * (pos.x + pos.x + size), 0.5f * (pos.y + pos.y + size));
|
||||
window.DrawList->AddCircleFilled(center, 0.5f * (size - 2.0f * margin), ImGui::GetColorU32({ color[0], color[1], color[2], 1.0f }), 16);
|
||||
};
|
||||
auto line_icon = [](ImGuiWindow& window, const ImVec2& pos, float size, const Color& color) {
|
||||
const float margin = 3.0f;
|
||||
window.DrawList->AddLine({ pos.x + margin, pos.y + size - margin }, { pos.x + size - margin, pos.y + margin }, ImGui::GetColorU32({ color[0], color[1], color[2], 1.0f }), 3.0f);
|
||||
};
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
ImGui::Spacing();
|
||||
toggle_button(Preview::OptionType::Travel, _u8L("Travel"), [line_icon](ImGuiWindow& window, const ImVec2& pos, float size) {
|
||||
line_icon(window, pos, size, Travel_Colors[0]);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
toggle_button(Preview::OptionType::Wipe, _u8L("Wipe"), [line_icon](ImGuiWindow& window, const ImVec2& pos, float size) {
|
||||
line_icon(window, pos, size, Wipe_Color);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
toggle_button(Preview::OptionType::Retractions, _u8L("Retractions"), [circle_icon](ImGuiWindow& window, const ImVec2& pos, float size) {
|
||||
circle_icon(window, pos, size, Options_Colors[static_cast<unsigned int>(EOptionsColors::Retractions)]);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
toggle_button(Preview::OptionType::Unretractions, _u8L("Deretractions"), [circle_icon](ImGuiWindow& window, const ImVec2& pos, float size) {
|
||||
circle_icon(window, pos, size, Options_Colors[static_cast<unsigned int>(EOptionsColors::Unretractions)]);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
toggle_button(Preview::OptionType::Seams, _u8L("Seams"), [circle_icon](ImGuiWindow& window, const ImVec2& pos, float size) {
|
||||
circle_icon(window, pos, size, Options_Colors[static_cast<unsigned int>(EOptionsColors::Seams)]);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
toggle_button(Preview::OptionType::ToolChanges, _u8L("Tool changes"), [circle_icon](ImGuiWindow& window, const ImVec2& pos, float size) {
|
||||
circle_icon(window, pos, size, Options_Colors[static_cast<unsigned int>(EOptionsColors::ToolChanges)]);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
toggle_button(Preview::OptionType::ColorChanges, _u8L("Color changes"), [circle_icon](ImGuiWindow& window, const ImVec2& pos, float size) {
|
||||
circle_icon(window, pos, size, Options_Colors[static_cast<unsigned int>(EOptionsColors::ColorChanges)]);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
toggle_button(Preview::OptionType::PausePrints, _u8L("Print pauses"), [circle_icon](ImGuiWindow& window, const ImVec2& pos, float size) {
|
||||
circle_icon(window, pos, size, Options_Colors[static_cast<unsigned int>(EOptionsColors::PausePrints)]);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
toggle_button(Preview::OptionType::CustomGCodes, _u8L("Custom G-codes"), [circle_icon](ImGuiWindow& window, const ImVec2& pos, float size) {
|
||||
circle_icon(window, pos, size, Options_Colors[static_cast<unsigned int>(EOptionsColors::CustomGCodes)]);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
toggle_button(Preview::OptionType::Shells, _u8L("Shells"), [](ImGuiWindow& window, const ImVec2& pos, float size) {
|
||||
const ImU32 color = ImGui::GetColorU32({ 1.0f, 1.0f, 1.0f, 1.0f });
|
||||
const float margin = 3.0f;
|
||||
const float proj = 0.25f * size;
|
||||
window.DrawList->AddRect({ pos.x + margin, pos.y + size - margin }, { pos.x + size - margin - proj, pos.y + margin + proj }, color);
|
||||
window.DrawList->AddLine({ pos.x + margin, pos.y + margin + proj }, { pos.x + margin + proj, pos.y + margin }, color);
|
||||
window.DrawList->AddLine({ pos.x + size - margin - proj, pos.y + margin + proj }, { pos.x + size - margin, pos.y + margin }, color);
|
||||
window.DrawList->AddLine({ pos.x + size - margin - proj, pos.y + size - margin }, { pos.x + size - margin, pos.y + size - margin - proj }, color);
|
||||
window.DrawList->AddLine({ pos.x + margin + proj, pos.y + margin }, { pos.x + size - margin, pos.y + margin }, color);
|
||||
window.DrawList->AddLine({ pos.x + size - margin, pos.y + margin }, { pos.x + size - margin, pos.y + size - margin - proj }, color);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
toggle_button(Preview::OptionType::ToolMarker, _u8L("Tool marker"), [](ImGuiWindow& window, const ImVec2& pos, float size) {
|
||||
const ImU32 color = ImGui::GetColorU32({ 1.0f, 1.0f, 1.0f, 0.8f });
|
||||
const float margin = 3.0f;
|
||||
const ImVec2 p1(0.5f * (pos.x + pos.x + size), pos.y + size - margin);
|
||||
const ImVec2 p2 = ImVec2(p1.x + 0.25f * size, p1.y - 0.25f * size);
|
||||
const ImVec2 p3 = ImVec2(p1.x - 0.25f * size, p1.y - 0.25f * size);
|
||||
window.DrawList->AddTriangleFilled(p1, p2, p3, color);
|
||||
const float mid_x = 0.5f * (pos.x + pos.x + size);
|
||||
window.DrawList->AddRectFilled({ mid_x - 0.09375f * size, p1.y - 0.25f * size }, { mid_x + 0.09375f * size, pos.y + margin }, color);
|
||||
});
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
legend_height = ImGui::GetCurrentWindow()->Size.y;
|
||||
|
||||
imgui.end();
|
||||
|
@ -2410,7 +2410,9 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
||||
if (!m_main_toolbar.is_enabled()) {
|
||||
m_gcode_viewer.enable_legend(!m_gcode_viewer.is_legend_enabled());
|
||||
m_dirty = true;
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
wxGetApp().plater()->update_preview_bottom_toolbar();
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -224,7 +224,6 @@ bool Preview::init(wxWindow* parent, Model* model)
|
||||
m_choice_view_type->Append(_L("Tool"));
|
||||
m_choice_view_type->Append(_L("Color Print"));
|
||||
m_choice_view_type->SetSelection(0);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
m_label_show = new wxStaticText(m_bottom_toolbar_panel, wxID_ANY, _L("Show"));
|
||||
|
||||
@ -233,7 +232,7 @@ bool Preview::init(wxWindow* parent, Model* model)
|
||||
#else
|
||||
long combo_style = wxCB_READONLY;
|
||||
#endif
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
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(
|
||||
@ -254,7 +253,6 @@ bool Preview::init(wxWindow* parent, Model* model)
|
||||
_L("Custom") + "|1"
|
||||
);
|
||||
Slic3r::GUI::create_combochecklist(m_combochecklist_features, GUI::into_u8(_L("Feature types")), feature_items);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
m_combochecklist_options = new wxComboCtrl();
|
||||
m_combochecklist_options->Create(m_bottom_toolbar_panel, wxID_ANY, _L("Options"), wxDefaultPosition, wxDefaultSize, combo_style);
|
||||
@ -273,6 +271,7 @@ bool Preview::init(wxWindow* parent, Model* model)
|
||||
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->Add(m_canvas_widget, 1, wxALL | wxEXPAND, 0);
|
||||
@ -288,17 +287,15 @@ bool Preview::init(wxWindow* parent, Model* model)
|
||||
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);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
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);
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
// 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);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
bottom_toolbar_sizer->AddSpacer(5);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
bottom_toolbar_sizer->Add(m_moves_slider, 1, wxALL | wxEXPAND, 0);
|
||||
m_bottom_toolbar_panel->SetSizer(bottom_toolbar_sizer);
|
||||
|
||||
@ -360,7 +357,9 @@ void Preview::load_print(bool keep_z_range)
|
||||
else if (tech == ptSLA)
|
||||
load_print_as_sla();
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
update_bottom_toolbar();
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
Layout();
|
||||
}
|
||||
|
||||
@ -430,9 +429,9 @@ void Preview::sys_color_changed()
|
||||
wxGetApp().UpdateDarkUI(m_choice_view_type);
|
||||
wxGetApp().UpdateDarkUI(m_combochecklist_features);
|
||||
wxGetApp().UpdateDarkUI(static_cast<wxCheckListBoxComboPopup*>(m_combochecklist_features->GetPopupControl()));
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
wxGetApp().UpdateDarkUI(m_combochecklist_options);
|
||||
wxGetApp().UpdateDarkUI(static_cast<wxCheckListBoxComboPopup*>(m_combochecklist_options->GetPopupControl()));
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
#endif
|
||||
|
||||
if (m_layers_slider != nullptr)
|
||||
@ -456,23 +455,23 @@ void Preview::edit_layers_slider(wxKeyEvent& evt)
|
||||
|
||||
void Preview::bind_event_handlers()
|
||||
{
|
||||
this->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);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
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);
|
||||
}
|
||||
|
||||
void Preview::unbind_event_handlers()
|
||||
{
|
||||
this->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);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
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);
|
||||
}
|
||||
|
||||
@ -510,7 +509,6 @@ void Preview::on_combochecklist_features(wxCommandEvent& evt)
|
||||
m_canvas->set_toolpath_role_visibility_flags(flags);
|
||||
refresh_print();
|
||||
}
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
void Preview::on_combochecklist_options(wxCommandEvent& evt)
|
||||
{
|
||||
@ -526,12 +524,9 @@ void Preview::on_combochecklist_options(wxCommandEvent& evt)
|
||||
|
||||
void Preview::update_bottom_toolbar()
|
||||
{
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
combochecklist_set_flags(m_combochecklist_features, m_canvas->get_toolpath_role_visibility_flags());
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
combochecklist_set_flags(m_combochecklist_options, m_canvas->get_gcode_options_visibility_flags());
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
// updates visibility of features combobox
|
||||
if (m_bottom_toolbar_panel->IsShown()) {
|
||||
wxSizer* sizer = m_bottom_toolbar_panel->GetSizer();
|
||||
@ -554,8 +549,8 @@ void Preview::update_bottom_toolbar()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
}
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
wxBoxSizer* Preview::create_layers_slider_sizer()
|
||||
{
|
||||
@ -1077,6 +1072,7 @@ void Preview::on_moves_slider_scroll_changed(wxCommandEvent& event)
|
||||
m_canvas->render();
|
||||
}
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
wxString Preview::get_option_type_string(OptionType type) const
|
||||
{
|
||||
switch (type)
|
||||
@ -1096,6 +1092,7 @@ wxString Preview::get_option_type_string(OptionType type) const
|
||||
default: { return ""; }
|
||||
}
|
||||
}
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
@ -87,13 +87,11 @@ class Preview : public wxPanel
|
||||
#else
|
||||
wxComboBox* m_choice_view_type { nullptr };
|
||||
#endif
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
wxStaticText* m_label_show { nullptr };
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
wxStaticText* m_label_show{ nullptr };
|
||||
wxComboCtrl* m_combochecklist_features { nullptr };
|
||||
size_t m_combochecklist_features_pos { 0 };
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
wxComboCtrl* m_combochecklist_options { nullptr };
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
DynamicPrintConfig* m_config;
|
||||
BackgroundSlicingProcess* m_process;
|
||||
@ -130,7 +128,9 @@ public:
|
||||
CustomGCodes,
|
||||
Shells,
|
||||
ToolMarker,
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
Legend
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
};
|
||||
|
||||
Preview(wxWindow* parent, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process,
|
||||
@ -158,7 +158,9 @@ public:
|
||||
|
||||
bool is_loaded() const { return m_loaded; }
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
void update_bottom_toolbar();
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
void update_moves_slider();
|
||||
void enable_moves_slider(bool enable);
|
||||
void move_moves_slider(wxKeyEvent& evt);
|
||||
@ -178,8 +180,8 @@ private:
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
void on_choice_view_type(wxCommandEvent& evt);
|
||||
void on_combochecklist_features(wxCommandEvent& evt);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
void on_combochecklist_options(wxCommandEvent& evt);
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
// Create/Update/Reset double slider on 3dPreview
|
||||
wxBoxSizer* create_layers_slider_sizer();
|
||||
@ -196,7 +198,9 @@ private:
|
||||
|
||||
void on_layers_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
|
||||
|
@ -349,6 +349,42 @@ bool ImGuiWrapper::radio_button(const wxString &label, bool 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,
|
||||
std::function<void(ImGuiWindow& window, const ImVec2& pos, float size)> draw_callback)
|
||||
{
|
||||
ImGuiWindow& window = *ImGui::GetCurrentWindow();
|
||||
if (window.SkipItems)
|
||||
return false;
|
||||
|
||||
ImGuiContext& g = *GImGui;
|
||||
const ImGuiStyle& style = g.Style;
|
||||
const ImGuiID id = window.GetID(name.c_str());
|
||||
|
||||
const ImVec2 pos = window.DC.CursorPos;
|
||||
const ImRect total_bb(pos, pos + ImVec2(size, size + style.FramePadding.y * 2.0f));
|
||||
ImGui::ItemSize(total_bb, style.FramePadding.y);
|
||||
if (!ImGui::ItemAdd(total_bb, id))
|
||||
return false;
|
||||
|
||||
bool hovered, held;
|
||||
bool pressed = ImGui::ButtonBehavior(total_bb, id, &hovered, &held);
|
||||
if (pressed)
|
||||
ImGui::MarkItemEdited(id);
|
||||
|
||||
if (hovered)
|
||||
window.DrawList->AddRect({ pos.x - 1.0f, pos.y - 1.0f }, { pos.x + size + 1.0f, pos.y + size + 1.0f }, ImGui::GetColorU32(ImGuiCol_CheckMark));
|
||||
|
||||
if (active)
|
||||
window.DrawList->AddRect(pos, { pos.x + size, pos.y + size }, ImGui::GetColorU32(ImGuiCol_CheckMark));
|
||||
|
||||
draw_callback(window, pos, size);
|
||||
|
||||
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window.DC.LastItemStatusFlags);
|
||||
return pressed;
|
||||
}
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
bool ImGuiWrapper::image_button()
|
||||
{
|
||||
return false;
|
||||
|
@ -16,6 +16,9 @@ class wxString;
|
||||
class wxMouseEvent;
|
||||
class wxKeyEvent;
|
||||
|
||||
#if ENABLE_PREVIEW_LAYOUT
|
||||
struct IMGUI_API ImGuiWindow;
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
@ -68,7 +71,10 @@ public:
|
||||
bool button(const wxString &label);
|
||||
bool button(const wxString& label, float width, float height);
|
||||
bool radio_button(const wxString &label, bool active);
|
||||
bool image_button();
|
||||
#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);
|
||||
#endif // ENABLE_PREVIEW_LAYOUT
|
||||
bool image_button();
|
||||
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_vec3(const std::string &label, const Vec3d &value, float width, const std::string &format = "%.3f");
|
||||
|
@ -1632,7 +1632,9 @@ struct Plater::priv
|
||||
bool init_view_toolbar();
|
||||
bool init_collapse_toolbar();
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
void update_preview_bottom_toolbar();
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
void update_preview_moves_slider();
|
||||
void enable_preview_moves_slider(bool enable);
|
||||
|
||||
@ -4400,10 +4402,12 @@ bool Plater::priv::init_collapse_toolbar()
|
||||
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()
|
||||
{
|
||||
@ -6637,10 +6641,12 @@ GLToolbar& Plater::get_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()
|
||||
{
|
||||
|
@ -345,7 +345,9 @@ public:
|
||||
const GLToolbar& get_collapse_toolbar() const;
|
||||
GLToolbar& get_collapse_toolbar();
|
||||
|
||||
#if !ENABLE_PREVIEW_LAYOUT
|
||||
void update_preview_bottom_toolbar();
|
||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||
void update_preview_moves_slider();
|
||||
void enable_preview_moves_slider(bool enable);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user