Make default Disk Writer window a little narrower.
[dcpomatic.git] / src / tools / dcpomatic_batch.cc
index dc092bf8ca1c06976a769cbc128daf22a6e0fcc6..1e383b39a5ecdafc516532308c85fc0638f4acf0 100644 (file)
@@ -22,6 +22,7 @@
 #include "wx/about_dialog.h"
 #include "wx/dcpomatic_button.h"
 #include "wx/full_config_dialog.h"
+#include "wx/id.h"
 #include "wx/job_manager_view.h"
 #include "wx/servers_list_dialog.h"
 #include "wx/wx_ptr.h"
@@ -31,6 +32,9 @@
 #include "lib/config.h"
 #include "lib/dcpomatic_socket.h"
 #include "lib/film.h"
+#ifdef DCPOMATIC_GROK
+#include "lib/grok/context.h"
+#endif
 #include "lib/job.h"
 #include "lib/job_manager.h"
 #include "lib/make_dcp.h"
@@ -71,7 +75,7 @@ static list<boost::filesystem::path> films_to_load;
 
 
 enum {
-       ID_file_add_film = 1,
+       ID_file_add_film = DCPOMATIC_MAIN_MENU,
        ID_tools_encoding_servers,
        ID_help_about
 };
@@ -89,7 +93,7 @@ setup_menu (wxMenuBar* m)
 #endif
 
 #ifdef DCPOMATIC_OSX
-       file->Append (wxID_PREFERENCES, _("&Preferences...\tCtrl-P"));
+       file->Append(wxID_PREFERENCES, _("&Preferences...\tCtrl-,"));
 #else
        auto edit = new wxMenu;
        edit->Append (wxID_PREFERENCES, _("&Preferences...\tCtrl-P"));
@@ -288,6 +292,7 @@ private:
                }
 
                ev.Skip ();
+               JobManager::drop ();
        }
 
        void file_add_film ()
@@ -377,6 +382,12 @@ private:
                                        );
                        }
                }
+
+#ifdef DCPOMATIC_GROK
+               if (what == Config::GROK) {
+                       setup_grok_library_path();
+               }
+#endif
        }
 
        boost::optional<boost::filesystem::path> _last_parent;
@@ -402,12 +413,14 @@ public:
        void handle (shared_ptr<Socket> socket) override
        {
                try {
-                       int const length = socket->read_uint32 ();
-                       scoped_array<char> buffer(new char[length]);
-                       socket->read (reinterpret_cast<uint8_t*>(buffer.get()), length);
-                       string s (buffer.get());
-                       emit(boost::bind(boost::ref(StartJob), s));
-                       socket->write (reinterpret_cast<uint8_t const *>("OK"), 3);
+                       auto const length = socket->read_uint32();
+                       if (length < 65536) {
+                               scoped_array<char> buffer(new char[length]);
+                               socket->read(reinterpret_cast<uint8_t*>(buffer.get()), length);
+                               string s(buffer.get());
+                               emit(boost::bind(boost::ref(StartJob), s));
+                               socket->write (reinterpret_cast<uint8_t const *>("OK"), 3);
+                       }
                } catch (...) {
 
                }
@@ -495,6 +508,11 @@ class App : public wxApp
                        }
                }
 
+#ifdef DCPOMATIC_GROK
+               grk_plugin::setMessengerLogger(new grk_plugin::GrokLogger("[GROK] "));
+               setup_grok_library_path();
+#endif
+
                return true;
        }