Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::GUI::Page Class Reference

#include <src/slic3r/GUI/Tab.hpp>

+ Collaboration diagram for Slic3r::GUI::Page:

Public Member Functions

 Page (wxWindow *parent, const wxString &title, int iconID)
 
 ~Page ()
 
wxBoxSizer * vsizer () const
 
wxWindow * parent () const
 
const wxString & title () const
 
size_t iconID () const
 
void set_config (DynamicPrintConfig *config_in)
 
void reload_config ()
 
void update_visibility (ConfigOptionMode mode, bool update_contolls_visibility)
 
void activate (ConfigOptionMode mode, std::function< void()> throw_if_canceled)
 
void clear ()
 
void msw_rescale ()
 
void sys_color_changed ()
 
void refresh ()
 
Fieldget_field (const t_config_option_key &opt_key, int opt_index=-1) const
 
Lineget_line (const t_config_option_key &opt_key)
 
bool set_value (const t_config_option_key &opt_key, const boost::any &value)
 
ConfigOptionsGroupShp new_optgroup (const wxString &title, int noncommon_label_width=-1)
 
const ConfigOptionsGroupShp get_optgroup (const wxString &title) const
 
bool set_item_colour (const wxColour *clr)
 
const wxColour get_item_colour ()
 
bool get_show () const
 

Public Attributes

bool m_is_modified_values { false }
 
bool m_is_nonsys_values { true }
 
std::vector< ConfigOptionsGroupShpm_optgroups
 
DynamicPrintConfigm_config
 

Protected Attributes

const wxColour * m_item_color
 

Private Attributes

wxWindow * m_parent
 
wxString m_title
 
size_t m_iconID
 
wxBoxSizer * m_vsizer
 
bool m_show = true
 

Detailed Description

Constructor & Destructor Documentation

◆ Page()

Slic3r::GUI::Page::Page ( wxWindow *  parent,
const wxString &  title,
int  iconID 
)
4827 :
4829 m_title(title),
4831{
4832 m_vsizer = (wxBoxSizer*)parent->GetSizer();
4833 m_item_color = &wxGetApp().get_label_clr_default();
4834}
size_t iconID() const
Definition Tab.hpp:121
const wxColour * m_item_color
Definition Tab.hpp:151
wxBoxSizer * m_vsizer
Definition Tab.hpp:105
const wxString & title() const
Definition Tab.hpp:120
wxString m_title
Definition Tab.hpp:103
wxWindow * m_parent
Definition Tab.hpp:102
wxWindow * parent() const
Definition Tab.hpp:119
size_t m_iconID
Definition Tab.hpp:104

References m_item_color, m_vsizer, and parent().

+ Here is the call graph for this function:

◆ ~Page()

Slic3r::GUI::Page::~Page ( )
inline
109{}

Member Function Documentation

◆ activate()

void Slic3r::GUI::Page::activate ( ConfigOptionMode  mode,
std::function< void()>  throw_if_canceled 
)
4856{
4857 for (auto group : m_optgroups) {
4858 if (!group->activate(throw_if_canceled))
4859 continue;
4860 m_vsizer->Add(group->sizer, 0, wxEXPAND | (group->is_legend_line() ? (wxLEFT|wxTOP) : wxALL), 10);
4861 group->update_visibility(mode);
4862 group->reload_config();
4863 throw_if_canceled();
4864 }
4865}
std::vector< ConfigOptionsGroupShp > m_optgroups
Definition Tab.hpp:115

References m_optgroups, and m_vsizer.

◆ clear()

void Slic3r::GUI::Page::clear ( )
4868{
4869 for (auto group : m_optgroups)
4870 group->clear();
4871}
void clear()
Definition Tab.cpp:4867

References m_optgroups.

◆ get_field()

Field * Slic3r::GUI::Page::get_field ( const t_config_option_key opt_key,
int  opt_index = -1 
) const
4892{
4893 Field* field = nullptr;
4894 for (auto opt : m_optgroups) {
4895 field = opt->get_fieldc(opt_key, opt_index);
4896 if (field != nullptr)
4897 return field;
4898 }
4899 return field;
4900}

References m_optgroups.

◆ get_item_colour()

const wxColour Slic3r::GUI::Page::get_item_colour ( )
inline
144 {
145 return *m_item_color;
146 }

References m_item_color.

◆ get_line()

Line * Slic3r::GUI::Page::get_line ( const t_config_option_key opt_key)
4903{
4904 for (auto opt : m_optgroups)
4905 if (Line* line = opt->get_line(opt_key))
4906 return line;
4907 return nullptr;
4908}
Line * get_line(const t_config_option_key &opt_key)
Definition Tab.cpp:4902
if(!(yy_init))
Definition lexer.c:1190

References m_optgroups.

◆ get_optgroup()

const ConfigOptionsGroupShp Slic3r::GUI::Page::get_optgroup ( const wxString &  title) const
4971{
4972 for (ConfigOptionsGroupShp optgroup : m_optgroups) {
4973 if (optgroup->title == title)
4974 return optgroup;
4975 }
4976
4977 return nullptr;
4978}
std::shared_ptr< ConfigOptionsGroup > ConfigOptionsGroupShp
Definition BedShapeDialog.hpp:19

References m_optgroups, and title().

+ Here is the call graph for this function:

◆ get_show()

bool Slic3r::GUI::Page::get_show ( ) const
inline
147{ return m_show; }
bool m_show
Definition Tab.hpp:106

References m_show.

◆ iconID()

size_t Slic3r::GUI::Page::iconID ( ) const
inline
121{ return m_iconID; }

References m_iconID.

◆ msw_rescale()

void Slic3r::GUI::Page::msw_rescale ( )
4874{
4875 for (auto group : m_optgroups)
4876 group->msw_rescale();
4877}
void msw_rescale()
Definition Tab.cpp:4873

References m_optgroups.

◆ new_optgroup()

ConfigOptionsGroupShp Slic3r::GUI::Page::new_optgroup ( const wxString &  title,
int  noncommon_label_width = -1 
)

config_ have to be "right"

This function will be called from OptionGroup. Using of CallAfter is redundant. And in some cases it causes update() function to be recalled again wxTheApp->CallAfter([this, opt_key, value]() {

});

4921{
4923 ConfigOptionsGroupShp optgroup = std::make_shared<ConfigOptionsGroup>(m_parent, title, m_config, true);
4924 if (noncommon_label_width >= 0)
4925 optgroup->label_width = noncommon_label_width;
4926
4927#ifdef __WXOSX__
4928 auto tab = parent()->GetParent()->GetParent();// GetParent()->GetParent();
4929#else
4930 auto tab = parent()->GetParent();// GetParent();
4931#endif
4932 optgroup->set_config_category_and_type(m_title, static_cast<Tab*>(tab)->type());
4933 optgroup->m_on_change = [tab](t_config_option_key opt_key, boost::any value) {
4938 static_cast<Tab*>(tab)->update_dirty();
4939 static_cast<Tab*>(tab)->on_value_change(opt_key, value);
4941 };
4942
4943 optgroup->m_get_initial_config = [tab]() {
4944 DynamicPrintConfig config = static_cast<Tab*>(tab)->m_presets->get_selected_preset().config;
4945 return config;
4946 };
4947
4948 optgroup->m_get_sys_config = [tab]() {
4949 DynamicPrintConfig config = static_cast<Tab*>(tab)->m_presets->get_selected_preset_parent()->config;
4950 return config;
4951 };
4952
4953 optgroup->have_sys_config = [tab]() {
4954 return static_cast<Tab*>(tab)->m_presets->get_selected_preset_parent() != nullptr;
4955 };
4956
4957 optgroup->rescale_extra_column_item = [](wxWindow* win) {
4958 auto *ctrl = dynamic_cast<wxStaticBitmap*>(win);
4959 if (ctrl == nullptr)
4960 return;
4961
4962 ctrl->SetBitmap(reinterpret_cast<ScalableBitmap*>(ctrl->GetClientData())->bmp());
4963 };
4964
4965 m_optgroups.push_back(optgroup);
4966
4967 return optgroup;
4968}
Definition wxExtensions.hpp:136
DynamicPrintConfig * m_config
Definition Tab.hpp:116
std::string t_config_option_key
Definition Config.hpp:76

References m_config, m_optgroups, m_parent, m_title, parent(), and title().

Referenced by Slic3r::GUI::TabPrinter::build_print_host_upload_group().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parent()

wxWindow * Slic3r::GUI::Page::parent ( ) const
inline
119{ return m_parent; }

References m_parent.

Referenced by Page(), and new_optgroup().

+ Here is the caller graph for this function:

◆ refresh()

void Slic3r::GUI::Page::refresh ( )
4886{
4887 for (auto group : m_optgroups)
4888 group->refresh();
4889}
void refresh()
Definition Tab.cpp:4885

References m_optgroups.

◆ reload_config()

void Slic3r::GUI::Page::reload_config ( )
4837{
4838 for (auto group : m_optgroups)
4839 group->reload_config();
4840}
void reload_config()
Definition Tab.cpp:4836

References m_optgroups.

◆ set_config()

void Slic3r::GUI::Page::set_config ( DynamicPrintConfig config_in)
inline
122{ m_config = config_in; }

References m_config.

◆ set_item_colour()

bool Slic3r::GUI::Page::set_item_colour ( const wxColour *  clr)
inline
136 {
137 if (m_item_color != clr) {
138 m_item_color = clr;
139 return true;
140 }
141 return false;
142 }

References m_item_color.

◆ set_value()

bool Slic3r::GUI::Page::set_value ( const t_config_option_key opt_key,
const boost::any &  value 
)
4910 {
4911 bool changed = false;
4912 for(auto optgroup: m_optgroups) {
4913 if (optgroup->set_value(opt_key, value))
4914 changed = true ;
4915 }
4916 return changed;
4917}

References m_optgroups.

◆ sys_color_changed()

void Slic3r::GUI::Page::sys_color_changed ( )
4880{
4881 for (auto group : m_optgroups)
4882 group->sys_color_changed();
4883}
void sys_color_changed()
Definition Tab.cpp:4879

References m_optgroups.

◆ title()

const wxString & Slic3r::GUI::Page::title ( ) const
inline
120{ return m_title; }

References m_title.

Referenced by get_optgroup(), new_optgroup(), and Slic3r::GUI::TabSLAPrint::update_description_lines().

+ Here is the caller graph for this function:

◆ update_visibility()

void Slic3r::GUI::Page::update_visibility ( ConfigOptionMode  mode,
bool  update_contolls_visibility 
)
4843{
4844 bool ret_val = false;
4845 for (auto group : m_optgroups) {
4846 ret_val = (update_contolls_visibility ?
4847 group->update_visibility(mode) : // update visibility for all controlls in group
4848 group->is_visible(mode) // just detect visibility for the group
4849 ) || ret_val;
4850 }
4851
4852 m_show = ret_val;
4853}

References m_optgroups, and m_show.

◆ vsizer()

wxBoxSizer * Slic3r::GUI::Page::vsizer ( ) const
inline
118{ return m_vsizer; }

References m_vsizer.

Member Data Documentation

◆ m_config

DynamicPrintConfig* Slic3r::GUI::Page::m_config

Referenced by new_optgroup(), and set_config().

◆ m_iconID

size_t Slic3r::GUI::Page::m_iconID
private

Referenced by iconID().

◆ m_is_modified_values

bool Slic3r::GUI::Page::m_is_modified_values { false }

◆ m_is_nonsys_values

bool Slic3r::GUI::Page::m_is_nonsys_values { true }

◆ m_item_color

const wxColour* Slic3r::GUI::Page::m_item_color
protected

◆ m_optgroups

◆ m_parent

wxWindow* Slic3r::GUI::Page::m_parent
private

Referenced by new_optgroup(), and parent().

◆ m_show

bool Slic3r::GUI::Page::m_show = true
private

Referenced by get_show(), and update_visibility().

◆ m_title

wxString Slic3r::GUI::Page::m_title
private

Referenced by new_optgroup(), and title().

◆ m_vsizer

wxBoxSizer* Slic3r::GUI::Page::m_vsizer
private

Referenced by Page(), activate(), and vsizer().


The documentation for this class was generated from the following files: