QoL: Make sidebar collapsible, resizable, movable, floatable and dockable (#2972)

* Add sidebar docking

* Fix sidebar initial size

* Fix sidebar collapse

* Hide floating sidebar when switch away from model view

* Add option to reset window layout

* Save & load window layout

* Fix a small issue with gcode toggle

* Properly save & restore sidebar state

* Show collapse icon based on sidebar docking state

* Adjust toolbar position based on docking position

* Fix return toolbar position

* Fix plate list position
This commit is contained in:
Noisyfox 2023-12-08 17:16:16 +08:00 committed by GitHub
parent 3d2ab8e2e2
commit 7cfa4f3bcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 317 additions and 119 deletions

View file

@ -762,7 +762,7 @@ void MainFrame::update_layout()
//BBS: add bed exclude area
m_plater->set_bed_shape({ { 0.0, 0.0 }, { 200.0, 0.0 }, { 200.0, 200.0 }, { 0.0, 200.0 } }, {}, 0.0, {}, {}, true);
m_plater->get_collapse_toolbar().set_enabled(false);
m_plater->collapse_sidebar(true);
m_plater->enable_sidebar(false);
m_plater->Show();
break;
}
@ -2523,9 +2523,18 @@ void MainFrame::init_menubar_as_editor()
wxGetApp().toggle_show_gcode_window();
m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
},
this, [this]() { return m_plater->is_preview_shown(); },
this, [this]() { return m_tabpanel->GetSelection() == tpPreview; },
[this]() { return wxGetApp().show_gcode_window(); }, this);
append_menu_item(
viewMenu, wxID_ANY, _L("Reset Window Layout"), _L("Reset to default window layout"),
[this](wxCommandEvent&) { m_plater->reset_window_layout(); }, "", this,
[this]() {
return (m_tabpanel->GetSelection() == TabPosition::tp3DEditor || m_tabpanel->GetSelection() == TabPosition::tpPreview) &&
m_plater->is_sidebar_enabled();
},
this);
viewMenu->AppendSeparator();
append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Labels") + "\t" + ctrl + "E", _L("Show object labels in 3D scene"),
[this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this,