Merge branch 'add_kinematics' of https://github.com/prusa3d/Slic3r into time_estimate

This commit is contained in:
Enrico Turri 2018-06-22 12:57:16 +02:00
commit 00ef0610a5
12 changed files with 256 additions and 51 deletions

View file

@ -286,11 +286,11 @@ PrintConfigDef::PrintConfigDef()
def->enum_values.push_back("hilbertcurve"); def->enum_values.push_back("hilbertcurve");
def->enum_values.push_back("archimedeanchords"); def->enum_values.push_back("archimedeanchords");
def->enum_values.push_back("octagramspiral"); def->enum_values.push_back("octagramspiral");
def->enum_labels.push_back("Rectilinear"); def->enum_labels.push_back(L("Rectilinear"));
def->enum_labels.push_back("Concentric"); def->enum_labels.push_back(L("Concentric"));
def->enum_labels.push_back("Hilbert Curve"); def->enum_labels.push_back(L("Hilbert Curve"));
def->enum_labels.push_back("Archimedean Chords"); def->enum_labels.push_back(L("Archimedean Chords"));
def->enum_labels.push_back("Octagram Spiral"); def->enum_labels.push_back(L("Octagram Spiral"));
// solid_fill_pattern is an obsolete equivalent to external_fill_pattern. // solid_fill_pattern is an obsolete equivalent to external_fill_pattern.
def->aliases.push_back("solid_fill_pattern"); def->aliases.push_back("solid_fill_pattern");
def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear); def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
@ -620,19 +620,19 @@ PrintConfigDef::PrintConfigDef()
def->enum_values.push_back("hilbertcurve"); def->enum_values.push_back("hilbertcurve");
def->enum_values.push_back("archimedeanchords"); def->enum_values.push_back("archimedeanchords");
def->enum_values.push_back("octagramspiral"); def->enum_values.push_back("octagramspiral");
def->enum_labels.push_back("Rectilinear"); def->enum_labels.push_back(L("Rectilinear"));
def->enum_labels.push_back("Grid"); def->enum_labels.push_back(L("Grid"));
def->enum_labels.push_back("Triangles"); def->enum_labels.push_back(L("Triangles"));
def->enum_labels.push_back("Stars"); def->enum_labels.push_back(L("Stars"));
def->enum_labels.push_back("Cubic"); def->enum_labels.push_back(L("Cubic"));
def->enum_labels.push_back("Line"); def->enum_labels.push_back(L("Line"));
def->enum_labels.push_back("Concentric"); def->enum_labels.push_back(L("Concentric"));
def->enum_labels.push_back("Honeycomb"); def->enum_labels.push_back(L("Honeycomb"));
def->enum_labels.push_back("3D Honeycomb"); def->enum_labels.push_back(L("3D Honeycomb"));
def->enum_labels.push_back("Gyroid"); def->enum_labels.push_back(L("Gyroid"));
def->enum_labels.push_back("Hilbert Curve"); def->enum_labels.push_back(L("Hilbert Curve"));
def->enum_labels.push_back("Archimedean Chords"); def->enum_labels.push_back(L("Archimedean Chords"));
def->enum_labels.push_back("Octagram Spiral"); def->enum_labels.push_back(L("Octagram Spiral"));
def->default_value = new ConfigOptionEnum<InfillPattern>(ipStars); def->default_value = new ConfigOptionEnum<InfillPattern>(ipStars);
def = this->add("first_layer_acceleration", coFloat); def = this->add("first_layer_acceleration", coFloat);
@ -740,7 +740,7 @@ PrintConfigDef::PrintConfigDef()
def->enum_labels.push_back("Mach3/LinuxCNC"); def->enum_labels.push_back("Mach3/LinuxCNC");
def->enum_labels.push_back("Machinekit"); def->enum_labels.push_back("Machinekit");
def->enum_labels.push_back("Smoothie"); def->enum_labels.push_back("Smoothie");
def->enum_labels.push_back("No extrusion"); def->enum_labels.push_back(L("No extrusion"));
def->default_value = new ConfigOptionEnum<GCodeFlavor>(gcfMarlin); def->default_value = new ConfigOptionEnum<GCodeFlavor>(gcfMarlin);
def = this->add("infill_acceleration", coFloat); def = this->add("infill_acceleration", coFloat);
@ -856,6 +856,12 @@ PrintConfigDef::PrintConfigDef()
def->min = 0; def->min = 0;
def->default_value = new ConfigOptionFloat(0.3); def->default_value = new ConfigOptionFloat(0.3);
def = this->add("silent_mode", coBool);
def->label = L("Support silent mode");
def->tooltip = L("Set silent mode for the G-code flavor");
def->default_value = new ConfigOptionBool(true);
const int machine_linits_opt_width = 70;
{ {
struct AxisDefault { struct AxisDefault {
std::string name; std::string name;
@ -874,65 +880,72 @@ PrintConfigDef::PrintConfigDef()
std::string axis_upper = boost::to_upper_copy<std::string>(axis.name); std::string axis_upper = boost::to_upper_copy<std::string>(axis.name);
// Add the machine feedrate limits for XYZE axes. (M203) // Add the machine feedrate limits for XYZE axes. (M203)
def = this->add("machine_max_feedrate_" + axis.name, coFloats); def = this->add("machine_max_feedrate_" + axis.name, coFloats);
def->label = (boost::format(L("Maximum feedrate %1%")) % axis_upper).str(); def->full_label = (boost::format(L("Maximum feedrate %1%")) % axis_upper).str();
def->category = L("Machine limits"); def->category = L("Machine limits");
def->tooltip = (boost::format(L("Maximum feedrate of the %1% axis")) % axis_upper).str(); def->tooltip = (boost::format(L("Maximum feedrate of the %1% axis")) % axis_upper).str();
def->sidetext = L("mm/s"); def->sidetext = L("mm/s");
def->min = 0; def->min = 0;
def->width = machine_linits_opt_width;
def->default_value = new ConfigOptionFloats(axis.max_feedrate); def->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)
def = this->add("machine_max_acceleration_" + axis.name, coFloats); def = this->add("machine_max_acceleration_" + axis.name, coFloats);
def->label = (boost::format(L("Maximum acceleration %1%")) % axis_upper).str(); def->full_label = (boost::format(L("Maximum acceleration %1%")) % axis_upper).str();
def->category = L("Machine limits"); def->category = L("Machine limits");
def->tooltip = (boost::format(L("Maximum acceleration of the %1% axis")) % axis_upper).str(); def->tooltip = (boost::format(L("Maximum acceleration of the %1% axis")) % axis_upper).str();
def->sidetext = L("mm/s²"); def->sidetext = L("mm/s²");
def->min = 0; def->min = 0;
def->width = machine_linits_opt_width;
def->default_value = new ConfigOptionFloats(axis.max_acceleration); def->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)
def = this->add("machine_max_jerk_" + axis.name, coFloats); def = this->add("machine_max_jerk_" + axis.name, coFloats);
def->label = (boost::format(L("Maximum jerk %1%")) % axis_upper).str(); def->full_label = (boost::format(L("Maximum jerk %1%")) % axis_upper).str();
def->category = L("Machine limits"); def->category = L("Machine limits");
def->tooltip = (boost::format(L("Maximum jerk of the %1% axis")) % axis_upper).str(); def->tooltip = (boost::format(L("Maximum jerk of the %1% axis")) % axis_upper).str();
def->sidetext = L("mm/s"); def->sidetext = L("mm/s");
def->min = 0; def->min = 0;
def->width = machine_linits_opt_width;
def->default_value = new ConfigOptionFloats(axis.max_jerk); def->default_value = new ConfigOptionFloats(axis.max_jerk);
} }
} }
// M205 S... [mm/sec] // M205 S... [mm/sec]
def = this->add("machine_min_extruding_rate", coFloats); def = this->add("machine_min_extruding_rate", coFloats);
def->label = L("Minimum feedrate when extruding"); def->full_label = L("Minimum feedrate when extruding");
def->category = L("Machine limits"); def->category = L("Machine limits");
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->default_value = new ConfigOptionFloats(0., 0.); def->width = machine_linits_opt_width;
def->default_value = new ConfigOptionFloats{ 0., 0. };
// M205 T... [mm/sec] // M205 T... [mm/sec]
def = this->add("machine_min_travel_rate", coFloats); def = this->add("machine_min_travel_rate", coFloats);
def->label = L("Minimum travel feedrate"); def->full_label = L("Minimum travel feedrate");
def->category = L("Machine limits"); def->category = L("Machine limits");
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->default_value = new ConfigOptionFloats(0., 0.); def->width = machine_linits_opt_width;
def->default_value = new ConfigOptionFloats{ 0., 0. };
// M204 S... [mm/sec^2] // M204 S... [mm/sec^2]
def = this->add("machine_max_acceleration_extruding", coFloats); def = this->add("machine_max_acceleration_extruding", coFloats);
def->label = L("Maximum acceleration when extruding"); def->full_label = L("Maximum acceleration when extruding");
def->category = L("Machine limits"); def->category = L("Machine limits");
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_linits_opt_width;
def->default_value = new ConfigOptionFloats(1250., 1250.); def->default_value = new ConfigOptionFloats(1250., 1250.);
// M204 T... [mm/sec^2] // M204 T... [mm/sec^2]
def = this->add("machine_max_acceleration_retracting", coFloats); def = this->add("machine_max_acceleration_retracting", coFloats);
def->label = L("Maximum acceleration when retracting"); def->full_label = L("Maximum acceleration when retracting");
def->category = L("Machine limits"); def->category = L("Machine limits");
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_linits_opt_width;
def->default_value = new ConfigOptionFloats(1250., 1250.); def->default_value = new ConfigOptionFloats(1250., 1250.);
def = this->add("max_fan_speed", coInts); def = this->add("max_fan_speed", coInts);
@ -1347,10 +1360,10 @@ PrintConfigDef::PrintConfigDef()
def->enum_values.push_back("nearest"); def->enum_values.push_back("nearest");
def->enum_values.push_back("aligned"); def->enum_values.push_back("aligned");
def->enum_values.push_back("rear"); def->enum_values.push_back("rear");
def->enum_labels.push_back("Random"); def->enum_labels.push_back(L("Random"));
def->enum_labels.push_back("Nearest"); def->enum_labels.push_back(L("Nearest"));
def->enum_labels.push_back("Aligned"); def->enum_labels.push_back(L("Aligned"));
def->enum_labels.push_back("Rear"); def->enum_labels.push_back(L("Rear"));
def->default_value = new ConfigOptionEnum<SeamPosition>(spAligned); def->default_value = new ConfigOptionEnum<SeamPosition>(spAligned);
#if 0 #if 0
@ -1613,8 +1626,8 @@ PrintConfigDef::PrintConfigDef()
def->min = 0; def->min = 0;
def->enum_values.push_back("0"); def->enum_values.push_back("0");
def->enum_values.push_back("0.2"); def->enum_values.push_back("0.2");
def->enum_labels.push_back("0 (soluble)"); def->enum_labels.push_back((boost::format("0 (%1%)") % L("soluble")).str());
def->enum_labels.push_back("0.2 (detachable)"); def->enum_labels.push_back((boost::format("0.2 (%1%)") % L("detachable")).str());
def->default_value = new ConfigOptionFloat(0.2); def->default_value = new ConfigOptionFloat(0.2);
def = this->add("support_material_enforce_layers", coInt); def = this->add("support_material_enforce_layers", coInt);
@ -1703,9 +1716,9 @@ PrintConfigDef::PrintConfigDef()
def->enum_values.push_back("rectilinear"); def->enum_values.push_back("rectilinear");
def->enum_values.push_back("rectilinear-grid"); def->enum_values.push_back("rectilinear-grid");
def->enum_values.push_back("honeycomb"); def->enum_values.push_back("honeycomb");
def->enum_labels.push_back("rectilinear"); def->enum_labels.push_back(L("Rectilinear"));
def->enum_labels.push_back("rectilinear grid"); def->enum_labels.push_back(L("Rectilinear grid"));
def->enum_labels.push_back("honeycomb"); def->enum_labels.push_back(L("Honeycomb"));
def->default_value = new ConfigOptionEnum<SupportMaterialPattern>(smpRectilinear); def->default_value = new ConfigOptionEnum<SupportMaterialPattern>(smpRectilinear);
def = this->add("support_material_spacing", coFloat); def = this->add("support_material_spacing", coFloat);

View file

@ -1588,7 +1588,7 @@ bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, con
m_data.clear(); m_data.clear();
// collects items to render // collects items to render
auto title = GUI::L_str(preview_data.get_legend_title()); auto title = _(preview_data.get_legend_title());
const GCodePreviewData::LegendItemsList& items = preview_data.get_legend_items(tool_colors); const GCodePreviewData::LegendItemsList& items = preview_data.get_legend_items(tool_colors);
unsigned int items_count = (unsigned int)items.size(); unsigned int items_count = (unsigned int)items.size();

View file

@ -67,7 +67,7 @@ namespace Slic3r { namespace GUI {
wxString Field::get_tooltip_text(const wxString& default_string) wxString Field::get_tooltip_text(const wxString& default_string)
{ {
wxString tooltip_text(""); wxString tooltip_text("");
wxString tooltip = L_str(m_opt.tooltip); wxString tooltip = _(m_opt.tooltip);
if (tooltip.length() > 0) if (tooltip.length() > 0)
tooltip_text = tooltip + "(" + _(L("default")) + ": " + tooltip_text = tooltip + "(" + _(L("default")) + ": " +
(boost::iends_with(m_opt_id, "_gcode") ? "\n" : "") + (boost::iends_with(m_opt_id, "_gcode") ? "\n" : "") +
@ -355,7 +355,7 @@ void Choice::BUILD() {
} }
else{ else{
for (auto el : m_opt.enum_labels.empty() ? m_opt.enum_values : m_opt.enum_labels){ for (auto el : m_opt.enum_labels.empty() ? m_opt.enum_values : m_opt.enum_labels){
const wxString& str = m_opt_id == "support" ? L_str(el) : el; const wxString& str = _(el);//m_opt_id == "support" ? _(el) : el;
temp->Append(str); temp->Append(str);
} }
set_selection(); set_selection();
@ -665,6 +665,22 @@ boost::any& PointCtrl::get_value()
return m_value = ret_point; 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 } // GUI
} // Slic3r } // Slic3r

View file

@ -384,6 +384,34 @@ public:
wxSizer* getSizer() override { return sizer; } 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 } // GUI
} // Slic3r } // Slic3r

View file

@ -56,6 +56,7 @@
#include "../Utils/PresetUpdater.hpp" #include "../Utils/PresetUpdater.hpp"
#include "../Config/Snapshot.hpp" #include "../Config/Snapshot.hpp"
#include "3DScene.hpp"
#include "libslic3r/I18N.hpp" #include "libslic3r/I18N.hpp"
namespace Slic3r { namespace GUI { namespace Slic3r { namespace GUI {
@ -109,6 +110,7 @@ wxNotebook *g_wxTabPanel = nullptr;
AppConfig *g_AppConfig = nullptr; AppConfig *g_AppConfig = nullptr;
PresetBundle *g_PresetBundle= nullptr; PresetBundle *g_PresetBundle= nullptr;
PresetUpdater *g_PresetUpdater = nullptr; PresetUpdater *g_PresetUpdater = nullptr;
_3DScene *g_3DScene = nullptr;
wxColour g_color_label_modified; wxColour g_color_label_modified;
wxColour g_color_label_sys; wxColour g_color_label_sys;
wxColour g_color_label_default; wxColour g_color_label_default;
@ -117,6 +119,9 @@ std::vector<Tab *> g_tabs_list;
wxLocale* g_wxLocale; wxLocale* g_wxLocale;
wxFont g_small_font;
wxFont g_bold_font;
std::shared_ptr<ConfigOptionsGroup> m_optgroup; std::shared_ptr<ConfigOptionsGroup> m_optgroup;
double m_brim_width = 0.0; double m_brim_width = 0.0;
wxButton* g_wiping_dialog_button = nullptr; wxButton* g_wiping_dialog_button = nullptr;
@ -149,6 +154,16 @@ void update_label_colours_from_appconfig()
} }
} }
static void init_fonts()
{
g_small_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
g_bold_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold();
#ifdef __WXMAC__
g_small_font.SetPointSize(11);
g_bold_font.SetPointSize(13);
#endif /*__WXMAC__*/
}
static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str().data(); } static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str().data(); }
void set_wxapp(wxApp *app) void set_wxapp(wxApp *app)
@ -157,6 +172,7 @@ void set_wxapp(wxApp *app)
// Let the libslic3r know the callback, which will translate messages on demand. // Let the libslic3r know the callback, which will translate messages on demand.
Slic3r::I18N::set_translate_callback(libslic3r_translate_callback); Slic3r::I18N::set_translate_callback(libslic3r_translate_callback);
init_label_colours(); init_label_colours();
init_fonts();
} }
void set_main_frame(wxFrame *main_frame) void set_main_frame(wxFrame *main_frame)
@ -184,6 +200,11 @@ void set_preset_updater(PresetUpdater *updater)
g_PresetUpdater = updater; g_PresetUpdater = updater;
} }
void set_3DScene(_3DScene *scene)
{
g_3DScene = scene;
}
std::vector<Tab *>& get_tabs_list() std::vector<Tab *>& get_tabs_list()
{ {
return g_tabs_list; return g_tabs_list;
@ -382,6 +403,7 @@ void add_config_menu(wxMenuBar *menu, int event_preferences_changed, int event_l
save_language(); save_language();
show_info(g_wxTabPanel, _(L("Application will be restarted")), _(L("Attention!"))); show_info(g_wxTabPanel, _(L("Application will be restarted")), _(L("Attention!")));
if (event_language_change > 0) { if (event_language_change > 0) {
g_3DScene->remove_all_canvases();// remove all canvas before recreate GUI
wxCommandEvent event(event_language_change); wxCommandEvent event(event_language_change);
g_wxApp->ProcessEvent(event); g_wxApp->ProcessEvent(event);
} }
@ -672,6 +694,14 @@ void set_label_clr_sys(const wxColour& clr) {
g_AppConfig->save(); g_AppConfig->save();
} }
const wxFont& small_font(){
return g_small_font;
}
const wxFont& bold_font(){
return g_bold_font;
}
const wxColour& get_label_clr_default() { const wxColour& get_label_clr_default() {
return g_color_label_default; return g_color_label_default;
} }

View file

@ -11,7 +11,7 @@
class wxApp; class wxApp;
class wxWindow; class wxWindow;
class wxFrame; class wxFrame;
class wxWindow; class wxFont;
class wxMenuBar; class wxMenuBar;
class wxNotebook; class wxNotebook;
class wxComboCtrl; class wxComboCtrl;
@ -32,6 +32,7 @@ class AppConfig;
class PresetUpdater; class PresetUpdater;
class DynamicPrintConfig; class DynamicPrintConfig;
class TabIface; class TabIface;
class _3DScene;
#define _(s) Slic3r::GUI::I18N::translate((s)) #define _(s) Slic3r::GUI::I18N::translate((s))
@ -90,6 +91,7 @@ void set_tab_panel(wxNotebook *tab_panel);
void set_app_config(AppConfig *app_config); void set_app_config(AppConfig *app_config);
void set_preset_bundle(PresetBundle *preset_bundle); void set_preset_bundle(PresetBundle *preset_bundle);
void set_preset_updater(PresetUpdater *updater); void set_preset_updater(PresetUpdater *updater);
void set_3DScene(_3DScene *scene);
AppConfig* get_app_config(); AppConfig* get_app_config();
wxApp* get_app(); wxApp* get_app();
@ -102,6 +104,9 @@ unsigned get_colour_approx_luma(const wxColour &colour);
void set_label_clr_modified(const wxColour& clr); void set_label_clr_modified(const wxColour& clr);
void set_label_clr_sys(const wxColour& clr); void set_label_clr_sys(const wxColour& clr);
const wxFont& small_font();
const wxFont& bold_font();
extern void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_language_change); extern void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_language_change);
// This is called when closing the application, when loading a config file or when starting the config wizard // This is called when closing the application, when loading a config file or when starting the config wizard

View file

@ -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))); 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("slider") == 0) {
} else if (opt.gui_type.compare("i_spin") == 0) { // Spinctrl } 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 { } else {
switch (opt.type) { switch (opt.type) {
case coFloatOrPercent: case coFloatOrPercent:
@ -86,7 +88,7 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
if (!this->m_disabled) if (!this->m_disabled)
this->back_to_sys_value(opt_id); 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_btn->Hide();
field->m_Undo_to_sys_btn->Hide(); field->m_Undo_to_sys_btn->Hide();
} }
@ -192,7 +194,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** colored_Label/*
ConfigOptionDef option = opt.opt; ConfigOptionDef option = opt.opt;
// add label if any // add label if any
if (option.label != "") { if (option.label != "") {
wxString str_label = L_str(option.label); wxString str_label = _(option.label);
//! 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 == "Top" || option.label == "Bottom") ? // wxString str_label = (option.label == "Top" || option.label == "Bottom") ?
// wxGETTEXT_IN_CONTEXT("Layers", wxString(option.label.c_str()): // wxGETTEXT_IN_CONTEXT("Layers", wxString(option.label.c_str()):
@ -213,7 +215,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** colored_Label/*
// add sidetext if any // add sidetext if any
if (option.sidetext != "") { if (option.sidetext != "") {
auto sidetext = new wxStaticText(parent(), wxID_ANY, L_str(option.sidetext), wxDefaultPosition, wxDefaultSize); auto sidetext = new wxStaticText(parent(), wxID_ANY, _(option.sidetext), wxDefaultPosition, wxDefaultSize);
sidetext->SetFont(sidetext_font); sidetext->SetFont(sidetext_font);
sizer->Add(sidetext, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4); sizer->Add(sidetext, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4);
} }
@ -235,7 +237,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** colored_Label/*
} }
Line OptionsGroup::create_single_option_line(const Option& option) const { Line OptionsGroup::create_single_option_line(const Option& option) const {
Line retval{ L_str(option.opt.label), L_str(option.opt.tooltip) }; Line retval{ _(option.opt.label), _(option.opt.tooltip) };
Option tmp(option); Option tmp(option);
tmp.opt.label = std::string(""); tmp.opt.label = std::string("");
retval.append_option(tmp); retval.append_option(tmp);

View file

@ -127,9 +127,15 @@ public:
inline void enable() { for (auto& field : m_fields) field.second->enable(); } inline void enable() { for (auto& field : m_fields) field.second->enable(); }
inline void disable() { for (auto& field : m_fields) field.second->disable(); } 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) : 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!="") {
sizer = (staticbox ? new wxStaticBoxSizer(new wxStaticBox(_parent, wxID_ANY, title), wxVERTICAL) : new wxBoxSizer(wxVERTICAL)); 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));
auto num_columns = 1U; auto num_columns = 1U;
if (label_width != 0) num_columns++; if (label_width != 0) num_columns++;
if (extra_column != nullptr) num_columns++; if (extra_column != nullptr) num_columns++;
@ -156,7 +162,7 @@ protected:
bool m_disabled {false}; bool m_disabled {false};
wxGridSizer* m_grid_sizer {nullptr}; wxGridSizer* m_grid_sizer {nullptr};
// "true" if option is created in preset tabs // "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 // 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 // Tooltips on GTK doesn't work inside wxStaticBoxSizer unless you insert a panel

View file

@ -326,6 +326,11 @@ const std::vector<std::string>& Preset::printer_options()
"single_extruder_multi_material", "start_gcode", "end_gcode", "before_layer_gcode", "layer_gcode", "toolchange_gcode", "single_extruder_multi_material", "start_gcode", "end_gcode", "before_layer_gcode", "layer_gcode", "toolchange_gcode",
"between_objects_gcode", "printer_vendor", "printer_model", "printer_variant", "printer_notes", "cooling_tube_retraction", "between_objects_gcode", "printer_vendor", "printer_model", "printer_variant", "printer_notes", "cooling_tube_retraction",
"cooling_tube_length", "parking_pos_retraction", "max_print_height", "default_print_profile", "inherits", "cooling_tube_length", "parking_pos_retraction", "max_print_height", "default_print_profile", "inherits",
"silent_mode","machine_max_acceleration_extruding", "machine_max_acceleration_retracting",
"machine_max_acceleration_x", "machine_max_acceleration_y", "machine_max_acceleration_z", "machine_max_acceleration_e",
"machine_max_feedrate_x", "machine_max_feedrate_y", "machine_max_feedrate_z", "machine_max_feedrate_e",
"machine_min_extruding_rate", "machine_min_travel_rate",
"machine_max_jerk_x", "machine_max_jerk_y", "machine_max_jerk_z", "machine_max_jerk_e"
}; };
s_opts.insert(s_opts.end(), Preset::nozzle_options().begin(), Preset::nozzle_options().end()); s_opts.insert(s_opts.end(), Preset::nozzle_options().begin(), Preset::nozzle_options().end());
} }

View file

@ -1627,6 +1627,16 @@ void TabPrinter::build()
optgroup = page->new_optgroup(_(L("Firmware"))); optgroup = page->new_optgroup(_(L("Firmware")));
optgroup->append_single_option_line("gcode_flavor"); optgroup->append_single_option_line("gcode_flavor");
optgroup->append_single_option_line("silent_mode");
optgroup->m_on_change = [this, optgroup](t_config_option_key opt_key, boost::any value){
wxTheApp->CallAfter([this, opt_key, value](){
if (opt_key.compare("gcode_flavor") == 0)
build_extruder_pages();
update_dirty();
on_value_change(opt_key, value);
});
};
optgroup = page->new_optgroup(_(L("Advanced"))); optgroup = page->new_optgroup(_(L("Advanced")));
optgroup->append_single_option_line("use_relative_e_distances"); optgroup->append_single_option_line("use_relative_e_distances");
@ -1708,8 +1718,91 @@ void TabPrinter::extruders_count_changed(size_t extruders_count){
on_value_change("extruders_count", extruders_count); on_value_change("extruders_count", extruders_count);
} }
void TabPrinter::build_extruder_pages(){ 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);
// 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);
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")));
for (const std::string &axis : axes) {
append_option_line(optgroup, "machine_max_feedrate_" + axis);
}
optgroup = page->new_optgroup(_(L("Starting Acceleration")));
append_option_line(optgroup, "machine_max_acceleration_extruding");
append_option_line(optgroup, "machine_max_acceleration_retracting");
optgroup = page->new_optgroup(_(L("Advanced")));
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;
}
void TabPrinter::build_extruder_pages()
{
size_t n_before_extruders = 2; // Count of pages before Extruder pages size_t n_before_extruders = 2; // Count of pages before Extruder pages
bool is_marlin_flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfMarlin;
// Add/delete Kinematics page according to is_marlin_flavor
size_t existed_page = 0;
for (int i = n_before_extruders; i < m_pages.size(); ++i) // first make sure it's not there already
if (m_pages[i]->title().find(_(L("Machine limits"))) != std::string::npos) {
if (!is_marlin_flavor)
m_pages.erase(m_pages.begin() + i);
else
existed_page = i;
break;
}
if (existed_page < n_before_extruders && is_marlin_flavor){
auto page = create_kinematics_page();
m_pages.insert(m_pages.begin() + n_before_extruders, page);
}
if (is_marlin_flavor)
n_before_extruders++;
size_t n_after_single_extruder_MM = 2; // Count of pages after single_extruder_multi_material page size_t n_after_single_extruder_MM = 2; // Count of pages after single_extruder_multi_material page
if (m_extruders_count_old == m_extruders_count || if (m_extruders_count_old == m_extruders_count ||
@ -1818,6 +1911,9 @@ void TabPrinter::update(){
get_field("toolchange_gcode")->toggle(have_multiple_extruders); get_field("toolchange_gcode")->toggle(have_multiple_extruders);
get_field("single_extruder_multi_material")->toggle(have_multiple_extruders); get_field("single_extruder_multi_material")->toggle(have_multiple_extruders);
bool is_marlin_flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfMarlin;
get_field("silent_mode")->toggle(is_marlin_flavor);
for (size_t i = 0; i < m_extruders_count; ++i) { for (size_t i = 0; i < m_extruders_count; ++i) {
bool have_retract_length = m_config->opt_float("retract_length", i) > 0; bool have_retract_length = m_config->opt_float("retract_length", i) > 0;

View file

@ -330,6 +330,7 @@ public:
void update() override; void update() override;
void update_serial_ports(); void update_serial_ports();
void extruders_count_changed(size_t extruders_count); void extruders_count_changed(size_t extruders_count);
PageShp create_kinematics_page();
void build_extruder_pages(); void build_extruder_pages();
void on_preset_loaded() override; void on_preset_loaded() override;
void init_options_list() override; void init_options_list() override;

View file

@ -101,3 +101,6 @@ void desktop_open_datadir_folder()
void fix_model_by_win10_sdk_gui(ModelObject *model_object_src, Print *print, Model *model_dst) void fix_model_by_win10_sdk_gui(ModelObject *model_object_src, Print *print, Model *model_dst)
%code%{ Slic3r::fix_model_by_win10_sdk_gui(*model_object_src, *print, *model_dst); %}; %code%{ Slic3r::fix_model_by_win10_sdk_gui(*model_object_src, *print, *model_dst); %};
void set_3DScene(SV *scene)
%code%{ Slic3r::GUI::set_3DScene((_3DScene *)wxPli_sv_2_object(aTHX_ scene, "Slic3r::Model::3DScene") ); %};