Fixed settings list for objects

+ fixed showing of an info_manifold_warning_icon
This commit is contained in:
YuSanka 2018-09-14 13:59:56 +02:00
parent 3903ca64d7
commit eb2b56a87f
5 changed files with 41 additions and 23 deletions

View File

@ -607,11 +607,12 @@ sub new {
#$self->{object_info_manifold_warning_icon}->Hide;
$self->{"object_info_manifold_warning_icon_show"} = sub {
if ($self->{object_info_manifold_warning_icon}->IsShown() != $_[0]) {
# this fuction show/hide info_manifold_warning_icon on the c++ side now
Slic3r::GUI::set_show_manifold_warning_icon($_[0]);
my $mode = wxTheApp->{app_config}->get("view_mode");
return if ($mode eq "" || $mode eq "simple");
$self->{object_info_manifold_warning_icon}->Show($_[0]);
$self->Layout
#my $mode = wxTheApp->{app_config}->get("view_mode");
#return if ($mode eq "" || $mode eq "simple");
#$self->{object_info_manifold_warning_icon}->Show($_[0]);
#$self->Layout
}
};
$self->{"object_info_manifold_warning_icon_show"}->(0);
@ -2478,11 +2479,11 @@ sub select_object {
if (defined $obj_idx) {
$self->{objects}->[$obj_idx]->selected(1);
# Select current object in the list on c++ side, if item isn't child
if (!defined $child){
Slic3r::GUI::select_current_object($obj_idx);}
# if (!defined $child){
# Slic3r::GUI::select_current_object($obj_idx);} # all selections in the object list is on c++ side
} else {
# Unselect all objects in the list on c++ side
Slic3r::GUI::unselect_objects();
# Slic3r::GUI::unselect_objects(); # all selections in the object list is on c++ side
}
$self->selection_changed(1);
}

View File

@ -259,6 +259,15 @@ void set_show_print_info(bool show)
void set_show_manifold_warning_icon(bool show)
{
g_show_manifold_warning_icon = show;
if (!g_manifold_warning_icon)
return;
// update manifold_warning_icon showing
if (show && !g_info_sizer->IsShown(static_cast<size_t>(0)))
g_show_manifold_warning_icon = false;
g_manifold_warning_icon->Show(g_show_manifold_warning_icon);
g_manifold_warning_icon->GetParent()->Layout();
}
void set_objects_list_sizer(wxBoxSizer *objects_list_sizer){
@ -1118,11 +1127,11 @@ void show_buttons(bool show)
}
}
void show_info_sizer(const bool show, const bool is_update_settings/* = false*/)
void show_info_sizer(const bool show)
{
g_info_sizer->Show(static_cast<size_t>(0), show);
g_info_sizer->Show(1, show && g_show_print_info);
g_manifold_warning_icon->Show(show && (!is_update_settings && g_show_manifold_warning_icon));
g_manifold_warning_icon->Show(show && g_show_manifold_warning_icon);
}
void show_object_name(bool show)
@ -1142,6 +1151,7 @@ void update_mode()
show_info_sizer(mode == ConfigMenuModeExpert);
show_buttons(mode == ConfigMenuModeExpert);
show_object_name(mode == ConfigMenuModeSimple);
show_manipulation_sizer(mode == ConfigMenuModeSimple);
// TODO There is a not the best place of it!
// *** Update showing of the collpane_settings

View File

@ -182,7 +182,7 @@ bool select_language(wxArrayString & names, wxArrayLong & identifiers);
// update right panel of the Plater according to view mode
void update_mode();
void show_info_sizer(const bool show, const bool is_update_settinfs = false);
void show_info_sizer(const bool show);
std::vector<Tab *>& get_tabs_list();
bool checked_tab(Tab* tab);

View File

@ -731,11 +731,8 @@ void select_current_object(int idx)
{
g_prevent_list_events = true;
m_objects_ctrl->UnselectAll();
if (idx < 0) {
g_prevent_list_events = false;
return;
}
m_objects_ctrl->Select(m_objects_model->GetItemById(idx));
if (idx>=0)
m_objects_ctrl->Select(m_objects_model->GetItemById(idx));
part_selection_changed();
g_prevent_list_events = false;
}
@ -748,12 +745,8 @@ void select_current_volume(int idx, int vol_idx)
}
g_prevent_list_events = true;
m_objects_ctrl->UnselectAll();
if (idx < 0) {
g_prevent_list_events = false;
return;
}
m_objects_ctrl->Select(m_objects_model->GetItemByVolumeId(idx, vol_idx));
if (idx >= 0)
m_objects_ctrl->Select(m_objects_model->GetItemByVolumeId(idx, vol_idx));
part_selection_changed();
g_prevent_list_events = false;
}
@ -1186,8 +1179,8 @@ wxMenu *create_add_settings_popupmenu(bool is_part)
menu->Append(menu_item);
}
#ifndef __WXMSW__
menu->Bind(wxEVT_MENU, [menu](wxEvent &event) {
get_settings_choice(menu, event.GetId(), true);
menu->Bind(wxEVT_MENU, [menu,is_part](wxEvent &event) {
get_settings_choice(menu, event.GetId(), is_part);
});
#endif //no __WXMSW__
return menu;
@ -2027,5 +2020,17 @@ void update_double_slider_from_canvas(wxKeyEvent& event)
event.Skip();
}
void show_manipulation_sizer(const bool is_simple_mode)
{
auto item = m_objects_ctrl->GetSelection();
if (!item || !is_simple_mode)
return;
if (m_objects_model->IsSettingsItem(item)) {
m_objects_ctrl->Select(m_objects_model->GetParent(item));
part_selection_changed();
}
}
} //namespace GUI
} //namespace Slic3r

View File

@ -140,6 +140,8 @@ void reset_double_slider();
// update DoubleSlider after keyDown in canvas
void update_double_slider_from_canvas(wxKeyEvent& event);
void show_manipulation_sizer(const bool is_simple_mode);
} //namespace GUI
} //namespace Slic3r
#endif //slic3r_GUI_ObjectParts_hpp_