add reset envelope gain; small patch from brian for tearoff dragging
git-svn-id: svn://localhost/ardour2/trunk@1139 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -1744,15 +1744,17 @@ Editor::add_region_context_items (AudioStreamView* sv, boost::shared_ptr<Region>
|
||||
|
||||
RegionView* rv = sv->find_view (ar);
|
||||
AudioRegionView* arv = dynamic_cast<AudioRegionView*>(rv);
|
||||
|
||||
items.push_back (MenuElem (_("Reset Envelope"), mem_fun(*this, &Editor::reset_region_gain_envelopes)));
|
||||
|
||||
items.push_back (CheckMenuElem (_("Envelope visible"), mem_fun(*this, &Editor::toggle_gain_envelope_visibility)));
|
||||
items.push_back (CheckMenuElem (_("Envelope Visible"), mem_fun(*this, &Editor::toggle_gain_envelope_visibility)));
|
||||
region_envelope_visible_item = static_cast<CheckMenuItem*> (&items.back());
|
||||
|
||||
if (arv->envelope_visible()) {
|
||||
region_envelope_visible_item->set_active (true);
|
||||
}
|
||||
|
||||
items.push_back (CheckMenuElem (_("Envelope active"), mem_fun(*this, &Editor::toggle_gain_envelope_active)));
|
||||
items.push_back (CheckMenuElem (_("Envelope Active"), mem_fun(*this, &Editor::toggle_gain_envelope_active)));
|
||||
region_envelope_active_item = static_cast<CheckMenuItem*> (&items.back());
|
||||
|
||||
if (ar->envelope_active()) {
|
||||
@@ -1774,7 +1776,7 @@ Editor::add_region_context_items (AudioStreamView* sv, boost::shared_ptr<Region>
|
||||
/* range related stuff */
|
||||
|
||||
items.push_back (MenuElem (_("Add Range Markers"), mem_fun (*this, &Editor::add_location_from_audio_region)));
|
||||
items.push_back (MenuElem (_("Set Range"), mem_fun (*this, &Editor::set_selection_from_audio_region)));
|
||||
items.push_back (MenuElem (_("Set Range Selection"), mem_fun (*this, &Editor::set_selection_from_audio_region)));
|
||||
items.push_back (SeparatorElem());
|
||||
|
||||
/* Nudge region */
|
||||
|
||||
@@ -1770,6 +1770,7 @@ class Editor : public PublicEditor
|
||||
|
||||
void toggle_gain_envelope_visibility ();
|
||||
void toggle_gain_envelope_active ();
|
||||
void reset_region_gain_envelopes ();
|
||||
|
||||
Gtk::CheckMenuItem* region_envelope_visible_item;
|
||||
Gtk::CheckMenuItem* region_envelope_active_item;
|
||||
|
||||
@@ -3474,6 +3474,29 @@ Editor::brush (nframes_t pos)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::reset_region_gain_envelopes ()
|
||||
{
|
||||
if (!session || selection->regions.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
session->begin_reversible_command (_("reset region gain"));
|
||||
|
||||
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
|
||||
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
|
||||
if (arv) {
|
||||
AutomationList& alist (arv->audio_region()->envelope());
|
||||
XMLNode& before (alist.get_state());
|
||||
|
||||
arv->audio_region()->set_default_envelope ();
|
||||
session->add_command (new MementoCommand<AutomationList>(arv->audio_region()->envelope(), &before, &alist.get_state()));
|
||||
}
|
||||
}
|
||||
|
||||
session->commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::toggle_gain_envelope_visibility ()
|
||||
{
|
||||
|
||||
@@ -116,6 +116,7 @@ class AudioRegion : public Region
|
||||
void set_fade_out (FadeShape, nframes_t);
|
||||
|
||||
void set_envelope_active (bool yn);
|
||||
void set_default_envelope ();
|
||||
|
||||
int separate_by_channel (ARDOUR::Session&, vector<AudioRegion*>&) const;
|
||||
|
||||
@@ -153,7 +154,6 @@ class AudioRegion : public Region
|
||||
void set_default_fades ();
|
||||
void set_default_fade_in ();
|
||||
void set_default_fade_out ();
|
||||
void set_default_envelope ();
|
||||
|
||||
void recompute_gain_at_end ();
|
||||
void recompute_gain_at_start ();
|
||||
|
||||
@@ -109,7 +109,7 @@ TearOff::tearoff_click (GdkEventButton* ev)
|
||||
own_window.show_all ();
|
||||
hide ();
|
||||
Detach ();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
gint
|
||||
@@ -121,19 +121,25 @@ TearOff::close_click (GdkEventButton* ev)
|
||||
own_window.hide ();
|
||||
show_all ();
|
||||
Attach ();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
gint
|
||||
TearOff::window_button_press (GdkEventButton* ev)
|
||||
{
|
||||
if (dragging) {
|
||||
dragging = false;
|
||||
own_window.remove_modal_grab();
|
||||
return true;
|
||||
}
|
||||
|
||||
dragging = true;
|
||||
drag_x = ev->x_root;
|
||||
drag_y = ev->y_root;
|
||||
|
||||
own_window.add_modal_grab();
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
gint
|
||||
@@ -141,7 +147,7 @@ TearOff::window_button_release (GdkEventButton* ev)
|
||||
{
|
||||
dragging = false;
|
||||
own_window.remove_modal_grab();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
gint
|
||||
@@ -163,7 +169,7 @@ TearOff::window_motion (GdkEventMotion* ev)
|
||||
own_window.get_pointer (mx, my);
|
||||
|
||||
if (!dragging) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
x_delta = ev->x_root - drag_x;
|
||||
@@ -175,7 +181,7 @@ TearOff::window_motion (GdkEventMotion* ev)
|
||||
drag_x = ev->x_root;
|
||||
drag_y = ev->y_root;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
Reference in New Issue
Block a user