aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-07-05 10:43:43 -0400
committerMichaelTheShifter <[email protected]>2016-07-05 10:43:43 -0400
commitad0e84c4be1411321e36a9f6ab022195c0d006b3 (patch)
treefc743792ec1251a49e1e8dda32ca9a29347ad9ee
parenta0b001b25f001d1df767987528980704d3d40347 (diff)
downloadshiftos-c-_theultimatehacker-ad0e84c4be1411321e36a9f6ab022195c0d006b3.tar.gz
shiftos-c-_theultimatehacker-ad0e84c4be1411321e36a9f6ab022195c0d006b3.tar.bz2
shiftos-c-_theultimatehacker-ad0e84c4be1411321e36a9f6ab022195c0d006b3.zip
More Lua work
including making save_file(filters, func) and open_file(filters, func) do the same as fileskimmer_open and fileskimmer_save
-rw-r--r--source/WindowsFormsApplication1/Controls/SyntaxHighlighter.cs2
-rw-r--r--source/WindowsFormsApplication1/Controls/WindowBorder.cs127
-rw-r--r--source/WindowsFormsApplication1/Engine/Lua_Interp.cs2
3 files changed, 130 insertions, 1 deletions
diff --git a/source/WindowsFormsApplication1/Controls/SyntaxHighlighter.cs b/source/WindowsFormsApplication1/Controls/SyntaxHighlighter.cs
index 4e82af7..1139096 100644
--- a/source/WindowsFormsApplication1/Controls/SyntaxHighlighter.cs
+++ b/source/WindowsFormsApplication1/Controls/SyntaxHighlighter.cs
@@ -76,7 +76,7 @@ namespace ShiftOS
switch (lang)
{
case SyntaxSettings.Language.Lua:
- var kw = new List<string>() { "function", "local", "return", "if", "else", "elseif", "while", "true", "do", "next", "end", "for", "pairs", "in", "{", "}", "false" };
+ var kw = new List<string>() { "function", "local", "return", "if", "else", "elseif", "while", "true", "do", "next", "end", "for", "pairs", "in", "{", "}", "false", "=", "+", "-", "/", "*", "..", "," };
Settings.Keywords.Clear();
foreach (var k in kw)
{
diff --git a/source/WindowsFormsApplication1/Controls/WindowBorder.cs b/source/WindowsFormsApplication1/Controls/WindowBorder.cs
index 79d1c20..ccd86ee 100644
--- a/source/WindowsFormsApplication1/Controls/WindowBorder.cs
+++ b/source/WindowsFormsApplication1/Controls/WindowBorder.cs
@@ -14,6 +14,113 @@ namespace ShiftOS
{
public Timer updater = new Timer();
+ private List<BorderWidget> _widgets = new List<BorderWidget>();
+
+ //Lua Methods
+
+ public void RegisterWidget(string ident, Control ctrl)
+ {
+ _widgets.Add(new BorderWidget { Identifier = ident, Control = ctrl });
+ resettitlebar();
+ }
+
+ public Control GetWidget(string ident)
+ {
+ Control ctrl = null;
+ foreach(var widget in _widgets)
+ {
+ if(widget.Identifier == ident)
+ {
+ ctrl = widget.Control;
+ }
+ }
+ if (ctrl == null)
+ throw new Exception($"The identifier {ident} was not found.");
+ return ctrl;
+ }
+
+ public void RemoveWidget(string ident)
+ {
+ BorderWidget ctrl = null;
+ foreach (var widget in _widgets)
+ {
+ if (widget.Identifier == ident)
+ {
+ ctrl = widget;
+ }
+ }
+ if (ctrl == null)
+ throw new Exception($"The identifier {ident} was not found.");
+ var wControl = ctrl.Control;
+ wControl.Parent.Controls.Remove(wControl);
+ wControl.Hide();
+ _widgets.Remove(ctrl);
+ wControl.Dispose();
+ }
+
+
+ public Panel GetTitlebar()
+ {
+ return titlebar;
+ }
+
+ public Panel GetBorder(string side)
+ {
+ switch(side)
+ {
+ case "left":
+ return pgleft;
+ case "right":
+ return pgright;
+ case "bottom":
+ return pgbottom;
+ default:
+ return null;
+ }
+ }
+
+ public Panel GetCloseButton() { return closebutton; }
+ public Panel GetRollupButton() { return this.rollupbutton; }
+ public Panel GetMinimizeButton() { return minimizebutton; }
+
+ private bool _closeEnabled = true;
+ private bool _minimizeEnabled = true;
+ private bool _rollupEnabled = true;
+
+ public bool CloseEnabled { get { return _closeEnabled; } set { _closeEnabled = value; resettitlebar(); } }
+ public bool MinimizeEnabled { get { return _minimizeEnabled; } set { _minimizeEnabled = value; resettitlebar(); } }
+ public bool RollupEnabled { get { return _rollupEnabled; } set { _rollupEnabled = value; resettitlebar(); } }
+
+
+ public Panel GetCorner(string position, string side)
+ {
+ switch(position)
+ {
+ case "top":
+ switch(side)
+ {
+ case "left":
+ return pgtoplcorner;
+ case "right":
+ return pgtoprcorner;
+ default:
+ return null;
+ }
+ case "bottom":
+ switch(side)
+ {
+ case "left":
+ return pgbottomlcorner;
+ case "right":
+ return pgbottomlcorner;
+ default:
+ return null;
+ }
+ default:
+ return null;
+ }
+ }
+
public WindowBorder(string aname, Image aicon)
{
AppName = aname;
@@ -115,6 +222,7 @@ namespace ShiftOS
}*/
ParentForm.Tag = ParentForm.Location;
WindowComposition.WindowsEverywhere(this.ParentForm);
+ ParentForm.Text = this.AppName;
}
private PanelButton pbtn = null;
@@ -344,6 +452,14 @@ namespace ShiftOS
closebutton.Show();
}
+ if (_closeEnabled == false)
+ closebutton.Hide();
+ if (_rollupEnabled == false)
+ rollupbutton.Hide();
+ if (_minimizeEnabled == false)
+ minimizebutton.Hide();
+
+
if (API.Upgrades["rollupbutton"] == false)
{
rollupbutton.Hide();
@@ -447,6 +563,12 @@ namespace ShiftOS
}
lbtitletext.ForeColor = API.CurrentSkin.titletextcolour;
}
+ if (_closeEnabled == false)
+ closebutton.Hide();
+ if (_rollupEnabled == false)
+ rollupbutton.Hide();
+ if (_minimizeEnabled == false)
+ minimizebutton.Hide();
API.CurrentSession.InvokeWindowOp("tbar_redraw", this.ParentForm);
}
@@ -667,5 +789,10 @@ namespace ShiftOS
}
#endregion
+ public class BorderWidget
+ {
+ public string Identifier { get; set; }
+ public Control Control { get; set; }
+ }
}
diff --git a/source/WindowsFormsApplication1/Engine/Lua_Interp.cs b/source/WindowsFormsApplication1/Engine/Lua_Interp.cs
index 88a51a3..5b338ae 100644
--- a/source/WindowsFormsApplication1/Engine/Lua_Interp.cs
+++ b/source/WindowsFormsApplication1/Engine/Lua_Interp.cs
@@ -642,6 +642,7 @@ end");
}
};
});
+ mod.open_File = mod.fileskimmer_open;
mod.fileskimmer_save += new Action<string, string>((filters, func) =>
{
API.CreateFileSkimmerSession(filters, File_Skimmer.FileSkimmerMode.Save);
@@ -655,6 +656,7 @@ end");
}
};
});
+ mod.save_File = mod.fileskimmer_save;
mod.font = new Func<string, int, Font>((style, size) => {
return new Font(style, size);
});