preparations for a working speaker editing dialog
[ardour.git] / gtk2_ardour / speaker_dialog.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 __ardour_gtk_speaker_dialog_h__
21 #define __ardour_gtk_speaker_dialog_h__
22
23 #include <gtkmm/drawingarea.h>
24 #include <gtkmm/spinbutton.h>
25 #include <gtkmm/box.h>
26 #include <gtkmm/adjustment.h>
27
28 #include "ardour/speakers.h"
29
30 #include "ardour_dialog.h"
31
32 class SpeakerDialog  : public ArdourDialog
33 {
34   public:
35     SpeakerDialog ();
36     
37     ARDOUR::Speakers get_speakers() const;
38     void set_speakers (const ARDOUR::Speakers&);
39
40   private:
41     ARDOUR::Speakers speakers;
42     Gtk::HBox        hbox;
43     Gtk::VBox        side_vbox;
44     Gtk::DrawingArea darea;
45     Gtk::Adjustment  azimuth_adjustment;
46     Gtk::SpinButton  azimuth_spinner;
47     Gtk::Button      add_speaker_button;
48     Gtk::Button      use_system_button;
49     int32_t          selected_speaker;
50     int              width;
51     int              height;
52     int              drag_x;
53     int              drag_y;
54     int              drag_index;
55
56     bool darea_expose_event (GdkEventExpose*);
57     void darea_size_allocate (Gtk::Allocation& alloc);
58     bool darea_motion_notify_event (GdkEventMotion *ev);
59     bool handle_motion (gint evx, gint evy, GdkModifierType state);
60     bool darea_button_press_event (GdkEventButton *ev);
61     bool darea_button_release_event (GdkEventButton *ev);
62
63     void clamp_to_circle (double& x, double& y);
64     void gtk_to_cart (PBD::CartesianVector& c) const;
65     void cart_to_gtk (PBD::CartesianVector& c) const;
66     int find_closest_object (gdouble x, gdouble y, int& which);
67 };
68
69 #endif /* __ardour_gtk_speaker_dialog_h__ */