From 34f0a48d9a6ab22c577575b0bdf508312338660b Mon Sep 17 00:00:00 2001 From: bbbradsmith Date: Fri, 11 Oct 2024 18:58:15 -0400 Subject: [PATCH] Don't hide maximum zoom in numericZoom.Maximum, use ZOOM_MAX constant instead. --- BinxelviewForm.Designer.cs | 12 ++++++------ BinxelviewForm.cs | 9 ++++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/BinxelviewForm.Designer.cs b/BinxelviewForm.Designer.cs index fd8e8f5..7fb7297 100644 --- a/BinxelviewForm.Designer.cs +++ b/BinxelviewForm.Designer.cs @@ -1010,7 +1010,7 @@ private void InitializeComponent() // this.numericZoom.Location = new System.Drawing.Point(115, 43); this.numericZoom.Maximum = new decimal(new int[] { - 16, + 32, 0, 0, 0}); @@ -1290,34 +1290,34 @@ private void InitializeComponent() this.positionToPixelContextItem, this.pixelsToPaletteContextItem}); this.contextMenuPixel.Name = "contextMenuPixel"; - this.contextMenuPixel.Size = new System.Drawing.Size(181, 114); + this.contextMenuPixel.Size = new System.Drawing.Size(160, 92); // // saveImageContextItem // this.saveImageContextItem.Enabled = false; this.saveImageContextItem.Name = "saveImageContextItem"; - this.saveImageContextItem.Size = new System.Drawing.Size(180, 22); + this.saveImageContextItem.Size = new System.Drawing.Size(159, 22); this.saveImageContextItem.Text = "&Save &Image"; this.saveImageContextItem.Click += new System.EventHandler(this.saveImageContextItem_Click); // // saveAllContextItem // this.saveAllContextItem.Name = "saveAllContextItem"; - this.saveAllContextItem.Size = new System.Drawing.Size(180, 22); + this.saveAllContextItem.Size = new System.Drawing.Size(159, 22); this.saveAllContextItem.Text = "Save &All Visible"; this.saveAllContextItem.Click += new System.EventHandler(this.saveAllVisibleContextItem_Click); // // positionToPixelContextItem // this.positionToPixelContextItem.Name = "positionToPixelContextItem"; - this.positionToPixelContextItem.Size = new System.Drawing.Size(180, 22); + this.positionToPixelContextItem.Size = new System.Drawing.Size(159, 22); this.positionToPixelContextItem.Text = "&Position to Pixel"; this.positionToPixelContextItem.Click += new System.EventHandler(this.positionToPixelToolContextItem_Click); // // pixelsToPaletteContextItem // this.pixelsToPaletteContextItem.Name = "pixelsToPaletteContextItem"; - this.pixelsToPaletteContextItem.Size = new System.Drawing.Size(180, 22); + this.pixelsToPaletteContextItem.Size = new System.Drawing.Size(159, 22); this.pixelsToPaletteContextItem.Text = "Pi&xels to Palette"; this.pixelsToPaletteContextItem.Click += new System.EventHandler(this.pixelsToPaletteContextItem_Click); // diff --git a/BinxelviewForm.cs b/BinxelviewForm.cs index bd6d242..6a3242f 100644 --- a/BinxelviewForm.cs +++ b/BinxelviewForm.cs @@ -14,6 +14,7 @@ public partial class BinxelviewForm : Form const int PRESET_VERSION = 2; const int PALETTE_BITS = 14; // maximum bits to fill 128 x 128 square const int PALETTE_DIM = 128; // should match paletteBox size + const int ZOOM_MAX = 32; enum PaletteMode { @@ -1618,8 +1619,8 @@ private void buttonZoom_Click(object sender, EventArgs e) { ++zoom; } - if (zoom < numericZoom.Minimum) zoom = (int)numericZoom.Minimum; // TODO replace with ZOOM_MIN ZOOM_MAX - if (zoom > numericZoom.Maximum) zoom = (int)numericZoom.Maximum; + if (zoom < 1) zoom = 1; + if (zoom > ZOOM_MAX) zoom = ZOOM_MAX; redrawOptions(); redrawPixels(); @@ -1628,7 +1629,7 @@ private void buttonZoom_MouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) return; --zoom; - if (zoom < numericZoom.Minimum) zoom = (int)numericZoom.Minimum; // TODO replace with ZOOM_MIN ZOOM_MAX + if (zoom < 1) zoom = 1; redrawOptions(); redrawPixels(); } @@ -2291,6 +2292,8 @@ private void BinxelviewForm_Load(object sender, EventArgs e) posfont_regular = new Font(numericPosByte.Font, FontStyle.Regular); posfont_bold = new Font(numericPosByte.Font, FontStyle.Bold); comboBoxPalette.SelectedIndex = (int)PaletteMode.PALETTE_RGB - 1; + numericZoom.Minimum = 1; + numericZoom.Maximum = ZOOM_MAX; // set default options defaultOption();