diff --git a/ShiftOS.WinForms/LuaDesktop.Designer.cs b/ShiftOS.WinForms/LuaDesktop.Designer.cs
deleted file mode 100644
index 7c77f0e..0000000
--- a/ShiftOS.WinForms/LuaDesktop.Designer.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-namespace ShiftOS.WinForms
-{
- partial class LuaDesktop
- {
- ///
- /// 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.pnlcanvas = new System.Windows.Forms.Panel();
- this.SuspendLayout();
- //
- // pnlcanvas
- //
- this.pnlcanvas.Dock = System.Windows.Forms.DockStyle.Fill;
- this.pnlcanvas.Location = new System.Drawing.Point(0, 0);
- this.pnlcanvas.Name = "pnlcanvas";
- this.pnlcanvas.Size = new System.Drawing.Size(284, 261);
- this.pnlcanvas.TabIndex = 0;
- //
- // LuaDesktop
- //
- 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.pnlcanvas);
- this.Name = "LuaDesktop";
- this.Text = "LuaDesktop";
- this.Load += new System.EventHandler(this.LuaDesktop_Load);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.Panel pnlcanvas;
- }
-}
\ No newline at end of file
diff --git a/ShiftOS.WinForms/LuaDesktop.cs b/ShiftOS.WinForms/LuaDesktop.cs
deleted file mode 100644
index 8fd5244..0000000
--- a/ShiftOS.WinForms/LuaDesktop.cs
+++ /dev/null
@@ -1,214 +0,0 @@
-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 Newtonsoft.Json;
-using ShiftOS.Engine;
-using ShiftOS.Engine.Scripting;
-using ShiftOS.Objects.ShiftFS;
-using static ShiftOS.Engine.SkinEngine;
-
-
-namespace ShiftOS.WinForms
-{
- public partial class LuaDesktop : Form, IDesktop
- {
- public LuaDesktop(string script)
- {
- InitializeComponent();
- interpreter = new LuaInterpreter();
- interpreter.Lua.getCanvas = new Func(() =>
- {
- return this.pnlcanvas;
- });
- if (Utils.FileExists(script))
- {
- interpreter.ExecuteFile(script);
- }
- else
- {
- Desktop.Init(new WinformsDesktop(), true);
- Infobox.Show("Script not found.", "Couldn't find a ShiftOS script to handle the desktop environment.");
- this.Close();
- }
- }
-
- private LuaInterpreter interpreter = null;
-
- public string DesktopName
- {
- get
- {
- string name = "Unknown";
- try
- {
- name = (string.IsNullOrWhiteSpace(interpreter.Lua.deskName)) ? "Unknown" : interpreter.Lua.deskName;
- }
- catch
- {
-
- }
- return name;
- }
- }
-
- private IWindowBorder focused = null;
-
- public Size GetSize()
- {
- return this.Size;
- }
-
- public void InvokeOnWorkerThread(Action act)
- {
- this.Invoke(act);
- }
-
- public void PopulateAppLauncher(LauncherItem[] items)
- {
- interpreter.Lua.populateAppLauncher(interpreter.Lua.totable(new List(items)));
- }
-
- public void PopulatePanelButtons()
- {
- interpreter.Lua.populatePanelButtons();
- }
-
- public void SetupDesktop()
- {
- try
- {
- interpreter.Lua.setupDesktop();
- }
- catch (Exception ex)
- {
- Infobox.Show("Desktop setup error", "The desktop environment threw an exception: \r\n\r\n\r\n" + ex.Message);
- Desktop.Init(new WinformsDesktop(), true);
- this.Close();
- }
- }
-
- public void ShowWindow(IWindowBorder border)
- {
- var brdr = border as Form;
- focused = border;
- brdr.GotFocus += (o, a) =>
- {
- focused = border;
- };
- brdr.FormBorderStyle = FormBorderStyle.None;
- brdr.Show();
- brdr.TopMost = true;
- }
-
- ///
- /// Kills the window.
- ///
- /// The window.
- /// Border.
- public void KillWindow(IWindowBorder border)
- {
- border.Close();
- }
-
- ///
- /// Minimizes the window.
- ///
- /// Brdr.
- public void MinimizeWindow(IWindowBorder brdr)
- {
- var loc = (brdr as WindowBorder).Location;
- var sz = (brdr as WindowBorder).Size;
- (brdr as WindowBorder).Tag = JsonConvert.SerializeObject(new
- {
- Size = sz,
- Location = loc
- });
- (brdr as WindowBorder).Location = new Point(this.GetSize().Width * 2, this.GetSize().Height * 2);
- }
-
- ///
- /// Maximizes the window.
- ///
- /// The window.
- /// Brdr.
- public void MaximizeWindow(IWindowBorder brdr)
- {
- int startY = (LoadedSkin.DesktopPanelPosition == 1) ? 0 : LoadedSkin.DesktopPanelHeight;
- int h = this.GetSize().Height - LoadedSkin.DesktopPanelHeight;
- var loc = (brdr as WindowBorder).Location;
- var sz = (brdr as WindowBorder).Size;
- (brdr as WindowBorder).Tag = JsonConvert.SerializeObject(new
- {
- Size = sz,
- Location = loc
- });
- (brdr as WindowBorder).Location = new Point(0, startY);
- (brdr as WindowBorder).Size = new Size(this.GetSize().Width, h);
-
- }
-
- ///
- /// Restores the window.
- ///
- /// The window.
- /// Brdr.
- public void RestoreWindow(IWindowBorder brdr)
- {
- dynamic tag = JsonConvert.DeserializeObject((brdr as WindowBorder).Tag.ToString());
- (brdr as WindowBorder).Location = tag.Location;
- (brdr as WindowBorder).Size = tag.Size;
-
- }
-
- private void LuaDesktop_Load(object sender, EventArgs e)
- {
- this.LocationChanged += (o, a) =>
- {
- if (this.Left != 0)
- this.Left = 0;
- if (this.Top != 0)
- this.Top = 0;
- };
-
- this.SizeChanged += (o, a) =>
- {
- if(this.DisplayRectangle != Screen.PrimaryScreen.Bounds)
- {
- this.WindowState = FormWindowState.Maximized;
- }
- };
-
- interpreter.Lua.onLoadDesktop();
- SetupDesktop();
- SaveSystem.GameReady += () =>
- {
- InvokeOnWorkerThread(new Action(() =>
- {
- SetupDesktop();
- }));
- };
- SkinEngine.SkinLoaded += () =>
- {
- if(this.Visible == true)
- {
- SetupDesktop();
- }
- };
- Shiftorium.Installed += () =>
- {
- if (this.Visible == true)
- {
- SetupDesktop();
- }
-
- };
-
- }
- }
-}
diff --git a/ShiftOS.WinForms/LuaDesktop.resx b/ShiftOS.WinForms/LuaDesktop.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/ShiftOS.WinForms/LuaDesktop.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.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
index 5f85330..1b6b2d7 100644
--- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj
+++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
@@ -203,12 +203,6 @@
-
- Form
-
-
- LuaDesktop.cs
-
Form
@@ -304,9 +298,6 @@
FakeSetupScreen.cs
-
- LuaDesktop.cs
-
Oobe.cs
diff --git a/ShiftOS.WinForms/Tools/ShiftOSMenuRenderer.cs b/ShiftOS.WinForms/Tools/ShiftOSMenuRenderer.cs
index f4765e3..246be04 100644
--- a/ShiftOS.WinForms/Tools/ShiftOSMenuRenderer.cs
+++ b/ShiftOS.WinForms/Tools/ShiftOSMenuRenderer.cs
@@ -71,8 +71,19 @@ namespace ShiftOS.WinForms.Tools
e.TextColor = LoadedSkin.Menu_TextColor;
}
}
+ e.TextRectangle = GenRect(e.Text, e.TextFont, e.Item.Size, e.Graphics);
base.OnRenderItemText(e);
}
+
+ private Rectangle GenRect(string t, Font f, Size s, Graphics g)
+ {
+ Rectangle rect = new Rectangle();
+ var fSize = g.MeasureString(t, f);
+ var loc = new Point((s.Width - (int)fSize.Width) / 2, (s.Height - (int)fSize.Height) / 2);
+ var rSize = new Size(loc.X + (int)fSize.Width, loc.Y + (int)fSize.Height);
+ rect = new Rectangle(loc, rSize);
+ return rect;
+ }
}
public class ShiftOSColorTable : ProfessionalColorTable
diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs
index 83de1fb..7409040 100644
--- a/ShiftOS.WinForms/WinformsDesktop.cs
+++ b/ShiftOS.WinForms/WinformsDesktop.cs
@@ -131,71 +131,73 @@ namespace ShiftOS.WinForms
/// The panel buttons.
public void PopulatePanelButtons()
{
-
- panelbuttonholder.Controls.Clear();
- if (Shiftorium.IsInitiated == true)
+ if (DesktopFunctions.ShowDefaultElements == true)
{
- if (Shiftorium.UpgradeInstalled("wm_panel_buttons"))
+ panelbuttonholder.Controls.Clear();
+ if (Shiftorium.IsInitiated == true)
{
- foreach (WindowBorder form in Engine.AppearanceManager.OpenForms)
+ if (Shiftorium.UpgradeInstalled("wm_panel_buttons"))
{
- if (form != null)
+ foreach (WindowBorder form in Engine.AppearanceManager.OpenForms)
{
- if (form.Visible == true)
+ if (form != null)
{
- EventHandler onClick = (o, a) =>
+ if (form.Visible == true)
{
- if (form == focused)
+ EventHandler onClick = (o, a) =>
{
- if (form.IsMinimized)
+ if (form == focused)
{
- RestoreWindow(form);
+ if (form.IsMinimized)
+ {
+ RestoreWindow(form);
+ }
+ else
+ {
+ MinimizeWindow(form);
+ }
}
else
{
- MinimizeWindow(form);
+ form.BringToFront();
+ focused = form;
}
- }
- else
- {
- form.BringToFront();
- focused = form;
- }
- };
+ };
- var pnlbtn = new Panel();
- pnlbtn.Margin = new Padding(2, LoadedSkin.PanelButtonFromTop, 0, 0);
- pnlbtn.BackColor = LoadedSkin.PanelButtonColor;
- pnlbtn.BackgroundImage = GetImage("panelbutton");
- pnlbtn.BackgroundImageLayout = GetImageLayout("panelbutton");
+ var pnlbtn = new Panel();
+ pnlbtn.Margin = new Padding(2, LoadedSkin.PanelButtonFromTop, 0, 0);
+ pnlbtn.BackColor = LoadedSkin.PanelButtonColor;
+ pnlbtn.BackgroundImage = GetImage("panelbutton");
+ pnlbtn.BackgroundImageLayout = GetImageLayout("panelbutton");
- var pnlbtntext = new Label();
- pnlbtntext.Text = NameChangerBackend.GetName(form.ParentWindow);
- pnlbtntext.AutoSize = true;
- pnlbtntext.Location = LoadedSkin.PanelButtonFromLeft;
- pnlbtntext.ForeColor = LoadedSkin.PanelButtonTextColor;
- pnlbtntext.BackColor = Color.Transparent;
-
- pnlbtn.BackColor = LoadedSkin.PanelButtonColor;
- if (pnlbtn.BackgroundImage != null)
- {
+ var pnlbtntext = new Label();
+ pnlbtntext.Text = NameChangerBackend.GetName(form.ParentWindow);
+ pnlbtntext.AutoSize = true;
+ pnlbtntext.Location = LoadedSkin.PanelButtonFromLeft;
+ pnlbtntext.ForeColor = LoadedSkin.PanelButtonTextColor;
pnlbtntext.BackColor = Color.Transparent;
- }
- pnlbtn.Size = LoadedSkin.PanelButtonSize;
- pnlbtn.Tag = "keepbg";
- pnlbtntext.Tag = "keepbg";
- pnlbtn.Controls.Add(pnlbtntext);
- this.panelbuttonholder.Controls.Add(pnlbtn);
- pnlbtn.Show();
- pnlbtntext.Show();
- if (Shiftorium.UpgradeInstalled("useful_panel_buttons"))
- {
- pnlbtn.Click += onClick;
- pnlbtntext.Click += onClick;
- }
- pnlbtntext.Font = LoadedSkin.PanelButtonFont;
+ pnlbtn.BackColor = LoadedSkin.PanelButtonColor;
+ if (pnlbtn.BackgroundImage != null)
+ {
+ pnlbtntext.BackColor = Color.Transparent;
+ }
+ pnlbtn.Size = LoadedSkin.PanelButtonSize;
+ pnlbtn.Tag = "keepbg";
+ pnlbtntext.Tag = "keepbg";
+ pnlbtn.Controls.Add(pnlbtntext);
+ this.panelbuttonholder.Controls.Add(pnlbtn);
+ pnlbtn.Show();
+ pnlbtntext.Show();
+ if (Shiftorium.UpgradeInstalled("useful_panel_buttons"))
+ {
+ pnlbtn.Click += onClick;
+ pnlbtntext.Click += onClick;
+ }
+ pnlbtntext.Font = LoadedSkin.PanelButtonFont;
+
+ }
}
}
}
@@ -211,70 +213,77 @@ namespace ShiftOS.WinForms
/// The desktop.
public void SetupDesktop()
{
- ToolStripManager.Renderer = new ShiftOSMenuRenderer();
-
- this.DoubleBuffered = true;
- this.FormBorderStyle = FormBorderStyle.None;
- this.WindowState = FormWindowState.Maximized;
- desktoppanel.BackColor = Color.Green;
-
- //upgrades
-
- if (Shiftorium.IsInitiated == true)
+ if (DesktopFunctions.ShowDefaultElements == true)
{
- desktoppanel.Visible = Shiftorium.UpgradeInstalled("desktop");
- lbtime.Visible = Shiftorium.UpgradeInstalled("desktop_clock_widget");
+ ToolStripManager.Renderer = new ShiftOSMenuRenderer();
- //skinning
- lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor;
+ this.DoubleBuffered = true;
+ this.FormBorderStyle = FormBorderStyle.None;
+ this.WindowState = FormWindowState.Maximized;
+ desktoppanel.BackColor = Color.Green;
- panelbuttonholder.Top = 0;
- panelbuttonholder.Left = LoadedSkin.PanelButtonHolderFromLeft;
- panelbuttonholder.Height = desktoppanel.Height;
- panelbuttonholder.BackColor = Color.Transparent;
- panelbuttonholder.Margin = new Padding(0, 0, 0, 0);
+ //upgrades
- sysmenuholder.Visible = Shiftorium.UpgradeInstalled("app_launcher");
-
- //The Color Picker can give us transparent colors - which Windows Forms fucking despises when dealing with form backgrounds.
- //To compensate, we must recreate the desktop color and make the alpha channel '255'.
- this.BackColor = Color.FromArgb(LoadedSkin.DesktopColor.R, LoadedSkin.DesktopColor.G, LoadedSkin.DesktopColor.B);
- //Not doing this will cause an ArgumentException.
-
- DitheringEngine.DitherImage(SkinEngine.GetImage("desktopbackground"), new Action((img) =>
+ if (Shiftorium.IsInitiated == true)
{
- this.BackgroundImage = img;
- }));
- this.BackgroundImageLayout = GetImageLayout("desktopbackground");
- desktoppanel.BackgroundImage = GetImage("desktoppanel");
- menuStrip1.BackgroundImage = GetImage("applauncher");
- lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor;
- lbtime.Font = LoadedSkin.DesktopPanelClockFont;
- if (desktoppanel.BackgroundImage == null)
- {
- lbtime.BackColor = LoadedSkin.DesktopPanelClockBackgroundColor;
- }
- else
- {
- lbtime.BackColor = Color.Transparent;
- }
- apps.Text = LoadedSkin.AppLauncherText;
- sysmenuholder.Location = LoadedSkin.AppLauncherFromLeft;
- sysmenuholder.Size = LoadedSkin.AppLauncherHolderSize;
- apps.Size = sysmenuholder.Size;
- menuStrip1.Renderer = new ShiftOSMenuRenderer(new AppLauncherColorTable());
- desktoppanel.BackColor = LoadedSkin.DesktopPanelColor;
- desktoppanel.BackgroundImageLayout = GetImageLayout("desktoppanel");
- desktoppanel.Height = LoadedSkin.DesktopPanelHeight;
- if (LoadedSkin.DesktopPanelPosition == 1)
- {
- desktoppanel.Dock = DockStyle.Bottom;
- }
- else
- {
- desktoppanel.Dock = DockStyle.Top;
+ desktoppanel.Visible = Shiftorium.UpgradeInstalled("desktop");
+ lbtime.Visible = Shiftorium.UpgradeInstalled("desktop_clock_widget");
+
+ //skinning
+ lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor;
+
+ panelbuttonholder.Top = 0;
+ panelbuttonholder.Left = LoadedSkin.PanelButtonHolderFromLeft;
+ panelbuttonholder.Height = desktoppanel.Height;
+ panelbuttonholder.BackColor = Color.Transparent;
+ panelbuttonholder.Margin = new Padding(0, 0, 0, 0);
+
+ sysmenuholder.Visible = Shiftorium.UpgradeInstalled("app_launcher");
+
+ //The Color Picker can give us transparent colors - which Windows Forms fucking despises when dealing with form backgrounds.
+ //To compensate, we must recreate the desktop color and make the alpha channel '255'.
+ this.BackColor = Color.FromArgb(LoadedSkin.DesktopColor.R, LoadedSkin.DesktopColor.G, LoadedSkin.DesktopColor.B);
+ //Not doing this will cause an ArgumentException.
+
+ DitheringEngine.DitherImage(SkinEngine.GetImage("desktopbackground"), new Action((img) =>
+ {
+ this.BackgroundImage = img;
+ }));
+ this.BackgroundImageLayout = GetImageLayout("desktopbackground");
+ desktoppanel.BackgroundImage = GetImage("desktoppanel");
+ menuStrip1.BackgroundImage = GetImage("applauncher");
+ lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor;
+ lbtime.Font = LoadedSkin.DesktopPanelClockFont;
+ if (desktoppanel.BackgroundImage == null)
+ {
+ lbtime.BackColor = LoadedSkin.DesktopPanelClockBackgroundColor;
+ }
+ else
+ {
+ lbtime.BackColor = Color.Transparent;
+ }
+ apps.Text = LoadedSkin.AppLauncherText;
+ sysmenuholder.Location = LoadedSkin.AppLauncherFromLeft;
+ sysmenuholder.Size = LoadedSkin.AppLauncherHolderSize;
+ apps.Size = sysmenuholder.Size;
+ menuStrip1.Renderer = new ShiftOSMenuRenderer(new AppLauncherColorTable());
+ desktoppanel.BackColor = LoadedSkin.DesktopPanelColor;
+ desktoppanel.BackgroundImageLayout = GetImageLayout("desktoppanel");
+ desktoppanel.Height = LoadedSkin.DesktopPanelHeight;
+ if (LoadedSkin.DesktopPanelPosition == 1)
+ {
+ desktoppanel.Dock = DockStyle.Bottom;
+ }
+ else
+ {
+ desktoppanel.Dock = DockStyle.Top;
+ }
}
}
+ else
+ {
+ desktoppanel.Hide();
+ }
LuaInterpreter.RaiseEvent("on_desktop_skin", this);
@@ -302,80 +311,82 @@ namespace ShiftOS.WinForms
/// Items.
public void PopulateAppLauncher(LauncherItem[] items)
{
- apps.DropDownItems.Clear();
-
- Dictionary> sortedItems = new Dictionary>();
-
-
-
- foreach (var kv in items)
+ if (DesktopFunctions.ShowDefaultElements == true)
{
- var item = new ToolStripMenuItem();
- item.Text = (kv.LaunchType == null) ? kv.DisplayData.Name : Applications.NameChangerBackend.GetNameRaw(kv.LaunchType);
- item.Image = (kv.LaunchType == null) ? null : SkinEngine.GetIcon(kv.LaunchType.Name);
- item.Click += (o, a) =>
- {
- if (kv is LuaLauncherItem)
- {
- var interpreter = new Engine.Scripting.LuaInterpreter();
- interpreter.ExecuteFile((kv as LuaLauncherItem).LaunchPath);
- }
- else
- {
- Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
- }
+ apps.DropDownItems.Clear();
- };
- if (sortedItems.ContainsKey(kv.DisplayData.Category))
- {
- sortedItems[kv.DisplayData.Category].Add(item);
- }
- else
- {
- sortedItems.Add(kv.DisplayData.Category, new List());
- sortedItems[kv.DisplayData.Category].Add(item);
- }
- }
+ Dictionary> sortedItems = new Dictionary>();
- foreach(var kv in sortedItems)
- {
- if (Shiftorium.IsInitiated == true)
- {
- if (Shiftorium.UpgradeInstalled("app_launcher_categories"))
- {
- var cat = GetALCategoryWithName(kv.Key);
- foreach (var subItem in kv.Value)
- {
- cat.DropDownItems.Add(subItem);
- }
- }
- else
- {
- foreach (var subItem in kv.Value)
- {
- apps.DropDownItems.Add(subItem);
- }
- }
- }
- }
- if (Shiftorium.IsInitiated == true)
- {
- if (Shiftorium.UpgradeInstalled("al_shutdown"))
+ foreach (var kv in items)
{
- apps.DropDownItems.Add(new ToolStripSeparator());
var item = new ToolStripMenuItem();
- item.Text = Localization.Parse("{SHUTDOWN}");
+ item.Text = (kv.LaunchType == null) ? kv.DisplayData.Name : Applications.NameChangerBackend.GetNameRaw(kv.LaunchType);
+ item.Image = (kv.LaunchType == null) ? null : SkinEngine.GetIcon(kv.LaunchType.Name);
item.Click += (o, a) =>
{
- TerminalBackend.InvokeCommand("sos.shutdown");
- };
- apps.DropDownItems.Add(item);
+ if (kv is LuaLauncherItem)
+ {
+ var interpreter = new Engine.Scripting.LuaInterpreter();
+ interpreter.ExecuteFile((kv as LuaLauncherItem).LaunchPath);
+ }
+ else
+ {
+ Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
+ }
+ };
+ if (sortedItems.ContainsKey(kv.DisplayData.Category))
+ {
+ sortedItems[kv.DisplayData.Category].Add(item);
+ }
+ else
+ {
+ sortedItems.Add(kv.DisplayData.Category, new List());
+ sortedItems[kv.DisplayData.Category].Add(item);
+ }
+ }
+
+ foreach (var kv in sortedItems)
+ {
+ if (Shiftorium.IsInitiated == true)
+ {
+ if (Shiftorium.UpgradeInstalled("app_launcher_categories"))
+ {
+ var cat = GetALCategoryWithName(kv.Key);
+ foreach (var subItem in kv.Value)
+ {
+ cat.DropDownItems.Add(subItem);
+ }
+ }
+
+ else
+ {
+ foreach (var subItem in kv.Value)
+ {
+ apps.DropDownItems.Add(subItem);
+ }
+ }
+ }
+ }
+
+ if (Shiftorium.IsInitiated == true)
+ {
+ if (Shiftorium.UpgradeInstalled("al_shutdown"))
+ {
+ apps.DropDownItems.Add(new ToolStripSeparator());
+ var item = new ToolStripMenuItem();
+ item.Text = Localization.Parse("{SHUTDOWN}");
+ item.Click += (o, a) =>
+ {
+ TerminalBackend.InvokeCommand("sos.shutdown");
+ };
+ apps.DropDownItems.Add(item);
+
+ }
}
}
-
LuaInterpreter.RaiseEvent("on_al_populate", items);
}
@@ -501,6 +512,13 @@ namespace ShiftOS.WinForms
this.Invoke(act);
}
+ public void OpenAppLauncher(Point loc)
+ {
+ apps.DropDown.Left = loc.X;
+ apps.DropDown.Top = loc.Y;
+ apps.ShowDropDown();
+ }
+
///
/// Gets the size.
///
@@ -514,9 +532,50 @@ namespace ShiftOS.WinForms
[ShiftOS.Engine.Scripting.Exposed("desktop")]
public class DesktopFunctions
{
+ public static bool ShowDefaultElements = true;
+
public dynamic getWindow()
{
return Desktop.CurrentDesktop;
}
+
+ public void showDefaultElements(bool val)
+ {
+ ShowDefaultElements = val;
+ SkinEngine.LoadSkin();
+ }
+
+ public dynamic getOpenWindows()
+ {
+ return AppearanceManager.OpenForms;
+ }
+
+ public string getALItemName(LauncherItem kv)
+ {
+ return (kv.LaunchType == null) ? kv.DisplayData.Name : Applications.NameChangerBackend.GetNameRaw(kv.LaunchType);
+ }
+
+ public void openAppLauncher(Point loc)
+ {
+ Desktop.OpenAppLauncher(loc);
+ }
+
+ public string getWindowTitle(IWindowBorder form)
+ {
+ return NameChangerBackend.GetName(form.ParentWindow);
+ }
+
+ public void openApp(LauncherItem kv)
+ {
+ if (kv is LuaLauncherItem)
+ {
+ var interpreter = new Engine.Scripting.LuaInterpreter();
+ interpreter.ExecuteFile((kv as LuaLauncherItem).LaunchPath);
+ }
+ else
+ {
+ Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
+ }
+ }
}
}
diff --git a/ShiftOS_TheReturn/Desktop.cs b/ShiftOS_TheReturn/Desktop.cs
index 256ab09..0373101 100644
--- a/ShiftOS_TheReturn/Desktop.cs
+++ b/ShiftOS_TheReturn/Desktop.cs
@@ -86,6 +86,8 @@ namespace ShiftOS.Engine
void InvokeOnWorkerThread(Action act);
Size GetSize();
+ void OpenAppLauncher(Point loc);
+
void Show();
void Close();
}
@@ -154,6 +156,11 @@ namespace ShiftOS.Engine
{
_desktop.PopulateAppLauncher(AppLauncherDaemon.Available().ToArray());
}
+
+ public static void OpenAppLauncher(Point loc)
+ {
+ _desktop.OpenAppLauncher(loc);
+ }
}
}
diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs
index e3512d8..4837dcd 100644
--- a/ShiftOS_TheReturn/Skinning.cs
+++ b/ShiftOS_TheReturn/Skinning.cs
@@ -348,7 +348,7 @@ namespace ShiftOS.Engine {
[ShifterName("Panel button holder from left")]
[ShifterDescription("How far from the left should the panel button holder be?")]
[RequiresUpgrade("shift_panel_buttons")]
- public int PanelButtonHolderFromLeft = 68;
+ public int PanelButtonHolderFromLeft = 100;
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
@@ -832,7 +832,7 @@ namespace ShiftOS.Engine {
[ShifterName("App launcher size")]
[ShifterDescription("The size of the app launcher.")]
[RequiresUpgrade("shift_app_launcher")]
- public Size AppLauncherHolderSize = new Size(68, 24);
+ public Size AppLauncherHolderSize = new Size(100, 24);
[ShifterMeta("Desktop")]
[ShifterCategory("App Launcher")]