Preset and PresetBundle are moved to the _libslic3r_ folder

This commit is contained in:
YuSanka 2020-06-16 16:58:41 +02:00
parent 43e6e4f18c
commit 19c4f32604
38 changed files with 61 additions and 73 deletions

View file

@ -147,6 +147,10 @@ add_library(libslic3r STATIC
PolygonTrimmer.hpp
Polyline.cpp
Polyline.hpp
Preset.cpp
Preset.hpp
PresetBundle.cpp
PresetBundle.hpp
Print.cpp
Print.hpp
PrintBase.cpp

View file

@ -1,8 +1,7 @@
#include <cassert>
#include "Preset.hpp"
#include "AppConfig.hpp"
#include "I18N.hpp"
#include "slic3r/GUI/AppConfig.hpp"
#ifdef _MSC_VER
#define WIN32_LEAN_AND_MEAN
@ -10,6 +9,16 @@
#include <Windows.h>
#endif /* _MSC_VER */
// instead of #include "slic3r/GUI/I18N.hpp" :
#ifndef L
// !!! If you needed to translate some string,
// !!! please use _L(string)
// !!! _() - is a standard wxWidgets macro to translate
// !!! L() is used only for marking localizable string
// !!! It will be used in "xgettext" to create a Locating Message Catalog.
#define L(s) s
#endif /* L */
#include <algorithm>
#include <fstream>
#include <stdexcept>
@ -28,9 +37,9 @@
#include <boost/locale.hpp>
#include <boost/log/trivial.hpp>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Utils.hpp"
#include "libslic3r/PlaceholderParser.hpp"
#include "libslic3r.h"
#include "Utils.hpp"
#include "PlaceholderParser.hpp"
using boost::property_tree::ptree;
@ -237,9 +246,9 @@ const std::string& Preset::suffix_modified()
return g_suffix_modified;
}
void Preset::update_suffix_modified()
void Preset::update_suffix_modified(const std::string& new_suffix_modified)
{
g_suffix_modified = (" (" + _(L("modified")) + ")").ToUTF8().data();
g_suffix_modified = new_suffix_modified;
}
// Remove an optional "(modified)" suffix from a name.
// This converts a UI name to a unique preset identifier.

View file

@ -8,16 +8,8 @@
#include <boost/filesystem/path.hpp>
#include <boost/property_tree/ptree_fwd.hpp>
#include "libslic3r/libslic3r.h"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/Semver.hpp"
class wxBitmap;
class wxBitmapComboBox;
class wxChoice;
class wxItemContainer;
class wxString;
class wxWindow;
#include "PrintConfig.hpp"
#include "Semver.hpp"
namespace Slic3r {
@ -231,7 +223,7 @@ public:
static const std::vector<std::string>& sla_material_options();
static const std::vector<std::string>& sla_print_options();
static void update_suffix_modified();
static void update_suffix_modified(const std::string& new_suffix_modified);
static const std::string& suffix_modified();
static std::string remove_suffix_modified(const std::string& name);
static void normalize(DynamicPrintConfig &config);

View file

@ -1,7 +1,9 @@
#include <cassert>
#include "PresetBundle.hpp"
#include "Plater.hpp"
#include "libslic3r.h"
#include "Utils.hpp"
#include "Model.hpp"
#include <algorithm>
#include <set>
@ -19,14 +21,6 @@
#include <boost/locale.hpp>
#include <boost/log/trivial.hpp>
#include <wx/image.h>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Model.hpp"
#include "GUI_App.hpp"
#include "libslic3r/CustomGCode.hpp"
// Store the print/filament/printer presets into a "presets" subdirectory of the Slic3rPE config dir.
// This breaks compatibility with the upstream Slic3r if the --datadir is used to switch between the two versions.
@ -49,9 +43,6 @@ PresetBundle::PresetBundle() :
sla_prints(Preset::TYPE_SLA_PRINT, Preset::sla_print_options(), static_cast<const SLAPrintObjectConfig&>(SLAFullPrintConfig::defaults())),
printers(Preset::TYPE_PRINTER, Preset::printer_options(), static_cast<const HostConfig&>(FullPrintConfig::defaults()), "- default FFF -")
{
if (wxImage::FindHandler(wxBITMAP_TYPE_PNG) == nullptr)
wxImage::AddHandler(new wxPNGHandler);
// The following keys are handled by the UI, they do not have a counterpart in any StaticPrintConfig derived classes,
// therefore they need to be handled differently. As they have no counterpart in StaticPrintConfig, they are not being
// initialized based on PrintConfigDef(), but to empty values (zeros, empty vectors, empty strings).
@ -822,8 +813,6 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
// 4) Load the project config values (the per extruder wipe matrix etc).
this->project_config.apply_only(config, s_project_options);
CustomGCode::update_custom_gcode_per_print_z_from_config(GUI::wxGetApp().plater()->model().custom_gcode_per_print_z, &this->project_config);
break;
}
case ptSLA:

View file

@ -1,14 +1,13 @@
#ifndef slic3r_PresetBundle_hpp_
#define slic3r_PresetBundle_hpp_
#include "AppConfig.hpp"
#include "Preset.hpp"
#include <memory>
#include <unordered_map>
#include <boost/filesystem/path.hpp>
class wxWindow;
#include "slic3r/GUI/AppConfig.hpp"
namespace Slic3r {

View file

@ -61,10 +61,6 @@ set(SLIC3R_GUI_SOURCES
GUI/GLToolbar.cpp
GUI/Preferences.cpp
GUI/Preferences.hpp
GUI/Preset.cpp
GUI/Preset.hpp
GUI/PresetBundle.cpp
GUI/PresetBundle.hpp
GUI/PresetHints.cpp
GUI/PresetHints.hpp
GUI/GUI.cpp

View file

@ -1,6 +1,5 @@
#include "Snapshot.hpp"
#include "../GUI/AppConfig.hpp"
#include "../GUI/PresetBundle.hpp"
#include <time.h>
@ -11,7 +10,7 @@
#include <boost/property_tree/ptree_fwd.hpp>
#include <boost/filesystem/operations.hpp>
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Time.hpp"
#include "libslic3r/Config.hpp"

View file

@ -7,7 +7,7 @@
#include "libslic3r/BoundingBox.hpp"
#include "GUI_App.hpp"
#include "PresetBundle.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "GLCanvas3D.hpp"
#include <GL/glew.h>

View file

@ -2,7 +2,7 @@
#include "ConfigManipulation.hpp"
#include "I18N.hpp"
#include "GUI_App.hpp"
#include "PresetBundle.hpp"
#include "libslic3r/PresetBundle.hpp"
#include <wx/msgdlg.h>

View file

@ -20,9 +20,9 @@
#include <wx/radiobut.h>
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "slic3r/Utils/PresetUpdater.hpp"
#include "AppConfig.hpp"
#include "PresetBundle.hpp"
#include "BedShapeDialog.hpp"
#include "GUI.hpp"
#include "wxExtensions.hpp"

View file

@ -13,11 +13,11 @@
#include "libslic3r/Utils.hpp"
#include "libslic3r/Technologies.hpp"
#include "libslic3r/Tesselate.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "slic3r/GUI/3DScene.hpp"
#include "slic3r/GUI/BackgroundSlicingProcess.hpp"
#include "slic3r/GUI/GLShader.hpp"
#include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/PresetBundle.hpp"
#include "slic3r/GUI/Tab.hpp"
#include "slic3r/GUI/GUI_Preview.hpp"
#include "slic3r/GUI/OpenGLManager.hpp"

View file

@ -31,11 +31,11 @@
#include "libslic3r/Utils.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/I18N.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "GUI.hpp"
#include "GUI_Utils.hpp"
#include "AppConfig.hpp"
#include "PresetBundle.hpp"
#include "3DScene.hpp"
#include "MainFrame.hpp"
#include "Plater.hpp"
@ -935,7 +935,7 @@ bool GUI_App::load_language(wxString language, bool initial)
m_imgui->set_language(into_u8(language_info->CanonicalName));
//FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only.
wxSetlocale(LC_NUMERIC, "C");
Preset::update_suffix_modified();
Preset::update_suffix_modified((" (" + _L("modified") + ")").ToUTF8().data());
return true;
}

View file

@ -3,10 +3,10 @@
#include <memory>
#include <string>
#include "Preset.hpp"
#include "ImGuiWrapper.hpp"
#include "ConfigWizard.hpp"
#include "OpenGLManager.hpp"
#include "libslic3r/Preset.hpp"
#include <wx/app.h>
#include <wx/colour.h>

View file

@ -3,7 +3,7 @@
#include "OptionsGroup.hpp"
#include "GUI_App.hpp"
#include "PresetBundle.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Model.hpp"
#include "GLCanvas3D.hpp"
#include "Plater.hpp"

View file

@ -1,4 +1,5 @@
#include "libslic3r/libslic3r.h"
#include "libslic3r/PresetBundle.hpp"
#include "GUI_ObjectList.hpp"
#include "GUI_ObjectManipulation.hpp"
#include "GUI_ObjectLayers.hpp"
@ -7,7 +8,6 @@
#include "Plater.hpp"
#include "OptionsGroup.hpp"
#include "PresetBundle.hpp"
#include "Tab.hpp"
#include "wxExtensions.hpp"
#include "libslic3r/Model.hpp"

View file

@ -6,7 +6,7 @@
#include "OptionsGroup.hpp"
#include "GUI_App.hpp"
#include "wxExtensions.hpp"
#include "PresetBundle.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/Geometry.hpp"
#include "Selection.hpp"

View file

@ -4,8 +4,8 @@
#include "OptionsGroup.hpp"
#include "GUI_App.hpp"
#include "wxExtensions.hpp"
#include "PresetBundle.hpp"
#include "Plater.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Model.hpp"
#include <boost/algorithm/string.hpp>

View file

@ -8,7 +8,7 @@
#include "BackgroundSlicingProcess.hpp"
#include "OpenGLManager.hpp"
#include "GLCanvas3D.hpp"
#include "PresetBundle.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "DoubleSlider.hpp"
#include "Plater.hpp"

View file

@ -6,9 +6,9 @@
#include <GL/glew.h>
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/PresetBundle.hpp"
#include "slic3r/GUI/Camera.hpp"
#include "slic3r/GUI/Plater.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Model.hpp"

View file

@ -9,7 +9,7 @@
#include "slic3r/GUI/GUI_ObjectSettings.hpp"
#include "slic3r/GUI/GUI_ObjectList.hpp"
#include "slic3r/GUI/Plater.hpp"
#include "slic3r/GUI/PresetBundle.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Model.hpp"

View file

@ -16,7 +16,7 @@
#include "slic3r/GUI/GUI_ObjectSettings.hpp"
#include "slic3r/GUI/GUI_ObjectList.hpp"
#include "slic3r/GUI/Plater.hpp"
#include "slic3r/GUI/PresetBundle.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/SLAPrint.hpp"

View file

@ -8,7 +8,7 @@
#include "slic3r/GUI/Camera.hpp"
#include "slic3r/GUI/Plater.hpp"
#include "slic3r/GUI/PresetBundle.hpp"
#include "libslic3r/PresetBundle.hpp"
#include <GL/glew.h>

View file

@ -5,7 +5,6 @@
#include "slic3r/GUI/Camera.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/GUI_ObjectManipulation.hpp"
#include "slic3r/GUI/PresetBundle.hpp"
#include "slic3r/GUI/Plater.hpp"
#include "slic3r/Utils/UndoRedo.hpp"
@ -19,6 +18,7 @@
#include "slic3r/GUI/Gizmos/GLGizmoHollow.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/PresetBundle.hpp"
#include <wx/glcanvas.h>

View file

@ -12,7 +12,7 @@
#ifndef L
// !!! If you needed to translate some wxString,
// !!! please use _(L(string))
// !!! please use _L(string)
// !!! _() - is a standard wxWidgets macro to translate
// !!! L() is used only for marking localizable string
// !!! It will be used in "xgettext" to create a Locating Message Catalog.

View file

@ -4,11 +4,11 @@
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/AppConfig.hpp"
#include "slic3r/GUI/Plater.hpp"
#include "slic3r/GUI/PresetBundle.hpp"
#include "slic3r/GUI/GUI_ObjectList.hpp"
#include "slic3r/Utils/SLAImport.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/PresetBundle.hpp"
#include <wx/dialog.h>
#include <wx/stattext.h>

View file

@ -15,9 +15,9 @@
#include "libslic3r/Print.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/SLAPrint.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "Tab.hpp"
#include "PresetBundle.hpp"
#include "ProgressStatusBar.hpp"
#include "3DScene.hpp"
#include "AppConfig.hpp"

View file

@ -1,9 +1,9 @@
#include "libslic3r/libslic3r.h"
#include "libslic3r/PresetBundle.hpp"
#include "Mouse3DController.hpp"
#include "Camera.hpp"
#include "GUI_App.hpp"
#include "PresetBundle.hpp"
#include "AppConfig.hpp"
#include "GLCanvas3D.hpp"
#include "Plater.hpp"

View file

@ -43,6 +43,7 @@
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/SLAPrint.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "GUI.hpp"
#include "GUI_App.hpp"
@ -65,7 +66,6 @@
#include "Jobs/ArrangeJob.hpp"
#include "Jobs/RotoptimizeJob.hpp"
#include "Jobs/SLAImportJob.hpp"
#include "PresetBundle.hpp"
#include "BackgroundSlicingProcess.hpp"
#include "ProgressStatusBar.hpp"
#include "PrintHostDialogs.hpp"
@ -2120,6 +2120,8 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
if (!config.empty()) {
Preset::normalize(config);
wxGetApp().preset_bundle->load_config_model(filename.string(), std::move(config));
if (printer_technology == ptFFF)
CustomGCode::update_custom_gcode_per_print_z_from_config(model.custom_gcode_per_print_z, &wxGetApp().preset_bundle->project_config);
wxGetApp().load_current_presets();
is_project_file = true;
}

View file

@ -7,9 +7,9 @@
#include <wx/panel.h>
#include "Preset.hpp"
#include "Selection.hpp"
#include "libslic3r/Preset.hpp"
#include "libslic3r/BoundingBox.hpp"
#include "Jobs/Job.hpp"
#include "Search.hpp"

View file

@ -15,6 +15,7 @@
#include "libslic3r/libslic3r.h"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "GUI.hpp"
#include "GUI_App.hpp"
@ -22,7 +23,6 @@
#include "MainFrame.hpp"
#include "format.hpp"
#include "Tab.hpp"
#include "PresetBundle.hpp"
#include "PrintHostDialogs.hpp"
#include "ConfigWizard.hpp"
#include "../Utils/ASCIIFolding.hpp"

View file

@ -7,7 +7,7 @@
#include <wx/bmpcbox.h>
#include <wx/gdicmn.h>
#include "Preset.hpp"
#include "libslic3r/Preset.hpp"
#include "wxExtensions.hpp"
#include "GUI_Utils.hpp"

View file

@ -4,7 +4,6 @@
#include "libslic3r/Slicing.hpp"
#include "libslic3r/libslic3r.h"
#include "PresetBundle.hpp"
#include "PresetHints.hpp"
#include <wx/intl.h>

View file

@ -3,7 +3,7 @@
#include <string>
#include "PresetBundle.hpp"
#include "libslic3r/PresetBundle.hpp"
namespace Slic3r {

View file

@ -9,10 +9,10 @@
#include "wx/dataview.h"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "GUI_App.hpp"
#include "Plater.hpp"
#include "Tab.hpp"
#include "PresetBundle.hpp"
#define FTS_FUZZY_MATCH_IMPLEMENTATION
#include "fts_fuzzy_match.h"

View file

@ -14,8 +14,8 @@
#include <wx/dialog.h>
#include "GUI_Utils.hpp"
#include "Preset.hpp"
#include "wxExtensions.hpp"
#include "libslic3r/Preset.hpp"
namespace Slic3r {

View file

@ -1,8 +1,8 @@
// #include "libslic3r/GCodeSender.hpp"
#include "slic3r/Utils/Serial.hpp"
#include "Tab.hpp"
#include "PresetBundle.hpp"
#include "PresetHints.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Model.hpp"
@ -32,7 +32,6 @@
#include "GUI_App.hpp"
#include "GUI_ObjectList.hpp"
#include "ConfigWizard.hpp"
#include "Plater.hpp"
#include "MainFrame.hpp"
#include "format.hpp"

View file

@ -33,8 +33,8 @@
#include "Event.hpp"
#include "wxExtensions.hpp"
#include "ConfigManipulation.hpp"
#include "Preset.hpp"
#include "OptionsGroup.hpp"
#include "libslic3r/Preset.hpp"
namespace Slic3r {
namespace GUI {

View file

@ -19,9 +19,9 @@
#include "libslic3r/libslic3r.h"
#include "libslic3r/format.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/PresetBundle.hpp"
#include "slic3r/GUI/UpdateDialogs.hpp"
#include "slic3r/GUI/ConfigWizard.hpp"
#include "slic3r/GUI/GUI_App.hpp"