From 646986348a2534be397f3e496a5227727672694a Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 30 Apr 2019 13:51:36 +0200 Subject: [PATCH] Fixed menubar item's name in respect to printer_technology --- src/slic3r/GUI/MainFrame.cpp | 19 +++++++++++++++++-- src/slic3r/GUI/MainFrame.hpp | 11 +++++++++++ src/slic3r/GUI/Plater.cpp | 3 +++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 3e3642af5..cbc85ef23 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -332,6 +332,7 @@ void MainFrame::init_menubar() wxMenu* export_menu = new wxMenu(); wxMenuItem* item_export_gcode = append_menu_item(export_menu, wxID_ANY, _(L("Export &G-code")) + dots +"\tCtrl+G", _(L("Export current plate as G-code")), [this](wxCommandEvent&) { if (m_plater) m_plater->export_gcode(); }, "export_gcode"); + m_changeable_menu_items.push_back(item_export_gcode); export_menu->AppendSeparator(); wxMenuItem* item_export_stl = append_menu_item(export_menu, wxID_ANY, _(L("Export plate as &STL")) + dots, _(L("Export current plate as STL")), [this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(); }, "export_plater"); @@ -444,8 +445,9 @@ void MainFrame::init_menubar() } append_menu_item(windowMenu, wxID_HIGHEST + 2, _(L("P&rint Settings Tab")) + "\tCtrl+2", _(L("Show the print settings")), [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 0); }, "cog"); - append_menu_item(windowMenu, wxID_HIGHEST + 3, _(L("&Filament Settings Tab")) + "\tCtrl+3", _(L("Show the filament settings")), - [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 1); }, "spool.png"); + wxMenuItem* item_material_tab = append_menu_item(windowMenu, wxID_HIGHEST + 3, _(L("&Filament Settings Tab")) + "\tCtrl+3", _(L("Show the filament settings")), + [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 1); }, "spool"); + m_changeable_menu_items.push_back(item_material_tab); append_menu_item(windowMenu, wxID_HIGHEST + 4, _(L("Print&er Settings Tab")) + "\tCtrl+4", _(L("Show the printer settings")), [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 2); }, "printer"); if (m_plater) { @@ -554,6 +556,19 @@ void MainFrame::init_menubar() }, wxID_EXIT); } #endif + + if (plater()->printer_technology() == ptSLA) + update_menubar(); +} + +void MainFrame::update_menubar() +{ + const bool is_fff = plater()->printer_technology() == ptFFF; + + m_changeable_menu_items[miExport] ->SetItemLabel((is_fff ? _(L("Export &G-code")) : _(L("Export")) ) + dots + "\tCtrl+G"); + + m_changeable_menu_items[miMaterialTab] ->SetItemLabel((is_fff ? _(L("&Filament Settings Tab")) : _(L("Mate&rial Settings Tab"))) + "\tCtrl+3"); + m_changeable_menu_items[miMaterialTab] ->SetBitmap(create_scaled_bitmap(this, is_fff ? "spool": "resin")); } // To perform the "Quck Slice", "Quick Slice and Save As", "Repeat last Quick Slice" and "Slice to SVG". diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index a8b2be2bc..13bf07922 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -70,6 +70,16 @@ class MainFrame : public DPIFrame bool can_delete() const; bool can_delete_all() const; + // MenuBar items changeable in respect to printer technology + enum MenuItems + { // FFF SLA + miExport = 0, // Export G-code Export + miMaterialTab, // Filament Settings Material Settings + }; + + // vector of a MenuBar items changeable in respect to printer technology + std::vector m_changeable_menu_items; + protected: virtual void on_dpi_changed(const wxRect &suggested_rect); @@ -83,6 +93,7 @@ public: void create_preset_tabs(); void add_created_tab(Tab* panel); void init_menubar(); + void update_menubar(); void update_ui_from_settings(); bool is_loaded() const { return m_loaded; } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 02cdaf208..2195471da 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3747,6 +3747,9 @@ void Plater::set_printer_technology(PrinterTechnology printer_technology) p->label_btn_export = printer_technology == ptFFF ? L("Export G-code") : L("Export"); p->label_btn_send = printer_technology == ptFFF ? L("Send G-code") : L("Send to printer"); + + if (wxGetApp().mainframe) + wxGetApp().mainframe->update_menubar(); } void Plater::changed_object(int obj_idx)