Fixed menubar item's name in respect to printer_technology

This commit is contained in:
YuSanka 2019-04-30 13:51:36 +02:00
parent 52c28578d6
commit 646986348a
3 changed files with 31 additions and 2 deletions

View file

@ -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".

View file

@ -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<wxMenuItem*> 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; }

View file

@ -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)