From: <nic...@us...> - 2013-12-05 20:23:56
|
Revision: 4698 http://sourceforge.net/p/mp-plugins/code/4698 Author: nicsergio Date: 2013-12-05 20:23:53 +0000 (Thu, 05 Dec 2013) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/Common/Skin.cs trunk/plugins/ShortCuter&SkinEditor/Source/Common/Tools.cs trunk/plugins/ShortCuter&SkinEditor/Source/Common/VersionInfo.cs trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.csproj trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.Designer.cs trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.cs trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Added Paths: ----------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/LockKeys.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/Common/Skin.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/Common/Skin.cs 2013-12-05 15:27:44 UTC (rev 4697) +++ trunk/plugins/ShortCuter&SkinEditor/Source/Common/Skin.cs 2013-12-05 20:23:53 UTC (rev 4698) @@ -2,12 +2,11 @@ using System.Collections.Generic; using System.Drawing; using System.IO; +using System.Linq; using System.Reflection; using System.Windows.Forms; using System.Xml; -using System.Linq; - namespace My.Common { internal class MediaPortalSkin //Classe per gestione elementare skin di MediaPortal Modified: trunk/plugins/ShortCuter&SkinEditor/Source/Common/Tools.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/Common/Tools.cs 2013-12-05 15:27:44 UTC (rev 4697) +++ trunk/plugins/ShortCuter&SkinEditor/Source/Common/Tools.cs 2013-12-05 20:23:53 UTC (rev 4698) @@ -4,7 +4,6 @@ using System.Reflection; using System.Windows.Forms; - namespace My.Common { internal static class Tools //Collezione utilità @@ -109,7 +108,7 @@ gp.AddArc(r.X, r.Y + r.Height - hRadius, wRadius, hRadius, 90, 90); winControl.Region = new Region(gp); } + #endregion #endregion - #endregion } } Modified: trunk/plugins/ShortCuter&SkinEditor/Source/Common/VersionInfo.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/Common/VersionInfo.cs 2013-12-05 15:27:44 UTC (rev 4697) +++ trunk/plugins/ShortCuter&SkinEditor/Source/Common/VersionInfo.cs 2013-12-05 20:23:53 UTC (rev 4698) @@ -66,9 +66,8 @@ { Graphics mGraphics = e.Graphics; Rectangle mArea = new Rectangle(0, 0, this.Width, this.Height); - LinearGradientBrush mLGB = new LinearGradientBrush(mArea, Color.FromArgb(96, 155, 173), Color.FromArgb(177, 192, 192), LinearGradientMode.ForwardDiagonal); - mGraphics.FillRectangle(mLGB, mArea);//Color.FromArgb(245, 251, 251) - + LinearGradientBrush mLGB = new LinearGradientBrush(mArea, Color.FromArgb(96, 155, 173), Color.PaleTurquoise, LinearGradientMode.ForwardDiagonal); + mGraphics.FillRectangle(mLGB, mArea); Rectangle r = new Rectangle(-1, -1, this.Width + 1, 36); mLGB = new LinearGradientBrush(r, Color.Navy, Color.MediumTurquoise, LinearGradientMode.ForwardDiagonal); Added: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/LockKeys.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/LockKeys.cs (rev 0) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/LockKeys.cs 2013-12-05 20:23:53 UTC (rev 4698) @@ -0,0 +1,161 @@ +using System; +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Reflection; +using System.Windows.Forms; +using System.Collections.Generic; + + +namespace ProcessPlugins.ShortCuter +{ + internal static class LockKeys //Classe per gestione attivazione/disattivazione blocco maiuscole/numeri + { + #region Dati + //bool numLockReq = false, capsLockReq = false; //--> inizializzazione parametri (richiesta di impostazione OFF) + + + + public enum ForcingType + { + [Description("Force OFF")] + Off = 0, + [Description("Force ON")] + On = 1, + [Description("Not change")] + None = 2 + } + + #region Costanti + const int KEYEVENTF_EXTENDEDKEY = 0x1; //Da impostare come flag per far precedere il codice per la scansione HW dal byte 0xE0 (tasti estesi) + const int KEYEVENTF_KEYUP = 0x2; //Da impostare come flag per ottenere l'azione di rilascio del tasto + const int VK_NUMLOCK = 0x90; //Codice VirtualKey di NumLock + const int HK_NUMLOCK = 0x45; //Codice HardwareKey di NumLock (per scansione HW -> bScan) + const int VK_CAPITAL = 0x14; //Codice VirtualKey di CapsLock + const int SC_CAPITAL = 0x3A; //Codice HardwareKey di CapsLock (per scansione HW -> bScan) + #endregion + #endregion + + public static List<string> GetForcingTypes() + { + List<string> descriptions = new List<string>(); + foreach (LockKeys.ForcingType enumValue in Enum.GetValues(typeof(LockKeys.ForcingType))) + { + descriptions.Add(enumValue.GetDescription()); + } + return descriptions; + } + /* public static string GetDescription(this Enum currentEnum) + { + string description = String.Empty; + DescriptionAttribute da; + + FieldInfo fi = currentEnum.GetType(). + GetField(currentEnum.ToString()); + da = (DescriptionAttribute)Attribute.GetCustomAttribute(fi, + typeof(DescriptionAttribute)); + if (da != null) + description = da.Description; + else + description = currentEnum.ToString(); + + return description; + } + + public static string[] GetDescription(this Enum Enumeration) + { + string Value = Enumeration.ToString(); + Type EnumType = Enumeration.GetType(); + var DescAttribute = (DescriptionAttribute[])EnumType + .GetField(Value) + .GetCustomAttributes(typeof(DescriptionAttribute), false); + return DescAttribute.Length > 0 ? DescAttribute[0].Description : Value; + }*/ + public static string GetDescription(this Enum value) + { + Type type = value.GetType(); + string name = Enum.GetName(type, value); + if (name != null) + { + FieldInfo field = type.GetField(name); + if (field != null) + { + DescriptionAttribute attr = + Attribute.GetCustomAttribute(field, + typeof(DescriptionAttribute)) as DescriptionAttribute; + if (attr != null) + { + return attr.Description; + } + } + } + return null; + } + /*public static string[] GetDescriptions(this enum value) + { + Type type = value.GetType(); + string name = Enum.GetName(type, value); + if (name != null) + { + FieldInfo field = type.GetField(name); + if (field != null) + { + DescriptionAttribute attr = + Attribute.GetCustomAttribute(field, + typeof(DescriptionAttribute)) as DescriptionAttribute; + if (attr != null) + { + return attr.Description; + } + } + } + return null; + }*/ + /*static void Main(string[] args) //Chiamata applicazione con parametri: LockKeys X Y (X->NumLock Y->Capslock) + { + #region Verifica parametri + if (args.Count() > 0) //Verifica se parametro passato da riga di comando + if (args[0] == "1") + numLockReq = true; //--> richiesta di attivare NumLock + else if (args[0] == "0") + numLockReq = false; //--> richiesta di disattivare NumLock + else + numLockReq = Console.NumberLock; //--> altrimenti lo stato rimane invariato + + if (args.Count() > 1) //Verifica se parametro passato da riga di comando + if (args[1] == "1") + capsLockReq = true; //--> richiesta di attivare CapsLock + else if (args[1] == "0") + capsLockReq = false; //--> richiesta di disattivare CapsLock + else + capsLockReq = Console.CapsLock; //--> altrimenti lo stato rimane invariato + #endregion + + #region Azioni + if (numLockReq != Console.NumberLock) //Se richiesta diversa da stato attuale + { + //Simulazione pressione del tasto NumLock + keybd_event(VK_NUMLOCK, HK_NUMLOCK, KEYEVENTF_EXTENDEDKEY, (UIntPtr)0); + //Simulazione rilascio del tasto NumLock + keybd_event(VK_NUMLOCK, HK_NUMLOCK, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (UIntPtr)0); + } + if (capsLockReq != Console.CapsLock) //Se richiesta diversa da stato attuale + { + //Simulazione pressione del tasto CapsLock + keybd_event(VK_CAPITAL, SC_CAPITAL, 0, (UIntPtr)0); + //Simulazione rilascio del tasto CapsLock + keybd_event(VK_CAPITAL, SC_CAPITAL, KEYEVENTF_KEYUP, (UIntPtr)0); + } + #endregion + } + */ + + + #region Importazione DLL + //Simulazione eventi di tastiera + [DllImport("user32.dll")] + static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo); + #endregion + } +} Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.csproj =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.csproj 2013-12-05 15:27:44 UTC (rev 4697) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.csproj 2013-12-05 20:23:53 UTC (rev 4698) @@ -93,6 +93,7 @@ </Compile> <Compile Include="KeyboardHookWorker.cs" /> <Compile Include="KeyboardHook.cs" /> + <Compile Include="LockKeys.cs" /> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\Resources.Designer.cs"> Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.Designer.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.Designer.cs 2013-12-05 15:27:44 UTC (rev 4697) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.Designer.cs 2013-12-05 20:23:53 UTC (rev 4698) @@ -55,10 +55,10 @@ this.propLeftPictureBox = new System.Windows.Forms.PictureBox(); this.saveButton = new System.Windows.Forms.Button(); this.overridesGroupBox = new System.Windows.Forms.GroupBox(); - this.capsLockComboBox = new System.Windows.Forms.ComboBox(); - this.capsLockLabel = new System.Windows.Forms.Label(); this.numLockComboBox = new System.Windows.Forms.Label(); this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.capsLockLabel = new System.Windows.Forms.Label(); + this.capsLockComboBox = new System.Windows.Forms.ComboBox(); ((System.ComponentModel.ISupportInitialize)(this.shortCutsDataGridView)).BeginInit(); this.itemsTabControl.SuspendLayout(); this.linksTabPage.SuspendLayout(); @@ -362,30 +362,10 @@ this.overridesGroupBox.TabStop = false; this.overridesGroupBox.Text = "Overrides at Start-Up"; // - // capsLockComboBox - // - this.capsLockComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.capsLockComboBox.FormattingEnabled = true; - this.capsLockComboBox.Location = new System.Drawing.Point(4, 40); - this.capsLockComboBox.Name = "capsLockComboBox"; - this.capsLockComboBox.Size = new System.Drawing.Size(140, 21); - this.capsLockComboBox.TabIndex = 0; - // - // capsLockLabel - // - this.capsLockLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.capsLockLabel.ForeColor = System.Drawing.Color.Blue; - this.capsLockLabel.Location = new System.Drawing.Point(4, 24); - this.capsLockLabel.Name = "capsLockLabel"; - this.capsLockLabel.Size = new System.Drawing.Size(140, 13); - this.capsLockLabel.TabIndex = 3; - this.capsLockLabel.Text = "Caps Lock"; - this.capsLockLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // // numLockComboBox // this.numLockComboBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.numLockComboBox.ForeColor = System.Drawing.Color.Blue; + this.numLockComboBox.ForeColor = System.Drawing.SystemColors.ControlText; this.numLockComboBox.Location = new System.Drawing.Point(174, 24); this.numLockComboBox.Name = "numLockComboBox"; this.numLockComboBox.Size = new System.Drawing.Size(140, 13); @@ -396,12 +376,34 @@ // comboBox2 // this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.comboBox2.FormattingEnabled = true; this.comboBox2.Location = new System.Drawing.Point(173, 40); this.comboBox2.Name = "comboBox2"; this.comboBox2.Size = new System.Drawing.Size(140, 21); this.comboBox2.TabIndex = 4; // + // capsLockLabel + // + this.capsLockLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.capsLockLabel.ForeColor = System.Drawing.SystemColors.ControlText; + this.capsLockLabel.Location = new System.Drawing.Point(4, 24); + this.capsLockLabel.Name = "capsLockLabel"; + this.capsLockLabel.Size = new System.Drawing.Size(140, 13); + this.capsLockLabel.TabIndex = 3; + this.capsLockLabel.Text = "Caps Lock"; + this.capsLockLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // capsLockComboBox + // + this.capsLockComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.capsLockComboBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.capsLockComboBox.FormattingEnabled = true; + this.capsLockComboBox.Location = new System.Drawing.Point(4, 40); + this.capsLockComboBox.Name = "capsLockComboBox"; + this.capsLockComboBox.Size = new System.Drawing.Size(140, 21); + this.capsLockComboBox.TabIndex = 0; + // // ShortCuterForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.cs 2013-12-05 15:27:44 UTC (rev 4697) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuterForm.cs 2013-12-05 20:23:53 UTC (rev 4698) @@ -35,6 +35,7 @@ mySkin.FillTreeViewSkinLinks(skinLinksTreeView); skinLinksTreeView.CollapseAll(); FormatShortCutsGrid(); + capsLockComboBox.DataSource = LockKeys.GetForcingTypes(); toolTip.SetToolTip(skinFilesListBox, "Double click to set the link's parameter to shortcut"); toolTip.SetToolTip(skinLinksTreeView, "Double click to set the link's parameter to shortcut"); toolTip.SetToolTip(rowAddButton, "Add shortcut to list"); Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2013-12-05 15:27:44 UTC (rev 4697) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2013-12-05 20:23:53 UTC (rev 4698) @@ -1,11 +1,11 @@ using System; +using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Reflection; -using System.Collections.Generic; using System.Text; +using System.Windows.Forms; using System.Xml; -using System.Windows.Forms; using MediaPortal.Profile; using My.Common; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |