Fixed show_info_sizer according to selected mode.

+ fixed right panel layouts
+ deleted unused functions
This commit is contained in:
YuSanka 2018-11-13 12:19:56 +01:00
parent 5089c4e2e0
commit b721f9431a
6 changed files with 17 additions and 43 deletions

View file

@ -481,18 +481,16 @@ ConfigMenuIDs GUI_App::get_view_mode()
// Update view mode according to selected menu // Update view mode according to selected menu
void GUI_App::update_mode() void GUI_App::update_mode()
{ {
wxWindowUpdateLocker noUpdates(mainframe->m_plater); wxWindowUpdateLocker noUpdates(&sidebar());
ConfigMenuIDs mode = wxGetApp().get_view_mode(); ConfigMenuIDs mode = wxGetApp().get_view_mode();
obj_list()->get_sizer()->Show(mode == ConfigMenuModeExpert); obj_list()->get_sizer()->Show(mode == ConfigMenuModeExpert);
sidebar().show_info_sizer(mode == ConfigMenuModeExpert); sidebar().set_mode_value(mode);
sidebar().show_buttons(mode == ConfigMenuModeExpert); sidebar().show_buttons(mode == ConfigMenuModeExpert);
obj_manipul()->show_object_name(mode == ConfigMenuModeSimple); obj_list()->update_selections();
obj_list()->update_manipulation_sizer(mode == ConfigMenuModeSimple);
sidebar().Layout(); sidebar().Layout();
mainframe->m_plater->Layout();
ConfigOptionMode opt_mode = mode == ConfigMenuModeSimple ? comSimple : ConfigOptionMode opt_mode = mode == ConfigMenuModeSimple ? comSimple :
mode == ConfigMenuModeExpert ? comExpert : comAdvanced; mode == ConfigMenuModeExpert ? comExpert : comAdvanced;

View file

@ -1016,7 +1016,6 @@ void ObjectList::part_selection_changed()
bool update_and_show_manipulations = false; bool update_and_show_manipulations = false;
bool update_and_show_settings = false; bool update_and_show_settings = false;
bool show_info_sizer = false;
if (multiple_selection()) { if (multiple_selection()) {
og_name = _(L("Group manipulation")); og_name = _(L("Group manipulation"));
@ -1033,7 +1032,6 @@ void ObjectList::part_selection_changed()
og_name = _(L("Object manipulation")); og_name = _(L("Object manipulation"));
m_config = &(*m_objects)[obj_idx]->config; m_config = &(*m_objects)[obj_idx]->config;
update_and_show_manipulations = true; update_and_show_manipulations = true;
show_info_sizer = true;
} }
else { else {
auto parent = m_objects_model->GetParent(item); auto parent = m_objects_model->GetParent(item);
@ -1082,25 +1080,15 @@ void ObjectList::part_selection_changed()
if (update_and_show_settings) if (update_and_show_settings)
wxGetApp().obj_settings()->get_og()->set_name(" " + og_name + " "); wxGetApp().obj_settings()->get_og()->set_name(" " + og_name + " ");
auto panel = wxGetApp().sidebar().scrolled_panel(); Sidebar& panel = wxGetApp().sidebar();
panel->Freeze(); panel.Freeze();
wxGetApp().obj_manipul() ->UpdateAndShow(update_and_show_manipulations); wxGetApp().obj_manipul() ->UpdateAndShow(update_and_show_manipulations);
wxGetApp().obj_settings()->UpdateAndShow(update_and_show_settings); wxGetApp().obj_settings()->UpdateAndShow(update_and_show_settings);
show_info_sizer ? wxGetApp().sidebar().update_info_sizer() : wxGetApp().sidebar().show_info_sizer(false); wxGetApp().sidebar().show_info_sizer();
panel->Thaw(); panel.Layout();
} panel.Thaw();
void ObjectList::update_manipulation_sizer(const bool is_simple_mode)
{
auto item = GetSelection(); /// #ys_FIXME_to_multi_sel
if (!item || !is_simple_mode)
return;
if (m_objects_model->IsSettingsItem(item)) {
select_item(m_objects_model->GetParent(item));
}
} }
void ObjectList::add_object_to_list(size_t obj_idx) void ObjectList::add_object_to_list(size_t obj_idx)

View file

@ -110,8 +110,6 @@ public:
void parts_changed(int obj_idx); void parts_changed(int obj_idx);
void part_selection_changed(); void part_selection_changed();
void update_manipulation_sizer(const bool is_simple_mode);
// Add object to the list // Add object to the list
void add_object_to_list(size_t obj_idx); void add_object_to_list(size_t obj_idx);
// Delete object from the list // Delete object from the list

View file

@ -38,7 +38,7 @@ void OG_Settings::Hide()
void OG_Settings::UpdateAndShow(const bool show) void OG_Settings::UpdateAndShow(const bool show)
{ {
Show(show); Show(show);
m_parent->Layout(); // m_parent->Layout();
} }
wxSizer* OG_Settings::get_sizer() wxSizer* OG_Settings::get_sizer()

View file

@ -690,19 +690,11 @@ void Sidebar::update_objects_list_extruder_column(int extruders_count)
p->object_list->update_objects_list_extruder_column(extruders_count); p->object_list->update_objects_list_extruder_column(extruders_count);
} }
void Sidebar::show_info_sizer(const bool show) void Sidebar::show_info_sizer()
{ {
p->object_info->show_sizer(show); if (!p->plater->is_single_full_object_selection() ||
p->scrolled->Layout(); m_mode < ConfigMenuModeExpert ) {
}
void Sidebar::update_info_sizer()
{
wxWindowUpdateLocker freeze_guard(p->scrolled);
if (/*obj_idx < 0 || */!p->plater->is_single_full_object_selection()) {
p->object_info->Show(false); p->object_info->Show(false);
p->scrolled->Layout();
return; return;
} }
@ -743,12 +735,11 @@ void Sidebar::update_info_sizer()
} }
p->object_info->show_sizer(true); p->object_info->show_sizer(true);
p->scrolled->Layout();
} }
void Sidebar::show_sliced_info_sizer(const bool show) void Sidebar::show_sliced_info_sizer(const bool show)
{ {
wxWindowUpdateLocker freeze_guard(p->scrolled); wxWindowUpdateLocker freeze_guard(this);
p->sliced_info->Show(show); p->sliced_info->Show(show);
if (show) { if (show) {
@ -777,7 +768,7 @@ void Sidebar::show_sliced_info_sizer(const bool show)
p->sliced_info->SetTextAndShow(siWTNumbetOfToolchanges, is_wipe_tower ? wxString::Format("%.d", p->plater->print().wipe_tower_data().number_of_toolchanges) : "N/A"); p->sliced_info->SetTextAndShow(siWTNumbetOfToolchanges, is_wipe_tower ? wxString::Format("%.d", p->plater->print().wipe_tower_data().number_of_toolchanges) : "N/A");
} }
p->scrolled->Layout(); Layout();
} }
void Sidebar::show_buttons(const bool show) void Sidebar::show_buttons(const bool show)
@ -1413,8 +1404,6 @@ void Plater::priv::selection_changed()
_3DScene::enable_toolbar_item(canvas3D, "layersediting", layers_height_allowed()); _3DScene::enable_toolbar_item(canvas3D, "layersediting", layers_height_allowed());
// forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears) // forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears)
_3DScene::render(canvas3D); _3DScene::render(canvas3D);
sidebar->update_info_sizer();
} }
void Plater::priv::object_list_changed() void Plater::priv::object_list_changed()

View file

@ -62,6 +62,7 @@ enum ButtonAction
class Sidebar : public wxPanel class Sidebar : public wxPanel
{ {
/*ConfigMenuIDs*/int m_mode;
public: public:
Sidebar(Plater *parent); Sidebar(Plater *parent);
Sidebar(Sidebar &&) = delete; Sidebar(Sidebar &&) = delete;
@ -82,13 +83,13 @@ public:
ConfigOptionsGroup* og_freq_chng_params(); ConfigOptionsGroup* og_freq_chng_params();
wxButton* get_wiping_dialog_button(); wxButton* get_wiping_dialog_button();
void update_objects_list_extruder_column(int extruders_count); void update_objects_list_extruder_column(int extruders_count);
void show_info_sizer(const bool show); void show_info_sizer();
void update_info_sizer();
void show_sliced_info_sizer(const bool show); void show_sliced_info_sizer(const bool show);
void show_buttons(const bool show); void show_buttons(const bool show);
void show_button(ButtonAction but_action, bool show); void show_button(ButtonAction but_action, bool show);
void enable_buttons(bool enable); void enable_buttons(bool enable);
bool is_multifilament(); bool is_multifilament();
void set_mode_value(const /*ConfigMenuIDs*/int mode) { m_mode = mode; }
std::vector<PresetComboBox*>& combos_filament(); std::vector<PresetComboBox*>& combos_filament();
private: private: