Changed mode of the OblectList to Multiple selection

This commit is contained in:
YuSanka 2018-10-10 16:22:20 +02:00
parent 05c016764f
commit 30f3ec3d16
4 changed files with 16 additions and 3 deletions

View file

@ -741,6 +741,7 @@ public:
#if ENABLE_EXTENDED_SELECTION
const Selection& get_selection() const { return m_selection; }
Selection& get_selection() { return m_selection; }
#endif // ENABLE_EXTENDED_SELECTION
// Set the bed shape to a single closed 2D polygon(array of two element arrays),

View file

@ -18,7 +18,7 @@ namespace GUI
{
ObjectList::ObjectList(wxWindow* parent) :
wxDataViewCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
wxDataViewCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE)
{
// Fill CATEGORY_ICON
{
@ -328,7 +328,9 @@ void ObjectList::on_begin_drag(wxDataViewEvent &event)
wxDataViewItem item(event.GetItem());
// only allow drags for item, not containers
if (m_objects_model->GetParent(item) == wxDataViewItem(0) || m_objects_model->IsSettingsItem(item)) {
if (multiple_selection() ||
m_objects_model->GetParent(item) == wxDataViewItem(0) ||
m_objects_model->IsSettingsItem(item) ) {
event.Veto();
return;
}
@ -1139,5 +1141,12 @@ void ObjectList::init_objects()
m_objects = wxGetApp().model_objects();
}
bool ObjectList::multiple_selection() const
{
wxDataViewItemArray sels;
GetSelections(sels);
return sels.size() > 1;
}
} //namespace GUI
} //namespace Slic3r

View file

@ -121,6 +121,8 @@ public:
void remove();
void init_objects();
bool multiple_selection() const ;
};

View file

@ -176,7 +176,8 @@ void ObjectManipulation::update_settings_list()
auto config = wxGetApp().obj_list()->m_config;
const auto item = objects_ctrl->GetSelection();
if (config && objects_model->IsSettingsItem(item))
if (!objects_ctrl->multiple_selection() &&
config && objects_model->IsSettingsItem(item))
{
auto extra_column = [config](wxWindow* parent, const Line& line)
{