From: <nic...@us...> - 2014-03-27 16:17:29
|
Revision: 4776 http://sourceforge.net/p/mp-plugins/code/4776 Author: nicsergio Date: 2014-03-27 16:17:25 +0000 (Thu, 27 Mar 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-03-23 17:55:25 UTC (rev 4775) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-03-27 16:17:25 UTC (rev 4776) @@ -11,8 +11,47 @@ namespace ProcessPlugins.ShortCuter { - public class ShortCut : INotifyPropertyChanged //Classe shortcut (scorciatoia da tastiera) con notifica variazione proprietà + private struct Destination { + public int _windowID; //Id finestra per visualizzazione in MediaPortal + public string _loadParameter; //Eventuali parametri di caricamento per visualizzazione (sotto-categorie, ecc.) + public override string ToString() + { + return "WindowID=" + _windowID.ToString() + ((_loadParameter.Length > 0) ? " LoadParameter=[" + _loadParameter + "]" : ""); + } + } + + private struct KeyCombination + { + public string _key; //Tasto (stringa corrispondente a KeyCode) + public bool _ctrl; //Utilizzo del modificatore "Ctrl" - combinazione di tasti + public bool _alt; //Utilizzo del modificatore "Alt" - combinazione di tasti + public bool _shift; //Utilizzo del modificatore "Shift" - combinazione di tasti + public override string ToString() + { + return "Key=" + ((_ctrl) ? "<CTRL>" : "") + + ((_alt) ? "<ALT>" : "") + + ((_shift) ? "<SHIFT>" : "") + + "<" + _key + ">"; + } + } + + internal class SimpleShortCut + { + protected string _caption; //Titolo + protected Destination _destination; + + public override string ToString() + { + return "ShortCut " + _caption + " --> " + _destination.ToString(); + } + + } + + + + public class ShortCut : INotifyPropertyChanged //Classe shortcut (scorciatoia da tastiera) con notifica variazione proprietà + { #region Dati private string _caption; //Titolo private string _key; //Tasto (stringa corrispondente a KeyCode) @@ -23,7 +62,7 @@ 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 - + private Destination _destination; public static readonly List<Keys> ModifierKeys = new List<Keys>(); //Lista dei tasti modificatori #endregion @@ -117,12 +156,15 @@ public bool Ctrl { get { return this._ctrl; } set { this._ctrl = value; this.NotifyPropertyChanged("Ctrl"); } } public bool Alt { get { return this._alt; } set { this._alt = value; this.NotifyPropertyChanged("Alt"); } } 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 int WindowID { get { return this._destination._windowID; } set { this._destination._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 } + + + internal class ShortCuts //Classe di gestione degli shortcuts configurati { #region Dati This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-04-28 17:43:52
|
Revision: 4790 http://sourceforge.net/p/mp-plugins/code/4790 Author: nicsergio Date: 2014-04-28 17:43:49 +0000 (Mon, 28 Apr 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-04-27 19:40:27 UTC (rev 4789) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-04-28 17:43:49 UTC (rev 4790) @@ -20,7 +20,7 @@ private string _loadParameter; //Eventuali parametri di caricamento per visualizzazione (sotto-categorie, ecc.) private const int TrailersPluginControlID = 11899; //Id controllo per attivazione plugin Trailers - internal delegate void LoadParamChgEventHandler(string loadParam); //Delegato per evento di modifica parametri di caricamento + internal delegate string NotifyLoadParamChanged(); //Delegato per evento di modifica parametri di caricamento #endregion #region Costruttore @@ -33,7 +33,8 @@ #endregion #region Metodi Pubblici - public void Go() //Visualizzazione finestra del collegamento + + public void Go(NotifyLoadParamChanged eee) //Visualizzazione finestra del collegamento { if (_loadParameter.Length > 0) //Se richiesti parametri di caricamento { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-04-30 20:28:41
|
Revision: 4791 http://sourceforge.net/p/mp-plugins/code/4791 Author: nicsergio Date: 2014-04-30 20:28:38 +0000 (Wed, 30 Apr 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-04-28 17:43:49 UTC (rev 4790) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-04-30 20:28:38 UTC (rev 4791) @@ -12,7 +12,7 @@ namespace ProcessPlugins.ShortCuter { - internal class ScreenLink //Classe collegamento ad una finestra di MediaPortal + internal class WindowLink //Classe collegamento ad una finestra di MediaPortal { #region Dati private string _caption; //Titolo link @@ -20,11 +20,11 @@ private string _loadParameter; //Eventuali parametri di caricamento per visualizzazione (sotto-categorie, ecc.) private const int TrailersPluginControlID = 11899; //Id controllo per attivazione plugin Trailers - internal delegate string NotifyLoadParamChanged(); //Delegato per evento di modifica parametri di caricamento + internal delegate void NotifyLoadParamChanged(string loadParam); //Delegato per notifica di modifica parametri di caricamento #endregion #region Costruttore - public ScreenLink() //Costruttore classe ScreenLink + public WindowLink() //Costruttore classe WindowLink { _caption = "Link"; //--> inizializzazione titolo _windowID = 0; //--> inizializzazione window ID @@ -33,9 +33,12 @@ #endregion #region Metodi Pubblici - - public void Go(NotifyLoadParamChanged eee) //Visualizzazione finestra del collegamento + public void Go() //Visualizzazione finestra del collegamento (senza delegato per notifica di modifica parametri di caricamento) { + Go(null); + } + public void Go(NotifyLoadParamChanged LoadParamChanged) //Visualizzazione finestra del collegamento + { if (_loadParameter.Length > 0) //Se richiesti parametri di caricamento { bool loadParameterChange = false; @@ -59,8 +62,8 @@ else break; } - if (loadParameterChange && (LoadParamChg != null)) - LoadParamChg(loadParameter); //--> richiamo dell'evento di modifica parametri di caricamento + if (loadParameterChange && LoadParamChanged != null) + LoadParamChanged(loadParameter); //--> notifica di modifica parametri di caricamento GUIWindowManager.ActivateWindow(_windowID, loadParameter, true); //--> richiamo schermata con parametri di caricamento } @@ -81,10 +84,6 @@ } #endregion - #region Eventi - public event LoadParamChgEventHandler LoadParamChg; //Evento di modifica parametri di caricamento - #endregion - #region Proprietà public bool IsValid { @@ -167,7 +166,7 @@ #region Dati private string _caption; //Titolo link private KeyCombination _keys; //Combinazione di tasti per attivazione shortcut - private ScreenLink _destination; //Destinazione dello shortcut + private WindowLink _destination; //Destinazione dello shortcut private bool _return; //Ritorno a finestra precedente se si è già a destinazione private string _soundEffect; //File relativo all'eventuale effetto sonoro #endregion @@ -177,7 +176,7 @@ { _caption = "ShortCut"; //--> inizializzazione titolo _keys = new KeyCombination(); //--> istanziazione classe KeyCombination - _destination = new ScreenLink(); //--> istanziazione classe Screenlink + _destination = new WindowLink(); //--> istanziazione classe WindowLink _destination.Caption = ""; //--> reset caption destinazione (gestita caption shortcut) _return = false; //--> inizializzazione ritorno a finestra precedente se si è già a destinazione _soundEffect = "click.wav"; //--> inizializzazione effetto sonoro @@ -196,15 +195,15 @@ public ShortCut Clone() //Clonazione shortcut { ShortCut sc = new ShortCut(); - sc.Caption = _caption; - sc.Key = _keys.Key; - sc.Ctrl = _keys.Ctrl; - sc.Alt = _keys.Alt; - sc.Shift = _keys.Shift; - sc.WindowID = _destination.WindowID; + sc.Caption = _caption; + sc.Key = _keys.Key; + sc.Ctrl = _keys.Ctrl; + sc.Alt = _keys.Alt; + sc.Shift = _keys.Shift; + sc.WindowID = _destination.WindowID; sc.LoadParameter = _destination.LoadParameter; - sc.Return = _return; - sc.SoundEffect = _soundEffect; + sc.Return = _return; + sc.SoundEffect = _soundEffect; return sc; } public override string ToString() //Override metodo ToString per stampare le proprietà dello shortcut @@ -247,6 +246,8 @@ private GeneralSettings _general = new GeneralSettings(); //Impostazioni generali plugin private BindingList<ShortCut> _items = new BindingList<ShortCut>(); //Lista (con associazione dati) degli shortcuts configurati private bool _initialized; //Classe inizializzata + + //internal delegate void (string loadParam); //Delegato per notifica di modifica parametri di caricamento #endregion #region Costruttore This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-05-04 20:12:58
|
Revision: 4796 http://sourceforge.net/p/mp-plugins/code/4796 Author: nicsergio Date: 2014-05-04 20:12:54 +0000 (Sun, 04 May 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-04 16:34:28 UTC (rev 4795) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-04 20:12:54 UTC (rev 4796) @@ -69,12 +69,12 @@ if (skinNavigator) //Se richiesta destinazione corrispondente a Skin Navigator { _caption = "Skin Navigator"; //--> titolo Skin Navigator - _windowID = NavigatorID; //--> window ID virtuale per attivazione Skin Navigator + _windowID = NavigatorID; //--> Id finestra virtuale per attivazione Skin Navigator } else { _caption = "Link"; //--> inizializzazione titolo - _windowID = 0; //--> inizializzazione window ID + _windowID = 0; //--> inizializzazione Id finestra } _loadParameter = ""; //--> inizializzazione parametri di caricamento per visualizzazione } @@ -159,7 +159,7 @@ } public void Reset() //Reset destinazione (invalidazione) { - _windowID = InvalidID; //--> invalidazione window ID + _windowID = InvalidID; //--> invalidazione Id finestra _loadParameter = ""; //--> reset parametri di caricamento } public override string ToString() //Override metodo ToString per stampare le proprietà del link @@ -345,6 +345,51 @@ public string SoundEffect { get { return this._soundEffect; } set { this._soundEffect = value; this.NotifyPropertyChanged("SoundEffect"); } } #endregion } + internal class Window //Classe finestra di MediaPortal + { + #region Dati + private string _caption; //Titolo finestra + private int _windowID; //Id finestra + private string _xmlFile; //Nome del file xml corrispondente + #endregion + + #region Costruttore + public Window() //Costruttore classe Window + { + _caption = ""; //--> inizializzazione titolo + _windowID = 0; //--> inizializzazione Id finestra + _xmlFile = ""; //--> inizializzazione nome file xml + } + #endregion + + #region Metodi Pubblici + public override string ToString() { return (_caption); } //Override metodo ToString per riempire classi ListControl + #endregion + + #region Proprietà + public string Caption { get { return this._caption; } set { this._caption = value; } } + public int WindowID { get { return this._windowID; } set { this._windowID = value; } } + public string XmlFile { get { return this._xmlFile; } set { this._xmlFile = value; } } + #endregion + } + internal class NavigatorItem //Classe elemento per navigazione + { + #region Dati + private string _caption; //Titolo link + private BindingList<Window> _windows = new BindingList<Window>(); + private BindingList<WindowLink> _destinations = new BindingList<WindowLink>(); + #endregion + + #region Costruttore + public NavigatorItem() //Costruttore classe Window + { + _caption = "Navigator Group"; //--> inizializzazione titolo + } + #endregion + + + } + internal class ShortCuts //Classe di gestione degli shortcuts configurati { #region Strutture This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-05-08 15:04:19
|
Revision: 4799 http://sourceforge.net/p/mp-plugins/code/4799 Author: nicsergio Date: 2014-05-08 15:04:15 +0000 (Thu, 08 May 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-07 19:58:53 UTC (rev 4798) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-08 15:04:15 UTC (rev 4799) @@ -21,7 +21,7 @@ { #region Dati private LogLevels _logLevel; //Livello di log - private string _logMessage; //Messaggio di log + private string _logMessage; //Messaggio di log private Exception _logException; //Eventuale eccezione public enum LogLevels //Tipologie di livelli di log @@ -43,8 +43,8 @@ #endregion #region Proprietà - public LogLevels LogLevel { get { return this._logLevel; } } - public string LogMessage { get { return this._logMessage; } } + public LogLevels LogLevel { get { return this._logLevel; } } + public string LogMessage { get { return this._logMessage; } } public Exception LogException { get { return this._logException; } } #endregion } @@ -68,13 +68,13 @@ { if (skinNavigator) //Se richiesta destinazione corrispondente a Skin Navigator { - _caption = "Skin Navigator"; //--> titolo Skin Navigator - _windowID = NavigatorID; //--> Id finestra virtuale per attivazione Skin Navigator + _caption = "Skin Navigator"; //--> titolo Skin Navigator + _windowID = NavigatorID; //--> Id finestra virtuale per attivazione Skin Navigator } else { - _caption = "Link"; //--> inizializzazione titolo - _windowID = 0; //--> inizializzazione Id finestra + _caption = "Link"; //--> inizializzazione titolo + _windowID = 0; //--> inizializzazione Id finestra } _loadParameter = ""; //--> inizializzazione parametri di caricamento per visualizzazione } @@ -86,7 +86,7 @@ { if (_caption.Length > 0 && Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "Go to link destination, " + this.ToString())); - + try { GUIGraphicsContext.ResetLastActivity(); @@ -112,7 +112,7 @@ break; } else - break; + break; } if (loadParameterChange && Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Debug, "GUIProperties replaced, LoadParameter=[" + loadParameter + "]")); @@ -133,7 +133,7 @@ } catch (Exception e) { - if (Log != null) + if (Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Error, "Error going to window", e)); return false; //--> comando non completato } @@ -160,8 +160,8 @@ public WindowLink Clone() //Clonazione collegamento { WindowLink lnk = new WindowLink(); - lnk.Caption = _caption; - lnk.WindowID = _windowID; + lnk.Caption = _caption; + lnk.WindowID = _windowID; lnk.LoadParameter = _loadParameter; return lnk; } @@ -177,20 +177,20 @@ #endregion #region Proprietà - public bool IsValid { get { return (this._windowID > InvalidID || this.IsNavigator) ; } } - public bool IsNavigator { get { return (this._windowID == NavigatorID); } } - public string Caption { get { return this._caption; } set { this._caption = value; } } - public int WindowID { get { return this._windowID; } set { this._windowID = value; } } - public string LoadParameter { get { return this._loadParameter; } set { this._loadParameter = value; } } - #endregion + public bool IsValid { get { return (this._windowID > InvalidID || this.IsNavigator); } } + public bool IsNavigator { get { return (this._windowID == NavigatorID); } } + public string Caption { get { return this._caption; } set { this._caption = value; } } + public int WindowID { get { return this._windowID; } set { this._windowID = value; } } + public string LoadParameter { get { return this._loadParameter; } set { this._loadParameter = value; } } + #endregion } internal class KeyCombination //Classe combinazione di tasti { #region Dati 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 _shift; //Utilizzo del modificatore "Shift" - 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 static readonly List<Keys> ModifierKeys = new List<Keys>(); //Lista dei tasti modificatori #endregion @@ -210,20 +210,20 @@ } public KeyCombination() //Costruttore classe KeyCombination { - _key = "A"; //--> inizializzazione tasto - _ctrl = true; //--> inizializzazione utilizzo del modificatore "Ctrl" - _alt = false; //--> inizializzazione utilizzo del modificatore "Alt" + _key = "A"; //--> inizializzazione tasto + _ctrl = true; //--> inizializzazione utilizzo del modificatore "Ctrl" + _alt = false; //--> inizializzazione utilizzo del modificatore "Alt" _shift = true; //--> inizializzazione utilizzo del modificatore "Shift" } public KeyCombination(KeyEventArgs k) //Costruttore classe KeyCombination da evento di pressione tasto { - _key = k.KeyCode.ToString(); //--> assegnazione tasto - _ctrl = k.Control; //--> utilizzo del modificatore "Ctrl" - _alt = k.Alt; //--> utilizzo del modificatore "Alt" + _key = k.KeyCode.ToString(); //--> assegnazione tasto + _ctrl = k.Control; //--> utilizzo del modificatore "Ctrl" + _alt = k.Alt; //--> utilizzo del modificatore "Alt" _shift = k.Shift; //--> utilizzo del modificatore "Shift" } #endregion - + #region Metodi Pubblici public static bool IsModifier(Keys key) //Verifica se un tasto corrisponde ad un modificatore { @@ -237,7 +237,7 @@ #region Proprietà public bool IsValid - { + { get { KeysConverter kc = new KeysConverter(); @@ -247,32 +247,32 @@ return (key != Keys.None && !ModifierKeys.Contains(key)); //--> verifica se la stringa corrisponde ad un tasto e che il tasto non sia un modificatore } } - public string Key { get { return this._key; } set { this._key = value; } } - public bool Ctrl { get { return this._ctrl; } set { this._ctrl = value; } } - public bool Alt { get { return this._alt; } set { this._alt = value; } } + public string Key { get { return this._key; } set { this._key = value; } } + public bool Ctrl { get { return this._ctrl; } set { this._ctrl = value; } } + public bool Alt { get { return this._alt; } set { this._alt = value; } } public bool Shift { get { return this._shift; } set { this._shift = value; } } - #endregion + #endregion } internal class ShortCut : INotifyPropertyChanged //Classe shortcut (scorciatoia da tastiera) con notifica variazione proprietà per binding su GridView { #region Dati - private string _caption; //Titolo link + private string _caption; //Titolo link private KeyCombination _keys; //Combinazione di tasti per attivazione shortcut - private WindowLink _destination; //Destinazione dello shortcut - private bool _return; //Ritorno a finestra precedente se si è già a destinazione - private string _soundEffect; //File relativo all'eventuale effetto sonoro + private WindowLink _destination; //Destinazione dello shortcut + private bool _return; //Ritorno a finestra precedente se si è già a destinazione + private string _soundEffect; //File relativo all'eventuale effetto sonoro #endregion #region Costruttore public ShortCut() : this(false) { } //Costruttore classe ShortCut (senza argomenti) public ShortCut(bool skinNavigator) //Costruttore classe ShortCut { - _caption = (skinNavigator ? "Skin Navigator" : "ShortCut"); //--> inizializzazione titolo - _keys = new KeyCombination(); //--> istanziazione classe KeyCombination - _destination = new WindowLink(skinNavigator); //--> istanziazione classe WindowLink + _caption = (skinNavigator ? "Skin Navigator" : "ShortCut"); //--> inizializzazione titolo + _keys = new KeyCombination(); //--> istanziazione classe KeyCombination + _destination = new WindowLink(skinNavigator); //--> istanziazione classe WindowLink _destination.Caption = ""; //--> reset caption destinazione (gestita caption shortcut) - _return = false; //--> inizializzazione ritorno a finestra precedente se si è già a destinazione - _soundEffect = "click.wav"; //--> inizializzazione effetto sonoro + _return = false; //--> inizializzazione ritorno a finestra precedente se si è già a destinazione + _soundEffect = "click.wav"; //--> inizializzazione effetto sonoro } #endregion @@ -290,13 +290,13 @@ { if (_caption.Length > 0 && Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "Go to shortcut destination, " + this.ToString())); - + try { if (_soundEffect.Length > 0 && !g_Player.Playing) Utils.PlaySound(_soundEffect, false, true); //--> eventuale effetto sonoro } - catch { } + catch { } return _destination.Go(Log); //--> visualizzazione finestra di destinazione } @@ -311,22 +311,22 @@ if (_soundEffect.Length > 0 && !g_Player.Playing) Utils.PlaySound("back.wav", false, true); //--> eventuale effetto sonoro } - catch { } + catch { } return _destination.GoPrevious(Log); //--> visualizzazione finestra precedente } public ShortCut Clone() //Clonazione shortcut { ShortCut sc = new ShortCut(); - sc.Caption = _caption; - sc.Key = _keys.Key; - sc.Ctrl = _keys.Ctrl; - sc.Alt = _keys.Alt; - sc.Shift = _keys.Shift; - sc.WindowID = _destination.WindowID; + sc.Caption = _caption; + sc.Key = _keys.Key; + sc.Ctrl = _keys.Ctrl; + sc.Alt = _keys.Alt; + sc.Shift = _keys.Shift; + sc.WindowID = _destination.WindowID; sc.LoadParameter = _destination.LoadParameter; - sc.Return = _return; - sc.SoundEffect = _soundEffect; + sc.Return = _return; + sc.SoundEffect = _soundEffect; return sc; } public override string ToString() //Override metodo ToString per stampare le proprietà dello shortcut @@ -340,17 +340,17 @@ #endregion #region Proprietà - public bool IsValid { get { return this._destination.IsValid && this._keys.IsValid; } } - public bool IsNavigator { get { return this._destination.IsNavigator; } } - public string Caption { get { return this._caption; } set { this._caption = value; this.NotifyPropertyChanged("Caption"); } } - public string Key { get { return this._keys.Key; } set { this._keys.Key = value; this.NotifyPropertyChanged("Key"); } } - public bool Ctrl { get { return this._keys.Ctrl; } set { this._keys.Ctrl = value; this.NotifyPropertyChanged("Ctrl"); } } - public bool Alt { get { return this._keys.Alt; } set { this._keys.Alt = value; this.NotifyPropertyChanged("Alt"); } } - public bool Shift { get { return this._keys.Shift; } set { this._keys.Shift = value; this.NotifyPropertyChanged("Shift"); } } - public int WindowID { get { return this._destination.WindowID; } set { this._destination.WindowID = value; this.NotifyPropertyChanged("WindowID"); } } + public bool IsValid { get { return this._destination.IsValid && this._keys.IsValid; } } + public bool IsNavigator { get { return this._destination.IsNavigator; } } + public string Caption { get { return this._caption; } set { this._caption = value; this.NotifyPropertyChanged("Caption"); } } + public string Key { get { return this._keys.Key; } set { this._keys.Key = value; this.NotifyPropertyChanged("Key"); } } + public bool Ctrl { get { return this._keys.Ctrl; } set { this._keys.Ctrl = value; this.NotifyPropertyChanged("Ctrl"); } } + public bool Alt { get { return this._keys.Alt; } set { this._keys.Alt = value; this.NotifyPropertyChanged("Alt"); } } + public bool Shift { get { return this._keys.Shift; } set { this._keys.Shift = value; this.NotifyPropertyChanged("Shift"); } } + public int WindowID { get { return this._destination.WindowID; } set { this._destination.WindowID = value; this.NotifyPropertyChanged("WindowID"); } } public string LoadParameter { get { return this._destination.LoadParameter; } set { this._destination.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"); } } + 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 } @@ -358,41 +358,41 @@ { #region Dati private string _caption; //Titolo finestra - private int _windowID; //Id finestra + private int _windowID; //Id finestra private string _xmlFile; //Nome del file xml corrispondente #endregion #region Costruttore public Window() //Costruttore classe Window { - _caption = ""; //--> inizializzazione titolo + _caption = ""; //--> inizializzazione titolo _windowID = 0; //--> inizializzazione Id finestra - _xmlFile = ""; //--> inizializzazione nome file xml + _xmlFile = ""; //--> inizializzazione nome file xml } #endregion #region Metodi Pubblici public override string ToString() { return (_caption); } //Override metodo ToString per riempire classi ListControl #endregion - + #region Proprietà - public string Caption { get { return this._caption; } set { this._caption = value; } } - public int WindowID { get { return this._windowID; } set { this._windowID = value; } } - public string XmlFile { get { return this._xmlFile; } set { this._xmlFile = value; } } - #endregion + public string Caption { get { return this._caption; } set { this._caption = value; } } + public int WindowID { get { return this._windowID; } set { this._windowID = value; } } + public string XmlFile { get { return this._xmlFile; } set { this._xmlFile = value; } } + #endregion } internal class NavItem //Classe elemento per navigazione { #region Dati - private string _caption; //Titolo link - private BindingList<Window> _windows = new BindingList<Window>(); + private string _caption; //Titolo link + private BindingList<Window> _windows = new BindingList<Window>(); private BindingList<WindowLink> _destinations = new BindingList<WindowLink>(); #endregion #region Costruttore public NavItem() //Costruttore classe Window { - _caption = "Navigator Group"; //--> inizializzazione titolo + _caption = "Navigator Group"; //--> inizializzazione titolo } #endregion @@ -414,52 +414,52 @@ #endregion #region Dati - private readonly string SettingsFile; //File di salvataggio impostazioni - private GeneralSettings _general = new GeneralSettings(); //Impostazioni generali plugin - private BindingList<ShortCut> _items = new BindingList<ShortCut>(); //Lista (con associazione dati) degli shortcuts configurati - private BindingList<NavItem> _navItems = new BindingList<NavItem>(); - private bool _initialized; //Classe inizializzata + private readonly string SettingsFile; //File di salvataggio impostazioni + private GeneralSettings _general = new GeneralSettings(); //Impostazioni generali plugin + private BindingList<ShortCut> _items = new BindingList<ShortCut>(); //Lista (con associazione dati) degli shortcuts configurati + private BindingList<NavItem> _navItems = new BindingList<NavItem>(); + private bool _initialized; //Classe inizializzata - private WindowLink lastDestination = new WindowLink(); //Dati ultima destinazione attivata dal plugin + private WindowLink lastDestination = new WindowLink(); //Dati ultima destinazione attivata dal plugin #endregion #region Costruttore public ShortCuts(string settingsFile) //Costruttore classe ShortCuts { - SettingsFile = settingsFile; //--> percorso & nome file delle impostazioni + SettingsFile = settingsFile; //--> percorso & nome file delle impostazioni _general.ForcingCapsLock = LockKeys.LockKeyActions.None; //--> default: nessuna modifica stato Caps-Lock - _general.ForcingNumLock = LockKeys.LockKeyActions.None; //--> default: nessuna modifica stato Num-Lock - _initialized = false; //--> reset classe inizializzata - lastDestination.Caption = "Last destination"; //--> titolo ultima destinazione + _general.ForcingNumLock = LockKeys.LockKeyActions.None; //--> default: nessuna modifica stato Num-Lock + _initialized = false; //--> reset classe inizializzata + lastDestination.Caption = "Last destination"; //--> titolo ultima destinazione lastDestination.Reset(); //--> reset ultima destinazione attivata dal plugin } #endregion - + #region Metodi Privati private bool LoadDeprecatedConfig() //Caricamento configurazione obsoleta { using (Settings confReader = new Settings(SettingsFile)) { const string sectionName = "ShortCuterForm"; - const string capPrefix = "Titel"; - const string keyPrefix = "Key"; - const string widPrefix = "ID"; + const string capPrefix = "Titel"; + const string keyPrefix = "Key"; + const string widPrefix = "ID"; if (!confReader.HasSection<string>(sectionName)) return false; //--> se sezione non presente: il file non corrisponde - bool ctrl = confReader.GetValueAsBool(sectionName, "ModCtrl", false); //--> utilizzo del modificatore ctrl per tutti gli shortcut + bool ctrl = confReader.GetValueAsBool(sectionName, "ModCtrl", false); //--> utilizzo del modificatore ctrl per tutti gli shortcut bool shift = confReader.GetValueAsBool(sectionName, "ModShift", false); //--> utilizzo del modificatore shift per tutti gli shortcut for (int i = 1; i <= 20; i++) //Iterazione di lettura shortcut { ShortCut sc = new ShortCut(); - sc.Caption = confReader.GetValueAsString(sectionName, capPrefix + string.Format("{0:00}", i), ""); - sc.Key = confReader.GetValueAsString(sectionName, keyPrefix + string.Format("{0:00}", i), "").ToUpper(); - sc.WindowID = confReader.GetValueAsInt(sectionName, widPrefix + string.Format("{0:00}", i), -1); - sc.Ctrl = ctrl; - sc.Alt = false; - sc.Shift = shift; + sc.Caption = confReader.GetValueAsString(sectionName, capPrefix + string.Format("{0:00}", i), ""); + sc.Key = confReader.GetValueAsString(sectionName, keyPrefix + string.Format("{0:00}", i), "").ToUpper(); + sc.WindowID = confReader.GetValueAsInt(sectionName, widPrefix + string.Format("{0:00}", i), -1); + sc.Ctrl = ctrl; + sc.Alt = false; + sc.Shift = shift; if (sc.IsValid) //Se shortcut valido _items.Add(sc); //--> aggiunta dello shortcut nella lista } @@ -468,7 +468,7 @@ } private List<ShortCut> GetShortCutsGroup(KeyCombination k) //Raccolta lista shortcut associati alla combinazione di tasti { - return _items.ToList().FindAll(x => x.Key == k.Key && x.Ctrl == k.Ctrl && x.Alt == k.Alt && x.Shift == k.Shift); + return _items.ToList().FindAll(x => x.Key == k.Key && x.Ctrl == k.Ctrl && x.Alt == k.Alt && x.Shift == k.Shift); } private bool AlreadyAtDestination(ShortCut sc) //Verifica se finestra attuale corrispondente a destinazione shortcut { @@ -498,7 +498,7 @@ else return false; //--> finestra attuale non corrispondente a destinazione shortcut } - private bool Navigation() + private void Navigation() //Gestione finestra di dialogo e navigazione alla destinazione selezionata { if (Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "Request Skin Navigator dialog menu")); @@ -535,34 +535,31 @@ { dlgMenu.DoModal(actWindowID); if (dlgMenu.SelectedLabel >= 0 && dlgMenu.SelectedLabel < dlgLinks.Count) - return dlgLinks[dlgMenu.SelectedLabel].Go(Log); - else - { - if (Log != null) - Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "No links selected from Skin Navigator dialog menu, ID = " + actWindowID)); - return false; - } + if (dlgLinks[dlgMenu.SelectedLabel].Go(Log)) + { + lastDestination.WindowID = dlgLinks[dlgMenu.SelectedLabel].WindowID; + lastDestination.LoadParameter = dlgLinks[dlgMenu.SelectedLabel].LoadParameter; + } + else + if (Log != null) + Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "No links selected from Skin Navigator dialog menu, ID = " + actWindowID)); } else - { if (Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "No links found for Skin Navigator, window ID = " + actWindowID)); - return false; - } } catch (Exception e) { if (Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Error, "Error opening Skin Navigator dialog menu", e)); - return false; } } #endregion #region Metodi Pubblici public bool Initialize() //Inizializzazione - { - _initialized = LoadConfig(false); //--> caricamento configurazione (standard) shortcuts + { + _initialized = LoadConfig(false); //--> caricamento configurazione (standard) shortcuts if (!_initialized) { if (Log != null) @@ -576,7 +573,7 @@ } } return _initialized; - } + } public bool LoadConfig(bool defaultSettings) //Caricamento configurazione { _items.Clear(); //--> pulizia lista shortcuts @@ -617,7 +614,7 @@ innerNode = generalNode.SelectSingleNode("ResetNumLock"); //Necessario per compatibilità con file di configurazione V2.0.5.0 if (innerNode != null && Convert.ToBoolean(Convert.ToInt16(innerNode.InnerText))) _general.ForcingNumLock = LockKeys.LockKeyActions.Off; - } + } } XmlNodeList nodeList = xmlFile.DocumentElement.SelectNodes("/ShortCuter/Items/Item"); foreach (XmlNode node in nodeList) //Iterazione per memorizzazione impostazioni shortcuts @@ -702,27 +699,27 @@ xmlSettings.WriteStartDocument(); xmlSettings.WriteStartElement("ShortCuter"); - xmlSettings.WriteStartElement("General"); - xmlSettings.WriteElementString("ForcingCapsLock", _general.ForcingCapsLock.ToString()); - xmlSettings.WriteElementString("ForcingNumLock", _general.ForcingNumLock.ToString()); + xmlSettings.WriteStartElement("General"); + xmlSettings.WriteElementString("ForcingCapsLock", _general.ForcingCapsLock.ToString()); + xmlSettings.WriteElementString("ForcingNumLock", _general.ForcingNumLock.ToString()); + xmlSettings.WriteEndElement(); + xmlSettings.WriteStartElement("Items"); + foreach (ShortCut sc in _items) //Iterazione per salvataggio sortcuts + { + xmlSettings.WriteStartElement("Item"); + xmlSettings.WriteElementString("Caption", sc.Caption); + xmlSettings.WriteElementString("Key", sc.Key); + xmlSettings.WriteElementString("Ctrl", Convert.ToInt16(sc.Ctrl).ToString()); + xmlSettings.WriteElementString("Alt", Convert.ToInt16(sc.Alt).ToString()); + 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(); - xmlSettings.WriteStartElement("Items"); - foreach (ShortCut sc in _items) //Iterazione per salvataggio sortcuts - { - xmlSettings.WriteStartElement("Item"); - xmlSettings.WriteElementString("Caption", sc.Caption); - xmlSettings.WriteElementString("Key", sc.Key); - xmlSettings.WriteElementString("Ctrl", Convert.ToInt16(sc.Ctrl).ToString()); - xmlSettings.WriteElementString("Alt", Convert.ToInt16(sc.Alt).ToString()); - 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(); - } - xmlSettings.WriteEndElement(); + } xmlSettings.WriteEndElement(); + xmlSettings.WriteEndElement(); xmlSettings.Flush(); xmlSettings.Close(); @@ -735,7 +732,7 @@ } finally { - if (xmlSettings != null) + if (xmlSettings != null) xmlSettings.Close(); //--> eventuale chiusura oggetto XmlWriter } if (Log != null) @@ -751,63 +748,9 @@ if (scList != null && scList.Count > 0) //Se trovato almeno uno shortcut { if (scList.Find(x => x.IsNavigator) != null) //Se combinazione di tasti corrispondente a Skin Navigator - { - if (Log != null) - Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "Request Skin Navigator dialog menu")); - - try - { - int actWindowID = (int)GUIWindowManager.ActiveWindow; - GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); - dlgMenu.Reset(); - dlgMenu.SetHeading("Skin Navigator"); - dlgMenu.ShowQuickNumbers = false; - - List<WindowLink> dlgLinks = new List<WindowLink>(); - foreach (NavItem item in _navItems) //Iterazione per memorizzazione impostazioni shortcuts - { - if ((item.Windows.First(x => x.WindowID == actWindowID)) != null || item.Windows.Count == 0) - { - bool first = true; - foreach (WindowLink link in item.Destinations) //Iterazione per memorizzazione impostazioni shortcuts - { - if (first && dlgLinks.Count > 0) - { - dlgMenu.Add("---- ----"); - dlgLinks.Add(null); - first = false; - } - dlgMenu.Add(link.Caption); - dlgLinks.Add(link); - } - } - } - - if (dlgLinks.Count > 0) - { - dlgMenu.DoModal(actWindowID); - if (dlgMenu.SelectedLabel >= 0 && dlgMenu.SelectedLabel < dlgLinks.Count) - dlgLinks[dlgMenu.SelectedLabel].Go(Log); - else - if (Log != null) - Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "No links selected from Skin Navigator dialog menu, ID = " + actWindowID)); - } - else - if (Log != null) - Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "No links found for Skin Navigator, window ID = " + actWindowID)); - } - catch (Exception e) - { - if (Log != null) - Log(this, new LogEventArgs(LogEventArgs.LogLevels.Error, "Error opening Skin Navigator dialog menu", e)); - } - - - } + Navigation(); //--> gestione navigazione alla destinazione selezionata else //Shortcuts normali - { if (scList.Count == 1) //Shortcut a destinazione singola - { if (scList[0].Return && AlreadyAtDestination(scList[0])) //Se impostato flag di ritorno e finestra attuale corrispondente a destinazione scList[0].GoPrevious(Log); //--> visualizzazione finestra precedente else @@ -816,7 +759,6 @@ lastDestination.WindowID = scList[0].WindowID; //--> memorizzazione id finestra lastDestination.LoadParameter = scList[0].LoadParameter; //--> memorizzazione parametri di caricamento utilizzati } - } else //Shortcut a destinazione multipla (ciclico) { int scIndex = 0; @@ -834,7 +776,6 @@ lastDestination.LoadParameter = scList[scIndex].LoadParameter; //--> memorizzazione parametri di caricamento utilizzati } } - } } else //Combinazione di tasti non corrispondente a nessuno shortcut if (Log != null) @@ -853,10 +794,10 @@ #endregion #region Proprietà - public bool Initialized { get { return this._initialized; } } - public LockKeys.LockKeyActions GeneralForcingCapsLock { get { return this._general.ForcingCapsLock; } set { this._general.ForcingCapsLock = value; } } - public LockKeys.LockKeyActions GeneralForcingNumLock { get { return this._general.ForcingNumLock; } set { this._general.ForcingNumLock = value; } } - public BindingList<ShortCut> Items { get { return this._items; } } + public bool Initialized { get { return this._initialized; } } + public LockKeys.LockKeyActions GeneralForcingCapsLock { get { return this._general.ForcingCapsLock; } set { this._general.ForcingCapsLock = value; } } + public LockKeys.LockKeyActions GeneralForcingNumLock { get { return this._general.ForcingNumLock; } set { this._general.ForcingNumLock = value; } } + public BindingList<ShortCut> Items { get { return this._items; } } #endregion - } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-05-11 12:58:34
|
Revision: 4802 http://sourceforge.net/p/mp-plugins/code/4802 Author: nicsergio Date: 2014-05-11 12:58:31 +0000 (Sun, 11 May 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-09 22:39:13 UTC (rev 4801) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-11 12:58:31 UTC (rev 4802) @@ -159,12 +159,22 @@ } public WindowLink Clone() //Clonazione collegamento { - WindowLink lnk = new WindowLink(); + WindowLink lnk = new WindowLink(); lnk.Caption = _caption; lnk.WindowID = _windowID; lnk.LoadParameter = _loadParameter; return lnk; } + public WindowLink GetData(WindowLink lnk) //Copiatura dati da un'altro collegamento + { + if (lnk != null) + { + _caption = lnk.Caption; + _windowID = lnk.WindowID; + _loadParameter = lnk.LoadParameter; + } + return this; + } public void Reset() //Reset destinazione (invalidazione) { _windowID = InvalidID; //--> invalidazione Id finestra @@ -315,16 +325,15 @@ public void Play() { Play(false); } //Manda effetto sonoro dello shortcut public ShortCut Clone() //Clonazione shortcut { - ShortCut sc = new ShortCut(); - sc.Caption = _caption; - sc.Key = _keys.Key; - sc.Ctrl = _keys.Ctrl; - sc.Alt = _keys.Alt; - sc.Shift = _keys.Shift; - sc.WindowID = _destination.WindowID; - sc.LoadParameter = _destination.LoadParameter; - sc.Return = _return; - sc.SoundEffect = _soundEffect; + ShortCut sc = new ShortCut(); + sc.Caption = _caption; + sc.Key = _keys.Key; + sc.Ctrl = _keys.Ctrl; + sc.Alt = _keys.Alt; + sc.Shift = _keys.Shift; + sc._destination = _destination.Clone(); + sc.Return = _return; + sc.SoundEffect = _soundEffect; return sc; } public override string ToString() //Override metodo ToString per stampare le proprietà dello shortcut @@ -338,17 +347,18 @@ #endregion #region Proprietà - public bool IsValid { get { return this._destination.IsValid && this._keys.IsValid; } } - public bool IsNavigator { get { return this._destination.IsNavigator; } } - public string Caption { get { return this._caption; } set { this._caption = value; this.NotifyPropertyChanged("Caption"); } } - public string Key { get { return this._keys.Key; } set { this._keys.Key = value; this.NotifyPropertyChanged("Key"); } } - public bool Ctrl { get { return this._keys.Ctrl; } set { this._keys.Ctrl = value; this.NotifyPropertyChanged("Ctrl"); } } - public bool Alt { get { return this._keys.Alt; } set { this._keys.Alt = value; this.NotifyPropertyChanged("Alt"); } } - public bool Shift { get { return this._keys.Shift; } set { this._keys.Shift = value; this.NotifyPropertyChanged("Shift"); } } - public int WindowID { get { return this._destination.WindowID; } set { this._destination.WindowID = value; this.NotifyPropertyChanged("WindowID"); } } - public string LoadParameter { get { return this._destination.LoadParameter; } set { this._destination.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"); } } + public bool IsValid { get { return this._destination.IsValid && this._keys.IsValid; } } + public bool IsNavigator { get { return this._destination.IsNavigator; } } + public string Caption { get { return this._caption; } set { this._caption = value; this.NotifyPropertyChanged("Caption"); } } + public string Key { get { return this._keys.Key; } set { this._keys.Key = value; this.NotifyPropertyChanged("Key"); } } + public bool Ctrl { get { return this._keys.Ctrl; } set { this._keys.Ctrl = value; this.NotifyPropertyChanged("Ctrl"); } } + public bool Alt { get { return this._keys.Alt; } set { this._keys.Alt = value; this.NotifyPropertyChanged("Alt"); } } + public bool Shift { get { return this._keys.Shift; } set { this._keys.Shift = value; this.NotifyPropertyChanged("Shift"); } } + public int WindowID { get { return this._destination.WindowID; } set { this._destination.WindowID = value; this.NotifyPropertyChanged("WindowID"); } } + public string LoadParameter { get { return this._destination.LoadParameter; } set { this._destination.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"); } } + public WindowLink Destination { get { return this._destination.Clone(); } } #endregion } internal class ShortCuts //Classe di gestione degli shortcuts configurati @@ -422,7 +432,9 @@ #endregion #region Proprietà - public bool Force { get { return this._force; } set { this._force = value; } } + public new bool IsValid { get { return (base.IsValid && !base.IsNavigator); } } + private new bool IsNavigator { get { return false; } } + public bool Force { get { return this._force; } set { this._force = value; } } #endregion } #endregion @@ -527,12 +539,7 @@ dlgLinks.Add(null); } dlgMenu.Add(dst.Caption); //--> aggiunta voce di menu - - WindowLink lnk = new WindowLink(); - lnk.WindowID = dst.WindowID; - lnk.Caption = dst.Caption; - lnk.LoadParameter = dst.LoadParameter; - dlgLinks.Add(lnk); //--> aggiunta destinazione corrispondente + dlgLinks.Add(new WindowLink().GetData(dst)); //--> aggiunta destinazione corrispondente (classe WindowLink) first = false; } } @@ -859,12 +866,7 @@ if (sc != null) //Se combinazione di tasti corrispondente a Skin Navigator { sc.Play(); //--> eventuale effetto sonoro - WindowLink dst = Navigator.Go(Log); //--> gestione navigazione alla destinazione selezionata - if (dst != null) //Se attivata correttamente una destinazione - { - lastDestination.WindowID = dst.WindowID; //--> memorizzazione id finestra - lastDestination.LoadParameter = dst.LoadParameter; //--> memorizzazione parametri di caricamento utilizzati - } + lastDestination.GetData(Navigator.Go(Log)); //--> gestione navigazione alla destinazione selezionata (ed eventuale memorizzazione) } else //Shortcuts normali if (scList.Count == 1) //Shortcut a destinazione singola @@ -873,10 +875,7 @@ scList[0].GoPrevious(Log); //--> visualizzazione finestra precedente else if (scList[0].Go(Log)) //--> visualizzazione finestra di destinazione shortcut - { - lastDestination.WindowID = scList[0].WindowID; //--> memorizzazione id finestra - lastDestination.LoadParameter = scList[0].LoadParameter; //--> memorizzazione parametri di caricamento utilizzati - } + lastDestination.GetData(scList[0].Destination); //--> aggiornamento ultima destinazione } else //Shortcut a destinazione multipla (ciclico) { @@ -890,10 +889,7 @@ } } if (scList[scIndex].Go(Log)) //--> visualizzazione finestra di destinazione shortcut - { - lastDestination.WindowID = scList[scIndex].WindowID; //--> memorizzazione id finestra - lastDestination.LoadParameter = scList[scIndex].LoadParameter; //--> memorizzazione parametri di caricamento utilizzati - } + lastDestination.GetData(scList[0].Destination); //--> aggiornamento ultima destinazione } } else //Combinazione di tasti non corrispondente a nessuno shortcut This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-05-12 14:52:45
|
Revision: 4804 http://sourceforge.net/p/mp-plugins/code/4804 Author: nicsergio Date: 2014-05-12 14:52:42 +0000 (Mon, 12 May 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-12 08:46:12 UTC (rev 4803) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-12 14:52:42 UTC (rev 4804) @@ -81,7 +81,7 @@ #endregion #region Metodi Pubblici - public bool Go() { return Go(null); } //Visualizzazione finestra del collegamento (senza log) + public bool Go() { return Go(null); } //Visualizzazione finestra del collegamento (senza delegato per log) public bool Go(LogEventHandler Log) //Visualizzazione finestra del collegamento { if (_caption.Length > 0 && Log != null) @@ -138,7 +138,7 @@ return false; //--> comando non completato } } - public bool GoPrevious() { return GoPrevious(null); } //Ritorno alla finestra precedente (senza log) + public bool GoPrevious() { return GoPrevious(null); } //Ritorno alla finestra precedente (senza delegato per log) public bool GoPrevious(LogEventHandler Log) //Ritorno alla finestra precedente { if (_caption.Length > 0 && Log != null) @@ -304,7 +304,7 @@ #endregion #region Metodi Pubblici - public bool Go() { return Go(null); } //Visualizzazione finestra del collegamento (senza log) + public bool Go() { return Go(null); } //Visualizzazione finestra del collegamento (senza delegato per log) public bool Go(LogEventHandler Log) //Visualizzazione finestra del collegamento { if (_caption.Length > 0 && Log != null) @@ -313,7 +313,7 @@ Play(); //--> eventuale effetto sonoro return _destination.Go(Log); //--> visualizzazione finestra di destinazione } - public bool GoPrevious() { return GoPrevious(null); } //Ritorno alla finestra precedente (senza log) + public bool GoPrevious() { return GoPrevious(null); } //Ritorno alla finestra precedente (senza delegato per log) public bool GoPrevious(LogEventHandler Log) //Ritorno alla finestra precedente { if (_caption.Length > 0 && Log != null) @@ -387,6 +387,35 @@ public class SkinNavigator //Sotto-classe di gestione Skin Navigator { #region Classi + public class GeneralSettings //Sotto-classe di gestione impostazioni generali Skin Navigator + { + #region Dati + private string _menuHeader; //Titolo menu di navigazione + private bool _showSeparator; //Visualizzazione separatore gruppi di destinazioni + private string _separator; //Eventuale separatore da visualizzare + private bool _showNumbers; //Visualizzazione numeri cossispondenti a voci menu (per accesso da telecomando) + private bool _removeDuplicates; //Rimozione destinazioni duplicate + #endregion + + #region Costruttore + public GeneralSettings() //Costruttore classe GeneralSettings + { + _menuHeader = "Skin Navigator"; //--> titolo menu di navigazione + _showSeparator = true; //--> visualizzazione separatore attiva + _separator = "-- -- -- -- -- --"; //--> separatore da visualizzare + _showNumbers = true; //--> visualizzazione numeri cossispondenti a voci menu + _removeDuplicates = true; //--> rimozione di destinazioni duplicate + } + #endregion + + #region Proprietà + public string MenuHeader { get { return this._menuHeader; } set { this._menuHeader = value; } } + public bool ShowSeparator { get { return this._showSeparator; } set { this._showSeparator = value; } } + public string Separator { get { return this._separator; } set { this._separator = value; } } + public bool ShowNumbers { get { return this._showNumbers; } set { this._showNumbers = value; } } + public bool RemoveDuplicates { get { return this._removeDuplicates; } set { this._removeDuplicates = value; } } + #endregion + } public class Item //Sotto-classe elemento per navigazione { #region Classi @@ -415,7 +444,7 @@ #endregion } public class Destination : WindowLink //Sotto-classe destinazione di navigazione - { + { #region Dati private bool _force; //Forzatura destinazione #endregion @@ -463,55 +492,25 @@ #endregion #region Dati - private string _menuHeader; //Titolo menu di navigazione - private bool _showSeparator; //Visualizzazione separatore gruppi di destinazioni - private string _separator; //Eventuale separatore da visualizzare - private bool _showNumbers; //Visualizzazione numeri cossispondenti a voci menu (per accesso da telecomando) - private bool _removeDuplicates; //Rimozione destinazioni duplicate + private GeneralSettings _general; //Impostazioni generali private BindingList<Item> _items; //Lista (con associazione dati) elementi di navigazione + private readonly LogEventHandler Log; #endregion #region Costruttore - public SkinNavigator() //Costruttore classe NavigatorSettings + public SkinNavigator() : this(null) { } //Costruttore classe SkinNavigator (senza delegato per log) + public SkinNavigator(LogEventHandler LogHandler) //Costruttore classe SkinNavigator { - _menuHeader = "Skin Navigator"; //--> titolo menu di navigazione - _showSeparator = true; //--> visualizzazione separatore attiva - _separator = "-- -- -- -- -- --"; //--> separatore da visualizzare - _removeDuplicates = true; //--> rimozione di destinazioni duplicate - _items = new BindingList<Item>(); //--> istanziazione lista elementi di navigazione - - - - Item iii1 = new Item(); - Item.Destination ddd1 = new Item.Destination(); - iii1.Caption = "www"; - ddd1.Caption = "Home"; - ddd1.WindowID = 35; - iii1.Destinations.Add(ddd1); - Item.Destination ddd2 = new Item.Destination(); - ddd2.Caption = "Movie"; - ddd2.WindowID =96742; - iii1.Destinations.Add(ddd2); - _items.Add(iii1); - - Item.Window www = new Item.Window(); - www.WindowID = 1; - Item iii2 = new Item(); - iii2.Caption = "www"; - iii2.Windows.Add(www); - Item.Destination ddd3 = new Item.Destination(); - ddd3.Caption = "Music"; - ddd3.WindowID = 501; - iii2.Destinations.Add(ddd3); - _items.Add(iii2); - - - + _general = new GeneralSettings(); //--> istanziazione impostazioni generali + _items = new BindingList<Item>(); //--> istanziazione lista elementi di navigazione + Log = LogHandler; //--> assegnazione eventuale delegato per operazioni di log } #endregion #region Metodi Pubblici - public WindowLink Go(LogEventHandler Log) //Gestione finestra di dialogo e navigazione alla destinazione selezionata + + + public WindowLink Go() //Gestione finestra di dialogo e navigazione alla destinazione selezionata { if (Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "Request Skin Navigator dialog menu")); @@ -521,8 +520,8 @@ int actWindowID = (int)GUIWindowManager.ActiveWindow; //--> id finestra attuale GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); dlgMenu.Reset(); - dlgMenu.SetHeading(_menuHeader); //--> titolo menu - dlgMenu.ShowQuickNumbers = _showNumbers; + dlgMenu.SetHeading(_general.MenuHeader); //--> titolo menu + dlgMenu.ShowQuickNumbers = _general.ShowNumbers; //--> visualizzazione numeri voci List<WindowLink> dlgLinks = new List<WindowLink>(); //--> lista links corrispondenti agli elementi di menu foreach (Item item in _items) //Iterazione per valutazione elementi di navigazione impostati @@ -532,11 +531,11 @@ bool first = true; foreach (Item.Destination dst in item.Destinations) //Iterazione di aggiunta destinazioni { - if ((dlgLinks.Find(x => x.WindowID == dst.WindowID && x.LoadParameter == dst.LoadParameter) == null || !_removeDuplicates) && (dst.WindowID != actWindowID || dst.Force)) + if ((dlgLinks.Find(x => x.WindowID == dst.WindowID && x.LoadParameter == dst.LoadParameter) == null || !_general.RemoveDuplicates) && (dst.WindowID != actWindowID || dst.Force)) { //Controllo destinazione duplicata o corrispondente a finestra attuale - if (_showSeparator && first && dlgLinks.Count > 0) //Eventuale inserzione separatore destinazioni + if (_general.ShowSeparator && first && dlgLinks.Count > 0) //Eventuale inserzione separatore destinazioni { - dlgMenu.Add(_separator); + dlgMenu.Add(_general.Separator); dlgLinks.Add(null); } dlgMenu.Add(dst.Caption); //--> aggiunta voce di menu @@ -574,11 +573,7 @@ #endregion #region Proprietà - public string MenuHeader { get { return this._menuHeader; } set { this._menuHeader = value; } } - public bool ShowSeparator { get { return this._showSeparator; } set { this._showSeparator = value; } } - public string Separator { get { return this._separator; } set { this._separator = value; } } - public bool ShowNumbers { get { return this._showNumbers; } set { this._showNumbers = value; } } - public bool RemoveDuplicates { get { return this._removeDuplicates; } set { this._removeDuplicates = value; } } + public GeneralSettings General { get { return this._general; } } public BindingList<Item> Items { get { return this._items; } } #endregion } @@ -599,7 +594,7 @@ SettingsFile = settingsFile; //--> percorso & nome file delle impostazioni _general = new GeneralSettings(); //--> istanziazione impostazioni generali _items = new BindingList<ShortCut>(); //--> istanziazione lista shortcuts - _navigator = new SkinNavigator(); //--> istanziazione Skin Navigator + _navigator = new SkinNavigator(Log); //--> istanziazione Skin Navigator _initialized = false; //--> reset classe inizializzata lastDestination = new WindowLink(); //--> istanziazione ultima destinazione attivata dal plugin @@ -867,7 +862,7 @@ if (sc != null) //Se combinazione di tasti corrispondente a Skin Navigator { sc.Play(); //--> eventuale effetto sonoro - lastDestination.GetData(Navigator.Go(Log)); //--> gestione navigazione alla destinazione selezionata (ed eventuale memorizzazione) + lastDestination.GetData(Navigator.Go()); //--> gestione navigazione alla destinazione selezionata (ed eventuale memorizzazione) } else //Shortcuts normali if (scList.Count == 1) //Shortcut a destinazione singola This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-05-16 13:19:06
|
Revision: 4805 http://sourceforge.net/p/mp-plugins/code/4805 Author: nicsergio Date: 2014-05-16 13:19:01 +0000 (Fri, 16 May 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-12 14:52:42 UTC (rev 4804) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-16 13:19:01 UTC (rev 4805) @@ -508,8 +508,118 @@ #endregion #region Metodi Pubblici + public bool LoadConfig(string settingsFile) //Caricamento configurazione + { + _items.Clear(); //--> pulizia lista elementi di navigazione + FileStream userConfig = null; + try + { + XmlDocument xmlFile = new XmlDocument(); + if (settingsFile.Length>0) + { + userConfig = new FileStream(settingsFile, FileMode.Open, FileAccess.Read); + xmlFile.Load(userConfig); //Lettura file xml delle ultime impostazioni + userConfig.Close(); //--> chiusura file + } + else + using (Stream defaultConfig = Assembly.GetExecutingAssembly().GetManifestResourceStream("ProcessPlugins.ShortCuter.Resources.XmlFiles.DefaultNavigatorConfig.xml")) + { + xmlFile.Load(defaultConfig); //Configurazione predefinita --> lettura file xml incapsulato + } - + + XmlNode innerNode; + XmlNode generalNode = xmlFile.DocumentElement.SelectSingleNode("/ShortCuter/Navigator/General"); + if (generalNode != null) //Se presente sezione "General" + { + innerNode = generalNode.SelectSingleNode("ForcingCapsLock"); + if (innerNode != null) + _general.ForcingCapsLock = (LockKeys.LockKeyActions)Enum.Parse(typeof(LockKeys.LockKeyActions), innerNode.InnerText); + else + { + innerNode = generalNode.SelectSingleNode("ResetCapsLock"); //Necessario per compatibilità con file di configurazione V2.0.5 + if (innerNode != null && Convert.ToBoolean(Convert.ToInt16(innerNode.InnerText))) + _general.ForcingCapsLock = LockKeys.LockKeyActions.Off; + } + innerNode = generalNode.SelectSingleNode("ForcingNumLock"); + if (innerNode != null) + _general.ForcingNumLock = (LockKeys.LockKeyActions)Enum.Parse(typeof(LockKeys.LockKeyActions), innerNode.InnerText); + else + { + innerNode = generalNode.SelectSingleNode("ResetNumLock"); //Necessario per compatibilità con file di configurazione V2.0.5 + if (innerNode != null && Convert.ToBoolean(Convert.ToInt16(innerNode.InnerText))) + _general.ForcingNumLock = LockKeys.LockKeyActions.Off; + } + } + else + return false; //--> altrimenti configurazione non presente + XmlNodeList nodeList = xmlFile.DocumentElement.SelectNodes("/ShortCuter/Items/Item"); + foreach (XmlNode node in nodeList) //Iterazione per memorizzazione impostazioni shortcuts + { + ShortCut sc = new ShortCut(); + innerNode = node.SelectSingleNode("Caption"); + if (innerNode != null) + sc.Caption = innerNode.InnerText; + innerNode = node.SelectSingleNode("Key"); + if (innerNode != null) + sc.Key = innerNode.InnerText; + innerNode = node.SelectSingleNode("Ctrl"); + if (innerNode != null) + sc.Ctrl = Convert.ToBoolean(Convert.ToInt16(innerNode.InnerText)); + innerNode = node.SelectSingleNode("Alt"); + if (innerNode != null) + sc.Alt = Convert.ToBoolean(Convert.ToInt16(innerNode.InnerText)); + innerNode = node.SelectSingleNode("Shift"); + if (innerNode != null) + sc.Shift = Convert.ToBoolean(Convert.ToInt16(innerNode.InnerText)); + innerNode = node.SelectSingleNode("WindowID"); + if (innerNode != null) + sc.WindowID = Convert.ToInt32(innerNode.InnerText); + else + { + innerNode = node.SelectSingleNode("Hyperlink"); //Necessario per compatibilità con file di configurazione V2.0.0 + if (innerNode != null) + sc.WindowID = Convert.ToInt32(innerNode.InnerText); + } + innerNode = node.SelectSingleNode("LoadParameter"); + if (innerNode != null) + sc.LoadParameter = innerNode.InnerText; + else + { + innerNode = node.SelectSingleNode("HyperlinkParameter"); //Necessario per compatibilità con file di configurazione V2.0.0 + 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; + if (sc.IsValid) //Se shortcut valido + _items.Add(sc); //--> aggiunta dello shortcut nella lista + } + if (_items.Count > 0) + return true; //--> lettura configurazione effettuata + else + { + if (defaultSettings && Log != null) //Se nessun shortcut trovato nella configurazione predefinita: emissione messaggio + Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "No shortcuts found loading DefaultConfig.xml.")); + return false; + } + } + catch (Exception e) + { + if (defaultSettings && Log != null) //Se lettura configurazione predefinita fallita: emissione messaggio di errore + Log(this, new LogEventArgs(LogEventArgs.LogLevels.Error, "Error loading DefaultConfig.xml.", e)); + return false; + } + finally + { + if (userConfig != null) + userConfig.Close(); //--> eventuale chiusura oggetto FileStream + } + } public WindowLink Go() //Gestione finestra di dialogo e navigazione alla destinazione selezionata { if (Log != null) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-05-19 09:47:24
|
Revision: 4808 http://sourceforge.net/p/mp-plugins/code/4808 Author: nicsergio Date: 2014-05-19 09:47:21 +0000 (Mon, 19 May 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-18 19:03:47 UTC (rev 4807) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-19 09:47:21 UTC (rev 4808) @@ -494,21 +494,32 @@ #region Dati private GeneralSettings _general; //Impostazioni generali private BindingList<Item> _items; //Lista (con associazione dati) elementi di navigazione - private readonly LogEventHandler Log; #endregion #region Costruttore - public SkinNavigator() : this(null) { } //Costruttore classe SkinNavigator (senza delegato per log) - public SkinNavigator(LogEventHandler LogHandler) //Costruttore classe SkinNavigator + public SkinNavigator() //Costruttore classe SkinNavigator { _general = new GeneralSettings(); //--> istanziazione impostazioni generali _items = new BindingList<Item>(); //--> istanziazione lista elementi di navigazione - Log = LogHandler; //--> assegnazione eventuale delegato per operazioni di log } #endregion #region Metodi Pubblici - //public bool LoadConfig() { return LoadConfig(string.Empty); } //Caricamento configurazione predefinita + public bool LoadDefaults() //Caricamento impostazioni predefinita + { + try + { + XmlDocument xmlFile = new XmlDocument(); + using (Stream defaultConfig = Assembly.GetExecutingAssembly().GetManifestResourceStream("ProcessPlugins.ShortCuter.Resources.XmlFiles.DefaultConfig.xml")) + { + xmlFile.Load(defaultConfig); //Configurazione predefinita --> lettura file xml incapsulato + } + LoadConfig(xmlFile); + } + catch {} + + return true; + } public void LoadConfig(XmlDocument xmlFile) //Caricamento configurazione { _items.Clear(); //--> pulizia lista elementi di navigazione @@ -619,7 +630,8 @@ xmlSettings.WriteEndElement(); xmlSettings.WriteEndElement(); } - public WindowLink Go() //Gestione finestra di dialogo e navigazione alla destinazione selezionata + public WindowLink Go() { return Go(null); } //Gestione finestra di dialogo e navigazione alla destinazione selezionata (senza delegato per log) + public WindowLink Go(LogEventHandler Log) //Gestione finestra di dialogo e navigazione alla destinazione selezionata { if (Log != null) Log(this, new LogEventArgs(LogEventArgs.LogLevels.Info, "Request Skin Navigator dialog menu")); @@ -703,7 +715,7 @@ SettingsFile = settingsFile; //--> percorso & nome file delle impostazioni _general = new GeneralSettings(); //--> istanziazione impostazioni generali _items = new BindingList<ShortCut>(); //--> istanziazione lista shortcuts - _navigator = new SkinNavigator(Log); //--> istanziazione Skin Navigator + _navigator = new SkinNavigator(); //--> istanziazione Skin Navigator _initialized = false; //--> reset classe inizializzata lastDestination = new WindowLink(); //--> istanziazione ultima destinazione attivata dal plugin @@ -976,7 +988,7 @@ if (sc != null) //Se combinazione di tasti corrispondente a Skin Navigator { sc.Play(); //--> eventuale effetto sonoro - lastDestination.GetData(Navigator.Go()); //--> gestione navigazione alla destinazione selezionata (ed eventuale memorizzazione) + lastDestination.GetData(Navigator.Go(Log)); //--> gestione navigazione alla destinazione selezionata (ed eventuale memorizzazione) } else //Shortcuts normali if (scList.Count == 1) //Shortcut a destinazione singola This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-05-19 14:44:50
|
Revision: 4809 http://sourceforge.net/p/mp-plugins/code/4809 Author: nicsergio Date: 2014-05-19 14:44:46 +0000 (Mon, 19 May 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-19 09:47:21 UTC (rev 4808) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-19 14:44:46 UTC (rev 4809) @@ -514,13 +514,14 @@ { xmlFile.Load(defaultConfig); //Configurazione predefinita --> lettura file xml incapsulato } - LoadConfig(xmlFile); + return LoadConfig(ref xmlFile); //--> caricamento configurazione Skin Navigator } - catch {} - - return true; + catch + { + return false; + } } - public void LoadConfig(XmlDocument xmlFile) //Caricamento configurazione + public bool LoadConfig(ref XmlDocument xmlFile) //Caricamento configurazione { _items.Clear(); //--> pulizia lista elementi di navigazione @@ -547,6 +548,8 @@ if (innerNode != null) _general.RemoveDuplicates = Convert.ToBoolean(Convert.ToInt16(innerNode.InnerText)); } + else + return false; //--> impostazioni non caricate (sezione General non presente) XmlNodeList nodeList = navigatorNode.SelectNodes("Items/Item"); foreach (XmlNode node in nodeList) //Iterazione per memorizzazione elementi di navigazione { @@ -587,9 +590,12 @@ } _items.Add(navItem); //--> aggiunta elemento di navigazione } + return (_items.Count > 0); //--> impostazioni caricate (almeno un elemento di navigazione configurato) } + else + return false; //--> impostazioni non caricate (sezione Navigator non presente) } - public void SaveConfig(XmlTextWriter xmlSettings) //Salvataggio configurazione + public void SaveConfig(ref XmlTextWriter xmlSettings) //Salvataggio configurazione { xmlSettings.WriteStartElement("Navigator"); xmlSettings.WriteStartElement("General"); @@ -896,7 +902,8 @@ } if (_items.Count > 0) { - _navigator.LoadConfig(xmlFile); //--> caricamento configurazione Skin Navigator + if (!_navigator.LoadConfig(ref xmlFile) && Log != null) //--> caricamento configurazione Skin Navigator + Log(this, new LogEventArgs(LogEventArgs.LogLevels.Debug, "No Skin Navigator settings found loading configuration.")); return true; //--> lettura configurazione effettuata } else @@ -956,7 +963,7 @@ xmlSettings.WriteEndElement(); xmlSettings.WriteEndElement(); - _navigator.SaveConfig(xmlSettings); //--> salvataggio configurazione Skin Navigator + _navigator.SaveConfig(ref xmlSettings); //--> salvataggio configurazione Skin Navigator xmlSettings.Flush(); xmlSettings.Close(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-05-20 13:03:03
|
Revision: 4811 http://sourceforge.net/p/mp-plugins/code/4811 Author: nicsergio Date: 2014-05-20 13:03:01 +0000 (Tue, 20 May 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-20 05:19:54 UTC (rev 4810) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-20 13:03:01 UTC (rev 4811) @@ -514,14 +514,11 @@ { xmlFile.Load(defaultConfig); //Configurazione predefinita --> lettura file xml incapsulato } - return LoadConfig(ref xmlFile); //--> caricamento configurazione Skin Navigator - } - catch - { - return false; + return LoadConfig(xmlFile); //--> caricamento configurazione Skin Navigator } + catch { return false; } } - public bool LoadConfig(ref XmlDocument xmlFile) //Caricamento configurazione + public bool LoadConfig(XmlDocument xmlFile) //Caricamento configurazione { _items.Clear(); //--> pulizia lista elementi di navigazione @@ -595,7 +592,7 @@ else return false; //--> impostazioni non caricate (sezione Navigator non presente) } - public void SaveConfig(ref XmlTextWriter xmlSettings) //Salvataggio configurazione + public void SaveConfig(XmlTextWriter xmlSettings) //Salvataggio configurazione { xmlSettings.WriteStartElement("Navigator"); xmlSettings.WriteStartElement("General"); @@ -732,33 +729,37 @@ #region Metodi Privati private bool LoadDeprecatedConfig() //Caricamento configurazione obsoleta { - using (Settings confReader = new Settings(SettingsFile)) + try { - const string sectionName = "ShortCuterForm"; - const string capPrefix = "Titel"; - const string keyPrefix = "Key"; - const string widPrefix = "ID"; + using (Settings confReader = new Settings(SettingsFile)) + { + const string sectionName = "ShortCuterForm"; + const string capPrefix = "Titel"; + const string keyPrefix = "Key"; + const string widPrefix = "ID"; - if (!confReader.HasSection<string>(sectionName)) - return false; //--> se sezione non presente: il file non corrisponde + if (!confReader.HasSection<string>(sectionName)) + return false; //--> se sezione non presente: il file non corrisponde - bool ctrl = confReader.GetValueAsBool(sectionName, "ModCtrl", false); //--> utilizzo del modificatore ctrl per tutti gli shortcut - bool shift = confReader.GetValueAsBool(sectionName, "ModShift", false); //--> utilizzo del modificatore shift per tutti gli shortcut + bool ctrl = confReader.GetValueAsBool(sectionName, "ModCtrl", false); //--> utilizzo del modificatore ctrl per tutti gli shortcut + bool shift = confReader.GetValueAsBool(sectionName, "ModShift", false); //--> utilizzo del modificatore shift per tutti gli shortcut - for (int i = 1; i <= 20; i++) //Iterazione di lettura shortcut - { - ShortCut sc = new ShortCut(); - sc.Caption = confReader.GetValueAsString(sectionName, capPrefix + string.Format("{0:00}", i), ""); - sc.Key = confReader.GetValueAsString(sectionName, keyPrefix + string.Format("{0:00}", i), "").ToUpper(); - sc.WindowID = confReader.GetValueAsInt(sectionName, widPrefix + string.Format("{0:00}", i), -1); - sc.Ctrl = ctrl; - sc.Alt = false; - sc.Shift = shift; - if (sc.IsValid) //Se shortcut valido - _items.Add(sc); //--> aggiunta dello shortcut nella lista + for (int i = 1; i <= 20; i++) //Iterazione di lettura shortcut + { + ShortCut sc = new ShortCut(); + sc.Caption = confReader.GetValueAsString(sectionName, capPrefix + string.Format("{0:00}", i), ""); + sc.Key = confReader.GetValueAsString(sectionName, keyPrefix + string.Format("{0:00}", i), "").ToUpper(); + sc.WindowID = confReader.GetValueAsInt(sectionName, widPrefix + string.Format("{0:00}", i), -1); + sc.Ctrl = ctrl; + sc.Alt = false; + sc.Shift = shift; + if (sc.IsValid) //Se shortcut valido + _items.Add(sc); //--> aggiunta dello shortcut nella lista + } + return (_items.Count > 0); } - return (_items.Count > 0); } + catch { return false; } } private List<ShortCut> GetShortCutsGroup(KeyCombination k) //Raccolta lista shortcut associati alla combinazione di tasti { @@ -902,7 +903,7 @@ } if (_items.Count > 0) { - if (!_navigator.LoadConfig(ref xmlFile) && Log != null) //--> caricamento configurazione Skin Navigator + if (!_navigator.LoadConfig(xmlFile) && Log != null) //--> caricamento configurazione Skin Navigator Log(this, new LogEventArgs(LogEventArgs.LogLevels.Debug, "No Skin Navigator settings found loading configuration.")); return true; //--> lettura configurazione effettuata } @@ -961,10 +962,9 @@ xmlSettings.WriteEndElement(); } xmlSettings.WriteEndElement(); + _navigator.SaveConfig(xmlSettings); //--> salvataggio configurazione Skin Navigator xmlSettings.WriteEndElement(); - _navigator.SaveConfig(ref xmlSettings); //--> salvataggio configurazione Skin Navigator - xmlSettings.Flush(); xmlSettings.Close(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-06-23 19:09:30
|
Revision: 4847 http://sourceforge.net/p/mp-plugins/code/4847 Author: nicsergio Date: 2014-06-23 19:09:23 +0000 (Mon, 23 Jun 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-06-21 19:10:40 UTC (rev 4846) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-06-23 19:09:23 UTC (rev 4847) @@ -503,7 +503,7 @@ { if (dst != null) { - GUIListItem lstItem = new GUIListItem(dst.Caption); //--> creazione elemento GUIListItem + GUIListItem lstItem = new GUIListItem(dst.Caption); //--> creazione elemento GUIListItem lstItem.IconImage = dst.Icon; //--> percorso eventuale icona destinazione (visualizzazione lista) lstItem.IconImageBig = dst.Icon; //--> percorso eventuale icona destinazione (visualizzazione pannello) dlg.Add(lstItem); //--> aggiunta elemento nella lista This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-07-01 19:57:00
|
Revision: 4851 http://sourceforge.net/p/mp-plugins/code/4851 Author: nicsergio Date: 2014-07-01 19:56:54 +0000 (Tue, 01 Jul 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-06-29 17:03:06 UTC (rev 4850) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-07-01 19:56:54 UTC (rev 4851) @@ -464,26 +464,20 @@ #region Metodi Privati private Item.Destination ShowMenuDialog(List<Item.Destination> destinations) //Visualizzazione menu di navigazione { - GUIDialogMenu dlg; - NavigatorDialog dlgvv = null; + GUIDialogMenu dlg = null; + NavigatorDialog navDlg = null; bool customDialog = (_general.DialogType != DialogTypes.DefaultDialog && (File.Exists(GUIGraphicsContext.Skin + @"\" + NavigatorDialog.DialogSkinFile) || File.Exists(GUIGraphicsContext.Theme + @"\" + NavigatorDialog.DialogSkinFile))); - if (customDialog) + if (customDialog) //Utilizzo della finestra di dialogo personalizzata { - //Utilizzo della finestra di dialogo personalizzata - NavigatorDialog dlgMenu = (NavigatorDialog)GUIWindowManager.GetWindow(NavigatorDialog.DialogWindowID); - if (dlgMenu != null) - dlgMenu.PanelView = (_general.DialogType == DialogTypes.CustomPanel); //--> eventuale visualizzazione a pannello di icone - dlg = dlgMenu; - dlgvv = dlgMenu; + navDlg = (NavigatorDialog)GUIWindowManager.GetWindow(NavigatorDialog.DialogWindowID); + if (navDlg != null) + navDlg.PanelView = (_general.DialogType == DialogTypes.CustomPanel); //--> eventuale visualizzazione a pannello di icone + dlg = navDlg; //--> accesso con metodi della classe base } - else - { - //Utilizzo della finestra di dialogo predefinita - GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); - dlg = dlgMenu; - } + else //Utilizzo della finestra di dialogo predefinita + dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) //--> finestra di dialogo non agganciata throw new NullReferenceException(String.Format("Dialog menu window reference is null! (ID:{0})", (customDialog ? NavigatorDialog.DialogWindowID : (int)GUIWindow.Window.WINDOW_DIALOG_MENU))); @@ -498,59 +492,28 @@ } dlg.ShowQuickNumbers = _general.ShowNumbers; //--> visualizzazione numeri per accesso diretto - - - for (int i = 0; i < destinations.Count; i++) //Iterazione di lettura shortcut + + for (int i = 0; i < destinations.Count; i++) //Iterazione per popolamento lista { if (destinations[i] != null) { - GUIListItem lstItem = new GUIListItem(destinations[i].Caption); //--> creazione elemento GUIListItem - lstItem.IconImage = destinations[i].Icon; //--> percorso eventuale icona destinazione (visualizzazione lista) - lstItem.IconImageBig = destinations[i].Icon; //--> percorso eventuale icona destinazione (visualizzazione pannello) + GUIListItem lstItem = new GUIListItem(destinations[i].Caption); //--> creazione elemento GUIListItem + lstItem.IconImage = destinations[i].Icon; //--> percorso eventuale icona destinazione (visualizzazione lista) + lstItem.IconImageBig = destinations[i].Icon; //--> percorso eventuale icona destinazione (visualizzazione pannello) dlg.Add(lstItem); //--> aggiunta elemento nella lista } else //--> se destinazione nulla: aggiunta separatore { - dlg.ShowQuickNumbers = false; + dlg.ShowQuickNumbers = false; //--> numero per accesso diretto non visualizzato con separatore if (_general.DialogType == DialogTypes.CustomPanel) - { - for (int ii = 0; ((i + ii) % dlgvv.PanelRowIcons) != 0; ii++) - { - dlg.Add(string.Empty); - } - } + for (int ii = 0; ((i + ii) % navDlg.PanelRowIcons) != 0; ii++) + dlg.Add(string.Empty); //--> nel caso di pannello: aggiunta elementi vuoti fino a forzare una nuova riga else - dlg.Add(string.Empty); + dlg.Add(string.Empty); //--> nel caso di lista: aggiunta stringa vuota dlg.ShowQuickNumbers = _general.ShowNumbers; } - - } - - //foreach (Item.Destination dst in destinations) //Iterazione per popolamento lista - //{ - // if (dst != null) - // { - // GUIListItem lstItem = new GUIListItem(dst.Caption); //--> creazione elemento GUIListItem - // lstItem.IconImage = dst.Icon; //--> percorso eventuale icona destinazione (visualizzazione lista) - // lstItem.IconImageBig = dst.Icon; //--> percorso eventuale icona destinazione (visualizzazione pannello) - // dlg.Add(lstItem); //--> aggiunta elemento nella lista - // } - // else //--> se destinazione nulla: aggiunta separatore - // { - // dlg.ShowQuickNumbers = false; - // if (_general.DialogType == DialogTypes.CustomPanel) - // { - // dlgvv.PanelRowIcons - // - // - // } - // else - // dlg.Add(string.Empty); - // dlg.ShowQuickNumbers = _general.ShowNumbers; - // } - //} dlg.DoModal(GUIWindowManager.ActiveWindow); //--> visualizzazione menu if (dlg.SelectedLabel >= 0 && dlg.SelectedLabel < destinations.Count) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-07-04 14:55:35
|
Revision: 4852 http://sourceforge.net/p/mp-plugins/code/4852 Author: nicsergio Date: 2014-07-04 14:55:28 +0000 (Fri, 04 Jul 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-07-01 19:56:54 UTC (rev 4851) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-07-04 14:55:28 UTC (rev 4852) @@ -505,12 +505,18 @@ else //--> se destinazione nulla: aggiunta separatore { dlg.ShowQuickNumbers = false; //--> numero per accesso diretto non visualizzato con separatore - if (_general.DialogType == DialogTypes.CustomPanel) - for (int ii = 0; ((i + ii) % navDlg.PanelRowIcons) != 0; ii++) - dlg.Add(string.Empty); //--> nel caso di pannello: aggiunta elementi vuoti fino a forzare una nuova riga + if (_general.DialogType == DialogTypes.CustomPanel) //--> nel caso di pannello: aggiunta elementi vuoti fino a forzare una nuova riga + { + destinations.RemoveAt(i); //--> rimozione preventiva elemento nullo (separatore) nella lista destinazioni + for (int ii = 0; ((i + ii) % navDlg.PanelRowIcons) != 0; ii++) //Iterazione di aggiunta elementi vuoti per forzare una nuova riga + { + dlg.Add(string.Empty); //--> aggiunta riquadro vuoto + destinations.Insert(i, null); //--> inserimento elemento nullo per mantenere sincronizzati gli indici delle destinazioni con gli elementi selezionabili + } + } else dlg.Add(string.Empty); //--> nel caso di lista: aggiunta stringa vuota - dlg.ShowQuickNumbers = _general.ShowNumbers; + dlg.ShowQuickNumbers = _general.ShowNumbers; //--> ripristino della visualizzazione numeri per accesso diretto } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2014-07-07 14:40:50
|
Revision: 4853 http://sourceforge.net/p/mp-plugins/code/4853 Author: nicsergio Date: 2014-07-07 14:40:44 +0000 (Mon, 07 Jul 2014) Log Message: ----------- Modified Paths: -------------- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs =================================================================== --- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-07-04 14:55:28 UTC (rev 4852) +++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-07-07 14:40:44 UTC (rev 4853) @@ -508,10 +508,12 @@ if (_general.DialogType == DialogTypes.CustomPanel) //--> nel caso di pannello: aggiunta elementi vuoti fino a forzare una nuova riga { destinations.RemoveAt(i); //--> rimozione preventiva elemento nullo (separatore) nella lista destinazioni - for (int ii = 0; ((i + ii) % navDlg.PanelRowIcons) != 0; ii++) //Iterazione di aggiunta elementi vuoti per forzare una nuova riga + i--; //--> adeguamento indice per rimozione elemento + for (int ii = 0; ((i + 1 + ii) % navDlg.PanelRowIcons) != 0; ii++) //Iterazione di aggiunta elementi vuoti per forzare una nuova riga { dlg.Add(string.Empty); //--> aggiunta riquadro vuoto destinations.Insert(i, null); //--> inserimento elemento nullo per mantenere sincronizzati gli indici delle destinazioni con gli elementi selezionabili + i++; //--> adeguemento indice per inserimento elemento } } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |