+ } catch (dcp::NotEncryptedError& e) {
+ error_dialog (this, _("CPL's content is not encrypted."));
+ } catch (exception& e) {
+ error_dialog (this, e.what ());
+ } catch (...) {
+ error_dialog (this, _("An unknown exception occurred."));
+ }
+ }
+
+ void setup_sensitivity ()
+ {
+ _screens->setup_sensitivity ();
+ _output->setup_sensitivity ();
+ _create->Enable (!_screens->screens().empty() && _dkdm->selection());
+ }
+
+ wxPreferencesEditor* _config_dialog;
+ ScreensPanel* _screens;
+ KDMTimingPanel* _timing;
+ EditableList<dcp::EncryptedKDM, KDMFileDialogWrapper>* _dkdm;
+ wxButton* _create;
+ KDMOutputPanel* _output;
+ JobViewDialog* _job_view;
+};
+
+/** @class App
+ * @brief The magic App class for wxWidgets.
+ */
+class App : public wxApp
+{
+public:
+ App ()
+ : wxApp ()
+ , _frame (0)
+ {}
+
+private:
+
+ bool OnInit ()
+ try
+ {
+ wxInitAllImageHandlers ();
+
+ SetAppName (_("DCP-o-matic KDM creator"));
+
+ if (!wxApp::OnInit()) {
+ return false;
+ }
+
+#ifdef DCPOMATIC_LINUX
+ unsetenv ("UBUNTU_MENUPROXY");
+#endif
+
+#ifdef __WXOSX__
+ ProcessSerialNumber serial;
+ GetCurrentProcess (&serial);
+ TransformProcessType (&serial, kProcessTransformToForegroundApplication);
+#endif
+
+ dcpomatic_setup_path_encoding ();
+
+ /* Enable i18n; this will create a Config object
+ to look for a force-configured language. This Config
+ object will be wrong, however, because dcpomatic_setup
+ hasn't yet been called and there aren't any filters etc.
+ set up yet.
+ */
+ dcpomatic_setup_i18n ();
+
+ /* Set things up, including filters etc.
+ which will now be internationalised correctly.
+ */
+ dcpomatic_setup ();
+
+ /* Force the configuration to be re-loaded correctly next
+ time it is needed.
+ */
+ Config::drop ();
+
+ _frame = new DOMFrame (_("DCP-o-matic KDM creator"));
+ SetTopWindow (_frame);
+ _frame->Maximize ();
+ _frame->Show ();
+
+ signal_manager = new wxSignalManager (this);
+ Bind (wxEVT_IDLE, boost::bind (&App::idle, this));
+
+ return true;
+ }
+ catch (exception& e)
+ {
+ error_dialog (0, wxString::Format ("DCP-o-matic could not start: %s", e.what ()));
+ return true;
+ }
+
+ /* An unhandled exception has occurred inside the main event loop */
+ bool OnExceptionInMainLoop ()
+ {
+ try {
+ throw;