2 Copyright (C) 2000-2007 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_gtk_tempo_dialog_h__
21 #define __ardour_gtk_tempo_dialog_h__
23 #include <gtkmm/entry.h>
24 #include <gtkmm/frame.h>
25 #include <gtkmm/box.h>
26 #include <gtkmm/button.h>
27 #include <gtkmm/label.h>
28 #include <gtkmm/table.h>
29 #include <gtkmm/entry.h>
30 #include <gtkmm/spinbutton.h>
31 #include <gtkmm/comboboxtext.h>
33 #include "ardour/types.h"
34 #include "ardour/tempo.h"
36 #include "ardour_dialog.h"
38 class TempoDialog : public ArdourDialog
41 TempoDialog (ARDOUR::TempoMap&, framepos_t, const std::string & action);
42 TempoDialog (ARDOUR::TempoSection&, const std::string & action);
45 double get_note_type ();
46 bool get_bbt_time (Timecode::BBT_Time&);
47 ARDOUR::TempoSection::Type get_tempo_type ();
50 void init (const Timecode::BBT_Time& start, double, double, bool);
51 bool is_user_input_valid() const;
53 bool bpm_button_press (GdkEventButton* );
54 bool bpm_button_release (GdkEventButton* );
55 bool entry_key_release (GdkEventKey* );
57 void tempo_type_change ();
58 bool tap_tempo_button_press (GdkEventButton* );
59 bool tap_tempo_focus_out (GdkEventFocus* );
61 typedef std::map<std::string,float> NoteTypes;
64 typedef std::map<std::string, ARDOUR::TempoSection::Type> TempoTypes;
65 TempoTypes tempo_types;
67 bool tapped; // whether the tap-tempo button has been clicked
68 double sum_x, sum_xx, sum_xy, sum_y;
73 Gtk::ComboBoxText pulse_selector;
74 Gtk::Adjustment bpm_adjustment;
75 Gtk::SpinButton bpm_spinner;
76 Gtk::Entry when_bar_entry;
77 Gtk::Entry when_beat_entry;
78 Gtk::Label when_bar_label;
79 Gtk::Label when_beat_label;
80 Gtk::Label pulse_selector_label;
81 Gtk::Button tap_tempo_button;
82 Gtk::ComboBoxText tempo_type;
86 class MeterDialog : public ArdourDialog
90 MeterDialog (ARDOUR::TempoMap&, framepos_t, const std::string & action);
91 MeterDialog (ARDOUR::MeterSection&, const std::string & action);
94 double get_note_type ();
95 bool get_bbt_time (Timecode::BBT_Time&);
98 void init (const Timecode::BBT_Time&, double, double, bool);
99 bool is_user_input_valid() const;
100 bool entry_key_press (GdkEventKey* );
101 bool entry_key_release (GdkEventKey* );
102 void note_type_change ();
104 typedef std::map<std::string,float> NoteTypes;
105 NoteTypes note_types;
107 Gtk::Entry bpb_entry;
108 Gtk::ComboBoxText note_type;
109 std::vector<std::string> strings;
110 Gtk::Button ok_button;
111 Gtk::Button cancel_button;
112 Gtk::Entry when_bar_entry;
115 #endif /* __ardour_gtk_tempo_dialog_h__ */