Add a missing #define to our MSVC project (portaudio_backend)
[ardour.git] / gtk2_ardour / tempo_dialog.h
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::TempoMap&, 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         ARDOUR::TempoSection::Type get_tempo_type ();
48         ARDOUR::PositionLockStyle get_lock_style ();
49
50 private:
51         void init (const Timecode::BBT_Time& start, double bpm , double note_type, ARDOUR::TempoSection::Type type, bool movable, ARDOUR::PositionLockStyle style);
52         bool is_user_input_valid() const;
53         void bpm_changed ();
54         bool bpm_button_press (GdkEventButton* );
55         bool bpm_button_release (GdkEventButton* );
56         bool entry_key_release (GdkEventKey* );
57         void pulse_change ();
58         void tempo_type_change ();
59         void lock_style_change ();
60         bool tap_tempo_button_press (GdkEventButton* );
61         bool tap_tempo_focus_out (GdkEventFocus* );
62
63         typedef std::map<std::string,float> NoteTypes;
64         NoteTypes note_types;
65
66         typedef std::map<std::string, ARDOUR::TempoSection::Type> TempoTypes;
67         TempoTypes tempo_types;
68
69         typedef std::map<std::string, ARDOUR::PositionLockStyle> LockStyles;
70         LockStyles lock_styles;
71
72         bool tapped;      // whether the tap-tempo button has been clicked
73         double sum_x, sum_xx, sum_xy, sum_y;
74         double tap_count;
75         double last_t;
76         gint64 first_t;
77
78         ARDOUR::TempoMap* _map;
79         ARDOUR::TempoSection* _section;
80
81         Gtk::ComboBoxText pulse_selector;
82         Gtk::Adjustment   bpm_adjustment;
83         Gtk::SpinButton   bpm_spinner;
84         Gtk::Entry   when_bar_entry;
85         Gtk::Entry   when_beat_entry;
86         Gtk::Label   when_bar_label;
87         Gtk::Label   when_beat_label;
88         Gtk::Label   pulse_selector_label;
89         Gtk::Button  tap_tempo_button;
90         Gtk::ComboBoxText tempo_type;
91         Gtk::ComboBoxText lock_style;
92 };
93
94 class MeterDialog : public ArdourDialog
95 {
96 public:
97
98         MeterDialog (ARDOUR::TempoMap&, framepos_t, const std::string & action);
99         MeterDialog (ARDOUR::TempoMap&, ARDOUR::MeterSection&, const std::string & action);
100
101         double get_bpb ();
102         double get_note_type ();
103         ARDOUR::PositionLockStyle get_lock_style ();
104         bool   get_bbt_time (Timecode::BBT_Time&);
105
106 private:
107         void init (const Timecode::BBT_Time&, double, double, bool, ARDOUR::PositionLockStyle style);
108         bool is_user_input_valid() const;
109         bool entry_key_press (GdkEventKey* );
110         bool entry_key_release (GdkEventKey* );
111         void note_type_change ();
112         void lock_style_change ();
113
114         typedef std::map<std::string,float> NoteTypes;
115         NoteTypes note_types;
116
117         typedef std::map<std::string, ARDOUR::PositionLockStyle> LockStyles;
118         LockStyles lock_styles;
119
120         Gtk::Entry   bpb_entry;
121         Gtk::ComboBoxText note_type;
122         Gtk::ComboBoxText lock_style;
123         std::vector<std::string> strings;
124         Gtk::Button  ok_button;
125         Gtk::Button  cancel_button;
126         Gtk::Entry   when_bar_entry;
127 };
128
129 #endif /* __ardour_gtk_tempo_dialog_h__ */