Ardour  9.0-pre0-582-g084a23a80d
bundle_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
3  * Copyright (C) 2008-2010 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2009-2014 David Robillard <d@drobilla.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #pragma once
22 
23 #include <gtkmm/comboboxtext.h>
24 #include <gtkmm/entry.h>
25 #include <gtkmm/liststore.h>
26 #include <gtkmm/treeview.h>
27 
28 #include "ardour/user_bundle.h"
29 
30 #include "ardour_dialog.h"
31 #include "port_matrix.h"
32 
33 namespace ARDOUR {
34  class Session;
35  class Bundle;
36 }
37 
39 {
40 public:
41  BundleEditorMatrix (Gtk::Window *, ARDOUR::Session *, std::shared_ptr<ARDOUR::Bundle>);
42 
43  void set_state (ARDOUR::BundleChannel c[2], bool s);
45 
46  bool can_add_channels (std::shared_ptr<ARDOUR::Bundle>) const;
47  bool can_add_port (std::shared_ptr<ARDOUR::Bundle>, ARDOUR::DataType t) const;
48 
49  void add_channel (std::shared_ptr<ARDOUR::Bundle>, ARDOUR::DataType);
50  bool can_remove_channels (std::shared_ptr<ARDOUR::Bundle>) const;
52  bool can_rename_channels (std::shared_ptr<ARDOUR::Bundle>) const;
54  void setup_ports (int);
55  bool list_is_global (int) const;
56 
57  std::string disassociation_verb () const;
58 
59 private:
60  enum {
61  OTHER = 0,
62  OURS = 1
63  };
64 
65  std::shared_ptr<PortGroup> _port_group;
66  std::shared_ptr<ARDOUR::Bundle> _bundle;
67 };
68 
69 class BundleEditor : public ArdourDialog
70 {
71 public:
72  BundleEditor (ARDOUR::Session *, std::shared_ptr<ARDOUR::UserBundle>);
73 
74 protected:
75  void on_map ();
76 
77 private:
78  void name_changed ();
80  void on_show ();
81 
83  std::shared_ptr<ARDOUR::UserBundle> _bundle;
86 };
87 
89 {
90 public:
92 
93 private:
94 
95  void new_clicked ();
96  void edit_clicked ();
97  void delete_clicked ();
98  void add_bundle (std::shared_ptr<ARDOUR::Bundle>);
99  void bundle_changed (ARDOUR::Bundle::Change, std::weak_ptr<ARDOUR::UserBundle>);
102 
104  {
105  public:
107  add (name);
108  add (bundle);
109  }
110 
113  };
114 
116  Glib::RefPtr<Gtk::ListStore> _list_model;
121 };
122 
124 {
125 public:
127  NameChannelDialog (std::shared_ptr<ARDOUR::Bundle>, uint32_t);
128 
129  std::string get_name () const;
130 
131 private:
132 
133  void setup ();
134 
135  std::shared_ptr<ARDOUR::Bundle> _bundle;
137  bool _adding;
138 };
139 
bool can_add_port(std::shared_ptr< ARDOUR::Bundle >, ARDOUR::DataType t) const
bool can_remove_channels(std::shared_ptr< ARDOUR::Bundle >) const
void setup_ports(int)
void rename_channel(ARDOUR::BundleChannel)
std::shared_ptr< PortGroup > _port_group
std::string disassociation_verb() const
void remove_channel(ARDOUR::BundleChannel)
bool list_is_global(int) const
bool can_add_channels(std::shared_ptr< ARDOUR::Bundle >) const
BundleEditorMatrix(Gtk::Window *, ARDOUR::Session *, std::shared_ptr< ARDOUR::Bundle >)
PortMatrixNode::State get_state(ARDOUR::BundleChannel c[2]) const
std::shared_ptr< ARDOUR::Bundle > _bundle
void add_channel(std::shared_ptr< ARDOUR::Bundle >, ARDOUR::DataType)
bool can_rename_channels(std::shared_ptr< ARDOUR::Bundle >) const
void set_state(ARDOUR::BundleChannel c[2], bool s)
void on_map()
This is a default handler for the signal signal_map().
BundleEditor(ARDOUR::Session *, std::shared_ptr< ARDOUR::UserBundle >)
std::shared_ptr< ARDOUR::UserBundle > _bundle
void name_changed()
Gtk::ComboBoxText _input_or_output
void input_or_output_changed()
Gtk::Entry _name
void on_show()
This is a default handler for the signal signal_show().
BundleEditorMatrix _matrix
Gtk::TreeModelColumn< std::string > name
Gtk::TreeModelColumn< std::shared_ptr< ARDOUR::UserBundle > > bundle
ModelColumns _list_model_columns
void set_button_sensitivity()
void row_activated(Gtk::TreeModel::Path const &p, Gtk::TreeViewColumn *c)
void delete_clicked()
Gtk::TreeView _tree_view
void new_clicked()
void bundle_changed(ARDOUR::Bundle::Change, std::weak_ptr< ARDOUR::UserBundle >)
Gtk::Button edit_button
void add_bundle(std::shared_ptr< ARDOUR::Bundle >)
void edit_clicked()
Glib::RefPtr< Gtk::ListStore > _list_model
PBD::ScopedConnectionList bundle_connections
BundleManager(ARDOUR::Session *)
Gtk::Button delete_button
void add(TreeModelColumnBase &column)
std::string get_name() const
std::shared_ptr< ARDOUR::Bundle > _bundle
NameChannelDialog(std::shared_ptr< ARDOUR::Bundle >, uint32_t)