mirror of
https://github.com/seriocomedy/ShiftOS-C-.git
synced 2025-01-22 10:50:27 -05:00
Move ShiftUI designer to ShiftOS and add
prober for ShiftOS to allow ShiftUI designer to design ShiftOS forms.
This commit is contained in:
parent
64aae03a9b
commit
b52090021f
9 changed files with 80 additions and 73 deletions
|
@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftUI", "ShiftUI\ShiftUI.csproj", "{C56E34D0-4749-4A73-9469-BCCD063569CD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftUI Designer", "..\..\Project-Circle\ShiftUI Designer\ShiftUI Designer.csproj", "{20C1A600-B5C2-4226-B5B6-3F17716D2669}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -26,6 +28,10 @@ Global
|
|||
{C56E34D0-4749-4A73-9469-BCCD063569CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C56E34D0-4749-4A73-9469-BCCD063569CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C56E34D0-4749-4A73-9469-BCCD063569CD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{20C1A600-B5C2-4226-B5B6-3F17716D2669}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{20C1A600-B5C2-4226-B5B6-3F17716D2669}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{20C1A600-B5C2-4226-B5B6-3F17716D2669}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{20C1A600-B5C2-4226-B5B6-3F17716D2669}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -14,6 +14,7 @@ public abstract class Skin
|
|||
public Color ButtonBorderColor = Color.Black;
|
||||
public Color ButtonBackColor = Color.White;
|
||||
public Color ButtonBackColor_Pressed = Color.Gray;
|
||||
public Color ButtonBackColor_Checked = Color.Black;
|
||||
#endregion
|
||||
|
||||
#region Global
|
||||
|
@ -55,6 +56,10 @@ public abstract class Skin
|
|||
|
||||
#endregion
|
||||
|
||||
#region ListView
|
||||
public Color ListViewBackground = Color.White;
|
||||
#endregion
|
||||
|
||||
// No reason to have ShiftOS deal with window borders itself
|
||||
// when I can do it inside ShiftUI.
|
||||
#region Form
|
||||
|
|
|
@ -2973,7 +2973,7 @@ public override void DrawListViewHeader(Graphics dc, Rectangle clip, ListView co
|
|||
// border is drawn directly in the Paint method
|
||||
if (details && control.HeaderStyle != ColumnHeaderStyle.None)
|
||||
{
|
||||
dc.FillRectangle(SystemBrushes.Control,
|
||||
dc.FillRectangle(new SolidBrush(Application.CurrentSkin.ListViewBackground),
|
||||
0, 0, control.TotalWidth, control.Font.Height + 5);
|
||||
if (control.Columns.Count > 0)
|
||||
{
|
||||
|
@ -6923,67 +6923,64 @@ public override void CPDrawButton(Graphics dc, Rectangle rectangle, ButtonState
|
|||
private void CPDrawButtonInternal(Graphics dc, Rectangle rectangle, ButtonState state, Pen DarkPen, Pen NormalPen, Pen LightPen)
|
||||
{
|
||||
// sadly enough, the rectangle gets always filled with a hatchbrush
|
||||
dc.FillRectangle(ResPool.GetHatchBrush(HatchStyle.Percent50,
|
||||
Color.FromArgb(Clamp(ColorControl.R + 3, 0, 255),
|
||||
ColorControl.G, ColorControl.B),
|
||||
ColorControl),
|
||||
dc.FillRectangle(new SolidBrush(Application.CurrentSkin.ButtonBackColor),
|
||||
rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2);
|
||||
|
||||
if ((state & ButtonState.All) == ButtonState.All || ((state & ButtonState.Checked) == ButtonState.Checked && (state & ButtonState.Flat) == ButtonState.Flat))
|
||||
{
|
||||
dc.FillRectangle(ResPool.GetHatchBrush(HatchStyle.Percent50, ColorControlLight, ColorControl), rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4);
|
||||
dc.FillRectangle(new SolidBrush(Application.CurrentSkin.ButtonBackColor_Checked), rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4);
|
||||
|
||||
dc.DrawRectangle(SystemPens.ControlDark, rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1);
|
||||
dc.DrawRectangle(new Pen(new SolidBrush(Application.CurrentSkin.ButtonBorderColor), Application.CurrentSkin.ButtonBorderWidth), rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1);
|
||||
}
|
||||
else
|
||||
if ((state & ButtonState.Flat) == ButtonState.Flat)
|
||||
{
|
||||
dc.DrawRectangle(SystemPens.ControlDark, rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1);
|
||||
dc.DrawRectangle(new Pen(new SolidBrush(Application.CurrentSkin.ButtonBorderColor), Application.CurrentSkin.ButtonBorderWidth), rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1);
|
||||
}
|
||||
else
|
||||
if ((state & ButtonState.Checked) == ButtonState.Checked)
|
||||
{
|
||||
dc.FillRectangle(ResPool.GetHatchBrush(HatchStyle.Percent50, ColorControlLight, ColorControl), rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4);
|
||||
dc.FillRectangle(new SolidBrush(Application.CurrentSkin.ButtonBackColor_Checked), rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4);
|
||||
|
||||
Pen pen = DarkPen;
|
||||
Pen pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DTopLeftInner));
|
||||
dc.DrawLine(pen, rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 2);
|
||||
dc.DrawLine(pen, rectangle.X + 1, rectangle.Y, rectangle.Right - 2, rectangle.Y);
|
||||
|
||||
pen = NormalPen;
|
||||
pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DBottomRight));
|
||||
dc.DrawLine(pen, rectangle.X + 1, rectangle.Y + 1, rectangle.X + 1, rectangle.Bottom - 3);
|
||||
dc.DrawLine(pen, rectangle.X + 2, rectangle.Y + 1, rectangle.Right - 3, rectangle.Y + 1);
|
||||
|
||||
pen = LightPen;
|
||||
pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DBottomRightInner));
|
||||
dc.DrawLine(pen, rectangle.X, rectangle.Bottom - 1, rectangle.Right - 2, rectangle.Bottom - 1);
|
||||
dc.DrawLine(pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 1);
|
||||
}
|
||||
else
|
||||
if (((state & ButtonState.Pushed) == ButtonState.Pushed) && ((state & ButtonState.Normal) == ButtonState.Normal))
|
||||
{
|
||||
Pen pen = DarkPen;
|
||||
Pen pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DTopLeftInner));
|
||||
dc.DrawLine(pen, rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 2);
|
||||
dc.DrawLine(pen, rectangle.X + 1, rectangle.Y, rectangle.Right - 2, rectangle.Y);
|
||||
|
||||
pen = NormalPen;
|
||||
pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DBottomRight));
|
||||
dc.DrawLine(pen, rectangle.X + 1, rectangle.Y + 1, rectangle.X + 1, rectangle.Bottom - 3);
|
||||
dc.DrawLine(pen, rectangle.X + 2, rectangle.Y + 1, rectangle.Right - 3, rectangle.Y + 1);
|
||||
|
||||
pen = LightPen;
|
||||
pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DBottomRightInner));
|
||||
dc.DrawLine(pen, rectangle.X, rectangle.Bottom - 1, rectangle.Right - 2, rectangle.Bottom - 1);
|
||||
dc.DrawLine(pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 1);
|
||||
}
|
||||
else
|
||||
if (((state & ButtonState.Inactive) == ButtonState.Inactive) || ((state & ButtonState.Normal) == ButtonState.Normal))
|
||||
{
|
||||
Pen pen = LightPen;
|
||||
Pen pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DTopLeftInner));
|
||||
dc.DrawLine(pen, rectangle.X, rectangle.Y, rectangle.Right - 2, rectangle.Y);
|
||||
dc.DrawLine(pen, rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 2);
|
||||
|
||||
pen = NormalPen;
|
||||
pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DBottomRight));
|
||||
dc.DrawLine(pen, rectangle.X + 1, rectangle.Bottom - 2, rectangle.Right - 2, rectangle.Bottom - 2);
|
||||
dc.DrawLine(pen, rectangle.Right - 2, rectangle.Y + 1, rectangle.Right - 2, rectangle.Bottom - 3);
|
||||
|
||||
pen = DarkPen;
|
||||
pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DBottomRightInner));
|
||||
dc.DrawLine(pen, rectangle.X, rectangle.Bottom - 1, rectangle.Right - 1, rectangle.Bottom - 1);
|
||||
dc.DrawLine(pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 2);
|
||||
}
|
||||
|
|
|
@ -1926,6 +1926,7 @@ public static Color GetLastColorFromSession()
|
|||
public static Color[] yellowmemory = new Color[16];
|
||||
public static Color[] pinkmemory = new Color[16];
|
||||
internal static Dictionary<string, Dictionary<string, object>> LuaShifterRegistry = null;
|
||||
public static bool ShouldLoadEngine = true;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -22,14 +22,17 @@ public partial class BitnoteWallet : Form
|
|||
public BitnoteWallet()
|
||||
{
|
||||
InitializeComponent();
|
||||
Clients = new List<BitnoteClient>();
|
||||
foreach(var c in Package_Grabber.clients)
|
||||
if (API.ShouldLoadEngine)
|
||||
{
|
||||
if(c.Value.IsConnected)
|
||||
Clients = new List<BitnoteClient>();
|
||||
foreach (var c in Package_Grabber.clients)
|
||||
{
|
||||
var client = new BitnoteClient(c.Key);
|
||||
client.GetBank();
|
||||
Clients.Add(client);
|
||||
if (c.Value.IsConnected)
|
||||
{
|
||||
var client = new BitnoteClient(c.Key);
|
||||
client.GetBank();
|
||||
Clients.Add(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -443,7 +443,6 @@ private void InitializeComponent()
|
|||
this.pnlshifterintro.SuspendLayout();
|
||||
this.pnldesktopoptions.SuspendLayout();
|
||||
this.pnldesktoppaneloptions.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtdesktoppanelheight)).BeginInit();
|
||||
this.pnlapplauncheroptions.SuspendLayout();
|
||||
this.pnldesktopintro.SuspendLayout();
|
||||
this.pnlpanelbuttonsoptions.SuspendLayout();
|
||||
|
@ -453,7 +452,6 @@ private void InitializeComponent()
|
|||
this.predesktoppanel.SuspendLayout();
|
||||
this.prepnlpanelbuttonholder.SuspendLayout();
|
||||
this.prepnlpanelbutton.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pretbicon)).BeginInit();
|
||||
this.pretimepanel.SuspendLayout();
|
||||
this.preapplaunchermenuholder.SuspendLayout();
|
||||
this.predesktopappmenu.SuspendLayout();
|
||||
|
@ -472,7 +470,6 @@ private void InitializeComponent()
|
|||
this.prepgleft.SuspendLayout();
|
||||
this.prepgright.SuspendLayout();
|
||||
this.pretitlebar.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.prepnlicon)).BeginInit();
|
||||
this.pnlreset.SuspendLayout();
|
||||
this.pgcontents.SuspendLayout();
|
||||
this.pnldesktopcomposition.SuspendLayout();
|
||||
|
@ -5123,7 +5120,7 @@ private void InitializeComponent()
|
|||
this.pnldesktopoptions.ResumeLayout(false);
|
||||
this.pnldesktoppaneloptions.ResumeLayout(false);
|
||||
this.pnldesktoppaneloptions.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtdesktoppanelheight)).EndInit();
|
||||
//((System.ComponentModel.ISupportInitialize)(this.txtdesktoppanelheight)).EndInit();
|
||||
this.pnlapplauncheroptions.ResumeLayout(false);
|
||||
this.pnlapplauncheroptions.PerformLayout();
|
||||
this.pnldesktopintro.ResumeLayout(false);
|
||||
|
@ -5139,7 +5136,7 @@ private void InitializeComponent()
|
|||
this.prepnlpanelbuttonholder.ResumeLayout(false);
|
||||
this.prepnlpanelbutton.ResumeLayout(false);
|
||||
this.prepnlpanelbutton.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pretbicon)).EndInit();
|
||||
//((System.ComponentModel.ISupportInitialize)(this.pretbicon)).EndInit();
|
||||
this.pretimepanel.ResumeLayout(false);
|
||||
this.pretimepanel.PerformLayout();
|
||||
this.preapplaunchermenuholder.ResumeLayout(false);
|
||||
|
@ -5169,7 +5166,7 @@ private void InitializeComponent()
|
|||
this.prepgright.ResumeLayout(false);
|
||||
this.pretitlebar.ResumeLayout(false);
|
||||
this.pretitlebar.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.prepnlicon)).EndInit();
|
||||
//((System.ComponentModel.ISupportInitialize)(this.prepnlicon)).EndInit();
|
||||
this.pnlreset.ResumeLayout(false);
|
||||
this.pgcontents.ResumeLayout(false);
|
||||
this.pgcontents.PerformLayout();
|
||||
|
|
|
@ -102,13 +102,7 @@ public int MaxValue
|
|||
get { return _MaxValue; }
|
||||
set
|
||||
{
|
||||
if (value > this.MinValue)
|
||||
{
|
||||
_MaxValue = value;
|
||||
}
|
||||
else {
|
||||
throw new ArgumentOutOfRangeException("The maximum value must be more than the minimum value.");
|
||||
}
|
||||
_MaxValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1466,9 +1466,7 @@ public static class Extensions
|
|||
/// <returns>The converted widget.</returns>
|
||||
public static Widget ToWidget(this System.Windows.Forms.Control ctrl)
|
||||
{
|
||||
string json = JsonConvert.SerializeObject(ctrl);
|
||||
json = json.Replace("Control", "Widget");
|
||||
return JsonConvert.DeserializeObject<Widget>(json);
|
||||
return new Controls.WinFormsHost(ctrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,24 +12,24 @@
|
|||
|
||||
namespace ShiftOS
|
||||
{
|
||||
static class Program
|
||||
public static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
//Extract all dependencies before starting the engine.
|
||||
ExtractDependencies();
|
||||
var poolThread = new Thread(new ThreadStart(new Action(() => {
|
||||
var poolThread = new Thread(new ThreadStart(new Action(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
//Download ShiftOS server startup-pool
|
||||
string pool = new WebClient().DownloadString("http://playshiftos.ml/server/startup_pool");
|
||||
//Download ShiftOS server startup-pool
|
||||
string pool = new WebClient().DownloadString("http://playshiftos.ml/server/startup_pool");
|
||||
string[] splitter = pool.Split(';');
|
||||
foreach (string address in splitter)
|
||||
{
|
||||
|
@ -55,13 +55,14 @@ static void Main(string[] args)
|
|||
//Start the Windows Forms backend
|
||||
Paths.RegisterPaths(); //Sets ShiftOS path variables based on the current OS.
|
||||
SaveSystem.Utilities.CheckForOlderSaves(); //Backs up C:\ShiftOS on Windows systems if it exists and doesn't contain a _engineInfo.txt file telling ShiftOS what engine created it.
|
||||
//If there isn't a save folder at the directory specified by ShiftOS.Paths.SaveRoot, create a new save.
|
||||
//If not, load that save.
|
||||
//If there isn't a save folder at the directory specified by ShiftOS.Paths.SaveRoot, create a new save.
|
||||
//If not, load that save.
|
||||
if (Directory.Exists(Paths.SaveRoot))
|
||||
{
|
||||
API.Log("Loading ShiftOS save...");
|
||||
SaveSystem.Utilities.loadGame();
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveSystem.Utilities.NewGame();
|
||||
}
|
||||
|
@ -80,44 +81,48 @@ static void Main(string[] args)
|
|||
Skinning.Utilities.loadskin();
|
||||
SaveSystem.ShiftoriumRegistry.UpdateShiftorium();
|
||||
//Lua bootscreen.
|
||||
if(File.Exists(Paths.SaveRoot + "BOOT"))
|
||||
if (File.Exists(Paths.SaveRoot + "BOOT"))
|
||||
{
|
||||
string lua = File.ReadAllText(Paths.SaveRoot + "BOOT");
|
||||
var l = new LuaInterpreter();
|
||||
l.mod(lua);
|
||||
}
|
||||
//Start recieving calls from the Modding API...
|
||||
Application.Run(new ShiftOSDesktop());
|
||||
//By now, the API receiver has been loaded,
|
||||
//and the desktop is shown. So, let's check
|
||||
//for auto-start mods.
|
||||
if(Directory.Exists(Paths.AutoStart))
|
||||
if (!args.Contains("nodisplay"))
|
||||
{
|
||||
foreach(string file in Directory.GetFiles(Paths.AutoStart))
|
||||
Application.Run(new ShiftOSDesktop());
|
||||
//By now, the API receiver has been loaded,
|
||||
//and the desktop is shown. So, let's check
|
||||
//for auto-start mods.
|
||||
if (Directory.Exists(Paths.AutoStart))
|
||||
{
|
||||
var inf = new FileInfo(file);
|
||||
switch(inf.Extension)
|
||||
foreach (string file in Directory.GetFiles(Paths.AutoStart))
|
||||
{
|
||||
case ".saa":
|
||||
if (API.Upgrades["shiftnet"] == true)
|
||||
{
|
||||
API.Log("Starting start-up mod \"" + inf.FullName + "\"...");
|
||||
API.LaunchMod(inf.FullName);
|
||||
}
|
||||
break;
|
||||
case ".trm":
|
||||
var t = new Terminal();
|
||||
t.runterminalfile(inf.FullName);
|
||||
API.Log("Started terminal file \"" + inf.FullName + "\"...");
|
||||
break;
|
||||
} }
|
||||
var inf = new FileInfo(file);
|
||||
switch (inf.Extension)
|
||||
{
|
||||
case ".saa":
|
||||
if (API.Upgrades["shiftnet"] == true)
|
||||
{
|
||||
API.Log("Starting start-up mod \"" + inf.FullName + "\"...");
|
||||
API.LaunchMod(inf.FullName);
|
||||
}
|
||||
break;
|
||||
case ".trm":
|
||||
var t = new Terminal();
|
||||
t.runterminalfile(inf.FullName);
|
||||
API.Log("Started terminal file \"" + inf.FullName + "\"...");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Now, for some ShiftOS launcher integration.
|
||||
try
|
||||
{
|
||||
if(args[0] != null)
|
||||
if (args[0] != null)
|
||||
{
|
||||
if(args[0] != "")
|
||||
if (args[0] != "")
|
||||
{
|
||||
API.CurrentSave.username = args[0];
|
||||
//Username set.
|
||||
|
@ -130,6 +135,7 @@ static void Main(string[] args)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
static void ExtractDependencies()
|
||||
{
|
||||
//Wow. This'll make it easy for people...
|
||||
|
|
Loading…
Reference in a new issue