Move some sync-related options to being session variables.
[ardour.git] / gtk2_ardour / session_option_editor.cc
1 #include "ardour/session.h"
2 #include "session_option_editor.h"
3 #include "i18n.h"
4
5 using namespace sigc;
6 using namespace ARDOUR;
7
8 SessionOptionEditor::SessionOptionEditor (Session* s)
9         : OptionEditor (&(s->config), _("Session Preferences")),
10           _session_config (&(s->config))
11 {
12         /* FADES */
13
14         ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> (
15                 "xfade-model",
16                 _("Crossfades are created"),
17                 mem_fun (*_session_config, &SessionConfiguration::get_xfade_model),
18                 mem_fun (*_session_config, &SessionConfiguration::set_xfade_model)
19                 );
20
21         cfm->add (FullCrossfade, _("to span entire overlap"));
22         cfm->add (ShortCrossfade, _("short"));
23
24         add_option (_("Fades"), cfm);
25
26         add_option (_("Fades"), new SpinOption<float> (
27                 _("short-xfade-seconds"),
28                 _("Short crossfade length"),
29                 mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds),
30                 mem_fun (*_session_config, &SessionConfiguration::set_short_xfade_seconds),
31                 0, 1000, 1, 10,
32                 _("ms"), 0.001
33                             ));
34
35         add_option (_("Fades"), new SpinOption<float> (
36                 _("destructive-xfade-seconds"),
37                 _("Destructive crossfade length"),
38                 mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs),
39                 mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs),
40                 0, 1000, 1, 10,
41                 _("ms")
42                             ));
43
44         add_option (_("Fades"), new BoolOption (
45                             "auto-xfade",
46                             _("Create crossfades automatically"),
47                             mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade),
48                             mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade)
49                             ));
50
51         add_option (_("Fades"), new BoolOption (
52                             "xfades-active",
53                             _("Crossfades active"),
54                             mem_fun (*_session_config, &SessionConfiguration::get_xfades_active),
55                             mem_fun (*_session_config, &SessionConfiguration::set_xfades_active)
56                             ));
57
58         add_option (_("Fades"), new BoolOption (
59                             "xfades-visible",
60                             _("Crossfades visible"),
61                             mem_fun (*_session_config, &SessionConfiguration::get_xfades_visible),
62                             mem_fun (*_session_config, &SessionConfiguration::set_xfades_visible)
63                             ));
64
65         add_option (_("Fades"), new BoolOption (
66                             "use-region-fades",
67                             _("Region fades active"),
68                             mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades),
69                             mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades)
70                             ));
71
72         add_option (_("Fades"), new BoolOption (
73                             "show-region-fades",
74                             _("Region fades visible"),
75                             mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades),
76                             mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades)
77                             ));
78
79         /* SYNC */
80
81         ComboOption<uint32_t>* spf = new ComboOption<uint32_t> (
82                 "subframes-per-frame",
83                 _("Subframes per frame"),
84                 mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame),
85                 mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame)
86                 );
87
88         spf->add (80, _("80"));
89         spf->add (100, _("100"));
90
91         add_option (_("Sync"), spf);
92
93         ComboOption<SmpteFormat>* smf = new ComboOption<SmpteFormat> (
94                 "smpte-format",
95                 _("Timecode frames-per-second"),
96                 mem_fun (*_session_config, &SessionConfiguration::get_smpte_format),
97                 mem_fun (*_session_config, &SessionConfiguration::set_smpte_format)
98                 );
99
100         smf->add (smpte_23976, _("23.976"));
101         smf->add (smpte_24, _("24"));
102         smf->add (smpte_24976, _("24.976"));
103         smf->add (smpte_25, _("25"));
104         smf->add (smpte_2997, _("29.97"));
105         smf->add (smpte_2997drop, _("29.97 drop"));
106         smf->add (smpte_30, _("30"));
107         smf->add (smpte_30drop, _("30 drop"));
108         smf->add (smpte_5994, _("59.94"));
109         smf->add (smpte_60, _("60"));
110
111         add_option (_("Sync"), smf);
112                 
113         add_option (_("Sync"), new BoolOption (
114                             "timecode-source-is-synced",
115                             _("Timecode source is synced"),
116                             mem_fun (*_session_config, &SessionConfiguration::get_timecode_source_is_synced),
117                             mem_fun (*_session_config, &SessionConfiguration::set_timecode_source_is_synced)
118                             ));
119
120         ComboOption<float>* vpu = new ComboOption<float> (
121                 "video-pullup",
122                 _("Pull-up / pull-down"),
123                 mem_fun (*_session_config, &SessionConfiguration::get_video_pullup),
124                 mem_fun (*_session_config, &SessionConfiguration::set_video_pullup)
125                 );
126
127         vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%"));
128         vpu->add (4.1667, _("4.1667"));
129         vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%"));
130         vpu->add (0.1, _("0.1"));
131         vpu->add (0, _("none"));
132         vpu->add (-0.1, _("-0.1"));
133         vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%"));
134         vpu->add (-4.1667, _("-4.1667"));
135         vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%"));
136                 
137         add_option (_("Sync"), vpu);
138         
139         /* MISC */
140
141         add_option (_("Misc"), new OptionEditorHeading (_("Audio file format")));
142
143         ComboOption<SampleFormat>* sf = new ComboOption<SampleFormat> (
144                 "native-file-data-format",
145                 _("Sample format"),
146                 mem_fun (*_session_config, &SessionConfiguration::get_native_file_data_format),
147                 mem_fun (*_session_config, &SessionConfiguration::set_native_file_data_format)
148                 );
149
150         sf->add (FormatFloat, _("32-bit floating point"));
151         sf->add (FormatInt24, _("24-bit integer"));
152         sf->add (FormatInt16, _("16-bit integer"));
153
154         add_option (_("Misc"), sf);
155
156         ComboOption<HeaderFormat>* hf = new ComboOption<HeaderFormat> (
157                 "native-file-header-format",
158                 _("File type"),
159                 mem_fun (*_session_config, &SessionConfiguration::get_native_file_header_format),
160                 mem_fun (*_session_config, &SessionConfiguration::set_native_file_header_format)
161                 );
162
163         hf->add (BWF, _("Broadcast WAVE"));
164         hf->add (WAVE, _("WAVE"));
165         hf->add (WAVE64, _("WAVE-64"));
166         hf->add (CAF, _("CAF"));
167
168         add_option (_("Misc"), hf);
169
170         add_option (_("Misc"), new OptionEditorHeading (_("Layering")));
171
172         ComboOption<LayerModel>* lm = new ComboOption<LayerModel> (
173                 "layer-model",
174                 _("Layering model"),
175                 mem_fun (*_session_config, &SessionConfiguration::get_layer_model),
176                 mem_fun (*_session_config, &SessionConfiguration::set_layer_model)
177                 );
178
179         lm->add (LaterHigher, _("later is higher"));
180         lm->add (MoveAddHigher, _("most recently moved or added is higher"));
181         lm->add (AddHigher, _("most recently added is higher"));
182
183         add_option (_("Misc"), lm);
184         
185         add_option (_("Misc"), new OptionEditorHeading (_("Broadcast WAVE metadata")));
186         
187         add_option (_("Misc"), new EntryOption (
188                             "bwf-country-code",
189                             _("Country code"),
190                             mem_fun (*_session_config, &SessionConfiguration::get_bwf_country_code),
191                             mem_fun (*_session_config, &SessionConfiguration::set_bwf_country_code)
192                             ));
193
194         add_option (_("Misc"), new EntryOption (
195                             "bwf-organization-code",
196                             _("Organization code"),
197                             mem_fun (*_session_config, &SessionConfiguration::get_bwf_organization_code),
198                             mem_fun (*_session_config, &SessionConfiguration::set_bwf_organization_code)
199                             ));
200 }