mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-19 04:37:52 -06:00
Start filling the Print's Tab, using @lordofhyphens's Optionsgroup
This commit is contained in:
parent
c5e21c1fbf
commit
d60fac42d6
11 changed files with 1000 additions and 482 deletions
|
@ -1,9 +1,7 @@
|
|||
#include <wx/app.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/sizer.h>
|
||||
|
||||
#include <wx/bmpcbox.h>
|
||||
|
@ -12,19 +10,11 @@
|
|||
#include <wx/imaglist.h>
|
||||
|
||||
#include "Tab.h"
|
||||
#include "PresetBundle.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
// Declare some IDs.
|
||||
/*const int BUTTON1 = 100;
|
||||
|
||||
// Attach the event handlers. Put this after Slis3rFrame declaration.
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_BUTTON(BUTTON1, MyFrame::OnButton1)
|
||||
END_EVENT_TABLE()
|
||||
*/
|
||||
|
||||
// sub new
|
||||
void CTab::create_preset_tab()
|
||||
{
|
||||
|
@ -32,136 +22,483 @@ void CTab::create_preset_tab()
|
|||
CTab *panel = this;
|
||||
auto *sizer = new wxBoxSizer(wxVERTICAL);
|
||||
sizer->SetSizeHints(panel);
|
||||
(panel)->SetSizer(sizer);
|
||||
panel->SetSizer(sizer);
|
||||
|
||||
// preset chooser
|
||||
//! Add Preset from PrintPreset
|
||||
// choice menu for Experiments
|
||||
wxString choices[] =
|
||||
{
|
||||
_T("Washington"),
|
||||
_T("Adams"),
|
||||
_T("Jefferson"),
|
||||
_T("Madison"),
|
||||
_T("Lincoln"),
|
||||
_T("One"),
|
||||
_T("Two"),
|
||||
_T("Three"),
|
||||
_T("Four")
|
||||
_T("First"),
|
||||
_T("Second"),
|
||||
_T("Third")
|
||||
};
|
||||
int nCntEl = 9;
|
||||
|
||||
presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(270, -1), nCntEl, choices, wxCB_READONLY);
|
||||
presets_choice_ = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(270, -1)/*, nCntEl, choices, wxCB_READONLY*/);
|
||||
const wxBitmap* bmp = new wxBitmap(wxT("var\\flag-green-icon.png"), wxBITMAP_TYPE_PNG);
|
||||
for (auto el:choices)
|
||||
presets_choice_->Append(wxString::FromUTF8(el).c_str(), *bmp);
|
||||
presets_choice_->SetSelection(presets_choice_->GetCount() - 1);
|
||||
|
||||
//buttons
|
||||
wxBitmap bmpMenu;
|
||||
bmpMenu = wxBitmap(wxT("var\\disk.png"), wxBITMAP_TYPE_PNG);
|
||||
auto *btn_save_preset = new wxBitmapButton(panel, wxID_ANY, bmpMenu, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||
btn_save_preset_ = new wxBitmapButton(panel, wxID_ANY, bmpMenu, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||
bmpMenu = wxBitmap(wxT("var\\delete.png"), wxBITMAP_TYPE_PNG);
|
||||
auto *btn_delete_preset = new wxBitmapButton(panel, wxID_ANY, bmpMenu, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||
btn_delete_preset_ = new wxBitmapButton(panel, wxID_ANY, bmpMenu, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||
|
||||
// $self->{show_incompatible_presets} = 0; // !!!
|
||||
|
||||
bmp_show_incompatible_presets = new wxBitmap(wxT("var\\flag-red-icon.png"), wxBITMAP_TYPE_PNG);
|
||||
bmp_hide_incompatible_presets = new wxBitmap(wxT("var\\flag-green-icon.png"), wxBITMAP_TYPE_PNG);
|
||||
btn_hide_incompatible_presets = new wxBitmapButton(panel, wxID_ANY, *bmp_hide_incompatible_presets, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||
bmp_show_incompatible_presets_ = new wxBitmap(wxT("var\\flag-red-icon.png"), wxBITMAP_TYPE_PNG);
|
||||
bmp_hide_incompatible_presets_ = new wxBitmap(wxT("var\\flag-green-icon.png"), wxBITMAP_TYPE_PNG);
|
||||
btn_hide_incompatible_presets_ = new wxBitmapButton(panel, wxID_ANY, *bmp_hide_incompatible_presets_, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||
|
||||
wxString stTitle = _T("Save current ") + wxString(_title);//. lc($self->title)
|
||||
btn_save_preset->SetToolTip(stTitle);
|
||||
btn_delete_preset->SetToolTip(_T("Delete this preset"));
|
||||
btn_delete_preset->Disable();
|
||||
btn_save_preset_->SetToolTip(wxT("Save current ") + wxString(title_));// (stTitle);
|
||||
btn_delete_preset_->SetToolTip(_T("Delete this preset"));
|
||||
btn_delete_preset_->Disable();
|
||||
|
||||
hsizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(hsizer, 0, wxBOTTOM, 3);
|
||||
hsizer->Add(presets_choice, 1, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3);
|
||||
hsizer->AddSpacer(4);
|
||||
hsizer->Add(btn_save_preset, 0, wxALIGN_CENTER_VERTICAL);
|
||||
hsizer->AddSpacer(4);
|
||||
hsizer->Add(btn_delete_preset, 0, wxALIGN_CENTER_VERTICAL);
|
||||
hsizer->AddSpacer(16);
|
||||
hsizer->Add(btn_hide_incompatible_presets, 0, wxALIGN_CENTER_VERTICAL);
|
||||
hsizer_ = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(hsizer_, 0, wxBOTTOM, 3);
|
||||
hsizer_->Add(presets_choice_, 1, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3);
|
||||
hsizer_->AddSpacer(4);
|
||||
hsizer_->Add(btn_save_preset_, 0, wxALIGN_CENTER_VERTICAL);
|
||||
hsizer_->AddSpacer(4);
|
||||
hsizer_->Add(btn_delete_preset_, 0, wxALIGN_CENTER_VERTICAL);
|
||||
hsizer_->AddSpacer(16);
|
||||
hsizer_->Add(btn_hide_incompatible_presets_, 0, wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
//Horizontal sizer to hold the tree and the selected page.
|
||||
hsizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(hsizer, 1, wxEXPAND, 0);
|
||||
hsizer_ = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(hsizer_, 1, wxEXPAND, 0);
|
||||
|
||||
//left vertical sizer
|
||||
left_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
hsizer->Add(left_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 3);
|
||||
left_sizer_ = new wxBoxSizer(wxVERTICAL);
|
||||
hsizer_->Add(left_sizer_, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 3);
|
||||
|
||||
// tree
|
||||
auto *treectrl = new wxTreeCtrl(panel, wxID_ANY, wxDefaultPosition, wxSize(185, -1), wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_SUNKEN | wxWANTS_CHARS);
|
||||
left_sizer->Add(treectrl, 1, wxEXPAND);
|
||||
icons = new wxImageList(16, 16, 1);
|
||||
// Map from an icon file name to its index in $self->{icons}.
|
||||
// $self->{icon_index} = {};
|
||||
treectrl_ = new wxTreeCtrl(panel, wxID_ANY/*ID_TAB_TREE*/, wxDefaultPosition, wxSize(185, -1), wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_SUNKEN | wxWANTS_CHARS);
|
||||
left_sizer_->Add(treectrl_, 1, wxEXPAND);
|
||||
icons_ = new wxImageList(16, 16, true, 1/*, 1*/);
|
||||
// Index of the last icon inserted into $self->{icons}.
|
||||
icon_count = -1;
|
||||
treectrl->AssignImageList(icons);
|
||||
treectrl->AddRoot("root");
|
||||
// $self->{pages} = [];
|
||||
treectrl->SetIndent(0);
|
||||
disable_tree_sel_changed_event = 0;
|
||||
treectrl_->AssignImageList(icons_);
|
||||
treectrl_->AddRoot("root");
|
||||
treectrl_->SetIndent(0);
|
||||
disable_tree_sel_changed_event_ = 0;
|
||||
|
||||
/* EVT_TREE_SEL_CHANGED($parent, $self->{treectrl}, sub {
|
||||
return if $self->{disable_tree_sel_changed_event};
|
||||
my $page = first { $_->{title} eq $self->{treectrl}->GetItemText($self->{treectrl}->GetSelection) } @{$self->{pages}}
|
||||
or return;
|
||||
$_->Hide for @{$self->{pages}};
|
||||
$page->Show;
|
||||
$self->{hsizer}->Layout;
|
||||
$self->Refresh;
|
||||
});
|
||||
EVT_KEY_DOWN($self->{treectrl}, sub {
|
||||
my ($treectrl, $event) = @_;
|
||||
if ($event->GetKeyCode == WXK_TAB) {
|
||||
$treectrl->Navigate($event->ShiftDown ? &Wx::wxNavigateBackward : &Wx::wxNavigateForward);
|
||||
} else {
|
||||
$event->Skip;
|
||||
}
|
||||
});
|
||||
//!-----------------------EXP
|
||||
// Vertical sizer to hold selected page
|
||||
// auto *scrolled_win = new wxScrolledWindow(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
// wxBoxSizer *vs = new wxBoxSizer(wxVERTICAL);
|
||||
// scrolled_win->SetSizer(vs);
|
||||
// scrolled_win->SetScrollbars(1, 1, 1, 1);
|
||||
// hsizer_->Add(scrolled_win, 1, wxEXPAND | wxLEFT, 5);
|
||||
//
|
||||
// wxSizer* sbs = new wxStaticBoxSizer(new wxStaticBox(scrolled_win, wxID_ANY, "Trulala"), wxVERTICAL);
|
||||
// vs->Add(sbs, 0, wxEXPAND | wxALL, 10);
|
||||
// sbs = new wxBoxSizer(wxVERTICAL);
|
||||
// vs->Add(sbs, 0, wxEXPAND | wxALL, 10);
|
||||
// sbs = new wxStaticBoxSizer(new wxStaticBox(scrolled_win, wxID_ANY, "LuTrulala"), wxVERTICAL);
|
||||
// vs->Add(sbs, 0, wxEXPAND | wxALL, 10);
|
||||
|
||||
EVT_COMBOBOX($parent, $self->{presets_choice}, sub {
|
||||
$self->select_preset($self->{presets_choice}->GetStringSelection);
|
||||
});
|
||||
|
||||
EVT_BUTTON($self, $self->{btn_save_preset}, sub { $self->save_preset });
|
||||
EVT_BUTTON($self, $self->{btn_delete_preset}, sub { $self->delete_preset });
|
||||
EVT_BUTTON($self, $self->{btn_hide_incompatible_presets}, sub { $self->_toggle_show_hide_incompatible });
|
||||
*/
|
||||
// auto *page_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
// hsizer_->Add(page_sizer, 1, wxEXPAND | wxLEFT, 5);
|
||||
|
||||
// wxStaticBox* box = new wxStaticBox(panel, wxID_ANY, "Filament");
|
||||
// page_sizer->Add(new wxStaticBoxSizer(box, wxHORIZONTAL), 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT | wxBOTTOM, 10);
|
||||
//
|
||||
// //Horizontal sizer to hold the tree and the selected page.
|
||||
// wxStaticBoxSizer* tmp_hsizer = new wxStaticBoxSizer(wxHORIZONTAL, panel, "Experimental Box");
|
||||
// page_sizer->Add(tmp_hsizer, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT | wxBOTTOM, 10);
|
||||
//
|
||||
// auto *grid_sizer = new wxFlexGridSizer(0, 4, 0, 0);
|
||||
// grid_sizer->SetFlexibleDirection(wxHORIZONTAL);
|
||||
// tmp_hsizer->Add(grid_sizer, 0, wxEXPAND | wxALL, /*&Wx::wxMAC ? 0 :*/ 5);
|
||||
//
|
||||
// wxStaticText *label = new wxStaticText(panel, wxID_ANY, "Label1", wxDefaultPosition, wxSize(200,-1));
|
||||
// auto *textctrl = new wxTextCtrl(panel, wxID_ANY, "TruLaLa1");
|
||||
// grid_sizer->Add(label, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
// grid_sizer->Add(textctrl, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
//
|
||||
// label = new wxStaticText(panel, wxID_ANY, "Labelszdfdghhjk2");
|
||||
// textctrl = new wxTextCtrl(panel, wxID_ANY, "TruLaLa2");
|
||||
// grid_sizer->Add(label, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
// grid_sizer->Add(textctrl, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
//
|
||||
// label = new wxStaticText(panel, wxID_ANY, "Label3");
|
||||
// textctrl = new wxTextCtrl(panel, wxID_ANY, "TruLaLa3");
|
||||
// grid_sizer->Add(label, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
// grid_sizer->Add(textctrl, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
//
|
||||
// label = new wxStaticText(panel, wxID_ANY, "Label4");
|
||||
// textctrl = new wxTextCtrl(panel, wxID_ANY, "TruLaLa4");
|
||||
// grid_sizer->Add(label, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
// grid_sizer->Add(textctrl, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
//
|
||||
// box = new wxStaticBox(panel, wxID_ANY, "Print");
|
||||
// page_sizer->Add(new wxStaticBoxSizer(box, wxHORIZONTAL), 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT | wxBOTTOM, 10);
|
||||
//!------------------------
|
||||
|
||||
treectrl_->Bind(wxEVT_TREE_SEL_CHANGED, &CTab::OnTreeSelChange, this);
|
||||
treectrl_->Bind(wxEVT_KEY_DOWN, &CTab::OnKeyDown, this);
|
||||
treectrl_->Bind(wxEVT_COMBOBOX, &CTab::OnComboBox, this);
|
||||
|
||||
btn_save_preset_->Bind(wxEVT_BUTTON, &CTab::save_preset, this);
|
||||
btn_delete_preset_->Bind(wxEVT_BUTTON, &CTab::delete_preset, this);
|
||||
btn_hide_incompatible_presets_->Bind(wxEVT_BUTTON, &CTab::_toggle_show_hide_incompatible, this);
|
||||
|
||||
// Initialize the DynamicPrintConfig by default keys/values.
|
||||
// Possible %params keys: no_controller
|
||||
// build(/*%params*/);
|
||||
// rebuild_page_tree();
|
||||
build();
|
||||
rebuild_page_tree();
|
||||
// _update();
|
||||
|
||||
|
||||
return;//$self;
|
||||
}
|
||||
|
||||
void CTab::OnTreeSelChange(wxCommandEvent& event)
|
||||
CPageShp CTab::add_options_page(wxString title, wxString icon)
|
||||
{
|
||||
if (disable_tree_sel_changed_event) return;
|
||||
// Index of icon in an icon list $self->{icons}.
|
||||
auto icon_idx = 0;
|
||||
if (!icon.IsEmpty()) {
|
||||
try { icon_idx = icon_index_.at(icon);}
|
||||
catch (std::out_of_range e) { icon_idx = -1; }
|
||||
if (icon_idx == -1) {
|
||||
// Add a new icon to the icon list.
|
||||
const auto img_icon = new wxIcon(wxT("var\\") + icon, wxBITMAP_TYPE_PNG);
|
||||
icons_->Add(*img_icon);
|
||||
icon_idx = ++icon_count; // $icon_idx = $self->{icon_count} + 1; $self->{icon_count} = $icon_idx;
|
||||
icon_index_[icon] = icon_idx;
|
||||
}
|
||||
}
|
||||
// Initialize the page.
|
||||
CPageShp page(new CPage(this, title, icon_idx));
|
||||
page->SetScrollbars(1, 1, 1, 1);
|
||||
page->Hide();
|
||||
hsizer_->Add(page.get(), 1, wxEXPAND | wxLEFT, 5);
|
||||
pages_.push_back(page);
|
||||
return page;
|
||||
}
|
||||
|
||||
void CTabPrint::build()
|
||||
{
|
||||
// $self->{presets} = wxTheApp->{preset_bundle}->print;
|
||||
// $self->{config} = $self->{presets}->get_edited_preset->config;
|
||||
|
||||
PresetCollection *prints = new PresetCollection(Preset::TYPE_PRINT, Preset::print_options());
|
||||
config_ = prints->get_edited_preset().config;
|
||||
|
||||
auto page = add_options_page("Layers and perimeters", "layers.png");
|
||||
page->set_config(&config_);
|
||||
// {
|
||||
auto optgroup = page->new_optgroup("Layer height");
|
||||
// optgroup->append_single_option_line("layer_height");
|
||||
// optgroup->append_single_option_line("first_layer_height");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Vertical shells");
|
||||
// $optgroup->append_single_option_line("perimeters");
|
||||
// $optgroup->append_single_option_line("spiral_vase");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Horizontal shells");
|
||||
// my $line = Slic3r::GUI::OptionsGroup::Line->new(
|
||||
// label = > "Solid layers",
|
||||
// );
|
||||
// $line->append_option($optgroup->get_option("top_solid_layers"));
|
||||
// $line->append_option($optgroup->get_option("bottom_solid_layers"));
|
||||
// $optgroup->append_line($line);
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Quality (slower slicing)");
|
||||
// $optgroup->append_single_option_line("extra_perimeters");
|
||||
// $optgroup->append_single_option_line("ensure_vertical_shell_thickness");
|
||||
// $optgroup->append_single_option_line("avoid_crossing_perimeters");
|
||||
// $optgroup->append_single_option_line("thin_walls");
|
||||
// $optgroup->append_single_option_line("overhangs");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Advanced");
|
||||
// $optgroup->append_single_option_line("seam_position");
|
||||
// $optgroup->append_single_option_line("external_perimeters_first");
|
||||
// }
|
||||
|
||||
page = add_options_page("Infill", "infill.png");
|
||||
page->set_config(&config_);
|
||||
// {
|
||||
optgroup = page->new_optgroup("Infill");
|
||||
// $optgroup->append_single_option_line("fill_density");
|
||||
// $optgroup->append_single_option_line("fill_pattern");
|
||||
// $optgroup->append_single_option_line("external_fill_pattern");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Reducing printing time");
|
||||
// $optgroup->append_single_option_line("infill_every_layers");
|
||||
// $optgroup->append_single_option_line("infill_only_where_needed");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Advanced");
|
||||
// $optgroup->append_single_option_line("solid_infill_every_layers");
|
||||
// $optgroup->append_single_option_line("fill_angle");
|
||||
// $optgroup->append_single_option_line("solid_infill_below_area");
|
||||
// $optgroup->append_single_option_line("bridge_angle");
|
||||
// $optgroup->append_single_option_line("only_retract_when_crossing_perimeters");
|
||||
// $optgroup->append_single_option_line("infill_first");
|
||||
// }
|
||||
|
||||
page = add_options_page("Skirt and brim", "box.png");
|
||||
page->set_config(&config_);
|
||||
// {
|
||||
optgroup = page->new_optgroup("Skirt");
|
||||
// $optgroup->append_single_option_line("skirts");
|
||||
// $optgroup->append_single_option_line("skirt_distance");
|
||||
// $optgroup->append_single_option_line("skirt_height");
|
||||
// $optgroup->append_single_option_line("min_skirt_length");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Brim");
|
||||
// $optgroup->append_single_option_line("brim_width");
|
||||
// }
|
||||
|
||||
page = add_options_page("Support material", "building.png");
|
||||
page->set_config(&config_);
|
||||
// {
|
||||
optgroup = page->new_optgroup("Support material");
|
||||
// $optgroup->append_single_option_line("support_material");
|
||||
// $optgroup->append_single_option_line("support_material_threshold");
|
||||
// $optgroup->append_single_option_line("support_material_enforce_layers");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Raft");
|
||||
// $optgroup->append_single_option_line("raft_layers");
|
||||
// # $optgroup->append_single_option_line("raft_contact_distance");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Options for support material and raft");
|
||||
// $optgroup->append_single_option_line("support_material_contact_distance");
|
||||
// $optgroup->append_single_option_line("support_material_pattern");
|
||||
// $optgroup->append_single_option_line("support_material_with_sheath");
|
||||
// $optgroup->append_single_option_line("support_material_spacing");
|
||||
// $optgroup->append_single_option_line("support_material_angle");
|
||||
// $optgroup->append_single_option_line("support_material_interface_layers");
|
||||
// $optgroup->append_single_option_line("support_material_interface_spacing");
|
||||
// $optgroup->append_single_option_line("support_material_interface_contact_loops");
|
||||
// $optgroup->append_single_option_line("support_material_buildplate_only");
|
||||
// $optgroup->append_single_option_line("support_material_xy_spacing");
|
||||
// $optgroup->append_single_option_line("dont_support_bridges");
|
||||
// $optgroup->append_single_option_line("support_material_synchronize_layers");
|
||||
// }
|
||||
|
||||
page = add_options_page("Speed", "time.png");
|
||||
page->set_config(&config_);
|
||||
// {
|
||||
optgroup = page->new_optgroup("Speed for print moves");
|
||||
// $optgroup->append_single_option_line("perimeter_speed");
|
||||
// $optgroup->append_single_option_line("small_perimeter_speed");
|
||||
// $optgroup->append_single_option_line("external_perimeter_speed");
|
||||
// $optgroup->append_single_option_line("infill_speed");
|
||||
// $optgroup->append_single_option_line("solid_infill_speed");
|
||||
// $optgroup->append_single_option_line("top_solid_infill_speed");
|
||||
// $optgroup->append_single_option_line("support_material_speed");
|
||||
// $optgroup->append_single_option_line("support_material_interface_speed");
|
||||
// $optgroup->append_single_option_line("bridge_speed");
|
||||
// $optgroup->append_single_option_line("gap_fill_speed");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Speed for non-print moves");
|
||||
// $optgroup->append_single_option_line("travel_speed");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Modifiers");
|
||||
// $optgroup->append_single_option_line("first_layer_speed");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Acceleration control (advanced)");
|
||||
// $optgroup->append_single_option_line("perimeter_acceleration");
|
||||
// $optgroup->append_single_option_line("infill_acceleration");
|
||||
// $optgroup->append_single_option_line("bridge_acceleration");
|
||||
// $optgroup->append_single_option_line("first_layer_acceleration");
|
||||
// $optgroup->append_single_option_line("default_acceleration");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Autospeed (advanced)");
|
||||
// $optgroup->append_single_option_line("max_print_speed");
|
||||
// $optgroup->append_single_option_line("max_volumetric_speed");
|
||||
// $optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_positive");
|
||||
// $optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_negative");
|
||||
// }
|
||||
|
||||
page = add_options_page("Multiple Extruders", "funnel.png");
|
||||
page->set_config(&config_);
|
||||
// {
|
||||
optgroup = page->new_optgroup("Extruders");
|
||||
// $optgroup->append_single_option_line("perimeter_extruder");
|
||||
// $optgroup->append_single_option_line("infill_extruder");
|
||||
// $optgroup->append_single_option_line("solid_infill_extruder");
|
||||
// $optgroup->append_single_option_line("support_material_extruder");
|
||||
// $optgroup->append_single_option_line("support_material_interface_extruder");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Ooze prevention");
|
||||
// $optgroup->append_single_option_line("ooze_prevention");
|
||||
// $optgroup->append_single_option_line("standby_temperature_delta");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Wipe tower");
|
||||
// $optgroup->append_single_option_line("wipe_tower");
|
||||
// $optgroup->append_single_option_line("wipe_tower_x");
|
||||
// $optgroup->append_single_option_line("wipe_tower_y");
|
||||
// $optgroup->append_single_option_line("wipe_tower_width");
|
||||
// $optgroup->append_single_option_line("wipe_tower_per_color_wipe");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Advanced");
|
||||
// $optgroup->append_single_option_line("interface_shells");
|
||||
// }
|
||||
|
||||
page = add_options_page("Advanced", "wrench.png");
|
||||
page->set_config(&config_);
|
||||
// {
|
||||
optgroup = page->new_optgroup("Extrusion width", 180);
|
||||
// $optgroup->append_single_option_line("extrusion_width");
|
||||
// $optgroup->append_single_option_line("first_layer_extrusion_width");
|
||||
// $optgroup->append_single_option_line("perimeter_extrusion_width");
|
||||
// $optgroup->append_single_option_line("external_perimeter_extrusion_width");
|
||||
// $optgroup->append_single_option_line("infill_extrusion_width");
|
||||
// $optgroup->append_single_option_line("solid_infill_extrusion_width");
|
||||
// $optgroup->append_single_option_line("top_infill_extrusion_width");
|
||||
// $optgroup->append_single_option_line("support_material_extrusion_width");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Overlap");
|
||||
// $optgroup->append_single_option_line("infill_overlap");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Flow");
|
||||
// $optgroup->append_single_option_line("bridge_flow_ratio");
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Other");
|
||||
// $optgroup->append_single_option_line("clip_multipart_objects");
|
||||
// $optgroup->append_single_option_line("elefant_foot_compensation");
|
||||
// $optgroup->append_single_option_line("xy_size_compensation");
|
||||
// # $optgroup->append_single_option_line("threads");
|
||||
// $optgroup->append_single_option_line("resolution");
|
||||
// }
|
||||
|
||||
page = add_options_page("Output options", "page_white_go.png");
|
||||
page->set_config(&config_);
|
||||
// {
|
||||
optgroup = page->new_optgroup("Sequential printing");
|
||||
// $optgroup->append_single_option_line("complete_objects");
|
||||
// my $line = Slic3r::GUI::OptionsGroup::Line->new(
|
||||
// label = > "Extruder clearance (mm)",
|
||||
// );
|
||||
// foreach my $opt_key(qw(extruder_clearance_radius extruder_clearance_height)) {
|
||||
// my $option = $optgroup->get_option($opt_key);
|
||||
// $option->width(60);
|
||||
// $line->append_option($option);
|
||||
// }
|
||||
// $optgroup->append_line($line);
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Output file");
|
||||
// $optgroup->append_single_option_line("gcode_comments");
|
||||
//
|
||||
// {
|
||||
// my $option = $optgroup->get_option("output_filename_format");
|
||||
// $option->full_width(1);
|
||||
// $optgroup->append_single_option_line($option);
|
||||
// }
|
||||
// }
|
||||
// {
|
||||
optgroup = page->new_optgroup("Post-processing scripts");
|
||||
// label_width = > 0,
|
||||
// );
|
||||
// my $option = $optgroup->get_option("post_process");
|
||||
// $option->full_width(1);
|
||||
// $option->height(50);
|
||||
// $optgroup->append_single_option_line($option);
|
||||
// }
|
||||
|
||||
page = add_options_page("Notes", "note.png");
|
||||
page->set_config(&config_);
|
||||
// {
|
||||
optgroup = page->new_optgroup("Notes"); //label_width = > 0,
|
||||
// my $option = $optgroup->get_option("notes");
|
||||
// $option->full_width(1);
|
||||
// $option->height(250);
|
||||
// $optgroup->append_single_option_line($option);
|
||||
// }
|
||||
|
||||
page = add_options_page("Dependencies", "wrench.png");
|
||||
page->set_config(&config_);
|
||||
// {
|
||||
optgroup = page->new_optgroup("Profile dependencies");
|
||||
// {
|
||||
// my $line = Slic3r::GUI::OptionsGroup::Line->new(
|
||||
// label = > "Compatible printers",
|
||||
// widget = > $self->_compatible_printers_widget,
|
||||
// );
|
||||
// $optgroup->append_line($line);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
//Regerenerate content of the page tree.
|
||||
void CTab::rebuild_page_tree()
|
||||
{
|
||||
Freeze();
|
||||
// get label of the currently selected item
|
||||
auto selected = treectrl_->GetItemText(treectrl_->GetSelection());
|
||||
auto rootItem = treectrl_->GetRootItem();
|
||||
treectrl_->DeleteChildren(rootItem);
|
||||
auto have_selection = 0;
|
||||
for (auto p : pages_)
|
||||
{
|
||||
auto itemId = treectrl_->AppendItem(rootItem, p->title(), p->iconID());
|
||||
if (p->title() == selected) {
|
||||
disable_tree_sel_changed_event_ = 1;
|
||||
treectrl_->SelectItem(itemId);
|
||||
disable_tree_sel_changed_event_ = 0;
|
||||
have_selection = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!have_selection) {
|
||||
// this is triggered on first load, so we don't disable the sel change event
|
||||
treectrl_->SelectItem(treectrl_->GetFirstVisibleItem());//! (treectrl->GetFirstChild(rootItem));
|
||||
}
|
||||
Thaw();
|
||||
}
|
||||
|
||||
void CTab::OnTreeSelChange(wxTreeEvent& event)
|
||||
{
|
||||
if (disable_tree_sel_changed_event_) return;
|
||||
CPage* page = nullptr;
|
||||
for (auto& el : pages)
|
||||
if (el.title() == treectrl->GetSelection())
|
||||
auto selection = treectrl_->GetItemText(treectrl_->GetSelection());
|
||||
for (auto p : pages_)
|
||||
if (p->title() == selection)
|
||||
{
|
||||
page = ⪙
|
||||
page = p.get();
|
||||
break;
|
||||
}
|
||||
if (page == nullptr) return;
|
||||
|
||||
for (auto& el : pages)
|
||||
el.Hide();
|
||||
for (auto& el : pages_)
|
||||
el.get()->Hide();
|
||||
page->Show();
|
||||
hsizer->Layout();
|
||||
this->Refresh();
|
||||
};
|
||||
hsizer_->Layout();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void CTab::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
event.GetKeyCode() == WXK_TAB ?
|
||||
treectrl->Navigate(event.ShiftDown() ? wxNavigationKeyEvent::IsBackward : wxNavigationKeyEvent::IsForward) :
|
||||
treectrl_->Navigate(event.ShiftDown() ? wxNavigationKeyEvent::IsBackward : wxNavigationKeyEvent::IsForward) :
|
||||
event.Skip();
|
||||
};
|
||||
|
||||
|
@ -169,5 +506,27 @@ void CTab::save_preset(wxCommandEvent &event){};
|
|||
void CTab::delete_preset(wxCommandEvent &event){};
|
||||
void CTab::_toggle_show_hide_incompatible(wxCommandEvent &event){};
|
||||
|
||||
// package Slic3r::GUI::Tab::Page;
|
||||
ConfigOptionsGroupShp CPage::new_optgroup(std::string title, size_t label_width /*= 0*/)
|
||||
{
|
||||
//! config_ have to be "right"
|
||||
ConfigOptionsGroupShp optgroup = std::make_shared<ConfigOptionsGroup>(/*parent()*/this, title, config_);
|
||||
if (label_width != 0)
|
||||
optgroup->label_width = label_width;
|
||||
|
||||
// on_change => sub {
|
||||
// my ($opt_key, $value) = @_;
|
||||
// wxTheApp->CallAfter(sub {
|
||||
// $self->GetParent->update_dirty;
|
||||
// $self->GetParent->_on_value_change($opt_key, $value);
|
||||
// });
|
||||
// },
|
||||
|
||||
vsizer()->Add(optgroup->sizer, 0, wxEXPAND | wxALL, 10);
|
||||
optgroups.push_back(optgroup);
|
||||
|
||||
return optgroup;
|
||||
}
|
||||
|
||||
} // GUI
|
||||
} // Slic3r
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue