Added a tooltip for the "Slice now" button and changed its behavior according to a hold of Shift
+ some code refactoring
This commit is contained in:
parent
a123099f80
commit
84a96d3ba0
@ -525,20 +525,7 @@ void GUI_App::save_mode(const /*ConfigOptionMode*/int mode)
|
||||
// Update view mode according to selected menu
|
||||
void GUI_App::update_mode()
|
||||
{
|
||||
wxWindowUpdateLocker noUpdates(&sidebar());
|
||||
|
||||
const ConfigOptionMode mode = wxGetApp().get_mode();
|
||||
|
||||
obj_list()->get_sizer()->Show(mode > comSimple);
|
||||
sidebar().set_mode_value(mode);
|
||||
// sidebar().show_buttons(mode == comExpert);
|
||||
obj_list()->unselect_objects();
|
||||
obj_list()->update_selections();
|
||||
obj_list()->update_object_menu();
|
||||
|
||||
sidebar().update_mode_sizer(mode);
|
||||
|
||||
sidebar().Layout();
|
||||
sidebar().update_mode();
|
||||
|
||||
for (auto tab : tabs_list)
|
||||
tab->update_visibility();
|
||||
|
@ -655,7 +655,13 @@ Sidebar::Sidebar(Plater *parent)
|
||||
|
||||
// Events
|
||||
p->btn_export_gcode->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->export_gcode(); });
|
||||
p->btn_reslice->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->reslice(); });
|
||||
p->btn_reslice->Bind(wxEVT_BUTTON, [this](wxCommandEvent&)
|
||||
{
|
||||
const bool export_gcode_after_slicing = wxGetKeyState(WXK_SHIFT);
|
||||
p->plater->reslice();
|
||||
if (export_gcode_after_slicing)
|
||||
p->plater->export_gcode();
|
||||
});
|
||||
p->btn_send_gcode->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->send_gcode(); });
|
||||
}
|
||||
|
||||
@ -753,9 +759,15 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
||||
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
|
||||
}
|
||||
|
||||
void Sidebar::update_mode_sizer(const Slic3r::ConfigOptionMode& mode)
|
||||
void Sidebar::update_mode_sizer() const
|
||||
{
|
||||
p->mode_sizer->SetMode(mode);
|
||||
p->mode_sizer->SetMode(m_mode);
|
||||
}
|
||||
|
||||
void Sidebar::update_reslice_btn_tooltip() const
|
||||
{
|
||||
const wxString tooltip = m_mode == comSimple ? wxEmptyString : _(L("Hold Shift to Slice & Export G-code"));
|
||||
p->btn_reslice->SetToolTip(tooltip);
|
||||
}
|
||||
|
||||
ObjectManipulation* Sidebar::obj_manipul()
|
||||
@ -958,6 +970,24 @@ bool Sidebar::is_multifilament()
|
||||
}
|
||||
|
||||
|
||||
void Sidebar::update_mode()
|
||||
{
|
||||
m_mode = wxGetApp().get_mode();
|
||||
|
||||
update_reslice_btn_tooltip();
|
||||
update_mode_sizer();
|
||||
|
||||
wxWindowUpdateLocker noUpdates(this);
|
||||
|
||||
p->object_list->get_sizer()->Show(m_mode > comSimple);
|
||||
|
||||
p->object_list->unselect_objects();
|
||||
p->object_list->update_selections();
|
||||
p->object_list->update_object_menu();
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
std::vector<PresetComboBox*>& Sidebar::combos_filament()
|
||||
{
|
||||
return p->combos_filament;
|
||||
|
@ -62,7 +62,7 @@ private:
|
||||
|
||||
class Sidebar : public wxPanel
|
||||
{
|
||||
/*ConfigOptionMode*/int m_mode;
|
||||
ConfigOptionMode m_mode;
|
||||
public:
|
||||
Sidebar(Plater *parent);
|
||||
Sidebar(Sidebar &&) = delete;
|
||||
@ -74,7 +74,8 @@ public:
|
||||
void init_filament_combo(PresetComboBox **combo, const int extr_idx);
|
||||
void remove_unused_filament_combos(const int current_extruder_count);
|
||||
void update_presets(Slic3r::Preset::Type preset_type);
|
||||
void update_mode_sizer(const Slic3r::ConfigOptionMode& mode);
|
||||
void update_mode_sizer() const;
|
||||
void update_reslice_btn_tooltip() const;
|
||||
|
||||
ObjectManipulation* obj_manipul();
|
||||
ObjectList* obj_list();
|
||||
@ -92,7 +93,7 @@ public:
|
||||
void show_export(bool show) const;
|
||||
void show_send(bool show) const;
|
||||
bool is_multifilament();
|
||||
void set_mode_value(const /*ConfigOptionMode*/int mode) { m_mode = mode; }
|
||||
void update_mode();
|
||||
|
||||
std::vector<PresetComboBox*>& combos_filament();
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user