change PropertyChange from a bitfield into a real object, with all the many widesprea...
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 19 Feb 2010 18:09:08 +0000 (18:09 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 19 Feb 2010 18:09:08 +0000 (18:09 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6701 d708f5d6-7413-0410-9779-e7cbd77b26cf

78 files changed:
gtk2_ardour/audio_region_editor.cc
gtk2_ardour/audio_region_editor.h
gtk2_ardour/audio_region_view.cc
gtk2_ardour/audio_region_view.h
gtk2_ardour/automation_region_view.cc
gtk2_ardour/automation_region_view.h
gtk2_ardour/crossfade_edit.cc
gtk2_ardour/crossfade_edit.h
gtk2_ardour/crossfade_view.cc
gtk2_ardour/crossfade_view.h
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_markers.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/editor_regions.cc
gtk2_ardour/editor_regions.h
gtk2_ardour/editor_routes.cc
gtk2_ardour/editor_routes.h
gtk2_ardour/editor_tempodisplay.cc
gtk2_ardour/lineset.h
gtk2_ardour/midi_region_view.cc
gtk2_ardour/midi_region_view.h
gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h
gtk2_ardour/processor_box.cc
gtk2_ardour/processor_box.h
gtk2_ardour/region_view.cc
gtk2_ardour/region_view.h
gtk2_ardour/route_params_ui.cc
gtk2_ardour/route_params_ui.h
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_time_axis.h
gtk2_ardour/route_ui.cc
gtk2_ardour/route_ui.h
libs/ardour/ardour/ardour.h
libs/ardour/ardour/audioplaylist.h
libs/ardour/ardour/audioregion.h
libs/ardour/ardour/crossfade.h
libs/ardour/ardour/diskstream.h
libs/ardour/ardour/internal_send.h
libs/ardour/ardour/location.h
libs/ardour/ardour/midi_model.h
libs/ardour/ardour/midi_playlist.h
libs/ardour/ardour/midi_region.h
libs/ardour/ardour/playlist.h
libs/ardour/ardour/region.h
libs/ardour/ardour/route_group.h
libs/ardour/ardour/session.h
libs/ardour/ardour/session_object.h
libs/ardour/ardour/tempo.h
libs/ardour/audio_playlist.cc
libs/ardour/audioregion.cc
libs/ardour/crossfade.cc
libs/ardour/diskstream.cc
libs/ardour/globals.cc
libs/ardour/internal_send.cc
libs/ardour/midi_model.cc
libs/ardour/midi_playlist.cc
libs/ardour/midi_region.cc
libs/ardour/playlist.cc
libs/ardour/region.cc
libs/ardour/region_factory.cc
libs/ardour/route_group.cc
libs/ardour/session.cc
libs/ardour/session_object.cc
libs/ardour/session_state.cc
libs/ardour/tempo.cc
libs/evoral/evoral/midi_events.h
libs/pbd/pbd/properties.h
libs/pbd/pbd/stateful.h
libs/pbd/property.cc
libs/pbd/stateful.cc
libs/pbd/wscript
libs/surfaces/mackie/mackie_control_protocol.cc
libs/surfaces/mackie/mackie_control_protocol.h
libs/surfaces/mackie/route_signal.cc

index 668ed8ed5278434ed9b2be95ef735375f5bf624e..e246c04391327a346a1682588bf12ff210c05a8c 100644 (file)
@@ -152,10 +152,19 @@ AudioRegionEditor::AudioRegionEditor (Session* s, boost::shared_ptr<AudioRegion>
        show_all();
 
        name_changed ();
-       bounds_changed (PropertyChange (StartChanged|LengthChanged|PositionChanged|Region::SyncOffsetChanged));
+
+       PropertyChange change;
+
+       change.add (ARDOUR::Properties::start);
+       change.add (ARDOUR::Properties::length);
+       change.add (ARDOUR::Properties::position);
+       change.add (ARDOUR::Properties::sync_position);
+
+       bounds_changed (change);
+
        gain_changed ();
 
-       _region->StateChanged.connect (state_connection, ui_bind (&AudioRegionEditor::region_changed, this, _1), gui_context());
+       _region->PropertyChanged.connect (state_connection, ui_bind (&AudioRegionEditor::region_changed, this, _1), gui_context());
 
        spin_arrow_grab = false;
 
@@ -167,17 +176,24 @@ AudioRegionEditor::~AudioRegionEditor ()
 }
 
 void
-AudioRegionEditor::region_changed (PBD::PropertyChange what_changed)
+AudioRegionEditor::region_changed (const PBD::PropertyChange& what_changed)
 {
-       if (what_changed & NameChanged) {
+       if (what_changed.contains (ARDOUR::Properties::name)) {
                name_changed ();
        }
 
-       if (what_changed & PropertyChange (BoundsChanged|StartChanged|Region::SyncOffsetChanged)) {
+       PropertyChange interesting_stuff;
+
+       interesting_stuff.add (ARDOUR::Properties::position);
+       interesting_stuff.add (ARDOUR::Properties::length);
+       interesting_stuff.add (ARDOUR::Properties::start);
+       interesting_stuff.add (ARDOUR::Properties::sync_position);
+
+       if (what_changed.contains (interesting_stuff)) {
                bounds_changed (what_changed);
        }
 
-       if (what_changed & AudioRegion::ScaleAmplitudeChanged) {
+       if (what_changed.contains (ARDOUR::Properties::scale_amplitude)) {
                gain_changed ();
        }
 }
@@ -326,35 +342,35 @@ AudioRegionEditor::name_changed ()
 }
 
 void
-AudioRegionEditor::bounds_changed (PropertyChange what_changed)
+AudioRegionEditor::bounds_changed (const PropertyChange& what_changed)
 {
-       if ((what_changed & PropertyChange (PositionChanged|LengthChanged)) == PropertyChange (PositionChanged|LengthChanged)) {
+       if (what_changed.contains (ARDOUR::Properties::position) && what_changed.contains (ARDOUR::Properties::length)) {
                position_clock.set (_region->position(), true);
                end_clock.set (_region->position() + _region->length() - 1, true);
                length_clock.set (_region->length(), true);
-       } else if (what_changed & PropertyChange (PositionChanged)) {
+       } else if (what_changed.contains (ARDOUR::Properties::position)) {
                position_clock.set (_region->position(), true);
                end_clock.set (_region->position() + _region->length() - 1, true);
-       } else if (what_changed & PropertyChange (LengthChanged)) {
+       } else if (what_changed.contains (ARDOUR::Properties::length)) {
                end_clock.set (_region->position() + _region->length() - 1, true);
                length_clock.set (_region->length(), true);
        }
 
-       if ((what_changed & Region::SyncOffsetChanged) || (what_changed & PositionChanged)) {
+       if (what_changed.contains (ARDOUR::Properties::sync_position) || what_changed.contains (ARDOUR::Properties::position)) {
                int dir;
                nframes_t off = _region->sync_offset (dir);
                if (dir == -1) {
                        off = -off;
                }
 
-               if (what_changed & Region::SyncOffsetChanged) {
+               if (what_changed.contains (ARDOUR::Properties::sync_position)) {
                        sync_offset_relative_clock.set (off, true);
                }
 
                sync_offset_absolute_clock.set (off + _region->position (), true);
        }
 
-       if (what_changed & StartChanged) {
+       if (what_changed.contains (ARDOUR::Properties::start)) {
                start_clock.set (_region->start(), true);
        }
 }
@@ -412,6 +428,14 @@ AudioRegionEditor::sync_offset_relative_clock_changed ()
 bool
 AudioRegionEditor::on_delete_event (GdkEventAny* ev)
 {
-       bounds_changed (PropertyChange (StartChanged|LengthChanged|PositionChanged|Region::SyncOffsetChanged));
+       PropertyChange change;
+
+       change.add (ARDOUR::Properties::start);
+       change.add (ARDOUR::Properties::length);
+       change.add (ARDOUR::Properties::position);
+       change.add (ARDOUR::Properties::sync_position);
+
+       bounds_changed (change);
+
        return RegionEditor::on_delete_event (ev);
 }
index e33caadba670abea74443bc68238f43869c588df..a382f9e6a94552015fb663bc7e5349dc13414d97 100644 (file)
@@ -98,8 +98,8 @@ class AudioRegionEditor : public RegionEditor
        PBD::ScopedConnection state_connection;
        PBD::ScopedConnection audition_connection;
 
-       void region_changed (PBD::PropertyChange);
-       void bounds_changed (PBD::PropertyChange);
+       void region_changed (const PBD::PropertyChange&);
+       void bounds_changed (const PBD::PropertyChange&);
        void name_changed ();
        void gain_changed ();
 
index 4d783956d71f256cdafb54d248e328352aefa449..438867c9dcdce41373530a3290be59954161e490 100644 (file)
@@ -222,7 +222,8 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
 
        region_muted ();
        region_sync_changed ();
-       region_resized (BoundsChanged);
+
+       region_resized (ARDOUR::bounds_change);
        set_waveview_data_src();
        region_locked ();
        envelope_active_changed ();
@@ -264,29 +265,29 @@ AudioRegionView::audio_region() const
 }
 
 void
-AudioRegionView::region_changed (PropertyChange what_changed)
+AudioRegionView::region_changed (const PropertyChange& what_changed)
 {
        ENSURE_GUI_THREAD (*this, &AudioRegionView::region_changed, what_changed)
        //cerr << "AudioRegionView::region_changed() called" << endl;
 
-       RegionView::region_changed(what_changed);
+       RegionView::region_changed (what_changed);
 
-       if (what_changed & AudioRegion::ScaleAmplitudeChanged) {
+       if (what_changed.contains (ARDOUR::Properties::scale_amplitude)) {
                region_scale_amplitude_changed ();
        }
-       if (what_changed & AudioRegion::FadeInChanged) {
-               fade_in_changed ();
+       if (what_changed.contains (ARDOUR::Properties::fade_in)) {
+                       fade_in_changed ();
        }
-       if (what_changed & AudioRegion::FadeOutChanged) {
+       if (what_changed.contains (ARDOUR::Properties::fade_out)) {
                fade_out_changed ();
        }
-       if (what_changed & AudioRegion::FadeInActiveChanged) {
+       if (what_changed.contains (ARDOUR::Properties::fade_in_active)) {
                fade_in_active_changed ();
        }
-       if (what_changed & AudioRegion::FadeOutActiveChanged) {
+       if (what_changed.contains (ARDOUR::Properties::fade_out_active)) {
                fade_out_active_changed ();
        }
-       if (what_changed & AudioRegion::EnvelopeActiveChanged) {
+       if (what_changed.contains (ARDOUR::Properties::envelope_active)) {
                envelope_active_changed ();
        }
 }
@@ -372,13 +373,17 @@ AudioRegionView::region_renamed ()
 }
 
 void
-AudioRegionView::region_resized (PropertyChange what_changed)
+AudioRegionView::region_resized (const PropertyChange& what_changed)
 {
        AudioGhostRegion* agr;
 
        RegionView::region_resized(what_changed);
+       PropertyChange interesting_stuff;
+
+       interesting_stuff.add (ARDOUR::Properties::start);
+       interesting_stuff.add (ARDOUR::Properties::length);
 
-       if (what_changed & PropertyChange (StartChanged|LengthChanged)) {
+       if (what_changed.contains (interesting_stuff)) {
 
                for (uint32_t n = 0; n < waves.size(); ++n) {
                        waves[n]->property_region_start() = _region->start();
index 767a66faed8fb4eaefe43e5bab9b591736775adf..b5fc89d0a98ed3ee847b00eebbc440a3e17d3571 100644 (file)
@@ -98,7 +98,7 @@ class AudioRegionView : public RegionView
 
        AudioRegionGainLine* get_gain_line() const { return gain_line; }
 
-       void region_changed (PBD::PropertyChange);
+       void region_changed (const PBD::PropertyChange&);
        void envelope_active_changed ();
 
        GhostRegion* add_ghost (TimeAxisView&);
@@ -150,7 +150,7 @@ class AudioRegionView : public RegionView
     void fade_in_active_changed ();
     void fade_out_active_changed ();
 
-    void region_resized (PBD::PropertyChange);
+    void region_resized (const PBD::PropertyChange&);
     void region_muted ();
     void region_scale_amplitude_changed ();
        void region_renamed ();
index a796d4d7cdcaa17139300141e126ed6bf3c93441..b86cb2191e1809133a3c0c01a802ddbe94ea98cf 100644 (file)
@@ -61,7 +61,7 @@ AutomationRegionView::init (Gdk::Color const & basic_color, bool /*wfd*/)
 
        set_height (trackview.current_height());
 
-       _region->StateChanged.connect (*this, ui_bind (&RegionView::region_changed, this, _1), gui_context());
+       _region->PropertyChanged.connect (*this, ui_bind (&RegionView::region_changed, this, _1), gui_context());
 
        set_colors ();
 
@@ -158,7 +158,7 @@ AutomationRegionView::reset_width_dependent_items (double pixel_width)
 
 
 void
-AutomationRegionView::region_resized (PBD::PropertyChange what_changed)
+AutomationRegionView::region_resized (const PBD::PropertyChange& what_changed)
 {
        RegionView::region_resized(what_changed);
 
index 0a1978c9636b15b6f713f07e59dd9f4c1da8ff60..6d3a00d4b6a69133a2251aeda535a872879f8d97 100644 (file)
@@ -66,7 +66,7 @@ public:
 protected:
        void create_line(boost::shared_ptr<ARDOUR::AutomationList> list);
        bool set_position(nframes64_t pos, void* src, double* ignored);
-       void region_resized (PBD::PropertyChange what_changed);
+       void region_resized (const PBD::PropertyChange&);
        bool canvas_event(GdkEvent* ev);
        void add_automation_event (GdkEvent* event, nframes_t when, double y);
        void entered();
index c5d7b8d1b557090f3ec6341b66fd85361017cbc2..c1201f2f9a91fca313de9dce9105df30006aca15 100644 (file)
@@ -291,7 +291,7 @@ CrossfadeEditor::CrossfadeEditor (Session* s, boost::shared_ptr<Crossfade> xf, d
 
        curve_select_clicked (In);
 
-       xfade->StateChanged.connect (state_connection, ui_bind (&CrossfadeEditor::xfade_changed, this, _1), gui_context());
+       xfade->PropertyChanged.connect (state_connection, ui_bind (&CrossfadeEditor::xfade_changed, this, _1), gui_context());
 
        _session->AuditionActive.connect (_session_connections, ui_bind (&CrossfadeEditor::audition_state_changed, this, _1), gui_context());
        show_all_children();
@@ -624,7 +624,7 @@ CrossfadeEditor::canvas_allocation (Gtk::Allocation& /*alloc*/)
 
 
 void
-CrossfadeEditor::xfade_changed (PropertyChange)
+CrossfadeEditor::xfade_changed (const PropertyChange&)
 {
        set (xfade->fade_in(), In);
        set (xfade->fade_out(), Out);
index a05bb093f07e9e645ec3c88856760108aba64ae4..936ead3895d4de6a0d4f9ce7985d451f10bb5ce8 100644 (file)
@@ -213,7 +213,7 @@ class CrossfadeEditor : public ArdourDialog
        void audition_right_dry ();
        void audition_right ();
 
-       void xfade_changed (PBD::PropertyChange);
+       void xfade_changed (const PBD::PropertyChange&);
 
        void dump ();
 };
index ca333e67a65cfbdc4dda6af4a3cb7ec792878f05..a861ba8e9ec10150ab8f9d812bbae57130e06fb9 100644 (file)
@@ -82,9 +82,12 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
 
        group->signal_event().connect (sigc::bind (sigc::mem_fun (tv.editor(), &PublicEditor::canvas_crossfade_view_event), group, this));
 
-       crossfade_changed (PropertyChange (~0));
+       PropertyChange all_crossfade_properties;
+       all_crossfade_properties.add (ARDOUR::Properties::active);
+       all_crossfade_properties.add (ARDOUR::Properties::follow_overlap);
+       crossfade_changed (all_crossfade_properties);
 
-       crossfade->StateChanged.connect (*this, ui_bind (&CrossfadeView::crossfade_changed, this, _1), gui_context());
+       crossfade->PropertyChanged.connect (*this, ui_bind (&CrossfadeView::crossfade_changed, this, _1), gui_context());
        ColorsChanged.connect (sigc::mem_fun (*this, &CrossfadeView::color_handler));
 }
 
@@ -123,11 +126,11 @@ CrossfadeView::set_height (double height)
 }
 
 void
-CrossfadeView::crossfade_changed (PropertyChange what_changed)
+CrossfadeView::crossfade_changed (const PropertyChange& what_changed)
 {
        bool need_redraw_curves = false;
 
-       if (what_changed & BoundsChanged) {
+       if (what_changed.contains (ARDOUR::bounds_change)) {
                set_position (crossfade->position(), this);
                set_duration (crossfade->length(), this);
 
@@ -136,11 +139,11 @@ CrossfadeView::crossfade_changed (PropertyChange what_changed)
                need_redraw_curves = false;
        }
 
-       if (what_changed & Crossfade::FollowOverlapChanged) {
+       if (what_changed.contains (ARDOUR::Properties::follow_overlap)) {
                need_redraw_curves = true;
        }
 
-       if (what_changed & Crossfade::ActiveChanged) {
+       if (what_changed.contains (ARDOUR::Properties::active)) {
                /* calls redraw_curves */
                active_changed ();
        } else if (need_redraw_curves) {
index 3e550e47882ff4f6b792a37df4e7ee53763aac54..610fa92e0e2e84775a4aef8f462ccc7a2a70af8a 100644 (file)
@@ -75,10 +75,10 @@ struct CrossfadeView : public TimeAxisViewItem
     ArdourCanvas::Line *fade_out;
     ArdourCanvas::Item *active_button;
 
-    void crossfade_changed (PBD::PropertyChange);
+    void crossfade_changed (const PBD::PropertyChange&);
     void active_changed ();
-       void redraw_curves ();
-       void color_handler ();
+    void redraw_curves ();
+    void color_handler ();
 };
 
 #endif /* __gtk_ardour_crossfade_view_h__ */
index 8053851f110692731f4559c31a0d9261bdb6d11e..88b7586888b056fecedf4d6e1c3a34fdfc57a9ab 100644 (file)
@@ -1073,7 +1073,7 @@ Editor::set_session (Session *t)
        _session->DurationChanged.connect (_session_connections, boost::bind (&Editor::handle_new_duration, this), gui_context());
        _session->DirtyChanged.connect (_session_connections, boost::bind (&Editor::update_title, this), gui_context());
        _session->TimecodeOffsetChanged.connect (_session_connections, boost::bind (&Editor::update_just_timecode, this), gui_context());
-       _session->tempo_map().StateChanged.connect (_session_connections, ui_bind (&Editor::tempo_map_changed, this, _1), gui_context());
+       _session->tempo_map().PropertyChanged.connect (_session_connections, ui_bind (&Editor::tempo_map_changed, this, _1), gui_context());
        _session->Located.connect (_session_connections, boost::bind (&Editor::located, this), gui_context());
        _session->config.ParameterChanged.connect (_session_connections, ui_bind (&Editor::parameter_changed, this, _1), gui_context());
        _session->StateSaved.connect (_session_connections, ui_bind (&Editor::session_state_saved, this, _1), gui_context());
@@ -3736,7 +3736,10 @@ Editor::edit_xfade (boost::weak_ptr<Crossfade> wxfade)
        }
 
        cew.apply ();
-       xfade->StateChanged (PropertyChange (~0));
+       PropertyChange all_crossfade_properties;
+       all_crossfade_properties.add (ARDOUR::Properties::active);
+       all_crossfade_properties.add (ARDOUR::Properties::follow_overlap);
+       xfade->PropertyChanged (all_crossfade_properties);
 }
 
 PlaylistSelector&
index 6b79f7d3a69d8efb95e3da19f9174f11cf99bbf8..9088312924775ad80c0cb276dfd2062d8d0706eb 100644 (file)
@@ -520,7 +520,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void location_changed (ARDOUR::Location *);
        void location_flags_changed (ARDOUR::Location *, void *);
        void refresh_location_display ();
-       void refresh_location_display_s (PBD::PropertyChange);
+       void refresh_location_display_s (const PBD::PropertyChange&);
        void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
        void add_new_location (ARDOUR::Location *);
        void location_gone (ARDOUR::Location *);
@@ -1475,7 +1475,7 @@ public:
        void draw_metric_marks (const ARDOUR::Metrics& metrics);
 
        void compute_current_bbt_points (nframes_t left, nframes_t right);
-       void tempo_map_changed (PBD::PropertyChange);
+       void tempo_map_changed (const PBD::PropertyChange&);
        void redisplay_tempo (bool immediate_redraw);
 
        void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
index 33e0962596b311e55ddd9880b55bf12867733aa6..7a2f4f7870b3bad3641ea6f81429a54488cf7ce6 100644 (file)
@@ -339,7 +339,7 @@ Editor::refresh_location_display ()
 }
 
 void
-Editor::refresh_location_display_s (PropertyChange)
+Editor::refresh_location_display_s (const PropertyChange&)
 {
        ENSURE_GUI_THREAD (*this, &Editor::refresh_location_display_s, ignored)
 
index fa641dd9b8614fb8cbf68e5c7e271eba3439656d..13bdf7af5ca54560c8c649b07098ef8bf005daaa 100644 (file)
@@ -2151,7 +2151,7 @@ Editor::single_contents_trim (RegionView& rv, nframes64_t frame_delta, bool left
                snap_to (new_bound);
        }
        region->trim_start ((nframes64_t) (new_bound * speed), this);
-       rv.region_changed (StartChanged);
+       rv.region_changed (PropertyChange (ARDOUR::Properties::start));
 }
 
 void
@@ -2206,7 +2206,7 @@ Editor::single_start_trim (RegionView& rv, nframes64_t frame_delta, bool left_di
                }
        }
 
-       rv.region_changed (PropertyChange (LengthChanged|PositionChanged|StartChanged));
+       rv.region_changed (ARDOUR::bounds_change);
 }
 
 void
@@ -2260,10 +2260,10 @@ Editor::single_end_trim (RegionView& rv, nframes64_t frame_delta, bool left_dire
                        region_right->trim_front(region->last_frame() + 1, this);
                }
 
-               rv.region_changed (PropertyChange (LengthChanged|PositionChanged|StartChanged));
-       }
-       else {
-               rv.region_changed (LengthChanged);
+               rv.region_changed (ARDOUR::bounds_change);
+                       
+       else {
+               rv.region_changed (PropertyChange (ARDOUR::Properties::length));
        }
 }
 
index a1000b707743dd7024c824195df9a5303562c269..2bb91fe229d341281dc293525a3d27c09176682b 100644 (file)
@@ -3616,7 +3616,7 @@ Editor::trim_to_region(bool forward)
                    }
 
                    region->trim_end((nframes64_t) (next_region->first_frame() * speed), this);
-                   arv->region_changed (PropertyChange (LengthChanged));
+                   arv->region_changed (PropertyChange (ARDOUR::Properties::length));
                }
                else {
 
@@ -3627,7 +3627,8 @@ Editor::trim_to_region(bool forward)
                    }
 
                    region->trim_front((nframes64_t) ((next_region->last_frame() + 1) * speed), this);
-                   arv->region_changed (PropertyChange (LengthChanged|PositionChanged|StartChanged));
+
+                   arv->region_changed (ARDOUR::bounds_change);
                }
 
                XMLNode &after = playlist->get_state();
index b3ca136bcf61f54bdb8a9438a3c4e3a85d30b1ae..39e8b84c1bf4c1493de0a46e3b67508bb139150e 100644 (file)
@@ -347,7 +347,7 @@ EditorRegions::add_region (boost::shared_ptr<Region> region)
 
 
 void
-EditorRegions::region_changed (PropertyChange what_changed, boost::weak_ptr<Region> region)
+EditorRegions::region_changed (const PropertyChange& what_changed, boost::weak_ptr<Region> region)
 {
        ENSURE_GUI_THREAD (*this, &EditorRegions::region_changed, what_changed, region)
 
@@ -357,7 +357,7 @@ EditorRegions::region_changed (PropertyChange what_changed, boost::weak_ptr<Regi
                return;
        }
 
-       if (what_changed & ARDOUR::NameChanged) {
+       if (what_changed.contains (ARDOUR::Properties::name)) {
                /* find the region in our model and change its name */
                TreeModel::Children rows = _model->children ();
                TreeModel::iterator i = rows.begin ();
@@ -762,10 +762,10 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co
                break;
 
        case AudioClock::Frames:
-               snprintf (start_str, sizeof (start_str), "%u", region->position());
-               snprintf (end_str, sizeof (end_str), "%u", (region->position() + region->length() - 1));
-               snprintf (length_str, sizeof (length_str), "%u", region->length());
-               snprintf (sync_str, sizeof (sync_str), "%u", region->sync_position() + region->position());
+               snprintf (start_str, sizeof (start_str), "%" PRId64, region->position());
+               snprintf (end_str, sizeof (end_str), "%" PRId64, (region->position() + region->length() - 1));
+               snprintf (length_str, sizeof (length_str), "%" PRId64, region->length());
+               snprintf (sync_str, sizeof (sync_str), "%" PRId64, region->sync_position() + region->position());
 
                if (audioRegion && !fades_in_seconds) {
                        snprintf (fadein_str, sizeof (fadein_str), "%u", uint (audioRegion->fade_in()->back()->when));
index 92adb72621bfe5bcb4579399f0f0cb03dad6b32e..33e077261cdecefadec190129b10e2d79b7936d0 100644 (file)
@@ -104,7 +104,7 @@ private:
 
        Columns _columns;
 
-       void region_changed (PBD::PropertyChange, boost::weak_ptr<ARDOUR::Region>);
+       void region_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Region>);
        void selection_changed ();
        sigc::connection _change_connection;
        bool set_selected_in_subrow (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
index 01da390f4b065a86310bbea7a528e994b12bcf68..1798c45864bc1fefd958261d9930649e57139381 100644 (file)
@@ -424,7 +424,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
                boost::weak_ptr<Route> wr ((*x)->route());
 
                (*x)->route()->gui_changed.connect (*this, ui_bind (&EditorRoutes::handle_gui_changes, this, _1, _2), gui_context());
-               (*x)->route()->NameChanged.connect (*this, boost::bind (&EditorRoutes::route_name_changed, this, wr), gui_context());
+               (*x)->route()->PropertyChanged.connect (*this, ui_bind (&EditorRoutes::route_property_changed, this, _1, wr), gui_context());
 
                if ((*x)->is_track()) {
                        boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> ((*x)->route());
@@ -487,11 +487,16 @@ EditorRoutes::route_removed (TimeAxisView *tv)
 }
 
 void
-EditorRoutes::route_name_changed (boost::weak_ptr<Route> r)
+EditorRoutes::route_property_changed (const PropertyChange& what_changed, boost::weak_ptr<Route> r)
 {
+       if (!what_changed.contains (ARDOUR::Properties::name)) {
+               return;
+       }
+
        ENSURE_GUI_THREAD (*this, &EditorRoutes::route_name_changed, r)
 
        boost::shared_ptr<Route> route = r.lock ();
+
        if (!route) {
                return;
        }
index a872e49012f1d02c158137c4026ac261ca963d17..7489cbf7d816e3f62f08888bef7bc1607f3d1ce7 100644 (file)
@@ -69,7 +69,7 @@ private:
        void visible_changed (Glib::ustring const &);
        void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
        bool button_press (GdkEventButton *);
-       void route_name_changed (boost::weak_ptr<ARDOUR::Route>);
+       void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route>);
        void handle_gui_changes (std::string const &, void *);
        void update_rec_display ();
        void update_mute_display ();
index 1c3f0180957b8a98e0594219b576b4103796f26a..fd598b8c817d739f8bd6e4a65c596fac08bca4b1 100644 (file)
@@ -93,13 +93,13 @@ Editor::draw_metric_marks (const Metrics& metrics)
 }
 
 void
-Editor::tempo_map_changed (PropertyChange ignored)
+Editor::tempo_map_changed (const PropertyChange& ignored)
 {
        if (!_session) {
                return;
        }
 
-       ENSURE_GUI_THREAD (*this, &Editor::tempo_map_changed ignored);
+       ENSURE_GUI_THREAD (*this, &Editor::tempo_map_changed, ignored);
 
        if (tempo_lines) {
                tempo_lines->tempo_map_changed();
index 66b4806439b02c8b6ab89aab3205ee8cca574d2f..e4f836717ff13bd2e1609ba3838c8c0cb26f91d7 100644 (file)
@@ -65,7 +65,7 @@ public:
         */
        void change_line_width(double coord, double width);
 
-       /** PropertyChange the color of a line.
+       /** Change the color of a line.
         */
        void change_line_color(double coord, uint32_t color);
 
index 576abafc1bbf2cce207de129f337a0908342be0f..4ea7aba4faaa88692abca2a88e564e01d7bc99a8 100644 (file)
@@ -193,7 +193,7 @@ MidiRegionView::init (Gdk::Color const & basic_color, bool wfd)
 
        region_muted ();
        region_sync_changed ();
-       region_resized (BoundsChanged);
+       region_resized (ARDOUR::bounds_change);
        region_locked ();
 
        reset_width_dependent_items (_pixel_width);
@@ -963,11 +963,11 @@ MidiRegionView::~MidiRegionView ()
 }
 
 void
-MidiRegionView::region_resized (PropertyChange what_changed)
+MidiRegionView::region_resized (const PropertyChange& what_changed)
 {
        RegionView::region_resized(what_changed);
 
-       if (what_changed & ARDOUR::PositionChanged) {
+       if (what_changed.contains (ARDOUR::Properties::position)) {
                set_duration(_region->length(), 0);
                if (_enable_display) {
                        redisplay_model();
index a08ef7c98db03526f4fb1bb0476b2107736569ad..d6dd213e726fb96fb58232105193cf3af8412171 100644 (file)
@@ -136,7 +136,7 @@ class MidiRegionView : public RegionView
         */
        void get_patch_key_at(double time, uint8_t channel, MIDI::Name::PatchPrimaryKey& key);
 
-       /** PropertyChange the 'automation' data of old_program to new values which correspond to new_patch.
+       /** Change the 'automation' data of old_program to new values which correspond to new_patch.
         * @param old_program the program change event which is to be altered
         * @param new_patch the new lsb, msb and program number which are to be set
         */
@@ -239,7 +239,7 @@ class MidiRegionView : public RegionView
         */
        void change_velocity(ArdourCanvas::CanvasNoteEvent* ev, int8_t velocity, bool relative=false);
 
-       /** PropertyChange the channel of the selection.
+       /** Change the channel of the selection.
         * @param channel - the channel number of the new channel, zero-based
         */
        void change_channel(uint8_t channel);
@@ -305,7 +305,7 @@ class MidiRegionView : public RegionView
                        Gdk::Color& basic_color,
                        TimeAxisViewItem::Visibility);
 
-       void region_resized (PBD::PropertyChange);
+       void region_resized (const PBD::PropertyChange&);
 
        void set_flags (XMLNode *);
        void store_flags ();
index 5be6ec9f5a1434dafd649a27f5837b75fd6047d7..05a7f4628b593c38dd744a3abc775ce2217b76df 100644 (file)
@@ -1442,7 +1442,7 @@ MixerStrip::name_changed ()
 {
        switch (_width) {
        case Wide:
-               RouteUI::name_changed ();
+               RouteUI::property_changed (PropertyChange (ARDOUR::Properties::name));
                break;
        case Narrow:
                name_label.set_text (PBD::short_version (_route->name(), 5));
index 03b1dd7d69711488bd2413b0f1880bdb7e1d80e3..4b4a5b41b18fa135cc9b26ca5dd41c748e3a152f 100644 (file)
@@ -337,7 +337,7 @@ Mixer_UI::add_strip (RouteList& routes)
                        route->set_order_key (N_("signal"), track_model->children().size()-1);
                }
 
-               route->NameChanged.connect (*this, boost::bind (&Mixer_UI::strip_name_changed, this, strip), gui_context());
+               route->PropertyChanged.connect (*this, ui_bind (&Mixer_UI::strip_property_changed, this, _1, strip), gui_context());
 
                strip->WidthChanged.connect (sigc::mem_fun(*this, &Mixer_UI::strip_width_changed));
                strip->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
@@ -1005,9 +1005,13 @@ Mixer_UI::build_track_menu ()
 }
 
 void
-Mixer_UI::strip_name_changed (MixerStrip* mx)
+Mixer_UI::strip_property_changed (const PropertyChange& what_changed, MixerStrip* mx)
 {
-       ENSURE_GUI_THREAD (*this, &Mixer_UI::strip_name_changed, mx)
+       if (!what_changed.contains (ARDOUR::Properties::name)) {
+               return;
+       }
+
+       ENSURE_GUI_THREAD (*this, &Mixer_UI::strip_name_changed, what_changed, mx)
 
        TreeModel::Children rows = track_model->children();
        TreeModel::Children::iterator i;
index eeda3c406210993cf32e1dbfc728f354acb3d2d8..e03d2efebd835d2b43c755f3237669a8d97f6f97 100644 (file)
@@ -196,7 +196,7 @@ class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public AR
 
        PluginSelector    *_plugin_selector;
 
-       void strip_name_changed (MixerStrip *);
+       void strip_property_changed (const PBD::PropertyChange&, MixerStrip *);
 
        void group_flags_changed (void *src, ARDOUR::RouteGroup *);
 
index 86a90fa9c53d83a46e050ea7825d3a6631b0341d..c4d01e4458479078135821e4cc178d2ad0975df0 100644 (file)
@@ -107,7 +107,7 @@ ProcessorEntry::ProcessorEntry (boost::shared_ptr<Processor> p, Width w)
        _active.signal_toggled().connect (sigc::mem_fun (*this, &ProcessorEntry::active_toggled));
        
        _processor->ActiveChanged.connect (active_connection, boost::bind (&ProcessorEntry::processor_active_changed, this), gui_context());
-       _processor->NameChanged.connect (name_connection, boost::bind (&ProcessorEntry::processor_name_changed, this), gui_context());
+       _processor->PropertyChanged.connect (name_connection, ui_bind (&ProcessorEntry::processor_property_changed, this, _1), gui_context());
 }
 
 EventBox&
@@ -163,9 +163,11 @@ ProcessorEntry::processor_active_changed ()
 }
 
 void
-ProcessorEntry::processor_name_changed ()
+ProcessorEntry::processor_property_changed (const PropertyChange& what_changed)
 {
-       _name.set_text (name ());
+       if (what_changed.contains (ARDOUR::Properties::name)) {
+               _name.set_text (name ());
+       }
 }
 
 string
@@ -328,7 +330,7 @@ ProcessorBox::set_route (boost::shared_ptr<Route> r)
 
        _route->processors_changed.connect (connections, ui_bind (&ProcessorBox::route_processors_changed, this, _1), gui_context());
        _route->DropReferences.connect (connections, boost::bind (&ProcessorBox::route_going_away, this), gui_context());
-       _route->NameChanged.connect (connections, boost::bind (&ProcessorBox::route_name_changed, this), gui_context());
+       _route->PropertyChanged.connect (connections, ui_bind (&ProcessorBox::route_property_changed, this, _1), gui_context());
 
        redisplay_processors ();
 }
@@ -1764,9 +1766,13 @@ ProcessorBox::rb_edit ()
 }
 
 void
-ProcessorBox::route_name_changed ()
+ProcessorBox::route_property_changed (const PropertyChange& what_changed)
 {
-       ENSURE_GUI_THREAD (*this, &ProcessorBox::route_name_changed)
+       if (!what_changed.contains (ARDOUR::Properties::name)) {
+               return;
+       }
+
+       ENSURE_GUI_THREAD (*this, &ProcessorBox::route_property_changed, what_changed);
 
        boost::shared_ptr<Processor> processor;
        boost::shared_ptr<PluginInsert> plugin_insert;
index a80dce00feac7af3ae9d6b615abd30a478f8b363..d5e4572659f6112e2612a3f464003a7e0bfdb20b 100644 (file)
@@ -91,7 +91,7 @@ private:
 
        void active_toggled ();
        void processor_active_changed ();
-       void processor_name_changed ();
+       void processor_property_changed (const PBD::PropertyChange&);
        std::string name () const;
        
        Gtk::EventBox _event_box;
@@ -275,7 +275,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD
        static void rb_ab_plugins ();
        static void rb_edit ();
 
-       void route_name_changed ();
+       void route_property_changed (const PBD::PropertyChange&);
        std::string generate_processor_title (boost::shared_ptr<ARDOUR::PluginInsert> pi);
 };
 
index 575ecbb5e2a36738b2e347910cad93075f26d40f..8e45b7ace05ca4d5d61a8b959dc1fea665b72526 100644 (file)
@@ -181,7 +181,7 @@ RegionView::init (Gdk::Color const & basic_color, bool wfd)
 
        set_height (trackview.current_height());
 
-       _region->StateChanged.connect (*this, ui_bind (&RegionView::region_changed, this, _1), gui_context());
+       _region->PropertyChanged.connect (*this, ui_bind (&RegionView::region_changed, this, _1), gui_context());
        
        group->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_event), group, this));
 
@@ -228,27 +228,27 @@ RegionView::lock_toggle ()
 }
 
 void
-RegionView::region_changed (PropertyChange what_changed)
+RegionView::region_changed (const PropertyChange& what_changed)
 {
-       ENSURE_GUI_THREAD (*this, &RegionView::region_changed, what_changed)
+       ENSURE_GUI_THREAD (*this, &RegionView::region_changed, what_changed);
 
-       if (what_changed & BoundsChanged) {
+       if (what_changed.contains (ARDOUR::bounds_change)) {
                region_resized (what_changed);
                region_sync_changed ();
        }
-       if (what_changed & Region::MuteChanged) {
+       if (what_changed.contains (ARDOUR::Properties::muted)) {
                region_muted ();
        }
-       if (what_changed & Region::OpacityChanged) {
+       if (what_changed.contains (ARDOUR::Properties::opaque)) {
                region_opacity ();
        }
-       if (what_changed & ARDOUR::NameChanged) {
+       if (what_changed.contains (ARDOUR::Properties::name)) {
                region_renamed ();
        }
-       if (what_changed & Region::SyncOffsetChanged) {
+       if (what_changed.contains (ARDOUR::Properties::sync_position)) {
                region_sync_changed ();
        }
-       if (what_changed & Region::LockChanged) {
+       if (what_changed.contains (ARDOUR::Properties::locked)) {
                region_locked ();
        }
 }
@@ -261,16 +261,20 @@ RegionView::region_locked ()
 }
 
 void
-RegionView::region_resized (PropertyChange what_changed)
+RegionView::region_resized (const PropertyChange& what_changed)
 {
        double unit_length;
 
-       if (what_changed & ARDOUR::PositionChanged) {
+       if (what_changed.contains (ARDOUR::Properties::position)) {
                set_position (_region->position(), 0);
                _time_converter.set_origin(_region->position());
        }
 
-       if (what_changed & PropertyChange (StartChanged|LengthChanged)) {
+       PropertyChange s_and_l;
+       s_and_l.add (ARDOUR::Properties::start);
+       s_and_l.add (ARDOUR::Properties::length);
+
+       if (what_changed.contains (s_and_l)) {
 
                set_duration (_region->length(), 0);
 
index d9ffc83c50e30220275d3378952ce3fa89517792..43d8a00f171e199da21bc65c869ad89badfc34d5 100644 (file)
@@ -75,7 +75,7 @@ class RegionView : public TimeAxisViewItem
        virtual void show_region_editor () {}
        virtual void hide_region_editor();
 
-       virtual void region_changed (PBD::PropertyChange);
+       virtual void region_changed (const PBD::PropertyChange&);
 
        virtual GhostRegion* add_ghost (TimeAxisView&) = 0;
        void remove_ghost_in (TimeAxisView&);
@@ -104,7 +104,7 @@ class RegionView : public TimeAxisViewItem
                bool recording,
                TimeAxisViewItem::Visibility);
 
-    virtual void region_resized (PBD::PropertyChange);
+    virtual void region_resized (const PBD::PropertyChange&);
     virtual void region_muted ();
     void         region_locked ();
     void         region_opacity ();
index fbd7af9f7ced00f848da38d65e8f4f91cdf38c25..5e0cc0f0a52b4e74c0712f9dd2e7d6eace597c5e 100644 (file)
@@ -181,15 +181,19 @@ RouteParams_UI::add_routes (RouteList& routes)
 
                //route_select_list.rows().back().select ();
 
-               route->NameChanged.connect (*this, boost::bind (&RouteParams_UI::route_name_changed, this, boost::weak_ptr<Route>(route)), gui_context());
+               route->PropertyChanged.connect (*this, ui_bind (&RouteParams_UI::route_property_changed, this, _1, boost::weak_ptr<Route>(route)), gui_context());
                route->DropReferences.connect (*this, boost::bind (&RouteParams_UI::route_removed, this, boost::weak_ptr<Route>(route)), gui_context());
        }
 }
 
 
 void
-RouteParams_UI::route_name_changed (boost::weak_ptr<Route> wr)
+RouteParams_UI::route_property_changed (const PropertyChange& what_changed, boost::weak_ptr<Route> wr)
 {
+       if (!what_changed.contains (ARDOUR::Properties::name)) {
+               return;
+       }
+
        boost::shared_ptr<Route> route (wr.lock());
 
        if (!route) { 
index c09d3c65cd4ea2b8aa794b8b612ce34fe7b4e75d..e99b9050fe4fdc4f8ea85a60f739c5a3f198c07a 100644 (file)
@@ -161,7 +161,7 @@ class RouteParams_UI : public ArdourDialog, public PBD::ScopedConnectionList
 
        void add_routes (ARDOUR::RouteList&);
 
-       void route_name_changed (boost::weak_ptr<ARDOUR::Route> route);
+       void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route> route);
        void route_removed (boost::weak_ptr<ARDOUR::Route> route);
 
 
index 0b5cf8b0853d00c4a4dd5f5bad8a092f284e40f8..39bb1847a1448955617bfe7e85fbf71eb1212e5c 100644 (file)
@@ -231,7 +231,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, boost::sh
        _y_position = -1;
 
        _route->processors_changed.connect (*this, ui_bind (&RouteTimeAxisView::processors_changed, this, _1), gui_context());
-       _route->NameChanged.connect (*this, boost::bind (&RouteTimeAxisView::route_name_changed, this), gui_context());
+       _route->PropertyChanged.connect (*this, ui_bind (&RouteTimeAxisView::route_property_changed, this, _1), gui_context());
 
        if (is_track()) {
 
@@ -347,9 +347,11 @@ RouteTimeAxisView::label_view ()
 }
 
 void
-RouteTimeAxisView::route_name_changed ()
+RouteTimeAxisView::route_property_changed (const PropertyChange& what_changed)
 {
-       label_view ();
+       if (what_changed.contains (ARDOUR::Properties::name)) {
+               label_view ();
+       }
 }
 
 void
index ac3429cb823c1db5c107e66b80c88a4a12e90ee2..39d65cd499b4254f7dc40cb735209624a1a654e0 100644 (file)
@@ -218,7 +218,7 @@ protected:
        void reset_processor_automation_curves ();
 
        void take_name_changed (void *src);
-       void route_name_changed ();
+       void route_property_changed (const PBD::PropertyChange&);
        void name_entry_changed ();
 
        void update_rec_display ();
index 926be943fa91713d3e3aec5b38d4c90a2adfaa0a..1a75132e4c61d2278a43f8e43f4d5664e415304e 100644 (file)
@@ -205,7 +205,7 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
        _route->solo_changed.connect (route_connections, ui_bind (&RouteUI::solo_changed, this, _1), gui_context());
        _route->listen_changed.connect (route_connections, ui_bind (&RouteUI::listen_changed, this, _1), gui_context());
        _route->solo_isolated_changed.connect (route_connections, ui_bind (&RouteUI::solo_changed, this, _1), gui_context());
-       _route->NameChanged.connect (route_connections, boost::bind (&RouteUI::name_changed, this), gui_context());
+       _route->PropertyChanged.connect (route_connections, ui_bind (&RouteUI::property_changed, this, _1), gui_context());
 
        if (_session->writable() && is_track()) {
                boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
@@ -1164,11 +1164,11 @@ RouteUI::route_rename ()
 }
 
 void
-RouteUI::name_changed ()
+RouteUI::property_changed (const PropertyChange& what_changed)
 {
-       ENSURE_GUI_THREAD (*this, &RouteUI::name_changed);
-
-       name_label.set_text (_route->name());
+       if (what_changed.contains (ARDOUR::Properties::name)) {
+               name_label.set_text (_route->name());
+       }
 }
 
 void
index 5dce9ee4b44e4c8a1cb6653b78f58c1d4d276e84..458910bd698c6dc6f64ebe29d02706353fd3de87 100644 (file)
@@ -164,7 +164,7 @@ class RouteUI : public virtual AxisView
 
        void route_rename();
 
-       virtual void name_changed ();
+       virtual void property_changed (const PBD::PropertyChange&);
        void route_removed ();
 
        Gtk::CheckMenuItem *route_active_menu_item;
index f608db5b7ed16e99ad738bfc808e3bdc30a5b631..2b1f7bbb04f7da01af3edae51cb334f2f4c376ca 100644 (file)
@@ -53,6 +53,9 @@ namespace ARDOUR {
        void init_post_engine ();
        int cleanup ();
        bool no_auto_connect ();
+       void make_property_quarks ();
+
+       extern PBD::PropertyChange bounds_change;
 
        std::string get_ardour_revision ();
        extern const char* const ardour_config_info;
@@ -65,12 +68,6 @@ namespace ARDOUR {
                return (microseconds_t) jack_get_time();
        }
 
-       extern PBD::PropertyChange StartChanged;
-       extern PBD::PropertyChange LengthChanged;
-       extern PBD::PropertyChange PositionChanged;
-       extern PBD::PropertyChange NameChanged;
-       extern PBD::PropertyChange BoundsChanged;
-
        static const double SHUTTLE_FRACT_SPEED1=0.48412291827; /* derived from A1,A2 */
 
        void setup_fpu ();
index b5df4cfabb5e1d5feb8df98061bd5c9f554adc4d..b53f3c1f7317d0578336913df0a6af169f287d95 100644 (file)
@@ -79,8 +79,8 @@ class AudioPlaylist : public ARDOUR::Playlist
        XMLNode& state (bool full_state);
        void dump () const;
 
-       bool region_changed (PBD::PropertyChange, boost::shared_ptr<Region>);
-       void crossfade_changed (PBD::PropertyChange);
+       bool region_changed (const PBD::PropertyChange&, boost::shared_ptr<Region>);
+       void crossfade_changed (const PBD::PropertyChange&);
        void add_crossfade (boost::shared_ptr<Crossfade>);
 
        void source_offset_changed (boost::shared_ptr<AudioRegion> region);
index 711c8030bd524892d191f9e851f2058a0cdd3fd9..ec9a64002f95991a7d9aa76c0d8a38d204e6f7d1 100644 (file)
@@ -44,6 +44,17 @@ namespace Properties {
        extern PBD::PropertyDescriptor<bool> fade_in_active;
        extern PBD::PropertyDescriptor<bool> fade_out_active;
        extern PBD::PropertyDescriptor<float> scale_amplitude;
+       extern PBD::PropertyDescriptor<float> scale_amplitude;
+
+       /* the envelope and fades are not scalar items and so
+          currently (2010/02) are not stored using Property.
+          However, these descriptors enable us to notify
+          about changes to them via PropertyChange.
+       */
+
+       extern PBD::PropertyDescriptor<bool> envelope;
+       extern PBD::PropertyDescriptor<bool> fade_in;
+       extern PBD::PropertyDescriptor<bool> fade_out;
 }
 
 class Route;
@@ -58,14 +69,6 @@ class AudioRegion : public Region
   public:
        static void make_property_quarks ();
 
-       static PBD::PropertyChange FadeInChanged;
-       static PBD::PropertyChange FadeOutChanged;
-       static PBD::PropertyChange FadeInActiveChanged;
-       static PBD::PropertyChange FadeOutActiveChanged;
-       static PBD::PropertyChange EnvelopeActiveChanged;
-       static PBD::PropertyChange ScaleAmplitudeChanged;
-       static PBD::PropertyChange EnvelopeChanged;
-
        ~AudioRegion();
 
        void copy_settings (boost::shared_ptr<const AudioRegion>);
@@ -185,8 +188,7 @@ class AudioRegion : public Region
        AudioRegion (const SourceList &);
        AudioRegion (boost::shared_ptr<const AudioRegion>, frameoffset_t offset = 0, bool offset_relative = true);
        AudioRegion (boost::shared_ptr<const AudioRegion>, const SourceList&);
-       AudioRegion (boost::shared_ptr<AudioSource>, const XMLNode&);
-       AudioRegion (SourceList &, const XMLNode&);
+       AudioRegion (SourceList &);
 
   private:
        PBD::Property<bool>     _envelope_active;
@@ -197,7 +199,7 @@ class AudioRegion : public Region
        PBD::Property<gain_t>   _scale_amplitude;
        
        void register_properties ();
-       PBD::PropertyChange set_property (const PBD::PropertyBase& prop);
+       bool set_property (const PBD::PropertyBase& prop);
        void post_set ();
 
        void init ();
index 15b9b3d2a70677af409e161a8d63de1f18cec70c..7b5ac28379dbde18f1acd60e6bab16eca808710d 100644 (file)
 #include "evoral/Curve.hpp"
 
 namespace ARDOUR {
+       namespace Properties {
+               /* "active" is defined elsewhere but we use it with crossfade also */
+               extern PBD::PropertyDescriptor<bool> active;
+               extern PBD::PropertyDescriptor<bool> follow_overlap;
+       }
 
 class AudioRegion;
 class Playlist;
@@ -71,6 +76,8 @@ class Crossfade : public ARDOUR::AudioRegion
        Crossfade (const Playlist&, XMLNode&);
        virtual ~Crossfade();
 
+       static void make_property_quarks ();
+
        bool operator== (const ARDOUR::Crossfade&);
 
        XMLNode& get_state (void);
@@ -106,7 +113,6 @@ class Crossfade : public ARDOUR::AudioRegion
        framecnt_t overlap_length() const;
 
        PBD::Signal1<void,boost::shared_ptr<Region> > Invalidated;
-       PBD::Signal1<void,PBD::PropertyChange>     StateChanged;
 
        bool covers (framecnt_t frame) const {
                return _position <= frame && frame < _position + _length;
@@ -136,9 +142,6 @@ class Crossfade : public ARDOUR::AudioRegion
        static framecnt_t short_xfade_length() { return _short_xfade_length; }
        static void set_short_xfade_length (framecnt_t n);
 
-       static PBD::PropertyChange ActiveChanged;
-       static PBD::PropertyChange FollowOverlapChanged;
-
   private:
        friend struct CrossfadeComparePtr;
        friend class AudioPlaylist;
@@ -147,11 +150,11 @@ class Crossfade : public ARDOUR::AudioRegion
 
        boost::shared_ptr<ARDOUR::AudioRegion> _in;
        boost::shared_ptr<ARDOUR::AudioRegion> _out;
-       bool                 _active;
+       PBD::Property<bool>  _active;
+       PBD::Property<bool>  _follow_overlap;
        bool                 _in_update;
        OverlapType           overlap_type;
        AnchorPoint          _anchor_point;
-       bool                 _follow_overlap;
        bool                 _fixed;
        int32_t               layer_relation;
 
index 90bcf4067a1f6b0f4655c065691e5a24c294a39b..48a9c2776b179147af782b4f3c05d7c76b5cb8c4 100644 (file)
@@ -206,7 +206,7 @@ class Diskstream : public SessionObject
 
        /* XXX fix this redundancy ... */
 
-       virtual void playlist_changed (PBD::PropertyChange);
+       virtual void playlist_changed (const PBD::PropertyChange&);
        virtual void playlist_deleted (boost::weak_ptr<Playlist>);
        virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &);
 
index 2171462ab7aa9c08f370808dc92019a484457947..243106fb54fe555e3b5fffccd355be1d53adc668 100644 (file)
@@ -56,7 +56,7 @@ class InternalSend : public Send
        PBD::ScopedConnection connect_c;
 
        void send_to_going_away ();
-       void send_to_name_changed ();
+       void send_to_property_changed (const PBD::PropertyChange&);
        int  connect_when_legal ();
        int  set_our_state (XMLNode const &, int);
 };
index d93ffeec4ae00dee83c26c79f88eb50c7da388b5..938177b102e97ca198be265026ebb7c80ca9f0d3 100644 (file)
@@ -179,7 +179,7 @@ class Locations : public PBD::StatefulDestructible
        PBD::Signal0<void>           changed;
        PBD::Signal1<void,Location*> added;
        PBD::Signal1<void,Location*> removed;
-       PBD::Signal1<void,PBD::PropertyChange>    StateChanged;
+       PBD::Signal1<void,const PBD::PropertyChange&>    StateChanged;
 
        template<class T> void apply (T& obj, void (T::*method)(LocationList&)) {
                Glib::Mutex::Lock lm (lock);
index 77f5798898e6cc00aac8c6198b2eeb5ed4eb010d..fcd285f98ced422cf4d37b4b118f53182df46e7f 100644 (file)
@@ -90,7 +90,7 @@ public:
        };
 
 
-       /** PropertyChange note properties.
+       /** Change note properties.
         * More efficient than DeltaCommand and has the important property that
         * it leaves the objects in the MidiModel (Notes) the same, thus
         * enabling selection and other state to persist across command
@@ -126,7 +126,7 @@ public:
                boost::shared_ptr<MidiModel> _model;
                const std::string            _name;
 
-               struct NotePropertyChange {
+               struct NoteChange {
                        DiffCommand::Property property;
                        boost::shared_ptr< Evoral::Note<TimeType> > note;
                        union {
@@ -139,11 +139,11 @@ public:
                        };
                };
 
-               typedef std::list<NotePropertyChange> ChangeList;
+               typedef std::list<NoteChange> ChangeList;
                ChangeList _changes;
 
-               XMLNode &marshal_change(const NotePropertyChange&);
-               NotePropertyChange unmarshal_change(XMLNode *xml_note);
+               XMLNode &marshal_change(const NoteChange&);
+               NoteChange unmarshal_change(XMLNode *xml_note);
        };
 
        MidiModel::DeltaCommand* new_delta_command(const std::string name="midi edit");
index 46aea9f0b468dda2b14379a5a1db3da3224a8c59..ccadb39e92ee4c8db6e8813050c2561388807b33 100644 (file)
@@ -74,7 +74,7 @@ protected:
 private:
        void dump () const;
 
-       bool region_changed (PBD::PropertyChange, boost::shared_ptr<Region>);
+       bool region_changed (const PBD::PropertyChange&, boost::shared_ptr<Region>);
 
        NoteMode _note_mode;
 
index d892e5837fd2445b7c7969cb5a1667d5a90f929b..671e4fca432e7db8b49e49e35c40c415e9080f51 100644 (file)
@@ -96,11 +96,8 @@ class MidiRegion : public Region
   private:
        friend class RegionFactory;
 
-       MidiRegion (boost::shared_ptr<MidiSource>);
        MidiRegion (const SourceList&);
        MidiRegion (boost::shared_ptr<const MidiRegion>, frameoffset_t offset = 0, bool offset_relative = true);
-       MidiRegion (boost::shared_ptr<MidiSource>, const XMLNode&);
-       MidiRegion (const SourceList &, const XMLNode&);
 
   private:
        framecnt_t _read_at (const SourceList&, Evoral::EventSink<nframes_t>& dst,
index 9cd02dec1e338808892ecf78480ed3bb9d5d32b5..7213c993979f798c23db50efba02c84f3a4559ce 100644 (file)
@@ -249,15 +249,15 @@ class Playlist : public SessionObject
        void notify_length_changed ();
        void notify_layering_changed ();
        void notify_contents_changed ();
-       void notify_state_changed (PBD::PropertyChange);
+       void notify_state_changed (const PBD::PropertyChange&);
        void notify_region_moved (boost::shared_ptr<Region>);
 
        void mark_session_dirty();
 
-       void region_changed_proxy (PBD::PropertyChange, boost::weak_ptr<Region>);
-       virtual bool region_changed (PBD::PropertyChange, boost::shared_ptr<Region>);
+       void region_changed_proxy (const PBD::PropertyChange&, boost::weak_ptr<Region>);
+       virtual bool region_changed (const PBD::PropertyChange&, boost::shared_ptr<Region>);
 
-       void region_bounds_changed (PBD::PropertyChange, boost::shared_ptr<Region>);
+       void region_bounds_changed (const PBD::PropertyChange&, boost::shared_ptr<Region>);
        void region_deleted (boost::shared_ptr<Region>);
 
        void sort_regions ();
index 60ccf6698465fed03fdb5b70f1e0d527022d95a6..fb827e308d88d5713ddeb2325f2686a7c6d27ed5 100644 (file)
@@ -89,16 +89,7 @@ class Region
                MusicTime
        };
 
-       static PBD::PropertyChange FadeChanged;
-       static PBD::PropertyChange SyncOffsetChanged;
-       static PBD::PropertyChange MuteChanged;
-       static PBD::PropertyChange OpacityChanged;
-       static PBD::PropertyChange LockChanged;
-       static PBD::PropertyChange LayerChanged;
-       static PBD::PropertyChange HiddenChanged;
-
-       PBD::Signal1<void,PBD::PropertyChange> StateChanged;
-       static PBD::Signal1<void,boost::shared_ptr<ARDOUR::Region> > RegionPropertyChanged;
+       static PBD::Signal2<void,boost::shared_ptr<ARDOUR::Region>, const PBD::PropertyChange&> RegionPropertyChanged;
 
        void unlock_property_changes () { _no_property_changes = false; }
        void block_property_changes () { _no_property_changes = true; }
@@ -281,8 +272,6 @@ class Region
   protected:
        friend class RegionFactory;
 
-       /** Construct a region from a single source */
-       Region (boost::shared_ptr<Source> src);
        /** Construct a region from multiple sources*/
        Region (const SourceList& srcs);
        /** Construct a region from another region, at an offset within that region */
@@ -292,16 +281,11 @@ class Region
        /** normal Region copy constructor */
        Region (boost::shared_ptr<const Region>);
 
-       /** Construct a region from 1 source and XML state */
-       Region (boost::shared_ptr<Source> src, const XMLNode&);
-       /** Construct a region from multiple sources and XML state */
-       Region (const SourceList& srcs, const XMLNode&);
-
        /** Constructor for derived types only */
        Region (Session& s, framepos_t start, framecnt_t length, const std::string& name, DataType);
 
   protected:
-       void send_change (PBD::PropertyChange);
+       void send_change (const PBD::PropertyChange&);
 
        void trim_to_internal (framepos_t position, framecnt_t length, void *src);
        virtual void set_position_internal (framepos_t pos, bool allow_bbt_recompute);
@@ -351,7 +335,7 @@ class Region
        AnalysisFeatureList     _transients;
        bool                    _valid_transients;
        mutable uint64_t        _read_data_count;  ///< modified in read()
-       PBD::PropertyChange             _pending_changed;
+       PBD::PropertyChange     _pending_changed;
        uint64_t                _last_layer_op;  ///< timestamp
        Glib::Mutex             _lock;
        SourceList              _sources;
@@ -365,7 +349,7 @@ class Region
 
        virtual int _set_state (const XMLNode&, int version, PBD::PropertyChange& what_changed, bool send_signal);
 
-       PBD::PropertyChange set_property (const PBD::PropertyBase&);
+       bool set_property (const PBD::PropertyBase&);
        void register_properties ();
 
 private:
index 820295b54a46666ada86984be2415c4f8f9b1895..f3109a707df23599392f9dcf95518f30af190f45 100644 (file)
@@ -131,9 +131,6 @@ class RouteGroup : public SessionObject
        PBD::Signal0<void> changed;
        PBD::Signal1<void,void*> FlagsChanged;
 
-       static PBD::PropertyChange FlagsChange;
-       static PBD::PropertyChange PropertiesChange;
-
        XMLNode& get_state ();
        
        int set_state (const XMLNode&, int version);
index 154c5d0078b71913d3010eb67c22308339f52548..9294d56fcc74b5dbae1cd50953d4e025f2e4a726 100644 (file)
@@ -1210,7 +1210,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void xrun_recovery ();
 
        TempoMap    *_tempo_map;
-       void          tempo_map_changed (PBD::PropertyChange);
+       void          tempo_map_changed (const PBD::PropertyChange&);
 
        /* edit/mix groups */
 
@@ -1257,7 +1257,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        RegionList regions;
 
        void add_region (boost::shared_ptr<Region>);
-       void region_changed (PBD::PropertyChange, boost::weak_ptr<Region>);
+       void region_changed (const PBD::PropertyChange&, boost::weak_ptr<Region>);
        void remove_region (boost::weak_ptr<Region>);
 
        int load_regions (const XMLNode& node);
index 1f81cf6fd252bb1e12816c811856e2f80249d414..d18a1f9d416031f42f9801dffe3b0baf35bf8c08 100644 (file)
@@ -48,7 +48,7 @@ class SessionObject : public SessionHandleRef, public PBD::StatefulDestructible
 
        SessionObject (Session& session, const std::string& name)
                : SessionHandleRef (session)
-               , _name (Properties::name, PBD::PropertyChange (0), name)
+               , _name (Properties::name, name)
        {
                add_property (_name);
        }
@@ -56,18 +56,16 @@ class SessionObject : public SessionHandleRef, public PBD::StatefulDestructible
        Session&    session() const { return _session; }
        std::string name()    const { return _name; }
 
-       PBD::PropertyChange set_property (const PBD::PropertyBase& prop);
+       bool set_property (const PBD::PropertyBase& prop);
 
        virtual bool set_name (const std::string& str) {
                if (_name != str) {
                        _name = str;
-                       NameChanged();
+                       PropertyChanged (PBD::PropertyChange (Properties::name));
                }
                return true;
        }
 
-       PBD::Signal0<void> NameChanged;
-
   protected:
        PBD::Property<std::string> _name;
 };
index 5c2d3d691890828684549050ca883553f719da30..596444173f2a8375d988b618b66f1bd27df28802 100644 (file)
@@ -258,8 +258,6 @@ class TempoMap : public PBD::StatefulDestructible
 
        nframes_t frame_rate () const { return _frame_rate; }
 
-       PBD::Signal1<void,PBD::PropertyChange> StateChanged;
-
   private:
        static Tempo    _default_tempo;
        static Meter    _default_meter;
index 60c7d4bdc38d87f8f29d83757e6b9248c90793cf..6e8b35a07238e8661058cef8f5453f42ab9fa85d 100644 (file)
@@ -525,7 +525,7 @@ AudioPlaylist::add_crossfade (boost::shared_ptr<Crossfade> xfade)
                _crossfades.push_back (xfade);
 
                xfade->Invalidated.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
-               xfade->StateChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
+               xfade->PropertyChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
 
                notify_crossfade_added (xfade);
        }
@@ -581,7 +581,7 @@ AudioPlaylist::set_state (const XMLNode& node, int version)
                        boost::shared_ptr<Crossfade> xfade = boost::shared_ptr<Crossfade> (new Crossfade (*((const Playlist *)this), *child));
                        _crossfades.push_back (xfade);
                        xfade->Invalidated.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
-                       xfade->StateChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
+                       xfade->PropertyChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
                        NewCrossfade(xfade);
                }
 
@@ -726,7 +726,7 @@ AudioPlaylist::destroy_region (boost::shared_ptr<Region> region)
 }
 
 void
-AudioPlaylist::crossfade_changed (PropertyChange)
+AudioPlaylist::crossfade_changed (const PropertyChange&)
 {
        if (in_flush || in_set_state) {
                return;
@@ -742,24 +742,27 @@ AudioPlaylist::crossfade_changed (PropertyChange)
 }
 
 bool
-AudioPlaylist::region_changed (PropertyChange what_changed, boost::shared_ptr<Region> region)
+AudioPlaylist::region_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
 {
        if (in_flush || in_set_state) {
                return false;
        }
 
-       PropertyChange our_interests = PropertyChange (AudioRegion::FadeInChanged|
-                                      AudioRegion::FadeOutChanged|
-                                      AudioRegion::FadeInActiveChanged|
-                                      AudioRegion::FadeOutActiveChanged|
-                                      AudioRegion::EnvelopeActiveChanged|
-                                      AudioRegion::ScaleAmplitudeChanged|
-                                      AudioRegion::EnvelopeChanged);
+       PropertyChange our_interests;
+
+       our_interests.add (Properties::fade_in_active);
+       our_interests.add (Properties::fade_out_active);
+       our_interests.add (Properties::scale_amplitude);
+       our_interests.add (Properties::envelope_active);
+       our_interests.add (Properties::envelope);
+       our_interests.add (Properties::fade_in);
+       our_interests.add (Properties::fade_out);
+
        bool parent_wants_notify;
 
        parent_wants_notify = Playlist::region_changed (what_changed, region);
 
-       if ((parent_wants_notify || (what_changed & our_interests))) {
+       if (parent_wants_notify || (what_changed.contains (our_interests))) {
                notify_contents_changed ();
        }
 
index f1af3b6fabf9c90e6de1667a549f0838b866748e..21fda237cb2338b26784261c5cf8a6152d84b064 100644 (file)
@@ -89,12 +89,12 @@ AudioRegion::register_properties ()
 }
 
 #define AUDIOREGION_STATE_DEFAULT \
-       _envelope_active (Properties::envelope_active, EnvelopeActiveChanged, false) \
-       , _default_fade_in (Properties::default_fade_in, FadeInChanged, true) \
-       , _default_fade_out (Properties::default_fade_out, FadeOutChanged, true) \
-       , _fade_in_active (Properties::fade_in_active, FadeInActiveChanged, true) \
-       , _fade_out_active (Properties::fade_out_active, FadeOutActiveChanged, true) \
-       , _scale_amplitude (Properties::scale_amplitude, ScaleAmplitudeChanged, 1.0)
+       _envelope_active (Properties::envelope_active, false) \
+       , _default_fade_in (Properties::default_fade_in, true) \
+       , _default_fade_out (Properties::default_fade_out, true) \
+       , _fade_in_active (Properties::fade_in_active, true) \
+       , _fade_out_active (Properties::fade_out_active, true) \
+       , _scale_amplitude (Properties::scale_amplitude, 0.0)
 
 #define AUDIOREGION_COPY_STATE(other) \
         _envelope_active (other->_envelope_active) \
@@ -104,14 +104,6 @@ AudioRegion::register_properties ()
         , _fade_out_active (other->_fade_out_active) \
        , _scale_amplitude (other->_scale_amplitude) 
 
-PropertyChange AudioRegion::FadeInChanged         = PBD::new_change();
-PropertyChange AudioRegion::FadeOutChanged        = PBD::new_change();
-PropertyChange AudioRegion::FadeInActiveChanged   = PBD::new_change();
-PropertyChange AudioRegion::FadeOutActiveChanged  = PBD::new_change();
-PropertyChange AudioRegion::EnvelopeActiveChanged = PBD::new_change();
-PropertyChange AudioRegion::ScaleAmplitudeChanged = PBD::new_change();
-PropertyChange AudioRegion::EnvelopeChanged       = PBD::new_change();
-
 /* a Session will reset these to its chosen defaults by calling AudioRegion::set_default_fade() */
 
 void
@@ -142,26 +134,7 @@ AudioRegion::AudioRegion (Session& s, framepos_t start, framecnt_t len, std::str
        assert (_sources.size() == _master_sources.size());
 }
 
-/** Basic AudioRegion constructor (one channel) */
-AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src)
-       : Region (boost::static_pointer_cast<Source>(src))
-       , AUDIOREGION_STATE_DEFAULT
-       , _automatable(src->session())
-       , _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
-       , _fade_out (new AutomationList(Evoral::Parameter(FadeOutAutomation)))
-       , _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
-       , _fade_in_suspended (0)
-       , _fade_out_suspended (0)
-{
-       init ();
-       
-       /* XXX why is this set here ? - set in a property list given to RegionFactory */
-       _external = true;
-
-       assert (_sources.size() == _master_sources.size());
-}
-
-/** Basic AudioRegion constructor (many channels) */
+/** Basic AudioRegion constructor */
 AudioRegion::AudioRegion (const SourceList& srcs)
        : Region (srcs)
        , AUDIOREGION_STATE_DEFAULT
@@ -219,26 +192,8 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, const Sour
        assert (_sources.size() == _master_sources.size());
 }
 
-AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, const XMLNode& node)
-       : Region (src, node)
-       , AUDIOREGION_STATE_DEFAULT
-       , _automatable(src->session())
-       , _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
-       , _fade_out (new AutomationList(Evoral::Parameter(FadeOutAutomation)))
-       , _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
-{
-       init ();
-
-       if (set_state (node, Stateful::loading_state_version)) {
-               throw failed_constructor();
-       }
-
-       assert(_type == DataType::AUDIO);
-       assert (_sources.size() == _master_sources.size());
-}
-
-AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node)
-       : Region (srcs, node)
+AudioRegion::AudioRegion (SourceList& srcs)
+       : Region (srcs)
        , AUDIOREGION_STATE_DEFAULT
        , _automatable(srcs[0]->session())
        , _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
@@ -249,12 +204,7 @@ AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node)
 {
        init ();
 
-       if (set_state (node, Stateful::loading_state_version)) {
-               throw failed_constructor();
-       }
-
        assert(_type == DataType::AUDIO);
-       connect_to_analysis_changed ();
        assert (_sources.size() == _master_sources.size());
 }
 
@@ -327,7 +277,7 @@ AudioRegion::set_envelope_active (bool yn)
 {
        if (envelope_active() != yn) {
                _envelope_active = yn;
-               send_change (EnvelopeActiveChanged);
+               send_change (PropertyChange (Properties::envelope_active));
        }
 }
 
@@ -650,8 +600,7 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
                float a = atof (prop->value().c_str());
                if (a != _scale_amplitude) {
                        _scale_amplitude = a;
-                       what_changed = PropertyChange (what_changed|ScaleAmplitudeChanged);
-                       cerr << _name << " amp changed\n";
+                       what_changed.add (Properties::scale_amplitude);
                }
        }
 
@@ -730,7 +679,6 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
        thaw ();
 
        if (send) {
-               cerr << _name << ": audio final change: " << hex << what_changed << dec << endl;
                send_change (what_changed);
        }
 
@@ -741,54 +689,52 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
        return 0;
 }
 
-PropertyChange
+bool
 AudioRegion::set_property (const PropertyBase& prop)
 {
-       PropertyChange c = PropertyChange (0);
-
        DEBUG_TRACE (DEBUG::Properties,  string_compose ("audio region %1 set property %2\n", _name.val(), prop.property_name()));
 
        if (prop == Properties::envelope_active.id) {
                bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
                if (val != _envelope_active) {
                        _envelope_active = val;
-                       c = EnvelopeActiveChanged;
+                       return true;
                }
        } else if (prop == Properties::default_fade_in.id) {
                bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
                if (val != _default_fade_in) {
                        _default_fade_in = val;
-                       c = FadeInChanged;
+                       return true;
                }
        } else if (prop == Properties::default_fade_out.id) {
                bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
                if (val != _default_fade_out) {
                        _default_fade_out = val;
-                       c = FadeOutChanged;
+                       return true;
                }
        } else if (prop == Properties::fade_in_active.id) {
                bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
                if (val != _fade_in_active) {
                        _fade_in_active = val;
-                       c = FadeInActiveChanged;
+                       return true;
                }
        } else if (prop == Properties::fade_out_active.id) {
                bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
                if (val != _fade_out_active) {
                        _fade_out_active = val;
-                       c = FadeOutChanged;
+                       return true;
                }
        } else if (prop == Properties::scale_amplitude.id) {
                gain_t val = dynamic_cast<const PropertyTemplate<gain_t>*>(&prop)->val();
                if (val != _scale_amplitude) {
                        _scale_amplitude = val;
-                       c = ScaleAmplitudeChanged;
+                       return true;
                }
        } else {
                return Region::set_property (prop);
        }
-
-       return c;
+       
+       return false;
 }
 
 int
@@ -817,7 +763,7 @@ AudioRegion::set_fade_in (boost::shared_ptr<AutomationList> f)
        *_fade_in = *f;
        _fade_in->thaw ();
        
-       send_change (FadeInChanged);
+       send_change (PropertyChange (Properties::fade_in));
 }
 
 void
@@ -884,7 +830,7 @@ AudioRegion::set_fade_out (boost::shared_ptr<AutomationList> f)
        *_fade_out = *f;
        _fade_out->thaw ();
 
-       send_change (FadeInChanged);
+       send_change (PropertyChange (Properties::fade_in));
 }
 
 void
@@ -953,7 +899,7 @@ AudioRegion::set_fade_in_length (framecnt_t len)
 
        if (changed) {
                _default_fade_in = false;
-               send_change (FadeInChanged);
+               send_change (PropertyChange (Properties::fade_in));
        }
 }
 
@@ -968,7 +914,7 @@ AudioRegion::set_fade_out_length (framecnt_t len)
 
        if (changed) {
                _default_fade_out = false;
-               send_change (FadeOutChanged);
+               send_change (PropertyChange (Properties::fade_out));
        }
 }
 
@@ -980,7 +926,7 @@ AudioRegion::set_fade_in_active (bool yn)
        }
 
        _fade_in_active = yn;
-       send_change (FadeInActiveChanged);
+       send_change (PropertyChange (Properties::fade_in_active));
 }
 
 void
@@ -990,7 +936,7 @@ AudioRegion::set_fade_out_active (bool yn)
                return;
        }
        _fade_out_active = yn;
-       send_change (FadeOutActiveChanged);
+       send_change (PropertyChange (Properties::fade_out_active));
 }
 
 bool
@@ -1050,12 +996,12 @@ AudioRegion::recompute_at_end ()
 
        if (_fade_in->back()->when > _length) {
                _fade_in->extend_to (_length);
-               send_change (FadeInChanged);
+               send_change (PropertyChange (Properties::fade_in));
        }
 
        if (_fade_out->back()->when > _length) {
                _fade_out->extend_to (_length);
-               send_change (FadeOutChanged);
+               send_change (PropertyChange (Properties::fade_out));
        }
 }
 
@@ -1068,12 +1014,12 @@ AudioRegion::recompute_at_start ()
 
        if (_fade_in->back()->when > _length) {
                _fade_in->extend_to (_length);
-               send_change (FadeInChanged);
+               send_change (PropertyChange (Properties::fade_in));
        }
 
        if (_fade_out->back()->when > _length) {
                _fade_out->extend_to (_length);
-               send_change (FadeOutChanged);
+               send_change (PropertyChange (Properties::fade_out));
        }
 }
 
@@ -1212,7 +1158,7 @@ AudioRegion::set_scale_amplitude (gain_t g)
 
        /* tell everybody else */
 
-       send_change (ScaleAmplitudeChanged);
+       send_change (PropertyChange (Properties::scale_amplitude));
 }
 
 void
@@ -1282,25 +1228,25 @@ AudioRegion::normalize_to (float target_dB)
 
        /* tell everybody else */
 
-       send_change (ScaleAmplitudeChanged);
+       send_change (PropertyChange (Properties::scale_amplitude));
 }
 
 void
 AudioRegion::fade_in_changed ()
 {
-       send_change (FadeInChanged);
+       send_change (PropertyChange (Properties::fade_in));
 }
 
 void
 AudioRegion::fade_out_changed ()
 {
-       send_change (FadeOutChanged);
+       send_change (PropertyChange (Properties::fade_out));
 }
 
 void
 AudioRegion::envelope_changed ()
 {
-       send_change (EnvelopeChanged);
+       send_change (PropertyChange (Properties::envelope));
 }
 
 void
index dc84352f4ebbb0dc7647a0db9cfbfa38224da650..8275876fe8223b029a4e3a1cc3dcb1609759ca51 100644 (file)
@@ -37,8 +37,6 @@ using namespace ARDOUR;
 using namespace PBD;
 
 framecnt_t Crossfade::_short_xfade_length = 0;
-PropertyChange Crossfade::ActiveChanged = new_change();
-PropertyChange Crossfade::FollowOverlapChanged = new_change();
 
 /* XXX if and when we ever implement parallel processing of the process()
    callback, these will need to be handled on a per-thread basis.
@@ -47,6 +45,24 @@ PropertyChange Crossfade::FollowOverlapChanged = new_change();
 Sample* Crossfade::crossfade_buffer_out = 0;
 Sample* Crossfade::crossfade_buffer_in = 0;
 
+
+#define CROSSFADE_DEFAULT_PROPERTIES \
+       _active (Properties::active, _session.config.get_xfades_active ()) \
+       , _follow_overlap (Properties::follow_overlap, false)
+
+
+namespace ARDOUR {
+       namespace Properties {
+               PropertyDescriptor<bool> follow_overlap;
+       }
+}
+
+void
+Crossfade::make_property_quarks ()
+{
+       Properties::follow_overlap.id = g_quark_from_static_string (X_("follow-overlap"));
+}
+
 void
 Crossfade::set_buffer_size (framecnt_t sz)
 {
@@ -72,26 +88,25 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<Audio
                      framecnt_t length,
                      framepos_t position,
                      AnchorPoint ap)
-       : AudioRegion (in->session(), position, length, in->name() + string ("<>") + out->name()),
-         _fade_in (Evoral::Parameter(FadeInAutomation)), // linear (gain coefficient) => -inf..+6dB
-         _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
+       : AudioRegion (in->session(), position, length, in->name() + string ("<>") + out->name())
+       , CROSSFADE_DEFAULT_PROPERTIES
+       , _fade_in (Evoral::Parameter(FadeInAutomation)) // linear (gain coefficient) => -inf..+6dB
+       , _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
 
 {
        _in = in;
        _out = out;
        _anchor_point = ap;
-       _follow_overlap = false;
-
-       _active = _session.config.get_xfades_active ();
        _fixed = true;
 
        initialize ();
 }
 
 Crossfade::Crossfade (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioRegion> b, CrossfadeModel model, bool act)
-       : AudioRegion (a->session(), 0, 0, a->name() + string ("<>") + b->name()),
-         _fade_in (Evoral::Parameter(FadeInAutomation)), // linear (gain coefficient) => -inf..+6dB
-         _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
+       : AudioRegion (a->session(), 0, 0, a->name() + string ("<>") + b->name())
+       , CROSSFADE_DEFAULT_PROPERTIES
+       , _fade_in (Evoral::Parameter(FadeInAutomation)) // linear (gain coefficient) => -inf..+6dB
+       , _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
 {
        _in_update = false;
        _fixed = false;
@@ -107,9 +122,10 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioR
 }
 
 Crossfade::Crossfade (const Playlist& playlist, XMLNode& node)
-       : AudioRegion (playlist.session(), 0, 0, "unnamed crossfade"),
-         _fade_in (Evoral::Parameter(FadeInAutomation)), // linear (gain coefficient) => -inf..+6dB
-         _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
+       : AudioRegion (playlist.session(), 0, 0, "unnamed crossfade")
+       , CROSSFADE_DEFAULT_PROPERTIES
+       , _fade_in (Evoral::Parameter(FadeInAutomation)) // linear (gain coefficient) => -inf..+6dB
+       , _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
 
 {
        boost::shared_ptr<Region> r;
@@ -163,6 +179,7 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node)
 
 Crossfade::Crossfade (boost::shared_ptr<Crossfade> orig, boost::shared_ptr<AudioRegion> newin, boost::shared_ptr<AudioRegion> newout)
        : AudioRegion (boost::dynamic_pointer_cast<const AudioRegion> (orig), 0, true)
+       , CROSSFADE_DEFAULT_PROPERTIES
        , _fade_in (orig->_fade_in)
        , _fade_out (orig->_fade_out)
 {
@@ -377,7 +394,7 @@ Crossfade::set_active (bool yn)
 {
        if (_active != yn) {
                _active = yn;
-               StateChanged (ActiveChanged);
+               PropertyChanged (PropertyChange (Properties::active));
        }
 }
 
@@ -442,7 +459,11 @@ Crossfade::refresh ()
        }
 
        if (send_signal) {
-               StateChanged (BoundsChanged); /* EMIT SIGNAL */
+               PropertyChange bounds;
+               bounds.add (Properties::start);
+               bounds.add (Properties::position);
+               bounds.add (Properties::length);
+               PropertyChanged (bounds); /* EMIT SIGNAL */
        }
 
        _in_update = false;
@@ -722,14 +743,14 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
        XMLNode* fo;
        const XMLProperty* prop;
        LocaleGuard lg (X_("POSIX"));
-       PropertyChange what_changed = PropertyChange (0);
+       PropertyChange what_changed;
        framepos_t val;
 
        if ((prop = node.property ("position")) != 0) {
                sscanf (prop->value().c_str(), "%" PRId64, &val);
                if (val != _position) {
                        _position = val;
-                       what_changed = PropertyChange (what_changed | PositionChanged);
+                       what_changed.add (Properties::position);
                }
        } else {
                warning << _("old-style crossfade information - no position information") << endmsg;
@@ -740,7 +761,7 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
                bool x = string_is_affirmative (prop->value());
                if (x != _active) {
                        _active = x;
-                       what_changed = PropertyChange (what_changed | ActiveChanged);
+                       what_changed.add (Properties::active);
                }
        } else {
                _active = true;
@@ -769,7 +790,7 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
                sscanf (prop->value().c_str(), "%" PRId64, &val);
                if (val != _length) {
                        _length = val;
-                       what_changed = PropertyChange (what_changed | LengthChanged);
+                       what_changed.add (Properties::length);
                }
 
        } else {
@@ -840,7 +861,7 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
 
        _fade_out.thaw ();
 
-       StateChanged (what_changed); /* EMIT SIGNAL */
+       PropertyChanged (what_changed); /* EMIT SIGNAL */
 
        return 0;
 }
@@ -866,7 +887,7 @@ Crossfade::set_follow_overlap (bool yn)
                set_xfade_length (_out->first_frame() + _out->length() - _in->first_frame());
        }
 
-       StateChanged (FollowOverlapChanged);
+       PropertyChanged (PropertyChange (Properties::follow_overlap));
 }
 
 framecnt_t
@@ -900,8 +921,8 @@ Crossfade::set_xfade_length (framecnt_t len)
 
        _length = len;
 
-       StateChanged (LengthChanged);
-
+       PropertyChanged (PropertyChange (Properties::length));
+       
        return len;
 }
 
index 6aee3a75729f9ad2ed10641471a37aa3b93a9c31..f80eb849ec99f66cfb065da41f4243cebf58159e 100644 (file)
@@ -361,7 +361,7 @@ Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist)
 }
 
 void
-Diskstream::playlist_changed (PropertyChange)
+Diskstream::playlist_changed (const PropertyChange&)
 {
        playlist_modified ();
 }
index f117e6d063ddf4c78f113655b4067544dde0e4f2..ee19f1caacb09fcc1a7b8792e4a81f862c36d90f 100644 (file)
@@ -102,12 +102,6 @@ MIDI::Port *ARDOUR::default_mtc_port = 0;
 MIDI::Port *ARDOUR::default_midi_port = 0;
 MIDI::Port *ARDOUR::default_midi_clock_port = 0;
 
-PropertyChange ARDOUR::StartChanged = PBD::new_change ();
-PropertyChange ARDOUR::LengthChanged = PBD::new_change ();
-PropertyChange ARDOUR::PositionChanged = PBD::new_change ();
-PropertyChange ARDOUR::NameChanged = PBD::new_change ();
-PropertyChange ARDOUR::BoundsChanged = PropertyChange (0); // see init(), below
-
 compute_peak_t          ARDOUR::compute_peak = 0;
 find_peaks_t            ARDOUR::find_peaks = 0;
 apply_gain_to_buffer_t  ARDOUR::apply_gain_to_buffer = 0;
@@ -118,6 +112,36 @@ PBD::Signal1<void,std::string> ARDOUR::BootMessage;
 
 void ARDOUR::setup_enum_writer ();
 
+/* this is useful for quite a few things that want to check
+   if any bounds-related property has changed
+*/
+PBD::PropertyChange ARDOUR::bounds_change;
+
+namespace ARDOUR { 
+       namespace Properties {
+
+               /* the envelope and fades are not scalar items and so
+                  currently (2010/02) are not stored using Property.
+                  However, these descriptors enable us to notify
+                  about changes to them via PropertyChange. 
+
+                  Declared in ardour/audioregion.h ...
+               */
+
+               PBD::PropertyDescriptor<bool> fade_in;
+               PBD::PropertyDescriptor<bool> fade_out;
+               PBD::PropertyDescriptor<bool> envelope;
+       }
+}
+
+void
+ARDOUR::make_property_quarks ()
+{
+       Properties::fade_in.id = g_quark_from_static_string (X_("fade_in_FAKE"));
+       Properties::fade_out.id = g_quark_from_static_string (X_("fade_out_FAKE"));
+       Properties::envelope.id = g_quark_from_static_string (X_("envelope_FAKE"));
+}
+
 int
 ARDOUR::setup_midi ()
 {
@@ -302,12 +326,23 @@ ARDOUR::init (bool use_vst, bool try_optimization)
 
        PBD::ID::init ();
        SessionEvent::init_event_pool ();
-
+       
+       make_property_quarks ();
        SessionObject::make_property_quarks ();
        Region::make_property_quarks ();
        AudioRegion::make_property_quarks ();
        RouteGroup::make_property_quarks ();
 
+       /* this is a useful ready to use PropertyChange that many
+          things need to check. This avoids having to compose
+          it every time we want to check for any of the relevant
+          property changes.
+       */
+
+       bounds_change.add (ARDOUR::Properties::start);
+       bounds_change.add (ARDOUR::Properties::position);
+       bounds_change.add (ARDOUR::Properties::length);
+
        /* provide a state version for the few cases that need it and are not
           driven by reading state from disk (e.g. undo/redo)
        */
@@ -367,8 +402,6 @@ ARDOUR::init (bool use_vst, bool try_optimization)
        /* singleton - first object is "it" */
        new PluginManager ();
 
-       BoundsChanged = PropertyChange (StartChanged|PositionChanged|LengthChanged);
-
        return 0;
 }
 
index 4a4823a29f0b7efbbebbe18b688f8e987080abc0..59446779343b221bd1689873fb7d2f2bfb4981ef 100644 (file)
@@ -44,7 +44,7 @@ InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, boost:
        set_name (sendto->name());
 
        _send_to->DropReferences.connect_same_thread (*this, boost::bind (&InternalSend::send_to_going_away, this));
-       _send_to->NameChanged.connect_same_thread (*this, boost::bind (&InternalSend::send_to_name_changed, this));
+       _send_to->PropertyChanged.connect_same_thread (*this, boost::bind (&InternalSend::send_to_property_changed, this, _1));;
 }
 
 InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node)
@@ -269,7 +269,9 @@ InternalSend::visible () const
 }
 
 void
-InternalSend::send_to_name_changed ()
+InternalSend::send_to_property_changed (const PropertyChange& what_changed)
 {
-       set_name (_send_to->name ());
+       if (what_changed.contains (Properties::name)) {
+               set_name (_send_to->name ());
+       }
 }
index baa3c2c7c016d4c54b408de7cf38e48c6d78e126..ac3360ea2b0e77776f38a43ecfea767a56fae7bc 100644 (file)
@@ -326,7 +326,7 @@ void
 MidiModel::DiffCommand::change(const boost::shared_ptr< Evoral::Note<TimeType> > note, Property prop,
                               uint8_t new_value)
 {
-       NotePropertyChange change;
+       NoteChange change;
 
        change.note = note;
        change.property = prop;
@@ -359,7 +359,7 @@ void
 MidiModel::DiffCommand::change(const boost::shared_ptr< Evoral::Note<TimeType> > note, Property prop,
                               TimeType new_time)
 {
-       NotePropertyChange change;
+       NoteChange change;
 
        change.note = note;
        change.property = prop;
@@ -443,7 +443,7 @@ MidiModel::DiffCommand::undo()
 }
 
 XMLNode&
-MidiModel::DiffCommand::marshal_change(const NotePropertyChange& change)
+MidiModel::DiffCommand::marshal_change(const NoteChange& change)
 {
        XMLNode* xml_change = new XMLNode("change");
 
@@ -516,11 +516,11 @@ MidiModel::DiffCommand::marshal_change(const NotePropertyChange& change)
        return *xml_change;
 }
 
-MidiModel::DiffCommand::NotePropertyChange
+MidiModel::DiffCommand::NoteChange
 MidiModel::DiffCommand::unmarshal_change(XMLNode *xml_change)
 {
        XMLProperty* prop;
-       NotePropertyChange change;
+       NoteChange change;
        unsigned int note;
        unsigned int channel;
        unsigned int velocity;
index cafbcc9e93d5caff767d038bd24f8678ccca81b9..8c94bb1a7fe0fd0958816e4f89327c999a94514a 100644 (file)
@@ -415,7 +415,7 @@ MidiPlaylist::contained_automation()
 
 
 bool
-MidiPlaylist::region_changed (PBD::PropertyChange what_changed, boost::shared_ptr<Region> region)
+MidiPlaylist::region_changed (const PBD::PropertyChange& what_changed, boost::shared_ptr<Region> region)
 {
        if (in_flush || in_set_state) {
                return false;
@@ -423,18 +423,13 @@ MidiPlaylist::region_changed (PBD::PropertyChange what_changed, boost::shared_pt
 
        // Feeling rather uninterested today, but thanks for the heads up anyway!
 
-       PBD::PropertyChange our_interests = PBD::PropertyChange (/*MidiRegion::FadeInChanged|
-                                      MidiRegion::FadeOutChanged|
-                                      MidiRegion::FadeInActiveChanged|
-                                      MidiRegion::FadeOutActiveChanged|
-                                      MidiRegion::EnvelopeActiveChanged|
-                                      MidiRegion::ScaleAmplitudeChanged|
-                                      MidiRegion::EnvelopeChanged*/);
+       PBD::PropertyChange our_interests;
+
        bool parent_wants_notify;
 
        parent_wants_notify = Playlist::region_changed (what_changed, region);
 
-       if ((parent_wants_notify || (what_changed & our_interests))) {
+       if (parent_wants_notify || what_changed.contains (our_interests)) {
                notify_contents_changed ();
        }
 
index f166dafda8a3f19c0ef165c4048dcd5dfc07decd..936ce047eec35f2620641a37f2a3f0bbc9e37bf3 100644 (file)
@@ -47,23 +47,15 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-/** Basic MidiRegion constructor (one channel) */
-MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src)
-       : Region (src)
-{
-       assert(_name.val().find("/") == string::npos);
-       midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
-}
-
 /* Basic MidiRegion constructor (many channels) */
 MidiRegion::MidiRegion (const SourceList& srcs)
        : Region (srcs)
 {
-       assert(_name.val().find("/") == string::npos);
        midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
+       assert(_name.val().find("/") == string::npos);
+       assert(_type == DataType::MIDI);
 }
 
-
 /** Create a new MidiRegion, that is part of an existing one */
 MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, frameoffset_t offset, bool offset_relative)
        : Region (other, offset, offset_relative)
@@ -72,30 +64,6 @@ MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, frameoffset_t
        midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
 }
 
-MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, const XMLNode& node)
-       : Region (src, node)
-{
-       if (set_state (node, Stateful::loading_state_version)) {
-               throw failed_constructor();
-       }
-
-       midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
-       assert(_name.val().find("/") == string::npos);
-       assert(_type == DataType::MIDI);
-}
-
-MidiRegion::MidiRegion (const SourceList& srcs, const XMLNode& node)
-       : Region (srcs, node)
-{
-       if (set_state (node, Stateful::loading_state_version)) {
-               throw failed_constructor();
-       }
-
-       midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
-       assert(_name.val().find("/") == string::npos);
-       assert(_type == DataType::MIDI);
-}
-
 MidiRegion::~MidiRegion ()
 {
 }
index 9d909d0fa659e849d386f14981da7c7b90319e50..f3a9c9949779a569cea0370a396362fa227fd128 100644 (file)
@@ -666,7 +666,7 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, framepos_t posi
                }
        }
 
-       region->StateChanged.connect_same_thread (region_state_changed_connections, boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr<Region> (region)));
+       region->PropertyChanged.connect_same_thread (region_state_changed_connections, boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr<Region> (region)));
 
        return true;
 }
@@ -1383,13 +1383,13 @@ Playlist::core_splice (framepos_t at, framecnt_t distance, boost::shared_ptr<Reg
 }
 
 void
-Playlist::region_bounds_changed (PropertyChange what_changed, boost::shared_ptr<Region> region)
+Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
 {
        if (in_set_state || _splicing || _nudging || _shuffling) {
                return;
        }
 
-       if (what_changed & ARDOUR::PositionChanged) {
+       if (what_changed.contains (Properties::position)) {
 
                /* remove it from the list then add it back in
                   the right place again.
@@ -1410,15 +1410,15 @@ Playlist::region_bounds_changed (PropertyChange what_changed, boost::shared_ptr<
                regions.insert (upper_bound (regions.begin(), regions.end(), region, cmp), region);
        }
 
-       if (what_changed & PropertyChange (ARDOUR::PositionChanged|ARDOUR::LengthChanged)) {
+       if (what_changed.contains (Properties::position) || what_changed.contains (Properties::length)) {
 
                frameoffset_t delta = 0;
 
-               if (what_changed & ARDOUR::PositionChanged) {
+               if (what_changed.contains (Properties::position)) {
                        delta = region->position() - region->last_position();
                }
 
-               if (what_changed & ARDOUR::LengthChanged) {
+               if (what_changed.contains (Properties::length)) {
                        delta += region->length() - region->last_length();
                }
 
@@ -1442,7 +1442,7 @@ Playlist::region_bounds_changed (PropertyChange what_changed, boost::shared_ptr<
 }
 
 void
-Playlist::region_changed_proxy (PropertyChange what_changed, boost::weak_ptr<Region> weak_region)
+Playlist::region_changed_proxy (const PropertyChange& what_changed, boost::weak_ptr<Region> weak_region)
 {
        boost::shared_ptr<Region> region (weak_region.lock());
 
@@ -1456,26 +1456,38 @@ Playlist::region_changed_proxy (PropertyChange what_changed, boost::weak_ptr<Reg
 }
 
 bool
-Playlist::region_changed (PropertyChange what_changed, boost::shared_ptr<Region> region)
+Playlist::region_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
 {
-       PropertyChange our_interests = PropertyChange (Region::MuteChanged|Region::LayerChanged|Region::OpacityChanged);
+       PropertyChange our_interests;
+       PropertyChange bounds;
+       PropertyChange pos_and_length;
        bool save = false;
 
        if (in_set_state || in_flush) {
                return false;
        }
 
-       if (what_changed & BoundsChanged) {
+       our_interests.add (Properties::muted);
+       our_interests.add (Properties::layer);
+       our_interests.add (Properties::opaque);
+
+       bounds.add (Properties::start);
+       bounds.add (Properties::position);
+       bounds.add (Properties::length);
+
+       pos_and_length.add (Properties::position);
+       pos_and_length.add (Properties::length);
+
+       if (what_changed.contains (bounds)) {
                region_bounds_changed (what_changed, region);
                save = !(_splicing || _nudging);
        }
 
-       if ((what_changed & our_interests) &&
-           !(what_changed & PropertyChange (ARDOUR::PositionChanged|ARDOUR::LengthChanged))) {
+       if (what_changed.contains (our_interests) && !what_changed.contains (pos_and_length)) {
                check_dependents (region, false);
        }
 
-       if (what_changed & PropertyChange (ARDOUR::PositionChanged)) {
+       if (what_changed.contains (Properties::position)) {
                notify_region_moved (region);
        }
 
@@ -1484,7 +1496,7 @@ Playlist::region_changed (PropertyChange what_changed, boost::shared_ptr<Region>
           them, and we notify in ::relayer()
        */
 
-       if (what_changed & our_interests) {
+       if (what_changed.contains (our_interests)) {
                save = true;
        }
 
@@ -1973,7 +1985,7 @@ Playlist::set_state (const XMLNode& node, int version)
                                error << _("region state node has no ID, ignored") << endmsg;
                                continue;
                        }
-
+                       
                        ID id = prop->value ();
 
                        if ((region = region_by_id (id))) {
index 740a4abd5e9c325a32cf501532df1795b5d5502f..9cd8d49411230f9a21a25cbbc8b9248ae0649084 100644 (file)
@@ -46,14 +46,6 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-PropertyChange Region::FadeChanged       = PBD::new_change ();
-PropertyChange Region::SyncOffsetChanged = PBD::new_change ();
-PropertyChange Region::MuteChanged       = PBD::new_change ();
-PropertyChange Region::OpacityChanged    = PBD::new_change ();
-PropertyChange Region::LockChanged       = PBD::new_change ();
-PropertyChange Region::LayerChanged      = PBD::new_change ();
-PropertyChange Region::HiddenChanged     = PBD::new_change ();
-
 namespace ARDOUR { 
        namespace Properties {
                PBD::PropertyDescriptor<bool> muted;
@@ -80,7 +72,7 @@ namespace ARDOUR {
        }
 }
        
-PBD::Signal1<void,boost::shared_ptr<ARDOUR::Region> > Region::RegionPropertyChanged;
+PBD::Signal2<void,boost::shared_ptr<ARDOUR::Region>,const PropertyChange&> Region::RegionPropertyChanged;
 
 void
 Region::make_property_quarks ()
@@ -137,27 +129,27 @@ Region::register_properties ()
 }
 
 #define REGION_DEFAULT_STATE(s,l) \
-       _muted (Properties::muted, MuteChanged, false)       \
-       , _opaque (Properties::opaque, OpacityChanged, true) \
-       , _locked (Properties::locked, LockChanged, false) \
-       , _automatic (Properties::automatic, PropertyChange (0), false) \
-       , _whole_file (Properties::whole_file, PropertyChange (0), false) \
-       , _import (Properties::import, PropertyChange (0), false) \
-       , _external (Properties::external, PropertyChange (0), false) \
-       , _sync_marked (Properties::sync_marked, SyncOffsetChanged, false) \
-       , _left_of_split (Properties::left_of_split, PropertyChange (0), false) \
-       , _right_of_split (Properties::right_of_split, PropertyChange (0), false) \
-       , _hidden (Properties::hidden, HiddenChanged, false) \
-       , _position_locked (Properties::position_locked, PropertyChange (0), false) \
-       , _start (Properties::start, StartChanged, (s)) \
-       , _length (Properties::length, LengthChanged, (l))      \
-       , _position (Properties::position, PositionChanged, 0) \
-       , _sync_position (Properties::sync_position, SyncOffsetChanged, (s)) \
-       , _layer (Properties::layer, LayerChanged, 0)   \
-       , _ancestral_start (Properties::ancestral_start, PropertyChange (0), (s)) \
-       , _ancestral_length (Properties::ancestral_length, PropertyChange (0), (l)) \
-       , _stretch (Properties::stretch, PropertyChange (0), 1.0) \
-       , _shift (Properties::shift, PropertyChange (0), 1.0)
+       _muted (Properties::muted, false)            \
+       , _opaque (Properties::opaque, true) \
+       , _locked (Properties::locked, false) \
+       , _automatic (Properties::automatic, false) \
+       , _whole_file (Properties::whole_file, false) \
+       , _import (Properties::import, false) \
+       , _external (Properties::external, false) \
+       , _sync_marked (Properties::sync_marked, false) \
+       , _left_of_split (Properties::left_of_split, false) \
+       , _right_of_split (Properties::right_of_split, false) \
+       , _hidden (Properties::hidden, false) \
+       , _position_locked (Properties::position_locked, false) \
+       , _start (Properties::start, (s))       \
+       , _length (Properties::length, (l))     \
+       , _position (Properties::position, 0) \
+       , _sync_position (Properties::sync_position, (s)) \
+       , _layer (Properties::layer, 0) \
+       , _ancestral_start (Properties::ancestral_start, (s)) \
+       , _ancestral_length (Properties::ancestral_length, (l)) \
+       , _stretch (Properties::stretch, 1.0) \
+       , _shift (Properties::shift, 1.0)
 
 #define REGION_COPY_STATE(other) \
          _muted (other->_muted) \
@@ -194,7 +186,6 @@ Region::Region (Session& s, framepos_t start, framecnt_t length, const string& n
        , _first_edit (EditChangesNothing)
        , _frozen(0)
        , _read_data_count(0)
-       , _pending_changed(PropertyChange (0))
        , _last_layer_op(0)
        , _pending_explicit_relayer (false)
 {
@@ -203,34 +194,6 @@ Region::Region (Session& s, framepos_t start, framecnt_t length, const string& n
        /* no sources at this point */
 }
 
-/** Basic Region constructor (single source) */
-Region::Region (boost::shared_ptr<Source> src)
-       : SessionObject(src->session(), "toBeRenamed")
-       , _type (src->type())
-       , _no_property_changes (true)
-       , REGION_DEFAULT_STATE(0,0)
-       , _last_length (0)
-       , _last_position (0)
-        , _positional_lock_style (_type == DataType::AUDIO ? AudioTime : MusicTime)
-       , _first_edit (EditChangesNothing)
-       , _frozen(0)
-       , _valid_transients(false)
-       , _read_data_count(0)
-       , _pending_changed(PropertyChange (0))
-       , _last_layer_op(0)
-       , _pending_explicit_relayer (false)
-{
-       register_properties ();
-
-       _sources.push_back (src);
-       _master_sources.push_back (src);
-
-       src->DropReferences.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(src)));
-       
-       assert (_sources.size() > 0);
-       assert (_type == src->type());
-}
-
 /** Basic Region constructor (many sources) */
 Region::Region (const SourceList& srcs)
        : SessionObject(srcs.front()->session(), "toBeRenamed")
@@ -244,7 +207,6 @@ Region::Region (const SourceList& srcs)
        , _frozen (0)
        , _valid_transients(false)
        , _read_data_count(0)
-       , _pending_changed(PropertyChange (0))
        , _last_layer_op (0)
        , _pending_explicit_relayer (false)
 {
@@ -277,7 +239,6 @@ Region::Region (boost::shared_ptr<const Region> other, frameoffset_t offset, boo
        , _frozen (0)
        , _valid_transients(false)
        , _read_data_count(0)
-       , _pending_changed(PropertyChange (0))
        , _last_layer_op (0)
        , _pending_explicit_relayer (false)
 
@@ -387,7 +348,6 @@ Region::Region (boost::shared_ptr<const Region> other, const SourceList& srcs)
        , _frozen (0)
        , _valid_transients (false)
        , _read_data_count (0)
-       , _pending_changed (PropertyChange(0))
        , _last_layer_op (other->_last_layer_op)
        , _pending_explicit_relayer (false)
 {
@@ -421,7 +381,6 @@ Region::Region (boost::shared_ptr<const Region> other)
        , _frozen(0)
        , _valid_transients(false)
        , _read_data_count(0)
-       , _pending_changed(PropertyChange(0))
        , _last_layer_op(other->_last_layer_op)
        , _pending_explicit_relayer (false)
 {
@@ -442,74 +401,6 @@ Region::Region (boost::shared_ptr<const Region> other)
        assert(_sources.size() > 0);
 }
 
-Region::Region (const SourceList& srcs, const XMLNode& node)
-       : SessionObject(srcs.front()->session(), X_("error: XML did not reset this"))
-       , _type (srcs.front()->type())
-       , REGION_DEFAULT_STATE(0,0)
-       , _last_length (0)
-       , _last_position (0)
-        , _positional_lock_style (_type == DataType::AUDIO ? AudioTime : MusicTime)
-       , _first_edit (EditChangesNothing)
-       , _frozen(0)
-       , _valid_transients(false)
-       , _read_data_count(0)
-       , _pending_changed(PropertyChange(0))
-       , _last_layer_op(0)
-       , _pending_explicit_relayer (false)
-{
-       const XMLProperty* prop;
-
-       register_properties ();
-
-       if ((prop = node.property (X_("id")))) {
-               _id = prop->value();
-       }
-
-       use_sources (srcs);
-
-       if (set_state (node, Stateful::loading_state_version)) {
-               throw failed_constructor();
-       }
-
-       assert(_type != DataType::NIL);
-       assert(_sources.size() > 0);
-       assert (_type == srcs.front()->type());
-
-}
-
-Region::Region (boost::shared_ptr<Source> src, const XMLNode& node)
-       : SessionObject(src->session(), X_("error: XML did not reset this"))
-       , _type (src->type())
-       , REGION_DEFAULT_STATE(0,0)
-       , _last_length (0)
-       , _last_position (0)
-        , _positional_lock_style (_type == DataType::AUDIO ? AudioTime : MusicTime)
-       , _first_edit (EditChangesNothing)
-       , _frozen (0)
-       , _read_data_count (0)
-       , _pending_changed (PropertyChange(0))
-       , _last_layer_op (0)
-       , _pending_explicit_relayer (false)
-{
-       const XMLProperty *prop;
-
-       register_properties ();
-
-       _sources.push_back (src);
-
-       if ((prop = node.property (X_("id")))) {
-               _id = prop->value();
-       }
-
-       if (set_state (node, Stateful::loading_state_version)) {
-               throw failed_constructor();
-       }
-
-       assert (_type != DataType::NIL);
-       assert (_sources.size() > 0);
-       assert (_type == src->type());
-}
-
 Region::~Region ()
 {
        DEBUG_TRACE (DEBUG::Destruction, string_compose ("Region %1 destructor @ %2\n", _name, this));
@@ -527,7 +418,7 @@ Region::set_name (const std::string& str)
        if (_name != str) {
                SessionObject::set_name(str); // EMIT SIGNAL NameChanged()
                assert(_name == str);
-               send_change (ARDOUR::NameChanged);
+               send_change (Properties::name);
        }
 
        return true;
@@ -567,7 +458,7 @@ Region::set_length (framecnt_t len, void */*src*/)
                        recompute_at_end ();
                }
 
-               send_change (LengthChanged);
+               send_change (Properties::length);
        }
 }
 
@@ -587,7 +478,7 @@ Region::first_edit ()
                _name = _session.new_region_name (_name);
                _first_edit = EditChangesNothing;
 
-               send_change (ARDOUR::NameChanged);
+               send_change (Properties::name);
                RegionFactory::CheckNewRegion (shared_from_this());
        }
 }
@@ -709,7 +600,7 @@ Region::set_position_internal (framepos_t pos, bool allow_bbt_recompute)
           a GUI that has moved its representation already.
        */
 
-       send_change (PositionChanged);
+       send_change (Properties::position);
 }
 
 void
@@ -734,7 +625,7 @@ Region::set_position_on_top (framepos_t pos, void* /*src*/)
           a GUI that has moved its representation already.
        */
 
-       send_change (PositionChanged);
+       send_change (Properties::position);
 }
 
 void
@@ -772,7 +663,7 @@ Region::nudge_position (frameoffset_t n, void* /*src*/)
                }
        }
 
-       send_change (PositionChanged);
+       send_change (Properties::position);
 }
 
 void
@@ -806,7 +697,7 @@ Region::set_start (framepos_t pos, void* /*src*/)
                first_edit ();
                invalidate_transients ();
 
-               send_change (StartChanged);
+               send_change (Properties::start);
        }
 }
 
@@ -856,7 +747,7 @@ Region::trim_start (framepos_t new_position, void */*src*/)
        _whole_file = false;
        first_edit ();
 
-       send_change (StartChanged);
+       send_change (Properties::start);
 }
 
 void
@@ -971,34 +862,39 @@ Region::trim_to_internal (framepos_t position, framecnt_t length, void */*src*/)
                return;
        }
 
-       PropertyChange what_changed = PropertyChange (0);
+       PropertyChange what_changed;
 
        if (_start != new_start) {
                _start = new_start;
-               what_changed = PropertyChange (what_changed|StartChanged);
+               what_changed.add (Properties::start);
        }
        if (_length != length) {
                if (!_frozen) {
                        _last_length = _length;
                }
                _length = length;
-               what_changed = PropertyChange (what_changed|LengthChanged);
+               what_changed.add (Properties::length);
        }
        if (_position != position) {
                if (!_frozen) {
                        _last_position = _position;
                }
                _position = position;
-               what_changed = PropertyChange (what_changed|PositionChanged);
+               what_changed.add (Properties::position);
        }
 
        _whole_file = false;
 
-       if (what_changed & (StartChanged|LengthChanged)) {
+       PropertyChange start_and_length;
+
+       start_and_length.add (Properties::start);
+       start_and_length.add (Properties::length);
+
+       if (what_changed.contains (start_and_length)) {
                first_edit ();
        }
 
-       if (what_changed) {
+       if (!what_changed.empty()) {
                send_change (what_changed);
        }
 }
@@ -1008,7 +904,7 @@ Region::set_hidden (bool yn)
 {
        if (hidden() != yn) {
                _hidden = yn;
-               send_change (HiddenChanged);
+               send_change (Properties::hidden);
        }
 }
 
@@ -1031,7 +927,7 @@ Region::set_muted (bool yn)
 {
        if (muted() != yn) {
                _muted = yn;
-               send_change (MuteChanged);
+               send_change (Properties::muted);
        }
 }
 
@@ -1040,7 +936,7 @@ Region::set_opaque (bool yn)
 {
        if (opaque() != yn) {
                _opaque = yn;
-               send_change (OpacityChanged);
+               send_change (Properties::opaque);
        }
 }
 
@@ -1049,7 +945,7 @@ Region::set_locked (bool yn)
 {
        if (locked() != yn) {
                _locked = yn;
-               send_change (LockChanged);
+               send_change (Properties::locked);
        }
 }
 
@@ -1058,7 +954,7 @@ Region::set_position_locked (bool yn)
 {
        if (position_locked() != yn) {
                _position_locked = yn;
-               send_change (LockChanged);
+               send_change (Properties::locked);
        }
 }
 
@@ -1073,7 +969,7 @@ Region::set_sync_position (framepos_t absolute_pos)
                if (!_frozen) {
                        maybe_uncopy ();
                }
-               send_change (SyncOffsetChanged);
+               send_change (Properties::sync_position);
        }
 }
 
@@ -1085,7 +981,7 @@ Region::clear_sync_position ()
                if (!_frozen) {
                        maybe_uncopy ();
                }
-               send_change (SyncOffsetChanged);
+               send_change (Properties::sync_position);
        }
 }
 
@@ -1184,7 +1080,7 @@ Region::set_layer (layer_t l)
        if (_layer != l) {
                _layer = l;
 
-               send_change (LayerChanged);
+               send_change (Properties::layer);
        }
 }
 
@@ -1239,7 +1135,7 @@ Region::get_state ()
 int
 Region::set_state (const XMLNode& node, int version)
 {
-       PropertyChange what_changed = PropertyChange (0);
+       PropertyChange what_changed;
        return _set_state (node, version, what_changed, true);
 }
 
@@ -1248,6 +1144,8 @@ Region::_set_state (const XMLNode& node, int version, PropertyChange& what_chang
 {
        const XMLProperty* prop;
 
+       cerr << "about to call ::set_properties for an XMLNode\n";
+
        what_changed = set_properties (node);
 
        if ((prop = node.property (X_("id")))) {
@@ -1300,7 +1198,11 @@ Region::_set_state (const XMLNode& node, int version, PropertyChange& what_chang
        }
 
        if (send) {
-               cerr << _name << ": final change to be sent: " << hex << what_changed << dec << endl;
+               cerr << _name << ": final change to be sent: ";
+               for (PropertyChange::iterator i = what_changed.begin(); i != what_changed.end(); ++i) {
+                       cerr << g_quark_to_string ((GQuark) *i) << ' ';
+               }
+               cerr << endl;
                send_change (what_changed);
        }
 
@@ -1318,7 +1220,7 @@ Region::freeze ()
 void
 Region::thaw ()
 {
-       PropertyChange what_changed = PropertyChange (0);
+       PropertyChange what_changed;
 
        {
                Glib::Mutex::Lock lm (_lock);
@@ -1327,18 +1229,18 @@ Region::thaw ()
                        return;
                }
 
-               if (_pending_changed) {
+               if (!_pending_changed.empty()) {
                        what_changed = _pending_changed;
-                       _pending_changed = PropertyChange (0);
+                       _pending_changed.clear ();
                }
        }
 
-       if (what_changed == PropertyChange (0)) {
+       if (what_changed.empty()) {
                return;
        }
 
-       if (what_changed & LengthChanged) {
-               if (what_changed & PositionChanged) {
+       if (what_changed.contains (Properties::length)) {
+               if (what_changed.contains (Properties::position)) {
                        recompute_at_start ();
                }
                recompute_at_end ();
@@ -1348,20 +1250,21 @@ Region::thaw ()
 }
 
 void
-Region::send_change (PropertyChange what_changed)
+Region::send_change (const PropertyChange& what_changed)
 {
+       if (what_changed.empty()) {
+               return;
+       }
 
        {
                Glib::Mutex::Lock lm (_lock);
                if (_frozen) {
-                       _pending_changed = PropertyChange (_pending_changed|what_changed);
+                       _pending_changed.add (what_changed);
                        return;
                }
        }
 
-       cerr << _name << " actually sends " << hex << what_changed << dec << " @" << get_microseconds() << endl;
-       StateChanged (what_changed);
-       cerr << _name << " done with " << hex << what_changed << dec << " @" << get_microseconds() << endl;
+       PropertyChanged (what_changed);
 
        if (!_no_property_changes) {
                
@@ -1371,9 +1274,7 @@ Region::send_change (PropertyChange what_changed)
 
                try {
                        boost::shared_ptr<Region> rptr = shared_from_this();
-                       cerr << _name << " actually sends prop change " << hex << what_changed << dec <<  " @ " << get_microseconds() << endl;
-                       RegionPropertyChanged (rptr);
-                       cerr << _name << " done with prop change  @ " << get_microseconds() << endl;
+                       RegionPropertyChanged (rptr, what_changed);
 
                } catch (...) {
                        /* no shared_ptr available, relax; */
@@ -1612,11 +1513,9 @@ Region::use_sources (SourceList const & s)
 }
 
 
-PropertyChange
+bool
 Region::set_property (const PropertyBase& prop)
 {
-       PropertyChange c = PropertyChange (0);
-
        DEBUG_TRACE (DEBUG::Properties,  string_compose ("region %1 set property %2\n", _name.val(), prop.property_name()));
 
        if (prop == Properties::muted.id) {
@@ -1625,7 +1524,7 @@ Region::set_property (const PropertyBase& prop)
                        DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 muted changed from %2 to %3",
                                                                        _name.val(), _muted.val(), val));
                        _muted = val;
-                       c = MuteChanged;
+                       return true;
                }
        } else if (prop == Properties::opaque.id) {
                bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
@@ -1633,7 +1532,7 @@ Region::set_property (const PropertyBase& prop)
                        DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 opaque changed from %2 to %3",
                                                                        _name.val(), _opaque.val(), val));
                        _opaque = val;
-                       c = OpacityChanged;
+                       return true;
                }
        } else if (prop == Properties::locked.id) {
                bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
@@ -1641,7 +1540,7 @@ Region::set_property (const PropertyBase& prop)
                        DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 locked changed from %2 to %3",
                                                                        _name.val(), _locked.val(), val));
                        _locked = val;
-                       c = LockChanged;
+                       return true;
                }
        } else if (prop == Properties::automatic.id) {
                _automatic = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
@@ -1661,51 +1560,35 @@ Region::set_property (const PropertyBase& prop)
                bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
                if (val != _hidden) {
                        _hidden = val;
-                       c = HiddenChanged;
+                       return true;
                }
        } else if (prop == Properties::position_locked.id) {
                _position_locked = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
        } else if (prop == Properties::start.id) {
                _start = dynamic_cast<const PropertyTemplate<framepos_t>*>(&prop)->val();
        } else if (prop == Properties::length.id) {
-               const PropertyTemplate<framecnt_t>* pt1 = dynamic_cast<const PropertyTemplate<framecnt_t>* >(&prop);
-               const PropertyTemplate<int>* pt2 = dynamic_cast<const PropertyTemplate<int>* >(&prop);
-               
-               cerr << "Cast to frmecnt = " << pt1 << " to int = " << pt2 << endl;
-
                framecnt_t val = dynamic_cast<const PropertyTemplate<framecnt_t>* > (&prop)->val();
                if (val != _length) {
-                       DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 length changed from %2 to %3",
-                                                                       _name.val(), _length.val(), val));
                        _length = val;
-                       c = LengthChanged;
-               } else {
-                       DEBUG_TRACE (DEBUG::Properties, string_compose ("length %1 matches %2\n", _length.val(), val));
+                       return true;
                }
-
        } else if (prop == Properties::position.id) {
                framepos_t val = dynamic_cast<const PropertyTemplate<framepos_t>*>(&prop)->val();
                if (val != _position) {
-                       DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 position changed from %2 to %3",
-                                                                       _name.val(), _position.val(), val));
                        _position = val;
-                       c = PositionChanged;
+                       return true;
                }
        } else if (prop == Properties::sync_position.id) {
                framepos_t val = dynamic_cast<const PropertyTemplate<framepos_t>*>(&prop)->val();
                if (val != _sync_position) {
-                       DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 syncpos changed from %2 to %3",
-                                                                       _name.val(), _sync_position, val));
                        _sync_position = val;
-                       c = SyncOffsetChanged;
+                       return true;
                }
        } else if (prop == Properties::layer.id) {
                layer_t val = dynamic_cast<const PropertyTemplate<layer_t>*>(&prop)->val();
                if (val != _layer) {
-                       DEBUG_TRACE (DEBUG::Properties, string_compose ("region %1 syncpos changed from %2 to %3",
-                                                                       _name.val(), _sync_position, val));
                        _layer = val;
-                       c = LayerChanged;
+                       return true;
                }
        } else if (prop == Properties::ancestral_start.id) {
                _ancestral_start = dynamic_cast<const PropertyTemplate<framepos_t>*>(&prop)->val();
@@ -1719,5 +1602,5 @@ Region::set_property (const PropertyBase& prop)
                return SessionObject::set_property (prop);
        }
        
-       return c;
+       return false;
 }
index ae4df173e4b0b59623a815d28f67256aff2f0543..42a5629e4ad48f1e39068d20b7d70aa202fbd391 100644 (file)
@@ -209,38 +209,9 @@ RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs,
 boost::shared_ptr<Region>
 RegionFactory::create (boost::shared_ptr<Source> src, const PropertyList& plist, bool announce)
 {
-       boost::shared_ptr<Region> ret; 
-       boost::shared_ptr<AudioSource> as;
-       boost::shared_ptr<MidiSource> ms;
-
-       if ((as = boost::dynamic_pointer_cast<AudioSource>(src)) != 0) {
-
-               AudioRegion* ar = new AudioRegion (as);
-               boost_debug_shared_ptr_mark_interesting (ar, "Region");
-
-               boost::shared_ptr<AudioRegion> arp (ar);
-               ret = boost::static_pointer_cast<Region> (arp);
-
-       } else if ((ms = boost::dynamic_pointer_cast<MidiSource>(src)) != 0) {
-               MidiRegion* mr = new MidiRegion (ms);
-               boost_debug_shared_ptr_mark_interesting (mr, "Region");
-
-               boost::shared_ptr<MidiRegion> mrp (mr);
-               ret = boost::static_pointer_cast<Region> (mrp);
-       }
-
-       if (ret) {
-               ret->set_properties (plist);
-               ret->unlock_property_changes ();
-
-               map_add (ret);
-
-               if (announce) {
-                       CheckNewRegion (ret);
-               }
-       }
-
-       return ret;
+       SourceList srcs;
+       srcs.push_back (src);
+       return create (srcs, plist, announce);
 }
 
 boost::shared_ptr<Region>
@@ -283,18 +254,9 @@ RegionFactory::create (const SourceList& srcs, const PropertyList& plist, bool a
 boost::shared_ptr<Region>
 RegionFactory::create (Session& session, XMLNode& node, bool yn)
 {
-       boost::shared_ptr<Region> r = session.XMLRegionFactory (node, yn);
-
-       if (r) {
-               r->unlock_property_changes ();
-               map_add (r);
-               CheckNewRegion (r);
-       }
-
-       return r;
+       return session.XMLRegionFactory (node, yn);
 }
 
-
 boost::shared_ptr<Region>
 RegionFactory::create (SourceList& srcs, const XMLNode& node)
 {
@@ -306,7 +268,7 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node)
 
        if (srcs[0]->type() == DataType::AUDIO) {
 
-               AudioRegion* ar = new AudioRegion (srcs, node);
+               AudioRegion* ar = new AudioRegion (srcs);
                boost_debug_shared_ptr_mark_interesting (ar, "Region");
 
                boost::shared_ptr<AudioRegion> arp (ar);
@@ -314,16 +276,21 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node)
 
        } else if (srcs[0]->type() == DataType::MIDI) {
                
-               MidiRegion* mr = new MidiRegion (srcs, node);
+               MidiRegion* mr = new MidiRegion (srcs);
 
                boost::shared_ptr<MidiRegion> mrp (mr);
                ret = boost::static_pointer_cast<Region> (mrp);
        }
 
        if (ret) {
-               ret->unlock_property_changes ();
-               map_add (ret);
-               CheckNewRegion (ret);
+
+               if (ret->set_state (node, Stateful::loading_state_version)) {
+                       ret.reset ();
+               } else {
+                       ret->unlock_property_changes ();
+                       map_add (ret);
+                       CheckNewRegion (ret);
+               }
        }
 
        return ret;
index 5b998d22f765de7d093efcf65ada5a308f1a1d7c..5e50c15457b403e756b89c072d85d4eb59b6c21a 100644 (file)
@@ -40,9 +40,6 @@ using namespace ARDOUR;
 using namespace PBD;
 using namespace std;
 
-PropertyChange RouteGroup::FlagsChange = new_change ();
-PropertyChange RouteGroup::PropertiesChange = new_change ();
-
 namespace ARDOUR {
        namespace Properties {
                PropertyDescriptor<bool> relative;
@@ -70,15 +67,15 @@ RouteGroup::make_property_quarks ()
        Properties::edit.id = g_quark_from_static_string (X_("edit"));
 }
 
-#define ROUTE_GROUP_DEFAULT_PROPERTIES  _relative (Properties::relative, FlagsChange, false) \
-       , _active (Properties::active, FlagsChange, false) \
-       , _hidden (Properties::hidden, FlagsChange, false) \
-       , _gain (Properties::gain, PropertiesChange, false) \
-       , _mute (Properties::mute, PropertiesChange, false) \
-       , _solo (Properties::solo, PropertiesChange , false) \
-       , _recenable (Properties::recenable, PropertiesChange, false) \
-       , _select (Properties::select, PropertiesChange, false) \
-       , _edit (Properties::edit, PropertiesChange , false)
+#define ROUTE_GROUP_DEFAULT_PROPERTIES  _relative (Properties::relative, false) \
+       , _active (Properties::active, false) \
+       , _hidden (Properties::hidden, false) \
+       , _gain (Properties::gain, false) \
+       , _mute (Properties::mute, false) \
+       , _solo (Properties::solo, false) \
+       , _recenable (Properties::recenable, false) \
+       , _select (Properties::select, false) \
+       , _edit (Properties::edit, false)
 
 RouteGroup::RouteGroup (Session& s, const string &n)
        : SessionObject (s, n)
index e5b57115c1923cf334d0e24c7aa58edb606bb694..decb2603fe98a73fd7268a7eea62c16a646d269f 100644 (file)
@@ -2810,7 +2810,7 @@ Session::add_regions (vector<boost::shared_ptr<Region> >& new_regions)
                                }
                        }
 
-                       region->StateChanged.connect_same_thread (*this, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr<Region>(region)));
+                       region->PropertyChanged.connect_same_thread (*this, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr<Region>(region)));
                        update_region_name_map (region);
                }
 
@@ -2840,7 +2840,7 @@ Session::update_region_name_map (boost::shared_ptr<Region> region)
 }
 
 void
-Session::region_changed (PropertyChange what_changed, boost::weak_ptr<Region> weak_region)
+Session::region_changed (const PropertyChange& what_changed, boost::weak_ptr<Region> weak_region)
 {
        boost::shared_ptr<Region> region (weak_region.lock ());
 
@@ -2848,12 +2848,12 @@ Session::region_changed (PropertyChange what_changed, boost::weak_ptr<Region> we
                return;
        }
 
-       if (what_changed & Region::HiddenChanged) {
+       if (what_changed.contains (Properties::hidden)) {
                /* relay hidden changes */
                RegionHiddenChange (region);
        }
 
-       if (what_changed & NameChanged) {
+       if (what_changed.contains (Properties::name)) {
                update_region_name_map (region);
        }
 }
@@ -3675,7 +3675,7 @@ Session::bundle_by_name (string name) const
 }
 
 void
-Session::tempo_map_changed (PropertyChange)
+Session::tempo_map_changed (const PropertyChange&)
 {
        clear_clicks ();
 
index 0dcda09f2628206e7e0c3280246fd928d9403aec..b245b43ae57c510db75afb4672d541aaa6e38c5d 100644 (file)
@@ -37,27 +37,19 @@ SessionObject::make_property_quarks ()
        Properties::name.id = g_quark_from_static_string (X_("name"));
 }
 
-PropertyChange 
+bool
 SessionObject::set_property (const PropertyBase& prop)
 {
-       PropertyChange c = PropertyChange (0);
-
-       DEBUG_TRACE (DEBUG::Properties,  string_compose ("session object %1 set property %2\n", _name.val(), prop.property_name()));
-       
        if (prop == Properties::name.id) {
                std::string str = dynamic_cast<const PropertyTemplate<std::string>*>(&prop)->val();
-               cerr << "prop @ " << &prop << " has quark " << prop.id() << " str value = " << str << endl;
-               cerr << "nameprop @ " << &_name << " has quark " << _name.id() << " str value = " << _name.val() << endl;
                if (_name != str) {
                        DEBUG_TRACE (DEBUG::Properties, string_compose ("session object named %1 renamed %2\n",
                                                                        _name.val(), str));
                        _name = str;
-                       c = _name.change();
-               } else {
-                       DEBUG_TRACE (DEBUG::Properties, string_compose ("name %1 matches %2\n", _name.val(), str));
-               }
+                       return true;
+               } 
        }
-       
-       return c;
+
+       return false;
 }
 
index face9388bc82ef58b2b4705075c7571b3fca4bf0..434410b39e618adedf9d042faf8f989deeffc9aa 100644 (file)
@@ -165,7 +165,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        _base_frame_rate = _current_frame_rate;
 
        _tempo_map = new TempoMap (_current_frame_rate);
-       _tempo_map->StateChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this, _1));
+       _tempo_map->PropertyChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this, _1));
 
 
        _non_soloed_outs_muted = false;
index be34b79cccfe640d5fe12c1540914ce635ee11df..93470e369be818b3ae120e3d7c4fbea4ad6b8cd8 100644 (file)
@@ -299,7 +299,7 @@ void
 TempoMap::move_tempo (TempoSection& tempo, const BBT_Time& when)
 {
        if (move_metric_section (tempo, when) == 0) {
-               StateChanged (PropertyChange (0));
+               PropertyChanged (PropertyChange ());
        }
 }
 
@@ -307,7 +307,7 @@ void
 TempoMap::move_meter (MeterSection& meter, const BBT_Time& when)
 {
        if (move_metric_section (meter, when) == 0) {
-               StateChanged (PropertyChange (0));
+               PropertyChanged (PropertyChange ());
        }
 }
 
@@ -334,7 +334,7 @@ TempoMap::remove_tempo (const TempoSection& tempo)
        }
 
        if (removed) {
-               StateChanged (PropertyChange (0));
+               PropertyChanged (PropertyChange ());
        }
 }
 
@@ -361,7 +361,7 @@ TempoMap::remove_meter (const MeterSection& tempo)
        }
 
        if (removed) {
-               StateChanged (PropertyChange (0));
+               PropertyChanged (PropertyChange ());
        }
 }
 
@@ -406,7 +406,7 @@ TempoMap::add_tempo (const Tempo& tempo, BBT_Time where)
                do_insert (new TempoSection (where, tempo.beats_per_minute(), tempo.note_type()), true);
        }
 
-       StateChanged (PropertyChange (0));
+       PropertyChanged (PropertyChange ());
 }
 
 void
@@ -417,7 +417,7 @@ TempoMap::add_tempo (const Tempo& tempo, nframes64_t where)
                do_insert (new TempoSection (where, tempo.beats_per_minute(), tempo.note_type()), false);
        }
 
-       StateChanged (PropertyChange (0));
+       PropertyChanged (PropertyChange ());
 }
 
 void
@@ -445,7 +445,7 @@ TempoMap::replace_tempo (TempoSection& existing, const Tempo& replacement)
        }
 
        if (replaced) {
-               StateChanged (PropertyChange (0));
+               PropertyChanged (PropertyChange ());
        }
 }
 
@@ -474,7 +474,7 @@ TempoMap::add_meter (const Meter& meter, BBT_Time where)
                do_insert (new MeterSection (where, meter.beats_per_bar(), meter.note_divisor()), true);
        }
 
-       StateChanged (PropertyChange (0));
+       PropertyChanged (PropertyChange ());
 }
 
 void
@@ -485,7 +485,7 @@ TempoMap::add_meter (const Meter& meter, nframes64_t where)
                do_insert (new MeterSection (where, meter.beats_per_bar(), meter.note_divisor()), false);
        }
 
-       StateChanged (PropertyChange (0));
+       PropertyChanged (PropertyChange ());
 }
 
 void
@@ -511,7 +511,7 @@ TempoMap::replace_meter (MeterSection& existing, const Meter& replacement)
        }
 
        if (replaced) {
-               StateChanged (PropertyChange (0));
+               PropertyChanged (PropertyChange ());
        }
 }
 
@@ -524,7 +524,7 @@ TempoMap::change_initial_tempo (double beats_per_minute, double note_type)
        for (Metrics::iterator i = metrics->begin(); i != metrics->end(); ++i) {
                if ((t = dynamic_cast<TempoSection*> (*i)) != 0) {
                        *((Tempo*) t) = newtempo;
-                       StateChanged (PropertyChange (0));
+                       PropertyChanged (PropertyChange ());
                        break;
                }
        }
@@ -570,7 +570,7 @@ TempoMap::change_existing_tempo_at (nframes64_t where, double beats_per_minute,
        /* reset */
 
        *((Tempo*)prev) = newtempo;
-       StateChanged (PropertyChange (0));
+       PropertyChanged (PropertyChange ());
 }
 
 const MeterSection&
@@ -1609,7 +1609,7 @@ TempoMap::set_state (const XMLNode& node, int /*version*/)
                }
        }
 
-       StateChanged (PropertyChange (0));
+       PropertyChanged (PropertyChange ());
 
        return 0;
 }
@@ -1673,7 +1673,7 @@ TempoMap::insert_time (nframes64_t where, nframes64_t amount)
 
        timestamp_metrics (false);
 
-       StateChanged (PropertyChange (0));
+       PropertyChanged (PropertyChange ());
 }
 
 BBT_Time
index 3a56eeb9b2654fb7c709821596c59bb0582e5017..a235d9a3fc5e40932fd7c3b1891580202c9a18ae 100644 (file)
 #define MIDI_CMD_NOTE_OFF               0x80 /**< Note Off */
 #define MIDI_CMD_NOTE_ON                0x90 /**< Note On */
 #define MIDI_CMD_NOTE_PRESSURE          0xA0 /**< Key Pressure */
-#define MIDI_CMD_CONTROL                0xB0 /**< Control PropertyChange */
-#define MIDI_CMD_PGM_CHANGE             0xC0 /**< Program PropertyChange */
+#define MIDI_CMD_CONTROL                0xB0 /**< Control Change */
+#define MIDI_CMD_PGM_CHANGE             0xC0 /**< Program Change */
 #define MIDI_CMD_CHANNEL_PRESSURE       0xD0 /**< Channel Pressure */
 #define MIDI_CMD_BENDER                 0xE0 /**< Pitch Bender */
 #define MIDI_CMD_COMMON_SYSEX           0xF0 /**< Sysex (System Exclusive) Begin */
index 10c661102dfe14c43518bac4f256b29124a00ffb..931b2676bda687efa5d3c84cc15ac97aa4d44b9c 100644 (file)
 #include <string>
 #include <sstream>
 #include <list>
+#include <set>
 #include <glib.h>
 
 #include "pbd/xml++.h"
 
 namespace PBD {
 
-enum PropertyChange {
-       range_guarantee = ~0ULL
-};
-
-PropertyChange new_change ();
-
 typedef GQuark PropertyID;
 
 template<typename T> 
@@ -43,14 +38,48 @@ struct PropertyDescriptor {
     typedef T value_type;
 };
 
+class PropertyChange : public std::set<PropertyID> 
+{
+  public:
+       PropertyChange() { }
+       template<typename T> PropertyChange(PropertyDescriptor<T> p) { insert (p.id); }
+        PropertyChange(const PropertyChange& other) : std::set<PropertyID> (other) { }
+       
+       PropertyChange operator= (const PropertyChange& other) {
+               clear ();
+               insert (other.begin(), other.end());
+               return *this;
+       }
+
+       template<typename T> PropertyChange operator= (PropertyDescriptor<T> p) {
+               clear ();
+               insert (p.id);
+               return *this;
+       }
+
+       template<typename T> bool contains (PropertyDescriptor<T> p) const { return find (p.id) != end(); }
+
+       bool contains (const PropertyChange& other) const { 
+               for (const_iterator x = other.begin(); x != other.end(); ++x) {
+                       if (find (*x) != end()) {
+                           return true;
+                       }
+               }
+               return false;
+       }
+
+       void add (PropertyID id) { (void) insert (id); }
+       void add (const PropertyChange& other) { (void) insert (other.begin(), other.end()); }
+       template<typename T> void add (PropertyDescriptor<T> p) { (void) insert (p.id); }
+};
+
 /** Base (non template) part of Property */    
 class PropertyBase
 {
 public:
-       PropertyBase (PropertyID pid, PropertyChange c)
+       PropertyBase (PropertyID pid)
                : _have_old (false)
                , _property_id (pid)
-               , _change (c)
        {
 
        }
@@ -62,11 +91,10 @@ public:
 
        virtual void diff (XMLNode *, XMLNode *) const = 0;
        virtual void diff (PropertyChange&) const = 0;
-       virtual PropertyChange set_state (XMLNode const &) = 0;
+       virtual bool set_state (XMLNode const &) = 0;
        virtual void add_state (XMLNode &) const = 0;
 
        const gchar* property_name() const { return g_quark_to_string (_property_id); }
-       PropertyChange change() const { return _change; }
        PropertyID id() const { return _property_id; }
 
        bool operator== (PropertyID pid) const {
@@ -76,7 +104,6 @@ public:
 protected:
        bool _have_old;
        PropertyID _property_id;
-       PropertyChange _change;
 };
 
 /** Parent class for classes which represent a single property in a Stateful object */
@@ -84,8 +111,8 @@ template <class T>
 class PropertyTemplate : public PropertyBase
 {
 public:
-       PropertyTemplate (PropertyDescriptor<T> p, PropertyChange c, T const & v)
-               : PropertyBase (p.id, c)
+       PropertyTemplate (PropertyDescriptor<T> p, T const & v)
+               : PropertyBase (p.id)
                , _current (v)
        {
 
@@ -94,7 +121,6 @@ public:
                /* XXX: isn't there a nicer place to do this? */
                _have_old = s._have_old;
                _property_id = s._property_id;
-               _change = s._change;
                
                _current = s._current;
                _old = s._old;
@@ -129,39 +155,38 @@ public:
 
        void diff (XMLNode* old, XMLNode* current) const {
                if (_have_old) {
-                       old->add_property (g_quark_to_string (_property_id), to_string (_old));
-                       current->add_property (g_quark_to_string (_property_id), to_string (_current));
+                       old->add_property (property_name(), to_string (_old));
+                       current->add_property (property_name(), to_string (_current));
                }
        }
        
        void diff (PropertyChange& c) const {
-               if (_have_old && _change) {
-                       c = PropertyChange (c | _change);
+               if (_have_old) {
+                       c.add (_property_id);
                }
        }
 
        /** Try to set state from the property of an XML node.
         *  @param node XML node.
-        *  @return PropertyChange effected, or 0.
+        *  @return true if the value of the property is changed
         */
-       PropertyChange set_state (XMLNode const & node) {
-               XMLProperty const * p = node.property (g_quark_to_string (_property_id));
-               PropertyChange c = PropertyChange (0);
+       bool set_state (XMLNode const & node) {
+               XMLProperty const * p = node.property (property_name());
 
                if (p) {
                        T const v = from_string (p->value ());
 
                        if (v != _current) {
                                set (v);
-                               c = _change;
+                               return true;
                        }
-               }
+               } 
 
-               return c;
+               return false;
        }
 
        void add_state (XMLNode & node) const {
-               node.add_property (g_quark_to_string (_property_id), to_string (_current));
+               node.add_property (property_name(), to_string (_current));
        }
 
 protected:
@@ -191,14 +216,8 @@ template <class T>
 class Property : public PropertyTemplate<T>
 {
 public:
-       Property (PropertyDescriptor<T> q, PropertyChange c, T const & v)
-               : PropertyTemplate<T> (q, c, v)
-       {
-
-       }
-
        Property (PropertyDescriptor<T> q, T const & v)
-               : PropertyTemplate<T> (q, PropertyChange (0), v)
+               : PropertyTemplate<T> (q, v)
        {
 
        }
@@ -222,7 +241,7 @@ private:
                s << v;
                return s.str ();
        }
-
+       
        T from_string (std::string const & s) const {
                std::stringstream t (s);
                T v;
@@ -231,6 +250,35 @@ private:
        }
 };
 
+/** Specialization, for std::string which is common and special (see to_string() and from_string()
+    Using stringstream to read from a std::string is easy to get wrong because of whitespace
+    delineation, etc.
+ */
+template <>
+class Property<std::string> : public PropertyTemplate<std::string>
+{
+public:
+       Property (PropertyDescriptor<std::string> q, std::string const & v)
+               : PropertyTemplate<std::string> (q, v)
+       {
+
+       }
+
+       std::string & operator= (std::string const & v) {
+               this->set (v);
+               return this->_current;
+       }
+       
+private:       
+        std::string to_string (std::string const & v) const {
+               return _current;
+       }
+       
+       std::string from_string (std::string const & s) const {
+               return s;
+       }
+};
+
 class PropertyList : public std::map<PropertyID,PropertyBase*>
 {
 public:
index 9ef1a9ef73761d79ede193de1ca57ceaebdd4a7e..bc32d7fd9b0df37437f0d4c0eb3b4514d32a72cf 100644 (file)
 #include <string>
 #include <list>
 #include <cassert>
+
 #include "pbd/id.h"
 #include "pbd/xml++.h"
-#include "pbd/enumwriter.h"
 #include "pbd/properties.h"
+#include "pbd/signals.h"
 
 class XMLNode;
 
@@ -47,7 +48,7 @@ class Stateful {
        /* derived types do not have to implement this, but probably should
           give it serious attention.
        */
-       virtual PropertyChange set_property (const PropertyBase&) { return PropertyChange (0); }
+       virtual bool set_property (const PropertyBase&) { return false; }
 
        PropertyChange set_properties (const PropertyList&);
 
@@ -68,6 +69,10 @@ class Stateful {
        std::pair<XMLNode *, XMLNode*> diff () const;
        void changed (PropertyChange&) const;
 
+       /* How stateful's notify of changes to their properties
+        */
+       PBD::Signal1<void,const PropertyChange&> PropertyChanged;
+
        static int current_state_version;
        static int loading_state_version;
 
index 58e81c056b86a9e3dd1a3583399ce35d856177a0..93d4738cd781b34a35a5c1bd7281188da8acb079 100644 (file)
 
 using namespace PBD;
 
-PropertyChange
-PBD::new_change ()
-{
-       static uint64_t change_bit = 1;
-
-       /* catch out-of-range */
-       if (!change_bit) {
-               fatal << _("programming error: ")
-                       << "change_bit out of range in ARDOUR::new_change()"
-                       << endmsg;
-               /*NOTREACHED*/
-       }
-
-       PropertyChange c = PropertyChange (change_bit);
-       change_bit <<= 1;       // if it shifts too far, change_bit == 0
-
-       return c;
-}
-
index a8dd7a41778960f623111c9edf88dfc4a6df84d1..9a1a11612858fabe1e68af99c87beade0ba0ba1c 100644 (file)
@@ -196,10 +196,12 @@ Stateful::changed (PropertyChange& c) const
 PropertyChange
 Stateful::set_properties (XMLNode const & node)
 {
-       PropertyChange c = PropertyChange (0);
+       PropertyChange c;
 
        for (OwnedPropertyList::iterator i = _properties.begin(); i != _properties.end(); ++i) {
-               c = PropertyChange (c | i->second->set_state (node));
+               if (i->second->set_state (node)) {
+                       c.add (i->first);
+               }
        }
 
        post_set ();
@@ -210,12 +212,14 @@ Stateful::set_properties (XMLNode const & node)
 PropertyChange
 Stateful::set_properties (const PropertyList& property_list)
 {
-       PropertyChange c = PropertyChange (0);
+       PropertyChange c;
        PropertyList::const_iterator p;
 
        for (OwnedPropertyList::iterator i = _properties.begin(); i != _properties.end(); ++i) {
                if ((p = property_list.find (i->first)) != property_list.end()) {
-                       c = PropertyChange (c|set_property (*(p->second)));
+                       if (set_property (*p->second)) {
+                               c.add (i->first);
+                       }
                }
        }
        
index 1c328e0410f3aac094b940cd1d73c823ab876a70..8bd00bcff9ff73526b65215c300312f9aceb2099 100644 (file)
@@ -74,7 +74,6 @@ def build(bld):
                mountpoint.cc
                pathscanner.cc
                pool.cc
-                property.cc
                pthread_utils.cc
                receiver.cc
                search_path.cc
index 48d074e1177582aae3b833d6f56eafbcd8983990..1a16902c80ac1403621439636a2d925ebc87fb6b 100644 (file)
@@ -946,8 +946,12 @@ MackieControlProtocol::notify_gain_changed (RouteSignal * route_signal, bool for
 }
 
 void 
-MackieControlProtocol::notify_name_changed (RouteSignal * route_signal)
+MackieControlProtocol::notify_property_changed (const PropertyChange& what_changed, RouteSignal * route_signal)
 {
+       if (!what_changed.contains (Properties::name)) {
+               return;
+       }
+
        try
        {
                Strip & strip = route_signal->strip();
index 14be7b437080dce071b2beb84f7aab4979453882..d920173eca854f7372f719e41a5a9dbe8479c2ba 100644 (file)
@@ -99,7 +99,7 @@ class MackieControlProtocol
        /// Signal handler for Route::gain_changed (from IO)
        void notify_gain_changed(Mackie::RouteSignal *, bool force_update = true);
        /// Signal handler for Route::name_change
-       void notify_name_changed(Mackie::RouteSignal *);
+       void notify_property_changed(const PBD::PropertyChange&, Mackie::RouteSignal *);
        /// Signal handler from Panner::Change
        void notify_panner_changed(Mackie::RouteSignal *, bool force_update = true);
        /// Signal handler for new routes added
index 6dc8532db914e7b59c712ed670dff979f7a8800e..984a6ccd9f4f6497ef14e4aa6a56dbf3fe193ea2 100644 (file)
@@ -21,6 +21,7 @@
 #include "ardour/track.h"
 #include "ardour/midi_ui.h"
 #include "ardour/panner.h"
+#include "ardour/session_object.h" // for Properties::name 
 
 #include "mackie_control_protocol.h"
 
@@ -47,7 +48,7 @@ void RouteSignal::connect()
                _route->gain_control()->Changed.connect(connections, ui_bind (&MackieControlProtocol::notify_gain_changed, &_mcp, this, false), midi_ui_context());
        }
 
-       _route->NameChanged.connect (connections, ui_bind (&MackieControlProtocol::notify_name_changed, &_mcp, this), midi_ui_context());
+       _route->PropertyChanged.connect (connections, ui_bind (&MackieControlProtocol::notify_property_changed, &_mcp, _1, this), midi_ui_context());
        
        if (_route->panner()) {
                _route->panner()->Changed.connect(connections, ui_bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false), midi_ui_context());
@@ -90,7 +91,7 @@ void RouteSignal::notify_all()
        if ( _strip.has_gain() )
                _mcp.notify_gain_changed( this );
        
-       _mcp.notify_name_changed( this );
+       _mcp.notify_property_changed (PBD::PropertyChange (ARDOUR::Properties::name), this );
        
        if ( _strip.has_vpot() )
                _mcp.notify_panner_changed( this );