Fixed line endings and applied gitignore

This commit is contained in:
2014-07-26 09:43:40 +03:00
parent 0c57cabe56
commit 7cba5cc109
542 changed files with 112014 additions and 119759 deletions

View File

@ -1,7 +1,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("© 2010 - Peter Souza IV")]
[assembly: AssemblyVersion("1.7.0.0")]
[assembly: AssemblyInformationalVersion(Rainmeter.Version.Informational)]
[assembly: AssemblyProduct("Rainmeter")]
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("© 2010 - Peter Souza IV")]
[assembly: AssemblyVersion("1.7.0.0")]
[assembly: AssemblyInformationalVersion(Rainmeter.Version.Informational)]
[assembly: AssemblyProduct("Rainmeter")]

View File

@ -1,105 +1,105 @@
namespace InputText
{
partial class InputBox
{
/// <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 Windows Form 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.txtInput = new System.Windows.Forms.TextBox();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// txtInput
//
this.txtInput.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtInput.Location = new System.Drawing.Point(0, 0);
this.txtInput.Margin = new System.Windows.Forms.Padding(0);
this.txtInput.Multiline = true;
this.txtInput.Name = "txtInput";
this.txtInput.Size = new System.Drawing.Size(200, 22);
this.txtInput.TabIndex = 0;
this.txtInput.Leave += new System.EventHandler(this.txtInput_Leave);
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(2, 2);
this.btnOK.Margin = new System.Windows.Forms.Padding(0);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(2, 2);
this.btnOK.TabIndex = 1;
this.btnOK.TabStop = false;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(2, 2);
this.btnCancel.Margin = new System.Windows.Forms.Padding(0);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(2, 2);
this.btnCancel.TabIndex = 2;
this.btnCancel.TabStop = false;
this.btnCancel.Text = "btnCancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// InputBox
//
this.AcceptButton = this.btnOK;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(251, 42);
this.Controls.Add(this.txtInput);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "InputBox";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "InputBox";
this.Deactivate += new System.EventHandler(this.InputBox_Deactivate);
this.Load += new System.EventHandler(this.InputBox_Load);
this.Shown += new System.EventHandler(this.InputBox_Shown);
this.Leave += new System.EventHandler(this.InputBox_Leave);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox txtInput;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
}
namespace InputText
{
partial class InputBox
{
/// <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 Windows Form 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.txtInput = new System.Windows.Forms.TextBox();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// txtInput
//
this.txtInput.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtInput.Location = new System.Drawing.Point(0, 0);
this.txtInput.Margin = new System.Windows.Forms.Padding(0);
this.txtInput.Multiline = true;
this.txtInput.Name = "txtInput";
this.txtInput.Size = new System.Drawing.Size(200, 22);
this.txtInput.TabIndex = 0;
this.txtInput.Leave += new System.EventHandler(this.txtInput_Leave);
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(2, 2);
this.btnOK.Margin = new System.Windows.Forms.Padding(0);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(2, 2);
this.btnOK.TabIndex = 1;
this.btnOK.TabStop = false;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(2, 2);
this.btnCancel.Margin = new System.Windows.Forms.Padding(0);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(2, 2);
this.btnCancel.TabIndex = 2;
this.btnCancel.TabStop = false;
this.btnCancel.Text = "btnCancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// InputBox
//
this.AcceptButton = this.btnOK;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(251, 42);
this.Controls.Add(this.txtInput);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "InputBox";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "InputBox";
this.Deactivate += new System.EventHandler(this.InputBox_Deactivate);
this.Load += new System.EventHandler(this.InputBox_Load);
this.Shown += new System.EventHandler(this.InputBox_Shown);
this.Leave += new System.EventHandler(this.InputBox_Leave);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox txtInput;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
}
}

View File

@ -1,382 +1,382 @@
/*
Copyright (C) 2013 Rainmeter Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using System.Drawing;
using System.Windows.Forms;
namespace InputText
{
public partial class InputBox : Form
{
private SkinWindow parent = null;
private bool _FocusDismiss = true;
private string _TextValue = string.Empty;
public InputBox(SkinWindow parent)
{
this.parent = parent;
InitializeComponent();
}
// This event will make sure we have focus when the inputbox is shown ot the user.
// it will only cause focus if the window itself has focus (i.e. doesn't steal).
private void InputBox_Shown(object sender, EventArgs e)
{
this.Activate();
this.BringToFront();
this.Activate();
this.BringToFront();
this.txtInput.Focus();
}
private void InputBox_Load(object sender, EventArgs e)
{
this.Activate();
this.BringToFront();
this.Activate();
this.BringToFront();
}
// All exceptions are swallowed for the sake of this example. Since the majority
// (if not all) of these are rather simple in nature, debugging without errors
// should be fairly simple anyway.
//
// However, if you wanted to log errors, a simple way would be to add something like
// this:
//
// try
// {
// ... // code you are testing
// }
// catch (Exception ex)
// {
// API.Log(API.LogType.Warning, "InputText :: exception :: " + ex.GetType().ToString() + ": " + ex.Message);
// }
#region TextValue -- returns the inputted text
public string TextValue
{
get { return this._TextValue; }
}
#endregion
#region ChangeFontFace(string) -- changes the text's font name
public void ChangeFontFace(string sFont)
{
try
{
this.txtInput.Font = new Font(sFont, this.txtInput.Font.Size);
}
catch { }
}
#endregion
#region ChangeFontColor(string) -- changes the font's color, supports 6 and 8-digit hex or a series of 3 or 4 comma-separated numbers
public void ChangeFontColor(string sColor)
{
try
{
sColor = sColor.Trim();
if (sColor.Contains(",")) // #,#,# or #,#,#,# format
{
string[] sParts = sColor.Trim().Replace(" ", string.Empty).Split(new char[] { ',' }, StringSplitOptions.None);
this.txtInput.ForeColor = Color.FromArgb(int.Parse(sParts[0]), int.Parse(sParts[1]), int.Parse(sParts[2]));
this.txtInput.ForeColor = Color.FromArgb(int.Parse(sParts[3]), int.Parse(sParts[0]), int.Parse(sParts[1]), int.Parse(sParts[2]));
}
else
{
if (sColor.Length == 6) // 6-digit hex (no alpha transparency)
{
uint iColor = uint.Parse(sColor, System.Globalization.NumberStyles.HexNumber);
// Since it was omitted, force full opacity (not transparent at all)
this.txtInput.ForeColor = Color.FromArgb((int)(0xFF000000 | iColor));
}
else if (sColor.Length == 8) // 8-digit hex (with alpha transparency)
{
uint iColor = uint.Parse(sColor, System.Globalization.NumberStyles.HexNumber);
// This swaps RRGGBBAA for AARRGGBB, which Color.FromArgb() wants
iColor = ((iColor & 0xFFFFFF00) >> 8) | ((iColor & 0x000000FF) << 24);
this.txtInput.ForeColor = Color.FromArgb((int)iColor);
}
}
}
catch { }
}
#endregion
#region ChangeBackColor(string) -- changes the background color, supports 6 and 8-digit hex or a series of 3 or 4 comma-separated numbers
public void ChangeBackColor(string sColor)
{
try
{
sColor = sColor.Trim();
if (sColor.Contains(",")) // #,#,# or #,#,#,# format
{
string[] sParts = sColor.Trim().Replace(" ", string.Empty).Split(new char[] { ',' }, StringSplitOptions.None);
this.txtInput.BackColor = Color.FromArgb(int.Parse(sParts[0]), int.Parse(sParts[1]), int.Parse(sParts[2]));
// Change 0-255 transparency to a 0.0-1.0 transparency range
double dTrans = (double)int.Parse(sParts[3]);
dTrans /= 255.0;
this.Opacity = dTrans;
}
else
{
if (sColor.Length == 6) // 6-digit hex (no alpha transparency)
{
uint iColor = uint.Parse(sColor, System.Globalization.NumberStyles.HexNumber);
this.txtInput.BackColor = Color.FromArgb((int)(0xFF000000 | iColor));
// Since it was omitted, force full opacity (not transparent at all)
this.Opacity = 1.0;
}
else if (sColor.Length == 8) // 8-digit hex (with alpha transparency)
{
uint iColor = uint.Parse(sColor, System.Globalization.NumberStyles.HexNumber);
// This swaps RRGGBBAA for AARRGGBB, which Color.FromArgb() wants
iColor = ((iColor & 0xFFFFFF00) >> 8) | ((iColor & 0x000000FF) << 24);
this.txtInput.BackColor = Color.FromArgb((int)((0xFF000000) | (0x00FFFFFF & iColor)));
// Change 0-255 transparency to a 0.0-1.0 transparency range
double dTrans = (double)((iColor & 0xFF000000) >> 24);
dTrans /= 255.0;
this.Opacity = dTrans;
}
}
}
catch { }
}
#endregion
#region ChangeStringAlign(string) -- Changes text horizontal alignment
public void ChangeStringAlign(string sAlign)
{
try
{
sAlign = sAlign.ToUpper().Trim();
if (sAlign == "LEFT")
this.txtInput.TextAlign = HorizontalAlignment.Left;
else if (sAlign == "CENTER")
this.txtInput.TextAlign = HorizontalAlignment.Center;
else if (sAlign == "RIGHT")
this.txtInput.TextAlign = HorizontalAlignment.Right;
}
catch { }
}
#endregion
#region ChangeFontSize(string) -- changes the font's point size (supports floating-point values)
public void ChangeFontSize(string sSize)
{
try
{
this.txtInput.Font = new Font(this.txtInput.Font.Name, float.Parse(sSize));
}
catch { }
}
#endregion
#region MakeTopmost() -- forces the form to have the 'Always On Top' property
public void MakeTopmost()
{
this.TopMost = true;
}
#endregion
#region MakePassword(bool) -- causes the textbox to be password style
public void MakePassword(bool bPass)
{
this.txtInput.PasswordChar = bPass ? '*' : '\0';
}
#endregion
#region ChangeFontStringStyle() -- changes the font's bold/italic styles
public void ChangeFontStringStyle(string sStyle)
{
try
{
sStyle = sStyle.ToUpper().Trim();
if (sStyle == "NORMAL")
this.txtInput.Font = new Font(this.txtInput.Font, FontStyle.Regular);
else if (sStyle == "BOLD")
this.txtInput.Font = new Font(this.txtInput.Font, FontStyle.Bold);
else if (sStyle == "ITALIC")
this.txtInput.Font = new Font(this.txtInput.Font, FontStyle.Italic);
else if (sStyle == "BOLDITALIC")
this.txtInput.Font = new Font(this.txtInput.Font, FontStyle.Bold | FontStyle.Italic);
}
catch { }
}
#endregion
#region ChangeW(string) -- changes the width of the input textbox
public void ChangeW(string sWidth)
{
try
{
this.txtInput.Width = int.Parse(sWidth);
}
catch { }
}
#endregion
#region ChangeH(string) -- changes the height of the input textbox
public void ChangeH(string sHeight)
{
try
{
this.txtInput.Height = int.Parse(sHeight);
}
catch { }
}
#endregion
#region ChangeX(string) -- changes the X (horizontal) position of the input textbox, relative to its parent skin
public void ChangeX(string sX)
{
try
{
// If the position is changed, make sure the form's auto-location is disabled.
if (this.StartPosition != FormStartPosition.Manual)
this.StartPosition = FormStartPosition.Manual;
// Notice that we need the position of the parent window for offset location.
//
// The Rainmeter class does this for us
this.Location = new System.Drawing.Point(this.parent.X + int.Parse(sX), this.Location.Y);
}
catch { }
}
#endregion
#region ChangeY(string) -- changes the Y (vertical) position of the input textbox, relative to its parent skin
public void ChangeY(string sY)
{
try
{
// If the position is changed, make sure the form's auto-location is disabled.
if (this.StartPosition != FormStartPosition.Manual)
this.StartPosition = FormStartPosition.Manual;
// Notice that we need the position of the parent window for offset location.
//
// The Rainmeter class does this for us
this.Location = new System.Drawing.Point(this.Location.X, this.parent.Y + int.Parse(sY));
}
catch { }
}
#endregion
#region DefaultValue(string) -- sets the default text to appear in the input textbox
public void DefaultValue(string val)
{
this.txtInput.Text = val;
}
#endregion
#region MakeFocusDismiss(bool) -- dismisses the input textbox if it loses cursor/window focus
public void MakeFocusDismiss(bool bDismissing)
{
this._FocusDismiss = bDismissing;
}
#endregion
#region ShowInputBox() -- shows text input textbox
private DialogResult drBackup = DialogResult.None;
public bool ShowInputBox()
{
if (this.drBackup != DialogResult.None)
return false;
if (this._FocusDismiss)
{
this.Show(this.parent);
while (this.DialogResult == DialogResult.None &&
this.drBackup == DialogResult.None)
{
Application.DoEvents();
System.Threading.Thread.Sleep(44);
}
}
else
{
this.ShowDialog(this.parent);
}
if (this.drBackup != DialogResult.None)
{
if (this.drBackup != DialogResult.OK)
return false;
}
else if (this.DialogResult != DialogResult.None)
{
if (this.DialogResult != DialogResult.OK)
return false;
}
return true;
}
public void Abort()
{
this.drBackup = DialogResult.Abort;
this.Close();
}
private void txtInput_Leave(object sender, EventArgs e)
{
if (this._FocusDismiss)
{
this.drBackup = DialogResult.Cancel;
this.Close();
}
}
private void InputBox_Leave(object sender, EventArgs e)
{
if (this._FocusDismiss)
{
this.drBackup = DialogResult.Cancel;
this.Close();
}
}
private void InputBox_Deactivate(object sender, EventArgs e)
{
if (this._FocusDismiss)
{
this.drBackup = DialogResult.Cancel;
this.Close();
}
}
private void btnOK_Click(object sender, EventArgs e)
{
this._FocusDismiss = false;
this._TextValue = this.txtInput.Text.Trim();
this.drBackup = DialogResult.OK;
this.DialogResult = DialogResult.OK;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this._FocusDismiss = false;
this.drBackup = DialogResult.Cancel;
this.DialogResult = DialogResult.Cancel;
this.Close();
}
#endregion
}
}
/*
Copyright (C) 2013 Rainmeter Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using System.Drawing;
using System.Windows.Forms;
namespace InputText
{
public partial class InputBox : Form
{
private SkinWindow parent = null;
private bool _FocusDismiss = true;
private string _TextValue = string.Empty;
public InputBox(SkinWindow parent)
{
this.parent = parent;
InitializeComponent();
}
// This event will make sure we have focus when the inputbox is shown ot the user.
// it will only cause focus if the window itself has focus (i.e. doesn't steal).
private void InputBox_Shown(object sender, EventArgs e)
{
this.Activate();
this.BringToFront();
this.Activate();
this.BringToFront();
this.txtInput.Focus();
}
private void InputBox_Load(object sender, EventArgs e)
{
this.Activate();
this.BringToFront();
this.Activate();
this.BringToFront();
}
// All exceptions are swallowed for the sake of this example. Since the majority
// (if not all) of these are rather simple in nature, debugging without errors
// should be fairly simple anyway.
//
// However, if you wanted to log errors, a simple way would be to add something like
// this:
//
// try
// {
// ... // code you are testing
// }
// catch (Exception ex)
// {
// API.Log(API.LogType.Warning, "InputText :: exception :: " + ex.GetType().ToString() + ": " + ex.Message);
// }
#region TextValue -- returns the inputted text
public string TextValue
{
get { return this._TextValue; }
}
#endregion
#region ChangeFontFace(string) -- changes the text's font name
public void ChangeFontFace(string sFont)
{
try
{
this.txtInput.Font = new Font(sFont, this.txtInput.Font.Size);
}
catch { }
}
#endregion
#region ChangeFontColor(string) -- changes the font's color, supports 6 and 8-digit hex or a series of 3 or 4 comma-separated numbers
public void ChangeFontColor(string sColor)
{
try
{
sColor = sColor.Trim();
if (sColor.Contains(",")) // #,#,# or #,#,#,# format
{
string[] sParts = sColor.Trim().Replace(" ", string.Empty).Split(new char[] { ',' }, StringSplitOptions.None);
this.txtInput.ForeColor = Color.FromArgb(int.Parse(sParts[0]), int.Parse(sParts[1]), int.Parse(sParts[2]));
this.txtInput.ForeColor = Color.FromArgb(int.Parse(sParts[3]), int.Parse(sParts[0]), int.Parse(sParts[1]), int.Parse(sParts[2]));
}
else
{
if (sColor.Length == 6) // 6-digit hex (no alpha transparency)
{
uint iColor = uint.Parse(sColor, System.Globalization.NumberStyles.HexNumber);
// Since it was omitted, force full opacity (not transparent at all)
this.txtInput.ForeColor = Color.FromArgb((int)(0xFF000000 | iColor));
}
else if (sColor.Length == 8) // 8-digit hex (with alpha transparency)
{
uint iColor = uint.Parse(sColor, System.Globalization.NumberStyles.HexNumber);
// This swaps RRGGBBAA for AARRGGBB, which Color.FromArgb() wants
iColor = ((iColor & 0xFFFFFF00) >> 8) | ((iColor & 0x000000FF) << 24);
this.txtInput.ForeColor = Color.FromArgb((int)iColor);
}
}
}
catch { }
}
#endregion
#region ChangeBackColor(string) -- changes the background color, supports 6 and 8-digit hex or a series of 3 or 4 comma-separated numbers
public void ChangeBackColor(string sColor)
{
try
{
sColor = sColor.Trim();
if (sColor.Contains(",")) // #,#,# or #,#,#,# format
{
string[] sParts = sColor.Trim().Replace(" ", string.Empty).Split(new char[] { ',' }, StringSplitOptions.None);
this.txtInput.BackColor = Color.FromArgb(int.Parse(sParts[0]), int.Parse(sParts[1]), int.Parse(sParts[2]));
// Change 0-255 transparency to a 0.0-1.0 transparency range
double dTrans = (double)int.Parse(sParts[3]);
dTrans /= 255.0;
this.Opacity = dTrans;
}
else
{
if (sColor.Length == 6) // 6-digit hex (no alpha transparency)
{
uint iColor = uint.Parse(sColor, System.Globalization.NumberStyles.HexNumber);
this.txtInput.BackColor = Color.FromArgb((int)(0xFF000000 | iColor));
// Since it was omitted, force full opacity (not transparent at all)
this.Opacity = 1.0;
}
else if (sColor.Length == 8) // 8-digit hex (with alpha transparency)
{
uint iColor = uint.Parse(sColor, System.Globalization.NumberStyles.HexNumber);
// This swaps RRGGBBAA for AARRGGBB, which Color.FromArgb() wants
iColor = ((iColor & 0xFFFFFF00) >> 8) | ((iColor & 0x000000FF) << 24);
this.txtInput.BackColor = Color.FromArgb((int)((0xFF000000) | (0x00FFFFFF & iColor)));
// Change 0-255 transparency to a 0.0-1.0 transparency range
double dTrans = (double)((iColor & 0xFF000000) >> 24);
dTrans /= 255.0;
this.Opacity = dTrans;
}
}
}
catch { }
}
#endregion
#region ChangeStringAlign(string) -- Changes text horizontal alignment
public void ChangeStringAlign(string sAlign)
{
try
{
sAlign = sAlign.ToUpper().Trim();
if (sAlign == "LEFT")
this.txtInput.TextAlign = HorizontalAlignment.Left;
else if (sAlign == "CENTER")
this.txtInput.TextAlign = HorizontalAlignment.Center;
else if (sAlign == "RIGHT")
this.txtInput.TextAlign = HorizontalAlignment.Right;
}
catch { }
}
#endregion
#region ChangeFontSize(string) -- changes the font's point size (supports floating-point values)
public void ChangeFontSize(string sSize)
{
try
{
this.txtInput.Font = new Font(this.txtInput.Font.Name, float.Parse(sSize));
}
catch { }
}
#endregion
#region MakeTopmost() -- forces the form to have the 'Always On Top' property
public void MakeTopmost()
{
this.TopMost = true;
}
#endregion
#region MakePassword(bool) -- causes the textbox to be password style
public void MakePassword(bool bPass)
{
this.txtInput.PasswordChar = bPass ? '*' : '\0';
}
#endregion
#region ChangeFontStringStyle() -- changes the font's bold/italic styles
public void ChangeFontStringStyle(string sStyle)
{
try
{
sStyle = sStyle.ToUpper().Trim();
if (sStyle == "NORMAL")
this.txtInput.Font = new Font(this.txtInput.Font, FontStyle.Regular);
else if (sStyle == "BOLD")
this.txtInput.Font = new Font(this.txtInput.Font, FontStyle.Bold);
else if (sStyle == "ITALIC")
this.txtInput.Font = new Font(this.txtInput.Font, FontStyle.Italic);
else if (sStyle == "BOLDITALIC")
this.txtInput.Font = new Font(this.txtInput.Font, FontStyle.Bold | FontStyle.Italic);
}
catch { }
}
#endregion
#region ChangeW(string) -- changes the width of the input textbox
public void ChangeW(string sWidth)
{
try
{
this.txtInput.Width = int.Parse(sWidth);
}
catch { }
}
#endregion
#region ChangeH(string) -- changes the height of the input textbox
public void ChangeH(string sHeight)
{
try
{
this.txtInput.Height = int.Parse(sHeight);
}
catch { }
}
#endregion
#region ChangeX(string) -- changes the X (horizontal) position of the input textbox, relative to its parent skin
public void ChangeX(string sX)
{
try
{
// If the position is changed, make sure the form's auto-location is disabled.
if (this.StartPosition != FormStartPosition.Manual)
this.StartPosition = FormStartPosition.Manual;
// Notice that we need the position of the parent window for offset location.
//
// The Rainmeter class does this for us
this.Location = new System.Drawing.Point(this.parent.X + int.Parse(sX), this.Location.Y);
}
catch { }
}
#endregion
#region ChangeY(string) -- changes the Y (vertical) position of the input textbox, relative to its parent skin
public void ChangeY(string sY)
{
try
{
// If the position is changed, make sure the form's auto-location is disabled.
if (this.StartPosition != FormStartPosition.Manual)
this.StartPosition = FormStartPosition.Manual;
// Notice that we need the position of the parent window for offset location.
//
// The Rainmeter class does this for us
this.Location = new System.Drawing.Point(this.Location.X, this.parent.Y + int.Parse(sY));
}
catch { }
}
#endregion
#region DefaultValue(string) -- sets the default text to appear in the input textbox
public void DefaultValue(string val)
{
this.txtInput.Text = val;
}
#endregion
#region MakeFocusDismiss(bool) -- dismisses the input textbox if it loses cursor/window focus
public void MakeFocusDismiss(bool bDismissing)
{
this._FocusDismiss = bDismissing;
}
#endregion
#region ShowInputBox() -- shows text input textbox
private DialogResult drBackup = DialogResult.None;
public bool ShowInputBox()
{
if (this.drBackup != DialogResult.None)
return false;
if (this._FocusDismiss)
{
this.Show(this.parent);
while (this.DialogResult == DialogResult.None &&
this.drBackup == DialogResult.None)
{
Application.DoEvents();
System.Threading.Thread.Sleep(44);
}
}
else
{
this.ShowDialog(this.parent);
}
if (this.drBackup != DialogResult.None)
{
if (this.drBackup != DialogResult.OK)
return false;
}
else if (this.DialogResult != DialogResult.None)
{
if (this.DialogResult != DialogResult.OK)
return false;
}
return true;
}
public void Abort()
{
this.drBackup = DialogResult.Abort;
this.Close();
}
private void txtInput_Leave(object sender, EventArgs e)
{
if (this._FocusDismiss)
{
this.drBackup = DialogResult.Cancel;
this.Close();
}
}
private void InputBox_Leave(object sender, EventArgs e)
{
if (this._FocusDismiss)
{
this.drBackup = DialogResult.Cancel;
this.Close();
}
}
private void InputBox_Deactivate(object sender, EventArgs e)
{
if (this._FocusDismiss)
{
this.drBackup = DialogResult.Cancel;
this.Close();
}
}
private void btnOK_Click(object sender, EventArgs e)
{
this._FocusDismiss = false;
this._TextValue = this.txtInput.Text.Trim();
this.drBackup = DialogResult.OK;
this.DialogResult = DialogResult.OK;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this._FocusDismiss = false;
this.drBackup = DialogResult.Cancel;
this.DialogResult = DialogResult.Cancel;
this.Close();
}
#endregion
}
}

View File

@ -1,120 +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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,208 +1,208 @@
/*
Copyright (C) 2013 Rainmeter Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
using Rainmeter;
namespace InputText
{
internal partial class Measure
{
private Rainmeter.API rm;
private string LastInput = string.Empty;
private bool IsExecuteBangRunning = false;
private object locker = new object();
internal Measure(Rainmeter.API rm)
{
this.rm = rm;
}
internal void Reload(Rainmeter.API rm, ref double maxValue)
{
// Do nothing here.
}
internal double Update()
{
return 0.0;
}
internal string GetString()
{
lock (this.locker)
{
return this.LastInput;
}
}
internal void ExecuteBang(string args)
{
bool go = false;
lock (this.locker)
{
if (!this.IsExecuteBangRunning)
{
this.IsExecuteBangRunning = true;
go = true;
}
}
if (go)
{
ExecuteBangParam param = new ExecuteBangParam(args);
if (ReadOptions(param)) // Read all options in main thread for thread-safety
{
ThreadPool.QueueUserWorkItem(_ =>
{
try
{
ExecuteCommands(param);
}
catch (Exception ex)
{
API.Log(API.LogType.Error, "C# plugin in ExecuteBang(), " + ex.GetType().ToString() + ": " + ex.Message);
}
lock (this.locker)
{
this.IsExecuteBangRunning = false;
}
});
}
else
{
// No need to continue
lock (this.locker)
{
this.IsExecuteBangRunning = false;
}
}
}
}
private class ExecuteBangParam
{
internal enum BangType
{
Unknown,
SetVariable,
ExecuteBatch
};
internal Dictionary<string, string> Options;
internal List<Dictionary<string, string>> OverrideOptions;
internal List<string> Commands;
internal string Command;
internal string DismissAction;
internal BangType Type;
internal ExecuteBangParam(string args)
{
this.Options = new Dictionary<string, string>();
this.OverrideOptions = new List<Dictionary<string, string>>();
this.Commands = new List<string>();
this.Command = args.Trim();
this.DismissAction = null;
this.Type = BangType.Unknown;
}
};
private bool _IsFinalizing = false;
internal void Dispose()
{
this._IsFinalizing = true;
FinalizePluginCode();
}
}
#region Plugin
public static class Plugin
{
static IntPtr StringBuffer = IntPtr.Zero;
[DllExport]
public static void Initialize(ref IntPtr data, IntPtr rm)
{
data = GCHandle.ToIntPtr(GCHandle.Alloc(new Measure(new Rainmeter.API(rm))));
}
[DllExport]
public static void Finalize(IntPtr data)
{
Measure measure = (Measure)GCHandle.FromIntPtr(data).Target;
measure.Dispose();
GCHandle.FromIntPtr(data).Free();
if (StringBuffer != IntPtr.Zero)
{
Marshal.FreeHGlobal(StringBuffer);
StringBuffer = IntPtr.Zero;
}
}
[DllExport]
public static void Reload(IntPtr data, IntPtr rm, ref double maxValue)
{
Measure measure = (Measure)GCHandle.FromIntPtr(data).Target;
measure.Reload(new Rainmeter.API(rm), ref maxValue);
}
[DllExport]
public static double Update(IntPtr data)
{
Measure measure = (Measure)GCHandle.FromIntPtr(data).Target;
return measure.Update();
}
[DllExport]
public static IntPtr GetString(IntPtr data)
{
Measure measure = (Measure)GCHandle.FromIntPtr(data).Target;
if (StringBuffer != IntPtr.Zero)
{
Marshal.FreeHGlobal(StringBuffer);
StringBuffer = IntPtr.Zero;
}
string stringValue = measure.GetString();
if (stringValue != null)
{
StringBuffer = Marshal.StringToHGlobalUni(stringValue);
}
return StringBuffer;
}
[DllExport]
public static void ExecuteBang(IntPtr data, IntPtr args)
{
Measure measure = (Measure)GCHandle.FromIntPtr(data).Target;
measure.ExecuteBang(Marshal.PtrToStringUni(args));
}
}
#endregion
}
/*
Copyright (C) 2013 Rainmeter Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
using Rainmeter;
namespace InputText
{
internal partial class Measure
{
private Rainmeter.API rm;
private string LastInput = string.Empty;
private bool IsExecuteBangRunning = false;
private object locker = new object();
internal Measure(Rainmeter.API rm)
{
this.rm = rm;
}
internal void Reload(Rainmeter.API rm, ref double maxValue)
{
// Do nothing here.
}
internal double Update()
{
return 0.0;
}
internal string GetString()
{
lock (this.locker)
{
return this.LastInput;
}
}
internal void ExecuteBang(string args)
{
bool go = false;
lock (this.locker)
{
if (!this.IsExecuteBangRunning)
{
this.IsExecuteBangRunning = true;
go = true;
}
}
if (go)
{
ExecuteBangParam param = new ExecuteBangParam(args);
if (ReadOptions(param)) // Read all options in main thread for thread-safety
{
ThreadPool.QueueUserWorkItem(_ =>
{
try
{
ExecuteCommands(param);
}
catch (Exception ex)
{
API.Log(API.LogType.Error, "C# plugin in ExecuteBang(), " + ex.GetType().ToString() + ": " + ex.Message);
}
lock (this.locker)
{
this.IsExecuteBangRunning = false;
}
});
}
else
{
// No need to continue
lock (this.locker)
{
this.IsExecuteBangRunning = false;
}
}
}
}
private class ExecuteBangParam
{
internal enum BangType
{
Unknown,
SetVariable,
ExecuteBatch
};
internal Dictionary<string, string> Options;
internal List<Dictionary<string, string>> OverrideOptions;
internal List<string> Commands;
internal string Command;
internal string DismissAction;
internal BangType Type;
internal ExecuteBangParam(string args)
{
this.Options = new Dictionary<string, string>();
this.OverrideOptions = new List<Dictionary<string, string>>();
this.Commands = new List<string>();
this.Command = args.Trim();
this.DismissAction = null;
this.Type = BangType.Unknown;
}
};
private bool _IsFinalizing = false;
internal void Dispose()
{
this._IsFinalizing = true;
FinalizePluginCode();
}
}
#region Plugin
public static class Plugin
{
static IntPtr StringBuffer = IntPtr.Zero;
[DllExport]
public static void Initialize(ref IntPtr data, IntPtr rm)
{
data = GCHandle.ToIntPtr(GCHandle.Alloc(new Measure(new Rainmeter.API(rm))));
}
[DllExport]
public static void Finalize(IntPtr data)
{
Measure measure = (Measure)GCHandle.FromIntPtr(data).Target;
measure.Dispose();
GCHandle.FromIntPtr(data).Free();
if (StringBuffer != IntPtr.Zero)
{
Marshal.FreeHGlobal(StringBuffer);
StringBuffer = IntPtr.Zero;
}
}
[DllExport]
public static void Reload(IntPtr data, IntPtr rm, ref double maxValue)
{
Measure measure = (Measure)GCHandle.FromIntPtr(data).Target;
measure.Reload(new Rainmeter.API(rm), ref maxValue);
}
[DllExport]
public static double Update(IntPtr data)
{
Measure measure = (Measure)GCHandle.FromIntPtr(data).Target;
return measure.Update();
}
[DllExport]
public static IntPtr GetString(IntPtr data)
{
Measure measure = (Measure)GCHandle.FromIntPtr(data).Target;
if (StringBuffer != IntPtr.Zero)
{
Marshal.FreeHGlobal(StringBuffer);
StringBuffer = IntPtr.Zero;
}
string stringValue = measure.GetString();
if (stringValue != null)
{
StringBuffer = Marshal.StringToHGlobalUni(stringValue);
}
return StringBuffer;
}
[DllExport]
public static void ExecuteBang(IntPtr data, IntPtr args)
{
Measure measure = (Measure)GCHandle.FromIntPtr(data).Target;
measure.ExecuteBang(Marshal.PtrToStringUni(args));
}
}
#endregion
}

File diff suppressed because it is too large Load Diff

View File

@ -1,101 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{2CFEC79A-E39E-4FFD-ABC2-C4A69DD1E44D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Rainmeter</RootNamespace>
<AssemblyName>InputText</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>1607</NoWarn>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>1607</NoWarn>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineConstants>TRACE;DEBUG;X64</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<NoWarn>1607</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DefineConstants>TRACE;X64</DefineConstants>
<Optimize>true</Optimize>
<DebugType>none</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<NoWarn>1607</NoWarn>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Main.cs" />
<Compile Include="PluginCode.cs" />
<Compile Include="Rainmeter.cs" />
<Compile Include="InputBox.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="InputBox.designer.cs">
<DependentUpon>InputBox.cs</DependentUpon>
</Compile>
<Compile Include="$(SolutionDir)Version.cs" />
<Compile Include="$(SolutionDir)Plugins\API\RainmeterAPI.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="InputBox.resx">
<DependentUpon>InputBox.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(SolutionDir)Build\VS\RainmeterPlugin.Cs.props" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>"$(RmOutDirRoot)Tools\DllExporter.exe" "$(ConfigurationName)" "$(PlatformName)" "$(TargetDir)\" "$(TargetFileName)"</PostBuildEvent>
</PropertyGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{2CFEC79A-E39E-4FFD-ABC2-C4A69DD1E44D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Rainmeter</RootNamespace>
<AssemblyName>InputText</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>1607</NoWarn>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>1607</NoWarn>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineConstants>TRACE;DEBUG;X64</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<NoWarn>1607</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DefineConstants>TRACE;X64</DefineConstants>
<Optimize>true</Optimize>
<DebugType>none</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<NoWarn>1607</NoWarn>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Main.cs" />
<Compile Include="PluginCode.cs" />
<Compile Include="Rainmeter.cs" />
<Compile Include="InputBox.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="InputBox.designer.cs">
<DependentUpon>InputBox.cs</DependentUpon>
</Compile>
<Compile Include="$(SolutionDir)Version.cs" />
<Compile Include="$(SolutionDir)Plugins\API\RainmeterAPI.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="InputBox.resx">
<DependentUpon>InputBox.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(SolutionDir)Build\VS\RainmeterPlugin.Cs.props" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>"$(RmOutDirRoot)Tools\DllExporter.exe" "$(ConfigurationName)" "$(PlatformName)" "$(TargetDir)\" "$(TargetFileName)"</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -1,133 +1,133 @@
/*
Copyright (C) 2013 Rainmeter Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using System.Runtime.InteropServices;
using Rainmeter;
// This is a utility class / toolkit for communicating with Rainmeter and managing
// window positioning.
//
// You should not need to edit this code except to expand the toolkit support.
//
// Rather, most of your plugin's code should go in PluginCode.cs or additional files
// that you create (such as new forms, classes, and controls).
namespace InputText
{
public class SkinWindow : System.Windows.Forms.IWin32Window
{
private string _SkinName;
private IntPtr _Handle;
private int _X = 0;
private int _Y = 0;
private int _W = 0;
private int _H = 0;
private bool _IsTopmost = false;
public SkinWindow(Rainmeter.API rm)
{
UpdateStatus(rm);
}
#region Methods for getting the screen-relative location of the current skin
public IntPtr Handle
{
get { return this._Handle; }
}
public int X
{
get { return this._X; }
}
public int Y
{
get { return this._Y; }
}
public int Width
{
get { return this._W; }
}
public int Height
{
get { return this._H; }
}
public bool IsTopmost
{
get { return this._IsTopmost; }
}
public void UpdateStatus(Rainmeter.API rm = null)
{
if (rm != null)
{
this._SkinName = rm.GetSkinName();
this._Handle = rm.GetSkinWindow();
}
RECT rct;
if (GetWindowRect(this._Handle, out rct))
{
this._X = rct.Left;
this._Y = rct.Top;
this._W = rct.Right - rct.Left;
this._H = rct.Bottom - rct.Top;
}
else
{
API.Log(API.LogType.Error,
"Rainmeter told us the HWND for window '" + this._SkinName + "' is " + this._Handle.ToInt32().ToString() + "L, but couldn't receive a proper RECT from it");
}
this._IsTopmost = ((GetWindowLong(this._Handle, GWL_EXSTYLE) & WS_EX_TOPMOST) > 0);
}
#region GetWindowRect() platform invoke to get the size/location of a window
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left; // x position of upper-left corner
public int Top; // y position of upper-left corner
public int Right; // x position of lower-right corner
public int Bottom; // y position of lower-right corner
}
#endregion
#region GetWindowLong() -- platform invoke to check a window's Z-order (Topmost=Auto)
[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hwnd, int nIndex);
private const int GWL_EXSTYLE = -20;
private const int WS_EX_TOPMOST = 8;
#endregion
#endregion
}
}
/*
Copyright (C) 2013 Rainmeter Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using System.Runtime.InteropServices;
using Rainmeter;
// This is a utility class / toolkit for communicating with Rainmeter and managing
// window positioning.
//
// You should not need to edit this code except to expand the toolkit support.
//
// Rather, most of your plugin's code should go in PluginCode.cs or additional files
// that you create (such as new forms, classes, and controls).
namespace InputText
{
public class SkinWindow : System.Windows.Forms.IWin32Window
{
private string _SkinName;
private IntPtr _Handle;
private int _X = 0;
private int _Y = 0;
private int _W = 0;
private int _H = 0;
private bool _IsTopmost = false;
public SkinWindow(Rainmeter.API rm)
{
UpdateStatus(rm);
}
#region Methods for getting the screen-relative location of the current skin
public IntPtr Handle
{
get { return this._Handle; }
}
public int X
{
get { return this._X; }
}
public int Y
{
get { return this._Y; }
}
public int Width
{
get { return this._W; }
}
public int Height
{
get { return this._H; }
}
public bool IsTopmost
{
get { return this._IsTopmost; }
}
public void UpdateStatus(Rainmeter.API rm = null)
{
if (rm != null)
{
this._SkinName = rm.GetSkinName();
this._Handle = rm.GetSkinWindow();
}
RECT rct;
if (GetWindowRect(this._Handle, out rct))
{
this._X = rct.Left;
this._Y = rct.Top;
this._W = rct.Right - rct.Left;
this._H = rct.Bottom - rct.Top;
}
else
{
API.Log(API.LogType.Error,
"Rainmeter told us the HWND for window '" + this._SkinName + "' is " + this._Handle.ToInt32().ToString() + "L, but couldn't receive a proper RECT from it");
}
this._IsTopmost = ((GetWindowLong(this._Handle, GWL_EXSTYLE) & WS_EX_TOPMOST) > 0);
}
#region GetWindowRect() platform invoke to get the size/location of a window
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left; // x position of upper-left corner
public int Top; // y position of upper-left corner
public int Right; // x position of lower-right corner
public int Bottom; // y position of lower-right corner
}
#endregion
#region GetWindowLong() -- platform invoke to check a window's Z-order (Topmost=Auto)
[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hwnd, int nIndex);
private const int GWL_EXSTYLE = -20;
private const int WS_EX_TOPMOST = 8;
#endregion
#endregion
}
}