diff options
author | bubnikv <bubnikv@gmail.com> | 2018-09-19 12:02:24 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2018-09-19 12:02:24 +0300 |
commit | 0558b53493a77bae44831cf87bb0f59359828ef5 (patch) | |
tree | c3e8dbdf7d91a051c12d9ebbf7606d41047fea96 /src/slic3r.cpp | |
parent | 3ddaccb6410478ad02d8c0e02d6d8e6eb1785b9f (diff) |
WIP: Moved sources int src/, separated most of the source code from Perl.
The XS was left only for the unit / integration tests, and it links
libslic3r only. No wxWidgets are allowed to be used from Perl starting
from now.
Diffstat (limited to 'src/slic3r.cpp')
-rw-r--r-- | src/slic3r.cpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/slic3r.cpp b/src/slic3r.cpp index 085b39686..8174ba0a2 100644 --- a/src/slic3r.cpp +++ b/src/slic3r.cpp @@ -12,8 +12,83 @@ #include <boost/nowide/args.hpp> #include <boost/nowide/iostream.hpp> +#include "slic3r/GUI/GUI.hpp" + using namespace Slic3r; +// wxWidgets "Hello world" Program +// For compilers that support precompilation, includes "wx/wx.h". +#include <wx/wxprec.h> +#ifndef WX_PRECOMP + #include <wx/wx.h> +#endif +class MyApp: public wxApp +{ +public: + virtual bool OnInit(); +}; +class MyFrame: public wxFrame +{ +public: + MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size); +private: + void OnHello(wxCommandEvent& event); + void OnExit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + wxDECLARE_EVENT_TABLE(); +}; +enum +{ + ID_Hello = 1 +}; +wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_MENU(ID_Hello, MyFrame::OnHello) + EVT_MENU(wxID_EXIT, MyFrame::OnExit) + EVT_MENU(wxID_ABOUT, MyFrame::OnAbout) +wxEND_EVENT_TABLE() +bool MyApp::OnInit() +{ + MyFrame *frame = new MyFrame( "Hello World", wxPoint(50, 50), wxSize(450, 340) ); + frame->Show( true ); + return true; +} +MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) + : wxFrame(NULL, wxID_ANY, title, pos, size) +{ + wxMenu *menuFile = new wxMenu; + menuFile->Append(ID_Hello, "&Hello...\tCtrl-H", + "Help string shown in status bar for this menu item"); + menuFile->AppendSeparator(); + menuFile->Append(wxID_EXIT); + wxMenu *menuHelp = new wxMenu; + menuHelp->Append(wxID_ABOUT); + wxMenuBar *menuBar = new wxMenuBar; + menuBar->Append( menuFile, "&File" ); + menuBar->Append( menuHelp, "&Help" ); + SetMenuBar( menuBar ); + CreateStatusBar(); + SetStatusText( "Welcome to wxWidgets!" ); + Slic3r::Model model; + ModelObject *object = model.add_object(); + SetStatusText(Slic3r::GUI::from_u8("HHuhuh")); +} + +void MyFrame::OnExit(wxCommandEvent& event) +{ + Close( true ); +} +void MyFrame::OnAbout(wxCommandEvent& event) +{ + wxMessageBox( "This is a wxWidgets' Hello world sample", + "About Hello World", wxOK | wxICON_INFORMATION ); +} +void MyFrame::OnHello(wxCommandEvent& event) +{ + wxLogMessage("Hello world from wxWidgets!"); +} + + +#if 1 int main(int argc, char **argv) { @@ -176,5 +251,11 @@ main(int argc, char **argv) } #endif + + MyApp *gui = new MyApp(); + + MyApp::SetInstance(gui); + wxEntry(argc, argv); return 0; } +#endif |