add toggles for region fade in/out/both active, plus toggle for region fades visibility
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3903 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
b8bb5f30aa
commit
1df8d73957
|
@ -215,6 +215,7 @@
|
|||
<menuitem action='cut-region-gain'/>
|
||||
<menuitem action='pitch-shift-region'/>
|
||||
<separator/>
|
||||
<menuitem action='toggle-selected-region-fades'/>
|
||||
<menuitem action='toggle-region-fades'/>
|
||||
</menu>
|
||||
|
||||
|
@ -223,6 +224,7 @@
|
|||
<menuitem action='show-editor-mixer'/>
|
||||
<menuitem action='ToggleMeasureVisibility'/>
|
||||
<menuitem action='ToggleLogoVisibility'/>
|
||||
<menuitem action='toggle-region-fades-visible'/>
|
||||
<separator/>
|
||||
<menu action="PrimaryClockMenu">
|
||||
<menuitem action="primary-clock-bbt"/>
|
||||
|
|
|
@ -226,6 +226,9 @@
|
|||
<menuitem action='cut-region-gain'/>
|
||||
<menuitem action='pitch-shift-region'/>
|
||||
<menuitem action='toggle-opaque-region'/>
|
||||
<menuitem action='toggle-selected-region-fade-in'/>
|
||||
<menuitem action='toggle-selected-region-fade-out'/>
|
||||
<menuitem action='toggle-selected-region-fades'/>
|
||||
<separator/>
|
||||
<menuitem action='duplicate-region'/>
|
||||
<menuitem action='multi-duplicate-region'/>
|
||||
|
@ -377,6 +380,7 @@
|
|||
<menuitem action='toggle-waveform-visible'/>
|
||||
<menuitem action='ToggleWaveformsWhileRecording'/>
|
||||
<menuitem action='SyncEditorAndMixerTrackOrder'/>
|
||||
<menuitem action='toggle-region-fades-visible'/>
|
||||
</menu>
|
||||
<menu name='JACK' action='JACK'>
|
||||
<menuitem action='JACKDisconnect'/>
|
||||
|
|
|
@ -176,7 +176,6 @@ AudioRegionView::init (Gdk::Color& basic_color, bool wfd)
|
|||
fade_out_shape->property_fill_color_rgba() = fade_color;
|
||||
fade_out_shape->set_data ("regionview", this);
|
||||
|
||||
|
||||
{
|
||||
uint32_t r,g,b,a;
|
||||
UINT_TO_RGBA(fill_color,&r,&g,&b,&a);
|
||||
|
@ -199,6 +198,10 @@ AudioRegionView::init (Gdk::Color& basic_color, bool wfd)
|
|||
fade_out_handle->set_data ("regionview", this);
|
||||
}
|
||||
|
||||
if (!Config->get_show_region_fades()) {
|
||||
set_fade_visibility (false);
|
||||
}
|
||||
|
||||
string foo = _region->name();
|
||||
foo += ':';
|
||||
foo += "gain";
|
||||
|
@ -392,8 +395,10 @@ AudioRegionView::reset_width_dependent_items (double pixel_width)
|
|||
fade_in_handle->hide();
|
||||
fade_out_handle->hide();
|
||||
} else {
|
||||
fade_in_handle->show();
|
||||
fade_out_handle->show();
|
||||
if (Config->get_show_region_fades()) {
|
||||
fade_in_handle->show();
|
||||
fade_out_handle->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -533,7 +538,9 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width)
|
|||
return;
|
||||
}
|
||||
|
||||
fade_in_shape->show();
|
||||
if (Config->get_show_region_fades()) {
|
||||
fade_in_shape->show();
|
||||
}
|
||||
|
||||
float curve[npoints];
|
||||
audio_region()->fade_in().get_vector (0, audio_region()->fade_in().back()->when, curve, npoints);
|
||||
|
@ -619,7 +626,9 @@ AudioRegionView::reset_fade_out_shape_width (nframes_t width)
|
|||
return;
|
||||
}
|
||||
|
||||
fade_out_shape->show();
|
||||
if (Config->get_show_region_fades()) {
|
||||
fade_out_shape->show();
|
||||
}
|
||||
|
||||
float curve[npoints];
|
||||
audio_region()->fade_out().get_vector (0, audio_region()->fade_out().back()->when, curve, npoints);
|
||||
|
@ -1266,3 +1275,34 @@ AudioRegionView::set_frame_color ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioRegionView::set_fade_visibility (bool yn)
|
||||
{
|
||||
if (yn) {
|
||||
if (fade_in_shape) {
|
||||
fade_in_shape->show();
|
||||
}
|
||||
if (fade_out_shape) {
|
||||
fade_out_shape->show ();
|
||||
}
|
||||
if (fade_in_handle) {
|
||||
fade_in_handle->show ();
|
||||
}
|
||||
if (fade_out_handle) {
|
||||
fade_out_handle->show ();
|
||||
}
|
||||
} else {
|
||||
if (fade_in_shape) {
|
||||
fade_in_shape->hide();
|
||||
}
|
||||
if (fade_out_shape) {
|
||||
fade_out_shape->hide ();
|
||||
}
|
||||
if (fade_in_handle) {
|
||||
fade_in_handle->hide ();
|
||||
}
|
||||
if (fade_out_handle) {
|
||||
fade_out_handle->hide ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,6 +106,8 @@ class AudioRegionView : public RegionView
|
|||
void reset_fade_in_shape_width (nframes_t);
|
||||
void reset_fade_out_shape_width (nframes_t);
|
||||
|
||||
void set_fade_visibility (bool);
|
||||
|
||||
virtual void entered ();
|
||||
virtual void exited ();
|
||||
|
||||
|
|
|
@ -725,6 +725,28 @@ AudioStreamView::update_rec_regions ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioStreamView::show_all_fades ()
|
||||
{
|
||||
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
|
||||
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
|
||||
if (arv) {
|
||||
arv->set_fade_visibility (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioStreamView::hide_all_fades ()
|
||||
{
|
||||
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
|
||||
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
|
||||
if (arv) {
|
||||
arv->set_fade_visibility (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioStreamView::show_all_xfades ()
|
||||
{
|
||||
|
|
|
@ -73,6 +73,9 @@ class AudioStreamView : public StreamView
|
|||
|
||||
void foreach_crossfadeview (void (CrossfadeView::*pmf)(void));
|
||||
|
||||
void show_all_fades ();
|
||||
void hide_all_fades ();
|
||||
|
||||
void show_all_xfades ();
|
||||
void hide_all_xfades ();
|
||||
void hide_xfades_involving (AudioRegionView&);
|
||||
|
|
|
@ -765,7 +765,10 @@ AutomationLine::get_verbose_cursor_string (float fraction)
|
|||
if (fraction == 0.0) {
|
||||
snprintf (buf, sizeof (buf), "-inf dB");
|
||||
} else {
|
||||
cerr << "from fraction " << fraction << " derived ";
|
||||
cerr << coefficient_to_dB (slider_position_to_gain (fraction));
|
||||
snprintf (buf, sizeof (buf), "%.1fdB", coefficient_to_dB (slider_position_to_gain (fraction)));
|
||||
cerr << " which prints as " << buf << endl;
|
||||
}
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), "%.2f", fraction);
|
||||
|
|
|
@ -325,9 +325,14 @@ class Editor : public PublicEditor
|
|||
void update_smpte_mode();
|
||||
void update_video_pullup();
|
||||
void update_subframes_per_frame ();
|
||||
|
||||
/* fades & xfades */
|
||||
|
||||
void toggle_region_fades ();
|
||||
void toggle_region_fades_visible ();
|
||||
void toggle_selected_region_fades (int dir);
|
||||
void update_region_fade_visibility ();
|
||||
|
||||
void toggle_auto_xfade ();
|
||||
void toggle_xfades_active ();
|
||||
void toggle_xfade_visibility ();
|
||||
|
|
|
@ -114,7 +114,16 @@ Editor::register_actions ()
|
|||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_toggle_action (editor_actions, "toggle-auto-xfades", _("Created Automatically"), mem_fun(*this, &Editor::toggle_auto_xfade));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_toggle_action (editor_actions, "toggle-region-fades", _("Active Region Fades"), mem_fun(*this, &Editor::toggle_region_fades));
|
||||
|
||||
act = ActionManager::register_toggle_action (editor_actions, "toggle-region-fades", _("Use Region Fades (global)"), mem_fun(*this, &Editor::toggle_region_fades));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_toggle_action (editor_actions, "toggle-region-fades-visible", _("Show Region Fades"), mem_fun(*this, &Editor::toggle_region_fades_visible));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_action (editor_actions, "toggle-selected-region-fade-in", _("Toggle Region Fade In"), bind (mem_fun(*this, &Editor::toggle_selected_region_fades), 1));;
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_action (editor_actions, "toggle-selected-region-fade-out", _("Toggle Region Fade Out"), bind (mem_fun(*this, &Editor::toggle_selected_region_fades), -1));;
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_action (editor_actions, "toggle-selected-region-fades", _("Toggle Region Fades"), bind (mem_fun(*this, &Editor::toggle_selected_region_fades), 0));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
|
||||
act = ActionManager::register_action (editor_actions, "playhead-to-next-region-boundary", _("Playhead to Next Region Boundary"), bind (mem_fun(*this, &Editor::cursor_to_next_region_boundary), playhead_cursor));
|
||||
|
@ -1657,6 +1666,12 @@ Editor::toggle_region_fades ()
|
|||
ActionManager::toggle_config_state ("Editor", "toggle-region-fades", &Configuration::set_use_region_fades, &Configuration::get_use_region_fades);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::toggle_region_fades_visible ()
|
||||
{
|
||||
ActionManager::toggle_config_state ("Editor", "toggle-region-fades-visible", &Configuration::set_show_region_fades, &Configuration::get_show_region_fades);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::toggle_auto_xfade ()
|
||||
{
|
||||
|
@ -1709,6 +1724,9 @@ Editor::parameter_changed (const char* parameter_name)
|
|||
} else if (PARAM_IS ("xfades-visible")) {
|
||||
ActionManager::map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_xfades_visible);
|
||||
update_xfade_visibility ();
|
||||
} else if (PARAM_IS ("show-region-fades")) {
|
||||
ActionManager::map_some_state ("Editor", "toggle-region-fades-visible", &Configuration::get_show_region_fades);
|
||||
update_region_fade_visibility ();
|
||||
} else if (PARAM_IS ("use-region-fades")) {
|
||||
ActionManager::map_some_state ("Editor", "toggle-region-fades", &Configuration::get_use_region_fades);
|
||||
} else if (PARAM_IS ("auto-xfade")) {
|
||||
|
@ -1745,3 +1763,4 @@ Editor::reset_canvas_action_sensitivity (bool onoff)
|
|||
(*x)->set_sensitive (onoff);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -361,7 +361,7 @@ Editor::controls_layout_size_request (Requisition* req)
|
|||
if (!screen) {
|
||||
screen = Gdk::Screen::get_default();
|
||||
}
|
||||
gint height = min ( (gint) pos, (screen->get_height() - 400));
|
||||
gint height = min ( (gint) pos, (screen->get_height() - 600));
|
||||
gint width = max (edit_controls_vbox.get_width(), controls_layout.get_width());
|
||||
|
||||
/* don't get too big. the fudge factors here are just guesses */
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "audio_time_axis.h"
|
||||
#include "automation_time_axis.h"
|
||||
#include "streamview.h"
|
||||
#include "audio_streamview.h"
|
||||
#include "audio_region_view.h"
|
||||
#include "rgb_macros.h"
|
||||
#include "selection_templates.h"
|
||||
|
@ -4906,6 +4907,69 @@ Editor::set_fade_out_active (bool yn)
|
|||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::toggle_selected_region_fades (int dir)
|
||||
{
|
||||
RegionSelection rs;
|
||||
RegionSelection::iterator i;
|
||||
boost::shared_ptr<AudioRegion> ar;
|
||||
bool yn;
|
||||
|
||||
get_regions_for_action (rs);
|
||||
|
||||
if (rs.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = rs.begin(); i != rs.end(); ++i) {
|
||||
if ((ar = boost::dynamic_pointer_cast<AudioRegion>((*i)->region())) != 0) {
|
||||
if (dir == -1) {
|
||||
yn = ar->fade_out_active ();
|
||||
} else {
|
||||
yn = ar->fade_in_active ();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == rs.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* XXX should this undo-able? */
|
||||
|
||||
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
|
||||
if ((ar = boost::dynamic_pointer_cast<AudioRegion>((*i)->region())) == 0) {
|
||||
continue;
|
||||
}
|
||||
if (dir == 1 || dir == 0) {
|
||||
ar->set_fade_in_active (!yn);
|
||||
}
|
||||
|
||||
if (dir == -1 || dir == 0) {
|
||||
ar->set_fade_out_active (!yn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Update region fade visibility after its configuration has been changed */
|
||||
void
|
||||
Editor::update_region_fade_visibility ()
|
||||
{
|
||||
bool _fade_visibility = Config->get_show_region_fades ();
|
||||
|
||||
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
|
||||
AudioTimeAxisView* v = dynamic_cast<AudioTimeAxisView*>(*i);
|
||||
if (v) {
|
||||
if (_fade_visibility) {
|
||||
v->audio_view()->show_all_fades ();
|
||||
} else {
|
||||
v->audio_view()->hide_all_fades ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Update crossfade visibility after its configuration has been changed */
|
||||
void
|
||||
|
@ -6035,3 +6099,4 @@ Editor::end_visual_state_op (uint32_t n)
|
|||
|
||||
return false; // do not call again
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue