Add basic quality option for x264 export.
[dcpomatic.git] / src / wx / table_dialog.cc
1 /*
2     Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #include "table_dialog.h"
22 #include "wx_util.h"
23
24 TableDialog::TableDialog (wxWindow* parent, wxString title, int columns, int growable, bool cancel)
25         : wxDialog (parent, wxID_ANY, title)
26 {
27         _overall_sizer = new wxBoxSizer (wxVERTICAL);
28         SetSizer (_overall_sizer);
29
30         _table = new wxFlexGridSizer (columns, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
31         _table->AddGrowableCol (growable, 1);
32
33         _overall_sizer->Add (_table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
34
35         long int flags = wxOK;
36         if (cancel) {
37                 flags |= wxCANCEL;
38         }
39
40         wxSizer* buttons = CreateSeparatedButtonSizer (flags);
41         if (buttons) {
42                 _overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
43         }
44 }
45
46 void
47 TableDialog::layout ()
48 {
49         _overall_sizer->Layout ();
50         _overall_sizer->SetSizeHints (this);
51 }
52
53 wxStaticText *
54 #ifdef DCPOMATIC_OSX
55 TableDialog::add (wxString text, bool label)
56 #else
57 TableDialog::add (wxString text, bool)
58 #endif
59 {
60         int flags = wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT;
61 #ifdef DCPOMATIC_OSX
62         if (label) {
63                 flags |= wxALIGN_RIGHT;
64                 text += wxT (":");
65         }
66 #endif
67         wxStaticText* m = new wxStaticText (this, wxID_ANY, wxT (""));
68         m->SetLabelMarkup (text);
69         _table->Add (m, 0, flags, 6);
70         return m;
71 }
72
73 void
74 TableDialog::add_spacer ()
75 {
76         _table->AddSpacer (0);
77 }