Added prototype for "Kinematics" Page

+ Added enum_labels to localizations
+ Added bold font for the name of Options Groups
This commit is contained in:
YuSanka 2018-06-20 14:20:48 +02:00
parent 86b02224ae
commit fd4feb689e
7 changed files with 129 additions and 31 deletions

View file

@ -283,11 +283,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);
@ -617,19 +617,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);
@ -737,7 +737,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);
@ -1265,10 +1265,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
@ -1483,6 +1483,13 @@ PrintConfigDef::PrintConfigDef()
def->cli = "single-extruder-multi-material!"; def->cli = "single-extruder-multi-material!";
def->default_value = new ConfigOptionBool(false); def->default_value = new ConfigOptionBool(false);
// -- ! Kinematics options
def = this->add("silent_mode", coBool);
def->label = L("Silent mode");
def->tooltip = L("Set silent mode for the G-code flavor");
def->default_value = new ConfigOptionBool(true);
// -- !
def = this->add("support_material", coBool); def = this->add("support_material", coBool);
def->label = L("Generate support material"); def->label = L("Generate support material");
def->category = L("Support material"); def->category = L("Support material");
@ -1621,9 +1628,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

@ -117,6 +117,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,10 +152,21 @@ 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__*/
}
void set_wxapp(wxApp *app) void set_wxapp(wxApp *app)
{ {
g_wxApp = app; g_wxApp = app;
init_label_colours(); init_label_colours();
init_fonts();
} }
void set_main_frame(wxFrame *main_frame) void set_main_frame(wxFrame *main_frame)
@ -668,6 +682,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;
@ -99,6 +99,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

@ -129,7 +129,9 @@ public:
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_is_tab_opt(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++;

View file

@ -326,6 +326,7 @@ 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"
}; };
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,57 @@ 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(){ PageShp TabPrinter::create_kinematics_page()
{
auto page = add_options_page(_(L("Kinematics")), "cog.png", true);
auto optgroup = page->new_optgroup(_(L("Maximum accelerations")));
// optgroup->append_single_option_line("max_acceleration_x");
// optgroup->append_single_option_line("max_acceleration_y");
// optgroup->append_single_option_line("max_acceleration_z");
optgroup = page->new_optgroup(_(L("Maximum feedrates")));
// optgroup->append_single_option_line("max_feedrate_x");
// optgroup->append_single_option_line("max_feedrate_y");
// optgroup->append_single_option_line("max_feedrate_z");
optgroup = page->new_optgroup(_(L("Starting Acceleration")));
// optgroup->append_single_option_line("start_acceleration");
// optgroup->append_single_option_line("start_retract_acceleration");
optgroup = page->new_optgroup(_(L("Advanced")));
// optgroup->append_single_option_line("min_feedrate_for_print_moves");
// optgroup->append_single_option_line("min_feedrate_for_travel_moves");
// optgroup->append_single_option_line("max_jerk_x");
// optgroup->append_single_option_line("max_jerk_y");
// optgroup->append_single_option_line("max_jerk_z");
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("Kinematics"))) != 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 +1877,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;