mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Fixed #735 & PresetHints.cpp is marked to localization
* Macro _LC is created to put translated string into std::string correctly. * Macro _LU8 is changed to function L_str. * Created function from_u8
This commit is contained in:
		
							parent
							
								
									3d805a0f43
								
							
						
					
					
						commit
						bc97184c63
					
				
					 6 changed files with 83 additions and 66 deletions
				
			
		|  | @ -38,7 +38,7 @@ namespace Slic3r { namespace GUI { | |||
| 	wxString Field::get_tooltip_text(const wxString& default_string) | ||||
| 	{ | ||||
| 		wxString tooltip_text(""); | ||||
| 		wxString tooltip = _LU8(m_opt.tooltip); | ||||
| 		wxString tooltip = L_str(m_opt.tooltip); | ||||
| 		if (tooltip.length() > 0) | ||||
| 			tooltip_text = tooltip + "(" + _L("default") + ": " + | ||||
| 							(boost::iends_with(m_opt_id, "_gcode") ? "\n" : "") +  | ||||
|  |  | |||
|  | @ -555,4 +555,14 @@ AppConfig* get_app_config() | |||
| 	return g_AppConfig; | ||||
| } | ||||
| 
 | ||||
| wxString L_str(std::string str) | ||||
| { | ||||
| 	return wxGetTranslation(wxString(str.c_str(), wxConvUTF8)); | ||||
| } | ||||
| 
 | ||||
| wxString from_u8(std::string str) | ||||
| { | ||||
| 	return wxString::FromUTF8(str.c_str()); | ||||
| } | ||||
| 
 | ||||
| } } | ||||
|  |  | |||
|  | @ -25,13 +25,10 @@ class TabIface; | |||
| 
 | ||||
| //! macro used to localization, return wxString
 | ||||
| #define _L(s) wxGetTranslation(s) | ||||
| 
 | ||||
| //! macro used to localization of ConfigOptionDef's std::strings
 | ||||
| //! Explicitly specify that the source string is already in UTF-8 encoding
 | ||||
| #define _LU8(s) wxGetTranslation(wxString(s.c_str(), wxConvUTF8)) | ||||
| 
 | ||||
| //! macro used to mark string used at localization, 
 | ||||
| //! return same string
 | ||||
| //! macro used to localization, return wxScopedCharBuffer
 | ||||
| //! With wxConvUTF8 explicitly specify that the source string is already in UTF-8 encoding
 | ||||
| #define _LC(s) wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str() | ||||
| //! macro used to mark string used at localization, return same string
 | ||||
| #define _LS(s) s | ||||
| 
 | ||||
| namespace GUI { | ||||
|  | @ -112,6 +109,11 @@ void create_combochecklist(wxComboCtrl* comboCtrl, std::string text, std::string | |||
| // encoded inside an int.
 | ||||
| int combochecklist_get_flags(wxComboCtrl* comboCtrl); | ||||
| 
 | ||||
| // Return translated std::string as a wxString
 | ||||
| wxString	L_str(std::string str); | ||||
| // Return wxString from std::string in UTF8
 | ||||
| wxString	from_u8(std::string str); | ||||
| 
 | ||||
| } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -2,7 +2,6 @@ | |||
| #include "ConfigExceptions.hpp" | ||||
| 
 | ||||
| #include <utility> | ||||
| #include <wx/tooltip.h> | ||||
| #include <wx/numformatter.h> | ||||
| 
 | ||||
| namespace Slic3r { namespace GUI { | ||||
|  | @ -122,13 +121,13 @@ void OptionsGroup::append_line(const Line& line) { | |||
|     } | ||||
| 
 | ||||
|     // If there's a widget, build it and add the result to the sizer.
 | ||||
|     if (line.widget != nullptr) { | ||||
|         auto wgt = line.widget(parent()); | ||||
| 	if (line.widget != nullptr) { | ||||
| 		auto wgt = line.widget(parent()); | ||||
| 		grid_sizer->Add(wgt, 0, wxEXPAND | wxBOTTOM | wxTOP, wxOSX ? 0 : 5); | ||||
|         return; | ||||
|     } | ||||
|      | ||||
|     // if we have a single option with no sidetext just add it directly to the grid sizer
 | ||||
| 		return; | ||||
| 	} | ||||
| 	 | ||||
| 	// if we have a single option with no sidetext just add it directly to the grid sizer
 | ||||
|     if (option_set.size() == 1 && option_set.front().opt.sidetext.size() == 0 && | ||||
|         option_set.front().side_widget == nullptr && line.get_extra_widgets().size() == 0) { | ||||
|         const auto& option = option_set.front(); | ||||
|  | @ -152,7 +151,7 @@ void OptionsGroup::append_line(const Line& line) { | |||
| 		ConfigOptionDef option = opt.opt; | ||||
| 		// add label if any
 | ||||
| 		if (option.label != "") { | ||||
| 			auto field_label = new wxStaticText(parent(), wxID_ANY, _LU8(option.label) + ":", wxDefaultPosition, wxDefaultSize); | ||||
| 			auto field_label = new wxStaticText(parent(), wxID_ANY, L_str(option.label) + ":", wxDefaultPosition, wxDefaultSize); | ||||
| 			field_label->SetFont(label_font); | ||||
| 			sizer->Add(field_label, 0, wxALIGN_CENTER_VERTICAL, 0); | ||||
| 		} | ||||
|  | @ -166,7 +165,7 @@ void OptionsGroup::append_line(const Line& line) { | |||
| 		 | ||||
| 		// add sidetext if any
 | ||||
| 		if (option.sidetext != "") { | ||||
| 			auto sidetext = new wxStaticText(parent(), wxID_ANY, _LU8(option.sidetext), wxDefaultPosition, wxDefaultSize); | ||||
| 			auto sidetext = new wxStaticText(parent(), wxID_ANY, L_str(option.sidetext), wxDefaultPosition, wxDefaultSize); | ||||
| 			sidetext->SetFont(sidetext_font); | ||||
| 			sizer->Add(sidetext, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4); | ||||
| 		} | ||||
|  | @ -188,7 +187,7 @@ void OptionsGroup::append_line(const Line& line) { | |||
| } | ||||
| 
 | ||||
| Line OptionsGroup::create_single_option_line(const Option& option) const { | ||||
| 	Line retval{ _LU8(option.opt.label), _LU8(option.opt.tooltip) }; | ||||
| 	Line retval{ L_str(option.opt.label), L_str(option.opt.tooltip) }; | ||||
|     Option tmp(option); | ||||
|     tmp.opt.label = std::string(""); | ||||
|     retval.append_option(tmp); | ||||
|  |  | |||
|  | @ -6,8 +6,10 @@ | |||
| #include "Flow.hpp" | ||||
| 
 | ||||
| #include <boost/algorithm/string/predicate.hpp> | ||||
| #include <wx/intl.h>  | ||||
| 
 | ||||
| #include "../../libslic3r/libslic3r.h" | ||||
| #include "GUI.hpp" | ||||
| 
 | ||||
| namespace Slic3r { | ||||
| 
 | ||||
|  | @ -21,31 +23,31 @@ std::string PresetHints::cooling_description(const Preset &preset) | |||
| 		int 	max_fan_speed 				= preset.config.opt_int("max_fan_speed", 0); | ||||
| 		int 	min_print_speed				= int(preset.config.opt_float("min_print_speed", 0) + 0.5); | ||||
| 		int 	fan_below_layer_time		= preset.config.opt_int("fan_below_layer_time", 0); | ||||
| 		sprintf(buf, "If estimated layer time is below ~%ds, fan will run at %d%% and print speed will be reduced so that no less than %ds are spent on that layer (however, speed will never be reduced below %dmm/s).", | ||||
| 		sprintf(buf, _LC("If estimated layer time is below ~%ds, fan will run at %d%% and print speed will be reduced so that no less than %ds are spent on that layer (however, speed will never be reduced below %dmm/s)."), | ||||
|             slowdown_below_layer_time, max_fan_speed, slowdown_below_layer_time, min_print_speed); | ||||
| 		out += buf; | ||||
|         if (fan_below_layer_time > slowdown_below_layer_time) { | ||||
|             sprintf(buf, "\nIf estimated layer time is greater, but still below ~%ds, fan will run at a proportionally decreasing speed between %d%% and %d%%.", | ||||
| 			sprintf(buf, _LC("\nIf estimated layer time is greater, but still below ~%ds, fan will run at a proportionally decreasing speed between %d%% and %d%%."), | ||||
|                 fan_below_layer_time, max_fan_speed, min_fan_speed); | ||||
|             out += buf; | ||||
|         } | ||||
|         out += "\nDuring the other layers, fan "; | ||||
| 		out += _LC("\nDuring the other layers, fan "); | ||||
|     } else { | ||||
|         out = "Fan "; | ||||
|         out = _LC("Fan "); | ||||
|     } | ||||
| 	if (preset.config.opt_bool("fan_always_on", 0)) { | ||||
| 		int 	disable_fan_first_layers 	= preset.config.opt_int("disable_fan_first_layers", 0); | ||||
| 		int 	min_fan_speed 				= preset.config.opt_int("min_fan_speed", 0); | ||||
|         sprintf(buf, "will always run at %d%% ", min_fan_speed); | ||||
|         sprintf(buf, _LC("will always run at %d%% "), min_fan_speed); | ||||
|         out += buf; | ||||
|         if (disable_fan_first_layers > 1) { | ||||
|         	sprintf(buf, "except for the first %d layers", disable_fan_first_layers); | ||||
|         	sprintf(buf, _LC("except for the first %d layers"), disable_fan_first_layers); | ||||
| 	        out += buf; | ||||
|         } | ||||
|         else if (disable_fan_first_layers == 1) | ||||
|         	out += "except for the first layer"; | ||||
|         	out += _LC("except for the first layer"); | ||||
|     } else | ||||
|     	out += "will be turned off."; | ||||
|     	out += _LC("will be turned off."); | ||||
| 
 | ||||
|     return out; | ||||
| } | ||||
|  | @ -146,7 +148,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle | |||
|                     limit_by_first_layer_speed(std::max(external_perimeter_speed, small_perimeter_speed), max_print_speed)); | ||||
|             if (max_flow < external_perimeter_rate) { | ||||
|                 max_flow = external_perimeter_rate; | ||||
|                 max_flow_extrusion_type = "external perimeters"; | ||||
|                 max_flow_extrusion_type = _LC("external perimeters"); | ||||
|             } | ||||
|             double perimeter_rate = Flow::new_from_config_width(frPerimeter,  | ||||
|                 first_positive(first_layer_extrusion_width_ptr, perimeter_extrusion_width, extrusion_width),  | ||||
|  | @ -155,7 +157,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle | |||
|                     limit_by_first_layer_speed(std::max(perimeter_speed, small_perimeter_speed), max_print_speed)); | ||||
|             if (max_flow < perimeter_rate) { | ||||
|                 max_flow = perimeter_rate; | ||||
|                 max_flow_extrusion_type = "perimeters"; | ||||
|                 max_flow_extrusion_type = _LC("perimeters"); | ||||
|             } | ||||
|         } | ||||
|         if (! bridging && infill_extruder_active) { | ||||
|  | @ -164,7 +166,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle | |||
|                 nozzle_diameter, lh, bfr).mm3_per_mm() * limit_by_first_layer_speed(infill_speed, max_print_speed); | ||||
|             if (max_flow < infill_rate) { | ||||
|                 max_flow = infill_rate; | ||||
|                 max_flow_extrusion_type = "infill"; | ||||
|                 max_flow_extrusion_type = _LC("infill"); | ||||
|             } | ||||
|         } | ||||
|         if (solid_infill_extruder_active) { | ||||
|  | @ -174,7 +176,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle | |||
|                 (bridging ? bridge_speed : limit_by_first_layer_speed(solid_infill_speed, max_print_speed)); | ||||
|             if (max_flow < solid_infill_rate) { | ||||
|                 max_flow = solid_infill_rate; | ||||
|                 max_flow_extrusion_type = "solid infill"; | ||||
|                 max_flow_extrusion_type = _LC("solid infill"); | ||||
|             } | ||||
|             if (! bridging) { | ||||
|                 double top_solid_infill_rate = Flow::new_from_config_width(frInfill,  | ||||
|  | @ -182,7 +184,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle | |||
|                     nozzle_diameter, lh, bfr).mm3_per_mm() * limit_by_first_layer_speed(top_solid_infill_speed, max_print_speed); | ||||
|                 if (max_flow < top_solid_infill_rate) { | ||||
|                     max_flow = top_solid_infill_rate; | ||||
|                     max_flow_extrusion_type = "top solid infill"; | ||||
|                     max_flow_extrusion_type = _LC("top solid infill"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | @ -193,7 +195,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle | |||
|                 (bridging ? bridge_speed : limit_by_first_layer_speed(support_material_speed, max_print_speed)); | ||||
|             if (max_flow < support_material_rate) { | ||||
|                 max_flow = support_material_rate; | ||||
|                 max_flow_extrusion_type = "support"; | ||||
|                 max_flow_extrusion_type = _LC("support"); | ||||
|             } | ||||
|         } | ||||
|         if (support_material_interface_extruder_active) { | ||||
|  | @ -203,25 +205,25 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle | |||
|                 (bridging ? bridge_speed : limit_by_first_layer_speed(support_material_interface_speed, max_print_speed)); | ||||
|             if (max_flow < support_material_interface_rate) { | ||||
|                 max_flow = support_material_interface_rate; | ||||
|                 max_flow_extrusion_type = "support interface"; | ||||
|                 max_flow_extrusion_type = _LC("support interface"); | ||||
|             } | ||||
|         } | ||||
|         //FIXME handle gap_fill_speed
 | ||||
|         if (! out.empty()) | ||||
|             out += "\n"; | ||||
|         out += (first_layer ? "First layer volumetric" : (bridging ? "Bridging volumetric" : "Volumetric")); | ||||
|         out += " flow rate is maximized "; | ||||
|         out += (first_layer ? _LC("First layer volumetric") : (bridging ? _LC("Bridging volumetric") : _LC("Volumetric"))); | ||||
|         out += _LC(" flow rate is maximized "); | ||||
|         bool limited_by_max_volumetric_speed = max_volumetric_speed > 0 && max_volumetric_speed < max_flow; | ||||
|         out += (limited_by_max_volumetric_speed ?  | ||||
|             "by the print profile maximum" :  | ||||
|             ("when printing " + max_flow_extrusion_type)) | ||||
|             + " with a volumetric rate "; | ||||
|             _LC("by the print profile maximum") :  | ||||
|             (_LC("when printing ") + max_flow_extrusion_type)) | ||||
|             + _LC(" with a volumetric rate "); | ||||
|         if (limited_by_max_volumetric_speed) | ||||
|             max_flow = max_volumetric_speed; | ||||
|         char buf[2048]; | ||||
|         sprintf(buf, "%3.2f mm³/s", max_flow); | ||||
|         sprintf(buf, _LC("%3.2f mm³/s"), max_flow); | ||||
|         out += buf; | ||||
|         sprintf(buf, " at filament speed %3.2f mm/s.", max_flow / filament_crossection); | ||||
|         sprintf(buf, _LC(" at filament speed %3.2f mm/s."), max_flow / filament_crossection); | ||||
|         out += buf; | ||||
|     } | ||||
| 
 | ||||
|  | @ -238,8 +240,11 @@ std::string PresetHints::recommended_thin_wall_thickness(const PresetBundle &pre | |||
|     bool    thin_walls                          = print_config.opt_bool("thin_walls"); | ||||
|     float   nozzle_diameter                     = float(printer_config.opt_float("nozzle_diameter", 0)); | ||||
|      | ||||
|     if (layer_height <= 0.f) | ||||
|         return "Recommended object thin wall thickness: Not available due to invalid layer height."; | ||||
|     std::string out; | ||||
| 	if (layer_height <= 0.f){ | ||||
| 		out += _LC("Recommended object thin wall thickness: Not available due to invalid layer height."); | ||||
| 		return out; | ||||
| 	} | ||||
| 
 | ||||
|     Flow    external_perimeter_flow             = Flow::new_from_config_width( | ||||
|         frExternalPerimeter,  | ||||
|  | @ -250,18 +255,18 @@ std::string PresetHints::recommended_thin_wall_thickness(const PresetBundle &pre | |||
|         *print_config.opt<ConfigOptionFloatOrPercent>("perimeter_extrusion_width"),  | ||||
|         nozzle_diameter, layer_height, false); | ||||
| 
 | ||||
|     std::string out; | ||||
|      | ||||
|     if (num_perimeters > 0) { | ||||
|         int num_lines = std::min(num_perimeters * 2, 10); | ||||
|         char buf[256]; | ||||
|         sprintf(buf, "Recommended object thin wall thickness for layer height %.2f and ", layer_height); | ||||
|         sprintf(buf, _LC("Recommended object thin wall thickness for layer height %.2f and "), layer_height); | ||||
|         out += buf; | ||||
|         // Start with the width of two closely spaced 
 | ||||
|         double width = external_perimeter_flow.width + external_perimeter_flow.spacing(); | ||||
|         for (int i = 2; i <= num_lines; thin_walls ? ++ i : i += 2) { | ||||
|             if (i > 2) | ||||
|                 out += ", "; | ||||
|             sprintf(buf, "%d lines: %.2lf mm", i, width); | ||||
|             sprintf(buf, _LC("%d lines: %.2lf mm"), i, width); | ||||
|             out += buf; | ||||
|             width += perimeter_flow.spacing() * (thin_walls ? 1.f : 2.f); | ||||
|         } | ||||
|  |  | |||
|  | @ -33,18 +33,18 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle) | |||
| 
 | ||||
| 	// preset chooser
 | ||||
| 	m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(270, -1), 0, 0,wxCB_READONLY); | ||||
| 	const wxBitmap* bmp = new wxBitmap(wxString::FromUTF8(Slic3r::var("flag-green-icon.png").c_str()), wxBITMAP_TYPE_PNG); | ||||
| 	const wxBitmap* bmp = new wxBitmap(from_u8(Slic3r::var("flag-green-icon.png")), wxBITMAP_TYPE_PNG); | ||||
| 
 | ||||
| 	//buttons
 | ||||
| 	wxBitmap bmpMenu; | ||||
| 	bmpMenu = wxBitmap(wxString::FromUTF8(Slic3r::var("disk.png").c_str()), wxBITMAP_TYPE_PNG); | ||||
| 	bmpMenu = wxBitmap(from_u8(Slic3r::var("disk.png")), wxBITMAP_TYPE_PNG); | ||||
| 	m_btn_save_preset = new wxBitmapButton(panel, wxID_ANY, bmpMenu, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE); | ||||
| 	bmpMenu = wxBitmap(wxString::FromUTF8(Slic3r::var("delete.png").c_str()), wxBITMAP_TYPE_PNG); | ||||
| 	bmpMenu = wxBitmap(from_u8(Slic3r::var("delete.png")), wxBITMAP_TYPE_PNG); | ||||
| 	m_btn_delete_preset = new wxBitmapButton(panel, wxID_ANY, bmpMenu, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE); | ||||
| 
 | ||||
| 	m_show_incompatible_presets = false; | ||||
| 	m_bmp_show_incompatible_presets = new wxBitmap(wxString::FromUTF8(Slic3r::var("flag-red-icon.png").c_str()), wxBITMAP_TYPE_PNG); | ||||
| 	m_bmp_hide_incompatible_presets = new wxBitmap(wxString::FromUTF8(Slic3r::var("flag-green-icon.png").c_str()), wxBITMAP_TYPE_PNG); | ||||
| 	m_bmp_show_incompatible_presets = new wxBitmap(from_u8(Slic3r::var("flag-red-icon.png")), wxBITMAP_TYPE_PNG); | ||||
| 	m_bmp_hide_incompatible_presets = new wxBitmap(from_u8(Slic3r::var("flag-green-icon.png")), wxBITMAP_TYPE_PNG); | ||||
| 	m_btn_hide_incompatible_presets = new wxBitmapButton(panel, wxID_ANY, *m_bmp_hide_incompatible_presets, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE); | ||||
| 
 | ||||
| 	m_btn_save_preset->SetToolTip(_L("Save current ") + m_title); | ||||
|  | @ -117,7 +117,7 @@ PageShp Tab::add_options_page(wxString title, std::string icon, bool is_extruder | |||
| 			icon_idx = -1; | ||||
| 		if (icon_idx == -1) { | ||||
| 			// Add a new icon to the icon list.
 | ||||
| 			const auto img_icon = new wxIcon(wxString::FromUTF8(Slic3r::var(icon).c_str()), wxBITMAP_TYPE_PNG); | ||||
| 			const auto img_icon = new wxIcon(from_u8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG); | ||||
| 			m_icons->Add(*img_icon); | ||||
| 			icon_idx = ++m_icon_count; | ||||
| 			m_icon_index[icon] = icon_idx; | ||||
|  | @ -545,6 +545,7 @@ void TabPrint::update() | |||
| 			new_conf.set_key_value("top_solid_layers", new ConfigOptionInt(0)); | ||||
| 			new_conf.set_key_value("fill_density", new ConfigOptionPercent(0)); | ||||
| 			new_conf.set_key_value("support_material", new ConfigOptionBool(false)); | ||||
| 			new_conf.set_key_value("support_material_enforce_layers", new ConfigOptionInt(0)); | ||||
| 			new_conf.set_key_value("ensure_vertical_shell_thickness", new ConfigOptionBool(false)); | ||||
| 		} | ||||
| 		else { | ||||
|  | @ -790,7 +791,7 @@ void TabFilament::build() | |||
| 		optgroup->append_single_option_line("filament_density"); | ||||
| 		optgroup->append_single_option_line("filament_cost"); | ||||
| 
 | ||||
| 		optgroup = page->new_optgroup(_L("Temperature") +" (\u00B0C)"); // degree sign
 | ||||
| 		optgroup = page->new_optgroup(_L("Temperature (°C)")/* +" (\u00B0C)"*/); // degree sign
 | ||||
| 		Line line = { _L("Extruder"), "" }; | ||||
| 		line.append_option(optgroup->get_option("first_layer_temperature")); | ||||
| 		line.append_option(optgroup->get_option("temperature")); | ||||
|  | @ -884,9 +885,9 @@ void TabFilament::reload_config(){ | |||
| 
 | ||||
| void TabFilament::update() | ||||
| { | ||||
| 	wxString text = wxString::FromUTF8(PresetHints::cooling_description(m_presets->get_edited_preset()).c_str()); | ||||
| 	wxString text = from_u8(PresetHints::cooling_description(m_presets->get_edited_preset())); | ||||
| 	m_cooling_description_line->SetText(text); | ||||
| 	text = wxString::FromUTF8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle).c_str()); | ||||
| 	text = from_u8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle)); | ||||
| 	m_volumetric_speed_description_line->SetText(text); | ||||
| 
 | ||||
| 	bool cooling = m_config->opt_bool("cooling", 0); | ||||
|  | @ -904,7 +905,7 @@ void TabFilament::update() | |||
| 
 | ||||
| void TabFilament::OnActivate() | ||||
| { | ||||
| 	m_volumetric_speed_description_line->SetText(wxString::FromUTF8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle).c_str())); | ||||
| 	m_volumetric_speed_description_line->SetText(from_u8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle))); | ||||
| } | ||||
| 
 | ||||
| wxSizer* Tab::description_line_widget(wxWindow* parent, ogStaticText* *StaticText) | ||||
|  | @ -938,9 +939,9 @@ void TabPrinter::build() | |||
| 
 | ||||
| 		Line line{ _L("Bed shape"), "" }; | ||||
| 		line.widget = [this](wxWindow* parent){ | ||||
| 			auto btn = new wxButton(parent, wxID_ANY, _L("Set")+"\u2026", wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxBU_EXACTFIT); | ||||
| 			auto btn = new wxButton(parent, wxID_ANY, _L(" Set …")/*+"\u2026"*/, wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxBU_EXACTFIT); | ||||
| //			btn->SetFont(Slic3r::GUI::small_font);
 | ||||
| 			btn->SetBitmap(wxBitmap(wxString::FromUTF8(Slic3r::var("printer_empty.png").c_str()), wxBITMAP_TYPE_PNG)); | ||||
| 			btn->SetBitmap(wxBitmap(from_u8(Slic3r::var("printer_empty.png")), wxBITMAP_TYPE_PNG)); | ||||
| 
 | ||||
| 			auto sizer = new wxBoxSizer(wxHORIZONTAL); | ||||
| 			sizer->Add(btn); | ||||
|  | @ -989,7 +990,7 @@ void TabPrinter::build() | |||
| 			line = {_L("Serial port"), ""}; | ||||
| 			Option serial_port = optgroup->get_option("serial_port"); | ||||
| 			serial_port.side_widget = ([this](wxWindow* parent){ | ||||
| 				auto btn = new wxBitmapButton(parent, wxID_ANY, wxBitmap(wxString::FromUTF8(Slic3r::var("arrow_rotate_clockwise.png").c_str()), wxBITMAP_TYPE_PNG), | ||||
| 				auto btn = new wxBitmapButton(parent, wxID_ANY, wxBitmap(from_u8(Slic3r::var("arrow_rotate_clockwise.png")), wxBITMAP_TYPE_PNG), | ||||
| 					wxDefaultPosition, wxDefaultSize, wxBORDER_NONE); | ||||
| 				btn->SetToolTip(_L("Rescan serial ports")); | ||||
| 				auto sizer = new wxBoxSizer(wxHORIZONTAL); | ||||
|  | @ -1002,7 +1003,7 @@ void TabPrinter::build() | |||
| 				auto btn = m_serial_test_btn = new wxButton(parent, wxID_ANY, | ||||
| 					_L("Test"), wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxBU_EXACTFIT); | ||||
| //				btn->SetFont($Slic3r::GUI::small_font);
 | ||||
| 				btn->SetBitmap(wxBitmap(wxString::FromUTF8(Slic3r::var("wrench.png").c_str()), wxBITMAP_TYPE_PNG)); | ||||
| 				btn->SetBitmap(wxBitmap(from_u8(Slic3r::var("wrench.png")), wxBITMAP_TYPE_PNG)); | ||||
| 				auto sizer = new wxBoxSizer(wxHORIZONTAL); | ||||
| 				sizer->Add(btn); | ||||
| 
 | ||||
|  | @ -1031,9 +1032,9 @@ void TabPrinter::build() | |||
| 		optgroup = page->new_optgroup(_L("OctoPrint upload")); | ||||
| 		// # append two buttons to the Host line
 | ||||
| 		auto octoprint_host_browse = [this] (wxWindow* parent) { | ||||
| 			auto btn = new wxButton(parent, wxID_ANY, _L("Browse")+"\u2026", wxDefaultPosition, wxDefaultSize, wxBU_LEFT); | ||||
| 			auto btn = new wxButton(parent, wxID_ANY, _L(" Browse …")/*+"\u2026"*/, wxDefaultPosition, wxDefaultSize, wxBU_LEFT); | ||||
| //			btn->SetFont($Slic3r::GUI::small_font);
 | ||||
| 			btn->SetBitmap(wxBitmap(wxString::FromUTF8(Slic3r::var("zoom.png").c_str()), wxBITMAP_TYPE_PNG)); | ||||
| 			btn->SetBitmap(wxBitmap(from_u8(Slic3r::var("zoom.png")), wxBITMAP_TYPE_PNG)); | ||||
| 			auto sizer = new wxBoxSizer(wxHORIZONTAL); | ||||
| 			sizer->Add(btn); | ||||
| 
 | ||||
|  | @ -1071,7 +1072,7 @@ void TabPrinter::build() | |||
| 			auto btn = m_octoprint_host_test_btn = new wxButton(parent, wxID_ANY, _L("Test"),  | ||||
| 				wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxBU_EXACTFIT); | ||||
| //			btn->SetFont($Slic3r::GUI::small_font);
 | ||||
| 			btn->SetBitmap(wxBitmap(wxString::FromUTF8(Slic3r::var("wrench.png").c_str()), wxBITMAP_TYPE_PNG)); | ||||
| 			btn->SetBitmap(wxBitmap(from_u8(Slic3r::var("wrench.png")), wxBITMAP_TYPE_PNG)); | ||||
| 			auto sizer = new wxBoxSizer(wxHORIZONTAL); | ||||
| 			sizer->Add(btn); | ||||
| 
 | ||||
|  | @ -1630,9 +1631,9 @@ void Tab::update_ui_from_settings() | |||
| wxSizer* Tab::compatible_printers_widget(wxWindow* parent, wxCheckBox** checkbox, wxButton** btn) | ||||
| { | ||||
| 	*checkbox = new wxCheckBox(parent, wxID_ANY, _L("All")); | ||||
| 	*btn = new wxButton(parent, wxID_ANY, _L("Set")+"\u2026", wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxBU_EXACTFIT); | ||||
| 	*btn = new wxButton(parent, wxID_ANY, _L(" Set …")/*+"\u2026"*/, wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxBU_EXACTFIT); | ||||
| 
 | ||||
| 	(*btn)->SetBitmap(wxBitmap(wxString::FromUTF8(Slic3r::var("printer_empty.png").c_str()), wxBITMAP_TYPE_PNG)); | ||||
| 	(*btn)->SetBitmap(wxBitmap(from_u8(Slic3r::var("printer_empty.png")), wxBITMAP_TYPE_PNG)); | ||||
| 
 | ||||
| 	auto sizer = new wxBoxSizer(wxHORIZONTAL); | ||||
| 	sizer->Add((*checkbox), 0, wxALIGN_CENTER_VERTICAL); | ||||
|  | @ -1746,10 +1747,10 @@ void SavePresetWindow::build(wxString title, std::string default_name, std::vect | |||
| { | ||||
| 	auto text = new wxStaticText(this, wxID_ANY, _L("Save ") + title + _L(" as:"),  | ||||
| 									wxDefaultPosition, wxDefaultSize); | ||||
| 	m_combo = new wxComboBox(this, wxID_ANY, wxString::FromUTF8(default_name.c_str()),  | ||||
| 	m_combo = new wxComboBox(this, wxID_ANY, from_u8(default_name),  | ||||
| 							wxDefaultPosition, wxDefaultSize, 0, 0, wxTE_PROCESS_ENTER); | ||||
| 	for (auto value : values) | ||||
| 		m_combo->Append(wxString::FromUTF8(value.c_str())); | ||||
| 		m_combo->Append(from_u8(value)); | ||||
| 	auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL); | ||||
| 
 | ||||
| 	auto sizer = new wxBoxSizer(wxVERTICAL); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 YuSanka
						YuSanka