Fix strange job status layout on OS X.
[dcpomatic.git] / src / wx / job_manager_view.cc
index 729dbc3adbfcfd528befcc6635cb50f759cd81e9..1b809edeccec09c6adbc78c953141647b8b98708 100644 (file)
  *  @brief Class generating a GTK widget to show the progress of jobs.
  */
 
+#include "job_manager_view.h"
+#include "wx_util.h"
 #include "lib/job_manager.h"
 #include "lib/job.h"
 #include "lib/util.h"
 #include "lib/exceptions.h"
-#include "job_manager_view.h"
-#include "wx_util.h"
+#include "lib/compose.hpp"
+#include <iostream>
 
 using std::string;
 using std::list;
@@ -46,14 +48,14 @@ public:
        {
                int n = 0;
 
-               wxBoxSizer* gauge_message = new wxBoxSizer (wxVERTICAL);
+               _gauge_message = new wxBoxSizer (wxVERTICAL);
                _gauge = new wxGauge (panel, wxID_ANY, 100);
                /* This seems to be required to allow the gauge to shrink under OS X */
                _gauge->SetMinSize (wxSize (0, -1));
-               gauge_message->Add (_gauge, 0, wxEXPAND | wxLEFT | wxRIGHT);
+               _gauge_message->Add (_gauge, 0, wxEXPAND | wxLEFT | wxRIGHT);
                _message = new wxStaticText (panel, wxID_ANY, wxT (" \n "));
-               gauge_message->Add (_message, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6);
-               table->Insert (n, gauge_message, 1, wxEXPAND | wxLEFT | wxRIGHT);
+               _gauge_message->Add (_message, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6);
+               table->Insert (n, _gauge_message, 1, wxEXPAND | wxLEFT | wxRIGHT);
                ++n;
 
                _cancel = new wxButton (panel, wxID_ANY, _("Cancel"));
@@ -75,6 +77,8 @@ public:
                _progress_connection = job->Progress.connect (boost::bind (&JobRecord::progress, this));
                _finished_connection = job->Finished.connect (boost::bind (&JobRecord::finished, this));
 
+               progress ();
+
                table->Layout ();
        }
 
@@ -95,7 +99,8 @@ private:
                }
                whole += _job->status ();
                if (whole != _last_message) {
-                       _message->SetLabelMarkup (whole);
+                       _message->SetLabelMarkup (std_to_wx (whole));
+                       _gauge_message->Layout ();
                        _last_message = whole;
                }
                if (_job->progress ()) {
@@ -144,6 +149,7 @@ private:
        boost::shared_ptr<Job> _job;
        wxScrolledWindow* _window;
        wxPanel* _panel;
+       wxBoxSizer* _gauge_message;
        wxGauge* _gauge;
        wxStaticText* _message;
        wxButton* _cancel;