예제 #1
0
 public void Add(SnippetInMemory snippet)
 {
     if (!snippets.Contains(snippet))
         snippets.Add(snippet);
     Dirty = true;
 }
예제 #2
0
 public void Remove(SnippetInMemory snippet)
 {
     // This assert is NOT always valid, because sometimes the UI wipes out
     // a parent and then wipes out children and all kinds of weird shit.
     // It's all ok.
     // Debug.Assert(snippets.Contains(snippet),"Removing non-existent snippet " + snippet + ".");
     snippets.Remove(snippet);
     Dirty = true;
 }
예제 #3
0
        void RemoveChildSnippet(SnippetInMemory child)
        {
            children.Remove(child);
            ((SnippetInMemory)child).parents.Remove(this);
            model.Dirty = true;
            if (child.Parents.Count == 0)
            {
                child.RemoveAllChildSnippets();
                model.Remove((SnippetInMemory)child);
            }

            UI.Hide(child);
        }
예제 #4
0
 void MoveUpChild(SnippetInMemory child)
 {
     Debug.Assert(children.Contains(child));
     int i = children.IndexOf(child);
     if (i > 0)
     {
         children.Remove(child);
         children.Insert(i-1, child);
         model.Dirty = true;
         UI.OnAfterReorder();
     }
 }
예제 #5
0
        void AddChildSnippet(SnippetInMemory child)
        {
            OnBeforeAdd(child);
            // this should only happen using the old serializers, not using the UI
            Debug.Assert(!children.Contains(child), "Parent " + this + ", Child " + child + "." +
                    "Trying to add child that already exists. This should ONLY happen from the old serializer.");

            children.Add((SnippetInMemory)child);
            ((SnippetInMemory)child).parents.Add(this);
            model.Dirty = true;
            UI.Show(child);
        }
예제 #6
0
 public override Kbase.Model.Snippet AddChildSnippet()
 {
     // make a new one
     SnippetInMemory retVal = new SnippetInMemory(this.model);
     if (UI.ShowingChildren)
         retVal.UI.ShowChildren();
     else
         retVal.UI.HideChildren();
     // add it as a child
     AddChildSnippet(retVal);
     // and add it to the model
     model.Add((SnippetInMemory)retVal);
     return retVal;
 }
예제 #7
0
 public static SnippetInMemory MakeLastXSnippet(SnippetDictionary model)
 {
     SnippetInMemory retVal = new SnippetInMemory(model);
     retVal.title = LAST_X_TEXT;
     model.TopLevelSnippet.AddChildSnippet(retVal);
     return retVal;
 }