mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-29 19:53:44 -06:00 
			
		
		
		
	ENH: icon for param group
Change-Id: I435830615747aa850ed82621349f5fedfc29d860
This commit is contained in:
		
							parent
							
								
									c5024af7e2
								
							
						
					
					
						commit
						d41e0db18f
					
				
					 33 changed files with 477 additions and 83 deletions
				
			
		|  | @ -545,7 +545,7 @@ int OG_CustomCtrl::get_title_width() | |||
|     if (!GetLabel().IsEmpty()) | ||||
|         return titleWidth; | ||||
|     else | ||||
|         return 1; | ||||
|         return 2; | ||||
| } | ||||
| 
 | ||||
| void OG_CustomCtrl::set_max_win_width(int max_win_width) | ||||
|  |  | |||
|  | @ -113,10 +113,10 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co | |||
|     return field; | ||||
| } | ||||
| 
 | ||||
| OptionsGroup::OptionsGroup(	wxWindow* _parent, const wxString& title, | ||||
| OptionsGroup::OptionsGroup(wxWindow *_parent, const wxString &title, const wxString &icon, | ||||
|                             bool is_tab_opt /* = false */, | ||||
|                             column_t extra_clmn /* = nullptr */) : | ||||
|                 m_parent(_parent), title(title), | ||||
|                 m_parent(_parent), title(title), icon(icon), | ||||
|                 m_use_custom_ctrl(is_tab_opt), | ||||
| 				// BBS: new layout
 | ||||
| 				staticbox(!is_tab_opt), extra_column(extra_clmn) | ||||
|  | @ -461,7 +461,7 @@ bool OptionsGroup::activate(std::function<void()> throw_if_canceled/* = [](){}*/ | |||
| 		} | ||||
| 		else { | ||||
| 			// BBS: new layout
 | ||||
| 			::StaticLine* stl = new ::StaticLine(m_parent, false, _(title)); | ||||
| 			::StaticLine* stl = new ::StaticLine(m_parent, false, _(title), icon); | ||||
|             stl->SetFont(Label::Head_14); | ||||
|             stl->SetForegroundColour("#262E30"); | ||||
|             sizer = new wxBoxSizer(wxVERTICAL); | ||||
|  | @ -850,6 +850,9 @@ void ConfigOptionsGroup::msw_rescale() | |||
| 
 | ||||
|     if (custom_ctrl) | ||||
|         custom_ctrl->msw_rescale(); | ||||
| 
 | ||||
|     if (auto line = dynamic_cast<::StaticLine*>(stb)) | ||||
|         line->Rescale(); | ||||
| } | ||||
| 
 | ||||
| void ConfigOptionsGroup::sys_color_changed() | ||||
|  |  | |||
|  | @ -105,6 +105,7 @@ public: | |||
|     bool option_label_at_right{false}; | ||||
|     // BBS: new layout
 | ||||
|     wxWindow *     stb; | ||||
|     const wxString  icon; | ||||
|     const wxString  title; | ||||
|     size_t			label_width = 20 ;// {200};
 | ||||
|     wxSizer*		sizer {nullptr}; | ||||
|  | @ -180,7 +181,7 @@ public: | |||
| 
 | ||||
|     void            hide_labels() { label_width = 0; } | ||||
| 
 | ||||
| 	OptionsGroup(	wxWindow* _parent, const wxString& title, bool is_tab_opt = false,  | ||||
| 	OptionsGroup(wxWindow *_parent, const wxString &title, const wxString &icon, bool is_tab_opt = false,  | ||||
|                     column_t extra_clmn = nullptr); | ||||
| 	~OptionsGroup() { clear(true); } | ||||
| 
 | ||||
|  | @ -239,14 +240,17 @@ public: | |||
| 
 | ||||
| class ConfigOptionsGroup: public OptionsGroup { | ||||
| public: | ||||
| 	ConfigOptionsGroup(	wxWindow* parent, const wxString& title, const wxString& icon, DynamicPrintConfig* config = nullptr,  | ||||
| 						bool is_tab_opt = false, column_t extra_clmn = nullptr) : | ||||
| 		OptionsGroup(parent, title, icon, is_tab_opt, extra_clmn), m_config(config) {} | ||||
| 	ConfigOptionsGroup(	wxWindow* parent, const wxString& title, DynamicPrintConfig* config = nullptr,  | ||||
| 						bool is_tab_opt = false, column_t extra_clmn = nullptr) : | ||||
| 		OptionsGroup(parent, title, is_tab_opt, extra_clmn), m_config(config) {} | ||||
| 		ConfigOptionsGroup(parent, title, wxEmptyString, config, is_tab_opt, extra_clmn) {} | ||||
| 	ConfigOptionsGroup(	wxWindow* parent, const wxString& title, ModelConfig* config,  | ||||
| 						bool is_tab_opt = false, column_t extra_clmn = nullptr) : | ||||
| 		OptionsGroup(parent, title, is_tab_opt, extra_clmn), m_config(&config->get()), m_modelconfig(config) {} | ||||
| 		OptionsGroup(parent, title, wxEmptyString, is_tab_opt, extra_clmn), m_config(&config->get()), m_modelconfig(config) {} | ||||
| 	ConfigOptionsGroup(	wxWindow* parent) : | ||||
| 		OptionsGroup(parent, wxEmptyString, true, nullptr) {} | ||||
| 		OptionsGroup(parent, wxEmptyString, wxEmptyString, true, nullptr) {} | ||||
| 
 | ||||
| 	const wxString& config_category() const throw() { return m_config_category; } | ||||
| 	int config_type() const throw() { return m_config_type; } | ||||
|  | @ -316,7 +320,7 @@ class ExtruderOptionsGroup : public ConfigOptionsGroup { | |||
| public: | ||||
| 	ExtruderOptionsGroup(wxWindow* parent, const wxString& title, DynamicPrintConfig* config = nullptr, | ||||
| 		bool is_tab_opt = false, column_t extra_clmn = nullptr) : | ||||
| 		ConfigOptionsGroup(parent, title, config, is_tab_opt, extra_clmn) {} | ||||
| 		ConfigOptionsGroup(parent, title, wxEmptyString, config, is_tab_opt, extra_clmn) {} | ||||
| 
 | ||||
| 	void on_change_OG(const t_config_option_key& opt_id, const boost::any& value) override; | ||||
| }; | ||||
|  |  | |||
|  | @ -1747,12 +1747,12 @@ void TabPrint::build() | |||
|     load_initial_data(); | ||||
| 
 | ||||
|     auto page = add_options_page(L("Quality"), "empty"); | ||||
|         auto optgroup = page->new_optgroup(L("Layer height")); | ||||
|         auto optgroup = page->new_optgroup(L("Layer height"), L"param_layer_height"); | ||||
|         optgroup->append_single_option_line("layer_height"); | ||||
|         optgroup->append_single_option_line("initial_layer_print_height"); | ||||
|         optgroup->append_single_option_line("adaptive_layer_height", "adaptive-layer-height"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Line width")); | ||||
|         optgroup = page->new_optgroup(L("Line width"), L"param_line_width"); | ||||
|         optgroup->append_single_option_line("line_width"); | ||||
|         optgroup->append_single_option_line("initial_layer_line_width"); | ||||
|         optgroup->append_single_option_line("outer_wall_line_width"); | ||||
|  | @ -1762,10 +1762,10 @@ void TabPrint::build() | |||
|         optgroup->append_single_option_line("internal_solid_infill_line_width"); | ||||
|         optgroup->append_single_option_line("support_line_width"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Seam")); | ||||
|         optgroup = page->new_optgroup(L("Seam"), L"param_seam"); | ||||
|         optgroup->append_single_option_line("seam_position", "Seam"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Precision")); | ||||
|         optgroup = page->new_optgroup(L("Precision"), L"param_precision"); | ||||
|         optgroup->append_single_option_line("slice_closing_radius"); | ||||
|         optgroup->append_single_option_line("resolution"); | ||||
|         optgroup->append_single_option_line("enable_arc_fitting"); | ||||
|  | @ -1773,13 +1773,13 @@ void TabPrint::build() | |||
|         optgroup->append_single_option_line("xy_contour_compensation"); | ||||
|         optgroup->append_single_option_line("elefant_foot_compensation"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Ironing")); | ||||
|         optgroup = page->new_optgroup(L("Ironing"), L"param_ironing"); | ||||
|         optgroup->append_single_option_line("ironing_type"); | ||||
|         optgroup->append_single_option_line("ironing_speed"); | ||||
|         optgroup->append_single_option_line("ironing_flow"); | ||||
|         optgroup->append_single_option_line("ironing_spacing"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Advanced")); | ||||
|         optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); | ||||
|         optgroup->append_single_option_line("wall_infill_order"); | ||||
|         optgroup->append_single_option_line("bridge_flow"); | ||||
|         optgroup->append_single_option_line("only_one_wall_top"); | ||||
|  | @ -1788,23 +1788,23 @@ void TabPrint::build() | |||
|         optgroup->append_single_option_line("max_travel_detour_distance"); | ||||
| 
 | ||||
|     page = add_options_page(L("Strength"), "empty"); | ||||
|         optgroup = page->new_optgroup(L("Walls")); | ||||
|         optgroup = page->new_optgroup(L("Walls"), L"param_wall"); | ||||
|         optgroup->append_single_option_line("wall_loops"); | ||||
|         optgroup->append_single_option_line("detect_thin_wall"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Top/bottom shells")); | ||||
|         optgroup = page->new_optgroup(L("Top/bottom shells"), L"param_shell"); | ||||
|         optgroup->append_single_option_line("top_shell_layers"); | ||||
|         optgroup->append_single_option_line("top_shell_thickness"); | ||||
|         optgroup->append_single_option_line("bottom_shell_layers"); | ||||
|         optgroup->append_single_option_line("bottom_shell_thickness"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Infill")); | ||||
|         optgroup = page->new_optgroup(L("Infill"), L"param_infill"); | ||||
|         optgroup->append_single_option_line("sparse_infill_density"); | ||||
|         optgroup->append_single_option_line("sparse_infill_pattern"); | ||||
|         optgroup->append_single_option_line("top_surface_pattern"); | ||||
|         optgroup->append_single_option_line("bottom_surface_pattern"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Advanced")); | ||||
|         optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); | ||||
|         optgroup->append_single_option_line("infill_wall_overlap"); | ||||
|         optgroup->append_single_option_line("infill_direction"); | ||||
|         optgroup->append_single_option_line("minimum_sparse_infill_area"); | ||||
|  | @ -1812,10 +1812,10 @@ void TabPrint::build() | |||
|         optgroup->append_single_option_line("detect_narrow_internal_solid_infill"); | ||||
| 
 | ||||
|     page = add_options_page(L("Speed"), "empty"); | ||||
|         optgroup = page->new_optgroup(L("Initial layer speed"), 15); | ||||
|         optgroup = page->new_optgroup(L("Initial layer speed"), L"param_speed_first", 15); | ||||
|         optgroup->append_single_option_line("initial_layer_speed"); | ||||
|         optgroup->append_single_option_line("initial_layer_infill_speed"); | ||||
|         optgroup = page->new_optgroup(L("Other layers speed"), 15); | ||||
|         optgroup = page->new_optgroup(L("Other layers speed"), L"param_speed", 15); | ||||
|         optgroup->append_single_option_line("outer_wall_speed"); | ||||
|         optgroup->append_single_option_line("inner_wall_speed"); | ||||
|         optgroup->append_single_option_line("sparse_infill_speed"); | ||||
|  | @ -1834,10 +1834,10 @@ void TabPrint::build() | |||
|         optgroup->append_single_option_line("support_speed"); | ||||
|         optgroup->append_single_option_line("support_interface_speed"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Travel speed"), 15); | ||||
|         optgroup = page->new_optgroup(L("Travel speed"), L"param_travel_speed", 15); | ||||
|         optgroup->append_single_option_line("travel_speed"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Acceleration"), 15); | ||||
|         optgroup = page->new_optgroup(L("Acceleration"), L"param_acceleration", 15); | ||||
|         optgroup->append_single_option_line("initial_layer_acceleration"); | ||||
|         optgroup->append_single_option_line("top_surface_acceleration"); | ||||
|         optgroup->append_single_option_line("default_acceleration"); | ||||
|  | @ -1848,7 +1848,7 @@ void TabPrint::build() | |||
| #endif /* HAS_PRESSURE_EQUALIZER */ | ||||
| 
 | ||||
|     page = add_options_page(L("Support"), "support"); | ||||
|         optgroup = page->new_optgroup(L("Support")); | ||||
|         optgroup = page->new_optgroup(L("Support"), L"param_support"); | ||||
|     optgroup->append_single_option_line("enable_support", "support"); | ||||
|         optgroup->append_single_option_line("support_type", "support#support-types"); | ||||
|         optgroup->append_single_option_line("support_threshold_angle", "support#threshold-angle"); | ||||
|  | @ -1856,7 +1856,7 @@ void TabPrint::build() | |||
|         optgroup->append_single_option_line("support_critical_regions_only"); | ||||
|         //optgroup->append_single_option_line("enforce_support_layers");
 | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Support filament")); | ||||
|         optgroup = page->new_optgroup(L("Support filament"), L"param_support_filament"); | ||||
|         optgroup->append_single_option_line("support_filament", "support#support-filament"); | ||||
|         optgroup->append_single_option_line("support_interface_filament", "support#support-filament"); | ||||
| 
 | ||||
|  | @ -1864,7 +1864,7 @@ void TabPrint::build() | |||
|         //optgroup->append_single_option_line("support_style");
 | ||||
| 
 | ||||
|         //BBS
 | ||||
|         optgroup = page->new_optgroup(L("Advanced")); | ||||
|         optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); | ||||
|         optgroup->append_single_option_line("tree_support_branch_distance", "support#tree-support-only-options"); | ||||
|         optgroup->append_single_option_line("tree_support_branch_diameter", "support#tree-support-only-options"); | ||||
|         optgroup->append_single_option_line("tree_support_branch_angle", "support#tree-support-only-options"); | ||||
|  | @ -1888,7 +1888,7 @@ void TabPrint::build() | |||
|         //optgroup->append_single_option_line("independent_support_layer_height");
 | ||||
| 
 | ||||
|     page = add_options_page(L("Others"), "advanced"); | ||||
|         optgroup = page->new_optgroup(L("Bed adhension")); | ||||
|         optgroup = page->new_optgroup(L("Bed adhension"), L"param_adhension"); | ||||
|         optgroup->append_single_option_line("skirt_loops"); | ||||
|         optgroup->append_single_option_line("skirt_distance"); | ||||
|         //optgroup->append_single_option_line("draft_shield");
 | ||||
|  | @ -1899,18 +1899,18 @@ void TabPrint::build() | |||
|         //optgroup->append_single_option_line("raft_first_layer_density");
 | ||||
|         //optgroup->append_single_option_line("raft_first_layer_expansion");
 | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Prime tower")); | ||||
|         optgroup = page->new_optgroup(L("Prime tower"), L"param_tower"); | ||||
|         optgroup->append_single_option_line("enable_prime_tower"); | ||||
|         optgroup->append_single_option_line("prime_tower_width"); | ||||
|         optgroup->append_single_option_line("prime_volume"); | ||||
|         optgroup->append_single_option_line("prime_tower_brim_width"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Flush options")); | ||||
|         optgroup = page->new_optgroup(L("Flush options"), L"param_flush"); | ||||
|         optgroup->append_single_option_line("flush_into_infill", "reduce-wasting-during-filament-change#wipe-into-infill"); | ||||
|         optgroup->append_single_option_line("flush_into_objects", "reduce-wasting-during-filament-change#wipe-into-object"); | ||||
|         optgroup->append_single_option_line("flush_into_support", "reduce-wasting-during-filament-change#wipe-into-support-enabled-by-default"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Special mode")); | ||||
|         optgroup = page->new_optgroup(L("Special mode"), L"param_special"); | ||||
|         optgroup->append_single_option_line("print_sequence"); | ||||
|         optgroup->append_single_option_line("spiral_mode", "spiral-vase"); | ||||
|         optgroup->append_single_option_line("timelapse_type", "Timelapse"); | ||||
|  | @ -1932,7 +1932,7 @@ void TabPrint::build() | |||
|         optgroup->append_single_option_line("fuzzy_skin_thickness"); | ||||
| 
 | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("G-code output")); | ||||
|         optgroup = page->new_optgroup(L("G-code output"), L"param_gcode"); | ||||
|         optgroup->append_single_option_line("reduce_infill_retraction"); | ||||
|         optgroup->append_single_option_line("gcode_add_line_number"); | ||||
|         Option option = optgroup->get_option("filename_format"); | ||||
|  | @ -2323,7 +2323,7 @@ void TabFilament::add_filament_overrides_page() | |||
| { | ||||
|     //BBS
 | ||||
|     PageShp page = add_options_page(L("Setting Overrides"), "empty"); | ||||
|     ConfigOptionsGroupShp optgroup = page->new_optgroup(L("Retraction")); | ||||
|     ConfigOptionsGroupShp optgroup = page->new_optgroup(L("Retraction"), L"param_retraction"); | ||||
| 
 | ||||
|     auto append_single_option_line = [optgroup, this](const std::string& opt_key, int opt_index) | ||||
|     { | ||||
|  | @ -2427,7 +2427,7 @@ void TabFilament::build() | |||
|     page->m_split_multi_line = true; | ||||
|     page->m_option_label_at_right = true; | ||||
|         //BBS
 | ||||
|         auto optgroup = page->new_optgroup(L("Basic information")); | ||||
|         auto optgroup = page->new_optgroup(L("Basic information"), L"param_information"); | ||||
|         // Set size as all another fields for a better alignment
 | ||||
|         Option option = optgroup->get_option("filament_type"); | ||||
|         option.opt.width = Field::def_width(); | ||||
|  | @ -2447,10 +2447,10 @@ void TabFilament::build() | |||
|         line.append_option(optgroup->get_option("nozzle_temperature_range_high")); | ||||
|         optgroup->append_line(line); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Recommended temperature range")); | ||||
|         optgroup = page->new_optgroup(L("Recommended temperature range"), L"param_temperature"); | ||||
|         optgroup->append_single_option_line("bed_temperature_difference"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Print temperature")); | ||||
|         optgroup = page->new_optgroup(L("Print temperature"), L"param_temperature"); | ||||
|         optgroup->split_multi_line = true; | ||||
|         optgroup->option_label_at_right = true; | ||||
|         line = { L("Nozzle"), L("Nozzle temperature when printing") }; | ||||
|  | @ -2506,7 +2506,7 @@ void TabFilament::build() | |||
|         }; | ||||
| 
 | ||||
|         //BBS
 | ||||
|         optgroup = page->new_optgroup(L("Volumetric speed limitation")); | ||||
|         optgroup = page->new_optgroup(L("Volumetric speed limitation"), L"param_volumetric_speed"); | ||||
|         optgroup->append_single_option_line("filament_max_volumetric_speed"); | ||||
| 
 | ||||
|         //line = { "", "" };
 | ||||
|  | @ -2524,11 +2524,11 @@ void TabFilament::build() | |||
|         //    return description_line_widget(parent, &m_cooling_description_line);
 | ||||
|         //};
 | ||||
|         //optgroup->append_line(line);
 | ||||
|         optgroup = page->new_optgroup(L("Cooling for specific layer")); | ||||
|         optgroup = page->new_optgroup(L("Cooling for specific layer"), L"param_cooling"); | ||||
|     optgroup->append_single_option_line("close_fan_the_first_x_layers", "auto-cooling"); | ||||
|         //optgroup->append_single_option_line("full_fan_speed_layer");
 | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Part cooling fan")); | ||||
|         optgroup = page->new_optgroup(L("Part cooling fan"), L"param_cooling_fan"); | ||||
|         line = { L("Min fan speed threshold"), L("Part cooling fan speed will start to run at min speed when the estimated layer time is no longer than the layer time in setting. When layer time is shorter than threshold, fan speed is interpolated between the minimum and maximum fan speed according to layer printing time") }; | ||||
|         line.label_path = "auto-cooling"; | ||||
|         line.append_option(optgroup->get_option("fan_min_speed")); | ||||
|  | @ -2547,7 +2547,7 @@ void TabFilament::build() | |||
|         optgroup->append_single_option_line("overhang_fan_threshold", "auto-cooling"); | ||||
|         optgroup->append_single_option_line("overhang_fan_speed", "auto-cooling"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Auxiliary part cooling fan")); | ||||
|         optgroup = page->new_optgroup(L("Auxiliary part cooling fan"), L"param_cooling_fan"); | ||||
|         optgroup->append_single_option_line("additional_cooling_fan_speed"); | ||||
| 
 | ||||
|         //BBS
 | ||||
|  | @ -2561,7 +2561,7 @@ void TabFilament::build() | |||
|         const int gcode_field_height = 15; // 150
 | ||||
| 
 | ||||
|     page = add_options_page(L("Advanced"), "advanced"); | ||||
|         optgroup = page->new_optgroup(L("Filament start G-code"), 0); | ||||
|         optgroup = page->new_optgroup(L("Filament start G-code"), L"param_gcode", 0); | ||||
|         optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) { | ||||
|             validate_custom_gcode_cb(this, optgroup, opt_key, value); | ||||
|         }; | ||||
|  | @ -2571,7 +2571,7 @@ void TabFilament::build() | |||
|         option.opt.height = gcode_field_height;// 150;
 | ||||
|         optgroup->append_single_option_line(option); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Filament end G-code"), 0); | ||||
|         optgroup = page->new_optgroup(L("Filament end G-code"), L"param_gcode", 0); | ||||
|         optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) { | ||||
|             validate_custom_gcode_cb(this, optgroup, opt_key, value); | ||||
|         }; | ||||
|  | @ -2741,7 +2741,7 @@ void TabPrinter::build_fff() | |||
|             static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size(); | ||||
| 
 | ||||
|     auto page = add_options_page(L("Basic information"), "printer"); | ||||
|         auto optgroup = page->new_optgroup(L("Printable space")); | ||||
|         auto optgroup = page->new_optgroup(L("Printable space")/*, L"param_printable_space"*/); | ||||
| 
 | ||||
|         //create_line_with_widget(optgroup.get(), "printable_area", "custom-svg-and-png-bed-textures_124612", [this](wxWindow* parent) {
 | ||||
|         //    return 	create_bed_shape_widget(parent);
 | ||||
|  | @ -2847,20 +2847,20 @@ void TabPrinter::build_fff() | |||
|         //};
 | ||||
| #endif | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Advanced")); | ||||
|         optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); | ||||
|         optgroup->append_single_option_line("gcode_flavor"); | ||||
|         optgroup->append_single_option_line("scan_first_layer"); | ||||
|         // optgroup->append_single_option_line("spaghetti_detector");
 | ||||
|         optgroup->append_single_option_line("machine_load_filament_time"); | ||||
|         optgroup->append_single_option_line("machine_unload_filament_time"); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Accessory")); | ||||
|         optgroup = page->new_optgroup(L("Accessory") /*, L"param_accessory"*/); | ||||
|         optgroup->append_single_option_line("nozzle_type"); | ||||
|         optgroup->append_single_option_line("auxiliary_fan"); | ||||
| 
 | ||||
|     const int gcode_field_height = 15; // 150
 | ||||
|     page = add_options_page(L("Machine gcode"), "cog"); | ||||
|         optgroup = page->new_optgroup(L("Machine start G-code"), 0); | ||||
|         optgroup = page->new_optgroup(L("Machine start G-code"), L"param_gcode", 0); | ||||
|         optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) { | ||||
|             validate_custom_gcode_cb(this, optgroup, opt_key, value); | ||||
|         }; | ||||
|  | @ -2870,7 +2870,7 @@ void TabPrinter::build_fff() | |||
|         option.opt.height = gcode_field_height;//150;
 | ||||
|         optgroup->append_single_option_line(option); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Machine end G-code"), 0); | ||||
|         optgroup = page->new_optgroup(L("Machine end G-code"), L"param_gcode", 0); | ||||
|         optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) { | ||||
|             validate_custom_gcode_cb(this, optgroup, opt_key, value); | ||||
|         }; | ||||
|  | @ -2891,7 +2891,7 @@ void TabPrinter::build_fff() | |||
|         optgroup->append_single_option_line(option); | ||||
| #endif | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Layer change G-code"), 0); | ||||
|         optgroup = page->new_optgroup(L("Layer change G-code"), L"param_gcode", 0); | ||||
|         optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) { | ||||
|             validate_custom_gcode_cb(this, optgroup, opt_key, value); | ||||
|         }; | ||||
|  | @ -2901,7 +2901,7 @@ void TabPrinter::build_fff() | |||
|         option.opt.height = gcode_field_height;//150;
 | ||||
|         optgroup->append_single_option_line(option); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Change filament G-code"), 0); | ||||
|         optgroup = page->new_optgroup(L("Change filament G-code"), L"param_gcode", 0); | ||||
|         optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) { | ||||
|             validate_custom_gcode_cb(this, optgroup, opt_key, value); | ||||
|         }; | ||||
|  | @ -2911,7 +2911,7 @@ void TabPrinter::build_fff() | |||
|         option.opt.height = gcode_field_height;//150;
 | ||||
|         optgroup->append_single_option_line(option); | ||||
| 
 | ||||
|         optgroup = page->new_optgroup(L("Pause G-code"), 0); | ||||
|         optgroup = page->new_optgroup(L("Pause G-code"), L"param_gcode", 0); | ||||
|         optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) { | ||||
|             validate_custom_gcode_cb(this, optgroup, opt_key, value); | ||||
|         }; | ||||
|  | @ -3063,13 +3063,13 @@ PageShp TabPrinter::build_kinematics_page() | |||
|         "machine_max_speed_z", | ||||
|         "machine_max_speed_e" | ||||
|     }; | ||||
|     auto optgroup = page->new_optgroup(L("Speed limitation")); | ||||
|     auto optgroup = page->new_optgroup(L("Speed limitation"), "param_speed"); | ||||
|         for (const std::string &speed_axis : speed_axes)	{ | ||||
|             append_option_line(optgroup, speed_axis); | ||||
|         } | ||||
| 
 | ||||
|     const std::vector<std::string> axes{ "x", "y", "z", "e" }; | ||||
|     optgroup = page->new_optgroup(L("Acceleration limitation")); | ||||
|         optgroup = page->new_optgroup(L("Acceleration limitation"), "param_acceleration"); | ||||
|         for (const std::string &axis : axes)	{ | ||||
|             append_option_line(optgroup, "machine_max_acceleration_" + axis); | ||||
|         } | ||||
|  | @ -3181,7 +3181,7 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/) | |||
|         auto page = add_options_page(page_name, "empty", true); | ||||
|         m_pages.insert(m_pages.begin() + n_before_extruders + extruder_idx, page); | ||||
| 
 | ||||
|             auto optgroup = page->new_optgroup(L("Size"), -1, true); | ||||
|             auto optgroup = page->new_optgroup(L("Size"), L"param_diameter", -1, true); | ||||
|             optgroup->append_single_option_line("nozzle_diameter", "", extruder_idx); | ||||
| 
 | ||||
|             optgroup->m_on_change = [this, extruder_idx](const t_config_option_key& opt_key, boost::any value) | ||||
|  | @ -3220,15 +3220,15 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/) | |||
|                 update(); | ||||
|             }; | ||||
| 
 | ||||
|             optgroup = page->new_optgroup(L("Layer height limits"), -1, true); | ||||
|             optgroup = page->new_optgroup(L("Layer height limits"), L"param_layer_height", -1, true); | ||||
|             optgroup->append_single_option_line("min_layer_height", "", extruder_idx); | ||||
|             optgroup->append_single_option_line("max_layer_height", "", extruder_idx); | ||||
| 
 | ||||
|             optgroup = page->new_optgroup(L("Position"), -1, true); | ||||
|             optgroup = page->new_optgroup(L("Position"), L"param_retraction", -1, true); | ||||
|             optgroup->append_single_option_line("extruder_offset", "", extruder_idx); | ||||
| 
 | ||||
|             //BBS: don't show retract related config menu in machine page
 | ||||
|             optgroup = page->new_optgroup(L("Retraction")); | ||||
|             optgroup = page->new_optgroup(L("Retraction"), L"param_retraction"); | ||||
|             optgroup->append_single_option_line("retraction_length", "", extruder_idx); | ||||
|             optgroup->append_single_option_line("z_hop", "", extruder_idx); | ||||
|             optgroup->append_single_option_line("retraction_speed", "", extruder_idx); | ||||
|  | @ -3240,7 +3240,7 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/) | |||
|             optgroup->append_single_option_line("wipe_distance", "", extruder_idx); | ||||
|             optgroup->append_single_option_line("retract_before_wipe", "", extruder_idx); | ||||
| 
 | ||||
|             optgroup = page->new_optgroup(L("Retraction when switching material"), -1, true); | ||||
|             optgroup = page->new_optgroup(L("Retraction when switching material"), L"param_retraction", -1, true); | ||||
|             optgroup->append_single_option_line("retract_length_toolchange", "", extruder_idx); | ||||
|             optgroup->append_single_option_line("retract_restart_extra_toolchange", "", extruder_idx); | ||||
| 
 | ||||
|  | @ -4861,11 +4861,11 @@ bool Page::set_value(const t_config_option_key &opt_key, const boost::any &value | |||
| } | ||||
| 
 | ||||
| // package Slic3r::GUI::Tab::Page;
 | ||||
| ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_label_width /*= -1*/, bool is_extruder_og /* false */) | ||||
| ConfigOptionsGroupShp Page::new_optgroup(const wxString &title, const wxString &icon, int noncommon_label_width /*= -1*/, bool is_extruder_og /* false */) | ||||
| { | ||||
|     //! config_ have to be "right"
 | ||||
|     ConfigOptionsGroupShp optgroup = is_extruder_og ? std::make_shared<ExtruderOptionsGroup>(m_parent, title, m_config, true) | ||||
|         : std::make_shared<ConfigOptionsGroup>(m_parent, title, m_config, true); | ||||
|         : std::make_shared<ConfigOptionsGroup>(m_parent, title, icon, m_config, true); | ||||
|     optgroup->split_multi_line     = this->m_split_multi_line; | ||||
|     optgroup->option_label_at_right = this->m_option_label_at_right; | ||||
|     if (noncommon_label_width >= 0) | ||||
|  |  | |||
|  | @ -97,7 +97,7 @@ public: | |||
|     Line *      get_line(const t_config_option_key &opt_key); | ||||
| 	bool		set_value(const t_config_option_key& opt_key, const boost::any& value); | ||||
| 	// BBS. Add is_extruder_og parameter.
 | ||||
| 	ConfigOptionsGroupShp	new_optgroup(const wxString& title, int noncommon_label_width = -1, bool is_extruder_og = false); | ||||
| 	ConfigOptionsGroupShp	new_optgroup(const wxString& title, const wxString& icon = wxEmptyString, int noncommon_label_width = -1, bool is_extruder_og = false); | ||||
| 	const ConfigOptionsGroupShp	get_optgroup(const wxString& title) const; | ||||
| 
 | ||||
| 	bool		set_item_colour(const wxColour *clr) { | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ EVT_PAINT(StaticLine::paintEvent) | |||
| 
 | ||||
| END_EVENT_TABLE() | ||||
| 
 | ||||
| StaticLine::StaticLine(wxWindow* parent, bool vertical, const wxString& label) | ||||
| StaticLine::StaticLine(wxWindow *parent, bool vertical, const wxString &label, const wxString &icon) | ||||
|     : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE) | ||||
|     , vertical(vertical) | ||||
| { | ||||
|  | @ -18,22 +18,22 @@ StaticLine::StaticLine(wxWindow* parent, bool vertical, const wxString& label) | |||
|     this->pen = wxPen(wxColour("#EEEEEE")); | ||||
|     DisableFocusFromKeyboard(); | ||||
|     SetFont(Label::Body_14); | ||||
|     SetLabel(label); | ||||
|     wxWindow::SetLabel(label); | ||||
|     SetIcon(icon); | ||||
| } | ||||
| 
 | ||||
| void StaticLine::SetLabel(const wxString& label) | ||||
| { | ||||
|     wxWindow::SetLabel(label); | ||||
|     int s = 1; | ||||
|     if (!label.IsEmpty()) { | ||||
|         wxClientDC dc(this); | ||||
|         auto size = dc.GetTextExtent(label); | ||||
|         s = vertical ? size.x : size.y; | ||||
|     } | ||||
|     if (vertical) | ||||
|         SetMinSize({s, -1}); | ||||
|     else | ||||
|         SetMinSize({-1, s}); | ||||
|     messureSize(); | ||||
|     Refresh(); | ||||
| } | ||||
| 
 | ||||
| void StaticLine::SetIcon(const wxString &icon) | ||||
| { | ||||
|     this->icon = icon.IsEmpty() ? ScalableBitmap()  | ||||
|         : ScalableBitmap(this, icon.ToStdString(), 18); | ||||
|     messureSize(); | ||||
|     Refresh(); | ||||
| } | ||||
| 
 | ||||
|  | @ -42,6 +42,13 @@ void StaticLine::SetLineColour(wxColour color) | |||
|     this->pen = wxPen(color); | ||||
| } | ||||
| 
 | ||||
| void StaticLine::Rescale() | ||||
| { | ||||
|     if (this->icon.bmp().IsOk()) | ||||
|         this->icon.msw_rescale(); | ||||
|     messureSize(); | ||||
| } | ||||
| 
 | ||||
| void StaticLine::paintEvent(wxPaintEvent& evt) | ||||
| { | ||||
|     // depending on your system you may need to look at double-buffered dcs
 | ||||
|  | @ -49,6 +56,27 @@ void StaticLine::paintEvent(wxPaintEvent& evt) | |||
|     render(dc); | ||||
| } | ||||
| 
 | ||||
| void StaticLine::messureSize() | ||||
| { | ||||
|     wxClientDC dc(this); | ||||
|     wxSize textSize = dc.GetTextExtent(GetLabel()); | ||||
|     wxSize szContent = textSize; | ||||
|     if (this->icon.bmp().IsOk()) { | ||||
|         if (szContent.y > 0) { | ||||
|             // BBS norrow size between text and icon
 | ||||
|             szContent.x += 5; | ||||
|         } | ||||
|         wxSize szIcon = this->icon.GetBmpSize(); | ||||
|         szContent.x += szIcon.x; | ||||
|         if (szIcon.y > szContent.y) szContent.y = szIcon.y; | ||||
|     } | ||||
|     if (vertical) | ||||
|         szContent.y += 10; | ||||
|     else | ||||
|         szContent.x += 10; | ||||
|     SetMinSize(szContent); | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Here we do the actual rendering. I put it in a separate | ||||
|  * method so that it can work no matter what type of DC | ||||
|  | @ -57,22 +85,29 @@ void StaticLine::paintEvent(wxPaintEvent& evt) | |||
| void StaticLine::render(wxDC& dc) | ||||
| { | ||||
|     wxSize size = GetSize(); | ||||
|     wxSize size2 {0, 0}; | ||||
|     auto label = GetLabel(); | ||||
|     wxSize textSize; | ||||
|     auto   label = GetLabel(); | ||||
|     if (!label.IsEmpty()) textSize = dc.GetTextExtent(label); | ||||
|     wxRect titleRect{{0, 0}, size}; | ||||
|     titleRect.height = wxMax(icon.GetBmpHeight(), textSize.GetHeight()); | ||||
|     int contentWidth = icon.GetBmpWidth() + ((icon.bmp().IsOk() && textSize.GetWidth() > 0) ? 5 : 0) + | ||||
|                 textSize.GetWidth(); | ||||
|     if (vertical) titleRect.Deflate((size.GetWidth() - contentWidth) / 2, 0); | ||||
|     if (icon.bmp().IsOk()) { | ||||
|         dc.DrawBitmap(icon.bmp(), {0, (size.y - icon.GetBmpHeight()) / 2}); | ||||
|         titleRect.x += icon.GetBmpWidth() + 5; | ||||
|     } | ||||
|     if (!label.IsEmpty()) { | ||||
|         size2 = dc.GetTextExtent(label); | ||||
|         dc.DrawText(label, 0, 0); | ||||
|         if (vertical) | ||||
|             size2.y += 5; | ||||
|         else | ||||
|             size2.x += 5; | ||||
|         dc.DrawText(label, titleRect.x, (size.GetHeight() - textSize.GetHeight()) / 2); | ||||
|         titleRect.x += textSize.GetWidth() + 5; | ||||
|     } | ||||
|     dc.SetPen(pen); | ||||
|     if (vertical) { | ||||
|         size.x /= 2; | ||||
|         dc.DrawLine(size.x, size2.y, size.x, size.y); | ||||
|         if (titleRect.y > 0) titleRect.y += 5; | ||||
|         dc.DrawLine(size.x, titleRect.y, size.x, size.y); | ||||
|     } else { | ||||
|         size.y /= 2; | ||||
|         dc.DrawLine(size2.x, size.y, size.x, size.y); | ||||
|         dc.DrawLine(titleRect.x, size.y, size.x, size.y); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,26 +1,34 @@ | |||
| #ifndef slic3r_GUI_StaticLine_hpp_ | ||||
| #define slic3r_GUI_StaticLine_hpp_ | ||||
| 
 | ||||
| #include "../wxExtensions.hpp" | ||||
| #include "wx/window.h" | ||||
| 
 | ||||
| class StaticLine : public wxWindow | ||||
| { | ||||
| public: | ||||
|     StaticLine(wxWindow* parent, bool vertical = false, const wxString& label = {}); | ||||
|     StaticLine(wxWindow *parent, bool vertical = false, const wxString &label = {}, const wxString &icon = {}); | ||||
| 
 | ||||
| public: | ||||
|     void SetLabel(const wxString& label) override; | ||||
| 
 | ||||
|     void SetIcon(const wxString& icon); | ||||
| 
 | ||||
|     void SetLineColour(wxColour color); | ||||
|      | ||||
|     void Rescale(); | ||||
| 
 | ||||
| private: | ||||
|     wxPen pen; | ||||
|     bool vertical; | ||||
|     ScalableBitmap icon; | ||||
| 
 | ||||
| private: | ||||
|     void paintEvent(wxPaintEvent& evt); | ||||
| 
 | ||||
|     void render(wxDC& dc); | ||||
|     void messureSize(); | ||||
| 
 | ||||
|     void render(wxDC &dc); | ||||
| 
 | ||||
|     DECLARE_EVENT_TABLE() | ||||
| }; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 chunmao.guo
						chunmao.guo