diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-09-02 22:09:33 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-09-02 22:09:33 +0100 |
| commit | 8407612363705f757d3ab26d6e119171c217b00a (patch) | |
| tree | 96c5e07733656a8df6f0e660a828b1765110297f /src/tools | |
| parent | e50e596448d17f32652a8215a01ae62a32c9afea (diff) | |
Seemingly rather long-winded way of making the JobManagerView in
dcpomatic_batch shrink nicely (i.e. shrinking the gauge) when the
window is shrunk. It seems surprising that we have to call back
to children to tell them to layout / fit-inside, but it does all
*seem* to be necessary.
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/dcpomatic_batch.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index 234bfea5c..de255e65e 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -62,6 +62,7 @@ class Frame : public wxFrame public: Frame (wxString const & title) : wxFrame (NULL, -1, title) + , _sizer (new wxBoxSizer (wxVERTICAL)) { wxMenuBar* bar = new wxMenuBar; setup_menu (bar); @@ -76,24 +77,29 @@ public: s->Add (panel, 1, wxEXPAND); SetSizer (s); - wxSizer* sizer = new wxBoxSizer (wxVERTICAL); - JobManagerView* job_manager_view = new JobManagerView (panel, JobManagerView::PAUSE); - sizer->Add (job_manager_view, 1, wxALL | wxEXPAND, 6); + _sizer->Add (job_manager_view, 1, wxALL | wxEXPAND, 6); wxSizer* buttons = new wxBoxSizer (wxHORIZONTAL); wxButton* add = new wxButton (panel, wxID_ANY, _("Add Film...")); add->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&Frame::add_film, this)); buttons->Add (add, 1, wxALL, 6); - sizer->Add (buttons, 0, wxALL, 6); + _sizer->Add (buttons, 0, wxALL, 6); - panel->SetSizer (sizer); + panel->SetSizer (_sizer); Bind (wxEVT_CLOSE_WINDOW, boost::bind (&Frame::close, this, _1)); + Bind (wxEVT_SIZE, boost::bind (&Frame::sized, this, _1)); } private: + void sized (wxSizeEvent& ev) + { + _sizer->Layout (); + ev.Skip (); + } + bool should_close () { if (!JobManager::instance()->work_to_do ()) { @@ -176,6 +182,7 @@ private: } boost::optional<boost::filesystem::path> _last_parent; + wxSizer* _sizer; }; static const wxCmdLineEntryDesc command_line_description[] = { |
