2017-09-19 11:55:48 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
#include <xsinit.h>
|
|
|
|
#include "slic3r/GUI/Preset.hpp"
|
2017-10-30 17:41:50 +00:00
|
|
|
#include "slic3r/GUI/PresetBundle.hpp"
|
2017-11-10 16:27:05 +00:00
|
|
|
#include "slic3r/GUI/PresetHints.hpp"
|
2017-09-19 11:55:48 +00:00
|
|
|
%}
|
|
|
|
|
|
|
|
%name{Slic3r::GUI::Preset} class Preset {
|
|
|
|
// owned by PresetCollection, no constructor/destructor
|
|
|
|
|
2017-10-25 10:53:31 +00:00
|
|
|
bool default() %code%{ RETVAL = THIS->is_default; %};
|
|
|
|
bool external() %code%{ RETVAL = THIS->is_external; %};
|
2018-03-09 15:37:33 +00:00
|
|
|
bool system() %code%{ RETVAL = THIS->is_system; %};
|
2017-10-25 10:53:31 +00:00
|
|
|
bool visible() %code%{ RETVAL = THIS->is_visible; %};
|
|
|
|
bool dirty() %code%{ RETVAL = THIS->is_dirty; %};
|
2017-12-13 13:00:14 +00:00
|
|
|
bool compatible() %code%{ RETVAL = THIS->is_compatible; %};
|
2017-12-18 14:07:38 +00:00
|
|
|
bool is_compatible_with_printer(Preset *active_printer)
|
|
|
|
%code%{ RETVAL = THIS->is_compatible_with_printer(*active_printer); %};
|
2017-09-19 11:55:48 +00:00
|
|
|
|
2018-02-02 10:32:32 +00:00
|
|
|
std::string name() %code%{ RETVAL = THIS->name; %};
|
|
|
|
std::string file() %code%{ RETVAL = THIS->file; %};
|
2017-09-19 11:55:48 +00:00
|
|
|
|
2017-10-25 10:53:31 +00:00
|
|
|
bool loaded() %code%{ RETVAL = THIS->loaded; %};
|
2017-09-19 11:55:48 +00:00
|
|
|
|
2017-11-01 18:30:05 +00:00
|
|
|
Ref<DynamicPrintConfig> config() %code%{ RETVAL = &THIS->config; %};
|
|
|
|
|
|
|
|
void set_num_extruders(int num_extruders);
|
2017-09-19 11:55:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
%name{Slic3r::GUI::PresetCollection} class PresetCollection {
|
|
|
|
|
|
|
|
Ref<Preset> preset(size_t idx) %code%{ RETVAL = &THIS->preset(idx); %};
|
2017-09-20 08:16:00 +00:00
|
|
|
Ref<Preset> default_preset() %code%{ RETVAL = &THIS->default_preset(); %};
|
2017-09-19 11:55:48 +00:00
|
|
|
size_t size() const;
|
|
|
|
size_t num_visible() const;
|
2017-11-10 16:27:05 +00:00
|
|
|
std::string name() const;
|
2017-10-25 10:53:31 +00:00
|
|
|
|
|
|
|
Ref<Preset> get_selected_preset() %code%{ RETVAL = &THIS->get_selected_preset(); %};
|
|
|
|
Ref<Preset> get_current_preset() %code%{ RETVAL = &THIS->get_edited_preset(); %};
|
|
|
|
std::string get_current_preset_name() %code%{ RETVAL = THIS->get_selected_preset().name; %};
|
|
|
|
Ref<Preset> get_edited_preset() %code%{ RETVAL = &THIS->get_edited_preset(); %};
|
|
|
|
|
|
|
|
Ref<Preset> find_preset(char *name, bool first_visible_if_not_found = false) %code%{ RETVAL = THIS->find_preset(name, first_visible_if_not_found); %};
|
|
|
|
|
2017-11-10 16:27:05 +00:00
|
|
|
void update_tab_ui(SV *ui, bool show_incompatible)
|
|
|
|
%code%{ auto cb = (wxBitmapComboBox*)wxPli_sv_2_object( aTHX_ ui, "Wx::BitmapComboBox" );
|
|
|
|
THIS->update_tab_ui(cb, show_incompatible); %};
|
2017-10-26 15:17:39 +00:00
|
|
|
|
2017-10-25 10:53:31 +00:00
|
|
|
void update_platter_ui(SV *ui)
|
2017-10-26 15:17:39 +00:00
|
|
|
%code%{ auto cb = (wxBitmapComboBox*)wxPli_sv_2_object( aTHX_ ui, "Wx::BitmapComboBox" );
|
2017-10-25 10:53:31 +00:00
|
|
|
THIS->update_platter_ui(cb); %};
|
|
|
|
|
2017-09-19 11:55:48 +00:00
|
|
|
%{
|
|
|
|
|
|
|
|
SV*
|
|
|
|
PresetCollection::arrayref()
|
|
|
|
CODE:
|
|
|
|
AV* av = newAV();
|
|
|
|
av_fill(av, THIS->size()-1);
|
2017-10-26 15:17:39 +00:00
|
|
|
for (int i = 0; i < int(THIS->size()); ++ i) {
|
2017-09-19 11:55:48 +00:00
|
|
|
Preset &preset = THIS->preset(i);
|
2017-10-26 15:17:39 +00:00
|
|
|
av_store(av, i, perl_to_SV_ref(preset));
|
2017-09-19 11:55:48 +00:00
|
|
|
}
|
|
|
|
RETVAL = newRV_noinc((SV*)av);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
%}
|
|
|
|
};
|
|
|
|
|
|
|
|
%name{Slic3r::GUI::PresetBundle} class PresetBundle {
|
|
|
|
PresetBundle();
|
|
|
|
~PresetBundle();
|
|
|
|
|
2017-12-19 18:51:22 +00:00
|
|
|
void reset(bool delete_files);
|
|
|
|
|
2017-11-02 15:21:34 +00:00
|
|
|
void setup_directories()
|
|
|
|
%code%{
|
|
|
|
try {
|
|
|
|
THIS->setup_directories();
|
|
|
|
} catch (std::exception& e) {
|
|
|
|
croak("Cannot create configuration directories:\n%s\n", e.what());
|
|
|
|
}
|
|
|
|
%};
|
2018-03-09 15:37:33 +00:00
|
|
|
void load_presets(AppConfig *config)
|
2017-11-02 15:21:34 +00:00
|
|
|
%code%{
|
|
|
|
try {
|
2018-03-09 15:37:33 +00:00
|
|
|
THIS->load_presets(*config);
|
2017-11-02 15:21:34 +00:00
|
|
|
} catch (std::exception& e) {
|
2017-12-10 21:11:00 +00:00
|
|
|
croak("Loading of Slic3r presets from %s failed.\n\n%s\n",
|
|
|
|
Slic3r::data_dir().c_str(), e.what());
|
2017-11-02 15:21:34 +00:00
|
|
|
}
|
|
|
|
%};
|
2017-12-20 10:28:16 +00:00
|
|
|
void load_config(const char *name, DynamicPrintConfig *config)
|
|
|
|
%code%{
|
|
|
|
try {
|
|
|
|
THIS->load_config(name, *config);
|
|
|
|
} catch (std::exception& e) {
|
|
|
|
croak("Loading a configuration %s failed:\n%s\n", name, e.what());
|
|
|
|
}
|
|
|
|
%};
|
2017-11-02 15:21:34 +00:00
|
|
|
void load_config_file(const char *path)
|
|
|
|
%code%{
|
|
|
|
try {
|
|
|
|
THIS->load_config_file(path);
|
|
|
|
} catch (std::exception& e) {
|
|
|
|
croak("Loading a configuration file %s failed:\n%s\n", path, e.what());
|
|
|
|
}
|
|
|
|
%};
|
|
|
|
size_t load_configbundle(const char *path)
|
|
|
|
%code%{
|
|
|
|
try {
|
2017-12-19 18:51:22 +00:00
|
|
|
RETVAL = THIS->load_configbundle(path, PresetBundle::LOAD_CFGBNDLE_SAVE);
|
2017-11-02 15:21:34 +00:00
|
|
|
} catch (std::exception& e) {
|
|
|
|
croak("Loading of a config bundle %s failed:\n%s\n", path, e.what());
|
|
|
|
}
|
|
|
|
%};
|
2018-03-09 15:37:33 +00:00
|
|
|
void install_vendor_configbundle(const char *path)
|
|
|
|
%code%{
|
|
|
|
try {
|
2018-03-29 15:54:43 +00:00
|
|
|
THIS->install_vendor_configbundle(std::string(path));
|
2018-03-09 15:37:33 +00:00
|
|
|
} catch (std::exception& e) {
|
|
|
|
croak("Installing a vendor config bundle %s failed:\n%s\n", path, e.what());
|
|
|
|
}
|
|
|
|
%};
|
2017-11-02 15:21:34 +00:00
|
|
|
void export_configbundle(char *path)
|
|
|
|
%code%{
|
|
|
|
try {
|
|
|
|
THIS->export_configbundle(path);
|
|
|
|
} catch (std::exception& e) {
|
|
|
|
croak("Export of a config bundle %s failed:\n%s\n", path, e.what());
|
|
|
|
}
|
|
|
|
%};
|
|
|
|
|
2017-10-26 15:17:39 +00:00
|
|
|
void set_default_suppressed(bool default_suppressed);
|
|
|
|
|
2017-10-30 17:15:41 +00:00
|
|
|
void export_selections(AppConfig *config) %code%{ THIS->export_selections(*config); %};
|
2017-11-02 15:21:34 +00:00
|
|
|
void export_selections_pp(PlaceholderParser *pp) %code%{ THIS->export_selections(*pp); %};
|
2017-10-30 17:15:41 +00:00
|
|
|
|
2017-10-26 15:17:39 +00:00
|
|
|
Ref<PresetCollection> print() %code%{ RETVAL = &THIS->prints; %};
|
|
|
|
Ref<PresetCollection> filament() %code%{ RETVAL = &THIS->filaments; %};
|
|
|
|
Ref<PresetCollection> printer() %code%{ RETVAL = &THIS->printers; %};
|
2018-03-14 10:54:11 +00:00
|
|
|
Ref<DynamicPrintConfig> project_config() %code%{ RETVAL = &THIS->project_config; %};
|
|
|
|
|
2017-11-02 15:21:34 +00:00
|
|
|
bool has_defauls_only();
|
2017-10-26 15:17:39 +00:00
|
|
|
|
|
|
|
std::vector<std::string> filament_presets() %code%{ RETVAL = THIS->filament_presets; %};
|
|
|
|
void set_filament_preset(int idx, const char *name);
|
2017-11-10 16:27:05 +00:00
|
|
|
|
2017-10-26 15:17:39 +00:00
|
|
|
Clone<DynamicPrintConfig> full_config() %code%{ RETVAL = THIS->full_config(); %};
|
|
|
|
|
|
|
|
void update_platter_filament_ui(int extruder_idx, SV *ui)
|
|
|
|
%code%{ auto cb = (wxBitmapComboBox*)wxPli_sv_2_object(aTHX_ ui, "Wx::BitmapComboBox");
|
|
|
|
THIS->update_platter_filament_ui(extruder_idx, cb); %};
|
2017-11-10 16:27:05 +00:00
|
|
|
};
|