Fixed "extruder" column editing for non-object/part items. It's suppressed now.

+ Try to fix the wrong last column width updating under OSX
This commit is contained in:
YuSanka 2018-12-04 14:27:39 +01:00
parent 428800ad1e
commit e0aa25b677
2 changed files with 20 additions and 1 deletions

View File

@ -77,7 +77,13 @@ ObjectList::ObjectList(wxWindow* parent) :
Bind(wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, [this](wxDataViewEvent& e) {on_drop_possible(e); });
Bind(wxEVT_DATAVIEW_ITEM_DROP, [this](wxDataViewEvent& e) {on_drop(e); });
Bind(wxCUSTOMEVT_LAST_VOLUME_IS_DELETED,[this](wxCommandEvent& e) {last_volume_is_deleted(e.GetInt()); });
Bind(wxCUSTOMEVT_LAST_VOLUME_IS_DELETED, [this](wxCommandEvent& e) {last_volume_is_deleted(e.GetInt()); });
// Bind(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, &ObjectList::OnValueChanged, this);
// Bind(wxEVT_DATAVIEW_ITEM_ACTIVATED, &ObjectList::OnActivated, this);
Bind(wxEVT_DATAVIEW_ITEM_START_EDITING, &ObjectList::OnStartEditing, this);
// Bind(wxEVT_DATAVIEW_ITEM_EDITING_STARTED, &ObjectList::OnEditingStarted, this);
// Bind(wxEVT_DATAVIEW_ITEM_EDITING_DONE, &ObjectList::OnEditingDone, this
}
ObjectList::~ObjectList()
@ -203,6 +209,8 @@ void ObjectList::update_objects_list_extruder_column(int extruders_count)
InsertColumn(1, create_objects_list_extruder_column(extruders_count));
// set show/hide for this column
set_extruder_column_hidden(extruders_count <= 1);
//a workaround for a wrong last column width updating under OSX
GetColumn(2)->SetWidth(25);
}
void ObjectList::set_extruder_column_hidden(bool hide)
@ -1600,5 +1608,12 @@ void ObjectList::update_settings_items()
UnselectAll();
}
void ObjectList::OnStartEditing(wxDataViewEvent &event)
{
const auto item_type = m_objects_model->GetItemType(event.GetItem());
if ( !(item_type&(itObject|itVolume)) )
event.Veto();
}
} //namespace GUI
} //namespace Slic3r

View File

@ -185,6 +185,10 @@ public:
void last_volume_is_deleted(const int obj_idx);
bool has_multi_part_objects();
void update_settings_items();
private:
void OnStartEditing(wxDataViewEvent &event);
};