Merge remote-tracking branch 'origin/ys_layouts'

This commit is contained in:
YuSanka 2020-05-06 14:44:30 +02:00
commit b7c122096a
10 changed files with 298 additions and 105 deletions

View file

@ -4209,6 +4209,9 @@ void GLCanvas3D::update_ui_from_settings()
_refresh_if_shown_on_screen();
}
#endif // ENABLE_RETINA_GL
bool enable_collapse = wxGetApp().app_config->get("show_collapse_button") == "1";
enable_collapse_toolbar(enable_collapse);
}
@ -4262,6 +4265,16 @@ void GLCanvas3D::msw_rescale()
m_warning_texture.msw_rescale(*this);
}
void GLCanvas3D::update_tooltip_for_settings_item_in_main_toolbar()
{
std::string new_tooltip = _u8L("Switch to Settings") +
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") +
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) +
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ;
m_main_toolbar.set_tooltip(get_main_toolbar_item_id("settings"), new_tooltip);
}
bool GLCanvas3D::has_toolpaths_to_export() const
{
return m_volumes.has_toolpaths_to_export();
@ -4889,10 +4902,25 @@ bool GLCanvas3D::_init_main_toolbar()
if (!m_main_toolbar.add_separator())
return false;
item.name = "settings";
item.icon_filename = "cog.svg";
item.tooltip = _u8L("Switch to Settings") + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") +
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) +
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ;
item.sprite_id = 10;
item.enabling_callback = GLToolbarItem::Default_Enabling_Callback;
item.visibility_callback = [this]() { return wxGetApp().app_config->get("old_settings_layout_mode") != "1"; };
item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(); };
if (!m_main_toolbar.add_item(item))
return false;
if (!m_main_toolbar.add_separator())
return false;
item.name = "layersediting";
item.icon_filename = "layers_white.svg";
item.tooltip = _utf8(L("Variable layer height"));
item.sprite_id = 10;
item.sprite_id = /*10*/11;
item.left.toggable = true;
item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_LAYERSEDITING)); };
item.visibility_callback = [this]()->bool
@ -4914,7 +4942,7 @@ bool GLCanvas3D::_init_main_toolbar()
item.name = "search";
item.icon_filename = "search_.svg";
item.tooltip = _utf8(L("Search")) + " [" + GUI::shortkey_ctrl_prefix() + "F]";
item.sprite_id = 11;
item.sprite_id = /*11*/12;
item.left.render_callback = [this](float left, float right, float, float) {
if (m_canvas != nullptr)
{
@ -5050,7 +5078,7 @@ bool GLCanvas3D::_init_view_toolbar()
bool GLCanvas3D::_init_collapse_toolbar()
{
if (!m_collapse_toolbar.is_enabled())
if (!m_collapse_toolbar.is_enabled() && m_collapse_toolbar.get_items_count() > 0)
return true;
BackgroundTexture::Metadata background_data;
@ -5091,61 +5119,10 @@ bool GLCanvas3D::_init_collapse_toolbar()
wxGetApp().plater()->collapse_sidebar(!wxGetApp().plater()->is_sidebar_collapsed());
};
if (!m_collapse_toolbar.add_item(item))
return false;
if (!m_collapse_toolbar.add_separator())
return false;
item.name = "print";
item.icon_filename = "cog.svg";
item.tooltip = _utf8(L("Switch to Print Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "2]";
item.sprite_id = 1;
item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*0*/1); };
if (!m_collapse_toolbar.add_item(item))
return false;
item.name = "filament";
item.icon_filename = "spool.svg";
item.tooltip = _utf8(L("Switch to Filament Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "3]";
item.sprite_id = 2;
item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*1*/2); };
item.visibility_callback = [this]() { return wxGetApp().plater()->printer_technology() == ptFFF; };
if (!m_collapse_toolbar.add_item(item))
return false;
item.name = "printer";
item.icon_filename = "printer.svg";
item.tooltip = _utf8(L("Switch to Printer Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "4]";
item.sprite_id = 3;
item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*2*/3); };
if (!m_collapse_toolbar.add_item(item))
return false;
item.name = "resin";
item.icon_filename = "resin.svg";
item.tooltip = _utf8(L("Switch to SLA Material Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "3]";
item.sprite_id = 4;
item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*1*/2); };
item.visibility_callback = [this]() { return m_process->current_printer_technology() == ptSLA; };
if (!m_collapse_toolbar.add_item(item))
return false;
item.name = "sla_printer";
item.icon_filename = "sla_printer.svg";
item.tooltip = _utf8(L("Switch to Printer Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "4]";
item.sprite_id = 5;
item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*2*/3); };
if (!m_collapse_toolbar.add_item(item))
return false;
return true;
}
bool GLCanvas3D::_set_current()