TODO features:

- Move Select and Baseline buttons right
- Display RectSelection width and width
This commit is contained in:
Anton Mukhin
2025-05-27 12:09:55 +03:00
parent 5d17ba5538
commit ca21c43926
4 changed files with 56 additions and 9 deletions

View File

@@ -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;
}
}

View File

@@ -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();
}

View File

@@ -20,9 +20,9 @@
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<ApplicationIcon>icon_64.ico</ApplicationIcon>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
<FileVersion>2.1.0.0</FileVersion>
<Version>$(VersionPrefix)2.1.0</Version>
<AssemblyVersion>2.2.0.0</AssemblyVersion>
<FileVersion>2.2.0.0</FileVersion>
<Version>$(VersionPrefix)2.2.0</Version>
<Copyright>Anton Mukhin</Copyright>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -1,4 +1,6 @@
Application:
V Move Select and Baseline buttons right
V Display RectSelection width and width
Functionality: