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

This commit is contained in:
YuSanka 2019-10-09 13:42:54 +02:00
commit 20c7801264
5 changed files with 33 additions and 17 deletions

View File

@ -2662,19 +2662,6 @@ std::string format_mouse_event_debug_message(const wxMouseEvent &evt)
void GLCanvas3D::on_mouse(wxMouseEvent& evt) void GLCanvas3D::on_mouse(wxMouseEvent& evt)
{ {
auto mouse_up_cleanup = [this](){
m_moving = false;
m_mouse.drag.move_volume_idx = -1;
m_mouse.set_start_position_3D_as_invalid();
m_mouse.set_start_position_2D_as_invalid();
m_mouse.dragging = false;
m_mouse.ignore_left_up = false;
m_dirty = true;
if (m_canvas->HasCapture())
m_canvas->ReleaseMouse();
};
#if ENABLE_RETINA_GL #if ENABLE_RETINA_GL
const float scale = m_retina_helper->get_scale_factor(); const float scale = m_retina_helper->get_scale_factor();
evt.SetX(evt.GetX() * scale); evt.SetX(evt.GetX() * scale);
@ -3511,6 +3498,20 @@ void GLCanvas3D::export_toolpaths_to_obj(const char* filename) const
m_volumes.export_toolpaths_to_obj(filename); m_volumes.export_toolpaths_to_obj(filename);
} }
void GLCanvas3D::mouse_up_cleanup()
{
m_moving = false;
m_mouse.drag.move_volume_idx = -1;
m_mouse.set_start_position_3D_as_invalid();
m_mouse.set_start_position_2D_as_invalid();
m_mouse.dragging = false;
m_mouse.ignore_left_up = false;
m_dirty = true;
if (m_canvas->HasCapture())
m_canvas->ReleaseMouse();
}
bool GLCanvas3D::_is_shown_on_screen() const bool GLCanvas3D::_is_shown_on_screen() const
{ {
return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false; return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false;

View File

@ -624,6 +624,8 @@ public:
bool has_toolpaths_to_export() const; bool has_toolpaths_to_export() const;
void export_toolpaths_to_obj(const char* filename) const; void export_toolpaths_to_obj(const char* filename) const;
void mouse_up_cleanup();
private: private:
bool _is_shown_on_screen() const; bool _is_shown_on_screen() const;

View File

@ -778,7 +778,13 @@ void ObjectList::OnChar(wxKeyEvent& event)
void ObjectList::OnContextMenu(wxDataViewEvent&) void ObjectList::OnContextMenu(wxDataViewEvent&)
{ {
list_manipulation(true); // Do not show the context menu if the user pressed the right mouse button on the 3D scene and released it on the objects list
GLCanvas3D* canvas = wxGetApp().plater()->canvas3D();
bool evt_context_menu = (canvas != nullptr) ? !canvas->is_mouse_dragging() : true;
if (!evt_context_menu)
canvas->mouse_up_cleanup();
list_manipulation(evt_context_menu);
} }
void ObjectList::list_manipulation(bool evt_context_menu/* = false*/) void ObjectList::list_manipulation(bool evt_context_menu/* = false*/)

View File

@ -118,7 +118,7 @@ class ObjectManipulation : public OG_Settings
wxStaticBitmap* m_fix_throught_netfab_bitmap; wxStaticBitmap* m_fix_throught_netfab_bitmap;
#ifndef __APPLE__ #ifndef __APPLE__
// Currently focused option name (empty if none) // Currently focused editor (nullptr if none)
ManipulationEditor* m_focused_editor {nullptr}; ManipulationEditor* m_focused_editor {nullptr};
#endif // __APPLE__ #endif // __APPLE__
@ -161,7 +161,11 @@ public:
void update_warning_icon_state(const wxString& tooltip); void update_warning_icon_state(const wxString& tooltip);
void msw_rescale(); void msw_rescale();
void on_change(const std::string& opt_key, int axis, double new_value); void on_change(const std::string& opt_key, int axis, double new_value);
void set_focused_editor(ManipulationEditor* focused_editor) { m_focused_editor = focused_editor; } void set_focused_editor(ManipulationEditor* focused_editor) {
#ifndef __APPLE__
m_focused_editor = focused_editor;
#endif // __APPLE__
}
private: private:
void reset_settings_value(); void reset_settings_value();

View File

@ -579,6 +579,9 @@ void ObjectDataViewModelNode::set_action_and_extruder_icons()
m_type & (itVolume | itLayer) ? "cog" : /*m_type & itInstance*/ "set_separate_obj"; m_type & (itVolume | itLayer) ? "cog" : /*m_type & itInstance*/ "set_separate_obj";
m_action_icon = create_scaled_bitmap(nullptr, m_action_icon_name); // FIXME: pass window ptr m_action_icon = create_scaled_bitmap(nullptr, m_action_icon_name); // FIXME: pass window ptr
if (m_type & itInstance)
return; // don't set colored bitmap for Instance
// set extruder bitmap // set extruder bitmap
int extruder_idx = atoi(m_extruder.c_str()); int extruder_idx = atoi(m_extruder.c_str());
if (extruder_idx > 0) --extruder_idx; if (extruder_idx > 0) --extruder_idx;
@ -2149,7 +2152,7 @@ wxWindow* BitmapChoiceRenderer::CreateEditorCtrl(wxWindow* parent, wxRect labelR
wxDataViewCtrl* const dv_ctrl = GetOwner()->GetOwner(); wxDataViewCtrl* const dv_ctrl = GetOwner()->GetOwner();
ObjectDataViewModel* const model = dynamic_cast<ObjectDataViewModel*>(dv_ctrl->GetModel()); ObjectDataViewModel* const model = dynamic_cast<ObjectDataViewModel*>(dv_ctrl->GetModel());
if (!(model->GetItemType(dv_ctrl->GetSelection()) & (itVolume | itObject))) if (!(model->GetItemType(dv_ctrl->GetSelection()) & (itVolume | itLayer | itObject)))
return nullptr; return nullptr;
std::vector<wxBitmap*> icons = get_extruder_color_icons(); std::vector<wxBitmap*> icons = get_extruder_color_icons();