2017-12-05 14:54:01 +00:00
|
|
|
// The "Expert" tab at the right of the main tabbed window.
|
|
|
|
//
|
|
|
|
// This file implements following packages:
|
|
|
|
// Slic3r::GUI::Tab;
|
|
|
|
// Slic3r::GUI::Tab::Print;
|
|
|
|
// Slic3r::GUI::Tab::Filament;
|
|
|
|
// Slic3r::GUI::Tab::Printer;
|
|
|
|
// Slic3r::GUI::Tab::Page
|
|
|
|
// - Option page: For example, the Slic3r::GUI::Tab::Print has option pages "Layers and perimeters", "Infill", "Skirt and brim" ...
|
|
|
|
// Slic3r::GUI::SavePresetWindow
|
|
|
|
// - Dialog to select a new preset name to store the configuration.
|
|
|
|
// Slic3r::GUI::Tab::Preset;
|
|
|
|
// - Single preset item: name, file is default or external.
|
|
|
|
|
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <wx/notebook.h>
|
|
|
|
#include <wx/scrolwin.h>
|
|
|
|
#include <wx/sizer.h>
|
|
|
|
#include <wx/bmpcbox.h>
|
|
|
|
#include <wx/bmpbuttn.h>
|
|
|
|
#include <wx/treectrl.h>
|
|
|
|
#include <wx/imaglist.h>
|
2017-12-13 13:45:10 +00:00
|
|
|
#include <wx/statbox.h>
|
2017-12-05 14:54:01 +00:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
2017-12-13 13:45:10 +00:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "OptionsGroup.hpp"
|
|
|
|
|
|
|
|
//!enum { ID_TAB_TREE = wxID_HIGHEST + 1 };
|
2017-12-05 14:54:01 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
// Single Tab page containing a{ vsizer } of{ optgroups }
|
|
|
|
// package Slic3r::GUI::Tab::Page;
|
2017-12-13 13:45:10 +00:00
|
|
|
using ConfigOptionsGroupShp = std::shared_ptr<ConfigOptionsGroup>;
|
2017-12-05 14:54:01 +00:00
|
|
|
class CPage : public wxScrolledWindow
|
|
|
|
{
|
2017-12-13 13:45:10 +00:00
|
|
|
wxWindow* parent_;
|
|
|
|
wxString title_;
|
|
|
|
size_t iconID_;
|
|
|
|
wxBoxSizer* vsizer_;
|
2017-12-05 14:54:01 +00:00
|
|
|
public:
|
2017-12-13 13:45:10 +00:00
|
|
|
CPage(wxWindow* parent, const wxString title, const int iconID) :
|
|
|
|
parent_(parent),
|
|
|
|
title_(title),
|
|
|
|
iconID_(iconID)
|
2017-12-05 14:54:01 +00:00
|
|
|
{
|
2017-12-13 13:45:10 +00:00
|
|
|
Create(parent_, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
|
|
|
vsizer_ = new wxBoxSizer(wxVERTICAL);
|
|
|
|
SetSizer(vsizer_);
|
2017-12-05 14:54:01 +00:00
|
|
|
}
|
2017-12-13 13:45:10 +00:00
|
|
|
~CPage(){}
|
|
|
|
|
|
|
|
public:
|
|
|
|
std::vector <ConfigOptionsGroupShp> optgroups; // $self->{optgroups} = [];
|
|
|
|
DynamicPrintConfig* config_;
|
|
|
|
|
|
|
|
wxBoxSizer* vsizer() const { return vsizer_; }
|
|
|
|
wxWindow* parent() const { return parent_; }
|
|
|
|
wxString title() const { return title_; }
|
|
|
|
size_t iconID() const { return iconID_; }
|
|
|
|
void set_config(DynamicPrintConfig* config_in) { config_ = config_in; }
|
|
|
|
|
|
|
|
ConfigOptionsGroupShp new_optgroup(std::string title, size_t label_width = 0);
|
2017-12-05 14:54:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Slic3r::GUI::Tab;
|
2017-12-13 13:45:10 +00:00
|
|
|
|
|
|
|
using CPageShp = std::shared_ptr<CPage>;
|
2017-12-05 14:54:01 +00:00
|
|
|
class CTab: public wxPanel
|
|
|
|
{
|
2017-12-13 13:45:10 +00:00
|
|
|
wxNotebook* parent_;
|
2017-12-05 14:54:01 +00:00
|
|
|
protected:
|
2017-12-13 13:45:10 +00:00
|
|
|
const char* title_;
|
|
|
|
wxBitmapComboBox* presets_choice_;
|
|
|
|
wxBitmapButton* btn_save_preset_;
|
|
|
|
wxBitmapButton* btn_delete_preset_;
|
|
|
|
wxBitmap* bmp_show_incompatible_presets_;
|
|
|
|
wxBitmap* bmp_hide_incompatible_presets_;
|
|
|
|
wxBitmapButton* btn_hide_incompatible_presets_;
|
|
|
|
wxBoxSizer* hsizer_;
|
|
|
|
wxBoxSizer* left_sizer_;
|
|
|
|
wxTreeCtrl* treectrl_;
|
|
|
|
wxImageList* icons_;
|
|
|
|
int icon_count;
|
|
|
|
std::map<wxString, size_t> icon_index_; // Map from an icon file name to its index in $self->{icons}.
|
|
|
|
std::vector<CPageShp> pages_; // $self->{pages} = [];
|
|
|
|
bool disable_tree_sel_changed_event_;
|
|
|
|
|
|
|
|
public:
|
|
|
|
DynamicPrintConfig config_;
|
|
|
|
|
2017-12-05 14:54:01 +00:00
|
|
|
public:
|
2017-12-13 13:45:10 +00:00
|
|
|
CTab() {}
|
|
|
|
CTab(wxNotebook* parent, const char *title) : parent_(parent), title_(title) {
|
|
|
|
Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
|
|
|
|
}
|
|
|
|
~CTab(){}
|
|
|
|
|
|
|
|
wxWindow* parent() const { return parent_; }
|
2017-12-05 14:54:01 +00:00
|
|
|
|
2017-12-13 13:45:10 +00:00
|
|
|
void create_preset_tab();
|
|
|
|
void rebuild_page_tree();
|
|
|
|
void select_preset(wxString preset_name){};
|
|
|
|
|
|
|
|
void OnTreeSelChange(wxTreeEvent& event);
|
|
|
|
void OnKeyDown(wxKeyEvent& event);
|
|
|
|
void OnComboBox(wxCommandEvent& event) { select_preset(presets_choice_->GetStringSelection()); }
|
|
|
|
void save_preset(wxCommandEvent &event);
|
|
|
|
void delete_preset(wxCommandEvent &event);
|
|
|
|
void _toggle_show_hide_incompatible(wxCommandEvent &event);
|
|
|
|
|
|
|
|
std::shared_ptr<CPage> add_options_page(wxString title, wxString icon);
|
|
|
|
|
|
|
|
virtual void build() = 0;
|
2017-12-05 14:54:01 +00:00
|
|
|
// virtual void _update();
|
|
|
|
};
|
|
|
|
|
|
|
|
//Slic3r::GUI::Tab::Print;
|
|
|
|
class CTabPrint : public CTab
|
|
|
|
{
|
|
|
|
public:
|
2017-12-13 13:45:10 +00:00
|
|
|
CTabPrint() {}
|
|
|
|
CTabPrint(wxNotebook* parent, const char *title/*, someParams*/) : CTab(parent, title) {}
|
|
|
|
~CTabPrint(){}
|
|
|
|
|
|
|
|
void build() override;
|
2017-12-05 14:54:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // GUI
|
|
|
|
} // Slic3r
|