ardour
region_gain_line.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000-2007 Paul Davis
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
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #include "evoral/Curve.hpp"
21 #include "pbd/memento_command.h"
23 
24 #include "ardour/audioregion.h"
25 #include "ardour/session.h"
26 
27 #include "control_point.h"
28 #include "region_gain_line.h"
29 #include "audio_region_view.h"
30 
31 #include "time_axis_view.h"
32 #include "editor.h"
33 #include "gui_thread.h"
34 
35 #include "i18n.h"
36 
37 using namespace std;
38 using namespace ARDOUR;
39 using namespace PBD;
40 
42  : AutomationLine (name, r.get_time_axis_view(), parent, l, l->parameter())
43  , rv (r)
44 {
45  // If this isn't true something is horribly wrong, and we'll get catastrophic gain values
46  assert(l->parameter().type() == EnvelopeAutomation);
47 
49 
51 
52  group->raise_to_top ();
53  group->set_y_position (2);
54  set_uses_gain_mapping (true);
56 }
57 
58 void
60 {
61  AutomationLine::start_drag_single (cp, x, fraction);
62 
63  // XXX Stateful need to capture automation curve data
64 
65  if (!rv.audio_region()->envelope_active()) {
68  }
69 }
70 
71 // This is an extended copy from AutomationList
72 void
74 {
75  trackview.editor().begin_reversible_command (_("remove control point"));
76  XMLNode &before = alist->get_state();
77 
78  if (!rv.audio_region()->envelope_active()) {
82  }
83 
84  alist->erase (cp.model());
85 
89 }
90 
91 void
92 AudioRegionGainLine::end_drag (bool with_push, uint32_t final_index)
93 {
94  if (!rv.audio_region()->envelope_active()) {
97  }
98 
99  AutomationLine::end_drag (with_push, final_index);
100 }
101 
102 void
104 {
105  PropertyChange interesting_stuff;
106 
107  interesting_stuff.add (ARDOUR::Properties::start);
108  interesting_stuff.add (ARDOUR::Properties::position);
109 
110  if (what_changed.contains (interesting_stuff)) {
112  }
113 }
PublicEditor & editor() const
XMLNode & get_state()
Definition: region.cc:1228
AudioRegionGainLine(const std::string &name, AudioRegionView &, ArdourCanvas::Container &parent, boost::shared_ptr< ARDOUR::AutomationList >)
PBD::Signal1< void, const PropertyChange & > PropertyChanged
Definition: stateful.h:87
void start_drag_single(ControlPoint *, double, float)
virtual void start_drag_single(ControlPoint *, double, float)
void set_envelope_active(bool yn)
Definition: audioregion.cc:404
virtual void end_drag(bool with_push, uint32_t final_index)
void end_drag(bool with_push, uint32_t final_index)
void add_command(Command *const cmd)
Definition: session.h:787
Definition: Beats.hpp:239
void set_uses_gain_mapping(bool yn)
boost::shared_ptr< ARDOUR::AudioRegion > audio_region() const
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
Definition: region.cc:63
#define invalidator(x)
Definition: gui_thread.h:40
#define _(Text)
Definition: i18n.h:11
void remove_point(ControlPoint &)
boost::shared_ptr< ARDOUR::Region > region() const
Definition: region_view.h:66
ArdourCanvas::Container * group
Definition: amp.h:29
ARDOUR::Session * session() const
Definition: axis_view.h:52
AudioRegionView & rv
virtual void begin_reversible_command(std::string cmd_name)=0
#define gui_context()
Definition: gui_thread.h:36
virtual void commit_reversible_command()=0
TimeAxisView & trackview
Evoral::TimeConverter< double, ARDOUR::framepos_t > * _time_converter
void erase(iterator)
const Parameter & parameter() const
T * get() const
Definition: shared_ptr.hpp:268
framepos_t position() const
Definition: region.h:112
PBD::ScopedConnection _region_changed_connection
const char * name
boost::shared_ptr< ARDOUR::AutomationList > alist
void region_changed(const PBD::PropertyChange &what_changed)
Definition: xml++.h:95
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > position
Definition: region.cc:65
ARDOUR::AutomationList::iterator model() const
Definition: control_point.h:80
uint32_t type() const
Definition: Parameter.hpp:47
Definition: debug.h:30
bool contains(PropertyDescriptor< T > p) const
bool terminal_points_can_slide
void clear_changes()
Definition: stateful.cc:184
void add(PropertyID id)
bool envelope_active() const
Definition: audioregion.h:83
virtual ARDOUR::Session * session() const =0