Merge remote-tracking branch 'origin/master' into tm_sla_supports_backend
This commit is contained in:
commit
c5438d8bc3
@ -2045,6 +2045,11 @@ void _3DScene::render(wxGLCanvas* canvas)
|
||||
s_canvas_mgr.render(canvas);
|
||||
}
|
||||
|
||||
void _3DScene::select_all(wxGLCanvas* canvas)
|
||||
{
|
||||
s_canvas_mgr.select_all(canvas);
|
||||
}
|
||||
|
||||
void _3DScene::delete_selected(wxGLCanvas* canvas)
|
||||
{
|
||||
s_canvas_mgr.delete_selected(canvas);
|
||||
|
@ -633,6 +633,7 @@ public:
|
||||
|
||||
static void render(wxGLCanvas* canvas);
|
||||
|
||||
static void select_all(wxGLCanvas* canvas);
|
||||
static void delete_selected(wxGLCanvas* canvas);
|
||||
static void ensure_on_bed(wxGLCanvas* canvas, unsigned int object_idx);
|
||||
|
||||
|
@ -1315,6 +1315,22 @@ void GLCanvas3D::Selection::remove_volume(unsigned int object_idx, unsigned int
|
||||
m_bounding_box_dirty = true;
|
||||
}
|
||||
|
||||
void GLCanvas3D::Selection::add_all()
|
||||
{
|
||||
if (!m_valid)
|
||||
return;
|
||||
|
||||
m_mode = Instance;
|
||||
|
||||
for (unsigned int i = 0; i < (unsigned int)m_volumes->size(); ++i)
|
||||
{
|
||||
_add_volume(i);
|
||||
}
|
||||
|
||||
_update_type();
|
||||
m_bounding_box_dirty = true;
|
||||
}
|
||||
|
||||
void GLCanvas3D::Selection::clear()
|
||||
{
|
||||
if (!m_valid)
|
||||
@ -3687,6 +3703,11 @@ void GLCanvas3D::render()
|
||||
m_canvas->SwapBuffers();
|
||||
}
|
||||
|
||||
void GLCanvas3D::select_all()
|
||||
{
|
||||
m_selection.add_all();
|
||||
}
|
||||
|
||||
void GLCanvas3D::delete_selected()
|
||||
{
|
||||
m_selection.erase();
|
||||
|
@ -485,6 +485,8 @@ public:
|
||||
void add_volume(unsigned int object_idx, unsigned int volume_idx, int instance_idx, bool as_single_selection = true);
|
||||
void remove_volume(unsigned int object_idx, unsigned int volume_idx);
|
||||
|
||||
void add_all();
|
||||
|
||||
// Update the selection based on the map from old indices to new indices after m_volumes changed.
|
||||
// If the current selection is by instance, this call may select newly added volumes, if they belong to already selected instances.
|
||||
void volumes_changed(const std::vector<size_t> &map_volume_old_to_new);
|
||||
@ -813,6 +815,7 @@ public:
|
||||
|
||||
void render();
|
||||
|
||||
void select_all();
|
||||
void delete_selected();
|
||||
void ensure_on_bed(unsigned int object_idx);
|
||||
|
||||
|
@ -454,6 +454,13 @@ void GLCanvas3DManager::render(wxGLCanvas* canvas) const
|
||||
it->second->render();
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::select_all(wxGLCanvas* canvas)
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->select_all();
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::delete_selected(wxGLCanvas* canvas)
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
|
@ -130,6 +130,7 @@ public:
|
||||
|
||||
void render(wxGLCanvas* canvas) const;
|
||||
|
||||
void select_all(wxGLCanvas* canvas);
|
||||
void delete_selected(wxGLCanvas* canvas);
|
||||
void ensure_on_bed(wxGLCanvas* canvas, unsigned int object_idx);
|
||||
|
||||
|
@ -201,6 +201,16 @@ bool MainFrame::can_change_view() const
|
||||
int page_id = m_tabpanel->GetSelection();
|
||||
return (page_id != wxNOT_FOUND) ? m_tabpanel->GetPageText((size_t)page_id).Lower() == "plater" : false;
|
||||
}
|
||||
|
||||
bool MainFrame::can_select() const
|
||||
{
|
||||
return (m_plater != nullptr) ? !m_plater->model().objects.empty() : false;
|
||||
}
|
||||
|
||||
bool MainFrame::can_delete() const
|
||||
{
|
||||
return (m_plater != nullptr) ? !m_plater->is_selection_empty() : false;
|
||||
}
|
||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
||||
|
||||
void MainFrame::init_menubar()
|
||||
@ -301,6 +311,22 @@ void MainFrame::init_menubar()
|
||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
||||
}
|
||||
|
||||
#if ENABLE_NEW_MENU_LAYOUT
|
||||
// Edit menu
|
||||
wxMenu* editMenu = nullptr;
|
||||
if (m_plater != nullptr)
|
||||
{
|
||||
editMenu = new wxMenu();
|
||||
wxMenuItem* item_select_all = append_menu_item(editMenu, wxID_ANY, L("Select all\tCtrl+A"), L("Selects all objects"),
|
||||
[this](wxCommandEvent&) { m_plater->select_all(); }, "");
|
||||
wxMenuItem* item_delete_sel = append_menu_item(editMenu, wxID_ANY, L("Delete selected\tDel"), L("Deletes the current selection"),
|
||||
[this](wxCommandEvent&) { m_plater->remove_selected(); }, "");
|
||||
|
||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_select()); }, item_select_all->GetId());
|
||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete()); }, item_delete_sel->GetId());
|
||||
}
|
||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
||||
|
||||
#if !ENABLE_NEW_MENU_LAYOUT
|
||||
// Plater menu
|
||||
if (m_plater) {
|
||||
@ -321,18 +347,18 @@ void MainFrame::init_menubar()
|
||||
{
|
||||
size_t tab_offset = 0;
|
||||
if (m_plater) {
|
||||
append_menu_item(windowMenu, wxID_ANY, L("Select &Plater Tab\tCtrl+1"), L("Show the plater"),
|
||||
append_menu_item(windowMenu, wxID_ANY, L("Select Plater Tab\tCtrl+1"), L("Show the plater"),
|
||||
[this](wxCommandEvent&) { select_tab(0); }, "application_view_tile.png");
|
||||
tab_offset += 1;
|
||||
}
|
||||
if (tab_offset > 0) {
|
||||
windowMenu->AppendSeparator();
|
||||
}
|
||||
append_menu_item(windowMenu, wxID_ANY, L("Select P&rint Settings Tab\tCtrl+2"), L("Show the print settings"),
|
||||
append_menu_item(windowMenu, wxID_ANY, L("Select Print Settings Tab\tCtrl+2"), L("Show the print settings"),
|
||||
[this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 0); }, "cog.png");
|
||||
append_menu_item(windowMenu, wxID_ANY, L("Select &Filament Settings Tab\tCtrl+3"), L("Show the filament settings"),
|
||||
append_menu_item(windowMenu, wxID_ANY, L("Select Filament Settings Tab\tCtrl+3"), L("Show the filament settings"),
|
||||
[this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 1); }, "spool.png");
|
||||
append_menu_item(windowMenu, wxID_ANY, L("Select Print&er Settings Tab\tCtrl+4"), L("Show the printer settings"),
|
||||
append_menu_item(windowMenu, wxID_ANY, L("Select Printer Settings Tab\tCtrl+4"), L("Show the printer settings"),
|
||||
[this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 2); }, "printer_empty.png");
|
||||
}
|
||||
|
||||
@ -389,18 +415,18 @@ void MainFrame::init_menubar()
|
||||
//# wxTheApp->check_version(1);
|
||||
//# });
|
||||
//# $versioncheck->Enable(wxTheApp->have_version_check);
|
||||
append_menu_item(helpMenu, wxID_ANY, _(L("Slic3r &Website")), _(L("Open the Slic3r website in your browser")),
|
||||
append_menu_item(helpMenu, wxID_ANY, _(L("Slic3r Website")), _(L("Open the Slic3r website in your browser")),
|
||||
[this](wxCommandEvent&) { wxLaunchDefaultBrowser("http://slic3r.org/"); });
|
||||
append_menu_item(helpMenu, wxID_ANY, _(L("Slic3r &Manual")), _(L("Open the Slic3r manual in your browser")),
|
||||
append_menu_item(helpMenu, wxID_ANY, _(L("Slic3r Manual")), _(L("Open the Slic3r manual in your browser")),
|
||||
[this](wxCommandEvent&) { wxLaunchDefaultBrowser("http://manual.slic3r.org/"); });
|
||||
helpMenu->AppendSeparator();
|
||||
append_menu_item(helpMenu, wxID_ANY, _(L("System Info")), _(L("Show system information")),
|
||||
[this](wxCommandEvent&) { wxGetApp().system_info(); });
|
||||
append_menu_item(helpMenu, wxID_ANY, _(L("Show &Configuration Folder")), _(L("Show user configuration folder (datadir)")),
|
||||
append_menu_item(helpMenu, wxID_ANY, _(L("Show Configuration Folder")), _(L("Show user configuration folder (datadir)")),
|
||||
[this](wxCommandEvent&) { Slic3r::GUI::desktop_open_datadir_folder(); });
|
||||
append_menu_item(helpMenu, wxID_ANY, _(L("Report an Issue")), _(L("Report an issue on the Slic3r Prusa Edition")),
|
||||
[this](wxCommandEvent&) { wxLaunchDefaultBrowser("http://github.com/prusa3d/slic3r/issues/new"); });
|
||||
append_menu_item(helpMenu, wxID_ANY, _(L("&About Slic3r")), _(L("Show about dialog")),
|
||||
append_menu_item(helpMenu, wxID_ANY, _(L("About Slic3r")), _(L("Show about dialog")),
|
||||
[this](wxCommandEvent&) { Slic3r::GUI::about(); });
|
||||
}
|
||||
|
||||
@ -410,6 +436,9 @@ void MainFrame::init_menubar()
|
||||
{
|
||||
auto menubar = new wxMenuBar();
|
||||
menubar->Append(fileMenu, L("&File"));
|
||||
#if ENABLE_NEW_MENU_LAYOUT
|
||||
if (editMenu) menubar->Append(editMenu, L("&Edit"));
|
||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
||||
#if !ENABLE_NEW_MENU_LAYOUT
|
||||
if (m_plater_menu) menubar->Append(m_plater_menu, L("&Plater"));
|
||||
#endif // !ENABLE_NEW_MENU_LAYOUT
|
||||
|
@ -71,6 +71,8 @@ class MainFrame : public wxFrame
|
||||
bool can_export_model() const;
|
||||
bool can_export_gcode() const;
|
||||
bool can_change_view() const;
|
||||
bool can_select() const;
|
||||
bool can_delete() const;
|
||||
#endif // ENABLE_NEW_MENU_LAYOUT
|
||||
|
||||
public:
|
||||
|
@ -951,6 +951,7 @@ struct Plater::priv
|
||||
void selection_changed();
|
||||
void object_list_changed();
|
||||
|
||||
void select_all();
|
||||
void remove(size_t obj_idx);
|
||||
void delete_object_from_model(size_t obj_idx);
|
||||
void reset();
|
||||
@ -1529,6 +1530,11 @@ void Plater::priv::object_list_changed()
|
||||
sidebar->enable_buttons(!model.objects.empty() && !export_in_progress && model_fits);
|
||||
}
|
||||
|
||||
void Plater::priv::select_all()
|
||||
{
|
||||
_3DScene::select_all(canvas3D);
|
||||
}
|
||||
|
||||
void Plater::priv::remove(size_t obj_idx)
|
||||
{
|
||||
// Prevent toolpaths preview from rendering while we modify the Print object
|
||||
@ -2272,6 +2278,8 @@ void Plater::update() { p->update(); }
|
||||
|
||||
void Plater::select_view(const std::string& direction) { p->select_view(direction); }
|
||||
|
||||
void Plater::select_all() { p->select_all(); }
|
||||
|
||||
void Plater::remove(size_t obj_idx) { p->remove(obj_idx); }
|
||||
void Plater::delete_object_from_model(size_t obj_idx) { p->delete_object_from_model(obj_idx); }
|
||||
|
||||
@ -2358,6 +2366,11 @@ void Plater::set_number_of_copies(/*size_t num*/)
|
||||
decrease_instances(-diff);
|
||||
}
|
||||
|
||||
bool Plater::is_selection_empty() const
|
||||
{
|
||||
return p->get_selection().is_empty();
|
||||
}
|
||||
|
||||
void Plater::cut(size_t obj_idx, size_t instance_idx, coordf_t z)
|
||||
{
|
||||
wxCHECK_RET(obj_idx < p->model.objects.size(), "obj_idx out of bounds");
|
||||
|
@ -128,12 +128,14 @@ public:
|
||||
void update();
|
||||
void select_view(const std::string& direction);
|
||||
|
||||
void select_all();
|
||||
void remove(size_t obj_idx);
|
||||
void delete_object_from_model(size_t obj_idx);
|
||||
void remove_selected();
|
||||
void increase_instances(size_t num = 1);
|
||||
void decrease_instances(size_t num = 1);
|
||||
void set_number_of_copies(/*size_t num*/);
|
||||
bool is_selection_empty() const;
|
||||
|
||||
void cut(size_t obj_idx, size_t instance_idx, coordf_t z);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user