mirror of
https://github.com/seriocomedy/ShiftOS-C-.git
synced 2025-01-22 17:22:14 +00:00
More Lua work
including making save_file(filters, func) and open_file(filters, func) do the same as fileskimmer_open and fileskimmer_save
This commit is contained in:
parent
a0b001b25f
commit
ad0e84c4be
3 changed files with 130 additions and 1 deletions
|
@ -76,7 +76,7 @@ public void SetLanguage(SyntaxSettings.Language lang)
|
||||||
switch (lang)
|
switch (lang)
|
||||||
{
|
{
|
||||||
case SyntaxSettings.Language.Lua:
|
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();
|
Settings.Keywords.Clear();
|
||||||
foreach (var k in kw)
|
foreach (var k in kw)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,113 @@ public partial class WindowBorder : UserControl
|
||||||
{
|
{
|
||||||
public Timer updater = new Timer();
|
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)
|
public WindowBorder(string aname, Image aicon)
|
||||||
{
|
{
|
||||||
AppName = aname;
|
AppName = aname;
|
||||||
|
@ -115,6 +222,7 @@ private void Template_Load(object sender, EventArgs e)
|
||||||
}*/
|
}*/
|
||||||
ParentForm.Tag = ParentForm.Location;
|
ParentForm.Tag = ParentForm.Location;
|
||||||
WindowComposition.WindowsEverywhere(this.ParentForm);
|
WindowComposition.WindowsEverywhere(this.ParentForm);
|
||||||
|
ParentForm.Text = this.AppName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PanelButton pbtn = null;
|
private PanelButton pbtn = null;
|
||||||
|
@ -344,6 +452,14 @@ public void setuptitlebar()
|
||||||
closebutton.Show();
|
closebutton.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_closeEnabled == false)
|
||||||
|
closebutton.Hide();
|
||||||
|
if (_rollupEnabled == false)
|
||||||
|
rollupbutton.Hide();
|
||||||
|
if (_minimizeEnabled == false)
|
||||||
|
minimizebutton.Hide();
|
||||||
|
|
||||||
|
|
||||||
if (API.Upgrades["rollupbutton"] == false)
|
if (API.Upgrades["rollupbutton"] == false)
|
||||||
{
|
{
|
||||||
rollupbutton.Hide();
|
rollupbutton.Hide();
|
||||||
|
@ -447,6 +563,12 @@ public void resettitlebar()
|
||||||
}
|
}
|
||||||
lbtitletext.ForeColor = API.CurrentSkin.titletextcolour;
|
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);
|
API.CurrentSession.InvokeWindowOp("tbar_redraw", this.ParentForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,5 +789,10 @@ private void Clock_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public class BorderWidget
|
||||||
|
{
|
||||||
|
public string Identifier { get; set; }
|
||||||
|
public Control Control { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -642,6 +642,7 @@ public void RegisterCore()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
mod.open_File = mod.fileskimmer_open;
|
||||||
mod.fileskimmer_save += new Action<string, string>((filters, func) =>
|
mod.fileskimmer_save += new Action<string, string>((filters, func) =>
|
||||||
{
|
{
|
||||||
API.CreateFileSkimmerSession(filters, File_Skimmer.FileSkimmerMode.Save);
|
API.CreateFileSkimmerSession(filters, File_Skimmer.FileSkimmerMode.Save);
|
||||||
|
@ -655,6 +656,7 @@ public void RegisterCore()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
mod.save_File = mod.fileskimmer_save;
|
||||||
mod.font = new Func<string, int, Font>((style, size) => {
|
mod.font = new Func<string, int, Font>((style, size) => {
|
||||||
return new Font(style, size);
|
return new Font(style, size);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue