Ardour  9.0-pre0-822-g12e3bc5c20
trigger_clip_picker.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #pragma once
20 
21 #include <set>
22 #include <string>
23 
24 #include <ytkmm/box.h>
25 #include <ytkmm/filechooserdialog.h>
26 #include <ytkmm/scale.h>
27 #include <ytkmm/scrolledwindow.h>
28 #include <ytkmm/table.h>
29 #include <ytkmm/treemodel.h>
30 #include <ytkmm/treestore.h>
31 #include <ytkmm/treeview.h>
32 
33 #include "ardour/types.h"
34 #include "ardour/session_handle.h"
35 
37 #include "widgets/ardour_button.h"
38 #include "widgets/ardour_knob.h"
39 
40 #include "instrument_selector.h"
41 
42 class PluginUIWindow;
43 
44 class TriggerClipPicker : public Gtk::VBox, public ARDOUR::SessionHandlePtr
45 {
46 public:
49 
51 
54  }
55 
56 private:
57  void list_dir (std::string const&, Gtk::TreeNodeChildren const* pc = NULL);
58  void open_dir ();
59  void open_downloader ();
60  void edit_path ();
61  bool refill_dropdown ();
62  void parameter_changed (std::string const&);
63  void clip_added (std::string const&, void*);
64  void row_selected ();
65  void cursor_changed ();
66  void row_activated (Gtk::TreeModel::Path const&, Gtk::TreeViewColumn*);
67  bool test_expand (Gtk::TreeModel::iterator const&, Gtk::TreeModel::Path const&);
68  void row_collapsed (Gtk::TreeModel::iterator const&, Gtk::TreeModel::Path const&);
69  void drag_data_get (Glib::RefPtr<Gdk::DragContext> const&, Gtk::SelectionData&, guint, guint);
70  void drag_begin (Glib::RefPtr<Gdk::DragContext> const&);
71  void drag_end (Glib::RefPtr<Gdk::DragContext> const&);
72  bool drag_motion (Glib::RefPtr<Gdk::DragContext> const&, int, int, guint);
73  void drag_data_received (Glib::RefPtr<Gdk::DragContext> const&, int, int, Gtk::SelectionData const&, guint, guint);
74  bool maybe_add_dir (std::string const&);
76  void audition (std::string const&);
77  void audition_active (bool);
84  void stop_audition ();
86  void refresh_library ();
87  void open_library ();
88  bool seek_button_press (GdkEventButton*);
89  bool seek_button_release (GdkEventButton*);
92  void mark_auditioned (Gtk::TreeModel::iterator);
93  void reset_audition_marks (bool force = false);
94 
96  Gtk::FileChooserDialog _fcd;
97 
98  struct Columns : public Gtk::TreeModel::ColumnRecord {
100  {
101  add (name);
102  add (path);
103  add (read);
104  add (file);
105  add (color);
106  add (auditioned);
107  }
108  Gtk::TreeModelColumn<std::string> name;
109  Gtk::TreeModelColumn<std::string> path;
110  Gtk::TreeModelColumn<bool> read;
111  Gtk::TreeModelColumn<bool> file;
112  Gtk::TreeModelColumn<Gdk::Color> color;
113  Gtk::TreeModelColumn<bool> auditioned;
114  };
115 
117  Glib::RefPtr<Gtk::TreeStore> _model;
118  Gtk::TreeView _view;
119  Gtk::ScrolledWindow _scroller;
127  Gtk::HScale _seek_slider;
128  Gtk::CheckButton _autoplay_btn;
131 
132  /* MIDI props */
134  Gtk::Label format_text;
135  Gtk::Label channels_value;
136 
138 
139  std::string _current_path;
140  std::string _clip_library_dir;
143 
144  std::set<std::string> _root_paths;
145 
146  bool _seeking;
148 
153  sigc::connection _idle_connection;
154 };
155 
ARDOUR::PluginInfoPtr selected_instrument() const
void parameter_changed(std::string const &)
ArdourWidgets::ArdourButton _play_btn
Glib::RefPtr< Gtk::TreeStore > _model
std::string _clip_library_dir
Gtk::CheckButton _autoplay_btn
void reset_audition_marks(bool force=false)
void row_collapsed(Gtk::TreeModel::iterator const &, Gtk::TreeModel::Path const &)
void audition_processors_changed()
void audition_processor_idle()
ArdourWidgets::ArdourButton _open_library_btn
void audition_progress(ARDOUR::samplecnt_t, ARDOUR::samplecnt_t)
void mark_auditioned(Gtk::TreeModel::iterator)
ArdourWidgets::ArdourButton _stop_btn
void list_dir(std::string const &, Gtk::TreeNodeChildren const *pc=NULL)
PluginUIWindow * _audition_plugnui
void audition_selected()
void drag_data_get(Glib::RefPtr< Gdk::DragContext > const &, Gtk::SelectionData &, guint, guint)
Gtk::FileChooserDialog _fcd
void drag_end(Glib::RefPtr< Gdk::DragContext > const &)
InstrumentSelector _auditioner_combo
ARDOUR::PluginInfoPtr instrument_plugin() const
PBD::ScopedConnectionList _auditioner_connections
void audition_processor_going_away()
void row_activated(Gtk::TreeModel::Path const &, Gtk::TreeViewColumn *)
bool audition_processor_viz(bool)
bool seek_button_release(GdkEventButton *)
void audition(std::string const &)
sigc::connection _idle_connection
void clip_added(std::string const &, void *)
void audition_active(bool)
void auditioner_combo_changed()
void set_session(ARDOUR::Session *)
ArdourWidgets::ArdourKnob _gain_control
PBD::ScopedConnection _clip_added_connection
bool drag_motion(Glib::RefPtr< Gdk::DragContext > const &, int, int, guint)
ArdourWidgets::ArdourButton _show_plugin_btn
bool maybe_add_dir(std::string const &)
PBD::ScopedConnection _config_connection
ArdourWidgets::ArdourButton _refresh_btn
void drag_data_received(Glib::RefPtr< Gdk::DragContext > const &, int, int, Gtk::SelectionData const &, guint, guint)
std::set< std::string > _root_paths
Gtk::ScrolledWindow _scroller
ArdourWidgets::ArdourDropdown _clip_dir_menu
void drag_begin(Glib::RefPtr< Gdk::DragContext > const &)
bool test_expand(Gtk::TreeModel::iterator const &, Gtk::TreeModel::Path const &)
void audition_show_plugin_ui()
PBD::ScopedConnectionList _processor_connections
bool seek_button_press(GdkEventButton *)
struct Table Table
Temporal::samplecnt_t samplecnt_t
std::shared_ptr< PluginInfo > PluginInfoPtr
Definition: plugin.h:65
uint32_t Color
Definition: colors.h:33
Gtk::TreeModelColumn< bool > file
Gtk::TreeModelColumn< bool > read
Gtk::TreeModelColumn< Gdk::Color > color
Gtk::TreeModelColumn< bool > auditioned
Gtk::TreeModelColumn< std::string > path
Gtk::TreeModelColumn< std::string > name