mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
Implement Preparation for Edit Custom Gcode
Original Commit: prusa3d/PrusaSlicer@7db83d5 Co-authored-by: YuSanka <yusanka@gmail.com>
This commit is contained in:
parent
4f0a47b7f4
commit
accdbb9661
8 changed files with 117 additions and 25 deletions
|
@ -196,6 +196,11 @@ void Field::on_back_to_sys_value()
|
||||||
m_back_to_sys_value(m_opt_id);
|
m_back_to_sys_value(m_opt_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Field::on_edit_value()
|
||||||
|
{
|
||||||
|
if (m_fn_edit_value)
|
||||||
|
m_fn_edit_value(m_opt_id);
|
||||||
|
}
|
||||||
|
|
||||||
/// Fires the enable or disable function, based on the input.
|
/// Fires the enable or disable function, based on the input.
|
||||||
|
|
||||||
|
|
|
@ -183,6 +183,8 @@ public:
|
||||||
void on_back_to_initial_value();
|
void on_back_to_initial_value();
|
||||||
/// Call the attached m_back_to_sys_value method.
|
/// Call the attached m_back_to_sys_value method.
|
||||||
void on_back_to_sys_value();
|
void on_back_to_sys_value();
|
||||||
|
/// Call the attached m_fn_edit_value method.
|
||||||
|
void on_edit_value();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// parent wx item, opportunity to refactor (probably not necessary - data duplication)
|
/// parent wx item, opportunity to refactor (probably not necessary - data duplication)
|
||||||
|
@ -198,6 +200,9 @@ public:
|
||||||
t_back_to_init m_back_to_initial_value{ nullptr };
|
t_back_to_init m_back_to_initial_value{ nullptr };
|
||||||
t_back_to_init m_back_to_sys_value{ nullptr };
|
t_back_to_init m_back_to_sys_value{ nullptr };
|
||||||
|
|
||||||
|
/// Callback function to edit field value
|
||||||
|
t_back_to_init m_fn_edit_value{ nullptr };
|
||||||
|
|
||||||
// This is used to avoid recursive invocation of the field change/update by wxWidgets.
|
// This is used to avoid recursive invocation of the field change/update by wxWidgets.
|
||||||
bool m_disable_change_event {false};
|
bool m_disable_change_event {false};
|
||||||
bool m_is_modified_value {false};
|
bool m_is_modified_value {false};
|
||||||
|
|
|
@ -373,22 +373,31 @@ void OG_CustomCtrl::OnMotion(wxMouseEvent& event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t opt_idx = 0; opt_idx < line.rects_undo_icon.size(); opt_idx++)
|
size_t undo_icons_cnt = line.rects_undo_icon.size();
|
||||||
if (is_point_in_rect(pos, line.rects_undo_icon[opt_idx])) {
|
assert(line.rects_undo_icon.size() == line.rects_undo_to_sys_icon.size());
|
||||||
const std::vector<Option>& option_set = line.og_line.get_options();
|
const std::vector<Option>& option_set = line.og_line.get_options();
|
||||||
Field* field = opt_group->get_field(option_set[opt_idx].opt_id);
|
for (size_t opt_idx = 0; opt_idx < undo_icons_cnt; opt_idx++) {
|
||||||
if (field)
|
const std::string& opt_key = option_set[opt_idx].opt_id;
|
||||||
|
if (is_point_in_rect(pos, line.rects_undo_icon[opt_idx])) {
|
||||||
|
if (line.og_line.has_undo_ui())
|
||||||
|
tooltip = *line.og_line.undo_tooltip();
|
||||||
|
else if (Field* field = opt_group->get_field(opt_key))
|
||||||
tooltip = *field->undo_tooltip();
|
tooltip = *field->undo_tooltip();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (size_t opt_idx = 0; opt_idx < line.rects_undo_to_sys_icon.size(); opt_idx++)
|
|
||||||
if (is_point_in_rect(pos, line.rects_undo_to_sys_icon[opt_idx])) {
|
if (is_point_in_rect(pos, line.rects_undo_to_sys_icon[opt_idx])) {
|
||||||
const std::vector<Option>& option_set = line.og_line.get_options();
|
if (line.og_line.has_undo_ui())
|
||||||
Field* field = opt_group->get_field(option_set[opt_idx].opt_id);
|
tooltip = *line.og_line.undo_to_sys_tooltip();
|
||||||
if (field)
|
else if (Field* field = opt_group->get_field(opt_key))
|
||||||
tooltip = *field->undo_to_sys_tooltip();
|
tooltip = *field->undo_to_sys_tooltip();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (opt_idx < line.rects_edit_icon.size() && is_point_in_rect(pos, line.rects_edit_icon[opt_idx])) {
|
||||||
|
if (Field* field = opt_group->get_field(opt_key); field && field->has_edit_ui())
|
||||||
|
tooltip = *field->edit_tooltip();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!tooltip.IsEmpty())
|
if (!tooltip.IsEmpty())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -424,24 +433,40 @@ void OG_CustomCtrl::OnLeftDown(wxMouseEvent& event)
|
||||||
if (!line.is_visible) continue;
|
if (!line.is_visible) continue;
|
||||||
if (line.launch_browser())
|
if (line.launch_browser())
|
||||||
return;
|
return;
|
||||||
for (size_t opt_idx = 0; opt_idx < line.rects_undo_icon.size(); opt_idx++)
|
size_t undo_icons_cnt = line.rects_undo_icon.size();
|
||||||
if (is_point_in_rect(pos, line.rects_undo_icon[opt_idx])) {
|
assert(line.rects_undo_icon.size() == line.rects_undo_to_sys_icon.size());
|
||||||
|
|
||||||
const std::vector<Option>& option_set = line.og_line.get_options();
|
const std::vector<Option>& option_set = line.og_line.get_options();
|
||||||
Field* field = opt_group->get_field(option_set[opt_idx].opt_id);
|
for (size_t opt_idx = 0; opt_idx < undo_icons_cnt; opt_idx++) {
|
||||||
if (field)
|
const std::string& opt_key = option_set[opt_idx].opt_id;
|
||||||
|
if (is_point_in_rect(pos, line.rects_undo_icon[opt_idx])) {
|
||||||
|
if (line.og_line.has_undo_ui()) {
|
||||||
|
if (ConfigOptionsGroup* conf_OG = dynamic_cast<ConfigOptionsGroup*>(line.ctrl->opt_group))
|
||||||
|
conf_OG->back_to_initial_value(opt_key);
|
||||||
|
}
|
||||||
|
else if (Field* field = opt_group->get_field(opt_key))
|
||||||
field->on_back_to_initial_value();
|
field->on_back_to_initial_value();
|
||||||
event.Skip();
|
event.Skip();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (size_t opt_idx = 0; opt_idx < line.rects_undo_to_sys_icon.size(); opt_idx++)
|
|
||||||
if (is_point_in_rect(pos, line.rects_undo_to_sys_icon[opt_idx])) {
|
if (is_point_in_rect(pos, line.rects_undo_to_sys_icon[opt_idx])) {
|
||||||
const std::vector<Option>& option_set = line.og_line.get_options();
|
if (line.og_line.has_undo_ui()) {
|
||||||
Field* field = opt_group->get_field(option_set[opt_idx].opt_id);
|
if (ConfigOptionsGroup* conf_OG = dynamic_cast<ConfigOptionsGroup*>(line.ctrl->opt_group))
|
||||||
if (field)
|
conf_OG->back_to_sys_value(opt_key);
|
||||||
|
}
|
||||||
|
else if (Field* field = opt_group->get_field(opt_key))
|
||||||
field->on_back_to_sys_value();
|
field->on_back_to_sys_value();
|
||||||
event.Skip();
|
event.Skip();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opt_idx < line.rects_edit_icon.size() && is_point_in_rect(pos, line.rects_edit_icon[opt_idx])) {
|
||||||
|
if (Field* field = opt_group->get_field(opt_key))
|
||||||
|
field->on_edit_value();
|
||||||
|
event.Skip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFocusIgnoringChildren();
|
SetFocusIgnoringChildren();
|
||||||
|
@ -745,10 +770,14 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord h_pos, wxCoord v_pos)
|
||||||
bool suppress_hyperlinks = false;
|
bool suppress_hyperlinks = false;
|
||||||
if (draw_just_act_buttons) {
|
if (draw_just_act_buttons) {
|
||||||
//BBS: GUI refactor
|
//BBS: GUI refactor
|
||||||
if (field && field->undo_bitmap())
|
if (field && field->undo_bitmap()) {
|
||||||
// if (field)
|
// if (field)
|
||||||
// BBS: new layout
|
// BBS: new layout
|
||||||
draw_act_bmps(dc, wxPoint(h_pos, v_pos), field->undo_to_sys_bitmap()->get_bitmap(), field->undo_bitmap()->get_bitmap(), field->blink());
|
const wxPoint pos = draw_act_bmps(dc, wxPoint(h_pos, v_pos), field->undo_to_sys_bitmap()->get_bitmap(),
|
||||||
|
field->undo_bitmap()->get_bitmap(), field->blink());
|
||||||
|
if (field->has_edit_ui())
|
||||||
|
draw_edit_bmp(dc, pos, field->edit_bitmap());
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,7 +831,7 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord h_pos, wxCoord v_pos)
|
||||||
|
|
||||||
auto draw_buttons = [&h_pos, &dc, &v_pos, this](Field* field, size_t bmp_rect_id = 0) {
|
auto draw_buttons = [&h_pos, &dc, &v_pos, this](Field* field, size_t bmp_rect_id = 0) {
|
||||||
if (field && field->undo_to_sys_bitmap()) {
|
if (field && field->undo_to_sys_bitmap()) {
|
||||||
h_pos = draw_act_bmps(dc, wxPoint(h_pos, v_pos), field->undo_to_sys_bitmap()->get_bitmap(), field->undo_bitmap()->get_bitmap(), field->blink(), bmp_rect_id);
|
h_pos = draw_act_bmps(dc, wxPoint(h_pos, v_pos), field->undo_to_sys_bitmap()->get_bitmap(), field->undo_bitmap()->get_bitmap(), field->blink(), bmp_rect_id).x;
|
||||||
}
|
}
|
||||||
#ifndef DISABLE_BLINKING
|
#ifndef DISABLE_BLINKING
|
||||||
else if (field && !field->undo_to_sys_bitmap() && field->blink())
|
else if (field && !field->undo_to_sys_bitmap() && field->blink())
|
||||||
|
@ -945,7 +974,7 @@ wxPoint OG_CustomCtrl::CtrlLine::draw_blinking_bmp(wxDC& dc, wxPoint pos, bool i
|
||||||
return wxPoint(h_pos, v_pos);
|
return wxPoint(h_pos, v_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord OG_CustomCtrl::CtrlLine::draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmapBundle& bmp_undo_to_sys, const wxBitmapBundle& bmp_undo, bool is_blinking, size_t rect_id)
|
wxPoint OG_CustomCtrl::CtrlLine::draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmapBundle& bmp_undo_to_sys, const wxBitmapBundle& bmp_undo, bool is_blinking, size_t rect_id)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_BLINKING
|
#ifndef DISABLE_BLINKING
|
||||||
pos = draw_blinking_bmp(dc, pos, is_blinking);
|
pos = draw_blinking_bmp(dc, pos, is_blinking);
|
||||||
|
@ -979,7 +1008,19 @@ wxCoord OG_CustomCtrl::CtrlLine::draw_act_bmps(wxDC& dc, wxPoint pos, const wxBi
|
||||||
|
|
||||||
h_pos += bmp_dim2 + ctrl->m_h_gap;
|
h_pos += bmp_dim2 + ctrl->m_h_gap;
|
||||||
|
|
||||||
return h_pos;
|
return wxPoint(h_pos, v_pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxCoord OG_CustomCtrl::CtrlLine::draw_edit_bmp(wxDC &dc, wxPoint pos, const wxBitmapBundle *bmp_edit)
|
||||||
|
{
|
||||||
|
const wxCoord h_pos = pos.x + ctrl->m_h_gap;
|
||||||
|
const wxCoord v_pos = pos.y;
|
||||||
|
const int bmp_w = get_bitmap_size(bmp_edit, ctrl).GetWidth();
|
||||||
|
rects_edit_icon.emplace_back(wxRect(h_pos, v_pos, bmp_w, bmp_w));
|
||||||
|
|
||||||
|
dc.DrawBitmap(bmp_edit->GetBitmapFor(ctrl), h_pos, v_pos);
|
||||||
|
|
||||||
|
return h_pos + bmp_w + ctrl->m_h_gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OG_CustomCtrl::CtrlLine::launch_browser() const
|
bool OG_CustomCtrl::CtrlLine::launch_browser() const
|
||||||
|
|
|
@ -64,12 +64,14 @@ class OG_CustomCtrl :public wxPanel
|
||||||
void render(wxDC& dc, wxCoord h_pos, wxCoord v_pos);
|
void render(wxDC& dc, wxCoord h_pos, wxCoord v_pos);
|
||||||
wxCoord draw_text (wxDC& dc, wxPoint pos, const wxString& text, const wxColour* color, int width, bool is_url = false, bool is_main = false);
|
wxCoord draw_text (wxDC& dc, wxPoint pos, const wxString& text, const wxColour* color, int width, bool is_url = false, bool is_main = false);
|
||||||
wxPoint draw_blinking_bmp(wxDC& dc, wxPoint pos, bool is_blinking);
|
wxPoint draw_blinking_bmp(wxDC& dc, wxPoint pos, bool is_blinking);
|
||||||
wxCoord draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmapBundle& bmp_undo_to_sys, const wxBitmapBundle& bmp_undo, bool is_blinking, size_t rect_id = 0);
|
wxPoint draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmapBundle& bmp_undo_to_sys, const wxBitmapBundle& bmp_undo, bool is_blinking, size_t rect_id = 0);
|
||||||
|
wxCoord draw_edit_bmp(wxDC& dc, wxPoint pos, const wxBitmapBundle* bmp_edit);
|
||||||
bool launch_browser() const;
|
bool launch_browser() const;
|
||||||
bool is_separator() const { return og_line.is_separator(); }
|
bool is_separator() const { return og_line.is_separator(); }
|
||||||
|
|
||||||
std::vector<wxRect> rects_undo_icon;
|
std::vector<wxRect> rects_undo_icon;
|
||||||
std::vector<wxRect> rects_undo_to_sys_icon;
|
std::vector<wxRect> rects_undo_to_sys_icon;
|
||||||
|
std::vector<wxRect> rects_edit_icon;
|
||||||
wxRect rect_label;
|
wxRect rect_label;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,14 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
|
||||||
};
|
};
|
||||||
field->m_parent = parent();
|
field->m_parent = parent();
|
||||||
|
|
||||||
|
if (edit_custom_gcode && opt.is_code) {
|
||||||
|
field->m_fn_edit_value = [this](std::string opt_id) {
|
||||||
|
if (!m_disabled)
|
||||||
|
this->edit_custom_gcode(opt_id);
|
||||||
|
};
|
||||||
|
field->set_edit_tooltip(_L("Edit CustomG-code"));
|
||||||
|
}
|
||||||
|
|
||||||
field->m_back_to_initial_value = [this](std::string opt_id) {
|
field->m_back_to_initial_value = [this](std::string opt_id) {
|
||||||
if (!m_disabled)
|
if (!m_disabled)
|
||||||
this->back_to_initial_value(opt_id);
|
this->back_to_initial_value(opt_id);
|
||||||
|
|
|
@ -122,6 +122,8 @@ public:
|
||||||
std::function<void(wxWindow* win)> rescale_extra_column_item { nullptr };
|
std::function<void(wxWindow* win)> rescale_extra_column_item { nullptr };
|
||||||
std::function<void(wxWindow* win)> rescale_near_label_widget { nullptr };
|
std::function<void(wxWindow* win)> rescale_near_label_widget { nullptr };
|
||||||
|
|
||||||
|
std::function<void(const t_config_option_key& opt_key)> edit_custom_gcode { nullptr };
|
||||||
|
|
||||||
wxFont sidetext_font {wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
|
wxFont sidetext_font {wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
|
||||||
wxFont label_font {wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
|
wxFont label_font {wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
|
||||||
int sidetext_width{ -1 };
|
int sidetext_width{ -1 };
|
||||||
|
|
|
@ -252,6 +252,8 @@ void Tab::create_preset_tab()
|
||||||
// Bitmaps to be shown on the "Undo user changes" button next to each input field.
|
// Bitmaps to be shown on the "Undo user changes" button next to each input field.
|
||||||
add_scaled_bitmap(this, m_bmp_value_revert, "undo");
|
add_scaled_bitmap(this, m_bmp_value_revert, "undo");
|
||||||
add_scaled_bitmap(this, m_bmp_white_bullet, "dot");
|
add_scaled_bitmap(this, m_bmp_white_bullet, "dot");
|
||||||
|
// Bitmap to be shown on the "edit" button before to each editable input field.
|
||||||
|
add_scaled_bitmap(this, m_bmp_edit_value, "edit");
|
||||||
|
|
||||||
set_tooltips_text();
|
set_tooltips_text();
|
||||||
|
|
||||||
|
@ -817,6 +819,10 @@ void Tab::decorate()
|
||||||
field->set_undo_tooltip(tt);
|
field->set_undo_tooltip(tt);
|
||||||
field->set_undo_to_sys_tooltip(sys_tt);
|
field->set_undo_to_sys_tooltip(sys_tt);
|
||||||
field->set_label_colour(color);
|
field->set_label_colour(color);
|
||||||
|
|
||||||
|
if (field->has_edit_ui())
|
||||||
|
field->set_edit_bitmap(&m_bmp_edit_value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_active_page)
|
if (m_active_page)
|
||||||
|
@ -2860,6 +2866,11 @@ static void validate_custom_gcode_cb(Tab* tab, ConfigOptionsGroupShp opt_group,
|
||||||
tab->on_value_change(opt_key, value);
|
tab->on_value_change(opt_key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Tab::edit_custom_gcode(const t_config_option_key& opt_key)
|
||||||
|
{
|
||||||
|
MessageDialog(this, format_wxstr("Edit gcode for %1%", opt_key), this->title()).ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
void TabFilament::add_filament_overrides_page()
|
void TabFilament::add_filament_overrides_page()
|
||||||
{
|
{
|
||||||
//BBS
|
//BBS
|
||||||
|
@ -3134,11 +3145,14 @@ void TabFilament::build()
|
||||||
const int gcode_field_height = 15; // 150
|
const int gcode_field_height = 15; // 150
|
||||||
const int notes_field_height = 25; // 250
|
const int notes_field_height = 25; // 250
|
||||||
|
|
||||||
|
auto edit_custom_gcode_fn = [this](const t_config_option_key& opt_key) { edit_custom_gcode(opt_key); };
|
||||||
|
|
||||||
page = add_options_page(L("Advanced"), "advanced");
|
page = add_options_page(L("Advanced"), "advanced");
|
||||||
optgroup = page->new_optgroup(L("Filament start G-code"), L"param_gcode", 0);
|
optgroup = page->new_optgroup(L("Filament start G-code"), L"param_gcode", 0);
|
||||||
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
||||||
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
||||||
};
|
};
|
||||||
|
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
|
||||||
option = optgroup->get_option("filament_start_gcode");
|
option = optgroup->get_option("filament_start_gcode");
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
|
@ -3149,6 +3163,7 @@ void TabFilament::build()
|
||||||
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
||||||
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
||||||
};
|
};
|
||||||
|
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
|
||||||
option = optgroup->get_option("filament_end_gcode");
|
option = optgroup->get_option("filament_end_gcode");
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
|
@ -3450,6 +3465,8 @@ void TabPrinter::build_fff()
|
||||||
optgroup->append_single_option_line("support_chamber_temp_control", "chamber-temperature");
|
optgroup->append_single_option_line("support_chamber_temp_control", "chamber-temperature");
|
||||||
optgroup->append_single_option_line("support_air_filtration", "air-filtration");
|
optgroup->append_single_option_line("support_air_filtration", "air-filtration");
|
||||||
|
|
||||||
|
auto edit_custom_gcode_fn = [this](const t_config_option_key& opt_key) { edit_custom_gcode(opt_key); };
|
||||||
|
|
||||||
const int gcode_field_height = 15; // 150
|
const int gcode_field_height = 15; // 150
|
||||||
const int notes_field_height = 25; // 250
|
const int notes_field_height = 25; // 250
|
||||||
page = add_options_page(L("Machine gcode"), "cog");
|
page = add_options_page(L("Machine gcode"), "cog");
|
||||||
|
@ -3457,6 +3474,7 @@ void TabPrinter::build_fff()
|
||||||
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
||||||
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
||||||
};
|
};
|
||||||
|
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
|
||||||
option = optgroup->get_option("machine_start_gcode");
|
option = optgroup->get_option("machine_start_gcode");
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
|
@ -3467,6 +3485,7 @@ void TabPrinter::build_fff()
|
||||||
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
||||||
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
||||||
};
|
};
|
||||||
|
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
|
||||||
option = optgroup->get_option("machine_end_gcode");
|
option = optgroup->get_option("machine_end_gcode");
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
|
@ -3477,6 +3496,7 @@ void TabPrinter::build_fff()
|
||||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key &opt_key, const boost::any &value) {
|
optgroup->m_on_change = [this, optgroup](const t_config_option_key &opt_key, const boost::any &value) {
|
||||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||||
};
|
};
|
||||||
|
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
|
||||||
option = optgroup->get_option("printing_by_object_gcode");
|
option = optgroup->get_option("printing_by_object_gcode");
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
|
@ -3488,6 +3508,7 @@ void TabPrinter::build_fff()
|
||||||
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
||||||
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
||||||
};
|
};
|
||||||
|
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
|
||||||
option = optgroup->get_option("before_layer_change_gcode");
|
option = optgroup->get_option("before_layer_change_gcode");
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
|
@ -3498,6 +3519,7 @@ void TabPrinter::build_fff()
|
||||||
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
||||||
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
||||||
};
|
};
|
||||||
|
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
|
||||||
option = optgroup->get_option("layer_change_gcode");
|
option = optgroup->get_option("layer_change_gcode");
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
|
@ -3508,6 +3530,7 @@ void TabPrinter::build_fff()
|
||||||
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
||||||
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
||||||
};
|
};
|
||||||
|
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
|
||||||
option = optgroup->get_option("time_lapse_gcode");
|
option = optgroup->get_option("time_lapse_gcode");
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
|
@ -3518,6 +3541,7 @@ void TabPrinter::build_fff()
|
||||||
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
||||||
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
||||||
};
|
};
|
||||||
|
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
|
||||||
option = optgroup->get_option("change_filament_gcode");
|
option = optgroup->get_option("change_filament_gcode");
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
|
@ -3528,7 +3552,7 @@ void TabPrinter::build_fff()
|
||||||
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key &opt_key, const boost::any &value) {
|
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key &opt_key, const boost::any &value) {
|
||||||
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
||||||
};
|
};
|
||||||
|
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
|
||||||
option = optgroup->get_option("change_extrusion_role_gcode");
|
option = optgroup->get_option("change_extrusion_role_gcode");
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
|
@ -3539,6 +3563,7 @@ void TabPrinter::build_fff()
|
||||||
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
||||||
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
||||||
};
|
};
|
||||||
|
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
|
||||||
option = optgroup->get_option("machine_pause_gcode");
|
option = optgroup->get_option("machine_pause_gcode");
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
option.opt.height = gcode_field_height;//150;
|
option.opt.height = gcode_field_height;//150;
|
||||||
|
@ -3548,6 +3573,7 @@ void TabPrinter::build_fff()
|
||||||
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
||||||
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
||||||
};
|
};
|
||||||
|
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
|
||||||
option = optgroup->get_option("template_custom_gcode");
|
option = optgroup->get_option("template_custom_gcode");
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
option.opt.height = gcode_field_height;//150;
|
option.opt.height = gcode_field_height;//150;
|
||||||
|
|
|
@ -196,6 +196,8 @@ protected:
|
||||||
ScalableBitmap *m_bmp_non_system;
|
ScalableBitmap *m_bmp_non_system;
|
||||||
// Bitmaps to be shown on the "Undo user changes" button next to each input field.
|
// Bitmaps to be shown on the "Undo user changes" button next to each input field.
|
||||||
ScalableBitmap m_bmp_value_revert;
|
ScalableBitmap m_bmp_value_revert;
|
||||||
|
// Bitmaps to be shown on the "Undo user changes" button next to each input field.
|
||||||
|
ScalableBitmap m_bmp_edit_value;
|
||||||
|
|
||||||
std::vector<ScalableButton*> m_scaled_buttons = {};
|
std::vector<ScalableButton*> m_scaled_buttons = {};
|
||||||
std::vector<ScalableBitmap*> m_scaled_bitmaps = {};
|
std::vector<ScalableBitmap*> m_scaled_bitmaps = {};
|
||||||
|
@ -402,6 +404,7 @@ public:
|
||||||
void restore_last_select_item();
|
void restore_last_select_item();
|
||||||
|
|
||||||
static bool validate_custom_gcode(const wxString& title, const std::string& gcode);
|
static bool validate_custom_gcode(const wxString& title, const std::string& gcode);
|
||||||
|
void edit_custom_gcode(const t_config_option_key &opt_key);
|
||||||
bool validate_custom_gcodes();
|
bool validate_custom_gcodes();
|
||||||
bool validate_custom_gcodes_was_shown{ false };
|
bool validate_custom_gcodes_was_shown{ false };
|
||||||
void set_just_edit(bool just_edit);
|
void set_just_edit(bool just_edit);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue