Пример #1
0
 public override void RaiseParseTreeModified(ParseTreeModifiedEventArgs args)
 {
     if (ParseTreeModified != null)
         ParseTreeModified(this, args);
     //base.RaiseTextChanged(sender, oldtext);
 }
Пример #2
0
 /// <summary>
 /// This method triggers a ParseTreeModified event in the root of the parse tree.
 /// </summary>
 /// <param name="sender">The node which the change applies to.</param>
 /// <param name="oldtext">the text of the node before the change.</param>
 public virtual void RaiseParseTreeModified(ParseTreeModifiedEventArgs args)
 {
     if (parent != null)
         parent.RaiseParseTreeModified(args);
 }
Пример #3
0
        void _ParseTree_ParseTreeModified(object sender, ParseTreeModifiedEventArgs e)
        {
            if (e.Type == ParseTreeModifiedType.Insert)
            {
                // see if the added item is displayed at all
                var toadd = CreateOverlayShapesFromItem(e.AffectedItem);

                if (toadd.Count() == 0)
                    return;

                // so we have something to add... find the correct element of the display tree to insert into
                var parent = e.AffectedItem.Ancestors.FirstOrDefault(tcpi => AllItems.OfType<OverlayScope>().Count(os => os.item == tcpi) > 0);
                if (parent == null)
                    TopLevelItems.AddRange(toadd);
                else
                {
                    var scope = AllItems.OfType<OverlayScope>().First(os => os.item == parent);
                    scope.children.AddRange(toadd);
                }


                //var cplist = toadd.SelectMany(tpi => GetAllDescendants(tpi)).OfType<OverlayControlPoint>();
                //foreach (var cp in cplist)
                //    cp.BindToOrigin(AllItems);
                BindControlPointsToOrigins(); // slightly inefficient ... but who cares

                if (DisplayTreeChanged != null)
                    DisplayTreeChanged(this, new DisplayTreeChangedEventArgs() { Type = DisplayTreeChangedType.Insert, AffectedItems = toadd });
            }
            else if (e.Type == ParseTreeModifiedType.Remove)
            {
                throw new NotSupportedException(); // maybe support that in the future
            }
        }