Fix up state save/load of location lock/glue settings.
authorCarl Hetherington <carl@carlh.net>
Mon, 9 Aug 2010 22:23:32 +0000 (22:23 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 9 Aug 2010 22:23:32 +0000 (22:23 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7579 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/location_ui.cc
libs/ardour/ardour/location.h
libs/ardour/location.cc

index ac7b227e5bfaabfc52c812c3d98d875f18f6285d..d2c1a1931fb8b0f128ae08347c38593a693207ad 100644 (file)
@@ -193,7 +193,11 @@ LocationEditRow::set_location (Location *loc)
 
        location = loc;
 
-       if (!location) return;
+       if (!location) {
+               return;
+       }
+
+       ++i_am_the_modifier;
 
        if (!hide_check_button.get_parent()) {
                item_table.attach (hide_check_button, 5, 6, 0, 1, FILL, Gtk::FILL, 4, 0);
@@ -293,6 +297,8 @@ LocationEditRow::set_location (Location *loc)
        end_clock.set_sensitive (!location->locked());
        length_clock.set_sensitive (!location->locked());
 
+       --i_am_the_modifier;
+
        location->start_changed.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::start_changed, this, _1), gui_context());
        location->end_changed.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::end_changed, this, _1), gui_context());
        location->name_changed.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::name_changed, this, _1), gui_context());
index 429fac177cae710bfbf054c85889c8d9e2e0c050..f3c322e2d446cc6d884b37cf910eb4794a4ce084 100644 (file)
@@ -58,8 +58,8 @@ class Location : public SessionHandleRef, public PBD::StatefulDestructible
        Location* operator= (const Location& other);
 
        bool locked() const { return _locked; }
-       void lock() { _locked = true; LockChanged (this); }
-       void unlock() { _locked = false; LockChanged (this); }
+       void lock ();
+       void unlock ();
 
        nframes64_t start() const  { return _start; }
        nframes64_t end() const { return _end; }
index ea267db25ede84ba0fe3f47b1b6d7a2e49f35fff..d9d5911555c612dcce670367afd78ccf3a3ce308 100644 (file)
@@ -357,6 +357,7 @@ Location::get_state ()
        node->add_property ("end", buf);
        node->add_property ("flags", enum_2_string (_flags));
        node->add_property ("locked", (_locked ? "yes" : "no"));
+       node->add_property ("position-lock-style", enum_2_string (_position_lock_style));
 
        return *node;
 }
@@ -427,24 +428,27 @@ Location::set_state (const XMLNode& node, int /*version*/)
                  cd_node = *cd_iter;
 
                  if (cd_node->name() != "CD-Info") {
-                   continue;
+                         continue;
                  }
 
                  if ((prop = cd_node->property ("name")) != 0) {
-                   cd_name = prop->value();
+                         cd_name = prop->value();
                  } else {
-                   throw failed_constructor ();
+                         throw failed_constructor ();
                  }
 
                  if ((prop = cd_node->property ("value")) != 0) {
-                   cd_value = prop->value();
+                         cd_value = prop->value();
                  } else {
-                   throw failed_constructor ();
+                         throw failed_constructor ();
                  }
 
 
                  cd_info[cd_name] = cd_value;
+       }
 
+       if ((prop = node.property ("position-lock-style")) != 0) {
+               _position_lock_style = PositionLockStyle (string_2_enum (prop->value(), _position_lock_style));
        }
 
        recompute_bbt_from_frames ();
@@ -490,6 +494,20 @@ Location::recompute_frames_from_bbt ()
        set (map.frame_time (_bbt_start), map.frame_time (_bbt_end), false);
 }
 
+void
+Location::lock ()
+{
+       _locked = true;
+       LockChanged (this);
+}
+
+void
+Location::unlock ()
+{
+       _locked = false;
+       LockChanged (this);
+}
+
 /*---------------------------------------------------------------------- */
 
 Locations::Locations (Session& s)