Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorenricoturri1966 <enricoturri@seznam.cz>2022-06-16 12:12:32 +0300
committerenricoturri1966 <enricoturri@seznam.cz>2022-06-16 12:12:45 +0300
commitdb31995310c1743faa0c1ce9d3135af6cb7e2c71 (patch)
tree924f0c128a6843c2efd3ae0d0782f25ce27ef5b6
parent9fc47b9c3a1e85a5b798b32b8a040edbfa056089 (diff)
Allow drag and drop on files into PrusaSlicer no matter which is the current selected tab
-rw-r--r--src/slic3r/GUI/Plater.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index d23a3dd13..b78a6db95 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -1586,12 +1586,15 @@ std::string& Sidebar::get_search_line()
class PlaterDropTarget : public wxFileDropTarget
{
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);
private:
- Plater* m_plater;
+ MainFrame& m_mainframe;
+ Plater& m_plater;
};
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();
#endif // WIN32
- bool res = (m_plater != nullptr) ? m_plater->load_files(filenames) : false;
- wxGetApp().mainframe->update_title();
+ m_mainframe.Raise();
+ 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;
}
@@ -2144,7 +2150,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
}
// 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();
set_current_panel(wxGetApp().is_editor() ? static_cast<wxPanel*>(view3D) : static_cast<wxPanel*>(preview));