Fixed bug with PrusaDataViewBitmapText ctor on Linux

+ Cleaned code from unusable comments
This commit is contained in:
YuSanka 2018-09-12 13:22:13 +02:00
parent 6d499525ee
commit 77e09e683d
3 changed files with 12 additions and 23 deletions

View File

@ -29,9 +29,9 @@ wxCollapsiblePane *m_collpane_settings = nullptr;
PrusaDoubleSlider *m_slider = nullptr;
wxGLCanvas *m_preview_canvas = nullptr;
wxBitmap/*Icon*/ m_icon_modifiermesh;
wxBitmap/*Icon*/ m_icon_solidmesh;
wxBitmap/*Icon*/ m_icon_manifold_warning;
wxBitmap m_icon_modifiermesh;
wxBitmap m_icon_solidmesh;
wxBitmap m_icon_manifold_warning;
wxBitmap m_bmp_cog;
wxBitmap m_bmp_split;
@ -141,11 +141,11 @@ void set_objects_from_model(Model &model) {
}
void init_mesh_icons(){
m_icon_modifiermesh = wxBitmap/*wxIcon*/(Slic3r::GUI::from_u8(Slic3r::var("lambda.png")), wxBITMAP_TYPE_PNG);//(Slic3r::var("plugin.png")), wxBITMAP_TYPE_PNG);
m_icon_solidmesh = wxBitmap/*wxIcon*/(Slic3r::GUI::from_u8(Slic3r::var("object.png")), wxBITMAP_TYPE_PNG);//(Slic3r::var("package.png")), wxBITMAP_TYPE_PNG);
m_icon_modifiermesh = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("lambda.png")), wxBITMAP_TYPE_PNG);//(Slic3r::var("plugin.png")), wxBITMAP_TYPE_PNG);
m_icon_solidmesh = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("object.png")), wxBITMAP_TYPE_PNG);//(Slic3r::var("package.png")), wxBITMAP_TYPE_PNG);
// init icon for manifold warning
m_icon_manifold_warning = wxBitmap/*wxIcon*/(Slic3r::GUI::from_u8(Slic3r::var("exclamation_mark_.png")), wxBITMAP_TYPE_PNG);//(Slic3r::var("error.png")), wxBITMAP_TYPE_PNG);
m_icon_manifold_warning = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("exclamation_mark_.png")), wxBITMAP_TYPE_PNG);//(Slic3r::var("error.png")), wxBITMAP_TYPE_PNG);
// init bitmap for "Split to sub-objects" context menu
m_bmp_split = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("split.png")), wxBITMAP_TYPE_PNG);
@ -249,10 +249,9 @@ void create_objects_ctrl(wxWindow* win, wxBoxSizer*& objects_sz)
#endif // wxUSE_DRAG_AND_DROP && wxUSE_UNICODE
// column 0(Icon+Text) of the view control:
// And Icon can be consisting of several bitmaps
m_objects_ctrl->AppendColumn(new wxDataViewColumn(_(L("Name")), new PrusaBitmapTextRenderer(),
0, 200, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE));
// m_objects_ctrl->AppendIconTextColumn(_(L("Name")), 0, wxDATAVIEW_CELL_INERT, 200,
// wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE);
// column 1 of the view control:
m_objects_ctrl->AppendTextColumn(_(L("Copy")), 1, wxDATAVIEW_CELL_INERT, 45,
@ -668,7 +667,6 @@ void add_object_to_list(const std::string &name, ModelObject* model_object)
int errors = stats.degenerate_facets + stats.edges_fixed + stats.facets_removed +
stats.facets_added + stats.facets_reversed + stats.backwards_edges;
if (errors > 0) {
// const wxDataViewIconText data(item_name, m_icon_manifold_warning);
const PrusaDataViewBitmapText data(item_name, m_icon_manifold_warning);
wxVariant variant;
variant << data;

View File

@ -383,7 +383,6 @@ bool PrusaObjectDataViewModelNode::update_settings_digest(const std::vector<std:
}
m_bmp = *bmp;
// m_icon.CopyFromBitmap(*bmp);
return true;
}
@ -430,7 +429,6 @@ wxDataViewItem PrusaObjectDataViewModel::Add(const wxString &name, const int ins
wxDataViewItem PrusaObjectDataViewModel::AddChild( const wxDataViewItem &parent_item,
const wxString &name,
// const wxIcon& icon,
const wxBitmap& icon,
const int extruder/* = 0*/,
const bool create_frst_child/* = true*/)
@ -644,7 +642,6 @@ void PrusaObjectDataViewModel::GetValue(wxVariant &variant, const wxDataViewItem
switch (col)
{
case 0:{
// const wxDataViewIconText data(node->m_name, node->m_icon);
const PrusaDataViewBitmapText data(node->m_name, node->m_bmp);
variant << data;
break;}
@ -872,10 +869,9 @@ bool PrusaBitmapTextRenderer::Render(wxRect rect, wxDC *dc, int state)
{
int xoffset = 0;
const /*wxIcon*/wxBitmap& icon = m_value.GetBitmap();// GetIcon();
const wxBitmap& icon = m_value.GetBitmap();
if (icon.IsOk())
{
// dc->DrawIcon(icon, rect.x, rect.y + (rect.height - icon.GetHeight()) / 2);
dc->DrawBitmap(icon, rect.x, rect.y + (rect.height - icon.GetHeight()) / 2);
xoffset = icon.GetWidth() + 4;
}
@ -891,8 +887,8 @@ wxSize PrusaBitmapTextRenderer::GetSize() const
{
wxSize size = GetTextExtent(m_value.GetText());
if (m_value.GetBitmap()/*GetIcon()*/.IsOk())
size.x += m_value.GetBitmap()/*GetIcon()*/.GetWidth() + 4;
if (m_value.GetBitmap().IsOk())
size.x += m_value.GetBitmap().GetWidth() + 4;
return size;
}
return wxSize(80, 20);

View File

@ -220,13 +220,11 @@ public:
PrusaObjectDataViewModelNode( PrusaObjectDataViewModelNode* parent,
const wxString& sub_obj_name,
const wxBitmap& bmp,
// const wxIcon& icon,
const wxString& extruder,
const int volume_id=-1) {
m_parent = parent;
m_name = sub_obj_name;
m_copy = wxEmptyString;
// m_icon = icon;
m_bmp = bmp;
m_type = "volume";
m_volume_id = volume_id;
@ -321,10 +319,8 @@ public:
switch (col)
{
case 0:{
// wxDataViewIconText data;
PrusaDataViewBitmapText data;
data << variant;
// m_icon = data.GetIcon();
m_bmp = data.GetBitmap();
m_name = data.GetText();
return true;}
@ -414,7 +410,6 @@ public:
wxDataViewItem Add(const wxString &name, const int instances_count);
wxDataViewItem AddChild(const wxDataViewItem &parent_item,
const wxString &name,
// const wxIcon& icon,
const wxBitmap& icon,
const int extruder = 0,
const bool create_frst_child = true);
@ -478,7 +473,7 @@ class PrusaBitmapTextRenderer : public wxDataViewCustomRenderer
public:
PrusaBitmapTextRenderer( wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT):
wxDataViewCustomRenderer(wxT("PrusaDataViewIconBitmapText"/*"wxDataViewIconText"*/), mode, align) {}
wxDataViewCustomRenderer(wxT("wxObject"), mode, align) {}
bool SetValue(const wxVariant &value);
bool GetValue(wxVariant &value) const;