diff options
| author | AShifter <[email protected]> | 2017-08-29 12:34:00 -0600 |
|---|---|---|
| committer | AShifter <[email protected]> | 2017-08-29 12:34:00 -0600 |
| commit | b1689dea36e46933280bfcc0d186746dd6210c0f (patch) | |
| tree | 3644ac63218378082e0afa90d4c42d73d6d3980c /Histacom2.Engine | |
| parent | f8e657ddbaf3654f102676a0b51e424c005218c3 (diff) | |
| parent | d4d94f85a6424e4d21cecccec21b0e78860431d6 (diff) | |
| download | histacom2-b1689dea36e46933280bfcc0d186746dd6210c0f.tar.gz histacom2-b1689dea36e46933280bfcc0d186746dd6210c0f.tar.bz2 histacom2-b1689dea36e46933280bfcc0d186746dd6210c0f.zip | |
Merge remote-tracking branch 'refs/remotes/Histacom2-Devs/master'
Diffstat (limited to 'Histacom2.Engine')
| -rw-r--r-- | Histacom2.Engine/FileDialogBoxManager.cs | 15 | ||||
| -rw-r--r-- | Histacom2.Engine/Histacom2.Engine.csproj | 10 | ||||
| -rw-r--r-- | Histacom2.Engine/SaveSystem.cs | 161 | ||||
| -rw-r--r-- | Histacom2.Engine/Template/ResizeOverlay.Designer.cs | 78 | ||||
| -rw-r--r-- | Histacom2.Engine/Template/ResizeOverlay.cs | 35 | ||||
| -rw-r--r-- | Histacom2.Engine/Template/ResizeOverlay.resx | 123 | ||||
| -rw-r--r-- | Histacom2.Engine/Template/WinClassic.Designer.cs | 10 | ||||
| -rw-r--r-- | Histacom2.Engine/Template/WinClassic.cs | 115 | ||||
| -rw-r--r-- | Histacom2.Engine/Template/WinClassic.resx | 48 | ||||
| -rw-r--r-- | Histacom2.Engine/UI/ClassicButton.resx | 3 |
10 files changed, 502 insertions, 96 deletions
diff --git a/Histacom2.Engine/FileDialogBoxManager.cs b/Histacom2.Engine/FileDialogBoxManager.cs index a862bc7..161c393 100644 --- a/Histacom2.Engine/FileDialogBoxManager.cs +++ b/Histacom2.Engine/FileDialogBoxManager.cs @@ -13,6 +13,7 @@ namespace Histacom2.Engine public static bool IsInOpenDialog = false; public static bool IsInSaveDialog = false; public static string OnlyViewExtension = ""; + public static void ActivateOpenFileDialog(string ExtensionToView) { IsInOpenDialog = true; @@ -36,5 +37,19 @@ namespace Histacom2.Engine return ""; } } + + public static void SaveRtfDocument(RichTextBox tbox, string path) + { + int fileBytes = 0; + tbox.SaveFile(path); + fileBytes = File.ReadAllText(path).Length; + + THFileInfo info = new THFileInfo(); + info.Name = Path.GetFileName(path); + info.FileIcon = 20; + info.ByteSize = fileBytes; + SaveSystem.CurrentSave.BytesLeft -= fileBytes; + SaveSystem.UpdateDirectoryInfo(new FileInfo(path).Directory.FullName, info); + } } } diff --git a/Histacom2.Engine/Histacom2.Engine.csproj b/Histacom2.Engine/Histacom2.Engine.csproj index beb4aa2..361672e 100644 --- a/Histacom2.Engine/Histacom2.Engine.csproj +++ b/Histacom2.Engine/Histacom2.Engine.csproj @@ -20,6 +20,7 @@ <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <PlatformTarget>x86</PlatformTarget> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> @@ -53,6 +54,12 @@ <Compile Include="Paintbrush.cs" /> <Compile Include="SaveSystem.cs" /> <Compile Include="TaskBarController.cs" /> + <Compile Include="Template\ResizeOverlay.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Template\ResizeOverlay.Designer.cs"> + <DependentUpon>ResizeOverlay.cs</DependentUpon> + </Compile> <Compile Include="Template\Win9XBSOD.cs"> <SubType>Form</SubType> </Compile> @@ -101,6 +108,9 @@ <Generator>PublicResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> + <EmbeddedResource Include="Template\ResizeOverlay.resx"> + <DependentUpon>ResizeOverlay.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="Template\Win9XBSOD.resx"> <DependentUpon>Win9XBSOD.cs</DependentUpon> </EmbeddedResource> diff --git a/Histacom2.Engine/SaveSystem.cs b/Histacom2.Engine/SaveSystem.cs index ef98c10..b8c619e 100644 --- a/Histacom2.Engine/SaveSystem.cs +++ b/Histacom2.Engine/SaveSystem.cs @@ -28,6 +28,13 @@ namespace Histacom2.Engine public static Theme currentTheme { get; set; } + public static bool IsBinarySave = +#if BINARY_SAVE + true; +#else + false; +#endif + #if BINARY_SAVE private static readonly byte[] magic = Encoding.UTF8.GetBytes("THSv"); private static readonly IOrderedEnumerable<System.Reflection.PropertyInfo> properties = typeof(Save).GetProperties().OrderBy(p => (p.GetCustomAttributes(typeof(OrderAttribute), false).SingleOrDefault() as OrderAttribute).Order); @@ -207,10 +214,58 @@ namespace Histacom2.Engine public static void UpdateDirectoryInfo(string path, THFileInfo newfile) { - newfile.DOSName = newfile.Name.ToUpper().Replace("*", "").Replace("+", "").Replace(":", "").Replace(";", "").Replace(" ", ""); - if (newfile.DOSName.Contains(".")) + SetDOSName(ref newfile); + + if (File.ReadAllText(Path.Combine(path, "_data.info")).Contains(newfile.DOSName)) return; + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info"))); + fsfi.Files.Add(newfile); + fsfi.ByteSize += newfile.ByteSize; + + string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented); + + File.WriteAllText(Path.Combine(path, "_data.info"), toWrite); + } + + public static void RemoveFileFromDirectory(string path, string filename) + { + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info"))); + THFileInfo fi = fsfi.Files.Find((THFileInfo f) => { return f.Name == filename; }); + if (fi == null) return; + + fsfi.ByteSize -= fi.ByteSize; + CurrentSave.BytesLeft += fi.ByteSize; + + fsfi.Files.Remove(fi); + string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented); + + File.WriteAllText(Path.Combine(path, "_data.info"), toWrite); + } + + public static void RemoveSubDirFromDirectory(string path, string dirname) + { + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info"))); + THDirInfo di = fsfi.SubDirs.Find((THDirInfo f) => { return f.Name == dirname; }); + if (di == null) return; + + // Find the bytesize of the folder + + FileSystemFolderInfo dirfsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info"))); + + fsfi.ByteSize -= dirfsfi.ByteSize; + CurrentSave.BytesLeft += dirfsfi.ByteSize; + + fsfi.SubDirs.Remove(di); + string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented); + + File.WriteAllText(Path.Combine(path, "_data.info"), toWrite); + } + + public static string SetDOSName(ref THFileInfo file) + { + file.DOSName = file.Name.ToUpper().Replace("*", "").Replace("+", "").Replace(":", "").Replace(";", "").Replace(" ", ""); + if (file.DOSName.Contains(".")) { - string[] dos = newfile.DOSName.Split('.'); + string[] dos = file.DOSName.Split('.'); if (dos.Count() > 2) { @@ -221,54 +276,79 @@ namespace Histacom2.Engine dos[1] = dos[1].Substring(0, 3); if (dos[0].Length > 8) dos[0] = dos[0].Substring(0, 6) + "~1"; - newfile.DOSName = dos[0] + "." + dos[1]; + file.DOSName = dos[0] + "." + dos[1]; } - else if (newfile.DOSName.Length > 8) newfile.DOSName = newfile.DOSName.Substring(0, 6) + "~1"; + else if (file.DOSName.Length > 8) file.DOSName = file.DOSName.Substring(0, 6) + "~1"; + return file.DOSName; + } - if (File.ReadAllText(Path.Combine(path, "_data.info")).Contains(newfile.DOSName)) return; + public static void RenameDirectory(string path, string dirname, string newname) + { FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info"))); - fsfi.Files.Add(newfile); - fsfi.ByteSize += newfile.ByteSize; + THDirInfo di = fsfi.SubDirs.Find((THDirInfo f) => { return f.Name == dirname; }); + if (di == null) return; + + THDirInfo newDi = di; + + newDi.Name = newname; + THFileInfo tmpfi = new THFileInfo(); + newDi.DOSName = SetDOSName(ref tmpfi); + fsfi.SubDirs.Remove(di); + fsfi.SubDirs.Add(newDi); string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented); File.WriteAllText(Path.Combine(path, "_data.info"), toWrite); } - public static void UpgradeFileSystem(string oldOS, string newOS) + public static void RenameFile(string path, string filename, string newname) { - switch (oldOS) + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(path, "_data.info"))); + THFileInfo fi = fsfi.Files.Find((THFileInfo f) => { return f.Name == filename; }); + if (fi == null) return; + + THFileInfo newFi = fi; + + newFi.Name = newname; + + THFileInfo tmpfi = new THFileInfo(); + newFi.DOSName = SetDOSName(ref tmpfi); + fsfi.Files.Remove(fi); + fsfi.Files.Add(newFi); + string toWrite = JsonConvert.SerializeObject(fsfi, Formatting.Indented); + + File.WriteAllText(Path.Combine(path, "_data.info"), toWrite); + } + + public static void UpgradeFileSystem(string newOS) + { + if (newOS == "98" || newOS == "2000" || newOS == "ME") { - case "95": - if (newOS == "98" || newOS == "2000" || newOS == "ME") - { - // We are upgrading from the old WinClassic file System to the new WinClassic filesystem! - // All the above OSes share basically the same file layout! - // (Excluding Documents And Settings) which is 2000 and ME only + // We are upgrading from the old WinClassic file System to the new WinClassic filesystem! + // All the above OSes share basically the same file layout! + // (Excluding Documents And Settings) which is 2000 and ME only - // Add Address Book into existance! + // Add Address Book into existance! - SaveDirectoryInfo(ProfileProgramsDirectory, "Outlook Express", false, "Outlook Express", true); - CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Outlook Express"), "WAB.exe", "addressbook", 8, 512); + SaveDirectoryInfo(ProfileProgramsDirectory, "Outlook Express", false, "Outlook Express", true); + CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Outlook Express"), "WAB.exe", "addressbook", 8, 512); - // There is no "The Microsoft Network" folder! + // There is no "The Microsoft Network" folder! - if (Directory.Exists(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network"))) Directory.Delete(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network"), true); - FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(ProfileProgramsDirectory, "_data.info"))); - foreach (THDirInfo dir in fsfi.SubDirs) - { - if (dir.Name == "The Microsoft Network") - { - fsfi.SubDirs.Remove(dir); - break; - } - } + if (Directory.Exists(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network"))) Directory.Delete(Path.Combine(ProfileProgramsDirectory, "The Microsoft Network"), true); + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(ProfileProgramsDirectory, "_data.info"))); + foreach (THDirInfo dir in fsfi.SubDirs) + { + if (dir.Name == "The Microsoft Network") + { + fsfi.SubDirs.Remove(dir); + break; } - break; + } } } - public static void SaveDirectoryInfo(string parent, string dirname, bool isProtected, string label, bool allowback) + public static void SaveDirectoryInfo(string parent, string dirname, bool isProtected, string label, bool allowback, bool updateParent = true) { if (File.Exists(Path.Combine(parent, dirname, "_data.info")) && Path.Combine(parent, dirname) != ProfileFileSystemDirectory) return; Directory.CreateDirectory(Path.Combine(parent, dirname)); @@ -286,15 +366,18 @@ namespace Histacom2.Engine info.SubDirs = new List<THDirInfo>(256); info.ByteSize = 0; - if (parent != ProfileDirectory) + if (updateParent == true) { - FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(parent, "_data.info"))); - THDirInfo thd = new THDirInfo(); - thd.Name = info.Label; - thd.DOSName = info.DOSLabel; - fsfi.SubDirs.Add(thd); + if ((parent != ProfileDirectory)) + { + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(parent, "_data.info"))); + THDirInfo thd = new THDirInfo(); + thd.Name = info.Label; + thd.DOSName = info.DOSLabel; + fsfi.SubDirs.Add(thd); - File.WriteAllText(Path.Combine(parent, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented)); + File.WriteAllText(Path.Combine(parent, "_data.info"), JsonConvert.SerializeObject(fsfi, Formatting.Indented)); + } } string toWrite = JsonConvert.SerializeObject(info, Formatting.Indented); diff --git a/Histacom2.Engine/Template/ResizeOverlay.Designer.cs b/Histacom2.Engine/Template/ResizeOverlay.Designer.cs new file mode 100644 index 0000000..8d76c26 --- /dev/null +++ b/Histacom2.Engine/Template/ResizeOverlay.Designer.cs @@ -0,0 +1,78 @@ +namespace Histacom2.Engine.Template +{ + partial class ResizeOverlay + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.outline = new System.Windows.Forms.PictureBox(); + this.tmrMove = new System.Windows.Forms.Timer(this.components); + ((System.ComponentModel.ISupportInitialize)(this.outline)).BeginInit(); + this.SuspendLayout(); + // + // outline + // + this.outline.BackColor = System.Drawing.Color.Transparent; + this.outline.Location = new System.Drawing.Point(194, 158); + this.outline.Name = "outline"; + this.outline.Size = new System.Drawing.Size(300, 158); + this.outline.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.outline.TabIndex = 0; + this.outline.TabStop = false; + this.outline.Paint += new System.Windows.Forms.PaintEventHandler(this.outline_Paint); + // + // tmrMove + // + this.tmrMove.Interval = 20; + this.tmrMove.Tick += new System.EventHandler(this.tmrMove_Tick); + // + // ResizeOverlay + // + 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(800, 600); + this.Controls.Add(this.outline); + this.DoubleBuffered = true; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "ResizeOverlay"; + this.Tag = "ignoreFormOnTaskbar"; + this.Text = "ResizeOverlay"; + 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; + ((System.ComponentModel.ISupportInitialize)(this.outline)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox outline; + public System.Windows.Forms.Timer tmrMove; + } +}
\ No newline at end of file diff --git a/Histacom2.Engine/Template/ResizeOverlay.cs b/Histacom2.Engine/Template/ResizeOverlay.cs new file mode 100644 index 0000000..ca8a5e4 --- /dev/null +++ b/Histacom2.Engine/Template/ResizeOverlay.cs @@ -0,0 +1,35 @@ +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 ResizeOverlay : Form + { + public Rectangle ToDraw = new Rectangle(); + + public ResizeOverlay() + { + InitializeComponent(); + } + + private void tmrMove_Tick(object sender, EventArgs e) + { + outline.Bounds = ToDraw; // Pens.Gray, ToDraw); + } + + private void outline_Paint(object sender, PaintEventArgs e) + { + e.Graphics.FillRectangle(Brushes.Gray, 0, 0, outline.Width, 4); // Top border + e.Graphics.FillRectangle(Brushes.Gray, 0, outline.Height - 4, outline.Width, 4); // Bottom border + e.Graphics.FillRectangle(Brushes.Gray, 0, 0, 4, outline.Height); // Left border + e.Graphics.FillRectangle(Brushes.Gray, outline.Width - 4, 0, 4, outline.Height); // Right border + } + } +} diff --git a/Histacom2.Engine/Template/ResizeOverlay.resx b/Histacom2.Engine/Template/ResizeOverlay.resx new file mode 100644 index 0000000..10340d0 --- /dev/null +++ b/Histacom2.Engine/Template/ResizeOverlay.resx @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="tmrMove.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root>
\ No newline at end of file diff --git a/Histacom2.Engine/Template/WinClassic.Designer.cs b/Histacom2.Engine/Template/WinClassic.Designer.cs index be76be6..593cfd6 100644 --- a/Histacom2.Engine/Template/WinClassic.Designer.cs +++ b/Histacom2.Engine/Template/WinClassic.Designer.cs @@ -162,6 +162,7 @@ this.toprightcorner.TabIndex = 6; this.toprightcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.toprightcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.toprightcorner_MouseMove); + this.toprightcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // bottomrightcorner // @@ -174,6 +175,7 @@ this.bottomrightcorner.TabIndex = 4; this.bottomrightcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.bottomrightcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bottomrightcorner_MouseMove); + this.bottomrightcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // bottomleftcorner // @@ -186,6 +188,7 @@ this.bottomleftcorner.TabIndex = 2; this.bottomleftcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.bottomleftcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bottomleftcorner_MouseMove); + this.bottomleftcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // topleftcorner // @@ -197,6 +200,7 @@ this.topleftcorner.TabIndex = 1; this.topleftcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.topleftcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.topleftcorner_MouseMove); + this.topleftcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // left // @@ -209,6 +213,7 @@ this.left.TabIndex = 3; this.left.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.left.MouseMove += new System.Windows.Forms.MouseEventHandler(this.left_MouseMove); + this.left.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // bottom // @@ -222,6 +227,7 @@ this.bottom.TabIndex = 5; this.bottom.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.bottom.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bottom_MouseMove); + this.bottom.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // right // @@ -234,6 +240,7 @@ this.right.TabIndex = 7; this.right.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.right.MouseMove += new System.Windows.Forms.MouseEventHandler(this.right_MouseMove); + this.right.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // top // @@ -247,6 +254,7 @@ this.top.TabIndex = 8; this.top.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown); this.top.MouseMove += new System.Windows.Forms.MouseEventHandler(this.top_MouseMove); + this.top.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp); // // WinClassic // @@ -254,11 +262,13 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(300, 300); this.Controls.Add(this.program); + this.DoubleBuffered = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Name = "WinClassic"; 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 4c495bc..23ea562 100644 --- a/Histacom2.Engine/Template/WinClassic.cs +++ b/Histacom2.Engine/Template/WinClassic.cs @@ -14,11 +14,13 @@ namespace Histacom2.Engine.Template } public Font fnt; + public ResizeOverlay resizer = new ResizeOverlay(); public bool resizable = true; public bool closeDisabled = false; public bool isActive = true; - + public bool Resizing = false; + public Bitmap ResizingBmp = null; public const int WM_NCLBUTTONDOWN = 0xA1; public const int WM_SYSCOMMAND = 0x0112; public const int HT_CAPTION = 0x2; @@ -72,7 +74,9 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Size = new Size(MousePosition.X - this.Location.X, this.Size.Height); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Width = MousePosition.X - this.Location.X; + resizer.ToDraw = toDraw; } } @@ -80,8 +84,10 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Width = ((this.Width + this.Location.X) - Cursor.Position.X); - if (resizable)this.Location = new Point(Cursor.Position.X, this.Location.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Width = ((this.Width + this.Location.X) - Cursor.Position.X); + if (resizable) toDraw.X = Cursor.Position.X; + resizer.ToDraw = toDraw; } } @@ -89,7 +95,10 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Size = new Size(this.Size.Width, MousePosition.Y - this.Location.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Y = this.Location.Y; + if (resizable) toDraw.Height = MousePosition.Y - this.Location.Y; + resizer.ToDraw = toDraw; } } @@ -97,7 +106,10 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Size = new Size(MousePosition.X - this.Location.X, MousePosition.Y - this.Location.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Width = MousePosition.X - this.Location.X; + if (resizable) toDraw.Height = MousePosition.Y - this.Location.Y; + resizer.ToDraw = toDraw; } } @@ -105,9 +117,11 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Width = ((this.Width + this.Location.X) - Cursor.Position.X); - if (resizable) this.Height = (Cursor.Position.Y - this.Location.Y); - if (resizable) this.Location = new Point(Cursor.Position.X, this.Location.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Width = ((toDraw.Width + toDraw.Location.X) - Cursor.Position.X); + if (resizable) toDraw.Height = Cursor.Position.Y - this.Location.Y; + if (resizable) toDraw.X = Cursor.Position.X; + resizer.ToDraw = toDraw; } } @@ -115,10 +129,12 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Width = ((this.Width + this.Location.X) - Cursor.Position.X); - if (resizable) this.Location = new Point(Cursor.Position.X, this.Location.Y); - if (resizable) this.Height = ((this.Height + this.Location.Y) - Cursor.Position.Y); - if (resizable) this.Location = new Point(this.Location.X, Cursor.Position.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Width = ((this.Width + this.Location.X) - Cursor.Position.X); + if (resizable) toDraw.X = Cursor.Position.X; + if (resizable) toDraw.Height = ((this.Height + this.Location.Y) - Cursor.Position.Y); + if (resizable) toDraw.Y = Cursor.Position.Y; + resizer.ToDraw = toDraw; } } @@ -126,8 +142,10 @@ namespace Histacom2.Engine.Template { if(e.Button == MouseButtons.Left) { - if(resizable) this.Height = ((this.Height + this.Location.Y) - Cursor.Position.Y); - if(resizable) this.Location = new Point(this.Location.X, Cursor.Position.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Height = ((toDraw.Height + toDraw.Top) - Cursor.Position.Y); + if (resizable) toDraw.Y = Cursor.Position.Y; + resizer.ToDraw = toDraw; } } @@ -135,12 +153,58 @@ namespace Histacom2.Engine.Template { if (e.Button == MouseButtons.Left) { - if (resizable) this.Width = (Cursor.Position.X - this.Location.X); - if (resizable) this.Height = ((this.Location.Y - Cursor.Position.Y) + this.Height); - if (resizable) this.Location = new Point(this.Location.X, Cursor.Position.Y); + var toDraw = resizer.ToDraw; + if (resizable) toDraw.Width = MousePosition.X - this.Location.X; + if (resizable) toDraw.Height = ((toDraw.Height + toDraw.Top) - Cursor.Position.Y); + if (resizable) toDraw.Y = Cursor.Position.Y; + resizer.ToDraw = toDraw; + } + } + + 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; + resizer.tmrMove.Stop(); + resizer.Close(); + + resizer = new ResizeOverlay(); + } + + private void border_MouseDown(object sender, MouseEventArgs e) + { + var cursor = this.PointToClient(Cursor.Position); + + if (topleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF004, 0); + else if (toprightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF005, 0); + else if (bottomleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF007, 0); + else if (bottomrightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF008, 0); + + else if (top.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF003, 0); + else if (left.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF001, 0); + else if (right.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF002, 0); + else if (bottom.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF006, 0); + + // Now we need to fix this weird artificating! + + resizer.tmrMove.Start(); + resizer.Show(); + + resizer.ToDraw = this.Bounds; + + // However this defocuses the window which we don't want + + WinClassic_Activated(null, null); + } + public bool max = false; private void maximizebutton_Click(object sender, EventArgs e) @@ -216,20 +280,5 @@ namespace Histacom2.Engine.Template var c = (Button)sender; c.UseVisualStyleBackColor = true; } - - private void border_MouseDown(object sender, EventArgs e) - { - var cursor = this.PointToClient(Cursor.Position); - - if (topleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF004, 0); - else if (toprightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF005, 0); - else if (bottomleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF007, 0); - else if (bottomrightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF008, 0); - - else if (top.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF003, 0); - else if (left.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF001, 0); - else if (right.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF002, 0); - else if (bottom.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF006, 0); - } } } diff --git a/Histacom2.Engine/Template/WinClassic.resx b/Histacom2.Engine/Template/WinClassic.resx index 394031d..6876b17 100644 --- a/Histacom2.Engine/Template/WinClassic.resx +++ b/Histacom2.Engine/Template/WinClassic.resx @@ -118,30 +118,6 @@ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> - <data name="maximizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value> - iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA+SURBVChTY/hP - CmAAAiB1nzjQ0NCA0HDgwAEQBwcAygIBNTRAJNDAqAY0DbgAdg0EAUIDkEUkAGkgDTAwAACYPGiagsMD - PwAAAABJRU5ErkJggg== -</value> - </data> - <data name="minimizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value> - iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA5SURBVChTY/hP - CmAAAiB1nzjQ0NCA0HCACDCqASqGF2DRAOKjAog4BFBDA36A0ABkEQlAGkgDDAwAKPmlWmNluNoAAAAA - SUVORK5CYII= -</value> - </data> - <data name="closebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value> - iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAABcSURBVChTrY/R - DcAgCERvdEbrJh2lPU+SYkINRt+PSN6J4FkBhMddw8y+wFUgCbQ70OtO7OQTJLgRa/L7JWmOt8RsB8mD - TQ5NkFbeQcLwauzMdkjZCLAq0gJrAC8niIXaIK89FAAAAABJRU5ErkJggg== -</value> - </data> <data name="toprightcorner.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -198,4 +174,28 @@ /DTD////wfTh46cBUSgJ/bC/izUAAAAASUVORK5CYII= </value> </data> + <data name="maximizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA+SURBVChTY/hP + CmAAAiB1nzjQ0NCA0HDgwAEQBwcAygIBNTRAJNDAqAY0DbgAdg0EAUIDkEUkAGkgDTAwAACYPGiagsMD + PwAAAABJRU5ErkJggg== +</value> + </data> + <data name="minimizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA5SURBVChTY/hP + CmAAAiB1nzjQ0NCA0HCACDCqASqGF2DRAOKjAog4BFBDA36A0ABkEQlAGkgDDAwAKPmlWmNluNoAAAAA + SUVORK5CYII= +</value> + </data> + <data name="closebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAABcSURBVChTrY/R + DcAgCERvdEbrJh2lPU+SYkINRt+PSN6J4FkBhMddw8y+wFUgCbQ70OtO7OQTJLgRa/L7JWmOt8RsB8mD + TQ5NkFbeQcLwauzMdkjZCLAq0gJrAC8niIXaIK89FAAAAABJRU5ErkJggg== +</value> + </data> </root>
\ No newline at end of file diff --git a/Histacom2.Engine/UI/ClassicButton.resx b/Histacom2.Engine/UI/ClassicButton.resx index 1af7de1..d5494e3 100644 --- a/Histacom2.Engine/UI/ClassicButton.resx +++ b/Histacom2.Engine/UI/ClassicButton.resx @@ -117,4 +117,7 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> </root>
\ No newline at end of file |
