From: <lk...@us...> - 2007-08-08 09:28:26
|
Revision: 810 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=810&view=rev Author: lkuech Date: 2007-08-08 02:28:23 -0700 (Wed, 08 Aug 2007) Log Message: ----------- Initial Upload Added Paths: ----------- trunk/plugins/ViewModeSwitcher/IconDisabled.GIF trunk/plugins/ViewModeSwitcher/IconDisabled.png trunk/plugins/ViewModeSwitcher/IconEnabled.GIF trunk/plugins/ViewModeSwitcher/IconEnabled.png trunk/plugins/ViewModeSwitcher/PlugInBase.cs trunk/plugins/ViewModeSwitcher/Properties/ trunk/plugins/ViewModeSwitcher/Properties/AssemblyInfo.cs trunk/plugins/ViewModeSwitcher/Rule.cs trunk/plugins/ViewModeSwitcher/Settings.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelper.sln trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelper.suo trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/Properties/ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/Properties/AssemblyInfo.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ViewModeSwitcherHelper.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ViewModeSwitcherHelper.sln trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ViewModeSwitcherHelper.suo trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ViewModeSwitcherHelperTVE2.csproj trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/Properties/ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/Properties/AssemblyInfo.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelper.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelper.sln trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelper.suo trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelperTVE3.csproj trunk/plugins/ViewModeSwitcher/ViewModeSwitcherRuleDetail.Designer.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherRuleDetail.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherRuleDetail.resx Added: trunk/plugins/ViewModeSwitcher/IconDisabled.GIF =================================================================== (Binary files differ) Property changes on: trunk/plugins/ViewModeSwitcher/IconDisabled.GIF ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/ViewModeSwitcher/IconDisabled.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/ViewModeSwitcher/IconDisabled.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/ViewModeSwitcher/IconEnabled.GIF =================================================================== (Binary files differ) Property changes on: trunk/plugins/ViewModeSwitcher/IconEnabled.GIF ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/ViewModeSwitcher/IconEnabled.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/ViewModeSwitcher/IconEnabled.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/ViewModeSwitcher/PlugInBase.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/PlugInBase.cs (rev 0) +++ trunk/plugins/ViewModeSwitcher/PlugInBase.cs 2007-08-08 09:28:23 UTC (rev 810) @@ -0,0 +1,83 @@ +/* Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +using System; +using System.Collections.Generic; +using System.Text; +using MediaPortal.GUI.Library; +using MediaPortal.Configuration; + +namespace ProcessPlugins.ViewModeSwitcher +{ + [PluginIcons("IconEnabled.GIF", "IconDisabled.GIF")] + public abstract class PlugInBase : IPlugin, ISetupForm + { + public abstract void Stop(); + public abstract void Start(); + + public string PluginName() + { + return "ViewModeSwitcher"; + } + + public string Description() + { + return "Switches to a predefined viewmode depending on the aspect ratio of the source format. It also allows crop settings dependig on the source format."; + } + + public string Author() + { + return "LKuech"; + } + + public void ShowPlugin() + { + ViewModeSwitcherConfig form = new ViewModeSwitcherConfig(); + form.ShowDialog(); + } + + public int GetWindowId() + { + return 4711667; + } + + public bool CanEnable() + { + return true; + } + + public bool DefaultEnabled() + { + return false; + } + + public bool HasSetup() + { + return true; + } + + public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) + { + strButtonText = null; strButtonImage = null; strButtonImageFocus = null; strPictureImage = null; + + return false; + } + } +} Added: trunk/plugins/ViewModeSwitcher/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/Properties/AssemblyInfo.cs (rev 0) +++ trunk/plugins/ViewModeSwitcher/Properties/AssemblyInfo.cs 2007-08-08 09:28:23 UTC (rev 810) @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +[assembly: AssemblyTitle("ViewModeSwitcher process plugin for MediaPortal")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ViewModeSwitcher")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("80d659b8-9c9c-40fd-b6dd-b878db9fc0d1")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Revisions- und Buildnummern +// übernehmen, indem Sie "*" eingeben: +[assembly: AssemblyVersion("0.3.0.0")] +[assembly: AssemblyFileVersion("0.3.0.0")] Added: trunk/plugins/ViewModeSwitcher/Rule.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/Rule.cs (rev 0) +++ trunk/plugins/ViewModeSwitcher/Rule.cs 2007-08-08 09:28:23 UTC (rev 810) @@ -0,0 +1,52 @@ +/* Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +using System; +using System.Collections.Generic; +using System.Text; +using MediaPortal.GUI.Library; + +namespace ProcessPlugins.ViewModeSwitcher +{ + public class Rule + { + public bool Enabled = true; + public string Name = "new rule"; + public float ARFrom = 0; + public float ARTo = 0; + public int MinWidth = 0; + public int MaxWidth = 9999; + public int MinHeight = 0; + public int MaxHeight = 9999; + public bool ChangeAR = true; + public Geometry.Type ViewMode = Geometry.Type.Normal; + public bool ChangeOs = true; + public int OverScan = 0; + public bool EnableLBDetection = false; + public int VerticalOffSetZoom = 0; + public int VerticalOffSet14_9 = 0; + public int VerticalOffSetWide14_9 = 0; + } + + public class RuleSet : List<Rule> + { + } + +} Added: trunk/plugins/ViewModeSwitcher/Settings.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/Settings.cs (rev 0) +++ trunk/plugins/ViewModeSwitcher/Settings.cs 2007-08-08 09:28:23 UTC (rev 810) @@ -0,0 +1,229 @@ +/* Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +using System; +using System.Collections.Generic; +using System.Text; +using MediaPortal.Configuration; +using MediaPortal.GUI.Library; + +namespace ProcessPlugins.ViewModeSwitcher +{ + public class ViewModeswitcherSettings + { + public RuleSet ViewModeRules = new RuleSet(); + public bool verboseLog = false; + public bool ShowSwitchMsg = false; + public bool SuppressInitialMsg = false; + public bool DisableLBGlobaly = false; + public int LBCheckInterval = 3000; + public bool UpperBoxEnabled = true; + public int UpperBoxWidth = 25; + public int UpperBoxHeight = 8; + public int UpperBoxStartPos = 1; + public int CenterBoxWidth = 25; + public int CenterBoxHeight = 8; + public bool LowerBoxEnabled = true; + public int LowerBoxWidth = 25; + public int LowerBoxHeight = 8; + public int LowerBoxStartPos = 92; + public float LBBlackLevel = 0.10f; + public int LBDetectionCount = 1; + public bool LBOverScanEnabled = false; + public int LBOberScan = 0; + public int VerticalOffSetZoom = 0; + public int VerticalOffSet14_9 = 0; + public int VerticalOffSetWide14_9 = 0; + + // parameter names + public static string ViewModeSwitcherSectionName = "ViewModeSwitcher"; + string ParmVerboselog = "parmverboselog"; + string ParmRuleCount = "parmrulecount"; + string ParmRulePrefix = "parmrule"; + string ParmShowSwitchMsg = "parmshowswitchmsg"; + string ParmSuppressInitalMsg = "parmsuppressinitialmsg"; + string ParmDisableLBGlobaly = "parmdisablelbglobaly"; + string ParmLBCheckInterval = "parmlbcheckinterval"; + string ParmUpBoxEnabled = "parmupboxenabled"; + string ParmUpBoxWidth = "parmupboxwidth"; + string ParmUpBoxHeight = "parmupboxheight"; + string ParmUpBoxStart = "parmupboxstart"; + string ParmCentBoxWidth = "parmcentboxwidth"; + string ParmCentBoxHeight = "parmcentboxheight"; + string ParmLowBoxEnabled = "parmlowboxenabled"; + string ParmLowBoxWidth = "parmlowboxwidth"; + string ParmLowBoxHeight = "parmlowboxheight"; + string ParmLowBoxStart = "parmlowboxstart"; + string ParmBlackLevel = "parmblacklevel"; + string ParmLBDetectionCount = "parmlbdetectioncount"; + string ParmLBOverScanEnabled = "parmlboverscanenabled"; + string ParmLBOverScan = "parmlboverscan"; + string ParmVOffsetZoom = "parmvoffsetzoom"; + string ParmVOffset14_9 = "parmvoffset149"; + string ParmVOffsetWide14_9 = "parmvoffsetwide149"; + public static string ParmTVChannelPrefix = "parmtvchannelprefix"; + + /// <summary> + /// load settings from MediaPortal configuration + /// </summary> + /// <returns></returns> + public bool LoadSettings() + { + using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + bool tmpReturn = false; + ViewModeRules.Clear(); + int tmpRuleCount = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmRuleCount, 0); + for (int i = 1; i <= tmpRuleCount; i++) + { + Rule tmpRule = new Rule(); + tmpRule.Enabled = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "Enabled", false); + if (tmpRule.Enabled) tmpReturn = true; + tmpRule.Name = reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "Name", "noname"); + tmpRule.ARFrom = (float)Convert.ToDouble(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ARFrom", "0")); + tmpRule.ARTo = (float)Convert.ToDouble(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ARTo", "0")); + tmpRule.MinWidth = Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "MinWidth", "0")); + tmpRule.MaxWidth = Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "MaxWidth", "0")); + tmpRule.MinHeight = Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "MinHeight", "0")); + tmpRule.MaxHeight = Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "MaxHeight", "0")); + tmpRule.ChangeAR = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ChangeAR", true); + String tmpViewMode = reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ViewMode", "Normal"); + + switch (tmpViewMode) + { + case "Zoom": tmpRule.ViewMode = Geometry.Type.Zoom; + break; + case "Normal": tmpRule.ViewMode = Geometry.Type.Normal; + break; + case "Stretch": tmpRule.ViewMode = Geometry.Type.Stretch; + break; + case "Original": tmpRule.ViewMode = Geometry.Type.Original; + break; + case "LetterBox43": tmpRule.ViewMode = Geometry.Type.LetterBox43; + break; + case "PanScan43": tmpRule.ViewMode = Geometry.Type.PanScan43; + break; + case "Zoom14to9": tmpRule.ViewMode = Geometry.Type.Zoom14to9; + break; + } + tmpRule.ChangeOs = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ChangeOS", true); + tmpRule.OverScan = Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "Overscan", "0")); + tmpRule.EnableLBDetection = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "EnableLBDetection", false); + + tmpRule.VerticalOffSetZoom = Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "VerticalOffSetZoom", "0")); + tmpRule.VerticalOffSet14_9 = Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "VerticalOffSet14_9", "0")); + tmpRule.VerticalOffSetWide14_9 = Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "VerticalOffSetWide14_9", "0")); + + ViewModeRules.Add(tmpRule); + } + verboseLog = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmVerboselog, false); + ShowSwitchMsg = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmShowSwitchMsg, false); + SuppressInitialMsg = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmSuppressInitalMsg, false); + + DisableLBGlobaly = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmDisableLBGlobaly, false); + LBCheckInterval = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmLBCheckInterval, 3000); + + UpperBoxEnabled = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmUpBoxEnabled, true); + UpperBoxWidth = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmUpBoxWidth, 25); + UpperBoxHeight = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmUpBoxHeight, 8); + UpperBoxStartPos = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmUpBoxStart, 1); + + CenterBoxWidth = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmCentBoxWidth, 35); + CenterBoxHeight = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmCentBoxHeight, 10); + + LowerBoxEnabled = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmLowBoxEnabled, false); + LowerBoxWidth = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmLowBoxWidth, 25); + LowerBoxHeight = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmLowBoxHeight, 8); + LowerBoxStartPos = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmLowBoxStart, 92); + + LBBlackLevel = (float)Convert.ToDouble(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmBlackLevel, ((float).10f).ToString() )); + LBDetectionCount = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmLBDetectionCount, 1); + LBOverScanEnabled = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmLBOverScanEnabled, false); + LBOberScan = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmLBOverScan, 0); + + VerticalOffSetZoom = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmVOffsetZoom, 0); + VerticalOffSet14_9= reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmVOffset14_9, 0); + VerticalOffSetWide14_9 = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmVOffsetWide14_9, 0); + + return tmpReturn; + } + } + + public void SaveSettings() + { + using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmVerboselog, verboseLog); + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmShowSwitchMsg, ShowSwitchMsg); + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmSuppressInitalMsg, SuppressInitialMsg); + // write ruleset + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRuleCount, ViewModeRules.Count.ToString()); + + for (int i = 1; i <= ViewModeRules.Count; i++) + { + Rule tmpRule = new Rule(); + tmpRule = ViewModeRules[i - 1]; + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "Enabled", tmpRule.Enabled); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "Name", tmpRule.Name); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ARFrom", tmpRule.ARFrom.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ARTo", tmpRule.ARTo.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "MinWidth", tmpRule.MinWidth.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "MaxWidth", tmpRule.MaxWidth.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "MinHeight", tmpRule.MinHeight.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "MaxHeight", tmpRule.MaxHeight.ToString()); + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ChangeAR", tmpRule.ChangeAR); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ViewMode", tmpRule.ViewMode.ToString()); + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ChangeOS", tmpRule.ChangeOs); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "Overscan", tmpRule.OverScan.ToString()); + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "EnableLBDetection", tmpRule.EnableLBDetection); + + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "VerticalOffSetZoom", tmpRule.VerticalOffSetZoom.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "VerticalOffSet14_9", tmpRule.VerticalOffSet14_9.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "VerticalOffSetWide14_9", tmpRule.VerticalOffSetWide14_9.ToString()); + } + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmDisableLBGlobaly, DisableLBGlobaly); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmLBCheckInterval, LBCheckInterval.ToString()); + + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmUpBoxEnabled, UpperBoxEnabled); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmUpBoxWidth, UpperBoxWidth.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmUpBoxHeight, UpperBoxHeight.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmUpBoxStart, UpperBoxStartPos.ToString()); + + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmCentBoxWidth, CenterBoxWidth.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmCentBoxHeight, CenterBoxHeight.ToString()); + + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmLowBoxEnabled, LowerBoxEnabled); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmLowBoxWidth, LowerBoxWidth.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmLowBoxHeight, LowerBoxHeight.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmLowBoxStart, LowerBoxStartPos.ToString()); + + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmBlackLevel, LBBlackLevel.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmLBDetectionCount, LBDetectionCount.ToString()); + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmLBOverScanEnabled, LBOverScanEnabled); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmLBOverScan, LBOberScan.ToString()); + + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmVOffsetZoom, VerticalOffSetZoom.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmVOffset14_9, VerticalOffSet14_9.ToString()); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmVOffsetWide14_9, VerticalOffSetWide14_9.ToString()); + } + } + + } +} Added: trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs (rev 0) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2007-08-08 09:28:23 UTC (rev 810) @@ -0,0 +1,1047 @@ +/* Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; +using MediaPortal.GUI.Library; +using MediaPortal.Configuration; +using MediaPortal.Util; +using MediaPortal.Player; +using MediaPortal.Dialogs; +using MediaPortal.TV.Recording; +using System.Threading; +using System.Diagnostics; +using System.Drawing; +using ViewModeSwitcherHelper; + +namespace ProcessPlugins.ViewModeSwitcher +{ + public delegate bool IsPlaying(); + public delegate bool getPlayBackJustStarted(); + public delegate bool getPlayBackJustEnded(); + public delegate float getLastSwitchedAspectRatio(); + public delegate void ProcessRules(float AspectRatio, int width, int height); + public delegate bool IsLetterbox(); + + public class ViewModeSwitcher : ProcessPlugins.ViewModeSwitcher.PlugInBase + { + ViewModeswitcherSettings currentSettings = new ViewModeswitcherSettings(); + + private static ViewModeSwitcher instance; + private AutoResetEvent workerEvent = new AutoResetEvent(false); + private bool stopWorkerThread = false; + private bool PlaybackJustStarted = false; // used in worker to differ between waiting for a playback or sleeping after it + private bool PlaybackJustEnded = false; // used in worker to differ between waiting for a playback or sleeping after it + private float LastSwitchedAspectRatio = 0f; // stores the last automatically set ratio. + private MediaPortal.FrameGrabber grabber = MediaPortal.FrameGrabber.GetInstance(); + private int LastLetterBoxDetectionTime = System.Environment.TickCount; + private bool LastLetterboxDetectionResult = false; + private bool LetterboxActive = false; + private bool ViewModeSwitcherEnabled = true; + private int LBDetections = 0; + private int currentOverScan = 0; + private Geometry.Type curZoomMode; + private string curTVChannelName = ""; + private System.ComponentModel.BackgroundWorker backgroundMenuWorker; + private bool MenuShown = false; + private int CurrentRule = -1; + private int RecentGuiWindowID = 0; + + enum MoveDirection + { + UP, + Down + } + + /// <summary> + /// starts the process plugin + /// </summary> + public override void Start() + { + Log.Debug("ViewModeSwitcher: Start()"); + ViewModeSwitcher.instance = this; + + if (!currentSettings.LoadSettings()) + { + Log.Info("ViewModeSwitcher: No enabled rule found. Process stopped!"); + return; + } + + // start the thread that will execute ratio switch + Thread t = new Thread(new ThreadStart(instance.Worker)); + t.IsBackground = true; + t.Priority = ThreadPriority.BelowNormal; + t.Name = "ViewModeSwitcherThread"; + t.Start(); + + // register to handle playback events so we can wake + // the above thread when playback starts + Recorder.OnTvViewingStarted += new Recorder.OnTvViewHandler(OnTVStarted); + Recorder.OnTvViewingStopped += new Recorder.OnTvViewHandler(OnTVStopped); + //Recorder.OnTvChannelChanged += new Recorder.OnTvChannelChangeHandler(OnTVChannelChange); + + g_Player.PlayBackStarted += new g_Player.StartedHandler(OnVideoStarted); + g_Player.PlayBackEnded += new g_Player.EndedHandler(OnVideoEnded); + g_Player.PlayBackStopped += new g_Player.StoppedHandler(OnVideoStopped); + + GUIGraphicsContext.OnNewAction += new OnActionHandler(OnAction); + + } + + public void OnAction(Action action) + { + switch (action.wID) + { + case Action.ActionType.ACTION_VIEWMODESWITCHER_MENU: + { + ShowMenu(); + } + break; + case Action.ActionType.ACTION_VIEWMODESWITCHER_DOWN: + { + MoveVisibleWindow(MoveDirection.Down); + } + break; + case Action.ActionType.ACTION_VIEWMODESWITCHER_UP: + { + MoveVisibleWindow(MoveDirection.UP); + } + break; + } + } + + + public void ShowMenu_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) + { + if (MenuShown) return; + MenuShown = true; + RecentGuiWindowID = GUIWindowManager.ActiveWindow; + + #region MainMenu + + string tmpChannel = curTVChannelName; + Geometry.Type tmpAR = GUIGraphicsContext.ARType; + + GUIDialogMenu Menu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); + bool tmpSpecialTVChannelState = false; + + Menu.Reset(); + Menu.SetHeading("ViewModeSwitcher Settings"); + + Menu.Add("ViewModeSwitcher enabled : " + ViewModeSwitcherEnabled.ToString()); + Menu.Add("Letterbox detection: " + (!currentSettings.DisableLBGlobaly).ToString()); + Menu.Add("Set Letterbox detection interval"); + Menu.Add("Set Letterbox detection count"); + + if (curTVChannelName != "" && (tmpAR == Geometry.Type.Zoom || tmpAR == Geometry.Type.Zoom14to9 || tmpAR == Geometry.Type.LetterBox43)) + if (!IsCurrentChannelViewSpecial()) + { + Menu.Add("Create a special \"" + tmpAR.ToString() + "\" offset for this channel (" + tmpChannel + ")"); + tmpSpecialTVChannelState = true; + } + else + { + Menu.Add("Delete the special \"" + tmpAR.ToString() + "\" offset for this channel (" + tmpChannel + ")"); + tmpSpecialTVChannelState = false; + } + + Menu.DoModal(GUIWindowManager.ActiveWindow); + + #endregion + + if (Menu.SelectedLabel == -1) + return; + switch (Menu.SelectedLabel) + { + case 0: + { + ViewModeSwitcherEnabled = !ViewModeSwitcherEnabled; + } + break; + case 1: + { + currentSettings.DisableLBGlobaly = !currentSettings.DisableLBGlobaly; + } + break; + case 2: + { + #region LB interval menu + + Menu.Reset(); + Menu.SetHeading("Set letterbox detection interval"); + + for (int i = 500; i < 20000; i += 500) + { + Menu.Add(i.ToString() + " ms"); + } + Menu.SelectedLabel = ((int)(currentSettings.LBCheckInterval / 500)-1); + + Menu.DoModal(GUIWindowManager.ActiveWindow); + + if (Menu.SelectedLabel == -1) + break; + currentSettings.LBCheckInterval = 500 * (Menu.SelectedLabel + 1); + + #endregion + } + break; + case 3: + { + #region LB count menu + + Menu.Reset(); + Menu.SetHeading("Set letterbox detection count"); + + for (int i = 1; i <= 10; i++) + { + Menu.Add(""); + } + Menu.SelectedLabel = currentSettings.LBDetectionCount-1; + + Menu.DoModal(GUIWindowManager.ActiveWindow); + + if (Menu.SelectedLabel == -1) + break; + currentSettings.LBDetectionCount = (Menu.SelectedLabel + 1); + + #endregion + } + break; + case 4: + { + #region SpecialTVChannel menu entry + if (tmpSpecialTVChannelState) + { + int tmpOffset; + + switch (tmpAR) + { + case Geometry.Type.Zoom: tmpOffset = currentSettings.VerticalOffSetZoom; + break; + case Geometry.Type.Zoom14to9: tmpOffset = currentSettings.VerticalOffSet14_9; + break; + case Geometry.Type.LetterBox43: tmpOffset = currentSettings.VerticalOffSetWide14_9; + break; + default: return; + } + + SetSpecialChannelOffset(tmpChannel, tmpAR, tmpOffset); + } + else + { + RemoveSpecialChannelOffset(tmpChannel, tmpAR); + } + #endregion + } + break; + } + + } + + private void ShowMenu_WorkCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) + { + backgroundMenuWorker.Dispose(); + if (RecentGuiWindowID != 0) GUIWindowManager.RouteToWindow(RecentGuiWindowID); + MenuShown = false; + } + + private void ShowMenu() + { + + if (!MenuShown) + { + //load menu in different thread (as it requires the UI thread, and dialogs steal the UI thread when modal) + backgroundMenuWorker = new System.ComponentModel.BackgroundWorker(); + backgroundMenuWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(ShowMenu_DoWork); + backgroundMenuWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(ShowMenu_WorkCompleted); + backgroundMenuWorker.RunWorkerAsync(); + } + + } + + /// <summary> + /// stops the process plugin + /// </summary> + public override void Stop() + { + stopWorkerThread = true; + Log.Debug("ViewModeSwitcher: Stop()"); + currentSettings.SaveSettings(); + } + + public void ResetWorkerPlaybackValues() + { + LastSwitchedAspectRatio = 0f; + PlaybackJustStarted = true; + PlaybackJustEnded = false; + //LetterboxActive = false; + LastLetterboxDetectionResult = false; + LBDetections = 0; + } + + /// <summary> + /// Handles the recorder.OnTvChannelChangeHandler event + /// </summary> + public void OnTVChannelChange(string tvChannelName) + { + if (currentSettings.verboseLog) Log.Info("ViewModeSwitcher: OnTVChannelChange... Reseting rule processing!"); + LastSwitchedAspectRatio = 0f; + LastLetterboxDetectionResult = false; + LBDetections = 0; + } + + /// <summary> + /// Handles the recorder.OnTVStarted event + /// </summary> + public void OnTVStarted(int j, TVCaptureDevice dev) + { + if (currentSettings.verboseLog) Log.Debug("ViewModeSwitcher: OnTVStarted"); + ResetWorkerPlaybackValues(); + if (ViewModeSwitcherEnabled) workerEvent.Set(); + } + + /// <summary> + /// Handles the recorder.OnTVStopped event + /// </summary> + public void OnTVStopped(int j, TVCaptureDevice dev) + { + if (currentSettings.verboseLog) Log.Debug("ViewModeSwitcher: OnTVStopped"); + LastSwitchedAspectRatio = 0f; + PlaybackJustEnded = true; + } + + /// <summary> + /// Handles the g_Player.PlayBackStarted event + /// </summary> + public void OnVideoStarted(g_Player.MediaType type, string s) + { + // do not handle e.g. visualization window, last.fm player, etc + if (type == g_Player.MediaType.Music) + return; + + if (currentSettings.verboseLog) Log.Debug("ViewModeSwitcher: On Video Started"); + + ResetWorkerPlaybackValues(); + + if (ViewModeSwitcherEnabled) workerEvent.Set(); + } + + /// <summary> + /// Handles the g_Player.PlayBackEnded event + /// </summary> + /// <param name="type"></param> + /// <param name="s"></param> + public void OnVideoEnded(g_Player.MediaType type, string s) + { + // do not handle e.g. visualization window, last.fm player, etc + if (type == g_Player.MediaType.Music) + return; + + if (currentSettings.verboseLog) Log.Debug("ViewModeSwitcher: On Video Ended"); + LastSwitchedAspectRatio = 0f; + PlaybackJustEnded = true; + } + + /// <summary> + /// Handles the g_Player.PlayBackStopped event + /// </summary> + /// <param name="type"></param> + /// <param name="i"></param> + /// <param name="s"></param> + public void OnVideoStopped(g_Player.MediaType type, int i, string s) + { + // do not handle e.g. visualization window, last.fm player, etc + if (type == g_Player.MediaType.Music) + return; + + if (currentSettings.verboseLog) Log.Debug("ViewModeSwitcher: On Video Stopped"); + LastSwitchedAspectRatio = 0f; + PlaybackJustEnded = true; + } + + + /// <summary> + /// Used for checking whether there is any purpose to change the aspect ratio + /// </summary> + /// <returns></returns> + private bool IsPlaying() + { + return g_Player.Playing || MediaPortal.TV.Recording.Recorder.IsViewing(); + } + + + /// <summary> + /// checks if a defined rule is fitting the current media + /// </summary> + /// <param name="width">the width of the media</param> + /// <param name="height">the height of the media</param> + /// <returns>the index of the fitting rule, or -1 if no rule fits</returns> + public int GetAffectedRuleIndex(float AspectRatio, int width, int height) + { + for(int i=0; i< currentSettings.ViewModeRules.Count; i++) + { + Rule tmpRule = new Rule(); + tmpRule = currentSettings.ViewModeRules[i]; + + if (tmpRule.Enabled + && AspectRatio >= tmpRule.ARFrom + && AspectRatio <= tmpRule.ARTo + && width >= tmpRule.MinWidth + && width <= tmpRule.MaxWidth + && height >= tmpRule.MinHeight + && height <= tmpRule.MaxHeight) + { + return i; + } + } + return -1; + } + + /// <summary> + /// checks if a rule is fitting and executes it + /// </summary> + /// <param name="AspectRatio">Aspect ratio</param> + /// <param name="width">video width</param> + /// <param name="height">video height</param> + public void ProcessRules(float AspectRatio, int width, int height) + { + CurrentRule = -1; + for (int i = 0; i < currentSettings.ViewModeRules.Count; i++) + { + Rule tmpRule = new Rule(); + tmpRule = currentSettings.ViewModeRules[i]; + + if (tmpRule.Enabled + && AspectRatio >= tmpRule.ARFrom + && AspectRatio <= tmpRule.ARTo + && width >= tmpRule.MinWidth + && width <= tmpRule.MaxWidth + && height >= tmpRule.MinHeight + && height <= tmpRule.MaxHeight) + { + if (AspectRatio != LastSwitchedAspectRatio) + { + Log.Info("Rule \"" + tmpRule.Name + "\" fits conditions."); + if (tmpRule.ChangeOs) + { + CropSettings tmpCropSettings = new CropSettings(tmpRule.OverScan, tmpRule.OverScan, (int)(tmpRule.OverScan * AspectRatio), (int)(tmpRule.OverScan * AspectRatio)); + SetCropMode(tmpCropSettings); + } + + if (tmpRule.ChangeAR) + { + SetAspectRatio(tmpRule.Name, tmpRule.ViewMode); + LastSwitchedAspectRatio = AspectRatio; + } + } + else if (!currentSettings.DisableLBGlobaly && tmpRule.EnableLBDetection && IsLetterbox()) + { + if (!LetterboxActive) + { + Log.Info("Letterbox detected! Switching to \"Zoom\" mode"); + if (currentSettings.LBOverScanEnabled) + { + CropSettings tmpCropSettings = new CropSettings(currentSettings.LBOberScan, currentSettings.LBOberScan, (int)(currentSettings.LBOberScan * AspectRatio), (int)(currentSettings.LBOberScan * AspectRatio)); + SetCropMode(tmpCropSettings); + } + SetAspectRatio("Letterbox detected!", Geometry.Type.Zoom); + LastSwitchedAspectRatio = AspectRatio; + LetterboxActive = true; + } + } + else if (LetterboxActive) + { + Log.Info("Letterbox is gone! Reseting rule processing"); + LastSwitchedAspectRatio = 0f; // make sure rules getting processed again + LetterboxActive = false; + continue; + } + CurrentRule = i; + break; // do not process any additional rule after a rule fits (better for offset function) + } + } + + } + + /// <summary> + /// Checks if the currently playing file is a letterbox file + /// </summary> + /// <returns>true if letterbox</returns> + private bool IsLetterbox() + { + if ((LastLetterBoxDetectionTime + currentSettings.LBCheckInterval) > System.Environment.TickCount) // if it is too sone for a new detection, return with the previos result + { + return LastLetterboxDetectionResult; + } + + if (currentSettings.verboseLog) Log.Info("Letterbox detection started"); + Bitmap frame = grabber.GetCurrentImage(); // grab a frame from the player + + if (frame == null) + { + if (currentSettings.verboseLog) Log.Error ("Framegrabber delivers null!"); + return LastLetterboxDetectionResult; + } + + // analyse the two boxes + bool tmpCenterBoxNearlyBlack = IsCenterBoxNearlyBlack(frame); + bool tmpOuterBoxesNearlyBlack = AreOuterBoxesNearlyBlack(frame); + LastLetterBoxDetectionTime = System.Environment.TickCount; + + if (!tmpCenterBoxNearlyBlack && tmpOuterBoxesNearlyBlack) // say yes if the center box has content and the others don't + { + if (LBDetections < 0) + { + LBDetections = 0; // reset detection count + if (currentSettings.verboseLog) Log.Info("Letterbox detection count was reseted to 0"); + } + + LBDetections += 1; + if (LBDetections > currentSettings.LBDetectionCount) LBDetections = currentSettings.LBDetectionCount; // let LBDetections not getting bigger than required + + if (currentSettings.verboseLog) Log.Info("Letterbox detection count is {0} of maximal {1} allowed", LBDetections, currentSettings.LBDetectionCount); + + if (LBDetections == currentSettings.LBDetectionCount) + { + LastLetterboxDetectionResult = true; + if (currentSettings.verboseLog) Log.Info("Letterbox detection ended - Result: True"); + return true; + } + else + { + if (currentSettings.verboseLog) Log.Info("Letterbox detection ended - with the previous result: " + LastLetterboxDetectionResult.ToString()); + return LastLetterboxDetectionResult; // else return the last result + } + } + else if (!tmpCenterBoxNearlyBlack && !tmpOuterBoxesNearlyBlack) // say no if all boxes have content + { + if (LBDetections > 0) + { + LBDetections = 0; // reset detection count + if (currentSettings.verboseLog) Log.Info("Letterbox detection count was reseted to 0"); + } + + LBDetections -= 1; + if (LBDetections < (currentSettings.LBDetectionCount * -1)) LBDetections = (currentSettings.LBDetectionCount * -1); // let LBDetections not getting smaller than required + + if (currentSettings.verboseLog) Log.Info("Letterbox detection count is {0} of maximal {1} allowed", LBDetections, (currentSettings.LBDetectionCount * -1)); + + if (LBDetections == (currentSettings.LBDetectionCount * -1)) + { + LastLetterboxDetectionResult = false; + if (currentSettings.verboseLog) Log.Info("Letterbox detection ended - Result: False"); + return false; + } + else + { + if (currentSettings.verboseLog) Log.Info("Letterbox detection ended - with the previous result: " + LastLetterboxDetectionResult.ToString()); + return LastLetterboxDetectionResult; // else return the last result + } + } + else + { + if (currentSettings.verboseLog) Log.Info("Letterbox detection ended - with the previous result: " + LastLetterboxDetectionResult.ToString()); + return LastLetterboxDetectionResult; // else return the last result + } + } + + private bool AreOuterBoxesNearlyBlack(Bitmap frame) + { + bool tmpResult = true; + + if (currentSettings.UpperBoxEnabled) tmpResult = IsUpperBoxNearlyBlack(frame); + + if (currentSettings.LowerBoxEnabled) + { + bool lowerResult = IsLowerBoxNearlyBlack(frame); + tmpResult = tmpResult && lowerResult; + } + + if (!currentSettings.UpperBoxEnabled && !currentSettings.LowerBoxEnabled) tmpResult = false; + + return tmpResult; + } + + /// <summary> + /// analyses the upper box of a given frame + /// </summary> + /// <param name="frame">the frame to analyse as bitmap</param> + /// <returns></returns> + private bool IsUpperBoxNearlyBlack(Bitmap frame) + { + float UpperAnalyseRectWidthBase = currentSettings.UpperBoxWidth; + float UpperAnalyseRectHeightBase = currentSettings.UpperBoxHeight; + float UpperAnalyseRectStartBase = currentSettings.UpperBoxStartPos; + + UpperAnalyseRectWidthBase /= 100; + UpperAnalyseRectHeightBase /= 100; + UpperAnalyseRectStartBase /= 100; + + int tmpX = (int)((frame.Width - (frame.Width * UpperAnalyseRectWidthBase)) / 2); + int tmpY = (int)(frame.Height * UpperAnalyseRectStartBase); // skip the first lines (may contain teletect and other cr...) + int tmpWidth = (int)(frame.Width * UpperAnalyseRectWidthBase); + int tmpHeight = (int)(frame.Height * UpperAnalyseRectHeightBase); + + Rectangle tmpUpperRect = new Rectangle(tmpX, tmpY, tmpWidth, tmpHeight); + + bool tmpResult = IsNearlyBlack(frame, tmpUpperRect); + if (currentSettings.verboseLog) Log.Info("Upper box is nearly black: " + tmpResult.ToString()); + return tmpResult; + } + + /// <summary> + /// analyses the lower box of a given frame + /// </summary> + /// <param name="frame">the frame to analyse as bitmap</param> + /// <returns></returns> + private bool IsLowerBoxNearlyBlack(Bitmap frame) + { + float LowerAnalyseRectWidthBase = currentSettings.LowerBoxWidth; + float LowerAnalyseRectHeightBase = currentSettings.LowerBoxHeight; + float LowerAnalyseRectStartBase = currentSettings.LowerBoxStartPos; + + LowerAnalyseRectWidthBase /= 100; + LowerAnalyseRectHeightBase /= 100; + LowerAnalyseRectStartBase /= 100; + + int tmpX = (int)((frame.Width - (frame.Width * LowerAnalyseRectWidthBase)) / 2); + int tmpY = (int)(frame.Height * LowerAnalyseRectStartBase); // skip the first lines (may contain teletect and other cr...) + int tmpWidth = (int)(frame.Width * LowerAnalyseRectWidthBase); + int tmpHeight = (int)(frame.Height * LowerAnalyseRectHeightBase); + + Rectangle tmpLowerRect = new Rectangle(tmpX, tmpY, tmpWidth, tmpHeight); + + bool tmpResult = IsNearlyBlack(frame, tmpLowerRect); + if (currentSettings.verboseLog) Log.Info("Lower box is nearly black: " + tmpResult.ToString()); + return tmpResult; + } + + /// <summary> + /// analyses the center box of a given frame + /// </summary> + /// <param name="frame">the frame to analyse as bitmap</param> + /// <returns></returns> + private bool IsCenterBoxNearlyBlack(Bitmap frame) + { + float CenterAnalyseRectWidthBase = currentSettings.CenterBoxWidth; + float CenterAnalyseRectHeightBase = currentSettings.CenterBoxHeight; + + CenterAnalyseRectWidthBase /= 100; + CenterAnalyseRectHeightBase /= 100; + + int tmpX = (int)((frame.Width - (frame.Width * CenterAnalyseRectWidthBase)) / 2); + int tmpY = (int)((frame.Height - (frame.Height * CenterAnalyseRectHeightBase)) / 2); + int tmpWidth = (int)(frame.Width * CenterAnalyseRectWidthBase); + int tmpHeight = (int)(frame.Height * CenterAnalyseRectHeightBase); + + Rectangle tmpCenterRect = new Rectangle(tmpX, tmpY, tmpWidth, tmpHeight); + + bool tmpResult = IsNearlyBlack(frame, tmpCenterRect); + if (currentSettings.verboseLog) Log.Info("Center box is nearly black: " + tmpResult.ToString()); + return tmpResult; + + } + + /// <summary> + /// Checks if the content of a given rectangle is nearly black + /// </summary> + /// <param name="frame">the frame to analyse as bitmap</param> + /// <param name="AnalyseRect">the rectangle to analyse</param> + /// <returns>true if nearly black</returns> + private bool IsNearlyBlack(Bitmap frame, Rectangle AnalyseRect) + { + float brightestColor = 0; + for (int y = AnalyseRect.Top; y < AnalyseRect.Bottom; y++) + { + for (int x = AnalyseRect.Left; x < AnalyseRect.Right; x++) + { + Color c = frame.GetPixel(x, y); + if (c.GetBrightness() > brightestColor) brightestColor = c.GetBrightness(); + } + } + + if(currentSettings.verboseLog) Log.Info("BrightesColor in box ( {0}, {1}, {2}, {3} ) is {4}", AnalyseRect.Left, AnalyseRect.Top, AnalyseRect.Width, AnalyseRect.Height, brightestColor); + + if (brightestColor <= currentSettings.LBBlackLevel) + { + return true; + } + else + { + return false; + } + } + + /// <summary> + /// Changes the aspect ratio of MediaPortal + /// </summary> + /// <param name="MessageString">Message text of the switch message</param> + /// <param name="AR">the aspect ratio to switch to</param> + private void SetAspectRatio(string MessageString, Geometry.Type AR) + { + Log.Info("Switching to viewmode: " + AR.ToString()); + GUIGraphicsContext.ARType = AR; + LastLetterBoxDetectionTime = System.Environment.TickCount; + + if (currentSettings.ShowSwitchMsg) + { + if (!(currentSettings.SuppressInitialMsg && getPlayBackJustStarted())) + { + GUIDialogNotify SwitchMsg = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); + SwitchMsg.SetHeading("ViewModeSwitcher"); + SwitchMsg.SetText(MessageString + " > " + AR.ToString()); + SwitchMsg.TimeOut = 2; + SwitchMsg.DoModal(GUIWindowManager.ActiveWindow); + } + } + + } + + /// <summary> + /// set the oversan of MediaPortal by setting crop parameters + /// </summary> + private void SetCropMode(CropSettings crops) + { + Log.Info("Using overscan: " + crops.Top.ToString()); + currentOverScan = crops.Top; + CropSettings newCropSettings = new CropSettings(); + newCropSettings = crops; + + MediaPortal.GUI.Library.GUIMessage msg = new GUIMessage(); + msg.Message = GUIMessage.MessageType.GUI_MSG_PLANESCENE_CROP; + msg.Object = newCropSettings; + GUIWindowManager.SendMessage(msg); + } + + /// <summary> + /// delegated access for the worker + /// </summary> + private bool getPlayBackJustStarted() + { + return PlaybackJustStarted; + } + + /// <summary> + /// delegated access for the worker + /// </summary> + private bool getPlayBackJustEnded() + { + return PlaybackJustEnded; + } + + /// <summary> + /// delegated access for the worker + /// </summary> + private float getLastSwitchedAspectRatio() + { + return LastSwitchedAspectRatio; + } + + /// <summary> + /// This method runs in a thread and calculates the aspect ratio + /// checks if a rule is affected + /// </summary> + private void Worker() + { + bool PlayingMediaDetected = new bool(); + + while (true) + { + if (currentSettings.verboseLog) Log.Debug("IsPlaying : " + IsPlaying() + " PlayingMediaDetected: " + PlayingMediaDetected.ToString() + " PlayBackJustStarted: " + PlaybackJustStarted.ToString() + " PlaybackStopped: " + PlaybackJustEnded.ToString()); + if (stopWorkerThread) + { + stopWorkerThread = false; + PlayingMediaDetected = false; + workerEvent.WaitOne(); + return; + } + if (ViewModeSwitcherEnabled && IsPlaying()) + { + if (!PlaybackJustEnded) + { + PlayingMediaDetected = true; + // calculate the current aspect ratio + if (VMR9Util.g_vmr9 != null) + { + float ARCalc = (float)VMR9Util.g_vmr9.VideoAspectRatioX / (float)VMR9Util.g_vmr9.VideoAspectRatioY; + + if (currentSettings.verboseLog) + { + Log.Debug("VideoAspectRatioX " + VMR9Util.g_vmr9.VideoAspectRatioX.ToString()); + Log.Debug("VideoAspectRatioY " + VMR9Util.g_vmr9.VideoAspectRatioY.ToString()); + Log.Debug("VideoWidth " + g_Player.Width.ToString()); + Log.Debug("VideoHeight " + g_Player.Height.ToString()); + //Log.Info("TV Client Channel: {0}",Recorder.GetTVChannelName()); + //Log.Info("TV Plugin Channel: {0}", TVstatusWrapper.GetChannelName()); + } + + if (currentSettings.verboseLog) Log.Debug("AR:" + g_Player.ARType + " AR Calc: " + ARCalc.ToString()); + if (!g_Player.Paused) + { + ProcessRules(ARCalc, g_Player.Width, g_Player.Height); // check if a rule fits the conditions and process it + } + //else Thread.Sleep(2500); + + // Do something after the rules have been scanned + if (curZoomMode != GUIGraphicsContext.ARType) + { + curZoomMode = GUIGraphicsContext.ARType; + if (currentSettings.verboseLog) Log.Info("The viewmode has been change to {0}", curZoomMode); + SetZoomModeOffset(curZoomMode); + } + + if (TVstatusWrapper.IsViewingTV()) + { + string tmpChannelName = TVstatusWrapper.GetChannelName(); + if (curTVChannelName != tmpChannelName) + { + curTVChannelName = tmpChannelName; + if (currentSettings.verboseLog) Log.Info("The TV channel is now: {0}", curTVChannelName); + + LastSwitchedAspectRatio = 0f; + LastLetterboxDetectionResult = false; + LBDetections = 0; + + if (IsCurrentChannelViewSpecial()) + { + if (currentSettings.verboseLog) Log.Info("There is a special offset defined for {0} and {1}",curTVChannelName,GUIGraphicsContext.ARType); + SetVisibleWindowPos(GetSpecialChannelOffset(curTVChannelName, GUIGraphicsContext.ARType)); + } + } + } + else curTVChannelName = ""; + } + PlaybackJustStarted = false; + Thread.Sleep(500); + } + else Thread.Sleep(1000); + } + else + { + + if (PlayingMediaDetected) + { + PlayingMediaDetected = false; + PlaybackJustEnded = false; + LastSwitchedAspectRatio = 0f; + if (currentSettings.verboseLog) Log.Info("Worker halting, waiting for next event"); + + workerEvent.WaitOne(); // reset automatically + } + else + { + Thread.Sleep(1000); + if (!PlaybackJustStarted) workerEvent.WaitOne(); // reset automatically + } + } + } + } + + /// <summary> + /// Changes the values of the zoom mode offsets + /// </summary> + private void MoveVisibleWindow(MoveDirection direction) + { + int tmpOffset; + bool isSpecialTV = IsCurrentChannelViewSpecial(); + + if (isSpecialTV) + { + tmpOffset = GetSpecialChannelOffset(curTVChannelName, GUIGraphicsContext.ARType); + } + else + { + if (CurrentRule == -1) + { + switch (GUIGraphicsContext.ARType) + { + case Geometry.Type.Zoom: tmpOffset = currentSettings.VerticalOffSetZoom; + break; + case Geometry.Type.Zoom14to9: tmpOffset = currentSettings.VerticalOffSet14_9; + break; + case Geometry.Type.LetterBox43: tmpOffset = currentSettings.VerticalOffSetWide14_9; + break; + default: return; + } + } + else + { + switch (GUIGraphicsContext.ARType) + { + case Geometry.Type.Zoom: tmpOffset = currentSettings.ViewModeRules[CurrentRule].VerticalOffSetZoom; + break; + case Geometry.Type.Zoom14to9: tmpOffset = currentSettings.ViewModeRules[CurrentRule].VerticalOffSet14_9; + break; + case Geometry.Type.LetterBox43: tmpOffset = currentSettings.ViewModeRules[CurrentRule].VerticalOffSetWide14_9; + break; + default: return; + } + } + } + + if (direction == MoveDirection.Down) tmpOffset -= 1; + else tmpOffset += 1; + + Rectangle tmpSourceRect = new Rectangle(); + Rectangle tmpDestRect = new Rectangle(); + + VMR9Util.g_vmr9.GetVideoWindows(out tmpSourceRect, out tmpDestRect); + + if (tmpOffset < ( (tmpSourceRect.Y - currentOverScan) * -1)) tmpOffset = ( (tmpSourceRect.Y-currentOverScan) * -1); + if (tmpOffset > tmpSourceRect.Y) tmpOffset = tmpSourceRect.Y; + //if (tmpOffset > -5 && tmpOffset < 5) tmpOffset = 0; + + SetVisibleWindowPos(tmpOffset); + + if (isSpecialTV) + { + SetSpecialChannelOffset(curTVChannelName, GUIGraphicsContext.ARType, tmpOffset); + } + else + { + if (CurrentRule == -1) + { + switch (GUIGraphicsContext.ARType) + { + case Geometry.Type.Zoom: currentSettings.VerticalOffSetZoom = tmpOffset; + break; + case Geometry.Type.Zoom14to9: currentSettings.VerticalOffSet14_9 = tmpOffset; + break; + case Geometry.Type.LetterBox43: currentSettings.VerticalOffSetWide14_9 = tmpOffset; + break; + } + } + else + { + switch (GUIGraphicsContext.ARType) + { + case Geometry.Type.Zoom: currentSettings.ViewModeRules[CurrentRule].VerticalOffSetZoom = tmpOffset; + break; + case Geometry.Type.Zoom14to9: currentSettings.ViewModeRules[CurrentRule].VerticalOffSet14_9 = tmpOffset; + break; + case Geometry.Type.LetterBox43: currentSettings.ViewModeRules[CurrentRule].VerticalOffSetWide14_9 = tmpOffset; + break; + } + } + } + } + + /// <summary> + /// Set the offset of the currently visible window + /// </summary> + private void SetVisibleWindowPos(int offset) + { + if (VMR9Util.g_vmr9 == null) return; + + if (currentSettings.verboseLog) L... [truncated message content] |
From: <lk...@us...> - 2007-08-22 11:31:56
|
Revision: 854 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=854&view=rev Author: lkuech Date: 2007-08-22 04:31:52 -0700 (Wed, 22 Aug 2007) Log Message: ----------- On the way to v0.3. Implementatio of a FallbackRule! Modified Paths: -------------- trunk/plugins/ViewModeSwitcher/PlugInBase.cs trunk/plugins/ViewModeSwitcher/Settings.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelper.suo trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/Properties/AssemblyInfo.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ViewModeSwitcherHelper.suo trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ViewModeSwitcherHelperTVE2.csproj trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/Properties/AssemblyInfo.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelper.sln trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelper.suo trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelperTVE3.csproj trunk/plugins/ViewModeSwitcher/ViewModeSwitcherRuleDetail.cs Modified: trunk/plugins/ViewModeSwitcher/PlugInBase.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/PlugInBase.cs 2007-08-22 05:26:54 UTC (rev 853) +++ trunk/plugins/ViewModeSwitcher/PlugInBase.cs 2007-08-22 11:31:52 UTC (rev 854) @@ -55,7 +55,7 @@ public int GetWindowId() { - return 4711667; + return -1; } public bool CanEnable() Modified: trunk/plugins/ViewModeSwitcher/Settings.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/Settings.cs 2007-08-22 05:26:54 UTC (rev 853) +++ trunk/plugins/ViewModeSwitcher/Settings.cs 2007-08-22 11:31:52 UTC (rev 854) @@ -32,6 +32,8 @@ public bool verboseLog = false; public bool ShowSwitchMsg = false; public bool SuppressInitialMsg = false; + public bool UseFallbackRule = false; + public Geometry.Type FallBackViewMode = Geometry.Type.Normal; public bool DisableLBGlobaly = false; public int LBCheckInterval = 3000; public bool UpperBoxEnabled = true; @@ -59,6 +61,8 @@ string ParmRulePrefix = "parmrule"; string ParmShowSwitchMsg = "parmshowswitchmsg"; string ParmSuppressInitalMsg = "parmsuppressinitialmsg"; + string ParmUseFallbackRule = "parmusefallbackrule"; + string ParmFallbackViewMode = "parmfallbackviewmode"; string ParmDisableLBGlobaly = "parmdisablelbglobaly"; string ParmLBCheckInterval = "parmlbcheckinterval"; string ParmUpBoxEnabled = "parmupboxenabled"; @@ -79,7 +83,31 @@ string ParmVOffset14_9 = "parmvoffset149"; string ParmVOffsetWide14_9 = "parmvoffsetwide149"; public static string ParmTVChannelPrefix = "parmtvchannelprefix"; - + + public static Geometry.Type StringToViewMode(string strViewmode) + { + Geometry.Type ret = Geometry.Type.Normal; + + switch (strViewmode) + { + case "Zoom": ret = Geometry.Type.Zoom; + break; + case "Normal": ret = Geometry.Type.Normal; + break; + case "Stretch": ret = Geometry.Type.Stretch; + break; + case "Original": ret = Geometry.Type.Original; + break; + case "LetterBox43": ret = Geometry.Type.LetterBox43; + break; + case "PanScan43": ret = Geometry.Type.PanScan43; + break; + case "Zoom14to9": ret = Geometry.Type.Zoom14to9; + break; + } + return ret; + } + /// <summary> /// load settings from MediaPortal configuration /// </summary> @@ -105,24 +133,7 @@ tmpRule.MaxHeight = Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "MaxHeight", "0")); tmpRule.ChangeAR = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ChangeAR", true); String tmpViewMode = reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ViewMode", "Normal"); - - switch (tmpViewMode) - { - case "Zoom": tmpRule.ViewMode = Geometry.Type.Zoom; - break; - case "Normal": tmpRule.ViewMode = Geometry.Type.Normal; - break; - case "Stretch": tmpRule.ViewMode = Geometry.Type.Stretch; - break; - case "Original": tmpRule.ViewMode = Geometry.Type.Original; - break; - case "LetterBox43": tmpRule.ViewMode = Geometry.Type.LetterBox43; - break; - case "PanScan43": tmpRule.ViewMode = Geometry.Type.PanScan43; - break; - case "Zoom14to9": tmpRule.ViewMode = Geometry.Type.Zoom14to9; - break; - } + tmpRule.ViewMode = StringToViewMode(tmpViewMode); tmpRule.ChangeOs = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "ChangeOS", true); tmpRule.OverScan = Convert.ToInt16(reader.GetValueAsString(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "Overscan", "0")); tmpRule.EnableLBDetection = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmRulePrefix + i.ToString() + "EnableLBDetection", false); @@ -136,6 +147,9 @@ verboseLog = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmVerboselog, false); ShowSwitchMsg = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmShowSwitchMsg, false); SuppressInitialMsg = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmSuppressInitalMsg, false); + UseFallbackRule = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmUseFallbackRule, false); + String tmpFallbackViewMode = reader.GetValueAsString(ViewModeSwitcherSectionName, ParmFallbackViewMode, "Normal"); + FallBackViewMode = StringToViewMode(tmpFallbackViewMode); DisableLBGlobaly = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmDisableLBGlobaly, false); LBCheckInterval = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmLBCheckInterval, 3000); @@ -173,6 +187,9 @@ xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmVerboselog, verboseLog); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmShowSwitchMsg, ShowSwitchMsg); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmSuppressInitalMsg, SuppressInitialMsg); + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmUseFallbackRule, UseFallbackRule); + xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmFallbackViewMode, FallBackViewMode.ToString()); + // write ruleset xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmRuleCount, ViewModeRules.Count.ToString()); Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2007-08-22 05:26:54 UTC (rev 853) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2007-08-22 11:31:52 UTC (rev 854) @@ -134,7 +134,8 @@ { if (MenuShown) return; MenuShown = true; - RecentGuiWindowID = GUIWindowManager.ActiveWindow; + //RecentGuiWindowID = GUIWindowManager.RoutedWindow; + //Debug.WriteLine("Rooted: " + RecentGuiWindowID.ToString()); #region MainMenu @@ -168,6 +169,8 @@ #endregion + //Debug.WriteLine("After MainMenu: " + GUIWindowManager.RoutedWindow); + if (Menu.SelectedLabel == -1) return; switch (Menu.SelectedLabel) @@ -260,7 +263,7 @@ private void ShowMenu_WorkCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { backgroundMenuWorker.Dispose(); - if (RecentGuiWindowID != 0) GUIWindowManager.RouteToWindow(RecentGuiWindowID); + //if (RecentGuiWindowID != 0) GUIWindowManager.RouteToWindow(RecentGuiWindowID); MenuShown = false; } @@ -438,6 +441,7 @@ && height >= tmpRule.MinHeight && height <= tmpRule.MaxHeight) { + CurrentRule = i; if (AspectRatio != LastSwitchedAspectRatio) { Log.Info("Rule \"" + tmpRule.Name + "\" fits conditions."); @@ -475,11 +479,47 @@ LetterboxActive = false; continue; } - CurrentRule = i; + break; // do not process any additional rule after a rule fits (better for offset function) } } + //process the fallback rule if no other rule has fitted + if (currentSettings.UseFallbackRule && CurrentRule == -1 && height != 100 && width != 100) + { + Log.Info("Processing the fallback rule!"); + if (AspectRatio != LastSwitchedAspectRatio) + { + CropSettings tmpCropSettings = new CropSettings(0, 0, 0, 0); + SetCropMode(tmpCropSettings); + SetAspectRatio("Fallback rule", currentSettings.FallBackViewMode); + LastSwitchedAspectRatio = AspectRatio; + } + } + + // Do something after the rules have been scanned + if (curZoomMode != GUIGraphicsContext.ARType) + { + curZoomMode = GUIGraphicsContext.ARType; + if (currentSettings.verboseLog) Log.Info("The viewmode has been change to {0}", curZoomMode); + SetZoomModeOffset(curZoomMode); + } + + if (TVstatusWrapper.IsViewingTV()) + { + string tmpChannelName = TVstatusWrapper.GetChannelName(); + if (curTVChannelName != tmpChannelName) + { + curTVChannelName = tmpChannelName; + if (currentSettings.verboseLog) Log.Info("The TV channel is now: {0}", curTVChannelName); + + LastSwitchedAspectRatio = 0f; + LastLetterboxDetectionResult = false; + LBDetections = 0; + } + } + else curTVChannelName = ""; + } /// <summary> @@ -730,6 +770,7 @@ msg.Message = GUIMessage.MessageType.GUI_MSG_PLANESCENE_CROP; msg.Object = newCropSettings; GUIWindowManager.SendMessage(msg); + } /// <summary> @@ -799,36 +840,8 @@ { ProcessRules(ARCalc, g_Player.Width, g_Player.Height); // check if a rule fits the conditions and process it } - //else Thread.Sleep(2500); + else Thread.Sleep(2500); - // Do something after the rules have been scanned - if (curZoomMode != GUIGraphicsContext.ARType) - { - curZoomMode = GUIGraphicsContext.ARType; - if (currentSettings.verboseLog) Log.Info("The viewmode has been change to {0}", curZoomMode); - SetZoomModeOffset(curZoomMode); - } - - if (TVstatusWrapper.IsViewingTV()) - { - string tmpChannelName = TVstatusWrapper.GetChannelName(); - if (curTVChannelName != tmpChannelName) - { - curTVChannelName = tmpChannelName; - if (currentSettings.verboseLog) Log.Info("The TV channel is now: {0}", curTVChannelName); - - LastSwitchedAspectRatio = 0f; - LastLetterboxDetectionResult = false; - LBDetections = 0; - - if (IsCurrentChannelViewSpecial()) - { - if (currentSettings.verboseLog) Log.Info("There is a special offset defined for {0} and {1}",curTVChannelName,GUIGraphicsContext.ARType); - SetVisibleWindowPos(GetSpecialChannelOffset(curTVChannelName, GUIGraphicsContext.ARType)); - } - } - } - else curTVChannelName = ""; } PlaybackJustStarted = false; Thread.Sleep(500); @@ -999,8 +1012,13 @@ } } - if (!(LetterboxActive && currentSettings.LBOverScanEnabled && zoomMode == Geometry.Type.Zoom) ) + if (IsCurrentChannelViewSpecial()) { + if (currentSettings.verboseLog) Log.Info("There is a special offset defined for {0} and {1}", curTVChannelName, zoomMode); + tmpOffset = GetSpecialChannelOffset(curTVChannelName, zoomMode); + } + else if(!(LetterboxActive && currentSettings.LBOverScanEnabled && zoomMode == Geometry.Type.Zoom) ) + { if (currentSettings.verboseLog) Log.Info("The offset for zoom mode {0} is {1}", zoomMode, tmpOffset); SetVisibleWindowPos(tmpOffset); } Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs 2007-08-22 05:26:54 UTC (rev 853) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs 2007-08-22 11:31:52 UTC (rev 854) @@ -57,6 +57,19 @@ this.bDelete = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.dg_RuleSets = new System.Windows.Forms.DataGridView(); + this.ColEnabled = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.ColRuleName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColARFrom = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColARTo = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColMinWidth = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColMaxWidth = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColMinHeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColMaxHeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColChangeAR = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColViewMode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColChangeOS = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColOverscan = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColEnableLBDetect = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.bCancel = new System.Windows.Forms.Button(); this.cbVerboseLog = new System.Windows.Forms.CheckBox(); this.linkLabelForum = new System.Windows.Forms.LinkLabel(); @@ -97,19 +110,8 @@ this.label16 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); this.label19 = new System.Windows.Forms.Label(); - this.ColEnabled = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.ColRuleName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColARFrom = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColARTo = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColMinWidth = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColMaxWidth = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColMinHeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColMaxHeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColChangeAR = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColViewMode = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColChangeOS = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColOverscan = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColEnableLBDetect = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.cbUseFallbackRule = new System.Windows.Forms.CheckBox(); + this.cmbViewMode = new System.Windows.Forms.ComboBox(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dg_RuleSets)).BeginInit(); this.groupBox2.SuspendLayout(); @@ -119,7 +121,7 @@ // bOK // this.bOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bOK.Location = new System.Drawing.Point(738, 435); + this.bOK.Location = new System.Drawing.Point(738, 452); this.bOK.Name = "bOK"; this.bOK.Size = new System.Drawing.Size(44, 23); this.bOK.TabIndex = 1; @@ -131,6 +133,8 @@ // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.cmbViewMode); + this.groupBox1.Controls.Add(this.cbUseFallbackRule); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.cbSuppressInitialMsg); this.groupBox1.Controls.Add(this.cbShowSwitchMsg); @@ -140,7 +144,7 @@ this.groupBox1.Controls.Add(this.dg_RuleSets); this.groupBox1.Location = new System.Drawing.Point(12, 35); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(770, 243); + this.groupBox1.Size = new System.Drawing.Size(770, 273); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; // @@ -149,7 +153,7 @@ this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label1.AutoSize = true; this.label1.ForeColor = System.Drawing.Color.Red; - this.label1.Location = new System.Drawing.Point(3, 219); + this.label1.Location = new System.Drawing.Point(3, 249); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(568, 13); this.label1.TabIndex = 7; @@ -237,10 +241,114 @@ this.dg_RuleSets.Size = new System.Drawing.Size(758, 150); this.dg_RuleSets.TabIndex = 0; // + // ColEnabled + // + this.ColEnabled.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColEnabled.HeaderText = "Enabled"; + this.ColEnabled.Name = "ColEnabled"; + this.ColEnabled.ReadOnly = true; + this.ColEnabled.Width = 52; + // + // ColRuleName + // + this.ColRuleName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColRuleName.HeaderText = "Name"; + this.ColRuleName.Name = "ColRuleName"; + this.ColRuleName.ReadOnly = true; + this.ColRuleName.Width = 60; + // + // ColARFrom + // + this.ColARFrom.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColARFrom.HeaderText = "AR From"; + this.ColARFrom.Name = "ColARFrom"; + this.ColARFrom.ReadOnly = true; + this.ColARFrom.Width = 73; + // + // ColARTo + // + this.ColARTo.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColARTo.HeaderText = "AR To"; + this.ColARTo.Name = "ColARTo"; + this.ColARTo.ReadOnly = true; + this.ColARTo.Width = 63; + // + // ColMinWidth + // + this.ColMinWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColMinWidth.HeaderText = "MinWidth"; + this.ColMinWidth.Name = "ColMinWidth"; + this.ColMinWidth.ReadOnly = true; + this.ColMinWidth.Width = 77; + // + // ColMaxWidth + // + this.ColMaxWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColMaxWidth.HeaderText = "MaxWidth"; + this.ColMaxWidth.Name = "ColMaxWidth"; + this.ColMaxWidth.ReadOnly = true; + this.ColMaxWidth.Width = 80; + // + // ColMinHeight + // + this.ColMinHeight.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColMinHeight.HeaderText = "MinHeight"; + this.ColMinHeight.Name = "ColMinHeight"; + this.ColMinHeight.ReadOnly = true; + this.ColMinHeight.Width = 80; + // + // ColMaxHeight + // + this.ColMaxHeight.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColMaxHeight.HeaderText = "MaxHeight"; + this.ColMaxHeight.Name = "ColMaxHeight"; + this.ColMaxHeight.ReadOnly = true; + this.ColMaxHeight.Width = 83; + // + // ColChangeAR + // + this.ColChangeAR.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColChangeAR.HeaderText = "ChangeAR"; + this.ColChangeAR.Name = "ColChangeAR"; + this.ColChangeAR.ReadOnly = true; + this.ColChangeAR.Width = 84; + // + // ColViewMode + // + this.ColViewMode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColViewMode.HeaderText = "ViewMode"; + this.ColViewMode.Name = "ColViewMode"; + this.ColViewMode.ReadOnly = true; + this.ColViewMode.Width = 82; + // + // ColChangeOS + // + this.ColChangeOS.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColChangeOS.HeaderText = "ChangeOS"; + this.ColChangeOS.Name = "ColChangeOS"; + this.ColChangeOS.ReadOnly = true; + this.ColChangeOS.Width = 84; + // + // ColOverscan + // + this.ColOverscan.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColOverscan.HeaderText = "Overscan"; + this.ColOverscan.Name = "ColOverscan"; + this.ColOverscan.ReadOnly = true; + this.ColOverscan.Width = 78; + // + // ColEnableLBDetect + // + this.ColEnableLBDetect.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.ColEnableLBDetect.HeaderText = "LB Detection"; + this.ColEnableLBDetect.Name = "ColEnableLBDetect"; + this.ColEnableLBDetect.ReadOnly = true; + this.ColEnableLBDetect.Width = 94; + // // bCancel // this.bCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bCancel.Location = new System.Drawing.Point(682, 435); + this.bCancel.Location = new System.Drawing.Point(682, 452); this.bCancel.Name = "bCancel"; this.bCancel.Size = new System.Drawing.Size(50, 23); this.bCancel.TabIndex = 0; @@ -303,7 +411,7 @@ this.groupBox2.Controls.Add(this.label9); this.groupBox2.Controls.Add(this.label8); this.groupBox2.Controls.Add(this.cbLBOverScan); - this.groupBox2.Location = new System.Drawing.Point(12, 294); + this.groupBox2.Location = new System.Drawing.Point(12, 314); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(770, 133); this.groupBox2.TabIndex = 8; @@ -613,7 +721,7 @@ // this.label16.AutoSize = true; this.label16.ForeColor = System.Drawing.Color.Red; - this.label16.Location = new System.Drawing.Point(27, 432); + this.label16.Location = new System.Drawing.Point(27, 452); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(177, 13); this.label16.TabIndex = 32; @@ -623,7 +731,7 @@ // this.label17.AutoSize = true; this.label17.ForeColor = System.Drawing.Color.Red; - this.label17.Location = new System.Drawing.Point(27, 448); + this.label17.Location = new System.Drawing.Point(27, 468); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(73, 13); this.label17.TabIndex = 33; @@ -634,121 +742,38 @@ this.label19.AutoSize = true; this.label19.Font = new System.Drawing.Font("Microsoft Sans Serif", 28F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label19.ForeColor = System.Drawing.Color.Red; - this.label19.Location = new System.Drawing.Point(10, 424); + this.label19.Location = new System.Drawing.Point(10, 444); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(32, 44); this.label19.TabIndex = 34; this.label19.Text = "!"; // - // ColEnabled + // cbUseFallbackRule // - this.ColEnabled.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColEnabled.HeaderText = "Enabled"; - this.ColEnabled.Name = "ColEnabled"; - this.ColEnabled.ReadOnly = true; - this.ColEnabled.Width = 52; + this.cbUseFallbackRule.AutoSize = true; + this.cbUseFallbackRule.Location = new System.Drawing.Point(6, 220); + this.cbUseFallbackRule.Name = "cbUseFallbackRule"; + this.cbUseFallbackRule.Size = new System.Drawing.Size(430, 17); + this.cbUseFallbackRule.TabIndex = 8; + this.cbUseFallbackRule.Text = "Automatically use the following viewmode if non of the above mentioned rules does" + + " fit:"; + this.cbUseFallbackRule.UseVisualStyleBackColor = true; + this.cbUseFallbackRule.CheckedChanged += new System.EventHandler(this.cbUseFallbackRule_CheckedChanged); // - // ColRuleName + // cmbViewMode // - this.ColRuleName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColRuleName.HeaderText = "Name"; - this.ColRuleName.Name = "ColRuleName"; - this.ColRuleName.ReadOnly = true; - this.ColRuleName.Width = 60; + this.cmbViewMode.Enabled = false; + this.cmbViewMode.FormattingEnabled = true; + this.cmbViewMode.Location = new System.Drawing.Point(450, 218); + this.cmbViewMode.Name = "cmbViewMode"; + this.cmbViewMode.Size = new System.Drawing.Size(121, 21); + this.cmbViewMode.TabIndex = 9; // - // ColARFrom - // - this.ColARFrom.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColARFrom.HeaderText = "AR From"; - this.ColARFrom.Name = "ColARFrom"; - this.ColARFrom.ReadOnly = true; - this.ColARFrom.Width = 73; - // - // ColARTo - // - this.ColARTo.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColARTo.HeaderText = "AR To"; - this.ColARTo.Name = "ColARTo"; - this.ColARTo.ReadOnly = true; - this.ColARTo.Width = 63; - // - // ColMinWidth - // - this.ColMinWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColMinWidth.HeaderText = "MinWidth"; - this.ColMinWidth.Name = "ColMinWidth"; - this.ColMinWidth.ReadOnly = true; - this.ColMinWidth.Width = 77; - // - // ColMaxWidth - // - this.ColMaxWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColMaxWidth.HeaderText = "MaxWidth"; - this.ColMaxWidth.Name = "ColMaxWidth"; - this.ColMaxWidth.ReadOnly = true; - this.ColMaxWidth.Width = 80; - // - // ColMinHeight - // - this.ColMinHeight.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColMinHeight.HeaderText = "MinHeight"; - this.ColMinHeight.Name = "ColMinHeight"; - this.ColMinHeight.ReadOnly = true; - this.ColMinHeight.Width = 80; - // - // ColMaxHeight - // - this.ColMaxHeight.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColMaxHeight.HeaderText = "MaxHeight"; - this.ColMaxHeight.Name = "ColMaxHeight"; - this.ColMaxHeight.ReadOnly = true; - this.ColMaxHeight.Width = 83; - // - // ColChangeAR - // - this.ColChangeAR.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColChangeAR.HeaderText = "ChangeAR"; - this.ColChangeAR.Name = "ColChangeAR"; - this.ColChangeAR.ReadOnly = true; - this.ColChangeAR.Width = 84; - // - // ColViewMode - // - this.ColViewMode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColViewMode.HeaderText = "ViewMode"; - this.ColViewMode.Name = "ColViewMode"; - this.ColViewMode.ReadOnly = true; - this.ColViewMode.Width = 82; - // - // ColChangeOS - // - this.ColChangeOS.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColChangeOS.HeaderText = "ChangeOS"; - this.ColChangeOS.Name = "ColChangeOS"; - this.ColChangeOS.ReadOnly = true; - this.ColChangeOS.Width = 84; - // - // ColOverscan - // - this.ColOverscan.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColOverscan.HeaderText = "Overscan"; - this.ColOverscan.Name = "ColOverscan"; - this.ColOverscan.ReadOnly = true; - this.ColOverscan.Width = 78; - // - // ColEnableLBDetect - // - this.ColEnableLBDetect.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.ColEnableLBDetect.HeaderText = "LB Detection"; - this.ColEnableLBDetect.Name = "ColEnableLBDetect"; - this.ColEnableLBDetect.ReadOnly = true; - this.ColEnableLBDetect.Width = 94; - // // ViewModeSwitcherConfig // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(794, 470); + this.ClientSize = new System.Drawing.Size(794, 487); this.Controls.Add(this.groupBox2); this.Controls.Add(this.label17); this.Controls.Add(this.label16); @@ -762,6 +787,7 @@ this.Name = "ViewModeSwitcherConfig"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "ViewModeSwitcherConfig - V0.3"; + this.Load += new System.EventHandler(this.ViewModeSwitcherConfig_Load); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dg_RuleSets)).EndInit(); @@ -837,5 +863,7 @@ private System.Windows.Forms.DataGridViewTextBoxColumn ColChangeOS; private System.Windows.Forms.DataGridViewTextBoxColumn ColOverscan; private System.Windows.Forms.DataGridViewTextBoxColumn ColEnableLBDetect; + private System.Windows.Forms.CheckBox cbUseFallbackRule; + private System.Windows.Forms.ComboBox cmbViewMode; } } \ No newline at end of file Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs 2007-08-22 05:26:54 UTC (rev 853) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs 2007-08-22 11:31:52 UTC (rev 854) @@ -48,6 +48,8 @@ this.cbVerboseLog.Checked = currentSettings.verboseLog; this.cbShowSwitchMsg.Checked = currentSettings.ShowSwitchMsg; this.cbSuppressInitialMsg.Checked = currentSettings.SuppressInitialMsg; + cbUseFallbackRule.Checked = currentSettings.UseFallbackRule; + cmbViewMode.Text = currentSettings.FallBackViewMode.ToString(); ReBuildDataGrid(); @@ -81,6 +83,8 @@ currentSettings.verboseLog = cbVerboseLog.Checked; currentSettings.ShowSwitchMsg = cbShowSwitchMsg.Checked; currentSettings.SuppressInitialMsg = cbSuppressInitialMsg.Checked; + currentSettings.UseFallbackRule = cbUseFallbackRule.Checked; + currentSettings.FallBackViewMode = ViewModeswitcherSettings.StringToViewMode(cmbViewMode.Text); currentSettings.DisableLBGlobaly = cbDisableLBGlobaly.Checked; currentSettings.LBCheckInterval = (int)uadLBCeckInterval.Value; @@ -199,6 +203,47 @@ } } + private void ViewModeSwitcherConfig_Load(object sender, EventArgs e) + { + cmbViewMode.Items.Clear(); + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + if (xmlreader.GetValueAsBool("mytv", "allowarzoom", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Zoom.ToString()); + } + if (xmlreader.GetValueAsBool("mytv", "allowarstretch", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Stretch.ToString()); + } + if (xmlreader.GetValueAsBool("mytv", "allowarnormal", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Normal.ToString()); + } + if (xmlreader.GetValueAsBool("mytv", "allowaroriginal", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Original.ToString()); + } + if (xmlreader.GetValueAsBool("mytv", "allowarletterbox", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.LetterBox43.ToString()); + } + if (xmlreader.GetValueAsBool("mytv", "allowarpanscan", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.PanScan43.ToString()); + } + if (xmlreader.GetValueAsBool("mytv", "allowarzoom149", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Zoom14to9.ToString()); + } + } + } + private void cbUseFallbackRule_CheckedChanged(object sender, EventArgs e) + { + cmbViewMode.Enabled = cbUseFallbackRule.Checked; + } + + } } \ No newline at end of file Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx 2007-08-22 05:26:54 UTC (rev 853) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx 2007-08-22 11:31:52 UTC (rev 854) @@ -156,4 +156,43 @@ <metadata name="ColEnableLBDetect.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> + <metadata name="ColEnabled.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColRuleName.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColARFrom.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColARTo.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColMinWidth.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColMaxWidth.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColMinHeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColMaxHeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColChangeAR.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColViewMode.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColChangeOS.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColOverscan.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColEnableLBDetect.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> </root> \ No newline at end of file Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelper.suo =================================================================== (Binary files differ) Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/Properties/AssemblyInfo.cs 2007-08-22 05:26:54 UTC (rev 853) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/Properties/AssemblyInfo.cs 2007-08-22 11:31:52 UTC (rev 854) @@ -6,7 +6,7 @@ // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // die mit einer Assembly verknüpft sind. [assembly: AssemblyTitle("ViewModeSwitcherHelper")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Helper based on TVE2")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ViewModeSwitcherHelper")] Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ViewModeSwitcherHelper.suo =================================================================== (Binary files differ) Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ViewModeSwitcherHelperTVE2.csproj =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ViewModeSwitcherHelperTVE2.csproj 2007-08-22 05:26:54 UTC (rev 853) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ViewModeSwitcherHelperTVE2.csproj 2007-08-22 11:31:52 UTC (rev 854) @@ -28,16 +28,16 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="Core, Version=0.2.2.0, Culture=neutral, processorArchitecture=x86"> + <Reference Include="Core, Version=0.2.2.9991, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\xbmc\bin\Release\Core.dll</HintPath> + <HintPath>..\..\Core\bin\Release\Core.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> - <Reference Include="TVCapture, Version=0.2.2.0, Culture=neutral, processorArchitecture=x86"> + <Reference Include="TVCapture, Version=0.2.2.9991, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\xbmc\bin\Release\TVCapture.dll</HintPath> + <HintPath>..\..\TVCapture\bin\Release\TVCapture.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/Properties/AssemblyInfo.cs 2007-08-22 05:26:54 UTC (rev 853) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/Properties/AssemblyInfo.cs 2007-08-22 11:31:52 UTC (rev 854) @@ -6,7 +6,7 @@ // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // die mit einer Assembly verknüpft sind. [assembly: AssemblyTitle("ViewModeSwitcherHelper")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Helper based on TVE3")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ViewModeSwitcherHelper")] Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelper.sln =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelper.sln 2007-08-22 05:26:54 UTC (rev 853) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelper.sln 2007-08-22 11:31:52 UTC (rev 854) @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ViewModeSwitcherHelperTVE3", "ViewModeSwitcherHelperTVE3.csproj", "{27A85D00-8872-45AE-91D4-E41E0EF1C7B4}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ViewModeSwitcherHelperTVE3", "ViewModeSwitcherHelperTVE3.csproj", "{EBFA5141-09F5-43AB-8B96-9DAA8B725284}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -9,10 +9,10 @@ Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {27A85D00-8872-45AE-91D4-E41E0EF1C7B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {27A85D00-8872-45AE-91D4-E41E0EF1C7B4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {27A85D00-8872-45AE-91D4-E41E0EF1C7B4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {27A85D00-8872-45AE-91D4-E41E0EF1C7B4}.Release|Any CPU.Build.0 = Release|Any CPU + {EBFA5141-09F5-43AB-8B96-9DAA8B725284}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EBFA5141-09F5-43AB-8B96-9DAA8B725284}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EBFA5141-09F5-43AB-8B96-9DAA8B725284}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EBFA5141-09F5-43AB-8B96-9DAA8B725284}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelper.suo =================================================================== (Binary files differ) Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelperTVE3.csproj =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelperTVE3.csproj 2007-08-22 05:26:54 UTC (rev 853) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ViewModeSwitcherHelperTVE3.csproj 2007-08-22 11:31:52 UTC (rev 854) @@ -28,16 +28,16 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="Core, Version=0.2.2.0, Culture=neutral, processorArchitecture=x86"> + <Reference Include="Core, Version=0.2.2.9991, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\xbmc\bin\Release\Core.dll</HintPath> + <HintPath>..\..\Core\bin\Release\Core.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> <Reference Include="TvPlugin, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\TV Server 3\TVLibrary\TvPlugin\TvPlugin\bin\Debug\TvPlugin.dll</HintPath> + <HintPath>C:\MediaPortal\MediaPortal\Plugins\Windows\TvPlugin.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherRuleDetail.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherRuleDetail.cs 2007-08-22 05:26:54 UTC (rev 853) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherRuleDetail.cs 2007-08-22 11:31:52 UTC (rev 854) @@ -112,24 +112,9 @@ currentRule.ChangeAR = cbViewModeSwitchEnabled.Checked; String tmpViewMode = cmbViewMode.Text; - switch (tmpViewMode) - { - case "Zoom": currentRule.ViewMode = Geometry.Type.Zoom; - break; - case "Normal": currentRule.ViewMode = Geometry.Type.Normal; - break; - case "Stretch": currentRule.ViewMode = Geometry.Type.Stretch; - break; - case "Original": currentRule.ViewMode = Geometry.Type.Original; - break; - case "LetterBox43": currentRule.ViewMode = Geometry.Type.LetterBox43; - break; - case "PanScan43": currentRule.ViewMode = Geometry.Type.PanScan43; - break; - case "Zoom14to9": currentRule.ViewMode = Geometry.Type.Zoom14to9; - break; - } + currentRule.ViewMode = ViewModeswitcherSettings.StringToViewMode(tmpViewMode); + currentRule.ChangeOs = cbOverScanEnabled.Checked; currentRule.OverScan = Convert.ToInt16(txbOverScan.Text); currentRule.EnableLBDetection = cb_EnableLBDetection.Checked; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lk...@us...> - 2008-01-30 06:47:31
|
Revision: 1326 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1326&view=rev Author: lkuech Date: 2008-01-29 22:47:24 -0800 (Tue, 29 Jan 2008) Log Message: ----------- ViewModeSwitcher: To give the TVPlugin time to load, the start of the reflection routine is delayed by 10secs now. Modified Paths: -------------- trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs Removed Paths: ------------- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ Modified: trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs 2008-01-29 16:51:41 UTC (rev 1325) +++ trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs 2008-01-30 06:47:24 UTC (rev 1326) @@ -29,7 +29,7 @@ { get { - if (CurrentChannelPropInfo == null && State == States.notstarted) Start(); + if (CurrentChannelPropInfo == null && State == States.notstarted) DelayedStart(10000); if (CurrentChannelPropInfo == null && State == States.finished) return string.Empty; return GetCurrentChannelViaReflection(); } @@ -52,32 +52,10 @@ Log.Debug("ViewModeSwitcher: TVPluginReflection: Try to read CurrentTVChannel property"); CurrentChannelPropInfo = AssemblyType.GetProperty("CurrentChannel"); + if (CurrentChannelPropInfo!=null) TVPluginFound = true; + string tmpCurrentTVChannel = GetCurrentChannelViaReflection(); Log.Debug("ViewModeSwitcher: TVPluginReflection: Value was: {0}", tmpCurrentTVChannel); - - //foreach (Type AssemblyType in assembly.GetTypes()) - //{ - // // Wait for the TvPlugin.ChannelNavigator class - // if (AssemblyType.IsClass == true && AssemblyType.FullName == "TvPlugin.ChannelNavigator") - // { - // Log.Debug("ViewModeSwitcher: TVPluginReflection: ...Found Class : {0}", AssemblyType.FullName); - - // // wait for the CurrentChannel property - // foreach (PropertyInfo PropInfo in AssemblyType.GetProperties()) - // { - // if (PropInfo.Name == "CurrentChannel") - // { - // Log.Debug("ViewModeSwitcher: TVPluginReflection: Found Property: {0}", PropInfo.Name); - // CurrentTVChannel = (string)AssemblyType.GetValue(PropInfo); - // Log.Debug("ViewModeSwitcher: TVPluginReflection: Value was: {0}", CurrentTVChannel); - // break; // leave the Properties foreach loop - // } - // } - - // break; // leave the Assembly foreach loop - //} - //} - } catch (Exception e) { @@ -87,6 +65,15 @@ State = States.finished; } + string GetCurrentChannelViaReflection() + { + if (CurrentChannelPropInfo == null || oAssembly == null) + { + return string.Empty; + } + return (string)CurrentChannelPropInfo.GetValue(oAssembly, null); + } + public void DelayedStart(int timeout) { State = States.delayed; @@ -97,17 +84,6 @@ delayTimer.Start(); } - string GetCurrentChannelViaReflection() - { - if (CurrentChannelPropInfo == null || oAssembly == null) - { - TVPluginFound = false; - return string.Empty; - } - TVPluginFound = true; - return (string)CurrentChannelPropInfo.GetValue(oAssembly, null); - } - void delayTimer_Tick(object sender, EventArgs e) { Timer tmpTimer = (Timer)sender; Modified: trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs 2008-01-29 16:51:41 UTC (rev 1325) +++ trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs 2008-01-30 06:47:24 UTC (rev 1326) @@ -19,6 +19,8 @@ { get { + if (TVPluginReference.State == TVPluginReflection.States.delayed) return string.Empty; + if (TVPluginReference.State == TVPluginReflection.States.notstarted) // make sure tvplug is searched via reflection { return TVPluginReference.CurrentTVChannel; Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2008-01-29 16:51:41 UTC (rev 1325) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2008-01-30 06:47:24 UTC (rev 1326) @@ -106,30 +106,35 @@ //GUIGraphicsContext.OnNewAction += new OnActionHandler(OnAction); TvStatus = new TVstatusWrapper(); + Log.Debug("ViewModeSwitcher: test the channel: {0}", TvStatus.CurrentChannelName); } //public void OnAction(Action action) //{ // switch (action.wID) // { - // case Action.ActionType.ACTION_VIEWMODESWITCHER_MENU: + // // case Action.ActionType.ACTION_VIEWMODESWITCHER_MENU: + // // { + // // ShowMenu(); + // // } + // // break; + // // case Action.ActionType.ACTION_VIEWMODESWITCHER_DOWN: + // // { + // // MoveVisibleWindow(MoveDirection.Down); + // // } + // // break; + // // case Action.ActionType.ACTION_VIEWMODESWITCHER_UP: + // // { + // // MoveVisibleWindow(MoveDirection.UP); + // // } + // // break; + // case Action.ActionType.ACTION_SWITCH_HOME: // { - // ShowMenu(); + // Log.Debug("ViewModeSwitcher: test the channel: {0}", TvStatus.CurrentChannelName); // } // break; - // case Action.ActionType.ACTION_VIEWMODESWITCHER_DOWN: - // { - // MoveVisibleWindow(MoveDirection.Down); - // } - // break; - // case Action.ActionType.ACTION_VIEWMODESWITCHER_UP: - // { - // MoveVisibleWindow(MoveDirection.UP); - // } - // break; // } //} - public void ShowMenu_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lk...@us...> - 2008-02-02 08:45:19
|
Revision: 1335 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1335&view=rev Author: lkuech Date: 2008-02-02 00:45:14 -0800 (Sat, 02 Feb 2008) Log Message: ----------- ViewModeSwitcher: Remove the reflection idea. Now a much simpler method is used (GUIPropertyManager.GetProperty("#TV.View.channel")). This one is working for TVE2 & 3! Modified Paths: -------------- trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj Removed Paths: ------------- trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs Deleted: trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs 2008-02-02 06:16:24 UTC (rev 1334) +++ trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs 2008-02-02 08:45:14 UTC (rev 1335) @@ -1,95 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Windows.Forms; -using MediaPortal.GUI.Library; -using System.Reflection; - - -namespace ProcessPlugins.ViewModeSwitcher -{ - public class TVPluginReflection - { - public enum States - { - notstarted, - delayed, - running, - finished - } - - public bool TVPluginFound = false; - public States State = States.notstarted; - - private System.Reflection.PropertyInfo CurrentChannelPropInfo = null; - private object oAssembly = null; - - public string CurrentTVChannel - { - get - { - if (CurrentChannelPropInfo == null && State == States.notstarted) DelayedStart(10000); - if (CurrentChannelPropInfo == null && State == States.finished) return string.Empty; - return GetCurrentChannelViaReflection(); - } - } - - public void Start() - { - Log.Debug("ViewModeSwitcher: TVPluginReflection: Start()"); - State = States.running; - - // Load the TVPlugin Assembly - Log.Debug("ViewModeSwitcher: TVPluginReflection: Try to find the TvPlugin"); - try - { - Assembly assembly = Assembly.LoadFrom("plugins\\Windows\\TvPlugin.dll"); - - Log.Debug("ViewModeSwitcher: TVPluginReflection: Try to load a instance of TvPlugin.ChannelNavigator"); - Type AssemblyType = assembly.GetType("TvPlugin.ChannelNavigator", false); - oAssembly = Activator.CreateInstance(AssemblyType); - - Log.Debug("ViewModeSwitcher: TVPluginReflection: Try to read CurrentTVChannel property"); - CurrentChannelPropInfo = AssemblyType.GetProperty("CurrentChannel"); - if (CurrentChannelPropInfo!=null) TVPluginFound = true; - - string tmpCurrentTVChannel = GetCurrentChannelViaReflection(); - Log.Debug("ViewModeSwitcher: TVPluginReflection: Value was: {0}", tmpCurrentTVChannel); - } - catch (Exception e) - { - Log.Debug("ViewModeSwitcher: TVPluginReflection: Error! {0}",e.Message); - } - - State = States.finished; - } - - string GetCurrentChannelViaReflection() - { - if (CurrentChannelPropInfo == null || oAssembly == null) - { - return string.Empty; - } - return (string)CurrentChannelPropInfo.GetValue(oAssembly, null); - } - - public void DelayedStart(int timeout) - { - State = States.delayed; - Log.Debug("ViewModeSwitcher: TVPluginReflection: Delayed start"); - Timer delayTimer = new Timer(); - delayTimer.Interval = timeout; - delayTimer.Tick += new EventHandler(delayTimer_Tick); - delayTimer.Start(); - } - - void delayTimer_Tick(object sender, EventArgs e) - { - Timer tmpTimer = (Timer)sender; - tmpTimer.Stop(); - Start(); - } - - } -} Modified: trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs 2008-02-02 06:16:24 UTC (rev 1334) +++ trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs 2008-02-02 08:45:14 UTC (rev 1335) @@ -8,47 +8,17 @@ { public class TVstatusWrapper { - public TVPluginReflection TVPluginReference; - - public TVstatusWrapper() + public static string CurrentChannelName { - TVPluginReference = new TVPluginReflection(); - //Log.Debug("ViewModeSwitcher: {0}", TVPluginReference.CurrentTVChannel); - } - - public string CurrentChannelName - { get { string tmpChannelName = string.Empty; - - if (TVPluginReference.State == TVPluginReflection.States.delayed || TVPluginReference.State == TVPluginReflection.States.notstarted) - { - Log.Debug("ViewModeSwitcher: TVstatusWrapper: CurrentChannelName: TVPluginReference.State = {0}", TVPluginReference.State); - return string.Empty; - } - - //if (TVPluginReference.State == TVPluginReflection.States.notstarted) // make sure tvplug is searched via reflection - //{ - // tmpChannelName = TVPluginReference.CurrentTVChannel; // let the Reflection class do her work - // Log.Debug("ViewModeSwitcher: TVstatusWrapper: CurrentChannelName: first start! Try to return the tve3 channel: {0}", tmpChannelName); - // return tmpChannelName; - //} - - if (TVPluginReference.State == TVPluginReflection.States.finished && TVPluginReference.TVPluginFound) - { - tmpChannelName = TVPluginReference.CurrentTVChannel; - Log.Debug("ViewModeSwitcher: TVstatusWrapper: CurrentChannelName: returning tve3 channel {0}", tmpChannelName); - return tmpChannelName; // return tve3 channel name - } - - tmpChannelName = Recorder.GetTVChannelName(); - Log.Debug("ViewModeSwitcher: TVstatusWrapper: CurrentChannelName: returning tve2 channel {0}", tmpChannelName); - return tmpChannelName; // return tve2 channel name + tmpChannelName = GUIPropertyManager.GetProperty("#TV.View.channel"); + return tmpChannelName; } } - public bool IsViewingTV() + public static bool IsViewingTV() { if (CurrentChannelName != string.Empty) return true; Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2008-02-02 06:16:24 UTC (rev 1334) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2008-02-02 08:45:14 UTC (rev 1335) @@ -65,7 +65,6 @@ private bool MenuShown = false; private int CurrentRule = -1; private int RecentGuiWindowID = 0; - private TVstatusWrapper TvStatus = null; enum MoveDirection { @@ -105,7 +104,6 @@ //GUIGraphicsContext.OnNewAction += new OnActionHandler(OnAction); - TvStatus = new TVstatusWrapper(); //Log.Debug("ViewModeSwitcher: test the channel: {0}", TvStatus.CurrentChannelName); } @@ -327,8 +325,6 @@ ResetWorkerPlaybackValues(); if (ViewModeSwitcherEnabled) workerEvent.Set(); - - TvStatus.TVPluginReference.Start(); } /// <summary> @@ -354,8 +350,6 @@ ResetWorkerPlaybackValues(); if (ViewModeSwitcherEnabled) workerEvent.Set(); - - TvStatus.TVPluginReference.Start(); } /// <summary> @@ -515,9 +509,9 @@ //SetZoomModeOffset(curZoomMode); } - if (TvStatus.IsViewingTV()) + if (TVstatusWrapper.IsViewingTV()) { - string tmpChannelName = TvStatus.CurrentChannelName; + string tmpChannelName = TVstatusWrapper.CurrentChannelName; if (curTVChannelName != tmpChannelName) { curTVChannelName = tmpChannelName; Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj 2008-02-02 06:16:24 UTC (rev 1334) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj 2008-02-02 08:45:14 UTC (rev 1335) @@ -57,7 +57,6 @@ <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Rule.cs" /> <Compile Include="Settings.cs" /> - <Compile Include="TVPluginReflection.cs" /> <Compile Include="TVstatusWrapper.cs" /> <Compile Include="ViewModeSwitcher.cs" /> <Compile Include="ViewModeSwitcherConfig.cs"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lk...@us...> - 2008-01-29 13:01:26
|
Revision: 1324 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1324&view=rev Author: lkuech Date: 2008-01-29 05:01:20 -0800 (Tue, 29 Jan 2008) Log Message: ----------- ViewModeSwitcher: Try to switch from the Helper.dll file idea to the usage of .net reflections Modified Paths: -------------- trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj Added Paths: ----------- trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs Added: trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs (rev 0) +++ trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs 2008-01-29 13:01:20 UTC (rev 1324) @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Windows.Forms; +using MediaPortal.GUI.Library; +using System.Reflection; + + +namespace ProcessPlugins.ViewModeSwitcher +{ + class TVPluginReflection + { + public enum States + { + notstarted, + delayed, + running, + finished + } + + public bool TVPluginFound = false; + public States State = States.notstarted; + + private System.Reflection.PropertyInfo CurrentChannelPropInfo = null; + private object oAssembly = null; + + public string CurrentTVChannel + { + get + { + if (CurrentChannelPropInfo == null && State == States.notstarted) Start(); + if (CurrentChannelPropInfo == null && State == States.finished) return string.Empty; + return GetCurrentChannelViaReflection(); + } + } + + public void Start() + { + Log.Debug("ViewModeSwitcher: TVPluginReflection: Start()"); + State = States.running; + + // Load the TVPlugin Assembly + Log.Debug("ViewModeSwitcher: TVPluginReflection: Try to find the TvPlugin"); + try + { + Assembly assembly = Assembly.LoadFrom("plugins\\Windows\\TvPlugin.dll"); + + Log.Debug("ViewModeSwitcher: TVPluginReflection: Try to load a instance of TvPlugin.ChannelNavigator"); + Type AssemblyType = assembly.GetType("TvPlugin.ChannelNavigator", false); + oAssembly = Activator.CreateInstance(AssemblyType); + + Log.Debug("ViewModeSwitcher: TVPluginReflection: Try to read CurrentTVChannel property"); + CurrentChannelPropInfo = AssemblyType.GetProperty("CurrentChannel"); + string tmpCurrentTVChannel = GetCurrentChannelViaReflection(); + Log.Debug("ViewModeSwitcher: TVPluginReflection: Value was: {0}", tmpCurrentTVChannel); + + //foreach (Type AssemblyType in assembly.GetTypes()) + //{ + // // Wait for the TvPlugin.ChannelNavigator class + // if (AssemblyType.IsClass == true && AssemblyType.FullName == "TvPlugin.ChannelNavigator") + // { + // Log.Debug("ViewModeSwitcher: TVPluginReflection: ...Found Class : {0}", AssemblyType.FullName); + + // // wait for the CurrentChannel property + // foreach (PropertyInfo PropInfo in AssemblyType.GetProperties()) + // { + // if (PropInfo.Name == "CurrentChannel") + // { + // Log.Debug("ViewModeSwitcher: TVPluginReflection: Found Property: {0}", PropInfo.Name); + // CurrentTVChannel = (string)AssemblyType.GetValue(PropInfo); + // Log.Debug("ViewModeSwitcher: TVPluginReflection: Value was: {0}", CurrentTVChannel); + // break; // leave the Properties foreach loop + // } + // } + + // break; // leave the Assembly foreach loop + //} + //} + + } + catch (Exception e) + { + Log.Debug("ViewModeSwitcher: TVPluginReflection: Error! {0}",e.Message); + } + + State = States.finished; + } + + public void DelayedStart(int timeout) + { + State = States.delayed; + Log.Debug("ViewModeSwitcher: TVPluginReflection: Delayed start"); + Timer delayTimer = new Timer(); + delayTimer.Interval = timeout; + delayTimer.Tick += new EventHandler(delayTimer_Tick); + delayTimer.Start(); + } + + string GetCurrentChannelViaReflection() + { + if (CurrentChannelPropInfo == null || oAssembly == null) + { + TVPluginFound = false; + return string.Empty; + } + TVPluginFound = true; + return (string)CurrentChannelPropInfo.GetValue(oAssembly, null); + } + + void delayTimer_Tick(object sender, EventArgs e) + { + Timer tmpTimer = (Timer)sender; + tmpTimer.Stop(); + Start(); + } + + } +} Added: trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs (rev 0) +++ trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs 2008-01-29 13:01:20 UTC (rev 1324) @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Text; +using MediaPortal.TV.Recording; + +namespace ProcessPlugins.ViewModeSwitcher +{ + public class TVstatusWrapper + { + private TVPluginReflection TVPluginReference; + + public TVstatusWrapper() + { + TVPluginReference = new TVPluginReflection(); + //Log.Debug("ViewModeSwitcher: {0}", TVPluginReference.CurrentTVChannel); + } + + public string CurrentChannelName + { + get + { + if (TVPluginReference.State == TVPluginReflection.States.notstarted) // make sure tvplug is searched via reflection + { + return TVPluginReference.CurrentTVChannel; + } + + if (TVPluginReference.State == TVPluginReflection.States.finished && TVPluginReference.TVPluginFound) + { + return TVPluginReference.CurrentTVChannel; // return tve3 channel name + } + + return Recorder.GetTVChannelName(); // return tve2 channel name + } + } + + public bool IsViewingTV() + { + if (CurrentChannelName != "") + return true; + else return false; + } + } + + +} Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2008-01-29 12:58:45 UTC (rev 1323) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2008-01-29 13:01:20 UTC (rev 1324) @@ -31,7 +31,7 @@ using System.Threading; using System.Diagnostics; using System.Drawing; -using ViewModeSwitcherHelper; +//using ViewModeSwitcherHelper; //TODO remove namespace ProcessPlugins.ViewModeSwitcher { @@ -65,6 +65,7 @@ private bool MenuShown = false; private int CurrentRule = -1; private int RecentGuiWindowID = 0; + private TVstatusWrapper TvStatus = null; enum MoveDirection { @@ -92,7 +93,6 @@ t.Priority = ThreadPriority.BelowNormal; t.Name = "ViewModeSwitcherThread"; t.Start(); - // register to handle playback events so we can wake // the above thread when playback starts Recorder.OnTvViewingStarted += new Recorder.OnTvViewHandler(OnTVStarted); @@ -103,31 +103,32 @@ g_Player.PlayBackEnded += new g_Player.EndedHandler(OnVideoEnded); g_Player.PlayBackStopped += new g_Player.StoppedHandler(OnVideoStopped); - GUIGraphicsContext.OnNewAction += new OnActionHandler(OnAction); + //GUIGraphicsContext.OnNewAction += new OnActionHandler(OnAction); + TvStatus = new TVstatusWrapper(); } - public void OnAction(Action action) - { - switch (action.wID) - { - case Action.ActionType.ACTION_VIEWMODESWITCHER_MENU: - { - ShowMenu(); - } - break; - case Action.ActionType.ACTION_VIEWMODESWITCHER_DOWN: - { - MoveVisibleWindow(MoveDirection.Down); - } - break; - case Action.ActionType.ACTION_VIEWMODESWITCHER_UP: - { - MoveVisibleWindow(MoveDirection.UP); - } - break; - } - } + //public void OnAction(Action action) + //{ + // switch (action.wID) + // { + // case Action.ActionType.ACTION_VIEWMODESWITCHER_MENU: + // { + // ShowMenu(); + // } + // break; + // case Action.ActionType.ACTION_VIEWMODESWITCHER_DOWN: + // { + // MoveVisibleWindow(MoveDirection.Down); + // } + // break; + // case Action.ActionType.ACTION_VIEWMODESWITCHER_UP: + // { + // MoveVisibleWindow(MoveDirection.UP); + // } + // break; + // } + //} public void ShowMenu_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) @@ -502,12 +503,12 @@ { curZoomMode = GUIGraphicsContext.ARType; if (currentSettings.verboseLog) Log.Info("The viewmode has been change to {0}", curZoomMode); - SetZoomModeOffset(curZoomMode); + //SetZoomModeOffset(curZoomMode); } - if (TVstatusWrapper.IsViewingTV()) + if (TvStatus.IsViewingTV()) { - string tmpChannelName = TVstatusWrapper.GetChannelName(); + string tmpChannelName = TvStatus.CurrentChannelName; if (curTVChannelName != tmpChannelName) { curTVChannelName = tmpChannelName; Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj 2008-01-29 12:58:45 UTC (rev 1323) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj 2008-01-29 13:01:20 UTC (rev 1324) @@ -51,13 +51,14 @@ <SpecificVersion>False</SpecificVersion> <HintPath>..\Core\bin\Debug\Utils.dll</HintPath> </Reference> - <Reference Include="ViewModeSwitcherHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" /> </ItemGroup> <ItemGroup> <Compile Include="PlugInBase.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Rule.cs" /> <Compile Include="Settings.cs" /> + <Compile Include="TVPluginReflection.cs" /> + <Compile Include="TVstatusWrapper.cs" /> <Compile Include="ViewModeSwitcher.cs" /> <Compile Include="ViewModeSwitcherConfig.cs"> <SubType>Form</SubType> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lk...@us...> - 2008-01-31 07:13:24
|
Revision: 1330 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1330&view=rev Author: lkuech Date: 2008-01-30 23:13:21 -0800 (Wed, 30 Jan 2008) Log Message: ----------- ViewModeSwitcher: Added Installer (MPI) Modified Paths: -------------- trunk/plugins/ViewModeSwitcher/PlugInBase.cs trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs Added Paths: ----------- trunk/plugins/ViewModeSwitcher/Installer/ trunk/plugins/ViewModeSwitcher/Installer/IconEnabled.png trunk/plugins/ViewModeSwitcher/Installer/ViewModeSwitcher.xmp trunk/plugins/ViewModeSwitcher/Installer/ViewModeSwitcher03.xml Added: trunk/plugins/ViewModeSwitcher/Installer/IconEnabled.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/ViewModeSwitcher/Installer/IconEnabled.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/ViewModeSwitcher/Installer/ViewModeSwitcher.xmp =================================================================== --- trunk/plugins/ViewModeSwitcher/Installer/ViewModeSwitcher.xmp (rev 0) +++ trunk/plugins/ViewModeSwitcher/Installer/ViewModeSwitcher.xmp 2008-01-31 07:13:21 UTC (rev 1330) @@ -0,0 +1,40 @@ +<MPinstaler> + <ver>1.00.000</ver> + <FileList> + <File> + <FileName>ViewModeSwitcher.dll</FileName> + <Type>Plugin</Type> + <SubType>Process</SubType> + <Source>C:\Users\TH10KX\Documents\Visual Studio 2005\Projects\MP Source\MediaPortal.Org\ViewModeSwitcher\bin\Release\ViewModeSwitcher.dll</Source> + <Id>01020</Id> + <Option /> + <Guid>a579dbad-1d13-4722-b5ad-ba48a6fd24d7</Guid> + </File> + </FileList> + <StringList /> + <Actions /> + <SetupGroups /> + <SetupGroupMappings /> + <Option> + <BuildFileName /> + <ProiectFileName>C:\Users\TH10KX\Documents\Visual Studio 2005\Projects\MP Source\MediaPortal.Org\ViewModeSwitcher\Installer\ViewModeSwitcher.xmp</ProiectFileName> + <ProiectName>ViewModeSwitcher</ProiectName> + <Author>LKuech</Author> + <UpdateURL>http://www.team-mediaportal.com</UpdateURL> + <Version>0.3</Version> + <Description>The idea of ViewModeSwitcher is to help MediaPortal (connected to a wide screen) to handle all kinds of signals (4:3, fake 16:9 (letterbox) and 16:9) without change the zoom mode via remote all the time.</Description> + <Group>Automation</Group> + <Release>Beta</Release> + <Logo>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</Logo> + </Option> + <Properties> + <MPMaxVersion /> + <MPMinVersion /> + <MinExtensionVersion /> + <MaxExtensionVersion /> + <ForumURL /> + <WebURL /> + <CreationDate>Thursday, January 31, 2008 12:00:00 AM</CreationDate> + <SingleGroupSelect>False</SingleGroupSelect> + </Properties> +</MPinstaler> \ No newline at end of file Added: trunk/plugins/ViewModeSwitcher/Installer/ViewModeSwitcher03.xml =================================================================== --- trunk/plugins/ViewModeSwitcher/Installer/ViewModeSwitcher03.xml (rev 0) +++ trunk/plugins/ViewModeSwitcher/Installer/ViewModeSwitcher03.xml 2008-01-31 07:13:21 UTC (rev 1330) @@ -0,0 +1,27 @@ +<MPinstalerS> + <ver>1.00.000</ver> + <ExtensionList> + <Extension> + <FileName>ViewModeSwitcher03.mpi</FileName> + <Name>ViewModeSwitcher</Name> + <URL>http://www.team-mediaportal.com</URL> + <Version>0.3</Version> + <Author>LKuech</Author> + <Description>The idea of ViewModeSwitcher is to help MediaPortal (connected to a wide screen) to handle all kinds of signals (4:3, fake 16:9 (letterbox) and 16:9) without change the zoom mode via remote all the time.</Description> + <Group>Automation</Group> + <Logo>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</Logo> + <Properties> + <MPMaxVersion /> + <MPMinVersion /> + <MinExtensionVersion /> + <MaxExtensionVersion /> + <ForumURL /> + <WebURL /> + <CreationDate>Thursday, January 31, 2008 12:00:00 AM</CreationDate> + <SingleGroupSelect>False</SingleGroupSelect> + </Properties> + <Uninstall /> + </Extension> + </ExtensionList> + <Option /> +</MPinstalerS> \ No newline at end of file Modified: trunk/plugins/ViewModeSwitcher/PlugInBase.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/PlugInBase.cs 2008-01-31 06:33:44 UTC (rev 1329) +++ trunk/plugins/ViewModeSwitcher/PlugInBase.cs 2008-01-31 07:13:21 UTC (rev 1330) @@ -65,7 +65,7 @@ public bool DefaultEnabled() { - return false; + return true; } public bool HasSetup() Modified: trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs 2008-01-31 06:33:44 UTC (rev 1329) +++ trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs 2008-01-31 07:13:21 UTC (rev 1330) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using MediaPortal.TV.Recording; +using MediaPortal.GUI.Library; namespace ProcessPlugins.ViewModeSwitcher { @@ -19,25 +20,34 @@ { get { + Log.Debug("ViewModeSwitcher: TVstatusWrapper: CurrentChannelName: TVPluginReference.State = {0}", TVPluginReference.State); + string tmpChannelName = string.Empty; + if (TVPluginReference.State == TVPluginReflection.States.delayed) return string.Empty; if (TVPluginReference.State == TVPluginReflection.States.notstarted) // make sure tvplug is searched via reflection { - return TVPluginReference.CurrentTVChannel; + tmpChannelName = TVPluginReference.CurrentTVChannel; // let the Reflection class do her work + Log.Debug("ViewModeSwitcher: TVstatusWrapper: CurrentChannelName: first start! Try to return the tve3 channel: {0}", tmpChannelName); + return tmpChannelName; } if (TVPluginReference.State == TVPluginReflection.States.finished && TVPluginReference.TVPluginFound) { - return TVPluginReference.CurrentTVChannel; // return tve3 channel name + tmpChannelName = TVPluginReference.CurrentTVChannel; + Log.Debug("ViewModeSwitcher: TVstatusWrapper: CurrentChannelName: returning tve3 channel {0}", tmpChannelName); + return tmpChannelName; // return tve3 channel name } - return Recorder.GetTVChannelName(); // return tve2 channel name + tmpChannelName = Recorder.GetTVChannelName(); + Log.Debug("ViewModeSwitcher: TVstatusWrapper: CurrentChannelName: returning tve2 channel {0}", tmpChannelName); + return tmpChannelName; // return tve2 channel name } } public bool IsViewingTV() { - if (CurrentChannelName != "") + if (CurrentChannelName != string.Empty) return true; else return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lk...@us...> - 2008-02-01 10:20:18
|
Revision: 1332 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1332&view=rev Author: lkuech Date: 2008-02-01 02:20:13 -0800 (Fri, 01 Feb 2008) Log Message: ----------- ViewModeSwitcher: Let the reflection function start from outside of the background worker thread. Hopefully that fixes the last tve3 issue regarding the current channel detection. Modified Paths: -------------- trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs Modified: trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs 2008-01-31 07:17:31 UTC (rev 1331) +++ trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs 2008-02-01 10:20:13 UTC (rev 1332) @@ -9,7 +9,7 @@ namespace ProcessPlugins.ViewModeSwitcher { - class TVPluginReflection + public class TVPluginReflection { public enum States { Modified: trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs 2008-01-31 07:17:31 UTC (rev 1331) +++ trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs 2008-02-01 10:20:13 UTC (rev 1332) @@ -8,7 +8,7 @@ { public class TVstatusWrapper { - private TVPluginReflection TVPluginReference; + public TVPluginReflection TVPluginReference; public TVstatusWrapper() { @@ -20,18 +20,21 @@ { get { - Log.Debug("ViewModeSwitcher: TVstatusWrapper: CurrentChannelName: TVPluginReference.State = {0}", TVPluginReference.State); string tmpChannelName = string.Empty; - if (TVPluginReference.State == TVPluginReflection.States.delayed) return string.Empty; - - if (TVPluginReference.State == TVPluginReflection.States.notstarted) // make sure tvplug is searched via reflection + if (TVPluginReference.State == TVPluginReflection.States.delayed || TVPluginReference.State == TVPluginReflection.States.notstarted) { - tmpChannelName = TVPluginReference.CurrentTVChannel; // let the Reflection class do her work - Log.Debug("ViewModeSwitcher: TVstatusWrapper: CurrentChannelName: first start! Try to return the tve3 channel: {0}", tmpChannelName); - return tmpChannelName; + Log.Debug("ViewModeSwitcher: TVstatusWrapper: CurrentChannelName: TVPluginReference.State = {0}", TVPluginReference.State); + return string.Empty; } + //if (TVPluginReference.State == TVPluginReflection.States.notstarted) // make sure tvplug is searched via reflection + //{ + // tmpChannelName = TVPluginReference.CurrentTVChannel; // let the Reflection class do her work + // Log.Debug("ViewModeSwitcher: TVstatusWrapper: CurrentChannelName: first start! Try to return the tve3 channel: {0}", tmpChannelName); + // return tmpChannelName; + //} + if (TVPluginReference.State == TVPluginReflection.States.finished && TVPluginReference.TVPluginFound) { tmpChannelName = TVPluginReference.CurrentTVChannel; Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2008-01-31 07:17:31 UTC (rev 1331) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2008-02-01 10:20:13 UTC (rev 1332) @@ -106,7 +106,7 @@ //GUIGraphicsContext.OnNewAction += new OnActionHandler(OnAction); TvStatus = new TVstatusWrapper(); - Log.Debug("ViewModeSwitcher: test the channel: {0}", TvStatus.CurrentChannelName); + //Log.Debug("ViewModeSwitcher: test the channel: {0}", TvStatus.CurrentChannelName); } //public void OnAction(Action action) @@ -324,8 +324,11 @@ public void OnTVStarted(int j, TVCaptureDevice dev) { if (currentSettings.verboseLog) Log.Debug("ViewModeSwitcher: OnTVStarted"); + ResetWorkerPlaybackValues(); if (ViewModeSwitcherEnabled) workerEvent.Set(); + + TvStatus.TVPluginReference.Start(); } /// <summary> @@ -350,8 +353,9 @@ if (currentSettings.verboseLog) Log.Debug("ViewModeSwitcher: On Video Started"); ResetWorkerPlaybackValues(); - if (ViewModeSwitcherEnabled) workerEvent.Set(); + + TvStatus.TVPluginReference.Start(); } /// <summary> @@ -517,7 +521,7 @@ if (curTVChannelName != tmpChannelName) { curTVChannelName = tmpChannelName; - if (currentSettings.verboseLog) Log.Info("The TV channel is now: {0}", curTVChannelName); + if (currentSettings.verboseLog) Log.Info("ViewModeSwitchwer: The TV channel is now: {0}", curTVChannelName); LastSwitchedAspectRatio = 0f; LastLetterboxDetectionResult = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lk...@us...> - 2008-02-05 09:42:40
|
Revision: 1340 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1340&view=rev Author: lkuech Date: 2008-02-05 01:42:35 -0800 (Tue, 05 Feb 2008) Log Message: ----------- ViewModeSwitcher: - Added a configuration icon. - Added a option to the config screen to enable/disable the "RescanRulesAfterChannelChange" function. Modified Paths: -------------- trunk/plugins/ViewModeSwitcher/PlugInBase.cs trunk/plugins/ViewModeSwitcher/Settings.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx Removed Paths: ------------- trunk/plugins/ViewModeSwitcher/IconDisabled.GIF trunk/plugins/ViewModeSwitcher/IconEnabled.GIF Deleted: trunk/plugins/ViewModeSwitcher/IconDisabled.GIF =================================================================== (Binary files differ) Deleted: trunk/plugins/ViewModeSwitcher/IconEnabled.GIF =================================================================== (Binary files differ) Modified: trunk/plugins/ViewModeSwitcher/PlugInBase.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/PlugInBase.cs 2008-02-04 21:45:54 UTC (rev 1339) +++ trunk/plugins/ViewModeSwitcher/PlugInBase.cs 2008-02-05 09:42:35 UTC (rev 1340) @@ -26,7 +26,6 @@ namespace ProcessPlugins.ViewModeSwitcher { - [PluginIcons("IconEnabled.GIF", "IconDisabled.GIF")] public abstract class PlugInBase : IPlugin, ISetupForm { public abstract void Stop(); Modified: trunk/plugins/ViewModeSwitcher/Settings.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/Settings.cs 2008-02-04 21:45:54 UTC (rev 1339) +++ trunk/plugins/ViewModeSwitcher/Settings.cs 2008-02-05 09:42:35 UTC (rev 1340) @@ -53,6 +53,7 @@ public int VerticalOffSetZoom = 0; public int VerticalOffSet14_9 = 0; public int VerticalOffSetWide14_9 = 0; + public bool RescanRulesAfterChannelChange = true; // parameter names public static string ViewModeSwitcherSectionName = "ViewModeSwitcher"; @@ -82,6 +83,7 @@ string ParmVOffsetZoom = "parmvoffsetzoom"; string ParmVOffset14_9 = "parmvoffset149"; string ParmVOffsetWide14_9 = "parmvoffsetwide149"; + string ParmRescanRulesAfterChannelChange = "parmrescanrulesafterchannelchange"; public static string ParmTVChannelPrefix = "parmtvchannelprefix"; public static Geometry.Type StringToViewMode(string strViewmode) @@ -146,6 +148,7 @@ } verboseLog = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmVerboselog, false); ShowSwitchMsg = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmShowSwitchMsg, false); + RescanRulesAfterChannelChange = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmRescanRulesAfterChannelChange, true); SuppressInitialMsg = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmSuppressInitalMsg, false); UseFallbackRule = reader.GetValueAsBool(ViewModeSwitcherSectionName, ParmUseFallbackRule, false); String tmpFallbackViewMode = reader.GetValueAsString(ViewModeSwitcherSectionName, ParmFallbackViewMode, "Normal"); @@ -186,6 +189,7 @@ { xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmVerboselog, verboseLog); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmShowSwitchMsg, ShowSwitchMsg); + xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRescanRulesAfterChannelChange, RescanRulesAfterChannelChange); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmSuppressInitalMsg, SuppressInitialMsg); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmUseFallbackRule, UseFallbackRule); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmFallbackViewMode, FallBackViewMode.ToString()); Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2008-02-04 21:45:54 UTC (rev 1339) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2008-02-05 09:42:35 UTC (rev 1340) @@ -42,6 +42,7 @@ public delegate void ProcessRules(float AspectRatio, int width, int height); public delegate bool IsLetterbox(); + [PluginIcons("ViewModeSwitcher.IconEnabled.png", "ViewModeSwitcher.IconDisabled.png")] public class ViewModeSwitcher : ProcessPlugins.ViewModeSwitcher.PlugInBase { ViewModeswitcherSettings currentSettings = new ViewModeswitcherSettings(); @@ -509,7 +510,7 @@ //SetZoomModeOffset(curZoomMode); } - if (TVstatusWrapper.IsViewingTV()) + if (currentSettings.RescanRulesAfterChannelChange && TVstatusWrapper.IsViewingTV()) { string tmpChannelName = TVstatusWrapper.CurrentChannelName; if (curTVChannelName != tmpChannelName) Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj 2008-02-04 21:45:54 UTC (rev 1339) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.csproj 2008-02-05 09:42:35 UTC (rev 1340) @@ -83,10 +83,8 @@ </EmbeddedResource> </ItemGroup> <ItemGroup> - <Content Include="IconDisabled.GIF" /> - <Content Include="IconDisabled.png" /> - <Content Include="IconEnabled.GIF" /> - <Content Include="IconEnabled.png" /> + <EmbeddedResource Include="IconDisabled.png" /> + <EmbeddedResource Include="IconEnabled.png" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs 2008-02-04 21:45:54 UTC (rev 1339) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs 2008-02-05 09:42:35 UTC (rev 1340) @@ -50,6 +50,8 @@ { this.bOK = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.cmbViewMode = new System.Windows.Forms.ComboBox(); + this.cbUseFallbackRule = new System.Windows.Forms.CheckBox(); this.label1 = new System.Windows.Forms.Label(); this.cbSuppressInitialMsg = new System.Windows.Forms.CheckBox(); this.cbShowSwitchMsg = new System.Windows.Forms.CheckBox(); @@ -110,8 +112,7 @@ this.label16 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); this.label19 = new System.Windows.Forms.Label(); - this.cbUseFallbackRule = new System.Windows.Forms.CheckBox(); - this.cmbViewMode = new System.Windows.Forms.ComboBox(); + this.cbRescanRulesAfterChannelChange = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dg_RuleSets)).BeginInit(); this.groupBox2.SuspendLayout(); @@ -121,7 +122,7 @@ // bOK // this.bOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bOK.Location = new System.Drawing.Point(738, 452); + this.bOK.Location = new System.Drawing.Point(738, 461); this.bOK.Name = "bOK"; this.bOK.Size = new System.Drawing.Size(44, 23); this.bOK.TabIndex = 1; @@ -133,6 +134,7 @@ // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.cbRescanRulesAfterChannelChange); this.groupBox1.Controls.Add(this.cmbViewMode); this.groupBox1.Controls.Add(this.cbUseFallbackRule); this.groupBox1.Controls.Add(this.label1); @@ -144,16 +146,37 @@ this.groupBox1.Controls.Add(this.dg_RuleSets); this.groupBox1.Location = new System.Drawing.Point(12, 35); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(770, 273); + this.groupBox1.Size = new System.Drawing.Size(770, 288); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; // + // cmbViewMode + // + this.cmbViewMode.Enabled = false; + this.cmbViewMode.FormattingEnabled = true; + this.cmbViewMode.Location = new System.Drawing.Point(450, 218); + this.cmbViewMode.Name = "cmbViewMode"; + this.cmbViewMode.Size = new System.Drawing.Size(121, 21); + this.cmbViewMode.TabIndex = 9; + // + // cbUseFallbackRule + // + this.cbUseFallbackRule.AutoSize = true; + this.cbUseFallbackRule.Location = new System.Drawing.Point(6, 220); + this.cbUseFallbackRule.Name = "cbUseFallbackRule"; + this.cbUseFallbackRule.Size = new System.Drawing.Size(430, 17); + this.cbUseFallbackRule.TabIndex = 8; + this.cbUseFallbackRule.Text = "Automatically use the following viewmode if non of the above mentioned rules does" + + " fit:"; + this.cbUseFallbackRule.UseVisualStyleBackColor = true; + this.cbUseFallbackRule.CheckedChanged += new System.EventHandler(this.cbUseFallbackRule_CheckedChanged); + // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label1.AutoSize = true; this.label1.ForeColor = System.Drawing.Color.Red; - this.label1.Location = new System.Drawing.Point(3, 249); + this.label1.Location = new System.Drawing.Point(3, 263); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(568, 13); this.label1.TabIndex = 7; @@ -348,7 +371,7 @@ // bCancel // this.bCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bCancel.Location = new System.Drawing.Point(682, 452); + this.bCancel.Location = new System.Drawing.Point(682, 461); this.bCancel.Name = "bCancel"; this.bCancel.Size = new System.Drawing.Size(50, 23); this.bCancel.TabIndex = 0; @@ -378,6 +401,8 @@ // // groupBox2 // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.groupBox2.Controls.Add(this.txtLBOverScan); this.groupBox2.Controls.Add(this.label21); this.groupBox2.Controls.Add(this.txbLBDetectionCount); @@ -411,9 +436,9 @@ this.groupBox2.Controls.Add(this.label9); this.groupBox2.Controls.Add(this.label8); this.groupBox2.Controls.Add(this.cbLBOverScan); - this.groupBox2.Location = new System.Drawing.Point(12, 314); + this.groupBox2.Location = new System.Drawing.Point(12, 326); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(770, 133); + this.groupBox2.Size = new System.Drawing.Size(770, 126); this.groupBox2.TabIndex = 8; this.groupBox2.TabStop = false; this.groupBox2.Text = "Letterbox Options"; @@ -719,9 +744,10 @@ // // label16 // + this.label16.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label16.AutoSize = true; this.label16.ForeColor = System.Drawing.Color.Red; - this.label16.Location = new System.Drawing.Point(27, 452); + this.label16.Location = new System.Drawing.Point(27, 455); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(177, 13); this.label16.TabIndex = 32; @@ -729,9 +755,10 @@ // // label17 // + this.label17.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label17.AutoSize = true; this.label17.ForeColor = System.Drawing.Color.Red; - this.label17.Location = new System.Drawing.Point(27, 468); + this.label17.Location = new System.Drawing.Point(27, 471); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(73, 13); this.label17.TabIndex = 33; @@ -739,41 +766,31 @@ // // label19 // + this.label19.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label19.AutoSize = true; this.label19.Font = new System.Drawing.Font("Microsoft Sans Serif", 28F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label19.ForeColor = System.Drawing.Color.Red; - this.label19.Location = new System.Drawing.Point(10, 444); + this.label19.Location = new System.Drawing.Point(10, 447); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(32, 44); this.label19.TabIndex = 34; this.label19.Text = "!"; // - // cbUseFallbackRule + // cbRescanRulesAfterChannelChange // - this.cbUseFallbackRule.AutoSize = true; - this.cbUseFallbackRule.Location = new System.Drawing.Point(6, 220); - this.cbUseFallbackRule.Name = "cbUseFallbackRule"; - this.cbUseFallbackRule.Size = new System.Drawing.Size(430, 17); - this.cbUseFallbackRule.TabIndex = 8; - this.cbUseFallbackRule.Text = "Automatically use the following viewmode if non of the above mentioned rules does" + - " fit:"; - this.cbUseFallbackRule.UseVisualStyleBackColor = true; - this.cbUseFallbackRule.CheckedChanged += new System.EventHandler(this.cbUseFallbackRule_CheckedChanged); + this.cbRescanRulesAfterChannelChange.AutoSize = true; + this.cbRescanRulesAfterChannelChange.Location = new System.Drawing.Point(6, 243); + this.cbRescanRulesAfterChannelChange.Name = "cbRescanRulesAfterChannelChange"; + this.cbRescanRulesAfterChannelChange.Size = new System.Drawing.Size(192, 17); + this.cbRescanRulesAfterChannelChange.TabIndex = 10; + this.cbRescanRulesAfterChannelChange.Text = "Rescan rules after channel change"; + this.cbRescanRulesAfterChannelChange.UseVisualStyleBackColor = true; // - // cmbViewMode - // - this.cmbViewMode.Enabled = false; - this.cmbViewMode.FormattingEnabled = true; - this.cmbViewMode.Location = new System.Drawing.Point(450, 218); - this.cmbViewMode.Name = "cmbViewMode"; - this.cmbViewMode.Size = new System.Drawing.Size(121, 21); - this.cmbViewMode.TabIndex = 9; - // // ViewModeSwitcherConfig // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(794, 487); + this.ClientSize = new System.Drawing.Size(794, 496); this.Controls.Add(this.groupBox2); this.Controls.Add(this.label17); this.Controls.Add(this.label16); @@ -865,5 +882,6 @@ private System.Windows.Forms.DataGridViewTextBoxColumn ColEnableLBDetect; private System.Windows.Forms.CheckBox cbUseFallbackRule; private System.Windows.Forms.ComboBox cmbViewMode; + private System.Windows.Forms.CheckBox cbRescanRulesAfterChannelChange; } } \ No newline at end of file Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs 2008-02-04 21:45:54 UTC (rev 1339) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs 2008-02-05 09:42:35 UTC (rev 1340) @@ -47,6 +47,7 @@ this.cbVerboseLog.Checked = currentSettings.verboseLog; this.cbShowSwitchMsg.Checked = currentSettings.ShowSwitchMsg; + this.cbRescanRulesAfterChannelChange.Checked = currentSettings.RescanRulesAfterChannelChange; this.cbSuppressInitialMsg.Checked = currentSettings.SuppressInitialMsg; cbUseFallbackRule.Checked = currentSettings.UseFallbackRule; cmbViewMode.Text = currentSettings.FallBackViewMode.ToString(); @@ -82,6 +83,7 @@ { currentSettings.verboseLog = cbVerboseLog.Checked; currentSettings.ShowSwitchMsg = cbShowSwitchMsg.Checked; + currentSettings.RescanRulesAfterChannelChange = cbRescanRulesAfterChannelChange.Checked; currentSettings.SuppressInitialMsg = cbSuppressInitialMsg.Checked; currentSettings.UseFallbackRule = cbUseFallbackRule.Checked; currentSettings.FallBackViewMode = ViewModeswitcherSettings.StringToViewMode(cmbViewMode.Text); @@ -205,38 +207,38 @@ private void ViewModeSwitcherConfig_Load(object sender, EventArgs e) { - cmbViewMode.Items.Clear(); - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - if (xmlreader.GetValueAsBool("mytv", "allowarzoom", true)) - { - cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Zoom.ToString()); - } - if (xmlreader.GetValueAsBool("mytv", "allowarstretch", true)) - { - cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Stretch.ToString()); - } - if (xmlreader.GetValueAsBool("mytv", "allowarnormal", true)) - { - cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Normal.ToString()); - } - if (xmlreader.GetValueAsBool("mytv", "allowaroriginal", true)) - { - cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Original.ToString()); - } - if (xmlreader.GetValueAsBool("mytv", "allowarletterbox", true)) - { - cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.LetterBox43.ToString()); - } - if (xmlreader.GetValueAsBool("mytv", "allowarpanscan", true)) - { - cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.PanScan43.ToString()); - } - if (xmlreader.GetValueAsBool("mytv", "allowarzoom149", true)) - { - cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Zoom14to9.ToString()); - } - } + cmbViewMode.Items.Clear(); + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + if (xmlreader.GetValueAsBool("mytv", "allowarzoom", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Zoom.ToString()); + } + if (xmlreader.GetValueAsBool("mytv", "allowarstretch", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Stretch.ToString()); + } + if (xmlreader.GetValueAsBool("mytv", "allowarnormal", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Normal.ToString()); + } + if (xmlreader.GetValueAsBool("mytv", "allowaroriginal", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Original.ToString()); + } + if (xmlreader.GetValueAsBool("mytv", "allowarletterbox", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.LetterBox43.ToString()); + } + if (xmlreader.GetValueAsBool("mytv", "allowarpanscan", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.PanScan43.ToString()); + } + if (xmlreader.GetValueAsBool("mytv", "allowarzoom149", true)) + { + cmbViewMode.Items.Add(MediaPortal.GUI.Library.Geometry.Type.Zoom14to9.ToString()); + } + } } private void cbUseFallbackRule_CheckedChanged(object sender, EventArgs e) Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx 2008-02-04 21:45:54 UTC (rev 1339) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx 2008-02-05 09:42:35 UTC (rev 1340) @@ -156,43 +156,4 @@ <metadata name="ColEnableLBDetect.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> - <metadata name="ColEnabled.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="ColRuleName.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="ColARFrom.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="ColARTo.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="ColMinWidth.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="ColMaxWidth.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="ColMinHeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="ColMaxHeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="ColChangeAR.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="ColViewMode.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="ColChangeOS.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="ColOverscan.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> - <metadata name="ColEnableLBDetect.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </metadata> </root> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lk...@us...> - 2008-02-07 08:27:39
|
Revision: 1341 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1341&view=rev Author: lkuech Date: 2008-02-07 00:27:37 -0800 (Thu, 07 Feb 2008) Log Message: ----------- ViewModeSwitcher: Implemented a Import/Export function for the complete settings Modified Paths: -------------- trunk/plugins/ViewModeSwitcher/Settings.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx Modified: trunk/plugins/ViewModeSwitcher/Settings.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/Settings.cs 2008-02-05 09:42:35 UTC (rev 1340) +++ trunk/plugins/ViewModeSwitcher/Settings.cs 2008-02-07 08:27:37 UTC (rev 1341) @@ -110,14 +110,25 @@ return ret; } + public bool LoadSettings() + { + return LoadSettings(string.Empty); + } + /// <summary> /// load settings from MediaPortal configuration /// </summary> /// <returns></returns> - public bool LoadSettings() + public bool LoadSettings(string ImportFileName) { - using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + string tmpConfigFileName = Config.GetFile(Config.Dir.Config, "MediaPortal.xml"); + if (ImportFileName != string.Empty) { + tmpConfigFileName = ImportFileName; + } + + using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(tmpConfigFileName)) + { bool tmpReturn = false; ViewModeRules.Clear(); int tmpRuleCount = reader.GetValueAsInt(ViewModeSwitcherSectionName, ParmRuleCount, 0); @@ -185,8 +196,19 @@ public void SaveSettings() { - using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + SaveSettings(string.Empty); + } + + public void SaveSettings(string ExportFileName) + { + string tmpConfigFileName = Config.GetFile(Config.Dir.Config, "MediaPortal.xml"); + if (ExportFileName != string.Empty) { + tmpConfigFileName = ExportFileName; + } + + using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(tmpConfigFileName)) + { xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmVerboselog, verboseLog); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmShowSwitchMsg, ShowSwitchMsg); xmlwriter.SetValueAsBool(ViewModeSwitcherSectionName, ParmRescanRulesAfterChannelChange, RescanRulesAfterChannelChange); @@ -243,6 +265,8 @@ xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmVOffsetZoom, VerticalOffSetZoom.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmVOffset14_9, VerticalOffSet14_9.ToString()); xmlwriter.SetValue(ViewModeSwitcherSectionName, ParmVOffsetWide14_9, VerticalOffSetWide14_9.ToString()); + + if (ExportFileName != string.Empty) MediaPortal.Profile.Settings.SaveCache(); } } Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs 2008-02-05 09:42:35 UTC (rev 1340) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.Designer.cs 2008-02-07 08:27:37 UTC (rev 1341) @@ -50,6 +50,7 @@ { this.bOK = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.cbRescanRulesAfterChannelChange = new System.Windows.Forms.CheckBox(); this.cmbViewMode = new System.Windows.Forms.ComboBox(); this.cbUseFallbackRule = new System.Windows.Forms.CheckBox(); this.label1 = new System.Windows.Forms.Label(); @@ -112,7 +113,10 @@ this.label16 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); this.label19 = new System.Windows.Forms.Label(); - this.cbRescanRulesAfterChannelChange = new System.Windows.Forms.CheckBox(); + this.bImport = new System.Windows.Forms.Button(); + this.bExport = new System.Windows.Forms.Button(); + this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); + this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dg_RuleSets)).BeginInit(); this.groupBox2.SuspendLayout(); @@ -150,6 +154,16 @@ this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; // + // cbRescanRulesAfterChannelChange + // + this.cbRescanRulesAfterChannelChange.AutoSize = true; + this.cbRescanRulesAfterChannelChange.Location = new System.Drawing.Point(6, 243); + this.cbRescanRulesAfterChannelChange.Name = "cbRescanRulesAfterChannelChange"; + this.cbRescanRulesAfterChannelChange.Size = new System.Drawing.Size(192, 17); + this.cbRescanRulesAfterChannelChange.TabIndex = 10; + this.cbRescanRulesAfterChannelChange.Text = "Rescan rules after channel change"; + this.cbRescanRulesAfterChannelChange.UseVisualStyleBackColor = true; + // // cmbViewMode // this.cmbViewMode.Enabled = false; @@ -776,21 +790,37 @@ this.label19.TabIndex = 34; this.label19.Text = "!"; // - // cbRescanRulesAfterChannelChange + // bImport // - this.cbRescanRulesAfterChannelChange.AutoSize = true; - this.cbRescanRulesAfterChannelChange.Location = new System.Drawing.Point(6, 243); - this.cbRescanRulesAfterChannelChange.Name = "cbRescanRulesAfterChannelChange"; - this.cbRescanRulesAfterChannelChange.Size = new System.Drawing.Size(192, 17); - this.cbRescanRulesAfterChannelChange.TabIndex = 10; - this.cbRescanRulesAfterChannelChange.Text = "Rescan rules after channel change"; - this.cbRescanRulesAfterChannelChange.UseVisualStyleBackColor = true; + this.bImport.Location = new System.Drawing.Point(543, 461); + this.bImport.Name = "bImport"; + this.bImport.Size = new System.Drawing.Size(88, 23); + this.bImport.TabIndex = 35; + this.bImport.Text = "Import Settings"; + this.bImport.UseVisualStyleBackColor = true; + this.bImport.Click += new System.EventHandler(this.bImport_Click); // + // bExport + // + this.bExport.Location = new System.Drawing.Point(444, 461); + this.bExport.Name = "bExport"; + this.bExport.Size = new System.Drawing.Size(93, 23); + this.bExport.TabIndex = 36; + this.bExport.Text = "Export Settings"; + this.bExport.UseVisualStyleBackColor = true; + this.bExport.Click += new System.EventHandler(this.bExport_Click); + // + // openFileDialog + // + this.openFileDialog.FileName = "openFileDialog1"; + // // ViewModeSwitcherConfig // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(794, 496); + this.Controls.Add(this.bExport); + this.Controls.Add(this.bImport); this.Controls.Add(this.groupBox2); this.Controls.Add(this.label17); this.Controls.Add(this.label16); @@ -883,5 +913,9 @@ private System.Windows.Forms.CheckBox cbUseFallbackRule; private System.Windows.Forms.ComboBox cmbViewMode; private System.Windows.Forms.CheckBox cbRescanRulesAfterChannelChange; + private System.Windows.Forms.Button bImport; + private System.Windows.Forms.Button bExport; + private System.Windows.Forms.OpenFileDialog openFileDialog; + private System.Windows.Forms.SaveFileDialog saveFileDialog; } } \ No newline at end of file Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs 2008-02-05 09:42:35 UTC (rev 1340) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.cs 2008-02-07 08:27:37 UTC (rev 1341) @@ -41,10 +41,8 @@ LoadSettings(); } - public void LoadSettings() + public void RefreshFormComponents() { - currentSettings.LoadSettings(); - this.cbVerboseLog.Checked = currentSettings.verboseLog; this.cbShowSwitchMsg.Checked = currentSettings.ShowSwitchMsg; this.cbRescanRulesAfterChannelChange.Checked = currentSettings.RescanRulesAfterChannelChange; @@ -76,9 +74,14 @@ cbLBOverScan.Checked = currentSettings.LBOverScanEnabled; txtLBOverScan.Text = currentSettings.LBOberScan.ToString(); - } + public void LoadSettings() + { + currentSettings.LoadSettings(); + RefreshFormComponents(); + } + public void SaveSettings() { currentSettings.verboseLog = cbVerboseLog.Checked; @@ -110,7 +113,6 @@ currentSettings.LBOberScan = Convert.ToInt16(txtLBOverScan.Text); currentSettings.SaveSettings(); - } /// <summary> @@ -246,6 +248,36 @@ cmbViewMode.Enabled = cbUseFallbackRule.Checked; } + private void bExport_Click(object sender, EventArgs e) + { + saveFileDialog.AddExtension = true; + //saveFileDialog.DefaultExt = "VmsSettings"; + saveFileDialog.Filter = "ViewModeSwitcher config (*.VmsSettings)|*.VmsSettings|All files (*.*)|*.*"; + saveFileDialog.FilterIndex = 0; + saveFileDialog.InitialDirectory = Config.GetSubFolder(Config.Dir.Plugins, "Process"); + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + SaveSettings(); // make sure all settings are stored before + currentSettings.SaveSettings(saveFileDialog.FileName); + } + } + private void bImport_Click(object sender, EventArgs e) + { + openFileDialog.AddExtension = true; + openFileDialog.Filter = "ViewModeSwitcher config (*.VmsSettings)|*.VmsSettings|All files (*.*)|*.*"; + openFileDialog.FilterIndex = 0; + openFileDialog.InitialDirectory = Config.GetSubFolder(Config.Dir.Plugins, "Process"); + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + if (!currentSettings.LoadSettings(openFileDialog.FileName)) + { + MessageBox.Show("Import Error!"); + } + else RefreshFormComponents(); // refresh the form + } + } + + } } \ No newline at end of file Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx 2008-02-05 09:42:35 UTC (rev 1340) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherConfig.resx 2008-02-07 08:27:37 UTC (rev 1341) @@ -156,4 +156,49 @@ <metadata name="ColEnableLBDetect.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> + <metadata name="ColEnabled.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColRuleName.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColARFrom.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColARTo.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColMinWidth.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColMaxWidth.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColMinHeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColMaxHeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColChangeAR.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColViewMode.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColChangeOS.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColOverscan.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="ColEnableLBDetect.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>157, 17</value> + </metadata> </root> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |