From 0a1f5992ad49192186954f59d09c02c48e1832c9 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 25 Jan 2015 11:10:06 +0100 Subject: [PATCH] Add Bed Shape to Simple Mode as well. #2574 --- lib/Slic3r/GUI/SimpleTab.pm | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/GUI/SimpleTab.pm b/lib/Slic3r/GUI/SimpleTab.pm index 93f4b3830..88a11d2b8 100644 --- a/lib/Slic3r/GUI/SimpleTab.pm +++ b/lib/Slic3r/GUI/SimpleTab.pm @@ -206,6 +206,8 @@ sub build { package Slic3r::GUI::SimpleTab::Printer; use base 'Slic3r::GUI::SimpleTab'; +use Wx qw(:sizer :button :bitmap :misc :id); +use Wx::Event qw(EVT_BUTTON); sub name { 'printer' } sub title { 'Printer Settings' } @@ -214,6 +216,7 @@ sub build { my $self = shift; $self->init_config_options(qw( + bed_shape z_offset gcode_flavor nozzle_diameter @@ -223,8 +226,36 @@ sub build { )); { + my $bed_shape_widget = sub { + my ($parent) = @_; + + my $btn = Wx::Button->new($parent, -1, "Set…", wxDefaultPosition, wxDefaultSize, wxBU_LEFT); + $btn->SetFont($Slic3r::GUI::small_font); + if ($Slic3r::GUI::have_button_icons) { + $btn->SetBitmap(Wx::Bitmap->new("$Slic3r::var/cog.png", wxBITMAP_TYPE_PNG)); + } + + my $sizer = Wx::BoxSizer->new(wxHORIZONTAL); + $sizer->Add($btn); + + EVT_BUTTON($self, $btn, sub { + my $dlg = Slic3r::GUI::BedShapeDialog->new($self, $self->{config}->bed_shape); + if ($dlg->ShowModal == wxID_OK) { + my $value = $dlg->GetValue; + $self->{config}->set('bed_shape', $value); + $self->_on_value_change('bed_shape', $value); + } + }); + + return $sizer; + }; + my $optgroup = $self->new_optgroup('Size and coordinates'); - # TODO: add bed_shape + my $line = Slic3r::GUI::OptionsGroup::Line->new( + label => 'Bed shape', + widget => $bed_shape_widget, + ); + $optgroup->append_line($line); $optgroup->append_single_option_line('z_offset'); }