2011-06-03 18:18:47 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2012-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2016-2017 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2011-06-03 18:18:47 -04:00
|
|
|
|
2011-06-08 09:44:18 -04:00
|
|
|
#include <algorithm>
|
2011-06-03 18:18:47 -04:00
|
|
|
#include "pbd/compose.h"
|
|
|
|
|
|
|
|
#include "gtkmm2ext/gui_thread.h"
|
|
|
|
#include "gtkmm2ext/utils.h"
|
2011-06-08 15:48:57 -04:00
|
|
|
#include "gtkmm2ext/actions.h"
|
2011-06-03 18:18:47 -04:00
|
|
|
|
|
|
|
#include "ardour/location.h"
|
2014-04-10 13:30:25 -04:00
|
|
|
#include "ardour/profile.h"
|
2011-06-03 18:18:47 -04:00
|
|
|
#include "ardour/session.h"
|
|
|
|
|
|
|
|
#include "audio_clock.h"
|
2012-04-22 10:03:07 -04:00
|
|
|
#include "automation_line.h"
|
2017-06-16 14:08:56 -04:00
|
|
|
#include "control_point.h"
|
|
|
|
#include "editor.h"
|
|
|
|
#include "region_view.h"
|
|
|
|
#include "time_info_box.h"
|
2011-06-03 18:18:47 -04:00
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2011-06-03 18:18:47 -04:00
|
|
|
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace ARDOUR;
|
2011-06-08 09:44:18 -04:00
|
|
|
using std::min;
|
|
|
|
using std::max;
|
2011-06-03 18:18:47 -04:00
|
|
|
|
2017-03-10 14:39:46 -05:00
|
|
|
TimeInfoBox::TimeInfoBox (std::string state_node_name, bool with_punch)
|
2016-12-19 21:10:05 -05:00
|
|
|
: table (3, 3)
|
|
|
|
, punch_start (0)
|
|
|
|
, punch_end (0)
|
2011-06-07 13:40:05 -04:00
|
|
|
, syncing_selection (false)
|
|
|
|
, syncing_punch (false)
|
2016-12-19 21:10:05 -05:00
|
|
|
, with_punch_clock (with_punch)
|
2011-06-03 18:18:47 -04:00
|
|
|
{
|
2012-11-11 11:04:30 -05:00
|
|
|
set_name (X_("TimeInfoBox"));
|
|
|
|
|
2017-03-10 14:39:46 -05:00
|
|
|
selection_start = new AudioClock (
|
|
|
|
string_compose ("%1-selection-start", state_node_name),
|
|
|
|
false, "selection", false, false, false, false);
|
|
|
|
selection_end = new AudioClock (
|
|
|
|
string_compose ("%1-selection-end", state_node_name),
|
|
|
|
false, "selection", false, false, false, false);
|
|
|
|
selection_length = new AudioClock (
|
|
|
|
string_compose ("%1-selection-length", state_node_name),
|
|
|
|
false, "selection", false, false, true, false);
|
2011-06-03 18:18:47 -04:00
|
|
|
|
2011-06-08 13:27:26 -04:00
|
|
|
selection_title.set_text (_("Selection"));
|
2011-06-03 18:18:47 -04:00
|
|
|
|
|
|
|
set_homogeneous (false);
|
2013-03-03 06:36:35 -05:00
|
|
|
set_spacing (0);
|
2011-06-07 12:42:48 -04:00
|
|
|
set_border_width (2);
|
|
|
|
|
2016-12-11 11:24:30 -05:00
|
|
|
pack_start (table, false, false);
|
2011-06-08 19:03:06 -04:00
|
|
|
|
2016-12-11 11:24:30 -05:00
|
|
|
table.set_homogeneous (false);
|
|
|
|
table.set_spacings (0);
|
|
|
|
table.set_border_width (2);
|
|
|
|
table.set_col_spacings (2);
|
2011-06-08 19:03:06 -04:00
|
|
|
|
2011-06-03 18:18:47 -04:00
|
|
|
Gtk::Label* l;
|
|
|
|
|
2011-06-08 13:27:26 -04:00
|
|
|
selection_title.set_name ("TimeInfoSelectionTitle");
|
2016-12-19 21:10:05 -05:00
|
|
|
if (with_punch_clock) {
|
|
|
|
table.attach (selection_title, 1, 2, 0, 1);
|
|
|
|
}
|
2011-06-03 18:18:47 -04:00
|
|
|
l = manage (new Label);
|
2011-06-08 13:27:26 -04:00
|
|
|
l->set_text (_("Start"));
|
|
|
|
l->set_alignment (1.0, 0.5);
|
|
|
|
l->set_name (X_("TimeInfoSelectionLabel"));
|
2016-12-11 11:24:30 -05:00
|
|
|
table.attach (*l, 0, 1, 1, 2, FILL);
|
|
|
|
table.attach (*selection_start, 1, 2, 1, 2);
|
2011-06-08 13:27:26 -04:00
|
|
|
|
2011-06-03 18:18:47 -04:00
|
|
|
l = manage (new Label);
|
2011-06-08 13:27:26 -04:00
|
|
|
l->set_text (_("End"));
|
|
|
|
l->set_alignment (1.0, 0.5);
|
|
|
|
l->set_name (X_("TimeInfoSelectionLabel"));
|
2016-12-11 11:24:30 -05:00
|
|
|
table.attach (*l, 0, 1, 2, 3, FILL);
|
|
|
|
table.attach (*selection_end, 1, 2, 2, 3);
|
2011-06-08 13:27:26 -04:00
|
|
|
|
2011-06-03 18:18:47 -04:00
|
|
|
l = manage (new Label);
|
2011-06-08 13:27:26 -04:00
|
|
|
l->set_text (_("Length"));
|
|
|
|
l->set_alignment (1.0, 0.5);
|
|
|
|
l->set_name (X_("TimeInfoSelectionLabel"));
|
2016-12-11 11:24:30 -05:00
|
|
|
table.attach (*l, 0, 1, 3, 4, FILL);
|
|
|
|
table.attach (*selection_length, 1, 2, 3, 4);
|
2011-06-08 15:48:57 -04:00
|
|
|
|
2016-12-19 21:10:05 -05:00
|
|
|
if (with_punch_clock) {
|
2017-03-10 14:39:46 -05:00
|
|
|
punch_start = new AudioClock (
|
|
|
|
string_compose ("%1-punch-start", state_node_name),
|
|
|
|
false, "punch", false, false, false, false);
|
|
|
|
punch_end = new AudioClock (
|
|
|
|
string_compose ("%1-punch-end", state_node_name),
|
|
|
|
false, "punch", false, false, false, false);
|
2016-12-19 21:10:05 -05:00
|
|
|
punch_title.set_text (_("Punch"));
|
|
|
|
|
|
|
|
punch_title.set_name ("TimeInfoSelectionTitle");
|
|
|
|
table.attach (punch_title, 2, 3, 0, 1);
|
|
|
|
table.attach (*punch_start, 2, 3, 1, 2);
|
|
|
|
table.attach (*punch_end, 2, 3, 2, 3);
|
|
|
|
}
|
2011-06-08 15:48:57 -04:00
|
|
|
|
2016-12-11 11:24:30 -05:00
|
|
|
show_all ();
|
2011-06-03 18:18:47 -04:00
|
|
|
|
2011-06-07 13:40:05 -04:00
|
|
|
selection_start->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_selection_mode), selection_start));
|
2011-06-08 09:44:18 -04:00
|
|
|
selection_end->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_selection_mode), selection_end));
|
|
|
|
selection_length->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_selection_mode), selection_length));
|
2011-06-07 13:40:05 -04:00
|
|
|
|
2011-06-07 14:20:22 -04:00
|
|
|
selection_start->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::clock_button_release_event), selection_start), true);
|
|
|
|
selection_end->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::clock_button_release_event), selection_end), true);
|
|
|
|
|
2016-12-19 21:10:05 -05:00
|
|
|
if (with_punch_clock) {
|
|
|
|
punch_start->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_punch_mode), punch_start));
|
|
|
|
punch_end->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_punch_mode), punch_end));
|
|
|
|
|
|
|
|
punch_start->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::clock_button_release_event), punch_start), true);
|
|
|
|
punch_end->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::clock_button_release_event), punch_end), true);
|
|
|
|
}
|
2011-06-07 14:20:22 -04:00
|
|
|
|
2011-06-03 18:18:47 -04:00
|
|
|
Editor::instance().get_selection().TimeChanged.connect (sigc::mem_fun (*this, &TimeInfoBox::selection_changed));
|
2011-06-07 19:07:08 -04:00
|
|
|
Editor::instance().get_selection().RegionsChanged.connect (sigc::mem_fun (*this, &TimeInfoBox::selection_changed));
|
|
|
|
|
2012-04-25 08:58:19 -04:00
|
|
|
Editor::instance().MouseModeChanged.connect (editor_connections, invalidator(*this), boost::bind (&TimeInfoBox::track_mouse_mode, this), gui_context());
|
2011-06-03 18:18:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
TimeInfoBox::~TimeInfoBox ()
|
|
|
|
{
|
2016-12-11 11:24:30 -05:00
|
|
|
delete selection_length;
|
|
|
|
delete selection_end;
|
|
|
|
delete selection_start;
|
2015-10-04 14:51:05 -04:00
|
|
|
|
2016-12-11 11:24:30 -05:00
|
|
|
delete punch_start;
|
|
|
|
delete punch_end;
|
2011-06-03 18:18:47 -04:00
|
|
|
}
|
|
|
|
|
2011-06-07 19:07:08 -04:00
|
|
|
void
|
|
|
|
TimeInfoBox::track_mouse_mode ()
|
|
|
|
{
|
|
|
|
selection_changed ();
|
|
|
|
}
|
|
|
|
|
2011-06-07 14:20:22 -04:00
|
|
|
bool
|
|
|
|
TimeInfoBox::clock_button_release_event (GdkEventButton* ev, AudioClock* src)
|
|
|
|
{
|
|
|
|
if (!_session) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ev->button == 1) {
|
2011-11-20 11:38:51 -05:00
|
|
|
if (!src->off()) {
|
2022-11-14 09:52:15 -05:00
|
|
|
_session->request_locate (src->last_when ().samples());
|
2011-11-20 11:38:51 -05:00
|
|
|
}
|
2011-06-07 14:20:22 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-06-07 13:40:05 -04:00
|
|
|
void
|
|
|
|
TimeInfoBox::sync_selection_mode (AudioClock* src)
|
|
|
|
{
|
|
|
|
if (!syncing_selection) {
|
|
|
|
syncing_selection = true;
|
|
|
|
selection_start->set_mode (src->mode());
|
|
|
|
selection_end->set_mode (src->mode());
|
|
|
|
selection_length->set_mode (src->mode());
|
|
|
|
syncing_selection = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TimeInfoBox::sync_punch_mode (AudioClock* src)
|
|
|
|
{
|
2016-12-19 21:10:05 -05:00
|
|
|
if (!with_punch_clock) {
|
|
|
|
return;
|
|
|
|
}
|
2011-06-07 13:40:05 -04:00
|
|
|
if (!syncing_punch) {
|
|
|
|
syncing_punch = true;
|
|
|
|
punch_start->set_mode (src->mode());
|
|
|
|
punch_end->set_mode (src->mode());
|
|
|
|
syncing_punch = false;
|
|
|
|
}
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-06-07 13:40:05 -04:00
|
|
|
|
2011-06-03 18:18:47 -04:00
|
|
|
void
|
|
|
|
TimeInfoBox::set_session (Session* s)
|
|
|
|
{
|
|
|
|
SessionHandlePtr::set_session (s);
|
|
|
|
|
|
|
|
selection_start->set_session (s);
|
|
|
|
selection_end->set_session (s);
|
|
|
|
selection_length->set_session (s);
|
|
|
|
|
2016-12-19 21:10:05 -05:00
|
|
|
if (!with_punch_clock) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-06-03 18:18:47 -04:00
|
|
|
punch_start->set_session (s);
|
|
|
|
punch_end->set_session (s);
|
|
|
|
|
|
|
|
if (s) {
|
|
|
|
Location* punch = s->locations()->auto_punch_location ();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-06-03 18:18:47 -04:00
|
|
|
if (punch) {
|
|
|
|
watch_punch (punch);
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-06-08 13:27:26 -04:00
|
|
|
punch_changed (punch);
|
|
|
|
|
2015-10-04 14:51:05 -04:00
|
|
|
_session->auto_punch_location_changed.connect (_session_connections, MISSING_INVALIDATOR,
|
2016-12-19 21:10:05 -05:00
|
|
|
boost::bind (&TimeInfoBox::punch_location_changed, this, _1), gui_context());
|
2011-06-03 18:18:47 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-16 14:08:56 -04:00
|
|
|
void
|
|
|
|
TimeInfoBox::region_selection_changed ()
|
|
|
|
{
|
2020-09-26 11:14:59 -04:00
|
|
|
timepos_t s, e;
|
2017-06-16 14:08:56 -04:00
|
|
|
Selection& selection (Editor::instance().get_selection());
|
2020-09-26 11:14:59 -04:00
|
|
|
s = selection.regions.start_time();
|
2020-10-01 12:32:06 -04:00
|
|
|
e = selection.regions.end_time();
|
2017-06-16 14:08:56 -04:00
|
|
|
selection_start->set_off (false);
|
|
|
|
selection_end->set_off (false);
|
|
|
|
selection_length->set_off (false);
|
2020-10-01 12:32:06 -04:00
|
|
|
selection_start->set (s);
|
2022-12-10 11:41:08 -05:00
|
|
|
selection_end->set (e);
|
|
|
|
selection_length->set_duration (s.distance (e).increment(), true);
|
2017-06-16 14:08:56 -04:00
|
|
|
}
|
|
|
|
|
2011-06-03 18:18:47 -04:00
|
|
|
void
|
|
|
|
TimeInfoBox::selection_changed ()
|
|
|
|
{
|
2020-10-02 23:26:17 -04:00
|
|
|
timepos_t s, e;
|
2011-06-08 09:22:40 -04:00
|
|
|
Selection& selection (Editor::instance().get_selection());
|
2011-06-07 19:07:08 -04:00
|
|
|
|
2017-06-16 14:08:56 -04:00
|
|
|
region_property_connections.drop_connections();
|
|
|
|
|
2011-06-07 19:07:08 -04:00
|
|
|
switch (Editor::instance().current_mouse_mode()) {
|
2011-06-08 09:44:18 -04:00
|
|
|
|
2014-12-08 23:00:00 -05:00
|
|
|
case Editing::MouseContent:
|
|
|
|
/* displaying MIDI note selection is tricky */
|
|
|
|
selection_start->set_off (true);
|
|
|
|
selection_end->set_off (true);
|
|
|
|
selection_length->set_off (true);
|
|
|
|
break;
|
|
|
|
|
2011-06-07 19:07:08 -04:00
|
|
|
case Editing::MouseObject:
|
2014-12-08 23:00:00 -05:00
|
|
|
if (selection.regions.empty()) {
|
|
|
|
if (selection.points.empty()) {
|
2023-09-07 15:24:23 -04:00
|
|
|
if (!selection.time.empty()) {
|
2014-12-08 23:00:00 -05:00
|
|
|
/* show selected range */
|
2011-06-08 09:44:18 -04:00
|
|
|
selection_start->set_off (false);
|
|
|
|
selection_end->set_off (false);
|
|
|
|
selection_length->set_off (false);
|
2020-10-01 12:32:06 -04:00
|
|
|
selection_start->set (selection.time.start_time());
|
2022-10-07 19:30:45 -04:00
|
|
|
selection_end->set (selection.time.end_time().decrement());
|
2020-09-26 11:14:59 -04:00
|
|
|
selection_length->set_duration (selection.time.start_time().distance (selection.time.end_time()));
|
2014-12-08 23:00:00 -05:00
|
|
|
} else {
|
|
|
|
selection_start->set_off (true);
|
|
|
|
selection_end->set_off (true);
|
|
|
|
selection_length->set_off (true);
|
2011-06-08 09:44:18 -04:00
|
|
|
}
|
|
|
|
} else {
|
2020-10-02 23:26:17 -04:00
|
|
|
s = timepos_t::max (selection.points.front()->line().the_list()->time_domain());
|
|
|
|
e = timepos_t::zero (s.time_domain());
|
2022-08-11 15:36:46 -04:00
|
|
|
for (auto const & pt : selection.points) {
|
|
|
|
const timepos_t p = pt->line().session_position ((*pt->model ())->when);
|
2014-12-08 23:00:00 -05:00
|
|
|
s = min (s, p);
|
|
|
|
e = max (e, p);
|
|
|
|
}
|
2011-06-08 09:44:18 -04:00
|
|
|
selection_start->set_off (false);
|
|
|
|
selection_end->set_off (false);
|
|
|
|
selection_length->set_off (false);
|
|
|
|
selection_start->set (s);
|
2022-10-07 19:30:45 -04:00
|
|
|
selection_end->set (e.decrement());
|
2022-10-07 18:12:27 -04:00
|
|
|
selection_length->set_duration (s.distance (e), false);
|
2011-06-08 09:44:18 -04:00
|
|
|
}
|
2014-12-08 23:00:00 -05:00
|
|
|
} else {
|
2017-06-16 14:08:56 -04:00
|
|
|
/* this is more efficient than tracking changes per region in large selections */
|
2023-04-05 20:12:10 -04:00
|
|
|
PlaylistSet playlists;
|
2017-06-16 14:08:56 -04:00
|
|
|
for (RegionSelection::iterator s = selection.regions.begin(); s != selection.regions.end(); ++s) {
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Playlist> pl = (*s)->region()->playlist();
|
2017-06-16 14:08:56 -04:00
|
|
|
if (pl) {
|
|
|
|
playlists.insert (pl);
|
|
|
|
}
|
|
|
|
}
|
2023-04-05 20:12:10 -04:00
|
|
|
for (PlaylistSet::iterator ps = playlists.begin(); ps != playlists.end(); ++ps) {
|
2017-06-16 14:08:56 -04:00
|
|
|
(*ps)->ContentsChanged.connect (region_property_connections, invalidator (*this),
|
|
|
|
boost::bind (&TimeInfoBox::region_selection_changed, this), gui_context());
|
|
|
|
}
|
|
|
|
region_selection_changed ();
|
2011-06-08 09:22:40 -04:00
|
|
|
}
|
2011-06-07 19:07:08 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Editing::MouseRange:
|
2011-06-08 09:22:40 -04:00
|
|
|
if (selection.time.empty()) {
|
2019-02-28 17:54:42 -05:00
|
|
|
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action ("MouseMode", "set-mouse-mode-object-range");
|
2012-01-27 14:05:03 -05:00
|
|
|
|
2019-02-28 17:54:42 -05:00
|
|
|
if (tact->get_active() && !selection.regions.empty()) {
|
2012-01-27 14:05:03 -05:00
|
|
|
/* show selected regions */
|
2020-10-02 23:26:17 -04:00
|
|
|
s = selection.regions.start_time();
|
|
|
|
e = selection.regions.end_time();
|
2012-01-27 14:05:03 -05:00
|
|
|
selection_start->set_off (false);
|
|
|
|
selection_end->set_off (false);
|
|
|
|
selection_length->set_off (false);
|
|
|
|
selection_start->set (s);
|
2022-10-07 19:30:45 -04:00
|
|
|
selection_end->set (e.decrement());
|
2022-10-07 18:12:27 -04:00
|
|
|
selection_length->set_duration(s.distance (e));
|
2012-01-27 14:05:03 -05:00
|
|
|
} else {
|
|
|
|
selection_start->set_off (true);
|
|
|
|
selection_end->set_off (true);
|
|
|
|
selection_length->set_off (true);
|
|
|
|
}
|
2011-06-08 09:22:40 -04:00
|
|
|
} else {
|
|
|
|
selection_start->set_off (false);
|
|
|
|
selection_end->set_off (false);
|
|
|
|
selection_length->set_off (false);
|
2020-10-01 12:32:06 -04:00
|
|
|
selection_start->set (selection.time.start_time());
|
2022-10-07 19:30:45 -04:00
|
|
|
selection_end->set (selection.time.end_time().decrement());
|
2022-10-07 18:12:27 -04:00
|
|
|
selection_length->set_duration (selection.time.length());
|
2011-06-08 09:22:40 -04:00
|
|
|
}
|
2011-06-07 19:07:08 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
selection_start->set_off (true);
|
|
|
|
selection_end->set_off (true);
|
2015-10-05 10:17:49 -04:00
|
|
|
selection_length->set_off (true);
|
2011-06-07 19:07:08 -04:00
|
|
|
break;
|
|
|
|
}
|
2011-06-03 18:18:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TimeInfoBox::punch_location_changed (Location* loc)
|
|
|
|
{
|
2016-12-19 21:10:05 -05:00
|
|
|
if (loc && with_punch_clock) {
|
2011-06-03 18:18:47 -04:00
|
|
|
watch_punch (loc);
|
2015-10-04 14:51:05 -04:00
|
|
|
}
|
2011-06-03 18:18:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TimeInfoBox::watch_punch (Location* punch)
|
|
|
|
{
|
2016-12-19 21:10:05 -05:00
|
|
|
assert (with_punch_clock);
|
2011-06-03 18:18:47 -04:00
|
|
|
punch_connections.drop_connections ();
|
|
|
|
|
|
|
|
punch->start_changed.connect (punch_connections, MISSING_INVALIDATOR, boost::bind (&TimeInfoBox::punch_changed, this, _1), gui_context());
|
|
|
|
punch->end_changed.connect (punch_connections, MISSING_INVALIDATOR, boost::bind (&TimeInfoBox::punch_changed, this, _1), gui_context());
|
|
|
|
|
|
|
|
punch_changed (punch);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TimeInfoBox::punch_changed (Location* loc)
|
|
|
|
{
|
2016-12-19 21:10:05 -05:00
|
|
|
assert (with_punch_clock);
|
2011-06-03 18:18:47 -04:00
|
|
|
if (!loc) {
|
2011-06-08 13:27:26 -04:00
|
|
|
punch_start->set_off (true);
|
|
|
|
punch_end->set_off (true);
|
2011-06-03 18:18:47 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-06-08 13:27:26 -04:00
|
|
|
punch_start->set_off (false);
|
|
|
|
punch_end->set_off (false);
|
|
|
|
|
2020-10-01 12:32:06 -04:00
|
|
|
punch_start->set (loc->start());
|
|
|
|
punch_end->set (loc->end());
|
2015-10-05 10:17:49 -04:00
|
|
|
}
|