From ca21c4392616be32ba0b244985972a52927ceadd Mon Sep 17 00:00:00 2001 From: Anton Mukhin Date: Tue, 27 May 2025 12:09:55 +0300 Subject: [PATCH] TODO features: - Move Select and Baseline buttons right - Display RectSelection width and width --- McBitFont/Form1.Designer.cs | 36 +++++++++++++++++++++++++++++++++--- McBitFont/Form1.cs | 21 ++++++++++++++++++--- McBitFont/McBitFont.csproj | 6 +++--- TODO.txt | 2 ++ 4 files changed, 56 insertions(+), 9 deletions(-) diff --git a/McBitFont/Form1.Designer.cs b/McBitFont/Form1.Designer.cs index 14f469d..5163344 100644 --- a/McBitFont/Form1.Designer.cs +++ b/McBitFont/Form1.Designer.cs @@ -103,6 +103,8 @@ chkHexCodes = new System.Windows.Forms.CheckBox(); chkRectSelect = new System.Windows.Forms.CheckBox(); label3 = new System.Windows.Forms.Label(); + lblSelectionLabel = new System.Windows.Forms.Label(); + lblSelection = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)nudX).BeginInit(); ((System.ComponentModel.ISupportInitialize)nudY).BeginInit(); panel1.SuspendLayout(); @@ -889,7 +891,7 @@ btnBaseline.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; btnBaseline.Image = Properties.Resources.fam_base; btnBaseline.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - btnBaseline.Location = new System.Drawing.Point(718, 92); + btnBaseline.Location = new System.Drawing.Point(812, 93); btnBaseline.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); btnBaseline.Name = "btnBaseline"; btnBaseline.Size = new System.Drawing.Size(88, 27); @@ -951,9 +953,9 @@ chkRectSelect.Appearance = System.Windows.Forms.Appearance.Button; chkRectSelect.Image = Properties.Resources.fam_rectt; chkRectSelect.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - chkRectSelect.Location = new System.Drawing.Point(620, 92); + chkRectSelect.Location = new System.Drawing.Point(718, 93); chkRectSelect.Name = "chkRectSelect"; - chkRectSelect.Size = new System.Drawing.Size(74, 27); + chkRectSelect.Size = new System.Drawing.Size(87, 27); chkRectSelect.TabIndex = 23; chkRectSelect.Text = " Select"; chkRectSelect.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -972,11 +974,37 @@ label3.TabIndex = 21; label3.Text = "Cursor:"; // + // lblSelectionLabel + // + lblSelectionLabel.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; + lblSelectionLabel.AutoSize = true; + lblSelectionLabel.Location = new System.Drawing.Point(616, 93); + lblSelectionLabel.Name = "lblSelectionLabel"; + lblSelectionLabel.Size = new System.Drawing.Size(58, 15); + lblSelectionLabel.TabIndex = 25; + lblSelectionLabel.Text = "Selection:"; + lblSelectionLabel.Visible = false; + // + // lblSelection + // + lblSelection.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; + lblSelection.AutoSize = true; + lblSelection.Location = new System.Drawing.Point(617, 108); + lblSelection.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + lblSelection.Name = "lblSelection"; + lblSelection.Size = new System.Drawing.Size(30, 15); + lblSelection.TabIndex = 24; + lblSelection.Text = "W,H"; + lblSelection.TextAlign = System.Drawing.ContentAlignment.TopRight; + lblSelection.Visible = false; + // // MainForm // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; ClientSize = new System.Drawing.Size(915, 647); + Controls.Add(lblSelectionLabel); + Controls.Add(lblSelection); Controls.Add(chkRectSelect); Controls.Add(chkHexCodes); Controls.Add(label3); @@ -1099,6 +1127,8 @@ private System.Windows.Forms.CheckBox chkRectSelect; private System.Windows.Forms.ToolStripMenuItem selectToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem importTextToolStripMenuItem1; + private System.Windows.Forms.Label lblSelectionLabel; + private System.Windows.Forms.Label lblSelection; } } diff --git a/McBitFont/Form1.cs b/McBitFont/Form1.cs index 55cdcc9..68286ee 100644 --- a/McBitFont/Form1.cs +++ b/McBitFont/Form1.cs @@ -57,7 +57,7 @@ namespace McBitFont { public bool monospaced = false; private bool modified = false; private bool prjModified = false; - public const string version = "2.1"; + public const string version = "2.2"; public string prjName = "Untitled"; public string prjFileName = ""; private int codepage = 1251; @@ -79,6 +79,10 @@ namespace McBitFont { h = pixelOffset + dotHeight * (cellSize + gap); } + private void UpdateSelectionLabel(int width, int height) { + lblSelection.Text = width.ToString() + ',' + height.ToString(); + } + private void Form1_Load(object sender, EventArgs e) { lblType.Text = monospaced ? "Monospaced" : "Variable width / Single"; tsmiMakeVarWidth.Visible = monospaced; @@ -88,6 +92,7 @@ namespace McBitFont { selection1 = new Point(0, 0); selection2 = new Point(dotWidth - 1, dotHeight - 1); + UpdateSelectionLabel(dotWidth, dotHeight); gap = (cellSize < 5) ? 0 : 1; SetNewWH(); @@ -240,8 +245,14 @@ namespace McBitFont { f = FrameResize(f, ww, hh); dotWidth = ww; dotHeight = hh; - if (selection2.X > dotWidth - 1) selection2.X = dotWidth - 1; - if (selection2.Y > dotHeight - 1) selection2.Y = dotHeight - 1; + if (selection2.X > dotWidth - 1) { + selection2.X = dotWidth - 1; + UpdateSelectionLabel(selection2.X - selection1.X + 1, selection2.Y - selection1.Y + 1); + } + if (selection2.Y > dotHeight - 1) { + selection2.Y = dotHeight - 1; + UpdateSelectionLabel(selection2.X - selection1.X + 1, selection2.Y - selection1.Y + 1); + } SetNewWH(); cbZoom_SelectedIndexChanged(cbZoom, null); @@ -456,6 +467,9 @@ namespace McBitFont { Point p1 = new(selection1.X, selection1.Y); Point p2 = new(selection2.X, selection2.Y); NormPoints(ref p1, ref p2); + + UpdateSelectionLabel(p2.X - p1.X + 1, p2.Y - p1.Y + 1); + x = pixelOffset + (p1.X - 1) * (cellSize + gap) - hScroll.Value - 1; y = pixelOffset + (p1.Y - 1) * (cellSize + gap) - vScroll.Value - 1; x2 = pixelOffset + (p2.X + 2) * (cellSize + gap) - hScroll.Value - 1; @@ -1242,6 +1256,7 @@ namespace McBitFont { } private void chkRectSelect_CheckedChanged(object sender, EventArgs e) { + lblSelection.Visible = lblSelectionLabel.Visible = chkRectSelect.Checked; dotPanel.Refresh(); } diff --git a/McBitFont/McBitFont.csproj b/McBitFont/McBitFont.csproj index 1cbb2e4..591cff5 100644 --- a/McBitFont/McBitFont.csproj +++ b/McBitFont/McBitFont.csproj @@ -20,9 +20,9 @@ true true icon_64.ico - 2.1.0.0 - 2.1.0.0 - $(VersionPrefix)2.1.0 + 2.2.0.0 + 2.2.0.0 + $(VersionPrefix)2.2.0 Anton Mukhin diff --git a/TODO.txt b/TODO.txt index 9cdfee3..022be8e 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,4 +1,6 @@ Application: +V Move Select and Baseline buttons right +V Display RectSelection width and width Functionality: