diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp index 7c249b3b0..b2a1e280b 100644 --- a/src/GUI/GUI.cpp +++ b/src/GUI/GUI.cpp @@ -17,6 +17,9 @@ bool App::OnInit() MainFrame *frame = new MainFrame( "Slic3r", wxDefaultPosition, wxDefaultSize, this->gui_config); frame->Show( true ); + + this->SetAppName("Slic3r"); + return true; } diff --git a/src/GUI/GUI.hpp b/src/GUI/GUI.hpp index 1339d1d34..d4ee0461b 100644 --- a/src/GUI/GUI.hpp +++ b/src/GUI/GUI.hpp @@ -3,12 +3,25 @@ #include "MainFrame.hpp" namespace Slic3r { namespace GUI { + +enum class PresetID { + PRINT = 0, + FILAMENT = 1, + PRINTER = 2 +}; + class App: public wxApp { - std::shared_ptr gui_config; // GUI-specific configuration options public: virtual bool OnInit(); App(std::shared_ptr config) : wxApp(), gui_config(config) {} + + void check_version(bool manual) { /* stub */} + +private: + std::shared_ptr gui_config; // GUI-specific configuration options + Notifier* notifier; + }; }} // namespace Slic3r::GUI diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index 8c2575cf8..56afce0dd 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -1,4 +1,6 @@ #include "MainFrame.hpp" +#include +#include namespace Slic3r { namespace GUI { @@ -105,6 +107,59 @@ void MainFrame::init_tabpanel() void MainFrame::init_menubar() { + + wxMenu* menuFile = new wxMenu(); + { + } + + wxMenu* menuPlater = new wxMenu(); + { + } + wxMenu* menuObject = new wxMenu(); + { + } + wxMenu* menuSettings = new wxMenu(); + { + } + wxMenu* menuView = new wxMenu(); + { + } + wxMenu* menuWindow = new wxMenu(); + { + } + wxMenu* menuHelp = new wxMenu(); + { + // TODO: Reimplement config wizard + //menuHelp->AppendSeparator(); + append_menu_item(menuHelp, _("Slic3r &Website"), _("Open the Slic3r website in your browser"), [=](wxCommandEvent& e) + { + wxLaunchDefaultBrowser("http://www.slic3r.org"); + }); + append_menu_item(menuHelp, _("Check for &Updates..."), _("Check for new Slic3r versions"), [=](wxCommandEvent& e) + { +// parent->check_version(true); + }); + append_menu_item(menuHelp, _("Slic3r &Manual"), _("Open the Slic3r manual in your browser"), [=](wxCommandEvent& e) + { + wxLaunchDefaultBrowser("http://manual.slic3r.org/"); + }); + append_menu_item(menuHelp, _("&About Slic3r"), _("Show about dialog"), [=](wxCommandEvent& e) + { + }, wxID_ABOUT); + + } + + wxMenuBar* menubar = new wxMenuBar(); + menubar->Append(menuFile, _("&File")); + menubar->Append(menuPlater, _("&Plater")); + menubar->Append(menuObject, _("&Object")); + menubar->Append(menuSettings, _("&Settings")); + menubar->Append(menuView, _("&View")); + menubar->Append(menuWindow, _("&Window")); + menubar->Append(menuHelp, _("&Help")); + + this->SetMenuBar(menubar); + } }} // Namespace Slic3r::GUI diff --git a/src/GUI/MainFrame.hpp b/src/GUI/MainFrame.hpp index 76a2146eb..e4014a27c 100644 --- a/src/GUI/MainFrame.hpp +++ b/src/GUI/MainFrame.hpp @@ -16,9 +16,21 @@ #include "Plater.hpp" #include "PresetEditor.hpp" #include "Settings.hpp" +#include "GUI.hpp" namespace Slic3r { namespace GUI { +template +void append_menu_item(wxMenu* menu, const wxString& name,const wxString& help, T lambda, int id = wxID_ANY, const wxBitmap& icon = wxBitmap(), const wxString& accel = "") { + wxMenuItem* tmp = menu->Append(wxID_ANY, name, help); + wxAcceleratorEntry* a = new wxAcceleratorEntry(); + if (a->FromString(accel)) + tmp->SetAccel(a); // set the accelerator if and only if the accelerator is fine + tmp->SetHelp(help); + + menu->Bind(wxEVT_MENU, lambda, tmp->GetId(), tmp->GetId()); +} + constexpr unsigned int TOOLTIP_TIMER = 32767; class MainFrame: public wxFrame