track naming patch from brian; slightly modified F11-bug workaround from brian; undo/redo items in edit menu now show operation to be undone/redone; canvas allocations now handled by an idle handler; region views respond to changes in fade/in/out curves ; undo/redo possible for some fade in/out operations; automation tracks extend to max_frames

git-svn-id: svn://localhost/ardour2/trunk@1134 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2006-11-16 18:42:48 +00:00
parent 7bbf761321
commit 2bf3ed423f
24 changed files with 254 additions and 205 deletions

View file

@ -85,16 +85,6 @@ ActionManager::init ()
}
}
RefPtr<Action>
ActionManager::register_action (RefPtr<ActionGroup> group, const char * name, const char * label, slot<void> sl, guint key, Gdk::ModifierType mods)
{
RefPtr<Action> act = register_action (group, name, label, sl);
cerr << "Reset A accel for " << name << endl;
AccelMap::add_entry (act->get_accel_path(), key, mods);
return act;
}
RefPtr<Action>
ActionManager::register_action (RefPtr<ActionGroup> group, const char * name, const char * label, slot<void> sl)
{
@ -118,16 +108,6 @@ ActionManager::register_action (RefPtr<ActionGroup> group, const char * name, co
}
RefPtr<Action>
ActionManager::register_radio_action (RefPtr<ActionGroup> group, RadioAction::Group& rgroup, const char * name, const char * label, slot<void> sl, guint key, Gdk::ModifierType mods)
{
RefPtr<Action> act = register_radio_action (group, rgroup, name, label, sl);
cerr << "Reset B accel for " << name << endl;
AccelMap::add_entry (act->get_accel_path(), key, mods);
return act;
}
RefPtr<Action>
ActionManager::register_radio_action (RefPtr<ActionGroup> group, RadioAction::Group& rgroup, const char * name, const char * label, slot<void> sl)
{
@ -139,16 +119,6 @@ ActionManager::register_radio_action (RefPtr<ActionGroup> group, RadioAction::Gr
return act;
}
RefPtr<Action>
ActionManager::register_toggle_action (RefPtr<ActionGroup> group, const char * name, const char * label, slot<void> sl, guint key, Gdk::ModifierType mods)
{
RefPtr<Action> act = register_toggle_action (group,name, label, sl);
cerr << "Reset C accel for " << name << endl;
AccelMap::add_entry (act->get_accel_path(), key, mods);
return act;
}
RefPtr<Action>
ActionManager::register_toggle_action (RefPtr<ActionGroup> group, const char * name, const char * label, slot<void> sl)
{

View file

@ -250,16 +250,52 @@ AudioRegionView::fade_out_changed ()
reset_fade_out_shape ();
}
void
AudioRegionView::set_fade_in_shape (AudioRegion::FadeShape shape)
{
AutomationList& alist = audio_region()->fade_in();
XMLNode& before (alist.get_state());
trackview.session().begin_reversible_command ("fade in shape");
audio_region()->set_fade_in_shape (shape);
XMLNode& after (alist.get_state());
trackview.session().add_command (new MementoCommand<AutomationList>(alist, &before, &after));
trackview.session().commit_reversible_command ();
}
void
AudioRegionView::set_fade_out_shape (AudioRegion::FadeShape shape)
{
AutomationList& alist = audio_region()->fade_out();
XMLNode& before (alist.get_state());
trackview.session().begin_reversible_command ("fade out shape");
audio_region()->set_fade_out_shape (shape);
XMLNode& after (alist.get_state());
trackview.session().add_command (new MementoCommand<AutomationList>(alist, &before, &after));
trackview.session().commit_reversible_command ();
}
void
AudioRegionView::set_fade_in_active (bool yn)
{
AutomationList& alist = audio_region()->fade_in();
XMLNode& before (alist.get_state());
trackview.session().begin_reversible_command ("fade in shape");
audio_region()->set_fade_in_active (yn);
XMLNode& after (alist.get_state());
trackview.session().add_command (new MementoCommand<AutomationList>(alist, &before, &after));
trackview.session().commit_reversible_command ();
}
void
AudioRegionView::set_fade_out_active (bool yn)
{
AutomationList& alist = audio_region()->fade_out();
XMLNode& before (alist.get_state());
trackview.session().begin_reversible_command ("fade out shape");
audio_region()->set_fade_out_active (yn);
XMLNode& after (alist.get_state());
trackview.session().add_command (new MementoCommand<AutomationList>(alist, &before, &after));
trackview.session().commit_reversible_command ();
}
void

View file

@ -24,7 +24,7 @@
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
#include <sigc++/signal.h>
#include <ardour/region.h>
#include <ardour/audioregion.h>
#include "region_view.h"
#include "route_time_axis.h"
@ -93,6 +93,8 @@ class AudioRegionView : public RegionView
void reset_fade_out_shape_width (nframes_t);
void set_fade_in_active (bool);
void set_fade_out_active (bool);
void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
virtual void entered ();
virtual void exited ();

View file

@ -1179,7 +1179,7 @@ AutomationLine::hide_selection ()
}
void
AutomationLine::list_changed (Change ignored)
AutomationLine::list_changed ()
{
queue_reset ();
}

View file

@ -202,7 +202,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin
virtual void change_model_range (ARDOUR::AutomationList::iterator,ARDOUR::AutomationList::iterator, double delta, float ydelta);
void reset_callback (const ARDOUR::AutomationList&);
void list_changed (ARDOUR::Change);
void list_changed ();
virtual bool event_handler (GdkEvent*);

View file

@ -43,24 +43,15 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
ignore_state_request = false;
first_call_to_set_height = true;
// base_rect = gnome_canvas_item_new (GNOME_CANVAS_GROUP(canvas_display),
// gnome_canvas_simplerect_get_type(),
// "x1", 0.0,
// "y1", 0.0,
// "x2", 1000000.0,
// "outline_color_rgba", color_map[cAutomationTrackOutline],
// /* outline ends and bottom */
// "outline_what", (guint32) (0x1|0x2|0x8),
// "fill_color_rgba", color_map[cAutomationTrackFill],
// NULL);
base_rect = new SimpleRect(*canvas_display);
base_rect->property_x1() = 0.0;
base_rect->property_y1() = 0.0;
base_rect->property_x2() = 1000000.0;
base_rect->property_x2() = max_frames;
base_rect->property_outline_color_rgba() = color_map[cAutomationTrackOutline];
/* outline ends and bottom */
base_rect->property_outline_what() = (guint32) (0x1|0x2|0x8);
base_rect->property_fill_color_rgba() = color_map[cAutomationTrackFill];
//base_rect->property_fill_color_rgba() = color_map[cEnteredControlPoint];
base_rect->set_data ("trackview", this);

View file

@ -307,6 +307,7 @@ Editor::Editor (AudioEngine& eng)
edit_cursor = 0;
playhead_cursor = 0;
button_release_can_deselect = true;
canvas_idle_queued = false;
location_marker_color = color_map[cLocationMarker];
location_range_color = color_map[cLocationRange];
@ -1120,6 +1121,7 @@ Editor::connect_to_session (Session *t)
update_title ();
session->GoingAway.connect (mem_fun(*this, &Editor::session_going_away));
session->history().Changed.connect (mem_fun (*this, &Editor::history_changed));
/* These signals can all be emitted by a non-GUI thread. Therefore the
handlers for them must not attempt to directly interact with the GUI,
@ -1312,7 +1314,6 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i
}
MenuList& items (fade_context_menu.items());
AudioRegion& ar (*arv->audio_region().get()); // FIXME
items.clear ();
@ -1327,11 +1328,11 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Linear"), bind (mem_fun (ar, &AudioRegion::set_fade_in_shape), AudioRegion::Linear)));
items.push_back (MenuElem (_("Slowest"), bind (mem_fun (ar, &AudioRegion::set_fade_in_shape), AudioRegion::LogB)));
items.push_back (MenuElem (_("Slow"), bind (mem_fun (ar, &AudioRegion::set_fade_in_shape), AudioRegion::Fast)));
items.push_back (MenuElem (_("Fast"), bind (mem_fun (ar, &AudioRegion::set_fade_in_shape), AudioRegion::LogA)));
items.push_back (MenuElem (_("Fastest"), bind (mem_fun (ar, &AudioRegion::set_fade_in_shape), AudioRegion::Slow)));
items.push_back (MenuElem (_("Linear"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::Linear)));
items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::LogB)));
items.push_back (MenuElem (_("Slow"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::Fast)));
items.push_back (MenuElem (_("Fast"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::LogA)));
items.push_back (MenuElem (_("Fastest"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::Slow)));
break;
case FadeOutItem:
@ -1344,13 +1345,14 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Linear"), bind (mem_fun (ar, &AudioRegion::set_fade_out_shape), AudioRegion::Linear)));
items.push_back (MenuElem (_("Slowest"), bind (mem_fun (ar, &AudioRegion::set_fade_out_shape), AudioRegion::Fast)));
items.push_back (MenuElem (_("Slow"), bind (mem_fun (ar, &AudioRegion::set_fade_out_shape), AudioRegion::LogB)));
items.push_back (MenuElem (_("Fast"), bind (mem_fun (ar, &AudioRegion::set_fade_out_shape), AudioRegion::LogA)));
items.push_back (MenuElem (_("Fastest"), bind (mem_fun (ar, &AudioRegion::set_fade_out_shape), AudioRegion::Slow)));
items.push_back (MenuElem (_("Linear"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::Linear)));
items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::Fast)));
items.push_back (MenuElem (_("Slow"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::LogB)));
items.push_back (MenuElem (_("Fast"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::LogA)));
items.push_back (MenuElem (_("Fastest"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::Slow)));
break;
default:
fatal << _("programming error: ")
<< X_("non-fade canvas item passed to popup_fade_context_menu()")
@ -3291,89 +3293,27 @@ Editor::set_edit_group_mute (Route& route, bool yn)
}
void
Editor::set_edit_menu (Menu& menu)
Editor::history_changed ()
{
edit_menu = &menu;
edit_menu->signal_map_event().connect (mem_fun(*this, &Editor::edit_menu_map_handler));
}
bool
Editor::edit_menu_map_handler (GdkEventAny* ev)
{
using namespace Menu_Helpers;
MenuList& edit_items = edit_menu->items();
string label;
/* Nuke all the old items */
edit_items.clear ();
if (session == 0) {
return false;
}
if (undo_action && session) {
if (session->undo_depth() == 0) {
label = _("Undo");
} else {
label = string_compose(_("Undo (%1)"), session->next_undo());
}
edit_items.push_back (MenuElem (label, bind (mem_fun(*this, &Editor::undo), 1U)));
if (session->undo_depth() == 0) {
edit_items.back().set_sensitive (false);
undo_action->property_label() = label;
}
if (redo_action && session) {
if (session->redo_depth() == 0) {
label = _("Redo");
} else {
label = string_compose(_("Redo (%1)"), session->next_redo());
}
edit_items.push_back (MenuElem (label, bind (mem_fun(*this, &Editor::redo), 1U)));
if (session->redo_depth() == 0) {
edit_items.back().set_sensitive (false);
redo_action->property_label() = label;
}
vector<MenuItem*> mitems;
edit_items.push_back (SeparatorElem());
edit_items.push_back (MenuElem (_("Cut"), mem_fun(*this, &Editor::cut)));
mitems.push_back (&edit_items.back());
edit_items.push_back (MenuElem (_("Copy"), mem_fun(*this, &Editor::copy)));
mitems.push_back (&edit_items.back());
edit_items.push_back (MenuElem (_("Paste"), bind (mem_fun(*this, &Editor::paste), 1.0f)));
mitems.push_back (&edit_items.back());
edit_items.push_back (SeparatorElem());
edit_items.push_back (MenuElem (_("Align"), bind (mem_fun(*this, &Editor::align), ARDOUR::SyncPoint)));
mitems.push_back (&edit_items.back());
edit_items.push_back (MenuElem (_("Align Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint)));
mitems.push_back (&edit_items.back());
edit_items.push_back (SeparatorElem());
if (selection->empty()) {
for (vector<MenuItem*>::iterator i = mitems.begin(); i != mitems.end(); ++i) {
(*i)->set_sensitive (false);
}
}
Menu* import_menu = manage (new Menu());
import_menu->set_name ("ArdourContextMenu");
MenuList& import_items = import_menu->items();
import_items.push_back (MenuElem (_("... as new track"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsTrack)));
import_items.push_back (MenuElem (_("... as new region"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion)));
edit_items.push_back (MenuElem (_("Import audio (copy)"), *import_menu));
edit_items.push_back (SeparatorElem());
edit_items.push_back (MenuElem (_("Remove last capture"), mem_fun(*this, &Editor::remove_last_capture)));
if (!session->have_captured()) {
edit_items.back().set_sensitive (false);
}
return false;
}
void
@ -4047,24 +3987,34 @@ Editor::session_state_saved (string snap_name)
void
Editor::maximise_editing_space ()
{
initial_ruler_update_required = true;
mouse_mode_tearoff->set_visible (false);
tools_tearoff->set_visible (false);
pre_maximal_pane_position = edit_pane.get_position();
pre_maximal_editor_width = this->get_width();
edit_pane.set_position (edit_pane.get_width());
fullscreen();
}
void
Editor::restore_editing_space ()
{
initial_ruler_update_required = true;
unfullscreen();
mouse_mode_tearoff->set_visible (true);
tools_tearoff->set_visible (true);
edit_pane.set_position (pre_maximal_pane_position);
unfullscreen();
edit_pane.set_position (
pre_maximal_pane_position + abs(this->get_width() - pre_maximal_editor_width)
);
}
void

View file

@ -174,8 +174,6 @@ class Editor : public PublicEditor
/* undo related */
void set_edit_menu (Gtk::Menu&);
nframes_t unit_to_frame (double unit) {
return (nframes_t) rint (unit * frames_per_unit);
}
@ -354,6 +352,7 @@ class Editor : public PublicEditor
Editing::MouseMode mouse_mode;
int pre_maximal_pane_position;
int pre_maximal_editor_width;
void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
Gtk::Notebook the_notebook;
@ -1125,7 +1124,10 @@ class Editor : public PublicEditor
bool track_canvas_event (GdkEvent* event, ArdourCanvas::Item*);
bool track_canvas_scroll (GdkEventScroll* event);
Gtk::Allocation canvas_allocation;
bool canvas_idle_queued;
void track_canvas_allocate (Gtk::Allocation alloc);
bool track_canvas_idle ();
void set_edit_cursor (GdkEvent* event);
void set_playhead_cursor (GdkEvent* event);
@ -1621,11 +1623,6 @@ class Editor : public PublicEditor
void duplicate_dialog (bool for_region);
/* edit menu */
Gtk::Menu* edit_menu;
bool edit_menu_map_handler (GdkEventAny*);
nframes_t event_frame (GdkEvent*, double* px = 0, double* py = 0);
void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
@ -1783,6 +1780,12 @@ class Editor : public PublicEditor
bool on_key_press_event (GdkEventKey*);
void session_state_saved (string);
Glib::RefPtr<Gtk::Action> undo_action;
Glib::RefPtr<Gtk::Action> redo_action;
void history_changed ();
};
#endif /* __ardour_editor_h__ */

View file

@ -201,9 +201,9 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "set-region-sync-position", _("Set Region Sync Position"), mem_fun(*this, &Editor::kbd_set_sync_position));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "undo", _("Undo"), bind (mem_fun(*this, &Editor::undo), 1U));
undo_action = act = ActionManager::register_action (editor_actions, "undo", _("Undo"), bind (mem_fun(*this, &Editor::undo), 1U));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "redo", _("Redo"), bind (mem_fun(*this, &Editor::redo), 1U));
redo_action = act = ActionManager::register_action (editor_actions, "redo", _("Redo"), bind (mem_fun(*this, &Editor::redo), 1U));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "export-session", _("Export Session"), mem_fun(*this, &Editor::export_session));

View file

@ -275,9 +275,32 @@ Editor::initialize_canvas ()
void
Editor::track_canvas_allocate (Gtk::Allocation alloc)
{
canvas_allocation = alloc;
canvas_width = alloc.get_width();
canvas_height = alloc.get_height();
if (!initial_ruler_update_required) {
if (!canvas_idle_queued) {
/* call this first so that we do stuff before any pending redraw */
Glib::signal_idle().connect (mem_fun (*this, &Editor::track_canvas_idle), false);
canvas_idle_queued = true;
}
return;
}
initial_ruler_update_required = false;
track_canvas_idle ();
}
bool
Editor::track_canvas_idle ()
{
if (canvas_idle_queued) {
canvas_idle_queued = false;
}
canvas_width = canvas_allocation.get_width();
canvas_height = canvas_allocation.get_height();
zoom_range_clock.set ((nframes_t) floor ((canvas_width * frames_per_unit)));
edit_cursor->set_position (edit_cursor->current_frame);
@ -319,18 +342,12 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc)
transport_punchout_line->property_y2() = canvas_height;
}
if (is_visible() && initial_ruler_update_required) {
/*
this is really dumb, but signal_size_allocate() gets emitted intermittently
depending on whether the canvas contents are visible or not.
we only want to do this once
*/
update_fixed_rulers();
tempo_map_changed (Change (0));
initial_ruler_update_required = false;
}
Resized (); /* EMIT_SIGNAL */
return false;
}
void

View file

@ -1818,12 +1818,13 @@ Editor::fade_in_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* even
}
begin_reversible_command (_("change fade in length"));
XMLNode &before = arv->audio_region()->get_state();
AutomationList& alist = arv->audio_region()->fade_in();
XMLNode &before = alist.get_state();
arv->audio_region()->set_fade_in_length (fade_length);
XMLNode &after = arv->audio_region()->get_state();
session->add_command(new MementoCommand<ARDOUR::AudioRegion>(*arv->audio_region().get(), &before, &after));
XMLNode &after = alist.get_state();
session->add_command(new MementoCommand<AutomationList>(alist, &before, &after));
commit_reversible_command ();
fade_in_drag_motion_callback (item, event);
}
@ -1913,12 +1914,13 @@ Editor::fade_out_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* eve
}
begin_reversible_command (_("change fade out length"));
XMLNode &before = arv->region()->get_state();
AutomationList& alist = arv->audio_region()->fade_out();
XMLNode &before = alist.get_state();
arv->audio_region()->set_fade_out_length (fade_length);
XMLNode &after = arv->region()->get_state();
session->add_command(new MementoCommand<ARDOUR::Region>(*arv->region().get(), &before, &after));
XMLNode &after = alist.get_state();
session->add_command(new MementoCommand<AutomationList>(alist, &before, &after));
commit_reversible_command ();
fade_out_drag_motion_callback (item, event);

View file

@ -57,7 +57,7 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv)
canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group);
canvas_rect->property_x1() = 0.0;
canvas_rect->property_y1() = 0.0;
canvas_rect->property_x2() = 1000000.0;
canvas_rect->property_x2() = max_frames;
canvas_rect->property_y2() = (double)20;
canvas_rect->property_outline_color_rgba() = color_map[cMarkerTrackOutline];
canvas_rect->property_fill_color_rgba() = stream_base_color;

View file

@ -86,7 +86,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
virtual void new_region_from_selection () = 0;
virtual void separate_region_from_selection () = 0;
virtual void toggle_playback (bool with_abort) = 0;
virtual void set_edit_menu (Gtk::Menu&) = 0;
virtual nframes_t unit_to_frame (double unit) = 0;
virtual double frame_to_unit (nframes_t frame) = 0;
virtual double frame_to_unit (double frame) = 0;
@ -114,6 +113,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
virtual bool set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove = false) = 0;
virtual void set_selected_mixer_strip (TimeAxisView&) = 0;
virtual void hide_track_in_display (TimeAxisView& tv) = 0;
virtual void show_track_in_display (TimeAxisView& tv) = 0;
virtual void set_follow_playhead (bool yn) = 0;
virtual void toggle_follow_playhead () = 0;
virtual bool follow_playhead() const = 0;

View file

@ -234,7 +234,7 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
if (canvas_item_visible ((*i)->canvas_display)) {
++nth;
effective_height += (*i)->show_at (y + effective_height, nth, parent);
effective_height += (*i)->show_at (y + 1 + effective_height, nth, parent);
}
}
@ -373,8 +373,43 @@ TimeAxisView::set_height_pixels (uint32_t h)
bool
TimeAxisView::name_entry_key_release (GdkEventKey* ev)
{
PublicEditor::TrackViewList *allviews = 0;
PublicEditor::TrackViewList::iterator i;
switch (ev->keyval) {
case GDK_Escape:
name_entry.select_region (0,0);
controls_ebox.grab_focus ();
name_entry_changed ();
return true;
/* Shift+Tab Keys Pressed. Note that for Shift+Tab, GDK actually
* generates a different ev->keyval, rather than setting
* ev->state.
*/
case GDK_ISO_Left_Tab:
case GDK_Tab:
name_entry_changed ();
allviews = editor.get_valid_views (0);
if (allviews != 0) {
i = find (allviews->begin(), allviews->end(), this);
if (i != allviews->end()) {
do {
if(ev->keyval == GDK_Tab) {
if(++i == allviews->end()) { return true; }
} else {
if(i-- == allviews->begin()) { return true; }
}
} while((*i)->hidden());
if((*i)->height_style == Small) {
(*i)->set_height(Smaller);
}
(*i)->name_entry.grab_focus();
}
}
return true;
case GDK_Up:
case GDK_Down:
name_entry_changed ();
@ -424,6 +459,7 @@ TimeAxisView::name_entry_focus_out (GdkEventFocus* ev)
last_name_entry_key_press_event = 0;
name_entry_key_timeout.disconnect ();
name_entry.set_name ("EditorTrackNameDisplay");
name_entry.select_region (0,0);
/* do the real stuff */

View file

@ -171,8 +171,11 @@ class AudioRegion : public Region
void recompute_at_start ();
void recompute_at_end ();
void envelope_changed (Change);
void envelope_changed ();
void fade_in_changed ();
void fade_out_changed ();
void source_offset_changed ();
void listen_to_my_curves ();
void source_deleted ();

View file

@ -152,7 +152,7 @@ class AutomationList : public PBD::StatefulDestructible
(obj.*method)(*this);
}
sigc::signal<void,Change> StateChanged;
sigc::signal<void> StateChanged;
XMLNode& get_state(void);
int set_state (const XMLNode &s);

View file

@ -742,16 +742,19 @@ class Session : public PBD::StatefulDestructible
/* History (for editors, mixers, UIs etc.) */
void undo (uint32_t n) {
history.undo (n);
}
void redo (uint32_t n) {
history.redo (n);
_history.undo (n);
}
uint32_t undo_depth() const { return history.undo_depth(); }
uint32_t redo_depth() const { return history.redo_depth(); }
string next_undo() const { return history.next_undo(); }
string next_redo() const { return history.next_redo(); }
void redo (uint32_t n) {
_history.redo (n);
}
UndoHistory& history() { return _history; }
uint32_t undo_depth() const { return _history.undo_depth(); }
uint32_t redo_depth() const { return _history.redo_depth(); }
string next_undo() const { return _history.next_undo(); }
string next_redo() const { return _history.next_redo(); }
void begin_reversible_command (string cmd_name);
void commit_reversible_command (Command* cmd = 0);
@ -1568,7 +1571,7 @@ class Session : public PBD::StatefulDestructible
void reverse_diskstream_buffers ();
UndoHistory history;
UndoHistory _history;
UndoTransaction* current_trans;
GlobalRouteBooleanState get_global_route_boolean (bool (Route::*method)(void) const);

View file

@ -80,7 +80,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n
set_default_fades ();
set_default_envelope ();
_envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed));
listen_to_my_curves ();
}
AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
@ -105,7 +105,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n
set_default_fades ();
set_default_envelope ();
_envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed));
listen_to_my_curves ();
}
AudioRegion::AudioRegion (SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
@ -132,7 +132,7 @@ AudioRegion::AudioRegion (SourceList& srcs, nframes_t start, nframes_t length, c
set_default_fades ();
set_default_envelope ();
_envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed));
listen_to_my_curves ();
}
@ -196,7 +196,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, nframes_t
_scale_amplitude = other->_scale_amplitude;
_envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed));
listen_to_my_curves ();
}
AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other)
@ -237,7 +237,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other)
_fade_in_disabled = 0;
_fade_out_disabled = 0;
_envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed));
listen_to_my_curves ();
}
AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, const XMLNode& node)
@ -261,7 +261,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, const XMLNode& nod
throw failed_constructor();
}
_envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed));
listen_to_my_curves ();
}
AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node)
@ -301,7 +301,7 @@ AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node)
throw failed_constructor();
}
_envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed));
listen_to_my_curves ();
}
AudioRegion::~AudioRegion ()
@ -316,6 +316,14 @@ AudioRegion::~AudioRegion ()
GoingAway (); /* EMIT SIGNAL */
}
void
AudioRegion::listen_to_my_curves ()
{
_envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed));
_fade_in.StateChanged.connect (mem_fun (*this, &AudioRegion::fade_in_changed));
_fade_out.StateChanged.connect (mem_fun (*this, &AudioRegion::fade_out_changed));
}
bool
AudioRegion::verify_length (nframes_t len)
{
@ -1248,7 +1256,19 @@ AudioRegion::normalize_to (float target_dB)
}
void
AudioRegion::envelope_changed (Change ignored)
AudioRegion::fade_in_changed ()
{
send_change (FadeInChanged);
}
void
AudioRegion::fade_out_changed ()
{
send_change (FadeOutChanged);
}
void
AudioRegion::envelope_changed ()
{
send_change (EnvelopeChanged);
}

View file

@ -192,7 +192,7 @@ AutomationList::maybe_signal_changed ()
if (_frozen) {
changed_when_thawed = true;
} else {
StateChanged (Change (0));
StateChanged ();
}
}
@ -583,7 +583,7 @@ AutomationList::thaw ()
{
_frozen = false;
if (changed_when_thawed) {
StateChanged(Change(0)); /* EMIT SIGNAL */
StateChanged(); /* EMIT SIGNAL */
}
}
@ -1255,13 +1255,13 @@ AutomationList::set_state (const XMLNode& node)
return deserialize_events (node);
}
if (node.name() == X_("Envelope") && (nsos = node.child (X_("AutomationList")))) {
if (node.name() == X_("Envelope") || node.name() == X_("FadeOut") || node.name() == X_("FadeIn")) {
if ((nsos = node.child (X_("AutomationList")))) {
/* new school in old school clothing */
return set_state (*nsos);
}
if (node.name() == X_("Envelope") || node.name() == X_("FadeOut") || node.name() == X_("FadeIn")) {
/* old school */
const XMLNodeList& elist = node.children();

View file

@ -259,7 +259,7 @@ BaseStereoPanner::load (istream& in, string path, uint32_t& linecnt)
/* now that we are done loading */
_automation.StateChanged (Change (0));
_automation.StateChanged ();
return 0;
}

View file

@ -405,7 +405,7 @@ Session::~Session ()
/* clear history so that no references to objects are held any more */
history.clear ();
_history.clear ();
/* clear state tree so that no references to objects are held any more */

View file

@ -2097,7 +2097,7 @@ Session::commit_reversible_command (Command *cmd)
gettimeofday (&now, 0);
current_trans->set_timestamp (now);
history.add (current_trans);
_history.add (current_trans);
}
Session::GlobalRouteBooleanState
@ -2647,7 +2647,7 @@ Session::cleanup_sources (Session::cleanup_report& rep)
/* dump the history list */
history.clear ();
_history.clear ();
/* save state so we don't end up a session file
referring to non-existent sources.
@ -2798,7 +2798,7 @@ Session::save_history (string snapshot_name)
string xml_path;
string bak_path;
tree.set_root (&history.get_state());
tree.set_root (&_history.get_state());
if (snapshot_name.empty()) {
snapshot_name = _current_snapshot_name;
@ -2825,8 +2825,7 @@ Session::save_history (string snapshot_name)
* possible to fix.
*/
if (unlink (xml_path.c_str()))
{
if (unlink (xml_path.c_str())) {
error << string_compose (_("could not remove corrupt history file %1"), xml_path) << endmsg;
} else {
if (rename (bak_path.c_str(), xml_path.c_str()))
@ -2862,7 +2861,7 @@ Session::restore_history (string snapshot_name)
}
/* replace history */
history.clear();
_history.clear();
for (XMLNodeConstIterator it = tree.root()->children().begin(); it != tree.root()->children().end(); it++) {
@ -2895,7 +2894,7 @@ Session::restore_history (string snapshot_name)
}
}
history.add (ut);
_history.add (ut);
}
return 0;

View file

@ -74,7 +74,7 @@ class UndoTransaction : public Command
friend void command_death (UndoTransaction*, Command *);
};
class UndoHistory
class UndoHistory : public sigc::trackable
{
public:
UndoHistory();
@ -97,6 +97,8 @@ class UndoHistory
XMLNode &get_state();
void save_state();
sigc::signal<void> Changed;
private:
bool _clearing;
std::list<UndoTransaction*> UndoList;

View file

@ -157,6 +157,8 @@ UndoHistory::add (UndoTransaction* const ut)
UndoList.push_back (ut);
/* we are now owners of the transaction */
Changed (); /* EMIT SIGNAL */
}
void
@ -168,6 +170,8 @@ UndoHistory::remove (UndoTransaction* const ut)
UndoList.remove (ut);
RedoList.remove (ut);
Changed (); /* EMIT SIGNAL */
}
void
@ -182,6 +186,8 @@ UndoHistory::undo (unsigned int n)
ut->undo ();
RedoList.push_back (ut);
}
Changed (); /* EMIT SIGNAL */
}
void
@ -196,6 +202,8 @@ UndoHistory::redo (unsigned int n)
ut->redo ();
UndoList.push_back (ut);
}
Changed (); /* EMIT SIGNAL */
}
void
@ -204,6 +212,9 @@ UndoHistory::clear_redo ()
_clearing = true;
RedoList.clear ();
_clearing = false;
Changed (); /* EMIT SIGNAL */
}
void
@ -212,6 +223,8 @@ UndoHistory::clear_undo ()
_clearing = true;
UndoList.clear ();
_clearing = false;
Changed (); /* EMIT SIGNAL */
}
void
@ -219,6 +232,8 @@ UndoHistory::clear ()
{
clear_undo ();
clear_redo ();
Changed (); /* EMIT SIGNAL */
}
XMLNode & UndoHistory::get_state()