mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 00:37:51 -06:00
Prototype of the hiding according to view mode
+ Added mode icon near option's label + Fixed segmentation fault on Linux
This commit is contained in:
parent
5d94e6adb8
commit
f47949504e
13 changed files with 242 additions and 53 deletions
|
@ -27,11 +27,6 @@
|
|||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
enum ogDrawFlag{
|
||||
ogDEFAULT,
|
||||
ogSIDE_OPTIONS_VERTICAL
|
||||
};
|
||||
|
||||
/// Widget type describes a function object that returns a wxWindow (our widget) and accepts a wxWidget (parent window).
|
||||
using widget_t = std::function<wxSizer*(wxWindow*)>;//!std::function<wxWindow*(wxWindow*)>;
|
||||
|
||||
|
@ -151,7 +146,6 @@ public:
|
|||
|
||||
inline void enable() { for (auto& field : m_fields) field.second->enable(); }
|
||||
inline void disable() { for (auto& field : m_fields) field.second->disable(); }
|
||||
void set_flag(ogDrawFlag flag) { m_flag = flag; }
|
||||
void set_grid_vgap(int gap) { m_grid_sizer->SetVGap(gap); }
|
||||
|
||||
void set_show_modified_btns_val(bool show) {
|
||||
|
@ -159,9 +153,10 @@ public:
|
|||
}
|
||||
|
||||
OptionsGroup( wxWindow* _parent, const wxString& title, bool is_tab_opt = false,
|
||||
ogDrawFlag flag = ogDEFAULT, column_t extra_clmn = nullptr) :
|
||||
m_parent(_parent), title(title), m_show_modified_btns(is_tab_opt),
|
||||
staticbox(title!=""), m_flag(flag), extra_column(extra_clmn){
|
||||
column_t extra_clmn = nullptr) :
|
||||
m_parent(_parent), title(title),
|
||||
m_show_modified_btns(is_tab_opt),
|
||||
staticbox(title!=""), extra_column(extra_clmn){
|
||||
if (staticbox) {
|
||||
stb = new wxStaticBox(_parent, wxID_ANY, title);
|
||||
stb->SetFont(wxGetApp().bold_font());
|
||||
|
@ -172,7 +167,7 @@ public:
|
|||
if (extra_column != nullptr) num_columns++;
|
||||
m_grid_sizer = new wxFlexGridSizer(0, num_columns, 1,0);
|
||||
static_cast<wxFlexGridSizer*>(m_grid_sizer)->SetFlexibleDirection(wxBOTH/*wxHORIZONTAL*/);
|
||||
static_cast<wxFlexGridSizer*>(m_grid_sizer)->AddGrowableCol(label_width != 0);
|
||||
static_cast<wxFlexGridSizer*>(m_grid_sizer)->AddGrowableCol(label_width == 0 ? 0 : !extra_column ? 1 : 2 );
|
||||
#ifdef __WXGTK__
|
||||
m_panel = new wxPanel( _parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
sizer->Fit(m_panel);
|
||||
|
@ -197,8 +192,6 @@ protected:
|
|||
// "true" if option is created in preset tabs
|
||||
bool m_show_modified_btns{ false };
|
||||
|
||||
ogDrawFlag m_flag{ ogDEFAULT };
|
||||
|
||||
// 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
|
||||
// inside it before you insert the other controls.
|
||||
|
@ -223,8 +216,8 @@ protected:
|
|||
class ConfigOptionsGroup: public OptionsGroup {
|
||||
public:
|
||||
ConfigOptionsGroup( wxWindow* parent, const wxString& title, DynamicPrintConfig* _config = nullptr,
|
||||
bool is_tab_opt = false, ogDrawFlag flag = ogDEFAULT, column_t extra_clmn = nullptr) :
|
||||
OptionsGroup(parent, title, is_tab_opt, flag, extra_clmn), m_config(_config) {}
|
||||
bool is_tab_opt = false, column_t extra_clmn = nullptr) :
|
||||
OptionsGroup(parent, title, is_tab_opt, extra_clmn), m_config(_config) {}
|
||||
|
||||
/// reference to libslic3r config, non-owning pointer (?).
|
||||
DynamicPrintConfig* m_config {nullptr};
|
||||
|
@ -252,6 +245,7 @@ public:
|
|||
void back_to_config_value(const DynamicPrintConfig& config, const std::string& opt_key);
|
||||
void on_kill_focus() override{ reload_config();}
|
||||
void reload_config();
|
||||
void update_visibility(ConfigOptionMode mode);
|
||||
boost::any config_value(const std::string& opt_key, int opt_index, bool deserialize);
|
||||
// return option value from config
|
||||
boost::any get_config_value(const DynamicPrintConfig& config, const std::string& opt_key, int opt_index = -1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue