diff --git a/OccuRec/Config/Panels/ucBadPixels.Designer.cs b/OccuRec/Config/Panels/ucBadPixels.Designer.cs new file mode 100644 index 0000000..f59279f --- /dev/null +++ b/OccuRec/Config/Panels/ucBadPixels.Designer.cs @@ -0,0 +1,254 @@ + +namespace OccuRec.Config.Panels +{ + partial class ucBadPixels + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.cbxEnableBadPixelsControl = new System.Windows.Forms.CheckBox(); + this.tbxBadPixelsFile = new System.Windows.Forms.TextBox(); + this.lblBadPixelsFile = new System.Windows.Forms.Label(); + this.btnBrowseBadPixelsFile = new System.Windows.Forms.Button(); + this.nupSize = new System.Windows.Forms.NumericUpDown(); + this.lblSize = new System.Windows.Forms.Label(); + this.cbxBlinking = new System.Windows.Forms.CheckBox(); + this.gbxOverlayMarker = new System.Windows.Forms.GroupBox(); + this.gbxShape = new System.Windows.Forms.GroupBox(); + this.rbCircle = new System.Windows.Forms.RadioButton(); + this.rbCross = new System.Windows.Forms.RadioButton(); + this.rbPlus = new System.Windows.Forms.RadioButton(); + this.gbxBadPixels = new System.Windows.Forms.GroupBox(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.ofdBrowseBadPixelsFile = new System.Windows.Forms.OpenFileDialog(); + ((System.ComponentModel.ISupportInitialize)(this.nupSize)).BeginInit(); + this.gbxOverlayMarker.SuspendLayout(); + this.gbxShape.SuspendLayout(); + this.gbxBadPixels.SuspendLayout(); + this.SuspendLayout(); + // + // cbxEnableBadPixelsControl + // + this.cbxEnableBadPixelsControl.AutoSize = true; + this.cbxEnableBadPixelsControl.Location = new System.Drawing.Point(17, 14); + this.cbxEnableBadPixelsControl.Name = "cbxEnableBadPixelsControl"; + this.cbxEnableBadPixelsControl.Size = new System.Drawing.Size(185, 17); + this.cbxEnableBadPixelsControl.TabIndex = 0; + this.cbxEnableBadPixelsControl.Text = "Enable \'bad pixels overlay\' control"; + this.toolTip1.SetToolTip(this.cbxEnableBadPixelsControl, "If ticked, a control for turning on/off the display of the bad pixel markers will" + + " be enabled on the main menu."); + this.cbxEnableBadPixelsControl.UseVisualStyleBackColor = true; + this.cbxEnableBadPixelsControl.CheckedChanged += new System.EventHandler(this.cbxUseBadPixelsAids_CheckedChanged); + // + // tbxBadPixelsFile + // + this.tbxBadPixelsFile.Location = new System.Drawing.Point(7, 34); + this.tbxBadPixelsFile.Name = "tbxBadPixelsFile"; + this.tbxBadPixelsFile.Size = new System.Drawing.Size(350, 20); + this.tbxBadPixelsFile.TabIndex = 1; + this.toolTip1.SetToolTip(this.tbxBadPixelsFile, "Enter the directory and name of the file containing the bad pixels coordinates d" + + "ata."); + // + // lblBadPixelsFile + // + this.lblBadPixelsFile.AutoSize = true; + this.lblBadPixelsFile.Location = new System.Drawing.Point(7, 14); + this.lblBadPixelsFile.Name = "lblBadPixelsFile"; + this.lblBadPixelsFile.Size = new System.Drawing.Size(75, 13); + this.lblBadPixelsFile.TabIndex = 2; + this.lblBadPixelsFile.Text = "Bad Pixels File"; + // + // btnBrowseBadPixelsFile + // + this.btnBrowseBadPixelsFile.Location = new System.Drawing.Point(372, 28); + this.btnBrowseBadPixelsFile.Name = "btnBrowseBadPixelsFile"; + this.btnBrowseBadPixelsFile.Size = new System.Drawing.Size(50, 30); + this.btnBrowseBadPixelsFile.TabIndex = 3; + this.btnBrowseBadPixelsFile.Text = "..."; + this.toolTip1.SetToolTip(this.btnBrowseBadPixelsFile, "Browse to select the bad pixels file"); + this.btnBrowseBadPixelsFile.UseVisualStyleBackColor = true; + this.btnBrowseBadPixelsFile.Click += new System.EventHandler(this.btnBrowseBadPixelsFile_Click); + // + // nupSize + // + this.nupSize.Location = new System.Drawing.Point(127, 36); + this.nupSize.Maximum = new decimal(new int[] { + 30, + 0, + 0, + 0}); + this.nupSize.Minimum = new decimal(new int[] { + 3, + 0, + 0, + 0}); + this.nupSize.Name = "nupSize"; + this.nupSize.Size = new System.Drawing.Size(56, 20); + this.nupSize.TabIndex = 7; + this.toolTip1.SetToolTip(this.nupSize, "choose the length or diameter (as appropriate) of the bad pixel overlay markers"); + this.nupSize.Value = new decimal(new int[] { + 3, + 0, + 0, + 0}); + // + // lblSize + // + this.lblSize.AutoSize = true; + this.lblSize.Location = new System.Drawing.Point(127, 21); + this.lblSize.Name = "lblSize"; + this.lblSize.Size = new System.Drawing.Size(85, 13); + this.lblSize.TabIndex = 8; + this.lblSize.Text = "Length/diameter"; + // + // cbxBlinking + // + this.cbxBlinking.AutoSize = true; + this.cbxBlinking.Location = new System.Drawing.Point(249, 36); + this.cbxBlinking.Name = "cbxBlinking"; + this.cbxBlinking.Size = new System.Drawing.Size(63, 17); + this.cbxBlinking.TabIndex = 9; + this.cbxBlinking.Text = "Blinking"; + this.toolTip1.SetToolTip(this.cbxBlinking, "tick if you want the bad pixel markers to blink"); + this.cbxBlinking.UseVisualStyleBackColor = true; + // + // gbxOverlayMarker + // + this.gbxOverlayMarker.Controls.Add(this.gbxShape); + this.gbxOverlayMarker.Controls.Add(this.cbxBlinking); + this.gbxOverlayMarker.Controls.Add(this.lblSize); + this.gbxOverlayMarker.Controls.Add(this.nupSize); + this.gbxOverlayMarker.Location = new System.Drawing.Point(7, 83); + this.gbxOverlayMarker.Name = "gbxOverlayMarker"; + this.gbxOverlayMarker.Size = new System.Drawing.Size(349, 137); + this.gbxOverlayMarker.TabIndex = 10; + this.gbxOverlayMarker.TabStop = false; + this.gbxOverlayMarker.Text = "Overlay marker"; + // + // gbxShape + // + this.gbxShape.Controls.Add(this.rbCircle); + this.gbxShape.Controls.Add(this.rbCross); + this.gbxShape.Controls.Add(this.rbPlus); + this.gbxShape.Location = new System.Drawing.Point(10, 20); + this.gbxShape.Name = "gbxShape"; + this.gbxShape.Size = new System.Drawing.Size(99, 97); + this.gbxShape.TabIndex = 10; + this.gbxShape.TabStop = false; + this.gbxShape.Text = "Shape"; + this.toolTip1.SetToolTip(this.gbxShape, "Choose the shape of the bad pixels overlay marker"); + // + // rbCircle + // + this.rbCircle.AutoSize = true; + this.rbCircle.Location = new System.Drawing.Point(12, 59); + this.rbCircle.Name = "rbCircle"; + this.rbCircle.Size = new System.Drawing.Size(51, 17); + this.rbCircle.TabIndex = 2; + this.rbCircle.TabStop = true; + this.rbCircle.Text = "Circle"; + this.rbCircle.UseVisualStyleBackColor = true; + // + // rbCross + // + this.rbCross.AutoSize = true; + this.rbCross.Location = new System.Drawing.Point(12, 39); + this.rbCross.Name = "rbCross"; + this.rbCross.Size = new System.Drawing.Size(51, 17); + this.rbCross.TabIndex = 1; + this.rbCross.TabStop = true; + this.rbCross.Text = "Cross"; + this.rbCross.UseVisualStyleBackColor = true; + // + // rbPlus + // + this.rbPlus.AutoSize = true; + this.rbPlus.Location = new System.Drawing.Point(12, 19); + this.rbPlus.Name = "rbPlus"; + this.rbPlus.Size = new System.Drawing.Size(45, 17); + this.rbPlus.TabIndex = 0; + this.rbPlus.TabStop = true; + this.rbPlus.Text = "Plus"; + this.rbPlus.UseVisualStyleBackColor = true; + // + // gbxBadPixels + // + this.gbxBadPixels.Controls.Add(this.gbxOverlayMarker); + this.gbxBadPixels.Controls.Add(this.btnBrowseBadPixelsFile); + this.gbxBadPixels.Controls.Add(this.lblBadPixelsFile); + this.gbxBadPixels.Controls.Add(this.tbxBadPixelsFile); + this.gbxBadPixels.Location = new System.Drawing.Point(10, 37); + this.gbxBadPixels.Name = "gbxBadPixels"; + this.gbxBadPixels.Size = new System.Drawing.Size(465, 241); + this.gbxBadPixels.TabIndex = 11; + this.gbxBadPixels.TabStop = false; + // + // ofdBrowseBadPixelsFile + // + this.ofdBrowseBadPixelsFile.FileName = "C:\\ProgramData\\OccuRec\\BadPixels.txt"; + this.ofdBrowseBadPixelsFile.Filter = "txt files (*.txt)|*.txt"; + this.ofdBrowseBadPixelsFile.Title = "Select the Bad Pixels file"; + // + // ucBadPixels + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.gbxBadPixels); + this.Controls.Add(this.cbxEnableBadPixelsControl); + this.Name = "ucBadPixels"; + this.Size = new System.Drawing.Size(493, 289); + ((System.ComponentModel.ISupportInitialize)(this.nupSize)).EndInit(); + this.gbxOverlayMarker.ResumeLayout(false); + this.gbxOverlayMarker.PerformLayout(); + this.gbxShape.ResumeLayout(false); + this.gbxShape.PerformLayout(); + this.gbxBadPixels.ResumeLayout(false); + this.gbxBadPixels.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.CheckBox cbxEnableBadPixelsControl; + private System.Windows.Forms.TextBox tbxBadPixelsFile; + private System.Windows.Forms.Label lblBadPixelsFile; + private System.Windows.Forms.Button btnBrowseBadPixelsFile; + private System.Windows.Forms.NumericUpDown nupSize; + private System.Windows.Forms.Label lblSize; + private System.Windows.Forms.CheckBox cbxBlinking; + private System.Windows.Forms.GroupBox gbxOverlayMarker; + private System.Windows.Forms.GroupBox gbxBadPixels; + private System.Windows.Forms.GroupBox gbxShape; + private System.Windows.Forms.RadioButton rbCircle; + private System.Windows.Forms.RadioButton rbCross; + private System.Windows.Forms.RadioButton rbPlus; + private System.Windows.Forms.ToolTip toolTip1; + private System.Windows.Forms.OpenFileDialog ofdBrowseBadPixelsFile; + } +} diff --git a/OccuRec/Config/Panels/ucBadPixels.cs b/OccuRec/Config/Panels/ucBadPixels.cs new file mode 100644 index 0000000..65a9b29 --- /dev/null +++ b/OccuRec/Config/Panels/ucBadPixels.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.IO; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using OccuRec.Helpers; +using OccuRec.Properties; +using OccuRec.Utilities; + +namespace OccuRec.Config.Panels +{ + public partial class ucBadPixels : SettingsPanel + { + public ucBadPixels() + { + InitializeComponent(); + } + + public override void LoadSettings() + { + cbxEnableBadPixelsControl.Checked = Settings.Default.EnableBadPixelsControl; + tbxBadPixelsFile.Text = Settings.Default.BadPixelsFileName; + rbPlus.Checked = Settings.Default.BadPixelsMarkerShapePlus; + rbCross.Checked = Settings.Default.BadPixelsMarkerShapeCross; + rbCircle.Checked = Settings.Default.BadPixelsMarkerShapeCircle; + nupSize.Value = Settings.Default.BadPixelsMarkerSize; + cbxBlinking.Checked = Settings.Default.BadPixelsMarkerBlinking; + + gbxBadPixels.Enabled = cbxEnableBadPixelsControl.Checked; + } + + public override void SaveSettings() + { + Settings.Default.EnableBadPixelsControl = cbxEnableBadPixelsControl.Checked; + Settings.Default.BadPixelsFileName = tbxBadPixelsFile.Text; + Settings.Default.BadPixelsMarkerShapePlus = rbPlus.Checked; + Settings.Default.BadPixelsMarkerShapeCross = rbCross.Checked; + Settings.Default.BadPixelsMarkerShapeCircle = rbCircle.Checked; + Settings.Default.BadPixelsMarkerSize = nupSize.Value; + Settings.Default.BadPixelsMarkerBlinking = cbxBlinking.Checked; + + } + + public override bool ValidateSettings() + { + if (cbxEnableBadPixelsControl.Checked) + { + if (!File.Exists(tbxBadPixelsFile.Text)) + { + MessageBox.Show("The 'Bad Pixels File' must be an existing file."); + tbxBadPixelsFile.Focus(); + return false; + } + } + + return true; + } + + private void cbxUseBadPixelsAids_CheckedChanged(object sender, EventArgs e) + { + gbxBadPixels.Enabled = cbxEnableBadPixelsControl.Checked; + } + + private void btnBrowseBadPixelsFile_Click(object sender, EventArgs e) + { + if (ofdBrowseBadPixelsFile.ShowDialog() == DialogResult.OK) + { + tbxBadPixelsFile.Text = ofdBrowseBadPixelsFile.FileName; + } + } + } +} diff --git a/OccuRec/Config/Panels/ucBadPixels.resx b/OccuRec/Config/Panels/ucBadPixels.resx new file mode 100644 index 0000000..0638b5a --- /dev/null +++ b/OccuRec/Config/Panels/ucBadPixels.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 114, 17 + + \ No newline at end of file diff --git a/OccuRec/Config/frmSettings.Designer.cs b/OccuRec/Config/frmSettings.Designer.cs index dea28f8..a281640 100644 --- a/OccuRec/Config/frmSettings.Designer.cs +++ b/OccuRec/Config/frmSettings.Designer.cs @@ -28,158 +28,174 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("General"); - System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("NTP Timestamps"); - System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("Astro Analogue Video (AAV)", new System.Windows.Forms.TreeNode[] { + System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("General"); + System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("NTP Timestamps"); + System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("Astro Analogue Video (AAV)", new System.Windows.Forms.TreeNode[] { treeNode2}); - System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("Telescope"); - System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("Focusing"); - System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("Observatory Control", new System.Windows.Forms.TreeNode[] { + System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("Telescope"); + System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("Focusing"); + System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("Observatory Control", new System.Windows.Forms.TreeNode[] { treeNode4, treeNode5}); - System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("Tracking Engine"); - System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("Light Curve"); - System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("Spectroscopy"); - System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("Observing Aids", new System.Windows.Forms.TreeNode[] { + System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("Tracking Engine"); + System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("Light Curve"); + System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("Spectroscopy"); + System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("Bad Pixels"); + System.Windows.Forms.TreeNode treeNode11 = new System.Windows.Forms.TreeNode("Observing Aids", new System.Windows.Forms.TreeNode[] { treeNode7, treeNode8, - treeNode9}); - System.Windows.Forms.TreeNode treeNode11 = new System.Windows.Forms.TreeNode("Field Identification"); - System.Windows.Forms.TreeNode treeNode12 = new System.Windows.Forms.TreeNode("Advanced"); - System.Windows.Forms.TreeNode treeNode13 = new System.Windows.Forms.TreeNode("Debug"); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSettings)); - this.btnCancel = new System.Windows.Forms.Button(); - this.btnSave = new System.Windows.Forms.Button(); - this.btnResetDefaults = new System.Windows.Forms.Button(); - this.pnlPropertyPage = new System.Windows.Forms.Panel(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.tvSettings = new System.Windows.Forms.TreeView(); - this.SuspendLayout(); - // - // btnCancel - // - this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(581, 376); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(75, 23); - this.btnCancel.TabIndex = 1; - this.btnCancel.Text = "Cancel"; - this.btnCancel.UseVisualStyleBackColor = true; - this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); - // - // btnSave - // - this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnSave.Location = new System.Drawing.Point(500, 376); - this.btnSave.Name = "btnSave"; - this.btnSave.Size = new System.Drawing.Size(75, 23); - this.btnSave.TabIndex = 8; - this.btnSave.Text = "Save"; - this.btnSave.UseVisualStyleBackColor = true; - this.btnSave.Click += new System.EventHandler(this.btnOK_Click); - // - // btnResetDefaults - // - this.btnResetDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnResetDefaults.Location = new System.Drawing.Point(185, 376); - this.btnResetDefaults.Name = "btnResetDefaults"; - this.btnResetDefaults.Size = new System.Drawing.Size(106, 23); - this.btnResetDefaults.TabIndex = 20; - this.btnResetDefaults.Text = "Reset Defaults"; - this.btnResetDefaults.Click += new System.EventHandler(this.btnResetDefaults_Click); - // - // pnlPropertyPage - // - this.pnlPropertyPage.Location = new System.Drawing.Point(185, 12); - this.pnlPropertyPage.Name = "pnlPropertyPage"; - this.pnlPropertyPage.Size = new System.Drawing.Size(471, 349); - this.pnlPropertyPage.TabIndex = 17; - // - // groupBox2 - // - this.groupBox2.Location = new System.Drawing.Point(185, 367); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(471, 3); - this.groupBox2.TabIndex = 16; - this.groupBox2.TabStop = false; - // - // tvSettings - // - this.tvSettings.Location = new System.Drawing.Point(3, 11); - this.tvSettings.Name = "tvSettings"; - treeNode1.Name = "ndGeneral"; - treeNode1.Tag = "0"; - treeNode1.Text = "General"; - treeNode2.Name = "ndNTP"; - treeNode2.Tag = "2"; - treeNode2.Text = "NTP Timestamps"; - treeNode3.Name = "ndAAV"; - treeNode3.Tag = "1"; - treeNode3.Text = "Astro Analogue Video (AAV)"; - treeNode4.Name = "ndTelescope"; - treeNode4.Tag = "6"; - treeNode4.Text = "Telescope"; - treeNode5.Name = "ndFocusing"; - treeNode5.Tag = "7"; - treeNode5.Text = "Focusing"; - treeNode6.Name = "ndObservatoryControl"; - treeNode6.Tag = "3"; - treeNode6.Text = "Observatory Control"; - treeNode7.Name = "ndTrackingEngine"; - treeNode7.Tag = "8"; - treeNode7.Text = "Tracking Engine"; - treeNode8.Name = "ndLightCurve"; - treeNode8.Tag = "9"; - treeNode8.Text = "Light Curve"; - treeNode9.Name = "ndSpectroscopy"; - treeNode9.Tag = "12"; - treeNode9.Text = "Spectroscopy"; - treeNode10.Name = "ndObservingAids"; - treeNode10.Tag = "4"; - treeNode10.Text = "Observing Aids"; - treeNode11.Name = "ndPlateSolve"; - treeNode11.Tag = "10"; - treeNode11.Text = "Field Identification"; - treeNode12.Name = "ndAdvanced"; - treeNode12.Tag = "11"; - treeNode12.Text = "Advanced"; - treeNode13.Name = "ndDebug"; - treeNode13.Tag = "5"; - treeNode13.Text = "Debug"; - this.tvSettings.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { + treeNode9, + treeNode10}); + System.Windows.Forms.TreeNode treeNode12 = new System.Windows.Forms.TreeNode("Field Identification"); + System.Windows.Forms.TreeNode treeNode13 = new System.Windows.Forms.TreeNode("Advanced"); + System.Windows.Forms.TreeNode treeNode14 = new System.Windows.Forms.TreeNode("Debug"); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSettings)); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnSave = new System.Windows.Forms.Button(); + this.btnResetDefaults = new System.Windows.Forms.Button(); + this.pnlPropertyPage = new System.Windows.Forms.Panel(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.tvSettings = new System.Windows.Forms.TreeView(); + this.ucObservingAids1 = new OccuRec.Config.Panels.ucObservingAids(); + this.pnlPropertyPage.SuspendLayout(); + this.SuspendLayout(); + // + // btnCancel + // + this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(581, 376); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 1; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // btnSave + // + this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnSave.Location = new System.Drawing.Point(500, 376); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(75, 23); + this.btnSave.TabIndex = 8; + this.btnSave.Text = "Save"; + this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnOK_Click); + // + // btnResetDefaults + // + this.btnResetDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnResetDefaults.Location = new System.Drawing.Point(185, 376); + this.btnResetDefaults.Name = "btnResetDefaults"; + this.btnResetDefaults.Size = new System.Drawing.Size(106, 23); + this.btnResetDefaults.TabIndex = 20; + this.btnResetDefaults.Text = "Reset Defaults"; + this.btnResetDefaults.Click += new System.EventHandler(this.btnResetDefaults_Click); + // + // pnlPropertyPage + // + this.pnlPropertyPage.Controls.Add(this.ucObservingAids1); + this.pnlPropertyPage.Location = new System.Drawing.Point(185, 12); + this.pnlPropertyPage.Name = "pnlPropertyPage"; + this.pnlPropertyPage.Size = new System.Drawing.Size(471, 349); + this.pnlPropertyPage.TabIndex = 17; + // + // groupBox2 + // + this.groupBox2.Location = new System.Drawing.Point(185, 367); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(471, 3); + this.groupBox2.TabIndex = 16; + this.groupBox2.TabStop = false; + // + // tvSettings + // + this.tvSettings.Location = new System.Drawing.Point(3, 11); + this.tvSettings.Name = "tvSettings"; + treeNode1.Name = "ndGeneral"; + treeNode1.Tag = "0"; + treeNode1.Text = "General"; + treeNode2.Name = "ndNTP"; + treeNode2.Tag = "2"; + treeNode2.Text = "NTP Timestamps"; + treeNode3.Name = "ndAAV"; + treeNode3.Tag = "1"; + treeNode3.Text = "Astro Analogue Video (AAV)"; + treeNode4.Name = "ndTelescope"; + treeNode4.Tag = "6"; + treeNode4.Text = "Telescope"; + treeNode5.Name = "ndFocusing"; + treeNode5.Tag = "7"; + treeNode5.Text = "Focusing"; + treeNode6.Name = "ndObservatoryControl"; + treeNode6.Tag = "3"; + treeNode6.Text = "Observatory Control"; + treeNode7.Name = "ndTrackingEngine"; + treeNode7.Tag = "8"; + treeNode7.Text = "Tracking Engine"; + treeNode8.Name = "ndLightCurve"; + treeNode8.Tag = "9"; + treeNode8.Text = "Light Curve"; + treeNode9.Name = "ndSpectroscopy"; + treeNode9.Tag = "12"; + treeNode9.Text = "Spectroscopy"; + treeNode10.Name = "ndBadPixels"; + treeNode10.Tag = "13"; + treeNode10.Text = "Bad Pixels"; + treeNode11.Name = "ndObservingAids"; + treeNode11.Tag = "4"; + treeNode11.Text = "Observing Aids"; + treeNode12.Name = "ndPlateSolve"; + treeNode12.Tag = "10"; + treeNode12.Text = "Field Identification"; + treeNode13.Name = "ndAdvanced"; + treeNode13.Tag = "11"; + treeNode13.Text = "Advanced"; + treeNode14.Name = "ndDebug"; + treeNode14.Tag = "5"; + treeNode14.Text = "Debug"; + this.tvSettings.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { treeNode1, treeNode3, treeNode6, - treeNode10, treeNode11, treeNode12, - treeNode13}); - this.tvSettings.Size = new System.Drawing.Size(176, 359); - this.tvSettings.TabIndex = 15; - this.tvSettings.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvSettings_BeforeSelect); - this.tvSettings.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvSettings_AfterSelect); - // - // frmSettings - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(664, 405); - this.Controls.Add(this.btnResetDefaults); - this.Controls.Add(this.pnlPropertyPage); - this.Controls.Add(this.groupBox2); - this.Controls.Add(this.tvSettings); - this.Controls.Add(this.btnSave); - this.Controls.Add(this.btnCancel); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "frmSettings"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "OccuRec Settings"; - this.Load += new System.EventHandler(this.frmSettings_Load); - this.ResumeLayout(false); + treeNode13, + treeNode14}); + this.tvSettings.Size = new System.Drawing.Size(176, 359); + this.tvSettings.TabIndex = 15; + this.tvSettings.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvSettings_BeforeSelect); + this.tvSettings.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvSettings_AfterSelect); + // + // ucObservingAids1 + // + this.ucObservingAids1.Location = new System.Drawing.Point(48, 231); + this.ucObservingAids1.Name = "ucObservingAids1"; + this.ucObservingAids1.Size = new System.Drawing.Size(493, 289); + this.ucObservingAids1.TabIndex = 0; + // + // frmSettings + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(664, 405); + this.Controls.Add(this.btnResetDefaults); + this.Controls.Add(this.pnlPropertyPage); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.tvSettings); + this.Controls.Add(this.btnSave); + this.Controls.Add(this.btnCancel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "frmSettings"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "OccuRec Settings"; + this.Load += new System.EventHandler(this.frmSettings_Load); + this.pnlPropertyPage.ResumeLayout(false); + this.ResumeLayout(false); } @@ -191,5 +207,6 @@ private void InitializeComponent() private System.Windows.Forms.Panel pnlPropertyPage; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.TreeView tvSettings; - } + private Panels.ucObservingAids ucObservingAids1; + } } \ No newline at end of file diff --git a/OccuRec/Config/frmSettings.cs b/OccuRec/Config/frmSettings.cs index 6f78962..efa8eae 100644 --- a/OccuRec/Config/frmSettings.cs +++ b/OccuRec/Config/frmSettings.cs @@ -76,6 +76,7 @@ private void InitAllPropertyPages(bool canChangeGrabberSettings) m_PropertyPages.Add(10, new ucFieldIdentification()); m_PropertyPages.Add(11, new ucAdvanced()); m_PropertyPages.Add(12, new ucSpectroscopy()); + m_PropertyPages.Add(13, new ucBadPixels()); #if !DEBUG tvSettings.Nodes.RemoveByKey("ndDebug"); diff --git a/OccuRec/Helpers/OverlayManager.cs b/OccuRec/Helpers/OverlayManager.cs index f79acca..076cc84 100644 --- a/OccuRec/Helpers/OverlayManager.cs +++ b/OccuRec/Helpers/OverlayManager.cs @@ -47,6 +47,8 @@ public class OverlayManager private static Pen m_LocationCrossPen = new Pen(Color.FromArgb(90, 255, 0, 0)); private static Pen[] m_GreyPens = new Pen[256]; + private static Pen m_LocationBadPixelPen = new Pen(Color.FromArgb(90, 255, 0, 0)); + private object syncRoot = new object(); private int m_NumCheckedSpectraFrames; @@ -259,6 +261,68 @@ public void ProcessFrame(Graphics g, VideoFrameWrapper frame) g.DrawEllipse(m_LocationCrossPen, Settings.Default.LocationCrossX - 6, Settings.Default.LocationCrossY - 6, 12, 12); } + if (Settings.Default.DisplayBadPixelsMarkers) + { + Pen contrastingColourPen = m_LocationBadPixelPen; + // lookup the display mode and change the pen colour from red to blue if in 'Hue Intensity'and not 'Inverted' as this combination has a predominantly red background. + if (Settings.Default.UseHueIntensityDisplayMode && !Settings.Default.UseInvertedDisplayMode) + contrastingColourPen = new Pen(Color.FromArgb(90, 0, 0, 255)); + + int dx = (int)Settings.Default.BadPixelsMarkerSize; + int dy = (int)Settings.Default.BadPixelsMarkerSize; + + // figure out if to display the markers or not in this frame for blinking markers + long frameCount; + long quotient, remainder; + + if (Settings.Default.BadPixelsMarkerBlinking) + { + // once every 25 frames change state (blink) + frameCount = frame.FrameNumber; + quotient = Math.DivRem(frameCount, 25, out remainder); + // odd or even? + quotient = Math.DivRem(quotient, 2, out remainder); + } + else remainder = 1; // 'Blinking' not selected so always draw the markers + + if (remainder == 1) // draw the markers + { + if (Settings.Default.BadPixelsMarkerShapePlus) + { + foreach (Point badPixel in frmMain.s_BadPixels) + { + int x0 = badPixel.X; + int y0 = badPixel.Y; + g.DrawLine(contrastingColourPen, x0 - dx, y0, x0 + dx, y0); + g.DrawLine(contrastingColourPen, x0, y0 - dy, x0, y0 + dy); + } + + } + else if (Settings.Default.BadPixelsMarkerShapeCross) + { + foreach (Point badPixel in frmMain.s_BadPixels) + { + int x0 = badPixel.X; + int y0 = badPixel.Y; + g.DrawLine(contrastingColourPen, x0 - dx, y0 - dy, x0 + dx, y0 + dy); + g.DrawLine(contrastingColourPen, x0 + dy, y0 - dy, x0 - dy, y0 + dy); + } + } + else if (Settings.Default.BadPixelsMarkerShapeCircle) + { + foreach (Point badPixel in frmMain.s_BadPixels) + { + int x0 = badPixel.X; + int y0 = badPixel.Y; + g.DrawEllipse(contrastingColourPen, x0 - dx, y0 - dy, 2 * dx, 2 * dy); + } + } + } + + + + } + if (frame != null) { if (exposureTimeSupported) diff --git a/OccuRec/OccuRec.csproj b/OccuRec/OccuRec.csproj index 4abc4fe..381f4ba 100644 --- a/OccuRec/OccuRec.csproj +++ b/OccuRec/OccuRec.csproj @@ -116,6 +116,12 @@ + + UserControl + + + ucBadPixels.cs + UserControl @@ -401,6 +407,9 @@ frmWAT910BDConnectionSettings.cs + + ucBadPixels.cs + ucSpectroscopy.cs @@ -513,6 +522,8 @@ + + diff --git a/OccuRec/Properties/Settings.Designer.cs b/OccuRec/Properties/Settings.Designer.cs index d419fb7..b992144 100644 --- a/OccuRec/Properties/Settings.Designer.cs +++ b/OccuRec/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace OccuRec.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -1702,5 +1702,101 @@ public bool DisableFieldNoCheck { this["DisableFieldNoCheck"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string BadPixelsFileName { + get { + return ((string)(this["BadPixelsFileName"])); + } + set { + this["BadPixelsFileName"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool EnableBadPixelsControl { + get { + return ((bool)(this["EnableBadPixelsControl"])); + } + set { + this["EnableBadPixelsControl"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool BadPixelsMarkerShapePlus { + get { + return ((bool)(this["BadPixelsMarkerShapePlus"])); + } + set { + this["BadPixelsMarkerShapePlus"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool BadPixelsMarkerShapeCross { + get { + return ((bool)(this["BadPixelsMarkerShapeCross"])); + } + set { + this["BadPixelsMarkerShapeCross"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool BadPixelsMarkerShapeCircle { + get { + return ((bool)(this["BadPixelsMarkerShapeCircle"])); + } + set { + this["BadPixelsMarkerShapeCircle"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("8")] + public decimal BadPixelsMarkerSize { + get { + return ((decimal)(this["BadPixelsMarkerSize"])); + } + set { + this["BadPixelsMarkerSize"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool BadPixelsMarkerBlinking { + get { + return ((bool)(this["BadPixelsMarkerBlinking"])); + } + set { + this["BadPixelsMarkerBlinking"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool DisplayBadPixelsMarkers { + get { + return ((bool)(this["DisplayBadPixelsMarkers"])); + } + set { + this["DisplayBadPixelsMarkers"] = value; + } + } } } diff --git a/OccuRec/Properties/Settings.settings b/OccuRec/Properties/Settings.settings index bf867c9..c068267 100644 --- a/OccuRec/Properties/Settings.settings +++ b/OccuRec/Properties/Settings.settings @@ -422,5 +422,29 @@ False + + + + + False + + + True + + + False + + + False + + + 8 + + + True + + + False + \ No newline at end of file diff --git a/OccuRec/app.config b/OccuRec/app.config index d515597..acc0e7b 100644 --- a/OccuRec/app.config +++ b/OccuRec/app.config @@ -428,6 +428,30 @@ False + + + + + False + + + True + + + False + + + False + + + 8 + + + True + + + False + diff --git a/OccuRec/frmMain.Designer.cs b/OccuRec/frmMain.Designer.cs index 855a4f0..5f74389 100644 --- a/OccuRec/frmMain.Designer.cs +++ b/OccuRec/frmMain.Designer.cs @@ -100,6 +100,7 @@ private void InitializeComponent() this.btnUpdateVtiOsd = new System.Windows.Forms.Button(); this.btnConfirmUserVtiOsd = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); + this.ucVideoControl = new OccuRec.Controls.ucCameraControl(); this.timerScheduler = new System.Windows.Forms.Timer(this.components); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.tsbConnectDisconnect = new System.Windows.Forms.ToolStripButton(); @@ -109,6 +110,7 @@ private void InitializeComponent() this.tbsAddTarget = new System.Windows.Forms.ToolStripButton(); this.tbsInsertSpectra = new System.Windows.Forms.ToolStripButton(); this.tbsClearTargets = new System.Windows.Forms.ToolStripLabel(); + this.tsbAddBadPixelMarkers = new System.Windows.Forms.ToolStripButton(); this.tssToolBorder = new System.Windows.Forms.ToolStripSeparator(); this.tsbTelControl = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); @@ -120,7 +122,6 @@ private void InitializeComponent() this.pnlControlArea = new System.Windows.Forms.Panel(); this.imageListToolbar = new System.Windows.Forms.ImageList(this.components); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); - this.ucVideoControl = new OccuRec.Controls.ucCameraControl(); this.restartRecTimer = new System.Windows.Forms.Timer(this.components); this.statusStrip.SuspendLayout(); this.msMain.SuspendLayout(); @@ -375,7 +376,7 @@ private void InitializeComponent() | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right) | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom))); this.tssRecordingFile.Name = "tssRecordingFile"; - this.tssRecordingFile.Size = new System.Drawing.Size(76, 19); + this.tssRecordingFile.Size = new System.Drawing.Size(79, 19); this.tssRecordingFile.Text = "File (xxx Mb)"; this.tssRecordingFile.Visible = false; // @@ -387,7 +388,7 @@ private void InitializeComponent() | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom))); this.tssFreeDiskSpace.ForeColor = System.Drawing.Color.Yellow; this.tssFreeDiskSpace.Name = "tssFreeDiskSpace"; - this.tssFreeDiskSpace.Size = new System.Drawing.Size(70, 19); + this.tssFreeDiskSpace.Size = new System.Drawing.Size(73, 19); this.tssFreeDiskSpace.Text = "xxx Mb free"; this.tssFreeDiskSpace.Visible = false; // @@ -981,6 +982,15 @@ private void InitializeComponent() this.label4.TabIndex = 15; this.label4.Text = "VTI-OSD Position"; // + // ucVideoControl + // + this.ucVideoControl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.ucVideoControl.Location = new System.Drawing.Point(4, 182); + this.ucVideoControl.Name = "ucVideoControl"; + this.ucVideoControl.Size = new System.Drawing.Size(190, 86); + this.ucVideoControl.TabIndex = 27; + this.ucVideoControl.Visible = false; + // // timerScheduler // this.timerScheduler.Enabled = true; @@ -997,6 +1007,7 @@ private void InitializeComponent() this.tbsAddTarget, this.tbsInsertSpectra, this.tbsClearTargets, + this.tsbAddBadPixelMarkers, this.tssToolBorder, this.tsbTelControl, this.toolStripSeparator5, @@ -1076,6 +1087,16 @@ private void InitializeComponent() this.tbsClearTargets.ToolTipText = "Remove Tracked Objects"; this.tbsClearTargets.Click += new System.EventHandler(this.tsbClearTargets_Click); // + // tsbAddBadPixelMarkers + // + this.tsbAddBadPixelMarkers.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tsbAddBadPixelMarkers.Image = ((System.Drawing.Image)(resources.GetObject("tsbAddBadPixelMarkers.Image"))); + this.tsbAddBadPixelMarkers.ImageTransparentColor = System.Drawing.Color.Magenta; + this.tsbAddBadPixelMarkers.Name = "tsbAddBadPixelMarkers"; + this.tsbAddBadPixelMarkers.Size = new System.Drawing.Size(23, 22); + this.tsbAddBadPixelMarkers.ToolTipText = "Overlay the bad pixels locations on the video"; + this.tsbAddBadPixelMarkers.Click += new System.EventHandler(this.tsbAddBadPixelMarkers_Click); + // // tssToolBorder // this.tssToolBorder.Name = "tssToolBorder"; @@ -1087,7 +1108,7 @@ private void InitializeComponent() this.tsbTelControl.Image = ((System.Drawing.Image)(resources.GetObject("tsbTelControl.Image"))); this.tsbTelControl.ImageTransparentColor = System.Drawing.Color.Magenta; this.tsbTelControl.Name = "tsbTelControl"; - this.tsbTelControl.Size = new System.Drawing.Size(106, 22); + this.tsbTelControl.Size = new System.Drawing.Size(105, 22); this.tsbTelControl.Text = "Control Telescope"; this.tsbTelControl.Click += new System.EventHandler(this.tsbTelControl_Click); // @@ -1148,21 +1169,14 @@ private void InitializeComponent() this.imageListToolbar.TransparentColor = System.Drawing.Color.Transparent; this.imageListToolbar.Images.SetKeyName(0, "Camera-Transparent-32x32.png"); this.imageListToolbar.Images.SetKeyName(1, "Camera-Transparent-32x32-Disc.png"); + this.imageListToolbar.Images.SetKeyName(2, "Overlay-Bad-Pixel-Markers-Start 16x16.png"); + this.imageListToolbar.Images.SetKeyName(3, "Overlay-Bad-Pixel-Markers-Stop 16x16.png"); // // openFileDialog // this.openFileDialog.DefaultExt = "avi"; this.openFileDialog.Filter = "Support Video Files (*.avi)|*.avi"; // - // ucVideoControl - // - this.ucVideoControl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.ucVideoControl.Location = new System.Drawing.Point(4, 182); - this.ucVideoControl.Name = "ucVideoControl"; - this.ucVideoControl.Size = new System.Drawing.Size(190, 86); - this.ucVideoControl.TabIndex = 27; - this.ucVideoControl.Visible = false; - // // restartRecTimer // this.restartRecTimer.Tick += new System.EventHandler(this.restartRecTimer_Tick); @@ -1322,6 +1336,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem miReleaseNotes; protected internal System.Windows.Forms.ToolStripMenuItem tsmiSaturation; private System.Windows.Forms.Timer restartRecTimer; - } + private System.Windows.Forms.ToolStripButton tsbAddBadPixelMarkers; + } } diff --git a/OccuRec/frmMain.cs b/OccuRec/frmMain.cs index 3a55f94..59b0554 100644 --- a/OccuRec/frmMain.cs +++ b/OccuRec/frmMain.cs @@ -56,10 +56,12 @@ public partial class frmMain : Form, IVideoCallbacks private OverlayManager m_OverlayManager = null; private List initializationErrorMessages = new List(); + public static List s_BadPixels = new List(); + private VideoFrameInteractionController m_VideoFrameInteractionController; private VideoRenderingController m_VideoRenderingController; - - public frmMain() + + public frmMain() { InitializeComponent(); @@ -78,6 +80,8 @@ public frmMain() m_ObservatoryController.VideoStateUpdated += VideoStateUpdated; m_ObservatoryController.VideoError += VideoError; + tsbAddBadPixelMarkers.Visible = false; + m_AnalysisManager = new FrameAnalysisManager(m_ObservatoryController); m_VideoRenderingController = new VideoRenderingController(this, m_StateManager, m_AnalysisManager); m_VideoFrameInteractionController = new VideoFrameInteractionController(this, m_VideoRenderingController); @@ -711,10 +715,10 @@ private void UpdateState(VideoFrameWrapper frame) // It is possible this method to be called during Disposing and we don't need to do anything in that case return; - // TODO: Many of things below only change their state when something changes. Rather than always resetting their state with each rendered frame, we should really - // use events to update the state! + // TODO: Many of things below only change their state when something changes. Rather than always resetting their state with each rendered frame, we should really + // use events to update the state! - if (ChangedToDisconnectedState()) + if (ChangedToDisconnectedState()) { tssCameraState.Text = "Disconnected"; tssFrameNo.Text = string.Empty; @@ -732,6 +736,7 @@ private void UpdateState(VideoFrameWrapper frame) tsbAddGuidingStar.Visible = false; tbsInsertSpectra.Visible = false; tbsClearTargets.Visible = false; + tsbAddBadPixelMarkers.Visible = false; tssToolBorder.Visible = false; //tsbCamControl.Enabled = false; @@ -748,8 +753,10 @@ private void UpdateState(VideoFrameWrapper frame) tbsClearTargets.Enabled = false; tsbAddGuidingStar.Enabled = true; tbsInsertSpectra.Enabled = true; - - TrackingContext.Current.Reset(); + tsbAddBadPixelMarkers.Enabled = Settings.Default.EnableBadPixelsControl; + tsbAddBadPixelMarkers.Visible = Settings.Default.EnableBadPixelsControl; + + TrackingContext.Current.Reset(); TrackingContext.Current.ReConfigureNativeTracking(videoObject.Width, videoObject.Height); //tsbCamControl.Enabled = CameraSupportsSoftwareControl(); @@ -1709,7 +1716,8 @@ private void btnManualIntegration_Click(object sender, EventArgs e) private void frmMain_Load(object sender, EventArgs e) { - if (Settings.Default.WarnForFileSystemIssues) + + if (Settings.Default.WarnForFileSystemIssues) { if (Directory.Exists(Settings.Default.OutputLocation)) { @@ -2130,7 +2138,20 @@ private void UpdateObservingAidControls() tbsInsertSpectra.Visible = false; m_VideoFrameInteractionController.RemoveTrackedObjects(); } - } + + if (Settings.Default.EnableBadPixelsControl) + { + if (videoObject != null) + tsbAddBadPixelMarkers.Enabled = true; + tsbAddBadPixelMarkers.Visible = true; + } + else + { + tsbAddBadPixelMarkers.Enabled = false; + tsbAddBadPixelMarkers.Visible = false; + } + + } private void frmMain_Shown(object sender, EventArgs e) { @@ -2351,5 +2372,143 @@ private void restartRecTimer_Tick(object sender, EventArgs e) string fileName = FileNameGenerator.GenerateFileName(OccuRecContext.Current.IsAAV); recordingfileName = videoObject.StartRecording(fileName); } - } + + private void tsbAddBadPixelMarkers_Click(object sender, EventArgs e) + { + // toggle the state + Settings.Default.DisplayBadPixelsMarkers = !Settings.Default.DisplayBadPixelsMarkers; + + if (Settings.Default.DisplayBadPixelsMarkers) + { + // turn off so the bad pixels aren't displayed until the preparation has been finished + Settings.Default.DisplayBadPixelsMarkers = false; + + // check the bad pixel file still exists (in case it was moved/deleted since it was selected in the settings form by the user) + if (!File.Exists(Settings.Default.BadPixelsFileName)) + { + string caption = "Bad Pixels File Missing"; + string message = "The file containing the bad pixels specified in the OccuRec Settings>Observing Aids>Bad Pixels form no longer exists so OccuRec can't overlay any bad pixel markers."; + MessageBoxButtons messageBoxButtons = MessageBoxButtons.OK; + MessageBoxIcon messageBoxIcon = MessageBoxIcon.Warning; + MessageBox.Show(message, caption, messageBoxButtons, messageBoxIcon); + tsbAddBadPixelMarkers.Enabled = false; + tsbAddBadPixelMarkers.Visible = false; + Settings.Default.EnableBadPixelsControl = false; + return; + } + + s_BadPixels.Clear(); + try + { + StreamReader streamReader = new StreamReader(Settings.Default.BadPixelsFileName); + using (streamReader) + { + string line; + while ((line = streamReader.ReadLine()) != null) + { + try + { + string[] coordinatesString = line.Split(','); + int x = Convert.ToInt32(coordinatesString[0]); + int y = Convert.ToInt32(coordinatesString[1]); + + s_BadPixels.Add(new Point(x, y)); + } + catch (FormatException) + { + string caption = "Bad Pixels File: Format Exception"; + string message = String.Format("Failed to convert the line '{0}' to pixel coordinates as it was in the wrong format", line); + MessageBoxButtons messageBoxButtons = MessageBoxButtons.OK; + MessageBoxIcon messageBoxIcon = MessageBoxIcon.Warning; + MessageBox.Show(message, caption, messageBoxButtons, messageBoxIcon); + tsbAddBadPixelMarkers.Enabled = false; + tsbAddBadPixelMarkers.Visible = false; + Settings.Default.EnableBadPixelsControl = false; + return; + } + catch (IndexOutOfRangeException) + { + string caption = "Bad Pixels File: Missing Coordinate"; + string message = String.Format("Failed to convert the line '{0}' to pixel coordinates as it was in the wrong format", line); + MessageBoxButtons messageBoxButtons = MessageBoxButtons.OK; + MessageBoxIcon messageBoxIcon = MessageBoxIcon.Warning; + MessageBox.Show(message, caption, messageBoxButtons, messageBoxIcon); + tsbAddBadPixelMarkers.Enabled = false; + tsbAddBadPixelMarkers.Visible = false; + Settings.Default.EnableBadPixelsControl = false; + return; + } + } + } + } + catch (UnauthorizedAccessException) + { + string caption = "Bad Pixels File: Unauthorised Access"; + string message = "For some reason Windows won't allow OccuRec to access the Bad Pixels file."; + MessageBoxButtons messageBoxButtons = MessageBoxButtons.OK; + MessageBoxIcon messageBoxIcon = MessageBoxIcon.Warning; + MessageBox.Show(message, caption, messageBoxButtons, messageBoxIcon); + tsbAddBadPixelMarkers.Enabled = false; + tsbAddBadPixelMarkers.Visible = false; + Settings.Default.EnableBadPixelsControl = false; + return; + } + catch (IOException) + { + string caption = "Bad Pixels File: IO error"; + string message = "Something went wrong with reading the Bad Pixels file."; + MessageBoxButtons messageBoxButtons = MessageBoxButtons.OK; + MessageBoxIcon messageBoxIcon = MessageBoxIcon.Warning; + MessageBox.Show(message, caption, messageBoxButtons, messageBoxIcon); + tsbAddBadPixelMarkers.Enabled = false; + tsbAddBadPixelMarkers.Visible = false; + Settings.Default.EnableBadPixelsControl = false; + return; + } + + // check there has been at least one successful bad pixel read from the file + if (s_BadPixels.Count < 1) + { + string caption = "Bad Pixels File is empty"; + string message = "The bad pixels file doesn't have the coordinates of any bad pixels in it."; + MessageBoxButtons messageBoxButtons = MessageBoxButtons.OK; + MessageBoxIcon messageBoxIcon = MessageBoxIcon.Warning; + MessageBox.Show(message, caption, messageBoxButtons, messageBoxIcon); + tsbAddBadPixelMarkers.Enabled = false; + tsbAddBadPixelMarkers.Visible = false; + Settings.Default.EnableBadPixelsControl = false; + return; + } + + foreach (Point badPixel in s_BadPixels) + { + if (badPixel.X < 0 || badPixel.Y < 0 || badPixel.X > imageWidth || badPixel.Y > imageHeight) + { + string caption = "Bad Pixels File: invalid coordinates"; + string message = String.Format("The bad pixels file has some coordinates ({0},{1}) outside the image.", badPixel.X, badPixel.Y); + MessageBoxButtons messageBoxButtons = MessageBoxButtons.OK; + MessageBoxIcon messageBoxIcon = MessageBoxIcon.Warning; + MessageBox.Show(message, caption, messageBoxButtons, messageBoxIcon); + tsbAddBadPixelMarkers.Enabled = false; + tsbAddBadPixelMarkers.Visible = false; + Settings.Default.EnableBadPixelsControl = false; + return; + } + } + + tsbAddBadPixelMarkers.ToolTipText = "Stop overlaying the bad pixels locations on the video"; + tsbAddBadPixelMarkers.Image = imageListToolbar.Images[3]; + + // turn back on now that the preparation has been finished + Settings.Default.DisplayBadPixelsMarkers = true; + } + else + { + s_BadPixels.Clear(); + + tsbAddBadPixelMarkers.ToolTipText = "Overlay the bad pixels locations on the video"; + tsbAddBadPixelMarkers.Image = imageListToolbar.Images[2]; + } + } + } } diff --git a/OccuRec/frmMain.resx b/OccuRec/frmMain.resx index 9e35e8a..5b66790 100644 --- a/OccuRec/frmMain.resx +++ b/OccuRec/frmMain.resx @@ -234,6 +234,19 @@ wNJycckphD2C95Ctxkw6Y/jMYpFmGB6T/2w/uWETIppVBzND0x2wfkxxjAGxDeh7A5Dec47hfsb7esFr ucApdbfpfQFmuzZD/gJwASEygOUSwAXM5QUslwAuYC5/geUSwAXM5RvkJRULGaIekeWaBeYSwLPAXAJ4 FphLAM8CcwngWWAuATwLzCXAaAs1wGgLNcCvBcMHAEAa6omDukoAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGuSURBVDhPhVNdSwJBFN33/k9/Rd0dXQKVoLCwwsiUwI8e + o4ggMqiX6CWIqKCoiNJVNyqzh+g7KsryJT96k25zZ3eHHdfowoHl3nPOzJyZldpL83i684qSycnyQ56Q + FoJ90x7OTJqzSoR05WV5OUfIDxVBJ7AZ5SDXlBnFxIqitQteViJwOd4r9BgoVzBBVweJ4nMrBs2zNFwl + +xwz1DAxnqvTtvWACo2TFHyfT0JNS0BB9Qpz1LBMMBz7gMFH4H1tjIktlIYDIgdBtZKZNm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AcABAAHABQAB4AEAAeAFAAH8 + AQEB/AEBAYABAQGAAQEB/wGfAf8BmQGAAQEBgAEBA/8B/AHAAQMBwAEAA/8B/gHwAQ8B8AEMCw== diff --git a/OccuRec/img/Overlay-Bad-Pixel-Markers-Start 16x16.png b/OccuRec/img/Overlay-Bad-Pixel-Markers-Start 16x16.png new file mode 100644 index 0000000..2853c41 Binary files /dev/null and b/OccuRec/img/Overlay-Bad-Pixel-Markers-Start 16x16.png differ diff --git a/OccuRec/img/Overlay-Bad-Pixel-Markers-Stop 16x16.png b/OccuRec/img/Overlay-Bad-Pixel-Markers-Stop 16x16.png new file mode 100644 index 0000000..f896e9a Binary files /dev/null and b/OccuRec/img/Overlay-Bad-Pixel-Markers-Stop 16x16.png differ