Plater -> View Menu
This commit is contained in:
parent
7d1828df05
commit
2e274b5646
4 changed files with 32 additions and 21 deletions
|
@ -3204,7 +3204,7 @@ void GLCanvas3D::select_view(const std::string& direction)
|
|||
else if (direction == "rear")
|
||||
dir_vec = VIEW_REAR;
|
||||
|
||||
if ((dir_vec != nullptr) && !empty(volumes_bounding_box()))
|
||||
if (dir_vec != nullptr)
|
||||
{
|
||||
m_camera.phi = dir_vec[0];
|
||||
m_camera.set_theta(dir_vec[1]);
|
||||
|
|
|
@ -319,23 +319,14 @@ void MainFrame::init_menubar()
|
|||
// View menu
|
||||
if (m_plater) {
|
||||
m_viewMenu = new wxMenu();
|
||||
// \xA0 is a non-breaing space. It is entered here to spoil the automatic accelerators,
|
||||
// as the simple numeric accelerators spoil all numeric data entry.
|
||||
// The camera control accelerators are captured by 3DScene Perl module instead.
|
||||
auto accel = [](const wxString& st1, const wxString& st2) {
|
||||
// if ($^O eq "MSWin32")
|
||||
// return st1 + "\t\xA0" + st2;
|
||||
// else
|
||||
return st1;
|
||||
};
|
||||
|
||||
append_menu_item(m_viewMenu, wxID_ANY, accel(_(L("Iso")), "0"), L("Iso View"), [this](wxCommandEvent&){ select_view("iso"); });
|
||||
append_menu_item(m_viewMenu, wxID_ANY, accel(_(L("Top")), "1"), L("Top View"), [this](wxCommandEvent&){ select_view("top"); });
|
||||
append_menu_item(m_viewMenu, wxID_ANY, accel(_(L("Bottom")), "2"), L("Bottom View"),[this](wxCommandEvent&){ select_view("bottom"); });
|
||||
append_menu_item(m_viewMenu, wxID_ANY, accel(_(L("Front")), "3"), L("Front View"), [this](wxCommandEvent&){ select_view("front"); });
|
||||
append_menu_item(m_viewMenu, wxID_ANY, accel(_(L("Rear")), "4"), L("Rear View"), [this](wxCommandEvent&){ select_view("rear"); });
|
||||
append_menu_item(m_viewMenu, wxID_ANY, accel(_(L("Left")), "5"), L("Left View"), [this](wxCommandEvent&){ select_view("left"); });
|
||||
append_menu_item(m_viewMenu, wxID_ANY, accel(_(L("Right")), "6"), L("Right View"), [this](wxCommandEvent&){ select_view("right"); });
|
||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Iso\t0")), _(L("Iso View")), [this](wxCommandEvent&){ select_view("iso"); });
|
||||
m_viewMenu->AppendSeparator();
|
||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Top\t1")), _(L("Top View")), [this](wxCommandEvent&){ select_view("top"); });
|
||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Bottom\t2")), _(L("Bottom View")), [this](wxCommandEvent&){ select_view("bottom"); });
|
||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Front\t3")), _(L("Front View")), [this](wxCommandEvent&){ select_view("front"); });
|
||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Rear\t4")), _(L("Rear View")), [this](wxCommandEvent&){ select_view("rear"); });
|
||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Left\t5")), _(L("Left View")), [this](wxCommandEvent&){ select_view("left"); });
|
||||
append_menu_item(m_viewMenu, wxID_ANY, _(L("Right\t6")), _(L("Right View")), [this](wxCommandEvent&){ select_view("right"); });
|
||||
}
|
||||
|
||||
// Help menu
|
||||
|
@ -683,9 +674,10 @@ void MainFrame::select_tab(size_t tab) const{
|
|||
}
|
||||
|
||||
// Set a camera direction, zoom to all objects.
|
||||
void MainFrame::select_view(const std::string& direction){
|
||||
// if (m_plater)
|
||||
// m_plater->select_view(direction);
|
||||
void MainFrame::select_view(const std::string& direction)
|
||||
{
|
||||
if (m_plater)
|
||||
m_plater->select_view(direction);
|
||||
}
|
||||
|
||||
void MainFrame::on_presets_changed(SimpleEvent &event)
|
||||
|
|
|
@ -761,6 +761,7 @@ struct Plater::priv
|
|||
std::vector<int> collect_selections();
|
||||
#endif // !ENABLE_EXTENDED_SELECTION
|
||||
void update(bool force_autocenter = false);
|
||||
void select_view(const std::string& direction);
|
||||
void update_ui_from_settings();
|
||||
ProgressStatusBar* statusbar();
|
||||
std::string get_config(const std::string &key) const;
|
||||
|
@ -1002,6 +1003,19 @@ void Plater::priv::update(bool force_autocenter)
|
|||
// schedule_background_process(); // TODO
|
||||
}
|
||||
|
||||
void Plater::priv::select_view(const std::string& direction)
|
||||
{
|
||||
int page_id = notebook->GetSelection();
|
||||
if (page_id != wxNOT_FOUND)
|
||||
{
|
||||
const wxString& page_text = notebook->GetPageText(page_id);
|
||||
if (page_text == _(L("3D")))
|
||||
_3DScene::select_view(canvas3D, direction);
|
||||
else if (page_text == _(L("Preview")))
|
||||
preview->select_view(direction);
|
||||
}
|
||||
}
|
||||
|
||||
void Plater::priv::update_ui_from_settings()
|
||||
{
|
||||
// TODO: (?)
|
||||
|
@ -1852,6 +1866,9 @@ void Plater::add()
|
|||
void Plater::load_files(const std::vector<fs::path> &input_files) { p->load_files(input_files); }
|
||||
|
||||
void Plater::update(bool force_autocenter) { p->update(force_autocenter); }
|
||||
|
||||
void Plater::select_view(const std::string& direction) { p->select_view(direction); }
|
||||
|
||||
void Plater::remove(size_t obj_idx) { p->remove(obj_idx); }
|
||||
|
||||
void Plater::remove_selected()
|
||||
|
|
|
@ -109,6 +109,8 @@ public:
|
|||
void load_files(const std::vector<boost::filesystem::path> &input_files);
|
||||
|
||||
void update(bool force_autocenter = false);
|
||||
void select_view(const std::string& direction);
|
||||
|
||||
void remove(size_t obj_idx);
|
||||
void remove_selected();
|
||||
void increase(size_t num = 1);
|
||||
|
|
Loading…
Reference in a new issue