Tinkering.
[dcpomatic.git] / src / wx / dvdomatic.cc
1 #include <wx/wx.h>
2 #include "lib/util.h"
3 #include "lib/film.h"
4 #include "film_viewer.h"
5 #include "film_editor.h"
6
7 enum {
8         ID_Quit = 1,
9 };
10
11 class Frame : public wxFrame
12 {
13 public:
14         Frame (wxString const & title, wxPoint const & pos, wxSize const & size)
15                 : wxFrame (NULL, -1, title, pos, size)
16         {
17                 wxMenuBar* bar = new wxMenuBar;
18                 
19                 wxMenu *menu_file = new wxMenu;
20                 menu_file->Append (ID_Quit, _("&Quit"));
21
22                 bar->Append (menu_file, _("&File"));
23
24                 SetMenuBar (bar);
25
26                 CreateStatusBar ();
27                 SetStatusText (_("Welcome to DVD-o-matic!"));
28         }
29         
30         void OnQuit (wxCommandEvent& event)
31         {
32                 Close (true);
33         }
34 };
35
36 class App : public wxApp
37 {
38         bool OnInit ()
39         {
40                 if (!wxApp::OnInit ()) {
41                         return false;
42                 }
43
44                 wxInitAllImageHandlers ();
45                 
46                 dvdomatic_setup ();
47
48                 Film* film = new Film ("/home/carl/DCP/BitHarvest");
49                 
50                 Frame* frame = new Frame (_("DVD-o-matic"), wxPoint (50, 50), wxSize(450, 350));
51                 frame->Show (true);
52                 
53                 frame->Connect (
54                         ID_Quit, wxEVT_COMMAND_MENU_SELECTED,
55                         (wxObjectEventFunction) &Frame::OnQuit
56                         );
57
58                 FilmEditor* editor = new FilmEditor (film, frame);
59                 editor->Show (true);
60                 FilmViewer* viewer = new FilmViewer (film, frame);
61                 viewer->load_thumbnail (22);
62
63                 wxBoxSizer* main_sizer = new wxBoxSizer (wxHORIZONTAL);
64                 main_sizer->Add (editor, 0);
65                 main_sizer->Add (viewer->get_widget (), 1, wxEXPAND);
66                 frame->SetSizer (main_sizer);
67
68 //              frame->Add (viewer->get_widget ());
69
70                 SetTopWindow (frame);
71                 return true;
72         }
73 };
74
75 IMPLEMENT_APP (App)
76