mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 04:25:55 +08:00
Move trim_zeroes to misc_ui
This commit is contained in:
parent
e66cda51bf
commit
9dc4343029
@ -342,15 +342,7 @@ private:
|
||||
void _set_value(Slic3r::Pointf3 value);
|
||||
void _set_value(std::string value);
|
||||
|
||||
/// Remove extra zeroes generated from std::to_string on doubles
|
||||
std::string trim_zeroes(std::string in) {
|
||||
std::string result {""};
|
||||
std::regex strip_zeroes("(0*)$");
|
||||
std::regex_replace (std::back_inserter(result), in.begin(), in.end(), strip_zeroes, "");
|
||||
if (result.back() == '.') result.append("0");
|
||||
return result;
|
||||
}
|
||||
wxString trim_zeroes(wxString in) { return wxString(trim_zeroes(in.ToStdString())); }
|
||||
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <regex>
|
||||
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
@ -147,5 +148,16 @@ std::vector<wxString> open_model(wxWindow* parent, wxWindow* top) {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/// Remove extra zeroes generated from std::to_string on doubles
|
||||
std::string trim_zeroes(std::string in) {
|
||||
std::string result {""};
|
||||
std::regex strip_zeroes("(0*)$");
|
||||
std::regex_replace (std::back_inserter(result), in.begin(), in.end(), strip_zeroes, "");
|
||||
if (result.back() == '.') result.append("0");
|
||||
return result;
|
||||
}
|
||||
|
||||
wxString trim_zeroes(wxString in) { return wxString(trim_zeroes(in.ToStdString())); }
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
|
@ -155,6 +155,10 @@ inline Slic3r::Point new_scale(const wxPoint& p) { return Slic3r::Point::new_sca
|
||||
/// Singleton for UI settings.
|
||||
extern std::unique_ptr<Settings> ui_settings;
|
||||
|
||||
std::string trim_zeroes(std::string in);
|
||||
wxString trim_zeroes(wxString in);
|
||||
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
#endif // MISC_UI_HPP
|
||||
|
Loading…
x
Reference in New Issue
Block a user