From 54609d3568b012005e15076959d44a6b47fed337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Concei=C3=A7=C3=A3o?= Date: Thu, 10 Sep 2020 20:32:51 +0100 Subject: [PATCH] Add verbose log and advanced options for Morph --- .../CtrlToolWindowContent.Designer.cs | 1 + .../Controls/Tools/CtrlToolBlur.Designer.cs | 9 +++---- UVtools.GUI/Controls/Tools/CtrlToolBlur.cs | 2 +- .../Controls/Tools/CtrlToolMorph.Designer.cs | 12 ++++++---- UVtools.GUI/Controls/Tools/CtrlToolMorph.cs | 10 ++++++++ UVtools.GUI/FrmMain.Designer.cs | 24 ++++++++++++++++++- UVtools.GUI/FrmMain.cs | 16 +++++++++---- UVtools.GUI/FrmMain.resx | 19 +++++++++++++-- 8 files changed, 76 insertions(+), 17 deletions(-) diff --git a/UVtools.GUI/Controls/CtrlToolWindowContent.Designer.cs b/UVtools.GUI/Controls/CtrlToolWindowContent.Designer.cs index 905dca7..b57116b 100644 --- a/UVtools.GUI/Controls/CtrlToolWindowContent.Designer.cs +++ b/UVtools.GUI/Controls/CtrlToolWindowContent.Designer.cs @@ -44,6 +44,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.BackColor = System.Drawing.Color.White; this.MinimumSize = new System.Drawing.Size(540, 0); this.Name = "CtrlToolWindowContent"; diff --git a/UVtools.GUI/Controls/Tools/CtrlToolBlur.Designer.cs b/UVtools.GUI/Controls/Tools/CtrlToolBlur.Designer.cs index ca74d07..ffe07fd 100644 --- a/UVtools.GUI/Controls/Tools/CtrlToolBlur.Designer.cs +++ b/UVtools.GUI/Controls/Tools/CtrlToolBlur.Designer.cs @@ -39,13 +39,13 @@ // // ctrlKernel // - this.ctrlKernel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.ctrlKernel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.ctrlKernel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.ctrlKernel.Location = new System.Drawing.Point(3, 80); + this.ctrlKernel.Location = new System.Drawing.Point(3, 78); this.ctrlKernel.Name = "ctrlKernel"; this.ctrlKernel.Size = new System.Drawing.Size(585, 217); this.ctrlKernel.TabIndex = 22; + this.ctrlKernel.Visible = false; // // label1 // @@ -100,6 +100,7 @@ // CtrlToolBlur // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoSize = true; this.Controls.Add(this.label1); this.Controls.Add(this.cbBlurOperation); this.Controls.Add(this.nmSize); @@ -107,7 +108,7 @@ this.Controls.Add(this.ctrlKernel); this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Name = "CtrlToolBlur"; - this.Size = new System.Drawing.Size(596, 309); + this.Size = new System.Drawing.Size(591, 298); ((System.ComponentModel.ISupportInitialize)(this.nmSize)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/UVtools.GUI/Controls/Tools/CtrlToolBlur.cs b/UVtools.GUI/Controls/Tools/CtrlToolBlur.cs index 606f2d4..c5bda85 100644 --- a/UVtools.GUI/Controls/Tools/CtrlToolBlur.cs +++ b/UVtools.GUI/Controls/Tools/CtrlToolBlur.cs @@ -42,7 +42,7 @@ namespace UVtools.GUI.Controls.Tools private void cbBlurOperation_SelectedIndexChanged(object sender, System.EventArgs e) { UpdateOperation(); - ctrlKernel.Enabled = Operation.BlurOperation == OperationBlur.BlurAlgorithm.Filter2D; + ctrlKernel.Visible = ctrlKernel.Enabled = Operation.BlurOperation == OperationBlur.BlurAlgorithm.Filter2D; nmSize.Enabled = Operation.BlurOperation != OperationBlur.BlurAlgorithm.Pyramid && Operation.BlurOperation != OperationBlur.BlurAlgorithm.Filter2D; } } diff --git a/UVtools.GUI/Controls/Tools/CtrlToolMorph.Designer.cs b/UVtools.GUI/Controls/Tools/CtrlToolMorph.Designer.cs index 20c3fcb..3342b61 100644 --- a/UVtools.GUI/Controls/Tools/CtrlToolMorph.Designer.cs +++ b/UVtools.GUI/Controls/Tools/CtrlToolMorph.Designer.cs @@ -43,13 +43,13 @@ // // ctrlKernel // - this.ctrlKernel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.ctrlKernel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.ctrlKernel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.ctrlKernel.Location = new System.Drawing.Point(3, 87); this.ctrlKernel.Name = "ctrlKernel"; - this.ctrlKernel.Size = new System.Drawing.Size(585, 217); + this.ctrlKernel.Size = new System.Drawing.Size(580, 217); this.ctrlKernel.TabIndex = 22; + this.ctrlKernel.Visible = false; // // cbIterationsFade // @@ -139,9 +139,10 @@ this.label1.TabIndex = 24; this.label1.Text = "Operation:"; // - // CtrlToolMorphModel + // CtrlToolMorph // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoSize = true; this.Controls.Add(this.label1); this.Controls.Add(this.cbMorphOperation); this.Controls.Add(this.ctrlKernel); @@ -150,9 +151,10 @@ this.Controls.Add(this.lbIterationsStop); this.Controls.Add(this.nmIterationsStart); this.Controls.Add(this.lbIterationsStart); + this.ExtraCheckboxVisible = true; this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Name = "CtrlToolMorph"; - this.Size = new System.Drawing.Size(596, 307); + this.Size = new System.Drawing.Size(591, 307); ((System.ComponentModel.ISupportInitialize)(this.nmIterationsEnd)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nmIterationsStart)).EndInit(); this.ResumeLayout(false); diff --git a/UVtools.GUI/Controls/Tools/CtrlToolMorph.cs b/UVtools.GUI/Controls/Tools/CtrlToolMorph.cs index 62046d2..72b34eb 100644 --- a/UVtools.GUI/Controls/Tools/CtrlToolMorph.cs +++ b/UVtools.GUI/Controls/Tools/CtrlToolMorph.cs @@ -7,6 +7,7 @@ */ using System; +using System.Windows.Forms; using Emgu.CV.CvEnum; using UVtools.Core.Objects; using UVtools.Core.Operations; @@ -42,6 +43,15 @@ namespace UVtools.GUI.Controls.Tools return true; } + public override void ExtraActionCall(object sender) + { + if (sender is CheckBox checkbox) + { + ctrlKernel.Visible = checkbox.Checked; + return; + } + } + private void EventCheckedChanged(object sender, EventArgs e) { if (ReferenceEquals(sender, cbIterationsFade)) diff --git a/UVtools.GUI/FrmMain.Designer.cs b/UVtools.GUI/FrmMain.Designer.cs index dc68ae5..3ec3868 100644 --- a/UVtools.GUI/FrmMain.Designer.cs +++ b/UVtools.GUI/FrmMain.Designer.cs @@ -236,6 +236,8 @@ namespace UVtools.GUI this.tsLog = new System.Windows.Forms.ToolStrip(); this.btnLogClear = new System.Windows.Forms.ToolStripButton(); this.lbLogOperations = new System.Windows.Forms.ToolStripLabel(); + this.toolStripSeparator26 = new System.Windows.Forms.ToolStripSeparator(); + this.btnLogVerbose = new System.Windows.Forms.ToolStripButton(); this.imageList16x16 = new System.Windows.Forms.ImageList(this.components); this.tlRight = new System.Windows.Forms.TableLayoutPanel(); this.btnPreviousLayer = new System.Windows.Forms.Button(); @@ -2568,7 +2570,9 @@ namespace UVtools.GUI this.tsLog.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; this.tsLog.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.btnLogClear, - this.lbLogOperations}); + this.lbLogOperations, + this.toolStripSeparator26, + this.btnLogVerbose}); this.tsLog.Location = new System.Drawing.Point(3, 3); this.tsLog.Name = "tsLog"; this.tsLog.Size = new System.Drawing.Size(380, 25); @@ -2592,6 +2596,22 @@ namespace UVtools.GUI this.lbLogOperations.Size = new System.Drawing.Size(77, 22); this.lbLogOperations.Text = "Operations: 0"; // + // toolStripSeparator26 + // + this.toolStripSeparator26.Name = "toolStripSeparator26"; + this.toolStripSeparator26.Size = new System.Drawing.Size(6, 25); + // + // btnLogVerbose + // + this.btnLogVerbose.CheckOnClick = true; + this.btnLogVerbose.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.btnLogVerbose.Image = ((System.Drawing.Image)(resources.GetObject("btnLogVerbose.Image"))); + this.btnLogVerbose.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btnLogVerbose.Name = "btnLogVerbose"; + this.btnLogVerbose.Size = new System.Drawing.Size(52, 22); + this.btnLogVerbose.Text = "Verbose"; + this.btnLogVerbose.ToolTipText = "Shows extra information usefull to debug problems"; + // // imageList16x16 // this.imageList16x16.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList16x16.ImageStream"))); @@ -3140,6 +3160,8 @@ namespace UVtools.GUI private System.Windows.Forms.ToolStripMenuItem tsIssuesDetectTouchingBounds; private System.Windows.Forms.PictureBox pbTrackerIssues; private System.Windows.Forms.ToolStripSplitButton btnLayerImageActions; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator26; + private System.Windows.Forms.ToolStripButton btnLogVerbose; } } diff --git a/UVtools.GUI/FrmMain.cs b/UVtools.GUI/FrmMain.cs index 22435f3..f5c0c0b 100644 --- a/UVtools.GUI/FrmMain.cs +++ b/UVtools.GUI/FrmMain.cs @@ -123,6 +123,8 @@ namespace UVtools.GUI private bool SupressLayerZoomEvent { get; set; } + public bool IsLogVerbose => btnLogVerbose.Checked; + #endregion #region Constructors @@ -1218,7 +1220,7 @@ namespace UVtools.GUI UpdateIslands(whiteListLayers); } - ShowLayer(); + //ShowLayer(); // It will call latter so its a extra call UpdateIssuesInfo(); menuFileSave.Enabled = menuFileSaveAs.Enabled = true; @@ -1511,14 +1513,13 @@ namespace UVtools.GUI //MessageBox.Show("Convertion was unsuccessful! Maybe not implemented...", "Convertion unsuccessful", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - } } private void pbLayer_Zoomed(object sender, Cyotek.Windows.Forms.ImageBoxZoomEventArgs e) { if (SupressLayerZoomEvent) return; - Debug.WriteLine($"{DateTime.Now.Ticks}: Zoomed"); + AddLogVerbose($"Zoomed from {e.OldZoom} to {e.NewZoom}"); // Update zoom level display in the toolstrip if (e.NewZoom == LockedZoomLevel) { @@ -2221,7 +2222,7 @@ namespace UVtools.GUI if (IsChangingLayer) return; IsChangingLayer = true; - Debug.WriteLine($"Show Layer: {layerNum}"); + AddLogVerbose($"Show Layer: {layerNum}"); ActualLayer = layerNum; btnLastLayer.Enabled = btnNextLayer.Enabled = layerNum < SlicerFile.LayerCount - 1; @@ -3668,6 +3669,13 @@ namespace UVtools.GUI lbLogOperations.Text = $"Operations: {count}"; } + public void AddLogVerbose(string description, decimal elapsedTime = 0) + { + if (!IsLogVerbose) return; + AddLog(description, elapsedTime); + Debug.WriteLine(description); + } + public void EditLastLogElapsedTime(decimal elapsedTime = 0) { if (lvLog.GetModelObject(lvLog.GetItemCount() - 1) is LogItem log) log.ElapsedTime = elapsedTime; diff --git a/UVtools.GUI/FrmMain.resx b/UVtools.GUI/FrmMain.resx index 5cc8edd..5fd05a4 100644 --- a/UVtools.GUI/FrmMain.resx +++ b/UVtools.GUI/FrmMain.resx @@ -150,6 +150,22 @@ 1587, 17 + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgP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