Ardour  8.12
track_record_axis.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 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 #ifndef __gtkardour_track_record_axis_h_
20 #define __gtkardour_track_record_axis_h_
21 
22 #include <cmath>
23 #include <vector>
24 
25 #include <gtkmm/alignment.h>
26 #include <gtkmm/box.h>
27 #include <gtkmm/drawingarea.h>
28 #include <gtkmm/eventbox.h>
29 #include <gtkmm/separator.h>
30 #include <gtkmm/sizegroup.h>
31 
32 #include "pbd/stateful.h"
33 
34 #include "ardour/ardour.h"
35 #include "ardour/types.h"
36 
37 #include "widgets/ardour_button.h"
38 #include "widgets/ardour_spacer.h"
39 #include "widgets/frame.h"
40 
41 #include "io_button.h"
42 #include "level_meter.h"
43 #include "route_ui.h"
44 
45 namespace ARDOUR
46 {
47  class Region;
48  class Route;
49  class RouteGroup;
50  class Session;
51  class Track;
52 }
53 
54 class LevelMeterVBox;
55 class RouteGroupMenu;
56 
57 class TrackRecordAxis : public Gtk::VBox, public AxisView, public RouteUI
58 {
59 public:
60  TrackRecordAxis (ARDOUR::Session*, std::shared_ptr<ARDOUR::Route>);
62 
63  /* AxisView */
64  std::string name () const;
65  Gdk::Color color () const;
66 
67  std::shared_ptr<ARDOUR::Stripable> stripable() const {
68  return RouteUI::stripable();
69  }
70 
72 
73  void fast_update ();
74  bool start_rename ();
76 
78  int summary_xpos () const;
79  int summary_width () const;
80 
81  static PBD::Signal1<void, TrackRecordAxis*> CatchDeletion;
82  static PBD::Signal2<void, TrackRecordAxis*, bool> EditNextName;
83 
84 protected:
85  void self_delete ();
86 
89 
90  /* AxisView */
91  std::string state_id () const;
92 
93  /* route UI */
96  void blink_rec_display (bool onoff);
98  void map_frozen ();
99 
100 private:
102  void parameter_changed (std::string const& p);
103 
104  void set_name_label ();
105 
110 
114 
115  /* name editing */
116  void end_rename (bool);
117  void entry_changed ();
126 
127  /* RouteUI */
131 
133 
136 
137  bool _renaming;
141 
148 
149  Glib::RefPtr<Gtk::SizeGroup> _ctrls_button_size_group;
150  Glib::RefPtr<Gtk::SizeGroup> _monitor_ctrl_size_group;
151 
153  static Glib::RefPtr<Gtk::SizeGroup> _track_number_size_group;
154 
156  std::list<sigc::connection> _entry_connections;
157 
158  struct RecInfo {
160  : capture_start (s)
161  , capture_end (e)
162  {}
165  };
166 
167  class TrackSummary : public CairoWidget
168  {
169  public:
170  TrackSummary (std::shared_ptr<ARDOUR::Route>);
172 
176 
177  protected:
178  void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
182 
183  private:
184  void render_region (std::shared_ptr<ARDOUR::Region>, Cairo::RefPtr<Cairo::Context> const&, double);
189  void update_rec_box ();
190 
191  double sample_to_xpos (samplepos_t p) const
192  {
193  return (p - _start) * _xscale;
194  }
195 
196  std::shared_ptr<ARDOUR::Track> _track;
199  double _xscale;
203 
204  std::vector<RecInfo> _rec_rects;
207  sigc::connection _screen_update_connection;
208  };
209 
211 
212 };
213 
214 #endif
std::shared_ptr< ARDOUR::Stripable > stripable() const
void render(Cairo::RefPtr< Cairo::Context > const &, cairo_rectangle_t *)
PBD::ScopedConnection _playlist_connections
std::vector< RecInfo > _rec_rects
void on_size_request(Gtk::Requisition *)
This is a default handler for the signal signal_size_request().
std::shared_ptr< ARDOUR::Track > _track
bool on_button_press_event(GdkEventButton *)
This is a default handler for the signal signal_button_press_event().
void render_region(std::shared_ptr< ARDOUR::Region >, Cairo::RefPtr< Cairo::Context > const &, double)
void set_gui_extents(samplepos_t, samplepos_t)
void playhead_position_changed(samplepos_t p)
double sample_to_xpos(samplepos_t p) const
PBD::ScopedConnectionList _connections
void on_size_allocate(Gtk::Allocation &)
This is a default handler for the signal signal_size_allocate().
bool rec_extent(samplepos_t &, samplepos_t &) const
TrackSummary(std::shared_ptr< ARDOUR::Route >)
void property_changed(PBD::PropertyChange const &)
sigc::connection _screen_update_connection
void on_size_request(Gtk::Requisition *)
This is a default handler for the signal signal_size_request().
std::list< sigc::connection > _entry_connections
void on_theme_changed()
void end_rename(bool)
void reset_group_peak_display(ARDOUR::RouteGroup *)
static PBD::Signal1< void, TrackRecordAxis * > CatchDeletion
Glib::RefPtr< Gtk::SizeGroup > _monitor_ctrl_size_group
bool entry_focus_in(GdkEventFocus *)
static Glib::RefPtr< Gtk::SizeGroup > _track_number_size_group
TrackSummary _track_summary
void disconnect_entry_signals()
bool namebox_button_press(GdkEventButton *)
bool entry_button_press(GdkEventButton *)
void route_active_changed()
void reset_route_peak_display(ARDOUR::Route *)
ArdourWidgets::ArdourVSpacer _vseparator
void set_session(ARDOUR::Session *s)
bool entry_key_press(GdkEventKey *)
void route_rec_enable_changed()
TrackRecordAxis(ARDOUR::Session *, std::shared_ptr< ARDOUR::Route >)
void set_gui_extents(samplepos_t, samplepos_t)
void parameter_changed(std::string const &p)
void set_button_names()
bool route_ops_click(GdkEventButton *)
bool rec_extent(samplepos_t &, samplepos_t &) const
static PBD::Signal2< void, TrackRecordAxis *, bool > EditNextName
void entry_changed()
ArdourWidgets::Frame _name_frame
bool entry_key_release(GdkEventKey *)
int summary_width() const
ArdourWidgets::ArdourButton _playlist_button
Gdk::Color color() const
void set_name_label()
static bool _size_group_initialized
std::shared_ptr< ARDOUR::Stripable > stripable() const
void update_sensitivity()
ArdourWidgets::ArdourButton _number_label
void entry_activated()
void route_property_changed(const PBD::PropertyChange &)
Gtk::EventBox _namebox
void blink_rec_display(bool onoff)
void build_route_ops_menu()
void on_size_allocate(Gtk::Allocation &)
This is a default handler for the signal signal_size_allocate().
void entry_populate_popup(Gtk::Menu *)
void reset_peak_display()
Gtk::Menu * _route_ops_menu
void route_color_changed()
std::string name() const
Glib::RefPtr< Gtk::SizeGroup > _ctrls_button_size_group
LevelMeterVBox * _level_meter
bool entry_focus_out(GdkEventFocus *)
std::string state_id() const
int summary_xpos() const
PBD::ScopedConnectionList _route_connections
bool playlist_click(GdkEventButton *)
Temporal::samplepos_t samplepos_t
RecInfo(samplepos_t s, samplepos_t e)