Ardour  9.0-pre0-582-g084a23a80d
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/entry.h>
29 #include <gtkmm/eventbox.h>
30 #include <gtkmm/separator.h>
31 #include <gtkmm/sizegroup.h>
32 
33 #include "pbd/stateful.h"
34 
35 #include "ardour/ardour.h"
36 #include "ardour/types.h"
37 
38 #include "widgets/ardour_button.h"
39 #include "widgets/ardour_spacer.h"
40 #include "widgets/frame.h"
41 
42 #include "io_button.h"
43 #include "level_meter.h"
44 #include "route_ui.h"
45 
46 namespace ARDOUR
47 {
48  class Region;
49  class Route;
50  class RouteGroup;
51  class Session;
52  class Track;
53 }
54 
55 class LevelMeterVBox;
56 class RouteGroupMenu;
57 
58 class TrackRecordAxis : public Gtk::VBox, public AxisView, public RouteUI
59 {
60 public:
61  TrackRecordAxis (ARDOUR::Session*, std::shared_ptr<ARDOUR::Route>);
63 
64  /* AxisView */
65  std::string name () const;
66  Gdk::Color color () const;
67 
68  std::shared_ptr<ARDOUR::Stripable> stripable() const {
69  return RouteUI::stripable();
70  }
71 
73 
74  void fast_update ();
75  bool start_rename ();
77 
79  int summary_xpos () const;
80  int summary_width () const;
81 
84 
85 protected:
86  void self_delete ();
87 
90 
91  /* AxisView */
92  std::string state_id () const;
93 
94  /* route UI */
97  void blink_rec_display (bool onoff);
99  void map_frozen ();
100 
101 private:
103  void parameter_changed (std::string const& p);
104 
105  void set_name_label ();
106 
111 
115 
116  /* name editing */
117  void end_rename (bool);
118  void entry_changed ();
127 
128  /* RouteUI */
132 
134 
137 
138  bool _renaming;
142 
149 
150  Glib::RefPtr<Gtk::SizeGroup> _ctrls_button_size_group;
151  Glib::RefPtr<Gtk::SizeGroup> _monitor_ctrl_size_group;
152 
154  static Glib::RefPtr<Gtk::SizeGroup> _track_number_size_group;
155 
157  std::list<sigc::connection> _entry_connections;
158 
159  struct RecInfo {
161  : capture_start (s)
162  , capture_end (e)
163  {}
166  };
167 
168  class TrackSummary : public CairoWidget
169  {
170  public:
171  TrackSummary (std::shared_ptr<ARDOUR::Route>);
173 
177 
178  protected:
179  void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
183 
184  private:
185  void render_region (std::shared_ptr<ARDOUR::Region>, Cairo::RefPtr<Cairo::Context> const&, double);
190  void update_rec_box ();
191 
192  double sample_to_xpos (samplepos_t p) const
193  {
194  return (p - _start) * _xscale;
195  }
196 
197  std::shared_ptr<ARDOUR::Track> _track;
200  double _xscale;
204 
205  std::vector<RecInfo> _rec_rects;
208  sigc::connection _screen_update_connection;
209  };
210 
212 
213 };
214 
215 #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 *)
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 *)
static PBD::Signal< void(TrackRecordAxis *, bool)> EditNextName
void route_active_changed()
static PBD::Signal< void(TrackRecordAxis *)> CatchDeletion
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
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)