mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 18:02:16 +00:00
volume control slider and other goodies
This commit is contained in:
parent
b0da30bbde
commit
324104eb0b
15 changed files with 618 additions and 78 deletions
|
@ -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 Rectangle(position, 0, BlockSize, this.Height));
|
||||
pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new RectangleF(0, 0, (float)width, 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;
|
||||
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(_marqueePos, 0, this.Width / 4, this.Height));
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
16
ShiftOS.WinForms/Properties/Resources.Designer.cs
generated
16
ShiftOS.WinForms/Properties/Resources.Designer.cs
generated
|
@ -947,6 +947,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>
|
||||
|
@ -1103,9 +1113,9 @@ namespace ShiftOS.WinForms.Properties {
|
|||
/// Category: "Enhancements",
|
||||
/// },
|
||||
/// {
|
||||
/// Name: "GUI Based Login Screen",
|
||||
/// Cost: 500,
|
||||
/// Description: "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]";.
|
||||
/// Name: "Shift Progress Bar",
|
||||
/// Cost: 150,
|
||||
/// Description: "Want to customize the look of all ShiftOS Progress Bars? Buy this upgrade today and you'll get the ability to set the foreground an [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string Shiftorium {
|
||||
get {
|
||||
|
|
|
@ -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>
|
BIN
ShiftOS.WinForms/Resources/iconSpeaker.bmp
Normal file
BIN
ShiftOS.WinForms/Resources/iconSpeaker.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
|
@ -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" />
|
||||
|
|
90
ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs
generated
Normal file
90
ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs
generated
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
33
ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs
Normal file
33
ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs
Normal file
|
@ -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}";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx
Normal file
120
ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx
Normal file
|
@ -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>
|
59
ShiftOS.WinForms/StatusIcons/Volume.Designer.cs
generated
Normal file
59
ShiftOS.WinForms/StatusIcons/Volume.Designer.cs
generated
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
67
ShiftOS.WinForms/StatusIcons/Volume.cs
Normal file
67
ShiftOS.WinForms/StatusIcons/Volume.cs
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/StatusIcons/Volume.resx
Normal file
120
ShiftOS.WinForms/StatusIcons/Volume.resx
Normal file
|
@ -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>
|
|
@ -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++)
|
||||
{
|
||||
|
|
29
ShiftOS.WinForms/WinformsDesktop.Designer.cs
generated
29
ShiftOS.WinForms/WinformsDesktop.Designer.cs
generated
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
Loading…
Reference in a new issue