Beispiel #1
0
 public ChangedEventArgs(ChangedEventArgs e)
 {
     this.myIsBeforeChanging = e.IsBeforeChanging;
     this.myDocument = e.Document;
     this.myHint = e.Hint;
     this.mySubHint = e.SubHint;
     this.myObject = e.Object;
     this.myOldInt = e.OldInt;
     this.myOldValue = e.OldValue;
     this.myOldRect = e.OldRect;
     this.myNewInt = e.NewInt;
     this.myNewValue = e.NewValue;
     this.myNewRect = e.NewRect;
     if (this.myDocument != null)
     {
         this.myDocument.CopyOldValueForUndo(this);
         this.myDocument.CopyNewValueForRedo(this);
     }
 }
Beispiel #2
0
 public virtual void CopyOldValueForUndo(ChangedEventArgs e)
 {
     int num1 = e.Hint;
     if (num1 != 220)
     {
         if (num1 == 0x385)
         {
             e.DiagramShape.CopyOldValueForUndo(e);
         }
     }
     else if (!e.IsBeforeChanging)
     {
         ChangedEventArgs args1 = e.FindBeforeChangingEdit();
         if (args1 != null)
         {
             e.OldValue = args1.NewValue;
         }
     }
 }
Beispiel #3
0
 public virtual void CopyNewValueForRedo(ChangedEventArgs e)
 {
     int num1 = e.Hint;
     if (num1 != 220)
     {
         if (num1 == 0x385)
         {
             e.DiagramShape.CopyNewValueForRedo(e);
         }
     }
     else
     {
         ArrayList list1 = new ArrayList();
         LayerCollectionObjectEnumerator enumerator1 = this.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             Shapes.DiagramShape obj2 = enumerator1.Current;
             list1.Add(obj2);
             if (obj2 is Shapes.IDiagramLine)
             {
                 Shapes.LineGraph link1 = obj2 as Shapes.LineGraph;
                 if (link1 != null)
                 {
                     PointF[] tfArray1 = link1.CopyPointsArray();
                     list1.Add(tfArray1);
                     continue;
                 }
                 Shapes.TextLine link2 = obj2 as Shapes.TextLine;
                 if (link2 != null)
                 {
                     PointF[] tfArray2 = link2.RealLink.CopyPointsArray();
                     list1.Add(tfArray2);
                 }
                 continue;
             }
             RectangleF ef1 = obj2.Bounds;
             list1.Add(ef1);
         }
         e.NewValue = list1;
     }
 }
Beispiel #4
0
 public virtual void ChangeValue(ChangedEventArgs e, bool undo)
 {
     int num2 = e.Hint;
     if (num2 <= 0x324)
     {
         switch (num2)
         {
             case 0xc9:
                 {
                     this.Name = (string)e.GetValue(undo);
                     return;
                 }
             case 0xca:
                 {
                     this.Size = e.GetSize(undo);
                     return;
                 }
             case 0xcb:
                 {
                     this.TopLeft = e.GetPoint(undo);
                     return;
                 }
             case 0xcc:
                 {
                     this.FixedSize = (bool)e.GetValue(undo);
                     return;
                 }
             case 0xcd:
                 {
                     this.PaperColor = (Color)e.GetValue(undo);
                     return;
                 }
             case 0xce:
                 {
                     this.DataFormat = (string)e.GetValue(undo);
                     return;
                 }
             case 0xcf:
                 {
                     this.AllowSelect = (bool)e.GetValue(undo);
                     return;
                 }
             case 0xd0:
                 {
                     this.AllowMove = (bool)e.GetValue(undo);
                     return;
                 }
             case 0xd1:
                 {
                     this.AllowCopy = (bool)e.GetValue(undo);
                     return;
                 }
             case 210:
                 {
                     this.AllowResize = (bool)e.GetValue(undo);
                     return;
                 }
             case 0xd3:
                 {
                     this.AllowReshape = (bool)e.GetValue(undo);
                     return;
                 }
             case 0xd4:
                 {
                     this.AllowDelete = (bool)e.GetValue(undo);
                     return;
                 }
             case 0xd5:
                 {
                     this.AllowInsert = (bool)e.GetValue(undo);
                     return;
                 }
             case 0xd6:
                 {
                     this.AllowLink = (bool)e.GetValue(undo);
                     return;
                 }
             case 0xd7:
                 {
                     this.AllowEdit = (bool)e.GetValue(undo);
                     return;
                 }
             case 0xd8:
             case 0xd9:
             case 0xda:
             case 0xdb:
                 {
                     goto Label_0677;
                 }
             case 220:
                 {
                     ArrayList list1 = (ArrayList)e.GetValue(undo);
                     for (int num1 = 0; num1 < list1.Count; num1 += 2)
                     {
                         Shapes.DiagramShape obj5 = (Shapes.DiagramShape)list1[num1];
                         if (obj5 is Shapes.IDiagramLine)
                         {
                             Shapes.LineGraph link1 = obj5 as Shapes.LineGraph;
                             if (link1 != null)
                             {
                                 PointF[] tfArray1 = (PointF[])list1[num1 + 1];
                                 link1.SetPoints(tfArray1);
                             }
                             else
                             {
                                 Shapes.TextLine link2 = obj5 as Shapes.TextLine;
                                 if (link2 != null)
                                 {
                                     PointF[] tfArray2 = (PointF[])list1[num1 + 1];
                                     link2.RealLink.SetPoints(tfArray2);
                                 }
                             }
                         }
                         else
                         {
                             RectangleF ef1 = (RectangleF)list1[num1 + 1];
                             obj5.Bounds = ef1;
                         }
                     }
                     this.InvalidateViews();
                     return;
                 }
             case 0xdd:
                 {
                     this.UserFlags = e.GetInt(undo);
                     return;
                 }
             case 0xde:
                 {
                     this.UserObject = e.GetValue(undo);
                     return;
                 }
             case 0xdf:
                 {
                     this.LinksLayer = (DiagramLayer)e.GetValue(undo);
                     return;
                 }
             case 0xe0:
                 {
                     this.PartIDIndexable = (bool)e.GetValue(undo);
                     return;
                 }
             case 0xe1:
                 {
                     this.ValidCycle = (DocumentValidCycle)e.GetInt(undo);
                     return;
                 }
             case 0xe2:
                 {
                     this.setWorldScale(e.GetSize(undo), true);
                     return;
                 }
             case 0x321:
                 {
                     DiagramLayer layer16 = (DiagramLayer)e.Object;
                     if (!undo)
                     {
                         DiagramLayer layer17 = (DiagramLayer)e.OldValue;
                         if (e.OldInt == 1)
                         {
                             this.Layers.InsertAfter(layer17, layer16);
                             return;
                         }
                         this.Layers.InsertBefore(layer17, layer16);
                         return;
                     }
                     this.Layers.Remove(layer16);
                     return;
                 }
             case 0x322:
                 {
                     DiagramLayer layer18 = (DiagramLayer)e.Object;
                     if (!undo)
                     {
                         this.Layers.Remove(layer18);
                         return;
                     }
                     DiagramLayer layer19 = (DiagramLayer)e.OldValue;
                     if (layer19 != null)
                     {
                         this.Layers.InsertBefore(layer19, layer18);
                         return;
                     }
                     this.Layers.InsertAfter(this.Layers.Top, layer18);
                     return;
                 }
             case 0x323:
                 {
                     DiagramLayer layer20 = (DiagramLayer)e.Object;
                     DiagramLayer layer21 = (DiagramLayer)e.OldValue;
                     if (e.OldInt != 1)
                     {
                         this.Layers.MoveBefore(layer21, layer20);
                         return;
                     }
                     this.Layers.MoveAfter(layer21, layer20);
                     return;
                 }
             case 0x324:
                 {
                     DiagramLayer layer22 = (DiagramLayer)e.GetValue(undo);
                     this.Layers.Default = layer22;
                     return;
                 }
         }
     }
     else
     {
         switch (num2)
         {
             case 0x385:
                 {
                     e.DiagramShape.ChangeValue(e, undo);
                     return;
                 }
             case 0x386:
                 {
                     DiagramLayer layer1 = (DiagramLayer)e.NewValue;
                     Shapes.DiagramShape obj2 = e.DiagramShape;
                     if (!undo)
                     {
                         layer1.addToLayer(obj2, true);
                         return;
                     }
                     layer1.removeFromLayer(obj2, true);
                     return;
                 }
             case 0x387:
                 {
                     DiagramLayer layer2 = (DiagramLayer)e.OldValue;
                     Shapes.DiagramShape obj3 = e.DiagramShape;
                     if (!undo)
                     {
                         layer2.removeFromLayer(obj3, true);
                         return;
                     }
                     layer2.addToLayer(obj3, true);
                     return;
                 }
             case 0x388:
                 {
                     Shapes.DiagramShape obj4 = e.DiagramShape;
                     DiagramLayer layer3 = (DiagramLayer)e.OldValue;
                     DiagramLayer layer4 = (DiagramLayer)e.NewValue;
                     if (!undo)
                     {
                         layer4.changeLayer(obj4, layer3, true);
                         return;
                     }
                     layer3.changeLayer(obj4, layer4, true);
                     return;
                 }
             case 0x389:
             case 0x38a:
             case 0x38b:
             case 0x38c:
             case 0x38d:
                 {
                     goto Label_0677;
                 }
             case 910:
                 {
                     DiagramLayer layer5 = (DiagramLayer)e.Object;
                     layer5.AllowView = (bool)e.GetValue(undo);
                     return;
                 }
             case 0x38f:
                 {
                     DiagramLayer layer6 = (DiagramLayer)e.Object;
                     layer6.AllowSelect = (bool)e.GetValue(undo);
                     return;
                 }
             case 0x390:
                 {
                     DiagramLayer layer7 = (DiagramLayer)e.Object;
                     layer7.AllowMove = (bool)e.GetValue(undo);
                     return;
                 }
             case 0x391:
                 {
                     DiagramLayer layer8 = (DiagramLayer)e.Object;
                     layer8.AllowCopy = (bool)e.GetValue(undo);
                     return;
                 }
             case 0x392:
                 {
                     DiagramLayer layer9 = (DiagramLayer)e.Object;
                     layer9.AllowResize = (bool)e.GetValue(undo);
                     return;
                 }
             case 0x393:
                 {
                     DiagramLayer layer10 = (DiagramLayer)e.Object;
                     layer10.AllowReshape = (bool)e.GetValue(undo);
                     return;
                 }
             case 0x394:
                 {
                     DiagramLayer layer11 = (DiagramLayer)e.Object;
                     layer11.AllowDelete = (bool)e.GetValue(undo);
                     return;
                 }
             case 0x395:
                 {
                     DiagramLayer layer12 = (DiagramLayer)e.Object;
                     layer12.AllowInsert = (bool)e.GetValue(undo);
                     return;
                 }
             case 0x396:
                 {
                     DiagramLayer layer13 = (DiagramLayer)e.Object;
                     layer13.AllowLink = (bool)e.GetValue(undo);
                     return;
                 }
             case 0x397:
                 {
                     DiagramLayer layer14 = (DiagramLayer)e.Object;
                     layer14.AllowEdit = (bool)e.GetValue(undo);
                     return;
                 }
             case 930:
                 {
                     DiagramLayer layer15 = (DiagramLayer)e.Object;
                     layer15.Identifier = e.GetValue(undo);
                     return;
                 }
         }
     }
 Label_0677:
     if (e.Hint >= 10000)
     {
         throw new ArgumentException("Unknown GoChangedEventArgs hint--override DiagramDocument.ChangeValue to handle the Hint: " + e.Hint.ToString(NumberFormatInfo.InvariantInfo));
     }
 }
Beispiel #5
0
 protected virtual void OnChanged(ChangedEventArgs evt)
 {
     if (this.Changed != null)
     {
         this.Changed(this, evt);
     }
     int num1 = evt.Hint;
     if (!this.SkipsUndoManager)
     {
         DiagramUndoManager manager1 = this.UndoManager;
         if (manager1 != null)
         {
             manager1.DocumentChanged(this, evt);
         }
         if (((num1 < 0) || (num1 >= 200)) && ((num1 != 0x385) || (evt.SubHint != 1000)))
         {
             this.IsModified = true;
         }
     }
     if (num1 == 0x385)
     {
         if (evt.SubHint == 0x3e9)
         {
             Shapes.DiagramShape obj1 = evt.DiagramShape;
             this.UpdateDocumentBounds(obj1);
             this.InvalidatePositionArray(obj1);
             if (obj1.IsTopLevel)
             {
                 DiagramLayer layer1 = obj1.Layer;
                 if (layer1 == null)
                 {
                     return;
                 }
                 layer1.UpdateCache(obj1, evt);
             }
         }
         else if (evt.SubHint == 0x41b)
         {
             if (this.PartIDIndexable)
             {
                 Shapes.DiagramShape obj2 = evt.DiagramShape;
                 this.AddAllParts(obj2);
             }
         }
         else if (evt.SubHint == 0x41c)
         {
             Shapes.DiagramShape obj3 = evt.DiagramShape;
             this.RemoveAllParts(obj3);
         }
     }
     else if (num1 == 0x386)
     {
         Shapes.DiagramShape obj4 = evt.DiagramShape;
         if (this.PartIDIndexable)
         {
             this.AddAllParts(obj4);
         }
         this.UpdateDocumentBounds(obj4);
         this.InvalidatePositionArray(obj4);
     }
     else if (num1 == 0x387)
     {
         Shapes.DiagramShape obj5 = evt.DiagramShape;
         this.RemoveAllParts(obj5);
         this.InvalidatePositionArray(obj5);
     }
     else if (num1 == 0x321)
     {
         this.InvalidatePositionArray(null);
     }
     else if (num1 == 0x322)
     {
         this.InvalidatePositionArray(null);
         if (evt.Object == this.LinksLayer)
         {
             this.LinksLayer = this.DefaultLayer;
         }
     }
 }
Beispiel #6
0
 private void invokeOnChanged(int hint, int subhint, object obj, int oldI, object oldVal, RectangleF oldRect, int newI, object newVal, RectangleF newRect, bool before)
 {
     if (!this.SuspendsUpdates)
     {
         ChangedEventArgs args1 = this.myChangedEventArgs;
         if (args1 == null)
         {
             args1 = new ChangedEventArgs();
             args1.Document = this;
         }
         args1.IsBeforeChanging = before;
         args1.Hint = hint;
         args1.SubHint = subhint;
         args1.Object = obj;
         args1.OldInt = oldI;
         args1.OldValue = oldVal;
         args1.OldRect = oldRect;
         args1.NewInt = newI;
         args1.NewValue = newVal;
         args1.NewRect = newRect;
         this.myChangedEventArgs = null;
         this.OnChanged(args1);
         this.myChangedEventArgs = args1;
         args1.Object = null;
         args1.OldValue = null;
         args1.NewValue = null;
     }
 }
Beispiel #7
0
 protected override void OnDocumentChanged(object sender, ChangedEventArgs e)
 {
     base.OnDocumentChanged(sender, e);
     if ((e.Hint == 0x386) || (e.Hint == 0x387))
     {
         this.LayoutItems();
     }
 }
Beispiel #8
0
 internal void UpdateCache(Shapes.DiagramShape obj, ChangedEventArgs evt)
 {
     foreach (GoLayerCache cache1 in this.Caches)
     {
         RectangleF ef1 = evt.OldRect;
         ef1 = obj.ExpandPaintBounds(ef1, cache1.View);
         RectangleF ef2 = evt.NewRect;
         ef2 = obj.ExpandPaintBounds(ef2, cache1.View);
         bool flag1 = Shapes.DiagramShape.IntersectsRect(cache1.Rect, ef1);
         bool flag2 = Shapes.DiagramShape.IntersectsRect(cache1.Rect, ef2);
         if ((!flag1 && flag2) && !cache1.Objects.Contains(obj))
         {
             cache1.Objects.Add(obj);
         }
     }
 }
Beispiel #9
0
 internal void SafeOnDocumentChanged(object sender, ChangedEventArgs e)
 {
     if (base.InvokeRequired)
     {
         if (this.mySafeOnDocumentChangedDelegate == null)
         {
             this.mySafeOnDocumentChangedDelegate = new EventHandler(this.InternalOnDocumentChanged);
         }
         if (this.myQueuedEvents == null)
         {
             this.myQueuedEvents = new Queue();
         }
         ChangedEventArgs args1 = new ChangedEventArgs(e);
         lock (this.myQueuedEvents)
         {
             this.myQueuedEvents.Enqueue(args1);
         }
         base.Invoke(this.mySafeOnDocumentChangedDelegate);
     }
     else
     {
         this.OnDocumentChanged(sender, e);
     }
 }
Beispiel #10
0
 protected virtual void OnDocumentChanged(object sender, ChangedEventArgs e)
 {
     Rectangle rectangle2;
     Shapes.DiagramShape obj1 = e.DiagramShape;
     if (e.IsBeforeChanging)
     {
         if ((e.Hint == 0x385) && (obj1 != null))
         {
             RectangleF ef1 = obj1.Bounds;
             ef1 = obj1.ExpandPaintBounds(ef1, this);
             Rectangle rectangle1 = this.ConvertDocToView(ef1);
             rectangle1.Inflate(2, 2);
             base.Invalidate(rectangle1);
         }
         goto Label_03B1;
     }
     int num1 = e.Hint;
     if (num1 <= 0xe2)
     {
         if (num1 <= 0xcd)
         {
             switch (num1)
             {
                 case 100:
                 case 0xcd:
                     {
                         goto Label_03A0;
                     }
                 case 0x65:
                     {
                         this.BeginUpdate();
                         goto Label_03B1;
                     }
                 case 0x66:
                     {
                         this.EndUpdate();
                         goto Label_03B1;
                     }
                 case 0x67:
                     {
                         base.Update();
                         goto Label_03B1;
                     }
                 case 0xca:
                     {
                         this.UpdateScrollBars();
                         goto Label_03B1;
                     }
                 case 0xcb:
                     {
                         this.UpdateScrollBars();
                         goto Label_03B1;
                     }
                 case 0xcc:
                     {
                         goto Label_03B1;
                     }
             }
             goto Label_03B1;
         }
         if (num1 == 220)
         {
             goto Label_03A0;
         }
         if (num1 == 0xe2)
         {
             DiagramDocument document1 = sender as DiagramDocument;
             if (document1 != null)
             {
                 SizeF ef5 = document1.WorldScale;
                 this.myHorizWorld = ef5.Width;
                 this.myVertWorld = ef5.Height;
                 this.UpdateView();
             }
         }
         goto Label_03B1;
     }
     if (num1 <= 0x388)
     {
         switch (num1)
         {
             case 0x321:
                 {
                     DiagramLayer layer1 = (DiagramLayer)e.Object;
                     DiagramLayer layer2 = (DiagramLayer)e.OldValue;
                     if (e.SubHint != 1)
                     {
                         this.Layers.InsertDocumentLayerBefore(layer2, layer1);
                         goto Label_0302;
                     }
                     this.Layers.InsertDocumentLayerAfter(layer2, layer1);
                     goto Label_0302;
                 }
             case 0x322:
                 {
                     DiagramLayer layer3 = (DiagramLayer)e.Object;
                     this.Layers.Remove(layer3);
                     this.Selection.AddAllSelectionHandles();
                     this.UpdateView();
                     goto Label_03B1;
                 }
             case 0x323:
                 {
                     DiagramLayer layer4 = (DiagramLayer)e.Object;
                     DiagramLayer layer5 = (DiagramLayer)e.OldValue;
                     try
                     {
                         if (e.SubHint == 1)
                         {
                             this.Layers.MoveAfter(layer5, layer4);
                         }
                         else
                         {
                             this.Layers.MoveBefore(layer5, layer4);
                         }
                     }
                     catch (ArgumentException)
                     {
                     }
                     this.Selection.AddAllSelectionHandles();
                     this.UpdateView();
                     goto Label_03B1;
                 }
             case 0x385:
                 {
                     RectangleF ef2 = obj1.Bounds;
                     ef2 = obj1.ExpandPaintBounds(ef2, this);
                     rectangle2 = this.ConvertDocToView(ef2);
                     rectangle2.Inflate(2, 2);
                     if (e.SubHint != 0x3e9)
                     {
                         if (e.SubHint == 0x3eb)
                         {
                             this.updateSelectionHandles(obj1);
                         }
                         else if (e.SubHint == 0x41c)
                         {
                             this.removeFromSelection(e.OldValue as Shapes.DiagramShape);
                         }
                         goto Label_01F7;
                     }
                     DiagramSelection selection1 = this.Selection;
                     if (selection1.GetHandleCount(obj1) > 0)
                     {
                         if (!obj1.CanView())
                         {
                             obj1.RemoveSelectionHandles(selection1);
                         }
                         else
                         {
                             IShapeHandle handle1 = selection1.GetAnExistingHandle(obj1);
                             obj1.AddSelectionHandles(selection1, handle1.SelectedObject);
                         }
                     }
                     RectangleF ef3 = e.OldRect;
                     ef3 = obj1.ExpandPaintBounds(ef3, this);
                     Rectangle rectangle3 = this.ConvertDocToView(ef3);
                     rectangle3.Inflate(2, 2);
                     base.Invalidate(rectangle3);
                     goto Label_01F7;
                 }
             case 0x386:
             case 0x387:
             case 0x388:
                 {
                     if (e.Hint == 0x387)
                     {
                         this.removeFromSelection(obj1);
                     }
                     RectangleF ef4 = obj1.Bounds;
                     ef4 = obj1.ExpandPaintBounds(ef4, this);
                     Rectangle rectangle4 = this.ConvertDocToView(ef4);
                     rectangle4.Inflate(2, 2);
                     base.Invalidate(rectangle4);
                     goto Label_03B1;
                 }
         }
         goto Label_03B1;
     }
     if (num1 == 910)
     {
         goto Label_03A0;
     }
     if (num1 != 930)
     {
     }
     goto Label_03B1;
 Label_01F7:
     base.Invalidate(rectangle2);
     goto Label_03B1;
 Label_0302:
     this.Selection.AddAllSelectionHandles();
     this.UpdateView();
     goto Label_03B1;
 Label_03A0:
     this.Selection.AddAllSelectionHandles();
     this.UpdateView();
 Label_03B1:
     if (this.DocumentChanged != null)
     {
         this.DocumentChanged(sender, e);
     }
 }
 public virtual void DocumentChanged(object sender, ChangedEventArgs e)
 {
     if ((!this.IsUndoing && !this.IsRedoing) && !this.SkipEvent(e))
     {
         UndoManagerCompoundEdit edit1 = this.CurrentEdit;
         if (edit1 == null)
         {
             edit1 = new UndoManagerCompoundEdit();
             this.CurrentEdit = edit1;
         }
         ChangedEventArgs args1 = new ChangedEventArgs(e);
         edit1.AddEdit(args1);
         if (this.ChecksTransactionLevel && (this.TransactionLevel <= 0))
         {
             Shapes.DiagramShape.Trace("Change not within a transaction: " + args1.ToString());
         }
     }
 }
 public virtual bool SkipEvent(ChangedEventArgs evt)
 {
     if ((((evt.Document != null) && !evt.Document.SkipsUndoManager) && ((evt.Hint < 0) || (evt.Hint >= 200))) && ((evt.Hint != 0x385) || (((evt.DiagramShape != null) && !evt.DiagramShape.SkipsUndoManager) && (evt.SubHint != 1000))))
     {
         return false;
     }
     return true;
 }