Add magic lines to put the DVD-o-matic window at the front on OS X so that it gets...
authorCarl Hetherington <cth@carlh.net>
Wed, 29 May 2013 22:02:00 +0000 (23:02 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 29 May 2013 22:02:00 +0000 (23:02 +0100)
src/lib/dcp_video_frame.cc
src/lib/subtitle.cc
src/lib/subtitle.h
src/lib/util.cc
src/lib/util.h
src/tools/dvdomatic.cc
src/wx/film_viewer.cc

index d674393a98023e2e02459c1bc6b8ec6c966d2a42..77b81a658f48e9e3a5ff531bc3041879d1502aba 100644 (file)
@@ -164,7 +164,7 @@ DCPVideoFrame::encode_locally ()
        shared_ptr<Image> prepared = _input->scale_and_convert_to_rgb (_out_size, _padding, _scaler, true);
 
        if (_subtitle) {
-               Rect tx = subtitle_transformed_area (
+               dvdomatic::Rect tx = subtitle_transformed_area (
                        float (_out_size.width) / _input->size().width,
                        float (_out_size.height) / _input->size().height,
                        _subtitle->area(), _subtitle_offset, _subtitle_scale
index 5c1ad97064fd1042450b99638d21de8a62f049b5..5c2a0d0b5f31d65efacf76f4194a812c104bff3f 100644 (file)
@@ -108,13 +108,13 @@ Subtitle::Subtitle (Position p, shared_ptr<Image> i)
  *  in the coordinate space of the source.
  *  @param subtitle_scale scaling factor to apply to the subtitle image.
  */
-Rect
+dvdomatic::Rect
 subtitle_transformed_area (
        float target_x_scale, float target_y_scale,
-       Rect sub_area, int subtitle_offset, float subtitle_scale
+       dvdomatic::Rect sub_area, int subtitle_offset, float subtitle_scale
        )
 {
-       Rect tx;
+       dvdomatic::Rect tx;
 
        sub_area.y += subtitle_offset;
 
@@ -143,8 +143,8 @@ subtitle_transformed_area (
 }
 
 /** @return area that this subtitle takes up, in the original uncropped source's coordinate space */
-Rect
+dvdomatic::Rect
 Subtitle::area () const
 {
-       return Rect (_position.x, _position.y, _image->size().width, _image->size().height);
+       return dvdomatic::Rect (_position.x, _position.y, _image->size().width, _image->size().height);
 }
index 38ba4e70e0170fabd5e2a71ee2ad9eadceb5a2ee..e3a853695f0fb313f2f20f2f5e6775e359eada92 100644 (file)
@@ -46,17 +46,17 @@ public:
                return _image;
        }
 
-       Rect area () const;
+       dvdomatic::Rect area () const;
        
 private:
        Position _position;
        boost::shared_ptr<Image> _image;
 };
 
-Rect
+dvdomatic::Rect
 subtitle_transformed_area (
        float target_x_scale, float target_y_scale,
-       Rect sub_area, int subtitle_offset, float subtitle_scale
+       dvdomatic::Rect sub_area, int subtitle_offset, float subtitle_scale
        );
 
 /** A Subtitle class with details of the time over which it should be shown */
index 2f8be6edde675dc37de0c1336b7d3a406bcf61fe..b8b60c6f645415652e66d883ff68722219a62bb5 100644 (file)
@@ -637,8 +637,8 @@ Socket::read_uint32 ()
 /** @param other A Rect.
  *  @return The intersection of this with `other'.
  */
-Rect
-Rect::intersection (Rect const & other) const
+dvdomatic::Rect
+dvdomatic::Rect::intersection (Rect const & other) const
 {
        int const tx = max (x, other.x);
        int const ty = max (y, other.y);
index d0c350a563598657a0e95462455a2e30ad1674b8..3e1d7f4b407d8326adf7869c0b0e15bd8785b269 100644 (file)
@@ -44,6 +44,8 @@ extern "C" {
 #define TIMING(...)
 #endif
 
+#undef check
+
 /** The maximum number of audio channels that we can cope with */
 #define MAX_AUDIO_CHANNELS 6
 
@@ -150,6 +152,9 @@ struct Position
        int y;
 };
 
+namespace dvdomatic
+{
+       
 /** @struct Rect
  *  @brief A rectangle.
  */
@@ -185,6 +190,8 @@ struct Rect
        Rect intersection (Rect const & other) const;
 };
 
+}
+
 extern std::string crop_string (Position, libdcp::Size);
 extern int dcp_audio_sample_rate (int);
 extern std::string colour_lut_index_to_name (int index);
index ff1560f0eaa83652551b48a527d2b9264e89cf6a..e6d4471db9e99a80ef61924f80cdc7774a486af0 100644 (file)
@@ -23,6 +23,9 @@
 #ifdef __WXMSW__
 #include <shellapi.h>
 #endif
+#ifdef __WXOSX__
+#include <ApplicationServices/ApplicationServices.h>
+#endif
 #include <wx/aboutdlg.h>
 #include <wx/stdpaths.h>
 #include <wx/cmdline.h>
@@ -472,6 +475,12 @@ class App : public wxApp
                
 #ifdef DVDOMATIC_POSIX         
                unsetenv ("UBUNTU_MENUPROXY");
+#endif
+
+#ifdef __WXOSX__               
+               ProcessSerialNumber serial;
+               GetCurrentProcess (&serial);
+               TransformProcessType (&serial, kProcessTransformToForegroundApplication);
 #endif         
 
                wxInitAllImageHandlers ();
index 82490e32978d6f7362c35e7b7fac93f7d93fa272..79642af9c72ee9c3979cc29302bbbd35f1ef34ef 100644 (file)
@@ -329,7 +329,7 @@ FilmViewer::raw_to_display ()
 
                Size const cropped_size = _film->cropped_size (_film->size ());
 
-               Rect tx = subtitle_transformed_area (
+               dvdomatic::Rect tx = subtitle_transformed_area (
                        float (_film_size.width) / cropped_size.width,
                        float (_film_size.height) / cropped_size.height,
                        _raw_sub->area(), _film->subtitle_offset(), _film->subtitle_scale()