Fixed wxASSERT( variant.GetType() == PrusaDataViewBitmapText );

This commit is contained in:
YuSanka 2018-10-15 13:25:22 +02:00
parent b9b404dd2c
commit 317fc45522
3 changed files with 12 additions and 6 deletions

View file

@ -1048,9 +1048,8 @@ void ObjectList::add_object_to_list(size_t obj_idx)
int errors = stats.degenerate_facets + stats.edges_fixed + stats.facets_removed +
stats.facets_added + stats.facets_reversed + stats.backwards_edges;
if (errors > 0) {
const PrusaDataViewBitmapText data(item_name, m_icon_manifold_warning);
wxVariant variant;
variant << data;
variant << PrusaDataViewBitmapText(item_name, m_icon_manifold_warning);
m_objects_model->SetValue(variant, item, 0);
}

View file

@ -684,8 +684,7 @@ void PrusaObjectDataViewModel::GetValue(wxVariant &variant, const wxDataViewItem
switch (col)
{
case 0:{
const PrusaDataViewBitmapText data(node->m_name, node->m_bmp);
variant << data;
variant << PrusaDataViewBitmapText(node->m_name, node->m_bmp);
break;}
case 1:
variant = node->m_copy;
@ -891,7 +890,14 @@ void PrusaObjectDataViewModel::UpdateSettingsDigest(const wxDataViewItem &item,
ItemChanged(item);
}
//-----------------------------------------------------------------------------
// PrusaDataViewBitmapText
//-----------------------------------------------------------------------------
wxIMPLEMENT_DYNAMIC_CLASS(PrusaDataViewBitmapText, wxObject)
IMPLEMENT_VARIANT_OBJECT(PrusaDataViewBitmapText)
// ---------------------------------------------------------
// PrusaIconTextRenderer
// ---------------------------------------------------------

View file

@ -184,6 +184,8 @@ public:
private:
wxString m_text;
wxBitmap m_bmp;
wxDECLARE_DYNAMIC_CLASS(PrusaDataViewBitmapText);
};
DECLARE_VARIANT_OBJECT(PrusaDataViewBitmapText)
@ -476,7 +478,7 @@ class PrusaBitmapTextRenderer : public wxDataViewCustomRenderer
public:
PrusaBitmapTextRenderer( wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT):
wxDataViewCustomRenderer(wxT("wxObject"), mode, align) {}
wxDataViewCustomRenderer(wxT("PrusaDataViewBitmapText"), mode, align) {}
bool SetValue(const wxVariant &value);
bool GetValue(wxVariant &value) const;
@ -487,7 +489,6 @@ public:
virtual bool HasEditorCtrl() const { return false; }
private:
// wxDataViewIconText m_value;
PrusaDataViewBitmapText m_value;
};