Ardour  9.0-pre0-582-g084a23a80d
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 #pragma once
22 
23 #include <memory>
24 
25 #include <gtkmm/box.h>
26 #include <gtkmm/button.h>
27 #include <gtkmm/scrolledwindow.h>
28 #include <gtkmm/treestore.h>
29 #include <gtkmm/treeview.h>
30 
31 #include "widgets/ardour_button.h"
32 
33 #include "ardour/playlist.h"
34 #include "ardour/session_handle.h"
35 #include "ardour_dialog.h"
36 
37 namespace ARDOUR {
38  class Session;
39  class PluginManager;
40  class Plugin;
41 }
42 
43 class RouteUI;
44 class RouteTimeAxisView;
45 
47  bool operator() (std::shared_ptr<ARDOUR::Playlist> a, std::shared_ptr<ARDOUR::Playlist> b) const {
48  if (a->pgroup_id().length() && b->pgroup_id().length()) {
49  return (a->id() < b->id()); /*both plists have pgroup-id: use IDs which are sequentially generated */
50  } else if (!a->pgroup_id().length() && !b->pgroup_id().length()) {
51  return (a->sort_id() < b->sort_id()); /*old session: neither plist has a pgroup-id: use prior sort_id calculation */ /*DEPRECATED*/
52  } else {
53  return (a->pgroup_id().length() < b->pgroup_id().length()); /*mix of old & new: old ones go on top */
54  }
55  }
56 };
57 
59 {
60 public:
63 
64  enum plMode {
68  plSteal
69  };
70 
71  void redisplay ();
72  void prepare (RouteUI*, plMode in);
73 
74 protected:
76 
77 private:
78  typedef std::map<PBD::ID, std::vector<std::shared_ptr<ARDOUR::Playlist> >*> TrackPlaylistMap;
79 
82 
83  void pl_property_changed (PBD::PropertyChange const& what_changed);
84 
85  void add_playlist_to_map (std::shared_ptr<ARDOUR::Playlist>);
86  void playlist_added ();
87  void clear_map ();
88  void ok_button_click ();
90 
97 
100 
104 
107  {
108  add (text);
109  add (pgrp);
110  add (playlist);
111  }
115  };
116 
118  Glib::RefPtr<Gtk::TreeStore> model;
120 
123 
125 };
126 
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:541
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