From 30729aca2f6c2cc73b62fb4861cfb43753b40c92 Mon Sep 17 00:00:00 2001 From: Anton Mukhin Date: Tue, 8 Jul 2025 10:49:26 +0300 Subject: [PATCH] TODO feature: When Rectangle selection tool is active hold Ctrl+Alt to temporary disable it to be able to draw --- McBitFont/Form1.Designer.cs | 3 +++ McBitFont/Form1.cs | 21 ++++++++++++++++++++- README.md | 1 + TODO.txt | 1 + 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/McBitFont/Form1.Designer.cs b/McBitFont/Form1.Designer.cs index 5ae003f..bf26ce2 100644 --- a/McBitFont/Form1.Designer.cs +++ b/McBitFont/Form1.Designer.cs @@ -1221,6 +1221,7 @@ Controls.Add(dotPanel); Controls.Add(menuStrip1); Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon"); + KeyPreview = true; MainMenuStrip = menuStrip1; Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); MinimumSize = new System.Drawing.Size(931, 686); @@ -1229,6 +1230,8 @@ Text = "McBitFont"; FormClosing += MainForm_FormClosing; Load += Form1_Load; + KeyDown += MainForm_KeyDown; + KeyUp += MainForm_KeyUp; ((System.ComponentModel.ISupportInitialize)nudX).EndInit(); ((System.ComponentModel.ISupportInitialize)nudY).EndInit(); panel1.ResumeLayout(false); diff --git a/McBitFont/Form1.cs b/McBitFont/Form1.cs index 4446c51..00d01b2 100644 --- a/McBitFont/Form1.cs +++ b/McBitFont/Form1.cs @@ -594,7 +594,7 @@ namespace McBitFont { // Check for Shift / Ctrl keys for straight lines if (ModifierKeys.HasFlag(Keys.Shift) && mouseDown) { j = lastY; - } else if (ModifierKeys.HasFlag(Keys.Control) && mouseDown) { + } else if (ModifierKeys.HasFlag(Keys.Control) && mouseDown && !CAKeyDown) { i = lastX; } lastX = i; @@ -1715,5 +1715,24 @@ namespace McBitFont { SetModified(); } } + + static bool CAKeyDown = false; + private void MainForm_KeyDown(object sender, KeyEventArgs e) { + if (CAKeyDown) return; + if (chkRectSelect.Checked && e.Control && e.Alt) { + //MessageBox.Show("Down: Alt!"); + chkRectSelect.Checked = false; + CAKeyDown = true; + e.Handled = true; + } + } + + private void MainForm_KeyUp(object sender, KeyEventArgs e) { + if (CAKeyDown && !e.Control && !e.Alt) { + chkRectSelect.Checked = true; + CAKeyDown = false; + e.Handled = true; + } + } } } diff --git a/README.md b/README.md index 4e7626c..25c5704 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Some basic hints on the interface: - Shift + scroll to scroll left and right - Crtl + scroll to zoom - Alt + Scroll to change painting brush size +- When Rectangle selection tool is active hold Ctrl+Alt to temporary disable it to be able to draw Download in the [Releases](https://gitea.mcflyer.ru/McFLY/McBitFont/releases) section! diff --git a/TODO.txt b/TODO.txt index d4ed246..814c125 100644 --- a/TODO.txt +++ b/TODO.txt @@ -3,6 +3,7 @@ Application: Functionality: V Show note field in Export comments +V When Rectangle selection tool is active hold Ctrl+Alt to temporary disable it to be able to draw Bugs: