2011-02-16 23:45:49 -05:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2011-2014 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2011 Carl Hetherington <carl@carlh.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2011-02-16 23:45:49 -05:00
|
|
|
|
|
|
|
#ifndef __ardour_gtk_speaker_dialog_h__
|
|
|
|
#define __ardour_gtk_speaker_dialog_h__
|
|
|
|
|
|
|
|
#include <gtkmm/drawingarea.h>
|
|
|
|
#include <gtkmm/spinbutton.h>
|
|
|
|
#include <gtkmm/box.h>
|
|
|
|
#include <gtkmm/adjustment.h>
|
2011-02-17 11:43:55 -05:00
|
|
|
#include <gtkmm/aspectframe.h>
|
2011-02-16 23:45:49 -05:00
|
|
|
|
|
|
|
#include "ardour/speakers.h"
|
|
|
|
|
2011-11-18 19:56:35 -05:00
|
|
|
#include "ardour_window.h"
|
2011-02-16 23:45:49 -05:00
|
|
|
|
2011-11-18 19:56:35 -05:00
|
|
|
class SpeakerDialog : public ArdourWindow
|
2011-02-16 23:45:49 -05:00
|
|
|
{
|
2011-03-04 12:33:35 -05:00
|
|
|
public:
|
|
|
|
SpeakerDialog ();
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::Speakers> get_speakers() const;
|
|
|
|
void set_speakers (std::shared_ptr<ARDOUR::Speakers>);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-03-04 12:33:35 -05:00
|
|
|
private:
|
2023-02-16 18:33:28 -05:00
|
|
|
std::weak_ptr<ARDOUR::Speakers> _speakers;
|
2011-03-04 12:33:35 -05:00
|
|
|
Gtk::HBox hbox;
|
|
|
|
Gtk::VBox side_vbox;
|
2017-09-18 14:45:56 -04:00
|
|
|
Gtk::AspectFrame aspect_frame;
|
2011-03-04 12:33:35 -05:00
|
|
|
Gtk::DrawingArea darea;
|
|
|
|
Gtk::Adjustment azimuth_adjustment;
|
|
|
|
Gtk::SpinButton azimuth_spinner;
|
|
|
|
Gtk::Button add_speaker_button;
|
2011-03-04 12:35:02 -05:00
|
|
|
Gtk::Button remove_speaker_button;
|
2011-03-04 12:34:50 -05:00
|
|
|
int width; ///< width of the circle
|
|
|
|
int height; ///< height of the circle
|
|
|
|
int x_origin; ///< x origin of our stuff within the drawing area
|
|
|
|
int y_origin; ///< y origin of our stuff within the drawing area
|
|
|
|
/** distance from the centre of the object being dragged to the mouse pointer
|
|
|
|
* when the drag was started (ie start_pointer - object_position).
|
|
|
|
*/
|
|
|
|
double drag_offset_x;
|
|
|
|
double drag_offset_y;
|
2011-03-04 12:33:35 -05:00
|
|
|
int drag_index;
|
2011-03-04 12:35:02 -05:00
|
|
|
int selected_index; ///< index of any selected speaker, or -1
|
|
|
|
PBD::ScopedConnection selected_speaker_connection;
|
|
|
|
bool ignore_speaker_position_change;
|
|
|
|
bool ignore_azimuth_change;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-03-04 12:33:35 -05:00
|
|
|
bool darea_expose_event (GdkEventExpose*);
|
|
|
|
void darea_size_allocate (Gtk::Allocation& alloc);
|
|
|
|
bool darea_motion_notify_event (GdkEventMotion *ev);
|
|
|
|
bool handle_motion (gint evx, gint evy, GdkModifierType state);
|
|
|
|
bool darea_button_press_event (GdkEventButton *ev);
|
|
|
|
bool darea_button_release_event (GdkEventButton *ev);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-03-04 12:33:35 -05:00
|
|
|
void clamp_to_circle (double& x, double& y);
|
|
|
|
void gtk_to_cart (PBD::CartesianVector& c) const;
|
|
|
|
void cart_to_gtk (PBD::CartesianVector& c) const;
|
|
|
|
int find_closest_object (gdouble x, gdouble y);
|
2011-03-04 12:34:42 -05:00
|
|
|
|
|
|
|
void add_speaker ();
|
2011-03-04 12:35:02 -05:00
|
|
|
void remove_speaker ();
|
|
|
|
void azimuth_changed ();
|
|
|
|
void set_selected (int);
|
|
|
|
void speaker_position_changed ();
|
2011-02-16 23:45:49 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ardour_gtk_speaker_dialog_h__ */
|