Add on_key_down event and other goodies

This commit is contained in:
Michael 2017-02-18 13:25:30 -05:00
parent 5c025fd165
commit 423569f4ae
5 changed files with 54 additions and 2 deletions

View file

@ -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)
{

View file

@ -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>

View file

@ -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 += () =>
{

View file

@ -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);

View file

@ -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)) {