Hide AL when clicking on window ctrls
This commit is contained in:
parent
0807e04881
commit
56e216a430
7 changed files with 358 additions and 194 deletions
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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++)
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ShiftOS.WinForms.WindowBorder"/> class.
|
||||
/// </summary>
|
||||
|
@ -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();
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -76,6 +76,9 @@ namespace ShiftOS.Engine
|
|||
string DesktopName { get; }
|
||||
|
||||
void SetupDesktop();
|
||||
|
||||
void HideAppLauncher();
|
||||
|
||||
void PopulateAppLauncher(LauncherItem[] items);
|
||||
void ShowWindow(IWindowBorder border);
|
||||
void KillWindow(IWindowBorder border);
|
||||
|
@ -161,6 +164,11 @@ namespace ShiftOS.Engine
|
|||
{
|
||||
_desktop.OpenAppLauncher(loc);
|
||||
}
|
||||
|
||||
public static void HideAppLauncher()
|
||||
{
|
||||
_desktop.HideAppLauncher();
|
||||
}
|
||||
}
|
||||
// sorry i almost killed everything :P
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ using static ShiftOS.Engine.SaveSystem;
|
|||
using ShiftOS.Objects.ShiftFS;
|
||||
using System.Reflection;
|
||||
using ShiftOS.Engine.Scripting;
|
||||
namespace ShiftOS.Engine {
|
||||
namespace ShiftOS.Engine
|
||||
{
|
||||
|
||||
[Exposed("skinning")]
|
||||
public class SkinFunctions
|
||||
|
@ -43,7 +44,7 @@ namespace ShiftOS.Engine {
|
|||
public void loadSkin()
|
||||
{
|
||||
SkinEngine.LoadSkin();
|
||||
}
|
||||
}
|
||||
|
||||
public dynamic getSkin()
|
||||
{
|
||||
|
@ -63,7 +64,8 @@ namespace ShiftOS.Engine {
|
|||
}
|
||||
|
||||
|
||||
public static class SkinEngine {
|
||||
public static class SkinEngine
|
||||
{
|
||||
public static ImageLayout GetImageLayout(string img)
|
||||
{
|
||||
if (LoadedSkin.SkinImageLayouts.ContainsKey(img))
|
||||
|
@ -77,14 +79,19 @@ namespace ShiftOS.Engine {
|
|||
}
|
||||
}
|
||||
|
||||
public static System.Drawing.Image GetImage(string img) {
|
||||
public static System.Drawing.Image GetImage(string img)
|
||||
{
|
||||
var type = typeof(Skin);
|
||||
|
||||
foreach (var field in type.GetFields()) {
|
||||
foreach (var attr in field.GetCustomAttributes(false)) {
|
||||
if (attr is ImageAttribute) {
|
||||
foreach (var field in type.GetFields())
|
||||
{
|
||||
foreach (var attr in field.GetCustomAttributes(false))
|
||||
{
|
||||
if (attr is ImageAttribute)
|
||||
{
|
||||
var iattr = attr as ImageAttribute;
|
||||
if (iattr.Name == img) {
|
||||
if (iattr.Name == img)
|
||||
{
|
||||
byte[] image = (byte[])field.GetValue(LoadedSkin);
|
||||
return ImageFromBinary(image);
|
||||
}
|
||||
|
@ -100,7 +107,8 @@ namespace ShiftOS.Engine {
|
|||
_iconProber = prober;
|
||||
}
|
||||
|
||||
public static Image ImageFromBinary(byte[] image) {
|
||||
public static Image ImageFromBinary(byte[] image)
|
||||
{
|
||||
if (image == null)
|
||||
return null;
|
||||
Image img = (Bitmap)((new ImageConverter()).ConvertFrom(image));
|
||||
|
@ -121,32 +129,40 @@ namespace ShiftOS.Engine {
|
|||
}
|
||||
}
|
||||
|
||||
public static void Init() {
|
||||
Application.ApplicationExit += (o, a) => {
|
||||
public static void Init()
|
||||
{
|
||||
Application.ApplicationExit += (o, a) =>
|
||||
{
|
||||
SaveSkin();
|
||||
};
|
||||
|
||||
if (!Utils.FileExists(Paths.GetPath("skin.json"))) {
|
||||
if (!Utils.FileExists(Paths.GetPath("skin.json")))
|
||||
{
|
||||
LoadedSkin = new ShiftOS.Engine.Skin();
|
||||
SaveSkin();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadSkin();
|
||||
}
|
||||
if (SaveSystem.CurrentSave != null) {
|
||||
if (SaveSystem.CurrentSave != null)
|
||||
{
|
||||
SkinLoaded?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public static event EmptyEventHandler SkinLoaded;
|
||||
|
||||
public static void LoadSkin() {
|
||||
public static void LoadSkin()
|
||||
{
|
||||
LoadedSkin = JsonConvert.DeserializeObject<Skin>(Utils.ReadAllText(Paths.GetPath("skin.json")));
|
||||
SkinLoaded?.Invoke();
|
||||
Desktop.ResetPanelButtons();
|
||||
Desktop.PopulateAppLauncher();
|
||||
}
|
||||
|
||||
public static void SaveSkin() {
|
||||
public static void SaveSkin()
|
||||
{
|
||||
Utils.WriteAllText(Paths.GetPath("skin.json"), JsonConvert.SerializeObject(LoadedSkin, Formatting.Indented));
|
||||
}
|
||||
|
||||
|
@ -160,20 +176,20 @@ namespace ShiftOS.Engine {
|
|||
}
|
||||
else
|
||||
{
|
||||
foreach(var f in System.IO.Directory.GetFiles(Environment.CurrentDirectory))
|
||||
foreach (var f in System.IO.Directory.GetFiles(Environment.CurrentDirectory))
|
||||
{
|
||||
if(f.EndsWith(".exe") || f.EndsWith(".dll"))
|
||||
if (f.EndsWith(".exe") || f.EndsWith(".dll"))
|
||||
{
|
||||
try
|
||||
{
|
||||
var asm = Assembly.LoadFile(f);
|
||||
foreach(var type in asm.GetTypes())
|
||||
foreach (var type in asm.GetTypes())
|
||||
{
|
||||
if(type.Name == id)
|
||||
if (type.Name == id)
|
||||
{
|
||||
foreach(var attr in type.GetCustomAttributes(true))
|
||||
foreach (var attr in type.GetCustomAttributes(true))
|
||||
{
|
||||
if(attr is DefaultIconAttribute)
|
||||
if (attr is DefaultIconAttribute)
|
||||
{
|
||||
return _iconProber.GetIcon(attr as DefaultIconAttribute);
|
||||
}
|
||||
|
@ -202,7 +218,7 @@ namespace ShiftOS.Engine {
|
|||
return Image.FromStream(sr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,7 +237,8 @@ namespace ShiftOS.Engine {
|
|||
public string ID { get; private set; }
|
||||
}
|
||||
|
||||
public class Skin {
|
||||
public class Skin
|
||||
{
|
||||
//borrowing from the discourse theme for the default skin
|
||||
private static readonly Color DefaultBackground = Color.FromArgb(0, 0x44, 0x00);
|
||||
private static readonly Color DefaultForeground = Color.FromArgb(0xDD, 0xDD, 0xDD);
|
||||
|
@ -278,8 +295,8 @@ namespace ShiftOS.Engine {
|
|||
[ShifterName("System Font")]
|
||||
[ShifterDescription("The font style used by the system.")]
|
||||
public Font MainFont = SysFont;
|
||||
|
||||
[ShifterEnumMask(new[] { "Right", "Left"})]
|
||||
|
||||
[ShifterEnumMask(new[] { "Right", "Left" })]
|
||||
[ShifterMeta("Windows")]
|
||||
[ShifterCategory("Title Buttons")]
|
||||
[ShifterName("Title button position")]
|
||||
|
@ -1068,25 +1085,126 @@ namespace ShiftOS.Engine {
|
|||
[ShifterName("App icon from side")]
|
||||
[ShifterDescription("How far from the side should the icon be?")]
|
||||
[RequiresUpgrade("shift_titlebar;app_icons")]
|
||||
public Point TitlebarIconFromSide = new Point(4,4);
|
||||
public Point TitlebarIconFromSide = new Point(4, 4);
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("shift_advanced_app_launcher")]
|
||||
[ShifterName("Status Panel Font")]
|
||||
[ShifterDescription("The font used by the status panel in the Advanced App Launcher.")]
|
||||
public Font ALStatusPanelFont = SysFont;
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("shift_advanced_app_launcher")]
|
||||
[ShifterName("Status Panel Text Color")]
|
||||
[ShifterDescription("The text color for the AL status panel.")]
|
||||
public Color ALStatusPanelTextColor = Skin.DefaultForeground;
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("shift_advanced_app_launcher")]
|
||||
[ShifterName("Status Panel Background")]
|
||||
[ShifterDescription("The status panel's background color.")]
|
||||
public Color ALStatusPanelBackColor = TitleBG;
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("shift_advanced_app_launcher")]
|
||||
[ShifterName("Status Panel Text Alignment")]
|
||||
[ShifterDescription("What part of the panel should the status text stick to?")]
|
||||
public ContentAlignment ALStatusPanelAlignment = ContentAlignment.MiddleCenter;
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("skinning;shift_advanced_app_launcher")]
|
||||
[ShifterName("Status Panel Background Image")]
|
||||
[ShifterDescription("Use an image for the App Launcher Status Panel")]
|
||||
[Image("al_bg_status")]
|
||||
public byte[] ALStatusPanelBG = null;
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("shift_advanced_app_launcher")]
|
||||
[ShifterEnumMask(new[] { "Button, bottom panel", "Button, top panel", "Category Item" })]
|
||||
[ShifterName("Shutdown Button position")]
|
||||
[ShifterDescription("Change the position and layout of the App Launcher Shutdown button.")]
|
||||
public int ShutdownButtonStyle = 0;
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("shift_advanced_app_launcher")]
|
||||
[ShifterName("Shutdown Button from side")]
|
||||
[ShifterDescription("The location relative to the side of the system panel that the shutdown button should reside from.")]
|
||||
public Point ShutdownButtonFromSide = new Point(2, 2);
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("shift_advanced_app_launcher")]
|
||||
[ShifterName("Align shutdown button to left?")]
|
||||
[ShifterDescription("Should the location of the shutdown button be calculated relative to the left of the system panel?")]
|
||||
public bool ShutdownOnLeft = false;
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("shift_advanced_app_launcher")]
|
||||
[ShifterName("Shutdown Button Font")]
|
||||
[ShifterDescription("The font of the Shutdown Button")]
|
||||
public Font ShutdownFont = SysFont;
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("shift_advanced_app_launcher")]
|
||||
[ShifterName("Shutdown Text Color")]
|
||||
[ShifterDescription("The foreground color of the Shutdown button")]
|
||||
public Color ShutdownForeColor = DefaultForeground;
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("shift_advanced_app_launcher")]
|
||||
[ShifterName("System Panel background color")]
|
||||
[ShifterDescription("The background color of the App Launcher System Panel.")]
|
||||
public Color SystemPanelBackground = TitleBG;
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("skinning;shift_advanced_app_launcher")]
|
||||
[ShifterName("System Panel Background Image")]
|
||||
[ShifterDescription("The background image of the System Panel.")]
|
||||
[Image("al_bg_system")]
|
||||
public byte[] SystemPanelBG = null;
|
||||
|
||||
[ShifterMeta("Desktop")]
|
||||
[ShifterCategory("App Launcher")]
|
||||
[RequiresUpgrade("shift_advanced_app_launcher")]
|
||||
[ShifterName("App Launcher Item Font")]
|
||||
[ShifterDescription("Select the font to use for the items in the App Launcher.")]
|
||||
public Font AdvALItemFont = SysFont2;
|
||||
}
|
||||
|
||||
public class ShifterHiddenAttribute : Attribute {
|
||||
public class ShifterHiddenAttribute : Attribute
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class ShifterFlagAttribute : Attribute {
|
||||
public ShifterFlagAttribute(string flag, bool expected) {
|
||||
public class ShifterFlagAttribute : Attribute
|
||||
{
|
||||
public ShifterFlagAttribute(string flag, bool expected)
|
||||
{
|
||||
Expected = expected;
|
||||
Flag = flag;
|
||||
}
|
||||
|
||||
public bool Expected { get; set; }
|
||||
public string Flag { get; set; }
|
||||
public bool IsTrue(Skin skn) {
|
||||
foreach (var f in skn.GetType().GetFields()) {
|
||||
if (f.Name == Flag) {
|
||||
if (f.FieldType == typeof(bool)) {
|
||||
public bool IsTrue(Skin skn)
|
||||
{
|
||||
foreach (var f in skn.GetType().GetFields())
|
||||
{
|
||||
if (f.Name == Flag)
|
||||
{
|
||||
if (f.FieldType == typeof(bool))
|
||||
{
|
||||
return (bool)f.GetValue(skn) == Expected;
|
||||
}
|
||||
}
|
||||
|
@ -1095,12 +1213,14 @@ namespace ShiftOS.Engine {
|
|||
}
|
||||
}
|
||||
|
||||
public class ImageAttribute : Attribute {
|
||||
public class ImageAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Attribute a byte array within the Skin object with this attribute and the engine and Shifter will see it as an image and you'll be able to grab the image by calling SkinEngine.GetImage() passing the name you input here.
|
||||
/// </summary>
|
||||
/// <param name="name">The name you want to reference this image as in the code.</param>
|
||||
public ImageAttribute(string name) {
|
||||
public ImageAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
|
@ -1108,8 +1228,10 @@ namespace ShiftOS.Engine {
|
|||
}
|
||||
|
||||
|
||||
public class ShifterEnumMaskAttribute : Attribute {
|
||||
public ShifterEnumMaskAttribute(string[] items) {
|
||||
public class ShifterEnumMaskAttribute : Attribute
|
||||
{
|
||||
public ShifterEnumMaskAttribute(string[] items)
|
||||
{
|
||||
Items = items;
|
||||
}
|
||||
|
||||
|
@ -1118,37 +1240,45 @@ namespace ShiftOS.Engine {
|
|||
|
||||
|
||||
|
||||
public class ShifterNameAttribute : Attribute {
|
||||
public ShifterNameAttribute(string name) {
|
||||
public class ShifterNameAttribute : Attribute
|
||||
{
|
||||
public ShifterNameAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
public class ShifterDescriptionAttribute : Attribute {
|
||||
public ShifterDescriptionAttribute(string description) {
|
||||
public class ShifterDescriptionAttribute : Attribute
|
||||
{
|
||||
public ShifterDescriptionAttribute(string description)
|
||||
{
|
||||
Description = description;
|
||||
}
|
||||
|
||||
public string Description { get; set; }
|
||||
}
|
||||
|
||||
public class ShifterCategoryAttribute : Attribute {
|
||||
public class ShifterCategoryAttribute : Attribute
|
||||
{
|
||||
|
||||
public ShifterCategoryAttribute(string category) {
|
||||
public ShifterCategoryAttribute(string category)
|
||||
{
|
||||
Category = category;
|
||||
}
|
||||
|
||||
public string Category { get; set; }
|
||||
}
|
||||
|
||||
public class ShifterMetaAttribute : Attribute {
|
||||
public class ShifterMetaAttribute : Attribute
|
||||
{
|
||||
|
||||
public ShifterMetaAttribute(string meta) {
|
||||
public ShifterMetaAttribute(string meta)
|
||||
{
|
||||
Meta = meta;
|
||||
}
|
||||
|
||||
public string Meta { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue