diff --git a/McBitFont/About.cs b/McBitFont/About.cs index a9a4172..0e0f3a1 100644 --- a/McBitFont/About.cs +++ b/McBitFont/About.cs @@ -15,7 +15,7 @@ namespace McBitFont { } private void About_Load(object sender, EventArgs e) { - lblVersion.Text = "Version: v" + MainForm.version; + lblVersion.Text = "Version: " + MainForm.version; } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { diff --git a/McBitFont/FontTester.Designer.cs b/McBitFont/FontTester.Designer.cs index 355ee76..20ba591 100644 --- a/McBitFont/FontTester.Designer.cs +++ b/McBitFont/FontTester.Designer.cs @@ -54,7 +54,7 @@ nudSpace.Maximum = new decimal(new int[] { 255, 0, 0, 0 }); nudSpace.Name = "nudSpace"; nudSpace.Size = new System.Drawing.Size(40, 23); - nudSpace.TabIndex = 1; + nudSpace.TabIndex = 2; toolTip1.SetToolTip(nudSpace, "Space between symbols in pixels"); nudSpace.Value = new decimal(new int[] { 1, 0, 0, 0 }); nudSpace.ValueChanged += Scrolling; @@ -75,7 +75,7 @@ tbText.Location = new System.Drawing.Point(12, 55); tbText.Name = "tbText"; tbText.Size = new System.Drawing.Size(260, 29); - tbText.TabIndex = 3; + tbText.TabIndex = 1; toolTip1.SetToolTip(tbText, "Text to test the font with"); tbText.TextChanged += Text_Changed; // @@ -125,12 +125,12 @@ // cbZoom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cbZoom.FormattingEnabled = true; - cbZoom.Items.AddRange(new object[] { "2", "3", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50" }); + cbZoom.Items.AddRange(new object[] { "1", "2", "3", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50" }); cbZoom.Location = new System.Drawing.Point(222, 6); cbZoom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); cbZoom.Name = "cbZoom"; cbZoom.Size = new System.Drawing.Size(50, 23); - cbZoom.TabIndex = 19; + cbZoom.TabIndex = 3; cbZoom.TabStop = false; toolTip1.SetToolTip(cbZoom, "Zoom level"); cbZoom.SelectedIndexChanged += ZoomChanged; @@ -149,7 +149,7 @@ btnCopy.Location = new System.Drawing.Point(110, 214); btnCopy.Name = "btnCopy"; btnCopy.Size = new System.Drawing.Size(80, 30); - btnCopy.TabIndex = 21; + btnCopy.TabIndex = 5; btnCopy.Text = " Copy"; btnCopy.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; toolTip1.SetToolTip(btnCopy, "Copy BitPixels you see to Clipboard"); @@ -162,7 +162,7 @@ chkBaseline.Location = new System.Drawing.Point(203, 36); chkBaseline.Name = "chkBaseline"; chkBaseline.Size = new System.Drawing.Size(69, 19); - chkBaseline.TabIndex = 20; + chkBaseline.TabIndex = 4; chkBaseline.Text = "Baseline"; chkBaseline.UseVisualStyleBackColor = true; chkBaseline.CheckedChanged += Scrolling; diff --git a/McBitFont/Form1.Designer.cs b/McBitFont/Form1.Designer.cs index 0427c47..d6f70b6 100644 --- a/McBitFont/Form1.Designer.cs +++ b/McBitFont/Form1.Designer.cs @@ -28,8 +28,8 @@ dotPanel = new System.Windows.Forms.Panel(); nudX = new System.Windows.Forms.NumericUpDown(); nudY = new System.Windows.Forms.NumericUpDown(); - label1 = new System.Windows.Forms.Label(); - label2 = new System.Windows.Forms.Label(); + lblWidth = new System.Windows.Forms.Label(); + lblHeight = new System.Windows.Forms.Label(); lblType = new System.Windows.Forms.Label(); cbZoom = new System.Windows.Forms.ComboBox(); label4 = new System.Windows.Forms.Label(); @@ -85,8 +85,12 @@ removeSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); removeBeforeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); removeAfterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + zerofyWidthToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); CodeShiftToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + previousSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + nextSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); testFontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); canvasToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ClearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -100,6 +104,7 @@ mirrorYToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); applyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + toggleBarToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); dlgSave = new System.Windows.Forms.SaveFileDialog(); dlgOpen = new System.Windows.Forms.OpenFileDialog(); btnBaseline = new System.Windows.Forms.Button(); @@ -108,16 +113,23 @@ chkTopSide = new System.Windows.Forms.CheckBox(); chkHexCodes = new System.Windows.Forms.CheckBox(); chkRectSelect = new System.Windows.Forms.CheckBox(); + nudBrush = new System.Windows.Forms.NumericUpDown(); label3 = new System.Windows.Forms.Label(); lblSelectionLabel = new System.Windows.Forms.Label(); lblSelection = new System.Windows.Forms.Label(); lblModified = new System.Windows.Forms.Label(); dlgSavePNG = new System.Windows.Forms.SaveFileDialog(); + pnlRightButtons = new System.Windows.Forms.Panel(); + lblBrush = new System.Windows.Forms.Label(); + pnlInfo = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)nudX).BeginInit(); ((System.ComponentModel.ISupportInitialize)nudY).BeginInit(); panel1.SuspendLayout(); cmMinilist.SuspendLayout(); menuStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)nudBrush).BeginInit(); + pnlRightButtons.SuspendLayout(); + pnlInfo.SuspendLayout(); SuspendLayout(); // // dotPanel @@ -137,8 +149,7 @@ // // nudX // - nudX.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; - nudX.Location = new System.Drawing.Point(777, 31); + nudX.Location = new System.Drawing.Point(59, 3); nudX.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); nudX.Maximum = new decimal(new int[] { 255, 0, 0, 0 }); nudX.Name = "nudX"; @@ -150,8 +161,7 @@ // // nudY // - nudY.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; - nudY.Location = new System.Drawing.Point(777, 57); + nudY.Location = new System.Drawing.Point(59, 27); nudY.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); nudY.Maximum = new decimal(new int[] { 255, 0, 0, 0 }); nudY.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); @@ -162,32 +172,29 @@ nudY.Value = new decimal(new int[] { 32, 0, 0, 0 }); nudY.ValueChanged += nudY_ValueChanged; // - // label1 + // lblWidth // - label1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; - label1.AutoSize = true; - label1.Location = new System.Drawing.Point(726, 33); - label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - label1.Name = "label1"; - label1.Size = new System.Drawing.Size(42, 15); - label1.TabIndex = 3; - label1.Text = "Width:"; + lblWidth.AutoSize = true; + lblWidth.Location = new System.Drawing.Point(8, 5); + lblWidth.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + lblWidth.Name = "lblWidth"; + lblWidth.Size = new System.Drawing.Size(42, 15); + lblWidth.TabIndex = 3; + lblWidth.Text = "Width:"; // - // label2 + // lblHeight // - label2.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; - label2.AutoSize = true; - label2.Location = new System.Drawing.Point(722, 59); - label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - label2.Name = "label2"; - label2.Size = new System.Drawing.Size(46, 15); - label2.TabIndex = 4; - label2.Text = "Height:"; + lblHeight.AutoSize = true; + lblHeight.Location = new System.Drawing.Point(4, 29); + lblHeight.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + lblHeight.Name = "lblHeight"; + lblHeight.Size = new System.Drawing.Size(46, 15); + lblHeight.TabIndex = 4; + lblHeight.Text = "Height:"; // // lblType // - lblType.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; - lblType.Location = new System.Drawing.Point(718, 159); + lblType.Location = new System.Drawing.Point(2, 136); lblType.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); lblType.Name = "lblType"; lblType.Size = new System.Drawing.Size(181, 15); @@ -201,7 +208,7 @@ cbZoom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cbZoom.FormattingEnabled = true; cbZoom.Items.AddRange(new object[] { "2", "3", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50" }); - cbZoom.Location = new System.Drawing.Point(619, 52); + cbZoom.Location = new System.Drawing.Point(7, 28); cbZoom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); cbZoom.Name = "cbZoom"; cbZoom.Size = new System.Drawing.Size(75, 23); @@ -213,7 +220,7 @@ // label4.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; label4.AutoSize = true; - label4.Location = new System.Drawing.Point(618, 33); + label4.Location = new System.Drawing.Point(6, 9); label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label4.Name = "label4"; label4.Size = new System.Drawing.Size(69, 15); @@ -358,9 +365,8 @@ // // btnExport // - btnExport.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; btnExport.Image = Properties.Resources.z_export; - btnExport.Location = new System.Drawing.Point(812, 126); + btnExport.Location = new System.Drawing.Point(94, 109); btnExport.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); btnExport.Name = "btnExport"; btnExport.Size = new System.Drawing.Size(88, 27); @@ -476,9 +482,8 @@ // // btnApply // - btnApply.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; btnApply.Image = Properties.Resources.z_tick; - btnApply.Location = new System.Drawing.Point(718, 126); + btnApply.Location = new System.Drawing.Point(4, 109); btnApply.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); btnApply.Name = "btnApply"; btnApply.Size = new System.Drawing.Size(88, 27); @@ -518,7 +523,7 @@ // lblCoords.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; lblCoords.AutoSize = true; - lblCoords.Location = new System.Drawing.Point(616, 138); + lblCoords.Location = new System.Drawing.Point(4, 114); lblCoords.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); lblCoords.Name = "lblCoords"; lblCoords.Size = new System.Drawing.Size(24, 15); @@ -528,7 +533,7 @@ // // menuStrip1 // - menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, editToolStripMenuItem, fontToolStripMenuItem, canvasToolStripMenuItem, aboutToolStripMenuItem }); + menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, editToolStripMenuItem, fontToolStripMenuItem, canvasToolStripMenuItem, aboutToolStripMenuItem, toggleBarToolStripMenuItem }); menuStrip1.Location = new System.Drawing.Point(0, 0); menuStrip1.Name = "menuStrip1"; menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2); @@ -719,16 +724,17 @@ // // fontToolStripMenuItem // - fontToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { makeVarWidthToolStripMenuItem, prependSymbolToolStripMenuItem, appendSymbolToolStripMenuItem, removeSymbolToolStripMenuItem, removeBeforeToolStripMenuItem, removeAfterToolStripMenuItem, CodeShiftToolStripMenuItem, toolStripSeparator3, testFontToolStripMenuItem }); + fontToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { makeVarWidthToolStripMenuItem, prependSymbolToolStripMenuItem, appendSymbolToolStripMenuItem, removeSymbolToolStripMenuItem, removeBeforeToolStripMenuItem, removeAfterToolStripMenuItem, zerofyWidthToolStripMenuItem, CodeShiftToolStripMenuItem, toolStripSeparator3, previousSymbolToolStripMenuItem, nextSymbolToolStripMenuItem, toolStripSeparator4, testFontToolStripMenuItem }); fontToolStripMenuItem.Name = "fontToolStripMenuItem"; fontToolStripMenuItem.Size = new System.Drawing.Size(43, 20); fontToolStripMenuItem.Text = "Font"; + fontToolStripMenuItem.DropDownOpening += fontToolStripMenuItem_DropDownOpening; // // makeVarWidthToolStripMenuItem // makeVarWidthToolStripMenuItem.Image = Properties.Resources.z_asterisk; makeVarWidthToolStripMenuItem.Name = "makeVarWidthToolStripMenuItem"; - makeVarWidthToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + makeVarWidthToolStripMenuItem.Size = new System.Drawing.Size(241, 22); makeVarWidthToolStripMenuItem.Text = "Make Variable Width"; makeVarWidthToolStripMenuItem.ToolTipText = "Make Font Variable width one"; makeVarWidthToolStripMenuItem.Visible = false; @@ -741,7 +747,7 @@ prependSymbolToolStripMenuItem.Name = "prependSymbolToolStripMenuItem"; prependSymbolToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Ins"; prependSymbolToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Insert; - prependSymbolToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + prependSymbolToolStripMenuItem.Size = new System.Drawing.Size(241, 22); prependSymbolToolStripMenuItem.Text = "Prepend symbol"; prependSymbolToolStripMenuItem.ToolTipText = "Add a symbol to the beginning of the sequence"; prependSymbolToolStripMenuItem.Click += prependSymbolToolStripMenuItem_Click; @@ -753,7 +759,7 @@ appendSymbolToolStripMenuItem.Name = "appendSymbolToolStripMenuItem"; appendSymbolToolStripMenuItem.ShortcutKeyDisplayString = ""; appendSymbolToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.End; - appendSymbolToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + appendSymbolToolStripMenuItem.Size = new System.Drawing.Size(241, 22); appendSymbolToolStripMenuItem.Text = "Append symbol"; appendSymbolToolStripMenuItem.ToolTipText = "Add a symbol to the end of the sequence"; appendSymbolToolStripMenuItem.Click += prependSymbolToolStripMenuItem_Click; @@ -765,7 +771,7 @@ removeSymbolToolStripMenuItem.Name = "removeSymbolToolStripMenuItem"; removeSymbolToolStripMenuItem.ShortcutKeyDisplayString = ""; removeSymbolToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete; - removeSymbolToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + removeSymbolToolStripMenuItem.Size = new System.Drawing.Size(241, 22); removeSymbolToolStripMenuItem.Text = "Remove symbol"; removeSymbolToolStripMenuItem.ToolTipText = "Remove current symbol (works only for first or last symbol in the sequence)"; removeSymbolToolStripMenuItem.Click += removeSymbolToolStripMenuItem_Click; @@ -775,7 +781,7 @@ removeBeforeToolStripMenuItem.Enabled = false; removeBeforeToolStripMenuItem.Image = Properties.Resources.delete; removeBeforeToolStripMenuItem.Name = "removeBeforeToolStripMenuItem"; - removeBeforeToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + removeBeforeToolStripMenuItem.Size = new System.Drawing.Size(241, 22); removeBeforeToolStripMenuItem.Text = "Remove all before selected"; removeBeforeToolStripMenuItem.ToolTipText = "Remove all symbols before current one"; removeBeforeToolStripMenuItem.Click += removeBeforeToolStripMenuItem_Click; @@ -785,16 +791,26 @@ removeAfterToolStripMenuItem.Enabled = false; removeAfterToolStripMenuItem.Image = Properties.Resources.delete; removeAfterToolStripMenuItem.Name = "removeAfterToolStripMenuItem"; - removeAfterToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + removeAfterToolStripMenuItem.Size = new System.Drawing.Size(241, 22); removeAfterToolStripMenuItem.Text = "Remove all after selected"; removeAfterToolStripMenuItem.ToolTipText = "Remove all symbols after current one"; removeAfterToolStripMenuItem.Click += removeAfterToolStripMenuItem_Click; // + // zerofyWidthToolStripMenuItem + // + zerofyWidthToolStripMenuItem.Enabled = false; + zerofyWidthToolStripMenuItem.Image = Properties.Resources.text_letterspacing2; + zerofyWidthToolStripMenuItem.Name = "zerofyWidthToolStripMenuItem"; + zerofyWidthToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + zerofyWidthToolStripMenuItem.Text = "Make all blank symbols 0-width"; + zerofyWidthToolStripMenuItem.ToolTipText = "Make width equals zero for all blank symbols (except code 32 (space))"; + zerofyWidthToolStripMenuItem.Click += ZerofyBlankWidth; + // // CodeShiftToolStripMenuItem // CodeShiftToolStripMenuItem.Image = Properties.Resources.z_align_center; CodeShiftToolStripMenuItem.Name = "CodeShiftToolStripMenuItem"; - CodeShiftToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + CodeShiftToolStripMenuItem.Size = new System.Drawing.Size(241, 22); CodeShiftToolStripMenuItem.Text = "Code shift"; CodeShiftToolStripMenuItem.ToolTipText = "Shift the font on the code line"; CodeShiftToolStripMenuItem.Click += CodeShiftToolStripMenuItem_Click; @@ -802,13 +818,38 @@ // toolStripSeparator3 // toolStripSeparator3.Name = "toolStripSeparator3"; - toolStripSeparator3.Size = new System.Drawing.Size(212, 6); + toolStripSeparator3.Size = new System.Drawing.Size(238, 6); + // + // previousSymbolToolStripMenuItem + // + previousSymbolToolStripMenuItem.Image = Properties.Resources.arrow_turn_left; + previousSymbolToolStripMenuItem.Name = "previousSymbolToolStripMenuItem"; + previousSymbolToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.Left; + previousSymbolToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + previousSymbolToolStripMenuItem.Text = "Previous Symbol"; + previousSymbolToolStripMenuItem.ToolTipText = "Select previous symbol"; + previousSymbolToolStripMenuItem.Click += previousSymbolToolStripMenuItem_Click; + // + // nextSymbolToolStripMenuItem + // + nextSymbolToolStripMenuItem.Image = Properties.Resources.arrow_turn_right; + nextSymbolToolStripMenuItem.Name = "nextSymbolToolStripMenuItem"; + nextSymbolToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.Right; + nextSymbolToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + nextSymbolToolStripMenuItem.Text = "Next symbol"; + nextSymbolToolStripMenuItem.ToolTipText = "Select next symbol"; + nextSymbolToolStripMenuItem.Click += nextSymbolToolStripMenuItem_Click; + // + // toolStripSeparator4 + // + toolStripSeparator4.Name = "toolStripSeparator4"; + toolStripSeparator4.Size = new System.Drawing.Size(238, 6); // // testFontToolStripMenuItem // testFontToolStripMenuItem.Image = Properties.Resources.font; testFontToolStripMenuItem.Name = "testFontToolStripMenuItem"; - testFontToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + testFontToolStripMenuItem.Size = new System.Drawing.Size(241, 22); testFontToolStripMenuItem.Text = "Test font"; testFontToolStripMenuItem.ToolTipText = "Open dialog where you can test the font with any text you type"; testFontToolStripMenuItem.Click += TestFont_Click; @@ -934,6 +975,16 @@ aboutToolStripMenuItem.Text = "About"; aboutToolStripMenuItem.Click += aboutToolStripMenuItem_Click; // + // toggleBarToolStripMenuItem + // + toggleBarToolStripMenuItem.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + toggleBarToolStripMenuItem.CheckOnClick = true; + toggleBarToolStripMenuItem.Name = "toggleBarToolStripMenuItem"; + toggleBarToolStripMenuItem.Size = new System.Drawing.Size(35, 20); + toggleBarToolStripMenuItem.Text = ">>"; + toggleBarToolStripMenuItem.ToolTipText = "Toggle side bar state"; + toggleBarToolStripMenuItem.Click += toggleBarToolStripMenuItem_Click; + // // dlgSave // dlgSave.DefaultExt = "mbf"; @@ -946,10 +997,9 @@ // // btnBaseline // - 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(812, 93); + btnBaseline.Location = new System.Drawing.Point(94, 81); btnBaseline.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); btnBaseline.Name = "btnBaseline"; btnBaseline.Size = new System.Drawing.Size(88, 27); @@ -968,9 +1018,8 @@ // // chkLeftSide // - chkLeftSide.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; chkLeftSide.AutoSize = true; - chkLeftSide.Location = new System.Drawing.Point(831, 33); + chkLeftSide.Location = new System.Drawing.Point(113, 5); chkLeftSide.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); chkLeftSide.Name = "chkLeftSide"; chkLeftSide.Size = new System.Drawing.Size(70, 19); @@ -981,9 +1030,8 @@ // // chkTopSide // - chkTopSide.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; chkTopSide.AutoSize = true; - chkTopSide.Location = new System.Drawing.Point(831, 58); + chkTopSide.Location = new System.Drawing.Point(113, 28); chkTopSide.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); chkTopSide.Name = "chkTopSide"; chkTopSide.Size = new System.Drawing.Size(70, 19); @@ -996,7 +1044,7 @@ // chkHexCodes.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; chkHexCodes.AutoSize = true; - chkHexCodes.Location = new System.Drawing.Point(618, 155); + chkHexCodes.Location = new System.Drawing.Point(6, 131); chkHexCodes.Name = "chkHexCodes"; chkHexCodes.Size = new System.Drawing.Size(95, 19); chkHexCodes.TabIndex = 22; @@ -1007,13 +1055,12 @@ // // chkRectSelect // - chkRectSelect.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; 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(718, 93); + chkRectSelect.Location = new System.Drawing.Point(4, 81); chkRectSelect.Name = "chkRectSelect"; - chkRectSelect.Size = new System.Drawing.Size(87, 27); + chkRectSelect.Size = new System.Drawing.Size(88, 27); chkRectSelect.TabIndex = 23; chkRectSelect.Text = " Select"; chkRectSelect.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -1022,11 +1069,24 @@ chkRectSelect.UseVisualStyleBackColor = true; chkRectSelect.CheckedChanged += chkRectSelect_CheckedChanged; // + // nudBrush + // + nudBrush.Location = new System.Drawing.Point(59, 51); + nudBrush.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + nudBrush.Maximum = new decimal(new int[] { 32, 0, 0, 0 }); + nudBrush.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + nudBrush.Name = "nudBrush"; + nudBrush.Size = new System.Drawing.Size(47, 23); + nudBrush.TabIndex = 24; + toolTip1.SetToolTip(nudBrush, "Symbol height"); + nudBrush.Value = new decimal(new int[] { 1, 0, 0, 0 }); + nudBrush.ValueChanged += nudBrush_ValueChanged; + // // label3 // label3.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; label3.AutoSize = true; - label3.Location = new System.Drawing.Point(615, 123); + label3.Location = new System.Drawing.Point(3, 99); label3.Name = "label3"; label3.Size = new System.Drawing.Size(45, 15); label3.TabIndex = 21; @@ -1036,7 +1096,7 @@ // lblSelectionLabel.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; lblSelectionLabel.AutoSize = true; - lblSelectionLabel.Location = new System.Drawing.Point(616, 93); + lblSelectionLabel.Location = new System.Drawing.Point(4, 69); lblSelectionLabel.Name = "lblSelectionLabel"; lblSelectionLabel.Size = new System.Drawing.Size(58, 15); lblSelectionLabel.TabIndex = 25; @@ -1047,7 +1107,7 @@ // lblSelection.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; lblSelection.AutoSize = true; - lblSelection.Location = new System.Drawing.Point(617, 108); + lblSelection.Location = new System.Drawing.Point(5, 84); lblSelection.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); lblSelection.Name = "lblSelection"; lblSelection.Size = new System.Drawing.Size(30, 15); @@ -1062,7 +1122,7 @@ lblModified.AutoSize = true; lblModified.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204); lblModified.ForeColor = System.Drawing.SystemColors.Highlight; - lblModified.Location = new System.Drawing.Point(616, 78); + lblModified.Location = new System.Drawing.Point(4, 54); lblModified.Name = "lblModified"; lblModified.Size = new System.Drawing.Size(91, 15); lblModified.TabIndex = 26; @@ -1074,34 +1134,66 @@ dlgSavePNG.DefaultExt = "png"; dlgSavePNG.Filter = "PNG Image|*.png;*.PNG"; // + // pnlRightButtons + // + pnlRightButtons.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; + pnlRightButtons.Controls.Add(nudBrush); + pnlRightButtons.Controls.Add(lblBrush); + pnlRightButtons.Controls.Add(chkLeftSide); + pnlRightButtons.Controls.Add(nudX); + pnlRightButtons.Controls.Add(nudY); + pnlRightButtons.Controls.Add(lblWidth); + pnlRightButtons.Controls.Add(lblHeight); + pnlRightButtons.Controls.Add(chkRectSelect); + pnlRightButtons.Controls.Add(lblType); + pnlRightButtons.Controls.Add(btnExport); + pnlRightButtons.Controls.Add(btnApply); + pnlRightButtons.Controls.Add(chkTopSide); + pnlRightButtons.Controls.Add(btnBaseline); + pnlRightButtons.Location = new System.Drawing.Point(715, 24); + pnlRightButtons.Margin = new System.Windows.Forms.Padding(0); + pnlRightButtons.Name = "pnlRightButtons"; + pnlRightButtons.Size = new System.Drawing.Size(184, 154); + pnlRightButtons.TabIndex = 27; + // + // lblBrush + // + lblBrush.AutoSize = true; + lblBrush.Location = new System.Drawing.Point(10, 54); + lblBrush.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + lblBrush.Name = "lblBrush"; + lblBrush.Size = new System.Drawing.Size(40, 15); + lblBrush.TabIndex = 25; + lblBrush.Text = "Brush:"; + // + // pnlInfo + // + pnlInfo.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; + pnlInfo.Controls.Add(label4); + pnlInfo.Controls.Add(cbZoom); + pnlInfo.Controls.Add(lblCoords); + pnlInfo.Controls.Add(lblModified); + pnlInfo.Controls.Add(label3); + pnlInfo.Controls.Add(lblSelectionLabel); + pnlInfo.Controls.Add(chkHexCodes); + pnlInfo.Controls.Add(lblSelection); + pnlInfo.Location = new System.Drawing.Point(615, 24); + pnlInfo.Margin = new System.Windows.Forms.Padding(0); + pnlInfo.Name = "pnlInfo"; + pnlInfo.Size = new System.Drawing.Size(103, 154); + pnlInfo.TabIndex = 28; + // // MainForm // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; ClientSize = new System.Drawing.Size(915, 647); - Controls.Add(lblModified); - Controls.Add(lblSelectionLabel); - Controls.Add(lblSelection); - Controls.Add(chkRectSelect); - Controls.Add(chkHexCodes); - Controls.Add(label3); - Controls.Add(chkTopSide); - Controls.Add(chkLeftSide); - Controls.Add(btnBaseline); - Controls.Add(btnApply); - Controls.Add(btnExport); - Controls.Add(lblCoords); + Controls.Add(pnlInfo); + Controls.Add(pnlRightButtons); Controls.Add(vScroll); Controls.Add(hScroll); Controls.Add(miniList); Controls.Add(panel1); - Controls.Add(label4); - Controls.Add(cbZoom); - Controls.Add(lblType); - Controls.Add(label2); - Controls.Add(label1); - Controls.Add(nudY); - Controls.Add(nudX); Controls.Add(dotPanel); Controls.Add(menuStrip1); Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon"); @@ -1119,6 +1211,11 @@ cmMinilist.ResumeLayout(false); menuStrip1.ResumeLayout(false); menuStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)nudBrush).EndInit(); + pnlRightButtons.ResumeLayout(false); + pnlRightButtons.PerformLayout(); + pnlInfo.ResumeLayout(false); + pnlInfo.PerformLayout(); ResumeLayout(false); PerformLayout(); @@ -1127,8 +1224,8 @@ #endregion private System.Windows.Forms.Panel dotPanel; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label lblWidth; + private System.Windows.Forms.Label lblHeight; private System.Windows.Forms.Label lblType; private System.Windows.Forms.ComboBox cbZoom; private System.Windows.Forms.Label label4; @@ -1214,6 +1311,15 @@ public System.Windows.Forms.ImageList ilMiniatures; public System.Windows.Forms.NumericUpDown nudX; public System.Windows.Forms.NumericUpDown nudY; + private System.Windows.Forms.ToolStripMenuItem previousSymbolToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem nextSymbolToolStripMenuItem; + private System.Windows.Forms.Panel pnlRightButtons; + private System.Windows.Forms.Panel pnlInfo; + private System.Windows.Forms.ToolStripMenuItem toggleBarToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripMenuItem zerofyWidthToolStripMenuItem; + public System.Windows.Forms.NumericUpDown nudBrush; + private System.Windows.Forms.Label lblBrush; } } diff --git a/McBitFont/Form1.cs b/McBitFont/Form1.cs index 39cda8a..9da77c4 100644 --- a/McBitFont/Form1.cs +++ b/McBitFont/Form1.cs @@ -59,7 +59,7 @@ namespace McBitFont { public bool monospaced = false; private bool modified = false; private bool prjModified = false; - public const string version = "2.5"; + public const string version = "2.6"; public string prjName = "Untitled"; public string prjFileName = ""; public int codepage = 1251; @@ -68,6 +68,7 @@ namespace McBitFont { private int baseline = 0; private bool set_base = false; private Point selection1, selection2; + private Point[,] sidebarLocs = new Point[2, 3]; public MainForm() { @@ -97,6 +98,30 @@ namespace McBitFont { } } + // Check if a frame is "blank" + private static bool IsFrameBlank(FrameMiniature frame) { + if (frame.code == 32) return false; // Space character is always blank, so skip it + for (int i = 0; i < frame.width; i++) { + for (int j = 0; j < frame.height; j++) { + if (frame.data[i, j]) return false; + } + } + return true; + } + + // Remember sidebar panels locations + private void SideBarRecalc() { + + sidebarLocs[0, 0] = new Point(this.Width - 459, 31); + sidebarLocs[0, 1] = new Point(this.Width - 316, 24); + sidebarLocs[0, 2] = new Point(this.Width - 487, 31); + sidebarLocs[1, 0] = new Point(this.Width - panel1.Width - 70, 180); + sidebarLocs[1, 1] = new Point(this.Width - pnlInfo.Width - 110, 320); + sidebarLocs[1, 2] = new Point(dotPanel.Width + 17, 31); + } + + + private void Form1_Load(object sender, EventArgs e) { lblType.Text = monospaced ? "Monospaced" : "Variable width / Single"; tsmiMakeVarWidth.Visible = monospaced; @@ -141,7 +166,12 @@ namespace McBitFont { CodeShiftToolStripMenuItem.Visible = frames.Count > 1; CheckForAdd(); - + + SideBarRecalc(); + + // Create default cursor + dotPanel.Cursor = McCursor.GetCursor((int)nudBrush.Value, cellSize, gap); + } [DllImport("user32.dll")] @@ -188,6 +218,12 @@ namespace McBitFont { if (t > hScroll.Maximum) t = hScroll.Maximum; hScroll.Value = t; } + } else if (ModifierKeys.HasFlag(Keys.Alt)) { + t += (int)nudBrush.Value; + if (t < nudBrush.Minimum) t = (int)nudBrush.Minimum; + if (t > nudBrush.Maximum) t = (int)nudBrush.Maximum; + if (t > dotWidth || t > dotHeight) t = dotWidth < dotHeight ? dotWidth : dotHeight; + nudBrush.Value = t; } else { if (vScroll.Enabled) { t = t * -1 * (cellSize + gap) + vScroll.Value; @@ -201,14 +237,8 @@ namespace McBitFont { public void nudX_ValueChanged(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; if (monospaced) { - Bitmap bmp; for (int i = 0; i < frames.Count; i++) { - frames[i] = FrameResize(frames[i], (int)nudX.Value, dotHeight); - bmp = GetMiniPictue(frames[i]); - string s = frames[i].code.ToString().PadLeft(3, '0'); - ilMiniatures.Images.RemoveByKey(s); - ilMiniatures.Images.Add(s, (Image)bmp); - miniList.Items[s].ImageKey = s; + frames[i] = FrameResize(frames[i], (int)nudX.Value, dotHeight, true); } SetModified(true, true); } @@ -219,20 +249,14 @@ namespace McBitFont { DotResize((int)nudX.Value, dotHeight); if (monospaced) history.Add(frames); else history.Add(f); - + Cursor.Current = Cursors.Default; } public void nudY_ValueChanged(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; - Bitmap bmp; for (int i = 0; i < frames.Count; i++) { - frames[i] = FrameResize(frames[i], frames[i].width, (int)nudY.Value); - bmp = GetMiniPictue(frames[i]); - string s = frames[i].code.ToString().PadLeft(3, '0'); - ilMiniatures.Images.RemoveByKey(s); - ilMiniatures.Images.Add(s, (Image)bmp); - miniList.Items[s].ImageKey = s; + frames[i] = FrameResize(frames[i], frames[i].width, (int)nudY.Value, true); } if (nudY.Focused) { SetModified(); @@ -244,7 +268,7 @@ namespace McBitFont { Cursor.Current = Cursors.Default; } - private FrameMiniature FrameResize(FrameMiniature ff, int neww, int newh) { + private FrameMiniature FrameResize(FrameMiniature ff, int neww, int newh, bool updateMiniList = false) { int oldw = ff.width; int oldh = ff.height; int di = 0, dj = 0; @@ -269,6 +293,15 @@ namespace McBitFont { } ff.data = t; + // update miniList with images + if (updateMiniList) { + Bitmap bmp = GetMiniPictue(ff); + string s = ff.code.ToString().PadLeft(3, '0'); + ilMiniatures.Images.RemoveByKey(s); + ilMiniatures.Images.Add(s, (Image)bmp); + miniList.Items[s].ImageKey = s; + } + return ff; } @@ -313,6 +346,7 @@ namespace McBitFont { vScroll.Enabled = true; } + dotPanel.Cursor = McCursor.GetCursor((int)nudBrush.Value, cellSize, gap); dotPanel.Refresh(); } @@ -456,7 +490,7 @@ namespace McBitFont { mouseDownMiddle = false; } } - + // Moving baseline Rectangle rect1, rect2; @@ -504,7 +538,7 @@ namespace McBitFont { selection2.X = i; selection2.Y = j; dotPanel.Invalidate(); - } //else history.AddPre(f, false); + } } if (e.Button == MouseButtons.None && mouseDown) { // Released a mouse button @@ -513,7 +547,7 @@ namespace McBitFont { NormPoints(ref selection1, ref selection2); dotPanel.Invalidate(); } else { - if (fChanged) { + if (fChanged) { fChanged = false; history.Add(f); } @@ -553,36 +587,46 @@ namespace McBitFont { } // Check for Shift / Ctrl keys for straight lines - if (ModifierKeys.HasFlag(Keys.Shift)) { + if (ModifierKeys.HasFlag(Keys.Shift) && mouseDown) { j = lastY; - } else if (ModifierKeys.HasFlag(Keys.Control)) { + } else if (ModifierKeys.HasFlag(Keys.Control) && mouseDown) { i = lastX; } lastX = i; lastY = j; // Paint black / white - if (e.Button == MouseButtons.Left && !f.data[i, j]) { - f.data[i, j] = true; - fChanged = true; - int x = pixelOffset + i * (cellSize + gap) - hScroll.Value; - int y = pixelOffset + j * (cellSize + gap) - vScroll.Value; - SetModified(); - rect1 = new Rectangle(x, y, cellSize, cellSize); - dotPanel.Invalidate(rect1); + if (e.Button == MouseButtons.Left) { + if (PaintPixel(i, j, true)) fChanged = true; + } - if (e.Button == MouseButtons.Right && f.data[i, j]) { - f.data[i, j] = false; - fChanged = true; - int x = pixelOffset + i * (cellSize + gap) - hScroll.Value; - int y = pixelOffset + j * (cellSize + gap) - vScroll.Value; - SetModified(); - rect1 = new Rectangle(x, y, cellSize, cellSize); - dotPanel.Invalidate(rect1); + if (e.Button == MouseButtons.Right) { + if (PaintPixel(i, j, false)) fChanged = true; } } + private bool PaintPixel(int i, int j, bool color) { + bool changed = false; + for (int a = 0; a < (int)nudBrush.Value; a++) { + if (i + a >= f.width) break; + for (int b = 0; b < (int)nudBrush.Value; b++) { + if (j + b >= f.height) break; + if (f.data[i + a, j + b] != color) { + f.data[i + a, j + b] = color; + int x = pixelOffset + (i + a) * (cellSize + gap) - hScroll.Value; + int y = pixelOffset + (j + b) * (cellSize + gap) - vScroll.Value; + Rectangle rect1 = new(x, y, cellSize, cellSize); + dotPanel.Invalidate(rect1); + SetModified(); + changed = true; + } + + } + } + return changed; + } + private void btnInvert_Click(object sender, EventArgs e) { int x, y, x2, y2; @@ -839,6 +883,7 @@ namespace McBitFont { } makeVarWidthToolStripMenuItem.Visible = monospaced; tsmiMakeVarWidth.Visible = monospaced; + zerofyWidthToolStripMenuItem.Enabled = !monospaced; CodeShiftToolStripMenuItem.Visible = !form.cbSingle.Checked; tsmiCodeShift.Visible = !form.cbSingle.Checked; lblType.Text = monospaced ? "Monospaced" : "Variable width / Single"; @@ -890,7 +935,7 @@ namespace McBitFont { nudX.Value = ff.width; nudY.Value = ff.height; f = ff; - + history.Add(code); @@ -989,6 +1034,7 @@ namespace McBitFont { tsmiMakeVarWidth.Visible = monospaced; makeVarWidthToolStripMenuItem.Visible = monospaced; + zerofyWidthToolStripMenuItem.Enabled = !monospaced; tsmiCodeShift.Visible = frames.Count > 1; CodeShiftToolStripMenuItem.Visible = frames.Count > 1; Cursor.Current = Cursors.Default; @@ -1242,6 +1288,7 @@ namespace McBitFont { monospaced = false; makeVarWidthToolStripMenuItem.Visible = false; tsmiMakeVarWidth.Visible = false; + zerofyWidthToolStripMenuItem.Enabled = true; lblType.Text = "Variable width / Single"; SetModified(true, true); } @@ -1573,5 +1620,75 @@ namespace McBitFont { } } + + private void toggleBarToolStripMenuItem_Click(object sender, EventArgs e) { + int state; + + dotPanel.Width = this.Width - (toggleBarToolStripMenuItem.Checked ? 260 : 504); + SideBarRecalc(); + if (toggleBarToolStripMenuItem.Checked) { + toggleBarToolStripMenuItem.Text = "<<"; + state = 1; + } else { + toggleBarToolStripMenuItem.Text = ">>"; + state = 0; + } + panel1.Location = sidebarLocs[state, 0]; + pnlInfo.Location = sidebarLocs[state, 1]; + miniList.Visible = !toggleBarToolStripMenuItem.Checked; + vScroll.Location = sidebarLocs[state, 2]; + hScroll.Width = dotPanel.Width; + cbZoom.Focus(); + } + + private void PrevNextMenuCheck() { + if (frames.Count < 2) { + nextSymbolToolStripMenuItem.Enabled = false; + previousSymbolToolStripMenuItem.Enabled = false; + return; + } + previousSymbolToolStripMenuItem.Enabled = f.code != frames.First().code; + nextSymbolToolStripMenuItem.Enabled = f.code != frames.Last().code; + } + private void fontToolStripMenuItem_DropDownOpening(object sender, EventArgs e) { + PrevNextMenuCheck(); + } + + private void previousSymbolToolStripMenuItem_Click(object sender, EventArgs e) { + if (f.code != frames.First().code && miniList.SelectedItems.Count > 0) { + miniList.Items[miniList.SelectedIndices[0] - 1].Selected = true; + } + PrevNextMenuCheck(); + } + + private void nextSymbolToolStripMenuItem_Click(object sender, EventArgs e) { + if (f.code != frames.Last().code && miniList.SelectedItems.Count > 0) { + miniList.Items[miniList.SelectedIndices[0] + 1].Selected = true; + } + PrevNextMenuCheck(); + } + + private void ZerofyBlankWidth(object sender, EventArgs e) { + if (monospaced) return; // Does not work for monospaced fonts + if (frames.Count < 2) return; // Does not work for single images + + bool flag = false; + for (int i = 0; i < frames.Count; i++) { + + if (IsFrameBlank(frames[i])) { + frames[i] = FrameResize(frames[i], 0, dotHeight, true); + + flag = true; + } + } + if (flag) { + SetModified(true, true); + MiniList_SelectedIndexChanged(miniList, EventArgs.Empty); + } + } + + private void nudBrush_ValueChanged(object sender, EventArgs e) { + dotPanel.Cursor = McCursor.GetCursor((int)nudBrush.Value, cellSize, gap); + } } } diff --git a/McBitFont/McBitFont.csproj b/McBitFont/McBitFont.csproj index a3b3b66..ff2d703 100644 --- a/McBitFont/McBitFont.csproj +++ b/McBitFont/McBitFont.csproj @@ -20,9 +20,9 @@ true true icon_64.ico - 2.5.0.0 - 2.5.0.0 - $(VersionPrefix)2.5.0 + 2.6.0.0 + 2.6.0.0 + $(VersionPrefix)2.6.0 Anton Mukhin diff --git a/McBitFont/McCursor.cs b/McBitFont/McCursor.cs new file mode 100644 index 0000000..c253520 --- /dev/null +++ b/McBitFont/McCursor.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Drawing.Imaging; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace McBitFont { + internal class McCursor { + + public struct IconInfo { + public bool fIcon; + public int xHotspot; + public int yHotspot; + public IntPtr hbmMask; + public IntPtr hbmColor; + } + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool GetIconInfo(IntPtr hIcon, ref IconInfo pIconInfo); + [DllImport("user32.dll")] + public static extern IntPtr CreateIconIndirect(ref IconInfo icon); + + /// + /// Create a cursor from a bitmap without resizing and with the specified + /// hot spot + /// + public static Cursor CreateCursorNoResize(Bitmap bmp, int xHotSpot, int yHotSpot) { + IntPtr ptr = bmp.GetHicon(); + IconInfo tmp = new IconInfo(); + GetIconInfo(ptr, ref tmp); + tmp.xHotspot = xHotSpot; + tmp.yHotspot = yHotSpot; + tmp.fIcon = false; + ptr = CreateIconIndirect(ref tmp); + return new Cursor(ptr); + } + + + /// + /// Create a 32x32 cursor from a bitmap, with the hot spot in the middle + /// + public static Cursor CreateCursor(Bitmap bmp) { + int xHotSpot = 16; + int yHotSpot = 16; + + IntPtr ptr = ((Bitmap)ResizeImage(bmp, 32, 32)).GetHicon(); + IconInfo tmp = new IconInfo(); + GetIconInfo(ptr, ref tmp); + tmp.xHotspot = xHotSpot; + tmp.yHotspot = yHotSpot; + tmp.fIcon = false; + ptr = CreateIconIndirect(ref tmp); + return new Cursor(ptr); + } + + + /// + /// Resize the image to the specified width and height. + /// + /// The image to resize. + /// The width to resize to. + /// The height to resize to. + /// The resized image. + public static Bitmap ResizeImage(Image image, int width, int height) { + var destRect = new Rectangle(0, 0, width, height); + var destImage = new Bitmap(width, height); + + destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution); + + using (var graphics = Graphics.FromImage(destImage)) { + graphics.CompositingMode = CompositingMode.SourceCopy; + graphics.CompositingQuality = CompositingQuality.HighQuality; + graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; + graphics.SmoothingMode = SmoothingMode.HighQuality; + graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; + + using (var wrapMode = new ImageAttributes()) { + wrapMode.SetWrapMode(WrapMode.TileFlipXY); + graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode); + } + } + + return destImage; + } + + public static Cursor GetCursor(int penSize, int cellSize, int gap) { + int size = (cellSize + gap) * penSize; + + Bitmap bmp = new(size, size); + Pen pb = new(Color.Black, 1); + SolidBrush bw = new(Color.FromArgb(160, Color.White)); + using (Graphics g = Graphics.FromImage(bmp)) { + g.DrawRectangle(pb, 0, 0, size-1, size-1); + g.FillRectangle(bw, 1, 1, size - 2, size - 2); + } + return CreateCursorNoResize(bmp, cellSize / 2, cellSize / 2); + } + + } +} diff --git a/McBitFont/Properties/Resources.Designer.cs b/McBitFont/Properties/Resources.Designer.cs index 99698dd..ee6c114 100644 --- a/McBitFont/Properties/Resources.Designer.cs +++ b/McBitFont/Properties/Resources.Designer.cs @@ -100,6 +100,26 @@ namespace McBitFont.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrow_turn_left { + get { + object obj = ResourceManager.GetObject("arrow_turn_left", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrow_turn_right { + get { + object obj = ResourceManager.GetObject("arrow_turn_right", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -320,6 +340,16 @@ namespace McBitFont.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap text_letterspacing2 { + get { + object obj = ResourceManager.GetObject("text_letterspacing2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/McBitFont/Properties/Resources.resx b/McBitFont/Properties/Resources.resx index a99b88d..b2051b4 100644 --- a/McBitFont/Properties/Resources.resx +++ b/McBitFont/Properties/Resources.resx @@ -136,18 +136,18 @@ ..\Resources\Famfamfam-Silk-Page-copy.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\font.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\picture_go.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\arrow_inout.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\font.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\redo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Famfamfam-Silk-Disk.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -181,20 +181,20 @@ ..\Resources\shading.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\arrow_turn_left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icon_32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\arrow_undo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\tick.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\arrow_undo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\arrow_redo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -208,6 +208,15 @@ ..\Resources\Famfamfam-Silk-Page-white.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\arrow_turn_right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Famfamfam-Silk-Disk.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\folder_table.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -232,7 +241,7 @@ ..\Resources\icon_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\picture_go.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\text_letterspacing2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/McBitFont/Resources/arrow_turn_left.png b/McBitFont/Resources/arrow_turn_left.png new file mode 100644 index 0000000..83328d9 Binary files /dev/null and b/McBitFont/Resources/arrow_turn_left.png differ diff --git a/McBitFont/Resources/arrow_turn_right.png b/McBitFont/Resources/arrow_turn_right.png new file mode 100644 index 0000000..629f20d Binary files /dev/null and b/McBitFont/Resources/arrow_turn_right.png differ diff --git a/McBitFont/Resources/text_letterspacing2.png b/McBitFont/Resources/text_letterspacing2.png new file mode 100644 index 0000000..fcc0db3 Binary files /dev/null and b/McBitFont/Resources/text_letterspacing2.png differ diff --git a/README.md b/README.md index 00e08f3..711a5e1 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Some basic hints on the interface: - Mouse Scroll to scroll up and down - Shift + scroll to scroll left and right - Crtl + scroll to zoom +- Alt + Scroll to change painting brush size Download in the [Releases](https://gitea.mcflyer.ru/McFLY/McBitFont/releases) section! diff --git a/TODO.txt b/TODO.txt index 1d91468..d3977b5 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,11 +1,12 @@ Application: - Consider migrating to WPF in order to make DPI aware UI - +V Option to hide symbols list to narrow the side bar +V Buttons to select previous/next symbol with shortcuts +V Custom cursor showing painting size Functionality: -V Middle mouse - drag the canvas -V Straight line painting (hold Shift / Ctrl) -V A button to Copy from Test font dialog to then paste into another frame +V Fix straight (Ctrl/Shift) lines paint to reset coordinate on mouse-up even if Ctrl/Shift is still held +V Command to make all blank symbols zero-width +V Alt-Scroll to change painting size Bugs: -V Nothing selected after removing a symbol. Potential error throw on "Apply" \ No newline at end of file diff --git a/examples/Cyrillic-pixel-7.mbfont b/examples/Cyrillic-pixel-7.mbfont new file mode 100644 index 0000000..5f04d79 Binary files /dev/null and b/examples/Cyrillic-pixel-7.mbfont differ diff --git a/examples/Font_5x7.mbfont b/examples/Font_5x7_mono.mbfont similarity index 100% rename from examples/Font_5x7.mbfont rename to examples/Font_5x7_mono.mbfont diff --git a/examples/Standard_narrow_Latin1.mbfont b/examples/Standard_narrow_Latin1.mbfont new file mode 100644 index 0000000..da847f9 Binary files /dev/null and b/examples/Standard_narrow_Latin1.mbfont differ diff --git a/examples/Standard_wide_Latin1.mbfont b/examples/Standard_wide_Latin1.mbfont new file mode 100644 index 0000000..8d55856 Binary files /dev/null and b/examples/Standard_wide_Latin1.mbfont differ diff --git a/examples/basis33_vw_cyr.mbfont b/examples/basis33_vw_cyr.mbfont new file mode 100644 index 0000000..9e842cf Binary files /dev/null and b/examples/basis33_vw_cyr.mbfont differ diff --git a/examples/pixel_3x5_Cyr.mbfont b/examples/pixel_3x5_Cyr.mbfont new file mode 100644 index 0000000..6fe8558 Binary files /dev/null and b/examples/pixel_3x5_Cyr.mbfont differ diff --git a/icons/famfamfam/arrow_turn_left.png b/icons/famfamfam/arrow_turn_left.png new file mode 100644 index 0000000..83328d9 Binary files /dev/null and b/icons/famfamfam/arrow_turn_left.png differ diff --git a/icons/famfamfam/arrow_turn_right.png b/icons/famfamfam/arrow_turn_right.png new file mode 100644 index 0000000..629f20d Binary files /dev/null and b/icons/famfamfam/arrow_turn_right.png differ diff --git a/icons/famfamfam/text_letterspacing2.png b/icons/famfamfam/text_letterspacing2.png new file mode 100644 index 0000000..fcc0db3 Binary files /dev/null and b/icons/famfamfam/text_letterspacing2.png differ diff --git a/images/Screenshot_Main.png b/images/Screenshot_Main.png index 2d63ce9..af82f2d 100644 Binary files a/images/Screenshot_Main.png and b/images/Screenshot_Main.png differ diff --git a/temp.txt b/temp.txt new file mode 100644 index 0000000..fb14d70 --- /dev/null +++ b/temp.txt @@ -0,0 +1,3 @@ +MainForm.Size: 931; 686 +panel1: 472; 31 +pnlRightButtons: