Esempio n. 1
0
 private void Globals_TransactionStored(object sender, Globals.TransactionEventArgs e)
 {         // only update if the transaction is an edit of the shape we are displaying, if any
     if (m_GrabSpots == null || !m_GrabSpots.Any())
     {
         return;
     }
     if (e.Transaction.Contains(m_GrabSpots.First().Shape))
     {
         RefillContent();
     }
 }
Esempio n. 2
0
 private void Engine_TransactionStored(object sender, Globals.TransactionEventArgs e)
 {
     if (e.Transaction.RequiresDocumentRepaint)
     {
         Invalidate();                 // The entire document structure might need updating; e.g. the number of pages has changed
     }
     if (e.Transaction.CurrentPage == null || e.Transaction.CurrentPage == Globals.Root.CurrentPage)
     {
         m_tmrUpdateCurrent.Enabled = true;                 // doesn't matter if already true
     }
     else
     {
         // if something changes a different page, we do update the graphics immediately rather than using the timer
         int index = m_Document.IndexOf(e.Transaction.CurrentPage);
         if (index < 0)
         {
             Debug.Fail("Page does not appear in document, ignoring ctrPages.NonCurrentPageEdited");
             return;
         }
         m_Document.Page(index).DiscardThumbnail();
         Invalidate(PageBounds(index));
     }
 }
Esempio n. 3
0
        private void Engine_TransactionStored(object sender, Globals.TransactionEventArgs e)
        {
            if (m_Stale)
            {
                if (Visible)
                {
                    FillTree();
                }
                return;
            }
            if (!Visible)
            {
                m_Stale = true;
                tvOutline.Nodes.Clear();
                NodeList.Clear();
                return;
            }
            bool wipeout = false;

            foreach (Change change in e.Transaction)
            {
                if (change.Key is IShapeContainer && !change.IsCreate && !change.IsDelete)
                {
                    IShapeContainer current  = (IShapeContainer)change.Current;
                    IShapeContainer previous = (IShapeContainer)change.Previous;
                    if (current.Contents.Count != previous.Contents.Count)
                    {
                        wipeout = true;
                    }
                    else
                    {
                        wipeout = Enumerable.Range(0, current.Contents.Count).Any(i => current.Contents[i] != previous.Contents[i]);
                    }
                }
                if (change.Key is Page)
                {
                    if (change.IsCreate || change.IsDelete)
                    {
                        wipeout = true;
                    }
                }
                else if (change.Key is Document)
                {
                    wipeout = true;
                }
                else if (change.Key is Shape)
                {
                    if (NodeList.ContainsKey(change.Key))
                    {
                        if (change.IsDelete)
                        {
                            NodeList[change.Key].Remove();                           // removes the node from the tree
                            NodeList.Remove(change.Key);                             // And update our list
                        }
                        else if (!change.IsCreate)
                        {
                            Shape currentShape  = change.Current as Shape;
                            Shape previousShape = (Shape)change.Previous;
                            if (currentShape.Parent != previousShape.Parent || currentShape.Z != previousShape.Z)
                            {
                                wipeout = true;                                 // A shape has been moved from one container to another; just update the entire tree
                            }
                            else if (currentShape.LabelText != previousShape.LabelText)
                            {
                                NodeList[change.Current].Text = currentShape.Description;
                            }
                            StyleNode(NodeList[change.Current], currentShape);
                        }
                    }
                    else if (change.IsCreate)
                    {
                        Shape shp = change.Current as Shape;
                        if (NodeList.ContainsKey((Datum)shp.Parent))
                        {
                            AddTreeNode(shp, NodeList[(Datum)shp.Parent].Nodes);
                        }
                        else
                        {
                            wipeout = true;                             // can't find parent of new shape.  Just  give up and start again
                        }
                    }
                }
                if (wipeout)
                {
                    break;
                }
            }
            if (wipeout)
            {
                FillTree();
            }
            UpdateInfo();
        }