2012-05-31 19:14:03 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2015 Colin Fletcher <colin.m.fletcher@googlemail.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.
|
|
|
|
*/
|
2012-05-31 19:14:03 -04:00
|
|
|
|
2024-09-25 20:38:59 -04:00
|
|
|
#pragma once
|
2015-12-07 17:08:19 -05:00
|
|
|
|
2012-05-31 19:14:03 -04:00
|
|
|
#include "audio_clock.h"
|
|
|
|
|
2015-02-03 14:25:10 -05:00
|
|
|
/** A simple subclass of AudioClock that adds a few things to its context menu:
|
|
|
|
* `display delta to edit cursor' and edit/change tempo/meter
|
|
|
|
*/
|
2012-05-31 19:14:03 -04:00
|
|
|
class MainClock : public AudioClock
|
|
|
|
{
|
|
|
|
public:
|
2024-09-27 11:10:10 -04:00
|
|
|
enum ClockDisposition {
|
|
|
|
PrimaryClock,
|
|
|
|
SecondaryClock
|
|
|
|
};
|
|
|
|
|
|
|
|
MainClock (const std::string& clock_name, const std::string& widget_name, ClockDisposition d);
|
2016-12-11 11:24:30 -05:00
|
|
|
void set_session (ARDOUR::Session *s);
|
2024-09-27 11:10:10 -04:00
|
|
|
|
|
|
|
ARDOUR::ClockDeltaMode display_delta_mode () {return _delta_mode;}
|
2022-11-06 13:12:20 -05:00
|
|
|
void set_display_delta_mode (ARDOUR::ClockDeltaMode m);
|
2024-09-27 11:10:10 -04:00
|
|
|
|
2022-10-07 18:12:27 -04:00
|
|
|
void set (Temporal::timepos_t const &, bool force = false);
|
2022-11-18 06:08:18 -05:00
|
|
|
sigc::signal<bool, ARDOUR::ClockDeltaMode> change_display_delta_mode_signal;
|
2012-05-31 19:14:03 -04:00
|
|
|
|
2024-09-27 11:10:10 -04:00
|
|
|
sigc::signal<void> CanonicalClockChanged;
|
|
|
|
|
|
|
|
void clock_value_changed();
|
|
|
|
|
|
|
|
void parameter_changed (std::string p);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
ClockDisposition _disposition;
|
|
|
|
|
2012-05-31 19:14:03 -04:00
|
|
|
private:
|
|
|
|
void build_ops_menu ();
|
2022-11-19 18:48:29 -05:00
|
|
|
void change_display_delta_mode (ARDOUR::ClockDeltaMode);
|
2015-02-03 14:25:10 -05:00
|
|
|
void edit_current_tempo ();
|
|
|
|
void edit_current_meter ();
|
|
|
|
void insert_new_tempo ();
|
|
|
|
void insert_new_meter ();
|
2017-11-22 16:10:37 -05:00
|
|
|
bool _suspend_delta_mode_signal;
|
2022-11-06 13:12:20 -05:00
|
|
|
std::string _widget_name;
|
|
|
|
ARDOUR::ClockDeltaMode _delta_mode;
|
2012-05-31 19:14:03 -04:00
|
|
|
};
|
2015-12-07 17:08:19 -05:00
|
|
|
|
2024-09-27 11:10:10 -04:00
|
|
|
/** TransportClock is a clock widget that reflects the state of the canonical MainClocks in ARDOUR_UI (either Primary or Secondary)
|
|
|
|
* there are multiple Primary and Secondary clock widgets, but from the user's perspective they all represent the "same clock"
|
|
|
|
* The current position, display mode, and 'delta mode' are globally shared across Primary and Secondary clocks.
|
|
|
|
* Other state, such as the editing/text-entry state, remains per-widget.
|
|
|
|
*/
|
|
|
|
class TransportClock : public MainClock
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TransportClock (const std::string& clock_name, const std::string& widget_name, ClockDisposition d);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void set_mode(Mode); //override
|
|
|
|
|
|
|
|
private:
|
|
|
|
void follow_canonical_clock();
|
|
|
|
};
|