Allow drag and drop on files into PrusaSlicer no matter which is the current selected tab
This commit is contained in:
parent
9fc47b9c3a
commit
db31995310
@ -1586,12 +1586,15 @@ std::string& Sidebar::get_search_line()
|
|||||||
class PlaterDropTarget : public wxFileDropTarget
|
class PlaterDropTarget : public wxFileDropTarget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlaterDropTarget(Plater* plater) : m_plater(plater) { this->SetDefaultAction(wxDragCopy); }
|
PlaterDropTarget(MainFrame& mainframe, Plater& plater) : m_mainframe(mainframe), m_plater(plater) {
|
||||||
|
this->SetDefaultAction(wxDragCopy);
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames);
|
virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Plater* m_plater;
|
MainFrame& m_mainframe;
|
||||||
|
Plater& m_plater;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
|
bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
|
||||||
@ -1601,8 +1604,11 @@ bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &fi
|
|||||||
this->MSWUpdateDragImageOnLeave();
|
this->MSWUpdateDragImageOnLeave();
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
bool res = (m_plater != nullptr) ? m_plater->load_files(filenames) : false;
|
m_mainframe.Raise();
|
||||||
wxGetApp().mainframe->update_title();
|
m_mainframe.select_tab(size_t(0));
|
||||||
|
m_plater.select_view_3D("3D");
|
||||||
|
bool res = m_plater.load_files(filenames);
|
||||||
|
m_mainframe.update_title();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2144,7 +2150,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Drop target:
|
// Drop target:
|
||||||
q->SetDropTarget(new PlaterDropTarget(q)); // if my understanding is right, wxWindow takes the owenership
|
main_frame->SetDropTarget(new PlaterDropTarget(*main_frame, *q)); // if my understanding is right, wxWindow takes the owenership
|
||||||
q->Layout();
|
q->Layout();
|
||||||
|
|
||||||
set_current_panel(wxGetApp().is_editor() ? static_cast<wxPanel*>(view3D) : static_cast<wxPanel*>(preview));
|
set_current_panel(wxGetApp().is_editor() ? static_cast<wxPanel*>(view3D) : static_cast<wxPanel*>(preview));
|
||||||
|
Loading…
Reference in New Issue
Block a user