aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-02-18 13:25:30 -0500
committerMichael <[email protected]>2017-02-18 13:25:30 -0500
commit423569f4ae2558b135f92d2f9cb7e163eb7bcc22 (patch)
tree1ff082f62378119a916a73deb1eb3b4fb1c0b72f
parent5c025fd165755a7801c51ff263dbc12a7cdab4d6 (diff)
downloadshiftos_thereturn-423569f4ae2558b135f92d2f9cb7e163eb7bcc22.tar.gz
shiftos_thereturn-423569f4ae2558b135f92d2f9cb7e163eb7bcc22.tar.bz2
shiftos_thereturn-423569f4ae2558b135f92d2f9cb7e163eb7bcc22.zip
Add on_key_down event and other goodies
-rw-r--r--ShiftOS.WinForms/Tools/ControlManager.cs11
-rw-r--r--ShiftOS.WinForms/WindowBorder.cs4
-rw-r--r--ShiftOS.WinForms/WinformsDesktop.cs2
-rw-r--r--ShiftOS_TheReturn/Scripting.cs15
-rw-r--r--ShiftOS_TheReturn/Skinning.cs24
5 files changed, 54 insertions, 2 deletions
diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs
index f9fb799..32f0217 100644
--- a/ShiftOS.WinForms/Tools/ControlManager.cs
+++ b/ShiftOS.WinForms/Tools/ControlManager.cs
@@ -229,8 +229,19 @@ namespace ShiftOS.WinForms.Tools
if (a.Control && a.KeyCode == Keys.T)
{
a.SuppressKeyPress = true;
+
+
+ if (SaveSystem.CurrentSave != null)
+ {
+ if (Shiftorium.UpgradeInstalled("window_manager"))
+ {
+ Engine.AppearanceManager.SetupWindow(new Applications.Terminal());
+ }
+ }
}
+ ShiftOS.Engine.Scripting.LuaInterpreter.RaiseEvent("on_key_down", a);
+ //a.Handled = true;
};
if (ctrl is Button)
{
diff --git a/ShiftOS.WinForms/WindowBorder.cs b/ShiftOS.WinForms/WindowBorder.cs
index 0226070..eae764c 100644
--- a/ShiftOS.WinForms/WindowBorder.cs
+++ b/ShiftOS.WinForms/WindowBorder.cs
@@ -117,7 +117,7 @@ namespace ShiftOS.WinForms
{
Setup();
(ParentWindow as IShiftOSWindow).OnSkinLoad();
- ControlManager.SetupControl(this.pnlcontents);
+ ControlManager.SetupControls(this.pnlcontents);
}
catch
{
@@ -159,6 +159,8 @@ namespace ShiftOS.WinForms
}
}
}
+
+ ShiftOS.Engine.Scripting.LuaInterpreter.RaiseEvent("on_key_down", a);
}
/// <summary>
diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs
index 0ea150c..ab04bc8 100644
--- a/ShiftOS.WinForms/WinformsDesktop.cs
+++ b/ShiftOS.WinForms/WinformsDesktop.cs
@@ -100,6 +100,8 @@ namespace ShiftOS.WinForms
if (a.Shift) CtrlTabMenu.CycleBack();
else CtrlTabMenu.CycleForwards();
}*/ //nyi
+
+ ShiftOS.Engine.Scripting.LuaInterpreter.RaiseEvent("on_key_down", a);
};
SkinEngine.SkinLoaded += () =>
{
diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs
index 9feb203..7215fbf 100644
--- a/ShiftOS_TheReturn/Scripting.cs
+++ b/ShiftOS_TheReturn/Scripting.cs
@@ -292,6 +292,21 @@ end");
return Utils.ReadAllText(path);
}
+ public void copy(string i, string o)
+ {
+ Utils.WriteAllBytes(o, Utils.ReadAllBytes(i));
+ }
+
+ public string[] getFiles(string dir)
+ {
+ return Utils.GetFiles(dir);
+ }
+
+ public string[] getDirectories(string dir)
+ {
+ return Utils.GetDirectories(dir);
+ }
+
public byte[] readAllBytes(string path)
{
return Utils.ReadAllBytes(path);
diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs
index eaede42..63dfe13 100644
--- a/ShiftOS_TheReturn/Skinning.cs
+++ b/ShiftOS_TheReturn/Skinning.cs
@@ -34,8 +34,30 @@ using System.Windows.Forms;
using static ShiftOS.Engine.SaveSystem;
using ShiftOS.Objects.ShiftFS;
using System.Reflection;
-
+using ShiftOS.Engine.Scripting;
namespace ShiftOS.Engine {
+
+ [Exposed("skinning")]
+ public class SkinFunctions
+ {
+ public void reload()
+ {
+ SkinEngine.LoadSkin();
+ }
+
+ public dynamic getSkin()
+ {
+ return SkinEngine.LoadedSkin;
+ }
+
+ public void setSkin(Skin skn)
+ {
+ Utils.WriteAllText(Paths.GetPath("skin.json"), JsonConvert.SerializeObject(skn));
+ SkinEngine.LoadSkin();
+ }
+ }
+
+
public static class SkinEngine {
public static ImageLayout GetImageLayout(string img) {
if (LoadedSkin.SkinImageLayouts.ContainsKey(img)) {