final tweaks for #4489
[ardour.git] / gtk2_ardour / time_info_box.h
1 /*
2     Copyright (C) 2011 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 __time_info_box_h__
21 #define __time_info_box_h__
22
23 #include <map>
24
25 #include <gtkmm/box.h>
26 #include <gtkmm/label.h>
27 #include <gtkmm/table.h>
28
29 #include "ardour/ardour.h"
30 #include "ardour/session_handle.h"
31
32 #include "ardour_button.h"
33
34 namespace ARDOUR {
35         class Session;
36         class Location;
37 }
38
39 class AudioClock;
40
41 class TimeInfoBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr
42 {
43   public:
44     TimeInfoBox ();
45     ~TimeInfoBox ();
46
47     void set_session (ARDOUR::Session*);
48
49   protected:
50     bool on_expose_event (GdkEventExpose*);
51
52   private:
53     Gtk::Table left;
54     Gtk::Table right;
55
56     AudioClock* selection_start;
57     AudioClock* selection_end;
58     AudioClock* selection_length;
59     
60     AudioClock* punch_start;
61     AudioClock* punch_end;
62
63     Gtk::Label selection_title;
64     Gtk::Label punch_title;
65     bool syncing_selection;
66     bool syncing_punch;
67
68     void punch_changed (ARDOUR::Location*);
69     void punch_location_changed (ARDOUR::Location*);
70     void watch_punch (ARDOUR::Location*);
71     PBD::ScopedConnectionList punch_connections;
72     PBD::ScopedConnectionList editor_connections;
73
74     ArdourButton punch_in_button;
75     ArdourButton punch_out_button;
76
77     void selection_changed ();
78
79     void sync_selection_mode (AudioClock*);
80     void sync_punch_mode (AudioClock*);
81
82     bool clock_button_release_event (GdkEventButton* ev, AudioClock* src);
83     void track_mouse_mode ();
84 };
85
86
87 #endif /* __time_info_box_h__ */