From: <nic...@us...> - 2014-01-10 16:19:50
|
Revision: 4720 http://sourceforge.net/p/mp-plugins/code/4720 Author: nicsergio Date: 2014-01-10 16:19:47 +0000 (Fri, 10 Jan 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/Resources/XmlFiles/DefaultConfig.xml trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.cs trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/Resources/XmlFiles/DefaultConfig.xml =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/Resources/XmlFiles/DefaultConfig.xml 2014-01-09 22:31:12 UTC (rev 4719) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/Resources/XmlFiles/DefaultConfig.xml 2014-01-10 16:19:47 UTC (rev 4720) @@ -13,6 +13,7 @@ <Shift>1</Shift> <Hyperlink>35</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>back.wav</SoundEffect> </Item> <Item> @@ -23,6 +24,7 @@ <Shift>1</Shift> <Hyperlink>0</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>back.wav</SoundEffect> </Item> <Item> @@ -33,6 +35,7 @@ <Shift>1</Shift> <Hyperlink>1</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -43,6 +46,7 @@ <Shift>1</Shift> <Hyperlink>602</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -53,6 +57,7 @@ <Shift>1</Shift> <Hyperlink>600</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -63,6 +68,7 @@ <Shift>1</Shift> <Hyperlink>7700</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -73,6 +79,7 @@ <Shift>1</Shift> <Hyperlink>7701</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -83,6 +90,7 @@ <Shift>1</Shift> <Hyperlink>6</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -93,6 +101,7 @@ <Shift>1</Shift> <Hyperlink>2005</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -103,6 +112,7 @@ <Shift>1</Shift> <Hyperlink>30</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -113,6 +123,7 @@ <Shift>1</Shift> <Hyperlink>501</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -123,6 +134,7 @@ <Shift>1</Shift> <Hyperlink>2</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -133,6 +145,7 @@ <Shift>1</Shift> <Hyperlink>7977</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -143,6 +156,7 @@ <Shift>1</Shift> <Hyperlink>9811</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -153,6 +167,7 @@ <Shift>1</Shift> <Hyperlink>96742</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> <Item> @@ -163,6 +178,7 @@ <Shift>1</Shift> <Hyperlink>3001</Hyperlink> <HyperlinkParameter /> + <Return>0</Return> <SoundEffect>click.wav</SoundEffect> </Item> </Items> Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.cs 2014-01-09 22:31:12 UTC (rev 4719) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuter.cs 2014-01-10 16:19:47 UTC (rev 4720) @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Linq; using System.Windows.Forms; using MediaPortal.Configuration; using MediaPortal.GUI.Library; @@ -14,6 +16,8 @@ private ShortCuts myShortCuts; //Istanza classe ShortCuts (dati relativi ai shortcuts configurati) private static readonly string LogPrefix; //Prefisso per log eventi private const int TrailersPluginControlID = 11899; //ID controllo per attivazione plugin Trailers + private int lastWindowID; //Id finestra per visualizzazione in MediaPortal + private string lastLoadParameter; //Eventuali parametri di caricamento per visualizzazione (sotto-categorie, ecc.) #endregion #region Costruttore @@ -113,6 +117,13 @@ MpLog(true, "Error going to screen", e); } } + private void GoToPrevious() //Esecuzione azione relativa allo shortcut + { + } + private bool AlreadyAtDestination(ShortCut sc) + { + return false; + } #endregion #region Metodi Pubblici @@ -139,15 +150,38 @@ { if (!ShortCut.ModifierKeys.Contains(e.KeyCode)) //Verifica se il tasto premuto non corrisponde ad un modificatore { - foreach (ShortCut sc in myShortCuts.Items) //Ricerca se la combinazione di tasti corrisponde ad uno shortcut + + /* + -ricerca sc, se nessuno: log + -se almeno 1, verifica ID finestra + - se <> da dest: gotoscreen + - se = a destinazione, verifica se ci sono altri sc + - se nessun sc, se return = false->gotoscreen altrimenti gotoback + - se altri sc --> gotoscreen(next) + */ + List<ShortCut> scList = myShortCuts.Items.ToList().FindAll(x => x.Key == e.KeyCode.ToString() + && x.Ctrl == e.Control + && x.Alt == e.Alt + && x.Shift == e.Shift); + if (scList != null && scList.Count > 0) //Se la combinazione di tasti corrisponde ad almeno uno shortcut { - if (sc.Key == e.KeyCode.ToString() && sc.Ctrl == e.Control && sc.Alt == e.Alt && sc.Shift == e.Shift) + if (scList.Count == 1) { - GoToScreen(sc); //--> esecuzione dell'azione relativa allo shortcut - return; + if (scList[0].Return && AlreadyAtDestination(scList[0])) + GoToPrevious(); + else + GoToScreen(scList[0]); } + else + { + foreach (ShortCut sc in scList) + { + + } + } } - MpLog(false, "Key not mapped: Key=" + (e.Control ? "<CTRL>" : "") + (e.Alt ? "<ALT>" : "") + (e.Shift ? "<SHIFT>" : "") + "<" + e.KeyCode.ToString() + ">"); + else + MpLog(false, "Key not mapped: Key=" + (e.Control ? "<CTRL>" : "") + (e.Alt ? "<ALT>" : "") + (e.Shift ? "<SHIFT>" : "") + "<" + e.KeyCode.ToString() + ">"); } } #endregion Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-01-09 22:31:12 UTC (rev 4719) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-01-10 16:19:47 UTC (rev 4720) @@ -16,11 +16,12 @@ #region Dati private string _caption; //Titolo private string _key; //Tasto (stringa corrispondente a KeyCode) - private bool _ctrl; //Utilizzo del modificatore "Ctrl" - combinazione di tasti - private bool _alt; //Utilizzo del modificatore "Alt" - combinazione di tasti + private bool _ctrl; //Utilizzo del modificatore "Ctrl" - combinazione di tasti + private bool _alt; //Utilizzo del modificatore "Alt" - combinazione di tasti private bool _shift; //Utilizzo del modificatore "Shift" - combinazione di tasti private int _windowID; //Id finestra per visualizzazione in MediaPortal private string _loadParameter; //Eventuali parametri di caricamento per visualizzazione (sotto-categorie, ecc.) + private bool _return; //Ritorno a finestra precedente se si è già a destinazione private string _soundEffect; //File relativo all'eventuale effetto sonoro public static readonly List<Keys> ModifierKeys = new List<Keys>(); //Lista dei tasti modificatori @@ -48,6 +49,7 @@ _shift = true; //--> inizializzazione utilizzo del modificatore "Shift" _windowID = 0; //--> inizializzazione window ID _loadParameter = ""; //--> inizializzazione parametri di caricamento per visualizzazione + _return = false; //--> inizializzazione ritorno a finestra precedente se si è già a destinazione _soundEffect = "click.wav"; //--> inizializzazione effetto sonoro } #endregion @@ -103,6 +105,7 @@ public bool Shift { get { return this._shift; } set { this._shift = value; this.NotifyPropertyChanged("Shift"); } } public int WindowID { get { return this._windowID; } set { this._windowID = value; this.NotifyPropertyChanged("WindowID"); } } public string LoadParameter { get { return this._loadParameter; } set { this._loadParameter = value; this.NotifyPropertyChanged("LoadParameter"); } } + public bool Return { get { return this._return; } set { this._return = value; this.NotifyPropertyChanged("Return"); } } public string SoundEffect { get { return this._soundEffect; } set { this._soundEffect = value; this.NotifyPropertyChanged("SoundEffect"); } } #endregion } @@ -273,6 +276,9 @@ if (innerNode != null) sc.LoadParameter = innerNode.InnerText; } + innerNode = node.SelectSingleNode("Return"); + if (innerNode != null) + sc.Return = Convert.ToBoolean(Convert.ToInt16(innerNode.InnerText)); innerNode = node.SelectSingleNode("SoundEffect"); if (innerNode != null) sc.SoundEffect = innerNode.InnerText; @@ -331,6 +337,7 @@ xmlSettings.WriteElementString("Shift", Convert.ToInt16(sc.Shift).ToString()); xmlSettings.WriteElementString("WindowID", sc.WindowID.ToString()); xmlSettings.WriteElementString("LoadParameter", sc.LoadParameter); + xmlSettings.WriteElementString("Return", Convert.ToInt16(sc.Return).ToString()); xmlSettings.WriteElementString("SoundEffect", sc.SoundEffect); xmlSettings.WriteEndElement(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |