Spacing tweaks; rename ImageMagick -> StillImage.
authorCarl Hetherington <cth@carlh.net>
Fri, 19 Jul 2013 15:08:29 +0000 (16:08 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 19 Jul 2013 15:08:29 +0000 (16:08 +0100)
35 files changed:
src/lib/content_factory.cc
src/lib/imagemagick.h [deleted file]
src/lib/imagemagick_content.cc [deleted file]
src/lib/imagemagick_content.h [deleted file]
src/lib/imagemagick_decoder.cc [deleted file]
src/lib/imagemagick_decoder.h [deleted file]
src/lib/imagemagick_examiner.cc [deleted file]
src/lib/imagemagick_examiner.h [deleted file]
src/lib/player.cc
src/lib/playlist.cc
src/lib/playlist.h
src/lib/still_image.h [new file with mode: 0644]
src/lib/still_image_content.cc [new file with mode: 0644]
src/lib/still_image_content.h [new file with mode: 0644]
src/lib/still_image_decoder.cc [new file with mode: 0644]
src/lib/still_image_decoder.h [new file with mode: 0644]
src/lib/still_image_examiner.cc [new file with mode: 0644]
src/lib/still_image_examiner.h [new file with mode: 0644]
src/lib/wscript
src/wx/config_dialog.cc
src/wx/dci_metadata_dialog.cc
src/wx/film_editor.cc
src/wx/film_viewer.cc
src/wx/gain_calculator_dialog.cc
src/wx/imagemagick_content_dialog.cc [deleted file]
src/wx/imagemagick_content_dialog.h [deleted file]
src/wx/new_film_dialog.cc
src/wx/properties_dialog.cc
src/wx/repeat_dialog.cc
src/wx/still_image_content_dialog.cc [new file with mode: 0644]
src/wx/still_image_content_dialog.h [new file with mode: 0644]
src/wx/wscript
src/wx/wx_util.h
test/black_fill_test.cc
test/scaling_test.cc

index cf45b6aa6f4074aceed188b4a36d6089ab3de4c7..bf447641d817165319e6c7fcd06e29ab6305579a 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <libcxml/cxml.h>
 #include "ffmpeg_content.h"
-#include "imagemagick_content.h"
+#include "still_image_content.h"
 #include "sndfile_content.h"
 
 using std::string;
@@ -34,8 +34,8 @@ content_factory (shared_ptr<const Film> film, shared_ptr<cxml::Node> node)
        
        if (type == "FFmpeg") {
                content.reset (new FFmpegContent (film, node));
-       } else if (type == "ImageMagick") {
-               content.reset (new ImageMagickContent (film, node));
+       } else if (type == "StillImage") {
+               content.reset (new StillImageContent (film, node));
        } else if (type == "Sndfile") {
                content.reset (new SndfileContent (film, node));
        }
diff --git a/src/lib/imagemagick.h b/src/lib/imagemagick.h
deleted file mode 100644 (file)
index 5a1712a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-class ImageMagickContent;
-
-class ImageMagick
-{
-public:
-       ImageMagick (boost::shared_ptr<const ImageMagickContent> c)
-               : _imagemagick_content (c)
-       {}
-
-       boost::shared_ptr<const ImageMagickContent> content () const {
-               return _imagemagick_content;
-       }
-
-protected:
-       boost::shared_ptr<const ImageMagickContent> _imagemagick_content;
-};
diff --git a/src/lib/imagemagick_content.cc b/src/lib/imagemagick_content.cc
deleted file mode 100644 (file)
index 0c4e840..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <libcxml/cxml.h>
-#include "imagemagick_content.h"
-#include "imagemagick_examiner.h"
-#include "config.h"
-#include "compose.hpp"
-#include "film.h"
-
-#include "i18n.h"
-
-using std::string;
-using std::cout;
-using std::stringstream;
-using boost::shared_ptr;
-
-ImageMagickContent::ImageMagickContent (shared_ptr<const Film> f, boost::filesystem::path p)
-       : Content (f, p)
-       , VideoContent (f, p)
-{
-
-}
-
-ImageMagickContent::ImageMagickContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node)
-       : Content (f, node)
-       , VideoContent (f, node)
-{
-       
-}
-
-string
-ImageMagickContent::summary () const
-{
-       return String::compose (_("%1 [still]"), file().filename().string());
-}
-
-bool
-ImageMagickContent::valid_file (boost::filesystem::path f)
-{
-       string ext = f.extension().string();
-       transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
-       return (ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp");
-}
-
-void
-ImageMagickContent::as_xml (xmlpp::Node* node) const
-{
-       node->add_child("Type")->add_child_text ("ImageMagick");
-       Content::as_xml (node);
-       VideoContent::as_xml (node);
-}
-
-void
-ImageMagickContent::examine (shared_ptr<Job> job)
-{
-       Content::examine (job);
-
-       shared_ptr<const Film> film = _film.lock ();
-       assert (film);
-       
-       shared_ptr<ImageMagickExaminer> examiner (new ImageMagickExaminer (film, shared_from_this()));
-
-       take_from_video_examiner (examiner);
-       set_video_length (Config::instance()->default_still_length() * video_frame_rate());
-}
-
-void
-ImageMagickContent::set_video_length (VideoContent::Frame len)
-{
-       {
-               boost::mutex::scoped_lock lm (_mutex);
-               _video_length = len;
-       }
-
-       signal_changed (ContentProperty::LENGTH);
-}
-
-Time
-ImageMagickContent::length () const
-{
-       shared_ptr<const Film> film = _film.lock ();
-       assert (film);
-       
-       FrameRateConversion frc (video_frame_rate(), film->dcp_video_frame_rate ());
-       return video_length() * frc.factor() * TIME_HZ / video_frame_rate();
-}
-
-string
-ImageMagickContent::identifier () const
-{
-       stringstream s;
-       s << VideoContent::identifier ();
-       s << "_" << video_length();
-       return s.str ();
-}
diff --git a/src/lib/imagemagick_content.h b/src/lib/imagemagick_content.h
deleted file mode 100644 (file)
index 50191cc..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef DCPOMATIC_IMAGEMAGICK_CONTENT_H
-#define DCPOMATIC_IMAGEMAGICK_CONTENT_H
-
-#include <boost/enable_shared_from_this.hpp>
-#include "video_content.h"
-
-namespace cxml {
-       class Node;
-}
-
-class ImageMagickContent : public VideoContent
-{
-public:
-       ImageMagickContent (boost::shared_ptr<const Film>, boost::filesystem::path);
-       ImageMagickContent (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>);
-
-       boost::shared_ptr<ImageMagickContent> shared_from_this () {
-               return boost::dynamic_pointer_cast<ImageMagickContent> (Content::shared_from_this ());
-       };
-
-       void examine (boost::shared_ptr<Job>);
-       std::string summary () const;
-       void as_xml (xmlpp::Node *) const;
-       Time length () const;
-
-       std::string identifier () const;
-       
-       void set_video_length (VideoContent::Frame);
-
-       static bool valid_file (boost::filesystem::path);
-};
-
-#endif
diff --git a/src/lib/imagemagick_decoder.cc b/src/lib/imagemagick_decoder.cc
deleted file mode 100644 (file)
index ee50f3f..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-    Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <iostream>
-#include <boost/filesystem.hpp>
-#include <Magick++.h>
-#include "imagemagick_content.h"
-#include "imagemagick_decoder.h"
-#include "image.h"
-#include "film.h"
-#include "exceptions.h"
-
-#include "i18n.h"
-
-using std::cout;
-using boost::shared_ptr;
-using libdcp::Size;
-
-ImageMagickDecoder::ImageMagickDecoder (shared_ptr<const Film> f, shared_ptr<const ImageMagickContent> c)
-       : Decoder (f)
-       , VideoDecoder (f)
-       , ImageMagick (c)
-{
-
-}
-
-void
-ImageMagickDecoder::pass ()
-{
-       if (_video_position >= _imagemagick_content->video_length ()) {
-               return;
-       }
-
-       if (_image) {
-               video (_image, true, _video_position);
-               return;
-       }
-
-       Magick::Image* magick_image = new Magick::Image (_imagemagick_content->file().string ());
-       _video_size = libdcp::Size (magick_image->columns(), magick_image->rows());
-       
-       _image.reset (new Image (PIX_FMT_RGB24, _video_size.get(), false));
-
-       using namespace MagickCore;
-       
-       uint8_t* p = _image->data()[0];
-       for (int y = 0; y < _video_size->height; ++y) {
-               for (int x = 0; x < _video_size->width; ++x) {
-                       Magick::Color c = magick_image->pixelColor (x, y);
-                       *p++ = c.redQuantum() * 255 / QuantumRange;
-                       *p++ = c.greenQuantum() * 255 / QuantumRange;
-                       *p++ = c.blueQuantum() * 255 / QuantumRange;
-               }
-       }
-
-       delete magick_image;
-
-       video (_image, false, _video_position);
-}
-
-void
-ImageMagickDecoder::seek (VideoContent::Frame frame, bool)
-{
-       _video_position = frame;
-}
-
-bool
-ImageMagickDecoder::done () const
-{
-       return _video_position >= _imagemagick_content->video_length ();
-}
diff --git a/src/lib/imagemagick_decoder.h b/src/lib/imagemagick_decoder.h
deleted file mode 100644 (file)
index 3e551c3..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-    Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "video_decoder.h"
-#include "imagemagick.h"
-
-namespace Magick {
-       class Image;
-}
-
-class ImageMagickContent;
-
-class ImageMagickDecoder : public VideoDecoder, public ImageMagick
-{
-public:
-       ImageMagickDecoder (boost::shared_ptr<const Film>, boost::shared_ptr<const ImageMagickContent>);
-
-       /* Decoder */
-
-       void pass ();
-       void seek (VideoContent::Frame, bool);
-       bool done () const;
-
-private:
-       boost::shared_ptr<Image> _image;
-       mutable boost::optional<libdcp::Size> _video_size;
-};
diff --git a/src/lib/imagemagick_examiner.cc b/src/lib/imagemagick_examiner.cc
deleted file mode 100644 (file)
index 0eee0d4..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <iostream>
-#include <Magick++.h>
-#include "imagemagick_content.h"
-#include "imagemagick_examiner.h"
-#include "film.h"
-
-#include "i18n.h"
-
-using std::cout;
-using boost::shared_ptr;
-
-ImageMagickExaminer::ImageMagickExaminer (shared_ptr<const Film> f, shared_ptr<const ImageMagickContent> c)
-       : ImageMagick (c)
-       , _film (f)
-{
-       using namespace MagickCore;
-       Magick::Image* image = new Magick::Image (_imagemagick_content->file().string());
-       _video_size = libdcp::Size (image->columns(), image->rows());
-       delete image;
-}
-
-libdcp::Size
-ImageMagickExaminer::video_size () const
-{
-       return _video_size;
-}
-
-int
-ImageMagickExaminer::video_length () const
-{
-       return _imagemagick_content->video_length ();
-}
-
-float
-ImageMagickExaminer::video_frame_rate () const
-{
-       boost::shared_ptr<const Film> f = _film.lock ();
-       if (!f) {
-               return 24;
-       }
-
-       return f->dcp_video_frame_rate ();
-}
-
diff --git a/src/lib/imagemagick_examiner.h b/src/lib/imagemagick_examiner.h
deleted file mode 100644 (file)
index 801ede4..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "imagemagick.h"
-#include "video_examiner.h"
-
-namespace Magick {
-       class Image;
-}
-
-class ImageMagickContent;
-
-class ImageMagickExaminer : public ImageMagick, public VideoExaminer
-{
-public:
-       ImageMagickExaminer (boost::shared_ptr<const Film>, boost::shared_ptr<const ImageMagickContent>);
-
-       float video_frame_rate () const;
-       libdcp::Size video_size () const;
-       VideoContent::Frame video_length () const;
-
-private:
-       boost::weak_ptr<const Film> _film;
-       libdcp::Size _video_size;
-};
index d3d5d0f6bb2415b4ae458761e80aa13f0d3124f9..1ffced4252b6cbce0a3cc333499619ba215b8fcc 100644 (file)
@@ -22,8 +22,8 @@
 #include "film.h"
 #include "ffmpeg_decoder.h"
 #include "ffmpeg_content.h"
-#include "imagemagick_decoder.h"
-#include "imagemagick_content.h"
+#include "still_image_decoder.h"
+#include "still_image_content.h"
 #include "sndfile_decoder.h"
 #include "sndfile_content.h"
 #include "subtitle_content.h"
@@ -74,8 +74,8 @@ std::ostream& operator<<(std::ostream& s, Piece const & p)
 {
        if (dynamic_pointer_cast<FFmpegContent> (p.content)) {
                s << "\tffmpeg     ";
-       } else if (dynamic_pointer_cast<ImageMagickContent> (p.content)) {
-               s << "\timagemagick";
+       } else if (dynamic_pointer_cast<StillImageContent> (p.content)) {
+               s << "\tstill image";
        } else if (dynamic_pointer_cast<SndfileContent> (p.content)) {
                s << "\tsndfile    ";
        }
@@ -421,20 +421,20 @@ Player::setup_pieces ()
                        piece->decoder = fd;
                }
                
-               shared_ptr<const ImageMagickContent> ic = dynamic_pointer_cast<const ImageMagickContent> (*i);
+               shared_ptr<const StillImageContent> ic = dynamic_pointer_cast<const StillImageContent> (*i);
                if (ic) {
-                       shared_ptr<ImageMagickDecoder> id;
+                       shared_ptr<StillImageDecoder> id;
                        
-                       /* See if we can re-use an old ImageMagickDecoder */
+                       /* See if we can re-use an old StillImageDecoder */
                        for (list<shared_ptr<Piece> >::const_iterator j = old_pieces.begin(); j != old_pieces.end(); ++j) {
-                               shared_ptr<ImageMagickDecoder> imd = dynamic_pointer_cast<ImageMagickDecoder> ((*j)->decoder);
+                               shared_ptr<StillImageDecoder> imd = dynamic_pointer_cast<StillImageDecoder> ((*j)->decoder);
                                if (imd && imd->content() == ic) {
                                        id = imd;
                                }
                        }
 
                        if (!id) {
-                               id.reset (new ImageMagickDecoder (_film, ic));
+                               id.reset (new StillImageDecoder (_film, ic));
                                id->Video.connect (bind (&Player::process_video, this, piece, _1, _2, _3));
                        }
 
index c9d05b0495465507210a28f462f63e0fb4804bc2..5ccc12b61ebc43c5f00f5ae1f44fe3e851e81f93 100644 (file)
@@ -26,8 +26,8 @@
 #include "video_content.h"
 #include "ffmpeg_decoder.h"
 #include "ffmpeg_content.h"
-#include "imagemagick_decoder.h"
-#include "imagemagick_content.h"
+#include "still_image_decoder.h"
+#include "still_image_content.h"
 #include "content_factory.h"
 #include "job.h"
 #include "config.h"
index e39e9f51f96aa13148a4c4b48c8066ca9c135904..7dbf416041d8bf4bfa555bf45341ee01e04af812 100644 (file)
@@ -29,8 +29,8 @@
 class Content;
 class FFmpegContent;
 class FFmpegDecoder;
-class ImageMagickContent;
-class ImageMagickDecoder;
+class StillImageMagickContent;
+class StillImageMagickDecoder;
 class SndfileContent;
 class SndfileDecoder;
 class Job;
diff --git a/src/lib/still_image.h b/src/lib/still_image.h
new file mode 100644 (file)
index 0000000..b600694
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+class StillImageContent;
+
+class StillImage
+{
+public:
+       StillImage (boost::shared_ptr<const StillImageContent> c)
+               : _still_image_content (c)
+       {}
+
+       boost::shared_ptr<const StillImageContent> content () const {
+               return _still_image_content;
+       }
+
+protected:
+       boost::shared_ptr<const StillImageContent> _still_image_content;
+};
diff --git a/src/lib/still_image_content.cc b/src/lib/still_image_content.cc
new file mode 100644 (file)
index 0000000..3a30ccf
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <libcxml/cxml.h>
+#include "still_image_content.h"
+#include "still_image_examiner.h"
+#include "config.h"
+#include "compose.hpp"
+#include "film.h"
+
+#include "i18n.h"
+
+using std::string;
+using std::cout;
+using std::stringstream;
+using boost::shared_ptr;
+
+StillImageContent::StillImageContent (shared_ptr<const Film> f, boost::filesystem::path p)
+       : Content (f, p)
+       , VideoContent (f, p)
+{
+
+}
+
+StillImageContent::StillImageContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node)
+       : Content (f, node)
+       , VideoContent (f, node)
+{
+       
+}
+
+string
+StillImageContent::summary () const
+{
+       return String::compose (_("%1 [still]"), file().filename().string());
+}
+
+bool
+StillImageContent::valid_file (boost::filesystem::path f)
+{
+       string ext = f.extension().string();
+       transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
+       return (ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp");
+}
+
+void
+StillImageContent::as_xml (xmlpp::Node* node) const
+{
+       node->add_child("Type")->add_child_text ("StillImage");
+       Content::as_xml (node);
+       VideoContent::as_xml (node);
+}
+
+void
+StillImageContent::examine (shared_ptr<Job> job)
+{
+       Content::examine (job);
+
+       shared_ptr<const Film> film = _film.lock ();
+       assert (film);
+       
+       shared_ptr<StillImageExaminer> examiner (new StillImageExaminer (film, shared_from_this()));
+
+       take_from_video_examiner (examiner);
+       set_video_length (Config::instance()->default_still_length() * video_frame_rate());
+}
+
+void
+StillImageContent::set_video_length (VideoContent::Frame len)
+{
+       {
+               boost::mutex::scoped_lock lm (_mutex);
+               _video_length = len;
+       }
+
+       signal_changed (ContentProperty::LENGTH);
+}
+
+Time
+StillImageContent::length () const
+{
+       shared_ptr<const Film> film = _film.lock ();
+       assert (film);
+       
+       FrameRateConversion frc (video_frame_rate(), film->dcp_video_frame_rate ());
+       return video_length() * frc.factor() * TIME_HZ / video_frame_rate();
+}
+
+string
+StillImageContent::identifier () const
+{
+       stringstream s;
+       s << VideoContent::identifier ();
+       s << "_" << video_length();
+       return s.str ();
+}
diff --git a/src/lib/still_image_content.h b/src/lib/still_image_content.h
new file mode 100644 (file)
index 0000000..02921f4
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef DCPOMATIC_STILL_IMAGE_CONTENT_H
+#define DCPOMATIC_STILL_IMAGE_CONTENT_H
+
+#include <boost/enable_shared_from_this.hpp>
+#include "video_content.h"
+
+namespace cxml {
+       class Node;
+}
+
+class StillImageContent : public VideoContent
+{
+public:
+       StillImageContent (boost::shared_ptr<const Film>, boost::filesystem::path);
+       StillImageContent (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>);
+
+       boost::shared_ptr<StillImageContent> shared_from_this () {
+               return boost::dynamic_pointer_cast<StillImageContent> (Content::shared_from_this ());
+       };
+
+       void examine (boost::shared_ptr<Job>);
+       std::string summary () const;
+       void as_xml (xmlpp::Node *) const;
+       Time length () const;
+
+       std::string identifier () const;
+       
+       void set_video_length (VideoContent::Frame);
+
+       static bool valid_file (boost::filesystem::path);
+};
+
+#endif
diff --git a/src/lib/still_image_decoder.cc b/src/lib/still_image_decoder.cc
new file mode 100644 (file)
index 0000000..21cc83f
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+    Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include <boost/filesystem.hpp>
+#include <Magick++.h>
+#include "still_image_content.h"
+#include "still_image_decoder.h"
+#include "image.h"
+#include "film.h"
+#include "exceptions.h"
+
+#include "i18n.h"
+
+using std::cout;
+using boost::shared_ptr;
+using libdcp::Size;
+
+StillImageDecoder::StillImageDecoder (shared_ptr<const Film> f, shared_ptr<const StillImageContent> c)
+       : Decoder (f)
+       , VideoDecoder (f)
+       , StillImage (c)
+{
+
+}
+
+void
+StillImageDecoder::pass ()
+{
+       if (_video_position >= _still_image_content->video_length ()) {
+               return;
+       }
+
+       if (_image) {
+               video (_image, true, _video_position);
+               return;
+       }
+
+       Magick::Image* magick_image = new Magick::Image (_still_image_content->file().string ());
+       _video_size = libdcp::Size (magick_image->columns(), magick_image->rows());
+       
+       _image.reset (new Image (PIX_FMT_RGB24, _video_size.get(), false));
+
+       using namespace MagickCore;
+       
+       uint8_t* p = _image->data()[0];
+       for (int y = 0; y < _video_size->height; ++y) {
+               for (int x = 0; x < _video_size->width; ++x) {
+                       Magick::Color c = magick_image->pixelColor (x, y);
+                       *p++ = c.redQuantum() * 255 / QuantumRange;
+                       *p++ = c.greenQuantum() * 255 / QuantumRange;
+                       *p++ = c.blueQuantum() * 255 / QuantumRange;
+               }
+       }
+
+       delete magick_image;
+
+       video (_image, false, _video_position);
+}
+
+void
+StillImageDecoder::seek (VideoContent::Frame frame, bool)
+{
+       _video_position = frame;
+}
+
+bool
+StillImageDecoder::done () const
+{
+       return _video_position >= _still_image_content->video_length ();
+}
diff --git a/src/lib/still_image_decoder.h b/src/lib/still_image_decoder.h
new file mode 100644 (file)
index 0000000..db41b03
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+    Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "video_decoder.h"
+#include "still_image.h"
+
+namespace Magick {
+       class Image;
+}
+
+class StillImageContent;
+
+class StillImageDecoder : public VideoDecoder, public StillImage
+{
+public:
+       StillImageDecoder (boost::shared_ptr<const Film>, boost::shared_ptr<const StillImageContent>);
+
+       /* Decoder */
+
+       void pass ();
+       void seek (VideoContent::Frame, bool);
+       bool done () const;
+
+private:
+       boost::shared_ptr<Image> _image;
+       mutable boost::optional<libdcp::Size> _video_size;
+};
+
diff --git a/src/lib/still_image_examiner.cc b/src/lib/still_image_examiner.cc
new file mode 100644 (file)
index 0000000..71357e5
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include <Magick++.h>
+#include "still_image_content.h"
+#include "still_image_examiner.h"
+#include "film.h"
+
+#include "i18n.h"
+
+using std::cout;
+using boost::shared_ptr;
+
+StillImageExaminer::StillImageExaminer (shared_ptr<const Film> f, shared_ptr<const StillImageContent> c)
+       : StillImage (c)
+       , _film (f)
+{
+       using namespace MagickCore;
+       Magick::Image* image = new Magick::Image (_still_image_content->file().string());
+       _video_size = libdcp::Size (image->columns(), image->rows());
+       delete image;
+}
+
+libdcp::Size
+StillImageExaminer::video_size () const
+{
+       return _video_size;
+}
+
+int
+StillImageExaminer::video_length () const
+{
+       return _still_image_content->video_length ();
+}
+
+float
+StillImageExaminer::video_frame_rate () const
+{
+       boost::shared_ptr<const Film> f = _film.lock ();
+       if (!f) {
+               return 24;
+       }
+
+       return f->dcp_video_frame_rate ();
+}
+
diff --git a/src/lib/still_image_examiner.h b/src/lib/still_image_examiner.h
new file mode 100644 (file)
index 0000000..fa3456e
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "still_image.h"
+#include "video_examiner.h"
+
+namespace Magick {
+       class Image;
+}
+
+class StillImageContent;
+
+class StillImageExaminer : public StillImage, public VideoExaminer
+{
+public:
+       StillImageExaminer (boost::shared_ptr<const Film>, boost::shared_ptr<const StillImageContent>);
+
+       float video_frame_rate () const;
+       libdcp::Size video_size () const;
+       VideoContent::Frame video_length () const;
+
+private:
+       boost::weak_ptr<const Film> _film;
+       libdcp::Size _video_size;
+};
index 2bedc1fce4acfdd9ac3fad3fdb48b9cb09f7efdb..100663b8742251e04c5a4999626692d9255b95cf 100644 (file)
@@ -28,9 +28,9 @@ sources = """
           film.cc
           filter.cc
           image.cc
-          imagemagick_content.cc
-          imagemagick_decoder.cc
-          imagemagick_examiner.cc
+          still_image_content.cc
+          still_image_decoder.cc
+          still_image_examiner.cc
           job.cc
           job_manager.cc
           log.cc
index 8fc68f06a416f3b4641f9e112ea4122e550d6c1b..7ab23c997bb88f3f0a840162c8667dc3b7df9b5c 100644 (file)
@@ -59,7 +59,7 @@ ConfigDialog::ConfigDialog (wxWindow* parent)
        _notebook->AddPage (_tms_panel, _("TMS"), false);
 
        wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
-       overall_sizer->Add (s, 1, wxEXPAND | wxALL, 6);
+       overall_sizer->Add (s, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
 
        wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
        if (buttons) {
index a5ddca44b018790d3d95a5fee21149929b0177f0..2862228e4e145bc1b25cdc6299647c08332d2a25 100644 (file)
@@ -68,7 +68,7 @@ DCIMetadataDialog::DCIMetadataDialog (wxWindow* parent, DCIMetadata dm)
        _package_type->SetValue (std_to_wx (dm.package_type));
 
        wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
-       overall_sizer->Add (table, 1, wxEXPAND | wxALL, 6);
+       overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
        
        wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
        if (buttons) {
index bfef303a8600d4bd77af26e734cc451265a50b59..fe332e335f9b1830bc365279c57e7dc93a9f6682 100644 (file)
@@ -36,7 +36,7 @@
 #include "lib/filter.h"
 #include "lib/ratio.h"
 #include "lib/config.h"
-#include "lib/imagemagick_content.h"
+#include "lib/still_image_content.h"
 #include "lib/sndfile_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/sound_processor.h"
@@ -48,7 +48,7 @@
 #include "gain_calculator_dialog.h"
 #include "dci_metadata_dialog.h"
 #include "audio_dialog.h"
-#include "imagemagick_content_dialog.h"
+#include "still_image_content_dialog.h"
 #include "timeline_dialog.h"
 #include "audio_mapping_view.h"
 
@@ -1166,8 +1166,8 @@ FilmEditor::content_add_clicked (wxCommandEvent &)
 
                shared_ptr<Content> c;
 
-               if (ImageMagickContent::valid_file (p)) {
-                       c.reset (new ImageMagickContent (_film, p));
+               if (StillImageContent::valid_file (p)) {
+                       c.reset (new StillImageContent (_film, p));
                } else if (SndfileContent::valid_file (p)) {
                        c.reset (new SndfileContent (_film, p));
                } else {
@@ -1457,7 +1457,7 @@ FilmEditor::length_changed ()
                return;
        }
 
-       shared_ptr<ImageMagickContent> ic = dynamic_pointer_cast<ImageMagickContent> (c);
+       shared_ptr<StillImageContent> ic = dynamic_pointer_cast<StillImageContent> (c);
        if (ic) {
                ic->set_video_length (_length->get(_film->dcp_video_frame_rate()) * ic->video_frame_rate() / TIME_HZ);
        }
index fffb64796e67e3a7d05c61af479f1841c49cee07..9d72254167857b4b8d284006e8307c5065b2585d 100644 (file)
@@ -36,7 +36,7 @@
 #include "lib/player.h"
 #include "lib/video_content.h"
 #include "lib/ffmpeg_content.h"
-#include "lib/imagemagick_content.h"
+#include "lib/still_image_content.h"
 #include "lib/video_decoder.h"
 #include "film_viewer.h"
 #include "wx_util.h"
index 17ebbb9831c37ad7ab297903ad0d62bc90571ce3..f9880c0440d513c727deea6cf790b3818ceb1f67 100644 (file)
@@ -38,7 +38,7 @@ GainCalculatorDialog::GainCalculatorDialog (wxWindow* parent)
        table->Add (_actual, 1, wxEXPAND);
 
        wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
-       overall_sizer->Add (table, 1, wxEXPAND | wxALL, 6);
+       overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
 
        wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
        if (buttons) {
diff --git a/src/wx/imagemagick_content_dialog.cc b/src/wx/imagemagick_content_dialog.cc
deleted file mode 100644 (file)
index 6aa7562..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <wx/spinctrl.h>
-#include "lib/imagemagick_content.h"
-#include "imagemagick_content_dialog.h"
-#include "wx_util.h"
-
-using boost::shared_ptr;
-using boost::dynamic_pointer_cast;
-
-ImageMagickContentDialog::ImageMagickContentDialog (wxWindow* parent, shared_ptr<ImageMagickContent> content)
-       : wxDialog (parent, wxID_ANY, _("Image"))
-       , _content (content)
-{
-       wxFlexGridSizer* grid = new wxFlexGridSizer (3, 6, 6);
-       grid->AddGrowableCol (1, 1);
-
-       {
-               add_label_to_sizer (grid, this, _("Duration"), true);
-               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-               _video_length = new wxSpinCtrl (this);
-               s->Add (_video_length);
-               /// TRANSLATORS: this is an abbreviation for seconds, the unit of time
-               add_label_to_sizer (s, this, _("s"), false);
-               grid->Add (s);
-       }
-
-       wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
-       overall_sizer->Add (grid, 1, wxEXPAND | wxALL, 6);
-
-       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
-       if (buttons) {
-               overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
-       }
-
-       SetSizer (overall_sizer);
-       overall_sizer->Layout ();
-       overall_sizer->SetSizeHints (this);
-
-       checked_set (_video_length, content->video_length () / 24);
-       _video_length->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (ImageMagickContentDialog::video_length_changed), 0, this);
-}
-
-void
-ImageMagickContentDialog::video_length_changed (wxCommandEvent &)
-{
-       shared_ptr<ImageMagickContent> c = _content.lock ();
-       if (!c) {
-               return;
-       }
-       
-       c->set_video_length (_video_length->GetValue() * 24);
-}
diff --git a/src/wx/imagemagick_content_dialog.h b/src/wx/imagemagick_content_dialog.h
deleted file mode 100644 (file)
index 23722f1..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <wx/wx.h>
-
-class wxSpinCtrl;
-class ImageMagickContent;
-class Region;
-
-class ImageMagickContentDialog : public wxDialog
-{
-public:
-       ImageMagickContentDialog (wxWindow *, boost::shared_ptr<ImageMagickContent>);
-
-private:
-       void video_length_changed (wxCommandEvent &);
-
-       boost::weak_ptr<ImageMagickContent> _content;
-       wxSpinCtrl* _video_length;
-};
index d4b78d5bff1ad845afd1732c3ef79c83720aecf7..4b12c1714adcfc4ecd315056f7d29f4b4b09c486 100644 (file)
@@ -39,7 +39,7 @@ NewFilmDialog::NewFilmDialog (wxWindow* parent)
        
        wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
        table->AddGrowableCol (1, 1);
-       overall_sizer->Add (table, 1, wxEXPAND | wxALL, 6);
+       overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
 
        add_label_to_sizer (table, this, _("Film name"), true);
        _name = new wxTextCtrl (this, wxID_ANY);
index d525fe38b115d059bd2cc2f279952540dccb456b..a1ba81b3b5ae07838a23adb2f7d4a8d9477e169a 100644 (file)
@@ -57,7 +57,7 @@ PropertiesDialog::PropertiesDialog (wxWindow* parent, shared_ptr<Film> film)
        _disk->SetLabel (std_to_wx (s.str ()));
 
        wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
-       overall_sizer->Add (table, 0, wxALL, 6);
+       overall_sizer->Add (table, 0, wxALL, DCPOMATIC_DIALOG_BORDER);
        
        wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
        if (buttons) {
index 9eb02ba578ea1790577a45cd68de9fe500b5587e..3721c61b926ab0d5b369606e54ddb05d99f18fa6 100644 (file)
@@ -28,7 +28,7 @@ RepeatDialog::RepeatDialog (wxWindow* parent)
        
        wxFlexGridSizer* table = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
        table->AddGrowableCol (1, 1);
-       overall_sizer->Add (table, 1, wxEXPAND | wxALL, 6);
+       overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
 
        add_label_to_sizer (table, this, _("Repeat"), true);
        _number = new wxSpinCtrl (this, wxID_ANY);
diff --git a/src/wx/still_image_content_dialog.cc b/src/wx/still_image_content_dialog.cc
new file mode 100644 (file)
index 0000000..7042054
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <wx/spinctrl.h>
+#include "lib/still_image_content.h"
+#include "still_image_content_dialog.h"
+#include "wx_util.h"
+
+using boost::shared_ptr;
+using boost::dynamic_pointer_cast;
+
+StillImageContentDialog::StillImageContentDialog (wxWindow* parent, shared_ptr<StillImageContent> content)
+       : wxDialog (parent, wxID_ANY, _("Stlll Image"))
+       , _content (content)
+{
+       wxFlexGridSizer* grid = new wxFlexGridSizer (3, 6, 6);
+       grid->AddGrowableCol (1, 1);
+
+       {
+               add_label_to_sizer (grid, this, _("Duration"), true);
+               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               _video_length = new wxSpinCtrl (this);
+               s->Add (_video_length);
+               /// TRANSLATORS: this is an abbreviation for seconds, the unit of time
+               add_label_to_sizer (s, this, _("s"), false);
+               grid->Add (s);
+       }
+
+       wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+       overall_sizer->Add (grid, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
+
+       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
+       if (buttons) {
+               overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+       }
+
+       SetSizer (overall_sizer);
+       overall_sizer->Layout ();
+       overall_sizer->SetSizeHints (this);
+
+       checked_set (_video_length, content->video_length () / 24);
+       _video_length->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (StillImageContentDialog::video_length_changed), 0, this);
+}
+
+void
+StillImageContentDialog::video_length_changed (wxCommandEvent &)
+{
+       shared_ptr<StillImageContent> c = _content.lock ();
+       if (!c) {
+               return;
+       }
+       
+       c->set_video_length (_video_length->GetValue() * 24);
+}
diff --git a/src/wx/still_image_content_dialog.h b/src/wx/still_image_content_dialog.h
new file mode 100644 (file)
index 0000000..b01d79b
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <wx/wx.h>
+
+class wxSpinCtrl;
+class StillImageContent;
+class Region;
+
+class StillImageContentDialog : public wxDialog
+{
+public:
+       StillImageContentDialog (wxWindow *, boost::shared_ptr<StillImageContent>);
+
+private:
+       void video_length_changed (wxCommandEvent &);
+
+       boost::weak_ptr<StillImageContent> _content;
+       wxSpinCtrl* _video_length;
+};
index 3402d4b415bc6e75a835da66f7739f4c7b9a6180..09ce0218db1fc1b63d1b31019214c94486f83d42 100644 (file)
@@ -16,7 +16,7 @@ sources = """
           filter_dialog.cc
           filter_view.cc
           gain_calculator_dialog.cc
-          imagemagick_content_dialog.cc
+          still_image_content_dialog.cc
           job_manager_view.cc
           job_wrapper.cc
           new_film_dialog.cc
index de6a09c35298fcc0b53460e4e8be8ef299695bed..d942d8fa83f22f7e07de20e0997c6b5c0eb2bae7 100644 (file)
@@ -34,6 +34,7 @@ class wxGridBagSizer;
 
 #define DCPOMATIC_SIZER_X_GAP 8
 #define DCPOMATIC_SIZER_Y_GAP 8
+#define DCPOMATIC_DIALOG_BORDER 12
 
 /** @file src/wx/wx_util.h
  *  @brief Some utility functions and classes.
index 48cf1f53c3d62a8b3c55e6914ecc24ce74e929ca..4bd76c07ff8ac2cc77f3cfa6c1adddf74329f902 100644 (file)
@@ -18,7 +18,7 @@
 */
 
 #include <boost/test/unit_test.hpp>
-#include "lib/imagemagick_content.h"
+#include "lib/still_image_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/film.h"
 #include "lib/ratio.h"
@@ -37,9 +37,9 @@ BOOST_AUTO_TEST_CASE (black_fill_test)
        film->set_name ("black_fill_test");
        film->set_container (Ratio::from_id ("185"));
        film->set_sequence_video (false);
-       shared_ptr<ImageMagickContent> contentA (new ImageMagickContent (film, "test/data/simple_testcard_640x480.png"));
+       shared_ptr<StillImageContent> contentA (new StillImageContent (film, "test/data/simple_testcard_640x480.png"));
        contentA->set_ratio (Ratio::from_id ("185"));
-       shared_ptr<ImageMagickContent> contentB (new ImageMagickContent (film, "test/data/simple_testcard_640x480.png"));
+       shared_ptr<StillImageContent> contentB (new StillImageContent (film, "test/data/simple_testcard_640x480.png"));
        contentB->set_ratio (Ratio::from_id ("185"));
 
        film->examine_and_add_content (contentA);
index 5e8dab3085171b49389476ab749ec97c1f2e3d82..8d00be72a33cee4df2cb482a62c092e1f1b4b8ca 100644 (file)
@@ -18,7 +18,7 @@
 */
 
 #include <boost/test/unit_test.hpp>
-#include "lib/imagemagick_content.h"
+#include "lib/still_image_content.h"
 #include "lib/ratio.h"
 #include "lib/film.h"
 #include "lib/dcp_content_type.h"
@@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE (scaling_test)
        shared_ptr<Film> film = new_test_film ("scaling_test");
        film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR"));
        film->set_name ("scaling_test");
-       shared_ptr<ImageMagickContent> imc (new ImageMagickContent (film, "test/data/simple_testcard_640x480.png"));
+       shared_ptr<StillImageContent> imc (new StillImageContent (film, "test/data/simple_testcard_640x480.png"));
 
        film->examine_and_add_content (imc);