2018-03-13 11:39:57 +00:00
|
|
|
#ifndef slic3r_ConfigWizard_private_hpp_
|
|
|
|
#define slic3r_ConfigWizard_private_hpp_
|
|
|
|
|
|
|
|
#include "ConfigWizard.hpp"
|
|
|
|
|
|
|
|
#include <vector>
|
2018-04-12 18:04:48 +00:00
|
|
|
#include <set>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <boost/filesystem.hpp>
|
2018-03-13 11:39:57 +00:00
|
|
|
|
|
|
|
#include <wx/sizer.h>
|
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <wx/button.h>
|
2018-04-05 14:10:44 +00:00
|
|
|
#include <wx/choice.h>
|
|
|
|
#include <wx/spinctrl.h>
|
2018-03-13 11:39:57 +00:00
|
|
|
|
2018-04-05 14:10:44 +00:00
|
|
|
#include "libslic3r/PrintConfig.hpp"
|
2018-03-29 15:54:43 +00:00
|
|
|
#include "AppConfig.hpp"
|
2018-04-12 18:04:48 +00:00
|
|
|
#include "Preset.hpp"
|
2018-04-05 14:10:44 +00:00
|
|
|
#include "BedShapeDialog.hpp"
|
2018-03-29 15:54:43 +00:00
|
|
|
|
2018-04-12 18:04:48 +00:00
|
|
|
namespace fs = boost::filesystem;
|
2018-03-13 11:39:57 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
namespace GUI {
|
|
|
|
|
2018-04-12 18:04:48 +00:00
|
|
|
// typedef std::unordered_map<std::string, VendorProfile> VendorMap;
|
2018-03-13 11:39:57 +00:00
|
|
|
|
|
|
|
enum {
|
2018-04-06 10:15:28 +00:00
|
|
|
CONTENT_WIDTH = 500,
|
|
|
|
|
2018-03-13 11:39:57 +00:00
|
|
|
DIALOG_MARGIN = 15,
|
|
|
|
INDEX_MARGIN = 40,
|
|
|
|
BTN_SPACING = 10,
|
2018-04-05 14:10:44 +00:00
|
|
|
INDENT_SPACING = 30,
|
|
|
|
VERTICAL_SPACING = 10,
|
2018-03-13 11:39:57 +00:00
|
|
|
};
|
|
|
|
|
2018-04-05 16:30:03 +00:00
|
|
|
struct PrinterPicker: wxPanel
|
|
|
|
{
|
|
|
|
unsigned variants_checked;
|
|
|
|
|
|
|
|
PrinterPicker(wxWindow *parent, const VendorProfile &vendor, const AppConfig &appconfig_vendors);
|
|
|
|
};
|
|
|
|
|
2018-03-13 11:39:57 +00:00
|
|
|
struct ConfigWizardPage: wxPanel
|
|
|
|
{
|
|
|
|
ConfigWizard *parent;
|
|
|
|
const wxString shortname;
|
|
|
|
wxBoxSizer *content;
|
|
|
|
|
|
|
|
ConfigWizardPage(ConfigWizard *parent, wxString title, wxString shortname);
|
|
|
|
|
|
|
|
virtual ~ConfigWizardPage();
|
|
|
|
|
2018-03-29 15:54:43 +00:00
|
|
|
ConfigWizardPage* page_prev() const { return p_prev; }
|
|
|
|
ConfigWizardPage* page_next() const { return p_next; }
|
2018-03-13 11:39:57 +00:00
|
|
|
ConfigWizardPage* chain(ConfigWizardPage *page);
|
|
|
|
|
2018-03-29 15:54:43 +00:00
|
|
|
template<class T>
|
2018-04-05 14:10:44 +00:00
|
|
|
void append(T *thing, int proportion = 0, int flag = wxEXPAND|wxTOP|wxBOTTOM, int border = 10)
|
2018-03-29 15:54:43 +00:00
|
|
|
{
|
|
|
|
content->Add(thing, proportion, flag, border);
|
|
|
|
}
|
|
|
|
|
2018-04-05 14:10:44 +00:00
|
|
|
void append_text(wxString text);
|
2018-03-13 11:39:57 +00:00
|
|
|
void append_spacer(int space);
|
2018-03-29 15:54:43 +00:00
|
|
|
|
2018-03-13 11:39:57 +00:00
|
|
|
ConfigWizard::priv *wizard_p() const { return parent->p.get(); }
|
|
|
|
|
|
|
|
virtual bool Show(bool show = true);
|
|
|
|
virtual bool Hide() { return Show(false); }
|
|
|
|
virtual wxPanel* extra_buttons() { return nullptr; }
|
|
|
|
virtual void on_page_set() {}
|
2018-04-05 14:10:44 +00:00
|
|
|
virtual void apply_custom_config(DynamicPrintConfig &config) {}
|
2018-03-13 11:39:57 +00:00
|
|
|
|
|
|
|
void enable_next(bool enable);
|
|
|
|
private:
|
|
|
|
ConfigWizardPage *p_prev;
|
|
|
|
ConfigWizardPage *p_next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PageWelcome: ConfigWizardPage
|
|
|
|
{
|
2018-04-05 16:30:03 +00:00
|
|
|
PrinterPicker *printer_picker;
|
2018-03-13 11:39:57 +00:00
|
|
|
wxPanel *others_buttons;
|
|
|
|
|
2018-03-29 15:54:43 +00:00
|
|
|
PageWelcome(ConfigWizard *parent);
|
2018-03-13 11:39:57 +00:00
|
|
|
|
|
|
|
virtual wxPanel* extra_buttons() { return others_buttons; }
|
|
|
|
virtual void on_page_set();
|
|
|
|
|
|
|
|
void on_variant_checked();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PageUpdate: ConfigWizardPage
|
|
|
|
{
|
2018-03-29 15:54:43 +00:00
|
|
|
bool version_check;
|
|
|
|
bool preset_update;
|
2018-03-13 11:39:57 +00:00
|
|
|
|
2018-04-05 14:10:44 +00:00
|
|
|
PageUpdate(ConfigWizard *parent);
|
2018-03-13 11:39:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PageVendors: ConfigWizardPage
|
|
|
|
{
|
2018-04-05 16:30:03 +00:00
|
|
|
std::vector<PrinterPicker*> pickers;
|
|
|
|
|
2018-03-13 11:39:57 +00:00
|
|
|
PageVendors(ConfigWizard *parent);
|
2018-04-05 16:30:03 +00:00
|
|
|
|
|
|
|
virtual void on_page_set();
|
|
|
|
|
|
|
|
void on_vendor_pick(size_t i);
|
|
|
|
void on_variant_checked();
|
2018-03-13 11:39:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PageFirmware: ConfigWizardPage
|
|
|
|
{
|
2018-04-05 14:10:44 +00:00
|
|
|
const ConfigOptionDef &gcode_opt;
|
|
|
|
wxChoice *gcode_picker;
|
|
|
|
|
2018-03-13 11:39:57 +00:00
|
|
|
PageFirmware(ConfigWizard *parent);
|
2018-04-05 14:10:44 +00:00
|
|
|
virtual void apply_custom_config(DynamicPrintConfig &config);
|
2018-03-13 11:39:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PageBedShape: ConfigWizardPage
|
|
|
|
{
|
2018-04-05 14:10:44 +00:00
|
|
|
BedShapePanel *shape_panel;
|
|
|
|
|
2018-03-13 11:39:57 +00:00
|
|
|
PageBedShape(ConfigWizard *parent);
|
2018-04-05 14:10:44 +00:00
|
|
|
virtual void apply_custom_config(DynamicPrintConfig &config);
|
2018-03-13 11:39:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PageDiameters: ConfigWizardPage
|
|
|
|
{
|
2018-04-05 14:10:44 +00:00
|
|
|
wxSpinCtrlDouble *spin_nozzle;
|
|
|
|
wxSpinCtrlDouble *spin_filam;
|
|
|
|
|
2018-03-13 11:39:57 +00:00
|
|
|
PageDiameters(ConfigWizard *parent);
|
2018-04-05 14:10:44 +00:00
|
|
|
virtual void apply_custom_config(DynamicPrintConfig &config);
|
2018-03-13 11:39:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PageTemperatures: ConfigWizardPage
|
|
|
|
{
|
2018-04-06 11:18:12 +00:00
|
|
|
wxSpinCtrlDouble *spin_extr;
|
|
|
|
wxSpinCtrlDouble *spin_bed;
|
2018-04-05 14:10:44 +00:00
|
|
|
|
2018-03-13 11:39:57 +00:00
|
|
|
PageTemperatures(ConfigWizard *parent);
|
2018-04-05 14:10:44 +00:00
|
|
|
virtual void apply_custom_config(DynamicPrintConfig &config);
|
2018-03-13 11:39:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigWizardIndex: public wxPanel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ConfigWizardIndex(wxWindow *parent);
|
|
|
|
|
|
|
|
void load_items(ConfigWizardPage *firstpage);
|
|
|
|
void set_active(ConfigWizardPage *page);
|
|
|
|
private:
|
|
|
|
const wxBitmap bg;
|
|
|
|
const wxBitmap bullet_black;
|
|
|
|
const wxBitmap bullet_blue;
|
|
|
|
const wxBitmap bullet_white;
|
|
|
|
int text_height;
|
|
|
|
|
|
|
|
std::vector<wxString> items;
|
|
|
|
std::vector<wxString>::const_iterator item_active;
|
|
|
|
|
2018-04-05 14:10:44 +00:00
|
|
|
void on_paint(wxPaintEvent &evt);
|
2018-03-13 11:39:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ConfigWizard::priv
|
|
|
|
{
|
|
|
|
ConfigWizard *q;
|
2018-04-13 13:08:58 +00:00
|
|
|
AppConfig appconfig_vendors; // TODO: use order-preserving container
|
|
|
|
std::unordered_map<std::string, VendorProfile> vendors; // TODO: just set?
|
2018-04-12 18:04:48 +00:00
|
|
|
std::unordered_map<std::string, fs::path> vendors_rsrc;
|
2018-04-06 10:15:28 +00:00
|
|
|
std::unique_ptr<DynamicPrintConfig> custom_config;
|
2018-03-29 15:54:43 +00:00
|
|
|
|
2018-03-13 11:39:57 +00:00
|
|
|
wxBoxSizer *topsizer = nullptr;
|
|
|
|
wxBoxSizer *btnsizer = nullptr;
|
|
|
|
ConfigWizardPage *page_current = nullptr;
|
|
|
|
ConfigWizardIndex *index = nullptr;
|
|
|
|
wxButton *btn_prev = nullptr;
|
|
|
|
wxButton *btn_next = nullptr;
|
|
|
|
wxButton *btn_finish = nullptr;
|
|
|
|
wxButton *btn_cancel = nullptr;
|
|
|
|
|
|
|
|
PageWelcome *page_welcome = nullptr;
|
|
|
|
PageUpdate *page_update = nullptr;
|
|
|
|
PageVendors *page_vendors = nullptr;
|
|
|
|
PageFirmware *page_firmware = nullptr;
|
|
|
|
PageBedShape *page_bed = nullptr;
|
|
|
|
PageDiameters *page_diams = nullptr;
|
|
|
|
PageTemperatures *page_temps = nullptr;
|
|
|
|
|
|
|
|
priv(ConfigWizard *q) : q(q) {}
|
|
|
|
|
2018-03-29 15:54:43 +00:00
|
|
|
void load_vendors();
|
2018-03-13 11:39:57 +00:00
|
|
|
void add_page(ConfigWizardPage *page);
|
|
|
|
void index_refresh();
|
|
|
|
void set_page(ConfigWizardPage *page);
|
2018-04-06 10:15:28 +00:00
|
|
|
void layout_fit();
|
2018-03-13 11:39:57 +00:00
|
|
|
void go_prev() { if (page_current != nullptr) { set_page(page_current->page_prev()); } }
|
|
|
|
void go_next() { if (page_current != nullptr) { set_page(page_current->page_next()); } }
|
|
|
|
void enable_next(bool enable);
|
|
|
|
|
|
|
|
void on_other_vendors();
|
|
|
|
void on_custom_setup();
|
2018-04-05 14:10:44 +00:00
|
|
|
|
|
|
|
void apply_config(AppConfig *app_config, PresetBundle *preset_bundle);
|
2018-03-13 11:39:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|