Merge remote-tracking branch 'origin/master' into tm_colldetection_upgr

This commit is contained in:
tamasmeszaros 2019-03-11 14:56:12 +01:00
commit 766353bbf3
5 changed files with 31 additions and 28 deletions

View File

@ -1932,6 +1932,7 @@ bool GLGizmoSlaSupports::is_mesh_update_necessary() const
void GLGizmoSlaSupports::update_mesh()
{
wxBusyCursor wait;
Eigen::MatrixXf& V = m_V;
Eigen::MatrixXi& F = m_F;
// Composite mesh of all instances in the world coordinate system.

View File

@ -161,12 +161,15 @@ bool GUI_App::OnInit()
Bind(wxEVT_IDLE, [this](wxIdleEvent& event)
{
if (! plater_)
return;
if (app_config->dirty() && app_config->get("autosave") == "1")
app_config->save();
// ! Temporary workaround for the correct behavior of the Scrolled sidebar panel
// Do this "manipulations" only once ( after (re)create of the application )
if (plater_ && sidebar().obj_list()->GetMinHeight() > 15 * wxGetApp().em_unit())
if (sidebar().obj_list()->GetMinHeight() > 15 * wxGetApp().em_unit())
{
wxWindowUpdateLocker noUpdates_sidebar(&sidebar());
sidebar().obj_list()->SetMinSize(wxSize(-1, 15 * wxGetApp().em_unit()));
@ -175,8 +178,7 @@ bool GUI_App::OnInit()
update_mode(); // update view mode after fix of the object_list size
}
if (this->plater() != nullptr)
this->obj_manipul()->update_if_dirty();
this->obj_manipul()->update_if_dirty();
// Preset updating & Configwizard are done after the above initializations,
// and after MainFrame is created & shown.

View File

@ -2509,15 +2509,20 @@ bool Plater::priv::init_object_menu()
bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/)
{
wxMenuItem* item_delete = append_menu_item(menu, wxID_ANY, _(L("Delete")) + "\tDel", _(L("Remove the selected object")),
[this](wxCommandEvent&) { q->remove_selected(); }, "brick_delete.png");
if (!is_part){
wxMenuItem* item_delete = nullptr;
if (is_part) {
item_delete = append_menu_item(menu, wxID_ANY, _(L("Delete")) + "\tDel", _(L("Remove the selected object")),
[this](wxCommandEvent&) { q->remove_selected(); }, "brick_delete.png");
} else {
wxMenuItem* item_increase = append_menu_item(menu, wxID_ANY, _(L("Increase copies")) + "\t+", _(L("Place one more copy of the selected object")),
[this](wxCommandEvent&) { q->increase_instances(); }, "add.png");
wxMenuItem* item_decrease = append_menu_item(menu, wxID_ANY, _(L("Decrease copies")) + "\t-", _(L("Remove one copy of the selected object")),
[this](wxCommandEvent&) { q->decrease_instances(); }, "delete.png");
wxMenuItem* item_set_number_of_copies = append_menu_item(menu, wxID_ANY, _(L("Set number of copies")) + dots, _(L("Change the number of copies of the selected object")),
[this](wxCommandEvent&) { q->set_number_of_copies(); }, "textfield.png");
// Delete menu was moved to be after +/- instace to make it more difficult to be selected by mistake.
item_delete = append_menu_item(menu, wxID_ANY, _(L("Delete")) + "\tDel", _(L("Remove the selected object")),
[this](wxCommandEvent&) { q->remove_selected(); }, "brick_delete.png");
menu->AppendSeparator();
wxMenuItem* item_instance_to_object = sidebar->obj_list()->append_menu_item_instance_to_object(menu);
@ -2554,7 +2559,7 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/
wxMenuItem* item_mirror = append_submenu(menu, mirror_menu, wxID_ANY, _(L("Mirror")), _(L("Mirror the selected object")));
// ui updates needs to be binded to the parent panel
// ui updates needs to be bound to the parent panel
if (q != nullptr)
{
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_mirror()); }, item_mirror->GetId());

View File

@ -1958,21 +1958,8 @@ int PrusaDoubleSlider::get_value_from_position(const wxCoord x, const wxCoord y)
return int(m_min_value + double(height - SLIDER_MARGIN - y) / step + 0.5);
}
void PrusaDoubleSlider::detect_selected_slider(const wxPoint& pt, const bool is_mouse_wheel /*= false*/)
void PrusaDoubleSlider::detect_selected_slider(const wxPoint& pt)
{
if (is_mouse_wheel)
{
if (is_horizontal()) {
m_selection = pt.x <= m_rect_lower_thumb.GetRight() ? ssLower :
pt.x >= m_rect_higher_thumb.GetLeft() ? ssHigher : ssUndef;
}
else {
m_selection = pt.y >= m_rect_lower_thumb.GetTop() ? ssLower :
pt.y <= m_rect_higher_thumb.GetBottom() ? ssHigher : ssUndef;
}
return;
}
m_selection = is_point_in_rect(pt, m_rect_lower_thumb) ? ssLower :
is_point_in_rect(pt, m_rect_higher_thumb) ? ssHigher : ssUndef;
}
@ -2192,12 +2179,20 @@ void PrusaDoubleSlider::action_tick(const TicksAction action)
void PrusaDoubleSlider::OnWheel(wxMouseEvent& event)
{
wxClientDC dc(this);
wxPoint pos = event.GetLogicalPosition(dc);
detect_selected_slider(pos, true);
if (m_selection == ssUndef)
return;
// Set nearest to the mouse thumb as a selected, if there is not selected thumb
if (m_selection == ssUndef)
{
const wxPoint& pt = event.GetLogicalPosition(wxClientDC(this));
if (is_horizontal())
m_selection = abs(pt.x - m_rect_lower_thumb.GetRight()) <=
abs(pt.x - m_rect_higher_thumb.GetLeft()) ?
ssLower : ssHigher;
else
m_selection = abs(pt.y - m_rect_lower_thumb.GetTop()) <=
abs(pt.y - m_rect_higher_thumb.GetBottom()) ?
ssLower : ssHigher;
}
move_current_thumb(event.GetWheelRotation() > 0);
}

View File

@ -771,7 +771,7 @@ protected:
void draw_thumb_text(wxDC& dc, const wxPoint& pos, const SelectedSlider& selection) const;
void update_thumb_rect(const wxCoord& begin_x, const wxCoord& begin_y, const SelectedSlider& selection);
void detect_selected_slider(const wxPoint& pt, const bool is_mouse_wheel = false);
void detect_selected_slider(const wxPoint& pt);
void correct_lower_value();
void correct_higher_value();
void move_current_thumb(const bool condition);