Ejemplo n.º 1
0
        public void AddDocumentWorkspace(DocumentWorkspace addMe)
        {
            this.documents.Add(addMe);

            ImageStrip.Item docButton = new ImageStrip.Item();
            docButton.Image = null;
            docButton.Tag   = addMe;

            AddItem(docButton);
            this.documentButtons.Add(docButton);

            addMe.CompositionUpdated += Workspace_CompositionUpdated;

            this.dw2button.Add(addMe, docButton);

            if (addMe.Document != null)
            {
                QueueThumbnailUpdate(addMe);
                docButton.Dirty              = addMe.Document.Dirty;
                addMe.Document.DirtyChanged += Document_DirtyChanged;
            }

            addMe.DocumentChanging += Workspace_DocumentChanging;
            addMe.DocumentChanged  += Workspace_DocumentChanged;

            OnDocumentListChanged();
        }
Ejemplo n.º 2
0
        public void RemoveDocumentWorkspace(DocumentWorkspace removeMe)
        {
            removeMe.CompositionUpdated -= Workspace_CompositionUpdated;

            if (this.selectedDocument == removeMe)
            {
                this.selectedDocument = null;
            }

            this.documents.Remove(removeMe);
            this.thumbnailManager.RemoveFromQueue(removeMe);

            ImageStrip.Item docButton = this.dw2button[removeMe];
            this.RemoveItem(docButton);
            this.dw2button.Remove(removeMe);
            this.documentButtons.Remove(docButton);

            if (this.thumbs.ContainsKey(removeMe))
            {
                RenderArgs thumbRA = this.thumbs[removeMe];
                Surface    surface = thumbRA.Surface;
                thumbRA.Dispose();
                this.thumbs.Remove(removeMe);
                surface.Dispose();
            }

            OnDocumentListChanged();
        }
Ejemplo n.º 3
0
 private void Document_DirtyChanged(object sender, EventArgs e)
 {
     for (int i = 0; i < this.documents.Count; ++i)
     {
         if (object.ReferenceEquals(sender, this.documents[i].Document))
         {
             ImageStrip.Item docButton = this.dw2button[this.documents[i]];
             docButton.Dirty = ((Document)sender).Dirty;
         }
     }
 }
Ejemplo n.º 4
0
 private void OnThumbnailUpdated(DocumentWorkspace dw)
 {
     // We must double check that the DW is still around, because there's a chance
     // that the DW was been removed while the thumbnail was being rendered.
     if (this.dw2button.ContainsKey(dw))
     {
         ImageStrip.Item docButton = this.dw2button[dw];
         RenderArgs      docRA     = this.thumbs[dw];
         docButton.Image = docRA.Bitmap;
         docButton.Update();
     }
 }
Ejemplo n.º 5
0
        private void Workspace_DocumentChanged(object sender, EventArgs e)
        {
            DocumentWorkspace dw = (DocumentWorkspace)sender;

            ImageStrip.Item docButton = this.dw2button[dw];

            if (dw.Document != null)
            {
                docButton.Dirty           = dw.Document.Dirty;
                dw.Document.DirtyChanged += Document_DirtyChanged;
            }
            else
            {
                docButton.Dirty = false;
            }
        }
Ejemplo n.º 6
0
        public void AddDocumentWorkspace(DocumentWorkspace addMe)
        {
            this.documents.Add(addMe);

            ImageStrip.Item docButton = new ImageStrip.Item();
            docButton.Image = null;
            docButton.Tag = addMe;

            AddItem(docButton);
            this.documentButtons.Add(docButton);

            addMe.CompositionUpdated += Workspace_CompositionUpdated;

            this.dw2button.Add(addMe, docButton);

            if (addMe.Document != null)
            {
                QueueThumbnailUpdate(addMe);
                docButton.Dirty = addMe.Document.Dirty;
                addMe.Document.DirtyChanged += Document_DirtyChanged;
            }

            addMe.DocumentChanging += Workspace_DocumentChanging;
            addMe.DocumentChanged += Workspace_DocumentChanged;

            OnDocumentListChanged();
        }