mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	escape_ampersand function and changed order of printer names and pictures in config wizard
This commit is contained in:
		
							parent
							
								
									4f85a42830
								
							
						
					
					
						commit
						0a4ce079e8
					
				
					 3 changed files with 23 additions and 3 deletions
				
			
		|  | @ -192,6 +192,23 @@ bool unescape_strings_cstyle(const std::string &str, std::vector<std::string> &o | |||
|     } | ||||
| } | ||||
| 
 | ||||
| std::string escape_ampersand(const std::string& str) | ||||
| { | ||||
|     // Allocate a buffer 2 times the input string length,
 | ||||
|     // so the output will fit even if all input characters get escaped.
 | ||||
|     std::vector<char> out(str.size() * 6, 0); | ||||
|     char* outptr = out.data(); | ||||
|     for (size_t i = 0; i < str.size(); ++i) { | ||||
|         char c = str[i]; | ||||
|         if (c == '&') { | ||||
|             (*outptr++) = '&'; | ||||
|             (*outptr++) = '&'; | ||||
|         } else | ||||
|             (*outptr++) = c; | ||||
|     } | ||||
|     return std::string(out.data(), outptr - out.data()); | ||||
| } | ||||
| 
 | ||||
| std::vector<std::string> ConfigOptionDef::cli_args(const std::string &key) const | ||||
| { | ||||
| 	std::vector<std::string> args; | ||||
|  |  | |||
|  | @ -34,6 +34,8 @@ extern std::string  escape_strings_cstyle(const std::vector<std::string> &strs); | |||
| extern bool         unescape_string_cstyle(const std::string &str, std::string &out); | ||||
| extern bool         unescape_strings_cstyle(const std::string &str, std::vector<std::string> &out); | ||||
| 
 | ||||
| extern std::string  escape_ampersand(const std::string& str); | ||||
| 
 | ||||
| /// Specialization of std::exception to indicate that an unknown config option has been encountered.
 | ||||
| class UnknownOptionException : public Slic3r::RuntimeError { | ||||
| public: | ||||
|  |  | |||
|  | @ -27,6 +27,7 @@ | |||
| #include <wx/debug.h> | ||||
| 
 | ||||
| #include "libslic3r/Utils.hpp" | ||||
| #include "libslic3r/Config.hpp" | ||||
| #include "GUI.hpp" | ||||
| #include "GUI_App.hpp" | ||||
| #include "GUI_Utils.hpp" | ||||
|  | @ -273,8 +274,8 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, wxSt | |||
|         const size_t odd_items = titles.size() % cols; | ||||
| 
 | ||||
|         for (size_t i = 0; i < titles.size() - odd_items; i += cols) { | ||||
|             for (size_t j = i; j < i + cols; j++) { printer_grid->Add(titles[j], 0, wxBOTTOM, 3); } | ||||
|             for (size_t j = i; j < i + cols; j++) { printer_grid->Add(bitmaps[j], 0, wxBOTTOM, 20); } | ||||
|             for (size_t j = i; j < i + cols; j++) { printer_grid->Add(titles[j], 0, wxBOTTOM, 3); } | ||||
|             for (size_t j = i; j < i + cols; j++) { printer_grid->Add(variants_panels[j]); } | ||||
| 
 | ||||
|             // Add separator space to multiliners
 | ||||
|  | @ -285,10 +286,10 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, wxSt | |||
|         if (odd_items > 0) { | ||||
|             const size_t rem = titles.size() - odd_items; | ||||
| 
 | ||||
|             for (size_t i = rem; i < titles.size(); i++) { printer_grid->Add(titles[i], 0, wxBOTTOM, 3); } | ||||
|             for (size_t i = 0; i < cols - odd_items; i++) { printer_grid->AddSpacer(1); } | ||||
|             for (size_t i = rem; i < titles.size(); i++) { printer_grid->Add(bitmaps[i], 0, wxBOTTOM, 20); } | ||||
|             for (size_t i = 0; i < cols - odd_items; i++) { printer_grid->AddSpacer(1); } | ||||
|             for (size_t i = rem; i < titles.size(); i++) { printer_grid->Add(titles[i], 0, wxBOTTOM, 3); } | ||||
|             for (size_t i = 0; i < cols - odd_items; i++) { printer_grid->AddSpacer(1); } | ||||
|             for (size_t i = rem; i < titles.size(); i++) { printer_grid->Add(variants_panels[i]); } | ||||
|         } | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 David Kocik
						David Kocik