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/ShifterStuff | |
| 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/ShifterStuff')
| -rw-r--r-- | ShiftOS.Main/Apps/ShifterStuff/SelectColor.Designer.cs | 150 | ||||
| -rw-r--r-- | ShiftOS.Main/Apps/ShifterStuff/SelectColor.cs | 63 | ||||
| -rw-r--r-- | ShiftOS.Main/Apps/ShifterStuff/SelectColor.resx | 120 | ||||
| -rw-r--r-- | ShiftOS.Main/Apps/ShifterStuff/Shifter.Designer.cs | 281 | ||||
| -rw-r--r-- | ShiftOS.Main/Apps/ShifterStuff/Shifter.cs | 227 | ||||
| -rw-r--r-- | ShiftOS.Main/Apps/ShifterStuff/Shifter.resx | 120 |
6 files changed, 961 insertions, 0 deletions
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 |
