Merge with 2.0-ongoing R2883.
[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 struct TempoDialog : public ArdourDialog 
39 {
40     Gtk::ComboBoxText note_types;
41     vector<string> strings;
42     Gtk::Adjustment   bpm_adjustment;
43     Gtk::SpinButton   bpm_spinner;
44     Gtk::Frame        bpm_frame;
45     Gtk::Frame   note_frame;
46     Gtk::VBox    vpacker;
47     Gtk::Button  ok_button;
48     Gtk::Button  cancel_button;
49     Gtk::HBox    button_box;
50     Gtk::HBox    hspacer1, hspacer2;
51     Gtk::VBox    vspacer1, vspacer2;
52     Gtk::Entry   when_bar_entry;
53     Gtk::Entry   when_beat_entry;
54     Gtk::Label   when_bar_label;
55     Gtk::Label   when_beat_label;
56     Gtk::Table   when_table;
57     Gtk::Frame   when_frame;
58     char buf[64];
59     
60     TempoDialog (ARDOUR::TempoMap&, nframes_t, const string & action);
61     TempoDialog (ARDOUR::TempoSection&, const string & action);
62
63     double get_bpm ();
64     double get_note_type ();
65     bool   get_bbt_time (ARDOUR::BBT_Time&);
66     
67   private:
68     void init (const ARDOUR::BBT_Time& start, double, double, bool);
69     void bpm_changed ();
70     bool bpm_button_press (GdkEventButton* );
71     bool bpm_button_release (GdkEventButton* );
72     void note_types_change ();
73 };
74
75 struct MeterDialog : public ArdourDialog 
76 {
77     Gtk::Entry   bpb_entry;
78     Gtk::ComboBoxText note_types;
79     vector<string> strings;
80     Gtk::Frame   note_frame;
81     Gtk::Frame   bpb_frame;
82     Gtk::VBox    vpacker;
83     Gtk::Button  ok_button;
84     Gtk::Button  cancel_button;
85     Gtk::HBox    button_box;
86     Gtk::HBox    hspacer1, hspacer2;
87     Gtk::VBox    vspacer1, vspacer2;
88     Gtk::Entry   when_bar_entry;
89     Gtk::Entry   when_beat_entry;
90     Gtk::Label   when_bar_label;
91     Gtk::Label   when_beat_label;
92     Gtk::Table   when_table;
93     Gtk::Frame   when_frame;
94     char buf[64];
95     
96     MeterDialog (ARDOUR::TempoMap&, nframes_t, const string & action);
97     MeterDialog (ARDOUR::MeterSection&, const string & action);
98
99     double get_bpb ();
100     double get_note_type ();
101     bool   get_bbt_time (ARDOUR::BBT_Time&);
102
103   private:
104     void init (const ARDOUR::BBT_Time&, double, double, bool);
105     bool bpb_key_press (GdkEventKey* );
106     bool bpb_key_release (GdkEventKey* );
107     void note_types_change ();
108 };
109
110 #endif /* __ardour_gtk_tempo_dialog_h__ */