Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_shortcuts_dialog

This commit is contained in:
Enrico Turri 2020-02-12 15:01:53 +01:00
commit 4d556b40d1
9 changed files with 1377 additions and 1354 deletions

File diff suppressed because it is too large Load Diff

View File

@ -64,7 +64,7 @@ std::string PrintBase::output_filename(const std::string &format, const std::str
boost::filesystem::path filename = format.empty() ? boost::filesystem::path filename = format.empty() ?
cfg.opt_string("input_filename_base") + default_ext : cfg.opt_string("input_filename_base") + default_ext :
this->placeholder_parser().process(format, 0, &cfg); this->placeholder_parser().process(format, 0, &cfg);
if (filename.extension().empty()) if (filename.extension().string() != default_ext)
filename = boost::filesystem::change_extension(filename, default_ext); filename = boost::filesystem::change_extension(filename, default_ext);
return filename.string(); return filename.string();
} catch (std::runtime_error &err) { } catch (std::runtime_error &err) {

View File

@ -573,7 +573,6 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("If layer print time is estimated below this number of seconds, fan will be enabled " def->tooltip = L("If layer print time is estimated below this number of seconds, fan will be enabled "
"and its speed will be calculated by interpolating the minimum and maximum speeds."); "and its speed will be calculated by interpolating the minimum and maximum speeds.");
def->sidetext = L("approximate seconds"); def->sidetext = L("approximate seconds");
def->width = 6;
def->min = 0; def->min = 0;
def->max = 1000; def->max = 1000;
def->mode = comExpert; def->mode = comExpert;
@ -1104,7 +1103,6 @@ void PrintConfigDef::init_fff_params()
def->mode = comExpert; def->mode = comExpert;
def->set_default_value(new ConfigOptionBool(true)); def->set_default_value(new ConfigOptionBool(true));
const int machine_limits_opt_width = 7;
{ {
struct AxisDefault { struct AxisDefault {
std::string name; std::string name;
@ -1136,7 +1134,6 @@ void PrintConfigDef::init_fff_params()
(void)L("Maximum feedrate of the E axis"); (void)L("Maximum feedrate of the E axis");
def->sidetext = L("mm/s"); def->sidetext = L("mm/s");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width;
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats(axis.max_feedrate)); def->set_default_value(new ConfigOptionFloats(axis.max_feedrate));
// Add the machine acceleration limits for XYZE axes (M201) // Add the machine acceleration limits for XYZE axes (M201)
@ -1154,7 +1151,6 @@ void PrintConfigDef::init_fff_params()
(void)L("Maximum acceleration of the E axis"); (void)L("Maximum acceleration of the E axis");
def->sidetext = L("mm/s²"); def->sidetext = L("mm/s²");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width;
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats(axis.max_acceleration)); def->set_default_value(new ConfigOptionFloats(axis.max_acceleration));
// Add the machine jerk limits for XYZE axes (M205) // Add the machine jerk limits for XYZE axes (M205)
@ -1172,7 +1168,6 @@ void PrintConfigDef::init_fff_params()
(void)L("Maximum jerk of the E axis"); (void)L("Maximum jerk of the E axis");
def->sidetext = L("mm/s"); def->sidetext = L("mm/s");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width;
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats(axis.max_jerk)); def->set_default_value(new ConfigOptionFloats(axis.max_jerk));
} }
@ -1185,7 +1180,6 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Minimum feedrate when extruding (M205 S)"); def->tooltip = L("Minimum feedrate when extruding (M205 S)");
def->sidetext = L("mm/s"); def->sidetext = L("mm/s");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width;
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{ 0., 0. }); def->set_default_value(new ConfigOptionFloats{ 0., 0. });
@ -1196,7 +1190,6 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Minimum travel feedrate (M205 T)"); def->tooltip = L("Minimum travel feedrate (M205 T)");
def->sidetext = L("mm/s"); def->sidetext = L("mm/s");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width;
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{ 0., 0. }); def->set_default_value(new ConfigOptionFloats{ 0., 0. });
@ -1207,7 +1200,6 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Maximum acceleration when extruding (M204 S)"); def->tooltip = L("Maximum acceleration when extruding (M204 S)");
def->sidetext = L("mm/s²"); def->sidetext = L("mm/s²");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width;
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{ 1500., 1250. }); def->set_default_value(new ConfigOptionFloats{ 1500., 1250. });
@ -1218,7 +1210,6 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Maximum acceleration when retracting (M204 T)"); def->tooltip = L("Maximum acceleration when retracting (M204 T)");
def->sidetext = L("mm/s²"); def->sidetext = L("mm/s²");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width;
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{ 1500., 1250. }); def->set_default_value(new ConfigOptionFloats{ 1500., 1250. });
@ -1715,7 +1706,6 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("If layer print time is estimated below this number of seconds, print moves " def->tooltip = L("If layer print time is estimated below this number of seconds, print moves "
"speed will be scaled down to extend duration to this value."); "speed will be scaled down to extend duration to this value.");
def->sidetext = L("approximate seconds"); def->sidetext = L("approximate seconds");
def->width = 6;
def->min = 0; def->min = 0;
def->max = 1000; def->max = 1000;
def->mode = comExpert; def->mode = comExpert;

View File

@ -76,7 +76,7 @@ Control::Control( wxWindow *parent,
m_cog_icon_dim = m_bmp_cog.GetBmpWidth(); m_cog_icon_dim = m_bmp_cog.GetBmpWidth();
m_selection = ssUndef; m_selection = ssUndef;
m_ticks.set_pause_print_msg(_utf8(L("Place bearings in slots and resume"))); m_ticks.set_pause_print_msg(_utf8(L("Place bearings in slots and resume printing")));
// slider events // slider events
this->Bind(wxEVT_PAINT, &Control::OnPaint, this); this->Bind(wxEVT_PAINT, &Control::OnPaint, this);
@ -925,12 +925,12 @@ wxString Control::get_tooltip(int tick/*=-1*/)
return _(L("Discard all custom changes")); return _(L("Discard all custom changes"));
if (m_focus == fiCogIcon) if (m_focus == fiCogIcon)
return m_mode == t_mode::MultiAsSingle ? return m_mode == t_mode::MultiAsSingle ?
_(L("For jump to print Z use left mouse button click OR (Shift+G)")) + "\n" + wxString::Format(_(L("Jump to height %s or "
_(L("For set extruder sequence for whole print use right mouse button click")) : "Set extruder sequence for the entire print")), " (Shift + G)\n") :
_(L("Jump to print Z")) + " (Shift+G)"; _(L("Jump to height")) + " (Shift + G)";
if (m_focus == fiColorBand) if (m_focus == fiColorBand)
return m_mode != t_mode::SingleExtruder ? "" : return m_mode != t_mode::SingleExtruder ? "" :
_(L("For edit current color use right mouse button click on colored band")); _(L("Edit current color - Right click the colored slider segment"));
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});
@ -938,7 +938,7 @@ wxString Control::get_tooltip(int tick/*=-1*/)
if (tick_code_it == m_ticks.ticks.end() && m_focus == fiActionIcon) // tick doesn't exist if (tick_code_it == m_ticks.ticks.end() && m_focus == fiActionIcon) // tick doesn't exist
{ {
// Show mode as a first string of tooltop // Show mode as a first string of tooltop
tooltip = " " + _(L("Slider(print) mode")) + ": "; tooltip = " " + _(L("Print mode")) + ": ";
tooltip += (m_mode == t_mode::SingleExtruder ? CustomGCode::SingleExtruderMode : tooltip += (m_mode == t_mode::SingleExtruder ? CustomGCode::SingleExtruderMode :
m_mode == t_mode::MultiAsSingle ? CustomGCode::MultiAsSingleMode : m_mode == t_mode::MultiAsSingle ? CustomGCode::MultiAsSingleMode :
CustomGCode::MultiExtruderMode ); CustomGCode::MultiExtruderMode );
@ -952,16 +952,15 @@ 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("For add change extruder use left mouse button click")) : _(L("Add extruder change - Left click")) :
m_mode == t_mode::SingleExtruder ? m_mode == t_mode::SingleExtruder ?
_(L("For add color change use left mouse button click " _(L("Add color change - Left click for predefined color or"
"if you want to use colors from default color list, " "Shift + Left click for custom color selection")) :
"or Shift + left mouse button click if you want to select a color")) : _(L("Add color change - Left click")) ) + " " +
_(L("For add color change use left mouse button click")) ) + " " + _(L("or press \"+\" key")) + "\n" + (
_(L("OR pres \"+\" key")) + "\n" + (
is_osx ? is_osx ?
_(L("For add another code use Ctrl + left mouse button click")) : _(L("Add another code - Ctrl + Left click")) :
_(L("For add another code use right mouse button click")) ); _(L("Add another code - Right click")) );
} }
if (tick_code_it != m_ticks.ticks.end()) // tick exists if (tick_code_it != m_ticks.ticks.end()) // tick exists
@ -985,24 +984,24 @@ wxString Control::get_tooltip(int tick/*=-1*/)
if (conflict != ctNone) if (conflict != ctNone)
tooltip += "\n\n" + _(L("Note")) + "! "; tooltip += "\n\n" + _(L("Note")) + "! ";
if (conflict == ctModeConflict) if (conflict == ctModeConflict)
tooltip += _(L("G-code of this tick has a conflict with slider(print) mode.\n" tooltip += _(L("G-code associated to this tick mark is in a conflict with print mode.\n"
"Any its editing will cause a changes of DoubleSlider data.")); "Editing it will cause changes of Slider data."));
else if (conflict == ctMeaninglessColorChange) else if (conflict == ctMeaninglessColorChange)
tooltip += _(L("There is a color change for extruder that wouldn't be used till the end of printing.\n" tooltip += _(L("There is a color change for extruder that won't be used till the end of print job.\n"
"This code wouldn't be processed during GCode generation.")); "This code won't be processed during G-code generation."));
else if (conflict == ctMeaninglessToolChange) else if (conflict == ctMeaninglessToolChange)
tooltip += _(L("There is a extruder change to the same extruder.\n" tooltip += _(L("There is an extruder change set to the same extruder.\n"
"This code wouldn't be processed during GCode generation.")); "This code won't be processed during G-code generation."));
else if (conflict == ctRedundant) else if (conflict == ctRedundant)
tooltip += _(L("There is a color change for extruder that has not been used before.\n" tooltip += _(L("There is a color change for extruder that has not been used before.\n"
"Check your choice to avoid redundant color changes.")); "Check your settings to avoid redundant color changes."));
// Show list of actions with existing tick // Show list of actions with existing tick
if (m_focus == fiActionIcon) if (m_focus == fiActionIcon)
tooltip += "\n\n" + _(L("For Delete tick use left mouse button click OR pres \"-\" key")) + "\n" + ( tooltip += "\n\n" + _(L("Delete tick mark - Left click or press \"-\" key")) + "\n" + (
is_osx ? is_osx ?
_(L("For Edit tick use Ctrl + Left mouse button click")) : _(L("Edit tick mark - Ctrl + Left click")) :
_(L("For Edit tick use right mouse button click")) ); _(L("Edit tick mark - Right click")) );
} }
return tooltip; return tooltip;
@ -1499,10 +1498,10 @@ void Control::show_cog_icon_context_menu()
{ {
wxMenu menu; wxMenu menu;
append_menu_item(&menu, wxID_ANY, _(L("Jump to print Z")) + " (Shift+G)", "", append_menu_item(&menu, wxID_ANY, _(L("Jump to height")) + " (Shift+G)", "",
[this](wxCommandEvent&) { jump_to_print_z(); }, "", &menu); [this](wxCommandEvent&) { jump_to_print_z(); }, "", &menu);
append_menu_item(&menu, wxID_ANY, _(L("Set extruder sequence for whole print")), "", append_menu_item(&menu, wxID_ANY, _(L("Set extruder sequence for the entire print")), "",
[this](wxCommandEvent&) { edit_extruder_sequence(); }, "", &menu); [this](wxCommandEvent&) { edit_extruder_sequence(); }, "", &menu);
GUI::wxGetApp().plater()->PopupMenu(&menu); GUI::wxGetApp().plater()->PopupMenu(&menu);
@ -1589,7 +1588,7 @@ static void upgrade_text_entry_dialog(wxTextEntryDialog* dlg, double min = -1.0,
static std::string get_custom_code(const std::string& code_in, double height) static std::string get_custom_code(const std::string& code_in, double height)
{ {
wxString msg_text = from_u8(_utf8(L("Enter custom G-code used on current layer"))) + ":"; wxString msg_text = from_u8(_utf8(L("Enter custom G-code used on current layer"))) + ":";
wxString msg_header = from_u8((boost::format(_utf8(L("Custom Gcode on current layer (%1% mm)."))) % height).str()); wxString msg_header = from_u8((boost::format(_utf8(L("Custom G-code on current layer (%1% mm)."))) % height).str());
// get custom gcode // get custom gcode
wxTextEntryDialog dlg(nullptr, msg_text, msg_header, code_in, wxTextEntryDialog dlg(nullptr, msg_text, msg_header, code_in,
@ -1604,7 +1603,7 @@ static std::string get_custom_code(const std::string& code_in, double height)
static std::string get_pause_print_msg(const std::string& msg_in, double height) static std::string get_pause_print_msg(const std::string& msg_in, double height)
{ {
wxString msg_text = from_u8(_utf8(L("Enter short message shown on Printer display during pause print"))) + ":"; wxString msg_text = from_u8(_utf8(L("Enter short message shown on Printer display when a print is paused"))) + ":";
wxString msg_header = from_u8((boost::format(_utf8(L("Message for pause print on current layer (%1% mm)."))) % height).str()); wxString msg_header = from_u8((boost::format(_utf8(L("Message for pause print on current layer (%1% mm)."))) % height).str());
// get custom gcode // get custom gcode
@ -1620,8 +1619,8 @@ static std::string get_pause_print_msg(const std::string& msg_in, double height)
static double get_print_z_to_jump(double active_print_z, double min_z, double max_z) static double get_print_z_to_jump(double active_print_z, double min_z, double max_z)
{ {
wxString msg_text = _(L("Enter print z value to jump to")) + " :"; wxString msg_text = _(L("Enter the height you want to jump to")) + " :";
wxString msg_header = _(L("Jump to print z")); wxString msg_header = _(L("Jump to height"));
wxString msg_in = GUI::double_to_string(active_print_z); wxString msg_in = GUI::double_to_string(active_print_z);
// get custom gcode // get custom gcode
@ -1873,7 +1872,7 @@ bool Control::check_ticks_changed_event(const std::string& gcode)
_(L("The last color change data was saved for a single extruder printer profile.")) : _(L("The last color change data was saved for a single extruder printer profile.")) :
_(L("The last color change data was saved for a multiple extruder printer profile.")) _(L("The last color change data was saved for a multiple extruder printer profile."))
) + "\n" + ) + "\n" +
_(L("Your current changes will cause a deletion of all saved color changes.")) + "\n\n\t" + _(L("Your current changes will delete all saved color changes.")) + "\n\n\t" +
_(L("Are you sure you want to continue?")); _(L("Are you sure you want to continue?"));
wxMessageDialog msg(this, message, _(L("Notice")), wxYES_NO); wxMessageDialog msg(this, message, _(L("Notice")), wxYES_NO);
@ -1890,11 +1889,11 @@ bool Control::check_ticks_changed_event(const std::string& gcode)
_(L("The last color change data was saved for a multi extruder printing.")) + "\n\n" + _(L("The last color change data was saved for a multi extruder printing.")) + "\n\n" +
_(L("Select YES if you want to delete all saved tool changes, \n\t" _(L("Select YES if you want to delete all saved tool changes, \n\t"
"NO if you want all tool changes switch to color changes, \n\t" "NO if you want all tool changes switch to color changes, \n\t"
"or CANCEL for do nothing")) + "\n\n\t" + "or CANCEL to leave it unchanged")) + "\n\n\t" +
_(L("Do you want to delete all saved tool changes?")) _(L("Do you want to delete all saved tool changes?"))
) : ( // t_mode::MultiExtruder ) : ( // t_mode::MultiExtruder
_(L("The last color change data was saved for a multi extruder printing with tool changes for whole print.")) + "\n\n" + _(L("The last color change data was saved for a multi extruder printing with tool changes for whole print.")) + "\n\n" +
_(L("Your current changes will cause a deletion of all saved tool changes.")) + "\n\n\t" + _(L("Your current changes will delete all saved extruder (tool) changes.")) + "\n\n\t" +
_(L("Are you sure you want to continue?")) ) ; _(L("Are you sure you want to continue?")) ) ;
wxMessageDialog msg(this, message, _(L("Notice")), wxYES_NO | (m_mode == t_mode::SingleExtruder ? wxCANCEL : 0)); wxMessageDialog msg(this, message, _(L("Notice")), wxYES_NO | (m_mode == t_mode::SingleExtruder ? wxCANCEL : 0));

View File

@ -250,6 +250,23 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
} }
} }
void Field::msw_rescale(bool rescale_sidetext)
{
m_Undo_to_sys_btn->msw_rescale();
m_Undo_btn->msw_rescale();
// update em_unit value
m_em_unit = em_unit(m_parent);
// update sidetext if it is needed
if (m_side_text && rescale_sidetext)
{
auto size = wxSize(def_width_thinner() * m_em_unit, -1);
m_side_text->SetSize(size);
m_side_text->SetMinSize(size);
}
}
template<class T> template<class T>
bool is_defined_input_value(wxWindow* win, const ConfigOptionType& type) bool is_defined_input_value(wxWindow* win, const ConfigOptionType& type)
{ {
@ -259,7 +276,7 @@ bool is_defined_input_value(wxWindow* win, const ConfigOptionType& type)
} }
void TextCtrl::BUILD() { void TextCtrl::BUILD() {
auto size = wxSize(wxDefaultSize); auto size = wxSize(def_width()*m_em_unit, wxDefaultCoord);
if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
@ -455,10 +472,10 @@ boost::any& TextCtrl::get_value()
return m_value; return m_value;
} }
void TextCtrl::msw_rescale() void TextCtrl::msw_rescale(bool rescale_sidetext/* = false*/)
{ {
Field::msw_rescale(); Field::msw_rescale(rescale_sidetext);
auto size = wxSize(wxDefaultSize); auto size = wxSize(def_width() * m_em_unit, wxDefaultCoord);
if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
@ -555,7 +572,7 @@ boost::any& CheckBox::get_value()
return m_value; return m_value;
} }
void CheckBox::msw_rescale() void CheckBox::msw_rescale(bool rescale_sidetext/* = false*/)
{ {
Field::msw_rescale(); Field::msw_rescale();
@ -565,7 +582,7 @@ void CheckBox::msw_rescale()
void SpinCtrl::BUILD() { void SpinCtrl::BUILD() {
auto size = wxSize(wxDefaultSize); auto size = wxSize(def_width() * m_em_unit, wxDefaultCoord);
if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
@ -690,16 +707,16 @@ void SpinCtrl::propagate_value()
suppress_propagation = false; suppress_propagation = false;
} }
void SpinCtrl::msw_rescale() void SpinCtrl::msw_rescale(bool rescale_sidetext/* = false*/)
{ {
Field::msw_rescale(); Field::msw_rescale(rescale_sidetext);
wxSpinCtrl* field = dynamic_cast<wxSpinCtrl*>(window); wxSpinCtrl* field = dynamic_cast<wxSpinCtrl*>(window);
field->SetMinSize(wxSize(-1, int(1.9f*field->GetFont().GetPixelSize().y))); field->SetMinSize(wxSize(def_width() * m_em_unit, int(1.9f*field->GetFont().GetPixelSize().y)));
} }
void Choice::BUILD() { void Choice::BUILD() {
wxSize size(m_width * m_em_unit, -1); wxSize size(def_width_wider() * m_em_unit, wxDefaultCoord);
if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
@ -1018,7 +1035,7 @@ boost::any& Choice::get_value()
return m_value; return m_value;
} }
void Choice::msw_rescale() void Choice::msw_rescale(bool rescale_sidetext/* = false*/)
{ {
Field::msw_rescale(); Field::msw_rescale();
@ -1034,7 +1051,7 @@ void Choice::msw_rescale()
*/ */
field->Clear(); field->Clear();
wxSize size(wxDefaultSize); wxSize size(wxDefaultSize);
size.SetWidth((m_opt.width > 0 ? m_opt.width : m_width) * m_em_unit); size.SetWidth((m_opt.width > 0 ? m_opt.width : def_width_wider()) * m_em_unit);
// Set rescaled min height to correct layout // Set rescaled min height to correct layout
field->SetMinSize(wxSize(-1, int(1.5f*field->GetFont().GetPixelSize().y + 0.5f))); field->SetMinSize(wxSize(-1, int(1.5f*field->GetFont().GetPixelSize().y + 0.5f)));
@ -1065,7 +1082,7 @@ void Choice::msw_rescale()
void ColourPicker::BUILD() void ColourPicker::BUILD()
{ {
auto size = wxSize(wxDefaultSize); auto size = wxSize(def_width() * m_em_unit, wxDefaultCoord);
if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
@ -1133,11 +1150,16 @@ boost::any& ColourPicker::get_value()
return m_value; return m_value;
} }
void ColourPicker::msw_rescale() void ColourPicker::msw_rescale(bool rescale_sidetext/* = false*/)
{ {
Field::msw_rescale(); Field::msw_rescale();
wxColourPickerCtrl* field = dynamic_cast<wxColourPickerCtrl*>(window); wxColourPickerCtrl* field = dynamic_cast<wxColourPickerCtrl*>(window);
auto size = wxSize(def_width() * m_em_unit, wxDefaultCoord);
if (m_opt.height >= 0) size.SetHeight(m_opt.height * m_em_unit);
if (m_opt.width >= 0) size.SetWidth(m_opt.width * m_em_unit);
field->SetMinSize(size);
if (field->GetColour() == wxTransparentColour) if (field->GetColour() == wxTransparentColour)
set_undef_value(field); set_undef_value(field);
} }
@ -1189,7 +1211,7 @@ void PointCtrl::BUILD()
y_textctrl->SetToolTip(get_tooltip_text(X+", "+Y)); y_textctrl->SetToolTip(get_tooltip_text(X+", "+Y));
} }
void PointCtrl::msw_rescale() void PointCtrl::msw_rescale(bool rescale_sidetext/* = false*/)
{ {
Field::msw_rescale(); Field::msw_rescale();
@ -1259,7 +1281,7 @@ void StaticText::BUILD()
temp->SetToolTip(get_tooltip_text(legend)); temp->SetToolTip(get_tooltip_text(legend));
} }
void StaticText::msw_rescale() void StaticText::msw_rescale(bool rescale_sidetext/* = false*/)
{ {
Field::msw_rescale(); Field::msw_rescale();

View File

@ -220,17 +220,16 @@ public:
m_side_text = side_text; m_side_text = side_text;
} }
virtual void msw_rescale() { virtual void msw_rescale(bool rescale_sidetext = false);
m_Undo_to_sys_btn->msw_rescale();
m_Undo_btn->msw_rescale();
// update em_unit value
m_em_unit = em_unit(m_parent);
}
bool get_enter_pressed() const { return bEnterPressed; } bool get_enter_pressed() const { return bEnterPressed; }
void set_enter_pressed(bool pressed) { bEnterPressed = pressed; } void set_enter_pressed(bool pressed) { bEnterPressed = pressed; }
// Values of width to "systematic" alignments of fields
static int def_width() { return 7; }
static int def_width_wider() { return 14; }
static int def_width_thinner() { return 4; }
protected: protected:
RevertButton* m_Undo_btn = nullptr; RevertButton* m_Undo_btn = nullptr;
// Bitmap and Tooltip text for m_Undo_btn. The wxButton will be updated only if the new wxBitmap pointer differs from the currently rendered one. // Bitmap and Tooltip text for m_Undo_btn. The wxButton will be updated only if the new wxBitmap pointer differs from the currently rendered one.
@ -297,7 +296,7 @@ public:
boost::any& get_value() override; boost::any& get_value() override;
void msw_rescale() override; void msw_rescale(bool rescale_sidetext = false) override;
virtual void enable(); virtual void enable();
virtual void disable(); virtual void disable();
@ -325,7 +324,7 @@ public:
void set_na_value() override; void set_na_value() override;
boost::any& get_value() override; boost::any& get_value() override;
void msw_rescale() override; void msw_rescale(bool rescale_sidetext = false) override;
void enable() override { dynamic_cast<wxCheckBox*>(window)->Enable(); } void enable() override { dynamic_cast<wxCheckBox*>(window)->Enable(); }
void disable() override { dynamic_cast<wxCheckBox*>(window)->Disable(); } void disable() override { dynamic_cast<wxCheckBox*>(window)->Disable(); }
@ -368,7 +367,7 @@ public:
return m_value = value; return m_value = value;
} }
void msw_rescale() override; void msw_rescale(bool rescale_sidetext = false) override;
void enable() override { dynamic_cast<wxSpinCtrl*>(window)->Enable(); } void enable() override { dynamic_cast<wxSpinCtrl*>(window)->Enable(); }
void disable() override { dynamic_cast<wxSpinCtrl*>(window)->Disable(); } void disable() override { dynamic_cast<wxSpinCtrl*>(window)->Disable(); }
@ -377,7 +376,6 @@ public:
class Choice : public Field { class Choice : public Field {
using Field::Field; using Field::Field;
int m_width{ 15 };
public: public:
Choice(const ConfigOptionDef& opt, const t_config_option_key& id) : Field(opt, id) {} Choice(const ConfigOptionDef& opt, const t_config_option_key& id) : Field(opt, id) {}
Choice(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : Field(parent, opt, id) {} Choice(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : Field(parent, opt, id) {}
@ -397,7 +395,7 @@ public:
void set_values(const std::vector<std::string> &values); void set_values(const std::vector<std::string> &values);
boost::any& get_value() override; boost::any& get_value() override;
void msw_rescale() override; void msw_rescale(bool rescale_sidetext = false) override;
void enable() override { dynamic_cast<wxBitmapComboBox*>(window)->Enable(); }; void enable() override { dynamic_cast<wxBitmapComboBox*>(window)->Enable(); };
void disable() override{ dynamic_cast<wxBitmapComboBox*>(window)->Disable(); }; void disable() override{ dynamic_cast<wxBitmapComboBox*>(window)->Disable(); };
@ -423,7 +421,7 @@ public:
} }
void set_value(const boost::any& value, bool change_event = false) override; void set_value(const boost::any& value, bool change_event = false) override;
boost::any& get_value() override; boost::any& get_value() override;
void msw_rescale() override; void msw_rescale(bool rescale_sidetext = false) override;
void enable() override { dynamic_cast<wxColourPickerCtrl*>(window)->Enable(); }; void enable() override { dynamic_cast<wxColourPickerCtrl*>(window)->Enable(); };
void disable() override{ dynamic_cast<wxColourPickerCtrl*>(window)->Disable(); }; void disable() override{ dynamic_cast<wxColourPickerCtrl*>(window)->Disable(); };
@ -448,7 +446,7 @@ public:
void set_value(const boost::any& value, bool change_event = false); void set_value(const boost::any& value, bool change_event = false);
boost::any& get_value() override; boost::any& get_value() override;
void msw_rescale() override; void msw_rescale(bool rescale_sidetext = false) override;
void enable() override { void enable() override {
x_textctrl->Enable(); x_textctrl->Enable();
@ -482,7 +480,7 @@ public:
boost::any& get_value()override { return m_value; } boost::any& get_value()override { return m_value; }
void msw_rescale() override; void msw_rescale(bool rescale_sidetext = false) override;
void enable() override { dynamic_cast<wxStaticText*>(window)->Enable(); }; void enable() override { dynamic_cast<wxStaticText*>(window)->Enable(); };
void disable() override{ dynamic_cast<wxStaticText*>(window)->Disable(); }; void disable() override{ dynamic_cast<wxStaticText*>(window)->Disable(); };

View File

@ -128,6 +128,10 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
for (auto opt : option_set) for (auto opt : option_set)
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
if (option_set.size() > 1)
sidetext_width = Field::def_width_thinner();
// 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())
m_options_mode.push_back(option_set[0].opt.mode); m_options_mode.push_back(option_set[0].opt.mode);
@ -274,9 +278,9 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
sizer_tmp->Add(field->getWindow(), 0, wxALIGN_CENTER_VERTICAL, 0); sizer_tmp->Add(field->getWindow(), 0, wxALIGN_CENTER_VERTICAL, 0);
// add sidetext if any // add sidetext if any
if (option.sidetext != "") { if (!option.sidetext.empty() || sidetext_width > 0) {
auto sidetext = new wxStaticText( this->ctrl_parent(), wxID_ANY, _(option.sidetext), wxDefaultPosition, auto sidetext = new wxStaticText( this->ctrl_parent(), wxID_ANY, _(option.sidetext), wxDefaultPosition,
wxSize(sidetext_width != -1 ? sidetext_width*wxGetApp().em_unit() : -1, -1) /*wxDefaultSize*/, wxALIGN_LEFT); wxSize(sidetext_width != -1 ? sidetext_width*wxGetApp().em_unit() : -1, -1), wxALIGN_LEFT);
sidetext->SetBackgroundStyle(wxBG_STYLE_PAINT); sidetext->SetBackgroundStyle(wxBG_STYLE_PAINT);
sidetext->SetFont(wxGetApp().normal_font()); sidetext->SetFont(wxGetApp().normal_font());
sizer_tmp->Add(sidetext, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4); sizer_tmp->Add(sidetext, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4);
@ -498,7 +502,7 @@ void ConfigOptionsGroup::msw_rescale()
// update undo buttons : rescale bitmaps // update undo buttons : rescale bitmaps
for (const auto& field : m_fields) for (const auto& field : m_fields)
field.second->msw_rescale(); field.second->msw_rescale(sidetext_width>0);
const int em = em_unit(parent()); const int em = em_unit(parent());

View File

@ -518,6 +518,18 @@ void TabPrinter::init_options_list()
m_options_list.emplace("extruders_count", m_opt_status_value); m_options_list.emplace("extruders_count", m_opt_status_value);
} }
void TabPrinter::msw_rescale()
{
Tab::msw_rescale();
// rescale missed options_groups
const std::vector<PageShp>& pages = m_printer_technology == ptFFF ? m_pages_sla : m_pages_fff;
for (auto page : pages)
page->msw_rescale();
Layout();
}
void TabSLAMaterial::init_options_list() void TabSLAMaterial::init_options_list()
{ {
if (!m_options_list.empty()) if (!m_options_list.empty())
@ -1221,18 +1233,14 @@ void TabPrint::build()
optgroup = page->new_optgroup(_(L("Sequential printing"))); optgroup = page->new_optgroup(_(L("Sequential printing")));
optgroup->append_single_option_line("complete_objects"); optgroup->append_single_option_line("complete_objects");
line = { _(L("Extruder clearance (mm)")), "" }; line = { _(L("Extruder clearance (mm)")), "" };
Option option = optgroup->get_option("extruder_clearance_radius"); line.append_option(optgroup->get_option("extruder_clearance_radius"));
option.opt.width = 6; line.append_option(optgroup->get_option("extruder_clearance_height"));
line.append_option(option);
option = optgroup->get_option("extruder_clearance_height");
option.opt.width = 6;
line.append_option(option);
optgroup->append_line(line); optgroup->append_line(line);
optgroup = page->new_optgroup(_(L("Output file"))); optgroup = page->new_optgroup(_(L("Output file")));
optgroup->append_single_option_line("gcode_comments"); optgroup->append_single_option_line("gcode_comments");
optgroup->append_single_option_line("gcode_label_objects"); optgroup->append_single_option_line("gcode_label_objects");
option = optgroup->get_option("output_filename_format"); Option option = optgroup->get_option("output_filename_format");
option.opt.full_width = true; option.opt.full_width = true;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
@ -1463,7 +1471,10 @@ void TabFilament::build()
page = add_options_page(_(L("Advanced")), "wrench"); page = add_options_page(_(L("Advanced")), "wrench");
optgroup = page->new_optgroup(_(L("Filament properties"))); optgroup = page->new_optgroup(_(L("Filament properties")));
optgroup->append_single_option_line("filament_type"); // Set size as all another fields for a better alignment
Option option = optgroup->get_option("filament_type");
option.opt.width = Field::def_width();
optgroup->append_single_option_line(option);
optgroup->append_single_option_line("filament_soluble"); optgroup->append_single_option_line("filament_soluble");
optgroup = page->new_optgroup(_(L("Print speed override"))); optgroup = page->new_optgroup(_(L("Print speed override")));
@ -1517,7 +1528,7 @@ void TabFilament::build()
page = add_options_page(_(L("Custom G-code")), "cog"); page = add_options_page(_(L("Custom G-code")), "cog");
optgroup = page->new_optgroup(_(L("Start G-code")), 0); optgroup = page->new_optgroup(_(L("Start G-code")), 0);
Option option = optgroup->get_option("start_filament_gcode"); option = optgroup->get_option("start_filament_gcode");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = gcode_field_height;// 150; option.opt.height = gcode_field_height;// 150;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
@ -1690,7 +1701,10 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
return sizer; return sizer;
}; };
Line host_line = optgroup->create_single_option_line("print_host"); // Set a wider width for a better alignment
Option option = optgroup->get_option("print_host");
option.opt.width = Field::def_width_wider();
Line host_line = optgroup->create_single_option_line(option);
host_line.append_widget(printhost_browse); host_line.append_widget(printhost_browse);
host_line.append_widget(print_host_test); host_line.append_widget(print_host_test);
optgroup->append_line(host_line); optgroup->append_line(host_line);
@ -3497,7 +3511,6 @@ void TabSLAMaterial::build()
for (auto& axis : axes) { for (auto& axis : axes) {
auto opt = optgroup->get_option(opt_key, id); auto opt = optgroup->get_option(opt_key, id);
opt.opt.label = axis; opt.opt.label = axis;
opt.opt.width = 6;
line.append_option(opt); line.append_option(opt);
++id; ++id;
} }

View File

@ -290,7 +290,7 @@ public:
virtual void reload_config(); virtual void reload_config();
void update_mode(); void update_mode();
void update_visibility(); void update_visibility();
void msw_rescale(); virtual void msw_rescale();
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const; Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
bool set_value(const t_config_option_key& opt_key, const boost::any& value); bool set_value(const t_config_option_key& opt_key, const boost::any& value);
wxSizer* description_line_widget(wxWindow* parent, ogStaticText** StaticText); wxSizer* description_line_widget(wxWindow* parent, ogStaticText** StaticText);
@ -403,6 +403,7 @@ public:
void build_unregular_pages(); void build_unregular_pages();
void on_preset_loaded() override; void on_preset_loaded() override;
void init_options_list() override; void init_options_list() override;
void msw_rescale() override;
bool supports_printer_technology(const PrinterTechnology /* tech */) override { return true; } bool supports_printer_technology(const PrinterTechnology /* tech */) override { return true; }
}; };