Ejemplo n.º 1
0
 // Update statistics
 private void UpdateStatistics(ImageDoc imgDoc)
 {
     if (config.statisticsVisible)
     {
         statisticsWin.GatherStatistics((imgDoc == null) ? null : imgDoc.Image);
     }
 }
Ejemplo n.º 2
0
 // Setup events
 private void SetupDocumentEvents(ImageDoc doc)
 {
     doc.DocumentChanged    += new System.EventHandler(this.document_DocumentChanged);
     doc.ZoomChanged        += new System.EventHandler(this.document_ZoomChanged);
     doc.MouseImagePosition += new ImageDoc.SelectionEventHandler(this.document_MouseImagePosition);
     doc.SelectionChanged   += new ImageDoc.SelectionEventHandler(this.document_SelectionChanged);
 }
Ejemplo n.º 3
0
 // Update histogram
 private void UpdateHistogram(ImageDoc imgDoc)
 {
     if (config.histogramVisible)
     {
         histogramWin.GatherStatistics((imgDoc == null) ? null : imgDoc.Image);
     }
 }
Ejemplo n.º 4
0
        // active document changed
        private void dockManager_ActiveDocumentChanged(object sender, System.EventArgs e)
        {
            Content  doc    = dockManager.ActiveDocument;
            ImageDoc imgDoc = (doc is ImageDoc) ? (ImageDoc)doc : null;

            UpdateHistogram(imgDoc);
            UpdateStatistics(imgDoc);
            UpdateZoomStatus(imgDoc);

            UpdateSizeStatus(doc);
        }
Ejemplo n.º 5
0
 // Update zoom status
 private void UpdateZoomStatus(ImageDoc imgDoc)
 {
     if (imgDoc != null)
     {
         int zoom = (int)(imgDoc.Zoom * 100);
         zoomPanel.Text = zoom.ToString() + "%";
     }
     else
     {
         zoomPanel.Text = String.Empty;
     }
 }
Ejemplo n.º 6
0
        // Paste image from clipboard
        private void PasteFromClipboard()
        {
            if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Bitmap))
            {
                ImageDoc imgDoc = new ImageDoc((Bitmap)Clipboard.GetDataObject().GetData(DataFormats.Bitmap), (IDocumentsHost)this);

                imgDoc.Text = "Image " + unNamedNumber.ToString();
                imgDoc.Show(dockManager);
                imgDoc.Focus();

                // set events
                SetupDocumentEvents(imgDoc);
            }
        }
Ejemplo n.º 7
0
        // Create new document
        public bool NewDocument(Bitmap image)
        {
            unNamedNumber++;

            ImageDoc imgDoc = new ImageDoc(image, (IDocumentsHost)this);

            imgDoc.Text = "Image " + unNamedNumber.ToString();
            imgDoc.Show(dockManager);
            imgDoc.Focus();

            // set events
            SetupDocumentEvents(imgDoc);

            return(true);
        }
Ejemplo n.º 8
0
        // Open specified file
        private void OpenFile(string fileName)
        {
            ImageDoc imgDoc = null;

            try
            {
                // create image document
                imgDoc      = new ImageDoc(fileName, (IDocumentsHost)this);
                imgDoc.Text = Path.GetFileName(fileName);
            }
            catch (ApplicationException ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (imgDoc != null)
            {
                imgDoc.Show(dockManager);
                imgDoc.Focus( );

                // set events
                SetupDocumentEvents(imgDoc);
            }
        }
Ejemplo n.º 9
0
 // Update histogram
 private void UpdateHistogram(ImageDoc imgDoc)
 {
     if ( histogramWin.Visible )
         histogramWin.GatherStatistics( ( imgDoc == null ) ? null : imgDoc.Image );
 }
Ejemplo n.º 10
0
 // Setup events
 private void SetupDocumentEvents(ImageDoc doc)
 {
     doc.DocumentChanged += new System.EventHandler(this.document_DocumentChanged);
     doc.ZoomChanged += new System.EventHandler(this.document_ZoomChanged);
     doc.MouseImagePosition += new ImageDoc.SelectionEventHandler(this.document_MouseImagePosition);
     doc.SelectionChanged += new ImageDoc.SelectionEventHandler(this.document_SelectionChanged);
 }
Ejemplo n.º 11
0
        // Paste image from clipboard
        private void PasteFromClipboard()
        {
            if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Bitmap))
            {
                ImageDoc imgDoc = new ImageDoc((Bitmap) Clipboard.GetDataObject().GetData(DataFormats.Bitmap), (IDocumentsHost) this);

                imgDoc.Text = "Image " + unnamedNumber.ToString();
                imgDoc.Show(dockManager);
                imgDoc.Focus();

                // set events
                SetupDocumentEvents(imgDoc);
            }
        }
Ejemplo n.º 12
0
        // Open file
        private void OpenFile()
        {
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                ImageDoc imgDoc = null;

                try
                {
                    // create image document
                    imgDoc = new ImageDoc(ofd.FileName, (IDocumentsHost) this);
                    imgDoc.Text = Path.GetFileName(ofd.FileName);
                }
                catch (ApplicationException ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                if (imgDoc != null)
                {
                    imgDoc.Show(dockManager);
                    Debug.WriteLine(imgDoc);
                    imgDoc.Focus();

                    // set events
                    SetupDocumentEvents(imgDoc);
                }
            }
        }
Ejemplo n.º 13
0
        // Create new document
        public bool NewDocument(Bitmap image)
        {
            unnamedNumber++;

            ImageDoc imgDoc = new ImageDoc(image, (IDocumentsHost) this);

            imgDoc.Text = "Image " + unnamedNumber.ToString();
            imgDoc.Show(dockManager);
            imgDoc.Focus();

            // set events
            SetupDocumentEvents(imgDoc);

            return true;
        }
Ejemplo n.º 14
0
        // Open specified file
        private void OpenFile( string fileName )
        {
            ImageDoc imgDoc = null;

            try
            {
                // create image document
                imgDoc = new ImageDoc( fileName, (IDocumentsHost) this );
                imgDoc.Text = Path.GetFileName( fileName );

            }
            catch ( ApplicationException ex )
            {
                MessageBox.Show( ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
            }

            if ( imgDoc != null )
            {
                imgDoc.Show( dockManager );
                imgDoc.Focus( );

                // set events
                SetupDocumentEvents( imgDoc );
            }
        }
Ejemplo n.º 15
0
 private void UpdateStatistics( ImageDoc imgDoc )
 {
     if ( statisticsWin.Visible )
         statisticsWin.GatherStatistics( ( imgDoc == null ) ? null : imgDoc.Image );
 }
Ejemplo n.º 16
0
 // Update zoom status
 private void UpdateZoomStatus(ImageDoc imgDoc)
 {
     if (imgDoc != null)
     {
         int zoom = (int)(imgDoc.Zoom * 100);
         zoomPanel.Text = zoom.ToString() + "%";
     }
     else
     {
         zoomPanel.Text = String.Empty;
     }
 }
Ejemplo n.º 17
0
 // Update histogram
 private void UpdateHistogram(ImageDoc imgDoc)
 {
 }
Ejemplo n.º 18
0
 public Logger(ImageDoc owner, bool AutoSave=false)
 {
     host = owner;
     log_messages = new List<string>();
     AutoSaveFlag = AutoSave;
 }
Ejemplo n.º 19
0
 // Update statistics
 private void UpdateStatistics(ImageDoc imgDoc)
 {
 }