2021-01-28 21:31:37 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2005-2021 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2013-2021 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _gtkardour_io_button_h_
|
|
|
|
#define _gtkardour_io_button_h_
|
|
|
|
|
|
|
|
#include <list>
|
2023-02-16 12:59:41 -05:00
|
|
|
#include <memory>
|
2021-01-28 21:31:37 -05:00
|
|
|
|
|
|
|
#include <gtkmm/menu.h>
|
|
|
|
|
2022-10-20 11:23:37 -04:00
|
|
|
#include "ardour/data_type.h"
|
2024-10-19 09:54:24 -04:00
|
|
|
#include "ardour/types.h"
|
2022-10-20 11:23:37 -04:00
|
|
|
|
2021-01-28 21:31:37 -05:00
|
|
|
#include "widgets/ardour_button.h"
|
|
|
|
|
2022-10-20 11:23:37 -04:00
|
|
|
namespace PBD
|
|
|
|
{
|
|
|
|
class PropertyChange;
|
|
|
|
}
|
|
|
|
|
2021-01-28 21:31:37 -05:00
|
|
|
namespace ARDOUR
|
|
|
|
{
|
|
|
|
class Bundle;
|
|
|
|
class IO;
|
|
|
|
class Route;
|
2022-10-20 11:23:37 -04:00
|
|
|
class Session;
|
2021-01-28 21:31:37 -05:00
|
|
|
class Track;
|
|
|
|
class Port;
|
|
|
|
}
|
|
|
|
|
|
|
|
class RouteUI;
|
|
|
|
|
2022-10-20 11:23:37 -04:00
|
|
|
class IOButtonBase : public ArdourWidgets::ArdourButton
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~IOButtonBase () {}
|
|
|
|
|
|
|
|
protected:
|
2023-02-16 18:33:28 -05:00
|
|
|
static void set_label (IOButtonBase&, ARDOUR::Session&, std::shared_ptr<ARDOUR::Bundle>&, std::shared_ptr<ARDOUR::IO>);
|
|
|
|
static ARDOUR::DataType guess_main_type (std::shared_ptr<ARDOUR::IO>);
|
2022-10-20 11:23:37 -04:00
|
|
|
|
|
|
|
virtual void update () = 0;
|
|
|
|
void maybe_update (PBD::PropertyChange const& what_changed);
|
|
|
|
|
|
|
|
PBD::ScopedConnectionList _connections;
|
|
|
|
PBD::ScopedConnectionList _bundle_connections;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IOButton : public IOButtonBase
|
2021-01-28 21:31:37 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
IOButton (bool input);
|
|
|
|
~IOButton ();
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
void set_route (std::shared_ptr<ARDOUR::Route>, RouteUI*);
|
2021-01-28 21:31:37 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
void update ();
|
|
|
|
bool button_press (GdkEventButton*);
|
|
|
|
bool button_release (GdkEventButton*);
|
|
|
|
void button_resized (Gtk::Allocation&);
|
|
|
|
void port_pretty_name_changed (std::string);
|
2023-02-16 18:33:28 -05:00
|
|
|
void port_connected_or_disconnected (std::weak_ptr<ARDOUR::Port>, std::weak_ptr<ARDOUR::Port>);
|
|
|
|
void maybe_add_bundle_to_menu (std::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const&, ARDOUR::DataType = ARDOUR::DataType::NIL);
|
2021-01-28 21:31:37 -05:00
|
|
|
void disconnect ();
|
|
|
|
void add_port (ARDOUR::DataType);
|
2023-02-16 18:33:28 -05:00
|
|
|
void bundle_chosen (std::shared_ptr<ARDOUR::Bundle>);
|
2021-01-28 21:31:37 -05:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::IO> io () const;
|
|
|
|
std::shared_ptr<ARDOUR::Track> track () const;
|
2021-01-28 21:31:37 -05:00
|
|
|
|
2021-01-29 23:01:33 -05:00
|
|
|
bool _input;
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::Route> _route;
|
2021-01-29 23:01:33 -05:00
|
|
|
RouteUI* _route_ui;
|
|
|
|
Gtk::Menu _menu;
|
2023-02-16 18:33:28 -05:00
|
|
|
std::list<std::shared_ptr<ARDOUR::Bundle> > _menu_bundles;
|
2021-01-28 21:31:37 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|