Use wxDefaultPosition and wxDefaultSize to improve readability
This commit is contained in:
parent
cd7661aa2a
commit
92ec70c860
@ -9,7 +9,7 @@ use Slic3r::GUI::OptionsGroup;
|
|||||||
use Slic3r::GUI::SkeinPanel;
|
use Slic3r::GUI::SkeinPanel;
|
||||||
use Slic3r::GUI::Tab;
|
use Slic3r::GUI::Tab;
|
||||||
|
|
||||||
use Wx 0.9901 qw(:bitmap :dialog :frame :icon :id :systemsettings);
|
use Wx 0.9901 qw(:bitmap :dialog :frame :icon :id :misc :systemsettings);
|
||||||
use Wx::Event qw(EVT_CLOSE EVT_MENU);
|
use Wx::Event qw(EVT_CLOSE EVT_MENU);
|
||||||
use base 'Wx::App';
|
use base 'Wx::App';
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ sub OnInit {
|
|||||||
|
|
||||||
# application frame
|
# application frame
|
||||||
Wx::Image::AddHandler(Wx::PNGHandler->new);
|
Wx::Image::AddHandler(Wx::PNGHandler->new);
|
||||||
my $frame = Wx::Frame->new(undef, -1, 'Slic3r', [-1, -1], [760,520], wxDEFAULT_FRAME_STYLE);
|
my $frame = Wx::Frame->new(undef, -1, 'Slic3r', wxDefaultPosition, [760,520], wxDEFAULT_FRAME_STYLE);
|
||||||
$frame->SetIcon(Wx::Icon->new("$Slic3r::var/Slic3r_128px.png", wxBITMAP_TYPE_PNG) );
|
$frame->SetIcon(Wx::Icon->new("$Slic3r::var/Slic3r_128px.png", wxBITMAP_TYPE_PNG) );
|
||||||
$frame->{skeinpanel} = Slic3r::GUI::SkeinPanel->new($frame);
|
$frame->{skeinpanel} = Slic3r::GUI::SkeinPanel->new($frame);
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ sub notify {
|
|||||||
}
|
}
|
||||||
|
|
||||||
package Slic3r::GUI::ProgressStatusBar;
|
package Slic3r::GUI::ProgressStatusBar;
|
||||||
use Wx qw(:gauge);
|
use Wx qw(:gauge :misc);
|
||||||
use base 'Wx::StatusBar';
|
use base 'Wx::StatusBar';
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
@ -179,9 +179,9 @@ sub new {
|
|||||||
$self->{_changed} = 0;
|
$self->{_changed} = 0;
|
||||||
$self->{busy} = 0;
|
$self->{busy} = 0;
|
||||||
$self->{timer} = Wx::Timer->new($self);
|
$self->{timer} = Wx::Timer->new($self);
|
||||||
$self->{prog} = Wx::Gauge->new($self, wxGA_HORIZONTAL, 100, [-1,-1], [-1,-1]);
|
$self->{prog} = Wx::Gauge->new($self, wxGA_HORIZONTAL, 100, wxDefaultPosition, wxDefaultSize);
|
||||||
$self->{prog}->Hide;
|
$self->{prog}->Hide;
|
||||||
$self->{cancelbutton} = Wx::Button->new($self, -1, "Cancel", [-1,-1], [-1,8]);
|
$self->{cancelbutton} = Wx::Button->new($self, -1, "Cancel", wxDefaultPosition, [-1,8]);
|
||||||
$self->{cancelbutton}->Hide;
|
$self->{cancelbutton}->Hide;
|
||||||
|
|
||||||
$self->SetFieldsCount(3);
|
$self->SetFieldsCount(3);
|
||||||
|
@ -111,7 +111,7 @@ sub new {
|
|||||||
if ($opt->{sidetext}) {
|
if ($opt->{sidetext}) {
|
||||||
my $sizer = Wx::BoxSizer->new(wxHORIZONTAL);
|
my $sizer = Wx::BoxSizer->new(wxHORIZONTAL);
|
||||||
$sizer->Add($field);
|
$sizer->Add($field);
|
||||||
my $sidetext = Wx::StaticText->new($parent, -1, $opt->{sidetext}, wxDefaultPosition, [-1, -1]);
|
my $sidetext = Wx::StaticText->new($parent, -1, $opt->{sidetext}, wxDefaultPosition, wxDefaultSize);
|
||||||
$sidetext->SetFont($sidetext_font);
|
$sidetext->SetFont($sidetext_font);
|
||||||
$sizer->Add($sidetext, 0, wxLEFT | wxALIGN_CENTER_VERTICAL , 4);
|
$sizer->Add($sidetext, 0, wxLEFT | wxALIGN_CENTER_VERTICAL , 4);
|
||||||
$grid_sizer->Add($sizer);
|
$grid_sizer->Add($sizer);
|
||||||
|
@ -8,7 +8,7 @@ use Math::ConvexHull qw(convex_hull);
|
|||||||
use Slic3r::Geometry qw(X Y Z X1 Y1 X2 Y2 scale unscale);
|
use Slic3r::Geometry qw(X Y Z X1 Y1 X2 Y2 scale unscale);
|
||||||
use Slic3r::Geometry::Clipper qw(JT_ROUND);
|
use Slic3r::Geometry::Clipper qw(JT_ROUND);
|
||||||
use threads::shared qw(shared_clone);
|
use threads::shared qw(shared_clone);
|
||||||
use Wx qw(:bitmap :brush :button :dialog :filedialog :font :icon :id :listctrl :pen :sizer :toolbar :window);
|
use Wx qw(:bitmap :brush :button :dialog :filedialog :font :icon :id :listctrl :misc :pen :sizer :toolbar :window);
|
||||||
use Wx::Event qw(EVT_BUTTON EVT_COMMAND EVT_LIST_ITEM_DESELECTED EVT_LIST_ITEM_SELECTED EVT_MOUSE_EVENTS EVT_PAINT EVT_TOOL);
|
use Wx::Event qw(EVT_BUTTON EVT_COMMAND EVT_LIST_ITEM_DESELECTED EVT_LIST_ITEM_SELECTED EVT_MOUSE_EVENTS EVT_PAINT EVT_TOOL);
|
||||||
use base 'Wx::Panel';
|
use base 'Wx::Panel';
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ sub new {
|
|||||||
my ($parent) = @_;
|
my ($parent) = @_;
|
||||||
my $self = $class->SUPER::new($parent, -1);
|
my $self = $class->SUPER::new($parent, -1);
|
||||||
|
|
||||||
$self->{canvas} = Wx::Panel->new($self, -1, [-1, -1], [300, 300]);
|
$self->{canvas} = Wx::Panel->new($self, -1, wxDefaultPosition, [300, 300]);
|
||||||
$self->{canvas}->SetBackgroundColour(Wx::wxWHITE);
|
$self->{canvas}->SetBackgroundColour(Wx::wxWHITE);
|
||||||
EVT_PAINT($self->{canvas}, \&repaint);
|
EVT_PAINT($self->{canvas}, \&repaint);
|
||||||
EVT_MOUSE_EVENTS($self->{canvas}, \&mouse_event);
|
EVT_MOUSE_EVENTS($self->{canvas}, \&mouse_event);
|
||||||
@ -44,7 +44,7 @@ sub new {
|
|||||||
$self->{clearance_pen} = Wx::Pen->new(Wx::Colour->new(0,0,200), 1, wxSOLID);
|
$self->{clearance_pen} = Wx::Pen->new(Wx::Colour->new(0,0,200), 1, wxSOLID);
|
||||||
$self->{skirt_pen} = Wx::Pen->new(Wx::Colour->new(150,150,150), 1, wxSOLID);
|
$self->{skirt_pen} = Wx::Pen->new(Wx::Colour->new(150,150,150), 1, wxSOLID);
|
||||||
|
|
||||||
$self->{list} = Wx::ListView->new($self, -1, [-1, -1], [-1, 180], wxLC_SINGLE_SEL | wxLC_REPORT | wxBORDER_DEFAULT);
|
$self->{list} = Wx::ListView->new($self, -1, wxDefaultPosition, [-1, 180], wxLC_SINGLE_SEL | wxLC_REPORT | wxBORDER_DEFAULT);
|
||||||
$self->{list}->InsertColumn(0, "Name", wxLIST_FORMAT_LEFT, 300);
|
$self->{list}->InsertColumn(0, "Name", wxLIST_FORMAT_LEFT, 300);
|
||||||
$self->{list}->InsertColumn(1, "Copies", wxLIST_FORMAT_CENTER, 50);
|
$self->{list}->InsertColumn(1, "Copies", wxLIST_FORMAT_CENTER, 50);
|
||||||
$self->{list}->InsertColumn(2, "Scale", wxLIST_FORMAT_CENTER, wxLIST_AUTOSIZE_USEHEADER);
|
$self->{list}->InsertColumn(2, "Scale", wxLIST_FORMAT_CENTER, wxLIST_AUTOSIZE_USEHEADER);
|
||||||
@ -54,7 +54,7 @@ sub new {
|
|||||||
# toolbar for object manipulation
|
# toolbar for object manipulation
|
||||||
if (!&Wx::wxMSW) {
|
if (!&Wx::wxMSW) {
|
||||||
Wx::ToolTip::Enable(1);
|
Wx::ToolTip::Enable(1);
|
||||||
$self->{htoolbar} = Wx::ToolBar->new($self, -1, [-1, -1], [-1, -1], wxTB_HORIZONTAL | wxTB_HORZ_TEXT);
|
$self->{htoolbar} = Wx::ToolBar->new($self, -1, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL | wxTB_HORZ_TEXT);
|
||||||
$self->{htoolbar}->AddTool(TB_MORE, "More", Wx::Bitmap->new("$Slic3r::var/add.png", wxBITMAP_TYPE_PNG), '');
|
$self->{htoolbar}->AddTool(TB_MORE, "More", Wx::Bitmap->new("$Slic3r::var/add.png", wxBITMAP_TYPE_PNG), '');
|
||||||
$self->{htoolbar}->AddTool(TB_LESS, "Less", Wx::Bitmap->new("$Slic3r::var/delete.png", wxBITMAP_TYPE_PNG), '');
|
$self->{htoolbar}->AddTool(TB_LESS, "Less", Wx::Bitmap->new("$Slic3r::var/delete.png", wxBITMAP_TYPE_PNG), '');
|
||||||
$self->{htoolbar}->AddSeparator;
|
$self->{htoolbar}->AddSeparator;
|
||||||
@ -70,19 +70,19 @@ sub new {
|
|||||||
rotate => "Rotate…", changescale => "Scale…", split => "Split");
|
rotate => "Rotate…", changescale => "Scale…", split => "Split");
|
||||||
$self->{btoolbar} = Wx::BoxSizer->new(wxHORIZONTAL);
|
$self->{btoolbar} = Wx::BoxSizer->new(wxHORIZONTAL);
|
||||||
for (qw(increase decrease rotate45ccw rotate45cw rotate changescale split)) {
|
for (qw(increase decrease rotate45ccw rotate45cw rotate changescale split)) {
|
||||||
$self->{"btn_$_"} = Wx::Button->new($self, -1, $tbar_buttons{$_}, [-1,-1], [-1,-1], wxBU_EXACTFIT);
|
$self->{"btn_$_"} = Wx::Button->new($self, -1, $tbar_buttons{$_}, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
|
||||||
$self->{btoolbar}->Add($self->{"btn_$_"});
|
$self->{btoolbar}->Add($self->{"btn_$_"});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# general buttons
|
# general buttons
|
||||||
$self->{btn_load} = Wx::Button->new($self, -1, "Add…", [-1,-1], [-1,-1], wxBU_LEFT);
|
$self->{btn_load} = Wx::Button->new($self, -1, "Add…", wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
|
||||||
$self->{btn_remove} = Wx::Button->new($self, -1, "Delete", [-1,-1], [-1,-1], wxBU_LEFT);
|
$self->{btn_remove} = Wx::Button->new($self, -1, "Delete", wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
|
||||||
$self->{btn_reset} = Wx::Button->new($self, -1, "Delete All", [-1,-1], [-1,-1], wxBU_LEFT);
|
$self->{btn_reset} = Wx::Button->new($self, -1, "Delete All", wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
|
||||||
$self->{btn_arrange} = Wx::Button->new($self, -1, "Autoarrange", [-1,-1], [-1,-1], wxBU_LEFT);
|
$self->{btn_arrange} = Wx::Button->new($self, -1, "Autoarrange", wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
|
||||||
$self->{btn_export_gcode} = Wx::Button->new($self, -1, "Export G-code…", [-1,-1], [-1,-1], wxBU_LEFT);
|
$self->{btn_export_gcode} = Wx::Button->new($self, -1, "Export G-code…", wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
|
||||||
$self->{btn_export_gcode}->SetDefault;
|
$self->{btn_export_gcode}->SetDefault;
|
||||||
$self->{btn_export_stl} = Wx::Button->new($self, -1, "Export STL…", [-1,-1], [-1,-1], wxBU_LEFT);
|
$self->{btn_export_stl} = Wx::Button->new($self, -1, "Export STL…", wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
|
||||||
|
|
||||||
if (&Wx::wxVERSION_STRING =~ / 2\.9\.[1-9]/) {
|
if (&Wx::wxVERSION_STRING =~ / 2\.9\.[1-9]/) {
|
||||||
my %icons = qw(
|
my %icons = qw(
|
||||||
@ -203,8 +203,8 @@ sub new {
|
|||||||
);
|
);
|
||||||
$self->{preset_choosers} = {};
|
$self->{preset_choosers} = {};
|
||||||
for my $group (qw(print filament printer)) {
|
for my $group (qw(print filament printer)) {
|
||||||
my $text = Wx::StaticText->new($self, -1, "$group_labels{$group}:", [-1, -1], [-1, -1], wxALIGN_RIGHT);
|
my $text = Wx::StaticText->new($self, -1, "$group_labels{$group}:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
|
||||||
$self->{preset_choosers}{$group} = Wx::Choice->new($self, -1, [-1, -1], [150, -1], []);
|
$self->{preset_choosers}{$group} = Wx::Choice->new($self, -1, wxDefaultPosition, [150, -1], []);
|
||||||
$presets->Add($text, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxRIGHT, 4);
|
$presets->Add($text, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxRIGHT, 4);
|
||||||
$presets->Add($self->{preset_choosers}{$group}, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 15);
|
$presets->Add($self->{preset_choosers}{$group}, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 15);
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,14 @@ use utf8;
|
|||||||
|
|
||||||
use File::Basename qw(basename);
|
use File::Basename qw(basename);
|
||||||
use List::Util qw(first);
|
use List::Util qw(first);
|
||||||
use Wx qw(:bookctrl :dialog :icon :id :sizer :treectrl);
|
use Wx qw(:bookctrl :dialog :icon :id :misc :sizer :treectrl);
|
||||||
use Wx::Event qw(EVT_BUTTON EVT_CHOICE EVT_TREE_SEL_CHANGED);
|
use Wx::Event qw(EVT_BUTTON EVT_CHOICE EVT_TREE_SEL_CHANGED);
|
||||||
use base 'Wx::Panel';
|
use base 'Wx::Panel';
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my ($parent, $title, %params) = @_;
|
my ($parent, $title, %params) = @_;
|
||||||
my $self = $class->SUPER::new($parent, -1, [-1,-1], [-1,-1], wxBK_LEFT);
|
my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxBK_LEFT);
|
||||||
|
|
||||||
$self->{title} = $title;
|
$self->{title} = $title;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ sub new {
|
|||||||
{
|
{
|
||||||
|
|
||||||
# choice menu
|
# choice menu
|
||||||
$self->{presets_choice} = Wx::Choice->new($self, -1, [-1, -1], [-1, -1], []);
|
$self->{presets_choice} = Wx::Choice->new($self, -1, wxDefaultPosition, wxDefaultSize, []);
|
||||||
$self->{presets_choice}->SetFont($Slic3r::GUI::small_font);
|
$self->{presets_choice}->SetFont($Slic3r::GUI::small_font);
|
||||||
|
|
||||||
# buttons
|
# buttons
|
||||||
@ -48,7 +48,7 @@ sub new {
|
|||||||
$self->{btn_delete_preset}->Disable;
|
$self->{btn_delete_preset}->Disable;
|
||||||
|
|
||||||
### These cause GTK warnings:
|
### These cause GTK warnings:
|
||||||
###my $box = Wx::StaticBox->new($self, -1, "Presets:", [-1, -1], [$left_col_width, 50]);
|
###my $box = Wx::StaticBox->new($self, -1, "Presets:", wxDefaultPosition, [$left_col_width, 50]);
|
||||||
###my $hsizer = Wx::StaticBoxSizer->new($box, wxHORIZONTAL);
|
###my $hsizer = Wx::StaticBoxSizer->new($box, wxHORIZONTAL);
|
||||||
|
|
||||||
my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL);
|
my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL);
|
||||||
@ -60,7 +60,7 @@ sub new {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# tree
|
# tree
|
||||||
$self->{treectrl} = Wx::TreeCtrl->new($self, -1, [-1, -1], [$left_col_width, -1], wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES);
|
$self->{treectrl} = Wx::TreeCtrl->new($self, -1, wxDefaultPosition, [$left_col_width, -1], wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES);
|
||||||
$left_sizer->Add($self->{treectrl}, 1, wxEXPAND);
|
$left_sizer->Add($self->{treectrl}, 1, wxEXPAND);
|
||||||
$self->{icons} = Wx::ImageList->new(16, 16, 1);
|
$self->{icons} = Wx::ImageList->new(16, 16, 1);
|
||||||
$self->{treectrl}->AssignImageList($self->{icons});
|
$self->{treectrl}->AssignImageList($self->{icons});
|
||||||
@ -485,17 +485,17 @@ sub append_optgroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
package Slic3r::GUI::SavePresetWindow;
|
package Slic3r::GUI::SavePresetWindow;
|
||||||
use Wx qw(:combobox :dialog :id :sizer);
|
use Wx qw(:combobox :dialog :id :misc :sizer);
|
||||||
use Wx::Event qw(EVT_BUTTON EVT_TEXT_ENTER);
|
use Wx::Event qw(EVT_BUTTON EVT_TEXT_ENTER);
|
||||||
use base 'Wx::Dialog';
|
use base 'Wx::Dialog';
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my ($parent, %params) = @_;
|
my ($parent, %params) = @_;
|
||||||
my $self = $class->SUPER::new($parent, -1, "Save preset", [-1, -1], [-1, -1]);
|
my $self = $class->SUPER::new($parent, -1, "Save preset", wxDefaultPosition, wxDefaultSize);
|
||||||
|
|
||||||
my $text = Wx::StaticText->new($self, -1, "Save " . lc($params{title}) . " as:", [-1, -1], [-1, -1]);
|
my $text = Wx::StaticText->new($self, -1, "Save " . lc($params{title}) . " as:", wxDefaultPosition, wxDefaultSize);
|
||||||
$self->{combo} = Wx::ComboBox->new($self, -1, $params{default}, [-1, -1], [-1, -1], $params{values},
|
$self->{combo} = Wx::ComboBox->new($self, -1, $params{default}, wxDefaultPosition, wxDefaultSize, $params{values},
|
||||||
wxTE_PROCESS_ENTER);
|
wxTE_PROCESS_ENTER);
|
||||||
my $buttons = $self->CreateStdDialogButtonSizer(wxOK | wxCANCEL);
|
my $buttons = $self->CreateStdDialogButtonSizer(wxOK | wxCANCEL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user