mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 16:21:24 -06:00
"Machine limits" page is completed
This commit is contained in:
parent
b6ebbdb94a
commit
4454c3437f
6 changed files with 120 additions and 74 deletions
|
@ -665,6 +665,22 @@ boost::any& PointCtrl::get_value()
|
|||
return m_value = ret_point;
|
||||
}
|
||||
|
||||
void StaticText::BUILD()
|
||||
{
|
||||
auto size = wxSize(wxDefaultSize);
|
||||
if (m_opt.height >= 0) size.SetHeight(m_opt.height);
|
||||
if (m_opt.width >= 0) size.SetWidth(m_opt.width);
|
||||
|
||||
wxString legend(static_cast<ConfigOptionString*>(m_opt.default_value)->value);
|
||||
auto temp = new wxStaticText(m_parent, wxID_ANY, legend, wxDefaultPosition, size);
|
||||
temp->SetFont(bold_font());
|
||||
|
||||
// // recast as a wxWindow to fit the calling convention
|
||||
window = dynamic_cast<wxWindow*>(temp);
|
||||
|
||||
temp->SetToolTip(get_tooltip_text(legend));
|
||||
}
|
||||
|
||||
} // GUI
|
||||
} // Slic3r
|
||||
|
||||
|
|
|
@ -384,6 +384,34 @@ public:
|
|||
wxSizer* getSizer() override { return sizer; }
|
||||
};
|
||||
|
||||
class StaticText : public Field {
|
||||
using Field::Field;
|
||||
public:
|
||||
StaticText(const ConfigOptionDef& opt, const t_config_option_key& id) : Field(opt, id) {}
|
||||
StaticText(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : Field(parent, opt, id) {}
|
||||
~StaticText() {}
|
||||
|
||||
wxWindow* window{ nullptr };
|
||||
void BUILD() override;
|
||||
|
||||
void set_value(const std::string& value, bool change_event = false) {
|
||||
m_disable_change_event = !change_event;
|
||||
dynamic_cast<wxStaticText*>(window)->SetLabel(value);
|
||||
m_disable_change_event = false;
|
||||
}
|
||||
void set_value(const boost::any& value, bool change_event = false) {
|
||||
m_disable_change_event = !change_event;
|
||||
dynamic_cast<wxStaticText*>(window)->SetLabel(boost::any_cast<wxString>(value));
|
||||
m_disable_change_event = false;
|
||||
}
|
||||
|
||||
boost::any& get_value()override { return m_value; }
|
||||
|
||||
void enable() override { dynamic_cast<wxColourPickerCtrl*>(window)->Enable(); };
|
||||
void disable() override{ dynamic_cast<wxColourPickerCtrl*>(window)->Disable(); };
|
||||
wxWindow* getWindow() override { return window; }
|
||||
};
|
||||
|
||||
} // GUI
|
||||
} // Slic3r
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
|
|||
m_fields.emplace(id, STDMOVE(Choice::Create<Choice>(parent(), opt, id)));
|
||||
} else if (opt.gui_type.compare("slider") == 0) {
|
||||
} else if (opt.gui_type.compare("i_spin") == 0) { // Spinctrl
|
||||
} else if (opt.gui_type.compare("legend") == 0) { // StaticText
|
||||
m_fields.emplace(id, STDMOVE(StaticText::Create<StaticText>(parent(), opt, id)));
|
||||
} else {
|
||||
switch (opt.type) {
|
||||
case coFloatOrPercent:
|
||||
|
@ -86,7 +88,7 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
|
|||
if (!this->m_disabled)
|
||||
this->back_to_sys_value(opt_id);
|
||||
};
|
||||
if (!m_is_tab_opt) {
|
||||
if (!m_show_modified_btns) {
|
||||
field->m_Undo_btn->Hide();
|
||||
field->m_Undo_to_sys_btn->Hide();
|
||||
}
|
||||
|
|
|
@ -127,8 +127,12 @@ 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_show_modified_btns_val(bool show) {
|
||||
m_show_modified_btns = show;
|
||||
}
|
||||
|
||||
OptionsGroup(wxWindow* _parent, const wxString& title, bool is_tab_opt=false) :
|
||||
m_parent(_parent), title(title), m_is_tab_opt(is_tab_opt), staticbox(title!="") {
|
||||
m_parent(_parent), title(title), m_show_modified_btns(is_tab_opt), staticbox(title!="") {
|
||||
auto stb = new wxStaticBox(_parent, wxID_ANY, title);
|
||||
stb->SetFont(bold_font());
|
||||
sizer = (staticbox ? new wxStaticBoxSizer(stb/*new wxStaticBox(_parent, wxID_ANY, title)*/, wxVERTICAL) : new wxBoxSizer(wxVERTICAL));
|
||||
|
@ -158,7 +162,7 @@ protected:
|
|||
bool m_disabled {false};
|
||||
wxGridSizer* m_grid_sizer {nullptr};
|
||||
// "true" if option is created in preset tabs
|
||||
bool m_is_tab_opt{ false };
|
||||
bool m_show_modified_btns{ false };
|
||||
|
||||
// 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
|
||||
|
|
|
@ -1718,73 +1718,63 @@ void TabPrinter::extruders_count_changed(size_t extruders_count){
|
|||
on_value_change("extruders_count", extruders_count);
|
||||
}
|
||||
|
||||
void append_option_line(ConfigOptionsGroupShp optgroup, const std::string opt_key)
|
||||
{
|
||||
auto option = optgroup->get_option(opt_key, 0);
|
||||
auto line = Line{ option.opt.full_label, "" };
|
||||
line.append_option(option);
|
||||
line.append_option(optgroup->get_option(opt_key, 1));
|
||||
optgroup->append_line(line);
|
||||
}
|
||||
|
||||
PageShp TabPrinter::create_kinematics_page()
|
||||
{
|
||||
auto page = add_options_page(_(L("Machine limits")), "cog.png", true);
|
||||
auto optgroup = page->new_optgroup(_(L("Maximum accelerations")));
|
||||
auto line = Line{ _(L("Standard/Silent mode")), "" };
|
||||
line.append_option(optgroup->get_option("machine_max_acceleration_x", 0));
|
||||
line.append_option(optgroup->get_option("machine_max_acceleration_x", 1));
|
||||
|
||||
// Legend for OptionsGroups
|
||||
auto optgroup = page->new_optgroup(_(L("")));
|
||||
optgroup->set_show_modified_btns_val(false);
|
||||
optgroup->label_width = 230;
|
||||
auto line = Line{ "", "" };
|
||||
|
||||
ConfigOptionDef def;
|
||||
def.type = coString;
|
||||
def.width = 150;
|
||||
def.gui_type = "legend";
|
||||
def.tooltip = L("Values in this column are for Full Power mode");
|
||||
def.default_value = new ConfigOptionString{ L("Full Power")};
|
||||
|
||||
auto option = Option(def, "full_power_legend");
|
||||
line.append_option(option);
|
||||
|
||||
def.tooltip = L("Values in this column are for Silent mode");
|
||||
def.default_value = new ConfigOptionString{ L("Silent") };
|
||||
option = Option(def, "silent_legend");
|
||||
line.append_option(option);
|
||||
|
||||
optgroup->append_line(line);
|
||||
line = Line{ "", "" };
|
||||
line.append_option(optgroup->get_option("machine_max_acceleration_y", 0));
|
||||
line.append_option(optgroup->get_option("machine_max_acceleration_y", 1));
|
||||
optgroup->append_line(line);
|
||||
line = Line{ _(L("Standard/Silent mode")), "" };
|
||||
line.append_option(optgroup->get_option("machine_max_acceleration_z", 0));
|
||||
line.append_option(optgroup->get_option("machine_max_acceleration_z", 1));
|
||||
optgroup->append_line(line);
|
||||
line = Line{ _(L("Standard/Silent mode")), "" };
|
||||
line.append_option(optgroup->get_option("machine_max_acceleration_e", 0));
|
||||
line.append_option(optgroup->get_option("machine_max_acceleration_e", 1));
|
||||
optgroup->append_line(line);
|
||||
// optgroup->append_single_option_line("machine_max_acceleration_x", 0);
|
||||
// optgroup->append_single_option_line("machine_max_acceleration_y", 0);
|
||||
// optgroup->append_single_option_line("machine_max_acceleration_z", 0);
|
||||
// optgroup->append_single_option_line("machine_max_acceleration_e", 0);
|
||||
|
||||
std::vector<std::string> axes{ "x", "y", "z", "e" };
|
||||
optgroup = page->new_optgroup(_(L("Maximum accelerations")));
|
||||
for (const std::string &axis : axes) {
|
||||
append_option_line(optgroup, "machine_max_acceleration_" + axis);
|
||||
}
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Maximum feedrates")));
|
||||
optgroup->append_single_option_line("machine_max_feedrate_x", 0);
|
||||
optgroup->append_single_option_line("machine_max_feedrate_y", 0);
|
||||
optgroup->append_single_option_line("machine_max_feedrate_z", 0);
|
||||
optgroup->append_single_option_line("machine_max_feedrate_e", 0);
|
||||
for (const std::string &axis : axes) {
|
||||
append_option_line(optgroup, "machine_max_feedrate_" + axis);
|
||||
}
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Starting Acceleration")));
|
||||
optgroup->append_single_option_line("machine_max_acceleration_extruding", 0);
|
||||
optgroup->append_single_option_line("machine_max_acceleration_retracting", 0);
|
||||
append_option_line(optgroup, "machine_max_acceleration_extruding");
|
||||
append_option_line(optgroup, "machine_max_acceleration_retracting");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Advanced")));
|
||||
optgroup->append_single_option_line("machine_min_extruding_rate", 0);
|
||||
optgroup->append_single_option_line("machine_min_travel_rate", 0);
|
||||
optgroup->append_single_option_line("machine_max_jerk_x", 0);
|
||||
optgroup->append_single_option_line("machine_max_jerk_y", 0);
|
||||
optgroup->append_single_option_line("machine_max_jerk_z", 0);
|
||||
optgroup->append_single_option_line("machine_max_jerk_e", 0);
|
||||
|
||||
//for silent mode
|
||||
// optgroup = page->new_optgroup(_(L("Maximum accelerations")));
|
||||
// optgroup->append_single_option_line("machine_max_acceleration_x", 1);
|
||||
// optgroup->append_single_option_line("machine_max_acceleration_y", 1);
|
||||
// optgroup->append_single_option_line("machine_max_acceleration_z", 1);
|
||||
// optgroup->append_single_option_line("machine_max_acceleration_e", 1);
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Maximum feedrates (Silent mode)")));
|
||||
optgroup->append_single_option_line("machine_max_feedrate_x", 1);
|
||||
optgroup->append_single_option_line("machine_max_feedrate_y", 1);
|
||||
optgroup->append_single_option_line("machine_max_feedrate_z", 1);
|
||||
optgroup->append_single_option_line("machine_max_feedrate_e", 1);
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Starting Acceleration (Silent mode)")));
|
||||
optgroup->append_single_option_line("machine_max_acceleration_extruding", 1);
|
||||
optgroup->append_single_option_line("machine_max_acceleration_retracting", 1);
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Advanced (Silent mode)")));
|
||||
optgroup->append_single_option_line("machine_min_extruding_rate", 1);
|
||||
optgroup->append_single_option_line("machine_min_travel_rate", 1);
|
||||
optgroup->append_single_option_line("machine_max_jerk_x", 1);
|
||||
optgroup->append_single_option_line("machine_max_jerk_y", 1);
|
||||
optgroup->append_single_option_line("machine_max_jerk_z", 1);
|
||||
optgroup->append_single_option_line("machine_max_jerk_e", 1);
|
||||
append_option_line(optgroup, "machine_min_extruding_rate");
|
||||
append_option_line(optgroup, "machine_min_travel_rate");
|
||||
for (const std::string &axis : axes) {
|
||||
append_option_line(optgroup, "machine_max_jerk_" + axis);
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue