Skip to content

Commit

Permalink
Merge pull request #51 from Polyrhythm/master
Browse files Browse the repository at this point in the history
Persist track names
  • Loading branch information
joreg committed Apr 18, 2017
2 parents c9e35a5 + 9c5ec93 commit cbe8f58
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Source/Model/BaseClasses.cs
Expand Up @@ -91,7 +91,7 @@ public abstract class TLTrackBase : TLModelBase
{
get;
}

public EditableProperty<int> Order
{
get;
Expand Down
14 changes: 12 additions & 2 deletions Source/Model/StringTrack.cs
Expand Up @@ -35,9 +35,19 @@ public TLStringTrack(string name)
Keyframes = new EditableIDList<TLStringKeyframe>("Keyframes");
Keyframes.Added += Keyframes_Added;
Add(Keyframes);

//set the name of this track
Label.Value = "String " + name;
string label;
int x;
if (Int32.TryParse(name, out x))
{
label = "String " + x.ToString();
}
else
{
label = name;
}
Label.Value = label;
}

void Keyframes_Added(IViewableCollection<TLStringKeyframe> collection, TLStringKeyframe item)
Expand Down
4 changes: 3 additions & 1 deletion Source/Model/TimelinerDocumentSerializer.cs
Expand Up @@ -145,7 +145,9 @@ public abstract class TLTrackSerializer<TTrack> : ISerializer<TTrack> where TTra
public XElement Serialize(TTrack value, Serializer serializer)
{
var x = value.GetXML(GetTagName());


string trackName = value.Label.Value;
x.FirstAttribute.SetValue(trackName);
value.SerializeProperties(x);

SerializeKeyframes(x, value, serializer);
Expand Down
13 changes: 11 additions & 2 deletions Source/Model/ValueTrack.cs
Expand Up @@ -73,8 +73,17 @@ public TLValueTrack(string name)
Keyframes.Added += Keyframes_Added;
Keyframes.Removed += Keyframes_Removed;


Label.Value = "Value " + name;
string label;
int x;
if (Int32.TryParse(name, out x))
{
label = "Value " + x.ToString();
}
else
{
label = name;
}
Label.Value = label;
}

void Keyframes_Removed(IViewableCollection<TLValueKeyframe> collection, TLValueKeyframe item)
Expand Down

0 comments on commit cbe8f58

Please sign in to comment.