Skip to content

Commit

Permalink
Use bold font to indicate hexadecimal position
Browse files Browse the repository at this point in the history
Also use bold for hexidecimal on binary chunk export position/length
Tweaks to binary chunk export design
Grouping variables to help identify settings
  • Loading branch information
bbbradsmith committed Oct 11, 2024
1 parent 9b86eae commit f85245a
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 48 deletions.
23 changes: 11 additions & 12 deletions BinaryChunkExportForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions BinaryChunkExportForm.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Windows.Forms;
using System.Drawing;

namespace Binxelview
{
Expand All @@ -16,6 +17,10 @@ public BinaryChunkExportForm(long startPosition, bool hex, byte[] data)
startNumericUpDown.Value = startPosition;
startNumericUpDown.Hexadecimal = hex;
lengthNumericUpDown.Hexadecimal = hex;
if (startNumericUpDown.Hexadecimal)
startNumericUpDown.Font = new Font(startNumericUpDown.Font, FontStyle.Bold);
if (lengthNumericUpDown.Hexadecimal)
lengthNumericUpDown.Font = new Font(lengthNumericUpDown.Font, FontStyle.Bold);
}

private void saveButton_Click(object sender, EventArgs e)
Expand Down
24 changes: 12 additions & 12 deletions BinxelviewForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 30 additions & 23 deletions BinxelviewForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,52 +15,53 @@ public partial class BinxelviewForm : Form
const int PALETTE_BITS = 14; // maximum bits to fill 128 x 128 square
const int PALETTE_DIM = 128; // should match paletteBox size

enum PaletteMode
{
PALETTE_CUSTOM = 0, // entries below are same order as comboBoxPalette.Items
PALETTE_RGB,
PALETTE_RANDOM,
PALETTE_GREY,
PALETTE_CUBEHELIX,
};

byte[] data = {};
string data_path = "";
string data_file = "";
long pos_byte = 0;
int pos_bit = 0;
int zoom = 2;
bool hidegrid = false;
int next_increment_byte = 1;
int next_increment_bit = 0;
int selected_tile = -1;
long selected_pos = -1;

Preset preset;
Preset default_preset;
List<Preset> presets;

Bitmap palette_bmp = new Bitmap(PALETTE_DIM, PALETTE_DIM);
Bitmap pixel_bmp = null;
Color[] palette = new Color[PALETTE_DIM * PALETTE_DIM];
int[] palette_raw = new int[PALETTE_DIM * PALETTE_DIM];
int[] palette_raw = new int[PALETTE_DIM * PALETTE_DIM]; // int version of palette
string palette_error = "";
int background_raw = SystemColors.Control.ToArgb(); // int version of background setting
int[] twiddle_cache = null;
int twiddle_cache_order = 0;
int twiddle_cache_w = 0;
int twiddle_cache_h = 0;
bool disable_pixel_redraw = false; // used to temporarily block redraws during repeated updates
Font posfont_regular, posfont_bold;
Random random = new Random();

// settings
int zoom = 2;
bool hidegrid = false;
Color background = SystemColors.Control;
int background_raw = SystemColors.Control.ToArgb();
PaletteMode palette_mode = PaletteMode.PALETTE_RGB;
string palette_error = "";

Bitmap pixel_bmp = null;
bool disable_pixel_redraw = false;
bool decimal_position = false;
int next_increment_byte = 1;
int next_increment_bit = 0;
int selected_tile = -1;
long selected_pos = -1;
bool snap_scroll = true;
bool horizontal_layout = false;
int twiddle = 0;

Random random = new Random();

enum PaletteMode
{
PALETTE_CUSTOM = 0, // entries below are same order as comboBoxPalette.Items
PALETTE_RGB,
PALETTE_RANDOM,
PALETTE_GREY,
PALETTE_CUBEHELIX,
};

//
// Preset
//
Expand Down Expand Up @@ -1193,6 +1194,9 @@ private void exitToolStripMenuItem_Click(object sender, EventArgs e)

private void BinxelviewForm_Load(object sender, EventArgs e)
{
posfont_regular = new Font(numericPosByte.Font, FontStyle.Regular);
posfont_bold = new Font(numericPosByte.Font, FontStyle.Bold);

// initialize Auto palette selection
comboBoxPalette.SelectedIndex = (int)PaletteMode.PALETTE_RGB - 1;

Expand All @@ -1212,6 +1216,7 @@ private void BinxelviewForm_Load(object sender, EventArgs e)
refreshPalette();
bgBox.BackColor = background;
redrawPixels();
numericPosByte.Font = decimal_position ? posfont_regular : posfont_bold;
}

private void BinxelviewForm_DragDrop(object sender, DragEventArgs e)
Expand Down Expand Up @@ -1578,6 +1583,7 @@ private void decimalPositionToolStripMenuItem_Click(object sender, EventArgs e)
decimalPositionToolStripMenuItem.Checked = true;
hexadecimalPositionToolStripMenuItem.Checked = false;
decimal_position = true;
numericPosByte.Font = posfont_regular;
updatePos();
}

Expand All @@ -1586,6 +1592,7 @@ private void hexadecimalPositionToolStripMenuItem_Click(object sender, EventArgs
decimalPositionToolStripMenuItem.Checked = false;
hexadecimalPositionToolStripMenuItem.Checked = true;
decimal_position = false;
numericPosByte.Font = posfont_bold;
updatePos();
}

Expand Down
3 changes: 2 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Other Notes
-----------

Due to signed 32-bit integer limitations of C sharp, files must be less than 2GB in size.
To inspect extremely large files, you may wish to split them first.
To inspect extremely large files, you may have to split them first.

The Twiddle options will rearrange the pixel X and Y within a tile to use a
Morton (Z/N) ordering, commonly seen in square textures "twiddled" or "swizzled" for
Expand Down Expand Up @@ -183,6 +183,7 @@ Changes
- Right click context menu option to copy to the palette starting from the selected pixel.
- PS1 15BPP and 4BPP presets. (Contributor: HeyItsLollie)
- VGA Palette preset.
- Indicate hexadecimal position with bold font.

1.5.0.0 (2020-07-31)
- Twiddle option for inspecting textures stored with morton ordering of pixels.
Expand Down

0 comments on commit f85245a

Please sign in to comment.