From 56e216a430694d86c242df763484deba682f3302 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 15 Apr 2017 20:21:11 -0400 Subject: Hide AL when clicking on window ctrls --- .../Applications/MUDControlCentre.Designer.cs | 184 +++++++++------------ ShiftOS.WinForms/Resources/Shiftorium.txt | 7 + ShiftOS.WinForms/Tools/ControlManager.cs | 5 +- ShiftOS.WinForms/WindowBorder.cs | 12 ++ ShiftOS.WinForms/WinformsDesktop.cs | 112 ++++++++----- 5 files changed, 173 insertions(+), 147 deletions(-) (limited to 'ShiftOS.WinForms') diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs index e2c0af3..125ea99 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs @@ -66,9 +66,13 @@ namespace ShiftOS.WinForms.Applications this.createLegionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.joinLegionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.myLegionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.chatToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.joinAChatToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); + this.pnlclasses = new System.Windows.Forms.Panel(); + this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnchooseclass = new System.Windows.Forms.Button(); + this.lbclasses = new System.Windows.Forms.ListBox(); + this.lbclassdesc = new System.Windows.Forms.Label(); + this.lbclasstitle = new System.Windows.Forms.Label(); this.you_systemstatus = new System.Windows.Forms.Panel(); this.btndeletesave = new System.Windows.Forms.Button(); this.lblsysstatus = new System.Windows.Forms.Label(); @@ -144,16 +148,12 @@ namespace ShiftOS.WinForms.Applications this.you_memos = new System.Windows.Forms.Panel(); this.flmemos = new System.Windows.Forms.FlowLayoutPanel(); this.label3 = new System.Windows.Forms.Label(); - this.pnlclasses = new System.Windows.Forms.Panel(); - this.lbclasstitle = new System.Windows.Forms.Label(); - this.lbclassdesc = new System.Windows.Forms.Label(); - this.lbclasses = new System.Windows.Forms.ListBox(); - this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel(); - this.btnchooseclass = new System.Windows.Forms.Button(); this.menuStrip1.SuspendLayout(); this.toolStripContainer1.ContentPanel.SuspendLayout(); this.toolStripContainer1.TopToolStripPanel.SuspendLayout(); this.toolStripContainer1.SuspendLayout(); + this.pnlclasses.SuspendLayout(); + this.flowLayoutPanel6.SuspendLayout(); this.you_systemstatus.SuspendLayout(); this.shop_all.SuspendLayout(); this.shop_view.SuspendLayout(); @@ -178,8 +178,6 @@ namespace ShiftOS.WinForms.Applications this.panel3.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout(); this.you_memos.SuspendLayout(); - this.pnlclasses.SuspendLayout(); - this.flowLayoutPanel6.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -188,8 +186,7 @@ namespace ShiftOS.WinForms.Applications this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.youToolStripMenuItem, this.shopsToolStripMenuItem, - this.legionsToolStripMenuItem, - this.chatToolStripMenuItem}); + this.legionsToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(756, 24); @@ -289,21 +286,6 @@ namespace ShiftOS.WinForms.Applications this.myLegionToolStripMenuItem.Text = "My Legion"; this.myLegionToolStripMenuItem.Click += new System.EventHandler(this.myLegionToolStripMenuItem_Click); // - // chatToolStripMenuItem - // - this.chatToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.joinAChatToolStripMenuItem}); - this.chatToolStripMenuItem.Name = "chatToolStripMenuItem"; - this.chatToolStripMenuItem.Size = new System.Drawing.Size(44, 20); - this.chatToolStripMenuItem.Text = "Chat"; - // - // joinAChatToolStripMenuItem - // - this.joinAChatToolStripMenuItem.Name = "joinAChatToolStripMenuItem"; - this.joinAChatToolStripMenuItem.Size = new System.Drawing.Size(130, 22); - this.joinAChatToolStripMenuItem.Text = "Join a chat"; - this.joinAChatToolStripMenuItem.Click += new System.EventHandler(this.joinAChatToolStripMenuItem_Click); - // // toolStripContainer1 // // @@ -331,6 +313,75 @@ namespace ShiftOS.WinForms.Applications // this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.menuStrip1); // + // pnlclasses + // + this.pnlclasses.Controls.Add(this.flowLayoutPanel6); + this.pnlclasses.Controls.Add(this.lbclasses); + this.pnlclasses.Controls.Add(this.lbclassdesc); + this.pnlclasses.Controls.Add(this.lbclasstitle); + this.pnlclasses.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlclasses.Location = new System.Drawing.Point(0, 0); + this.pnlclasses.Name = "pnlclasses"; + this.pnlclasses.Size = new System.Drawing.Size(756, 464); + this.pnlclasses.TabIndex = 3; + // + // flowLayoutPanel6 + // + this.flowLayoutPanel6.AutoSize = true; + this.flowLayoutPanel6.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel6.Controls.Add(this.btnchooseclass); + this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel6.Location = new System.Drawing.Point(0, 415); + this.flowLayoutPanel6.Name = "flowLayoutPanel6"; + this.flowLayoutPanel6.Padding = new System.Windows.Forms.Padding(10); + this.flowLayoutPanel6.Size = new System.Drawing.Size(756, 49); + this.flowLayoutPanel6.TabIndex = 3; + // + // btnchooseclass + // + this.btnchooseclass.AutoSize = true; + this.btnchooseclass.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnchooseclass.Location = new System.Drawing.Point(13, 13); + this.btnchooseclass.Name = "btnchooseclass"; + this.btnchooseclass.Size = new System.Drawing.Size(53, 23); + this.btnchooseclass.TabIndex = 0; + this.btnchooseclass.Text = "Choose"; + this.btnchooseclass.UseVisualStyleBackColor = true; + this.btnchooseclass.Click += new System.EventHandler(this.btnchooseclass_Click); + // + // lbclasses + // + this.lbclasses.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbclasses.FormattingEnabled = true; + this.lbclasses.Location = new System.Drawing.Point(0, 66); + this.lbclasses.Name = "lbclasses"; + this.lbclasses.Size = new System.Drawing.Size(756, 398); + this.lbclasses.TabIndex = 2; + // + // lbclassdesc + // + this.lbclassdesc.AutoSize = true; + this.lbclassdesc.Dock = System.Windows.Forms.DockStyle.Top; + this.lbclassdesc.Location = new System.Drawing.Point(0, 33); + this.lbclassdesc.Name = "lbclassdesc"; + this.lbclassdesc.Padding = new System.Windows.Forms.Padding(10); + this.lbclassdesc.Size = new System.Drawing.Size(727, 33); + this.lbclassdesc.TabIndex = 1; + this.lbclassdesc.Text = "A class is a way for the multi-user domain to better understand you. It defines w" + + "ho you are as a sentient being, what you do, what you like, and so on."; + // + // lbclasstitle + // + this.lbclasstitle.AutoSize = true; + this.lbclasstitle.Dock = System.Windows.Forms.DockStyle.Top; + this.lbclasstitle.Location = new System.Drawing.Point(0, 0); + this.lbclasstitle.Name = "lbclasstitle"; + this.lbclasstitle.Padding = new System.Windows.Forms.Padding(10); + this.lbclasstitle.Size = new System.Drawing.Size(82, 33); + this.lbclasstitle.TabIndex = 0; + this.lbclasstitle.Tag = "header1"; + this.lbclasstitle.Text = "Join a class"; + // // you_systemstatus // this.you_systemstatus.Controls.Add(this.btndeletesave); @@ -1191,75 +1242,6 @@ namespace ShiftOS.WinForms.Applications this.label3.Tag = "header1"; this.label3.Text = "Memos"; // - // pnlclasses - // - this.pnlclasses.Controls.Add(this.flowLayoutPanel6); - this.pnlclasses.Controls.Add(this.lbclasses); - this.pnlclasses.Controls.Add(this.lbclassdesc); - this.pnlclasses.Controls.Add(this.lbclasstitle); - this.pnlclasses.Dock = System.Windows.Forms.DockStyle.Fill; - this.pnlclasses.Location = new System.Drawing.Point(0, 0); - this.pnlclasses.Name = "pnlclasses"; - this.pnlclasses.Size = new System.Drawing.Size(756, 464); - this.pnlclasses.TabIndex = 3; - // - // lbclasstitle - // - this.lbclasstitle.AutoSize = true; - this.lbclasstitle.Dock = System.Windows.Forms.DockStyle.Top; - this.lbclasstitle.Location = new System.Drawing.Point(0, 0); - this.lbclasstitle.Name = "lbclasstitle"; - this.lbclasstitle.Padding = new System.Windows.Forms.Padding(10); - this.lbclasstitle.Size = new System.Drawing.Size(82, 33); - this.lbclasstitle.TabIndex = 0; - this.lbclasstitle.Tag = "header1"; - this.lbclasstitle.Text = "Join a class"; - // - // lbclassdesc - // - this.lbclassdesc.AutoSize = true; - this.lbclassdesc.Dock = System.Windows.Forms.DockStyle.Top; - this.lbclassdesc.Location = new System.Drawing.Point(0, 33); - this.lbclassdesc.Name = "lbclassdesc"; - this.lbclassdesc.Padding = new System.Windows.Forms.Padding(10); - this.lbclassdesc.Size = new System.Drawing.Size(727, 33); - this.lbclassdesc.TabIndex = 1; - this.lbclassdesc.Text = "A class is a way for the multi-user domain to better understand you. It defines w" + - "ho you are as a sentient being, what you do, what you like, and so on."; - // - // lbclasses - // - this.lbclasses.Dock = System.Windows.Forms.DockStyle.Fill; - this.lbclasses.FormattingEnabled = true; - this.lbclasses.Location = new System.Drawing.Point(0, 66); - this.lbclasses.Name = "lbclasses"; - this.lbclasses.Size = new System.Drawing.Size(756, 398); - this.lbclasses.TabIndex = 2; - // - // flowLayoutPanel6 - // - this.flowLayoutPanel6.AutoSize = true; - this.flowLayoutPanel6.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.flowLayoutPanel6.Controls.Add(this.btnchooseclass); - this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Bottom; - this.flowLayoutPanel6.Location = new System.Drawing.Point(0, 415); - this.flowLayoutPanel6.Name = "flowLayoutPanel6"; - this.flowLayoutPanel6.Padding = new System.Windows.Forms.Padding(10); - this.flowLayoutPanel6.Size = new System.Drawing.Size(756, 49); - this.flowLayoutPanel6.TabIndex = 3; - // - // btnchooseclass - // - this.btnchooseclass.AutoSize = true; - this.btnchooseclass.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.btnchooseclass.Location = new System.Drawing.Point(13, 13); - this.btnchooseclass.Name = "btnchooseclass"; - this.btnchooseclass.Size = new System.Drawing.Size(53, 23); - this.btnchooseclass.TabIndex = 0; - this.btnchooseclass.Text = "Choose"; - this.btnchooseclass.UseVisualStyleBackColor = true; - this.btnchooseclass.Click += new System.EventHandler(this.btnchooseclass_Click); - // // MUDControlCentre // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1276,6 +1258,10 @@ namespace ShiftOS.WinForms.Applications this.toolStripContainer1.TopToolStripPanel.PerformLayout(); this.toolStripContainer1.ResumeLayout(false); this.toolStripContainer1.PerformLayout(); + this.pnlclasses.ResumeLayout(false); + this.pnlclasses.PerformLayout(); + this.flowLayoutPanel6.ResumeLayout(false); + this.flowLayoutPanel6.PerformLayout(); this.you_systemstatus.ResumeLayout(false); this.you_systemstatus.PerformLayout(); this.shop_all.ResumeLayout(false); @@ -1320,10 +1306,6 @@ namespace ShiftOS.WinForms.Applications this.flowLayoutPanel2.PerformLayout(); this.you_memos.ResumeLayout(false); this.you_memos.PerformLayout(); - this.pnlclasses.ResumeLayout(false); - this.pnlclasses.PerformLayout(); - this.flowLayoutPanel6.ResumeLayout(false); - this.flowLayoutPanel6.PerformLayout(); this.ResumeLayout(false); } @@ -1418,8 +1400,6 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.Button btnremoveitem; private System.Windows.Forms.Button btnedititem; private System.Windows.Forms.Button btneditshop; - private System.Windows.Forms.ToolStripMenuItem chatToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem joinAChatToolStripMenuItem; private System.Windows.Forms.Button btndeletesave; private System.Windows.Forms.Panel pnlclasses; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel6; diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index fd03677..2260198 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -197,6 +197,13 @@ Category: "Device Drivers", Dependencies: "color_depth_dithering" }, + { + Name: "Shift Advanced App Launcher", + Cost: 150, + Description: "So you got yourself one of those fancy Advanced App Launchers. Well, it ain't so advanced if it can't be customized! This upgrade will add some settings to the Shifter so you can customize the Advanced App Launcher and its behaviour.", + Dependencies: "advanced_app_launcher;shifter", + Category: "Customization" + }, { Name: "Color Depth 2 bits", Cost: 2000, diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs index d12e54a..6d60f9d 100644 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -270,7 +270,10 @@ namespace ShiftOS.WinForms.Tools public static void SetupControls(Control frm, bool runInThread = true) { SetupControl(frm); - + frm.Click += (o, a) => + { + Desktop.HideAppLauncher(); + }; ThreadStart ts = () => { for (int i = 0; i < frm.Controls.Count; i++) diff --git a/ShiftOS.WinForms/WindowBorder.cs b/ShiftOS.WinForms/WindowBorder.cs index e809f90..64f2da4 100644 --- a/ShiftOS.WinForms/WindowBorder.cs +++ b/ShiftOS.WinForms/WindowBorder.cs @@ -92,6 +92,16 @@ namespace ShiftOS.WinForms lbtitletext.Text = title; } + public void SetupControls(Control ctrl) + { + foreach (Control c in ctrl.Controls) + SetupControls(c); + ctrl.Click += (o, a) => + { + Desktop.HideAppLauncher(); + }; + } + /// /// Initializes a new instance of the class. /// @@ -127,6 +137,8 @@ namespace ShiftOS.WinForms this.Width = LoadedSkin.LeftBorderWidth + _parentWindow.Width + LoadedSkin.RightBorderWidth; this.Height = LoadedSkin.TitlebarHeight + _parentWindow.Height + LoadedSkin.BottomBorderWidth; + SetupControls(this); + this.pnlcontents.Controls.Add(this._parentWindow); this._parentWindow.Dock = DockStyle.Fill; this._parentWindow.Show(); diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 8704b94..d50be53 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -244,45 +244,6 @@ namespace ShiftOS.WinForms private void ShowScreensaver() { - if (Shiftorium.UpgradeInstalled("screensavers")) - { - this.Invoke(new Action(() => - { - pnlscreensaver.Show(); - this.TopMost = true; - pnlssicon.Show(); - pnlssicon.BackColor = Color.Green; - pnlssicon.BackgroundImage = GetImage("screensaver"); - pnlssicon.BackgroundImageLayout = GetImageLayout("screensaver"); - - if (pnlssicon.BackgroundImage != null) - { - pnlssicon.Size = pnlssicon.BackgroundImage.Size; - } - - Cursor.Hide(); - - var t = new Thread(() => - { - var rnd = new Random(); - while (InScreensaver == true) - { - int x = rnd.Next(0, this.Width); - int y = rnd.Next(0, this.Height); - - this.Invoke(new Action(() => - { - pnlssicon.Location = new Point(x, y); - })); - - Thread.Sleep(5000); - } - ResetDesktop = true; - }); - t.IsBackground = true; - t.Start(); - })); - } } @@ -498,12 +459,47 @@ namespace ShiftOS.WinForms { if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) { - ControlManager.SetupControls(pnladvancedal); pnladvancedal.Visible = false; flapps.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; flcategories.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; - pnlalsystemactions.BackColor = LoadedSkin.DesktopPanelColor; - lbalstatus.BackColor = LoadedSkin.DesktopPanelColor; + pnlalsystemactions.BackColor = LoadedSkin.SystemPanelBackground; + lbalstatus.BackColor = LoadedSkin.ALStatusPanelBackColor; + //Fonts + lbalstatus.Font = LoadedSkin.ALStatusPanelFont; + btnshutdown.Font = LoadedSkin.ShutdownFont; + + //Upgrades + btnshutdown.Visible = Shiftorium.UpgradeInstalled("al_shutdown"); + + //Alignments and positions. + lbalstatus.TextAlign = LoadedSkin.ALStatusPanelAlignment; + if (LoadedSkin.ShutdownButtonStyle == 2) + btnshutdown.Hide(); + else if (LoadedSkin.ShutdownButtonStyle == 1) + { + btnshutdown.Parent = pnlstatus; + btnshutdown.BringToFront(); + } + else + btnshutdown.Parent = pnlalsystemactions; + if (LoadedSkin.ShutdownOnLeft) + { + btnshutdown.Location = LoadedSkin.ShutdownButtonFromSide; + } + else + { + btnshutdown.Left = (btnshutdown.Parent.Width - btnshutdown.Width) - LoadedSkin.ShutdownButtonFromSide.X; + btnshutdown.Top = LoadedSkin.ShutdownButtonFromSide.Y; + } + + //Images + lbalstatus.BackgroundImage = GetImage("al_bg_status"); + lbalstatus.BackgroundImageLayout = GetImageLayout("al_bg_status"); + + pnlalsystemactions.BackgroundImage = GetImage("al_bg_system"); + pnlalsystemactions.BackgroundImageLayout = GetImageLayout("al_bg_system"); + if (pnlalsystemactions.BackgroundImage != null) + btnshutdown.BackColor = Color.Transparent; } @@ -563,6 +559,7 @@ namespace ShiftOS.WinForms if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) { var catbtn = new Button(); + catbtn.Font = LoadedSkin.AdvALItemFont; catbtn.FlatStyle = FlatStyle.Flat; catbtn.FlatAppearance.BorderSize = 0; catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; @@ -600,7 +597,25 @@ namespace ShiftOS.WinForms TerminalBackend.InvokeCommand("sos.shutdown"); }; apps.DropDownItems.Add(item); - + if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) + { + if (LoadedSkin.ShutdownButtonStyle == 2) { + var catbtn = new Button(); + catbtn.Font = LoadedSkin.AdvALItemFont; + catbtn.FlatStyle = FlatStyle.Flat; + catbtn.FlatAppearance.BorderSize = 0; + catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; + catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; + catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; + catbtn.TextAlign = ContentAlignment.MiddleLeft; + catbtn.Text = "Shutdown"; + catbtn.Width = flcategories.Width; + catbtn.Height = 24; + flcategories.Controls.Add(catbtn); + catbtn.Show(); + catbtn.Click += (o, a) => TerminalBackend.InvokeCommand("sos.shutdown"); + } + } } } } @@ -614,6 +629,7 @@ namespace ShiftOS.WinForms foreach(var app in LauncherItemList[cat]) { var catbtn = new Button(); + catbtn.Font = LoadedSkin.AdvALItemFont; catbtn.FlatStyle = FlatStyle.Flat; catbtn.FlatAppearance.BorderSize = 0; catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; @@ -622,8 +638,8 @@ namespace ShiftOS.WinForms catbtn.TextAlign = ContentAlignment.MiddleLeft; catbtn.Text = (app is LuaLauncherItem) ? app.DisplayData.Name : NameChangerBackend.GetNameRaw(app.LaunchType); catbtn.Width = flapps.Width; + catbtn.ImageAlign = ContentAlignment.MiddleRight; catbtn.Height = 24; - catbtn.ImageAlign = ContentAlignment.MiddleLeft; catbtn.Image = (app.LaunchType == null) ? null : SkinEngine.GetIcon(app.LaunchType.Name); flapps.Controls.Add(catbtn); @@ -830,6 +846,14 @@ namespace ShiftOS.WinForms { TerminalBackend.InvokeCommand("sos.shutdown"); } + + public void HideAppLauncher() + { + this.Invoke(new Action(() => + { + pnladvancedal.Hide(); + })); + } } [ShiftOS.Engine.Scripting.Exposed("desktop")] -- cgit v1.2.3