summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-07-25 05:19:06 +0100
committerCarl Hetherington <cth@carlh.net>2012-07-25 05:19:06 +0100
commit489e6a92b9aa940de64a886a1f9b5a420b50c7fc (patch)
treee1a7d202cf04bc2902fc45d191ffe68d24e80528
parent424fb25e9b084ee1cc8d2552f8b22a0a4d3d5f46 (diff)
Viewer kind of works.
-rw-r--r--src/tools/dvdomatic.cc4
-rw-r--r--src/wx/film_viewer.cc47
-rw-r--r--src/wx/film_viewer.h3
-rw-r--r--src/wx2/dvdomatic.cc4
4 files changed, 22 insertions, 36 deletions
diff --git a/src/tools/dvdomatic.cc b/src/tools/dvdomatic.cc
index 8fe447da5..81da111e7 100644
--- a/src/tools/dvdomatic.cc
+++ b/src/tools/dvdomatic.cc
@@ -383,8 +383,8 @@ class App : public wxApp
#endif
wxBoxSizer* main_sizer = new wxBoxSizer (wxHORIZONTAL);
- main_sizer->Add (film_editor, 0);
- main_sizer->Add (film_viewer, 1, wxEXPAND);
+ main_sizer->Add (film_editor, 0, wxALL, 6);
+ main_sizer->Add (film_viewer, 1, wxEXPAND | wxALL, 6);
frame->SetSizer (main_sizer);
SetTopWindow (frame);
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 066083397..c9a72f225 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -62,6 +62,11 @@ public:
return;
}
+ resize ();
+ }
+
+ void resize ()
+ {
int vw, vh;
GetSize (&vw, &vh);
@@ -75,13 +80,15 @@ public:
/* view is shorter (horizontally) than the ratio; fit width */
_bitmap = new wxBitmap (_image->Scale (vw, vw / target));
}
+
+ Refresh ();
}
void load (string f)
{
- clear ();
+ delete _image;
_image = new wxImage (wxString (f.c_str(), wxConvUTF8));
- _bitmap = new wxBitmap (_image->Scale (512, 512));
+ resize ();
}
void clear ()
@@ -113,30 +120,16 @@ FilmViewer::FilmViewer (Film* f, wxWindow* p)
SetSizer (_sizer);
_thumb_panel = new ThumbPanel (this, f);
- _thumb_panel->Show (true);
_sizer->Add (_thumb_panel, 1, wxEXPAND);
-#if 0
- _scroller.add (_image);
-
- Gtk::HBox* controls = manage (new Gtk::HBox);
- controls->set_spacing (6);
- controls->pack_start (_position_slider);
-
- _vbox.pack_start (_scroller, true, true);
- _vbox.pack_start (*controls, false, false);
- _vbox.set_border_width (12);
-
- _position_slider.set_digits (0);
- _position_slider.signal_format_value().connect (sigc::mem_fun (*this, &FilmViewer::format_position_slider_value));
- _position_slider.signal_value_changed().connect (sigc::mem_fun (*this, &FilmViewer::position_slider_changed));
+ int const max = f ? f->num_thumbs() : 0;
+ _slider = new wxSlider (this, wxID_ANY, 0, 0, max);
+ _sizer->Add (_slider, 0, wxEXPAND | wxLEFT | wxRIGHT);
+ load_thumbnail (0);
- _scroller.signal_size_allocate().connect (sigc::mem_fun (*this, &FilmViewer::scroller_size_allocate));
-#endif
+ _slider->Connect (wxID_ANY, wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler (FilmViewer::slider_changed), 0, this);
set_film (_film);
-
- load_thumbnail (42);//XXX
}
void
@@ -152,24 +145,16 @@ FilmViewer::load_thumbnail (int n)
int const bottom = _film->bottom_crop ();
_thumb_panel->load (_film->thumb_file(n));
-
-// _pixbuf = Gdk::Pixbuf::create_from_file (_film->thumb_file (n));
-
-// int const cw = _film->size().width - left - right;
-// int const ch = _film->size().height - top - bottom;
-// _cropped_pixbuf = Gdk::Pixbuf::create_subpixbuf (_pixbuf, left, top, cw, ch);
-// update_scaled_pixbuf ();
-// _image.set (_scaled_pixbuf);
}
void
FilmViewer::reload_current_thumbnail ()
{
- load_thumbnail (42);//_position_slider.get_value ());
+ load_thumbnail (_slider->GetValue ());
}
void
-FilmViewer::position_slider_changed ()
+FilmViewer::slider_changed (wxCommandEvent &)
{
reload_current_thumbnail ();
}
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 416dc7260..f1213e023 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -38,7 +38,7 @@ public:
void setup_visibility ();
private:
- void position_slider_changed ();
+ void slider_changed (wxCommandEvent &);
void update_thumbs ();
std::string format_position_slider_value (double) const;
void load_thumbnail (int);
@@ -51,6 +51,7 @@ private:
Film* _film;
wxBoxSizer* _sizer;
ThumbPanel* _thumb_panel;
+ wxSlider* _slider;
// Gtk::VBox _vbox;
// Gtk::ScrolledWindow _scroller;
// Gtk::Image _image;
diff --git a/src/wx2/dvdomatic.cc b/src/wx2/dvdomatic.cc
index 3e1114f03..44e51de09 100644
--- a/src/wx2/dvdomatic.cc
+++ b/src/wx2/dvdomatic.cc
@@ -61,8 +61,8 @@ class App : public wxApp
viewer->load_thumbnail (22);
wxBoxSizer* main_sizer = new wxBoxSizer (wxHORIZONTAL);
- main_sizer->Add (editor, 0);
- main_sizer->Add (viewer->get_widget (), 1, wxEXPAND);
+ main_sizer->Add (editor, 0, wxALL, 6);
+ main_sizer->Add (viewer->get_widget (), 1, wxEXPAND | wxALL, 6);
frame->SetSizer (main_sizer);
// frame->Add (viewer->get_widget ());