After merging bug fixes

This commit is contained in:
YuSanka 2018-07-26 12:10:45 +02:00
parent e0bb6bafd5
commit ca1a11742b
5 changed files with 36 additions and 63 deletions

View file

@ -135,7 +135,9 @@ sub new {
} }
$_->set_scaling_factor($scale) for @{ $model_object->instances }; $_->set_scaling_factor($scale) for @{ $model_object->instances };
$self->{list}->SetItem($obj_idx, 2, ($model_object->instances->[0]->scaling_factor * 100) . "%"); # Set object scale on c++ side
Slic3r::GUI::set_object_scale($obj_idx, $model_object->instances->[0]->scaling_factor * 100);
$object->transform_thumbnail($self->{model}, $obj_idx); $object->transform_thumbnail($self->{model}, $obj_idx);
#update print and start background processing #update print and start background processing
@ -539,35 +541,9 @@ sub new {
} }
} }
my $print_info_sizer; my $print_info_sizer = $self->{print_info_sizer} = Wx::StaticBoxSizer->new(
{ Wx::StaticBox->new($self->{right_panel}, -1, L("Sliced Info")), wxVERTICAL);
my $box = Wx::StaticBox->new($self->{right_panel}, -1, L("Sliced Info")); $print_info_sizer->SetMinSize([300,-1]);
$box->SetFont($Slic3r::GUI::small_bold_font);
$print_info_sizer = Wx::StaticBoxSizer->new($box, wxVERTICAL);
$print_info_sizer->SetMinSize([316,-1]);
my $grid_sizer = Wx::FlexGridSizer->new(2, 2, 5, 5);
$grid_sizer->SetFlexibleDirection(wxHORIZONTAL);
$grid_sizer->AddGrowableCol(1, 1);
$grid_sizer->AddGrowableCol(3, 1);
$print_info_sizer->Add($grid_sizer, 0, wxEXPAND);
my @info = (
fil_m => L("Used Filament (m)"),
fil_mm3 => L("Used Filament (mm³)"),
fil_g => L("Used Filament (g)"),
cost => L("Cost"),
time => L("Estimated printing time"),
);
while (my $field = shift @info) {
my $label = shift @info;
my $text = Wx::StaticText->new($self->{right_panel}, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
$text->SetFont($Slic3r::GUI::small_font);
$grid_sizer->Add($text, 0);
$self->{"print_info_$field"} = Wx::StaticText->new($self->{right_panel}, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
$self->{"print_info_$field"}->SetFont($Slic3r::GUI::small_font);
$grid_sizer->Add($self->{"print_info_$field"}, 0);
}
}
my $buttons_sizer = Wx::BoxSizer->new(wxHORIZONTAL); my $buttons_sizer = Wx::BoxSizer->new(wxHORIZONTAL);
$self->{buttons_sizer} = $buttons_sizer; $self->{buttons_sizer} = $buttons_sizer;
@ -579,7 +555,7 @@ sub new {
#$buttons_sizer->Add($self->{btn_export_gcode}, 0, wxALIGN_RIGHT, 0); #$buttons_sizer->Add($self->{btn_export_gcode}, 0, wxALIGN_RIGHT, 0);
### Sizer for info boxes ### Sizer for info boxes
my $info_sizer = Wx::BoxSizer->new(wxVERTICAL); my $info_sizer = $self->{info_sizer} = Wx::BoxSizer->new(wxVERTICAL);
$info_sizer->SetMinSize([318, -1]); $info_sizer->SetMinSize([318, -1]);
$info_sizer->Add($object_info_sizer, 0, wxEXPAND | wxBOTTOM, 5); $info_sizer->Add($object_info_sizer, 0, wxEXPAND | wxBOTTOM, 5);
$info_sizer->Add($print_info_sizer, 0, wxEXPAND | wxBOTTOM, 5); $info_sizer->Add($print_info_sizer, 0, wxEXPAND | wxBOTTOM, 5);
@ -593,18 +569,6 @@ sub new {
$right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM | wxTOP, 10); $right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM | wxTOP, 10);
$right_sizer->Add($info_sizer, 0, wxEXPAND | wxLEFT, 20); $right_sizer->Add($info_sizer, 0, wxEXPAND | wxLEFT, 20);
$right_sizer->Add($self->{btn_export_gcode}, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 20); $right_sizer->Add($self->{btn_export_gcode}, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 20);
# Callback for showing / hiding the print info box.
$self->{"print_info_box_show"} = sub {
if ($info_sizer->IsShown(1) != $_[0]) {
Slic3r::GUI::set_show_print_info($_[0]);
return if (wxTheApp->{app_config}->get("view_mode") eq "simple");
$info_sizer->Show(1, $_[0]);
$self->Layout;
$self->{right_panel}->Refresh;
}
};
# Show the box initially, let it be shown after the slicing is finished.
#$self->{"print_info_box_show"}->(0);
my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL); my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL);
$hsizer->Add($self->{preview_notebook}, 1, wxEXPAND | wxTOP, 1); $hsizer->Add($self->{preview_notebook}, 1, wxEXPAND | wxTOP, 1);
@ -963,9 +927,6 @@ sub remove {
$self->select_object(undef); $self->select_object(undef);
$self->update; $self->update;
$self->schedule_background_process; $self->schedule_background_process;
# Hide the slicing results if the current slicing status is no more valid.
$self->{"print_info_box_show"}->(0);
} }
sub reset { sub reset {
@ -986,9 +947,6 @@ sub reset {
$self->select_object(undef); $self->select_object(undef);
$self->update; $self->update;
# Hide the slicing results if the current slicing status is no more valid.
$self->{"print_info_box_show"}->(0);
} }
sub increase { sub increase {
@ -1664,9 +1622,15 @@ sub on_export_completed {
# Fill in the "Sliced info" box with the result of the G-code generator. # Fill in the "Sliced info" box with the result of the G-code generator.
sub print_info_box_show { sub print_info_box_show {
my ($self, $show) = @_; my ($self, $show) = @_;
my $scrolled_window_panel = $self->{scrolled_window_panel}; # my $scrolled_window_panel = $self->{scrolled_window_panel};
my $scrolled_window_sizer = $self->{scrolled_window_sizer}; # my $scrolled_window_sizer = $self->{scrolled_window_sizer};
return if $scrolled_window_sizer->IsShown(2) == $show; # return if $scrolled_window_sizer->IsShown(2) == $show;
my $panel = $self->{right_panel};
my $sizer = $self->{info_sizer};
return if $sizer->IsShown(1) == $show;
Slic3r::GUI::set_show_print_info($show);
return if (wxTheApp->{app_config}->get("view_mode") eq "simple");
if ($show) { if ($show) {
my $print_info_sizer = $self->{print_info_sizer}; my $print_info_sizer = $self->{print_info_sizer};
@ -1693,17 +1657,23 @@ sub print_info_box_show {
while ( my $label = shift @info) { while ( my $label = shift @info) {
my $value = shift @info; my $value = shift @info;
next if $value eq "N/A"; next if $value eq "N/A";
my $text = Wx::StaticText->new($scrolled_window_panel, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); # my $text = Wx::StaticText->new($scrolled_window_panel, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
my $text = Wx::StaticText->new($panel, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
$text->SetFont($Slic3r::GUI::small_font); $text->SetFont($Slic3r::GUI::small_font);
$grid_sizer->Add($text, 0); $grid_sizer->Add($text, 0);
my $field = Wx::StaticText->new($scrolled_window_panel, -1, $value, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); # my $field = Wx::StaticText->new($scrolled_window_panel, -1, $value, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
my $field = Wx::StaticText->new($panel, -1, $value, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
$field->SetFont($Slic3r::GUI::small_font); $field->SetFont($Slic3r::GUI::small_font);
$grid_sizer->Add($field, 0); $grid_sizer->Add($field, 0);
} }
} }
$scrolled_window_sizer->Show(2, $show); # $scrolled_window_sizer->Show(2, $show);
$scrolled_window_panel->Layout; # $scrolled_window_panel->Layout;
$sizer->Show(1, $show);
$self->Layout;
$panel->Refresh;
} }
sub do_print { sub do_print {

View file

@ -3025,6 +3025,12 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
m_mouse.set_start_position_2D_as_invalid(); m_mouse.set_start_position_2D_as_invalid();
#endif #endif
} }
else if (evt.Leaving())
{
// to remove hover when mouse goes out of this canvas
m_mouse.position = Pointf((coordf_t)pos.x, (coordf_t)pos.y);
render();
}
else if (evt.LeftDClick() && (m_hover_volume_id != -1)) else if (evt.LeftDClick() && (m_hover_volume_id != -1))
m_on_double_click_callback.call(); m_on_double_click_callback.call();
else if (evt.LeftDown() || evt.RightDown()) else if (evt.LeftDown() || evt.RightDown())

View file

@ -148,9 +148,6 @@ wxStaticBitmap *g_manifold_warning_icon = nullptr;
bool g_show_print_info = false; bool g_show_print_info = false;
bool g_show_manifold_warning_icon = false; bool g_show_manifold_warning_icon = false;
wxFont g_small_font;
wxFont g_bold_font;
static void init_label_colours() static void init_label_colours()
{ {
auto luma = get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); auto luma = get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));

View file

@ -96,7 +96,7 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
void OptionsGroup::add_undo_buttuns_to_sizer(wxSizer* sizer, const t_field& field) void OptionsGroup::add_undo_buttuns_to_sizer(wxSizer* sizer, const t_field& field)
{ {
if (!m_is_tab_opt) { if (!m_show_modified_btns) {
field->m_Undo_btn->Hide(); field->m_Undo_btn->Hide();
field->m_Undo_to_sys_btn->Hide(); field->m_Undo_to_sys_btn->Hide();
return; return;

View file

@ -153,7 +153,7 @@ public:
OptionsGroup( wxWindow* _parent, const wxString& title, bool is_tab_opt = false, OptionsGroup( wxWindow* _parent, const wxString& title, bool is_tab_opt = false,
ogDrawFlag flag = ogDEFAULT, column_t extra_clmn = nullptr) : ogDrawFlag flag = ogDEFAULT, column_t extra_clmn = nullptr) :
m_parent(_parent), title(title), m_is_tab_opt(is_tab_opt), m_parent(_parent), title(title), m_show_modified_btns(is_tab_opt),
staticbox(title!=""), m_flag(flag), extra_column(extra_clmn){ staticbox(title!=""), m_flag(flag), extra_column(extra_clmn){
stb = new wxStaticBox(_parent, wxID_ANY, title); stb = new wxStaticBox(_parent, wxID_ANY, title);
stb->SetFont(bold_font()); stb->SetFont(bold_font());