diff options
| author | Richie Moch <[email protected]> | 2018-12-23 19:15:07 -0600 |
|---|---|---|
| committer | Richie Moch <[email protected]> | 2018-12-23 19:15:07 -0600 |
| commit | bca879db94bc6395dbfa77628747080311fdb226 (patch) | |
| tree | 24103811cd3df0957f2450bbe579e05d7dc7c4e6 /ShiftOS.Main/Apps | |
| parent | d94c79dbf5183230e5fd3342848408f776de60ea (diff) | |
| download | shiftos-rewind-bca879db94bc6395dbfa77628747080311fdb226.tar.gz shiftos-rewind-bca879db94bc6395dbfa77628747080311fdb226.tar.bz2 shiftos-rewind-bca879db94bc6395dbfa77628747080311fdb226.zip | |
started work on the pong, implemented "ShiftToolStrip". (note: pong is very buggy)
Diffstat (limited to 'ShiftOS.Main/Apps')
24 files changed, 3021 insertions, 0 deletions
diff --git a/ShiftOS.Main/Apps/FileSkimmer.Designer.cs b/ShiftOS.Main/Apps/FileSkimmer.Designer.cs new file mode 100644 index 0000000..36fe4e5 --- /dev/null +++ b/ShiftOS.Main/Apps/FileSkimmer.Designer.cs @@ -0,0 +1,260 @@ +using System.Windows.Forms; + +namespace ShiftOS.Main.Apps +{ + partial class FileSkimmer + { + /// <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 Component 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(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FileSkimmer)); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.newFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.textFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.newFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.breadcrumbsBar = new System.Windows.Forms.ToolStrip(); + this.toolStrip2 = new System.Windows.Forms.ToolStrip(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton(); + this.largeIconsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.smallIconsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.detailsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.listToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.tilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.listView1 = new System.Windows.Forms.ListView(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.renameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.menuStrip1.SuspendLayout(); + this.toolStrip2.SuspendLayout(); + this.contextMenuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Padding = new System.Windows.Forms.Padding(4, 1, 0, 1); + this.menuStrip1.Size = new System.Drawing.Size(1027, 24); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.newFileToolStripMenuItem, + this.newFolderToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 22); + this.fileToolStripMenuItem.Text = "File"; + // + // newFileToolStripMenuItem + // + this.newFileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.textFileToolStripMenuItem}); + this.newFileToolStripMenuItem.Name = "newFileToolStripMenuItem"; + this.newFileToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.newFileToolStripMenuItem.Text = "New File"; + // + // textFileToolStripMenuItem + // + this.textFileToolStripMenuItem.Name = "textFileToolStripMenuItem"; + this.textFileToolStripMenuItem.Size = new System.Drawing.Size(114, 22); + this.textFileToolStripMenuItem.Text = "Text file"; + this.textFileToolStripMenuItem.Click += new System.EventHandler(this.textFileToolStripMenuItem_Click); + // + // newFolderToolStripMenuItem + // + this.newFolderToolStripMenuItem.Name = "newFolderToolStripMenuItem"; + this.newFolderToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.newFolderToolStripMenuItem.Text = "New Folder"; + // + // breadcrumbsBar + // + this.breadcrumbsBar.ImageScalingSize = new System.Drawing.Size(24, 24); + this.breadcrumbsBar.Location = new System.Drawing.Point(0, 24); + this.breadcrumbsBar.Name = "breadcrumbsBar"; + this.breadcrumbsBar.Size = new System.Drawing.Size(1027, 25); + this.breadcrumbsBar.TabIndex = 2; + this.breadcrumbsBar.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.breadcrumbsBar_ItemClicked); + // + // toolStrip2 + // + this.toolStrip2.ImageScalingSize = new System.Drawing.Size(24, 24); + this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButton1, + this.toolStripDropDownButton1}); + this.toolStrip2.Location = new System.Drawing.Point(0, 49); + this.toolStrip2.Name = "toolStrip2"; + this.toolStrip2.Size = new System.Drawing.Size(1027, 25); + this.toolStrip2.TabIndex = 3; + this.toolStrip2.Text = "toolbar"; + // + // toolStripButton1 + // + this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image"))); + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(23, 22); + this.toolStripButton1.Text = "^"; + this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click); + // + // toolStripDropDownButton1 + // + this.toolStripDropDownButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.largeIconsToolStripMenuItem, + this.smallIconsToolStripMenuItem, + this.detailsToolStripMenuItem, + this.listToolStripMenuItem, + this.tilesToolStripMenuItem}); + this.toolStripDropDownButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image"))); + this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripDropDownButton1.Name = "toolStripDropDownButton1"; + this.toolStripDropDownButton1.Size = new System.Drawing.Size(79, 22); + this.toolStripDropDownButton1.Text = "View Mode"; + this.toolStripDropDownButton1.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStripDropDownButton1_DropDownItemClicked); + // + // largeIconsToolStripMenuItem + // + this.largeIconsToolStripMenuItem.Name = "largeIconsToolStripMenuItem"; + this.largeIconsToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.largeIconsToolStripMenuItem.Text = "Large Icons"; + // + // smallIconsToolStripMenuItem + // + this.smallIconsToolStripMenuItem.Name = "smallIconsToolStripMenuItem"; + this.smallIconsToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.smallIconsToolStripMenuItem.Text = "Small Icons"; + // + // detailsToolStripMenuItem + // + this.detailsToolStripMenuItem.Name = "detailsToolStripMenuItem"; + this.detailsToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.detailsToolStripMenuItem.Text = "Details"; + // + // listToolStripMenuItem + // + this.listToolStripMenuItem.Name = "listToolStripMenuItem"; + this.listToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.listToolStripMenuItem.Text = "List"; + // + // tilesToolStripMenuItem + // + this.tilesToolStripMenuItem.Name = "tilesToolStripMenuItem"; + this.tilesToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.tilesToolStripMenuItem.Text = "Tiles"; + // + // listView1 + // + this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView1.Location = new System.Drawing.Point(0, 74); + this.listView1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(1027, 437); + this.listView1.TabIndex = 4; + this.listView1.UseCompatibleStateImageBehavior = false; + this.listView1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseClick); + this.listView1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDoubleClick); + // + // contextMenuStrip1 + // + this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openToolStripMenuItem, + this.renameToolStripMenuItem, + this.deleteToolStripMenuItem}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(118, 70); + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.openToolStripMenuItem.Text = "Open"; + // + // renameToolStripMenuItem + // + this.renameToolStripMenuItem.Name = "renameToolStripMenuItem"; + this.renameToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.renameToolStripMenuItem.Text = "Rename"; + // + // deleteToolStripMenuItem + // + this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.deleteToolStripMenuItem.Text = "Delete"; + // + // FileSkimmer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.listView1); + this.Controls.Add(this.toolStrip2); + this.Controls.Add(this.breadcrumbsBar); + this.Controls.Add(this.menuStrip1); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.Name = "FileSkimmer"; + this.Size = new System.Drawing.Size(1027, 511); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.toolStrip2.ResumeLayout(false); + this.toolStrip2.PerformLayout(); + this.contextMenuStrip1.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStrip breadcrumbsBar; + private System.Windows.Forms.ToolStrip toolStrip2; + private System.Windows.Forms.ListView listView1; + private System.Windows.Forms.ToolStripDropDownButton toolStripDropDownButton1; + private System.Windows.Forms.ToolStripMenuItem largeIconsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem smallIconsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem detailsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem listToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem tilesToolStripMenuItem; + private System.Windows.Forms.ToolStripButton toolStripButton1; + private ToolStripMenuItem fileToolStripMenuItem; + private ToolStripMenuItem newFileToolStripMenuItem; + private ToolStripMenuItem newFolderToolStripMenuItem; + private ToolStripMenuItem textFileToolStripMenuItem; + private ContextMenuStrip contextMenuStrip1; + private ToolStripMenuItem openToolStripMenuItem; + private ToolStripMenuItem renameToolStripMenuItem; + private ToolStripMenuItem deleteToolStripMenuItem; + } +} diff --git a/ShiftOS.Main/Apps/FileSkimmer.cs b/ShiftOS.Main/Apps/FileSkimmer.cs new file mode 100644 index 0000000..e749d21 --- /dev/null +++ b/ShiftOS.Main/Apps/FileSkimmer.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Windows.Forms; +using ShiftOS.Engine.Misc; +using ShiftOS.Engine.ShiftFS; +using ShiftOS.Engine.WindowManager; +using System.Linq; +using ShiftOS.Engine.UI; + +namespace ShiftOS.Main.Apps +{ + public partial class FileSkimmer : UserControl, IShiftWindowExtensions + { + ShiftDirectory _currentDirectory; + + public FileSkimmer() + { + InitializeComponent(); + + } + + public void OnLoaded(ShiftWindow window) + { + Debug.WriteLine(ShiftFS.Drives.Count); + listView1.ShowDrivesList(window); + } + + void toolStripDropDownButton1_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + switch (e.ClickedItem.Text) + { + case "Small Icons": + listView1.View = View.SmallIcon; + break; + case "Details": + listView1.View = View.Details; + break; + case "List": + listView1.View = View.List; + break; + case "Tiles": + listView1.View = View.Tile; + break; + default: + listView1.View = View.LargeIcon; + break; + } + } + + void listView1_MouseDoubleClick(object sender, MouseEventArgs e) + { + var hit = listView1.HitTest(e.Location); + + if (!(hit.Item.Tag is ShiftDirectory dir)) return; + + listView1.Items.Clear(); + listView1.DisplayShiftFolder(dir); + _currentDirectory = dir; + breadcrumbsBar.Items.Add(new ToolStripButton(dir.Name) { Tag = dir }); + } + + void toolStripButton1_Click(object sender, EventArgs e) + { + listView1.Items.Clear(); + if (breadcrumbsBar.Items.Count > 1) + { + breadcrumbsBar.Items.Remove(breadcrumbsBar.Items.OfType<ToolStripItem>().Last()); + var dir = breadcrumbsBar.Items.OfType<ToolStripItem>().Last().Tag as ShiftDirectory; + _currentDirectory = dir; + listView1.DisplayShiftFolder(dir); + } + else + { + breadcrumbsBar.Items.Clear(); + listView1.ShowDrivesList(); + } + } + + void breadcrumbsBar_ItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + var items = new List<ToolStripItem>(breadcrumbsBar.Items.OfType<ToolStripItem>() + .Where((_, y) => y > breadcrumbsBar.Items.IndexOf(e.ClickedItem))); + + foreach (var item in items) + { + breadcrumbsBar.Items.Remove(item); + } + + toolStripButton1_Click(null, EventArgs.Empty); + } + + void textFileToolStripMenuItem_Click(object sender, EventArgs e) + { + _currentDirectory.Add(new ShiftFile<string>("Text file")); + } + + void listView1_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + contextMenuStrip1.Show(MousePosition); + } + } + } +} diff --git a/ShiftOS.Main/Apps/FileSkimmer.resx b/ShiftOS.Main/Apps/FileSkimmer.resx new file mode 100644 index 0000000..aeeea08 --- /dev/null +++ b/ShiftOS.Main/Apps/FileSkimmer.resx @@ -0,0 +1,163 @@ +<?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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>175, 17</value> + </metadata> + <metadata name="breadcrumbsBar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>331, 17</value> + </metadata> + <metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>473, 17</value> + </metadata> + <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== +</value> + </data> + <data name="toolStripDropDownButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== +</value> + </data> + <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>615, 17</value> + </metadata> +</root>
\ No newline at end of file diff --git a/ShiftOS.Main/Apps/Pong.Designer.cs b/ShiftOS.Main/Apps/Pong.Designer.cs new file mode 100644 index 0000000..4b9bd01 --- /dev/null +++ b/ShiftOS.Main/Apps/Pong.Designer.cs @@ -0,0 +1,100 @@ +namespace ShiftOS.Main.Apps +{ + partial class Pong + { + /// <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 Component 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.playerPaddle = new System.Windows.Forms.PictureBox(); + this.cpuPaddle = new System.Windows.Forms.PictureBox(); + this.ball = new System.Windows.Forms.PictureBox(); + this.gameTimer = new System.Windows.Forms.Timer(this.components); + ((System.ComponentModel.ISupportInitialize)(this.playerPaddle)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.cpuPaddle)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.ball)).BeginInit(); + this.SuspendLayout(); + // + // playerPaddle + // + this.playerPaddle.BackColor = System.Drawing.Color.White; + this.playerPaddle.Location = new System.Drawing.Point(27, 153); + this.playerPaddle.Name = "playerPaddle"; + this.playerPaddle.Size = new System.Drawing.Size(22, 103); + this.playerPaddle.TabIndex = 0; + this.playerPaddle.TabStop = false; + // + // cpuPaddle + // + this.cpuPaddle.BackColor = System.Drawing.Color.White; + this.cpuPaddle.Location = new System.Drawing.Point(751, 153); + this.cpuPaddle.Name = "cpuPaddle"; + this.cpuPaddle.Size = new System.Drawing.Size(22, 103); + this.cpuPaddle.TabIndex = 1; + this.cpuPaddle.TabStop = false; + // + // ball + // + this.ball.BackColor = System.Drawing.Color.White; + this.ball.Location = new System.Drawing.Point(390, 201); + this.ball.Name = "ball"; + this.ball.Size = new System.Drawing.Size(18, 18); + this.ball.TabIndex = 2; + this.ball.TabStop = false; + // + // gameTimer + // + this.gameTimer.Interval = 20; + this.gameTimer.Tick += new System.EventHandler(this.gameTimer_Tick); + // + // Pong + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Black; + this.Controls.Add(this.ball); + this.Controls.Add(this.cpuPaddle); + this.Controls.Add(this.playerPaddle); + this.ForeColor = System.Drawing.Color.White; + this.Name = "Pong"; + this.Size = new System.Drawing.Size(801, 470); + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Pong_KeyDown); + this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Pong_KeyUp); + ((System.ComponentModel.ISupportInitialize)(this.playerPaddle)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.cpuPaddle)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.ball)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox playerPaddle; + private System.Windows.Forms.PictureBox cpuPaddle; + private System.Windows.Forms.PictureBox ball; + private System.Windows.Forms.Timer gameTimer; + } +} diff --git a/ShiftOS.Main/Apps/Pong.cs b/ShiftOS.Main/Apps/Pong.cs new file mode 100644 index 0000000..aa0c792 --- /dev/null +++ b/ShiftOS.Main/Apps/Pong.cs @@ -0,0 +1,72 @@ +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 ShiftOS.Main.Apps +{ + public partial class Pong : UserControl + { + bool goUp = false; + bool goDown = false; + int speed = 5; + float ballX = 5; + float ballY = 5; + public Pong() + { + InitializeComponent(); + gameTimer.Start(); + ResetToRest(); + } + void ResetToRest() + { + ball.Location = new Point((int)Math.Round(this.Width / 2d, 0), (int)Math.Round(this.Height / 2d, 0)); + playerPaddle.Location = new Point(playerPaddle.Location.X, (int)Math.Round(this.Height / 2d, 0)); + cpuPaddle.Location = new Point(cpuPaddle.Location.X, (int)Math.Round(this.Height / 2d, 0)); + } + + private void Pong_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.W) goUp = true; + if (e.KeyCode == Keys.S) goDown = true; + } + + private void Pong_KeyUp(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.W) goUp = false; + if (e.KeyCode == Keys.S) goDown = false; + } + + private void gameTimer_Tick(object sender, EventArgs e) + { + ball.Top -= (int)ballY; + ball.Left -= (int)ballX; + + cpuPaddle.Top += speed; + + if (cpuPaddle.Top < 0 || cpuPaddle.Top > this.Height) speed = -speed; + + if (ball.Left < 0) + { + ResetToRest(); + ballX = -ballX; + } + if (ball.Left + ball.Width > this.Height) + { + ResetToRest(); + ballX = -ballX; + } + if (ball.Top < 0 || ball.Top + ball.Height > this.Height) ballY = -ballY; + if (ball.Bounds.IntersectsWith(playerPaddle.Bounds) || ball.Bounds.IntersectsWith(cpuPaddle.Bounds)) ballX = -ballX; + + if (goUp && playerPaddle.Top > 0) playerPaddle.Top -= 8; + if (goDown && playerPaddle.Top < this.Height) playerPaddle.Top += 8; + + } + } +} diff --git a/ShiftOS.Main/Apps/Pong.resx b/ShiftOS.Main/Apps/Pong.resx new file mode 100644 index 0000000..a0e8b0d --- /dev/null +++ b/ShiftOS.Main/Apps/Pong.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="gameTimer.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/ShiftOS.Main/Apps/ShiftDemo.Designer.cs b/ShiftOS.Main/Apps/ShiftDemo.Designer.cs new file mode 100644 index 0000000..f8ee8e3 --- /dev/null +++ b/ShiftOS.Main/Apps/ShiftDemo.Designer.cs @@ -0,0 +1,74 @@ +namespace ShiftOS.Main.ShiftOS.Apps +{ + partial class ShiftDemo + { + /// <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 Component 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.label1 = new System.Windows.Forms.Label(); + this.icon = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.icon)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(27, 25); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(51, 20); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + // + // icon + // + this.icon.Location = new System.Drawing.Point(31, 61); + this.icon.Name = "icon"; + this.icon.Size = new System.Drawing.Size(300, 300); + this.icon.TabIndex = 1; + this.icon.TabStop = false; + // + // ShiftDemo + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.icon); + this.Controls.Add(this.label1); + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.Name = "ShiftDemo"; + this.Size = new System.Drawing.Size(450, 462); + ((System.ComponentModel.ISupportInitialize)(this.icon)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.Label label1; + private System.Windows.Forms.PictureBox icon; + } +} diff --git a/ShiftOS.Main/Apps/ShiftDemo.cs b/ShiftOS.Main/Apps/ShiftDemo.cs new file mode 100644 index 0000000..ced10d2 --- /dev/null +++ b/ShiftOS.Main/Apps/ShiftDemo.cs @@ -0,0 +1,18 @@ +using System.Windows.Forms; +using ShiftOS.Engine.WindowManager; + +namespace ShiftOS.Main.ShiftOS.Apps +{ + public partial class ShiftDemo : UserControl, IShiftWindowExtensions + { + public ShiftDemo() + { + InitializeComponent(); + } + + public void OnLoaded(ShiftWindow window) + { + icon.Image = this.GetShiftWindow().Icon.ToBitmap(); + } + } +}
\ No newline at end of file diff --git a/ShiftOS.Main/Apps/ShiftDemo.resx b/ShiftOS.Main/Apps/ShiftDemo.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.Main/Apps/ShiftDemo.resx @@ -0,0 +1,120 @@ +<?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> +</root>
\ No newline at end of file diff --git a/ShiftOS.Main/Apps/ShifterStuff/SelectColor.Designer.cs b/ShiftOS.Main/Apps/ShifterStuff/SelectColor.Designer.cs new file mode 100644 index 0000000..5e617cb --- /dev/null +++ b/ShiftOS.Main/Apps/ShifterStuff/SelectColor.Designer.cs @@ -0,0 +1,150 @@ +namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff +{ + partial class SelectColor + { + /// <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 Component 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.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.btnSetColor = new System.Windows.Forms.Button(); + this.redUpDown = new System.Windows.Forms.NumericUpDown(); + this.greenUpDown = new System.Windows.Forms.NumericUpDown(); + this.blueUpDown = new System.Windows.Forms.NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)(this.redUpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.greenUpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.blueUpDown)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(21, 34); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(39, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Red:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(21, 62); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(55, 13); + this.label2.TabIndex = 1; + this.label2.Text = "Green:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(21, 92); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(47, 13); + this.label3.TabIndex = 2; + this.label3.Text = "Blue:"; + // + // btnSetColor + // + this.btnSetColor.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnSetColor.Location = new System.Drawing.Point(75, 121); + this.btnSetColor.Name = "btnSetColor"; + this.btnSetColor.Size = new System.Drawing.Size(93, 23); + this.btnSetColor.TabIndex = 6; + this.btnSetColor.Text = "Set Color"; + this.btnSetColor.UseVisualStyleBackColor = true; + this.btnSetColor.Click += new System.EventHandler(this.btnSetColor_Click); + // + // redUpDown + // + this.redUpDown.Location = new System.Drawing.Point(82, 32); + this.redUpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.redUpDown.Name = "redUpDown"; + this.redUpDown.Size = new System.Drawing.Size(120, 20); + this.redUpDown.TabIndex = 7; + // + // greenUpDown + // + this.greenUpDown.Location = new System.Drawing.Point(82, 60); + this.greenUpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.greenUpDown.Name = "greenUpDown"; + this.greenUpDown.Size = new System.Drawing.Size(120, 20); + this.greenUpDown.TabIndex = 8; + // + // blueUpDown + // + this.blueUpDown.Location = new System.Drawing.Point(82, 90); + this.blueUpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.blueUpDown.Name = "blueUpDown"; + this.blueUpDown.Size = new System.Drawing.Size(120, 20); + this.blueUpDown.TabIndex = 9; + // + // SelectColor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.blueUpDown); + this.Controls.Add(this.greenUpDown); + this.Controls.Add(this.redUpDown); + this.Controls.Add(this.btnSetColor); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Font = new System.Drawing.Font("Lucida Console", 9.25F); + this.Name = "SelectColor"; + this.Size = new System.Drawing.Size(317, 158); + this.Load += new System.EventHandler(this.SelectColor_Load); + ((System.ComponentModel.ISupportInitialize)(this.redUpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.greenUpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.blueUpDown)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button btnSetColor; + private System.Windows.Forms.NumericUpDown redUpDown; + private System.Windows.Forms.NumericUpDown greenUpDown; + private System.Windows.Forms.NumericUpDown blueUpDown; + } +} diff --git a/ShiftOS.Main/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/Apps/ShifterStuff/SelectColor.cs new file mode 100644 index 0000000..3da3b98 --- /dev/null +++ b/ShiftOS.Main/Apps/ShifterStuff/SelectColor.cs @@ -0,0 +1,63 @@ +using System; +using System.Drawing; +using System.Globalization; +using System.Windows.Forms; +using ShiftOS.Engine.WindowManager; +using ShiftOS.Engine.UI; + +namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff +{ + public partial class SelectColor : UserControl + { + int _colorType1; + int _colorType2; + int _colorType3; + Color _finalColor; + + public SelectColor() + { + InitializeComponent(); + } + + Color SetColor() + { + _colorType1 = int.Parse(redUpDown.Value.ToString(CultureInfo.InvariantCulture)); + _colorType2 = int.Parse(greenUpDown.Value.ToString(CultureInfo.InvariantCulture)); + _colorType3 = int.Parse(blueUpDown.Value.ToString(CultureInfo.InvariantCulture)); + try + { + _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3); + + + foreach (var window in ShiftWM.Windows) + { + window.Invoke(new Action(() => window.titleBar.BackColor = _finalColor)); + } + + + ShiftWM.StartInfoboxSession( + "Success!", + $"Changed color to:\r\n{_colorType1}, {_colorType2}, {_colorType3}.", + InfoboxTemplate.ButtonType.Ok); + } + catch (Exception) + { + ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok); + } + return _finalColor; + } + + void btnSetColor_Click(object sender, EventArgs e) + { + SetColor(); + } + + private void SelectColor_Load(object sender, EventArgs e) + { + var s = new ShiftButton(); + s.Location = new System.Drawing.Point(211, 48); + s.Text = "test"; + Controls.Add(s); + } + } +}
\ No newline at end of file diff --git a/ShiftOS.Main/Apps/ShifterStuff/SelectColor.resx b/ShiftOS.Main/Apps/ShifterStuff/SelectColor.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.Main/Apps/ShifterStuff/SelectColor.resx @@ -0,0 +1,120 @@ +<?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> +</root>
\ No newline at end of file diff --git a/ShiftOS.Main/Apps/ShifterStuff/Shifter.Designer.cs b/ShiftOS.Main/Apps/ShifterStuff/Shifter.Designer.cs new file mode 100644 index 0000000..fc0d417 --- /dev/null +++ b/ShiftOS.Main/Apps/ShifterStuff/Shifter.Designer.cs @@ -0,0 +1,281 @@ +using ShiftOS.Engine.UI; +namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff +{ + partial class Shifter + { + /// <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 Component 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.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.shiftButton2 = new ShiftButton(); + this.button7 = new System.Windows.Forms.Button(); + this.shiftButton1 = new Engine.UI.ShiftButton(); + this.button6 = new System.Windows.Forms.Button(); + this.btnLoad = new System.Windows.Forms.Button(); + this.btnSave = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.button1 = new System.Windows.Forms.Button(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // tabControl1 + // + this.tabControl1.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.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Location = new System.Drawing.Point(3, 3); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(334, 322); + this.tabControl1.TabIndex = 0; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.shiftButton2); + this.tabPage1.Controls.Add(this.button7); + this.tabPage1.Controls.Add(this.shiftButton1); + this.tabPage1.Controls.Add(this.button6); + this.tabPage1.Controls.Add(this.btnLoad); + this.tabPage1.Controls.Add(this.btnSave); + this.tabPage1.Controls.Add(this.button5); + this.tabPage1.Controls.Add(this.button4); + this.tabPage1.Controls.Add(this.button3); + this.tabPage1.Controls.Add(this.button2); + this.tabPage1.Controls.Add(this.groupBox1); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(326, 296); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Titlebar"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // shiftButton2 + // + this.shiftButton2.BackColor = System.Drawing.Color.White; + this.shiftButton2.FlatAppearance.BorderColor = System.Drawing.Color.Black; + this.shiftButton2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.shiftButton2.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.shiftButton2.ForeColor = System.Drawing.Color.Black; + this.shiftButton2.Location = new System.Drawing.Point(194, 77); + this.shiftButton2.Margin = new System.Windows.Forms.Padding(0); + this.shiftButton2.MinimumSize = new System.Drawing.Size(75, 23); + this.shiftButton2.Name = "shiftButton2"; + this.shiftButton2.Padding = new System.Windows.Forms.Padding(3); + this.shiftButton2.Size = new System.Drawing.Size(121, 27); + this.shiftButton2.TabIndex = 11; + this.shiftButton2.Text = "Test Textures"; + this.shiftButton2.UseVisualStyleBackColor = false; + this.shiftButton2.Click += new System.EventHandler(this.shiftButton2_Click); + // + // button7 + // + this.button7.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button7.Font = new System.Drawing.Font("Lucida Console", 8.25F); + this.button7.Location = new System.Drawing.Point(205, 51); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(100, 23); + this.button7.TabIndex = 10; + this.button7.Text = "NormalBtn"; + this.button7.UseVisualStyleBackColor = true; + this.button7.Click += new System.EventHandler(this.shiftButton2_Click); + // + // shiftButton1 + // + this.shiftButton1.BackColor = System.Drawing.Color.White; + this.shiftButton1.FlatAppearance.BorderColor = System.Drawing.Color.Gray; + this.shiftButton1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.shiftButton1.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.shiftButton1.ForeColor = System.Drawing.Color.Black; + this.shiftButton1.Location = new System.Drawing.Point(205, 25); + this.shiftButton1.Margin = new System.Windows.Forms.Padding(0); + this.shiftButton1.MinimumSize = new System.Drawing.Size(75, 23); + this.shiftButton1.Name = "shiftButton1"; + this.shiftButton1.Padding = new System.Windows.Forms.Padding(3); + this.shiftButton1.Size = new System.Drawing.Size(100, 23); + this.shiftButton1.TabIndex = 9; + this.shiftButton1.Text = "ShiftButton"; + this.shiftButton1.UseVisualStyleBackColor = false; + this.shiftButton1.Click += new System.EventHandler(this.shiftButton1_Click); + // + // button6 + // + this.button6.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button6.Font = new System.Drawing.Font("Lucida Console", 8.25F); + this.button6.Location = new System.Drawing.Point(6, 152); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(314, 23); + this.button6.TabIndex = 8; + this.button6.Text = "Set Midnight Skin"; + this.button6.UseVisualStyleBackColor = true; + this.button6.Click += new System.EventHandler(this.button6_Click); + // + // btnLoad + // + this.btnLoad.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnLoad.Font = new System.Drawing.Font("Lucida Console", 8.25F); + this.btnLoad.Location = new System.Drawing.Point(165, 267); + this.btnLoad.Name = "btnLoad"; + this.btnLoad.Size = new System.Drawing.Size(155, 23); + this.btnLoad.TabIndex = 7; + this.btnLoad.Text = "Load Skin"; + this.btnLoad.UseVisualStyleBackColor = true; + this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click); + // + // btnSave + // + this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnSave.Font = new System.Drawing.Font("Lucida Console", 8.25F); + this.btnSave.Location = new System.Drawing.Point(6, 267); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(155, 23); + this.btnSave.TabIndex = 6; + this.btnSave.Text = "Save Skin"; + this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // + // button5 + // + this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button5.Font = new System.Drawing.Font("Lucida Console", 8.25F); + this.button5.Location = new System.Drawing.Point(6, 239); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(314, 23); + this.button5.TabIndex = 5; + this.button5.Text = "Apply"; + this.button5.UseVisualStyleBackColor = true; + // + // button4 + // + this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button4.Font = new System.Drawing.Font("Lucida Console", 8.25F); + this.button4.Location = new System.Drawing.Point(6, 181); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(314, 23); + this.button4.TabIndex = 4; + this.button4.Text = "Set Random Skin"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.SetRandomSkin); + // + // button3 + // + this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button3.Font = new System.Drawing.Font("Lucida Console", 8.25F); + this.button3.Location = new System.Drawing.Point(6, 210); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(155, 23); + this.button3.TabIndex = 3; + this.button3.Text = "Set Default Skin"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.SetDefaultSkin); + // + // button2 + // + this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button2.Font = new System.Drawing.Font("Lucida Console", 8.25F); + this.button2.Location = new System.Drawing.Point(165, 210); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(155, 23); + this.button2.TabIndex = 2; + this.button2.Text = "Set Colorful Skin"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.SetColorSkin); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.button1); + this.groupBox1.Location = new System.Drawing.Point(6, 6); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(161, 108); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "groupBox1"; + // + // button1 + // + this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button1.Font = new System.Drawing.Font("Lucida Console", 8.25F); + this.button1.Location = new System.Drawing.Point(6, 19); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(149, 23); + this.button1.TabIndex = 1; + this.button1.Text = "Set Titlebar Color"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // tabPage2 + // + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(326, 296); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "tabPage2"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // Shifter + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tabControl1); + this.Name = "Shifter"; + this.Size = new System.Drawing.Size(340, 325); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button btnSave; + private System.Windows.Forms.Button btnLoad; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button7; + private Engine.UI.ShiftButton shiftButton1; + private Engine.UI.ShiftButton shiftButton2; + } +} diff --git a/ShiftOS.Main/Apps/ShifterStuff/Shifter.cs b/ShiftOS.Main/Apps/ShifterStuff/Shifter.cs new file mode 100644 index 0000000..529e603 --- /dev/null +++ b/ShiftOS.Main/Apps/ShifterStuff/Shifter.cs @@ -0,0 +1,227 @@ +using System; +using System.Drawing; +using System.IO; +using System.Windows.Forms; +using ShiftOS.Engine.Misc; +using ShiftOS.Engine.WindowManager; +using ShiftOS.Main.Properties; +using Whoa; + +namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff +{ + public partial class Shifter : UserControl + { + public static readonly ImageConverter imageConverter = new ImageConverter(); + public int ColorType; //This is a check to see what option was chosen. + public Shifter() + { + InitializeComponent(); + } + + void button1_Click(object sender, EventArgs e) + { + ColorType = 1; + ShiftWM.Init(new SelectColor(), "Select a color", Resources.iconColourPicker_fw); + } + + /// <summary> + /// Modifies the values in ShiftShiftSkinData.Colors. + /// </summary> + /// <param name="borderColor">The border color of the window.</param> + /// <param name="btnClose">The close button color of the window.</param> + /// <param name="btnCloseHover">The close button color of the window while hovering.</param> + /// <param name="btnMax">The maximize button color of the window.</param> + /// <param name="btnMaxHover">The maximize button color of the window while hovering.</param> + /// <param name="btnMin">The minimize button color of the window.</param> + /// <param name="btnMinHover">The minimize button color of the window while hovering.</param> + void ModifyData(Color borderColor, Color btnClose, Color btnCloseHover, Color btnMax, Color btnMaxHover, Color btnMin, Color btnMinHover) + { + SetBorderColor(borderColor); + ShiftSkinData.Colors.BtnCloseColor = btnClose; + ShiftSkinData.Colors.BtnCloseHoverColor = btnCloseHover; + ShiftSkinData.Colors.BtnMaxColor = btnMax; + ShiftSkinData.Colors.BtnMaxHoverColor = btnMaxHover; + ShiftSkinData.Colors.BtnMinColor = btnMin; + ShiftSkinData.Colors.BtnMinHoverColor = btnMinHover; + } + + // SetBorderColor + public void SetBorderColor(Color borderColor) + { + ShiftSkinData.Colors.LeftTopCornerColor = borderColor; + ShiftSkinData.Colors.TitleBarColor = borderColor; + ShiftSkinData.Colors.RightTopCornerColor = borderColor; + ShiftSkinData.Colors.LeftSideColor = borderColor; + ShiftSkinData.Colors.RightSideColor = borderColor; + ShiftSkinData.Colors.LeftBottomCornerColor = borderColor; + ShiftSkinData.Colors.BottomSideColor = borderColor; + ShiftSkinData.Colors.RightBottomCornerColor = borderColor; + } + + void SetDefaultSkin(object sender, EventArgs e) + { + ModifyData(Color.FromArgb(64, 64, 64), Color.Black, Color.FromArgb(40, 40, 40), Color.Black, Color.FromArgb(40, 40, 40), Color.Black, Color.FromArgb(40, 40, 40)); + ApplySkin(); + } + + void SetColorSkin(object sender, EventArgs e) + { + ModifyData(Color.Blue, Color.Red, Color.FromArgb(255, 102, 102), Color.Yellow, Color.FromArgb(255, 255, 153), Color.Green, Color.FromArgb(102, 255, 102)); + ApplySkin(); + } + + void SetRandomSkin(object sender, EventArgs e) + { + var rnd = new Random(); + ModifyData( + Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)), // Border Color + Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)), // Close Button Color + Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)), // Close Hover Color + Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)), // Maximize Button Color + Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)), // Maximize Hover Color + Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)), // Minimize Button Color + Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255))); // Minimize Hover Color + ApplySkin(); + } + + void ApplySkin() + { + foreach (var window in ShiftWM.Windows) + { + window.Invoke(new Action(() => window.titleBar.BackColor = ShiftSkinData.Colors.TitleBarColor)); + window.Invoke(new Action(() => window.leftTopCorner.BackColor = ShiftSkinData.Colors.LeftTopCornerColor)); + window.Invoke(new Action(() => window.rightTopCorner.BackColor = ShiftSkinData.Colors.RightTopCornerColor)); + window.Invoke(new Action(() => window.leftSide.BackColor = ShiftSkinData.Colors.LeftSideColor)); + window.Invoke(new Action(() => window.rightSide.BackColor = ShiftSkinData.Colors.RightSideColor)); + window.Invoke(new Action(() => window.leftBottomCorner.BackColor = ShiftSkinData.Colors.LeftBottomCornerColor)); + window.Invoke(new Action(() => window.bottomSide.BackColor = ShiftSkinData.Colors.BottomSideColor)); + window.Invoke(new Action(() => window.rightBottomCorner.BackColor = ShiftSkinData.Colors.RightBottomCornerColor)); + window.Invoke(new Action(() => window.btnClose.BackColor = ShiftSkinData.Colors.BtnCloseColor)); + window.Invoke(new Action(() => window.btnMax.BackColor = ShiftSkinData.Colors.BtnMaxColor)); + window.Invoke(new Action(() => window.btnMin.BackColor = ShiftSkinData.Colors.BtnMinColor)); + } + } + void ApplyTexturedSkin() //not implemented + { + throw new NotImplementedException("Not implemented."); + + /*foreach (var window in ShiftWM.Windows) + { + window.Invoke(new Action(() => window.titleBar.Height = ShiftSkinData.Images.TitleBarImage.Height)); + window.Invoke(new Action(() => window.leftTopCorner.Width = ShiftSkinData.Images.LeftTopCornerImage.Width)); + window.Invoke(new Action(() => window.rightTopCorner.Width = ShiftSkinData.Images.RightTopCornerImage.Width)); + window.Invoke(new Action(() => window.leftSide.Width = ShiftSkinData.Images.LeftSideImage.Width)); + window.Invoke(new Action(() => window.rightSide.Width = ShiftSkinData.Images.RightSideImage.Width)); + window.Invoke(new Action(() => window.leftBottomCorner.Width = ShiftSkinData.Images.LeftBottomCornerImage.Width)); + window.Invoke(new Action(() => window.bottomSide.Width = ShiftSkinData.Images.BottomSideImage.Width)); + window.Invoke(new Action(() => window.rightBottomCorner.Width = ShiftSkinData.Images.RightBottomCornerImage.Width)); + window.Invoke(new Action(() => window.btnClose.Width = ShiftSkinData.Images.BtnCloseImage.Width)); + window.Invoke(new Action(() => window.btnMax.Width = ShiftSkinData.Images.BtnMaxImage.Width)); + window.Invoke(new Action(() => window.btnMin.Width = ShiftSkinData.Images.BtnMinImage.Width)); + window.Invoke(new Action(() => window.titleBar.BackgroundImage = ShiftSkinData.Images.TitleBarImage)); + window.Invoke(new Action(() => window.leftTopCorner.BackgroundImage = ShiftSkinData.Images.LeftTopCornerImage)); + window.Invoke(new Action(() => window.rightTopCorner.BackgroundImage = ShiftSkinData.Images.RightTopCornerImage)); + window.Invoke(new Action(() => window.leftSide.BackgroundImage = ShiftSkinData.Images.LeftSideImage)); + window.Invoke(new Action(() => window.rightSide.BackgroundImage = ShiftSkinData.Images.RightSideImage)); + window.Invoke(new Action(() => window.leftBottomCorner.BackgroundImage = ShiftSkinData.Images.LeftBottomCornerImage)); + window.Invoke(new Action(() => window.bottomSide.BackgroundImage = ShiftSkinData.Images.BottomSideImage)); + window.Invoke(new Action(() => window.rightBottomCorner.BackgroundImage = ShiftSkinData.Images.RightBottomCornerImage)); + window.Invoke(new Action(() => window.btnClose.BackgroundImage = ShiftSkinData.Images.BtnCloseImage)); + window.Invoke(new Action(() => window.btnMax.BackgroundImage = ShiftSkinData.Images.BtnMaxImage)); + window.Invoke(new Action(() => window.btnMin.BackgroundImage = ShiftSkinData.Images.BtnMinImage)); + }*/ + } + + void btnSave_Click(object sender, EventArgs e) + { + Color[] shiftSkinColors = new Color[14]; + + shiftSkinColors[0] = ShiftSkinData.Colors.LeftTopCornerColor; + shiftSkinColors[1] = ShiftSkinData.Colors.TitleBarColor; + shiftSkinColors[2] = ShiftSkinData.Colors.RightTopCornerColor; + shiftSkinColors[3] = ShiftSkinData.Colors.LeftSideColor; + shiftSkinColors[4] = ShiftSkinData.Colors.RightSideColor; + shiftSkinColors[5] = ShiftSkinData.Colors.LeftBottomCornerColor; + shiftSkinColors[6] = ShiftSkinData.Colors.BottomSideColor; + shiftSkinColors[7] = ShiftSkinData.Colors.RightBottomCornerColor; + shiftSkinColors[8] = ShiftSkinData.Colors.BtnCloseColor; + shiftSkinColors[9] = ShiftSkinData.Colors.BtnCloseHoverColor; + shiftSkinColors[10] = ShiftSkinData.Colors.BtnMaxColor; + shiftSkinColors[11] = ShiftSkinData.Colors.BtnMaxHoverColor; + shiftSkinColors[12] = ShiftSkinData.Colors.BtnMinColor; + shiftSkinColors[13] = ShiftSkinData.Colors.BtnMinHoverColor; + + using (var fobj = File.OpenWrite(@"C:\Users\Public\Documents\Skin.whoa")) + Whoa.Whoa.SerialiseObject(fobj, shiftSkinColors); + + InfoboxTemplate shiftWindow = ShiftWM.StartInfoboxSession( + "Saved Skin", + "Saved Skin to C:\\Users\\Public\\Documents\\Skin.whoa", + InfoboxTemplate.ButtonType.Ok); + + } + + private void btnLoad_Click(object sender, EventArgs e) + { + Color[] shiftSkinColors = new Color[14]; + using (var fobj = File.OpenRead(@"C:\Users\Public\Documents\Skin.whoa")) + shiftSkinColors = Whoa.Whoa.DeserialiseObject<Color[]>(fobj); + + ShiftSkinData.Colors.LeftTopCornerColor = shiftSkinColors[0]; + ShiftSkinData.Colors.TitleBarColor = shiftSkinColors[1]; + ShiftSkinData.Colors.RightTopCornerColor = shiftSkinColors[2]; + ShiftSkinData.Colors.LeftSideColor = shiftSkinColors[3]; + ShiftSkinData.Colors.RightSideColor = shiftSkinColors[4]; + ShiftSkinData.Colors.LeftBottomCornerColor = shiftSkinColors[5]; + ShiftSkinData.Colors.BottomSideColor = shiftSkinColors[6]; + ShiftSkinData.Colors.RightBottomCornerColor = shiftSkinColors[7]; + ShiftSkinData.Colors.BtnCloseColor = shiftSkinColors[8]; + ShiftSkinData.Colors.BtnCloseHoverColor = shiftSkinColors[9]; + ShiftSkinData.Colors.BtnMaxColor = shiftSkinColors[10]; + ShiftSkinData.Colors.BtnMaxHoverColor = shiftSkinColors[11]; + ShiftSkinData.Colors.BtnMinColor = shiftSkinColors[12]; + ShiftSkinData.Colors.BtnMinHoverColor = shiftSkinColors[13]; + + ApplySkin(); + ShiftWM.StartInfoboxSession( + "Loaded Skin", + "Loaded Skin from C:\\Users\\Public\\Documents\\Skin.whoa", + InfoboxTemplate.ButtonType.Ok); + } + + private void button6_Click(object sender, EventArgs e) + { + ModifyData( + Color.FromArgb(15, 29, 45), + Color.FromArgb(15, 29, 78), + Color.FromArgb(15, 29, 100), + Color.FromArgb(15, 29, 130), + Color.FromArgb(15, 29, 108), + Color.FromArgb(15, 29, 130), + Color.FromArgb(15, 29, 160)); + ApplySkin(); + } + + private void shiftButton1_Click(object sender, EventArgs e) + { + MessageBox.Show("This was clicked."); + } + + private void shiftButton2_Click(object sender, EventArgs e) + { + + } + public static Bitmap LoadImage(byte[] byteArray) + { + var bm = (Bitmap)imageConverter.ConvertFrom(byteArray); + + if (bm != null && (bm.HorizontalResolution != (int)bm.HorizontalResolution || + bm.VerticalResolution != (int)bm.VerticalResolution)) + { + bm.SetResolution((int)(bm.HorizontalResolution + 0.5f), + (int)(bm.VerticalResolution + 0.5f)); + } + return bm; + } + } +}
\ No newline at end of file diff --git a/ShiftOS.Main/Apps/ShifterStuff/Shifter.resx b/ShiftOS.Main/Apps/ShifterStuff/Shifter.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.Main/Apps/ShifterStuff/Shifter.resx @@ -0,0 +1,120 @@ +<?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> +</root>
\ No newline at end of file diff --git a/ShiftOS.Main/Apps/Terminal.Designer.cs b/ShiftOS.Main/Apps/Terminal.Designer.cs new file mode 100644 index 0000000..2ad4398 --- /dev/null +++ b/ShiftOS.Main/Apps/Terminal.Designer.cs @@ -0,0 +1,66 @@ +namespace ShiftOS.Main.Apps +{ + partial class Terminal + { + /// <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 Component 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.termmain = new System.Windows.Forms.RichTextBox(); + this.SuspendLayout(); + // + // termmain + // + this.termmain.BackColor = System.Drawing.Color.Black; + this.termmain.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.termmain.Dock = System.Windows.Forms.DockStyle.Fill; + this.termmain.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.termmain.ForeColor = System.Drawing.Color.White; + this.termmain.Location = new System.Drawing.Point(0, 0); + this.termmain.Name = "termmain"; + this.termmain.Size = new System.Drawing.Size(476, 394); + this.termmain.TabIndex = 0; + this.termmain.Text = ""; + this.termmain.SelectionChanged += new System.EventHandler(this.termmain_SelectionChanged); + this.termmain.TextChanged += new System.EventHandler(this.termmain_TextChanged); + this.termmain.KeyDown += new System.Windows.Forms.KeyEventHandler(this.termmain_KeyDown); + // + // Terminal + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.termmain); + this.Name = "Terminal"; + this.Size = new System.Drawing.Size(476, 394); + this.Load += new System.EventHandler(this.Terminal_Load); + this.ResumeLayout(false); + + } + + #endregion + + public System.Windows.Forms.RichTextBox termmain; + } +} diff --git a/ShiftOS.Main/Apps/Terminal.cs b/ShiftOS.Main/Apps/Terminal.cs new file mode 100644 index 0000000..6a76d19 --- /dev/null +++ b/ShiftOS.Main/Apps/Terminal.cs @@ -0,0 +1,172 @@ +using System; +using System.Windows.Forms; +using ShiftOS.Engine; +using ShiftOS.Main.Terminal; +using System.Linq; +using System.Collections.Generic; +using System.Drawing.Text; +using System.IO; +using ShiftOS.Main.Properties; +using Whoa; + +namespace ShiftOS.Main.Apps +{ + public partial class Terminal : UserControl + { + public int TerminalID = TerminalBackend.trmTopID++; // Used so that we can have multiple instances of the terminal whilst the command begin run knowing what terminal to send the text to - very complicated ;) + public string defaulttextBefore = "user> "; + public string defaulttextResult = "[user@shiftos ~]$ "; // NOT YET IMPLEMENTED!!! + public bool DoClear = false; + public bool RunningCommand = false; + public bool WaitingResponse = false; + public string InputReturnText = ""; + public Stack<string> c = TerminalBackend.commandBuffer; + private PrivateFontCollection fontCollection = new PrivateFontCollection(); + + + // The below variables makes the terminal... a terminal! + string OldText = ""; + + int TrackingPosition; + + public Terminal() + { + InitializeComponent(); + + termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox! + + TerminalBackend.trm.Add(this); + + + Setup(); + } + + void Print() + { + termmain.AppendText($"\n {defaulttextResult}"); + TrackingPosition = termmain.Text.Length; + } + + void Print(string text) + { + termmain.AppendText($"\n {text} \n {defaulttextResult}"); + TrackingPosition = termmain.Text.Length; + } + + //if (e.Control && e.KeyCode == Keys.V) + // { + // //if (Clipboard.ContainsText()) + // // termmain.Paste(DataFormats.GetFormat(DataFormats.Text)); + // e.Handled = true; + // } else if (e.KeyCode == Keys.Enter) { + // RunningCommand = true; + // TerminalBackend.RunCommand(termmain.Text.Substring(TrackingPosition, termmain.Text.Length - TrackingPosition), TerminalID); // The most horrific line in the entire application! + // RunningCommand = false; + // termmain.AppendText($"\n {defaulttextResult}"); + // TrackingPosition = termmain.Text.Length; + // e.Handled = true; + // } + //} + + private void termmain_TextChanged(object sender, EventArgs e) + { + if (!RunningCommand) + { + if (termmain.SelectionStart < TrackingPosition) + { + if (!DoClear) // If it's not clearing the terminal + { + termmain.Text = OldText; + termmain.Select(termmain.Text.Length, 0); + } + } + else + { + OldText = termmain.Text; + } + } + } + + private void termmain_SelectionChanged(object sender, EventArgs e) + { + if (!RunningCommand) + { + if (termmain.SelectionStart < TrackingPosition) + { + termmain.Text = OldText; + termmain.Select(termmain.Text.Length, 0); + } + } + } + + private void Terminal_Load(object sender, EventArgs e) + { + termmain.Text = $"\n {defaulttextResult}"; + TrackingPosition = termmain.Text.Length; + termmain.Select(termmain.TextLength, 1); + } + + public void Input(string request) + { + InputReturnText = ""; + RunningCommand = false; + + termmain.AppendText($"\n {request} "); + TrackingPosition = termmain.Text.Length; + } + + public void Clear() + { + DoClear = true; + OldText = ""; + termmain.Text = ""; + TrackingPosition = termmain.Text.Length; + DoClear = false; + } + + void termmain_KeyDown(object sender, KeyEventArgs e) + { + // The below code disables the ability to paste anything other then text... + + if (e.Control && e.KeyCode == Keys.V) + { + //if (Clipboard.ContainsText()) + // termmain.Paste(DataFormats.GetFormat(DataFormats.Text)); + e.Handled = true; + } + else if (e.KeyCode == Keys.Enter) + { + TerminalBackend.RunCommand(termmain.Text.Substring(TrackingPosition, termmain.Text.Length - TrackingPosition), TerminalID); // The most horrific line in the entire application! + Print(); + e.Handled = true; + } + else if (e.KeyCode == Keys.Up) + { + if (c.Count == 0) return; + termmain.AppendText(c.Pop()); + } + } + public void Setup() + { + if (!Directory.Exists(SaveSystem.gameDir)) Directory.CreateDirectory(SaveSystem.gameDir); + if (!Directory.Exists(SaveSystem.fontDir)) Directory.CreateDirectory(SaveSystem.fontDir); + if (!Directory.Exists(SaveSystem.dataDir)) Directory.CreateDirectory(SaveSystem.dataDir); + if (!File.Exists(SaveSystem.fontDir + "\\termFont.ttf")) File.WriteAllBytes(SaveSystem.fontDir + "\\termFont.ttf", Resources.UbuntuMono_R); + if (!File.Exists(SaveSystem.dataDir + "\\userCodePoints.whoa")) + { + using (var fobj = File.OpenWrite(SaveSystem.dataDir + "\\userCodePoints.whoa")) + { + Whoa.Whoa.SerialiseObject(fobj, SaveSystem.User.codePoints); + } + } + if (!Directory.Exists(SaveSystem.baseGameDir)) Directory.CreateDirectory(SaveSystem.baseGameDir); + if (!Directory.Exists(SaveSystem.desktopDir)) Directory.CreateDirectory(SaveSystem.desktopDir); + if (!Directory.Exists(SaveSystem.docDir)) Directory.CreateDirectory(SaveSystem.docDir); + if (!Directory.Exists(SaveSystem.downloadsDir)) Directory.CreateDirectory(SaveSystem.downloadsDir); + if (!Directory.Exists(SaveSystem.musicDir)) Directory.CreateDirectory(SaveSystem.musicDir); + if (!Directory.Exists(SaveSystem.picDir)) Directory.CreateDirectory(SaveSystem.picDir); + fontCollection.AddFontFile(SaveSystem.fontDir + "\\termFont.ttf"); + termmain.Font = new System.Drawing.Font(fontCollection.Families[0], 12F, System.Drawing.FontStyle.Regular); + } + } +}
\ No newline at end of file diff --git a/ShiftOS.Main/Apps/Terminal.resx b/ShiftOS.Main/Apps/Terminal.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.Main/Apps/Terminal.resx @@ -0,0 +1,120 @@ +<?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> +</root>
\ No newline at end of file diff --git a/ShiftOS.Main/Apps/TestForm.Designer.cs b/ShiftOS.Main/Apps/TestForm.Designer.cs new file mode 100644 index 0000000..b49924e --- /dev/null +++ b/ShiftOS.Main/Apps/TestForm.Designer.cs @@ -0,0 +1,132 @@ +namespace ShiftOS.Main.ShiftOS.Apps +{ + partial class TestForm + { + /// <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.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.systemIconsBindingSource = new System.Windows.Forms.BindingSource(this.components); + ((System.ComponentModel.ISupportInitialize)(this.systemIconsBindingSource)).BeginInit(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(18, 20); + this.textBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(388, 26); + this.textBox1.TabIndex = 0; + this.textBox1.Text = "Title"; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(18, 60); + this.textBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(388, 26); + this.textBox2.TabIndex = 1; + this.textBox2.Text = "Contents"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(13, 149); + this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(192, 35); + this.button1.TabIndex = 2; + this.button1.Text = "Create Window"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.Button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(217, 149); + this.button2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(189, 35); + this.button2.TabIndex = 4; + this.button2.Text = "Test Shifter"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "Application", + "Asterisk", + "Error", + "Exclamation", + "Hand", + "Information", + "Question", + "Shield", + "Warning", + "WinLogo"}); + this.comboBox1.Location = new System.Drawing.Point(18, 104); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(388, 28); + this.comboBox1.TabIndex = 5; + // + // systemIconsBindingSource + // + this.systemIconsBindingSource.DataSource = typeof(System.Drawing.SystemIcons); + // + // TestForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(426, 198); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.Name = "TestForm"; + this.Text = "TestForm"; + ((System.ComponentModel.ISupportInitialize)(this.systemIconsBindingSource)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.BindingSource systemIconsBindingSource; + } +}
\ No newline at end of file diff --git a/ShiftOS.Main/Apps/TestForm.cs b/ShiftOS.Main/Apps/TestForm.cs new file mode 100644 index 0000000..a0c12c0 --- /dev/null +++ b/ShiftOS.Main/Apps/TestForm.cs @@ -0,0 +1,27 @@ +using System; +using System.Windows.Forms; +using ShiftOS.Engine.Misc; +using ShiftOS.Engine.WindowManager; +using ShiftOS.Main.Properties; +using ShiftOS.Main.ShiftOS.Apps.ShifterStuff; + +namespace ShiftOS.Main.ShiftOS.Apps +{ + public partial class TestForm : Form + { + public TestForm() + { + InitializeComponent(); + } + + void Button1_Click(object sender, EventArgs e) + { + var demo = new ShiftDemo(); + ShiftWM.Init(demo, textBox1.Text, null); + ShiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok); + } + + void button2_Click(object sender, EventArgs e) + => ShiftWM.Init(new Shifter(), "Shifter", Resources.iconShifter); + } +}
\ No newline at end of file diff --git a/ShiftOS.Main/Apps/TestForm.resx b/ShiftOS.Main/Apps/TestForm.resx new file mode 100644 index 0000000..6dba9d3 --- /dev/null +++ b/ShiftOS.Main/Apps/TestForm.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="systemIconsBindingSource.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/ShiftOS.Main/Apps/TextPad.Designer.cs b/ShiftOS.Main/Apps/TextPad.Designer.cs new file mode 100644 index 0000000..3842fbf --- /dev/null +++ b/ShiftOS.Main/Apps/TextPad.Designer.cs @@ -0,0 +1,215 @@ +namespace ShiftOS.Main.Apps +{ + partial class TextPad + { + /// <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 Component 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.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.fontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.wordWrapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.insertToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.timeAndDateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.textBox = new System.Windows.Forms.RichTextBox(); + this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); + this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); + this.menuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.editToolStripMenuItem, + this.insertToolStripMenuItem, + this.helpToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(315, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.newToolStripMenuItem, + this.openToolStripMenuItem, + this.saveToolStripMenuItem, + this.saveAsToolStripMenuItem, + this.toolStripMenuItem1, + this.exitToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + // + // newToolStripMenuItem + // + this.newToolStripMenuItem.Name = "newToolStripMenuItem"; + this.newToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.newToolStripMenuItem.Text = "New..."; + this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click); + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.openToolStripMenuItem.Text = "Open..."; + this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.saveToolStripMenuItem.Text = "Save..."; + // + // saveAsToolStripMenuItem + // + this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; + this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.saveAsToolStripMenuItem.Text = "Save As..."; + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6); + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.exitToolStripMenuItem.Text = "Exit"; + // + // editToolStripMenuItem + // + this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fontToolStripMenuItem, + this.wordWrapToolStripMenuItem}); + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); + this.editToolStripMenuItem.Text = "Edit"; + // + // fontToolStripMenuItem + // + this.fontToolStripMenuItem.Name = "fontToolStripMenuItem"; + this.fontToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.fontToolStripMenuItem.Text = "Font"; + // + // wordWrapToolStripMenuItem + // + this.wordWrapToolStripMenuItem.Checked = true; + this.wordWrapToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.wordWrapToolStripMenuItem.Name = "wordWrapToolStripMenuItem"; + this.wordWrapToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.wordWrapToolStripMenuItem.Text = "Word Wrap"; + // + // insertToolStripMenuItem + // + this.insertToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.timeAndDateToolStripMenuItem}); + this.insertToolStripMenuItem.Name = "insertToolStripMenuItem"; + this.insertToolStripMenuItem.Size = new System.Drawing.Size(48, 20); + this.insertToolStripMenuItem.Text = "Insert"; + // + // timeAndDateToolStripMenuItem + // + this.timeAndDateToolStripMenuItem.Name = "timeAndDateToolStripMenuItem"; + this.timeAndDateToolStripMenuItem.Size = new System.Drawing.Size(160, 22); + this.timeAndDateToolStripMenuItem.Text = "Time and Date..."; + // + // helpToolStripMenuItem + // + this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.aboutToolStripMenuItem}); + this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; + this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.helpToolStripMenuItem.Text = "Help"; + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.aboutToolStripMenuItem.Text = "About..."; + // + // textBox + // + this.textBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox.Location = new System.Drawing.Point(0, 24); + this.textBox.Name = "textBox"; + this.textBox.Size = new System.Drawing.Size(315, 265); + this.textBox.TabIndex = 1; + this.textBox.Text = ""; + // + // openFileDialog1 + // + this.openFileDialog1.FileName = "openFileDialog1"; + // + // TextPad + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.textBox); + this.Controls.Add(this.menuStrip1); + this.Name = "TextPad"; + this.Size = new System.Drawing.Size(315, 289); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem fontToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem wordWrapToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem insertToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem timeAndDateToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; + private System.Windows.Forms.RichTextBox textBox; + private System.Windows.Forms.OpenFileDialog openFileDialog1; + private System.Windows.Forms.SaveFileDialog saveFileDialog1; + } +} diff --git a/ShiftOS.Main/Apps/TextPad.cs b/ShiftOS.Main/Apps/TextPad.cs new file mode 100644 index 0000000..ee4a379 --- /dev/null +++ b/ShiftOS.Main/Apps/TextPad.cs @@ -0,0 +1,40 @@ +using ShiftOS.Engine.ShiftFS.FileGUI; +using ShiftOS.Engine.WindowManager; +using System; +using System.IO; +using System.Windows.Forms; + +namespace ShiftOS.Main.Apps +{ + public partial class TextPad : UserControl + { + readonly string _editedText; + + public TextPad() + { + InitializeComponent(); + _editedText = textBox.Text; + } + + bool IsEdited() => _editedText != textBox.Text; + + void openToolStripMenuItem_Click(object sender, EventArgs e) + { + if (openFileDialog1.ShowDialog() != DialogResult.OK) return; + + var sr = new StreamReader(openFileDialog1.FileName); + textBox.Text = sr.ReadToEnd(); + sr.Close(); + } + + void newToolStripMenuItem_Click(object sender, EventArgs e) + { + if (IsEdited()) + { + MessageBox.Show("yay it works"); + } + var f = new FileOpener(); + ShiftWM.Init(f, "testing", null); + } + } +}
\ No newline at end of file diff --git a/ShiftOS.Main/Apps/TextPad.resx b/ShiftOS.Main/Apps/TextPad.resx new file mode 100644 index 0000000..53f75e1 --- /dev/null +++ b/ShiftOS.Main/Apps/TextPad.resx @@ -0,0 +1,129 @@ +<?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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>153, 17</value> + </metadata> + <metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>268, 17</value> + </metadata> + <metadata name="saveFileDialog1.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 |
