2 * Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2005 Karsten Wiese <fzuuzf@googlemail.com>
4 * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
5 * Copyright (C) 2008-2011 David Robillard <d@drobilla.net>
6 * Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net>
7 * Copyright (C) 2014-2015 Colin Fletcher <colin.m.fletcher@googlemail.com>
8 * Copyright (C) 2015-2017 Nick Mainsbridge <mainsbridge@gmail.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef __ardour_gtk_tempo_dialog_h__
26 #define __ardour_gtk_tempo_dialog_h__
28 #include <gtkmm/entry.h>
29 #include <gtkmm/frame.h>
30 #include <gtkmm/box.h>
31 #include <gtkmm/button.h>
32 #include <gtkmm/label.h>
33 #include <gtkmm/table.h>
34 #include <gtkmm/entry.h>
35 #include <gtkmm/spinbutton.h>
36 #include <gtkmm/comboboxtext.h>
38 #include "ardour/types.h"
39 #include "ardour/tempo.h"
41 #include "ardour_dialog.h"
43 class TempoDialog : public ArdourDialog
46 TempoDialog (ARDOUR::TempoMap&, samplepos_t, const std::string & action);
47 TempoDialog (ARDOUR::TempoMap&, ARDOUR::TempoSection&, const std::string & action);
50 double get_end_bpm ();
51 double get_note_type ();
52 bool get_bbt_time (Timecode::BBT_Time&);
53 ARDOUR::TempoSection::Type get_tempo_type ();
54 ARDOUR::PositionLockStyle get_lock_style ();
57 void init (const Timecode::BBT_Time& start, double bpm, double end_bpm, double note_type, ARDOUR::TempoSection::Type type, bool movable, ARDOUR::PositionLockStyle style);
58 bool is_user_input_valid() const;
60 bool bpm_button_press (GdkEventButton* );
61 bool bpm_button_release (GdkEventButton* );
62 bool entry_key_release (GdkEventKey* );
64 void tempo_type_change ();
65 void lock_style_change ();
66 bool tap_tempo_key_press (GdkEventKey*);
67 bool tap_tempo_button_press (GdkEventButton*);
68 bool tap_tempo_focus_out (GdkEventFocus* );
72 typedef std::map<std::string,float> NoteTypes;
75 typedef std::map<std::string, ARDOUR::TempoSection::Type> TempoTypes;
76 TempoTypes tempo_types;
78 typedef std::map<std::string, ARDOUR::PositionLockStyle> LockStyles;
79 LockStyles lock_styles;
81 bool tapped; // whether the tap-tempo button has been clicked
82 double sum_x, sum_xx, sum_xy, sum_y;
87 ARDOUR::TempoMap* _map;
88 ARDOUR::TempoSection* _section;
90 Gtk::ComboBoxText pulse_selector;
91 Gtk::Adjustment bpm_adjustment;
92 Gtk::SpinButton bpm_spinner;
93 Gtk::Adjustment end_bpm_adjustment;
94 Gtk::SpinButton end_bpm_spinner;
95 Gtk::Label _end_bpm_label;
96 Gtk::Entry when_bar_entry;
97 Gtk::Entry when_beat_entry;
98 Gtk::Label when_bar_label;
99 Gtk::Label when_beat_label;
100 Gtk::Label pulse_selector_label;
101 Gtk::Button tap_tempo_button;
102 Gtk::ComboBoxText tempo_type;
103 Gtk::ComboBoxText lock_style;
106 class MeterDialog : public ArdourDialog
110 MeterDialog (ARDOUR::TempoMap&, samplepos_t, const std::string & action);
111 MeterDialog (ARDOUR::TempoMap&, ARDOUR::MeterSection&, const std::string & action);
114 double get_note_type ();
115 ARDOUR::PositionLockStyle get_lock_style ();
116 bool get_bbt_time (Timecode::BBT_Time&);
119 void init (const Timecode::BBT_Time&, double, double, bool, ARDOUR::PositionLockStyle style);
120 bool is_user_input_valid() const;
121 bool entry_key_press (GdkEventKey* );
122 bool entry_key_release (GdkEventKey* );
123 void note_type_change ();
124 void lock_style_change ();
126 typedef std::map<std::string,float> NoteTypes;
127 NoteTypes note_types;
129 typedef std::map<std::string, ARDOUR::PositionLockStyle> LockStyles;
130 LockStyles lock_styles;
132 Gtk::Entry bpb_entry;
133 Gtk::ComboBoxText note_type;
134 Gtk::ComboBoxText lock_style;
135 std::vector<std::string> strings;
136 Gtk::Button ok_button;
137 Gtk::Button cancel_button;
138 Gtk::Entry when_bar_entry;
141 #endif /* __ardour_gtk_tempo_dialog_h__ */