mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-04 15:50:38 +08:00
Moved Preset to its own header.
This commit is contained in:
parent
c5653a1435
commit
d74712ef7d
@ -9,17 +9,11 @@
|
||||
#include <mutex>
|
||||
|
||||
|
||||
#include "Preset.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
|
||||
// Friendly indices for the preset lists.
|
||||
enum class PresetID {
|
||||
PRINT = 0,
|
||||
FILAMENT = 1,
|
||||
PRINTER = 2
|
||||
};
|
||||
using preset_list = std::vector<std::string>;
|
||||
|
||||
class App: public wxApp
|
||||
{
|
||||
public:
|
||||
@ -41,7 +35,7 @@ public:
|
||||
private:
|
||||
std::shared_ptr<Settings> gui_config; // GUI-specific configuration options
|
||||
std::unique_ptr<Notifier> notifier {nullptr};
|
||||
std::vector<preset_list> presets { preset_list(), preset_list(), preset_list() };
|
||||
std::vector<Presets> presets { preset_types, Presets() };
|
||||
|
||||
void load_presets();
|
||||
|
||||
|
@ -1193,5 +1193,12 @@ void Plater::_on_change_combobox(preset_t preset, wxBitmapComboBox* choice) {
|
||||
*/
|
||||
}
|
||||
|
||||
void Plater::load_presets() {
|
||||
|
||||
for (auto group : {preset_t::Printer, preset_t::Material, preset_t::Print}) {
|
||||
// skip presets not compatible with selected printer
|
||||
}
|
||||
}
|
||||
|
||||
}} // Namespace Slic3r::GUI
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "Config.hpp"
|
||||
#include "misc_ui.hpp"
|
||||
|
||||
#include "Preset.hpp"
|
||||
|
||||
#include "Plater/PlaterObject.hpp"
|
||||
#include "Plater/Plate2D.hpp"
|
||||
#include "Plater/Plate3D.hpp"
|
||||
@ -37,13 +39,6 @@ enum class UndoCmd {
|
||||
Remove, Add, Reset, Increase, Decrease, Rotate
|
||||
};
|
||||
|
||||
/// Preset tab list
|
||||
enum class preset_t : uint8_t {
|
||||
Print = 0, Material, Printer,
|
||||
Last // This MUST be the last enumeration. Don't use it for anything.
|
||||
};
|
||||
/// Convenience counter to determine how many preset tabs exist.
|
||||
constexpr size_t preset_count = static_cast<uint8_t>(preset_t::Last);
|
||||
|
||||
enum class Zoom {
|
||||
In, Out
|
||||
@ -262,7 +257,7 @@ private:
|
||||
void show_preset_editor(preset_t preset, unsigned int idx) { };
|
||||
|
||||
void _on_select_preset(preset_t preset) {};
|
||||
void load_presets() {};
|
||||
void load_presets();
|
||||
|
||||
};
|
||||
|
||||
|
@ -5,9 +5,30 @@
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
class Preset {
|
||||
/// Preset types list. We assign numbers to permit static_casts and use as preset tab indices
|
||||
enum class preset_t : uint8_t {
|
||||
Print = 0, Material, Printer,
|
||||
Last // This MUST be the last enumeration. Don't use it for anything.
|
||||
};
|
||||
|
||||
/// Convenience counter to determine how many preset tabs exist.
|
||||
constexpr size_t preset_types = static_cast<uint8_t>(preset_t::Last);
|
||||
|
||||
class Preset;
|
||||
|
||||
using Presets = std::vector<Preset>;
|
||||
|
||||
class Preset {
|
||||
preset_t type;
|
||||
std::string name {""};
|
||||
|
||||
|
||||
/// Search the compatible_printers config option list for this preset name.
|
||||
/// Assume that Printer configs are compatible with other Printer configs
|
||||
bool compatible(std::string printer_name) { return true; }
|
||||
bool compatible(const Preset& other) {return (this->type == preset_t::Printer || (compatible(other.name) && other.type == preset_t::Printer));}
|
||||
private:
|
||||
/// store to keep config options for this preset
|
||||
Slic3r::DynamicPrintConfig config { Slic3r::DynamicPrintConfig() };
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user