aboutsummaryrefslogtreecommitdiff
path: root/Histacom2.Engine
diff options
context:
space:
mode:
authorlempamo <[email protected]>2017-09-04 20:14:19 -0400
committerlempamo <[email protected]>2017-09-04 20:14:19 -0400
commit1a970e69dada088c5f5ea82dd5683da9ae306ebe (patch)
tree1f77a784221a7565843624f321995ab8856e4a3a /Histacom2.Engine
parent69d4465542fb00108576219d9c1da026f2e864b1 (diff)
downloadhistacom2-1a970e69dada088c5f5ea82dd5683da9ae306ebe.tar.gz
histacom2-1a970e69dada088c5f5ea82dd5683da9ae306ebe.tar.bz2
histacom2-1a970e69dada088c5f5ea82dd5683da9ae306ebe.zip
new classic buttons!
Diffstat (limited to 'Histacom2.Engine')
-rw-r--r--Histacom2.Engine/Histacom2.Engine.csproj8
-rw-r--r--Histacom2.Engine/Template/Infobox95.Designer.cs31
-rw-r--r--Histacom2.Engine/Template/Infobox95.cs3
-rw-r--r--Histacom2.Engine/Theme.cs14
-rw-r--r--Histacom2.Engine/UI/ClassicButton.Designer.cs91
-rw-r--r--Histacom2.Engine/UI/ClassicButton.cs77
-rw-r--r--Histacom2.Engine/UI/ClassicButton.resx123
7 files changed, 69 insertions, 278 deletions
diff --git a/Histacom2.Engine/Histacom2.Engine.csproj b/Histacom2.Engine/Histacom2.Engine.csproj
index fb64648..9b186d8 100644
--- a/Histacom2.Engine/Histacom2.Engine.csproj
+++ b/Histacom2.Engine/Histacom2.Engine.csproj
@@ -92,10 +92,7 @@
</Compile>
<Compile Include="Theme.cs" />
<Compile Include="UI\ClassicButton.cs">
- <SubType>UserControl</SubType>
- </Compile>
- <Compile Include="UI\ClassicButton.Designer.cs">
- <DependentUpon>ClassicButton.cs</DependentUpon>
+ <SubType>Component</SubType>
</Compile>
<Compile Include="UI\IProgressBar.cs">
<SubType>Component</SubType>
@@ -132,9 +129,6 @@
<EmbeddedResource Include="Template\WinXP.resx">
<DependentUpon>WinXP.cs</DependentUpon>
</EmbeddedResource>
- <EmbeddedResource Include="UI\ClassicButton.resx">
- <DependentUpon>ClassicButton.cs</DependentUpon>
- </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\chord.wav" />
diff --git a/Histacom2.Engine/Template/Infobox95.Designer.cs b/Histacom2.Engine/Template/Infobox95.Designer.cs
index 0bccf85..6ee2a6a 100644
--- a/Histacom2.Engine/Template/Infobox95.Designer.cs
+++ b/Histacom2.Engine/Template/Infobox95.Designer.cs
@@ -29,12 +29,12 @@
private void InitializeComponent()
{
this.programContent = new System.Windows.Forms.Panel();
- this.button1 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
+ this.button1 = new Histacom2.Engine.UI.ClassicButton();
+ this.button3 = new Histacom2.Engine.UI.ClassicButton();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.panel1 = new System.Windows.Forms.Panel();
this.infoText = new System.Windows.Forms.Label();
- this.button2 = new System.Windows.Forms.Button();
+ this.button2 = new Histacom2.Engine.UI.ClassicButton();
this.programContent.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.panel1.SuspendLayout();
@@ -57,16 +57,13 @@
//
// button1
//
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
+ this.button1.BackColor = System.Drawing.Color.Silver;
+ this.button1.ForeColor = System.Drawing.Color.Black;
this.button1.Location = new System.Drawing.Point(150, 84);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 23);
- this.button1.TabIndex = 5;
+ this.button1.TabIndex = 6;
this.button1.Text = "Yes";
- this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button3
@@ -74,13 +71,13 @@
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
+ this.button3.BackColor = System.Drawing.Color.Silver;
+ this.button3.ForeColor = System.Drawing.Color.Black;
this.button3.Location = new System.Drawing.Point(323, 84);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(80, 23);
this.button3.TabIndex = 4;
this.button3.Text = "Cancel";
- this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// pictureBox1
@@ -116,13 +113,13 @@
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
- this.button2.Location = new System.Drawing.Point(236, 84);
+ this.button2.BackColor = System.Drawing.Color.Silver;
+ this.button2.ForeColor = System.Drawing.Color.Black;
+ this.button2.Location = new System.Drawing.Point(237, 84);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(80, 23);
this.button2.TabIndex = 1;
this.button2.Text = "No";
- this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Infobox95
@@ -145,8 +142,8 @@
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Panel panel1;
public System.Windows.Forms.Label infoText;
- private System.Windows.Forms.Button button2;
- private System.Windows.Forms.Button button3;
- private System.Windows.Forms.Button button1;
+ private UI.ClassicButton button1;
+ private UI.ClassicButton button2;
+ private UI.ClassicButton button3;
}
} \ No newline at end of file
diff --git a/Histacom2.Engine/Template/Infobox95.cs b/Histacom2.Engine/Template/Infobox95.cs
index f0ed0db..dca45bb 100644
--- a/Histacom2.Engine/Template/Infobox95.cs
+++ b/Histacom2.Engine/Template/Infobox95.cs
@@ -13,9 +13,6 @@ namespace Histacom2.Engine.Template
public Infobox95(InfoboxType type, InfoboxButtons btns)
{
InitializeComponent();
- button1.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
- button2.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
- button3.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
switch (type)
{
diff --git a/Histacom2.Engine/Theme.cs b/Histacom2.Engine/Theme.cs
index 6c1efef..579f42e 100644
--- a/Histacom2.Engine/Theme.cs
+++ b/Histacom2.Engine/Theme.cs
@@ -19,6 +19,9 @@ namespace Histacom2.Engine
public Stream progErrorSound { get; set; }
public Stream questionSound { get; set; }
+ public Color threeDObjectsColor { get; set; }
+ public Color threeDObjectsTextColor { get; set; }
+
public Color activeTitleBarColor { get; set; }
public Color activeTitleTextColor { get; set; }
public Color inactiveTitleBarColor { get; set; }
@@ -42,6 +45,9 @@ namespace Histacom2.Engine
progErrorSound = Properties.Resources.CHORD;
questionSound = Properties.Resources.CHORD;
+ threeDObjectsColor = Color.Silver;
+ threeDObjectsTextColor = Color.Black;
+
activeTitleBarColor = Color.Navy;
activeTitleTextColor = Color.White;
inactiveTitleBarColor = Color.Gray;
@@ -65,6 +71,14 @@ namespace Histacom2.Engine
progErrorSound = Properties.Resources.CHORD;
questionSound = Properties.Resources.CHORD;
+ threeDObjectsColor = Color.Silver;
+ threeDObjectsTextColor = Color.Black;
+
+ activeTitleBarColor = Color.Navy;
+ activeTitleTextColor = Color.White;
+ inactiveTitleBarColor = Color.Gray;
+ inactiveTitleTextColor = Color.Silver;
+
defaultWallpaper = null;
themeName = "default98";
}
diff --git a/Histacom2.Engine/UI/ClassicButton.Designer.cs b/Histacom2.Engine/UI/ClassicButton.Designer.cs
deleted file mode 100644
index c76bba0..0000000
--- a/Histacom2.Engine/UI/ClassicButton.Designer.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-namespace Histacom2.Engine.UI
-{
- partial class ClassicButton
- {
- /// <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.borderpart = new System.Windows.Forms.Panel();
- this.graystuff = new System.Windows.Forms.Panel();
- this.lessgraystuff = new System.Windows.Forms.Label();
- this.borderpart.SuspendLayout();
- this.graystuff.SuspendLayout();
- this.SuspendLayout();
- //
- // borderpart
- //
- this.borderpart.BackColor = System.Drawing.Color.White;
- this.borderpart.Controls.Add(this.graystuff);
- this.borderpart.Location = new System.Drawing.Point(0, 0);
- this.borderpart.Name = "borderpart";
- this.borderpart.Size = new System.Drawing.Size(99, 24);
- this.borderpart.TabIndex = 0;
- //
- // graystuff
- //
- this.graystuff.BackColor = System.Drawing.Color.Gray;
- this.graystuff.Controls.Add(this.lessgraystuff);
- this.graystuff.Location = new System.Drawing.Point(1, 1);
- this.graystuff.Name = "graystuff";
- this.graystuff.Size = new System.Drawing.Size(98, 23);
- this.graystuff.TabIndex = 0;
- //
- // lessgraystuff
- //
- this.lessgraystuff.BackColor = System.Drawing.Color.Silver;
- this.lessgraystuff.Location = new System.Drawing.Point(0, 0);
- this.lessgraystuff.Margin = new System.Windows.Forms.Padding(0);
- this.lessgraystuff.Name = "lessgraystuff";
- this.lessgraystuff.Size = new System.Drawing.Size(97, 22);
- this.lessgraystuff.TabIndex = 0;
- this.lessgraystuff.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- this.lessgraystuff.Paint += new System.Windows.Forms.PaintEventHandler(this.lessgraystuff_Paint);
- //
- // ClassicButton
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.Black;
- this.Controls.Add(this.borderpart);
- this.Name = "ClassicButton";
- this.Size = new System.Drawing.Size(100, 25);
- this.Paint += new System.Windows.Forms.PaintEventHandler(this.ClassicButton_Paint);
- this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ClassicButton_MouseDown);
- this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ClassicButton_MouseUp);
- this.Resize += new System.EventHandler(this.ClassicButton_Resize);
- this.borderpart.ResumeLayout(false);
- this.graystuff.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.Panel borderpart;
- private System.Windows.Forms.Panel graystuff;
- private System.Windows.Forms.Label lessgraystuff;
- }
-}
diff --git a/Histacom2.Engine/UI/ClassicButton.cs b/Histacom2.Engine/UI/ClassicButton.cs
index 26629a8..e82a742 100644
--- a/Histacom2.Engine/UI/ClassicButton.cs
+++ b/Histacom2.Engine/UI/ClassicButton.cs
@@ -1,8 +1,6 @@
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;
@@ -10,49 +8,54 @@ using System.Windows.Forms;
namespace Histacom2.Engine.UI
{
- public partial class ClassicButton : UserControl
+ public class ClassicButton : Control
{
- public ClassicButton()
- {
- InitializeComponent();
- }
-
- private void ClassicButton_SizeChanged(object sender, EventArgs e)
- {
+ private Color _lightBack = Color.White;
+ private Color _darkBack = Color.Gray;
- }
+ private bool _pressing = false;
- private void ClassicButton_MouseDown(object sender, MouseEventArgs e)
+ public ClassicButton() : base()
{
- this.BackColor = Color.White;
- borderpart.BackColor = Color.Black;
- lessgraystuff.Location = new Point(1, 1);
- }
+ if (SaveSystem.currentTheme != null) BackColor = SaveSystem.currentTheme.threeDObjectsColor;
+ else BackColor = Color.Silver;
+ _lightBack = ControlPaint.Light(BackColor, 50);
+ _darkBack = ControlPaint.Dark(BackColor, 50);
- private void ClassicButton_Paint(object sender, PaintEventArgs e)
- {
- e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
- base.OnPaint(e);
- }
+ if (SaveSystem.currentTheme != null) ForeColor = SaveSystem.currentTheme.threeDObjectsTextColor;
+ else ForeColor = Color.Black;
- private void lessgraystuff_Paint(object sender, PaintEventArgs e)
- {
- e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
- base.OnPaint(e);
+ MouseDown += (s, e) => { _pressing = true; Invalidate(); };
+ MouseUp += (s, e) => { _pressing = false; Invalidate(); };
}
- private void ClassicButton_MouseUp(object sender, MouseEventArgs e)
+ protected override void OnPaint(PaintEventArgs e)
{
- this.BackColor = Color.Black;
- borderpart.BackColor = Color.White;
- lessgraystuff.Location = new Point(0, 0);
- }
-
- private void ClassicButton_Resize(object sender, EventArgs e)
- {
- borderpart.Size = new Size(this.Width - 1, this.Height - 1);
- graystuff.Size = new Size(this.Width - 2, this.Height - 2);
- lessgraystuff.Size = new Size(this.Width - 3, this.Height - 3);
+ base.OnPaint(e);
+ var g = e.Graphics;
+ g.Clear(BackColor);
+
+ g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
+
+ if (_pressing)
+ {
+ g.FillRectangle(new SolidBrush(_lightBack), new Rectangle(0, 0, Width, Height));
+ g.FillRectangle(Brushes.Black, new Rectangle(0, 0, Width - 1, Height - 1));
+ g.FillRectangle(new SolidBrush(_darkBack), new Rectangle(1, 1, Width - 2, Height - 2));
+ g.FillRectangle(new SolidBrush(BackColor), new Rectangle(2, 2, Width - 3, Height - 3));
+
+ g.DrawString(Text, Font, new SolidBrush(ForeColor), (Width / 2) - (g.MeasureString(Text, Font).Width / 2) + 1, (Height / 2) - (g.MeasureString(Text, Font).Height / 2) + 1);
+ }
+ else
+ {
+ g.FillRectangle(Brushes.Black, new Rectangle(0, 0, Width, Height));
+ g.FillRectangle(new SolidBrush(_lightBack), new Rectangle(0, 0, Width - 1, Height - 1));
+ g.FillRectangle(new SolidBrush(_darkBack), new Rectangle(1, 1, Width - 2, Height - 2));
+ g.FillRectangle(new SolidBrush(BackColor), new Rectangle(1, 1, Width - 3, Height - 3));
+
+ g.DrawString(Text, Font, new SolidBrush(ForeColor), (Width / 2) - (g.MeasureString(Text, Font).Width / 2), (Height / 2) - (g.MeasureString(Text, Font).Height / 2));
+ }
}
+
}
-} \ No newline at end of file
+}
diff --git a/Histacom2.Engine/UI/ClassicButton.resx b/Histacom2.Engine/UI/ClassicButton.resx
deleted file mode 100644
index d5494e3..0000000
--- a/Histacom2.Engine/UI/ClassicButton.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-<?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>
- <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