// Update statistics private void UpdateStatistics(ImageDoc imgDoc) { if (config.statisticsVisible) { statisticsWin.GatherStatistics((imgDoc == null) ? null : imgDoc.Image); } }
// 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); }
// Update histogram private void UpdateHistogram(ImageDoc imgDoc) { if (config.histogramVisible) { histogramWin.GatherStatistics((imgDoc == null) ? null : imgDoc.Image); } }
// 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); }
// 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; } }
// 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); } }
// 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); }
// 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); } }
// Update histogram private void UpdateHistogram(ImageDoc imgDoc) { if ( histogramWin.Visible ) histogramWin.GatherStatistics( ( imgDoc == null ) ? null : imgDoc.Image ); }
// 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); } }
// 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); } } }
// 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; }
// 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 ); } }
private void UpdateStatistics( ImageDoc imgDoc ) { if ( statisticsWin.Visible ) statisticsWin.GatherStatistics( ( imgDoc == null ) ? null : imgDoc.Image ); }
// Update histogram private void UpdateHistogram(ImageDoc imgDoc) { }
public Logger(ImageDoc owner, bool AutoSave=false) { host = owner; log_messages = new List<string>(); AutoSaveFlag = AutoSave; }
// Update statistics private void UpdateStatistics(ImageDoc imgDoc) { }