conf.recurse('lib')
if not conf.env.DISABLE_GUI:
conf.recurse('gtk')
+ conf.recurse('wx')
def build(bld):
bld.recurse('lib')
bld.recurse('tools')
if not bld.env.DISABLE_GUI:
bld.recurse('gtk')
+ bld.recurse('wx')
--- /dev/null
+#include <wx/wx.h>
+#include "lib/util.h"
+#include "lib/film.h"
+#include "film_viewer.h"
+#include "film_editor.h"
+
+enum {
+ ID_Quit = 1,
+};
+
+class Frame : public wxFrame
+{
+public:
+ Frame (wxString const & title, wxPoint const & pos, wxSize const & size)
+ : wxFrame (NULL, -1, title, pos, size)
+ {
+ wxMenuBar* bar = new wxMenuBar;
+
+ wxMenu *menu_file = new wxMenu;
+ menu_file->Append (ID_Quit, _("&Quit"));
+
+ bar->Append (menu_file, _("&File"));
+
+ SetMenuBar (bar);
+
+ CreateStatusBar ();
+ SetStatusText (_("Welcome to DVD-o-matic!"));
+ }
+
+ void OnQuit (wxCommandEvent& event)
+ {
+ Close (true);
+ }
+};
+
+class App : public wxApp
+{
+ bool OnInit ()
+ {
+ if (!wxApp::OnInit ()) {
+ return false;
+ }
+
+ wxInitAllImageHandlers ();
+
+ dvdomatic_setup ();
+
+ Film* film = new Film ("/home/carl/DCP/BitHarvest");
+
+ Frame* frame = new Frame (_("DVD-o-matic"), wxPoint (50, 50), wxSize(450, 350));
+ frame->Show (true);
+
+ frame->Connect (
+ ID_Quit, wxEVT_COMMAND_MENU_SELECTED,
+ (wxObjectEventFunction) &Frame::OnQuit
+ );
+
+ FilmEditor* editor = new FilmEditor (film, frame);
+ editor->Show (true);
+ FilmViewer* viewer = new FilmViewer (film, frame);
+ viewer->load_thumbnail (22);
+
+ wxBoxSizer* main_sizer = new wxBoxSizer (wxHORIZONTAL);
+ main_sizer->Add (editor, 0);
+ main_sizer->Add (viewer->get_widget (), 1, wxEXPAND);
+ frame->SetSizer (main_sizer);
+
+// frame->Add (viewer->get_widget ());
+
+ SetTopWindow (frame);
+ return true;
+ }
+};
+
+IMPLEMENT_APP (App)
+
--- /dev/null
+#include "film_editor.h"
+
+FilmEditor::FilmEditor (Film* f, wxFrame* p)
+ : wxPanel (p)
+ , _film (f)
+{
+ new wxButton (this, 0, wxT("FUCK"));
+}
--- /dev/null
+#include <wx/wx.h>
+
+class Film;
+
+class FilmEditor : public wxPanel
+{
+public:
+ FilmEditor (Film* f, wxFrame *);
+
+private:
+ Film* _film;
+};
--- /dev/null
+#include <iostream>
+#include "lib/film.h"
+#include "film_viewer.h"
+
+using namespace std;
+
+class ThumbPanel : public wxPanel
+{
+public:
+ ThumbPanel (wxFrame* parent)
+ : wxPanel (parent)
+ , _bitmap (0)
+ {
+ }
+
+ void paint_event (wxPaintEvent& ev)
+ {
+ if (!_bitmap) {
+ return;
+ }
+
+ cout << "RENDER\n";
+
+ wxPaintDC dc (this);
+ dc.DrawBitmap (*_bitmap, 0, 0, false);
+ }
+
+ void set_bitmap (wxBitmap* bitmap)
+ {
+ _bitmap = bitmap;
+ }
+
+ DECLARE_EVENT_TABLE ();
+
+private:
+ wxBitmap* _bitmap;
+};
+
+BEGIN_EVENT_TABLE (ThumbPanel, wxPanel)
+EVT_PAINT (ThumbPanel::paint_event)
+END_EVENT_TABLE ()
+
+FilmViewer::FilmViewer (Film* f, wxFrame* p)
+ : _film (f)
+ , _image (0)
+ , _scaled_image (0)
+ , _bitmap (0)
+{
+ _thumb_panel = new ThumbPanel (p);
+ _thumb_panel->Show (true);
+ int x, y;
+ _thumb_panel->GetSize (&x, &y);
+ cout << x << " " << y << "\n";
+}
+
+void
+FilmViewer::load_thumbnail (int n)
+{
+ if (_film == 0 && _film->num_thumbs() <= n) {
+ return;
+ }
+
+ _image = new wxImage (wxString (_film->thumb_file(n).c_str (), wxConvUTF8));
+ _scaled_image = new wxImage (_image->Scale (512, 512));
+ _bitmap = new wxBitmap (*_scaled_image);
+ _thumb_panel->set_bitmap (_bitmap);
+}
+
+wxPanel *
+FilmViewer::get_widget ()
+{
+ return _thumb_panel;
+}
--- /dev/null
+#include <wx/wx.h>
+
+class Film;
+class ThumbPanel;
+
+class FilmViewer
+{
+public:
+ FilmViewer (Film *, wxFrame *);
+
+ void load_thumbnail (int);
+ wxPanel* get_widget ();
+
+private:
+ Film* _film;
+
+ wxImage* _image;
+ wxImage* _scaled_image;
+ wxBitmap* _bitmap;
+ ThumbPanel* _thumb_panel;
+};
--- /dev/null
+def configure(conf):
+ conf.check_cfg(package = '', path = 'wx-config', args = '--cppflags --cxxflags --libs', uselib_store = 'WXWIDGETS', mandatory = True)
+
+def build(bld):
+ obj = bld(features = 'cxx cxxprogram')
+ obj.name = 'dvdomatic-wx'
+ obj.includes = [ '..' ]
+ obj.export_includes = ['.']
+ obj.uselib = 'WXWIDGETS'
+ obj.use = 'dvdomatic'
+ obj.source = """
+ dvdomatic.cc
+ film_viewer.cc
+ film_editor.cc
+ """
+ obj.target = 'dvdomatic-wx'