From 175271c97f69c0ee2dd7367d48d6d87dfd178a7b Mon Sep 17 00:00:00 2001 From: bbbradsmith Date: Mon, 14 Oct 2024 16:54:19 -0400 Subject: [PATCH] scrollRange should always be followed by updatePos fix #23 --- BinxelviewForm.cs | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/BinxelviewForm.cs b/BinxelviewForm.cs index 5ae6576..b1cba2d 100644 --- a/BinxelviewForm.cs +++ b/BinxelviewForm.cs @@ -1130,26 +1130,6 @@ void autoPalette() // regenerate automatic palettes // Position and Scroll // - void scrollRange() - { - if (view_scroll.Value > data.Length) view_scroll.Value = data.Length; - view_scroll.Maximum = data.Length; - - next_increment_byte = preset.next_stride_byte * ((preset.height == 1) ? 16 : 1); - next_increment_bit = preset.next_stride_bit * ((preset.height == 1) ? 16 : 1); - int nb = next_increment_bit / 8; - next_increment_byte += nb; - next_increment_bit -= nb * 8; - - view_scroll.LargeChange = (next_increment_byte >= 0) ? next_increment_byte : -next_increment_byte; - - view_scroll.SmallChange = 1; - if (snap_scroll) - { - view_scroll.SmallChange = view_scroll.LargeChange; - } - } - void updatePos(bool update_scroll = true) { numericPosByte.Hexadecimal = (pos_byte >= 0) && !decimal_position; @@ -1172,6 +1152,27 @@ void normalizePos() updatePos(); } + void scrollRange() + { + if (view_scroll.Value > data.Length) view_scroll.Value = data.Length; + view_scroll.Maximum = data.Length; + + next_increment_byte = preset.next_stride_byte * ((preset.height == 1) ? 16 : 1); + next_increment_bit = preset.next_stride_bit * ((preset.height == 1) ? 16 : 1); + int nb = next_increment_bit / 8; + next_increment_byte += nb; + next_increment_bit -= nb * 8; + + view_scroll.LargeChange = (next_increment_byte >= 0) ? next_increment_byte : -next_increment_byte; + view_scroll.SmallChange = 1; + if (snap_scroll) + { + view_scroll.SmallChange = view_scroll.LargeChange; + } + + updatePos(); + } + void advanceClick(int inc_byte, int inc_bit) { if ((Control.ModifierKeys & Keys.Shift) != 0) @@ -1217,7 +1218,6 @@ bool openFile(string path) pos_byte = 0; } pos_bit = 0; - updatePos(); scrollRange(); data_path = path; data_file = Path.GetFileName(path);