From e5f29e7b53322e11578acd0deb3b1d454998bb77 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Tue, 24 Oct 2017 11:18:12 +0100 Subject: [PATCH 01/11] All new ClassicTextBox --- Histacom2.Engine/Histacom2.Engine.csproj | 18 +- .../Properties/Resources.Designer.cs | 12 +- Histacom2.Engine/Properties/Resources.resx | 3 + .../Resources/ClassicDropDownButton.png | Bin 0 -> 222 bytes .../Template/WinClassic.Designer.cs | 1 - Histacom2.Engine/Template/WinClassic.cs | 9 - .../UI/ClassicDropDown.Designer.cs | 36 +++ Histacom2.Engine/UI/ClassicDropDown.cs | 306 ++++++++++++++++++ .../UI/ClassicTextBox.Designer.cs | 117 +++++++ Histacom2.Engine/UI/ClassicTextBox.resx | 120 +++++++ Histacom2.Engine/UI/ClassicTextbox.cs | 85 +++-- Histacom2.Engine/UI/OldClassicTextbox.cs | 77 +++++ .../Win95WindowsExplorer.Designer.cs | 142 ++++---- .../Win95/Win95Apps/Win95WindowsExplorer.cs | 19 +- .../SaveFileTroubleShooter.Designer.cs | 13 +- Histacom2/TitleScreen.Designer.cs | 9 +- Histacom2/TitleScreen.cs | 36 +-- Histacom2/TitleScreen.resx | 3 - 18 files changed, 869 insertions(+), 137 deletions(-) create mode 100644 Histacom2.Engine/Resources/ClassicDropDownButton.png create mode 100644 Histacom2.Engine/UI/ClassicDropDown.Designer.cs create mode 100644 Histacom2.Engine/UI/ClassicDropDown.cs create mode 100644 Histacom2.Engine/UI/ClassicTextBox.Designer.cs create mode 100644 Histacom2.Engine/UI/ClassicTextBox.resx create mode 100644 Histacom2.Engine/UI/OldClassicTextbox.cs diff --git a/Histacom2.Engine/Histacom2.Engine.csproj b/Histacom2.Engine/Histacom2.Engine.csproj index 889c071..57d6bbb 100644 --- a/Histacom2.Engine/Histacom2.Engine.csproj +++ b/Histacom2.Engine/Histacom2.Engine.csproj @@ -94,15 +94,25 @@ Component + + Component + + + ClassicDropDown.cs + Component Component - - Component + + UserControl + + ClassicTextBox.cs + + Component @@ -138,9 +148,13 @@ WinXP.cs + + ClassicTextBox.cs + + diff --git a/Histacom2.Engine/Properties/Resources.Designer.cs b/Histacom2.Engine/Properties/Resources.Designer.cs index 949a91c..a65020b 100644 --- a/Histacom2.Engine/Properties/Resources.Designer.cs +++ b/Histacom2.Engine/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Histacom2.Engine.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { @@ -69,6 +69,16 @@ public static System.IO.UnmanagedMemoryStream CHORD { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ClassicDropDownButton { + get { + object obj = ResourceManager.GetObject("ClassicDropDownButton", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Byte[]. /// diff --git a/Histacom2.Engine/Properties/Resources.resx b/Histacom2.Engine/Properties/Resources.resx index a6faf66..122ea03 100644 --- a/Histacom2.Engine/Properties/Resources.resx +++ b/Histacom2.Engine/Properties/Resources.resx @@ -265,4 +265,7 @@ ..\resources\winxp\window\winxp_trcorner.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ClassicDropDownButton.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Histacom2.Engine/Resources/ClassicDropDownButton.png b/Histacom2.Engine/Resources/ClassicDropDownButton.png new file mode 100644 index 0000000000000000000000000000000000000000..4cdc12f15ca01cb90ae2875a17269568dfc47ece GIT binary patch literal 222 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRt!2~3u&+eWKq!^2X+?^QKos)S9a~60+7BevL9R^{>9plvr7AHqP<7eB-rqJ!daLGX`A%TIxzM0Ydtma8KpverL Lu6{1-oD!M<{=Gl_ literal 0 HcmV?d00001 diff --git a/Histacom2.Engine/Template/WinClassic.Designer.cs b/Histacom2.Engine/Template/WinClassic.Designer.cs index 8463041..f788517 100644 --- a/Histacom2.Engine/Template/WinClassic.Designer.cs +++ b/Histacom2.Engine/Template/WinClassic.Designer.cs @@ -287,7 +287,6 @@ private void InitializeComponent() this.Text = "WinClassic"; this.Activated += new System.EventHandler(this.WinClassic_Activated); this.Deactivate += new System.EventHandler(this.WinClassic_Deactivate); - this.Paint += new System.Windows.Forms.PaintEventHandler(this.WinClassic_Paint); this.program.ResumeLayout(false); this.programtopbar.ResumeLayout(false); this.programtopbar.PerformLayout(); diff --git a/Histacom2.Engine/Template/WinClassic.cs b/Histacom2.Engine/Template/WinClassic.cs index 25cbfaa..988f268 100644 --- a/Histacom2.Engine/Template/WinClassic.cs +++ b/Histacom2.Engine/Template/WinClassic.cs @@ -165,15 +165,6 @@ private void toprightcorner_MouseMove(object sender, MouseEventArgs e) } } - private void WinClassic_Paint(object sender, PaintEventArgs e) - { - if (Resizing) - { - MessageBox.Show("HIT IT"); - e.Graphics.DrawImage(ResizingBmp, 0, 0, this.Width, this.Height); - } - } - private void border_MouseUp(object sender, MouseEventArgs e) { this.Bounds = resizer.ToDraw; diff --git a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs new file mode 100644 index 0000000..2925f72 --- /dev/null +++ b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs @@ -0,0 +1,36 @@ +namespace Histacom2.Engine.UI +{ + partial class ClassicDropDown + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/Histacom2.Engine/UI/ClassicDropDown.cs b/Histacom2.Engine/UI/ClassicDropDown.cs new file mode 100644 index 0000000..85c509a --- /dev/null +++ b/Histacom2.Engine/UI/ClassicDropDown.cs @@ -0,0 +1,306 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Histacom2.Engine.UI +{ + //public class CustomTextBox : NativeWindow + //{ + // private TextBox parentTextBox; + // private Bitmap bitmap; + // private Graphics textBoxGraphics; + // private Graphics bufferGraphics; + // // this is where we intercept the Paint event for the TextBox at the OS level   + // protected override void WndProc(ref Message m) + // { + // switch (m.Msg) + // { + // case 15: // this is the WM_PAINT message   + // // invalidate the TextBox so that it gets refreshed properly   + // parentTextBox.Invalidate(); + // // call the default win32 Paint method for the TextBox first   + // base.WndProc(ref m); + // // now use our code to draw extra stuff over the TextBox   + // this.CustomPaint(); + // break; + // default: + // base.WndProc(ref m); + // break; + // } + // } + // public CustomTextBox(TextBox textBox) + // { + // this.parentTextBox = textBox; + // this.bitmap = new Bitmap(textBox.Width, textBox.Height); + // this.bufferGraphics = Graphics.FromImage(this.bitmap); + // this.bufferGraphics.Clip = new Region(textBox.ClientRectangle); + // this.textBoxGraphics = Graphics.FromHwnd(textBox.Handle); + // // Start receiving messages (make sure you call ReleaseHandle on Dispose):   + // this.AssignHandle(textBox.Handle); + // } + // private void CustomPaint() + // { + // // code goes here, see below   + // } + //} + + public partial class ClassicDropDown : Control + { + public TextBox tb = new TextBox(); + public bool UseSystemPasswordChar { get; set; } + public int CursorPosition { get; set; } + private Timer CursorBlink { get; set; } + private bool _cursorVisible { get; set; } + + public ClassicDropDown() : base() + { + if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; + else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); + + DoubleBuffered = true; + + CursorBlink = new Timer(); + CursorBlink.Interval = 1000; + + // The stuff that make the textbox "work" + + MouseDown += new MouseEventHandler(PerformMouseDown); + MouseUp += new MouseEventHandler(PerformMouseUp); + + PreviewKeyDown += (s, e) => + { + e.IsInputKey = true; + }; + + //KeyDown += new KeyEventHandler(PerformKeyDown); + + // Remove the default textbox paint event so that we can have our own! ACTUALLY, NO! + + //FieldInfo f1 = typeof(Control).GetField("EventPaint", + // BindingFlags.Static | BindingFlags.NonPublic); + //object obj = f1.GetValue(this); + //PropertyInfo pi = GetType().GetProperty("Events", + // BindingFlags.NonPublic | BindingFlags.Instance); + //EventHandlerList list = (EventHandlerList)pi.GetValue(this, null); + //list.RemoveHandler(obj, list[obj]); + + //tb.Paint += new PaintEventHandler(PerformPaint); + //TextChanged += new EventHandler(PerformTextChanged); + //CursorBlink.Tick += new EventHandler(PerformCursorBlink); + + //CursorBlink.Start(); + + // I know it's a bit of a hack but it's all we can really do... + tb.Size = new Size(this.Size.Width - 6, this.Size.Height - 6); + tb.Location = new Point(3, 3); + tb.BorderStyle = BorderStyle.None; + Controls.Add(tb); + + + } + + protected override void OnPaint(PaintEventArgs e) + { + var textboxcolor = Color.Silver; + if (SaveSystem.currentTheme != null) textboxcolor = SaveSystem.currentTheme.windowColor; + + if (SaveSystem.currentTheme != null) BackColor = SaveSystem.currentTheme.threeDObjectsColor; + else BackColor = Color.White; + + var _lightBack = Paintbrush.GetLightFromColor(textboxcolor); + var _darkBack = Paintbrush.GetDarkFromColor(textboxcolor); + + if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; + else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); + + var g = e.Graphics; + g.Clear(BackColor); + + //g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; + //if (UseSystemPasswordChar) g.DrawString(new string('●', Text.Length), Font, Brushes.Black, 3, 3); + //else g.DrawString(Text, Font, Brushes.Black, 3, 3); + + g.DrawLine(new Pen(_darkBack), 0, 0, Width - 2, 0); + g.DrawLine(new Pen(_lightBack), Width - 1, 0, Width - 1, Height - 1); + g.DrawLine(new Pen(_lightBack), 0, Height - 1, Width - 1, Height - 1); + g.DrawLine(new Pen(_darkBack), 0, 0, 0, Height - 2); + g.DrawLine(Pens.Black, 1, 1, Width - 3, 1); + g.DrawLine(Pens.Black, 1, 1, 1, Height - 3); + g.DrawLine(new Pen(textboxcolor), 1, Height - 2, Width - 2, Height - 2); + g.DrawLine(new Pen(textboxcolor), Width - 2, Height - 2, Width - 2, 1); + + Size textSize = MeasureText(Text.Substring(0, CursorPosition), Font); // Get the width of the text from the begining to the cursor's position so it can draw the cursor. + + if (_cursorVisible) g.DrawLine(new Pen(Color.Gray), textSize.Width + 3, 4, textSize.Width + 3, Height - 4); // This is the caret! + g.DrawImage(Properties.Resources.ClassicDropDownButton, Width - 17, 2); + + base.OnPaint(e); + + } + + private void PerformMouseDown(object sender, MouseEventArgs e) + { + // TextBox: + + base.Focus(); + + // First check if it is in the bounds of the actual box + if (e.X < Width - 18 && e.X > 3 && e.Y > 3 && e.Y < Width - 2) + { + // Now to get where on text you are clicking... this is very tricky because different characters are different widths... + int Sum = 0; + int i = 0; + + foreach (char character in Text) + { + + Sum += MeasureText(character.ToString(), Font).Width; + + if (e.X - 3 <= Sum) break; + + //LastSum = Sum; + i++; + } + + //setCurPos = (Sum == 0) ? Text.Length : Sum; + //if (setCurPos > Text.Length) setCurPos = Text.Length; + CursorPosition = i; // This sets the cursor position! + } + _cursorVisible = true; + + // DropDown: + + + Invalidate(); + } + + private void PerformMouseUp(object sender, MouseEventArgs e) + { + // DropDown: + + + } + + private void PerformKeyDown(object sender, KeyEventArgs e) + { + // TextBox: + + switch (e.KeyCode) + { + case Keys.Back: + Text = Text.Remove(CursorPosition - 1, 1); + break; + case Keys.Delete: + if (!(CursorPosition > Text.Length + 1)) Text = Text.Remove(CursorPosition, 1); + break; + case Keys.Home: + CursorPosition = 0; + break; + case Keys.End: + CursorPosition = Text.Length; + break; + case Keys.Left: + if (CursorPosition > 0) CursorPosition -= 1; + break; + case Keys.Right: + if (CursorPosition < Text.Length) CursorPosition += 1; + break; + case Keys.Return: + break; + case Keys.Space: + Text = Text.Insert(CursorPosition, " "); + CursorPosition = CursorPosition + 1; + break; + default: + bool caps = false; + + if (e.Shift) caps = true; + if (Control.IsKeyLocked(Keys.CapsLock)) caps = true; + + if (char.IsLetterOrDigit((char)e.KeyCode)) + { + // Now the numbers 1, 2, 3 etc. are "d1", "d2" etc. - STUPID, RIGHT? So now we have to check if it has a number and contains "d". + + bool handled = false; + + if (StrContainsNumber(e.KeyCode.ToString().ToLower())) + { + if (e.KeyCode.ToString().ToLower().Contains("d")) + { + handled = true; + Text = Text.Insert(CursorPosition, e.KeyCode.ToString().Replace("d", "")); + } + } + + if (handled == false) + { + if (caps == false) Text = Text.Insert(CursorPosition, e.KeyCode.ToString().ToLower()); else Text = Text.Insert(CursorPosition, e.KeyCode.ToString().ToUpper()); + } + CursorPosition = CursorPosition + 1; + } + break; + } + + _cursorVisible = true; + Invalidate(); + } + + private void PerformCursorBlink(object sender, EventArgs e) + { + if (_cursorVisible) _cursorVisible = false; + else _cursorVisible = true; + Invalidate(); + } + + private void PerformTextChanged(object sender, EventArgs e) + { + _cursorVisible = true; + if (CursorPosition >= Text.Length) CursorPosition = Text.Length; + Invalidate(); + } + + public static Size MeasureText(string Text, Font Font) + { + TextFormatFlags flags + = TextFormatFlags.Left + | TextFormatFlags.Top + | TextFormatFlags.NoPadding + | TextFormatFlags.NoPrefix; + Size szProposed = new Size(int.MaxValue, int.MaxValue); + Size sz1 = TextRenderer.MeasureText(".", Font, szProposed, flags); + Size sz2 = TextRenderer.MeasureText(Text + ".", Font, szProposed, flags); + return new Size(sz2.Width - sz1.Width, sz2.Height); + } + + public bool StrContainsNumber(string str) + { + foreach (char ch in str) + { + double unused; + if (double.TryParse(ch.ToString(), out unused)) return true; + } + return false; + } + + [DllImport("gdi32.dll")] + private static extern bool BitBlt( +IntPtr hdcDest, // handle to destination DC +int nXDest, // x-coord of destination upper-left corner +int nYDest, // y-coord of destination upper-left corner +int nWidth, // width of destination rectangle +int nHeight, // height of destination rectangle +IntPtr hdcSrc, // handle to source DC +int nXSrc, // x-coordinate of source upper-left corner +int nYSrc, // y-coordinate of source upper-left corner +System.Int32 dwRop // raster operation code +); + } +} diff --git a/Histacom2.Engine/UI/ClassicTextBox.Designer.cs b/Histacom2.Engine/UI/ClassicTextBox.Designer.cs new file mode 100644 index 0000000..0e7148f --- /dev/null +++ b/Histacom2.Engine/UI/ClassicTextBox.Designer.cs @@ -0,0 +1,117 @@ +namespace Histacom2.Engine.UI +{ + partial class ClassicTextBox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.bborder = new System.Windows.Forms.PictureBox(); + this.lborder = new System.Windows.Forms.PictureBox(); + this.rborder = new System.Windows.Forms.PictureBox(); + this.tborder = new System.Windows.Forms.PictureBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + ((System.ComponentModel.ISupportInitialize)(this.bborder)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.lborder)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.rborder)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.tborder)).BeginInit(); + this.SuspendLayout(); + // + // bborder + // + this.bborder.Dock = System.Windows.Forms.DockStyle.Bottom; + this.bborder.Location = new System.Drawing.Point(2, 15); + this.bborder.Name = "bborder"; + this.bborder.Size = new System.Drawing.Size(96, 2); + this.bborder.TabIndex = 0; + this.bborder.TabStop = false; + // + // lborder + // + this.lborder.Dock = System.Windows.Forms.DockStyle.Left; + this.lborder.Location = new System.Drawing.Point(0, 0); + this.lborder.Name = "lborder"; + this.lborder.Size = new System.Drawing.Size(2, 17); + this.lborder.TabIndex = 1; + this.lborder.TabStop = false; + // + // rborder + // + this.rborder.Dock = System.Windows.Forms.DockStyle.Right; + this.rborder.Location = new System.Drawing.Point(98, 0); + this.rborder.Name = "rborder"; + this.rborder.Size = new System.Drawing.Size(2, 17); + this.rborder.TabIndex = 2; + this.rborder.TabStop = false; + // + // tborder + // + this.tborder.Dock = System.Windows.Forms.DockStyle.Top; + this.tborder.Location = new System.Drawing.Point(2, 0); + this.tborder.Name = "tborder"; + this.tborder.Size = new System.Drawing.Size(96, 2); + this.tborder.TabIndex = 3; + this.tborder.TabStop = false; + // + // textBox1 + // + this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox1.Location = new System.Drawing.Point(2, 2); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(96, 13); + this.textBox1.TabIndex = 4; + // + // ClassicTextBox + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.textBox1); + this.Controls.Add(this.tborder); + this.Controls.Add(this.bborder); + this.Controls.Add(this.rborder); + this.Controls.Add(this.lborder); + this.MaximumSize = new System.Drawing.Size(0, 17); + this.MinimumSize = new System.Drawing.Size(100, 17); + this.Name = "ClassicTextBox"; + this.Size = new System.Drawing.Size(100, 17); + ((System.ComponentModel.ISupportInitialize)(this.bborder)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.lborder)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.rborder)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tborder)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.PictureBox bborder; + private System.Windows.Forms.PictureBox lborder; + private System.Windows.Forms.PictureBox rborder; + private System.Windows.Forms.PictureBox tborder; + private System.Windows.Forms.TextBox textBox1; + } +} diff --git a/Histacom2.Engine/UI/ClassicTextBox.resx b/Histacom2.Engine/UI/ClassicTextBox.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Histacom2.Engine/UI/ClassicTextBox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Histacom2.Engine/UI/ClassicTextbox.cs b/Histacom2.Engine/UI/ClassicTextbox.cs index e38af16..8c1d8d8 100644 --- a/Histacom2.Engine/UI/ClassicTextbox.cs +++ b/Histacom2.Engine/UI/ClassicTextbox.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Drawing; +using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,47 +10,72 @@ namespace Histacom2.Engine.UI { - public class ClassicTextbox : Control + public partial class ClassicTextBox : UserControl { public bool UseSystemPasswordChar { get; set; } - public ClassicTextbox() : base() + public static Color textboxcolor = Color.Black; + + public static Color _lightBack = Color.Silver; + public static Color _darkBack = Color.Silver; + + public ClassicTextBox() { - if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; - else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - } + InitializeComponent(); - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); + try + { + // Draw the border - var textboxcolor = Color.Silver; - if (SaveSystem.currentTheme != null) textboxcolor = SaveSystem.currentTheme.windowColor; + this.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + // Update a bunch of variables! + if (SaveSystem.currentTheme != null) textBox1.Font = SaveSystem.currentTheme.buttonFont; + else textBox1.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - if (SaveSystem.currentTheme != null) BackColor = SaveSystem.currentTheme.threeDObjectsColor; - else BackColor = Color.White; + if (SaveSystem.currentTheme != null) BackColor = SaveSystem.currentTheme.threeDObjectsColor; + else BackColor = Color.White; - var _lightBack = Paintbrush.GetLightFromColor(textboxcolor); - var _darkBack = Paintbrush.GetDarkFromColor(textboxcolor); + if (SaveSystem.currentTheme != null) + { + textboxcolor = SaveSystem.currentTheme.windowColor; - if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; - else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); + _lightBack = Paintbrush.GetLightFromColor(textboxcolor); + _darkBack = Paintbrush.GetDarkFromColor(textboxcolor); + } + }); - var g = e.Graphics; - g.Clear(BackColor); - g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; - if (UseSystemPasswordChar) g.DrawString(new string('●', Text.Length), Font, Brushes.Black, 3, 3); - else g.DrawString(Text, Font, Brushes.Black, 3, 3); + tborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + e.Graphics.DrawLine(new Pen(_darkBack), 0, 0, tborder.Width, 0); + e.Graphics.DrawLine(Pens.Black, 0, 1, tborder.Width, 1); - g.DrawLine(new Pen(_darkBack), 0, 0, Width - 2, 0); - g.DrawLine(new Pen(_lightBack), Width - 1, 0, Width - 1, Height - 1); - g.DrawLine(new Pen(_lightBack), 0, Height - 1, Width - 1, Height - 1); - g.DrawLine(new Pen(_darkBack), 0, 0, 0, Height - 2); - g.DrawLine(Pens.Black, 1, 1, Width - 3, 1); - g.DrawLine(Pens.Black, 1, 1, 1, Height - 3); - g.DrawLine(new Pen(textboxcolor), 1, Height - 2, Width - 2, Height - 2); - g.DrawLine(new Pen(textboxcolor), Width - 2, Height - 2, Width - 2, 1); + }); + + lborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + e.Graphics.DrawLine(new Pen(_darkBack), 0, 0, 0, Height); + e.Graphics.DrawLine(Pens.Black, 1, 0, 1, Height); + }); + + rborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + e.Graphics.DrawLine(new Pen(_lightBack), 0, 0, 0, Height - 1); + e.Graphics.DrawLine(new Pen(textboxcolor), 1, 0, 1, Height - 1); + }); + + bborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + e.Graphics.DrawLine(new Pen(_lightBack), 0, 0, Width - 1, 0); + e.Graphics.DrawLine(new Pen(textboxcolor), 0, 1, Width - 2, 1); + }); + + tborder.Invalidate(); + lborder.Invalidate(); + rborder.Invalidate(); + bborder.Invalidate(); + } catch { } } } } diff --git a/Histacom2.Engine/UI/OldClassicTextbox.cs b/Histacom2.Engine/UI/OldClassicTextbox.cs new file mode 100644 index 0000000..f7db87d --- /dev/null +++ b/Histacom2.Engine/UI/OldClassicTextbox.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Histacom2.Engine.UI +{ + //public class OldClassicTextbox : Control + //{ + // private System.ComponentModel.IContainer components = null; + // public TextBox tb = new TextBox(); + // public bool UseSystemPasswordChar { get; set; } + + // public ClassicTextbox() : base() + // { + // // A bunch of designer stuff! + // this.components = new System.ComponentModel.Container(); + // this.SuspendLayout(); + + // if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; + // else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); + + // tb.Name = "mainText"; + // tb.Location = new Point(3, 3); + // tb.Size = new Size(Size.Width - 6, Size.Height - 6); + // tb.BorderStyle = BorderStyle.None; + // Controls.Add(tb); + + // this.ResumeLayout(false); + // } + + // protected override void Dispose(bool disposing) + // { + // if (disposing && (components != null)) + // { + // components.Dispose(); + // } + // base.Dispose(disposing); + // } + + // protected override void OnPaint(PaintEventArgs e) + // { + + // var textboxcolor = Color.Silver; + // if (SaveSystem.currentTheme != null) textboxcolor = SaveSystem.currentTheme.windowColor; + + // if (SaveSystem.currentTheme != null) BackColor = SaveSystem.currentTheme.threeDObjectsColor; + // else BackColor = Color.White; + + // var _lightBack = Paintbrush.GetLightFromColor(textboxcolor); + // var _darkBack = Paintbrush.GetDarkFromColor(textboxcolor); + + // if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; + // else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); + + // var g = e.Graphics; + // g.Clear(BackColor); + + // g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; + // if (UseSystemPasswordChar) g.DrawString(new string('●', Text.Length), Font, Brushes.Black, 3, 3); + // else g.DrawString(Text, Font, Brushes.Black, 3, 3); + + // g.DrawLine(new Pen(_darkBack), 0, 0, Width - 2, 0); + // g.DrawLine(new Pen(_lightBack), Width - 1, 0, Width - 1, Height - 1); + // g.DrawLine(new Pen(_lightBack), 0, Height - 1, Width - 1, Height - 1); + // g.DrawLine(new Pen(_darkBack), 0, 0, 0, Height - 2); + // g.DrawLine(Pens.Black, 1, 1, Width - 3, 1); + // g.DrawLine(Pens.Black, 1, 1, 1, Height - 3); + // g.DrawLine(new Pen(textboxcolor), 1, Height - 2, Width - 2, Height - 2); + // g.DrawLine(new Pen(textboxcolor), Width - 2, Height - 2, Width - 2, 1); + + // base.OnPaint(e); + // } +} diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs index 8939b84..153018a 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs @@ -30,10 +30,6 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.program = new System.Windows.Forms.Panel(); - this.pnlSave = new System.Windows.Forms.Panel(); - this.Button1 = new System.Windows.Forms.Button(); - this.Label1 = new System.Windows.Forms.Label(); - this.txtSave = new System.Windows.Forms.TextBox(); this.mainView = new System.Windows.Forms.ListView(); this.diskView = new System.Windows.Forms.TreeView(); this.MenuStrip1 = new System.Windows.Forms.MenuStrip(); @@ -58,10 +54,16 @@ private void InitializeComponent() this.bottomrightcorner = new System.Windows.Forms.Panel(); this.bottomleftcorner = new System.Windows.Forms.Panel(); this.topleftcorner = new System.Windows.Forms.Panel(); + this.pnlSave = new System.Windows.Forms.Panel(); this.refresh = new System.Windows.Forms.Timer(this.components); + this.classicLabel2 = new Histacom2.Engine.UI.ClassicLabel(); + this.classicLabel1 = new Histacom2.Engine.UI.ClassicLabel(); + this.classicButton1 = new Histacom2.Engine.UI.ClassicButton(); + this.btnSave = new Histacom2.Engine.UI.ClassicButton(); + this.txtSave = new Histacom2.Engine.UI.ClassicTextBox(); this.program.SuspendLayout(); - this.pnlSave.SuspendLayout(); this.MenuStrip1.SuspendLayout(); + this.pnlSave.SuspendLayout(); this.SuspendLayout(); // // program @@ -81,54 +83,12 @@ private void InitializeComponent() this.program.Size = new System.Drawing.Size(704, 517); this.program.TabIndex = 13; // - // pnlSave - // - this.pnlSave.Controls.Add(this.Button1); - this.pnlSave.Controls.Add(this.Label1); - this.pnlSave.Controls.Add(this.txtSave); - this.pnlSave.Dock = System.Windows.Forms.DockStyle.Bottom; - this.pnlSave.Location = new System.Drawing.Point(0, 482); - this.pnlSave.Name = "pnlSave"; - this.pnlSave.Size = new System.Drawing.Size(704, 35); - this.pnlSave.TabIndex = 18; - this.pnlSave.Visible = false; - // - // Button1 - // - this.Button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.Button1.Location = new System.Drawing.Point(629, 1); - this.Button1.Name = "Button1"; - this.Button1.Size = new System.Drawing.Size(75, 23); - this.Button1.TabIndex = 17; - this.Button1.Text = "Save"; - this.Button1.UseVisualStyleBackColor = true; - this.Button1.Click += new System.EventHandler(this.Button1_Click); - // - // Label1 - // - this.Label1.AutoSize = true; - this.Label1.Location = new System.Drawing.Point(3, 6); - this.Label1.Name = "Label1"; - this.Label1.Size = new System.Drawing.Size(57, 13); - this.Label1.TabIndex = 16; - this.Label1.Text = "File Name:"; - // - // txtSave - // - this.txtSave.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtSave.Location = new System.Drawing.Point(60, 3); - this.txtSave.Name = "txtSave"; - this.txtSave.Size = new System.Drawing.Size(563, 20); - this.txtSave.TabIndex = 15; - // // mainView // this.mainView.Dock = System.Windows.Forms.DockStyle.Fill; this.mainView.Location = new System.Drawing.Point(213, 24); this.mainView.Name = "mainView"; - this.mainView.Size = new System.Drawing.Size(491, 458); + this.mainView.Size = new System.Drawing.Size(491, 439); this.mainView.TabIndex = 10; this.mainView.UseCompatibleStateImageBehavior = false; this.mainView.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.mainView_AfterLabelEdit); @@ -139,7 +99,7 @@ private void InitializeComponent() this.diskView.Dock = System.Windows.Forms.DockStyle.Left; this.diskView.Location = new System.Drawing.Point(0, 24); this.diskView.Name = "diskView"; - this.diskView.Size = new System.Drawing.Size(213, 458); + this.diskView.Size = new System.Drawing.Size(213, 439); this.diskView.TabIndex = 13; this.diskView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.diskView_AfterSelect); // @@ -321,11 +281,84 @@ private void InitializeComponent() this.topleftcorner.Size = new System.Drawing.Size(4, 4); this.topleftcorner.TabIndex = 1; // + // pnlSave + // + this.pnlSave.Controls.Add(this.txtSave); + this.pnlSave.Controls.Add(this.classicLabel2); + this.pnlSave.Controls.Add(this.classicLabel1); + this.pnlSave.Controls.Add(this.classicButton1); + this.pnlSave.Controls.Add(this.btnSave); + this.pnlSave.Dock = System.Windows.Forms.DockStyle.Bottom; + this.pnlSave.Location = new System.Drawing.Point(0, 463); + this.pnlSave.Name = "pnlSave"; + this.pnlSave.Size = new System.Drawing.Size(704, 54); + this.pnlSave.TabIndex = 18; + this.pnlSave.Visible = false; + // // refresh // this.refresh.Interval = 15000; this.refresh.Tick += new System.EventHandler(this.refresh_Tick); // + // classicLabel2 + // + this.classicLabel2.Location = new System.Drawing.Point(3, 32); + this.classicLabel2.Name = "classicLabel2"; + this.classicLabel2.Size = new System.Drawing.Size(64, 13); + this.classicLabel2.TabIndex = 19; + this.classicLabel2.Text = "File name:"; + // + // classicLabel1 + // + this.classicLabel1.Location = new System.Drawing.Point(3, 6); + this.classicLabel1.Name = "classicLabel1"; + this.classicLabel1.Size = new System.Drawing.Size(64, 13); + this.classicLabel1.TabIndex = 19; + this.classicLabel1.Text = "File name:"; + // + // classicButton1 + // + this.classicButton1.AdaptBackColorWithTheme = true; + this.classicButton1.AdaptFontWithTheme = true; + this.classicButton1.AdaptForeColorWithTheme = true; + this.classicButton1.BackColor = System.Drawing.Color.Silver; + this.classicButton1.DialogResult = System.Windows.Forms.DialogResult.None; + this.classicButton1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.classicButton1.ForeColor = System.Drawing.Color.Black; + this.classicButton1.Location = new System.Drawing.Point(611, 29); + this.classicButton1.Name = "classicButton1"; + this.classicButton1.Size = new System.Drawing.Size(75, 23); + this.classicButton1.TabIndex = 17; + this.classicButton1.Text = "Cancel"; + this.classicButton1.Click += new System.EventHandler(this.btnSave_Click); + // + // btnSave + // + this.btnSave.AdaptBackColorWithTheme = true; + this.btnSave.AdaptFontWithTheme = true; + this.btnSave.AdaptForeColorWithTheme = true; + this.btnSave.BackColor = System.Drawing.Color.Silver; + this.btnSave.DialogResult = System.Windows.Forms.DialogResult.None; + this.btnSave.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.btnSave.ForeColor = System.Drawing.Color.Black; + this.btnSave.Location = new System.Drawing.Point(611, 1); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(75, 25); + this.btnSave.TabIndex = 17; + this.btnSave.Text = "Save"; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // + // txtSave + // + this.txtSave.BackColor = System.Drawing.Color.White; + this.txtSave.Location = new System.Drawing.Point(56, 6); + this.txtSave.MaximumSize = new System.Drawing.Size(0, 17); + this.txtSave.MinimumSize = new System.Drawing.Size(100, 17); + this.txtSave.Name = "txtSave"; + this.txtSave.Size = new System.Drawing.Size(549, 17); + this.txtSave.TabIndex = 22; + this.txtSave.UseSystemPasswordChar = false; + // // Win95WindowsExplorer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -336,10 +369,9 @@ private void InitializeComponent() this.Load += new System.EventHandler(this.WinClassicWindowsExplorer_Load); this.program.ResumeLayout(false); this.program.PerformLayout(); - this.pnlSave.ResumeLayout(false); - this.pnlSave.PerformLayout(); this.MenuStrip1.ResumeLayout(false); this.MenuStrip1.PerformLayout(); + this.pnlSave.ResumeLayout(false); this.ResumeLayout(false); } @@ -372,9 +404,11 @@ private void InitializeComponent() internal System.Windows.Forms.Panel topleftcorner; internal System.Windows.Forms.ListView mainView; internal System.Windows.Forms.Panel pnlSave; - internal System.Windows.Forms.Button Button1; - internal System.Windows.Forms.Label Label1; - internal System.Windows.Forms.TextBox txtSave; private System.Windows.Forms.Timer refresh; + private Engine.UI.ClassicButton btnSave; + private Engine.UI.ClassicButton classicButton1; + private Engine.UI.ClassicLabel classicLabel2; + private Engine.UI.ClassicLabel classicLabel1; + private Engine.UI.ClassicTextBox txtSave; } } diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index fa1e0ce..9038a96 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -36,6 +36,16 @@ public partial class Win95WindowsExplorer : UserControl public Win95WindowsExplorer() { InitializeComponent(); + + + // Fonts! yoy! + + foreach (Control ctrl in this.Controls) + { + ctrl.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); + } + + //Histacom2.Engine.UI.CustomTextBox ctb = new Histacom2.Engine.UI.CustomTextBox(textBox1); } void WinClassicWindowsExplorer_Load(object sender, EventArgs e) @@ -100,14 +110,14 @@ void WinClassicWindowsExplorer_Load(object sender, EventArgs e) if (IsFileOpenDialog == true) { pnlSave.Show(); - Button1.Text = "Open"; + btnSave.Text = "Open"; } else { if (IsFileSaveDialog == true) { pnlSave.Show(); - Button1.Text = "Save"; + btnSave.Text = "Save"; } } @@ -701,7 +711,7 @@ private void FolderToolStripMenuItem_Click(object sender, EventArgs e) RefreshTreeNode(); } - private void Button1_Click(object sender, EventArgs e) + private void btnSave_Click(object sender, EventArgs e) { try { @@ -728,9 +738,8 @@ private void Button1_Click(object sender, EventArgs e) ((Form)this.TopLevelControl).Close(); } } - } catch { - } + catch { } } private void DeleteToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/Histacom2/SaveDialogs/SaveFileTroubleShooter.Designer.cs b/Histacom2/SaveDialogs/SaveFileTroubleShooter.Designer.cs index 85c04fb..ff7b5c0 100644 --- a/Histacom2/SaveDialogs/SaveFileTroubleShooter.Designer.cs +++ b/Histacom2/SaveDialogs/SaveFileTroubleShooter.Designer.cs @@ -59,7 +59,7 @@ private void InitializeComponent() this.pnlResolved.Controls.Add(this.label2); this.pnlResolved.Location = new System.Drawing.Point(12, 38); this.pnlResolved.Name = "pnlResolved"; - this.pnlResolved.Size = new System.Drawing.Size(589, 275); + this.pnlResolved.Size = new System.Drawing.Size(518, 243); this.pnlResolved.TabIndex = 1; this.pnlResolved.Visible = false; // @@ -73,7 +73,7 @@ private void InitializeComponent() this.textBox1.Name = "textBox1"; this.textBox1.ReadOnly = true; this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.textBox1.Size = new System.Drawing.Size(567, 208); + this.textBox1.Size = new System.Drawing.Size(496, 176); this.textBox1.TabIndex = 3; // // label3 @@ -100,15 +100,15 @@ private void InitializeComponent() this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.panel2.Controls.Add(this.btnClose); this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel2.Location = new System.Drawing.Point(0, 315); + this.panel2.Location = new System.Drawing.Point(0, 283); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(612, 30); + this.panel2.Size = new System.Drawing.Size(541, 30); this.panel2.TabIndex = 2; // // btnClose // this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnClose.Location = new System.Drawing.Point(526, 4); + this.btnClose.Location = new System.Drawing.Point(455, 4); this.btnClose.Name = "btnClose"; this.btnClose.Size = new System.Drawing.Size(75, 23); this.btnClose.TabIndex = 0; @@ -120,12 +120,11 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(612, 345); + this.ClientSize = new System.Drawing.Size(541, 313); this.Controls.Add(this.panel2); this.Controls.Add(this.pnlResolved); this.Controls.Add(this.label1); this.Name = "SaveFileTroubleShooter"; - this.Text = "Save File Troubleshooter"; this.Load += new System.EventHandler(this.SaveFileTroubleShooter_Load); this.pnlResolved.ResumeLayout(false); this.pnlResolved.PerformLayout(); diff --git a/Histacom2/TitleScreen.Designer.cs b/Histacom2/TitleScreen.Designer.cs index 3d3ef0c..d73f29f 100644 --- a/Histacom2/TitleScreen.Designer.cs +++ b/Histacom2/TitleScreen.Designer.cs @@ -30,7 +30,6 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TitleScreen)); - this.vmModeTimer = new System.Windows.Forms.Timer(this.components); this.program = new System.Windows.Forms.Panel(); this.programContent = new System.Windows.Forms.Panel(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); @@ -72,10 +71,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); this.SuspendLayout(); // - // vmModeTimer - // - this.vmModeTimer.Tick += new System.EventHandler(this.vmModeTimer_Tick); - // // program // this.program.BackColor = System.Drawing.Color.Silver; @@ -148,6 +143,7 @@ private void InitializeComponent() 0, 0, 0}); + this.VM_Height.Visible = false; // // VM_Width // @@ -170,6 +166,7 @@ private void InitializeComponent() 0, 0, 0}); + this.VM_Width.Visible = false; // // vm_mode // @@ -182,6 +179,7 @@ private void InitializeComponent() this.vm_mode.TabIndex = 4; this.vm_mode.Text = "VM Mode"; this.vm_mode.UseVisualStyleBackColor = false; + this.vm_mode.CheckStateChanged += new System.EventHandler(this.vm_mode_CheckStateChanged); // // pictureBox1 // @@ -427,7 +425,6 @@ private void InitializeComponent() } #endregion - private System.Windows.Forms.Timer vmModeTimer; internal System.Windows.Forms.Panel program; internal System.Windows.Forms.Panel toprightcorner; internal System.Windows.Forms.Panel bottomrightcorner; diff --git a/Histacom2/TitleScreen.cs b/Histacom2/TitleScreen.cs index 37539d9..ea06ce2 100644 --- a/Histacom2/TitleScreen.cs +++ b/Histacom2/TitleScreen.cs @@ -137,9 +137,6 @@ private void TitleScreen_Load(object sender, EventArgs e) SettingsToolStripMenuItem.Font = new Font(pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); HelpToolStripMenuItem.Font = new Font(pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); ShutdownToolStripMenuItem.Font = new Font(pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); - - // Start the VM Mode timer - vmModeTimer.Start(); } private static void leet() @@ -155,23 +152,6 @@ private static void leet() wm.Init(leet, "Thank You", null, true, true); } - // The VM Mode timer / checker. Updates every 100ms - private void vmModeTimer_Tick(object sender, EventArgs e) - { - // Check for VM mode - if (vm_mode.Checked == true) - { - VM_Width.Visible = true; - VM_Height.Visible = true; - } - // If VM Mode is disabled - else - { - VM_Width.Visible = false; - VM_Height.Visible = false; - } - } - #region Menu Buttons #region NewGame @@ -296,5 +276,21 @@ private void achievementsToolStripMenuItem_Click(object sender, EventArgs e) AchievementScreen achievelist = new AchievementScreen(); achievelist.ShowDialog(); } + + private void vm_mode_CheckStateChanged(object sender, EventArgs e) + { + // Check for VM mode + if (vm_mode.Checked == true) + { + VM_Width.Visible = true; + VM_Height.Visible = true; + } + // If VM Mode is disabled + else + { + VM_Width.Visible = false; + VM_Height.Visible = false; + } + } } } diff --git a/Histacom2/TitleScreen.resx b/Histacom2/TitleScreen.resx index 435fff8..ba800cd 100644 --- a/Histacom2/TitleScreen.resx +++ b/Histacom2/TitleScreen.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - From 72a2b98a29ac1d3b67a4158b6a1823a39ecb5e00 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Tue, 24 Oct 2017 13:50:38 +0100 Subject: [PATCH 02/11] Finished ClassicTextBox ClassicDropDown next! --- .../UI/ClassicDropDown.Designer.cs | 7 +- Histacom2.Engine/UI/ClassicDropDown.cs | 294 +----------------- .../UI/ClassicTextBox.Designer.cs | 2 - Histacom2.Engine/UI/ClassicTextbox.cs | 7 +- .../Win95WindowsExplorer.Designer.cs | 29 +- 5 files changed, 26 insertions(+), 313 deletions(-) diff --git a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs index 2925f72..424ff69 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs @@ -2,7 +2,7 @@ { partial class ClassicDropDown { - /// + /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; @@ -22,13 +22,14 @@ protected override void Dispose(bool disposing) #region Component Designer generated code - /// - /// Required method for Designer support - do not modify + /// + /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; } #endregion diff --git a/Histacom2.Engine/UI/ClassicDropDown.cs b/Histacom2.Engine/UI/ClassicDropDown.cs index 85c509a..43e1a65 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.cs @@ -1,306 +1,20 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics; using System.Drawing; +using System.Data; using System.Linq; -using System.Reflection; -using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Histacom2.Engine.UI { - //public class CustomTextBox : NativeWindow - //{ - // private TextBox parentTextBox; - // private Bitmap bitmap; - // private Graphics textBoxGraphics; - // private Graphics bufferGraphics; - // // this is where we intercept the Paint event for the TextBox at the OS level   - // protected override void WndProc(ref Message m) - // { - // switch (m.Msg) - // { - // case 15: // this is the WM_PAINT message   - // // invalidate the TextBox so that it gets refreshed properly   - // parentTextBox.Invalidate(); - // // call the default win32 Paint method for the TextBox first   - // base.WndProc(ref m); - // // now use our code to draw extra stuff over the TextBox   - // this.CustomPaint(); - // break; - // default: - // base.WndProc(ref m); - // break; - // } - // } - // public CustomTextBox(TextBox textBox) - // { - // this.parentTextBox = textBox; - // this.bitmap = new Bitmap(textBox.Width, textBox.Height); - // this.bufferGraphics = Graphics.FromImage(this.bitmap); - // this.bufferGraphics.Clip = new Region(textBox.ClientRectangle); - // this.textBoxGraphics = Graphics.FromHwnd(textBox.Handle); - // // Start receiving messages (make sure you call ReleaseHandle on Dispose):   - // this.AssignHandle(textBox.Handle); - // } - // private void CustomPaint() - // { - // // code goes here, see below   - // } - //} - - public partial class ClassicDropDown : Control + public partial class ClassicDropDown : UserControl { - public TextBox tb = new TextBox(); - public bool UseSystemPasswordChar { get; set; } - public int CursorPosition { get; set; } - private Timer CursorBlink { get; set; } - private bool _cursorVisible { get; set; } - - public ClassicDropDown() : base() + public ClassicDropDown() { - if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; - else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - - DoubleBuffered = true; - - CursorBlink = new Timer(); - CursorBlink.Interval = 1000; - - // The stuff that make the textbox "work" - - MouseDown += new MouseEventHandler(PerformMouseDown); - MouseUp += new MouseEventHandler(PerformMouseUp); - - PreviewKeyDown += (s, e) => - { - e.IsInputKey = true; - }; - - //KeyDown += new KeyEventHandler(PerformKeyDown); - - // Remove the default textbox paint event so that we can have our own! ACTUALLY, NO! - - //FieldInfo f1 = typeof(Control).GetField("EventPaint", - // BindingFlags.Static | BindingFlags.NonPublic); - //object obj = f1.GetValue(this); - //PropertyInfo pi = GetType().GetProperty("Events", - // BindingFlags.NonPublic | BindingFlags.Instance); - //EventHandlerList list = (EventHandlerList)pi.GetValue(this, null); - //list.RemoveHandler(obj, list[obj]); - - //tb.Paint += new PaintEventHandler(PerformPaint); - //TextChanged += new EventHandler(PerformTextChanged); - //CursorBlink.Tick += new EventHandler(PerformCursorBlink); - - //CursorBlink.Start(); - - // I know it's a bit of a hack but it's all we can really do... - tb.Size = new Size(this.Size.Width - 6, this.Size.Height - 6); - tb.Location = new Point(3, 3); - tb.BorderStyle = BorderStyle.None; - Controls.Add(tb); - - + InitializeComponent(); } - - protected override void OnPaint(PaintEventArgs e) - { - var textboxcolor = Color.Silver; - if (SaveSystem.currentTheme != null) textboxcolor = SaveSystem.currentTheme.windowColor; - - if (SaveSystem.currentTheme != null) BackColor = SaveSystem.currentTheme.threeDObjectsColor; - else BackColor = Color.White; - - var _lightBack = Paintbrush.GetLightFromColor(textboxcolor); - var _darkBack = Paintbrush.GetDarkFromColor(textboxcolor); - - if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; - else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - - var g = e.Graphics; - g.Clear(BackColor); - - //g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; - //if (UseSystemPasswordChar) g.DrawString(new string('●', Text.Length), Font, Brushes.Black, 3, 3); - //else g.DrawString(Text, Font, Brushes.Black, 3, 3); - - g.DrawLine(new Pen(_darkBack), 0, 0, Width - 2, 0); - g.DrawLine(new Pen(_lightBack), Width - 1, 0, Width - 1, Height - 1); - g.DrawLine(new Pen(_lightBack), 0, Height - 1, Width - 1, Height - 1); - g.DrawLine(new Pen(_darkBack), 0, 0, 0, Height - 2); - g.DrawLine(Pens.Black, 1, 1, Width - 3, 1); - g.DrawLine(Pens.Black, 1, 1, 1, Height - 3); - g.DrawLine(new Pen(textboxcolor), 1, Height - 2, Width - 2, Height - 2); - g.DrawLine(new Pen(textboxcolor), Width - 2, Height - 2, Width - 2, 1); - - Size textSize = MeasureText(Text.Substring(0, CursorPosition), Font); // Get the width of the text from the begining to the cursor's position so it can draw the cursor. - - if (_cursorVisible) g.DrawLine(new Pen(Color.Gray), textSize.Width + 3, 4, textSize.Width + 3, Height - 4); // This is the caret! - g.DrawImage(Properties.Resources.ClassicDropDownButton, Width - 17, 2); - - base.OnPaint(e); - - } - - private void PerformMouseDown(object sender, MouseEventArgs e) - { - // TextBox: - - base.Focus(); - - // First check if it is in the bounds of the actual box - if (e.X < Width - 18 && e.X > 3 && e.Y > 3 && e.Y < Width - 2) - { - // Now to get where on text you are clicking... this is very tricky because different characters are different widths... - int Sum = 0; - int i = 0; - - foreach (char character in Text) - { - - Sum += MeasureText(character.ToString(), Font).Width; - - if (e.X - 3 <= Sum) break; - - //LastSum = Sum; - i++; - } - - //setCurPos = (Sum == 0) ? Text.Length : Sum; - //if (setCurPos > Text.Length) setCurPos = Text.Length; - CursorPosition = i; // This sets the cursor position! - } - _cursorVisible = true; - - // DropDown: - - - Invalidate(); - } - - private void PerformMouseUp(object sender, MouseEventArgs e) - { - // DropDown: - - - } - - private void PerformKeyDown(object sender, KeyEventArgs e) - { - // TextBox: - - switch (e.KeyCode) - { - case Keys.Back: - Text = Text.Remove(CursorPosition - 1, 1); - break; - case Keys.Delete: - if (!(CursorPosition > Text.Length + 1)) Text = Text.Remove(CursorPosition, 1); - break; - case Keys.Home: - CursorPosition = 0; - break; - case Keys.End: - CursorPosition = Text.Length; - break; - case Keys.Left: - if (CursorPosition > 0) CursorPosition -= 1; - break; - case Keys.Right: - if (CursorPosition < Text.Length) CursorPosition += 1; - break; - case Keys.Return: - break; - case Keys.Space: - Text = Text.Insert(CursorPosition, " "); - CursorPosition = CursorPosition + 1; - break; - default: - bool caps = false; - - if (e.Shift) caps = true; - if (Control.IsKeyLocked(Keys.CapsLock)) caps = true; - - if (char.IsLetterOrDigit((char)e.KeyCode)) - { - // Now the numbers 1, 2, 3 etc. are "d1", "d2" etc. - STUPID, RIGHT? So now we have to check if it has a number and contains "d". - - bool handled = false; - - if (StrContainsNumber(e.KeyCode.ToString().ToLower())) - { - if (e.KeyCode.ToString().ToLower().Contains("d")) - { - handled = true; - Text = Text.Insert(CursorPosition, e.KeyCode.ToString().Replace("d", "")); - } - } - - if (handled == false) - { - if (caps == false) Text = Text.Insert(CursorPosition, e.KeyCode.ToString().ToLower()); else Text = Text.Insert(CursorPosition, e.KeyCode.ToString().ToUpper()); - } - CursorPosition = CursorPosition + 1; - } - break; - } - - _cursorVisible = true; - Invalidate(); - } - - private void PerformCursorBlink(object sender, EventArgs e) - { - if (_cursorVisible) _cursorVisible = false; - else _cursorVisible = true; - Invalidate(); - } - - private void PerformTextChanged(object sender, EventArgs e) - { - _cursorVisible = true; - if (CursorPosition >= Text.Length) CursorPosition = Text.Length; - Invalidate(); - } - - public static Size MeasureText(string Text, Font Font) - { - TextFormatFlags flags - = TextFormatFlags.Left - | TextFormatFlags.Top - | TextFormatFlags.NoPadding - | TextFormatFlags.NoPrefix; - Size szProposed = new Size(int.MaxValue, int.MaxValue); - Size sz1 = TextRenderer.MeasureText(".", Font, szProposed, flags); - Size sz2 = TextRenderer.MeasureText(Text + ".", Font, szProposed, flags); - return new Size(sz2.Width - sz1.Width, sz2.Height); - } - - public bool StrContainsNumber(string str) - { - foreach (char ch in str) - { - double unused; - if (double.TryParse(ch.ToString(), out unused)) return true; - } - return false; - } - - [DllImport("gdi32.dll")] - private static extern bool BitBlt( -IntPtr hdcDest, // handle to destination DC -int nXDest, // x-coord of destination upper-left corner -int nYDest, // y-coord of destination upper-left corner -int nWidth, // width of destination rectangle -int nHeight, // height of destination rectangle -IntPtr hdcSrc, // handle to source DC -int nXSrc, // x-coordinate of source upper-left corner -int nYSrc, // y-coordinate of source upper-left corner -System.Int32 dwRop // raster operation code -); } } diff --git a/Histacom2.Engine/UI/ClassicTextBox.Designer.cs b/Histacom2.Engine/UI/ClassicTextBox.Designer.cs index 0e7148f..af6b199 100644 --- a/Histacom2.Engine/UI/ClassicTextBox.Designer.cs +++ b/Histacom2.Engine/UI/ClassicTextBox.Designer.cs @@ -93,8 +93,6 @@ private void InitializeComponent() this.Controls.Add(this.bborder); this.Controls.Add(this.rborder); this.Controls.Add(this.lborder); - this.MaximumSize = new System.Drawing.Size(0, 17); - this.MinimumSize = new System.Drawing.Size(100, 17); this.Name = "ClassicTextBox"; this.Size = new System.Drawing.Size(100, 17); ((System.ComponentModel.ISupportInitialize)(this.bborder)).EndInit(); diff --git a/Histacom2.Engine/UI/ClassicTextbox.cs b/Histacom2.Engine/UI/ClassicTextbox.cs index 8c1d8d8..a42c2b1 100644 --- a/Histacom2.Engine/UI/ClassicTextbox.cs +++ b/Histacom2.Engine/UI/ClassicTextbox.cs @@ -30,11 +30,10 @@ public ClassicTextBox() this.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => { // Update a bunch of variables! - if (SaveSystem.currentTheme != null) textBox1.Font = SaveSystem.currentTheme.buttonFont; - else textBox1.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); + textBox1.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - if (SaveSystem.currentTheme != null) BackColor = SaveSystem.currentTheme.threeDObjectsColor; - else BackColor = Color.White; + if (SaveSystem.currentTheme != null) textBox1.BackColor = SaveSystem.currentTheme.threeDObjectsColor; + else textBox1.BackColor = Color.White; if (SaveSystem.currentTheme != null) { diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs index 153018a..0f3eee8 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs @@ -55,12 +55,12 @@ private void InitializeComponent() this.bottomleftcorner = new System.Windows.Forms.Panel(); this.topleftcorner = new System.Windows.Forms.Panel(); this.pnlSave = new System.Windows.Forms.Panel(); - this.refresh = new System.Windows.Forms.Timer(this.components); + this.txtSave = new Histacom2.Engine.UI.ClassicTextBox(); this.classicLabel2 = new Histacom2.Engine.UI.ClassicLabel(); this.classicLabel1 = new Histacom2.Engine.UI.ClassicLabel(); this.classicButton1 = new Histacom2.Engine.UI.ClassicButton(); this.btnSave = new Histacom2.Engine.UI.ClassicButton(); - this.txtSave = new Histacom2.Engine.UI.ClassicTextBox(); + this.refresh = new System.Windows.Forms.Timer(this.components); this.program.SuspendLayout(); this.MenuStrip1.SuspendLayout(); this.pnlSave.SuspendLayout(); @@ -295,10 +295,17 @@ private void InitializeComponent() this.pnlSave.TabIndex = 18; this.pnlSave.Visible = false; // - // refresh + // txtSave // - this.refresh.Interval = 15000; - this.refresh.Tick += new System.EventHandler(this.refresh_Tick); + this.txtSave.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtSave.BackColor = System.Drawing.Color.White; + this.txtSave.Location = new System.Drawing.Point(56, 6); + this.txtSave.Name = "txtSave"; + this.txtSave.Size = new System.Drawing.Size(549, 17); + this.txtSave.TabIndex = 22; + this.txtSave.UseSystemPasswordChar = false; // // classicLabel2 // @@ -348,16 +355,10 @@ private void InitializeComponent() this.btnSave.Text = "Save"; this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // - // txtSave + // refresh // - this.txtSave.BackColor = System.Drawing.Color.White; - this.txtSave.Location = new System.Drawing.Point(56, 6); - this.txtSave.MaximumSize = new System.Drawing.Size(0, 17); - this.txtSave.MinimumSize = new System.Drawing.Size(100, 17); - this.txtSave.Name = "txtSave"; - this.txtSave.Size = new System.Drawing.Size(549, 17); - this.txtSave.TabIndex = 22; - this.txtSave.UseSystemPasswordChar = false; + this.refresh.Interval = 15000; + this.refresh.Tick += new System.EventHandler(this.refresh_Tick); // // Win95WindowsExplorer // From 81cde79fccd0b46e5af1109968f16f5249b27555 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Tue, 24 Oct 2017 13:55:39 +0100 Subject: [PATCH 03/11] Started on ClassicDropDown --- Histacom2.Engine/Histacom2.Engine.csproj | 5 +- .../UI/ClassicDropDown.Designer.cs | 96 +++++++++++++- Histacom2.Engine/UI/ClassicDropDown.cs | 61 +++++++++ Histacom2.Engine/UI/ClassicDropDown.resx | 120 ++++++++++++++++++ .../Win95WindowsExplorer.Designer.cs | 18 ++- 5 files changed, 297 insertions(+), 3 deletions(-) create mode 100644 Histacom2.Engine/UI/ClassicDropDown.resx diff --git a/Histacom2.Engine/Histacom2.Engine.csproj b/Histacom2.Engine/Histacom2.Engine.csproj index 128f0ab..bb10572 100644 --- a/Histacom2.Engine/Histacom2.Engine.csproj +++ b/Histacom2.Engine/Histacom2.Engine.csproj @@ -95,7 +95,7 @@ Component - Component + UserControl ClassicDropDown.cs @@ -148,6 +148,9 @@ WinXP.cs + + ClassicDropDown.cs + ClassicTextBox.cs diff --git a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs index 424ff69..da54d6e 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs @@ -28,10 +28,104 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - components = new System.ComponentModel.Container(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.tborder = new System.Windows.Forms.PictureBox(); + this.bborder = new System.Windows.Forms.PictureBox(); + this.rborder = new System.Windows.Forms.PictureBox(); + this.lborder = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.tborder)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.bborder)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.rborder)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.lborder)).BeginInit(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox1.Location = new System.Drawing.Point(2, 2); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(96, 13); + this.textBox1.TabIndex = 9; + // + // pictureBox1 + // + this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Right; + this.pictureBox1.Image = global::Histacom2.Engine.Properties.Resources.ClassicDropDownButton; + this.pictureBox1.Location = new System.Drawing.Point(82, 2); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(16, 16); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.pictureBox1.TabIndex = 10; + this.pictureBox1.TabStop = false; + // + // tborder + // + this.tborder.Dock = System.Windows.Forms.DockStyle.Top; + this.tborder.Location = new System.Drawing.Point(2, 0); + this.tborder.Name = "tborder"; + this.tborder.Size = new System.Drawing.Size(96, 2); + this.tborder.TabIndex = 8; + this.tborder.TabStop = false; + // + // bborder + // + this.bborder.Dock = System.Windows.Forms.DockStyle.Bottom; + this.bborder.Location = new System.Drawing.Point(2, 18); + this.bborder.Name = "bborder"; + this.bborder.Size = new System.Drawing.Size(96, 2); + this.bborder.TabIndex = 5; + this.bborder.TabStop = false; + // + // rborder + // + this.rborder.Dock = System.Windows.Forms.DockStyle.Right; + this.rborder.Location = new System.Drawing.Point(98, 0); + this.rborder.Name = "rborder"; + this.rborder.Size = new System.Drawing.Size(2, 20); + this.rborder.TabIndex = 7; + this.rborder.TabStop = false; + // + // lborder + // + this.lborder.Dock = System.Windows.Forms.DockStyle.Left; + this.lborder.Location = new System.Drawing.Point(0, 0); + this.lborder.Name = "lborder"; + this.lborder.Size = new System.Drawing.Size(2, 20); + this.lborder.TabIndex = 6; + this.lborder.TabStop = false; + // + // ClassicDropDown + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.tborder); + this.Controls.Add(this.bborder); + this.Controls.Add(this.rborder); + this.Controls.Add(this.lborder); + this.Name = "ClassicDropDown"; + this.Size = new System.Drawing.Size(100, 20); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tborder)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.bborder)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.rborder)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.lborder)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.PictureBox tborder; + private System.Windows.Forms.PictureBox bborder; + private System.Windows.Forms.PictureBox rborder; + private System.Windows.Forms.PictureBox lborder; + private System.Windows.Forms.PictureBox pictureBox1; } } diff --git a/Histacom2.Engine/UI/ClassicDropDown.cs b/Histacom2.Engine/UI/ClassicDropDown.cs index 43e1a65..b26862e 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.cs @@ -12,9 +12,70 @@ namespace Histacom2.Engine.UI { public partial class ClassicDropDown : UserControl { + public bool UseSystemPasswordChar { get; set; } + + public static Color textboxcolor = Color.Black; + + public static Color _lightBack = Color.Silver; + public static Color _darkBack = Color.Silver; + public ClassicDropDown() { InitializeComponent(); + + try + { + // Draw the border + + this.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + // Update a bunch of variables! + textBox1.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); + + if (SaveSystem.currentTheme != null) textBox1.BackColor = SaveSystem.currentTheme.threeDObjectsColor; + else textBox1.BackColor = Color.White; + + if (SaveSystem.currentTheme != null) + { + textboxcolor = SaveSystem.currentTheme.windowColor; + + _lightBack = Paintbrush.GetLightFromColor(textboxcolor); + _darkBack = Paintbrush.GetDarkFromColor(textboxcolor); + } + }); + + + tborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + e.Graphics.DrawLine(new Pen(_darkBack), 0, 0, tborder.Width, 0); + e.Graphics.DrawLine(Pens.Black, 0, 1, tborder.Width, 1); + + }); + + lborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + e.Graphics.DrawLine(new Pen(_darkBack), 0, 0, 0, Height); + e.Graphics.DrawLine(Pens.Black, 1, 0, 1, Height); + }); + + rborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + e.Graphics.DrawLine(new Pen(_lightBack), 0, 0, 0, Height - 1); + e.Graphics.DrawLine(new Pen(textboxcolor), 1, 0, 1, Height - 1); + }); + + bborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => + { + e.Graphics.DrawLine(new Pen(_lightBack), 0, 0, Width - 1, 0); + e.Graphics.DrawLine(new Pen(textboxcolor), 0, 1, Width - 2, 1); + }); + + tborder.Invalidate(); + lborder.Invalidate(); + rborder.Invalidate(); + bborder.Invalidate(); + } + catch { } } } } diff --git a/Histacom2.Engine/UI/ClassicDropDown.resx b/Histacom2.Engine/UI/ClassicDropDown.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Histacom2.Engine/UI/ClassicDropDown.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs index 0f3eee8..8da51f7 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs @@ -55,6 +55,7 @@ private void InitializeComponent() this.bottomleftcorner = new System.Windows.Forms.Panel(); this.topleftcorner = new System.Windows.Forms.Panel(); this.pnlSave = new System.Windows.Forms.Panel(); + this.classicDropDown1 = new Histacom2.Engine.UI.ClassicDropDown(); this.txtSave = new Histacom2.Engine.UI.ClassicTextBox(); this.classicLabel2 = new Histacom2.Engine.UI.ClassicLabel(); this.classicLabel1 = new Histacom2.Engine.UI.ClassicLabel(); @@ -283,6 +284,7 @@ private void InitializeComponent() // // pnlSave // + this.pnlSave.Controls.Add(this.classicDropDown1); this.pnlSave.Controls.Add(this.txtSave); this.pnlSave.Controls.Add(this.classicLabel2); this.pnlSave.Controls.Add(this.classicLabel1); @@ -295,6 +297,17 @@ private void InitializeComponent() this.pnlSave.TabIndex = 18; this.pnlSave.Visible = false; // + // classicDropDown1 + // + this.classicDropDown1.BackColor = System.Drawing.Color.White; + this.classicDropDown1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.classicDropDown1.Location = new System.Drawing.Point(56, 31); + this.classicDropDown1.Name = "classicDropDown1"; + this.classicDropDown1.Size = new System.Drawing.Size(549, 20); + this.classicDropDown1.TabIndex = 23; + this.classicDropDown1.Text = "classicDropDown1"; + this.classicDropDown1.UseSystemPasswordChar = false; + // // txtSave // this.txtSave.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -309,14 +322,16 @@ private void InitializeComponent() // // classicLabel2 // + this.classicLabel2.DropShadow = false; this.classicLabel2.Location = new System.Drawing.Point(3, 32); this.classicLabel2.Name = "classicLabel2"; this.classicLabel2.Size = new System.Drawing.Size(64, 13); this.classicLabel2.TabIndex = 19; - this.classicLabel2.Text = "File name:"; + this.classicLabel2.Text = "File type:"; // // classicLabel1 // + this.classicLabel1.DropShadow = false; this.classicLabel1.Location = new System.Drawing.Point(3, 6); this.classicLabel1.Name = "classicLabel1"; this.classicLabel1.Size = new System.Drawing.Size(64, 13); @@ -411,5 +426,6 @@ private void InitializeComponent() private Engine.UI.ClassicLabel classicLabel2; private Engine.UI.ClassicLabel classicLabel1; private Engine.UI.ClassicTextBox txtSave; + private Engine.UI.ClassicDropDown classicDropDown1; } } From 2a473d05a34afe51cf0f5340cbdd48ad4e771657 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Sat, 4 Nov 2017 08:51:38 +0000 Subject: [PATCH 04/11] ClassicDropDown + ClassicTextBox! Finally! It only took 2 months... --- Histacom2.Engine/Histacom2.Engine.csproj | 19 ++- .../Template/DropDownItem.Designer.cs | 63 +++++++++ Histacom2.Engine/Template/DropDownItem.cs | 42 ++++++ Histacom2.Engine/Template/DropDownItem.resx | 120 ++++++++++++++++++ .../Template/DropDownOverlay.Designer.cs | 64 ++++++++++ Histacom2.Engine/Template/DropDownOverlay.cs | 26 ++++ .../Template/DropDownOverlay.resx | 120 ++++++++++++++++++ .../UI/ClassicDropDown.Designer.cs | 30 +++-- Histacom2.Engine/UI/ClassicDropDown.cs | 82 +++++++++++- Histacom2.Engine/UI/ClassicTextbox.cs | 12 +- Histacom2.Engine/UI/OldClassicTextbox.cs | 77 ----------- .../Win95WindowsExplorer.Designer.cs | 86 +++++-------- .../Win95/Win95Apps/Win95WindowsExplorer.cs | 2 + 13 files changed, 590 insertions(+), 153 deletions(-) create mode 100644 Histacom2.Engine/Template/DropDownItem.Designer.cs create mode 100644 Histacom2.Engine/Template/DropDownItem.cs create mode 100644 Histacom2.Engine/Template/DropDownItem.resx create mode 100644 Histacom2.Engine/Template/DropDownOverlay.Designer.cs create mode 100644 Histacom2.Engine/Template/DropDownOverlay.cs create mode 100644 Histacom2.Engine/Template/DropDownOverlay.resx delete mode 100644 Histacom2.Engine/UI/OldClassicTextbox.cs diff --git a/Histacom2.Engine/Histacom2.Engine.csproj b/Histacom2.Engine/Histacom2.Engine.csproj index bb10572..46d7427 100644 --- a/Histacom2.Engine/Histacom2.Engine.csproj +++ b/Histacom2.Engine/Histacom2.Engine.csproj @@ -54,6 +54,18 @@ + + UserControl + + + DropDownItem.cs + + + Form + + + DropDownOverlay.cs + Form @@ -112,7 +124,6 @@ ClassicTextBox.cs - Component @@ -130,6 +141,12 @@ PublicResXFileCodeGenerator Resources.Designer.cs + + DropDownItem.cs + + + DropDownOverlay.cs + ResizeOverlay.cs diff --git a/Histacom2.Engine/Template/DropDownItem.Designer.cs b/Histacom2.Engine/Template/DropDownItem.Designer.cs new file mode 100644 index 0000000..1318726 --- /dev/null +++ b/Histacom2.Engine/Template/DropDownItem.Designer.cs @@ -0,0 +1,63 @@ +namespace Histacom2.Engine.Template +{ + partial class DropDownItem + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Dock = System.Windows.Forms.DockStyle.Fill; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(315, 20); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter; + this.label1.Click += new System.EventHandler(this.label1_Click); + this.label1.MouseEnter += new System.EventHandler(this.label1_MouseEnter); + this.label1.MouseLeave += new System.EventHandler(this.label1_MouseLeave); + // + // DropDownItem + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Transparent; + this.Controls.Add(this.label1); + this.Name = "DropDownItem"; + this.Size = new System.Drawing.Size(315, 20); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label1; + } +} diff --git a/Histacom2.Engine/Template/DropDownItem.cs b/Histacom2.Engine/Template/DropDownItem.cs new file mode 100644 index 0000000..8b2c654 --- /dev/null +++ b/Histacom2.Engine/Template/DropDownItem.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Histacom2.Engine.Template +{ + public partial class DropDownItem : UserControl + { + public UI.ClassicDropDown dpdw; + public DropDownItem() + { + InitializeComponent(); + } + + public void ChangeText(string newText, Font fnt) + { + label1.Font = fnt; + label1.Text = newText; + } + + private void label1_MouseLeave(object sender, EventArgs e) + { + label1.BackColor = Color.Transparent; + } + + private void label1_Click(object sender, EventArgs e) + { + dpdw.ChooseItem(label1.Text); + } + + private void label1_MouseEnter(object sender, EventArgs e) + { + label1.BackColor = Color.Blue; + } + } +} diff --git a/Histacom2.Engine/Template/DropDownItem.resx b/Histacom2.Engine/Template/DropDownItem.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Histacom2.Engine/Template/DropDownItem.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Histacom2.Engine/Template/DropDownOverlay.Designer.cs b/Histacom2.Engine/Template/DropDownOverlay.Designer.cs new file mode 100644 index 0000000..6894433 --- /dev/null +++ b/Histacom2.Engine/Template/DropDownOverlay.Designer.cs @@ -0,0 +1,64 @@ +namespace Histacom2.Engine.Template +{ + partial class DropDownOverlay + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.outline = new System.Windows.Forms.Panel(); + this.SuspendLayout(); + // + // outline + // + this.outline.BackColor = System.Drawing.Color.White; + this.outline.Location = new System.Drawing.Point(230, 56); + this.outline.Name = "outline"; + this.outline.Size = new System.Drawing.Size(200, 100); + this.outline.TabIndex = 0; + this.outline.Paint += new System.Windows.Forms.PaintEventHandler(this.outline_Paint); + // + // DropDownOverlay + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(0)))), ((int)(((byte)(1))))); + this.ClientSize = new System.Drawing.Size(628, 210); + this.Controls.Add(this.outline); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "DropDownOverlay"; + this.Text = "DropDownOverlay"; + this.TopMost = true; + this.TransparencyKey = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(0)))), ((int)(((byte)(1))))); + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + this.ResumeLayout(false); + + } + + #endregion + + public System.Windows.Forms.Panel outline; + } +} \ No newline at end of file diff --git a/Histacom2.Engine/Template/DropDownOverlay.cs b/Histacom2.Engine/Template/DropDownOverlay.cs new file mode 100644 index 0000000..4d364d6 --- /dev/null +++ b/Histacom2.Engine/Template/DropDownOverlay.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Histacom2.Engine.Template +{ + public partial class DropDownOverlay : Form + { + public DropDownOverlay() + { + InitializeComponent(); + } + + private void outline_Paint(object sender, PaintEventArgs e) + { + e.Graphics.DrawRectangle(Pens.Black, 0, 0, outline.Width - 1, outline.Height - 1); // Draws a 1 pixel border around the dropdown's drop area! + if (SaveSystem.currentTheme != null) outline.BackColor = SaveSystem.currentTheme.threeDObjectsColor; + } + } +} diff --git a/Histacom2.Engine/Template/DropDownOverlay.resx b/Histacom2.Engine/Template/DropDownOverlay.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Histacom2.Engine/Template/DropDownOverlay.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs index da54d6e..509c04d 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.Designer.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.Designer.cs @@ -29,12 +29,12 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.textBox1 = new System.Windows.Forms.TextBox(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.dropDownSwitch = new System.Windows.Forms.PictureBox(); this.tborder = new System.Windows.Forms.PictureBox(); this.bborder = new System.Windows.Forms.PictureBox(); this.rborder = new System.Windows.Forms.PictureBox(); this.lborder = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dropDownSwitch)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tborder)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bborder)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rborder)).BeginInit(); @@ -50,16 +50,17 @@ private void InitializeComponent() this.textBox1.Size = new System.Drawing.Size(96, 13); this.textBox1.TabIndex = 9; // - // pictureBox1 + // dropDownSwitch // - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Right; - this.pictureBox1.Image = global::Histacom2.Engine.Properties.Resources.ClassicDropDownButton; - this.pictureBox1.Location = new System.Drawing.Point(82, 2); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(16, 16); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.pictureBox1.TabIndex = 10; - this.pictureBox1.TabStop = false; + this.dropDownSwitch.Dock = System.Windows.Forms.DockStyle.Right; + this.dropDownSwitch.Image = global::Histacom2.Engine.Properties.Resources.ClassicDropDownButton; + this.dropDownSwitch.Location = new System.Drawing.Point(82, 2); + this.dropDownSwitch.Name = "dropDownSwitch"; + this.dropDownSwitch.Size = new System.Drawing.Size(16, 16); + this.dropDownSwitch.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.dropDownSwitch.TabIndex = 10; + this.dropDownSwitch.TabStop = false; + this.dropDownSwitch.Click += new System.EventHandler(this.dropDownSwitch_Click); // // tborder // @@ -101,7 +102,7 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.dropDownSwitch); this.Controls.Add(this.textBox1); this.Controls.Add(this.tborder); this.Controls.Add(this.bborder); @@ -109,7 +110,8 @@ private void InitializeComponent() this.Controls.Add(this.lborder); this.Name = "ClassicDropDown"; this.Size = new System.Drawing.Size(100, 20); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.Load += new System.EventHandler(this.ClassicDropDown_Load); + ((System.ComponentModel.ISupportInitialize)(this.dropDownSwitch)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tborder)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bborder)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.rborder)).EndInit(); @@ -126,6 +128,6 @@ private void InitializeComponent() private System.Windows.Forms.PictureBox bborder; private System.Windows.Forms.PictureBox rborder; private System.Windows.Forms.PictureBox lborder; - private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.PictureBox dropDownSwitch; } } diff --git a/Histacom2.Engine/UI/ClassicDropDown.cs b/Histacom2.Engine/UI/ClassicDropDown.cs index b26862e..0b56cb9 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.cs @@ -7,22 +7,28 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using Histacom2.Engine.Template; namespace Histacom2.Engine.UI { public partial class ClassicDropDown : UserControl { + public DropDownOverlay thisOverlay = new DropDownOverlay(); public bool UseSystemPasswordChar { get; set; } + public bool dropDownShown; public static Color textboxcolor = Color.Black; public static Color _lightBack = Color.Silver; public static Color _darkBack = Color.Silver; + public List items = new List { "TestItem" }; + public ClassicDropDown() { InitializeComponent(); + try { // Draw the border @@ -30,20 +36,26 @@ public ClassicDropDown() this.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => { // Update a bunch of variables! - textBox1.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - - if (SaveSystem.currentTheme != null) textBox1.BackColor = SaveSystem.currentTheme.threeDObjectsColor; - else textBox1.BackColor = Color.White; + textBox1.Font = Font; if (SaveSystem.currentTheme != null) { + textBox1.BackColor = SaveSystem.currentTheme.threeDObjectsColor; + BackColor = SaveSystem.currentTheme.threeDObjectsColor; + textboxcolor = SaveSystem.currentTheme.windowColor; _lightBack = Paintbrush.GetLightFromColor(textboxcolor); _darkBack = Paintbrush.GetDarkFromColor(textboxcolor); } + else + { + textBox1.BackColor = Color.White; + BackColor = Color.White; + } }); + tborder.Paint += new PaintEventHandler((object sender, PaintEventArgs e) => { @@ -77,5 +89,67 @@ public ClassicDropDown() } catch { } } + + public void ChooseItem(string str) + { + textBox1.Text = str; + ShowHideDropDown(); + } + + public void ShowHideDropDown() + { + if (dropDownShown) + { + thisOverlay.Close(); + dropDownShown = false; + } else { + thisOverlay = new DropDownOverlay(); + int applyHeight = 0; + foreach (string str in items) + { + DropDownItem itm = new DropDownItem(); + itm.ChangeText(str, Font); + itm.dpdw = this; + itm.Dock = DockStyle.Top; + applyHeight += itm.Height; + thisOverlay.outline.Controls.Add(itm); + } + thisOverlay.outline.Location = this.PointToScreen(Point.Empty); + thisOverlay.outline.Top += this.Height; + thisOverlay.outline.Size = new Size(this.Width, applyHeight); + + thisOverlay.Deactivate += (sender2, e2) => { thisOverlay.Close(); dropDownShown = false; }; + + thisOverlay.Show(); + dropDownShown = true; + } + } + + private void dropDownSwitch_Click(object sender, EventArgs e) + { + ShowHideDropDown(); + } + + private void ClassicDropDown_Load(object sender, EventArgs e) + { + try + { + ((Form)this.TopLevelControl).FormClosed += (sender2, e2) => { thisOverlay.Close(); }; + ((Form)this.TopLevelControl).Resize += (sender2, e2) => + { + thisOverlay.outline.Location = this.PointToScreen(Point.Empty); + thisOverlay.outline.Top += this.Height; + thisOverlay.BringToFront(); + }; + + ((Form)this.TopLevelControl).Move += (sender2, e2) => + { + thisOverlay.outline.Location = this.PointToScreen(Point.Empty); + thisOverlay.outline.Top += this.Height; + thisOverlay.BringToFront(); + }; + } catch { } + + } } } diff --git a/Histacom2.Engine/UI/ClassicTextbox.cs b/Histacom2.Engine/UI/ClassicTextbox.cs index a42c2b1..8f1f9c3 100644 --- a/Histacom2.Engine/UI/ClassicTextbox.cs +++ b/Histacom2.Engine/UI/ClassicTextbox.cs @@ -32,8 +32,16 @@ public ClassicTextBox() // Update a bunch of variables! textBox1.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - if (SaveSystem.currentTheme != null) textBox1.BackColor = SaveSystem.currentTheme.threeDObjectsColor; - else textBox1.BackColor = Color.White; + if (SaveSystem.currentTheme != null) + { + textBox1.BackColor = SaveSystem.currentTheme.threeDObjectsColor; + BackColor = SaveSystem.currentTheme.threeDObjectsColor; + } + else + { + textBox1.BackColor = Color.White; + BackColor = Color.White; + } if (SaveSystem.currentTheme != null) { diff --git a/Histacom2.Engine/UI/OldClassicTextbox.cs b/Histacom2.Engine/UI/OldClassicTextbox.cs deleted file mode 100644 index f7db87d..0000000 --- a/Histacom2.Engine/UI/OldClassicTextbox.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Histacom2.Engine.UI -{ - //public class OldClassicTextbox : Control - //{ - // private System.ComponentModel.IContainer components = null; - // public TextBox tb = new TextBox(); - // public bool UseSystemPasswordChar { get; set; } - - // public ClassicTextbox() : base() - // { - // // A bunch of designer stuff! - // this.components = new System.ComponentModel.Container(); - // this.SuspendLayout(); - - // if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; - // else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - - // tb.Name = "mainText"; - // tb.Location = new Point(3, 3); - // tb.Size = new Size(Size.Width - 6, Size.Height - 6); - // tb.BorderStyle = BorderStyle.None; - // Controls.Add(tb); - - // this.ResumeLayout(false); - // } - - // protected override void Dispose(bool disposing) - // { - // if (disposing && (components != null)) - // { - // components.Dispose(); - // } - // base.Dispose(disposing); - // } - - // protected override void OnPaint(PaintEventArgs e) - // { - - // var textboxcolor = Color.Silver; - // if (SaveSystem.currentTheme != null) textboxcolor = SaveSystem.currentTheme.windowColor; - - // if (SaveSystem.currentTheme != null) BackColor = SaveSystem.currentTheme.threeDObjectsColor; - // else BackColor = Color.White; - - // var _lightBack = Paintbrush.GetLightFromColor(textboxcolor); - // var _darkBack = Paintbrush.GetDarkFromColor(textboxcolor); - - // if (SaveSystem.currentTheme != null) Font = SaveSystem.currentTheme.buttonFont; - // else Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); - - // var g = e.Graphics; - // g.Clear(BackColor); - - // g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; - // if (UseSystemPasswordChar) g.DrawString(new string('●', Text.Length), Font, Brushes.Black, 3, 3); - // else g.DrawString(Text, Font, Brushes.Black, 3, 3); - - // g.DrawLine(new Pen(_darkBack), 0, 0, Width - 2, 0); - // g.DrawLine(new Pen(_lightBack), Width - 1, 0, Width - 1, Height - 1); - // g.DrawLine(new Pen(_lightBack), 0, Height - 1, Width - 1, Height - 1); - // g.DrawLine(new Pen(_darkBack), 0, 0, 0, Height - 2); - // g.DrawLine(Pens.Black, 1, 1, Width - 3, 1); - // g.DrawLine(Pens.Black, 1, 1, 1, Height - 3); - // g.DrawLine(new Pen(textboxcolor), 1, Height - 2, Width - 2, Height - 2); - // g.DrawLine(new Pen(textboxcolor), Width - 2, Height - 2, Width - 2, 1); - - // base.OnPaint(e); - // } -} diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs index 8da51f7..2a96033 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs @@ -51,17 +51,15 @@ private void InitializeComponent() this.HelpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.AboutWindows95ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toprightcorner = new System.Windows.Forms.Panel(); - this.bottomrightcorner = new System.Windows.Forms.Panel(); - this.bottomleftcorner = new System.Windows.Forms.Panel(); this.topleftcorner = new System.Windows.Forms.Panel(); this.pnlSave = new System.Windows.Forms.Panel(); - this.classicDropDown1 = new Histacom2.Engine.UI.ClassicDropDown(); + this.cmbType = new Histacom2.Engine.UI.ClassicDropDown(); this.txtSave = new Histacom2.Engine.UI.ClassicTextBox(); this.classicLabel2 = new Histacom2.Engine.UI.ClassicLabel(); this.classicLabel1 = new Histacom2.Engine.UI.ClassicLabel(); - this.classicButton1 = new Histacom2.Engine.UI.ClassicButton(); this.btnSave = new Histacom2.Engine.UI.ClassicButton(); this.refresh = new System.Windows.Forms.Timer(this.components); + this.btnCanc = new Histacom2.Engine.UI.ClassicButton(); this.program.SuspendLayout(); this.MenuStrip1.SuspendLayout(); this.pnlSave.SuspendLayout(); @@ -74,8 +72,6 @@ private void InitializeComponent() this.program.Controls.Add(this.diskView); this.program.Controls.Add(this.MenuStrip1); this.program.Controls.Add(this.toprightcorner); - this.program.Controls.Add(this.bottomrightcorner); - this.program.Controls.Add(this.bottomleftcorner); this.program.Controls.Add(this.topleftcorner); this.program.Controls.Add(this.pnlSave); this.program.Dock = System.Windows.Forms.DockStyle.Fill; @@ -258,23 +254,6 @@ private void InitializeComponent() this.toprightcorner.Size = new System.Drawing.Size(4, 4); this.toprightcorner.TabIndex = 6; // - // bottomrightcorner - // - this.bottomrightcorner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bottomrightcorner.Cursor = System.Windows.Forms.Cursors.SizeNWSE; - this.bottomrightcorner.Location = new System.Drawing.Point(700, 513); - this.bottomrightcorner.Name = "bottomrightcorner"; - this.bottomrightcorner.Size = new System.Drawing.Size(4, 4); - this.bottomrightcorner.TabIndex = 4; - // - // bottomleftcorner - // - this.bottomleftcorner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.bottomleftcorner.Location = new System.Drawing.Point(0, 513); - this.bottomleftcorner.Name = "bottomleftcorner"; - this.bottomleftcorner.Size = new System.Drawing.Size(4, 4); - this.bottomleftcorner.TabIndex = 2; - // // topleftcorner // this.topleftcorner.Location = new System.Drawing.Point(0, 0); @@ -284,11 +263,11 @@ private void InitializeComponent() // // pnlSave // - this.pnlSave.Controls.Add(this.classicDropDown1); + this.pnlSave.Controls.Add(this.btnCanc); + this.pnlSave.Controls.Add(this.cmbType); this.pnlSave.Controls.Add(this.txtSave); this.pnlSave.Controls.Add(this.classicLabel2); this.pnlSave.Controls.Add(this.classicLabel1); - this.pnlSave.Controls.Add(this.classicButton1); this.pnlSave.Controls.Add(this.btnSave); this.pnlSave.Dock = System.Windows.Forms.DockStyle.Bottom; this.pnlSave.Location = new System.Drawing.Point(0, 463); @@ -297,16 +276,15 @@ private void InitializeComponent() this.pnlSave.TabIndex = 18; this.pnlSave.Visible = false; // - // classicDropDown1 + // cmbType // - this.classicDropDown1.BackColor = System.Drawing.Color.White; - this.classicDropDown1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); - this.classicDropDown1.Location = new System.Drawing.Point(56, 31); - this.classicDropDown1.Name = "classicDropDown1"; - this.classicDropDown1.Size = new System.Drawing.Size(549, 20); - this.classicDropDown1.TabIndex = 23; - this.classicDropDown1.Text = "classicDropDown1"; - this.classicDropDown1.UseSystemPasswordChar = false; + this.cmbType.BackColor = System.Drawing.Color.White; + this.cmbType.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.cmbType.Location = new System.Drawing.Point(56, 31); + this.cmbType.Name = "cmbType"; + this.cmbType.Size = new System.Drawing.Size(549, 20); + this.cmbType.TabIndex = 23; + this.cmbType.UseSystemPasswordChar = false; // // txtSave // @@ -316,7 +294,7 @@ private void InitializeComponent() this.txtSave.BackColor = System.Drawing.Color.White; this.txtSave.Location = new System.Drawing.Point(56, 6); this.txtSave.Name = "txtSave"; - this.txtSave.Size = new System.Drawing.Size(549, 17); + this.txtSave.Size = new System.Drawing.Size(549, 20); this.txtSave.TabIndex = 22; this.txtSave.UseSystemPasswordChar = false; // @@ -338,27 +316,12 @@ private void InitializeComponent() this.classicLabel1.TabIndex = 19; this.classicLabel1.Text = "File name:"; // - // classicButton1 - // - this.classicButton1.AdaptBackColorWithTheme = true; - this.classicButton1.AdaptFontWithTheme = true; - this.classicButton1.AdaptForeColorWithTheme = true; - this.classicButton1.BackColor = System.Drawing.Color.Silver; - this.classicButton1.DialogResult = System.Windows.Forms.DialogResult.None; - this.classicButton1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); - this.classicButton1.ForeColor = System.Drawing.Color.Black; - this.classicButton1.Location = new System.Drawing.Point(611, 29); - this.classicButton1.Name = "classicButton1"; - this.classicButton1.Size = new System.Drawing.Size(75, 23); - this.classicButton1.TabIndex = 17; - this.classicButton1.Text = "Cancel"; - this.classicButton1.Click += new System.EventHandler(this.btnSave_Click); - // // btnSave // this.btnSave.AdaptBackColorWithTheme = true; this.btnSave.AdaptFontWithTheme = true; this.btnSave.AdaptForeColorWithTheme = true; + this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnSave.BackColor = System.Drawing.Color.Silver; this.btnSave.DialogResult = System.Windows.Forms.DialogResult.None; this.btnSave.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); @@ -375,6 +338,21 @@ private void InitializeComponent() this.refresh.Interval = 15000; this.refresh.Tick += new System.EventHandler(this.refresh_Tick); // + // btnCanc + // + this.btnCanc.AdaptBackColorWithTheme = true; + this.btnCanc.AdaptFontWithTheme = true; + this.btnCanc.AdaptForeColorWithTheme = true; + this.btnCanc.BackColor = System.Drawing.Color.Silver; + this.btnCanc.DialogResult = System.Windows.Forms.DialogResult.None; + this.btnCanc.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.btnCanc.ForeColor = System.Drawing.Color.Black; + this.btnCanc.Location = new System.Drawing.Point(611, 27); + this.btnCanc.Name = "btnCanc"; + this.btnCanc.Size = new System.Drawing.Size(75, 25); + this.btnCanc.TabIndex = 24; + this.btnCanc.Text = "Cancel"; + // // Win95WindowsExplorer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -415,17 +393,15 @@ private void InitializeComponent() internal System.Windows.Forms.ToolStripMenuItem HelpToolStripMenuItem1; internal System.Windows.Forms.ToolStripMenuItem AboutWindows95ToolStripMenuItem; internal System.Windows.Forms.Panel toprightcorner; - internal System.Windows.Forms.Panel bottomrightcorner; - internal System.Windows.Forms.Panel bottomleftcorner; internal System.Windows.Forms.Panel topleftcorner; internal System.Windows.Forms.ListView mainView; internal System.Windows.Forms.Panel pnlSave; private System.Windows.Forms.Timer refresh; private Engine.UI.ClassicButton btnSave; - private Engine.UI.ClassicButton classicButton1; private Engine.UI.ClassicLabel classicLabel2; private Engine.UI.ClassicLabel classicLabel1; private Engine.UI.ClassicTextBox txtSave; - private Engine.UI.ClassicDropDown classicDropDown1; + private Engine.UI.ClassicDropDown cmbType; + private Engine.UI.ClassicButton btnCanc; } } diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index 9038a96..f118542 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -45,6 +45,8 @@ public Win95WindowsExplorer() ctrl.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); } + txtSave.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); + cmbType.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); //Histacom2.Engine.UI.CustomTextBox ctb = new Histacom2.Engine.UI.CustomTextBox(textBox1); } From 6ab1468786f1e865e9ff408d32149f9c9620d844 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Sat, 4 Nov 2017 09:43:02 +0000 Subject: [PATCH 05/11] Fix bugs ...and get rid of all == false and == true --- Histacom2.Engine/DesktopController.cs | 4 +- Histacom2.Engine/FileDialogBoxManager.cs | 7 + Histacom2.Engine/SaveSystem.cs | 4 +- Histacom2.Engine/Template/WinClassic.cs | 4 +- Histacom2.Engine/Template/WinXP.cs | 2 +- Histacom2.Engine/UI/ClassicDropDown.cs | 12 ++ Histacom2.Engine/UI/ClassicTextbox.cs | 12 ++ Histacom2.Engine/WindowManager.cs | 12 +- Histacom2/GlobalPrograms/WinClassicNotepad.cs | 20 ++- Histacom2/OS/Win95/Win95.cs | 2 +- .../OS/Win95/Win95Apps/MineSweeper/Square.cs | 2 +- .../MineSweeper/WinClassicMinesweeper.cs | 2 +- Histacom2/OS/Win95/Win95Apps/Story/Hack1.cs | 2 +- .../Win95WindowsExplorer.Designer.cs | 49 ++++--- .../Win95/Win95Apps/Win95WindowsExplorer.cs | 32 ++--- .../OS/Win95/Win95Apps/WinClassicFTPClient.cs | 113 +++++++-------- .../OS/Win95/Win95Apps/WinClassicWordPad.cs | 1 + Histacom2/OS/Win98/Win98.cs | 2 +- .../WinClassicWindowsExplorer.Designer.cs | 129 +++++++++++++----- .../Win98Apps/WinClassicWindowsExplorer.cs | 82 ++++++----- Histacom2/SaveDialogs/LoadGameProfileItem.cs | 6 +- Histacom2/SaveDialogs/NewGameDialog.cs | 4 +- .../SaveDialogs/SaveFileTroubleShooter.cs | 2 +- Histacom2/TitleScreen.cs | 14 +- 24 files changed, 318 insertions(+), 201 deletions(-) diff --git a/Histacom2.Engine/DesktopController.cs b/Histacom2.Engine/DesktopController.cs index 8ea9775..cb09333 100644 --- a/Histacom2.Engine/DesktopController.cs +++ b/Histacom2.Engine/DesktopController.cs @@ -17,9 +17,9 @@ public static string ReadDataFile(string reqDirectory, bool returnYesIfProtected string directoryFileInfo = File.ReadAllText(Path.Combine(reqDirectory, "_data.info")); FileSystemFolderInfo toRead = JsonConvert.DeserializeObject(directoryFileInfo); - if (returnYesIfProtected == true) + if (returnYesIfProtected) { - if (toRead.IsProtected == true) + if (toRead.IsProtected) { return "yes"; } diff --git a/Histacom2.Engine/FileDialogBoxManager.cs b/Histacom2.Engine/FileDialogBoxManager.cs index 161c393..9f0b2ce 100644 --- a/Histacom2.Engine/FileDialogBoxManager.cs +++ b/Histacom2.Engine/FileDialogBoxManager.cs @@ -28,6 +28,13 @@ public static void ActivateSaveFileDialog(string ExtensionToView) OnlyViewExtension = ExtensionToView; } + public static void DeactivateFileDialog() + { + IsInOpenDialog = false; + IsInSaveDialog = false; + OnlyViewExtension = ""; + } + public static string ReadTextFile(string path) { try diff --git a/Histacom2.Engine/SaveSystem.cs b/Histacom2.Engine/SaveSystem.cs index 70609a2..fcc6606 100644 --- a/Histacom2.Engine/SaveSystem.cs +++ b/Histacom2.Engine/SaveSystem.cs @@ -127,7 +127,7 @@ public static void NewGame() { var save = new Save(); save.ExperiencedStories = new List(); - if (DevMode == true) + if (DevMode) { if (ProfileName == "xpbad") { @@ -373,7 +373,7 @@ public static void SaveDirectoryInfo(string parent, string dirname, bool isProte info.SubDirs = new List(256); info.ByteSize = 0; - if (updateParent == true) + if (updateParent) { if ((parent != ProfileDirectory)) { diff --git a/Histacom2.Engine/Template/WinClassic.cs b/Histacom2.Engine/Template/WinClassic.cs index 988f268..68cba3d 100644 --- a/Histacom2.Engine/Template/WinClassic.cs +++ b/Histacom2.Engine/Template/WinClassic.cs @@ -45,7 +45,7 @@ public static extern int SendMessage(IntPtr hWnd, private void Programtopbar_drag(object sender, MouseEventArgs e) { - if (e.Button == MouseButtons.Left && max == false) + if (e.Button == MouseButtons.Left && !max) { ReleaseCapture(); SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); @@ -306,7 +306,7 @@ private void bottomrightcorner_Paint(object sender, PaintEventArgs e) private void maximizebutton_Click(object sender, EventArgs e) { - if (max == false) + if (!max) { this.right.Hide(); this.left.Hide(); diff --git a/Histacom2.Engine/Template/WinXP.cs b/Histacom2.Engine/Template/WinXP.cs index fa26611..2f51c1c 100644 --- a/Histacom2.Engine/Template/WinXP.cs +++ b/Histacom2.Engine/Template/WinXP.cs @@ -51,7 +51,7 @@ private void closebutton_Click(object sender, EventArgs e) private void top_MouseDown(object sender, MouseEventArgs e) { - if (e.Button == MouseButtons.Left && max == false) + if (e.Button == MouseButtons.Left && !max) { ReleaseCapture(); SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); diff --git a/Histacom2.Engine/UI/ClassicDropDown.cs b/Histacom2.Engine/UI/ClassicDropDown.cs index 0b56cb9..93b4a62 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.cs @@ -17,6 +17,18 @@ public partial class ClassicDropDown : UserControl public bool UseSystemPasswordChar { get; set; } public bool dropDownShown; + public override string Text + { + get + { + return textBox1.Text; + } + set + { + textBox1.Text = value; + } + } + public static Color textboxcolor = Color.Black; public static Color _lightBack = Color.Silver; diff --git a/Histacom2.Engine/UI/ClassicTextbox.cs b/Histacom2.Engine/UI/ClassicTextbox.cs index 8f1f9c3..f89df03 100644 --- a/Histacom2.Engine/UI/ClassicTextbox.cs +++ b/Histacom2.Engine/UI/ClassicTextbox.cs @@ -19,6 +19,18 @@ public partial class ClassicTextBox : UserControl public static Color _lightBack = Color.Silver; public static Color _darkBack = Color.Silver; + public override string Text + { + get + { + return textBox1.Text; + } + set + { + textBox1.Text = value; + } + } + public ClassicTextBox() { InitializeComponent(); diff --git a/Histacom2.Engine/WindowManager.cs b/Histacom2.Engine/WindowManager.cs index 12f7954..04de392 100644 --- a/Histacom2.Engine/WindowManager.cs +++ b/Histacom2.Engine/WindowManager.cs @@ -67,14 +67,14 @@ public WinClassic Init(UserControl content, string title, Image icon, bool MaxBu else app.programIcon.Image = icon; // Check if Max button is enabled and set proper X for Min button - if (MaxButton == false) + if (!MaxButton) { app.maximizebutton.Visible = false; app.minimizebutton.Location = new Point(app.closebutton.Location.X - 14, app.minimizebutton.Location.Y); } // Check if Min button is enabled - if (MinButton == false) + if (!MinButton) { app.minimizebutton.Visible = false; app.minimizebutton.Location = new Point(app.minimizebutton.Location.X, app.minimizebutton.Location.Y); @@ -102,7 +102,7 @@ public WinClassic Init(UserControl content, string title, Image icon, bool MaxBu // Show the app app.TopMost = true; - if (ShowApplicationAsDialog == false) { app.Show(); } else { app.ShowDialog(); } + if (!ShowApplicationAsDialog) { app.Show(); } else { app.ShowDialog(); } return app; } @@ -134,14 +134,14 @@ public WinXP InitXP(UserControl content, string title, Image icon, bool MaxButto else app.programIcon.Image = icon; // Check if Max button is enabled and set proper X for Min button - if (MaxButton == false) + if (!MaxButton) { app.maximizebutton.Visible = false; app.minimizebutton.Location = new Point(app.closebutton.Location.X - 14, app.minimizebutton.Location.Y); } // Check if Min button is enabled - if (MinButton == false) + if (!MinButton) { app.minimizebutton.Visible = false; app.minimizebutton.Location = new Point(app.minimizebutton.Location.X, app.minimizebutton.Location.Y); @@ -165,7 +165,7 @@ public WinXP InitXP(UserControl content, string title, Image icon, bool MaxButto // Show the app app.TopMost = true; - if (ShowApplicationAsDialog == false) { app.Show(); } else { app.ShowDialog(); } + if (!ShowApplicationAsDialog) { app.Show(); } else { app.ShowDialog(); } return app; } diff --git a/Histacom2/GlobalPrograms/WinClassicNotepad.cs b/Histacom2/GlobalPrograms/WinClassicNotepad.cs index 1a58d8e..de838e0 100644 --- a/Histacom2/GlobalPrograms/WinClassicNotepad.cs +++ b/Histacom2/GlobalPrograms/WinClassicNotepad.cs @@ -100,16 +100,21 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e) private void saveToolStripMenuItem_Click(object sender, EventArgs e) { - if (CurrentFilePath == "") + try { - // We aren't in a file right now + if (CurrentFilePath == "") + { + // We aren't in a file right now - SaveAs(); - } else { + SaveAs(); + } + else + { - File.Delete(CurrentFilePath); - SaveSystem.CreateWindowsFile(new FileInfo(CurrentFilePath).Directory.FullName, CurrentFilePath.Split('\\').Last(), mainText.Text, 12, mainText.Text.Length); - } + File.Delete(CurrentFilePath); + SaveSystem.CreateWindowsFile(new FileInfo(CurrentFilePath).Directory.FullName, CurrentFilePath.Split('\\').Last(), mainText.Text, 12, mainText.Text.Length); + } + } catch { } // This try catch loop was added due the game crashing if the desktop is updating the same time the notepad is saving... which I got! } void SaveAs() @@ -118,6 +123,7 @@ void SaveAs() { ActivateSaveFileDialog(".txt"); string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath(); + DeactivateFileDialog(); if (selectedPath != "") { diff --git a/Histacom2/OS/Win95/Win95.cs b/Histacom2/OS/Win95/Win95.cs index e330ea0..2a26b91 100644 --- a/Histacom2/OS/Win95/Win95.cs +++ b/Histacom2/OS/Win95/Win95.cs @@ -114,7 +114,7 @@ private void Desktop_Load(object sender, EventArgs e) this.BringToFront(); //Check if it is the first time - if (CurrentSave.FTime95 == false) + if (!CurrentSave.FTime95) { CurrentSave.FTime95 = true; SaveGame(); diff --git a/Histacom2/OS/Win95/Win95Apps/MineSweeper/Square.cs b/Histacom2/OS/Win95/Win95Apps/MineSweeper/Square.cs index 4f80240..2ebb319 100644 --- a/Histacom2/OS/Win95/Win95Apps/MineSweeper/Square.cs +++ b/Histacom2/OS/Win95/Win95Apps/MineSweeper/Square.cs @@ -108,7 +108,7 @@ private void Click(object sender, EventArgs e) this.Open(); } } - if (_game.ftime == true && !Minded) + if (_game.ftime && !Minded) { _game.ftime = false; _game._timer = new Timer(); diff --git a/Histacom2/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs b/Histacom2/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs index 2a03c7e..958e8a0 100644 --- a/Histacom2/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs +++ b/Histacom2/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs @@ -129,7 +129,7 @@ private void bestTimesToolStripMenuItem_Click(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e) { - if (_game.win == true) + if (_game.win) { button1.BackgroundImage = Properties.Resources.WinClassicMinesweeperWin; switch (level) diff --git a/Histacom2/OS/Win95/Win95Apps/Story/Hack1.cs b/Histacom2/OS/Win95/Win95Apps/Story/Hack1.cs index 41f7c35..7cf9dd4 100644 --- a/Histacom2/OS/Win95/Win95Apps/Story/Hack1.cs +++ b/Histacom2/OS/Win95/Win95Apps/Story/Hack1.cs @@ -74,7 +74,7 @@ public static async void ContinueObjective() public static void CheckIfSoundFinished(Object sender, EventArgs e) { - if (soundThread.IsAlive == false) + if (!soundThread.IsAlive) { // Continue from where we were System.Windows.Forms.Timer trm = sender as System.Windows.Forms.Timer; diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs index 2a96033..a4bd611 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs @@ -53,13 +53,13 @@ private void InitializeComponent() this.toprightcorner = new System.Windows.Forms.Panel(); this.topleftcorner = new System.Windows.Forms.Panel(); this.pnlSave = new System.Windows.Forms.Panel(); + this.refresh = new System.Windows.Forms.Timer(this.components); + this.btnCanc = new Histacom2.Engine.UI.ClassicButton(); this.cmbType = new Histacom2.Engine.UI.ClassicDropDown(); this.txtSave = new Histacom2.Engine.UI.ClassicTextBox(); this.classicLabel2 = new Histacom2.Engine.UI.ClassicLabel(); this.classicLabel1 = new Histacom2.Engine.UI.ClassicLabel(); this.btnSave = new Histacom2.Engine.UI.ClassicButton(); - this.refresh = new System.Windows.Forms.Timer(this.components); - this.btnCanc = new Histacom2.Engine.UI.ClassicButton(); this.program.SuspendLayout(); this.MenuStrip1.SuspendLayout(); this.pnlSave.SuspendLayout(); @@ -276,8 +276,33 @@ private void InitializeComponent() this.pnlSave.TabIndex = 18; this.pnlSave.Visible = false; // + // refresh + // + this.refresh.Interval = 15000; + this.refresh.Tick += new System.EventHandler(this.refresh_Tick); + // + // btnCanc + // + this.btnCanc.AdaptBackColorWithTheme = true; + this.btnCanc.AdaptFontWithTheme = true; + this.btnCanc.AdaptForeColorWithTheme = true; + this.btnCanc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnCanc.BackColor = System.Drawing.Color.Silver; + this.btnCanc.DialogResult = System.Windows.Forms.DialogResult.None; + this.btnCanc.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.btnCanc.ForeColor = System.Drawing.Color.Black; + this.btnCanc.Location = new System.Drawing.Point(611, 27); + this.btnCanc.Name = "btnCanc"; + this.btnCanc.Size = new System.Drawing.Size(75, 25); + this.btnCanc.TabIndex = 24; + this.btnCanc.Text = "Cancel"; + this.btnCanc.Click += new System.EventHandler(this.btnCanc_Click); + // // cmbType // + this.cmbType.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.cmbType.BackColor = System.Drawing.Color.White; this.cmbType.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.cmbType.Location = new System.Drawing.Point(56, 31); @@ -333,26 +358,6 @@ private void InitializeComponent() this.btnSave.Text = "Save"; this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // - // refresh - // - this.refresh.Interval = 15000; - this.refresh.Tick += new System.EventHandler(this.refresh_Tick); - // - // btnCanc - // - this.btnCanc.AdaptBackColorWithTheme = true; - this.btnCanc.AdaptFontWithTheme = true; - this.btnCanc.AdaptForeColorWithTheme = true; - this.btnCanc.BackColor = System.Drawing.Color.Silver; - this.btnCanc.DialogResult = System.Windows.Forms.DialogResult.None; - this.btnCanc.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); - this.btnCanc.ForeColor = System.Drawing.Color.Black; - this.btnCanc.Location = new System.Drawing.Point(611, 27); - this.btnCanc.Name = "btnCanc"; - this.btnCanc.Size = new System.Drawing.Size(75, 25); - this.btnCanc.TabIndex = 24; - this.btnCanc.Text = "Cancel"; - // // Win95WindowsExplorer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index f118542..0f221af 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -109,14 +109,14 @@ void WinClassicWindowsExplorer_Load(object sender, EventArgs e) IsFileSaveDialog = true; } - if (IsFileOpenDialog == true) + if (IsFileOpenDialog) { pnlSave.Show(); btnSave.Text = "Open"; } else { - if (IsFileSaveDialog == true) + if (IsFileSaveDialog) { pnlSave.Show(); btnSave.Text = "Save"; @@ -133,9 +133,9 @@ string ReadDataFile(string reqDirectory, bool returnYesIfProtected = false) { FileSystemFolderInfo toRead = new FileSystemFolderInfo(); toRead = JsonConvert.DeserializeObject(directoryFileInfo); - if (returnYesIfProtected == true) + if (returnYesIfProtected) { - if (toRead.IsProtected == true) return "yes"; + if (toRead.IsProtected) return "yes"; } else return toRead.Label; return Val; @@ -717,28 +717,23 @@ private void btnSave_Click(object sender, EventArgs e) { try { - bool OpenFile = false; if (mainView.FocusedItem != null) { if (mainView.FocusedItem.Tag.ToString() == "") { // If it isn't a file GoToDir(Path.Combine(CurrentDirectory, mainView.FocusedItem.Tag.ToString())); } - else OpenFile = true; // If it is a file + else txtSave.Text = mainView.FocusedItem.Tag.ToString(); } - else OpenFile = true; - if (OpenFile == true) + if (txtSave.Text == "") wm.StartInfobox95("Windows Explorer", "Please enter a filename", InfoboxType.Info, InfoboxButtons.OK); + else { - if (txtSave.Text == "") wm.StartInfobox95("Windows Explorer", "Please enter a filename", InfoboxType.Info, InfoboxButtons.OK); - else - { - if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); + if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); - FileDialogBoxManager.IsInOpenDialog = false; - FileDialogBoxManager.IsInSaveDialog = false; + FileDialogBoxManager.IsInOpenDialog = false; + FileDialogBoxManager.IsInSaveDialog = false; - ((Form)this.TopLevelControl).Close(); - } + ((Form)this.TopLevelControl).Close(); } } catch { } @@ -1041,5 +1036,10 @@ private void TextDocumentToolStripMenuItem_Click(object sender, EventArgs e) RefreshTreeNode(); } + + private void btnCanc_Click(object sender, EventArgs e) + { + ((Form)this.TopLevelControl).Close(); + } } } diff --git a/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.cs b/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.cs index 1a0836b..55a4ee2 100644 --- a/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.cs +++ b/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.cs @@ -58,64 +58,67 @@ private void button1_Click(object sender, EventArgs e) private void ftpItems_Click(object sender, EventArgs e) { - Point objDrawingPoint = ftpFiles.PointToClient(Cursor.Position); - ListViewItem objListViewItem = new ListViewItem(); - if (objDrawingPoint != null) + try { - objListViewItem = ftpFiles.GetItemAt(objDrawingPoint.X, objDrawingPoint.Y); - if (objListViewItem.Text == "/software/") + Point objDrawingPoint = ftpFiles.PointToClient(Cursor.Position); + ListViewItem objListViewItem = new ListViewItem(); + if (objDrawingPoint != null) { - ftpFiles.Clear(); - ListViewItem listViewItem1 = new ListViewItem(new string[] { "/downloads/" }, 0, Color.Black, Color.Empty, null); - ListViewItem listViewItem2 = new ListViewItem(new string[] { "skindows.html" }, 1, Color.Black, Color.Empty, null); - ftpFiles.Items.AddRange(new ListViewItem[] { listViewItem1, listViewItem2 }); + objListViewItem = ftpFiles.GetItemAt(objDrawingPoint.X, objDrawingPoint.Y); + if (objListViewItem.Text == "/software/") + { + ftpFiles.Clear(); + ListViewItem listViewItem1 = new ListViewItem(new string[] { "/downloads/" }, 0, Color.Black, Color.Empty, null); + ListViewItem listViewItem2 = new ListViewItem(new string[] { "skindows.html" }, 1, Color.Black, Color.Empty, null); + ftpFiles.Items.AddRange(new ListViewItem[] { listViewItem1, listViewItem2 }); + } + else if (objListViewItem.Text == "/downloads/") + { + ftpFiles.Clear(); + ListViewItem listViewItem1 = new ListViewItem(new string[] { "/totallynotthetimedistorter/" }, 0, Color.Black, Color.Empty, null); + ListViewItem listViewItem2 = new ListViewItem(new string[] { "FTP Client Setup.exe" }, 2, Color.Black, Color.Empty, null); + ListViewItem listViewItem3 = new ListViewItem(new string[] { "Web Chat Setup.exe" }, 2, Color.Black, Color.Empty, null); + ListViewItem listViewItem4 = new ListViewItem(new string[] { "Guess The Number V1 Setup.exe" }, 2, Color.Black, Color.Empty, null); + ftpFiles.Items.AddRange(new ListViewItem[] { listViewItem1, listViewItem2, listViewItem3, listViewItem4 }); + } + else if (objListViewItem.Text == "/totallynotthetimedistorter/") + { + ftpFiles.Clear(); + ListViewItem listViewItem1 = new ListViewItem(new string[] { "Time Distorter Setup.exe" }, 2, Color.Black, Color.Empty, null); + ftpFiles.Items.AddRange(new ListViewItem[] { listViewItem1 }); + } + else if (objListViewItem.Text == "FTP Client Setup.exe") + { + WinClassicDownloader opendownload = new WinClassicDownloader(); + WindowManager wm = new WindowManager(); + wm.Init(opendownload, "Downloader", null, false, true); + opendownload.appName.Text = "Downloading: FTP Client"; + } + else if (objListViewItem.Text == "Web Chat Setup.exe") + { + WinClassicDownloader opendownload = new WinClassicDownloader(); + WindowManager wm = new WindowManager(); + wm.Init(opendownload, "Downloader", null, false, true); + opendownload.appName.Text = "Downloading: Web Chat 1998"; + opendownload.amountToDL = 35; + } + else if (objListViewItem.Text == "Time Distorter Setup.exe") + { + WinClassicDownloader opendownload = new WinClassicDownloader(); + WindowManager wm = new WindowManager(); + wm.Init(opendownload, "Downloader", null, false, true); + opendownload.appName.Text = "Downloading: Time Distorter 0.1"; + } + else if (objListViewItem.Text == "Guess The Number V1 Setup.exe") + { + WinClassicDownloader opendownload = new WinClassicDownloader(); + WindowManager wm = new WindowManager(); + wm.Init(opendownload, "Downloader", null, false, true); + opendownload.appName.Text = "Downloading: Guess The Number V1"; + opendownload.amountToDL = 16; + } } - else if (objListViewItem.Text == "/downloads/") - { - ftpFiles.Clear(); - ListViewItem listViewItem1 = new ListViewItem(new string[] { "/totallynotthetimedistorter/" }, 0, Color.Black, Color.Empty, null); - ListViewItem listViewItem2 = new ListViewItem(new string[] { "FTP Client Setup.exe" }, 2, Color.Black, Color.Empty, null); - ListViewItem listViewItem3 = new ListViewItem(new string[] { "Web Chat Setup.exe" }, 2, Color.Black, Color.Empty, null); - ListViewItem listViewItem4 = new ListViewItem(new string[] { "Guess The Number V1 Setup.exe" }, 2, Color.Black, Color.Empty, null); - ftpFiles.Items.AddRange(new ListViewItem[] { listViewItem1, listViewItem2, listViewItem3, listViewItem4 }); - } - else if (objListViewItem.Text == "/totallynotthetimedistorter/") - { - ftpFiles.Clear(); - ListViewItem listViewItem1 = new ListViewItem(new string[] { "Time Distorter Setup.exe" }, 2, Color.Black, Color.Empty, null); - ftpFiles.Items.AddRange(new ListViewItem[] { listViewItem1 }); - } - else if (objListViewItem.Text == "FTP Client Setup.exe") - { - WinClassicDownloader opendownload = new WinClassicDownloader(); - WindowManager wm = new WindowManager(); - wm.Init(opendownload, "Downloader", null, false, true); - opendownload.appName.Text = "Downloading: FTP Client"; - } - else if (objListViewItem.Text == "Web Chat Setup.exe") - { - WinClassicDownloader opendownload = new WinClassicDownloader(); - WindowManager wm = new WindowManager(); - wm.Init(opendownload, "Downloader", null, false, true); - opendownload.appName.Text = "Downloading: Web Chat 1998"; - opendownload.amountToDL = 35; - } - else if (objListViewItem.Text == "Time Distorter Setup.exe") - { - WinClassicDownloader opendownload = new WinClassicDownloader(); - WindowManager wm = new WindowManager(); - wm.Init(opendownload, "Downloader", null, false, true); - opendownload.appName.Text = "Downloading: Time Distorter 0.1"; - } - else if (objListViewItem.Text == "Guess The Number V1 Setup.exe") - { - WinClassicDownloader opendownload = new WinClassicDownloader(); - WindowManager wm = new WindowManager(); - wm.Init(opendownload, "Downloader", null, false, true); - opendownload.appName.Text = "Downloading: Guess The Number V1"; - opendownload.amountToDL = 16; - } - } + } catch { } // Try catch due to if you have more then one item selected the game crashing. } private void btnCancel_Click(object sender, EventArgs e) diff --git a/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs b/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs index 91d9368..381f5ee 100644 --- a/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs +++ b/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs @@ -225,6 +225,7 @@ void SaveAs() { ActivateSaveFileDialog(".rtf"); string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath(); + DeactivateFileDialog(); if (selectedPath != "") { diff --git a/Histacom2/OS/Win98/Win98.cs b/Histacom2/OS/Win98/Win98.cs index e10904e..efaa31b 100644 --- a/Histacom2/OS/Win98/Win98.cs +++ b/Histacom2/OS/Win98/Win98.cs @@ -116,7 +116,7 @@ private void Desktop_Load(object sender, EventArgs e) this.BringToFront(); //Check if it is the first time - if (CurrentSave.FTime98 == false) + if (!CurrentSave.FTime98) { CurrentSave.FTime98 = true; SaveGame(); diff --git a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs index af2570c..f88d451 100644 --- a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs +++ b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs @@ -52,9 +52,12 @@ private void InitializeComponent() this.bottomleftcorner = new System.Windows.Forms.Panel(); this.topleftcorner = new System.Windows.Forms.Panel(); this.pnlSave = new System.Windows.Forms.Panel(); - this.Button1 = new System.Windows.Forms.Button(); - this.Label1 = new System.Windows.Forms.Label(); - this.txtSave = new System.Windows.Forms.TextBox(); + this.btnCanc = new Histacom2.Engine.UI.ClassicButton(); + this.cmbType = new Histacom2.Engine.UI.ClassicDropDown(); + this.txtSave = new Histacom2.Engine.UI.ClassicTextBox(); + this.classicLabel2 = new Histacom2.Engine.UI.ClassicLabel(); + this.classicLabel1 = new Histacom2.Engine.UI.ClassicLabel(); + this.btnSave = new Histacom2.Engine.UI.ClassicButton(); this.MenuStrip1 = new System.Windows.Forms.MenuStrip(); this.FileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CreateShortcutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -112,7 +115,7 @@ private void InitializeComponent() this.mainView.Dock = System.Windows.Forms.DockStyle.Fill; this.mainView.Location = new System.Drawing.Point(396, 24); this.mainView.Name = "mainView"; - this.mainView.Size = new System.Drawing.Size(308, 458); + this.mainView.Size = new System.Drawing.Size(308, 439); this.mainView.TabIndex = 10; this.mainView.UseCompatibleStateImageBehavior = false; this.mainView.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.mainView_AfterLabelEdit); @@ -130,7 +133,7 @@ private void InitializeComponent() this.pnlInfo.Dock = System.Windows.Forms.DockStyle.Left; this.pnlInfo.Location = new System.Drawing.Point(196, 24); this.pnlInfo.Name = "pnlInfo"; - this.pnlInfo.Size = new System.Drawing.Size(200, 458); + this.pnlInfo.Size = new System.Drawing.Size(200, 439); this.pnlInfo.TabIndex = 19; // // pictureBox1 @@ -165,7 +168,7 @@ private void InitializeComponent() this.pnlInfoContent.Controls.Add(this.txtInfoTip); this.pnlInfoContent.Location = new System.Drawing.Point(0, 95); this.pnlInfoContent.Name = "pnlInfoContent"; - this.pnlInfoContent.Size = new System.Drawing.Size(199, 362); + this.pnlInfoContent.Size = new System.Drawing.Size(199, 343); this.pnlInfoContent.TabIndex = 22; // // InfoDesc @@ -245,7 +248,7 @@ private void InitializeComponent() this.pnlFolders.Dock = System.Windows.Forms.DockStyle.Left; this.pnlFolders.Location = new System.Drawing.Point(0, 24); this.pnlFolders.Name = "pnlFolders"; - this.pnlFolders.Size = new System.Drawing.Size(196, 458); + this.pnlFolders.Size = new System.Drawing.Size(196, 439); this.pnlFolders.TabIndex = 0; // // diskView @@ -253,7 +256,7 @@ private void InitializeComponent() this.diskView.Dock = System.Windows.Forms.DockStyle.Fill; this.diskView.Location = new System.Drawing.Point(0, 22); this.diskView.Name = "diskView"; - this.diskView.Size = new System.Drawing.Size(196, 436); + this.diskView.Size = new System.Drawing.Size(196, 417); this.diskView.TabIndex = 13; this.diskView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.diskView_AfterSelect); // @@ -325,45 +328,95 @@ private void InitializeComponent() // // pnlSave // - this.pnlSave.Controls.Add(this.Button1); - this.pnlSave.Controls.Add(this.Label1); + this.pnlSave.Controls.Add(this.btnCanc); + this.pnlSave.Controls.Add(this.cmbType); this.pnlSave.Controls.Add(this.txtSave); + this.pnlSave.Controls.Add(this.classicLabel2); + this.pnlSave.Controls.Add(this.classicLabel1); + this.pnlSave.Controls.Add(this.btnSave); this.pnlSave.Dock = System.Windows.Forms.DockStyle.Bottom; - this.pnlSave.Location = new System.Drawing.Point(0, 482); + this.pnlSave.Location = new System.Drawing.Point(0, 463); this.pnlSave.Name = "pnlSave"; - this.pnlSave.Size = new System.Drawing.Size(704, 35); + this.pnlSave.Size = new System.Drawing.Size(704, 54); this.pnlSave.TabIndex = 18; this.pnlSave.Visible = false; // - // Button1 + // btnCanc // - this.Button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.Button1.Location = new System.Drawing.Point(626, 3); - this.Button1.Name = "Button1"; - this.Button1.Size = new System.Drawing.Size(75, 23); - this.Button1.TabIndex = 17; - this.Button1.Text = "Save"; - this.Button1.UseVisualStyleBackColor = true; - this.Button1.Click += new System.EventHandler(this.Button1_Click); + this.btnCanc.AdaptBackColorWithTheme = true; + this.btnCanc.AdaptFontWithTheme = true; + this.btnCanc.AdaptForeColorWithTheme = true; + this.btnCanc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnCanc.BackColor = System.Drawing.Color.Silver; + this.btnCanc.DialogResult = System.Windows.Forms.DialogResult.None; + this.btnCanc.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.btnCanc.ForeColor = System.Drawing.Color.Black; + this.btnCanc.Location = new System.Drawing.Point(619, 28); + this.btnCanc.Name = "btnCanc"; + this.btnCanc.Size = new System.Drawing.Size(75, 25); + this.btnCanc.TabIndex = 30; + this.btnCanc.Text = "Cancel"; + this.btnCanc.Click += new System.EventHandler(this.btnCanc_Click); // - // Label1 + // cmbType // - this.Label1.AutoSize = true; - this.Label1.Location = new System.Drawing.Point(3, 6); - this.Label1.Name = "Label1"; - this.Label1.Size = new System.Drawing.Size(57, 13); - this.Label1.TabIndex = 16; - this.Label1.Text = "File Name:"; + this.cmbType.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.cmbType.BackColor = System.Drawing.Color.White; + this.cmbType.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.cmbType.Location = new System.Drawing.Point(64, 32); + this.cmbType.Name = "cmbType"; + this.cmbType.Size = new System.Drawing.Size(549, 20); + this.cmbType.TabIndex = 29; + this.cmbType.UseSystemPasswordChar = false; // // txtSave // - this.txtSave.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.txtSave.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.txtSave.Location = new System.Drawing.Point(60, 3); + this.txtSave.BackColor = System.Drawing.Color.White; + this.txtSave.Location = new System.Drawing.Point(64, 7); this.txtSave.Name = "txtSave"; - this.txtSave.Size = new System.Drawing.Size(560, 20); - this.txtSave.TabIndex = 15; + this.txtSave.Size = new System.Drawing.Size(549, 20); + this.txtSave.TabIndex = 28; + this.txtSave.UseSystemPasswordChar = false; + // + // classicLabel2 + // + this.classicLabel2.DropShadow = false; + this.classicLabel2.Location = new System.Drawing.Point(11, 33); + this.classicLabel2.Name = "classicLabel2"; + this.classicLabel2.Size = new System.Drawing.Size(64, 13); + this.classicLabel2.TabIndex = 26; + this.classicLabel2.Text = "File type:"; + // + // classicLabel1 + // + this.classicLabel1.DropShadow = false; + this.classicLabel1.Location = new System.Drawing.Point(11, 7); + this.classicLabel1.Name = "classicLabel1"; + this.classicLabel1.Size = new System.Drawing.Size(64, 13); + this.classicLabel1.TabIndex = 27; + this.classicLabel1.Text = "File name:"; + // + // btnSave + // + this.btnSave.AdaptBackColorWithTheme = true; + this.btnSave.AdaptFontWithTheme = true; + this.btnSave.AdaptForeColorWithTheme = true; + this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnSave.BackColor = System.Drawing.Color.Silver; + this.btnSave.DialogResult = System.Windows.Forms.DialogResult.None; + this.btnSave.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.btnSave.ForeColor = System.Drawing.Color.Black; + this.btnSave.Location = new System.Drawing.Point(619, 2); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(75, 25); + this.btnSave.TabIndex = 25; + this.btnSave.Text = "Save"; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // MenuStrip1 // @@ -553,7 +606,6 @@ private void InitializeComponent() this.pnlFoldersTop.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.btnFolderClose)).EndInit(); this.pnlSave.ResumeLayout(false); - this.pnlSave.PerformLayout(); this.MenuStrip1.ResumeLayout(false); this.MenuStrip1.PerformLayout(); this.ResumeLayout(false); @@ -590,9 +642,6 @@ private void InitializeComponent() internal System.Windows.Forms.Panel topleftcorner; internal System.Windows.Forms.ListView mainView; internal System.Windows.Forms.Panel pnlSave; - internal System.Windows.Forms.Button Button1; - internal System.Windows.Forms.Label Label1; - internal System.Windows.Forms.TextBox txtSave; private System.Windows.Forms.Panel pnlInfo; private System.Windows.Forms.Panel pnlFolders; private System.Windows.Forms.Panel pnlFoldersTop; @@ -609,5 +658,11 @@ private void InitializeComponent() private System.Windows.Forms.Label txtInfoDescName; private System.Windows.Forms.Label txtInfoDescSize; private System.Windows.Forms.Timer refresh; + private Engine.UI.ClassicButton btnCanc; + private Engine.UI.ClassicDropDown cmbType; + private Engine.UI.ClassicTextBox txtSave; + private Engine.UI.ClassicLabel classicLabel2; + private Engine.UI.ClassicLabel classicLabel1; + private Engine.UI.ClassicButton btnSave; } } diff --git a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs index f261cb2..5cc075e 100644 --- a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs +++ b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs @@ -102,17 +102,17 @@ void WinClassicWindowsExplorer_Load(object sender, EventArgs e) IsFileSaveDialog = true; } - if (IsFileOpenDialog == true) + if (IsFileOpenDialog) { pnlSave.Show(); - Button1.Text = "Open"; + btnSave.Text = "Open"; } else { - if (IsFileSaveDialog == true) + if (IsFileSaveDialog) { pnlSave.Show(); - Button1.Text = "Save"; + btnSave.Text = "Save"; } } @@ -139,9 +139,9 @@ string ReadDataFile(string reqDirectory, bool returnYesIfProtected = false) { FileSystemFolderInfo toRead = new FileSystemFolderInfo(); toRead = JsonConvert.DeserializeObject(directoryFileInfo); - if (returnYesIfProtected == true) + if (returnYesIfProtected) { - if (toRead.IsProtected == true) + if (toRead.IsProtected) { return "yes"; } @@ -655,7 +655,7 @@ void mainView_DoubleClick(object sender, EventArgs e) } else { // If it is a file - if (IsFileOpenDialog == true || IsFileSaveDialog == true) + if (IsFileOpenDialog || IsFileSaveDialog) { if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) { @@ -734,41 +734,26 @@ private void Button1_Click(object sender, EventArgs e) { try { - bool OpenFile = false; if (mainView.FocusedItem != null) { - if ((string)mainView.FocusedItem.Tag == "") + if (mainView.FocusedItem.Tag.ToString() == "") { // If it isn't a file GoToDir(Path.Combine(CurrentDirectory, mainView.FocusedItem.Tag.ToString())); } - else OpenFile = true; // If it is a file + else txtSave.Text = mainView.FocusedItem.Tag.ToString(); } - else OpenFile = true; - if (OpenFile == true) + if (txtSave.Text == "") wm.StartInfobox95("Windows Explorer", "Please enter a filename", InfoboxType.Info, InfoboxButtons.OK); + else { - if (txtSave.Text == "") - { - wm.StartInfobox95("Windows Explorer", "Please enter a filename", InfoboxType.Info, InfoboxButtons.OK); - } - else - { - if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) - { + if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); - Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); + FileDialogBoxManager.IsInOpenDialog = false; + FileDialogBoxManager.IsInSaveDialog = false; - } - - - FileDialogBoxManager.IsInOpenDialog = false; - FileDialogBoxManager.IsInSaveDialog = false; - - ((Form)this.TopLevelControl).Close(); - } + ((Form)this.TopLevelControl).Close(); } - } catch { - } + catch { } } private void DeleteToolStripMenuItem_Click(object sender, EventArgs e) @@ -929,7 +914,7 @@ private void btnFolderClose_Click(object sender, EventArgs e) private void FoldersToolStripMenuItem_Click(object sender, EventArgs e) { - if (FoldersToolStripMenuItem.Checked == true) + if (FoldersToolStripMenuItem.Checked) { FoldersToolStripMenuItem.Checked = false; pnlFolders.Hide(); @@ -973,7 +958,7 @@ private void mainView_SelectedIndexChanged(object sender, EventArgs e) } } - if (recognized == true) + if (recognized) { // TODO: } else { @@ -1137,5 +1122,36 @@ private void SellectAllCtrlAToolStripMenuItem_Click(object sender, EventArgs e) item.Selected = true; } } + + private void btnCanc_Click(object sender, EventArgs e) + { + ((Form)this.TopLevelControl).Close(); + } + + private void btnSave_Click(object sender, EventArgs e) + { + try + { + if (mainView.FocusedItem != null) + { + if (mainView.FocusedItem.Tag.ToString() == "") + { // If it isn't a file + GoToDir(Path.Combine(CurrentDirectory, mainView.FocusedItem.Tag.ToString())); + } + else txtSave.Text = mainView.FocusedItem.Tag.ToString(); + } + if (txtSave.Text == "") wm.StartInfobox95("Windows Explorer", "Please enter a filename", InfoboxType.Info, InfoboxButtons.OK); + else + { + if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); + + FileDialogBoxManager.IsInOpenDialog = false; + FileDialogBoxManager.IsInSaveDialog = false; + + ((Form)this.TopLevelControl).Close(); + } + } + catch { } + } } } diff --git a/Histacom2/SaveDialogs/LoadGameProfileItem.cs b/Histacom2/SaveDialogs/LoadGameProfileItem.cs index bdc0b7c..646601b 100644 --- a/Histacom2/SaveDialogs/LoadGameProfileItem.cs +++ b/Histacom2/SaveDialogs/LoadGameProfileItem.cs @@ -37,7 +37,7 @@ public bool PreFilterMessage(ref Message m) if (!ClientRectangle.Contains(PointToClient(Control.MousePosition))) { sidebar.Hide(); - if (OnceRemoveHeight == false) + if (!OnceRemoveHeight) { this.Height -= 28; OnceRemoveHeight = true; @@ -49,7 +49,7 @@ public bool PreFilterMessage(ref Message m) } else { sidebar.Show(); - if (OnceAddHeight == false) + if (!OnceAddHeight) { this.Height += 28; OnceAddHeight = true; @@ -95,7 +95,7 @@ private void button2_Click(object sender, EventArgs e) { try { - if (!RequestingNewName == false) + if (!RequestingNewName) { if (textBox1.Text == "") { diff --git a/Histacom2/SaveDialogs/NewGameDialog.cs b/Histacom2/SaveDialogs/NewGameDialog.cs index eb8d44f..e3ecd00 100644 --- a/Histacom2/SaveDialogs/NewGameDialog.cs +++ b/Histacom2/SaveDialogs/NewGameDialog.cs @@ -46,7 +46,7 @@ private void btnOk_Click(object sender, EventArgs e) if (!(txtProfName.Text.Length > 20)) { ProfileName = txtProfName.Text; - if (DevMode == true) + if (DevMode) { if (Directory.Exists(ProfileDirectory)) { @@ -84,7 +84,7 @@ private void btnOk_Click(object sender, EventArgs e) private void NewGameDialog_Load(object sender, EventArgs e) { - if (DevMode == true) + if (DevMode) { btnDevMode.Show(); } diff --git a/Histacom2/SaveDialogs/SaveFileTroubleShooter.cs b/Histacom2/SaveDialogs/SaveFileTroubleShooter.cs index eceff04..3283ca1 100644 --- a/Histacom2/SaveDialogs/SaveFileTroubleShooter.cs +++ b/Histacom2/SaveDialogs/SaveFileTroubleShooter.cs @@ -193,7 +193,7 @@ void EndScan(bool successful) { pnlResolved.Visible = true; label1.Hide(); - if (successful == true) + if (successful) { label2.Text = "The issue has been resolved."; diff --git a/Histacom2/TitleScreen.cs b/Histacom2/TitleScreen.cs index 4e3ab01..d39ba45 100644 --- a/Histacom2/TitleScreen.cs +++ b/Histacom2/TitleScreen.cs @@ -69,7 +69,7 @@ public void StartGame() frm95.TopMost = true; frm95.FormBorderStyle = FormBorderStyle.None; frm95.WindowState = FormWindowState.Maximized; - //if (vm_mode.Checked == true) + //if (vm_mode.Checked) //{ // frm95.Size = new Size(Convert.ToInt32(VM_Width.Text), Convert.ToInt32(VM_Height.Text)); // frm95.FormBorderStyle = FormBorderStyle.Fixed3D; @@ -83,7 +83,7 @@ public void StartGame() frm98.TopMost = true; frm98.FormBorderStyle = FormBorderStyle.None; frm98.WindowState = FormWindowState.Maximized; - //if (vm_mode.Checked == true) + //if (vm_mode.Checked) //{ // frm98.Size = new Size(Convert.ToInt32(VM_Width.Text), Convert.ToInt32(VM_Height.Text)); // frm98.FormBorderStyle = FormBorderStyle.Fixed3D; @@ -97,7 +97,7 @@ public void StartGame() frmBadXP.TopMost = true; frmBadXP.FormBorderStyle = FormBorderStyle.None; frmBadXP.WindowState = FormWindowState.Maximized; - //if (vm_mode.Checked == true) + //if (vm_mode.Checked) //{ // frm98.Size = new Size(Convert.ToInt32(VM_Width.Text), Convert.ToInt32(VM_Height.Text)); // frm98.FormBorderStyle = FormBorderStyle.Fixed3D; @@ -178,7 +178,7 @@ private void NewGame_Click(object sender, EventArgs e) newGameBox = new NewGameDialog(); newGameBox.ShowDialog(); - if (newGameBox.Successful == true) + if (newGameBox.Successful) { NewGame(); StartGame(); @@ -232,7 +232,7 @@ private void LoadGame_Click(object sender, EventArgs e) loadGameBox = new LoadGameDialog(); loadGameBox.ShowDialog(); - if (loadGameBox.successful == true) + if (loadGameBox.successful) { LoadSave(); SetTheme(); @@ -262,7 +262,7 @@ private void gameversion_MouseLeave(object sender, EventArgs e) private void startbutton_Click(object sender, EventArgs e) { - if (DevMode == true) + if (DevMode) { DevMode = false; gameversion.Text = "Developer Mode Deactivated"; @@ -296,7 +296,7 @@ private void achievementsToolStripMenuItem_Click(object sender, EventArgs e) private void vm_mode_CheckStateChanged(object sender, EventArgs e) { // Check for VM mode - if (vm_mode.Checked == true) + if (vm_mode.Checked) { VM_Width.Visible = true; VM_Height.Visible = true; From e7a1221130047f442ae7fb36ab399eca51d0ba33 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Sat, 4 Nov 2017 09:56:30 +0000 Subject: [PATCH 06/11] Fix moar bugs --- .../WinClassicAddressBook.Designer.cs | 23 ++++++------- .../AddressBook/WinClassicAddressBook.cs | 5 +++ Histacom2/Program.cs | 4 +-- Histacom2/TitleScreen.cs | 33 ------------------- 4 files changed, 19 insertions(+), 46 deletions(-) diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs index cbe2600..85bccf0 100644 --- a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs +++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs @@ -105,67 +105,67 @@ private void InitializeComponent() // newContactToolStripMenuItem // this.newContactToolStripMenuItem.Name = "newContactToolStripMenuItem"; - this.newContactToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.newContactToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.newContactToolStripMenuItem.Text = "New contact..."; this.newContactToolStripMenuItem.Click += new System.EventHandler(this.newContactToolStripMenuItem_Click); // // newFolderToolStripMenuItem // this.newFolderToolStripMenuItem.Name = "newFolderToolStripMenuItem"; - this.newFolderToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.newFolderToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.newFolderToolStripMenuItem.Text = "New folder..."; this.newFolderToolStripMenuItem.Click += new System.EventHandler(this.newFolderToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(147, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); // // propertiesToolStripMenuItem // this.propertiesToolStripMenuItem.Name = "propertiesToolStripMenuItem"; - this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.propertiesToolStripMenuItem.Text = "Properties"; this.propertiesToolStripMenuItem.Click += new System.EventHandler(this.propertiesToolStripMenuItem_Click); // // deleteToolStripMenuItem // this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; - this.deleteToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.deleteToolStripMenuItem.Text = "Delete"; this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(147, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6); // // importToolStripMenuItem // this.importToolStripMenuItem.Name = "importToolStripMenuItem"; - this.importToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.importToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.importToolStripMenuItem.Text = "Import..."; // // exportToolStripMenuItem // this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; - this.exportToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.exportToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.exportToolStripMenuItem.Text = "Export..."; // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(147, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6); // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(147, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -304,6 +304,7 @@ private void InitializeComponent() this.toolNew.Size = new System.Drawing.Size(43, 39); this.toolNew.TabIndex = 0; this.toolNew.TabStop = false; + this.toolNew.Click += new System.EventHandler(this.toolNew_Click); // // toolDelete // diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs index ccd22f0..c4c6960 100644 --- a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs +++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs @@ -275,6 +275,11 @@ private void exitToolStripMenuItem_Click(object sender, EventArgs e) { ((Form)this.TopLevelControl).Close(); } + + private void toolNew_Click(object sender, EventArgs e) + { + newContext.Show(); + } } public class AddressBookContact diff --git a/Histacom2/Program.cs b/Histacom2/Program.cs index 97fee5f..e19c770 100644 --- a/Histacom2/Program.cs +++ b/Histacom2/Program.cs @@ -96,8 +96,8 @@ public static void ShutdownApplication(System.IO.Stream audio) public static void AddTaskbarItem(Form Application, string ApplicationID, string ApplicationName, Image ApplicationIcon) { - TitleScreen.frm95.AddTaskBarItem(Application, ApplicationID, ApplicationName, ApplicationIcon); - TitleScreen.frm98.AddTaskBarItem(Application, ApplicationID, ApplicationName, ApplicationIcon); + if (TitleScreen.frm95 != null) TitleScreen.frm95.AddTaskBarItem(Application, ApplicationID, ApplicationName, ApplicationIcon); + if (TitleScreen.frm98 != null) TitleScreen.frm98.AddTaskBarItem(Application, ApplicationID, ApplicationName, ApplicationIcon); } public static void NonImportantApp_Closing(object sender, FormClosingEventArgs e) diff --git a/Histacom2/TitleScreen.cs b/Histacom2/TitleScreen.cs index 4108204..ef235cf 100644 --- a/Histacom2/TitleScreen.cs +++ b/Histacom2/TitleScreen.cs @@ -149,23 +149,6 @@ private void TitleScreen_Load(object sender, EventArgs e) HelpToolStripMenuItem.Font = new Font(pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); ShutdownToolStripMenuItem.Font = new Font(pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); } - -<<<<<<< HEAD - private static void leet() - { - WindowManager wm = new WindowManager(); - UserControl leet = new UserControl(); - leet.Width = 500; - leet.Height = 500; - Label label1 = new Label(); - label1.Parent = leet; - label1.AutoSize = true; - label1.Text = "Thank you for making Histacom2 possible."; - wm.Init(leet, "Thank You", null, true, true); - } - -======= ->>>>>>> 382f0167714bbcad00ab710fe7dcfa05eaeb88ac #region Menu Buttons #region NewGame @@ -275,21 +258,5 @@ private void achievementsToolStripMenuItem_Click(object sender, EventArgs e) AchievementScreen achievelist = new AchievementScreen(); achievelist.ShowDialog(); } - - private void vm_mode_CheckStateChanged(object sender, EventArgs e) - { - // Check for VM mode - if (vm_mode.Checked) - { - VM_Width.Visible = true; - VM_Height.Visible = true; - } - // If VM Mode is disabled - else - { - VM_Width.Visible = false; - VM_Height.Visible = false; - } - } } } From fd13d9d4f6484a0ad29556d2c1b6b9871066a385 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Sat, 4 Nov 2017 10:51:45 +0000 Subject: [PATCH 07/11] Made code neater and fixed Address Book bugs! --- .../Win95/Win95Apps/Win95WindowsExplorer.cs | 199 ++--------- .../WinClassicAddressBook.Designer.cs | 23 +- .../AddressBook/WinClassicAddressBook.cs | 63 ++-- .../Win98Apps/WinClassicWindowsExplorer.cs | 321 +++++------------- 4 files changed, 162 insertions(+), 444 deletions(-) diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index 8f946ab..4efdd6f 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -397,228 +397,89 @@ void OpenApplication(string appname, string path) } } - string ReturnType(string extension) { - string returnVal = "File"; - fileType = 0; + int ReturnType(string extension) { switch (extension) { case ".txt": - fileType = 1; - returnVal = "Text Document \n createtext"; - break; - case ".dat": - fileType = 1; - returnVal = "Text Document \n createtext"; - break; - case ".rtf": - fileType = 2; - returnVal = "Rich Text Document \n createtext"; - break; case ".cfg": - fileType = 1; - returnVal = "Config file \n createtext"; - break; case ".log": - fileType = 1; - returnVal = "log text file \n createtext"; - break; case ".ini": - fileType = 1; - returnVal = "initialization \n createtext"; - break; case ".properties": - fileType = 1; - returnVal = "Config file \n createtext"; - break; case ".json": - fileType = 1; - returnVal = "Config file \n createtext"; - break; + case ".dat": + return 1; + + case ".rtf": + return 2; + case ".doc": - fileType = 3; - returnVal = "Word Document \n word"; - break; + return 3; case ".docm": - fileType = 3; - returnVal = "Macro-Enabled Word Document \n word"; - break; + return 3; case ".xls": - fileType = 4; - returnVal = "Excel Spreadsheets \n excel"; - break; + return 4; case ".ppt": - fileType = 5; - returnVal = "Powerpoint Presentation \n powerpoint"; - break; + return 5; case ".pub": - fileType = 7; - returnVal = "Publisher Document \n powerpoint"; - break; + return 7; case ".xps": - fileType = 8; - returnVal = "XPS Document \n xpsview"; - break; + return 8; case ".htm": - fileType = 9; - returnVal = "HTML web page \n html"; - break; + return 9; case ".html": - fileType = 9; - returnVal = "HTML web page \n html"; - break; + return 9; case ".wps": - fileType = 10; - returnVal = "Works document \n works"; - break; + return 10; case ".wmf": - fileType = 11; - returnVal = "Windows Metafile (A picture) \n createart"; - break; case ".emf": - fileType = 11; - returnVal = "Enhanced Metafile (A picture) \n createart"; - break; case ".png": - fileType = 11; - returnVal = "Picture file (Portable Network Graphics) \n createart"; - break; case ".jpg": - fileType = 11; - returnVal = "Picture file \n createart"; - break; case ".jpeg": - fileType = 11; - returnVal = "Picture file \n createart"; - break; case ".gif": - fileType = 12; - returnVal = "Picture file \n gifman"; - break; case ".tif": - fileType = 11; - returnVal = "Picture file \n createart"; - break; case ".bmp": - fileType = 11; - returnVal = "Picture file \n createart"; - break; case ".zip": - fileType = 11; - returnVal = "Compressed ZIP file \n winrar"; - break; + return 11; + case ".exe": - fileType = 12; - returnVal = "Program \n exe"; - break; - case ".avi": - fileType = 15; - returnVal = "Video \n video"; - break; + return 12; + case ".avi": case ".m4v": - fileType = 15; - returnVal = "Video (MPEG-4) \n video"; - break; case ".mp4": - fileType = 15; - returnVal = "Video (MPEG-4) \n video"; - break; case ".wmv": - fileType = 15; - returnVal = "Video \n video"; - break; case ".m2v": - fileType = 15; - returnVal = "Video \n video"; - break; case ".m3u": - fileType = 15; - returnVal = "Video \n video"; - break; case ".mts": - fileType = 15; - returnVal = "Video \n video"; - break; case ".dv": - fileType = 15; - returnVal = "Video (Digital Video) \n video"; - break; case ".flv": - fileType = 15; - returnVal = "Video \n video"; - break; case ".m1v": - fileType = 15; - returnVal = "Video \n video"; - break; case ".m2ts": - fileType = 15; - returnVal = "Video \n video"; - break; case ".mkv": - fileType = 15; - returnVal = "Video \n video"; - break; case ".mov": - fileType = 15; - returnVal = "Video \n video"; - break; case ".mpeg4": - fileType = 15; - returnVal = "Video \n video"; - break; case ".mpeg": - fileType = 15; - returnVal = "Video \n video"; - break; case ".mpg": - fileType = 15; - returnVal = "Video \n video"; - break; case ".3gp": - fileType = 15; - returnVal = "Video \n video"; - break; case ".m4p": - fileType = 15; - returnVal = "Video \n video"; - break; + return 15; + case ".mp2": - fileType = 21; - returnVal = "Audio \n video"; - break; case ".mp3": - fileType = 21; - returnVal = "Audio \n video"; - break; case ".wav": - fileType = 21; - returnVal = "Audio \n video"; - break; + return 21; case ".nls": - fileType = 16; - returnVal = "Font file \n font"; - break; + return 16; case ".dll": - fileType = 17; - returnVal = "System File \n sys"; - break; + return 17; case ".bat": - fileType = 18; - returnVal = "MS-DOS Batch File \n winterm"; - break; + return 18; case ".url": - fileType = 19; - returnVal = "Shortcut \n short"; - break; + return 19; case ".sh": - fileType = 20; - returnVal = "BASH file \n winterm"; - break; + return 20; case ".win": - fileType = 17; - returnVal = "System file \n sys"; - break; + return 17; } - return returnVal; + return 0; } //Private Sub windows_explorer_Closed(sender As Object, e As EventArgs) Handles Me.Closed diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs index 85bccf0..20f5af2 100644 --- a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs +++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs @@ -105,67 +105,67 @@ private void InitializeComponent() // newContactToolStripMenuItem // this.newContactToolStripMenuItem.Name = "newContactToolStripMenuItem"; - this.newContactToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.newContactToolStripMenuItem.Size = new System.Drawing.Size(150, 22); this.newContactToolStripMenuItem.Text = "New contact..."; this.newContactToolStripMenuItem.Click += new System.EventHandler(this.newContactToolStripMenuItem_Click); // // newFolderToolStripMenuItem // this.newFolderToolStripMenuItem.Name = "newFolderToolStripMenuItem"; - this.newFolderToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.newFolderToolStripMenuItem.Size = new System.Drawing.Size(150, 22); this.newFolderToolStripMenuItem.Text = "New folder..."; this.newFolderToolStripMenuItem.Click += new System.EventHandler(this.newFolderToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(147, 6); // // propertiesToolStripMenuItem // this.propertiesToolStripMenuItem.Name = "propertiesToolStripMenuItem"; - this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(150, 22); this.propertiesToolStripMenuItem.Text = "Properties"; this.propertiesToolStripMenuItem.Click += new System.EventHandler(this.propertiesToolStripMenuItem_Click); // // deleteToolStripMenuItem // this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; - this.deleteToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(150, 22); this.deleteToolStripMenuItem.Text = "Delete"; this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(147, 6); // // importToolStripMenuItem // this.importToolStripMenuItem.Name = "importToolStripMenuItem"; - this.importToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.importToolStripMenuItem.Size = new System.Drawing.Size(150, 22); this.importToolStripMenuItem.Text = "Import..."; // // exportToolStripMenuItem // this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; - this.exportToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.exportToolStripMenuItem.Size = new System.Drawing.Size(150, 22); this.exportToolStripMenuItem.Text = "Export..."; // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(147, 6); // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(147, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(150, 22); this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -247,6 +247,7 @@ private void InitializeComponent() this.aboutAddressBookToolStripMenuItem.Name = "aboutAddressBookToolStripMenuItem"; this.aboutAddressBookToolStripMenuItem.Size = new System.Drawing.Size(182, 22); this.aboutAddressBookToolStripMenuItem.Text = "About Address Book"; + this.aboutAddressBookToolStripMenuItem.Click += new System.EventHandler(this.aboutAddressBookToolStripMenuItem_Click); // // contactsView // diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs index c4c6960..0c6701a 100644 --- a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs +++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs @@ -42,7 +42,7 @@ public WinClassicAddressBook() { new AddressBookContactList() { - AttachedNode = treeView1.Nodes[0].Text, + AttachedNode = treeView1.Nodes[0].Text } }; } @@ -82,17 +82,8 @@ public void UpdateContactListFromNodeName(string NodeName) { foreach (AddressBookContact contact in ContactList.Contacts) { - if (contact != null) - { - if (contact.FirstName != null) - { - contactsView.Items.Add(contact.FirstName + " " + contact.MiddleName + " " + contact.LastName); - } - } - else - { - MessageBox.Show("Null contact!"); - } + if (contact.FirstName != null) + contactsView.Items.Add(contact.FirstName + " " + contact.MiddleName + " " + contact.LastName); } } } @@ -182,9 +173,16 @@ void OpenProperties() { foreach (AddressBookContact Contact in ContactList.Contacts) { - if ((Contact.FirstName + " " + Contact.MiddleName + " " + Contact.LastName) == contactsView.FocusedItem.Text) + if (contactsView.FocusedItem == null) + { // Most likely they are trying to view a whole folder! + wm.StartInfobox95("Properties of a folder", "You cannot view the properties of a contact folder.", InfoboxType.Warning, InfoboxButtons.OK); + } + else { - abnc.toSet = Contact; + if ((Contact.FirstName + " " + Contact.MiddleName + " " + Contact.LastName) == contactsView.FocusedItem.Text) + { + abnc.toSet = Contact; + } } } } @@ -228,22 +226,38 @@ private void deleteToolStripMenuItem_Click(object sender, EventArgs e) void DeleteContact() { - if (treeView1.SelectedNode != null) + try { - foreach (AddressBookContactList ContactList in AddressBookObjects) + if (treeView1.SelectedNode != null) { - if (ContactList.AttachedNode == treeView1.SelectedNode.Text) + foreach (AddressBookContactList ContactList in AddressBookObjects) { - foreach (AddressBookContact Contact in ContactList.Contacts) + if (ContactList.AttachedNode == treeView1.SelectedNode.Text) { - if ((Contact.FirstName + " " + Contact.MiddleName + " " + Contact.LastName) == contactsView.FocusedItem.Text) + foreach (AddressBookContact Contact in ContactList.Contacts) { - ContactList.Contacts.Remove(Contact); + if (contactsView.FocusedItem == null) + { // Most likely they are trying to delete a whole folder! + if (treeView1.SelectedNode.Text != "Shared Contacts") + if (treeView1.SelectedNode != null) + { + AddressBookObjects.Remove(ContactList); + treeView1.Nodes.Remove(treeView1.SelectedNode); + UpdateContactListFromNodeName("Shared Contacts"); + } + } + else + { + if ((Contact.FirstName + " " + Contact.MiddleName + " " + Contact.LastName) == contactsView.FocusedItem.Text) + { + ContactList.Contacts.Remove(Contact); + } + } } } } } - } + } catch { } } private void toolDelete_Click(object sender, EventArgs e) @@ -278,7 +292,12 @@ private void exitToolStripMenuItem_Click(object sender, EventArgs e) private void toolNew_Click(object sender, EventArgs e) { - newContext.Show(); + newContext.Show(MousePosition); + } + + private void aboutAddressBookToolStripMenuItem_Click(object sender, EventArgs e) + { + } } diff --git a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs index 5cc075e..c7369b4 100644 --- a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs +++ b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs @@ -346,301 +346,96 @@ void OpenApplication(string appname, string path) } } - string ReturnType(string extension) { - string returnVal = ""; - fileType = 1; - switch (extension) { + int ReturnType(string extension) + { + switch (extension) + { case ".txt": - fileType = 1; - returnVal = "Text Document \n createtext"; - break; - case ".dat": - fileType = 1; - returnVal = "Text Document \n createtext"; - break; - case ".rtf": - fileType = 2; - returnVal = "Rich Text Document \n createtext"; - break; case ".cfg": - fileType = 1; - returnVal = "Config file \n createtext"; - break; case ".log": - fileType = 1; - returnVal = "log text file \n createtext"; - break; + case ".ini": case ".properties": - fileType = 1; - returnVal = "Config file \n createtext"; - break; case ".json": - fileType = 1; - returnVal = "Config file \n createtext"; - break; + case ".dat": + return 1; + + case ".rtf": + return 2; + case ".doc": - fileType = 3; - returnVal = "Word Document (Old) \n word"; - break; - case ".docx": - fileType = 3; - returnVal = "Word Document \n word"; - break; + return 3; case ".docm": - fileType = 3; - returnVal = "Macro-Enabled Word Document \n word"; - break; + return 3; case ".xls": - fileType = 4; - returnVal = "Excel Spreadsheets (Old) \n excel"; - break; - case ".xlsx": - fileType = 4; - returnVal = "Excel Spreadsheets \n excel"; - break; + return 4; case ".ppt": - fileType = 5; - returnVal = "Powerpoint Presentation (Old) \n powerpoint"; - break; - case ".pptx": - fileType = 5; - returnVal = "Powerpoint Presentation \n powerpoint"; - break; + return 5; case ".pub": - fileType = 7; - returnVal = "Publisher Document \n powerpoint"; - break; + return 7; case ".xps": - fileType = 8; - returnVal = "XPS Document \n xpsview"; - break; + return 8; case ".htm": - fileType = 9; - returnVal = "HTML web page \n html"; - break; + return 9; case ".html": - fileType = 9; - returnVal = "HTML web page \n html"; - break; + return 9; case ".wps": - fileType = 10; - returnVal = "Works document \n works"; - break; + return 10; case ".wmf": - fileType = 11; - returnVal = "Windows Metafile (A picture) \n createart"; - break; case ".emf": - fileType = 11; - returnVal = "Enhanced Metafile (A picture) \n createart"; - break; case ".png": - fileType = 11; - returnVal = "Picture file (Portable Network Graphics) \n createart"; - break; case ".jpg": - fileType = 11; - returnVal = "Picture file \n createart"; - break; case ".jpeg": - fileType = 11; - returnVal = "Picture file \n createart"; - break; case ".gif": - fileType = 12; - returnVal = "Picture file \n gifman"; - break; case ".tif": - fileType = 11; - returnVal = "Picture file \n createart"; - break; case ".bmp": - fileType = 11; - returnVal = "Picture file \n createart"; - break; case ".zip": - fileType = 11; - returnVal = "Compressed ZIP file \n winrar"; - break; - case ".rar": - fileType = 11; - returnVal = "WINRAR Compressed file \n winrar"; - break; - case ".gz": - fileType = 11; - returnVal = "WINRAR file \n winrar"; - break; - case ".7z": - fileType = 11; - returnVal = "7ZIP file \n 7z"; - break; - case ".ace": - fileType = 11; - returnVal = "WINRAR file \n winrar"; - break; - case ".arj": - fileType = 11; - returnVal = "WINRAR file \n winrar"; - break; - case ".bz2": - fileType = 11; - returnVal = "WINRAR file \n winrar"; - break; - case ".gzip": - fileType = 11; - returnVal = "WINRAR file \n winrar"; - break; - case ".lzh": - fileType = 11; - returnVal = "WINRAR file \n winrar"; - break; - case ".tar": - fileType = 11; - returnVal = "WINRAR file \n winrar"; - break; - case ".uue": - fileType = 11; - returnVal = "WINRAR file \n winrar"; - break; - case ".xz": - fileType = 11; - returnVal = "WINRAR file \n winrar"; - break; - case ".z": - fileType = 11; - returnVal = "WINRAR file \n winrar"; - break; - case ".001": - fileType = 11; - returnVal = "WINRAR file \n winrar"; - break; + return 11; + case ".exe": - fileType = 12; - returnVal = "Program \n exe"; - break; - case ".jar": - fileType = 13; - returnVal = "Java file \n java"; - break; - case ".iso": - fileType = 14; - returnVal = "CD Image file \n iso"; - break; + return 12; case ".avi": - fileType = 15; - returnVal = "Video \n video"; - break; case ".m4v": - fileType = 15; - returnVal = "Video (MPEG-4) \n video"; - break; case ".mp4": - fileType = 15; - returnVal = "Video (MPEG-4) \n video"; - break; case ".wmv": - fileType = 15; - returnVal = "Video \n video"; - break; case ".m2v": - fileType = 15; - returnVal = "Video \n video"; - break; case ".m3u": - fileType = 15; - returnVal = "Video \n video"; - break; case ".mts": - fileType = 15; - returnVal = "Video \n video"; - break; case ".dv": - fileType = 15; - returnVal = "Video (Digital Video) \n video"; - break; case ".flv": - fileType = 15; - returnVal = "Video \n video"; - break; case ".m1v": - fileType = 15; - returnVal = "Video \n video"; - break; case ".m2ts": - fileType = 15; - returnVal = "Video \n video"; - break; case ".mkv": - fileType = 15; - returnVal = "Video \n video"; - break; case ".mov": - fileType = 15; - returnVal = "Video \n video"; - break; case ".mpeg4": - fileType = 15; - returnVal = "Video \n video"; - break; case ".mpeg": - fileType = 15; - returnVal = "Video \n video"; - break; case ".mpg": - fileType = 15; - returnVal = "Video \n video"; - break; case ".3gp": - fileType = 15; - returnVal = "Video \n video"; - break; case ".m4p": - fileType = 15; - returnVal = "Video \n video"; - break; + return 15; + case ".mp2": - fileType = 21; - returnVal = "Audio \n video"; - break; case ".mp3": - fileType = 21; - returnVal = "Audio \n video"; - break; case ".wav": - fileType = 21; - returnVal = "Audio \n video"; - break; + return 21; case ".nls": - fileType = 16; - returnVal = "Font file \n font"; - break; + return 16; case ".dll": - fileType = 17; - returnVal = "System File \n sys"; - break; + return 17; case ".bat": - fileType = 18; - returnVal = "MS-DOS Batch file \n winterm"; - break; + return 18; case ".url": - fileType = 19; - returnVal = "Shortcut \n short"; - break; + return 19; case ".sh": - fileType = 20; - returnVal = "BASH file \n winterm"; - break; + return 20; case ".win": - fileType = 17; - returnVal = "System file \n sys"; - break; + return 17; } - return returnVal; + return 0; } - //Private Sub windows_explorer_Closed(sender As Object, e As EventArgs) Handles Me.Closed - // IsFileDialog = False - //End Sub + //Private Sub windows_explorer_Closed(sender As Object, e As EventArgs) Handles Me.Closed + // IsFileDialog = False + //End Sub void mainView_DoubleClick(object sender, EventArgs e) { @@ -966,7 +761,7 @@ private void mainView_SelectedIndexChanged(object sender, EventArgs e) FileInfo fi = new FileInfo(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); txtInfoDescName.Text = mainView.FocusedItem.Text; - txtInfoDescType.Text = ReturnType(fi.Extension).Split('\n')[0]; + txtInfoDescType.Text = GetDescription(ReturnType(fi.Extension)); txtInfoDescModified.Text = fi.CreationTime.ToString(); txtInfoDescSize.Show(); @@ -988,6 +783,48 @@ private void mainView_SelectedIndexChanged(object sender, EventArgs e) } } + public string GetDescription(int type) + { + switch (type) + { + case 1: + return "Text Document"; + case 2: + return "Rich Text Document"; + case 3: + return "Word Document"; + case 4: + return "Excel Document"; + case 5: + return "Powerpoint Document"; + case 7: + return "Publisher Document"; + case 8: + return "XPS File"; + case 9: + return "HTML Document"; + case 10: + return "Microsoft Works Document"; + case 11: + return "Image File"; + case 12: + return "Executable File"; + case 21: + return "Video File"; + case 16: + case 17: + return "System File"; + case 18: + return "Batch File"; + case 19: + return "Online Shortcut"; + case 20: + return "Bash Script"; + + } + return "File"; + } + private void CutCtrlXToolStripMenuItem_Click(object sender, EventArgs e) { try From 4af08fc6e341a45158e23beb13be10aa1a6a3590 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Sat, 4 Nov 2017 11:09:57 +0000 Subject: [PATCH 08/11] Slight SaveSystem change... read the description WARNING: FROM THIS POINT ON ALL OLD SAVES ARE OUTDATED AND WILL NOT WORK kthx --- Histacom2.Engine/SaveSystem.cs | 3 +++ .../WinClassicAddressBook.Designer.cs | 23 ++++++++++--------- .../AddressBook/WinClassicAddressBook.cs | 19 +++++++++++++++ 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/Histacom2.Engine/SaveSystem.cs b/Histacom2.Engine/SaveSystem.cs index 0975a2b..a3fd2ef 100644 --- a/Histacom2.Engine/SaveSystem.cs +++ b/Histacom2.Engine/SaveSystem.cs @@ -190,6 +190,7 @@ public static void CheckFiles() public static void CreateWindowsDirectory() { + SaveDirectoryInfo(ProfileWindowsDirectory, "Application Data", true, "Application Data", true); SaveDirectoryInfo(ProfileWindowsDirectory, "System", true, "System", true); SaveDirectoryInfo(ProfileWindowsDirectory, "Config", true, "Config", true); SaveDirectoryInfo(ProfileWindowsDirectory, "Cursors", true, "Cursors", true); @@ -337,6 +338,8 @@ public static void UpgradeFileSystem(string newOS) // Add Address Book into existance! SaveDirectoryInfo(ProfileProgramsDirectory, "Outlook Express", false, "Outlook Express", true); + SaveDirectoryInfo(Path.Combine(ProfileWindowsDirectory, "Application Data"), "Microsoft", false, "Microsoft", true); + SaveDirectoryInfo(Path.Combine(ProfileWindowsDirectory, "Application Data", "Microsoft"), "Address Book", false, "Address Book", true); CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Outlook Express"), "WAB.exe", "addressbook", 8, 512); // There is no "The Microsoft Network" folder! diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs index 20f5af2..09030fb 100644 --- a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs +++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs @@ -105,67 +105,67 @@ private void InitializeComponent() // newContactToolStripMenuItem // this.newContactToolStripMenuItem.Name = "newContactToolStripMenuItem"; - this.newContactToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.newContactToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.newContactToolStripMenuItem.Text = "New contact..."; this.newContactToolStripMenuItem.Click += new System.EventHandler(this.newContactToolStripMenuItem_Click); // // newFolderToolStripMenuItem // this.newFolderToolStripMenuItem.Name = "newFolderToolStripMenuItem"; - this.newFolderToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.newFolderToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.newFolderToolStripMenuItem.Text = "New folder..."; this.newFolderToolStripMenuItem.Click += new System.EventHandler(this.newFolderToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(147, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); // // propertiesToolStripMenuItem // this.propertiesToolStripMenuItem.Name = "propertiesToolStripMenuItem"; - this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.propertiesToolStripMenuItem.Text = "Properties"; this.propertiesToolStripMenuItem.Click += new System.EventHandler(this.propertiesToolStripMenuItem_Click); // // deleteToolStripMenuItem // this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; - this.deleteToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.deleteToolStripMenuItem.Text = "Delete"; this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(147, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6); // // importToolStripMenuItem // this.importToolStripMenuItem.Name = "importToolStripMenuItem"; - this.importToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.importToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.importToolStripMenuItem.Text = "Import..."; // // exportToolStripMenuItem // this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; - this.exportToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.exportToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.exportToolStripMenuItem.Text = "Export..."; // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(147, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6); // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(147, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -350,6 +350,7 @@ private void InitializeComponent() this.Controls.Add(this.topmenu); this.Name = "WinClassicAddressBook"; this.Size = new System.Drawing.Size(666, 425); + this.Load += new System.EventHandler(this.WinClassicAddressBook_Load); this.topmenu.ResumeLayout(false); this.topmenu.PerformLayout(); this.toolbar.ResumeLayout(false); diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs index 0c6701a..e4d6c7b 100644 --- a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs +++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs @@ -299,6 +299,25 @@ private void aboutAddressBookToolStripMenuItem_Click(object sender, EventArgs e) { } + + private void WinClassicAddressBook_Load(object sender, EventArgs e) + { + ((Form)this.TopLevelControl).FormClosed += (sender2, e2) => + { + SaveData(); + }; + } + + public void SaveData() + { + + } + + public void SaveDataAs() + { + + } + } public class AddressBookContact From cc07981aa3603c74507c9ea0acb6dd0d8418d58e Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Sat, 4 Nov 2017 17:48:05 +0000 Subject: [PATCH 09/11] Address Book can now save data! --- Histacom2.Engine/FileDialogBoxManager.cs | 12 +- Histacom2.Engine/UI/ClassicDropDown.cs | 4 +- .../Win95/Win95Apps/Win95WindowsExplorer.cs | 21 ++- .../FRMWinClassicAddressBookNewContact.cs | 8 +- .../WinClassicAddressBook.Designer.cs | 2 + .../AddressBook/WinClassicAddressBook.cs | 157 ++++++++++++++---- .../Win98Apps/WinClassicWindowsExplorer.cs | 51 +++--- 7 files changed, 180 insertions(+), 75 deletions(-) diff --git a/Histacom2.Engine/FileDialogBoxManager.cs b/Histacom2.Engine/FileDialogBoxManager.cs index 9f0b2ce..d4d025c 100644 --- a/Histacom2.Engine/FileDialogBoxManager.cs +++ b/Histacom2.Engine/FileDialogBoxManager.cs @@ -12,27 +12,27 @@ public static class FileDialogBoxManager { public static bool IsInOpenDialog = false; public static bool IsInSaveDialog = false; - public static string OnlyViewExtension = ""; + public static List OnlyViewExtension = new List(); - public static void ActivateOpenFileDialog(string ExtensionToView) + public static void ActivateOpenFileDialog(params string[] ExtensionToView) { IsInOpenDialog = true; IsInSaveDialog = false; - OnlyViewExtension = ExtensionToView; + OnlyViewExtension = ExtensionToView.ToList(); } - public static void ActivateSaveFileDialog(string ExtensionToView) + public static void ActivateSaveFileDialog(params string[] ExtensionToView) { IsInOpenDialog = false; IsInSaveDialog = true; - OnlyViewExtension = ExtensionToView; + OnlyViewExtension = ExtensionToView.ToList(); } public static void DeactivateFileDialog() { IsInOpenDialog = false; IsInSaveDialog = false; - OnlyViewExtension = ""; + OnlyViewExtension = new List(); } public static string ReadTextFile(string path) diff --git a/Histacom2.Engine/UI/ClassicDropDown.cs b/Histacom2.Engine/UI/ClassicDropDown.cs index 93b4a62..edf2268 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.cs @@ -34,7 +34,7 @@ public override string Text public static Color _lightBack = Color.Silver; public static Color _darkBack = Color.Silver; - public List items = new List { "TestItem" }; + public List Items { get; set; } = new List(); public ClassicDropDown() { @@ -117,7 +117,7 @@ public void ShowHideDropDown() } else { thisOverlay = new DropDownOverlay(); int applyHeight = 0; - foreach (string str in items) + foreach (string str in Items) { DropDownItem itm = new DropDownItem(); itm.ChangeText(str, Font); diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index 4efdd6f..1ac4512 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -22,14 +22,12 @@ public partial class Win95WindowsExplorer : UserControl { public bool IsFileOpenDialog = false; public bool IsFileSaveDialog = false; - public string onlyViewExtension = ""; + public List onlyViewExtension = new List(); string ToReplaceWith = ProfileDirectory; public string CurrentDirectory = ProfileMyComputerDirectory; string OldLabelText; string CurrentCopyFile; - - int fileType = 6; //string attemptedDirectory = ""; WindowManager wm = new WindowManager(); @@ -89,7 +87,8 @@ void WinClassicWindowsExplorer_Load(object sender, EventArgs e) Properties.Resources.TimeDistorter1, Properties.Resources.WinClassicGTN, Properties.Resources.WinClassicFTP, - Properties.Resources.WinClassicRtfFile}); //20 + Properties.Resources.WinClassicRtfFile, // 20 + Properties.Resources.WinClassicAddressBook}); program.BringToFront(); @@ -124,6 +123,9 @@ void WinClassicWindowsExplorer_Load(object sender, EventArgs e) } onlyViewExtension = FileDialogBoxManager.OnlyViewExtension; + + foreach (string str in onlyViewExtension) + cmbType.Items.Add(str); } string ReadDataFile(string reqDirectory, bool returnYesIfProtected = false) { @@ -162,7 +164,7 @@ private void RefreshAll() { if (!(Path.GetFileName(str) == "_data.info")) { - if (new FileInfo(str).Extension == onlyViewExtension) + if (onlyViewExtension.Contains(new FileInfo(str).Extension)) { itm = this.mainView.Items.Add(Path.GetFileName(str)); itm.Tag = str; @@ -232,8 +234,7 @@ public void OpenFile(string fileDir) { try { - ReturnType(new FileInfo(fileDir).Extension); - switch (fileType) + switch (ReturnType(new FileInfo(fileDir).Extension)) { case 1: WinClassicNotepad np = new WinClassicNotepad(); @@ -501,7 +502,7 @@ void mainView_DoubleClick(object sender, EventArgs e) { // If it is a file if (IsFileOpenDialog || IsFileSaveDialog) { - if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) + if (onlyViewExtension.Contains(new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension)) { Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); } @@ -513,9 +514,7 @@ void mainView_DoubleClick(object sender, EventArgs e) ((Form)this.TopLevelControl).Close(); } else - { OpenFile(mainView.FocusedItem.Tag.ToString()); - } } } catch { /* TODO: Illegal operation */ } } @@ -595,7 +594,7 @@ private void btnSave_Click(object sender, EventArgs e) if (txtSave.Text == "") wm.StartInfobox95("Windows Explorer", "Please enter a filename", InfoboxType.Info, InfoboxButtons.OK); else { - if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); + if (onlyViewExtension.Contains(new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension)) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); FileDialogBoxManager.IsInOpenDialog = false; FileDialogBoxManager.IsInSaveDialog = false; diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/FRMWinClassicAddressBookNewContact.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/FRMWinClassicAddressBookNewContact.cs index 9facd7b..45384fa 100644 --- a/Histacom2/OS/Win98/Win98Apps/AddressBook/FRMWinClassicAddressBookNewContact.cs +++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/FRMWinClassicAddressBookNewContact.cs @@ -7,12 +7,13 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; - +using Histacom2.Engine; namespace Histacom2.OS.Win95.Win95Apps { public partial class FRMWinClassicAddressBookNewContact : UserControl { + WindowManager wm = new WindowManager(); public AddressBookContact toSet = new AddressBookContact(); public FRMWinClassicAddressBookNewContact() { @@ -37,7 +38,7 @@ private void button1_Click(object sender, EventArgs e) Program.AddressBookSelectedContact = toSet; ((Form)this.TopLevelControl).Close(); } else { - MessageBox.Show("Please fill out the First, Middle and Last name."); + wm.StartInfobox95("Address Book", "Please fill out the First, Middle and Last name.", Engine.Template.InfoboxType.Info, Engine.Template.InfoboxButtons.OK); } } @@ -62,9 +63,6 @@ private void FRMWinClassicAddressBookNewContact_Load(object sender, EventArgs e) emails.Items.Add(email); } } - } else - { - MessageBox.Show("NULL CONTACT!"); } } } diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs index 09030fb..5452184 100644 --- a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs +++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs @@ -145,12 +145,14 @@ private void InitializeComponent() this.importToolStripMenuItem.Name = "importToolStripMenuItem"; this.importToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.importToolStripMenuItem.Text = "Import..."; + this.importToolStripMenuItem.Click += new System.EventHandler(this.importToolStripMenuItem_Click); // // exportToolStripMenuItem // this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; this.exportToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.exportToolStripMenuItem.Text = "Export..."; + this.exportToolStripMenuItem.Click += new System.EventHandler(this.exportToolStripMenuItem_Click); // // toolStripSeparator3 // diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs index e4d6c7b..bf4f648 100644 --- a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs +++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs @@ -9,6 +9,9 @@ using System.Windows.Forms; using Histacom2.Engine; using Histacom2.Engine.Template; +using System.IO; +using static Histacom2.Engine.SaveSystem; +using static Histacom2.Engine.FileDialogBoxManager; namespace Histacom2.OS.Win95.Win95Apps { @@ -42,14 +45,30 @@ public WinClassicAddressBook() { new AddressBookContactList() { - AttachedNode = treeView1.Nodes[0].Text + NodePath = treeView1.Nodes[0].Text } }; + + if (File.Exists(Path.Combine(ProfileWindowsDirectory, "Application Data", "Microsoft", "Address Book", $"{ProfileName}.wab"))) + LoadData(); + else + SaveData(); + + } private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { - UpdateContactListFromNodeName(treeView1.SelectedNode.Text); + previousParent = treeView1.SelectedNode.Parent; + UpdateContactListFromNodeName(treeView1.SelectedNode); + + // Remove the focus from contactsView + + if (contactsView.SelectedItems.Count != 0) + contactsView.SelectedItems[0].Selected = false; + + if (contactsView.FocusedItem != null) + contactsView.FocusedItem.Focused = false; } //AddressBookContactList GetAddressBookContactListFromNode(string NodeText) @@ -71,14 +90,15 @@ private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) // return toReturn; //} - public void UpdateContactListFromNodeName(string NodeName) + public void UpdateContactListFromNodeName(TreeNode Node) { + previousParent = Node.Parent; contactsView.Items.Clear(); try { foreach (AddressBookContactList ContactList in AddressBookObjects) { - if (ContactList.AttachedNode == NodeName) + if (ContactList.NodePath == FindNodePath(Node)) { foreach (AddressBookContact contact in ContactList.Contacts) { @@ -97,15 +117,29 @@ public void AddFolderToNode(TreeNode OldTreeNode, string NewNodeName) { if (OldTreeNode != null) { - OldTreeNode.Nodes.Add(NewNodeName); + TreeNode nde = OldTreeNode.Nodes.Add(NewNodeName); AddressBookObjects.Add(new AddressBookContactList { - AttachedNode = NewNodeName, + NodePath = FindNodePath(nde) }); } } + TreeNode previousParent; + public string FindNodePath(TreeNode nde) + { + if (nde != null) + { + string ret = nde.Text; + previousParent = nde.Parent; + while (previousParent != null) + ret = $"{FindNodePath(nde.Parent)}\\{ret}"; + return ret; + } + else return ""; + } + private void newFolderToolStripMenuItem_Click(object sender, EventArgs e) { NewFolder(); @@ -145,7 +179,7 @@ void NewContact() { foreach (AddressBookContactList ContactList in AddressBookObjects) { - if (ContactList.AttachedNode == treeView1.SelectedNode.Text) + if (ContactList.NodePath == FindNodePath(treeView1.SelectedNode)) { ContactList.Contacts.Add(Program.AddressBookSelectedContact); contactsView.Items.Add(Program.AddressBookSelectedContact.FirstName + " " + Program.AddressBookSelectedContact.MiddleName + " " + Program.AddressBookSelectedContact.LastName); @@ -169,7 +203,7 @@ void OpenProperties() { foreach (AddressBookContactList ContactList in AddressBookObjects) { - if (ContactList.AttachedNode == treeView1.SelectedNode.Text) + if (ContactList.NodePath == FindNodePath(treeView1.SelectedNode)) { foreach (AddressBookContact Contact in ContactList.Contacts) { @@ -195,7 +229,7 @@ void OpenProperties() { foreach (AddressBookContactList ContactList in AddressBookObjects) { - if (ContactList.AttachedNode == treeView1.SelectedNode.Text) + if (ContactList.NodePath == FindNodePath(treeView1.SelectedNode)) { foreach (AddressBookContact Contact in ContactList.Contacts) { @@ -228,31 +262,31 @@ void DeleteContact() { try { - if (treeView1.SelectedNode != null) + foreach (AddressBookContactList ContactList in AddressBookObjects) { - foreach (AddressBookContactList ContactList in AddressBookObjects) + if (ContactList.NodePath == FindNodePath(treeView1.SelectedNode)) { - if (ContactList.AttachedNode == treeView1.SelectedNode.Text) + foreach (AddressBookContact Contact in ContactList.Contacts) { - foreach (AddressBookContact Contact in ContactList.Contacts) - { - if (contactsView.FocusedItem == null) - { // Most likely they are trying to delete a whole folder! - if (treeView1.SelectedNode.Text != "Shared Contacts") - if (treeView1.SelectedNode != null) - { - AddressBookObjects.Remove(ContactList); - treeView1.Nodes.Remove(treeView1.SelectedNode); - UpdateContactListFromNodeName("Shared Contacts"); - } - } - else - { - if ((Contact.FirstName + " " + Contact.MiddleName + " " + Contact.LastName) == contactsView.FocusedItem.Text) + if (contactsView.FocusedItem == null) + { // Most likely they are trying to delete a whole folder! + if (treeView1.SelectedNode.Text != "Shared Contacts") + if (treeView1.SelectedNode != null) { - ContactList.Contacts.Remove(Contact); + AddressBookObjects.Remove(ContactList); + treeView1.Nodes.Remove(treeView1.SelectedNode); + previousParent = null; + UpdateContactListFromNodeName(treeView1.Nodes[0]); } - } + } + else + { + if ((Contact.FirstName + " " + Contact.MiddleName + " " + Contact.LastName) == contactsView.FocusedItem.Text) + { + ContactList.Contacts.Remove(Contact); + previousParent = treeView1.SelectedNode.Parent; + UpdateContactListFromNodeName(treeView1.SelectedNode); + } } } } @@ -310,14 +344,75 @@ private void WinClassicAddressBook_Load(object sender, EventArgs e) public void SaveData() { - + string toSave = Newtonsoft.Json.JsonConvert.SerializeObject(AddressBookObjects, Newtonsoft.Json.Formatting.Indented); + CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Application Data", "Microsoft", "Address Book"), $"{ProfileName}.wab", toSave, 21, toSave.Length); } public void SaveDataAs() { + try + { + string toSave = Newtonsoft.Json.JsonConvert.SerializeObject(AddressBookObjects, Newtonsoft.Json.Formatting.Indented); + ActivateSaveFileDialog(".wab"); + string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath(); + DeactivateFileDialog(); + + if (selectedPath != "") + CreateWindowsFile(new FileInfo(selectedPath).Directory.FullName, selectedPath.Split('\\').Last(), toSave, 21, toSave.Length); + } catch { } + } + + public void LoadData() + { + AddressBookObjects = Newtonsoft.Json.JsonConvert.DeserializeObject>(File.ReadAllText(Path.Combine(ProfileWindowsDirectory, "Application Data", "Microsoft", "Address Book", $"{ProfileName}.wab"))); + + foreach (AddressBookContactList lst in AddressBookObjects) + UpdateTreeView(lst); } + public void LoadDataAs() + { + ActivateOpenFileDialog(".wab"); + string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath(); + DeactivateFileDialog(); + + if (selectedPath != "") + AddressBookObjects = Newtonsoft.Json.JsonConvert.DeserializeObject>(File.ReadAllText(selectedPath)); + + foreach (AddressBookContactList lst in AddressBookObjects) + UpdateTreeView(lst); + } + + TreeNode UpdatePrevParent; + public void UpdateTreeView(AddressBookContactList lst, int count = 0) + { + try + { + string[] parts = lst.NodePath.Split('\\'); + if (count == 0) UpdatePrevParent = treeView1.Nodes[0]; + if (lst.NodePath != FindNodePath(treeView1.Nodes[0])) + { + if (UpdatePrevParent.Nodes.ContainsKey(parts[count + 1])) + UpdatePrevParent.Nodes.RemoveByKey(parts[count + 1]); + + TreeNode newNde = UpdatePrevParent.Nodes.Add(parts[count + 1], parts[count + 1]); + UpdatePrevParent = newNde; + if (count != parts.Length - 2) UpdateTreeView(lst, ++count); + } + + } catch { } + } + + private void importToolStripMenuItem_Click(object sender, EventArgs e) + { + LoadDataAs(); + } + + private void exportToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveDataAs(); + } } public class AddressBookContact @@ -330,7 +425,7 @@ public class AddressBookContact public class AddressBookContactList { - public string AttachedNode; + public string NodePath; public List Contacts = new List(); } } diff --git a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs index c7369b4..947f9ba 100644 --- a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs +++ b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs @@ -22,13 +22,12 @@ public partial class WinClassicWindowsExplorer : UserControl { public bool IsFileOpenDialog = false; public bool IsFileSaveDialog = false; - public string onlyViewExtension = ""; + public List onlyViewExtension = new List(); string ToReplaceWith = ProfileDirectory; public string CurrentDirectory = ProfileMyComputerDirectory; string OldLabelText; string CurrentCopyFile; - int fileType = 6; //string attemptedDirectory = ""; WindowManager wm = new WindowManager(); @@ -82,7 +81,8 @@ void WinClassicWindowsExplorer_Load(object sender, EventArgs e) Properties.Resources.TimeDistorter1, Properties.Resources.WinClassicGTN, Properties.Resources.WinClassicFTP, - Properties.Resources.WinClassicRtfFile}); //20 + Properties.Resources.WinClassicRtfFile, // 20 + Properties.Resources.WinClassicAddressBook}); program.BringToFront(); @@ -117,6 +117,11 @@ void WinClassicWindowsExplorer_Load(object sender, EventArgs e) } onlyViewExtension = FileDialogBoxManager.OnlyViewExtension; + + foreach (string str in onlyViewExtension) + cmbType.Items.Add(str); + + cmbType.Text = onlyViewExtension.FirstOrDefault(); } //'Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) @@ -157,6 +162,19 @@ void RefreshAll() { //try { this.mainView.Items.Clear(); + if (CurrentDirectory == ProfileFileSystemDirectory) + { + txtInfoTitle.Text = "My Computer"; + pictureBox1.Image = Properties.Resources.Win95ComputerIcon; + } else if (CurrentDirectory == ProfileMyComputerDirectory) { + txtInfoTitle.Text = "C:"; + pictureBox1.Image = Properties.Resources.WinClassicFolderSmall; // TODO: ADD DRIVE ICON + } else { + txtInfoTitle.Text = Path.GetFileName(CurrentDirectory); + pictureBox1.Image = Properties.Resources.WinClassicFolderSmall; + } + + foreach (string str in Directory.GetDirectories(CurrentDirectory)) { string label = ReadDataFile(str, false); @@ -172,14 +190,14 @@ void RefreshAll() { { if (!(Path.GetFileName(str) == "_data.info")) { - if (new FileInfo(str).Extension == onlyViewExtension) + if (onlyViewExtension.Contains(new FileInfo(str).Extension)) { itm = this.mainView.Items.Add(Path.GetFileName(str)); itm.Tag = str; } - else break; + else continue; } - else break; + else continue; } else { @@ -188,7 +206,7 @@ void RefreshAll() { itm = this.mainView.Items.Add(Path.GetFileName(str)); itm.Tag = str; } - else break; + else continue; } FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info"))); foreach (var item in fsfi.Files) @@ -244,8 +262,7 @@ public void OpenFile(string fileDir) { try { - ReturnType(new FileInfo(fileDir).Extension); - switch (fileType) + switch (ReturnType(new FileInfo(fileDir).Extension)) { case 1: WinClassicNotepad np = new WinClassicNotepad(); @@ -452,7 +469,7 @@ void mainView_DoubleClick(object sender, EventArgs e) { // If it is a file if (IsFileOpenDialog || IsFileSaveDialog) { - if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) + if (onlyViewExtension.Contains(new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension)) { Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); } @@ -464,9 +481,7 @@ void mainView_DoubleClick(object sender, EventArgs e) ((Form)this.TopLevelControl).Close(); } else - { OpenFile(mainView.FocusedItem.Tag.ToString()); - } } } catch { /* TODO: Illegal operation */ } } @@ -477,7 +492,7 @@ void diskView_AfterSelect(object sender, EventArgs e) { if (diskView.SelectedNode != null) { - if (diskView.SelectedNode.Text == "My Computer") + if (diskView.SelectedNode.Text == "My Computer" || diskView.SelectedNode.Text == "Desktop") { GoToDir(ProfileFileSystemDirectory); } @@ -491,11 +506,7 @@ void diskView_AfterSelect(object sender, EventArgs e) { // It is a directory: - try - { - GoToDir(diskView.SelectedNode.Tag.ToString()); - } - catch { } + GoToDir(diskView.SelectedNode.Tag.ToString()); } } } @@ -540,7 +551,7 @@ private void Button1_Click(object sender, EventArgs e) if (txtSave.Text == "") wm.StartInfobox95("Windows Explorer", "Please enter a filename", InfoboxType.Info, InfoboxButtons.OK); else { - if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); + if (onlyViewExtension.Contains(new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension)) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); FileDialogBoxManager.IsInOpenDialog = false; FileDialogBoxManager.IsInSaveDialog = false; @@ -980,7 +991,7 @@ private void btnSave_Click(object sender, EventArgs e) if (txtSave.Text == "") wm.StartInfobox95("Windows Explorer", "Please enter a filename", InfoboxType.Info, InfoboxButtons.OK); else { - if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); + if (onlyViewExtension.Contains(new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension)) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); FileDialogBoxManager.IsInOpenDialog = false; FileDialogBoxManager.IsInSaveDialog = false; From 1cdbf9659b0153285bb56bd35ab58e0a70f4d632 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Sat, 4 Nov 2017 22:00:05 +0000 Subject: [PATCH 10/11] Final commit! --- Histacom2.Engine/UI/ClassicDropDown.cs | 13 +- .../UI/ClassicTextBox.Designer.cs | 8 +- Histacom2.Engine/UI/ClassicTextbox.cs | 14 +- Histacom2/Histacom2.csproj | 3 + .../Win95/Win95Apps/Win95WindowsExplorer.cs | 2 +- .../Win95Apps/WinClassicFTPClient.Designer.cs | 217 +++++++++--------- .../OS/Win95/Win95Apps/WinClassicFTPClient.cs | 6 +- .../Win95/Win95Apps/WinClassicFTPClient.resx | 2 +- .../WinClassicAddressBook.Designer.cs | 2 +- .../AddressBook/WinClassicAddressBook.cs | 7 +- .../WinClassicWindowsExplorer.Designer.cs | 150 ++++++------ .../Win98Apps/WinClassicWindowsExplorer.cs | 32 ++- .../Win98Apps/WinClassicWindowsExplorer.resx | 9 + Histacom2/Properties/Resources.resx | 6 + Histacom2/Properties/Resources1.Designer.cs | 26 ++- .../Resources/WinClassicAddressBookBig.png | Bin 0 -> 2146 bytes Histacom2/Resources/WinClassicDrive.png | Bin 0 -> 238 bytes Histacom2/Resources/addrbook.ico_32x32[1].png | Bin 0 -> 2146 bytes 18 files changed, 294 insertions(+), 203 deletions(-) create mode 100644 Histacom2/Resources/WinClassicAddressBookBig.png create mode 100644 Histacom2/Resources/WinClassicDrive.png create mode 100644 Histacom2/Resources/addrbook.ico_32x32[1].png diff --git a/Histacom2.Engine/UI/ClassicDropDown.cs b/Histacom2.Engine/UI/ClassicDropDown.cs index edf2268..e01ca2a 100644 --- a/Histacom2.Engine/UI/ClassicDropDown.cs +++ b/Histacom2.Engine/UI/ClassicDropDown.cs @@ -14,7 +14,6 @@ namespace Histacom2.Engine.UI public partial class ClassicDropDown : UserControl { public DropDownOverlay thisOverlay = new DropDownOverlay(); - public bool UseSystemPasswordChar { get; set; } public bool dropDownShown; public override string Text @@ -29,6 +28,18 @@ public override string Text } } + public bool UseSystemPasswordChar + { + get + { + return textBox1.UseSystemPasswordChar; + } + set + { + textBox1.UseSystemPasswordChar = value; + } + } + public static Color textboxcolor = Color.Black; public static Color _lightBack = Color.Silver; diff --git a/Histacom2.Engine/UI/ClassicTextBox.Designer.cs b/Histacom2.Engine/UI/ClassicTextBox.Designer.cs index af6b199..06df3fb 100644 --- a/Histacom2.Engine/UI/ClassicTextBox.Designer.cs +++ b/Histacom2.Engine/UI/ClassicTextBox.Designer.cs @@ -42,7 +42,7 @@ private void InitializeComponent() // bborder // this.bborder.Dock = System.Windows.Forms.DockStyle.Bottom; - this.bborder.Location = new System.Drawing.Point(2, 15); + this.bborder.Location = new System.Drawing.Point(2, 18); this.bborder.Name = "bborder"; this.bborder.Size = new System.Drawing.Size(96, 2); this.bborder.TabIndex = 0; @@ -53,7 +53,7 @@ private void InitializeComponent() this.lborder.Dock = System.Windows.Forms.DockStyle.Left; this.lborder.Location = new System.Drawing.Point(0, 0); this.lborder.Name = "lborder"; - this.lborder.Size = new System.Drawing.Size(2, 17); + this.lborder.Size = new System.Drawing.Size(2, 20); this.lborder.TabIndex = 1; this.lborder.TabStop = false; // @@ -62,7 +62,7 @@ private void InitializeComponent() this.rborder.Dock = System.Windows.Forms.DockStyle.Right; this.rborder.Location = new System.Drawing.Point(98, 0); this.rborder.Name = "rborder"; - this.rborder.Size = new System.Drawing.Size(2, 17); + this.rborder.Size = new System.Drawing.Size(2, 20); this.rborder.TabIndex = 2; this.rborder.TabStop = false; // @@ -94,7 +94,7 @@ private void InitializeComponent() this.Controls.Add(this.rborder); this.Controls.Add(this.lborder); this.Name = "ClassicTextBox"; - this.Size = new System.Drawing.Size(100, 17); + this.Size = new System.Drawing.Size(100, 20); ((System.ComponentModel.ISupportInitialize)(this.bborder)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.lborder)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.rborder)).EndInit(); diff --git a/Histacom2.Engine/UI/ClassicTextbox.cs b/Histacom2.Engine/UI/ClassicTextbox.cs index f89df03..4847ed5 100644 --- a/Histacom2.Engine/UI/ClassicTextbox.cs +++ b/Histacom2.Engine/UI/ClassicTextbox.cs @@ -12,8 +12,6 @@ namespace Histacom2.Engine.UI { public partial class ClassicTextBox : UserControl { - public bool UseSystemPasswordChar { get; set; } - public static Color textboxcolor = Color.Black; public static Color _lightBack = Color.Silver; @@ -31,6 +29,18 @@ public override string Text } } + public bool UseSystemPasswordChar + { + get + { + return textBox1.UseSystemPasswordChar; + } + set + { + textBox1.UseSystemPasswordChar = value; + } + } + public ClassicTextBox() { InitializeComponent(); diff --git a/Histacom2/Histacom2.csproj b/Histacom2/Histacom2.csproj index 1c34422..19cf5dc 100644 --- a/Histacom2/Histacom2.csproj +++ b/Histacom2/Histacom2.csproj @@ -759,6 +759,7 @@ + @@ -878,6 +879,8 @@ + + diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index 1ac4512..e743b30 100644 --- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -88,7 +88,7 @@ void WinClassicWindowsExplorer_Load(object sender, EventArgs e) Properties.Resources.WinClassicGTN, Properties.Resources.WinClassicFTP, Properties.Resources.WinClassicRtfFile, // 20 - Properties.Resources.WinClassicAddressBook}); + Properties.Resources.WinClassicAddressBookBig}); program.BringToFront(); diff --git a/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.Designer.cs b/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.Designer.cs index c112e61..ead2483 100644 --- a/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.Designer.cs +++ b/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.Designer.cs @@ -38,21 +38,21 @@ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WinClassicFTPClient)); this.topBar = new System.Windows.Forms.Panel(); this.btnLogin = new Histacom2.Engine.UI.ClassicButton(); - this.infoLabel = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.textBox4 = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.passBox = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.usernameBox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.hostnameBox = new System.Windows.Forms.TextBox(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.panel1 = new System.Windows.Forms.Panel(); this.btnCancel = new Histacom2.Engine.UI.ClassicButton(); this.welcomeLabel = new System.Windows.Forms.Label(); this.ftpFiles = new System.Windows.Forms.ListView(); this.fileIcons = new System.Windows.Forms.ImageList(this.components); + this.hostnameBox = new Histacom2.Engine.UI.ClassicTextBox(); + this.usernameBox = new Histacom2.Engine.UI.ClassicTextBox(); + this.passBox = new Histacom2.Engine.UI.ClassicTextBox(); + this.infoLabel = new Histacom2.Engine.UI.ClassicLabel(); + this.textBox4 = new Histacom2.Engine.UI.ClassicTextBox(); + this.classicLabel1 = new Histacom2.Engine.UI.ClassicLabel(); + this.classicLabel2 = new Histacom2.Engine.UI.ClassicLabel(); + this.classicLabel3 = new Histacom2.Engine.UI.ClassicLabel(); + this.classicLabel4 = new Histacom2.Engine.UI.ClassicLabel(); this.topBar.SuspendLayout(); this.panel1.SuspendLayout(); this.SuspendLayout(); @@ -60,16 +60,16 @@ private void InitializeComponent() // topBar // this.topBar.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.topBar.Controls.Add(this.btnLogin); this.topBar.Controls.Add(this.infoLabel); - this.topBar.Controls.Add(this.label4); this.topBar.Controls.Add(this.textBox4); - this.topBar.Controls.Add(this.label3); this.topBar.Controls.Add(this.passBox); - this.topBar.Controls.Add(this.label2); this.topBar.Controls.Add(this.usernameBox); - this.topBar.Controls.Add(this.label1); this.topBar.Controls.Add(this.hostnameBox); + this.topBar.Controls.Add(this.btnLogin); + this.topBar.Controls.Add(this.classicLabel4); + this.topBar.Controls.Add(this.classicLabel3); + this.topBar.Controls.Add(this.classicLabel2); + this.topBar.Controls.Add(this.classicLabel1); this.topBar.Dock = System.Windows.Forms.DockStyle.Top; this.topBar.Location = new System.Drawing.Point(0, 0); this.topBar.Name = "topBar"; @@ -85,91 +85,13 @@ private void InitializeComponent() this.btnLogin.DialogResult = System.Windows.Forms.DialogResult.None; this.btnLogin.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.btnLogin.ForeColor = System.Drawing.Color.Black; - this.btnLogin.Location = new System.Drawing.Point(585, 4); + this.btnLogin.Location = new System.Drawing.Point(571, 4); this.btnLogin.Name = "btnLogin"; this.btnLogin.Size = new System.Drawing.Size(44, 20); this.btnLogin.TabIndex = 9; this.btnLogin.Text = "Login"; this.btnLogin.Click += new System.EventHandler(this.button1_Click); // - // infoLabel - // - this.infoLabel.AutoSize = true; - this.infoLabel.ForeColor = System.Drawing.Color.Red; - this.infoLabel.Location = new System.Drawing.Point(635, 7); - this.infoLabel.Name = "infoLabel"; - this.infoLabel.Size = new System.Drawing.Size(35, 13); - this.infoLabel.TabIndex = 8; - this.infoLabel.Text = "label5"; - this.infoLabel.Visible = false; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(503, 7); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(29, 13); - this.label4.TabIndex = 6; - this.label4.Text = "&Port:"; - // - // textBox4 - // - this.textBox4.Enabled = false; - this.textBox4.Location = new System.Drawing.Point(538, 4); - this.textBox4.Name = "textBox4"; - this.textBox4.Size = new System.Drawing.Size(41, 20); - this.textBox4.TabIndex = 7; - this.textBox4.Text = "21"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(335, 7); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(56, 13); - this.label3.TabIndex = 4; - this.label3.Text = "Pass&word:"; - // - // passBox - // - this.passBox.Location = new System.Drawing.Point(397, 4); - this.passBox.Name = "passBox"; - this.passBox.PasswordChar = '*'; - this.passBox.Size = new System.Drawing.Size(100, 20); - this.passBox.TabIndex = 5; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(156, 7); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(58, 13); - this.label2.TabIndex = 2; - this.label2.Text = "&Username:"; - // - // usernameBox - // - this.usernameBox.Location = new System.Drawing.Point(214, 4); - this.usernameBox.Name = "usernameBox"; - this.usernameBox.Size = new System.Drawing.Size(100, 20); - this.usernameBox.TabIndex = 3; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(8, 7); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(32, 13); - this.label1.TabIndex = 1; - this.label1.Text = "&Host:"; - // - // hostnameBox - // - this.hostnameBox.Location = new System.Drawing.Point(41, 4); - this.hostnameBox.Name = "hostnameBox"; - this.hostnameBox.Size = new System.Drawing.Size(100, 20); - this.hostnameBox.TabIndex = 1; - // // contextMenuStrip1 // this.contextMenuStrip1.Name = "contextMenuStrip1"; @@ -246,6 +168,96 @@ private void InitializeComponent() this.fileIcons.Images.SetKeyName(1, "WinClassicNotepad.png"); this.fileIcons.Images.SetKeyName(2, "WinClassicSetup.png"); // + // hostnameBox + // + this.hostnameBox.BackColor = System.Drawing.Color.White; + this.hostnameBox.Location = new System.Drawing.Point(37, 4); + this.hostnameBox.Name = "hostnameBox"; + this.hostnameBox.Size = new System.Drawing.Size(113, 20); + this.hostnameBox.TabIndex = 10; + this.hostnameBox.UseSystemPasswordChar = false; + // + // usernameBox + // + this.usernameBox.BackColor = System.Drawing.Color.White; + this.usernameBox.Location = new System.Drawing.Point(220, 4); + this.usernameBox.Name = "usernameBox"; + this.usernameBox.Size = new System.Drawing.Size(109, 20); + this.usernameBox.TabIndex = 10; + this.usernameBox.UseSystemPasswordChar = false; + // + // passBox + // + this.passBox.BackColor = System.Drawing.Color.White; + this.passBox.Location = new System.Drawing.Point(392, 4); + this.passBox.Name = "passBox"; + this.passBox.Size = new System.Drawing.Size(105, 20); + this.passBox.TabIndex = 10; + this.passBox.UseSystemPasswordChar = true; + // + // infoLabel + // + this.infoLabel.DropShadow = false; + this.infoLabel.ForeColor = System.Drawing.Color.Red; + this.infoLabel.Location = new System.Drawing.Point(621, 7); + this.infoLabel.Name = "infoLabel"; + this.infoLabel.Size = new System.Drawing.Size(75, 13); + this.infoLabel.TabIndex = 11; + this.infoLabel.Text = "classicLabel1"; + // + // textBox4 + // + this.textBox4.BackColor = System.Drawing.Color.White; + this.textBox4.Location = new System.Drawing.Point(530, 4); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(36, 20); + this.textBox4.TabIndex = 10; + this.textBox4.UseSystemPasswordChar = false; + // + // classicLabel1 + // + this.classicLabel1.BackColor = System.Drawing.Color.Transparent; + this.classicLabel1.DropShadow = false; + this.classicLabel1.ForeColor = System.Drawing.Color.Black; + this.classicLabel1.Location = new System.Drawing.Point(3, 7); + this.classicLabel1.Name = "classicLabel1"; + this.classicLabel1.Size = new System.Drawing.Size(75, 13); + this.classicLabel1.TabIndex = 11; + this.classicLabel1.Text = "Host:"; + // + // classicLabel2 + // + this.classicLabel2.BackColor = System.Drawing.Color.Transparent; + this.classicLabel2.DropShadow = false; + this.classicLabel2.ForeColor = System.Drawing.Color.Black; + this.classicLabel2.Location = new System.Drawing.Point(156, 7); + this.classicLabel2.Name = "classicLabel2"; + this.classicLabel2.Size = new System.Drawing.Size(75, 13); + this.classicLabel2.TabIndex = 11; + this.classicLabel2.Text = "Username:"; + // + // classicLabel3 + // + this.classicLabel3.BackColor = System.Drawing.Color.Transparent; + this.classicLabel3.DropShadow = false; + this.classicLabel3.ForeColor = System.Drawing.Color.Black; + this.classicLabel3.Location = new System.Drawing.Point(335, 7); + this.classicLabel3.Name = "classicLabel3"; + this.classicLabel3.Size = new System.Drawing.Size(75, 13); + this.classicLabel3.TabIndex = 11; + this.classicLabel3.Text = "Password:"; + // + // classicLabel4 + // + this.classicLabel4.BackColor = System.Drawing.Color.Transparent; + this.classicLabel4.DropShadow = false; + this.classicLabel4.ForeColor = System.Drawing.Color.Black; + this.classicLabel4.Location = new System.Drawing.Point(503, 7); + this.classicLabel4.Name = "classicLabel4"; + this.classicLabel4.Size = new System.Drawing.Size(75, 13); + this.classicLabel4.TabIndex = 11; + this.classicLabel4.Text = "Port:"; + // // WinClassicFTPClient // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -257,7 +269,6 @@ private void InitializeComponent() this.Size = new System.Drawing.Size(762, 499); this.Load += new System.EventHandler(this.WinClassicFTPClient_Load); this.topBar.ResumeLayout(false); - this.topBar.PerformLayout(); this.panel1.ResumeLayout(false); this.ResumeLayout(false); @@ -266,21 +277,21 @@ private void InitializeComponent() #endregion private System.Windows.Forms.Panel topBar; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox textBox4; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox passBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox usernameBox; - private System.Windows.Forms.Label label1; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - public System.Windows.Forms.TextBox hostnameBox; - private System.Windows.Forms.Label infoLabel; private System.Windows.Forms.Panel panel1; private Engine.UI.ClassicButton btnCancel; private System.Windows.Forms.Label welcomeLabel; internal System.Windows.Forms.ListView ftpFiles; private System.Windows.Forms.ImageList fileIcons; private Engine.UI.ClassicButton btnLogin; + private Engine.UI.ClassicTextBox hostnameBox; + private Engine.UI.ClassicTextBox passBox; + private Engine.UI.ClassicTextBox usernameBox; + private Engine.UI.ClassicLabel infoLabel; + private Engine.UI.ClassicTextBox textBox4; + private Engine.UI.ClassicLabel classicLabel1; + private Engine.UI.ClassicLabel classicLabel3; + private Engine.UI.ClassicLabel classicLabel2; + private Engine.UI.ClassicLabel classicLabel4; } } diff --git a/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.cs b/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.cs index df531c3..d20563e 100644 --- a/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.cs +++ b/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.cs @@ -17,6 +17,10 @@ public partial class WinClassicFTPClient : UserControl public WinClassicFTPClient() { InitializeComponent(); + + hostnameBox.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((0))); + usernameBox.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((0))); + passBox.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((0))); } @@ -64,7 +68,7 @@ private void btnCancel_Click(object sender, EventArgs e) private void WinClassicFTPClient_Load(object sender, EventArgs e) { - + textBox4.Text = "21"; } private void topBar_Paint(object sender, PaintEventArgs e) diff --git a/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.resx b/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.resx index e03fcd1..067a121 100644 --- a/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.resx +++ b/Histacom2/OS/Win95/Win95Apps/WinClassicFTPClient.resx @@ -128,7 +128,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABe - EgAAAk1TRnQBSQFMAgEBAwEAAUABAAFAAQABIAEAASABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + EgAAAk1TRnQBSQFMAgEBAwEAAUgBAAFIAQABIAEAASABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABgAMAASADAAEBAQABCAYAARAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs index 5452184..f76bb99 100644 --- a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs +++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs @@ -383,7 +383,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.ListView contactsView; - private System.Windows.Forms.TreeView treeView1; + public System.Windows.Forms.TreeView treeView1; private System.Windows.Forms.ToolStripMenuItem toolbarToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem foldersToolStripMenuItem; private System.Windows.Forms.Panel toolbar; diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs index bf4f648..fd2bf0f 100644 --- a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs +++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs @@ -388,8 +388,11 @@ public void LoadDataAs() public void UpdateTreeView(AddressBookContactList lst, int count = 0) { try - { - string[] parts = lst.NodePath.Split('\\'); + { + string[] parts = new string[] { "Shared Contacts" }; + if (lst.NodePath != null) + parts = lst.NodePath.Split('\\'); + if (count == 0) UpdatePrevParent = treeView1.Nodes[0]; if (lst.NodePath != FindNodePath(treeView1.Nodes[0])) { diff --git a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs index f88d451..586c6c2 100644 --- a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs +++ b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs @@ -29,24 +29,25 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WinClassicWindowsExplorer)); this.program = new System.Windows.Forms.Panel(); this.mainView = new System.Windows.Forms.ListView(); this.pnlInfo = new System.Windows.Forms.Panel(); + this.txtInfoTitle = new Histacom2.Engine.UI.ClassicLabel(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.txtInfoTitle = new System.Windows.Forms.Label(); this.pnlInfoContent = new System.Windows.Forms.Panel(); this.InfoDesc = new System.Windows.Forms.Panel(); - this.txtInfoDescSize = new System.Windows.Forms.Label(); - this.txtInfoDescModified = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.txtInfoDescType = new System.Windows.Forms.Label(); - this.txtInfoDescName = new System.Windows.Forms.Label(); - this.txtInfoTip = new System.Windows.Forms.Label(); + this.classicLabel3 = new Histacom2.Engine.UI.ClassicLabel(); + this.txtInfoDescSize = new Histacom2.Engine.UI.ClassicLabel(); + this.txtInfoDescModified = new Histacom2.Engine.UI.ClassicLabel(); + this.txtInfoDescType = new Histacom2.Engine.UI.ClassicLabel(); + this.txtInfoDescName = new Histacom2.Engine.UI.ClassicLabel(); + this.txtInfoTip = new Histacom2.Engine.UI.ClassicLabel(); this.pnlFolders = new System.Windows.Forms.Panel(); this.diskView = new System.Windows.Forms.TreeView(); this.pnlFoldersTop = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); this.btnFolderClose = new System.Windows.Forms.PictureBox(); + this.classicLabel4 = new Histacom2.Engine.UI.ClassicLabel(); this.toprightcorner = new System.Windows.Forms.Panel(); this.bottomrightcorner = new System.Windows.Forms.Panel(); this.bottomleftcorner = new System.Windows.Forms.Panel(); @@ -127,8 +128,8 @@ private void InitializeComponent() this.pnlInfo.BackColor = System.Drawing.Color.White; this.pnlInfo.BackgroundImage = global::Histacom2.Properties.Resources.Win98WebBackground; this.pnlInfo.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.pnlInfo.Controls.Add(this.pictureBox1); this.pnlInfo.Controls.Add(this.txtInfoTitle); + this.pnlInfo.Controls.Add(this.pictureBox1); this.pnlInfo.Controls.Add(this.pnlInfoContent); this.pnlInfo.Dock = System.Windows.Forms.DockStyle.Left; this.pnlInfo.Location = new System.Drawing.Point(196, 24); @@ -136,28 +137,28 @@ private void InitializeComponent() this.pnlInfo.Size = new System.Drawing.Size(200, 439); this.pnlInfo.TabIndex = 19; // + // txtInfoTitle + // + this.txtInfoTitle.BackColor = System.Drawing.Color.Transparent; + this.txtInfoTitle.DropShadow = false; + this.txtInfoTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F); + this.txtInfoTitle.Location = new System.Drawing.Point(13, 56); + this.txtInfoTitle.Name = "txtInfoTitle"; + this.txtInfoTitle.Size = new System.Drawing.Size(194, 30); + this.txtInfoTitle.TabIndex = 23; + this.txtInfoTitle.Text = "FOLDER_NAME"; + // // pictureBox1 // this.pictureBox1.BackColor = System.Drawing.Color.Transparent; - this.pictureBox1.Image = global::Histacom2.Properties.Resources.WinClassicFolderSmall; + this.pictureBox1.Image = global::Histacom2.Properties.Resources.WinClassicFolder; this.pictureBox1.Location = new System.Drawing.Point(15, 18); this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(30, 30); + this.pictureBox1.Size = new System.Drawing.Size(32, 32); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 20; this.pictureBox1.TabStop = false; // - // txtInfoTitle - // - this.txtInfoTitle.AutoSize = true; - this.txtInfoTitle.BackColor = System.Drawing.Color.Transparent; - this.txtInfoTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtInfoTitle.Location = new System.Drawing.Point(3, 51); - this.txtInfoTitle.Name = "txtInfoTitle"; - this.txtInfoTitle.Size = new System.Drawing.Size(192, 29); - this.txtInfoTitle.TabIndex = 0; - this.txtInfoTitle.Text = "FOLDER_NAME"; - // // pnlInfoContent // this.pnlInfoContent.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -173,73 +174,72 @@ private void InitializeComponent() // // InfoDesc // + this.InfoDesc.Controls.Add(this.classicLabel3); this.InfoDesc.Controls.Add(this.txtInfoDescSize); this.InfoDesc.Controls.Add(this.txtInfoDescModified); - this.InfoDesc.Controls.Add(this.label5); this.InfoDesc.Controls.Add(this.txtInfoDescType); this.InfoDesc.Controls.Add(this.txtInfoDescName); this.InfoDesc.Dock = System.Windows.Forms.DockStyle.Top; - this.InfoDesc.Location = new System.Drawing.Point(0, 25); + this.InfoDesc.Location = new System.Drawing.Point(0, 26); this.InfoDesc.Name = "InfoDesc"; this.InfoDesc.Size = new System.Drawing.Size(199, 94); this.InfoDesc.TabIndex = 22; this.InfoDesc.Visible = false; // + // classicLabel3 + // + this.classicLabel3.DropShadow = false; + this.classicLabel3.Location = new System.Drawing.Point(13, 38); + this.classicLabel3.Name = "classicLabel3"; + this.classicLabel3.Size = new System.Drawing.Size(179, 13); + this.classicLabel3.TabIndex = 1; + this.classicLabel3.Text = "Last modified:"; + // // txtInfoDescSize // - this.txtInfoDescSize.AutoSize = true; - this.txtInfoDescSize.Location = new System.Drawing.Point(12, 81); + this.txtInfoDescSize.DropShadow = false; + this.txtInfoDescSize.Location = new System.Drawing.Point(15, 76); this.txtInfoDescSize.Name = "txtInfoDescSize"; - this.txtInfoDescSize.Size = new System.Drawing.Size(59, 13); - this.txtInfoDescSize.TabIndex = 0; + this.txtInfoDescSize.Size = new System.Drawing.Size(179, 13); + this.txtInfoDescSize.TabIndex = 1; this.txtInfoDescSize.Text = "FILE_SIZE"; // // txtInfoDescModified // - this.txtInfoDescModified.AutoSize = true; - this.txtInfoDescModified.Location = new System.Drawing.Point(12, 54); + this.txtInfoDescModified.DropShadow = false; + this.txtInfoDescModified.Location = new System.Drawing.Point(13, 57); this.txtInfoDescModified.Name = "txtInfoDescModified"; - this.txtInfoDescModified.Size = new System.Drawing.Size(92, 13); - this.txtInfoDescModified.TabIndex = 0; - this.txtInfoDescModified.Text = "LAST_MODIFIED"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(12, 41); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(73, 13); - this.label5.TabIndex = 0; - this.label5.Text = "Last Modified:"; + this.txtInfoDescModified.Size = new System.Drawing.Size(179, 13); + this.txtInfoDescModified.TabIndex = 1; + this.txtInfoDescModified.Text = "DATE_MODIFIED"; // // txtInfoDescType // - this.txtInfoDescType.AutoSize = true; - this.txtInfoDescType.Location = new System.Drawing.Point(12, 18); + this.txtInfoDescType.DropShadow = false; + this.txtInfoDescType.Location = new System.Drawing.Point(13, 19); this.txtInfoDescType.Name = "txtInfoDescType"; - this.txtInfoDescType.Size = new System.Drawing.Size(63, 13); - this.txtInfoDescType.TabIndex = 0; + this.txtInfoDescType.Size = new System.Drawing.Size(183, 13); + this.txtInfoDescType.TabIndex = 1; this.txtInfoDescType.Text = "FILE_TYPE"; // // txtInfoDescName // - this.txtInfoDescName.AutoSize = true; - this.txtInfoDescName.Location = new System.Drawing.Point(12, 5); + this.txtInfoDescName.DropShadow = false; + this.txtInfoDescName.Location = new System.Drawing.Point(13, 2); this.txtInfoDescName.Name = "txtInfoDescName"; - this.txtInfoDescName.Size = new System.Drawing.Size(66, 13); - this.txtInfoDescName.TabIndex = 0; + this.txtInfoDescName.Size = new System.Drawing.Size(179, 13); + this.txtInfoDescName.TabIndex = 1; this.txtInfoDescName.Text = "FILE_NAME"; // // txtInfoTip // - this.txtInfoTip.BackColor = System.Drawing.Color.Transparent; this.txtInfoTip.Dock = System.Windows.Forms.DockStyle.Top; + this.txtInfoTip.DropShadow = false; this.txtInfoTip.Location = new System.Drawing.Point(0, 0); this.txtInfoTip.Name = "txtInfoTip"; - this.txtInfoTip.Size = new System.Drawing.Size(199, 25); - this.txtInfoTip.TabIndex = 21; - this.txtInfoTip.Text = "Select an item to view its description."; - this.txtInfoTip.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.txtInfoTip.Size = new System.Drawing.Size(199, 26); + this.txtInfoTip.TabIndex = 23; + this.txtInfoTip.Text = "Please choose an item to view it\'s description."; // // pnlFolders // @@ -263,23 +263,14 @@ private void InitializeComponent() // pnlFoldersTop // this.pnlFoldersTop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200))))); - this.pnlFoldersTop.Controls.Add(this.label2); this.pnlFoldersTop.Controls.Add(this.btnFolderClose); + this.pnlFoldersTop.Controls.Add(this.classicLabel4); this.pnlFoldersTop.Dock = System.Windows.Forms.DockStyle.Top; this.pnlFoldersTop.Location = new System.Drawing.Point(0, 0); this.pnlFoldersTop.Name = "pnlFoldersTop"; this.pnlFoldersTop.Size = new System.Drawing.Size(196, 22); this.pnlFoldersTop.TabIndex = 20; // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(3, 3); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(41, 13); - this.label2.TabIndex = 1; - this.label2.Text = "Folders"; - // // btnFolderClose // this.btnFolderClose.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(208)))), ((int)(((byte)(200))))); @@ -294,6 +285,15 @@ private void InitializeComponent() this.btnFolderClose.MouseEnter += new System.EventHandler(this.pictureBox1_MouseEnter); this.btnFolderClose.MouseLeave += new System.EventHandler(this.btnFolderClose_MouseLeave); // + // classicLabel4 + // + this.classicLabel4.DropShadow = false; + this.classicLabel4.Location = new System.Drawing.Point(3, 5); + this.classicLabel4.Name = "classicLabel4"; + this.classicLabel4.Size = new System.Drawing.Size(179, 13); + this.classicLabel4.TabIndex = 1; + this.classicLabel4.Text = "Folders"; + // // toprightcorner // this.toprightcorner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -365,6 +365,7 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.cmbType.BackColor = System.Drawing.Color.White; this.cmbType.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.cmbType.Items = ((System.Collections.Generic.List)(resources.GetObject("cmbType.Items"))); this.cmbType.Location = new System.Drawing.Point(64, 32); this.cmbType.Name = "cmbType"; this.cmbType.Size = new System.Drawing.Size(549, 20); @@ -596,14 +597,11 @@ private void InitializeComponent() this.program.ResumeLayout(false); this.program.PerformLayout(); this.pnlInfo.ResumeLayout(false); - this.pnlInfo.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.pnlInfoContent.ResumeLayout(false); this.InfoDesc.ResumeLayout(false); - this.InfoDesc.PerformLayout(); this.pnlFolders.ResumeLayout(false); this.pnlFoldersTop.ResumeLayout(false); - this.pnlFoldersTop.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.btnFolderClose)).EndInit(); this.pnlSave.ResumeLayout(false); this.MenuStrip1.ResumeLayout(false); @@ -646,17 +644,9 @@ private void InitializeComponent() private System.Windows.Forms.Panel pnlFolders; private System.Windows.Forms.Panel pnlFoldersTop; private System.Windows.Forms.PictureBox btnFolderClose; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label txtInfoTitle; private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.Label txtInfoTip; private System.Windows.Forms.Panel pnlInfoContent; private System.Windows.Forms.Panel InfoDesc; - private System.Windows.Forms.Label txtInfoDescModified; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label txtInfoDescType; - private System.Windows.Forms.Label txtInfoDescName; - private System.Windows.Forms.Label txtInfoDescSize; private System.Windows.Forms.Timer refresh; private Engine.UI.ClassicButton btnCanc; private Engine.UI.ClassicDropDown cmbType; @@ -664,5 +654,13 @@ private void InitializeComponent() private Engine.UI.ClassicLabel classicLabel2; private Engine.UI.ClassicLabel classicLabel1; private Engine.UI.ClassicButton btnSave; + private Engine.UI.ClassicLabel txtInfoTitle; + private Engine.UI.ClassicLabel txtInfoTip; + private Engine.UI.ClassicLabel txtInfoDescName; + private Engine.UI.ClassicLabel txtInfoDescType; + private Engine.UI.ClassicLabel classicLabel3; + private Engine.UI.ClassicLabel txtInfoDescModified; + private Engine.UI.ClassicLabel txtInfoDescSize; + private Engine.UI.ClassicLabel classicLabel4; } } diff --git a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs index 947f9ba..bc121e6 100644 --- a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs +++ b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs @@ -38,11 +38,6 @@ public WinClassicWindowsExplorer() void WinClassicWindowsExplorer_Load(object sender, EventArgs e) { - if (SaveSystem.CurrentSave.CurrentOS == "2000") - { - pnlInfo.Width = 200; - txtInfoTitle.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((0))); - } diskView.ImageList = new ImageList(); @@ -82,7 +77,7 @@ void WinClassicWindowsExplorer_Load(object sender, EventArgs e) Properties.Resources.WinClassicGTN, Properties.Resources.WinClassicFTP, Properties.Resources.WinClassicRtfFile, // 20 - Properties.Resources.WinClassicAddressBook}); + Properties.Resources.WinClassicAddressBookBig}); program.BringToFront(); @@ -122,6 +117,9 @@ void WinClassicWindowsExplorer_Load(object sender, EventArgs e) cmbType.Items.Add(str); cmbType.Text = onlyViewExtension.FirstOrDefault(); + + txtSave.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); + cmbType.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); } //'Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) @@ -168,10 +166,10 @@ void RefreshAll() { pictureBox1.Image = Properties.Resources.Win95ComputerIcon; } else if (CurrentDirectory == ProfileMyComputerDirectory) { txtInfoTitle.Text = "C:"; - pictureBox1.Image = Properties.Resources.WinClassicFolderSmall; // TODO: ADD DRIVE ICON + pictureBox1.Image = Properties.Resources.WinClassicDrive; } else { txtInfoTitle.Text = Path.GetFileName(CurrentDirectory); - pictureBox1.Image = Properties.Resources.WinClassicFolderSmall; + pictureBox1.Image = Properties.Resources.WinClassicFolder; } @@ -283,6 +281,19 @@ public void OpenFile(string fileDir) case 12: OpenApplication(FileDialogBoxManager.ReadTextFile(fileDir), fileDir); break; + case 13: + WinClassicAddressBook wcab = new WinClassicAddressBook(); + wcab.AddressBookObjects = JsonConvert.DeserializeObject>(File.ReadAllText(fileDir)); + + wcab.treeView1.Nodes.Clear(); + wcab.treeView1.Nodes.Add("Shared Contacts"); + foreach (AddressBookContactList lst in wcab.AddressBookObjects) + wcab.UpdateTreeView(lst); + + WinClassic app3 = wm.Init(wcab, "Address Book", Properties.Resources.WinClassicAddressBook, true, true); + + Program.AddTaskbarItem(app3, app3.Tag.ToString(), "Address Book", Properties.Resources.WinClassicAddressBook); + break; } } catch @@ -407,9 +418,10 @@ int ReturnType(string extension) case ".bmp": case ".zip": return 11; - case ".exe": return 12; + case ".wab": + return 13; case ".avi": case ".m4v": case ".mp4": @@ -820,6 +832,8 @@ public string GetDescription(int type) return "Image File"; case 12: return "Executable File"; + case 13: + return "Address Book File"; case 21: return "Video File"; case 16: diff --git a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.resx b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.resx index e1edd06..3b47ace 100644 --- a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.resx +++ b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.resx @@ -120,6 +120,15 @@ 17, 17 + + + AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u + ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u + PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB + AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0 + ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs= + + 132, 17 diff --git a/Histacom2/Properties/Resources.resx b/Histacom2/Properties/Resources.resx index c34dd0c..605ba09 100644 --- a/Histacom2/Properties/Resources.resx +++ b/Histacom2/Properties/Resources.resx @@ -2123,4 +2123,10 @@ ..\Resources\distort fail.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\WinClassicAddressBookBig.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\WinClassicDrive.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Histacom2/Properties/Resources1.Designer.cs b/Histacom2/Properties/Resources1.Designer.cs index a053ed4..69aefb6 100644 --- a/Histacom2/Properties/Resources1.Designer.cs +++ b/Histacom2/Properties/Resources1.Designer.cs @@ -19,7 +19,7 @@ namespace Histacom2.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { @@ -976,7 +976,9 @@ public static System.IO.UnmanagedMemoryStream std_gobeep { /// "btn4txt": "", /// "btn4tag": "", /// "btn5txt": "", - /// "btn5tag": " [rest of string was truncated]";. + /// "btn5tag": "" + /// }, + /// "inthe [rest of string was truncated]";. /// public static string std_story { get { @@ -1613,6 +1615,16 @@ public static System.Drawing.Bitmap WinClassicAddressBook { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap WinClassicAddressBookBig { + get { + object obj = ResourceManager.GetObject("WinClassicAddressBookBig", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1703,6 +1715,16 @@ public static System.Drawing.Bitmap WinClassicDocuments { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap WinClassicDrive { + get { + object obj = ResourceManager.GetObject("WinClassicDrive", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/Histacom2/Resources/WinClassicAddressBookBig.png b/Histacom2/Resources/WinClassicAddressBookBig.png new file mode 100644 index 0000000000000000000000000000000000000000..ceee626649d509eb5b812f60d646dc6b03338dba GIT binary patch literal 2146 zcmV-o2%YzdP)#iW;sN(`ws2hq3f?x$?Q3xOi2ni(rdEZN$GZFmYnd7(q&v_0>xc7N~&+y%|Yx>jyHPxDYr`4V4YU09c`C|?wukIpyi(vaILT$sJ;yxTZoQJ zJIg9kH&j{7}=0m(_MG1*ZMW@M!D8HTRZ$I=OOrWMs#tDOq&!svpjwsS~hT zIqP5PY7S!UoalNFUuBv|stFGZ3md`h3Mv$QEqr!RhmbNC%+Ec7SLsD<1(3ZJSQUlh zuje7FtP5A405xsEa})W$xfi0V8}_>SFJKo7oc#h$9_;Dy{)(9jMX0+@r+e473uqZu z-V#A}HWbDVpvM9f)dR&1Km+;SZTTO6MUBYJuSe2JBhFO;-#-S7FMwuZb#3%s4#p;~ zDR;0OL}J{;YWMN-e*}nCDveO{5iKVN@c6`{Eyd|_e7^BxoGPYwQzx7=PUfE8&j)fF zk@fF;n4VJ1*__>V$g2f%DuMcTpt=<(ZvreYmm_Z-uq_a{kO)V2*$EFHMXX4q7#HK~ z`wj3Z4Sz9|0|$ zuc{xR+9Kj0rs+b;#(B&B&KIx@(GU(mOr})Z$$8~HKfViUB@LbE?CveWbFRT{0R3j+ z6oGhRgX~{d3l~6mZ47X3F~+(|54(G@Qv?FWi36Zp?EayJiL@7tg&(5iTL-SLtzAG9 z`CIXs?5K-n{{8HxJe5iOP`4xnJWKUj&P(AiVE!pDaV{2AcwO@H~5 z7X`SItjE-}QrtE6Hr3gkT4_t5KXW~V>b={bmFiBWB1 zU1fV+yqVu}0Ceo?mHNR=N9W`)$H4*2x(qyM2J)(b8@0swbD-VKf!HG4b>4^-8BI9! z0LXp_6g(lYCb}bRjccch=G!P)$_KuiiqS68TsLoKzU^T|_hnh;^2JqagFzvv-K-~z z*I976!i0(zE9yIFNocD3_QI)01hxja*U%ezEd@5gUUbT?@j>gpSnH^9l2Vd^R2u-D zOhG}qQM3$Su06#8?8S10njqUXfz+zpZF@PXSpZN%+nw>%ZUF}0Y{6v zkXhP=D>Xf20V_&KHmaV3tNpU=MYb#)D+R7U0nL} zWOtlBn2mM^5;_=ee7ATC_C%s#fd{_HD8rElR+?T8B&XU+vS7j0CJXKoh=21M>hU7ep37XS$gx8 z#W9vAu|iaZx}hcX*FfYbVB!cEbR=pgv6)2ujBK?MviJ#4ANh)a0C}WLrt+dsK@z0x zaM~XLHyMeIl*u#_VW4`tK&V>D_g8Ln_ht|B+@z-oOunN#Q|#lftd7=dn^UGu=uDXw zX%dQqUkq~+w~hQ*QpLAR)UN^X^83O-3PkHi50!eoe(*#R8RN%{ zVOfn!xLoZY!iF%Pkg`R{H69UUJJaz_8|_WJnsHFnIgO5HiJtfMq40&OZrK%#Sz37CKZ+*4682+KFTIp>;EYVP~qj4{IQ zbldi73LH;C!F27k0KyS`7>+Z7e@jp>`Ot#i`%r=N>Bl#KKsa1r#wT}e0~6p43>Tn> oW{Lv+zu*G<;ec+eP%wAn4H}?ymTn4`pa1{>07*qoM6N<$f?h{qSO5S3 literal 0 HcmV?d00001 diff --git a/Histacom2/Resources/addrbook.ico_32x32[1].png b/Histacom2/Resources/addrbook.ico_32x32[1].png new file mode 100644 index 0000000000000000000000000000000000000000..ceee626649d509eb5b812f60d646dc6b03338dba GIT binary patch literal 2146 zcmV-o2%YzdP)#iW;sN(`ws2hq3f?x$?Q3xOi2ni(rdEZN$GZFmYnd7(q&v_0>xc7N~&+y%|Yx>jyHPxDYr`4V4YU09c`C|?wukIpyi(vaILT$sJ;yxTZoQJ zJIg9kH&j{7}=0m(_MG1*ZMW@M!D8HTRZ$I=OOrWMs#tDOq&!svpjwsS~hT zIqP5PY7S!UoalNFUuBv|stFGZ3md`h3Mv$QEqr!RhmbNC%+Ec7SLsD<1(3ZJSQUlh zuje7FtP5A405xsEa})W$xfi0V8}_>SFJKo7oc#h$9_;Dy{)(9jMX0+@r+e473uqZu z-V#A}HWbDVpvM9f)dR&1Km+;SZTTO6MUBYJuSe2JBhFO;-#-S7FMwuZb#3%s4#p;~ zDR;0OL}J{;YWMN-e*}nCDveO{5iKVN@c6`{Eyd|_e7^BxoGPYwQzx7=PUfE8&j)fF zk@fF;n4VJ1*__>V$g2f%DuMcTpt=<(ZvreYmm_Z-uq_a{kO)V2*$EFHMXX4q7#HK~ z`wj3Z4Sz9|0|$ zuc{xR+9Kj0rs+b;#(B&B&KIx@(GU(mOr})Z$$8~HKfViUB@LbE?CveWbFRT{0R3j+ z6oGhRgX~{d3l~6mZ47X3F~+(|54(G@Qv?FWi36Zp?EayJiL@7tg&(5iTL-SLtzAG9 z`CIXs?5K-n{{8HxJe5iOP`4xnJWKUj&P(AiVE!pDaV{2AcwO@H~5 z7X`SItjE-}QrtE6Hr3gkT4_t5KXW~V>b={bmFiBWB1 zU1fV+yqVu}0Ceo?mHNR=N9W`)$H4*2x(qyM2J)(b8@0swbD-VKf!HG4b>4^-8BI9! z0LXp_6g(lYCb}bRjccch=G!P)$_KuiiqS68TsLoKzU^T|_hnh;^2JqagFzvv-K-~z z*I976!i0(zE9yIFNocD3_QI)01hxja*U%ezEd@5gUUbT?@j>gpSnH^9l2Vd^R2u-D zOhG}qQM3$Su06#8?8S10njqUXfz+zpZF@PXSpZN%+nw>%ZUF}0Y{6v zkXhP=D>Xf20V_&KHmaV3tNpU=MYb#)D+R7U0nL} zWOtlBn2mM^5;_=ee7ATC_C%s#fd{_HD8rElR+?T8B&XU+vS7j0CJXKoh=21M>hU7ep37XS$gx8 z#W9vAu|iaZx}hcX*FfYbVB!cEbR=pgv6)2ujBK?MviJ#4ANh)a0C}WLrt+dsK@z0x zaM~XLHyMeIl*u#_VW4`tK&V>D_g8Ln_ht|B+@z-oOunN#Q|#lftd7=dn^UGu=uDXw zX%dQqUkq~+w~hQ*QpLAR)UN^X^83O-3PkHi50!eoe(*#R8RN%{ zVOfn!xLoZY!iF%Pkg`R{H69UUJJaz_8|_WJnsHFnIgO5HiJtfMq Date: Sun, 5 Nov 2017 14:12:33 +0000 Subject: [PATCH 11/11] Fixed icon --- Histacom2/Histacom2.csproj | 2 +- .../Resources/WinClassicAddressBookBig.png | Bin 2146 -> 288 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Histacom2/Histacom2.csproj b/Histacom2/Histacom2.csproj index a313c6b..bed73b9 100644 --- a/Histacom2/Histacom2.csproj +++ b/Histacom2/Histacom2.csproj @@ -879,8 +879,8 @@ - + diff --git a/Histacom2/Resources/WinClassicAddressBookBig.png b/Histacom2/Resources/WinClassicAddressBookBig.png index ceee626649d509eb5b812f60d646dc6b03338dba..c181754345c80e927b02856353f7138eca3cdc7e 100644 GIT binary patch delta 261 zcmV+g0s8*p5TF8(BYyzrNklq zHgtRSQ<7A!oXTNFv5Ob7F#Y^Y`@S~-OG{Bbh}i>xIyWFmZO9-W7`xB_pfr1cI#ll) z0N70dj6wl``Gg7p(*fYn5kP$n=PQW0gqf=VK)DJC;42`&pMF*#9bQ#IGXN%3Fb#ke zII)6-0GkwEb1yhbkP`obxd8cl!TbsclLdgE{0P$k{o@$`>iaVr02~H8fcWsrfcdI` z2hkp2Ai@Ly54AZ2@YL>7KE49ZfQb#iW;sN(`ws2hq3f?x$?Q3xOi2ni(r zdEZN$GZFmYnd7(q&v_0>xc7N~&+8S(SY`~UD+{yP2Gm>BtcBvtRwbm29C%zJ(( zvSu&J!Px|$$A1J)P4|JUDB#j`MC!B$g@M5{gMz~NQBhIv+xf*_HLy7VNEM@Xd-R3s zjg$U%dWlY~W0)a?_E(fR$-!Y@e=sc@CJeLgj9$e>U49XLlo`!I>`#t2dip81O4wkX zR;wLtmxb<~A`YPCpA&GcupFqq4IEpDj!QesDpKRtWPi<#km?v+9~kR5`bn1MGH{D` zccEWZ5~#yrz}Y_{KpdRoCkmR&s>6LqhTpRVgv-k|-ajJ1jAMNKP}7N*)pjferv1zC zXzRi?_m+G*xpH}AWXGl{S#tE?=4r1+`=z0%dWtvE;2@eYk8^P@g zDinMze1CROhmbNC%+Ec7SLsD<1(3ZJSQUlhuje7FtP5A405xsEa})W$xfi0V8}_>S zFJKo7oc#h$9_;Dy{)(9jMX0+@r+e473uqZu-V#A}HWbDVpvM9f)dR&1Km+;SZTTO6 zMUBYJuSe2JBhFO;-#-S7FMwuZb#3%s4#p;~DSvmc97JN=#A^5P@_z(~RVs~8^ARm4 z2k`jBqAkVga(uq=W1K3ccT*>vGfw87-p>be8uPcA&Zy zC~pERFP9^49k4ABxR3}(ci9OKA4RN4q!<_D>-!D|aA?yUh613$0fpBLG-3{*hBz!W za(~WkSumL`xL*1kE7O0(uG=P@EC&jn0_PtAEuF8bAEDYJ;vlB!LdwQ@%l^(6unf@< z4nRz%RNKjUUsnqkKzMBoaBeZix=Ihb zd$Cgl0>+60pj+(zp@oUG7mS4;qU2i#u79qrT|g80Tk))K7VbQ1=Kv0s0Xa25*)y&g ziTd9WEtVz@pkTW{Sc#(0*;Bg0$A=C48Q|?rfBBOa1-O!|$JDe^+%@(#)#KJ)5K|AW zt$h|~^b}&>MI#F8>5icH(Cchwr$5)}If!G4QEg*gWqVz`ncs2%bnNPt`oT>{=YQld z$H4*2x(qyM2J)(b8@0swbD-VKf!HG4b>4^-8BI9!0LXp_6g(lYCb}bRjccch=G!P) z$_KuiiqS68TsLoKzU^T|_hnh;^2JqagFzvv-K-~z*I976!i0(zE9yIFNocD3_QI)0 z1hxja*U%ezEd@5gUUbT?@j>gpSbyuNagtJ!fm9m+olHSNx>2+YU#>mH0qn|eLw+5B zcxpvXl^MCUW)!ycpt{3q1DTmtfpwSKv9B1oOaY8QQ7?qO8Y_X7eB4Q!0f9K!Ji=L0 z#dDYLu>sIB#Aq}h)}Qz)t7o|<&dk#wHOq+qQ~^hex{z7gg)22ZWC1HmNPjk}o`b9X zvh78-EF3EZu0H|Ilzk&+uLlx6vBvNzhVmrc!<{89qg`ZooIRM0b_WtV7;b#GcnbDJ zqG5ptzR4)Vkq1_qUJfLu+Dfuu!PO=U?h=TH&w%@tEtrv7fz&H6aI_rAs{;qu*#n@} z2&@VRQlwC_!ImLBao0#^Nq++wMz>tN*xjDKY@9uSgTq^LdBpI}BeR}jp$qn`OU8z? zt=L~|!SQm~KyquqJqK>p_szoj$H2Wtpf&F_5XVE>7kW5*%6mTIiQ9YAF1zUEBj4aF zP)wCdmA-ZWL<6G4QSayPO_)!60ZToRy?F-c=dZhu!#=BT5a^qeDE(8-Ot%X4E2Ts)XeukmbhfS+oRH|Xr-|M~? z3`j~!8c0vcv0Cj11cancGg2y5JBKJkeAV($1tV5#{ruR;d_Q@-zrSj!$X}5n@>i}F z3Y4GA0)vCp