aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-07-20 13:52:12 -0400
committerMichaelTheShifter <[email protected]>2016-07-20 13:52:12 -0400
commitb52090021ff0ae61db652e8a486cbff6732f5ec5 (patch)
treed6b3fa622525e293f715c963e46cb91465b4a064
parent64aae03a9b08a10ace6366008093e95ab5e99945 (diff)
downloadshiftos-c-_theultimatehacker-b52090021ff0ae61db652e8a486cbff6732f5ec5.tar.gz
shiftos-c-_theultimatehacker-b52090021ff0ae61db652e8a486cbff6732f5ec5.tar.bz2
shiftos-c-_theultimatehacker-b52090021ff0ae61db652e8a486cbff6732f5ec5.zip
Move ShiftUI designer to ShiftOS and add
prober for ShiftOS to allow ShiftUI designer to design ShiftOS forms.
-rw-r--r--source/ShiftOS.sln6
-rw-r--r--source/ShiftUI/Theming/ShiftOS.cs5
-rw-r--r--source/ShiftUI/Theming/ThemeSkinnable.cs33
-rw-r--r--source/WindowsFormsApplication1/API.cs1
-rw-r--r--source/WindowsFormsApplication1/Apps/BitnoteWallet.cs15
-rw-r--r--source/WindowsFormsApplication1/Apps/Shifter.Designer.cs9
-rw-r--r--source/WindowsFormsApplication1/Controls/ProgressBarEX.cs8
-rw-r--r--source/WindowsFormsApplication1/Engine/Lua_Interp.cs4
-rw-r--r--source/WindowsFormsApplication1/Program.cs72
9 files changed, 80 insertions, 73 deletions
diff --git a/source/ShiftOS.sln b/source/ShiftOS.sln
index ccf69a3..ef829cd 100644
--- a/source/ShiftOS.sln
+++ b/source/ShiftOS.sln
@@ -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
diff --git a/source/ShiftUI/Theming/ShiftOS.cs b/source/ShiftUI/Theming/ShiftOS.cs
index 00e9b1a..7950c18 100644
--- a/source/ShiftUI/Theming/ShiftOS.cs
+++ b/source/ShiftUI/Theming/ShiftOS.cs
@@ -14,6 +14,7 @@ namespace ShiftUI.ShiftOS
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 @@ namespace ShiftUI.ShiftOS
#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
diff --git a/source/ShiftUI/Theming/ThemeSkinnable.cs b/source/ShiftUI/Theming/ThemeSkinnable.cs
index 6772251..5ea8a4d 100644
--- a/source/ShiftUI/Theming/ThemeSkinnable.cs
+++ b/source/ShiftUI/Theming/ThemeSkinnable.cs
@@ -2973,7 +2973,7 @@ namespace ShiftUI
// 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 @@ namespace ShiftUI
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);
}
diff --git a/source/WindowsFormsApplication1/API.cs b/source/WindowsFormsApplication1/API.cs
index 4434fc7..ce0ad8c 100644
--- a/source/WindowsFormsApplication1/API.cs
+++ b/source/WindowsFormsApplication1/API.cs
@@ -1926,6 +1926,7 @@ namespace ShiftOS
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
}
diff --git a/source/WindowsFormsApplication1/Apps/BitnoteWallet.cs b/source/WindowsFormsApplication1/Apps/BitnoteWallet.cs
index 7b19c70..3a7164e 100644
--- a/source/WindowsFormsApplication1/Apps/BitnoteWallet.cs
+++ b/source/WindowsFormsApplication1/Apps/BitnoteWallet.cs
@@ -22,14 +22,17 @@ namespace ShiftOS
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);
+ }
}
}
}
diff --git a/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs b/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs
index 04a61d3..568822e 100644
--- a/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs
+++ b/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs
@@ -443,7 +443,6 @@ namespace ShiftOS
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 @@ namespace ShiftOS
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 @@ namespace ShiftOS
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 @@ namespace ShiftOS
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 @@ namespace ShiftOS
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 @@ namespace ShiftOS
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();
diff --git a/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs b/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs
index d89969e..8febdcd 100644
--- a/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs
+++ b/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs
@@ -102,13 +102,7 @@ namespace ShiftOS
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;
}
}
diff --git a/source/WindowsFormsApplication1/Engine/Lua_Interp.cs b/source/WindowsFormsApplication1/Engine/Lua_Interp.cs
index fabc1be..d36b4d9 100644
--- a/source/WindowsFormsApplication1/Engine/Lua_Interp.cs
+++ b/source/WindowsFormsApplication1/Engine/Lua_Interp.cs
@@ -1466,9 +1466,7 @@ end");
/// <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);
}
}
}
diff --git a/source/WindowsFormsApplication1/Program.cs b/source/WindowsFormsApplication1/Program.cs
index 5f3f1ad..af294db 100644
--- a/source/WindowsFormsApplication1/Program.cs
+++ b/source/WindowsFormsApplication1/Program.cs
@@ -12,24 +12,24 @@ using Newtonsoft.Json;
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 @@ namespace ShiftOS
//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 @@ namespace ShiftOS
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 @@ namespace ShiftOS
}
}
+
static void ExtractDependencies()
{
//Wow. This'll make it easy for people...