ardour
tempo_dialog.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000-2007 Paul Davis
3 
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.
8 
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.
13 
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.
17 
18 */
19 
20 #ifndef __ardour_gtk_tempo_dialog_h__
21 #define __ardour_gtk_tempo_dialog_h__
22 
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>
32 
33 #include "ardour/types.h"
34 #include "ardour/tempo.h"
35 
36 #include "ardour_dialog.h"
37 
38 class TempoDialog : public ArdourDialog
39 {
40 public:
41  TempoDialog (ARDOUR::TempoMap&, framepos_t, const std::string & action);
42  TempoDialog (ARDOUR::TempoSection&, const std::string & action);
43 
44  double get_bpm ();
45  double get_note_type ();
46  bool get_bbt_time (Timecode::BBT_Time&);
47 
48 private:
49  void init (const Timecode::BBT_Time& start, double, double, bool);
50  bool is_user_input_valid() const;
51  void bpm_changed ();
52  bool bpm_button_press (GdkEventButton* );
53  bool bpm_button_release (GdkEventButton* );
54  bool entry_key_release (GdkEventKey* );
55  void pulse_change ();
56  bool tap_tempo_button_press (GdkEventButton* );
57  bool tap_tempo_focus_out (GdkEventFocus* );
58 
59  typedef std::map<std::string,float> NoteTypes;
60  NoteTypes note_types;
61 
62  bool tapped; // whether the tap-tempo button has been clicked
63  gint64 last_tap;
65 
66  Gtk::ComboBoxText pulse_selector;
67  Gtk::Adjustment bpm_adjustment;
68  Gtk::SpinButton bpm_spinner;
69  Gtk::Entry when_bar_entry;
70  Gtk::Entry when_beat_entry;
71  Gtk::Label when_bar_label;
72  Gtk::Label when_beat_label;
74  Gtk::Button tap_tempo_button;
75 };
76 
77 class MeterDialog : public ArdourDialog
78 {
79 public:
80 
81  MeterDialog (ARDOUR::TempoMap&, framepos_t, const std::string & action);
82  MeterDialog (ARDOUR::MeterSection&, const std::string & action);
83 
84  double get_bpb ();
85  double get_note_type ();
86  bool get_bbt_time (Timecode::BBT_Time&);
87 
88 private:
89  void init (const Timecode::BBT_Time&, double, double, bool);
90  bool is_user_input_valid() const;
91  bool entry_key_press (GdkEventKey* );
92  bool entry_key_release (GdkEventKey* );
93  void note_type_change ();
94 
95  typedef std::map<std::string,float> NoteTypes;
96  NoteTypes note_types;
97 
98  Gtk::Entry bpb_entry;
99  Gtk::ComboBoxText note_type;
100  std::vector<std::string> strings;
101  Gtk::Button ok_button;
102  Gtk::Button cancel_button;
103  Gtk::Entry when_bar_entry;
104 };
105 
106 #endif /* __ardour_gtk_tempo_dialog_h__ */
Gtk::Entry when_bar_entry
Definition: tempo_dialog.h:69
double get_note_type()
bool bpm_button_press(GdkEventButton *)
TempoDialog(ARDOUR::TempoMap &, framepos_t, const std::string &action)
std::map< std::string, float > NoteTypes
Definition: tempo_dialog.h:59
bool tap_tempo_focus_out(GdkEventFocus *)
void note_type_change()
Gtk::Button cancel_button
Definition: tempo_dialog.h:102
bool entry_key_release(GdkEventKey *)
Gtk::Entry bpb_entry
Definition: tempo_dialog.h:98
Gtk::Button ok_button
Definition: tempo_dialog.h:101
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
Definition: region.cc:63
bool bpm_button_release(GdkEventButton *)
bool is_user_input_valid() const
bool get_bbt_time(Timecode::BBT_Time &)
bool entry_key_press(GdkEventKey *)
Gtk::Label when_beat_label
Definition: tempo_dialog.h:72
NoteTypes note_types
Definition: tempo_dialog.h:96
Gtk::ComboBoxText note_type
Definition: tempo_dialog.h:99
Gtk::Entry when_bar_entry
Definition: tempo_dialog.h:103
NoteTypes note_types
Definition: tempo_dialog.h:60
bool entry_key_release(GdkEventKey *)
Gtk::SpinButton bpm_spinner
Definition: tempo_dialog.h:68
Gtk::Button tap_tempo_button
Definition: tempo_dialog.h:74
double get_note_type()
void bpm_changed()
Gtk::Adjustment bpm_adjustment
Definition: tempo_dialog.h:67
Gtk::Label pulse_selector_label
Definition: tempo_dialog.h:73
double get_bpm()
Gtk::Label when_bar_label
Definition: tempo_dialog.h:71
void pulse_change()
Gtk::ComboBoxText pulse_selector
Definition: tempo_dialog.h:66
double get_bpb()
bool get_bbt_time(Timecode::BBT_Time &)
double average_interval
Definition: tempo_dialog.h:64
gint64 last_tap
Definition: tempo_dialog.h:63
bool tap_tempo_button_press(GdkEventButton *)
MeterDialog(ARDOUR::TempoMap &, framepos_t, const std::string &action)
std::vector< std::string > strings
Definition: tempo_dialog.h:100
Gtk::Entry when_beat_entry
Definition: tempo_dialog.h:70
int64_t framepos_t
bool is_user_input_valid() const
std::map< std::string, float > NoteTypes
Definition: tempo_dialog.h:95