Ardour  8.12
playlist_selector.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2009 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
4  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
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 #ifndef __ardour_playlist_selector_h__
22 #define __ardour_playlist_selector_h__
23 
24 #include <memory>
25 
26 #include <gtkmm/box.h>
27 #include <gtkmm/button.h>
28 #include <gtkmm/scrolledwindow.h>
29 #include <gtkmm/treestore.h>
30 #include <gtkmm/treeview.h>
31 
32 #include "ardour/playlist.h"
33 #include "ardour/session_handle.h"
34 #include "ardour_dialog.h"
35 
36 namespace ARDOUR {
37  class Session;
38  class PluginManager;
39  class Plugin;
40 }
41 
42 class RouteUI;
43 class RouteTimeAxisView;
44 
46  bool operator() (std::shared_ptr<ARDOUR::Playlist> a, std::shared_ptr<ARDOUR::Playlist> b) const {
47  if (a->pgroup_id().length() && b->pgroup_id().length()) {
48  return (a->id() < b->id()); /*both plists have pgroup-id: use IDs which are sequentially generated */
49  } else if (!a->pgroup_id().length() && !b->pgroup_id().length()) {
50  return (a->sort_id() < b->sort_id()); /*old session: neither plist has a pgroup-id: use prior sort_id calculation */ /*DEPRECATED*/
51  } else {
52  return (a->pgroup_id().length() < b->pgroup_id().length()); /*mix of old & new: old ones go on top */
53  }
54  }
55 };
56 
58 {
59 public:
62 
63  enum plMode {
67  plSteal
68  };
69 
70  void redisplay ();
71  void prepare (RouteUI*, plMode in);
72 
73 protected:
75 
76 private:
77  typedef std::map<PBD::ID, std::vector<std::shared_ptr<ARDOUR::Playlist> >*> TrackPlaylistMap;
78 
81 
82  void pl_property_changed (PBD::PropertyChange const& what_changed);
83 
84  void add_playlist_to_map (std::shared_ptr<ARDOUR::Playlist>);
85  void playlist_added ();
86  void clear_map ();
87  void ok_button_click ();
89 
96 
99 
103 
106  {
107  add (text);
108  add (pgrp);
109  add (playlist);
110  }
114  };
115 
117  Glib::RefPtr<Gtk::TreeStore> model;
119 
122 
124 };
125 
126 #endif // __ardour_playlist_selector_h__
void add(TreeModelColumnBase &column)
Glib::RefPtr< Gtk::TreeStore > model
Gtk::TreeView tree
TrackPlaylistMap _trpl_map
void prepare(RouteUI *, plMode in)
void ok_button_click()
void new_plist_button_clicked()
void copy_plist_button_clicked()
PBD::ScopedConnectionList _playlist_connections
ArdourWidgets::ArdourButton _btn_new_plist
Gtk::HBox _scope_container
Gtk::HBox * _scope_box
bool on_key_press_event(GdkEventKey *)
This is a default handler for the signal signal_key_press_event().
PBD::ScopedConnectionList _track_connections
std::map< PBD::ID, std::vector< std::shared_ptr< ARDOUR::Playlist > > * > TrackPlaylistMap
ModelColumns columns
void add_playlist_to_map(std::shared_ptr< ARDOUR::Playlist >)
Gtk::RadioButton * _scope_all_radio
Gtk::RadioButton * _scope_grp_radio
Gtk::RadioButton * _scope_rec_radio
void selection_changed()
void pl_property_changed(PBD::PropertyChange const &what_changed)
ArdourWidgets::ArdourButton _btn_copy_plist
DebugBits PluginManager
Definition: plugin.h:542
Gtk::TreeModelColumn< std::string > text
Gtk::TreeModelColumn< std::string > pgrp
Gtk::TreeModelColumn< std::shared_ptr< ARDOUR::Playlist > > playlist
bool operator()(std::shared_ptr< ARDOUR::Playlist > a, std::shared_ptr< ARDOUR::Playlist > b) const