mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Updated Collapsed/Layout for PrusaCollapsiblePane.
Cleaned right_panel
This commit is contained in:
parent
d7d0edf4dc
commit
c7d7da452e
4 changed files with 86 additions and 82 deletions
|
@ -230,15 +230,7 @@ sub new {
|
||||||
$self->{right_panel} = Wx::ScrolledWindow->new($self, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
$self->{right_panel} = Wx::ScrolledWindow->new($self, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||||
$self->{right_panel}->SetScrollbars(0, 1, 1, 1);
|
$self->{right_panel}->SetScrollbars(0, 1, 1, 1);
|
||||||
|
|
||||||
### Scrolled Window for info boxes
|
$self->{list} = Wx::ListView->new($self->{right_panel}, -1, wxDefaultPosition, wxDefaultSize,
|
||||||
my $scrolled_window_sizer = Wx::BoxSizer->new(wxVERTICAL);
|
|
||||||
$scrolled_window_sizer->SetMinSize([310, -1]);
|
|
||||||
# my $scrolled_window_panel = Wx::ScrolledWindow->new($self->{right_panel}, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
|
||||||
my $scrolled_window_panel = Wx::Panel->new($self->{right_panel}, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
|
||||||
$scrolled_window_panel->SetSizer($scrolled_window_sizer);
|
|
||||||
# $scrolled_window_panel->SetScrollbars(1, 1, 1, 1);
|
|
||||||
|
|
||||||
$self->{list} = Wx::ListView->new($scrolled_window_panel, -1, wxDefaultPosition, wxDefaultSize,
|
|
||||||
wxLC_SINGLE_SEL | wxLC_REPORT | wxBORDER_SUNKEN | wxTAB_TRAVERSAL | wxWANTS_CHARS );
|
wxLC_SINGLE_SEL | wxLC_REPORT | wxBORDER_SUNKEN | wxTAB_TRAVERSAL | wxWANTS_CHARS );
|
||||||
$self->{list}->InsertColumn(0, L("Name"), wxLIST_FORMAT_LEFT, 145);
|
$self->{list}->InsertColumn(0, L("Name"), wxLIST_FORMAT_LEFT, 145);
|
||||||
$self->{list}->InsertColumn(1, L("Copies"), wxLIST_FORMAT_CENTER, 45);
|
$self->{list}->InsertColumn(1, L("Copies"), wxLIST_FORMAT_CENTER, 45);
|
||||||
|
@ -424,7 +416,7 @@ sub new {
|
||||||
|
|
||||||
my $object_info_sizer;
|
my $object_info_sizer;
|
||||||
{
|
{
|
||||||
my $box = Wx::StaticBox->new($scrolled_window_panel, -1, L("Info"));
|
my $box = Wx::StaticBox->new($self->{right_panel}, -1, L("Info"));
|
||||||
$box->SetFont($Slic3r::GUI::small_bold_font);
|
$box->SetFont($Slic3r::GUI::small_bold_font);
|
||||||
$object_info_sizer = Wx::StaticBoxSizer->new($box, wxVERTICAL);
|
$object_info_sizer = Wx::StaticBoxSizer->new($box, wxVERTICAL);
|
||||||
$object_info_sizer->SetMinSize([300,-1]);
|
$object_info_sizer->SetMinSize([300,-1]);
|
||||||
|
@ -443,14 +435,14 @@ sub new {
|
||||||
);
|
);
|
||||||
while (my $field = shift @info) {
|
while (my $field = shift @info) {
|
||||||
my $label = shift @info;
|
my $label = shift @info;
|
||||||
my $text = Wx::StaticText->new($scrolled_window_panel, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
my $text = Wx::StaticText->new($self->{right_panel}, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
||||||
$text->SetFont($Slic3r::GUI::small_font);
|
$text->SetFont($Slic3r::GUI::small_font);
|
||||||
$grid_sizer->Add($text, 0);
|
$grid_sizer->Add($text, 0);
|
||||||
|
|
||||||
$self->{"object_info_$field"} = Wx::StaticText->new($scrolled_window_panel, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
$self->{"object_info_$field"} = Wx::StaticText->new($self->{right_panel}, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
||||||
$self->{"object_info_$field"}->SetFont($Slic3r::GUI::small_font);
|
$self->{"object_info_$field"}->SetFont($Slic3r::GUI::small_font);
|
||||||
if ($field eq 'manifold') {
|
if ($field eq 'manifold') {
|
||||||
$self->{object_info_manifold_warning_icon} = Wx::StaticBitmap->new($scrolled_window_panel, -1, Wx::Bitmap->new(Slic3r::var("error.png"), wxBITMAP_TYPE_PNG));
|
$self->{object_info_manifold_warning_icon} = Wx::StaticBitmap->new($self->{right_panel}, -1, Wx::Bitmap->new(Slic3r::var("error.png"), wxBITMAP_TYPE_PNG));
|
||||||
#$self->{object_info_manifold_warning_icon}->Hide;
|
#$self->{object_info_manifold_warning_icon}->Hide;
|
||||||
$self->{"object_info_manifold_warning_icon_show"} = sub {
|
$self->{"object_info_manifold_warning_icon_show"} = sub {
|
||||||
if ($self->{object_info_manifold_warning_icon}->IsShown() != $_[0]) {
|
if ($self->{object_info_manifold_warning_icon}->IsShown() != $_[0]) {
|
||||||
|
@ -475,7 +467,7 @@ sub new {
|
||||||
|
|
||||||
my $print_info_sizer;
|
my $print_info_sizer;
|
||||||
{
|
{
|
||||||
my $box = Wx::StaticBox->new($scrolled_window_panel, -1, L("Sliced Info"));
|
my $box = Wx::StaticBox->new($self->{right_panel}, -1, L("Sliced Info"));
|
||||||
$box->SetFont($Slic3r::GUI::small_bold_font);
|
$box->SetFont($Slic3r::GUI::small_bold_font);
|
||||||
$print_info_sizer = Wx::StaticBoxSizer->new($box, wxVERTICAL);
|
$print_info_sizer = Wx::StaticBoxSizer->new($box, wxVERTICAL);
|
||||||
$print_info_sizer->SetMinSize([300,-1]);
|
$print_info_sizer->SetMinSize([300,-1]);
|
||||||
|
@ -493,11 +485,11 @@ sub new {
|
||||||
);
|
);
|
||||||
while (my $field = shift @info) {
|
while (my $field = shift @info) {
|
||||||
my $label = shift @info;
|
my $label = shift @info;
|
||||||
my $text = Wx::StaticText->new($scrolled_window_panel, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
|
my $text = Wx::StaticText->new($self->{right_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);
|
||||||
|
|
||||||
$self->{"print_info_$field"} = Wx::StaticText->new($scrolled_window_panel, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
$self->{"print_info_$field"} = Wx::StaticText->new($self->{right_panel}, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
||||||
$self->{"print_info_$field"}->SetFont($Slic3r::GUI::small_font);
|
$self->{"print_info_$field"}->SetFont($Slic3r::GUI::small_font);
|
||||||
$grid_sizer->Add($self->{"print_info_$field"}, 0);
|
$grid_sizer->Add($self->{"print_info_$field"}, 0);
|
||||||
}
|
}
|
||||||
|
@ -512,17 +504,21 @@ sub new {
|
||||||
$buttons_sizer->Add($self->{btn_send_gcode}, 0, wxALIGN_RIGHT, 0);
|
$buttons_sizer->Add($self->{btn_send_gcode}, 0, wxALIGN_RIGHT, 0);
|
||||||
#$buttons_sizer->Add($self->{btn_export_gcode}, 0, wxALIGN_RIGHT, 0);
|
#$buttons_sizer->Add($self->{btn_export_gcode}, 0, wxALIGN_RIGHT, 0);
|
||||||
|
|
||||||
$scrolled_window_sizer->Add($self->{list}, 1, wxEXPAND, 5);
|
### Sizer for info boxes
|
||||||
$scrolled_window_sizer->Add($object_info_sizer, 0, wxEXPAND | wxLEFT, 20);
|
my $info_sizer = Wx::BoxSizer->new(wxVERTICAL);
|
||||||
$scrolled_window_sizer->Add($print_info_sizer, 0, wxEXPAND | wxLEFT, 20);
|
$info_sizer->SetMinSize([310, -1]);
|
||||||
|
$info_sizer->Add($self->{list}, 1, wxEXPAND, 5);
|
||||||
|
$info_sizer->Add($object_info_sizer, 0, wxEXPAND | wxBOTTOM, 5);
|
||||||
|
$info_sizer->Add($print_info_sizer, 0, wxEXPAND | wxBOTTOM, 5);
|
||||||
|
|
||||||
my $right_sizer = Wx::BoxSizer->new(wxVERTICAL);
|
my $right_sizer = Wx::BoxSizer->new(wxVERTICAL);
|
||||||
|
$self->{right_panel}->SetSizer($right_sizer);
|
||||||
$right_sizer->SetMinSize([320, -1]);
|
$right_sizer->SetMinSize([320, -1]);
|
||||||
$right_sizer->Add($presets, 0, wxEXPAND | wxTOP, 10) if defined $presets;
|
$right_sizer->Add($presets, 0, wxEXPAND | wxTOP, 10) if defined $presets;
|
||||||
$right_sizer->Add($frequently_changed_parameters_sizer, 1, wxEXPAND | wxTOP, 0) if defined $frequently_changed_parameters_sizer;
|
$right_sizer->Add($frequently_changed_parameters_sizer, 1, wxEXPAND | wxTOP, 0) if defined $frequently_changed_parameters_sizer;
|
||||||
$right_sizer->Add($expert_mode_part_sizer, 0, wxEXPAND | wxTOP, 0) if defined $expert_mode_part_sizer;
|
$right_sizer->Add($expert_mode_part_sizer, 0, wxEXPAND | wxTOP, 0) if defined $expert_mode_part_sizer;
|
||||||
$right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM, 5);
|
$right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM, 5);
|
||||||
$right_sizer->Add($scrolled_window_panel, 0, wxEXPAND | wxALL, 1);
|
$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.
|
# Callback for showing / hiding the print info box.
|
||||||
$self->{"print_info_box_show"} = sub {
|
$self->{"print_info_box_show"} = sub {
|
||||||
|
@ -530,18 +526,16 @@ sub new {
|
||||||
# $right_sizer->Show(5, $_[0]);
|
# $right_sizer->Show(5, $_[0]);
|
||||||
# $self->Layout
|
# $self->Layout
|
||||||
# }
|
# }
|
||||||
if ($scrolled_window_sizer->IsShown(2) != $_[0]) {
|
if ($info_sizer->IsShown(2) != $_[0]) {
|
||||||
Slic3r::GUI::set_show_print_info($_[0]);
|
Slic3r::GUI::set_show_print_info($_[0]);
|
||||||
return if (wxTheApp->{app_config}->get("view_mode") eq "simple");
|
return if (wxTheApp->{app_config}->get("view_mode") eq "simple");
|
||||||
$scrolled_window_sizer->Show(2, $_[0]);
|
$info_sizer->Show(2, $_[0]);
|
||||||
$scrolled_window_panel->Layout
|
$self->{right_panel}->Layout
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
# Show the box initially, let it be shown after the slicing is finished.
|
# Show the box initially, let it be shown after the slicing is finished.
|
||||||
$self->{"print_info_box_show"}->(0);
|
$self->{"print_info_box_show"}->(0);
|
||||||
|
|
||||||
$self->{right_panel}->SetSizer($right_sizer);
|
|
||||||
|
|
||||||
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);
|
||||||
$hsizer->Add($self->{right_panel}, 0, wxEXPAND | wxLEFT | wxRIGHT, 3);
|
$hsizer->Add($self->{right_panel}, 0, wxEXPAND | wxLEFT | wxRIGHT, 3);
|
||||||
|
@ -558,7 +552,7 @@ sub new {
|
||||||
Slic3r::GUI::set_objects_from_perl( $self->{right_panel},
|
Slic3r::GUI::set_objects_from_perl( $self->{right_panel},
|
||||||
$frequently_changed_parameters_sizer,
|
$frequently_changed_parameters_sizer,
|
||||||
$expert_mode_part_sizer,
|
$expert_mode_part_sizer,
|
||||||
$scrolled_window_sizer,
|
$info_sizer,
|
||||||
$self->{btn_export_gcode},
|
$self->{btn_export_gcode},
|
||||||
$self->{btn_export_stl},
|
$self->{btn_export_stl},
|
||||||
$self->{btn_reslice},
|
$self->{btn_reslice},
|
||||||
|
|
|
@ -142,10 +142,11 @@ wxDataViewCtrl *m_objects_ctrl = nullptr;
|
||||||
PrusaCollapsiblePane *m_collpane_settings = nullptr;
|
PrusaCollapsiblePane *m_collpane_settings = nullptr;
|
||||||
|
|
||||||
wxFont g_small_font{ wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
|
wxFont g_small_font{ wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
|
||||||
#ifdef __WXMAC__
|
|
||||||
g_small_font->SetPointSize(11);
|
|
||||||
#endif /*__WXMAC__*/
|
|
||||||
wxFont g_bold_font{ wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold() };
|
wxFont g_bold_font{ wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold() };
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
g_small_font.SetPointSize(11);
|
||||||
|
g_bold_font.SetPointSize(11);
|
||||||
|
#endif /*__WXMAC__*/
|
||||||
|
|
||||||
static void init_label_colours()
|
static void init_label_colours()
|
||||||
{
|
{
|
||||||
|
@ -833,7 +834,6 @@ wxString from_u8(const std::string &str)
|
||||||
PrusaCollapsiblePane* add_prusa_collapsible_pane(wxWindow* parent, wxBoxSizer* sizer_parent, const wxString& name, std::function<wxSizer *(wxWindow *)> content_function)
|
PrusaCollapsiblePane* add_prusa_collapsible_pane(wxWindow* parent, wxBoxSizer* sizer_parent, const wxString& name, std::function<wxSizer *(wxWindow *)> content_function)
|
||||||
{
|
{
|
||||||
auto *collpane = new PrusaCollapsiblePane(parent, wxID_ANY, name);
|
auto *collpane = new PrusaCollapsiblePane(parent, wxID_ANY, name);
|
||||||
collpane->SetTopParent(g_right_panel);
|
|
||||||
// add the pane with a zero proportion value to the sizer which contains it
|
// add the pane with a zero proportion value to the sizer which contains it
|
||||||
sizer_parent->Add(collpane, 0, wxGROW | wxALL, 0);
|
sizer_parent->Add(collpane, 0, wxGROW | wxALL, 0);
|
||||||
|
|
||||||
|
@ -844,14 +844,14 @@ PrusaCollapsiblePane* add_prusa_collapsible_pane(wxWindow* parent, wxBoxSizer* s
|
||||||
wxSizer *sizer_pane = new wxBoxSizer(wxVERTICAL);
|
wxSizer *sizer_pane = new wxBoxSizer(wxVERTICAL);
|
||||||
sizer_pane->Add(sizer, 1, wxGROW | wxEXPAND | wxBOTTOM, 2);
|
sizer_pane->Add(sizer, 1, wxGROW | wxEXPAND | wxBOTTOM, 2);
|
||||||
win->SetSizer(sizer_pane);
|
win->SetSizer(sizer_pane);
|
||||||
sizer_pane->SetSizeHints(win);
|
// sizer_pane->SetSizeHints(win);
|
||||||
return collpane;
|
return collpane;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBoxSizer* content_objects_list(wxWindow *win)
|
wxBoxSizer* content_objects_list(wxWindow *win)
|
||||||
{
|
{
|
||||||
m_objects_ctrl = new wxDataViewCtrl(win, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
m_objects_ctrl = new wxDataViewCtrl(win, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
m_objects_ctrl->SetBestFittingSize(wxSize(-1, 150)); // TODO - Set correct height according to the opened/closed objects
|
m_objects_ctrl->SetInitialSize(wxSize(-1, 150)); // TODO - Set correct height according to the opened/closed objects
|
||||||
auto objects_sz = new wxBoxSizer(wxVERTICAL);
|
auto objects_sz = new wxBoxSizer(wxVERTICAL);
|
||||||
objects_sz->Add(m_objects_ctrl, 1, wxGROW | wxLEFT/*ALL*/, 20/*5*/);
|
objects_sz->Add(m_objects_ctrl, 1, wxGROW | wxLEFT/*ALL*/, 20/*5*/);
|
||||||
|
|
||||||
|
@ -883,18 +883,17 @@ wxBoxSizer* content_objects_list(wxWindow *win)
|
||||||
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE);
|
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE);
|
||||||
m_objects_ctrl->AppendColumn(column02);
|
m_objects_ctrl->AppendColumn(column02);
|
||||||
|
|
||||||
m_objects_ctrl->Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, [objects_model](wxCommandEvent& evt)
|
m_objects_ctrl->Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, [objects_model](wxEvent& evt)
|
||||||
{
|
{
|
||||||
wxWindowUpdateLocker noUpdates(g_right_panel);
|
wxWindowUpdateLocker noUpdates(g_right_panel);
|
||||||
auto item = m_objects_ctrl->GetSelection();
|
auto item = m_objects_ctrl->GetSelection();
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
// m_objects_ctrl->SetSize(m_objects_ctrl->GetBestSize()); // TODO override GetBestSize(), than use it
|
||||||
auto show_obj_sizer = objects_model->GetParent(item) == wxDataViewItem(0);
|
auto show_obj_sizer = objects_model->GetParent(item) == wxDataViewItem(0);
|
||||||
m_sizer_object_buttons->Show(show_obj_sizer);
|
m_sizer_object_buttons->Show(show_obj_sizer);
|
||||||
m_sizer_part_buttons->Show(!show_obj_sizer);
|
m_sizer_part_buttons->Show(!show_obj_sizer);
|
||||||
m_collpane_settings->SetLabelText((show_obj_sizer ? _(L("Object Settings")) : _(L("Part Settings"))) + ":");
|
m_collpane_settings->SetLabelText((show_obj_sizer ? _(L("Object Settings")) : _(L("Part Settings"))) + ":");
|
||||||
m_collpane_settings->Show(true);
|
m_collpane_settings->show_it(true);
|
||||||
|
|
||||||
g_right_panel->Layout();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return objects_sz;
|
return objects_sz;
|
||||||
|
@ -921,15 +920,13 @@ wxBoxSizer* content_edit_object_buttons(wxWindow* win)
|
||||||
btn_move_up->SetBitmap(wxBitmap(from_u8(Slic3r::var("bullet_arrow_up.png")), wxBITMAP_TYPE_PNG));
|
btn_move_up->SetBitmap(wxBitmap(from_u8(Slic3r::var("bullet_arrow_up.png")), wxBITMAP_TYPE_PNG));
|
||||||
btn_move_down->SetBitmap(wxBitmap(from_u8(Slic3r::var("bullet_arrow_down.png")), wxBITMAP_TYPE_PNG));
|
btn_move_down->SetBitmap(wxBitmap(from_u8(Slic3r::var("bullet_arrow_down.png")), wxBITMAP_TYPE_PNG));
|
||||||
|
|
||||||
m_sizer_object_buttons = new /*wxFlex*/wxGridSizer(1, 3, 0, 0);
|
m_sizer_object_buttons = new wxGridSizer(1, 3, 0, 0);
|
||||||
// static_cast<wxFlexGridSizer*>(m_sizer_object_buttons)->SetFlexibleDirection(wxBOTH);
|
|
||||||
m_sizer_object_buttons->Add(btn_load_part, 0, wxEXPAND);
|
m_sizer_object_buttons->Add(btn_load_part, 0, wxEXPAND);
|
||||||
m_sizer_object_buttons->Add(btn_load_modifier, 0, wxEXPAND);
|
m_sizer_object_buttons->Add(btn_load_modifier, 0, wxEXPAND);
|
||||||
m_sizer_object_buttons->Add(btn_load_lambda_modifier, 0, wxEXPAND);
|
m_sizer_object_buttons->Add(btn_load_lambda_modifier, 0, wxEXPAND);
|
||||||
m_sizer_object_buttons->Show(false);
|
m_sizer_object_buttons->Show(false);
|
||||||
|
|
||||||
m_sizer_part_buttons = new /*wxFlex*/wxGridSizer(1, 3, 0, 0);
|
m_sizer_part_buttons = new wxGridSizer(1, 3, 0, 0);
|
||||||
// m_sizer_part_buttons->SetFlexibleDirection(wxBOTH);
|
|
||||||
m_sizer_part_buttons->Add(btn_delete, 0, wxEXPAND);
|
m_sizer_part_buttons->Add(btn_delete, 0, wxEXPAND);
|
||||||
m_sizer_part_buttons->Add(btn_split, 0, wxEXPAND);
|
m_sizer_part_buttons->Add(btn_split, 0, wxEXPAND);
|
||||||
{
|
{
|
||||||
|
@ -948,8 +945,8 @@ wxBoxSizer* content_edit_object_buttons(wxWindow* win)
|
||||||
btn_move_up->SetFont(Slic3r::GUI::small_font());
|
btn_move_up->SetFont(Slic3r::GUI::small_font());
|
||||||
btn_move_down->SetFont(Slic3r::GUI::small_font());
|
btn_move_down->SetFont(Slic3r::GUI::small_font());
|
||||||
|
|
||||||
sizer->Add(m_sizer_object_buttons, 0, wxEXPAND|wxLEFT, 20/*wxALIGN_CENTER_HORIZONTAL*/);
|
sizer->Add(m_sizer_object_buttons, 0, wxEXPAND|wxLEFT, 20);
|
||||||
sizer->Add(m_sizer_part_buttons, 0, wxEXPAND|wxLEFT, 20/*wxALIGN_CENTER_HORIZONTAL*/);
|
sizer->Add(m_sizer_part_buttons, 0, wxEXPAND|wxLEFT, 20);
|
||||||
return sizer;
|
return sizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1021,31 +1018,29 @@ wxBoxSizer* content_settings(wxWindow *win)
|
||||||
|
|
||||||
void add_expert_mode_part(wxWindow* parent, wxBoxSizer* sizer)
|
void add_expert_mode_part(wxWindow* parent, wxBoxSizer* sizer)
|
||||||
{
|
{
|
||||||
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
wxWindowUpdateLocker noUpdates(parent);
|
||||||
auto main_page = new wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
|
||||||
main_page->SetSizer(main_sizer);
|
|
||||||
sizer->Add(main_page, 1, wxEXPAND | wxALL, 1);
|
|
||||||
|
|
||||||
// Experiments with new UI
|
// Experiments with new UI
|
||||||
|
|
||||||
// *** Objects List ***
|
// *** Objects List ***
|
||||||
auto collpane = add_prusa_collapsible_pane(main_page, main_sizer, "Objects List:", content_objects_list);
|
auto collpane = add_prusa_collapsible_pane(parent, sizer, "Objects List:", content_objects_list);
|
||||||
collpane->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, ([collpane](wxCommandEvent e){
|
collpane->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, ([collpane](wxCommandEvent& e){
|
||||||
|
e.Skip();
|
||||||
wxWindowUpdateLocker noUpdates(g_right_panel);
|
wxWindowUpdateLocker noUpdates(g_right_panel);
|
||||||
if (collpane->IsCollapsed()) {
|
if (collpane->IsCollapsed()) {
|
||||||
m_sizer_object_buttons->Show(false);
|
m_sizer_object_buttons->Show(false);
|
||||||
m_sizer_part_buttons->Show(false);
|
m_sizer_part_buttons->Show(false);
|
||||||
m_collpane_settings->Show(false);
|
m_collpane_settings->show_it(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_objects_ctrl->UnselectAll();
|
m_objects_ctrl->UnselectAll();
|
||||||
|
|
||||||
g_right_panel->Layout();
|
g_right_panel->Layout();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// *** Object/Part Settings ***
|
// *** Object/Part Settings ***
|
||||||
m_collpane_settings = add_prusa_collapsible_pane(main_page, main_sizer, "Settings:", content_settings);
|
m_collpane_settings = add_prusa_collapsible_pane(parent, sizer, "Settings:", content_settings);
|
||||||
m_collpane_settings->Show(false);
|
m_collpane_settings->Hide(); // ? TODO why doesn't work?
|
||||||
|
|
||||||
|
|
||||||
// More experiments with UI
|
// More experiments with UI
|
||||||
// auto listctrl = new wxDataViewListCtrl(main_page, wxID_ANY, wxDefaultPosition, wxSize(-1, 100));
|
// auto listctrl = new wxDataViewListCtrl(main_page, wxID_ANY, wxDefaultPosition, wxSize(-1, 100));
|
||||||
|
|
|
@ -257,6 +257,36 @@ void PrusaCollapsiblePane::UpdateBtnBmp()
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrusaCollapsiblePane::OnStateChange_(const wxSize& sz)
|
||||||
|
{
|
||||||
|
SetSize(sz);
|
||||||
|
|
||||||
|
if (this->HasFlag(wxCP_NO_TLW_RESIZE))
|
||||||
|
{
|
||||||
|
// the user asked to explicitly handle the resizing itself...
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto top = GetParent(); //right_panel
|
||||||
|
if (!top)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxSizer *sizer = top->GetSizer();
|
||||||
|
if (!sizer)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const wxSize newBestSize = sizer->ComputeFittingClientSize(top);
|
||||||
|
top->SetMinClientSize(newBestSize);
|
||||||
|
|
||||||
|
wxWindowUpdateLocker noUpdates_p(top->GetParent());
|
||||||
|
// we shouldn't attempt to resize a maximized window, whatever happens
|
||||||
|
// if (!top->IsMaximized())
|
||||||
|
// top->SetClientSize(newBestSize);
|
||||||
|
top->GetParent()->Layout();
|
||||||
|
top->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrusaCollapsiblePane::Collapse(bool collapse)
|
void PrusaCollapsiblePane::Collapse(bool collapse)
|
||||||
{
|
{
|
||||||
// optimization
|
// optimization
|
||||||
|
@ -268,10 +298,20 @@ void PrusaCollapsiblePane::Collapse(bool collapse)
|
||||||
// update our state
|
// update our state
|
||||||
m_pPane->Show(!collapse);
|
m_pPane->Show(!collapse);
|
||||||
|
|
||||||
|
// update button label
|
||||||
|
#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__)
|
||||||
|
m_pButton->SetOpen(!collapse);
|
||||||
|
#else
|
||||||
|
#ifdef __WXMSW__
|
||||||
// update button bitmap
|
// update button bitmap
|
||||||
UpdateBtnBmp();
|
UpdateBtnBmp();
|
||||||
|
#else
|
||||||
|
// NB: this must be done after updating our "state"
|
||||||
|
m_pButton->SetLabel(GetBtnLabel());
|
||||||
|
#endif //__WXMSW__
|
||||||
|
#endif
|
||||||
|
|
||||||
OnStateChange(GetBestSize());
|
OnStateChange_(GetBestSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrusaCollapsiblePane::SetLabel(const wxString &label)
|
void PrusaCollapsiblePane::SetLabel(const wxString &label)
|
||||||
|
|
|
@ -84,7 +84,6 @@ class PrusaCollapsiblePane : public wxCollapsiblePane
|
||||||
wxBitmap m_bmp_close;
|
wxBitmap m_bmp_close;
|
||||||
wxBitmap m_bmp_open;
|
wxBitmap m_bmp_open;
|
||||||
#endif //__WXMSW__
|
#endif //__WXMSW__
|
||||||
wxWindow* m_top_parent = nullptr;
|
|
||||||
public:
|
public:
|
||||||
PrusaCollapsiblePane() {}
|
PrusaCollapsiblePane() {}
|
||||||
PrusaCollapsiblePane( wxWindow *parent,
|
PrusaCollapsiblePane( wxWindow *parent,
|
||||||
|
@ -101,35 +100,10 @@ public:
|
||||||
#else
|
#else
|
||||||
Create(parent, winid, label);
|
Create(parent, winid, label);
|
||||||
#endif //__WXMSW__
|
#endif //__WXMSW__
|
||||||
this->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, ([parent, this](wxCommandEvent e){
|
|
||||||
wxWindowUpdateLocker noUpdates_cp(this);
|
|
||||||
wxWindowUpdateLocker noUpdates(parent);
|
|
||||||
|
|
||||||
parent->Layout();
|
|
||||||
this->Refresh();
|
|
||||||
|
|
||||||
if (m_top_parent)
|
|
||||||
{
|
|
||||||
m_top_parent->GetSizer()->Layout();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
wxGetTopLevelParent(this)->Layout();
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (parent->GetParent()){
|
|
||||||
// parent->GetParent()->Layout();
|
|
||||||
// parent->Refresh();
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
// parent->Layout();
|
|
||||||
// this->Refresh();}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~PrusaCollapsiblePane() {}
|
~PrusaCollapsiblePane() {}
|
||||||
|
|
||||||
void SetTopParent(wxWindow *parent) { m_top_parent = parent; }
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
bool Create(wxWindow *parent,
|
bool Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
|
@ -141,11 +115,12 @@ public:
|
||||||
const wxString& name);
|
const wxString& name);
|
||||||
|
|
||||||
void UpdateBtnBmp();
|
void UpdateBtnBmp();
|
||||||
void Collapse(bool collapse) override;
|
|
||||||
void SetLabel(const wxString &label) override;
|
void SetLabel(const wxString &label) override;
|
||||||
bool Layout() override;
|
bool Layout() override;
|
||||||
#endif //__WXMSW__
|
#endif //__WXMSW__
|
||||||
|
void Collapse(bool collapse) override;
|
||||||
|
void OnStateChange_(const wxSize& sz); //override of OnStateChange
|
||||||
|
void show_it(bool show) { Show(show); OnStateChange_(GetBestSize()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue