summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-29 23:02:00 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-29 23:02:00 +0100
commit07ee845fddca9c7f4e714cf0df8f3e755af7ed81 (patch)
tree62328cf211c7d3c365e2619b00a9de12efef1f92 /src
parent2c942f2794bae0500fa514281367eb4365ef59ba (diff)
Add magic lines to put the DVD-o-matic window at the front on OS X so that it gets a menu bar. Put our Rect in a namespace to hide from Carbon's version.
Diffstat (limited to 'src')
-rw-r--r--src/lib/dcp_video_frame.cc2
-rw-r--r--src/lib/subtitle.cc10
-rw-r--r--src/lib/subtitle.h6
-rw-r--r--src/lib/util.cc4
-rw-r--r--src/lib/util.h7
-rw-r--r--src/tools/dvdomatic.cc9
-rw-r--r--src/wx/film_viewer.cc2
7 files changed, 28 insertions, 12 deletions
diff --git a/src/lib/dcp_video_frame.cc b/src/lib/dcp_video_frame.cc
index d674393a9..77b81a658 100644
--- a/src/lib/dcp_video_frame.cc
+++ b/src/lib/dcp_video_frame.cc
@@ -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
diff --git a/src/lib/subtitle.cc b/src/lib/subtitle.cc
index 5c1ad9706..5c2a0d0b5 100644
--- a/src/lib/subtitle.cc
+++ b/src/lib/subtitle.cc
@@ -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);
}
diff --git a/src/lib/subtitle.h b/src/lib/subtitle.h
index 38ba4e70e..e3a853695 100644
--- a/src/lib/subtitle.h
+++ b/src/lib/subtitle.h
@@ -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 */
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 2f8be6edd..b8b60c6f6 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -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);
diff --git a/src/lib/util.h b/src/lib/util.h
index d0c350a56..3e1d7f4b4 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -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);
diff --git a/src/tools/dvdomatic.cc b/src/tools/dvdomatic.cc
index ff1560f0e..e6d4471db 100644
--- a/src/tools/dvdomatic.cc
+++ b/src/tools/dvdomatic.cc
@@ -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 ();
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 82490e329..79642af9c 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -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()