stub out more menus

This commit is contained in:
Joseph Lenox 2018-04-24 22:46:26 -05:00 committed by Joseph Lenox
parent f6f2a81dee
commit 67f41d2c23
4 changed files with 84 additions and 1 deletions

View File

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

View File

@ -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<Settings> gui_config; // GUI-specific configuration options
public:
virtual bool OnInit();
App(std::shared_ptr<Settings> config) : wxApp(), gui_config(config) {}
void check_version(bool manual) { /* stub */}
private:
std::shared_ptr<Settings> gui_config; // GUI-specific configuration options
Notifier* notifier;
};
}} // namespace Slic3r::GUI

View File

@ -1,4 +1,6 @@
#include "MainFrame.hpp"
#include <wx/accel.h>
#include <wx/utils.h>
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

View File

@ -16,9 +16,21 @@
#include "Plater.hpp"
#include "PresetEditor.hpp"
#include "Settings.hpp"
#include "GUI.hpp"
namespace Slic3r { namespace GUI {
template <typename T>
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