Merge branch 'master' into wipe_tower_improvements
This commit is contained in:
commit
1c6fa6660e
79 changed files with 34645 additions and 10116 deletions
|
@ -13,6 +13,8 @@ use Wx qw(wxTheApp :misc :pen :brush :sizer :font :cursor wxTAB_TRAVERSAL);
|
|||
use Wx::Event qw(EVT_MOUSE_EVENTS EVT_PAINT EVT_ERASE_BACKGROUND EVT_SIZE);
|
||||
use base 'Wx::Panel';
|
||||
|
||||
use Wx::Locale gettext => 'L';
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my ($parent, $size, $objects, $model, $config) = @_;
|
||||
|
@ -126,8 +128,8 @@ sub repaint {
|
|||
$dc->SetFont(Wx::Font->new(14, wxDEFAULT, wxNORMAL, wxNORMAL));
|
||||
$dc->DrawLabel(
|
||||
join('-', +(localtime)[3,4]) eq '13-8'
|
||||
? 'What do you want to print today? ™' # Sept. 13, 2006. The first part ever printed by a RepRap to make another RepRap.
|
||||
: 'Drag your objects here',
|
||||
? L('What do you want to print today? ™') # Sept. 13, 2006. The first part ever printed by a RepRap to make another RepRap.
|
||||
: L('Drag your objects here'),
|
||||
Wx::Rect->new(0, 0, $self->GetSize->GetWidth, $self->GetSize->GetHeight), wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL);
|
||||
}
|
||||
|
||||
|
|
|
@ -338,7 +338,6 @@ sub Render {
|
|||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
if (!$self->GetParent->enabled || !$self->layers) {
|
||||
glFlush();
|
||||
$self->SwapBuffers;
|
||||
return;
|
||||
}
|
||||
|
@ -486,7 +485,6 @@ sub Render {
|
|||
}
|
||||
|
||||
gluDeleteTess($tess) if $tess;
|
||||
glFlush();
|
||||
$self->SwapBuffers;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ use Wx qw(:misc :sizer :slider :statictext :keycode wxWHITE wxCB_READONLY);
|
|||
use Wx::Event qw(EVT_SLIDER EVT_KEY_DOWN EVT_CHECKBOX EVT_CHOICE EVT_CHECKLISTBOX);
|
||||
use base qw(Wx::Panel Class::Accessor);
|
||||
|
||||
use Wx::Locale gettext => 'L';
|
||||
|
||||
__PACKAGE__->mk_accessors(qw(print gcode_preview_data enabled _loaded canvas slider_low slider_high single_layer auto_zoom));
|
||||
|
||||
sub new {
|
||||
|
@ -58,34 +60,42 @@ sub new {
|
|||
$z_label_high->SetFont($Slic3r::GUI::small_font);
|
||||
|
||||
$self->single_layer(0);
|
||||
my $checkbox_singlelayer = $self->{checkbox_singlelayer} = Wx::CheckBox->new($self, -1, "1 Layer");
|
||||
my $checkbox_singlelayer = $self->{checkbox_singlelayer} = Wx::CheckBox->new($self, -1, L("1 Layer"));
|
||||
|
||||
my $label_view_type = $self->{label_view_type} = Wx::StaticText->new($self, -1, "View");
|
||||
my $label_view_type = $self->{label_view_type} = Wx::StaticText->new($self, -1, L("View"));
|
||||
|
||||
my $choice_view_type = $self->{choice_view_type} = Wx::Choice->new($self, -1);
|
||||
$choice_view_type->Append("Feature type");
|
||||
$choice_view_type->Append("Height");
|
||||
$choice_view_type->Append("Width");
|
||||
$choice_view_type->Append("Speed");
|
||||
$choice_view_type->Append("Tool");
|
||||
$choice_view_type->Append(L("Feature type"));
|
||||
$choice_view_type->Append(L("Height"));
|
||||
$choice_view_type->Append(L("Width"));
|
||||
$choice_view_type->Append(L("Speed"));
|
||||
$choice_view_type->Append(L("Tool"));
|
||||
$choice_view_type->SetSelection(0);
|
||||
|
||||
my $label_show_features = $self->{label_show_features} = Wx::StaticText->new($self, -1, "Show");
|
||||
my $label_show_features = $self->{label_show_features} = Wx::StaticText->new($self, -1, L("Show"));
|
||||
|
||||
my $combochecklist_features = $self->{combochecklist_features} = Wx::ComboCtrl->new();
|
||||
$combochecklist_features->Create($self, -1, "Feature types", wxDefaultPosition, [200, -1], wxCB_READONLY);
|
||||
#FIXME If the following line is removed, the combo box popup list will not react to mouse clicks.
|
||||
# On the other side, with this line the combo box popup cannot be closed by clicking on the combo button on Windows 10.
|
||||
$combochecklist_features->UseAltPopupWindow();
|
||||
$combochecklist_features->EnablePopupAnimation(0);
|
||||
my $feature_text = "Feature types";
|
||||
my $feature_items = "Perimeter|External perimeter|Overhang perimeter|Internal infill|Solid infill|Top solid infill|Bridge infill|Gap fill|Skirt|Support material|Support material interface|Wipe tower";
|
||||
$combochecklist_features->Create($self, -1, L("Feature types"), wxDefaultPosition, [200, -1], wxCB_READONLY);
|
||||
my $feature_text = L("Feature types");
|
||||
my $feature_items = L("Perimeter")."|"
|
||||
.L("External perimeter")."|"
|
||||
.L("Overhang perimeter")."|"
|
||||
.L("Internal infill")."|"
|
||||
.L("Solid infill")."|"
|
||||
.L("Top solid infill")."|"
|
||||
.L("Bridge infill")."|"
|
||||
.L("Gap fill")."|"
|
||||
.L("Skirt")."|"
|
||||
.L("Support material")."|"
|
||||
.L("Support material interface")."|"
|
||||
.L("Wipe tower")."|"
|
||||
.L("Custom");
|
||||
Slic3r::GUI::create_combochecklist($combochecklist_features, $feature_text, $feature_items, 1);
|
||||
|
||||
my $checkbox_travel = $self->{checkbox_travel} = Wx::CheckBox->new($self, -1, "Travel");
|
||||
my $checkbox_retractions = $self->{checkbox_retractions} = Wx::CheckBox->new($self, -1, "Retractions");
|
||||
my $checkbox_unretractions = $self->{checkbox_unretractions} = Wx::CheckBox->new($self, -1, "Unretractions");
|
||||
my $checkbox_shells = $self->{checkbox_shells} = Wx::CheckBox->new($self, -1, "Shells");
|
||||
my $checkbox_travel = $self->{checkbox_travel} = Wx::CheckBox->new($self, -1, L("Travel"));
|
||||
my $checkbox_retractions = $self->{checkbox_retractions} = Wx::CheckBox->new($self, -1, L("Retractions"));
|
||||
my $checkbox_unretractions = $self->{checkbox_unretractions} = Wx::CheckBox->new($self, -1, L("Unretractions"));
|
||||
my $checkbox_shells = $self->{checkbox_shells} = Wx::CheckBox->new($self, -1, L("Shells"));
|
||||
|
||||
my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL);
|
||||
my $vsizer = Wx::BoxSizer->new(wxVERTICAL);
|
||||
|
@ -255,6 +265,7 @@ sub new {
|
|||
'Support material' => '00FF00',
|
||||
'Support material interface' => '008000',
|
||||
'Wipe tower' => 'B3E3AB',
|
||||
'Custom' => 'FFFF00',
|
||||
);
|
||||
$self->gcode_preview_data->set_extrusion_paths_colors(\@extrusion_roles_colors);
|
||||
|
||||
|
@ -322,31 +333,9 @@ sub load_print {
|
|||
return;
|
||||
}
|
||||
|
||||
my $z_idx_low = $self->slider_low->GetValue;
|
||||
my $z_idx_high = $self->slider_high->GetValue;
|
||||
$self->enabled(1);
|
||||
$self->slider_low->SetRange(0, $n_layers - 1);
|
||||
$self->slider_high->SetRange(0, $n_layers - 1);
|
||||
if ($z_idx_high < $n_layers && ($self->single_layer || $z_idx_high != 0)) {
|
||||
# use $z_idx
|
||||
} else {
|
||||
# Out of range. Disable 'single layer' view.
|
||||
$self->single_layer(0);
|
||||
$self->{checkbox_singlelayer}->SetValue(0);
|
||||
$z_idx_low = 0;
|
||||
$z_idx_high = $n_layers - 1;
|
||||
}
|
||||
if ($self->single_layer) {
|
||||
$z_idx_low = $z_idx_high;
|
||||
} elsif ($z_idx_low > $z_idx_high) {
|
||||
$z_idx_low = 0;
|
||||
}
|
||||
$self->slider_low->SetValue($z_idx_low);
|
||||
$self->slider_high->SetValue($z_idx_high);
|
||||
$self->slider_low->Show;
|
||||
$self->slider_high->Show;
|
||||
$self->Layout;
|
||||
|
||||
# used to set the sliders to the extremes of the current zs range
|
||||
$self->{force_sliders_full_range} = 0;
|
||||
|
||||
if ($self->{preferred_color_mode} eq 'tool_or_feature') {
|
||||
# It is left to Slic3r to decide whether the print shall be colored by the tool or by the feature.
|
||||
# Color by feature if it is a single extruder print.
|
||||
|
@ -384,16 +373,58 @@ sub load_print {
|
|||
}
|
||||
$self->show_hide_ui_elements('simple');
|
||||
} else {
|
||||
$self->{force_sliders_full_range} = (scalar(@{$self->canvas->volumes}) == 0) && $self->auto_zoom;
|
||||
$self->canvas->load_gcode_preview($self->print, $self->gcode_preview_data, \@colors);
|
||||
$self->show_hide_ui_elements('full');
|
||||
|
||||
# recalculates zs and update sliders accordingly
|
||||
$self->{layers_z} = $self->canvas->get_current_print_zs();
|
||||
$n_layers = scalar(@{$self->{layers_z}});
|
||||
}
|
||||
|
||||
$self->update_sliders($n_layers);
|
||||
|
||||
if ($self->auto_zoom) {
|
||||
$self->canvas->zoom_to_volumes;
|
||||
}
|
||||
$self->_loaded(1);
|
||||
}
|
||||
}
|
||||
|
||||
sub update_sliders
|
||||
{
|
||||
my ($self, $n_layers) = @_;
|
||||
|
||||
my $z_idx_low = $self->slider_low->GetValue;
|
||||
my $z_idx_high = $self->slider_high->GetValue;
|
||||
$self->enabled(1);
|
||||
$self->slider_low->SetRange(0, $n_layers - 1);
|
||||
$self->slider_high->SetRange(0, $n_layers - 1);
|
||||
|
||||
if ($self->{force_sliders_full_range}) {
|
||||
$z_idx_low = 0;
|
||||
$z_idx_high = $n_layers - 1;
|
||||
} elsif ($z_idx_high < $n_layers && ($self->single_layer || $z_idx_high != 0)) {
|
||||
# use $z_idx
|
||||
} else {
|
||||
# Out of range. Disable 'single layer' view.
|
||||
$self->single_layer(0);
|
||||
$self->{checkbox_singlelayer}->SetValue(0);
|
||||
$z_idx_low = 0;
|
||||
$z_idx_high = $n_layers - 1;
|
||||
}
|
||||
if ($self->single_layer) {
|
||||
$z_idx_low = $z_idx_high;
|
||||
} elsif ($z_idx_low > $z_idx_high) {
|
||||
$z_idx_low = 0;
|
||||
}
|
||||
|
||||
$self->slider_low->SetValue($z_idx_low);
|
||||
$self->slider_high->SetValue($z_idx_high);
|
||||
$self->slider_low->Show;
|
||||
$self->slider_high->Show;
|
||||
$self->set_z_range($self->{layers_z}[$z_idx_low], $self->{layers_z}[$z_idx_high]);
|
||||
$self->Layout;
|
||||
}
|
||||
|
||||
sub set_z_range
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue