mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Billet for the part of the expert view mode
This commit is contained in:
parent
622c613b41
commit
6e2d72f35c
4 changed files with 67 additions and 44 deletions
|
@ -886,35 +886,28 @@ wxString from_u8(const std::string &str)
|
||||||
return wxString::FromUTF8(str.c_str());
|
return wxString::FromUTF8(str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add PrusaCollapsiblePane to sizer
|
||||||
void add_expert_mode_part(wxWindow* parent, wxBoxSizer* sizer)
|
void add_prusa_collapsible_pane(wxWindow* parent, wxBoxSizer* sizer_parent, const wxString& name, std::function<wxSizer *(wxWindow *)> content_function)
|
||||||
{
|
{
|
||||||
sizer->SetMinSize(-1, 150);
|
auto *collpane = new PrusaCollapsiblePane(parent, wxID_ANY, name);
|
||||||
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
auto main_page = new wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
|
||||||
main_page->SetSizer(main_sizer);
|
|
||||||
main_page->SetScrollbars(1, 1, 1, 1);
|
|
||||||
sizer->Add(main_page, 1, wxEXPAND | wxALL, 1);
|
|
||||||
|
|
||||||
// Experiments with new UI
|
|
||||||
// wxSizer *paneSz = new wxBoxSizer(wxVERTICAL);
|
|
||||||
// paneSz->Add(m_optgroup->sizer, 1, wxGROW | wxEXPAND | wxLEFT | wxRIGHT, 5);
|
|
||||||
// win->SetSizer(paneSz);
|
|
||||||
// paneSz->SetSizeHints(win);
|
|
||||||
|
|
||||||
// *** Objects List ***
|
|
||||||
auto *collpane_objects = new PrusaCollapsiblePane(main_page, wxID_ANY, "Objects List:");
|
|
||||||
// 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
|
||||||
main_sizer->Add(collpane_objects, 0, wxGROW | wxALL, 0);
|
sizer_parent->Add(collpane, 0, wxGROW | wxALL, 0);
|
||||||
|
|
||||||
wxWindow *win_objects = collpane_objects->GetPane();
|
wxWindow *win = collpane->GetPane();
|
||||||
|
|
||||||
// **********************************************************************************************
|
wxSizer *sizer = content_function(win);
|
||||||
auto objects_ctrl = new wxDataViewCtrl(win_objects, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
|
||||||
wxSizer *objects_sz = new wxBoxSizer(wxVERTICAL);
|
wxSizer *sizer_pane = new wxBoxSizer(wxVERTICAL);
|
||||||
objects_ctrl->SetBestFittingSize(wxSize(-1, 200));
|
sizer_pane->Add(sizer, 1, wxGROW | wxEXPAND | wxBOTTOM, 2);
|
||||||
// TODO - Set correct height according to the opened/closed objects
|
win->SetSizer(sizer_pane);
|
||||||
// objects_ctrl->SetMinSize(wxSize(-1, 200));
|
sizer_pane->SetSizeHints(win);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxBoxSizer* content_objects_list(wxWindow *win)
|
||||||
|
{
|
||||||
|
auto objects_ctrl = new wxDataViewCtrl(win, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
|
objects_ctrl->SetBestFittingSize(wxSize(-1, 150)); // TODO - Set correct height according to the opened/closed objects
|
||||||
|
auto objects_sz = new wxBoxSizer(wxVERTICAL);
|
||||||
objects_sz->Add(objects_ctrl, 1, wxGROW | wxALL, 5);
|
objects_sz->Add(objects_ctrl, 1, wxGROW | wxALL, 5);
|
||||||
|
|
||||||
auto objects_model = new MyObjectTreeModel;
|
auto objects_model = new MyObjectTreeModel;
|
||||||
|
@ -945,19 +938,44 @@ void add_expert_mode_part(wxWindow* parent, wxBoxSizer* sizer)
|
||||||
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE);
|
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE);
|
||||||
objects_ctrl->AppendColumn(column02);
|
objects_ctrl->AppendColumn(column02);
|
||||||
|
|
||||||
// common_sizer->Add(objects_sz, 0, wxEXPAND | wxALL, 1);
|
return objects_sz;
|
||||||
|
}
|
||||||
|
|
||||||
wxSizer *paneSz_objects = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* content_object_settings(wxWindow *win)
|
||||||
paneSz_objects->Add(objects_sz, 1, wxGROW | wxEXPAND | wxBOTTOM, 2);
|
{
|
||||||
win_objects->SetSizer(paneSz_objects);
|
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
paneSz_objects->SetSizeHints(win_objects);
|
sizer->Add(new wxStaticText(win, wxID_ANY, "Some object text"));
|
||||||
|
return sizer;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxBoxSizer* content_part_settings(wxWindow *win)
|
||||||
|
{
|
||||||
|
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
sizer->Add(new wxStaticText(win, wxID_ANY, "Some part text"));
|
||||||
|
return sizer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void add_expert_mode_part(wxWindow* parent, wxBoxSizer* sizer)
|
||||||
|
{
|
||||||
|
sizer->SetMinSize(-1, 150);
|
||||||
|
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
auto main_page = new wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||||
|
main_page->SetSizer(main_sizer);
|
||||||
|
main_page->SetScrollbars(1, 1, 1, 1);
|
||||||
|
sizer->Add(main_page, 1, wxEXPAND | wxALL, 1);
|
||||||
|
|
||||||
|
// Experiments with new UI
|
||||||
|
|
||||||
|
// *** Objects List ***
|
||||||
|
add_prusa_collapsible_pane(main_page, main_sizer, "Objects List:", content_objects_list);
|
||||||
|
// *** Object Settings ***
|
||||||
|
add_prusa_collapsible_pane(main_page, main_sizer, "Object Settings:", content_object_settings);
|
||||||
|
// *** Part Settings ***
|
||||||
|
add_prusa_collapsible_pane(main_page, main_sizer, "Part Settings:", content_part_settings);
|
||||||
|
|
||||||
|
|
||||||
|
// More experiments with UI
|
||||||
// auto common_sizer = new wxBoxSizer(wxVERTICAL);
|
// auto listctrl = new wxDataViewListCtrl(main_page, wxID_ANY, wxDefaultPosition, wxSize(-1, 100));
|
||||||
// common_sizer->Add(m_optgroup->sizer);
|
|
||||||
|
|
||||||
// auto listctrl = new wxDataViewListCtrl(win, wxID_ANY, wxDefaultPosition, wxSize(-1, 100));
|
|
||||||
// listctrl->AppendToggleColumn("Toggle");
|
// listctrl->AppendToggleColumn("Toggle");
|
||||||
// listctrl->AppendTextColumn("Text");
|
// listctrl->AppendTextColumn("Text");
|
||||||
// wxVector<wxVariant> data;
|
// wxVector<wxVariant> data;
|
||||||
|
@ -972,9 +990,7 @@ void add_expert_mode_part(wxWindow* parent, wxBoxSizer* sizer)
|
||||||
// data.push_back(wxVariant(false));
|
// data.push_back(wxVariant(false));
|
||||||
// data.push_back(wxVariant("row 2"));
|
// data.push_back(wxVariant("row 2"));
|
||||||
// listctrl->AppendItem(data);
|
// listctrl->AppendItem(data);
|
||||||
// common_sizer->Add(listctrl, 0, wxEXPAND | wxALL, 1);
|
// main_sizer->Add(listctrl, 0, wxEXPAND | wxALL, 1);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFlexGridSizer* preset_sizer)
|
void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFlexGridSizer* preset_sizer)
|
||||||
|
|
|
@ -47,6 +47,11 @@ class TabIface;
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
enum ogDrawFlag{
|
||||||
|
ogDEFAULT,
|
||||||
|
ogSIDE_OPTIONS_TO_GRID
|
||||||
|
};
|
||||||
|
|
||||||
class Tab;
|
class Tab;
|
||||||
class ConfigOptionsGroup;
|
class ConfigOptionsGroup;
|
||||||
// Map from an file_type name to full file wildcard name.
|
// Map from an file_type name to full file wildcard name.
|
||||||
|
|
|
@ -173,7 +173,9 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** colored_Label/*
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we have a single option with no sidetext just add it directly to the grid sizer
|
// If we're here, we have more than one option or a single option with sidetext
|
||||||
|
// so we need a horizontal sizer to arrange these things
|
||||||
|
// If we have a single option with no sidetext just add it directly to the grid sizer
|
||||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
grid_sizer->Add(sizer, 0, wxEXPAND | wxALL, 0);
|
grid_sizer->Add(sizer, 0, wxEXPAND | wxALL, 0);
|
||||||
if (option_set.size() == 1 && option_set.front().opt.sidetext.size() == 0 &&
|
if (option_set.size() == 1 && option_set.front().opt.sidetext.size() == 0 &&
|
||||||
|
@ -190,9 +192,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** colored_Label/*
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're here, we have more than one option or a single option with sidetext
|
for (auto opt : option_set) {
|
||||||
// so we need a horizontal sizer to arrange these things
|
|
||||||
for (auto opt : option_set) {
|
|
||||||
ConfigOptionDef option = opt.opt;
|
ConfigOptionDef option = opt.opt;
|
||||||
// add label if any
|
// add label if any
|
||||||
if (option.label != "") {
|
if (option.label != "") {
|
||||||
|
|
|
@ -127,8 +127,8 @@ public:
|
||||||
inline void enable() { for (auto& field : m_fields) field.second->enable(); }
|
inline void enable() { for (auto& field : m_fields) field.second->enable(); }
|
||||||
inline void disable() { for (auto& field : m_fields) field.second->disable(); }
|
inline void disable() { for (auto& field : m_fields) field.second->disable(); }
|
||||||
|
|
||||||
OptionsGroup(wxWindow* _parent, const wxString& title, bool is_tab_opt=false) :
|
OptionsGroup(wxWindow* _parent, const wxString& title, bool is_tab_opt=false, ogDrawFlag flag = ogDEFAULT) :
|
||||||
m_parent(_parent), title(title), m_is_tab_opt(is_tab_opt), staticbox(title!="") {
|
m_parent(_parent), title(title), m_is_tab_opt(is_tab_opt), staticbox(title!=""), m_flag(flag) {
|
||||||
sizer = (staticbox ? new wxStaticBoxSizer(new wxStaticBox(_parent, wxID_ANY, title), wxVERTICAL) : new wxBoxSizer(wxVERTICAL));
|
sizer = (staticbox ? new wxStaticBoxSizer(new wxStaticBox(_parent, wxID_ANY, title), wxVERTICAL) : new wxBoxSizer(wxVERTICAL));
|
||||||
auto num_columns = 1U;
|
auto num_columns = 1U;
|
||||||
if (label_width != 0) num_columns++;
|
if (label_width != 0) num_columns++;
|
||||||
|
@ -158,6 +158,8 @@ protected:
|
||||||
// "true" if option is created in preset tabs
|
// "true" if option is created in preset tabs
|
||||||
bool m_is_tab_opt{ false };
|
bool m_is_tab_opt{ false };
|
||||||
|
|
||||||
|
ogDrawFlag m_flag{ ogDEFAULT };
|
||||||
|
|
||||||
// This panel is needed for correct showing of the ToolTips for Button, StaticText and CheckBox
|
// This panel is needed for correct showing of the ToolTips for Button, StaticText and CheckBox
|
||||||
// Tooltips on GTK doesn't work inside wxStaticBoxSizer unless you insert a panel
|
// Tooltips on GTK doesn't work inside wxStaticBoxSizer unless you insert a panel
|
||||||
// inside it before you insert the other controls.
|
// inside it before you insert the other controls.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue