mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Next try to fix OSX/Linux compilation bug
This commit is contained in:
parent
bb27d62ba8
commit
72541ad13e
3 changed files with 47 additions and 10 deletions
|
@ -140,7 +140,7 @@ wxSizer *m_sizer_object_buttons = nullptr;
|
||||||
wxSizer *m_sizer_part_buttons = nullptr;
|
wxSizer *m_sizer_part_buttons = nullptr;
|
||||||
wxDataViewCtrl *m_objects_ctrl = nullptr;
|
wxDataViewCtrl *m_objects_ctrl = nullptr;
|
||||||
MyObjectTreeModel *m_objects_model = nullptr;
|
MyObjectTreeModel *m_objects_model = nullptr;
|
||||||
PrusaCollapsiblePane *m_collpane_settings = nullptr;
|
wxCollapsiblePane *m_collpane_settings = nullptr;
|
||||||
|
|
||||||
wxFont g_small_font { wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
|
wxFont g_small_font { wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
|
||||||
wxFont g_bold_font { wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold() };
|
wxFont g_bold_font { wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold() };
|
||||||
|
@ -836,10 +836,14 @@ wxString from_u8(const std::string &str)
|
||||||
return wxString::FromUTF8(str.c_str());
|
return wxString::FromUTF8(str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// add PrusaCollapsiblePane to sizer
|
// add Collapsible Pane to sizer
|
||||||
PrusaCollapsiblePane* add_prusa_collapsible_pane(wxWindow* parent, wxBoxSizer* sizer_parent, const wxString& name, std::function<wxSizer *(wxWindow *)> content_function)
|
wxCollapsiblePane* add_collapsible_pane(wxWindow* parent, wxBoxSizer* sizer_parent, const wxString& name, std::function<wxSizer *(wxWindow *)> content_function)
|
||||||
{
|
{
|
||||||
|
#ifdef __WXMSW__
|
||||||
auto *collpane = new PrusaCollapsiblePane(parent, wxID_ANY, name);
|
auto *collpane = new PrusaCollapsiblePane(parent, wxID_ANY, name);
|
||||||
|
#else
|
||||||
|
auto *collpane = new wxCollapsiblePane(parent, wxID_ANY, name);
|
||||||
|
#endif // __WXMSW__
|
||||||
// add the pane with a zero proportion value to the sizer which contains it
|
// add the pane with a zero proportion value to the sizer which contains it
|
||||||
sizer_parent->Add(collpane, 0, wxGROW | wxALL, 0);
|
sizer_parent->Add(collpane, 0, wxGROW | wxALL, 0);
|
||||||
|
|
||||||
|
@ -899,7 +903,7 @@ wxBoxSizer* content_objects_list(wxWindow *win)
|
||||||
m_sizer_object_buttons->Show(show_obj_sizer);
|
m_sizer_object_buttons->Show(show_obj_sizer);
|
||||||
m_sizer_part_buttons->Show(!show_obj_sizer);
|
m_sizer_part_buttons->Show(!show_obj_sizer);
|
||||||
m_collpane_settings->SetLabelText((show_obj_sizer ? _(L("Object Settings")) : _(L("Part Settings"))) + ":");
|
m_collpane_settings->SetLabelText((show_obj_sizer ? _(L("Object Settings")) : _(L("Part Settings"))) + ":");
|
||||||
m_collpane_settings->show_it(true);
|
m_collpane_settings->Show(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
return objects_sz;
|
return objects_sz;
|
||||||
|
@ -1058,13 +1062,13 @@ void delete_object_from_list()
|
||||||
m_objects_model->Delete(item);
|
m_objects_model->Delete(item);
|
||||||
|
|
||||||
if (m_objects_model->IsEmpty())
|
if (m_objects_model->IsEmpty())
|
||||||
m_collpane_settings->show_it(false);
|
m_collpane_settings->Show(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_all_objects_from_list()
|
void delete_all_objects_from_list()
|
||||||
{
|
{
|
||||||
m_objects_model->DeleteAll();
|
m_objects_model->DeleteAll();
|
||||||
m_collpane_settings->show_it(false);
|
m_collpane_settings->Show(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_expert_mode_part(wxWindow* parent, wxBoxSizer* sizer)
|
void add_expert_mode_part(wxWindow* parent, wxBoxSizer* sizer)
|
||||||
|
@ -1091,14 +1095,14 @@ void add_expert_mode_part(wxWindow* parent, wxBoxSizer* sizer)
|
||||||
btn_grid_sizer->Add(del_all_btn, 0, wxEXPAND, 0);
|
btn_grid_sizer->Add(del_all_btn, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
// *** Objects List ***
|
// *** Objects List ***
|
||||||
auto collpane = add_prusa_collapsible_pane(parent, sizer, "Objects List:", content_objects_list);
|
auto collpane = add_collapsible_pane(parent, sizer, "Objects List:", content_objects_list);
|
||||||
collpane->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, ([collpane](wxCommandEvent& e){
|
collpane->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, ([collpane](wxCommandEvent& e){
|
||||||
e.Skip();
|
e.Skip();
|
||||||
wxWindowUpdateLocker noUpdates(g_right_panel);
|
wxWindowUpdateLocker noUpdates(g_right_panel);
|
||||||
if (collpane->IsCollapsed()) {
|
if (collpane->IsCollapsed()) {
|
||||||
m_sizer_object_buttons->Show(false);
|
m_sizer_object_buttons->Show(false);
|
||||||
m_sizer_part_buttons->Show(false);
|
m_sizer_part_buttons->Show(false);
|
||||||
m_collpane_settings->show_it(false);
|
m_collpane_settings->Show(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_objects_ctrl->UnselectAll();
|
m_objects_ctrl->UnselectAll();
|
||||||
|
@ -1107,7 +1111,7 @@ void add_expert_mode_part(wxWindow* parent, wxBoxSizer* sizer)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// *** Object/Part Settings ***
|
// *** Object/Part Settings ***
|
||||||
m_collpane_settings = add_prusa_collapsible_pane(parent, sizer, "Settings:", content_settings);
|
m_collpane_settings = add_collapsible_pane(parent, sizer, "Settings:", content_settings);
|
||||||
m_collpane_settings->Hide(); // ? TODO why doesn't work?
|
m_collpane_settings->Hide(); // ? TODO why doesn't work?
|
||||||
|
|
||||||
add_btn->Bind(wxEVT_BUTTON, [](wxEvent& )
|
add_btn->Bind(wxEVT_BUTTON, [](wxEvent& )
|
||||||
|
|
|
@ -533,6 +533,14 @@ bool MyObjectTreeModel::SetValue(const wxVariant &variant, const wxDataViewItem
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MyObjectTreeModel::SetValue(const wxVariant &variant, const int item_idx, unsigned int col)
|
||||||
|
{
|
||||||
|
if (item_idx < 0 || item_idx >= m_objects.size())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return m_objects[item_idx]->SetValue(variant, col);
|
||||||
|
}
|
||||||
|
|
||||||
// bool MyObjectTreeModel::IsEnabled(const wxDataViewItem &item, unsigned int col) const
|
// bool MyObjectTreeModel::IsEnabled(const wxDataViewItem &item, unsigned int col) const
|
||||||
// {
|
// {
|
||||||
//
|
//
|
||||||
|
|
|
@ -120,7 +120,11 @@ public:
|
||||||
#endif //__WXMSW__
|
#endif //__WXMSW__
|
||||||
void Collapse(bool collapse) override;
|
void Collapse(bool collapse) override;
|
||||||
void OnStateChange_(const wxSize& sz); //override of OnStateChange
|
void OnStateChange_(const wxSize& sz); //override of OnStateChange
|
||||||
void show_it(bool show) { Show(show); OnStateChange_(GetBestSize()); }
|
virtual bool Show(bool show=true) override {
|
||||||
|
wxCollapsiblePane::Show(show);
|
||||||
|
OnStateChange_(GetBestSize());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,6 +217,26 @@ public:
|
||||||
{
|
{
|
||||||
return m_children.GetCount();
|
return m_children.GetCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SetValue(const wxVariant &variant, unsigned int col)
|
||||||
|
{
|
||||||
|
switch (col)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
m_name = variant.GetString();
|
||||||
|
return true;
|
||||||
|
case 1:
|
||||||
|
m_copy = variant.GetString();
|
||||||
|
return true;
|
||||||
|
case 2:
|
||||||
|
m_scale = variant.GetString();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printf("MyObjectTreeModel::SetValue: wrong column");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -253,6 +277,7 @@ public:
|
||||||
const wxDataViewItem &item, unsigned int col) const override;
|
const wxDataViewItem &item, unsigned int col) const override;
|
||||||
virtual bool SetValue(const wxVariant &variant,
|
virtual bool SetValue(const wxVariant &variant,
|
||||||
const wxDataViewItem &item, unsigned int col) override;
|
const wxDataViewItem &item, unsigned int col) override;
|
||||||
|
bool SetValue(const wxVariant &variant, const int item_idx, unsigned int col);
|
||||||
|
|
||||||
// virtual bool IsEnabled(const wxDataViewItem &item,
|
// virtual bool IsEnabled(const wxDataViewItem &item,
|
||||||
// unsigned int col) const override;
|
// unsigned int col) const override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue