2019-08-02 17:26:43 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016-2017 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
* Copyright (C) 2017-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2016-05-07 13:03:12 -04:00
|
|
|
#ifndef __gtk_ardour_tempo_curve_h__
|
|
|
|
#define __gtk_ardour_tempo_curve_h__
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <sigc++/signal.h>
|
|
|
|
|
|
|
|
#include "ardour/ardour.h"
|
|
|
|
#include "pbd/signals.h"
|
|
|
|
|
|
|
|
#include "canvas/types.h"
|
2016-05-17 13:26:18 -04:00
|
|
|
#include "canvas/framed_curve.h"
|
2017-02-27 01:53:31 -05:00
|
|
|
#include "canvas/text.h"
|
2016-05-07 13:03:12 -04:00
|
|
|
|
2020-11-16 13:19:22 -05:00
|
|
|
namespace Temporal {
|
|
|
|
class TempoPoint;
|
2016-05-07 13:03:12 -04:00
|
|
|
}
|
|
|
|
class PublicEditor;
|
|
|
|
|
|
|
|
class TempoCurve : public sigc::trackable
|
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2022-01-18 21:45:18 -05:00
|
|
|
TempoCurve (PublicEditor& editor, ArdourCanvas::Item &, guint32 rgba, Temporal::TempoPoint const & temp, bool handle_events , ArdourCanvas::Distance marker_width);
|
2016-05-07 13:03:12 -04:00
|
|
|
~TempoCurve ();
|
|
|
|
|
|
|
|
static PBD::Signal1<void,TempoCurve*> CatchDeletion;
|
|
|
|
|
|
|
|
static void setup_sizes (const double timebar_height);
|
|
|
|
|
|
|
|
ArdourCanvas::Item& the_item() const;
|
|
|
|
|
2022-01-18 21:45:18 -05:00
|
|
|
void set_duration (ARDOUR::samplecnt_t duration);
|
2016-05-07 13:03:12 -04:00
|
|
|
void set_color_rgba (uint32_t rgba);
|
|
|
|
|
|
|
|
void hide ();
|
|
|
|
void show ();
|
|
|
|
|
2022-03-09 22:16:21 -05:00
|
|
|
Temporal::TempoPoint const & tempo () const { return *_tempo; }
|
|
|
|
void reset_point (Temporal::TempoPoint const &);
|
2016-05-07 13:03:12 -04:00
|
|
|
|
2023-08-31 20:25:18 -04:00
|
|
|
void update_range (double min, double max) { _max_tempo = max; _min_tempo = min; }
|
2016-05-07 13:03:12 -04:00
|
|
|
|
2023-08-31 12:34:41 -04:00
|
|
|
static void format_tempo (double ntpm, int nt, char*, size_t);
|
|
|
|
|
2016-05-07 13:03:12 -04:00
|
|
|
protected:
|
|
|
|
PublicEditor& editor;
|
|
|
|
|
2022-01-18 21:45:18 -05:00
|
|
|
ArdourCanvas::Item* _parent;
|
2019-04-08 15:37:02 -04:00
|
|
|
ArdourCanvas::Container* group;
|
2022-01-18 21:45:18 -05:00
|
|
|
ArdourCanvas::Points points;
|
2016-05-17 13:26:18 -04:00
|
|
|
ArdourCanvas::FramedCurve* _curve;
|
2016-05-07 13:03:12 -04:00
|
|
|
|
2022-01-18 21:45:18 -05:00
|
|
|
ARDOUR::samplecnt_t _duration;
|
|
|
|
ArdourCanvas::Distance _marker_width;
|
|
|
|
uint32_t _color;
|
2016-05-07 13:03:12 -04:00
|
|
|
|
|
|
|
void reposition ();
|
2019-04-08 15:37:02 -04:00
|
|
|
|
2016-05-07 13:03:12 -04:00
|
|
|
private:
|
|
|
|
/* disallow copy construction */
|
|
|
|
TempoCurve (TempoCurve const &);
|
2019-04-08 15:37:02 -04:00
|
|
|
|
2016-05-07 13:03:12 -04:00
|
|
|
TempoCurve & operator= (TempoCurve const &);
|
|
|
|
|
2019-04-08 15:37:02 -04:00
|
|
|
double _min_tempo;
|
|
|
|
double _max_tempo;
|
|
|
|
|
2022-03-09 22:16:21 -05:00
|
|
|
Temporal::TempoPoint const * _tempo;
|
2019-04-08 15:37:02 -04:00
|
|
|
ArdourCanvas::Text* _start_text;
|
|
|
|
ArdourCanvas::Text* _end_text;
|
2016-05-07 13:03:12 -04:00
|
|
|
};
|
|
|
|
#endif /* __gtk_ardour_tempo_curve_h__ */
|