Beispiel #1
0
 private void mCurrentDrawing_ConstructionStepComplete(object sender, Drawing.ConstructionStepCompleteEventArgs args)
 {
     if (args.ConstructionComplete)
     {
         ConstructionInProgress = false;
         UpdateUndoRedo();
         Drawing.ClearStatus();
     }
     else
     {
         Drawing.RaiseDisplayProperties(Drawing.Behavior.PropertyBag);
         CommandRedo.Enabled = false;
         Drawing.RaiseStatusNotification(Drawing.Behavior.ConstructionHintText(args));
     }
 }
Beispiel #2
0
 public void Undo()
 {
     if (ConstructionInProgress)
     {
         Drawing.Behavior.Restart();
         return;
     }
     try
     {
         Drawing.ActionManager.Undo();
     }
     catch (Exception ex)
     {
         HandleException(ex);
     }
     UpdateUndoRedo();
     Drawing.RaiseDisplayProperties(null);
 }
Beispiel #3
0
        private static void TearOffGeneralCase(IFigure figure)
        {
            Drawing drawing = figure.Drawing;

            using (drawing.ActionManager.CreateTransaction())
            {
                foreach (var dependency in figure.Dependencies.ToArray())
                {
                    var dependencyPoint = dependency as IPoint;
                    if (dependencyPoint == null)
                    {
                        // for now, can't tear off a figure
                        // that has a non-point dependency (such as a ParallelLine)
                        return;
                    }

                    if (dependencyPoint is FreePoint)
                    {
                        // no need to tear-off from an already free point
                        // since no one else uses this point
                        if (dependencyPoint.Dependents.Count == 1)
                        {
                            continue;
                        }
                        if (dependencyPoint.Dependents.Count == 2 && dependencyPoint.Dependents.OfType <LabelBase>().Count() > 0)
                        {
                            continue;
                        }
                    }

                    FreePoint newDependencyPoint = Factory.CreateFreePoint(drawing, dependencyPoint.Coordinates);
                    Actions.Add(figure.Drawing, newDependencyPoint);
                    Actions.ReplaceDependency(figure, dependencyPoint, newDependencyPoint);
                }
            }

            drawing.RaiseDisplayProperties(figure);
        }