From dc7533184a88271bfd2a3aae299532ec7632144d Mon Sep 17 00:00:00 2001 From: FloppyDiskDrive Date: Mon, 25 Sep 2017 17:49:40 -0500 Subject: Added titlebar button hughlighting / pushing --- .vs/ShiftOS/v15/sqlite3/storage.ide | Bin 3395584 -> 3395584 bytes .../WindowManager/InfoboxTemplate.Designer.cs | 26 +++++++++++------- ShiftOS.Engine/WindowManager/InfoboxTemplate.cs | 9 ++++++- ShiftOS.Engine/WindowManager/InfoboxTemplate.resx | 3 +++ .../WindowManager/ShiftWindow.Designer.cs | 12 ++++++--- ShiftOS.Engine/WindowManager/ShiftWindow.cs | 30 +++++++++++++++++++++ .../ShiftOS/Apps/ShifterStuff/SelectColor.cs | 6 ++--- ShiftOS.Main/ShiftOS/Apps/TestForm.cs | 3 +-- 8 files changed, 70 insertions(+), 19 deletions(-) diff --git a/.vs/ShiftOS/v15/sqlite3/storage.ide b/.vs/ShiftOS/v15/sqlite3/storage.ide index 1d1331f..232bc17 100644 Binary files a/.vs/ShiftOS/v15/sqlite3/storage.ide and b/.vs/ShiftOS/v15/sqlite3/storage.ide differ diff --git a/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs b/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs index 6b18e5f..a046516 100644 --- a/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs +++ b/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs @@ -28,10 +28,12 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.btnOpt1 = new System.Windows.Forms.Button(); this.btnOpt2 = new System.Windows.Forms.Button(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.label1 = new System.Windows.Forms.Label(); + this.changeSize = new System.Windows.Forms.Timer(this.components); + this.label1 = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -75,18 +77,21 @@ this.pictureBox1.TabIndex = 2; this.pictureBox1.TabStop = false; // + // changeSize + // + this.changeSize.Interval = 1; + this.changeSize.Tick += new System.EventHandler(this.changeSize_Tick); + // // label1 // - this.label1.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.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Lucida Console", 9.25F); - this.label1.Location = new System.Drawing.Point(106, 57); + this.label1.BackColor = System.Drawing.SystemColors.Window; + this.label1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.label1.Font = new System.Drawing.Font("Lucida Console", 9F); + this.label1.Location = new System.Drawing.Point(111, 61); + this.label1.Multiline = true; this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(103, 13); + this.label1.Size = new System.Drawing.Size(219, 57); this.label1.TabIndex = 3; - this.label1.Text = "Generic Body"; // // InfoboxTemplate // @@ -110,6 +115,7 @@ public System.Windows.Forms.Button btnOpt1; public System.Windows.Forms.Button btnOpt2; public System.Windows.Forms.PictureBox pictureBox1; - public System.Windows.Forms.Label label1; + private System.Windows.Forms.Timer changeSize; + public System.Windows.Forms.TextBox label1; } } diff --git a/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs b/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs index f261ace..c1921a6 100644 --- a/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs +++ b/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs @@ -20,12 +20,13 @@ namespace ShiftOS.Engine.WindowManager public InfoboxTemplate(buttonType type) { InitializeComponent(); + switch (type) { case buttonType.OK: btnOpt1.Text = "OK"; btnOpt2.Hide(); - btnOpt1.Location = new Point(122, 134); + btnOpt1.Location = new Point(109, 134); buttonChoice = 1; break; case buttonType.OKCancel: @@ -86,5 +87,11 @@ namespace ShiftOS.Engine.WindowManager { Play(); } + + private void changeSize_Tick(object sender, EventArgs e) + { + this.Height += label1.Height; + this.Width += label1.Width; + } } } diff --git a/ShiftOS.Engine/WindowManager/InfoboxTemplate.resx b/ShiftOS.Engine/WindowManager/InfoboxTemplate.resx index 1af7de1..a977bee 100644 --- a/ShiftOS.Engine/WindowManager/InfoboxTemplate.resx +++ b/ShiftOS.Engine/WindowManager/InfoboxTemplate.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/ShiftOS.Engine/WindowManager/ShiftWindow.Designer.cs b/ShiftOS.Engine/WindowManager/ShiftWindow.Designer.cs index c26e724..f7443d6 100644 --- a/ShiftOS.Engine/WindowManager/ShiftWindow.Designer.cs +++ b/ShiftOS.Engine/WindowManager/ShiftWindow.Designer.cs @@ -155,25 +155,29 @@ // this.maximizebutton.Anchor = System.Windows.Forms.AnchorStyles.Right; this.maximizebutton.BackColor = System.Drawing.Color.Black; - this.maximizebutton.Location = new System.Drawing.Point(231, 4); + this.maximizebutton.Location = new System.Drawing.Point(230, 4); this.maximizebutton.Name = "maximizebutton"; this.maximizebutton.Size = new System.Drawing.Size(21, 21); this.maximizebutton.TabIndex = 6; this.maximizebutton.TabStop = false; + this.maximizebutton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.maximizebutton_MouseDown); this.maximizebutton.MouseEnter += new System.EventHandler(this.maximizebutton_MouseEnter); this.maximizebutton.MouseLeave += new System.EventHandler(this.maximizebutton_MouseLeave); + this.maximizebutton.MouseUp += new System.Windows.Forms.MouseEventHandler(this.maximizebutton_MouseUp); // // minimizebutton // this.minimizebutton.Anchor = System.Windows.Forms.AnchorStyles.Right; this.minimizebutton.BackColor = System.Drawing.Color.Black; - this.minimizebutton.Location = new System.Drawing.Point(208, 4); + this.minimizebutton.Location = new System.Drawing.Point(207, 4); this.minimizebutton.Name = "minimizebutton"; this.minimizebutton.Size = new System.Drawing.Size(21, 21); this.minimizebutton.TabIndex = 5; this.minimizebutton.TabStop = false; + this.minimizebutton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.minimizebutton_MouseDown); this.minimizebutton.MouseEnter += new System.EventHandler(this.minimizebutton_MouseEnter); this.minimizebutton.MouseLeave += new System.EventHandler(this.minimizebutton_MouseLeave); + this.minimizebutton.MouseUp += new System.Windows.Forms.MouseEventHandler(this.minimizebutton_MouseUp); // // Title // @@ -192,14 +196,16 @@ // this.closebutton.Anchor = System.Windows.Forms.AnchorStyles.Right; this.closebutton.BackColor = System.Drawing.Color.Black; - this.closebutton.Location = new System.Drawing.Point(254, 4); + this.closebutton.Location = new System.Drawing.Point(253, 4); this.closebutton.Name = "closebutton"; this.closebutton.Size = new System.Drawing.Size(21, 21); this.closebutton.TabIndex = 4; this.closebutton.TabStop = false; this.closebutton.Click += new System.EventHandler(this.closebutton_Click); + this.closebutton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.closebutton_MouseDown); this.closebutton.MouseEnter += new System.EventHandler(this.closebutton_MouseEnter); this.closebutton.MouseLeave += new System.EventHandler(this.closebutton_MouseLeave); + this.closebutton.MouseUp += new System.Windows.Forms.MouseEventHandler(this.closebutton_MouseUp); // // right // diff --git a/ShiftOS.Engine/WindowManager/ShiftWindow.cs b/ShiftOS.Engine/WindowManager/ShiftWindow.cs index a004aa6..45aec7c 100644 --- a/ShiftOS.Engine/WindowManager/ShiftWindow.cs +++ b/ShiftOS.Engine/WindowManager/ShiftWindow.cs @@ -69,5 +69,35 @@ namespace ShiftOS.Engine.WindowManager { minimizebutton.BackColor = Color.Black; } + + private void closebutton_MouseDown(object sender, MouseEventArgs e) + { + closebutton.BackColor = Color.Black; + } + + private void maximizebutton_MouseDown(object sender, MouseEventArgs e) + { + maximizebutton.BackColor = Color.Black; + } + + private void minimizebutton_MouseDown(object sender, MouseEventArgs e) + { + minimizebutton.BackColor = Color.Black; + } + + private void minimizebutton_MouseUp(object sender, MouseEventArgs e) + { + minimizebutton.BackColor = Color.Gray; + } + + private void maximizebutton_MouseUp(object sender, MouseEventArgs e) + { + maximizebutton.BackColor = Color.Gray; + } + + private void closebutton_MouseUp(object sender, MouseEventArgs e) + { + closebutton.BackColor = Color.Gray; + } } } diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs index 175d1cb..9062947 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs @@ -32,9 +32,9 @@ namespace ShiftOS.Main.ShiftOS.Apps colorType2 = Convert.ToInt32(textBox2.Text); colorType3 = Convert.ToInt32(textBox3.Text); } - catch + catch(Exception ex) { - shiftWM.StartInfoboxSession("Error!", "Cannot parse a string.", InfoboxTemplate.buttonType.OK); + shiftWM.StartInfoboxSession("Error!", "Failed to parse integer. Error:\n" + ex, InfoboxTemplate.buttonType.OK); } if (colorType1 > 255 || colorType2 > 255 || colorType3 > 255) @@ -52,7 +52,7 @@ namespace ShiftOS.Main.ShiftOS.Apps } catch (Exception ex) { - shiftWM.StartInfoboxSession("Error!", "An exception occured while setting the color! Exception: \n" + ex, InfoboxTemplate.buttonType.OK); + shiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.buttonType.OK); } } } diff --git a/ShiftOS.Main/ShiftOS/Apps/TestForm.cs b/ShiftOS.Main/ShiftOS/Apps/TestForm.cs index c8cd086..e2b5bf7 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TestForm.cs +++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.cs @@ -24,7 +24,6 @@ namespace ShiftOS.Main private void button2_Click(object sender, EventArgs e) { - shiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter); - } + shiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter); } } } -- cgit v1.2.3 From 9c24aebd302435b9993dd495cea5898cd5872867 Mon Sep 17 00:00:00 2001 From: FloppyDiskDrive Date: Tue, 26 Sep 2017 19:09:21 -0500 Subject: Began work on a crappy Skinning Engine; Shifter is removed until completed. --- .vs/ShiftOS/v15/sqlite3/storage.ide | Bin 3395584 -> 3399680 bytes ShiftOS.Engine/ShiftOS.Engine.csproj | 1 + ShiftOS.Engine/SkinningEngine.cs | 24 ++++ ShiftOS.Main/ShiftOS.Main.csproj | 18 --- .../Apps/ShifterStuff/SelectColor.Designer.cs | 128 --------------------- .../ShiftOS/Apps/ShifterStuff/SelectColor.cs | 60 ---------- .../ShiftOS/Apps/ShifterStuff/SelectColor.resx | 120 ------------------- .../ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs | 119 ------------------- ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs | 29 ----- .../ShiftOS/Apps/ShifterStuff/Shifter.resx | 120 ------------------- 10 files changed, 25 insertions(+), 594 deletions(-) create mode 100644 ShiftOS.Engine/SkinningEngine.cs delete mode 100644 ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs delete mode 100644 ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs delete mode 100644 ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.resx delete mode 100644 ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs delete mode 100644 ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs delete mode 100644 ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.resx diff --git a/.vs/ShiftOS/v15/sqlite3/storage.ide b/.vs/ShiftOS/v15/sqlite3/storage.ide index 232bc17..31873c6 100644 Binary files a/.vs/ShiftOS/v15/sqlite3/storage.ide and b/.vs/ShiftOS/v15/sqlite3/storage.ide differ diff --git a/ShiftOS.Engine/ShiftOS.Engine.csproj b/ShiftOS.Engine/ShiftOS.Engine.csproj index 8683d20..ad5696a 100644 --- a/ShiftOS.Engine/ShiftOS.Engine.csproj +++ b/ShiftOS.Engine/ShiftOS.Engine.csproj @@ -48,6 +48,7 @@ True Resources.resx + UserControl diff --git a/ShiftOS.Engine/SkinningEngine.cs b/ShiftOS.Engine/SkinningEngine.cs new file mode 100644 index 0000000..b94069d --- /dev/null +++ b/ShiftOS.Engine/SkinningEngine.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine.WindowManager; +using System.Drawing; + +namespace ShiftOS.Engine +{ + public static class SkinningEngine + { + static ShiftWindow shiftWindow = new ShiftWindow(); + public static void SetTitleBarColor(Color selectedColor) + { + shiftWindow.top.BackColor = selectedColor; + } + public static void SetBackColor(Color selectedColor) + { + shiftWindow.programContent.BackColor = selectedColor; + } + } +} diff --git a/ShiftOS.Main/ShiftOS.Main.csproj b/ShiftOS.Main/ShiftOS.Main.csproj index 18e842f..77bf889 100644 --- a/ShiftOS.Main/ShiftOS.Main.csproj +++ b/ShiftOS.Main/ShiftOS.Main.csproj @@ -52,24 +52,12 @@ - - UserControl - - - SelectColor.cs - UserControl ShiftDemo.cs - - UserControl - - - Shifter.cs - Form @@ -89,15 +77,9 @@ Resources.resx True - - SelectColor.cs - ShiftDemo.cs - - Shifter.cs - TestForm.cs diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs deleted file mode 100644 index e305651..0000000 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs +++ /dev/null @@ -1,128 +0,0 @@ -namespace ShiftOS.Main.ShiftOS.Apps -{ - partial class SelectColor - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.textBox3 = new System.Windows.Forms.TextBox(); - this.btnSetColor = new System.Windows.Forms.Button(); - 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:"; - // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(75, 27); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(206, 20); - this.textBox1.TabIndex = 3; - // - // textBox2 - // - this.textBox2.Location = new System.Drawing.Point(75, 58); - this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(206, 20); - this.textBox2.TabIndex = 4; - // - // textBox3 - // - this.textBox3.Location = new System.Drawing.Point(75, 88); - this.textBox3.Name = "textBox3"; - this.textBox3.Size = new System.Drawing.Size(206, 20); - this.textBox3.TabIndex = 5; - // - // 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); - // - // SelectColor - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.btnSetColor); - this.Controls.Add(this.textBox3); - this.Controls.Add(this.textBox2); - this.Controls.Add(this.textBox1); - 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.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.TextBox textBox1; - private System.Windows.Forms.TextBox textBox2; - private System.Windows.Forms.TextBox textBox3; - private System.Windows.Forms.Button btnSetColor; - } -} diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs deleted file mode 100644 index 9062947..0000000 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs +++ /dev/null @@ -1,60 +0,0 @@ -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; -using ShiftOS.Engine.WindowManager; - -namespace ShiftOS.Main.ShiftOS.Apps -{ - public partial class SelectColor : UserControl - { - ShiftWM shiftWM = new ShiftWM(); - Color finalColor; - int colorType1; - int colorType2; - int colorType3; - public SelectColor() - { - InitializeComponent(); - - } - - private void btnSetColor_Click(object sender, EventArgs e) - { - try - { - colorType1 = Convert.ToInt32(textBox1.Text); - colorType2 = Convert.ToInt32(textBox2.Text); - colorType3 = Convert.ToInt32(textBox3.Text); - } - catch(Exception ex) - { - shiftWM.StartInfoboxSession("Error!", "Failed to parse integer. Error:\n" + ex, InfoboxTemplate.buttonType.OK); - } - - if (colorType1 > 255 || colorType2 > 255 || colorType3 > 255) - { - shiftWM.StartInfoboxSession("Error!", "A value cannot be greater than 255!", InfoboxTemplate.buttonType.OK); - } - else - { - try - { - ShiftWindow sw = new ShiftWindow(); - finalColor = Color.FromArgb(colorType1, colorType2, colorType3); - this.BackColor = finalColor; - shiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + colorType1.ToString() + ", " + colorType2.ToString() + ", " + colorType3.ToString() + ".", InfoboxTemplate.buttonType.OK); - } - catch (Exception ex) - { - shiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.buttonType.OK); - } - } - } - } -} diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.resx b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.resx deleted file mode 100644 index 1af7de1..0000000 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs deleted file mode 100644 index a89dca4..0000000 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs +++ /dev/null @@ -1,119 +0,0 @@ -namespace ShiftOS.Main.ShiftOS.Apps -{ - partial class Shifter - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - 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.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; - // - // 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; - } -} diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs deleted file mode 100644 index 74b2079..0000000 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs +++ /dev/null @@ -1,29 +0,0 @@ -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; -using ShiftOS.Engine.WindowManager; - -namespace ShiftOS.Main.ShiftOS.Apps -{ - public partial class Shifter : UserControl - { - public int colorType; //This is a check to see what option was chosen. - ShiftWM wm = new ShiftWM(); - public Shifter() - { - InitializeComponent(); - } - - private void button1_Click(object sender, EventArgs e) - { - colorType = 1; - wm.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw); - } - } -} diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.resx b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.resx deleted file mode 100644 index 1af7de1..0000000 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file -- cgit v1.2.3 From 92d7a143ca9681fa63ff2bcebdf9a9470ceb18b4 Mon Sep 17 00:00:00 2001 From: FloppyDiskDrive Date: Wed, 27 Sep 2017 17:12:44 -0500 Subject: Revert "Began work on a crappy Skinning Engine; Shifter is removed until completed." This reverts commit 9c24aebd302435b9993dd495cea5898cd5872867. --- .vs/ShiftOS/v15/sqlite3/storage.ide | Bin 3399680 -> 3395584 bytes ShiftOS.Engine/ShiftOS.Engine.csproj | 1 - ShiftOS.Engine/SkinningEngine.cs | 24 ---- ShiftOS.Main/ShiftOS.Main.csproj | 18 +++ .../Apps/ShifterStuff/SelectColor.Designer.cs | 128 +++++++++++++++++++++ .../ShiftOS/Apps/ShifterStuff/SelectColor.cs | 60 ++++++++++ .../ShiftOS/Apps/ShifterStuff/SelectColor.resx | 120 +++++++++++++++++++ .../ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs | 119 +++++++++++++++++++ ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs | 29 +++++ .../ShiftOS/Apps/ShifterStuff/Shifter.resx | 120 +++++++++++++++++++ 10 files changed, 594 insertions(+), 25 deletions(-) delete mode 100644 ShiftOS.Engine/SkinningEngine.cs create mode 100644 ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs create mode 100644 ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs create mode 100644 ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.resx create mode 100644 ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs create mode 100644 ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs create mode 100644 ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.resx diff --git a/.vs/ShiftOS/v15/sqlite3/storage.ide b/.vs/ShiftOS/v15/sqlite3/storage.ide index 31873c6..232bc17 100644 Binary files a/.vs/ShiftOS/v15/sqlite3/storage.ide and b/.vs/ShiftOS/v15/sqlite3/storage.ide differ diff --git a/ShiftOS.Engine/ShiftOS.Engine.csproj b/ShiftOS.Engine/ShiftOS.Engine.csproj index ad5696a..8683d20 100644 --- a/ShiftOS.Engine/ShiftOS.Engine.csproj +++ b/ShiftOS.Engine/ShiftOS.Engine.csproj @@ -48,7 +48,6 @@ True Resources.resx - UserControl diff --git a/ShiftOS.Engine/SkinningEngine.cs b/ShiftOS.Engine/SkinningEngine.cs deleted file mode 100644 index b94069d..0000000 --- a/ShiftOS.Engine/SkinningEngine.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ShiftOS.Engine.WindowManager; -using System.Drawing; - -namespace ShiftOS.Engine -{ - public static class SkinningEngine - { - static ShiftWindow shiftWindow = new ShiftWindow(); - public static void SetTitleBarColor(Color selectedColor) - { - shiftWindow.top.BackColor = selectedColor; - } - public static void SetBackColor(Color selectedColor) - { - shiftWindow.programContent.BackColor = selectedColor; - } - } -} diff --git a/ShiftOS.Main/ShiftOS.Main.csproj b/ShiftOS.Main/ShiftOS.Main.csproj index 77bf889..18e842f 100644 --- a/ShiftOS.Main/ShiftOS.Main.csproj +++ b/ShiftOS.Main/ShiftOS.Main.csproj @@ -52,12 +52,24 @@ + + UserControl + + + SelectColor.cs + UserControl ShiftDemo.cs + + UserControl + + + Shifter.cs + Form @@ -77,9 +89,15 @@ Resources.resx True + + SelectColor.cs + ShiftDemo.cs + + Shifter.cs + TestForm.cs diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs new file mode 100644 index 0000000..e305651 --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs @@ -0,0 +1,128 @@ +namespace ShiftOS.Main.ShiftOS.Apps +{ + partial class SelectColor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.btnSetColor = new System.Windows.Forms.Button(); + 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:"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(75, 27); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(206, 20); + this.textBox1.TabIndex = 3; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(75, 58); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(206, 20); + this.textBox2.TabIndex = 4; + // + // textBox3 + // + this.textBox3.Location = new System.Drawing.Point(75, 88); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(206, 20); + this.textBox3.TabIndex = 5; + // + // 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); + // + // SelectColor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.btnSetColor); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + 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.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.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Button btnSetColor; + } +} diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs new file mode 100644 index 0000000..9062947 --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs @@ -0,0 +1,60 @@ +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; +using ShiftOS.Engine.WindowManager; + +namespace ShiftOS.Main.ShiftOS.Apps +{ + public partial class SelectColor : UserControl + { + ShiftWM shiftWM = new ShiftWM(); + Color finalColor; + int colorType1; + int colorType2; + int colorType3; + public SelectColor() + { + InitializeComponent(); + + } + + private void btnSetColor_Click(object sender, EventArgs e) + { + try + { + colorType1 = Convert.ToInt32(textBox1.Text); + colorType2 = Convert.ToInt32(textBox2.Text); + colorType3 = Convert.ToInt32(textBox3.Text); + } + catch(Exception ex) + { + shiftWM.StartInfoboxSession("Error!", "Failed to parse integer. Error:\n" + ex, InfoboxTemplate.buttonType.OK); + } + + if (colorType1 > 255 || colorType2 > 255 || colorType3 > 255) + { + shiftWM.StartInfoboxSession("Error!", "A value cannot be greater than 255!", InfoboxTemplate.buttonType.OK); + } + else + { + try + { + ShiftWindow sw = new ShiftWindow(); + finalColor = Color.FromArgb(colorType1, colorType2, colorType3); + this.BackColor = finalColor; + shiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + colorType1.ToString() + ", " + colorType2.ToString() + ", " + colorType3.ToString() + ".", InfoboxTemplate.buttonType.OK); + } + catch (Exception ex) + { + shiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.buttonType.OK); + } + } + } + } +} diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.resx b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs new file mode 100644 index 0000000..a89dca4 --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs @@ -0,0 +1,119 @@ +namespace ShiftOS.Main.ShiftOS.Apps +{ + partial class Shifter + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + 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.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; + // + // 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; + } +} diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs new file mode 100644 index 0000000..74b2079 --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs @@ -0,0 +1,29 @@ +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; +using ShiftOS.Engine.WindowManager; + +namespace ShiftOS.Main.ShiftOS.Apps +{ + public partial class Shifter : UserControl + { + public int colorType; //This is a check to see what option was chosen. + ShiftWM wm = new ShiftWM(); + public Shifter() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + colorType = 1; + wm.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw); + } + } +} diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.resx b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file -- cgit v1.2.3 From a25baf08203237fc2eeeb4b7ca720f7d47f8a666 Mon Sep 17 00:00:00 2001 From: John T Date: Wed, 27 Sep 2017 18:32:16 -0400 Subject: added desktop and some small additions and changes to shiftwm --- .vs/ProjectSettings.json | 3 + .vs/ShiftOS/v15/sqlite3/storage.ide | Bin 3395584 -> 3678208 bytes .vs/VSWorkspaceState.json | 6 + .vs/slnx.sqlite | Bin 0 -> 638976 bytes ShiftOS.Engine/ShiftOS.Engine.csproj | 6 + ShiftOS.Engine/Tools.cs | 32 ++ ShiftOS.Engine/WindowManager/InfoboxTemplate.cs | 58 ++- ShiftOS.Engine/WindowManager/ShiftWM.cs | 82 +++- .../WindowManager/ShiftWindow.Designer.cs | 446 +++++++++++---------- ShiftOS.Engine/WindowManager/ShiftWindow.cs | 126 +++--- ShiftOS.Engine/packages.config | 4 + ShiftOS.Main/Program.cs | 8 +- ShiftOS.Main/ShiftOS.Main.csproj | 9 + ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs | 59 ++- ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs | 10 +- .../ShiftOS/Apps/ShifterStuff/SelectColor.cs | 39 +- ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs | 11 +- ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs | 148 ++++--- ShiftOS.Main/ShiftOS/Apps/TestForm.cs | 21 +- ShiftOS.Main/ShiftOS/Apps/TestForm.resx | 3 + ShiftOS.Main/ShiftOS/Desktop.Designer.cs | 111 +++++ ShiftOS.Main/ShiftOS/Desktop.cs | 61 +++ ShiftOS.Main/ShiftOS/Desktop.resx | 126 ++++++ 23 files changed, 910 insertions(+), 459 deletions(-) create mode 100644 .vs/ProjectSettings.json create mode 100644 .vs/VSWorkspaceState.json create mode 100644 .vs/slnx.sqlite create mode 100644 ShiftOS.Engine/Tools.cs create mode 100644 ShiftOS.Engine/packages.config create mode 100644 ShiftOS.Main/ShiftOS/Desktop.Designer.cs create mode 100644 ShiftOS.Main/ShiftOS/Desktop.cs create mode 100644 ShiftOS.Main/ShiftOS/Desktop.resx diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 0000000..f8b4888 --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": null +} \ No newline at end of file diff --git a/.vs/ShiftOS/v15/sqlite3/storage.ide b/.vs/ShiftOS/v15/sqlite3/storage.ide index 232bc17..a7bcbbb 100644 Binary files a/.vs/ShiftOS/v15/sqlite3/storage.ide and b/.vs/ShiftOS/v15/sqlite3/storage.ide differ diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..6b61141 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,6 @@ +{ + "ExpandedNodes": [ + "" + ], + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..135556a Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/ShiftOS.Engine/ShiftOS.Engine.csproj b/ShiftOS.Engine/ShiftOS.Engine.csproj index 8683d20..2b436c1 100644 --- a/ShiftOS.Engine/ShiftOS.Engine.csproj +++ b/ShiftOS.Engine/ShiftOS.Engine.csproj @@ -20,6 +20,7 @@ DEBUG;TRACE prompt 4 + true pdbonly @@ -30,6 +31,9 @@ 4 + + ..\packages\Magick.NET-Q16-AnyCPU.7.0.7.300\lib\net40\Magick.NET-Q16-AnyCPU.dll + @@ -48,6 +52,7 @@ True Resources.resx + UserControl @@ -75,6 +80,7 @@ + diff --git a/ShiftOS.Engine/Tools.cs b/ShiftOS.Engine/Tools.cs new file mode 100644 index 0000000..eca7b59 --- /dev/null +++ b/ShiftOS.Engine/Tools.cs @@ -0,0 +1,32 @@ +using System; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Runtime.InteropServices; +using ImageMagick; + +namespace ShiftOS.Engine +{ + /// + /// Random class full of unassorted [but also uncategorizable] tools. + /// + public static class Tools + { + public static Random Rnd = new Random(); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + public extern static bool DestroyIcon(IntPtr handle); + + public static Icon ToIcon(this Bitmap bm) + { + Icon tempicon = Icon.FromHandle(bm.GetHicon()); + + Icon newIcon = tempicon.Clone() as Icon; + + //for some reason this exists + DestroyIcon(tempicon.Handle); + + return newIcon; + } + } +} diff --git a/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs b/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs index c1921a6..a5be129 100644 --- a/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs +++ b/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs @@ -1,11 +1,5 @@ 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; using System.Media; using System.IO; @@ -14,38 +8,39 @@ namespace ShiftOS.Engine.WindowManager { public partial class InfoboxTemplate : UserControl { - Stream str; - public int buttonChoice; - public int buttonSelected; - public InfoboxTemplate(buttonType type) + Stream _str; + private int _buttonChoice; + private int _buttonSelected; + public InfoboxTemplate(ButtonType type) { InitializeComponent(); switch (type) { - case buttonType.OK: + case ButtonType.Ok: btnOpt1.Text = "OK"; btnOpt2.Hide(); btnOpt1.Location = new Point(109, 134); - buttonChoice = 1; + _buttonChoice = 1; break; - case buttonType.OKCancel: + case ButtonType.OkCancel: btnOpt1.Text = "OK"; btnOpt2.Text = "Cancel"; - buttonChoice = 2; + _buttonChoice = 2; break; - case buttonType.YesNo: + case ButtonType.YesNo: btnOpt1.Text = "Yes"; btnOpt2.Text = "No"; - buttonChoice = 3; + _buttonChoice = 3; break; } } - public enum buttonType + + public enum ButtonType { YesNo, - OKCancel, - OK + OkCancel, + Ok } private void btnOpt1_Click(object sender, EventArgs e) @@ -53,12 +48,12 @@ namespace ShiftOS.Engine.WindowManager switch (btnOpt1.Text) { case "OK": - buttonSelected = 1; - ParentForm.Close(); + _buttonSelected = 1; + ParentForm?.Close(); break; case "Yes": - buttonSelected = 2; - ParentForm.Close(); + _buttonSelected = 2; + ParentForm?.Close(); break; } } @@ -68,27 +63,26 @@ namespace ShiftOS.Engine.WindowManager switch (btnOpt2.Text) { case "No": - buttonSelected = 3; + _buttonSelected = 3; break; case "Cancel": - buttonSelected = 4; + _buttonSelected = 4; break; } } + public void Play() { - str = Properties.Resources.infobox; - SoundPlayer sp = new SoundPlayer(str); + _str = Properties.Resources.infobox; + SoundPlayer sp = new SoundPlayer(_str); sp.Play(); sp.Stream.Position = 0; } - private void InfoboxTemplate_Load(object sender, EventArgs e) - { - Play(); - } + private void InfoboxTemplate_Load(object sender, EventArgs e) + => Play(); - private void changeSize_Tick(object sender, EventArgs e) + private void changeSize_Tick(object sender, EventArgs e) { this.Height += label1.Height; this.Width += label1.Width; diff --git a/ShiftOS.Engine/WindowManager/ShiftWM.cs b/ShiftOS.Engine/WindowManager/ShiftWM.cs index 38537c7..539d469 100644 --- a/ShiftOS.Engine/WindowManager/ShiftWM.cs +++ b/ShiftOS.Engine/WindowManager/ShiftWM.cs @@ -1,41 +1,81 @@ -using System.Drawing; +using System; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Drawing; +using System.Linq; using System.Windows.Forms; using static ShiftOS.Engine.WindowManager.InfoboxTemplate; namespace ShiftOS.Engine.WindowManager { - public class ShiftWM + public static class ShiftWM { - public ShiftWindow Init(UserControl content, string title, Image icon, bool ShowAsInfobox = false, bool resize = true) + public static ObservableCollection Windows { get; } = new ObservableCollection(); + + public static ShiftWindow GetShiftWindow(this UserControl control) + { + return Windows.First(p => (uint) control.Tag == p.Id); + } + + public static ShiftWindow Init(UserControl content, string title, Icon icon, bool showAsInfobox = false, bool resize = true) { // Setup Window - ShiftWindow app = new ShiftWindow(); - app.Text = title; - app.Title.Text = title; - app.Width = content.Width + app.left.Width + app.right.Width; + ShiftWindow app = new ShiftWindow + { + Text = title, + Title = {Text = title} + }; + + app.Width = content.Width + app.left.Width + app.right.Width; app.Height = content.Height + app.bottom.Height + app.top.Height; // Icon Setup - if (icon == null) - { - app.programIcon.Hide(); - app.programIcon.Image = Properties.Resources.nullIcon; - app.Title.Location = new Point(2, 7); - } - else app.programIcon.Image = icon; - - // Setup UC - content.Parent = app.programContent; + if (icon == null) + { + app.programIcon.Hide(); + app.programIcon.Image = Properties.Resources.nullIcon; + app.Title.Location = new Point(2, 7); + } + + else + { + app.programIcon.Image = icon.ToBitmap(); + app.Icon = icon; + } + + // Setup UC + content.Parent = app.programContent; content.BringToFront(); content.Dock = DockStyle.Fill; app.Show(); + + content.Tag = app.SetId(); + + Debug.WriteLine($"usercontrol: {content.Tag} window: {app.Id}"); + + app.Closed += (sender, args) => + { + Windows.Remove((ShiftWindow) sender); + }; + + Windows.Add(app); + + if (content is IShiftWindowExtensions extensions) + { + extensions.OnLoaded(app); + } + return app; } - public InfoboxTemplate StartInfoboxSession(string title, string body, buttonType type) + + public static InfoboxTemplate StartInfoboxSession(string title, string body, ButtonType type) { - InfoboxTemplate info = new InfoboxTemplate(type); - info.label1.Text = body; - Init(info, title, Properties.Resources.iconInfoBox_fw, true, false); + InfoboxTemplate info = new InfoboxTemplate(type) + { + label1 = { Text = body } + }; + + Init(info, title, Properties.Resources.iconInfoBox_fw.ToIcon(), true, false); return info; } } diff --git a/ShiftOS.Engine/WindowManager/ShiftWindow.Designer.cs b/ShiftOS.Engine/WindowManager/ShiftWindow.Designer.cs index f7443d6..1e0f105 100644 --- a/ShiftOS.Engine/WindowManager/ShiftWindow.Designer.cs +++ b/ShiftOS.Engine/WindowManager/ShiftWindow.Designer.cs @@ -28,220 +28,238 @@ /// private void InitializeComponent() { - this.program = new System.Windows.Forms.Panel(); - this.programContent = new System.Windows.Forms.Panel(); - this.bottomleftcorner = new System.Windows.Forms.Panel(); - this.toprightcorner = new System.Windows.Forms.Panel(); - this.bottomrightcorner = new System.Windows.Forms.Panel(); - this.topleftcorner = new System.Windows.Forms.Panel(); - this.bottom = new System.Windows.Forms.Panel(); - this.top = new System.Windows.Forms.Panel(); - this.programIcon = new System.Windows.Forms.PictureBox(); - this.maximizebutton = new System.Windows.Forms.PictureBox(); - this.minimizebutton = new System.Windows.Forms.PictureBox(); - this.Title = new System.Windows.Forms.Label(); - this.closebutton = new System.Windows.Forms.PictureBox(); - this.right = new System.Windows.Forms.Panel(); - this.left = new System.Windows.Forms.Panel(); - this.program.SuspendLayout(); - this.top.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.programIcon)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.maximizebutton)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.minimizebutton)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.closebutton)).BeginInit(); - this.SuspendLayout(); - // - // program - // - this.program.BackColor = System.Drawing.Color.White; - this.program.Controls.Add(this.programContent); - this.program.Controls.Add(this.bottomleftcorner); - this.program.Controls.Add(this.toprightcorner); - this.program.Controls.Add(this.bottomrightcorner); - this.program.Controls.Add(this.topleftcorner); - this.program.Controls.Add(this.bottom); - this.program.Controls.Add(this.top); - this.program.Controls.Add(this.right); - this.program.Controls.Add(this.left); - this.program.Dock = System.Windows.Forms.DockStyle.Fill; - this.program.Location = new System.Drawing.Point(0, 0); - this.program.Name = "program"; - this.program.Size = new System.Drawing.Size(284, 261); - this.program.TabIndex = 11; - // - // programContent - // - this.programContent.Dock = System.Windows.Forms.DockStyle.Fill; - this.programContent.Location = new System.Drawing.Point(4, 30); - this.programContent.Name = "programContent"; - this.programContent.Size = new System.Drawing.Size(276, 227); - this.programContent.TabIndex = 11; - // - // bottomleftcorner - // - this.bottomleftcorner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.bottomleftcorner.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.bottomleftcorner.Location = new System.Drawing.Point(0, 257); - this.bottomleftcorner.Name = "bottomleftcorner"; - this.bottomleftcorner.Size = new System.Drawing.Size(5, 4); - this.bottomleftcorner.TabIndex = 10; - // - // toprightcorner - // - this.toprightcorner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.toprightcorner.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.toprightcorner.Location = new System.Drawing.Point(278, 0); - this.toprightcorner.Name = "toprightcorner"; - this.toprightcorner.Size = new System.Drawing.Size(6, 30); - this.toprightcorner.TabIndex = 9; - // - // bottomrightcorner - // - this.bottomrightcorner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bottomrightcorner.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.bottomrightcorner.Cursor = System.Windows.Forms.Cursors.SizeNWSE; - this.bottomrightcorner.Location = new System.Drawing.Point(280, 257); - this.bottomrightcorner.Name = "bottomrightcorner"; - this.bottomrightcorner.Size = new System.Drawing.Size(4, 4); - this.bottomrightcorner.TabIndex = 4; - // - // topleftcorner - // - this.topleftcorner.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.topleftcorner.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.topleftcorner.Location = new System.Drawing.Point(0, 0); - this.topleftcorner.Name = "topleftcorner"; - this.topleftcorner.Size = new System.Drawing.Size(7, 30); - this.topleftcorner.TabIndex = 8; - // - // bottom - // - this.bottom.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.bottom.Cursor = System.Windows.Forms.Cursors.SizeNS; - this.bottom.Dock = System.Windows.Forms.DockStyle.Bottom; - this.bottom.Location = new System.Drawing.Point(4, 257); - this.bottom.Name = "bottom"; - this.bottom.Size = new System.Drawing.Size(276, 4); - this.bottom.TabIndex = 3; - // - // top - // - this.top.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.top.Controls.Add(this.programIcon); - this.top.Controls.Add(this.maximizebutton); - this.top.Controls.Add(this.minimizebutton); - this.top.Controls.Add(this.Title); - this.top.Controls.Add(this.closebutton); - this.top.Dock = System.Windows.Forms.DockStyle.Top; - this.top.ForeColor = System.Drawing.SystemColors.ControlText; - this.top.Location = new System.Drawing.Point(4, 0); - this.top.Name = "top"; - this.top.Size = new System.Drawing.Size(276, 30); - this.top.TabIndex = 0; - this.top.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Programtopbar_drag); - // - // programIcon - // - this.programIcon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.programIcon.ErrorImage = null; - this.programIcon.InitialImage = null; - this.programIcon.Location = new System.Drawing.Point(6, 7); - this.programIcon.Name = "programIcon"; - this.programIcon.Size = new System.Drawing.Size(16, 16); - this.programIcon.TabIndex = 7; - this.programIcon.TabStop = false; - // - // maximizebutton - // - this.maximizebutton.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.maximizebutton.BackColor = System.Drawing.Color.Black; - this.maximizebutton.Location = new System.Drawing.Point(230, 4); - this.maximizebutton.Name = "maximizebutton"; - this.maximizebutton.Size = new System.Drawing.Size(21, 21); - this.maximizebutton.TabIndex = 6; - this.maximizebutton.TabStop = false; - this.maximizebutton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.maximizebutton_MouseDown); - this.maximizebutton.MouseEnter += new System.EventHandler(this.maximizebutton_MouseEnter); - this.maximizebutton.MouseLeave += new System.EventHandler(this.maximizebutton_MouseLeave); - this.maximizebutton.MouseUp += new System.Windows.Forms.MouseEventHandler(this.maximizebutton_MouseUp); - // - // minimizebutton - // - this.minimizebutton.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.minimizebutton.BackColor = System.Drawing.Color.Black; - this.minimizebutton.Location = new System.Drawing.Point(207, 4); - this.minimizebutton.Name = "minimizebutton"; - this.minimizebutton.Size = new System.Drawing.Size(21, 21); - this.minimizebutton.TabIndex = 5; - this.minimizebutton.TabStop = false; - this.minimizebutton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.minimizebutton_MouseDown); - this.minimizebutton.MouseEnter += new System.EventHandler(this.minimizebutton_MouseEnter); - this.minimizebutton.MouseLeave += new System.EventHandler(this.minimizebutton_MouseLeave); - this.minimizebutton.MouseUp += new System.Windows.Forms.MouseEventHandler(this.minimizebutton_MouseUp); - // - // Title - // - this.Title.AutoSize = true; - this.Title.BackColor = System.Drawing.Color.Transparent; - this.Title.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Title.ForeColor = System.Drawing.Color.White; - this.Title.Location = new System.Drawing.Point(25, 8); - this.Title.Name = "Title"; - this.Title.Size = new System.Drawing.Size(98, 13); - this.Title.TabIndex = 3; - this.Title.Text = "Application Title"; - this.Title.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Programtopbar_drag); - // - // closebutton - // - this.closebutton.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.closebutton.BackColor = System.Drawing.Color.Black; - this.closebutton.Location = new System.Drawing.Point(253, 4); - this.closebutton.Name = "closebutton"; - this.closebutton.Size = new System.Drawing.Size(21, 21); - this.closebutton.TabIndex = 4; - this.closebutton.TabStop = false; - this.closebutton.Click += new System.EventHandler(this.closebutton_Click); - this.closebutton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.closebutton_MouseDown); - this.closebutton.MouseEnter += new System.EventHandler(this.closebutton_MouseEnter); - this.closebutton.MouseLeave += new System.EventHandler(this.closebutton_MouseLeave); - this.closebutton.MouseUp += new System.Windows.Forms.MouseEventHandler(this.closebutton_MouseUp); - // - // right - // - this.right.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.right.Cursor = System.Windows.Forms.Cursors.SizeWE; - this.right.Dock = System.Windows.Forms.DockStyle.Right; - this.right.Location = new System.Drawing.Point(280, 0); - this.right.Name = "right"; - this.right.Size = new System.Drawing.Size(4, 261); - this.right.TabIndex = 2; - // - // left - // - this.left.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.left.Dock = System.Windows.Forms.DockStyle.Left; - this.left.Location = new System.Drawing.Point(0, 0); - this.left.Name = "left"; - this.left.Size = new System.Drawing.Size(4, 261); - this.left.TabIndex = 1; - // - // ShiftWindow - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(284, 261); - this.Controls.Add(this.program); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.Name = "ShiftWindow"; - this.program.ResumeLayout(false); - this.top.ResumeLayout(false); - this.top.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.programIcon)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.maximizebutton)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.minimizebutton)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.closebutton)).EndInit(); - this.ResumeLayout(false); + this.program = new System.Windows.Forms.Panel(); + this.programContent = new System.Windows.Forms.Panel(); + this.bottomleftcorner = new System.Windows.Forms.Panel(); + this.toprightcorner = new System.Windows.Forms.Panel(); + this.bottomrightcorner = new System.Windows.Forms.Panel(); + this.topleftcorner = new System.Windows.Forms.Panel(); + this.bottom = new System.Windows.Forms.Panel(); + this.top = new System.Windows.Forms.Panel(); + this.programIcon = new System.Windows.Forms.PictureBox(); + this.maximizebutton = new System.Windows.Forms.PictureBox(); + this.minimizebutton = new System.Windows.Forms.PictureBox(); + this.Title = new System.Windows.Forms.Label(); + this.closebutton = new System.Windows.Forms.PictureBox(); + this.right = new System.Windows.Forms.Panel(); + this.left = new System.Windows.Forms.Panel(); + this.program.SuspendLayout(); + this.top.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.programIcon)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.maximizebutton)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.minimizebutton)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.closebutton)).BeginInit(); + this.SuspendLayout(); + // + // program + // + this.program.BackColor = System.Drawing.Color.White; + this.program.Controls.Add(this.programContent); + this.program.Controls.Add(this.bottomleftcorner); + this.program.Controls.Add(this.toprightcorner); + this.program.Controls.Add(this.bottomrightcorner); + this.program.Controls.Add(this.topleftcorner); + this.program.Controls.Add(this.bottom); + this.program.Controls.Add(this.top); + this.program.Controls.Add(this.right); + this.program.Controls.Add(this.left); + this.program.Dock = System.Windows.Forms.DockStyle.Fill; + this.program.Location = new System.Drawing.Point(0, 0); + this.program.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.program.Name = "program"; + this.program.Size = new System.Drawing.Size(426, 402); + this.program.TabIndex = 11; + // + // programContent + // + this.programContent.Dock = System.Windows.Forms.DockStyle.Fill; + this.programContent.Location = new System.Drawing.Point(6, 46); + this.programContent.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.programContent.Name = "programContent"; + this.programContent.Size = new System.Drawing.Size(414, 350); + this.programContent.TabIndex = 11; + // + // bottomleftcorner + // + this.bottomleftcorner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bottomleftcorner.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.bottomleftcorner.Location = new System.Drawing.Point(0, 395); + this.bottomleftcorner.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.bottomleftcorner.Name = "bottomleftcorner"; + this.bottomleftcorner.Size = new System.Drawing.Size(8, 6); + this.bottomleftcorner.TabIndex = 10; + // + // toprightcorner + // + this.toprightcorner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.toprightcorner.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.toprightcorner.Location = new System.Drawing.Point(417, 0); + this.toprightcorner.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.toprightcorner.Name = "toprightcorner"; + this.toprightcorner.Size = new System.Drawing.Size(9, 46); + this.toprightcorner.TabIndex = 9; + // + // bottomrightcorner + // + this.bottomrightcorner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bottomrightcorner.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.bottomrightcorner.Cursor = System.Windows.Forms.Cursors.SizeNWSE; + this.bottomrightcorner.Location = new System.Drawing.Point(420, 395); + this.bottomrightcorner.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.bottomrightcorner.Name = "bottomrightcorner"; + this.bottomrightcorner.Size = new System.Drawing.Size(6, 6); + this.bottomrightcorner.TabIndex = 4; + // + // topleftcorner + // + this.topleftcorner.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.topleftcorner.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.topleftcorner.Location = new System.Drawing.Point(0, 0); + this.topleftcorner.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.topleftcorner.Name = "topleftcorner"; + this.topleftcorner.Size = new System.Drawing.Size(10, 46); + this.topleftcorner.TabIndex = 8; + // + // bottom + // + this.bottom.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.bottom.Cursor = System.Windows.Forms.Cursors.SizeNS; + this.bottom.Dock = System.Windows.Forms.DockStyle.Bottom; + this.bottom.Location = new System.Drawing.Point(6, 396); + this.bottom.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.bottom.Name = "bottom"; + this.bottom.Size = new System.Drawing.Size(414, 6); + this.bottom.TabIndex = 3; + // + // top + // + this.top.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.top.Controls.Add(this.programIcon); + this.top.Controls.Add(this.maximizebutton); + this.top.Controls.Add(this.minimizebutton); + this.top.Controls.Add(this.Title); + this.top.Controls.Add(this.closebutton); + this.top.Dock = System.Windows.Forms.DockStyle.Top; + this.top.ForeColor = System.Drawing.SystemColors.ControlText; + this.top.Location = new System.Drawing.Point(6, 0); + this.top.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.top.Name = "top"; + this.top.Size = new System.Drawing.Size(414, 46); + this.top.TabIndex = 0; + this.top.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Programtopbar_drag); + // + // programIcon + // + this.programIcon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.programIcon.ErrorImage = null; + this.programIcon.InitialImage = null; + this.programIcon.Location = new System.Drawing.Point(9, 11); + this.programIcon.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.programIcon.Name = "programIcon"; + this.programIcon.Size = new System.Drawing.Size(24, 25); + this.programIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.programIcon.TabIndex = 7; + this.programIcon.TabStop = false; + // + // maximizebutton + // + this.maximizebutton.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.maximizebutton.BackColor = System.Drawing.Color.Black; + this.maximizebutton.Location = new System.Drawing.Point(345, 6); + this.maximizebutton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.maximizebutton.Name = "maximizebutton"; + this.maximizebutton.Size = new System.Drawing.Size(32, 32); + this.maximizebutton.TabIndex = 6; + this.maximizebutton.TabStop = false; + this.maximizebutton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.maximizebutton_MouseDown); + this.maximizebutton.MouseEnter += new System.EventHandler(this.maximizebutton_MouseEnter); + this.maximizebutton.MouseLeave += new System.EventHandler(this.maximizebutton_MouseLeave); + this.maximizebutton.MouseUp += new System.Windows.Forms.MouseEventHandler(this.maximizebutton_MouseUp); + // + // minimizebutton + // + this.minimizebutton.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.minimizebutton.BackColor = System.Drawing.Color.Black; + this.minimizebutton.Location = new System.Drawing.Point(310, 6); + this.minimizebutton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.minimizebutton.Name = "minimizebutton"; + this.minimizebutton.Size = new System.Drawing.Size(32, 32); + this.minimizebutton.TabIndex = 5; + this.minimizebutton.TabStop = false; + this.minimizebutton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.minimizebutton_MouseDown); + this.minimizebutton.MouseEnter += new System.EventHandler(this.minimizebutton_MouseEnter); + this.minimizebutton.MouseLeave += new System.EventHandler(this.minimizebutton_MouseLeave); + this.minimizebutton.MouseUp += new System.Windows.Forms.MouseEventHandler(this.minimizebutton_MouseUp); + // + // Title + // + this.Title.AutoSize = true; + this.Title.BackColor = System.Drawing.Color.Transparent; + this.Title.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Title.ForeColor = System.Drawing.Color.White; + this.Title.Location = new System.Drawing.Point(38, 12); + this.Title.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.Title.Name = "Title"; + this.Title.Size = new System.Drawing.Size(149, 21); + this.Title.TabIndex = 3; + this.Title.Text = "Application Title"; + this.Title.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Programtopbar_drag); + // + // closebutton + // + this.closebutton.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.closebutton.BackColor = System.Drawing.Color.Black; + this.closebutton.Location = new System.Drawing.Point(380, 6); + this.closebutton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.closebutton.Name = "closebutton"; + this.closebutton.Size = new System.Drawing.Size(32, 32); + this.closebutton.TabIndex = 4; + this.closebutton.TabStop = false; + this.closebutton.Click += new System.EventHandler(this.closebutton_Click); + this.closebutton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.closebutton_MouseDown); + this.closebutton.MouseEnter += new System.EventHandler(this.closebutton_MouseEnter); + this.closebutton.MouseLeave += new System.EventHandler(this.closebutton_MouseLeave); + this.closebutton.MouseUp += new System.Windows.Forms.MouseEventHandler(this.closebutton_MouseUp); + // + // right + // + this.right.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.right.Cursor = System.Windows.Forms.Cursors.SizeWE; + this.right.Dock = System.Windows.Forms.DockStyle.Right; + this.right.Location = new System.Drawing.Point(420, 0); + this.right.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.right.Name = "right"; + this.right.Size = new System.Drawing.Size(6, 402); + this.right.TabIndex = 2; + // + // left + // + this.left.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.left.Dock = System.Windows.Forms.DockStyle.Left; + this.left.Location = new System.Drawing.Point(0, 0); + this.left.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.left.Name = "left"; + this.left.Size = new System.Drawing.Size(6, 402); + this.left.TabIndex = 1; + // + // ShiftWindow + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(426, 402); + this.Controls.Add(this.program); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.Name = "ShiftWindow"; + this.Text = "c"; + this.program.ResumeLayout(false); + this.top.ResumeLayout(false); + this.top.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.programIcon)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.maximizebutton)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.minimizebutton)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.closebutton)).EndInit(); + this.ResumeLayout(false); } diff --git a/ShiftOS.Engine/WindowManager/ShiftWindow.cs b/ShiftOS.Engine/WindowManager/ShiftWindow.cs index 45aec7c..a41786a 100644 --- a/ShiftOS.Engine/WindowManager/ShiftWindow.cs +++ b/ShiftOS.Engine/WindowManager/ShiftWindow.cs @@ -1,11 +1,6 @@ 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; using System.Runtime.InteropServices; @@ -13,91 +8,86 @@ namespace ShiftOS.Engine.WindowManager { public partial class ShiftWindow : Form { - public ShiftWindow() + public uint Id { get; private set; } + + public UserControl ChildControl { get; set; } + + public ShiftWindow() { InitializeComponent(); } - public const int WM_NCLBUTTONDOWN = 0xA1; - public const int HT_CAPTION = 0x2; + + public uint SetId() + { + do + { + Id = (uint)Tools.Rnd.Next(100000, 999999); + } + while (ShiftWM.Windows.FirstOrDefault(w => w.Id == Id) != null); + + return Id; + } + + private const int WM_NCLBUTTONDOWN = 0xA1; + private const int HT_CAPTION = 0x2; [DllImportAttribute("user32.dll")] - public static extern int SendMessage(IntPtr hWnd, + private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); + [DllImportAttribute("user32.dll")] - public static extern bool ReleaseCapture(); + private static extern bool ReleaseCapture(); private void Programtopbar_drag(object sender, MouseEventArgs e) { - if (e.Button == MouseButtons.Left) - { - ReleaseCapture(); - SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); - } - } + if (e.Button != MouseButtons.Left) return; - private void closebutton_Click(object sender, EventArgs e) - { - this.Close(); + ReleaseCapture(); + SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); } - private void closebutton_MouseEnter(object sender, EventArgs e) - { - closebutton.BackColor = Color.Gray; - } + private void closebutton_Click(object sender, EventArgs e) + => this.Close(); - private void closebutton_MouseLeave(object sender, EventArgs e) - { - closebutton.BackColor = Color.Black; - } + private void closebutton_MouseEnter(object sender, EventArgs e) + => closebutton.BackColor = Color.Gray; - private void maximizebutton_MouseEnter(object sender, EventArgs e) - { - maximizebutton.BackColor = Color.Gray; - } + private void closebutton_MouseLeave(object sender, EventArgs e) + => closebutton.BackColor = Color.Black; - private void maximizebutton_MouseLeave(object sender, EventArgs e) - { - maximizebutton.BackColor = Color.Black; - } + private void maximizebutton_MouseEnter(object sender, EventArgs e) + => maximizebutton.BackColor = Color.Gray; - private void minimizebutton_MouseEnter(object sender, EventArgs e) - { - minimizebutton.BackColor = Color.Gray; - } + private void maximizebutton_MouseLeave(object sender, EventArgs e) + => maximizebutton.BackColor = Color.Black; - private void minimizebutton_MouseLeave(object sender, EventArgs e) - { - minimizebutton.BackColor = Color.Black; - } + private void minimizebutton_MouseEnter(object sender, EventArgs e) + => minimizebutton.BackColor = Color.Gray; - private void closebutton_MouseDown(object sender, MouseEventArgs e) - { - closebutton.BackColor = Color.Black; - } + private void minimizebutton_MouseLeave(object sender, EventArgs e) + => minimizebutton.BackColor = Color.Black; - private void maximizebutton_MouseDown(object sender, MouseEventArgs e) - { - maximizebutton.BackColor = Color.Black; - } + private void closebutton_MouseDown(object sender, MouseEventArgs e) + => closebutton.BackColor = Color.Black; - private void minimizebutton_MouseDown(object sender, MouseEventArgs e) - { - minimizebutton.BackColor = Color.Black; - } + private void maximizebutton_MouseDown(object sender, MouseEventArgs e) + => maximizebutton.BackColor = Color.Black; - private void minimizebutton_MouseUp(object sender, MouseEventArgs e) - { - minimizebutton.BackColor = Color.Gray; - } + private void minimizebutton_MouseDown(object sender, MouseEventArgs e) + => minimizebutton.BackColor = Color.Black; - private void maximizebutton_MouseUp(object sender, MouseEventArgs e) - { - maximizebutton.BackColor = Color.Gray; - } + private void minimizebutton_MouseUp(object sender, MouseEventArgs e) + => minimizebutton.BackColor = Color.Gray; - private void closebutton_MouseUp(object sender, MouseEventArgs e) - { - closebutton.BackColor = Color.Gray; - } - } + private void maximizebutton_MouseUp(object sender, MouseEventArgs e) + => maximizebutton.BackColor = Color.Gray; + + private void closebutton_MouseUp(object sender, MouseEventArgs e) + => closebutton.BackColor = Color.Gray; + } + + public interface IShiftWindowExtensions + { + void OnLoaded(ShiftWindow window); + } } diff --git a/ShiftOS.Engine/packages.config b/ShiftOS.Engine/packages.config new file mode 100644 index 0000000..d376894 --- /dev/null +++ b/ShiftOS.Engine/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ShiftOS.Main/Program.cs b/ShiftOS.Main/Program.cs index 5464d8e..10277b0 100644 --- a/ShiftOS.Main/Program.cs +++ b/ShiftOS.Main/Program.cs @@ -1,8 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; +using ShiftOS.Main.ShiftOS; namespace ShiftOS.Main { @@ -16,7 +15,10 @@ namespace ShiftOS.Main { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new TestForm()); + + Parallel.Invoke( + () => Application.Run(new TestForm()), + () => Application.Run(new Desktop())); } } } diff --git a/ShiftOS.Main/ShiftOS.Main.csproj b/ShiftOS.Main/ShiftOS.Main.csproj index 18e842f..c814c14 100644 --- a/ShiftOS.Main/ShiftOS.Main.csproj +++ b/ShiftOS.Main/ShiftOS.Main.csproj @@ -76,6 +76,12 @@ TestForm.cs + + Form + + + Desktop.cs + HijackScreen.cs @@ -101,6 +107,9 @@ TestForm.cs + + Desktop.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs index 5c3a0de..7fd37f0 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs @@ -28,32 +28,47 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(18, 16); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(35, 13); - this.label1.TabIndex = 0; - this.label1.Text = "label1"; - // - // ShiftDemo - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.label1); - this.Name = "ShiftDemo"; - this.Size = new System.Drawing.Size(300, 300); - this.ResumeLayout(false); - this.PerformLayout(); + 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/ShiftOS/Apps/ShiftDemo.cs b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs index 1f400c8..11fc160 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs @@ -7,14 +7,20 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using ShiftOS.Engine.WindowManager; namespace ShiftOS.Main { - public partial class ShiftDemo : UserControl + public partial class ShiftDemo : UserControl, IShiftWindowExtensions { public ShiftDemo() { InitializeComponent(); } - } + + public void OnLoaded(ShiftWindow window) + { + icon.Image = this.GetShiftWindow().Icon.ToBitmap(); + } + } } diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs index 9062947..697e22e 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs @@ -1,11 +1,5 @@ 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; using ShiftOS.Engine.WindowManager; @@ -13,11 +7,10 @@ namespace ShiftOS.Main.ShiftOS.Apps { public partial class SelectColor : UserControl { - ShiftWM shiftWM = new ShiftWM(); - Color finalColor; - int colorType1; - int colorType2; - int colorType3; + Color _finalColor; + int _colorType1; + int _colorType2; + int _colorType3; public SelectColor() { InitializeComponent(); @@ -28,31 +21,31 @@ namespace ShiftOS.Main.ShiftOS.Apps { try { - colorType1 = Convert.ToInt32(textBox1.Text); - colorType2 = Convert.ToInt32(textBox2.Text); - colorType3 = Convert.ToInt32(textBox3.Text); + _colorType1 = Convert.ToInt32(textBox1.Text); + _colorType2 = Convert.ToInt32(textBox2.Text); + _colorType3 = Convert.ToInt32(textBox3.Text); } - catch(Exception ex) + catch(FormatException ex) { - shiftWM.StartInfoboxSession("Error!", "Failed to parse integer. Error:\n" + ex, InfoboxTemplate.buttonType.OK); + ShiftWM.StartInfoboxSession("Error!", "Failed to parse integer. Error:\n" + ex, InfoboxTemplate.ButtonType.Ok); } - if (colorType1 > 255 || colorType2 > 255 || colorType3 > 255) + if (_colorType1 > 255 || _colorType2 > 255 || _colorType3 > 255) { - shiftWM.StartInfoboxSession("Error!", "A value cannot be greater than 255!", InfoboxTemplate.buttonType.OK); + ShiftWM.StartInfoboxSession("Error!", "A value cannot be greater than 255!", InfoboxTemplate.ButtonType.Ok); } else { try { ShiftWindow sw = new ShiftWindow(); - finalColor = Color.FromArgb(colorType1, colorType2, colorType3); - this.BackColor = finalColor; - shiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + colorType1.ToString() + ", " + colorType2.ToString() + ", " + colorType3.ToString() + ".", InfoboxTemplate.buttonType.OK); + _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3); + BackColor = _finalColor; + ShiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + _colorType1.ToString() + ", " + _colorType2.ToString() + ", " + _colorType3.ToString() + ".", InfoboxTemplate.ButtonType.Ok); } - catch (Exception ex) + catch (Exception) { - shiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.buttonType.OK); + ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok); } } } diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs index 74b2079..098920f 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs @@ -1,12 +1,6 @@ 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; +using ShiftOS.Engine; using ShiftOS.Engine.WindowManager; namespace ShiftOS.Main.ShiftOS.Apps @@ -14,7 +8,6 @@ namespace ShiftOS.Main.ShiftOS.Apps public partial class Shifter : UserControl { public int colorType; //This is a check to see what option was chosen. - ShiftWM wm = new ShiftWM(); public Shifter() { InitializeComponent(); @@ -23,7 +16,7 @@ namespace ShiftOS.Main.ShiftOS.Apps private void button1_Click(object sender, EventArgs e) { colorType = 1; - wm.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw); + ShiftWM.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw.ToIcon()); } } } diff --git a/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs index 7049a7e..50bcb58 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs @@ -28,61 +28,95 @@ /// private void InitializeComponent() { - 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.SuspendLayout(); - // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(12, 13); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(260, 20); - this.textBox1.TabIndex = 0; - this.textBox1.Text = "Title"; - // - // textBox2 - // - this.textBox2.Location = new System.Drawing.Point(12, 39); - this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(260, 20); - this.textBox2.TabIndex = 1; - this.textBox2.Text = "Contents"; - // - // button1 - // - this.button1.Location = new System.Drawing.Point(12, 65); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(128, 23); - 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(146, 65); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(126, 23); - this.button2.TabIndex = 4; - this.button2.Text = "Test Shifter"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // TestForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(284, 100); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); - this.Controls.Add(this.textBox2); - this.Controls.Add(this.textBox1); - this.Name = "TestForm"; - this.Text = "TestForm"; - this.ResumeLayout(false); - this.PerformLayout(); + 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(); } @@ -92,5 +126,7 @@ 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/ShiftOS/Apps/TestForm.cs b/ShiftOS.Main/ShiftOS/Apps/TestForm.cs index e2b5bf7..1fd3b18 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TestForm.cs +++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.cs @@ -1,5 +1,8 @@ using System; +using System.Drawing; +using System.Linq; using System.Windows.Forms; +using ShiftOS.Engine; using ShiftOS.Engine.WindowManager; using ShiftOS.Main.ShiftOS.Apps; @@ -7,8 +10,6 @@ namespace ShiftOS.Main { public partial class TestForm : Form { - public ShiftWM shiftWM = new ShiftWM(); - public TestForm() { InitializeComponent(); @@ -16,14 +17,16 @@ namespace ShiftOS.Main private void Button1_Click(object sender, EventArgs e) { - ShiftDemo demo = new ShiftDemo(); - demo.label1.Text = textBox2.Text; - shiftWM.Init(demo, textBox1.Text, null); - shiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.buttonType.OK); + ShiftDemo demo = new ShiftDemo {label1 = {Text = textBox2.Text}}; + + var item = typeof(SystemIcons).GetProperties() + .First(p => p.Name == comboBox1.SelectedItem as string); + + ShiftWM.Init(demo, textBox1.Text, (item.GetMethod.Invoke(null, new object[0]) as Icon)); + ShiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok); } - private void button2_Click(object sender, EventArgs e) - { - shiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter); } + private void button2_Click(object sender, EventArgs e) + => ShiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter.ToIcon()); } } diff --git a/ShiftOS.Main/ShiftOS/Apps/TestForm.resx b/ShiftOS.Main/ShiftOS/Apps/TestForm.resx index 1af7de1..6dba9d3 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TestForm.resx +++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Desktop.Designer.cs b/ShiftOS.Main/ShiftOS/Desktop.Designer.cs new file mode 100644 index 0000000..dac30c6 --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Desktop.Designer.cs @@ -0,0 +1,111 @@ +namespace ShiftOS.Main.ShiftOS +{ + partial class Desktop + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.listView1 = new System.Windows.Forms.ListView(); + this.taskbar = new System.Windows.Forms.ToolStrip(); + this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton(); + this.taskbarClock = new System.Windows.Forms.ToolStripLabel(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.taskbar.SuspendLayout(); + this.SuspendLayout(); + // + // listView1 + // + this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView1.Location = new System.Drawing.Point(0, 0); + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(1962, 1236); + this.listView1.TabIndex = 0; + this.listView1.UseCompatibleStateImageBehavior = false; + // + // taskbar + // + this.taskbar.Dock = System.Windows.Forms.DockStyle.Bottom; + this.taskbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.taskbar.ImageScalingSize = new System.Drawing.Size(24, 24); + this.taskbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripDropDownButton1, + this.taskbarClock}); + this.taskbar.Location = new System.Drawing.Point(0, 1204); + this.taskbar.Name = "taskbar"; + this.taskbar.Size = new System.Drawing.Size(1962, 32); + this.taskbar.TabIndex = 1; + this.taskbar.Text = "toolStrip1"; + // + // toolStripDropDownButton1 + // + this.toolStripDropDownButton1.Image = global::ShiftOS.Main.Properties.Resources.iconWebBrowser; + this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripDropDownButton1.Name = "toolStripDropDownButton1"; + this.toolStripDropDownButton1.Size = new System.Drawing.Size(131, 29); + this.toolStripDropDownButton1.Tag = ((uint)(0u)); + this.toolStripDropDownButton1.Text = "Programs"; + // + // taskbarClock + // + this.taskbarClock.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + this.taskbarClock.Image = global::ShiftOS.Main.Properties.Resources.iconClock; + this.taskbarClock.Name = "taskbarClock"; + this.taskbarClock.Size = new System.Drawing.Size(70, 29); + this.taskbarClock.Tag = ((uint)(0u)); + this.taskbarClock.Text = "0:00"; + // + // timer1 + // + this.timer1.Interval = 1000; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // Desktop + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1962, 1236); + this.Controls.Add(this.taskbar); + this.Controls.Add(this.listView1); + this.Name = "Desktop"; + this.Text = "Desktop"; + this.taskbar.ResumeLayout(false); + this.taskbar.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ListView listView1; + private System.Windows.Forms.ToolStrip taskbar; + private System.Windows.Forms.ToolStripDropDownButton toolStripDropDownButton1; + private System.Windows.Forms.ToolStripLabel taskbarClock; + private System.Windows.Forms.Timer timer1; + } +} \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Desktop.cs b/ShiftOS.Main/ShiftOS/Desktop.cs new file mode 100644 index 0000000..494222a --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Desktop.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine.WindowManager; + +namespace ShiftOS.Main.ShiftOS +{ + public partial class Desktop : Form + { + public Desktop() + { + InitializeComponent(); + + timer1.Start(); + + this.Closed += (sender, args) => + { + Application.Exit(); + }; + + #region Disgusting taskbar code + + ShiftWM.Windows.CollectionChanged += (sender, args) => + { + args.NewItems?.OfType().ToList().ForEach(window => + { + taskbar.Invoke(new Action(() => + { + taskbar.Items.Add(new ToolStripButton + { + Text = window.Title.Text, + Image = window.Icon.ToBitmap(), + Tag = window.Id + }); + })); + }); + + args.OldItems?.OfType().ToList().ForEach(window => + { + taskbar.Invoke(new Action(() => + { + var tbRemovalList = taskbar.Items.OfType().Where(i => (uint) i.Tag == window.Id); + + tbRemovalList.ToList().ForEach(p => taskbar.Items.Remove(p)); + })); + }); + }; + + #endregion + } + + private void timer1_Tick(object sender, EventArgs e) => + taskbarClock.Text = $"{DateTime.Now:t}"; + } +} diff --git a/ShiftOS.Main/ShiftOS/Desktop.resx b/ShiftOS.Main/ShiftOS/Desktop.resx new file mode 100644 index 0000000..1ea96dc --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Desktop.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 159, 17 + + \ No newline at end of file -- cgit v1.2.3 From 1c2bf50041e376adc3e901fdc94326d2f9beec77 Mon Sep 17 00:00:00 2001 From: FloppyDiskDrive Date: Wed, 27 Sep 2017 19:36:09 -0500 Subject: Commented in the Engine project --- .vs/ShiftOS/v15/sqlite3/storage.ide | Bin 3678208 -> 3678208 bytes ShiftOS.Engine/Resources/Symbolinfo - Copy.png | Bin 0 -> 56780 bytes ShiftOS.Engine/Resources/symbolWarning.png | Bin 0 -> 3463 bytes ShiftOS.Engine/Tools.cs | 1 - .../WindowManager/InfoboxTemplate.Designer.cs | 15 ++++++------- ShiftOS.Engine/WindowManager/ShiftWM.cs | 25 ++++++++++++++++----- ShiftOS.Main/HijackScreen.cs | 18 +++++++-------- 7 files changed, 36 insertions(+), 23 deletions(-) create mode 100644 ShiftOS.Engine/Resources/Symbolinfo - Copy.png create mode 100644 ShiftOS.Engine/Resources/symbolWarning.png diff --git a/.vs/ShiftOS/v15/sqlite3/storage.ide b/.vs/ShiftOS/v15/sqlite3/storage.ide index a7bcbbb..a031093 100644 Binary files a/.vs/ShiftOS/v15/sqlite3/storage.ide and b/.vs/ShiftOS/v15/sqlite3/storage.ide differ diff --git a/ShiftOS.Engine/Resources/Symbolinfo - Copy.png b/ShiftOS.Engine/Resources/Symbolinfo - Copy.png new file mode 100644 index 0000000..659d9b3 Binary files /dev/null and b/ShiftOS.Engine/Resources/Symbolinfo - Copy.png differ diff --git a/ShiftOS.Engine/Resources/symbolWarning.png b/ShiftOS.Engine/Resources/symbolWarning.png new file mode 100644 index 0000000..f8805f6 Binary files /dev/null and b/ShiftOS.Engine/Resources/symbolWarning.png differ diff --git a/ShiftOS.Engine/Tools.cs b/ShiftOS.Engine/Tools.cs index eca7b59..792ccef 100644 --- a/ShiftOS.Engine/Tools.cs +++ b/ShiftOS.Engine/Tools.cs @@ -3,7 +3,6 @@ using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Runtime.InteropServices; -using ImageMagick; namespace ShiftOS.Engine { diff --git a/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs b/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs index a046516..a076c2a 100644 --- a/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs +++ b/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs @@ -33,7 +33,7 @@ this.btnOpt2 = new System.Windows.Forms.Button(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.changeSize = new System.Windows.Forms.Timer(this.components); - this.label1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -84,14 +84,13 @@ // // label1 // - this.label1.BackColor = System.Drawing.SystemColors.Window; - this.label1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.label1.Font = new System.Drawing.Font("Lucida Console", 9F); - this.label1.Location = new System.Drawing.Point(111, 61); - this.label1.Multiline = true; + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Lucida Console", 9.25F); + this.label1.Location = new System.Drawing.Point(105, 55); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(219, 57); + this.label1.Size = new System.Drawing.Size(55, 13); this.label1.TabIndex = 3; + this.label1.Text = "label1"; // // InfoboxTemplate // @@ -116,6 +115,6 @@ public System.Windows.Forms.Button btnOpt2; public System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Timer changeSize; - public System.Windows.Forms.TextBox label1; + public System.Windows.Forms.Label label1; } } diff --git a/ShiftOS.Engine/WindowManager/ShiftWM.cs b/ShiftOS.Engine/WindowManager/ShiftWM.cs index 539d469..0c69fb7 100644 --- a/ShiftOS.Engine/WindowManager/ShiftWM.cs +++ b/ShiftOS.Engine/WindowManager/ShiftWM.cs @@ -17,6 +17,15 @@ namespace ShiftOS.Engine.WindowManager return Windows.First(p => (uint) control.Tag == p.Id); } + /// + /// Shows a new Window based on a UserControl. + /// + /// The UserControl to use + /// The program's title + /// The icon to show + /// Checks if this is an infobox + /// Enables or disables resizing + /// public static ShiftWindow Init(UserControl content, string title, Icon icon, bool showAsInfobox = false, bool resize = true) { // Setup Window @@ -68,13 +77,19 @@ namespace ShiftOS.Engine.WindowManager return app; } + /// + /// Shows a new infobox. + /// + /// The title of the infobox. + /// The infobox's content. + /// The ButtonType used for the infobox. + /// public static InfoboxTemplate StartInfoboxSession(string title, string body, ButtonType type) { - InfoboxTemplate info = new InfoboxTemplate(type) - { - label1 = { Text = body } - }; - + InfoboxTemplate info = new InfoboxTemplate(type) + { + label1 = { Text = body } + }; Init(info, title, Properties.Resources.iconInfoBox_fw.ToIcon(), true, false); return info; } diff --git a/ShiftOS.Main/HijackScreen.cs b/ShiftOS.Main/HijackScreen.cs index ef1db92..721d49e 100644 --- a/ShiftOS.Main/HijackScreen.cs +++ b/ShiftOS.Main/HijackScreen.cs @@ -167,19 +167,19 @@ namespace ShiftOS.Main textgeninput = lblhackwords; textgen.Interval = 10; rtext = ""; - TextType("Congratulations, you have been involuntarily selected to be an Alpha Tester for ShiftOS." + Environment.NewLine + Environment.NewLine); + TextType("Congratulations, " + Environment.UserName + "you have been involuntarily selected to be an Alpha Tester for ShiftOS!" + Environment.NewLine + Environment.NewLine); break; case 4: - TextType("At this current point in time I do not wish to reveal my identity or future intentions." + Environment.NewLine + Environment.NewLine); + TextType("At this time, I do not wish to reveal any of my intentions and idenity." + Environment.NewLine + Environment.NewLine); break; case 5: TextType("I just need to use you and your computer as an external test bed to evolve my experimental operating system." + Environment.NewLine + Environment.NewLine); break; case 6: - TextType("Right now ShiftOS is practically non-existent but I’ll work on coding it remotely as you use it." + Environment.NewLine + Environment.NewLine); + TextType("I need to expand the name of ShiftOS, so I'll work on it, and you'll have the chance to use ShiftOS!" + Environment.NewLine + Environment.NewLine); break; case 7: - TextType("Your hard drive will now be formatted in preparation for the installation of ShiftOS" + Environment.NewLine + Environment.NewLine); + TextType("Your hard drive will now be formatted in preparation for the installation of ShiftOS." + Environment.NewLine + Environment.NewLine); break; case 8: TextType("Starting Format."); @@ -201,23 +201,23 @@ namespace ShiftOS.Main rtext = ""; break; case 20: - TextType("Scanning Drive C:/"); + TextType("Scanning Drive C:\\..."); break; case 21: TextType(Environment.NewLine + Environment.NewLine + "Drive Label: " + cdrive.VolumeLabel); break; case 22: - TextType(Environment.NewLine + "Total Drive Size: " + String.Format((cdrive.TotalSize / 1024 / 1024 / 1024).ToString(), "0.00") + " GigaBytes "); + TextType(Environment.NewLine + "Total Drive Size: " + String.Format((cdrive.TotalSize / 1024 / 1024 / 1024).ToString(), "0.00") + "GB. "); break; case 23: - TextType(Environment.NewLine + "Old File System: " + cdrive.DriveFormat + " "); + TextType(Environment.NewLine + "Old File System: " + cdrive.DriveFormat + ". "); break; case 24: - TextType(Environment.NewLine + "New File System: ShiftFS "); + TextType(Environment.NewLine + "New File System: ShiftFS. "); break; case 25: - TextType(Environment.NewLine + Environment.NewLine + "Formatting C:/ - "); + TextType(Environment.NewLine + Environment.NewLine + "Formatting C:\\... - "); conversationtimer.Interval = 100; break; case 26: // TODO: to 126 -- cgit v1.2.3 From 1b28809aadcd5281fd335bf7af7b5790542a4a97 Mon Sep 17 00:00:00 2001 From: John T Date: Wed, 27 Sep 2017 20:37:26 -0400 Subject: wtf is this --- .vs/ShiftOS/v15/sqlite3/storage.ide | Bin 3678208 -> 3702784 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/.vs/ShiftOS/v15/sqlite3/storage.ide b/.vs/ShiftOS/v15/sqlite3/storage.ide index a7bcbbb..683886f 100644 Binary files a/.vs/ShiftOS/v15/sqlite3/storage.ide and b/.vs/ShiftOS/v15/sqlite3/storage.ide differ -- cgit v1.2.3 From 05740746dd8123685eb9e66e26cc3f64b51bf490 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 27 Sep 2017 20:50:08 -0400 Subject: Actually added the new gitignore Should fix the stupid issues where it uploaded the .vs dir --- .gitignore | 162 +++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 125 insertions(+), 37 deletions(-) diff --git a/.gitignore b/.gitignore index c33d8d2..0867ec5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,17 @@ -# https://www.gitignore.io/api/visualstudio,windows,linux - -### VisualStudio ### ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore # User-specific files *.suo *.user +*.userosscache *.sln.docstates +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + # Build results [Dd]ebug/ [Dd]ebugPublic/ @@ -16,19 +19,21 @@ [Rr]eleases/ x64/ x86/ -build/ bld/ [Bb]in/ [Oo]bj/ +[Ll]og/ -# Roslyn cache directories -*.ide/ +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* -#NUNIT +# NUNIT *.VisualState.xml TestResult.xml @@ -37,6 +42,15 @@ TestResult.xml [Rr]eleasePS/ dlldata.c +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + *_i.c *_p.c *_i.h @@ -69,14 +83,21 @@ _Chutzpah* ipch/ *.aps *.ncb +*.opendb *.opensdf *.sdf *.cachefile +*.VC.db +*.VC.VC.opendb # Visual Studio profiler *.psess *.vsp *.vspx +*.sap + +# Visual Studio Trace Files +*.e2e # TFS 2012 Local Workspace $tf/ @@ -89,7 +110,7 @@ _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user -# JustCode is a .NET coding addin-in +# JustCode is a .NET coding add-in .JustCode # TeamCity is a build add-in @@ -98,9 +119,18 @@ _TeamCity* # DotCover is a Code Coverage Tool *.dotCover +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + # NCrunch _NCrunch_* .*crunch*.local.xml +nCrunchTemp_* # MightyMoose *.mm.* @@ -128,39 +158,63 @@ publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings +# Note: Comment the next line if you want to checkin your web deploy settings, # but database connection strings (with potential passwords) will be unencrypted *.pubxml *.publishproj +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + # NuGet Packages *.nupkg # The packages folder can be ignored because of Package Restore **/packages/* # except build/, which is used as an MSBuild target. !**/packages/build/ -# If using the old MSBuild-Integrated Package Restore, uncomment this: +# Uncomment if necessary however generally it will be regenerated when needed #!**/packages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets -# Windows Azure Build Output +# Microsoft Azure Build Output csx/ *.build.csdef -# Windows Store app package directory +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ # Others -sql/ -*.Cache ClientBin/ -[Ss]tyle[Cc]op.* ~$* *~ *.dbmdl *.dbproj.schemaview +*.jfm *.pfx *.publishsettings -node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ # RIA/Silverlight projects Generated_Code/ @@ -176,6 +230,7 @@ UpgradeLog*.htm # SQL Server files *.mdf *.ldf +*.ndf # Business Intelligence projects *.rdl.data @@ -185,33 +240,66 @@ UpgradeLog*.htm # Microsoft Fakes FakesAssemblies/ +# GhostDoc plugin setting file +*.GhostDoc.xml -### Windows ### -# Windows image file caches -Thumbs.db -ehthumbs.db +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ -# Folder config file -Desktop.ini +# Typescript v1 declaration files +typings/ -# Recycle Bin used on file shares -$RECYCLE.BIN/ +# Visual Studio 6 build log +*.plg -# Windows Installer files -*.cab -*.msi -*.msm -*.msp +# Visual Studio 6 workspace options file +*.opt -# Windows shortcuts -*.lnk +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions -### Linux ### -*~ +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig -# KDE directory preferences -.directory +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs -# Vim swp files -*.swp +# OpenCover UI analysis results +OpenCover/ -- cgit v1.2.3 From 23791cf63b61a2a922e80e5077ec5a3ad0ce7c53 Mon Sep 17 00:00:00 2001 From: FloppyDiskDrive Date: Wed, 27 Sep 2017 20:00:17 -0500 Subject: Added a buggy dynamically changing infobox (this will most likely not work) --- .vs/ShiftOS/v15/sqlite3/storage.ide | Bin 3678208 -> 3678208 bytes .../WindowManager/InfoboxTemplate.Designer.cs | 2 +- ShiftOS.Engine/WindowManager/InfoboxTemplate.cs | 20 ++++++++++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.vs/ShiftOS/v15/sqlite3/storage.ide b/.vs/ShiftOS/v15/sqlite3/storage.ide index a031093..daba2e0 100644 Binary files a/.vs/ShiftOS/v15/sqlite3/storage.ide and b/.vs/ShiftOS/v15/sqlite3/storage.ide differ diff --git a/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs b/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs index a076c2a..29d9299 100644 --- a/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs +++ b/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs @@ -70,7 +70,7 @@ this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.pictureBox1.Image = global::ShiftOS.Engine.Properties.Resources.Symbolinfo; - this.pictureBox1.Location = new System.Drawing.Point(3, 35); + this.pictureBox1.Location = new System.Drawing.Point(0, 34); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(80, 70); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; diff --git a/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs b/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs index a5be129..d8ad071 100644 --- a/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs +++ b/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs @@ -11,6 +11,12 @@ namespace ShiftOS.Engine.WindowManager Stream _str; private int _buttonChoice; private int _buttonSelected; + private int _leftDistance; + private int _rightDistance; + private int _textWidth; + private int _textHeight; + private int _topDistance; + private int _bottomDistance; public InfoboxTemplate(ButtonType type) { InitializeComponent(); @@ -84,8 +90,18 @@ namespace ShiftOS.Engine.WindowManager private void changeSize_Tick(object sender, EventArgs e) { - this.Height += label1.Height; - this.Width += label1.Width; + ChangeSize(); + } + private void ChangeSize() + { + _textHeight = label1.Height; + _textWidth = label1.Width; + _topDistance = 55; + _bottomDistance = 121; + _rightDistance = 101; + _leftDistance = 55; + this.Height = _textHeight + _topDistance + _bottomDistance; + this.Width = _textWidth + _leftDistance + _rightDistance; } } } -- cgit v1.2.3 From 0326d646b08ceaf139b7be609a1690f20fdff1a4 Mon Sep 17 00:00:00 2001 From: John T Date: Wed, 27 Sep 2017 21:26:49 -0400 Subject: test --- .vs/ProjectSettings.json | 3 --- .vs/ShiftOS/v15/sqlite3/storage.ide | Bin 3706880 -> 659456 bytes .vs/VSWorkspaceState.json | 6 ------ .vs/slnx.sqlite | Bin 638976 -> 0 bytes 4 files changed, 9 deletions(-) delete mode 100644 .vs/ProjectSettings.json delete mode 100644 .vs/VSWorkspaceState.json delete mode 100644 .vs/slnx.sqlite diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json deleted file mode 100644 index f8b4888..0000000 --- a/.vs/ProjectSettings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "CurrentProjectSetting": null -} \ No newline at end of file diff --git a/.vs/ShiftOS/v15/sqlite3/storage.ide b/.vs/ShiftOS/v15/sqlite3/storage.ide index 03eedd0..3be5453 100644 Binary files a/.vs/ShiftOS/v15/sqlite3/storage.ide and b/.vs/ShiftOS/v15/sqlite3/storage.ide differ diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json deleted file mode 100644 index 6b61141..0000000 --- a/.vs/VSWorkspaceState.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "ExpandedNodes": [ - "" - ], - "PreviewInSolutionExplorer": false -} \ No newline at end of file diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite deleted file mode 100644 index 135556a..0000000 Binary files a/.vs/slnx.sqlite and /dev/null differ -- cgit v1.2.3 From 753a880c0d5eb6fa6f466ef5e36713203409e13f Mon Sep 17 00:00:00 2001 From: FloppyDiskDrive Date: Wed, 27 Sep 2017 20:34:58 -0500 Subject: Revert "Added a buggy dynamically changing infobox (this will most likely not work)" This reverts commit 23791cf63b61a2a922e80e5077ec5a3ad0ce7c53. --- .vs/ShiftOS/v15/sqlite3/storage.ide | Bin 3678208 -> 3678208 bytes .../WindowManager/InfoboxTemplate.Designer.cs | 2 +- ShiftOS.Engine/WindowManager/InfoboxTemplate.cs | 20 ++------------------ 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/.vs/ShiftOS/v15/sqlite3/storage.ide b/.vs/ShiftOS/v15/sqlite3/storage.ide index daba2e0..a031093 100644 Binary files a/.vs/ShiftOS/v15/sqlite3/storage.ide and b/.vs/ShiftOS/v15/sqlite3/storage.ide differ diff --git a/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs b/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs index 29d9299..a076c2a 100644 --- a/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs +++ b/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs @@ -70,7 +70,7 @@ this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.pictureBox1.Image = global::ShiftOS.Engine.Properties.Resources.Symbolinfo; - this.pictureBox1.Location = new System.Drawing.Point(0, 34); + this.pictureBox1.Location = new System.Drawing.Point(3, 35); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(80, 70); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; diff --git a/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs b/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs index d8ad071..a5be129 100644 --- a/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs +++ b/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs @@ -11,12 +11,6 @@ namespace ShiftOS.Engine.WindowManager Stream _str; private int _buttonChoice; private int _buttonSelected; - private int _leftDistance; - private int _rightDistance; - private int _textWidth; - private int _textHeight; - private int _topDistance; - private int _bottomDistance; public InfoboxTemplate(ButtonType type) { InitializeComponent(); @@ -90,18 +84,8 @@ namespace ShiftOS.Engine.WindowManager private void changeSize_Tick(object sender, EventArgs e) { - ChangeSize(); - } - private void ChangeSize() - { - _textHeight = label1.Height; - _textWidth = label1.Width; - _topDistance = 55; - _bottomDistance = 121; - _rightDistance = 101; - _leftDistance = 55; - this.Height = _textHeight + _topDistance + _bottomDistance; - this.Width = _textWidth + _leftDistance + _rightDistance; + this.Height += label1.Height; + this.Width += label1.Width; } } } -- cgit v1.2.3