# HG changeset patch # User viric@mandarina # Date 1207174572 -7200 # Node ID 5b075fa903ae0899738ca31619f68b4b13fb5966 # Parent 97dd4d2c08b616bbc85be239130deaa660e551d1 Adding a Generate menu item. diff -r 97dd4d2c08b6 -r 5b075fa903ae MainWindow.cpp --- a/MainWindow.cpp Wed Apr 02 21:47:47 2008 +0200 +++ b/MainWindow.cpp Thu Apr 03 00:16:12 2008 +0200 @@ -3,6 +3,7 @@ #include "PageList.hpp" BEGIN_EVENT_TABLE(MainWindow, wxFrame) + EVT_MENU(ID_MENU_GENERATE, MainWindow::on_generate) EVT_MENU(wxID_OPEN, MainWindow::on_open) EVT_MENU(wxID_CLOSE, MainWindow::on_quit) END_EVENT_TABLE() @@ -30,7 +31,11 @@ _menufile->Append(wxID_OPEN, _("&Open")); _menufile->Append(wxID_CLOSE, _("&Quit")); + wxMenu *menuplay = new wxMenu(); + menuplay->Append(ID_MENU_GENERATE, _("&Generate")); + _menubar->Append(_menufile, _("&File")); + _menubar->Append(menuplay, _("&Document")); SetMenuBar(_menubar); } @@ -55,3 +60,9 @@ { Close(); } + +void +MainWindow::on_generate(wxCommandEvent &event) +{ + _pagelist->generate(wxT("out.djvu")); +} diff -r 97dd4d2c08b6 -r 5b075fa903ae MainWindow.hpp --- a/MainWindow.hpp Wed Apr 02 21:47:47 2008 +0200 +++ b/MainWindow.hpp Thu Apr 03 00:16:12 2008 +0200 @@ -4,15 +4,19 @@ class MainWindow : public wxFrame { + enum + { + ID_MENU_GENERATE + }; public: MainWindow(); - private: void create_menus(); void on_open(wxCommandEvent &event); void on_quit(wxCommandEvent &event); + void on_generate(wxCommandEvent &event); wxMenuBar *_menubar; wxMenu *_menufile; diff -r 97dd4d2c08b6 -r 5b075fa903ae PageList.cpp --- a/PageList.cpp Wed Apr 02 21:47:47 2008 +0200 +++ b/PageList.cpp Thu Apr 03 00:16:12 2008 +0200 @@ -57,3 +57,10 @@ PopupMenu(menu); } + +void +PageList::generate(const wxString &outputfile) +{ + wxMessageDialog w(this, outputfile); + w.ShowModal(); +} diff -r 97dd4d2c08b6 -r 5b075fa903ae PageList.hpp --- a/PageList.hpp Wed Apr 02 21:47:47 2008 +0200 +++ b/PageList.hpp Thu Apr 03 00:16:12 2008 +0200 @@ -7,6 +7,7 @@ void add_files(const wxArrayString &filenames); void on_context_menu(wxContextMenuEvent &event); + void generate(const wxString &outputfile); private: