diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-04-24 01:49:09 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-04-24 19:12:36 +0200 |
| commit | 401da185ca664fc8d819fc842ffc08e14d4f6486 (patch) | |
| tree | 5c2ea2d1a7b1b537c04e7e9b3d32c8a44080f168 /src/wx/kdm_timing_panel.cc | |
| parent | dbcd1675732d59f6337f7f60d0a39aaa6a1aa3a6 (diff) | |
Restore time zone to Cinema and improve UI to use it (#2473).
Diffstat (limited to 'src/wx/kdm_timing_panel.cc')
| -rw-r--r-- | src/wx/kdm_timing_panel.cc | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/wx/kdm_timing_panel.cc b/src/wx/kdm_timing_panel.cc index 6e362a3b2..c892c9d48 100644 --- a/src/wx/kdm_timing_panel.cc +++ b/src/wx/kdm_timing_panel.cc @@ -122,14 +122,10 @@ KDMTimingPanel::KDMTimingPanel (wxWindow* parent) _warning->SetFont(font); /* Default to UTC */ - size_t sel = get_offsets(_offsets); - for (size_t i = 0; i < _offsets.size(); ++i) { - _utc_offset->add_entry(_offsets[i].name); - if (_offsets[i].hour == 0 && _offsets[i].minute == 0) { - sel = i; - } + auto const sel = get_offsets(_offsets); + for (auto const& offset: _offsets) { + _utc_offset->add_entry(offset.name); } - _utc_offset->set(sel); /* I said I've been to the year 3000. Not much has changed but they live underwater. And your In-in-in-interop DCP @@ -142,7 +138,7 @@ KDMTimingPanel::KDMTimingPanel (wxWindow* parent) _until_date->Bind (wxEVT_DATE_CHANGED, bind (&KDMTimingPanel::changed, this)); _from_time->Changed.connect (bind (&KDMTimingPanel::changed, this)); _until_time->Changed.connect (bind (&KDMTimingPanel::changed, this)); - _utc_offset->bind(&KDMTimingPanel::changed, this); + _utc_offset->bind(&KDMTimingPanel::utc_offset_changed, this); SetSizer (overall_sizer); } @@ -205,10 +201,28 @@ KDMTimingPanel::utc_offset() const return {}; } - auto const& offset = _offsets[*sel]; - int const minute_scale = offset.hour < 0 ? -1 : 1; + return _offsets[*sel].offset; +} + - return { offset.hour, minute_scale * offset.minute }; +void +KDMTimingPanel::utc_offset_changed() +{ + _utc_offset_changed_once = true; + changed(); } +void +KDMTimingPanel::suggest_utc_offset(dcp::UTCOffset offset) +{ + if (!_utc_offset_changed_once) { + for (size_t i = 0; i < _offsets.size(); ++i) { + if (_offsets[i].offset == offset) { + _utc_offset->set(i); + break; + } + } + } +} + |
