mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
DoubleSlider: Suppressed manipulation for sequential print.
+ some code refactoring + experiment with alignment of several options inside the Line
This commit is contained in:
parent
f8c5855d55
commit
1399696b04
6 changed files with 60 additions and 27 deletions
|
@ -332,6 +332,13 @@ void Control::SetTicksValues(const CustomGCode::Info& custom_gcode_per_print_z)
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Control::SetDrawMode(bool is_sla_print, bool is_sequential_print)
|
||||||
|
{
|
||||||
|
m_draw_mode = is_sla_print ? dmSlaPrint :
|
||||||
|
is_sequential_print ? dmSequentialFffPrint :
|
||||||
|
dmRegular;
|
||||||
|
}
|
||||||
|
|
||||||
void Control::SetModeAndOnlyExtruder(const bool is_one_extruder_printed_model, const int only_extruder)
|
void Control::SetModeAndOnlyExtruder(const bool is_one_extruder_printed_model, const int only_extruder)
|
||||||
{
|
{
|
||||||
m_mode = !is_one_extruder_printed_model ? t_mode::MultiExtruder :
|
m_mode = !is_one_extruder_printed_model ? t_mode::MultiExtruder :
|
||||||
|
@ -441,7 +448,7 @@ void Control::draw_info_line_with_icon(wxDC& dc, const wxPoint& pos, const Selec
|
||||||
dc.DrawLine(pt_beg, pt_end);
|
dc.DrawLine(pt_beg, pt_end);
|
||||||
|
|
||||||
//draw action icon
|
//draw action icon
|
||||||
if (m_is_enabled_tick_manipulation)
|
if (m_draw_mode == dmRegular)
|
||||||
draw_action_icon(dc, pt_beg, pt_end);
|
draw_action_icon(dc, pt_beg, pt_end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -612,10 +619,10 @@ void Control::draw_thumbs(wxDC& dc, const wxCoord& lower_pos, const wxCoord& hig
|
||||||
|
|
||||||
void Control::draw_ticks(wxDC& dc)
|
void Control::draw_ticks(wxDC& dc)
|
||||||
{
|
{
|
||||||
if (!m_is_enabled_tick_manipulation)
|
if (m_draw_mode == dmSlaPrint)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dc.SetPen(m_is_enabled_tick_manipulation ? DARK_GREY_PEN : LIGHT_GREY_PEN );
|
dc.SetPen(m_draw_mode == dmRegular ? DARK_GREY_PEN : LIGHT_GREY_PEN );
|
||||||
int height, width;
|
int height, width;
|
||||||
get_size(&width, &height);
|
get_size(&width, &height);
|
||||||
const wxCoord mid = is_horizontal() ? 0.5*height : 0.5*width;
|
const wxCoord mid = is_horizontal() ? 0.5*height : 0.5*width;
|
||||||
|
@ -633,7 +640,11 @@ void Control::draw_ticks(wxDC& dc)
|
||||||
|
|
||||||
// get icon name if it is
|
// get icon name if it is
|
||||||
std::string icon_name;
|
std::string icon_name;
|
||||||
if (tick.gcode == ColorChangeCode || tick.gcode == ToolChangeCode) {
|
|
||||||
|
// if we have non-regular draw mode, all ticks should be marked with error icon
|
||||||
|
if (m_draw_mode != dmRegular)
|
||||||
|
icon_name = focused_tick ? "error_tick_f" : "error_tick";
|
||||||
|
else if (tick.gcode == ColorChangeCode || tick.gcode == ToolChangeCode) {
|
||||||
if (m_ticks.is_conflict_tick(tick, m_mode, m_only_extruder, m_values[tick.tick]))
|
if (m_ticks.is_conflict_tick(tick, m_mode, m_only_extruder, m_values[tick.tick]))
|
||||||
icon_name = focused_tick ? "error_tick_f" : "error_tick";
|
icon_name = focused_tick ? "error_tick_f" : "error_tick";
|
||||||
}
|
}
|
||||||
|
@ -705,7 +716,7 @@ wxRect Control::get_colored_band_rect()
|
||||||
|
|
||||||
void Control::draw_colored_band(wxDC& dc)
|
void Control::draw_colored_band(wxDC& dc)
|
||||||
{
|
{
|
||||||
if (!m_is_enabled_tick_manipulation)
|
if (m_draw_mode != dmRegular)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto draw_band = [](wxDC& dc, const wxColour& clr, const wxRect& band_rc)
|
auto draw_band = [](wxDC& dc, const wxColour& clr, const wxRect& band_rc)
|
||||||
|
@ -771,7 +782,7 @@ void Control::draw_one_layer_icon(wxDC& dc)
|
||||||
|
|
||||||
void Control::draw_revert_icon(wxDC& dc)
|
void Control::draw_revert_icon(wxDC& dc)
|
||||||
{
|
{
|
||||||
if (m_ticks.empty() || !m_is_enabled_tick_manipulation)
|
if (m_ticks.empty() || m_draw_mode != dmRegular)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
|
@ -880,7 +891,7 @@ void Control::OnLeftDown(wxMouseEvent& event)
|
||||||
m_mouse = maOneLayerIconClick;
|
m_mouse = maOneLayerIconClick;
|
||||||
else if (is_point_in_rect(pos, m_rect_cog_icon))
|
else if (is_point_in_rect(pos, m_rect_cog_icon))
|
||||||
m_mouse = maCogIconClick;
|
m_mouse = maCogIconClick;
|
||||||
else if (m_is_enabled_tick_manipulation)
|
else if (m_draw_mode == dmRegular)
|
||||||
{
|
{
|
||||||
if (is_point_in_rect(pos, m_rect_tick_action)) {
|
if (is_point_in_rect(pos, m_rect_tick_action)) {
|
||||||
auto it = m_ticks.ticks.find(TickCode{ m_selection == ssLower ? m_lower_value : m_higher_value });
|
auto it = m_ticks.ticks.find(TickCode{ m_selection == ssLower ? m_lower_value : m_higher_value });
|
||||||
|
@ -931,6 +942,8 @@ wxString Control::get_tooltip(int tick/*=-1*/)
|
||||||
if (m_focus == fiColorBand)
|
if (m_focus == fiColorBand)
|
||||||
return m_mode != t_mode::SingleExtruder ? "" :
|
return m_mode != t_mode::SingleExtruder ? "" :
|
||||||
_(L("Edit current color - Right click the colored slider segment"));
|
_(L("Edit current color - Right click the colored slider segment"));
|
||||||
|
if (m_draw_mode == dmSlaPrint)
|
||||||
|
return ""; // no drawn ticks and no tooltips for them in SlaPrinting mode
|
||||||
|
|
||||||
wxString tooltip;
|
wxString tooltip;
|
||||||
const auto tick_code_it = m_ticks.ticks.find(TickCode{tick});
|
const auto tick_code_it = m_ticks.ticks.find(TickCode{tick});
|
||||||
|
@ -953,9 +966,9 @@ wxString Control::get_tooltip(int tick/*=-1*/)
|
||||||
// Show list of actions with new tick
|
// Show list of actions with new tick
|
||||||
tooltip += ( m_mode == t_mode::MultiAsSingle ?
|
tooltip += ( m_mode == t_mode::MultiAsSingle ?
|
||||||
_(L("Add extruder change - Left click")) :
|
_(L("Add extruder change - Left click")) :
|
||||||
m_mode == t_mode::SingleExtruder ?
|
m_mode == t_mode::SingleExtruder ?
|
||||||
_(L("Add color change - Left click for predefined color or"
|
_(L("Add color change - Left click for predefined color or"
|
||||||
"Shift + Left click for custom color selection")) :
|
"Shift + Left click for custom color selection")) :
|
||||||
_(L("Add color change - Left click")) ) + " " +
|
_(L("Add color change - Left click")) ) + " " +
|
||||||
_(L("or press \"+\" key")) + "\n" + (
|
_(L("or press \"+\" key")) + "\n" + (
|
||||||
is_osx ?
|
is_osx ?
|
||||||
|
@ -965,17 +978,22 @@ wxString Control::get_tooltip(int tick/*=-1*/)
|
||||||
|
|
||||||
if (tick_code_it != m_ticks.ticks.end()) // tick exists
|
if (tick_code_it != m_ticks.ticks.end()) // tick exists
|
||||||
{
|
{
|
||||||
|
if (m_draw_mode == dmSequentialFffPrint)
|
||||||
|
return _(L("The sequential print is on.\n"
|
||||||
|
"It's impossible to apply any custom G-code for objects printing sequentually.\n"
|
||||||
|
"This code won't be processed during G-code generation."));
|
||||||
|
|
||||||
// Show custom Gcode as a first string of tooltop
|
// Show custom Gcode as a first string of tooltop
|
||||||
tooltip = " ";
|
tooltip = " ";
|
||||||
tooltip += tick_code_it->gcode == ColorChangeCode ? (
|
tooltip += tick_code_it->gcode == ColorChangeCode ? ( m_mode == t_mode::SingleExtruder ?
|
||||||
m_mode == t_mode::SingleExtruder ?
|
|
||||||
from_u8((boost::format(_utf8(L("Color change (\"%1%\")"))) % tick_code_it->gcode ).str()) :
|
from_u8((boost::format(_utf8(L("Color change (\"%1%\")"))) % tick_code_it->gcode ).str()) :
|
||||||
from_u8((boost::format(_utf8(L("Color change (\"%1%\") for Extruder %2%"))) %
|
from_u8((boost::format(_utf8(L("Color change (\"%1%\") for Extruder %2%"))) %
|
||||||
tick_code_it->gcode % tick_code_it->extruder).str()) ) :
|
tick_code_it->gcode % tick_code_it->extruder).str()) ) :
|
||||||
tick_code_it->gcode == PausePrintCode ?
|
tick_code_it->gcode == PausePrintCode ?
|
||||||
from_u8((boost::format(_utf8(L("Pause print (\"%1%\")"))) % tick_code_it->gcode ).str()) :
|
from_u8((boost::format(_utf8(L("Pause print (\"%1%\")"))) % tick_code_it->gcode ).str()) :
|
||||||
tick_code_it->gcode == ToolChangeCode ?
|
tick_code_it->gcode == ToolChangeCode ?
|
||||||
from_u8((boost::format(_utf8(L("Extruder (tool) is changed to Extruder \"%1%\""))) % tick_code_it->extruder ).str()) :
|
from_u8((boost::format(_utf8(L("Extruder (tool) is changed to Extruder \"%1%\""))) %
|
||||||
|
tick_code_it->extruder ).str()) :
|
||||||
from_u8((boost::format(_utf8(L("\"%1%\""))) % tick_code_it->gcode ).str()) ;
|
from_u8((boost::format(_utf8(L("\"%1%\""))) % tick_code_it->gcode ).str()) ;
|
||||||
|
|
||||||
// If tick is marked as a conflict (exclamation icon),
|
// If tick is marked as a conflict (exclamation icon),
|
||||||
|
@ -1169,7 +1187,7 @@ void Control::OnLeftUp(wxMouseEvent& event)
|
||||||
add_current_tick();
|
add_current_tick();
|
||||||
break;
|
break;
|
||||||
case maCogIconClick :
|
case maCogIconClick :
|
||||||
if (m_mode == t_mode::MultiAsSingle)
|
if (m_mode == t_mode::MultiAsSingle && m_draw_mode == dmRegular)
|
||||||
show_cog_icon_context_menu();
|
show_cog_icon_context_menu();
|
||||||
else
|
else
|
||||||
jump_to_print_z();
|
jump_to_print_z();
|
||||||
|
@ -1320,7 +1338,7 @@ void Control::OnRightDown(wxMouseEvent& event)
|
||||||
const wxPoint pos = event.GetLogicalPosition(wxClientDC(this));
|
const wxPoint pos = event.GetLogicalPosition(wxClientDC(this));
|
||||||
|
|
||||||
m_mouse = maNone;
|
m_mouse = maNone;
|
||||||
if (m_is_enabled_tick_manipulation) {
|
if (m_draw_mode == dmRegular) {
|
||||||
if (is_point_in_rect(pos, m_rect_tick_action))
|
if (is_point_in_rect(pos, m_rect_tick_action))
|
||||||
{
|
{
|
||||||
const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
|
const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
|
||||||
|
@ -1766,7 +1784,7 @@ void Control::discard_all_thicks()
|
||||||
void Control::move_current_thumb_to_pos(wxPoint pos)
|
void Control::move_current_thumb_to_pos(wxPoint pos)
|
||||||
{
|
{
|
||||||
const int tick_val = get_tick_near_point(pos);
|
const int tick_val = get_tick_near_point(pos);
|
||||||
const int mouse_val = tick_val >= 0 && m_is_enabled_tick_manipulation ? tick_val :
|
const int mouse_val = tick_val >= 0 && m_draw_mode == dmRegular ? tick_val :
|
||||||
get_value_from_position(pos);
|
get_value_from_position(pos);
|
||||||
if (mouse_val >= 0)
|
if (mouse_val >= 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,6 +66,13 @@ enum MouseAction
|
||||||
maRevertIconClick, // LeftMouseClick on "revert" icon
|
maRevertIconClick, // LeftMouseClick on "revert" icon
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum DrawMode
|
||||||
|
{
|
||||||
|
dmRegular,
|
||||||
|
dmSlaPrint,
|
||||||
|
dmSequentialFffPrint,
|
||||||
|
};
|
||||||
|
|
||||||
using t_mode = CustomGCode::Mode;
|
using t_mode = CustomGCode::Mode;
|
||||||
|
|
||||||
struct TickCode
|
struct TickCode
|
||||||
|
@ -197,8 +204,7 @@ public:
|
||||||
CustomGCode::Info GetTicksValues() const;
|
CustomGCode::Info GetTicksValues() const;
|
||||||
void SetTicksValues(const Slic3r::CustomGCode::Info &custom_gcode_per_print_z);
|
void SetTicksValues(const Slic3r::CustomGCode::Info &custom_gcode_per_print_z);
|
||||||
|
|
||||||
void EnableTickManipulation(bool enable = true) { m_is_enabled_tick_manipulation = enable; }
|
void SetDrawMode(bool is_sla_print, bool is_sequential_print);
|
||||||
void DisableTickManipulation() { EnableTickManipulation(false); }
|
|
||||||
|
|
||||||
void SetManipulationMode(t_mode mode) { m_mode = mode; }
|
void SetManipulationMode(t_mode mode) { m_mode = mode; }
|
||||||
t_mode GetManipulationMode() const { return m_mode; }
|
t_mode GetManipulationMode() const { return m_mode; }
|
||||||
|
@ -323,9 +329,10 @@ private:
|
||||||
bool m_is_right_down = false;
|
bool m_is_right_down = false;
|
||||||
bool m_is_one_layer = false;
|
bool m_is_one_layer = false;
|
||||||
bool m_is_focused = false;
|
bool m_is_focused = false;
|
||||||
bool m_is_enabled_tick_manipulation = true;
|
|
||||||
bool m_force_mode_apply = true;
|
bool m_force_mode_apply = true;
|
||||||
|
|
||||||
|
DrawMode m_draw_mode = dmRegular;
|
||||||
|
|
||||||
t_mode m_mode = t_mode::SingleExtruder;
|
t_mode m_mode = t_mode::SingleExtruder;
|
||||||
int m_only_extruder = -1;
|
int m_only_extruder = -1;
|
||||||
|
|
||||||
|
|
|
@ -586,7 +586,9 @@ void Preview::update_view_type(bool slice_completed)
|
||||||
void Preview::create_double_slider()
|
void Preview::create_double_slider()
|
||||||
{
|
{
|
||||||
m_slider = new DoubleSlider::Control(this, wxID_ANY, 0, 0, 0, 100);
|
m_slider = new DoubleSlider::Control(this, wxID_ANY, 0, 0, 0, 100);
|
||||||
m_slider->EnableTickManipulation(wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptFFF);
|
bool sla_print_technology = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA;
|
||||||
|
bool sequential_print = wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_bool("complete_objects");
|
||||||
|
m_slider->SetDrawMode(sla_print_technology, sequential_print);
|
||||||
|
|
||||||
m_double_slider_sizer->Add(m_slider, 0, wxEXPAND, 0);
|
m_double_slider_sizer->Add(m_slider, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
|
@ -700,7 +702,9 @@ void Preview::update_double_slider(const std::vector<double>& layers_z, bool kee
|
||||||
|
|
||||||
m_slider->SetTicksValues(ticks_info_from_model);
|
m_slider->SetTicksValues(ticks_info_from_model);
|
||||||
|
|
||||||
m_slider->EnableTickManipulation(wxGetApp().plater()->printer_technology() == ptFFF);
|
bool sla_print_technology = wxGetApp().plater()->printer_technology() == ptSLA;
|
||||||
|
bool sequential_print = wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_bool("complete_objects");
|
||||||
|
m_slider->SetDrawMode(sla_print_technology, sequential_print);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preview::update_double_slider_mode()
|
void Preview::update_double_slider_mode()
|
||||||
|
|
|
@ -129,8 +129,11 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
|
||||||
m_options.emplace(opt.opt_id, opt);
|
m_options.emplace(opt.opt_id, opt);
|
||||||
|
|
||||||
// Set sidetext width for a better alignment of options in line
|
// Set sidetext width for a better alignment of options in line
|
||||||
if (option_set.size() > 1)
|
if (option_set.size() > 1) {
|
||||||
sidetext_width = Field::def_width_thinner();
|
sidetext_width = Field::def_width_thinner();
|
||||||
|
if (m_show_modified_btns) // means that options groups are in tabs
|
||||||
|
sublabel_width = Field::def_width();
|
||||||
|
}
|
||||||
|
|
||||||
// add mode value for current line to m_options_mode
|
// add mode value for current line to m_options_mode
|
||||||
if (!option_set.empty())
|
if (!option_set.empty())
|
||||||
|
@ -248,15 +251,16 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
|
||||||
ConfigOptionDef option = opt.opt;
|
ConfigOptionDef option = opt.opt;
|
||||||
wxSizer* sizer_tmp = sizer;
|
wxSizer* sizer_tmp = sizer;
|
||||||
// add label if any
|
// add label if any
|
||||||
if (option.label != "") {
|
if (!option.label.empty()) {
|
||||||
//! To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
|
//! To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
|
||||||
wxString str_label = (option.label == L_CONTEXT("Top", "Layers") || option.label == L_CONTEXT("Bottom", "Layers")) ?
|
wxString str_label = (option.label == L_CONTEXT("Top", "Layers") || option.label == L_CONTEXT("Bottom", "Layers")) ?
|
||||||
_CTX(option.label, "Layers") :
|
_CTX(option.label, "Layers") :
|
||||||
_(option.label);
|
_(option.label);
|
||||||
label = new wxStaticText(this->ctrl_parent(), wxID_ANY, str_label + ": ", wxDefaultPosition, wxDefaultSize);
|
label = new wxStaticText(this->ctrl_parent(), wxID_ANY, str_label + ": ", wxDefaultPosition, //wxDefaultSize);
|
||||||
|
wxSize(sublabel_width != -1 ? sublabel_width * wxGetApp().em_unit() : -1, -1), wxALIGN_RIGHT);
|
||||||
label->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
label->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
label->SetFont(wxGetApp().normal_font());
|
label->SetFont(wxGetApp().normal_font());
|
||||||
sizer_tmp->Add(label, 0, /*wxALIGN_RIGHT |*/ wxALIGN_CENTER_VERTICAL, 0);
|
sizer_tmp->Add(label, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add field
|
// add field
|
||||||
|
|
|
@ -97,6 +97,7 @@ public:
|
||||||
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 };
|
||||||
|
int sublabel_width{ -1 };
|
||||||
|
|
||||||
/// Returns a copy of the pointer of the parent wxWindow.
|
/// Returns a copy of the pointer of the parent wxWindow.
|
||||||
/// Accessor function is because users are not allowed to change the parent
|
/// Accessor function is because users are not allowed to change the parent
|
||||||
|
|
|
@ -3505,7 +3505,6 @@ void TabSLAMaterial::build()
|
||||||
optgroup->append_single_option_line("initial_exposure_time");
|
optgroup->append_single_option_line("initial_exposure_time");
|
||||||
|
|
||||||
optgroup = page->new_optgroup(_(L("Corrections")));
|
optgroup = page->new_optgroup(_(L("Corrections")));
|
||||||
optgroup->label_width = 19;//190;
|
|
||||||
std::vector<std::string> corrections = {"material_correction"};
|
std::vector<std::string> corrections = {"material_correction"};
|
||||||
// std::vector<std::string> axes{ "X", "Y", "Z" };
|
// std::vector<std::string> axes{ "X", "Y", "Z" };
|
||||||
std::vector<std::string> axes{ "XY", "Z" };
|
std::vector<std::string> axes{ "XY", "Z" };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue