aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-31 19:23:40 -0400
committerMichael <[email protected]>2017-05-31 19:23:40 -0400
commit324104eb0b8650969b2205404e3ad83401fb100e (patch)
treee1345eb1aee68d33eb16aaed57e9567e06a0fdf7
parentb0da30bbde2bb198850ea45dc0006762b23f99a3 (diff)
downloadshiftos_thereturn-324104eb0b8650969b2205404e3ad83401fb100e.tar.gz
shiftos_thereturn-324104eb0b8650969b2205404e3ad83401fb100e.tar.bz2
shiftos_thereturn-324104eb0b8650969b2205404e3ad83401fb100e.zip
volume control slider and other goodies
-rw-r--r--ShiftOS.WinForms/Controls/ShiftedProgressBar.cs88
-rw-r--r--ShiftOS.WinForms/Properties/Resources.Designer.cs16
-rw-r--r--ShiftOS.WinForms/Properties/Resources.resx3
-rw-r--r--ShiftOS.WinForms/Resources/iconSpeaker.bmpbin0 -> 3382 bytes
-rw-r--r--ShiftOS.WinForms/ShiftOS.WinForms.csproj19
-rw-r--r--ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs90
-rw-r--r--ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs33
-rw-r--r--ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx120
-rw-r--r--ShiftOS.WinForms/StatusIcons/Volume.Designer.cs59
-rw-r--r--ShiftOS.WinForms/StatusIcons/Volume.cs67
-rw-r--r--ShiftOS.WinForms/StatusIcons/Volume.resx120
-rw-r--r--ShiftOS.WinForms/Tools/ControlManager.cs15
-rw-r--r--ShiftOS.WinForms/WinformsDesktop.Designer.cs29
-rw-r--r--ShiftOS.WinForms/WinformsDesktop.cs32
-rw-r--r--ShiftOS.WinForms/WinformsDesktop.resx3
15 files changed, 617 insertions, 77 deletions
diff --git a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs
index ceaff02..c5a6d05 100644
--- a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs
+++ b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs
@@ -140,51 +140,65 @@ namespace ShiftOS.WinForms.Controls
protected override void OnPaint(PaintEventArgs pe)
{
- pe.Graphics.Clear(this.RealBackColor);
- if(RealBackgroundImage != null)
+ try
{
- pe.Graphics.FillRectangle(new TextureBrush(RealBackgroundImage), new Rectangle(0, 0, this.Width, this.Height));
- }
- switch (Style)
- {
- case ProgressBarStyle.Continuous:
- double width = linear(this.Value, 0, this.Maximum, 0, this.Width);
- if (ProgressImage != null)
- {
- pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new RectangleF(0, 0, (float)width, this.Height));
- }
- else
- {
- pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new RectangleF(0, 0, (float)width, this.Height));
- }
- break;
- case ProgressBarStyle.Blocks:
- int block_count = this.Width / (this.BlockSize + 2);
- int blocks = (int)linear(this.Value, 0, this.Maximum, 0, block_count);
- for(int i = 0; i < blocks - 1; i++)
- {
- int position = i * (BlockSize + 2);
+ pe.Graphics.Clear(this.RealBackColor);
+ if (RealBackgroundImage != null)
+ {
+ pe.Graphics.FillRectangle(new TextureBrush(RealBackgroundImage), new Rectangle(0, 0, this.Width, this.Height));
+ }
+ switch (Style)
+ {
+ case ProgressBarStyle.Continuous:
+ double width = linear(this.Value, 0, this.Maximum, 0, this.Width);
if (ProgressImage != null)
{
- pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(position, 0, BlockSize, this.Height));
+ pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new RectangleF(0, 0, (float)width, this.Height));
+ }
+ else
+ {
+ pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new RectangleF(0, 0, (float)width, this.Height));
+ }
+ break;
+ case ProgressBarStyle.Blocks:
+ int block_count = this.Width / (this.BlockSize + 2);
+ int blocks = (int)linear(this.Value, 0, this.Maximum, 0, block_count);
+ for (int i = 0; i < blocks - 1; i++)
+ {
+ int position = i * (BlockSize + 2);
+ if (ProgressImage != null)
+ {
+ pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(position, 0, BlockSize, this.Height));
+ }
+ else
+ {
+ pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(position, 0, BlockSize, this.Height));
+ }
+ }
+ break;
+ case ProgressBarStyle.Marquee:
+ if (ProgressImage != null)
+ {
+ pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height));
}
else
{
- pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(position, 0, BlockSize, this.Height));
+ pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height));
}
- }
- break;
- case ProgressBarStyle.Marquee:
- if (ProgressImage != null)
- {
- pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height));
- }
- else
- {
- pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height));
- }
- break;
+ break;
+ }
+ }
+ catch
+ {
+ pe.Graphics.Clear(Color.Black);
+ string text = "Preview mode. This control can't be drawn without an initiated ShiftOS engine.";
+ SizeF sz = pe.Graphics.MeasureString(text, this.Font);
+ PointF loc = new PointF(
+ (this.Width - sz.Width) / 2,
+ (this.Height - sz.Height) / 2
+ );
+ pe.Graphics.DrawString(text, Font, new SolidBrush(Color.White), loc);
}
}
diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs
index 3e83c3f..0386237 100644
--- a/ShiftOS.WinForms/Properties/Resources.Designer.cs
+++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs
@@ -950,6 +950,16 @@ namespace ShiftOS.WinForms.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
+ internal static System.Drawing.Bitmap iconSpeaker {
+ get {
+ object obj = ResourceManager.GetObject("iconSpeaker", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
internal static System.Drawing.Bitmap iconSysinfo {
get {
object obj = ResourceManager.GetObject("iconSysinfo", resourceCulture);
@@ -1103,9 +1113,9 @@ namespace ShiftOS.WinForms.Properties {
/// Category: &quot;Enhancements&quot;,
/// },
/// {
- /// Name: &quot;GUI Based Login Screen&quot;,
- /// Cost: 500,
- /// Description: &quot;Tired of using the text-based login screen in ShiftOS? Well, we have a functioning window manager, and a functioning desktop, w [rest of string was truncated]&quot;;.
+ /// Name: &quot;Shift Progress Bar&quot;,
+ /// Cost: 150,
+ /// Description: &quot;Want to customize the look of all ShiftOS Progress Bars? Buy this upgrade today and you&apos;ll get the ability to set the foreground an [rest of string was truncated]&quot;;.
/// </summary>
internal static string Shiftorium {
get {
diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx
index 1db7a46..d1a3544 100644
--- a/ShiftOS.WinForms/Properties/Resources.resx
+++ b/ShiftOS.WinForms/Properties/Resources.resx
@@ -34603,4 +34603,7 @@
<data name="notestate_connection_full" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\notestate_connection_full.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="iconSpeaker" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\iconSpeaker.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Resources/iconSpeaker.bmp b/ShiftOS.WinForms/Resources/iconSpeaker.bmp
new file mode 100644
index 0000000..ec2defb
--- /dev/null
+++ b/ShiftOS.WinForms/Resources/iconSpeaker.bmp
Binary files differ
diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
index 65a512e..fd875e9 100644
--- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj
+++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
@@ -403,6 +403,18 @@
<Compile Include="ShiftOSAudioProvider.cs" />
<Compile Include="ShiftOSConfigFile.cs" />
<Compile Include="SkinCommands.cs" />
+ <Compile Include="StatusIcons\ShiftnetStatus.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="StatusIcons\ShiftnetStatus.Designer.cs">
+ <DependentUpon>ShiftnetStatus.cs</DependentUpon>
+ </Compile>
+ <Compile Include="StatusIcons\Volume.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="StatusIcons\Volume.Designer.cs">
+ <DependentUpon>Volume.cs</DependentUpon>
+ </Compile>
<Compile Include="Stories\LegionStory.cs" />
<Compile Include="TestCommandsForUpgrades.cs" />
<Compile Include="Tools\ColorPickerDataBackend.cs" />
@@ -601,6 +613,12 @@
<EmbeddedResource Include="ShiftnetSites\ShiftSoft_Ping.resx">
<DependentUpon>ShiftSoft_Ping.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="StatusIcons\ShiftnetStatus.resx">
+ <DependentUpon>ShiftnetStatus.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="StatusIcons\Volume.resx">
+ <DependentUpon>Volume.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="UniteLoginDialog.resx">
<DependentUpon>UniteLoginDialog.cs</DependentUpon>
</EmbeddedResource>
@@ -827,6 +845,7 @@
<None Include="Resources\writesound.wav" />
<None Include="Resources\SuperDesk screenshot.png" />
<None Include="Resources\notestate_connection_full.bmp" />
+ <None Include="Resources\iconSpeaker.bmp" />
<Content Include="SystemIcons\iconArtpad.png" />
<Content Include="SystemIcons\iconAudioPlayer.png" />
<Content Include="SystemIcons\iconBitnoteDigger.png" />
diff --git a/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs
new file mode 100644
index 0000000..65aed28
--- /dev/null
+++ b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs
@@ -0,0 +1,90 @@
+namespace ShiftOS.WinForms.StatusIcons
+{
+ partial class ShiftnetStatus
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.lbserviceprovider = new System.Windows.Forms.Label();
+ this.lbstatus = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.label1.Location = new System.Drawing.Point(0, 0);
+ this.label1.Name = "label1";
+ this.label1.Padding = new System.Windows.Forms.Padding(5);
+ this.label1.Size = new System.Drawing.Size(53, 23);
+ this.label1.TabIndex = 0;
+ this.label1.Tag = "header2";
+ this.label1.Text = "Shiftnet";
+ //
+ // lbserviceprovider
+ //
+ this.lbserviceprovider.AutoSize = true;
+ this.lbserviceprovider.Dock = System.Windows.Forms.DockStyle.Top;
+ this.lbserviceprovider.Location = new System.Drawing.Point(0, 23);
+ this.lbserviceprovider.Name = "lbserviceprovider";
+ this.lbserviceprovider.Padding = new System.Windows.Forms.Padding(5);
+ this.lbserviceprovider.Size = new System.Drawing.Size(98, 23);
+ this.lbserviceprovider.TabIndex = 1;
+ this.lbserviceprovider.Tag = "header3";
+ this.lbserviceprovider.Text = "Freebie Solutions";
+ //
+ // lbstatus
+ //
+ this.lbstatus.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lbstatus.Location = new System.Drawing.Point(0, 46);
+ this.lbstatus.Name = "lbstatus";
+ this.lbstatus.Padding = new System.Windows.Forms.Padding(5);
+ this.lbstatus.Size = new System.Drawing.Size(331, 144);
+ this.lbstatus.TabIndex = 2;
+ this.lbstatus.Text = "This will show the Shiftnet status.";
+ //
+ // ShiftnetStatus
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.lbstatus);
+ this.Controls.Add(this.lbserviceprovider);
+ this.Controls.Add(this.label1);
+ this.Name = "ShiftnetStatus";
+ this.Size = new System.Drawing.Size(331, 190);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label lbserviceprovider;
+ private System.Windows.Forms.Label lbstatus;
+ }
+}
diff --git a/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs
new file mode 100644
index 0000000..f1d31af
--- /dev/null
+++ b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+
+namespace ShiftOS.WinForms.StatusIcons
+{
+ [DefaultIcon("iconShiftnet")]
+ [RequiresUpgrade("victortran_shiftnet")]
+ public partial class ShiftnetStatus : UserControl, IStatusIcon
+ {
+ public ShiftnetStatus()
+ {
+ InitializeComponent();
+ }
+
+ public void Setup()
+ {
+ var subscription = Applications.DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription];
+ float kilobytes = (float)subscription.DownloadSpeed / 1024F;
+ lbserviceprovider.Text = subscription.Name;
+ lbstatus.Text = $@"Company: {subscription.Company}
+Download speed (KB/s): {kilobytes}";
+
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/StatusIcons/Volume.Designer.cs b/ShiftOS.WinForms/StatusIcons/Volume.Designer.cs
new file mode 100644
index 0000000..aa8aa7a
--- /dev/null
+++ b/ShiftOS.WinForms/StatusIcons/Volume.Designer.cs
@@ -0,0 +1,59 @@
+namespace ShiftOS.WinForms.StatusIcons
+{
+ partial class Volume
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.lbvolume = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // lbvolume
+ //
+ this.lbvolume.AutoSize = true;
+ this.lbvolume.Location = new System.Drawing.Point(4, 4);
+ this.lbvolume.Name = "lbvolume";
+ this.lbvolume.Size = new System.Drawing.Size(81, 13);
+ this.lbvolume.TabIndex = 0;
+ this.lbvolume.Text = "System volume:";
+ //
+ // Volume
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.lbvolume);
+ this.Name = "Volume";
+ this.Size = new System.Drawing.Size(444, 44);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label lbvolume;
+ }
+}
diff --git a/ShiftOS.WinForms/StatusIcons/Volume.cs b/ShiftOS.WinForms/StatusIcons/Volume.cs
new file mode 100644
index 0000000..329faf0
--- /dev/null
+++ b/ShiftOS.WinForms/StatusIcons/Volume.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+using ShiftOS.WinForms.Controls;
+
+namespace ShiftOS.WinForms.StatusIcons
+{
+ [DefaultIcon("iconSpeaker")]
+ public partial class Volume : UserControl, IStatusIcon
+ {
+ public Volume()
+ {
+ InitializeComponent();
+ }
+
+ public void Setup()
+ {
+ lbvolume.Top = (this.Height - lbvolume.Height) / 2;
+ bool moving = false;
+ var prg = new ShiftedProgressBar();
+ prg.Tag = "ignoreal"; //Don't close AL or current widget when this control is clicked.
+ this.Controls.Add(prg);
+ prg.Height = this.Height / 3;
+ prg.Maximum = 100;
+ prg.Value = SaveSystem.CurrentSave.MusicVolume;
+ prg.Width = this.Width - lbvolume.Width - 50;
+ prg.Left = lbvolume.Left + lbvolume.Width + 15;
+ prg.Top = (this.Height - prg.Height) / 2;
+ prg.MouseDown += (o, a) =>
+ {
+ moving = true;
+ };
+
+ prg.MouseMove += (o, a) =>
+ {
+ if (moving)
+ {
+ int val = (int)linear(a.X, 0, prg.Width, 0, 100);
+ SaveSystem.CurrentSave.MusicVolume = val;
+ prg.Value = val;
+ }
+ };
+
+ prg.MouseUp += (o, a) =>
+ {
+ moving = false;
+ };
+ prg.Show();
+ }
+
+ static public double linear(double x, double x0, double x1, double y0, double y1)
+ {
+ if ((x1 - x0) == 0)
+ {
+ return (y0 + y1) / 2;
+ }
+ return y0 + (x - x0) * (y1 - y0) / (x1 - x0);
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/StatusIcons/Volume.resx b/ShiftOS.WinForms/StatusIcons/Volume.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/StatusIcons/Volume.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs
index 92482fa..548a62a 100644
--- a/ShiftOS.WinForms/Tools/ControlManager.cs
+++ b/ShiftOS.WinForms/Tools/ControlManager.cs
@@ -158,6 +158,15 @@ namespace ShiftOS.WinForms.Tools
}
catch { }
+ if (!tag.Contains("ignoreal"))
+ {
+ ctrl.Click += (o, a) =>
+ {
+ Desktop.HideAppLauncher();
+ };
+
+ }
+
if (!tag.Contains("keepbg"))
{
if (ctrl.BackColor != Control.DefaultBackColor)
@@ -279,6 +288,8 @@ namespace ShiftOS.WinForms.Tools
{
(ctrl as WindowBorder).Setup();
}
+
+
MakeDoubleBuffered(ctrl);
ControlSetup?.Invoke(ctrl);
});
@@ -305,10 +316,6 @@ namespace ShiftOS.WinForms.Tools
public static void SetupControls(Control frm, bool runInThread = true)
{
- frm.Click += (o, a) =>
- {
- Desktop.HideAppLauncher();
- };
var ctrls = frm.Controls.ToList();
for (int i = 0; i < ctrls.Count(); i++)
{
diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs
index 968a31c..d82bc0c 100644
--- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs
+++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs
@@ -55,6 +55,7 @@ namespace ShiftOS.WinForms
this.desktoppanel = new System.Windows.Forms.Panel();
this.pnlnotifications = new System.Windows.Forms.Panel();
this.flnotifications = new System.Windows.Forms.FlowLayoutPanel();
+ this.ntconnectionstatus = new System.Windows.Forms.PictureBox();
this.lbtime = new System.Windows.Forms.Label();
this.panelbuttonholder = new System.Windows.Forms.FlowLayoutPanel();
this.sysmenuholder = new System.Windows.Forms.Panel();
@@ -63,7 +64,6 @@ namespace ShiftOS.WinForms
this.pnlscreensaver = new System.Windows.Forms.Panel();
this.pnlssicon = new System.Windows.Forms.Panel();
this.pnlwidgetlayer = new System.Windows.Forms.Panel();
- this.ntconnectionstatus = new System.Windows.Forms.PictureBox();
this.pnlnotificationbox = new System.Windows.Forms.Panel();
this.lbnotemsg = new System.Windows.Forms.Label();
this.lbnotetitle = new System.Windows.Forms.Label();
@@ -77,10 +77,10 @@ namespace ShiftOS.WinForms
this.desktoppanel.SuspendLayout();
this.pnlnotifications.SuspendLayout();
this.flnotifications.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).BeginInit();
this.sysmenuholder.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.pnlscreensaver.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).BeginInit();
this.pnlnotificationbox.SuspendLayout();
this.pnladvancedal.SuspendLayout();
this.pnlalsystemactions.SuspendLayout();
@@ -121,6 +121,18 @@ namespace ShiftOS.WinForms
this.flnotifications.Name = "flnotifications";
this.flnotifications.Size = new System.Drawing.Size(22, 24);
this.flnotifications.TabIndex = 1;
+ this.flnotifications.WrapContents = false;
+ //
+ // ntconnectionstatus
+ //
+ this.ntconnectionstatus.Image = global::ShiftOS.WinForms.Properties.Resources.notestate_connection_full;
+ this.ntconnectionstatus.Location = new System.Drawing.Point(3, 3);
+ this.ntconnectionstatus.Name = "ntconnectionstatus";
+ this.ntconnectionstatus.Size = new System.Drawing.Size(16, 16);
+ this.ntconnectionstatus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
+ this.ntconnectionstatus.TabIndex = 0;
+ this.ntconnectionstatus.TabStop = false;
+ this.ntconnectionstatus.Tag = "digitalsociety";
//
// lbtime
//
@@ -200,17 +212,6 @@ namespace ShiftOS.WinForms
this.pnlwidgetlayer.Size = new System.Drawing.Size(1296, 714);
this.pnlwidgetlayer.TabIndex = 1;
//
- // ntconnectionstatus
- //
- this.ntconnectionstatus.Image = global::ShiftOS.WinForms.Properties.Resources.notestate_connection_full;
- this.ntconnectionstatus.Location = new System.Drawing.Point(3, 3);
- this.ntconnectionstatus.Name = "ntconnectionstatus";
- this.ntconnectionstatus.Size = new System.Drawing.Size(16, 16);
- this.ntconnectionstatus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
- this.ntconnectionstatus.TabIndex = 0;
- this.ntconnectionstatus.TabStop = false;
- this.ntconnectionstatus.Tag = "digitalsociety";
- //
// pnlnotificationbox
//
this.pnlnotificationbox.AutoSize = true;
@@ -341,12 +342,12 @@ namespace ShiftOS.WinForms
this.pnlnotifications.PerformLayout();
this.flnotifications.ResumeLayout(false);
this.flnotifications.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).EndInit();
this.sysmenuholder.ResumeLayout(false);
this.sysmenuholder.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.pnlscreensaver.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).EndInit();
this.pnlnotificationbox.ResumeLayout(false);
this.pnlnotificationbox.PerformLayout();
this.pnladvancedal.ResumeLayout(false);
diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs
index b9c4f37..f1dbe48 100644
--- a/ShiftOS.WinForms/WinformsDesktop.cs
+++ b/ShiftOS.WinForms/WinformsDesktop.cs
@@ -85,27 +85,24 @@ namespace ShiftOS.WinForms
ic.Tag = itype.Name.ToLower();
//Next get the icon data if any.
- var iconattrib = itype.GetCustomAttributes(false).FirstOrDefault(x => x is DefaultIconAttribute) as DefaultIconAttribute;
- if(iconattrib != null)
- {
//We can use this attribute's ID in the skin engine to get an icon.
- var img = GetIcon(iconattrib.ID);
+ var img = GetIcon(itype.Name);
//Make it transparent.
- (img as Bitmap).MakeTransparent(LoadedSkin.SystemKey);
+ (img as Bitmap).MakeTransparent(Color.White);
//Assign it to the control
ic.Image = img;
//Set the sizing mode
ic.SizeMode = PictureBoxSizeMode.StretchImage;
- }
- else
- {
- ic.BackColor = Color.White; //TODO: Make it skinnable.
- }
- ic.Size = new Size(20, 20); //TODO: make it skinnable
+ ic.Size = new Size(16, 16); //TODO: make it skinnable
//add to the notification tray
flnotifications.Controls.Add(ic);
ic.Show();
+ ic.BringToFront();
+
+ flnotifications.Show();
+
+
ic.Click += (o, a) =>
{
HideAppLauncher();
@@ -115,7 +112,14 @@ namespace ShiftOS.WinForms
UserControl ctrl = (UserControl)Activator.CreateInstance(itype);
(ctrl as IStatusIcon).Setup();
currentSettingsPane = ctrl;
- if(LoadedSkin.DesktopPanelPosition == 0)
+ ControlManager.SetupControls(ctrl);
+ this.Controls.Add(ctrl);
+ ctrl.BringToFront();
+ int left = ic.Parent.PointToScreen(ic.Location).X;
+ int realleft = left - ctrl.Width;
+ realleft += ic.Width;
+ ctrl.Left = realleft;
+ if (LoadedSkin.DesktopPanelPosition == 0)
{
ctrl.Top = desktoppanel.Height;
}
@@ -123,10 +127,6 @@ namespace ShiftOS.WinForms
{
ctrl.Top = this.Height - desktoppanel.Height - ctrl.Height;
}
- int noteleft = flnotifications.PointToScreen(ic.Location).X;
- int realleft = (this.Width - (noteleft + ic.Width)) - ctrl.Width;
- ctrl.Left = realleft;
- ControlManager.SetupControls(ctrl);
ctrl.Show();
}
diff --git a/ShiftOS.WinForms/WinformsDesktop.resx b/ShiftOS.WinForms/WinformsDesktop.resx
index b77504b..d5494e3 100644
--- a/ShiftOS.WinForms/WinformsDesktop.resx
+++ b/ShiftOS.WinForms/WinformsDesktop.resx
@@ -120,7 +120,4 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
- <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>17, 17</value>
- </metadata>
</root> \ No newline at end of file