From: <mis...@us...> - 2007-10-06 22:11:53
|
Revision: 979 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=979&view=rev Author: misterd_sf Date: 2007-10-06 15:11:51 -0700 (Sat, 06 Oct 2007) Log Message: ----------- - Improved performance of the external osd library. Now only an update occures, if it is needed. - Fixed Labels in external osd library - Suspend and resume layout of MP form while adding/removing elements Modified Paths: -------------- trunk/plugins/My MPlayer/ExternalOSDLibrary/BaseWindow.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/DialogWindow.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/BaseElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ButtonElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/CheckMarkElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/FadeLabelElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ImageElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/LabelElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ListElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ProgressControlElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/SliderElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/TextScrollUpElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ToggleButtonElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/VerticalScrollbarElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/VolumeBarElement.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/FullscreenWindow.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/OSDController.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/OSDForm.cs trunk/plugins/My MPlayer/ExternalOSDLibrary/OSDWindow.cs trunk/plugins/My MPlayer/MPlayer_ExtPlayer/VideoHandler.cs Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/BaseWindow.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/BaseWindow.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/BaseWindow.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -39,6 +39,16 @@ /// List of all elements of the window /// </summary> protected List<BaseElement> _elementList; + + /// <summary> + /// Indicates, if the window is visible + /// </summary> + private bool _visible; + + /// <summary> + /// Indicates, if the visibility of the window has changed + /// </summary> + protected bool _visibleChanged; #endregion #region protected methods @@ -114,7 +124,7 @@ /// <param name="graph">Graphics of the bitmap</param> public void DrawWindow(Graphics graph) { try { - if (IsWindowVisible()) { + if (_visible) { foreach (BaseElement element in _elementList) { element.DrawElement(graph); } @@ -123,6 +133,38 @@ Log.Error(ex); } } + + /// <summary> + /// Indicates if the window is currently visible + /// </summary> + /// <returns>true, if window is visible; false otherwise</returns> + public bool CheckVisibility() { + bool result = CheckSpecificVisibility(); + if (result != _visible) { + _visible = result; + _visibleChanged = true; + } + return result; + } + + /// <summary> + /// Checks, if an update is needed for this window + /// </summary> + /// <returns>true, if an update is needed; false otherwise</returns> + public bool CheckForUpdate() { + CheckVisibility(); + bool result = false; + if (_visibleChanged) { + _visibleChanged = false; + result = true; + } + if (_visible) { + foreach (BaseElement element in _elementList) { + result = result | element.CheckForUpdate(); + } + } + return result; + } #endregion #region abstract methods @@ -130,7 +172,7 @@ /// Indicates if the window is currently visible /// </summary> /// <returns>true, if window is visible; false otherwise</returns> - public abstract bool IsWindowVisible(); + protected abstract bool CheckSpecificVisibility(); #endregion #region IDisposable Member Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/DialogWindow.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/DialogWindow.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/DialogWindow.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -60,7 +60,7 @@ /// Indicates if the window is currently visible /// </summary> /// <returns>true, if window is visible; false otherwise</returns> - public override bool IsWindowVisible() { + protected override bool CheckSpecificVisibility() { return GUIWindowManager.RoutedWindow == _dialogWindow.GetID; } #endregion Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/BaseElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/BaseElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/BaseElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -34,13 +34,41 @@ /// <summary> /// Base class for all gui elements /// </summary> - public abstract class BaseElement : IDisposable{ + public abstract class BaseElement : IDisposable { + #region variables + /// <summary> + /// Indicates, if the element was visible + /// </summary> + protected bool _wasVisible; + + /// <summary> + /// Control of the base element + /// </summary> + protected GUIControl _control; + #endregion + + #region ctor + /// <summary> + /// Initialize the base element + /// </summary> + /// <param name="control">GUIControl</param> + public BaseElement(GUIControl control) { + _control = control; + } + #endregion + #region abstract methods /// <summary> /// Draws the element on the given graphics /// </summary> /// <param name="graph">Graphics</param> public abstract void DrawElement(Graphics graph); + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected abstract bool CheckElementSpecificForUpdate(); #endregion #region protected methods @@ -119,6 +147,22 @@ /// <param name="cacheFill">Status of the cache</param> public virtual void DrawCacheStatus(Graphics graph, float cacheFill) { } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + public bool CheckForUpdate() { + bool newVisible = _control.Visible; + if (newVisible == _wasVisible) { + return CheckElementSpecificForUpdate(); + } + _wasVisible = newVisible; + if (newVisible) { + CheckElementSpecificForUpdate(); + } + return true; + } #endregion #region IDisposable Member Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ButtonElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ButtonElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ButtonElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -96,6 +96,16 @@ /// Height of the hover image /// </summary> private int _hoverHeight; + + /// <summary> + /// Indicates, if the button is focused + /// </summary> + private bool _focus; + + /// <summary> + /// Label of the button + /// </summary> + private String _label; #endregion #region ctor @@ -103,7 +113,8 @@ /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> - public ButtonElement(GUIControl control) { + public ButtonElement(GUIControl control) + : base(control) { _button = control as GUIButtonControl; _font = getFont(_button.FontName); _focusBitmap = loadBitmap(_button.TexutureFocusName); @@ -129,6 +140,8 @@ FieldInfo hoverHeightFieldInfo = buttonType.GetField("_hoverHeight", BindingFlags.NonPublic | BindingFlags.Instance); _hoverHeight = Int32.Parse(hoverHeightFieldInfo.GetValue(_button).ToString()); + _label = _button.Label; + _focus = _button.Focus; Log.Debug("VideoPlayerOSD: Found button element: " + _button.GetID); } #endregion @@ -140,7 +153,7 @@ /// <param name="graph">Graphics</param> public override void DrawElement(Graphics graph) { if (_button.Visible) { - if (_button.Focus) { + if (_focus) { if (_focusBitmap != null) { graph.DrawImage(_focusBitmap, (float)_button.Location.X, (float)_button.Location.Y, (float)_button.Size.Width, (float)_button.Size.Height); } @@ -171,8 +184,7 @@ break; } Rectangle rectangle = new Rectangle(x, _button.YPosition + _button.TextOffsetY, labelWidth, _button.Height); - String label = _button.Label; - graph.DrawString(GUIPropertyManager.Parse(label), _font, brush, rectangle, StringFormat.GenericTypographic); + graph.DrawString(_label, _font, brush, rectangle, StringFormat.GenericTypographic); brush.Dispose(); } } @@ -186,6 +198,24 @@ _hoverBitmap.Dispose(); _font.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + bool result = false; + String newLabel = GUIPropertyManager.Parse(_button.Label); + if (!newLabel.Equals(_label)) { + _label = newLabel; + result = true; + } + if (_button.Focus != _focus) { + _focus = _button.Focus; + result = true; + } + return result; + } #endregion } } Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/CheckMarkElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/CheckMarkElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/CheckMarkElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -76,6 +76,26 @@ /// Text color /// </summary> private Color _textColor; + + /// <summary> + /// Indicates, if the checkmark is focused + /// </summary> + private bool _focus; + + /// <summary> + /// Indicates, if the checkmark is selected + /// </summary> + private bool _selected; + + /// <summary> + /// Indicates, if the checkmark is disabled + /// </summary> + private bool _disabled; + + /// <summary> + /// Label of the button + /// </summary> + private String _label; #endregion #region ctor @@ -83,7 +103,8 @@ /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> - public CheckMarkElement(GUIControl control) { + public CheckMarkElement(GUIControl control) + : base(control) { _checkMark = control as GUICheckMarkControl; Type buttonType = typeof(GUICheckMarkControl); FieldInfo checkFocusFieldInfo = buttonType.GetField("_checkMarkFocusTextureName", @@ -101,6 +122,10 @@ _font = getFont(_checkMark.FontName); _disabledColor = GetColor(_checkMark.DisabledColor); _textColor = GetColor(_checkMark.TextColor); + _focus = _checkMark.Focus; + _selected = _checkMark.Selected; + _disabled = _checkMark.Disabled; + _label = _checkMark.Label; Log.Debug("VideoPlayerOSD: Found checkMark element: " + _checkMark.GetID); } #endregion @@ -114,37 +139,36 @@ if (_checkMark.Visible) { int dwTextPosX = _checkMark.XPosition; int dwCheckMarkPosX = _checkMark.XPosition; - Rectangle _rectangle = new Rectangle() ; + Rectangle _rectangle = new Rectangle(); _rectangle.X = _checkMark.YPosition; _rectangle.Y = _checkMark.YPosition; _rectangle.Height = _checkFocusBitmap.Height; if (null != _font) { - SizeF sizeF ; + SizeF sizeF; if (_checkMark.TextAlignment == GUIControl.Alignment.ALIGN_LEFT) { - sizeF = graph.MeasureString(_checkMark.Label, _font); + sizeF = graph.MeasureString(GUIPropertyManager.Parse(_label), _font); dwCheckMarkPosX += ((int)(sizeF.Width) + 5); } else { dwTextPosX = (dwCheckMarkPosX + _checkFocusBitmap.Width + 5); - sizeF = graph.MeasureString(_checkMark.Label, _font); + sizeF = graph.MeasureString(GUIPropertyManager.Parse(_label), _font); } - if (_checkMark.Disabled) { + if (_disabled) { SolidBrush brush = new SolidBrush(_disabledColor); - graph.DrawString(_checkMark.Label, _font, brush, dwTextPosX, _checkMark.YPosition); + graph.DrawString(GUIPropertyManager.Parse(_label), _font, brush, dwTextPosX, _checkMark.YPosition); brush.Dispose(); } else { - if (_checkMark.Focus) { + if (_focus) { SolidBrush brush = new SolidBrush(_textColor); - graph.DrawString(_checkMark.Label, _font, brush, dwTextPosX, _checkMark.YPosition); + graph.DrawString(GUIPropertyManager.Parse(_label), _font, brush, dwTextPosX, _checkMark.YPosition); brush.Dispose(); - } - else { + } else { SolidBrush brush = new SolidBrush(_disabledColor); - graph.DrawString(_checkMark.Label, _font, brush, dwTextPosX, _checkMark.YPosition); + graph.DrawString(GUIPropertyManager.Parse(_label), _font, brush, dwTextPosX, _checkMark.YPosition); brush.Dispose(); } } } - if (_checkMark.Selected) { + if (_selected) { graph.DrawImage(_checkFocusBitmap, dwCheckMarkPosX, _checkMark.YPosition); } else { graph.DrawImage(_checkNoFocusBitmap, dwCheckMarkPosX, _checkMark.YPosition); @@ -159,6 +183,32 @@ _checkFocusBitmap.Dispose(); _checkNoFocusBitmap.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + bool result = false; + String newLabel = GUIPropertyManager.Parse(_checkMark.Label); + if (!newLabel.Equals(_label)) { + _label = newLabel; + result = true; + } + if (_checkMark.Focus != _focus) { + _focus = _checkMark.Focus; + result = true; + } + if (_checkMark.Disabled != _disabled) { + _disabled = _checkMark.Disabled; + result = true; + } + if (_checkMark.Selected != _selected) { + _selected = _checkMark.Selected; + result = true; + } + return result; + } #endregion } } Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/FadeLabelElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/FadeLabelElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/FadeLabelElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -48,6 +48,11 @@ /// Brush /// </summary> private Brush _brush; + + /// <summary> + /// Label of the fade label + /// </summary> + private String _labelString; #endregion #region ctor @@ -55,10 +60,12 @@ /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> - public FadeLabelElement(GUIControl control) { + public FadeLabelElement(GUIControl control) + : base(control) { _label = control as GUIFadeLabel; _font = getFont(_label.FontName); _brush = new SolidBrush(GetColor(_label.TextColor)); + _labelString = _label.Label; Log.Debug("VideoPlayerOSD: Found label element: " + _label.Name + "/" + _font.Name); } #endregion @@ -92,6 +99,20 @@ _font.Dispose(); _brush.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + bool result = false; + String newLabel = GUIPropertyManager.Parse(_label.Label); + if (!newLabel.Equals(_labelString)) { + _labelString = newLabel; + result = true; + } + return result; + } #endregion } } Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ImageElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ImageElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ImageElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -52,7 +52,8 @@ /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> - public ImageElement(GUIControl control) { + public ImageElement(GUIControl control) + : base(control) { _image = control as GUIImage; _bitmap = loadBitmap(_image.FileName); Log.Debug("VideoPlayerOSD: Found image element: " + _image.FileName); @@ -76,6 +77,15 @@ public override void Dispose() { _bitmap.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + return false; + } + #endregion #region public methods Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/LabelElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/LabelElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/LabelElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -48,6 +48,11 @@ /// Brush /// </summary> private Brush _brush; + + /// <summary> + /// Label String + /// </summary> + private String _labelString; #endregion #region ctor @@ -55,10 +60,12 @@ /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> - public LabelElement(GUIControl control) { + public LabelElement(GUIControl control) + : base(control) { _label = control as GUILabelControl; _font = getFont(_label.FontName); _brush = new SolidBrush(GetColor(_label.TextColor)); + _labelString = _label.Label; Log.Debug("VideoPlayerOSD: Found label element: " + _label.Name + "/" + _font.Name); } #endregion @@ -70,7 +77,7 @@ /// <param name="graph">Graphics</param> public override void DrawElement(Graphics graph) { if (_label.Visible) { - DrawStandard(graph, _label.Label); + DrawStandard(graph, _labelString); } } @@ -80,6 +87,20 @@ public override void Dispose() { _font.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + bool result = false; + String newLabel = GUIPropertyManager.Parse(_label.Label); + if (!newLabel.Equals(_labelString)) { + _labelString = newLabel; + result = true; + } + return result; + } #endregion #region public methods @@ -96,7 +117,7 @@ FontStyle style = _font.Style | FontStyle.Strikeout; temp = new Font(_font.FontFamily.Name, _font.Size, style); } - graph.DrawString(GUIPropertyManager.Parse(label), temp, _brush, rectangle, StringFormat.GenericTypographic); + graph.DrawString(label, temp, _brush, rectangle, StringFormat.GenericTypographic); } /// <summary> @@ -106,7 +127,7 @@ /// <param name="label">Label</param> /// <returns>Rectangle</returns> public RectangleF GetStringRectangle(Graphics graph, String label) { - SizeF size = graph.MeasureString(label, _font); + SizeF size = graph.MeasureString(label, _font); return new RectangleF((float)_label.Location.X, (float)_label.Location.Y, size.Width, _label.Height); } #endregion @@ -118,7 +139,7 @@ /// <param name="graph">Graphics</param> /// <param name="cacheFill">Status of the cache</param> public override void DrawCacheStatus(Graphics graph, float cacheFill) { - if(_label.Label.Contains("#currentremaining")){ + if (_label.Label.Contains("#currentremaining")) { DrawStandard(graph, String.Format("{0:00.00}", cacheFill) + " %"); } } Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ListElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ListElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ListElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -74,6 +74,11 @@ /// Height /// </summary> private float _height; + + /// <summary> + /// Indicates if an update is needed + /// </summary> + private bool needUpdate; #endregion #region ctor @@ -86,7 +91,8 @@ /// <param name="height">Height</param> /// <param name="buttonFocusName">FileName of the focus image</param> /// <param name="buttonNonFocusName">FileName of the non focus image</param> - public ListButtonElement(int positionX, int positionY, float width, float height, String buttonFocusName, String buttonNonFocusName) { + public ListButtonElement(int positionX, int positionY, float width, float height, String buttonFocusName, String buttonNonFocusName) + : base(null) { _imageFocus = loadBitmap(buttonFocusName); _imageNonFocus = loadBitmap(buttonNonFocusName); _positionX = positionX; @@ -121,6 +127,18 @@ _imageFocus.Dispose(); _imageNonFocus.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + bool result = needUpdate; + if (needUpdate) { + needUpdate = false; + } + return result; + } #endregion #region properties @@ -129,7 +147,12 @@ /// </summary> public bool Focus { get { return _focus; } - set { _focus = value; } + set { + if (_focus != value) { + needUpdate = true; + } + _focus = value; + } } #endregion @@ -197,7 +220,8 @@ /// <summary> /// Creates the element /// </summary> - public ListLabelElement() { + public ListLabelElement() + : base(null) { _xPosition = 0f; _yPosition = 0f; _width = 0f; @@ -231,6 +255,14 @@ _brush.Dispose(); _font.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + return false; + } #endregion #region properties @@ -417,6 +449,11 @@ /// VerticalScrollbarElement /// </summary> private VerticalScrollBarElement _verticalScrollBarElement; + + /// <summary> + /// Indicates, if the list is focused + /// </summary> + private bool _focus; #endregion #region ctor @@ -424,7 +461,8 @@ /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> - public ListElement(GUIControl control) { + public ListElement(GUIControl control) + : base(control) { _list = control as GUIListControl; Type listType = typeof(GUIListControl); FieldInfo alignmentFieldInfo = listType.GetField("_textAlignment", @@ -479,6 +517,9 @@ BindingFlags.NonPublic | BindingFlags.Instance); initializeLabels(); _verticalScrollBarElement = new VerticalScrollBarElement(_list.Scrollbar); + _offset = (int)_offsetFieldInfo.GetValue(_list); + _cursorX = (int)_cursorXFieldInfo.GetValue(_list); + _focus = _list.IsFocused; Log.Debug("VideoPlayerOSD: Found list element: "); } #endregion @@ -491,8 +532,6 @@ public override void DrawElement(Graphics graph) { if (_list.Visible) { _listItems = _listItemsFieldInfo.GetValue(_list) as List<GUIListItem>; - _offset = (int)_offsetFieldInfo.GetValue(_list); - _cursorX = (int)_cursorXFieldInfo.GetValue(_list); int dwPosY = _list.YPosition; // Render the buttons first. for (int i = 0; i < _itemsPerPage; i++) { @@ -567,6 +606,29 @@ element.Dispose(); } } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + bool result = false; + int newOffset = (int)_offsetFieldInfo.GetValue(_list); + int newCursorX = (int)_cursorXFieldInfo.GetValue(_list); + if (_offset!=newOffset) { + _offset = newOffset; + result = true; + } + if (newCursorX !=_cursorX) { + _cursorX = newCursorX; + result = true; + } + if (_list.IsFocused != _focus) { + _focus = _list.IsFocused; + result = true; + } + return result; + } #endregion #region private methods Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ProgressControlElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ProgressControlElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ProgressControlElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -59,6 +59,11 @@ /// Background image /// </summary> private Bitmap _backgroundBitmap; + + /// <summary> + /// Percentage of the progress control + /// </summary> + private int _percentage; #endregion #region ctor @@ -66,12 +71,14 @@ /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> - public ProgressControlElement(GUIControl control) { + public ProgressControlElement(GUIControl control) + : base(control) { _progressControl = control as GUIProgressControl; _leftBitmap = loadBitmap(_progressControl.BackTextureLeftName); _midBitmap = loadBitmap(_progressControl.BackTextureMidName); _rightBitmap = loadBitmap(_progressControl.BackTextureRightName); _backgroundBitmap = loadBitmap(_progressControl.BackGroundTextureName); + _percentage = GetPercentage(); Log.Debug("VideoPlayerOSD: Found progess control"); } #endregion @@ -83,11 +90,8 @@ /// <param name="graph">Graphics</param> public override void DrawElement(Graphics graph) { if (_progressControl.Visible) { - int percent = 0; - Int32.TryParse(GUIPropertyManager.Parse(_progressControl.Property), out percent); - if (percent > 100) percent = 100; - float fWidth = (float)percent; - DrawProgressBar(graph,fWidth,percent); + float fWidth = (float)_percentage; + DrawProgressBar(graph,fWidth,_percentage); } } @@ -100,6 +104,20 @@ _rightBitmap.Dispose(); _backgroundBitmap.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + bool result = false; + int newPercentage = GetPercentage(); + if (newPercentage != _percentage) { + _percentage = newPercentage; + result = true; + } + return result; + } #endregion #region public overrides methods @@ -152,6 +170,17 @@ graph.DrawImage(_rightBitmap, iXPos, iYPos, iWidthRight, iHeightRight); } } + + /// <summary> + /// Calculates the percentage of the control + /// </summary> + /// <returns></returns> + private int GetPercentage() { + int percent = 0; + Int32.TryParse(GUIPropertyManager.Parse(_progressControl.Property), out percent); + if (percent > 100) percent = 100; + return percent; + } #endregion } } Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/SliderElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/SliderElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/SliderElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -41,21 +41,36 @@ /// GUISliderControl /// </summary> private GUISliderControl _slider; - + /// <summary> /// Background image /// </summary> private Bitmap _backgroundBitmap; - + /// <summary> /// Slider image /// </summary> private Bitmap _sliderBitmap; - + /// <summary> /// Slider focus image /// </summary> private Bitmap _sliderFocusBitmap; + + /// <summary> + /// String value of the slider element + /// </summary> + private String _strValue; + + /// <summary> + /// Percentage of the slider element + /// </summary> + private int _percentage; + + /// <summary> + /// Indicates, if the element is focused + /// </summary> + private bool _focus; #endregion #region ctor @@ -63,7 +78,8 @@ /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> - public SliderElement(GUIControl control) { + public SliderElement(GUIControl control) + : base(control) { _slider = control as GUISliderControl; Type buttonType = typeof(GUISliderControl); FieldInfo backgroundBitmapFieldInfo = buttonType.GetField("_backgroundTextureName", @@ -75,6 +91,9 @@ FieldInfo sliderFocusBitmapFieldInfo = buttonType.GetField("_sliderFocusTextureName", BindingFlags.NonPublic | BindingFlags.Instance); _sliderFocusBitmap = loadBitmap(sliderFocusBitmapFieldInfo.GetValue(_slider).ToString()); + _focus = _slider.Focus; + _percentage = _slider.Percentage; + _strValue = getStringValue(); Log.Debug("VideoPlayerOSD: Found slider element: " + _slider.GetID); } #endregion @@ -89,31 +108,14 @@ string strValue = ""; float fPos = 0.0f; Font font = getFont("font13"); - float backgroundPositionX = (float) _slider.XPosition; + float backgroundPositionX = (float)_slider.XPosition; float backgroundPositionY = (float)_slider.YPosition; - switch (_slider.SpinType) { - // Float based slider - case GUISpinControl.SpinType.SPIN_CONTROL_TYPE_FLOAT: - strValue = String.Format("{0}", _slider.FloatValue); - if (null != font) { - SolidBrush brush = new SolidBrush(Color.FromArgb(255,255,255,255)); - graph.DrawString(GUIPropertyManager.Parse(strValue), font, brush, (float)_slider.XPosition, (float)_slider.YPosition); - brush.Dispose(); - } - backgroundPositionX += 60; - break; - - // Integer based slider - case GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT: - strValue = String.Format("{0}/{1}", _slider.IntValue, 100); - if (null != font) { - SolidBrush brush = new SolidBrush(Color.FromArgb(255, 255, 255, 255)); - graph.DrawString(GUIPropertyManager.Parse(strValue), font, brush, (float)_slider.XPosition, (float)_slider.YPosition); - brush.Dispose(); - } - backgroundPositionX += 60; - break; + if (null != font) { + SolidBrush brush = new SolidBrush(Color.FromArgb(255, 255, 255, 255)); + graph.DrawString(GUIPropertyManager.Parse(strValue), font, brush, (float)_slider.XPosition, (float)_slider.YPosition); + brush.Dispose(); } + backgroundPositionX += 60; //int iHeight=25; graph.DrawImage(_backgroundBitmap, backgroundPositionX, backgroundPositionY, _backgroundBitmap.Width, _backgroundBitmap.Height); @@ -122,7 +124,7 @@ float _width = _backgroundBitmap.Width + 60; float fWidth = (float)(_backgroundBitmap.Width - _sliderBitmap.Width); //-20.0f; - fPos = (float)_slider.Percentage; + fPos = (float)_percentage; fPos /= 100.0f; fPos *= fWidth; fPos += backgroundPositionX; @@ -145,6 +147,45 @@ _sliderBitmap.Dispose(); _sliderFocusBitmap.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + bool result = false; + if (_slider.Percentage != _percentage) { + _percentage = _slider.Percentage; + result = true; + } + if (_slider.Focus != _focus) { + _focus = _slider.Focus; + result = true; + } + String newStrValue = getStringValue(); + if (newStrValue != _strValue) { + _strValue = newStrValue; + result = true; + } + return result; + } #endregion + + #region private methods + private String getStringValue() { + String strValue = String.Empty; + switch (_slider.SpinType) { + // Float based slider + case GUISpinControl.SpinType.SPIN_CONTROL_TYPE_FLOAT: + strValue = String.Format("{0}", _slider.FloatValue); + break; + // Integer based slider + case GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT: + strValue = String.Format("{0}/{1}", _slider.IntValue, 100); + break; + } + return strValue; + } + #endregion } } Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/TextScrollUpElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/TextScrollUpElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/TextScrollUpElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -56,6 +56,11 @@ /// Alignment of the message /// </summary> private GUIControl.Alignment _alignment; + + /// <summary> + /// Label of the text scrollup element + /// </summary> + private String _label; #endregion #region ctor @@ -63,7 +68,8 @@ /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> - public TextScrollUpElement(GUIControl control) { + public TextScrollUpElement(GUIControl control) + : base(control) { _textScrollUp = control as GUITextScrollUpControl; Type textScrollUpType = typeof(GUITextScrollUpControl); FieldInfo fontNameFieldInfo = textScrollUpType.GetField("_fontName", @@ -73,6 +79,7 @@ FieldInfo alignmentFieldInfo = textScrollUpType.GetField("_textAlignment", BindingFlags.NonPublic | BindingFlags.Instance); _alignment = (GUIControl.Alignment)alignmentFieldInfo.GetValue(_textScrollUp); + _label = _textScrollUp.Property; Log.Debug("VideoPlayerOSD: Found textScrollUp element: " + _textScrollUp.GetID); } #endregion @@ -84,8 +91,7 @@ /// <param name="graph">Graphics</param> public override void DrawElement(Graphics graph) { if (_textScrollUp.Visible) { - String label = _textScrollUp.Property; - SizeF textSize = graph.MeasureString(label, _font); + SizeF textSize = graph.MeasureString(_label, _font); RectangleF rectangle; if (_alignment == GUIControl.Alignment.ALIGN_LEFT) { rectangle = new RectangleF((float)_textScrollUp.Location.X, (float)_textScrollUp.Location.Y, _textScrollUp.Width, _textScrollUp.Height); @@ -94,7 +100,7 @@ } else { rectangle = new RectangleF((float)_textScrollUp.Location.X - (textSize.Width / 2), (float)_textScrollUp.Location.Y - (textSize.Height / 2), _textScrollUp.Width, _textScrollUp.Height); } - graph.DrawString(GUIPropertyManager.Parse(label), _font, _brush, rectangle, StringFormat.GenericTypographic); + graph.DrawString(GUIPropertyManager.Parse(_label), _font, _brush, rectangle, StringFormat.GenericTypographic); } } @@ -105,6 +111,20 @@ _font.Dispose(); _brush.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + bool result = false; + String newLabel = GUIPropertyManager.Parse(_textScrollUp.Property); + if (!newLabel.Equals(_label)) { + _label = _textScrollUp.Property; + result = true; + } + return result; + } #endregion } } Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ToggleButtonElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ToggleButtonElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/ToggleButtonElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -81,6 +81,21 @@ /// Disabled color /// </summary> private Color _disabledColor; + + /// <summary> + /// Indicates, if the toogle button is focused + /// </summary> + private bool _focus; + + /// <summary> + /// Indicates, if the toogle button is selected + /// </summary> + private bool _selected; + + /// <summary> + /// Label of the toggle button + /// </summary> + private String _label; #endregion #region ctor @@ -88,7 +103,8 @@ /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> - public ToggleButtonElement(GUIControl control) { + public ToggleButtonElement(GUIControl control) + : base(control) { _button = control as GUIToggleButtonControl; _font = getFont(_button.FontName); Type buttonType = typeof(GUIToggleButtonControl); @@ -109,6 +125,9 @@ _alignment = (GUIControl.Alignment)alignmentFieldInfo.GetValue(_button); _textColor = GetColor(_button.TextColor); _disabledColor = GetColor(_button.DisabledColor); + _focus = _button.Focus; + _selected = _button.Selected; + _label = _button.Label; Log.Debug("VideoPlayerOSD: Found toggle button element: " + _button.GetID); } #endregion @@ -160,8 +179,7 @@ } Rectangle rectangle = new Rectangle(x, _button.YPosition + _button.TextOffsetY, labelWidth, _button.Height); - String label = _button.Label; - graph.DrawString(GUIPropertyManager.Parse(label), _font, brush, rectangle, StringFormat.GenericTypographic); + graph.DrawString(GUIPropertyManager.Parse(_label), _font, brush, rectangle, StringFormat.GenericTypographic); brush.Dispose(); } } @@ -176,6 +194,28 @@ _altNoFocusBitmap.Dispose(); _font.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + bool result = false; + String newLabel = GUIPropertyManager.Parse(_button.Label); + if (!newLabel.Equals(_label)) { + _label = newLabel; + result = true; + } + if (_button.Focus != _focus) { + _focus = _button.Focus; + result = true; + } + if (_button.Selected != _selected) { + _selected = _button.Selected; + result = true; + } + return result; + } #endregion } } Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/VerticalScrollbarElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/VerticalScrollbarElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/VerticalScrollbarElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -39,21 +39,26 @@ /// GUIVerticalScrollbar /// </summary> private GUIVerticalScrollbar _verticalScrollBar; - + /// <summary> /// Background image of the scrollbar /// </summary> private Bitmap _scrollBarBackground; - + /// <summary> /// Top image of the scrollbar /// </summary> private Bitmap _scrollBarTop; - + /// <summary> /// Bottom image of the scrollbar /// </summary> private Bitmap _scrollBarBottom; + + /// <summary> + /// Percentage + /// </summary> + private float _percentage; #endregion #region ctor @@ -61,7 +66,8 @@ /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> - public VerticalScrollBarElement(GUIControl control) { + public VerticalScrollBarElement(GUIControl control) + : base(control) { _verticalScrollBar = control as GUIVerticalScrollbar; Type verticalScrollBarType = typeof(GUIVerticalScrollbar); FieldInfo scrollBarBgFieldInfo = verticalScrollBarType.GetField("_scrollbarBackgroundName", @@ -75,7 +81,7 @@ FieldInfo scrollBarBottomFieldInfo = verticalScrollBarType.GetField("_scrollbarBottomTextureName", BindingFlags.NonPublic | BindingFlags.Instance); _scrollBarBottom = loadBitmap(scrollBarBottomFieldInfo.GetValue(_verticalScrollBar).ToString()); ; - + _percentage = _verticalScrollBar.Percentage; Log.Debug("VideoPlayerOSD: Found vertical scroll bar element "); } #endregion @@ -92,7 +98,7 @@ graph.DrawImage(_scrollBarBackground, _verticalScrollBar.XPosition, _verticalScrollBar.YPosition, _verticalScrollBar.Width, iHeight); - float fPercent = (float)_verticalScrollBar.Percentage; + float fPercent = _percentage; float fPosYOff = (fPercent / 100.0f); int _startPositionY = _verticalScrollBar.YPosition; @@ -120,6 +126,21 @@ _scrollBarTop.Dispose(); _scrollBarBottom.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + bool result = false; + int oldPercentage = (int)_percentage; + int newPercentage = (int)_verticalScrollBar.Percentage; + if (oldPercentage != newPercentage) { + _percentage = _verticalScrollBar.Percentage; + result = true; + } + return result; + } #endregion } } Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/VolumeBarElement.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/VolumeBarElement.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/Elements/VolumeBarElement.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -51,6 +51,26 @@ /// Alignment of the volume bar /// </summary> private GUIControl.Alignment _alignment; + + /// <summary> + /// Index of the first image + /// </summary> + private int _image1; + + /// <summary> + /// Index of the second image + /// </summary> + private int _image2; + + /// <summary> + /// Maximum value of the volume + /// </summary> + private int _maximum; + + /// <summary> + /// Current value of the volume + /// </summary> + private int _current; #endregion #region ctor @@ -58,7 +78,8 @@ /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> - public VolumeBarElement(GUIControl control) { + public VolumeBarElement(GUIControl control) + : base(control) { _volumeBar = control as GUIVolumeBar; Type volumeBarType = typeof(GUIVolumeBar); FieldInfo textureNameFieldInfo = volumeBarType.GetField("_textureName", @@ -68,6 +89,10 @@ String textureFileName = textureNameFieldInfo.GetValue(_volumeBar).ToString(); _alignment = (GUIControl.Alignment)alignmentFieldInfo.GetValue(_volumeBar); _bitmap = loadBitmap(textureFileName); + _image1 = _volumeBar.Image1; + _image2 = _volumeBar.Image2; + _maximum = _volumeBar.Maximum; + _current = _volumeBar.Current; Log.Debug("VideoPlayerOSD: Found volume bar element: " + textureFileName); } #endregion @@ -125,6 +150,31 @@ public override void Dispose() { _bitmap.Dispose(); } + + /// <summary> + /// Checks, if an update for the element is needed + /// </summary> + /// <returns>true, if an update is needed</returns> + protected override bool CheckElementSpecificForUpdate() { + bool result = false; + if (_volumeBar.Image1 != _image1) { + _image1 = _volumeBar.Image1; + result = true; + } + if (_volumeBar.Image2 != _image2) { + _image2 = _volumeBar.Image2; + result = true; + } + if (_volumeBar.Current != _current) { + _current = _volumeBar.Current; + result = true; + } + if (_volumeBar.Maximum!= _maximum) { + _maximum= _volumeBar.Maximum; + result = true; + } + return result; + } #endregion } } Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/FullscreenWindow.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/FullscreenWindow.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/FullscreenWindow.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -114,7 +114,7 @@ /// Indicates if the window is currently visible /// </summary> /// <returns>true, if window is visible; false otherwise</returns> - public override bool IsWindowVisible() { + protected override bool CheckSpecificVisibility() { return GUIWindowManager.ActiveWindow == _fullscreenWindow.GetID; } #endregion Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/OSDController.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/OSDController.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/OSDController.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -26,6 +26,7 @@ using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; +using System.Drawing.Text; using System.Threading; using MediaPortal.GUI.Library; @@ -100,6 +101,11 @@ /// Indicates, if the init label should be displayed /// </summary> private bool _showInit; + + /// <summary> + /// Indicates, if an update is needed + /// </summary> + private bool _needUpdate; #endregion #region ctor @@ -140,39 +146,43 @@ /// Performs an update on the osd, should be called from the process method of the player /// </summary> public void UpdateGUI() { - Bitmap image = new Bitmap(_osdForm.Width, _osdForm.Height); - Graphics graph = Graphics.FromImage(image); - if (GUIGraphicsContext.Fullscreen) { - graph.FillRectangle(new SolidBrush(Color.FromArgb(0, 0, 0)), new Rectangle(0, 0, _osdForm.Width, _osdForm.Height)); + bool update = _needUpdate | _videoOSDWindow.CheckForUpdate() | _dialogWindow.CheckForUpdate() | _fullscreenWindow.CheckForUpdate(); + if(_needUpdate){ + _needUpdate=false; + }else{ + if (_showAdditionalOSD) { + TimeSpan ts = DateTime.Now - _lastUpdate; + if (ts.Seconds >= 3){ + _showAdditionalOSD = false; + update = true; + } + } } - graph.SmoothingMode = SmoothingMode.AntiAlias; - if (_showAdditionalOSD) { - TimeSpan ts = DateTime.Now - _lastUpdate; - if (ts.Seconds < 3) { - _fullscreenWindow.DrawAlternativeOSD(graph, _label, _strikeOut); - } else { - _showAdditionalOSD = false; + if (update) { + Bitmap image = new Bitmap(_osdForm.Width, _osdForm.Height); + Graphics graph = Graphics.FromImage(image); + if (GUIGraphicsContext.Fullscreen) { + graph.FillRectangle(new SolidBrush(Color.FromArgb(0, 0, 0)), new Rectangle(0,0,_osdForm.Size.Width,_osdForm.Size.Height)); } - } - if (_showInit) { - _fullscreenWindow.DrawAlternativeOSD(graph, _label, false); - } - if (_showCacheStatus) { - _fullscreenWindow.DrawCacheStatus(graph, _cacheFill); - } - if (_fullscreenWindow.IsWindowVisible()) { + graph.TextRenderingHint = TextRenderingHint.AntiAlias; + graph.SmoothingMode = SmoothingMode.AntiAlias; + if (_showAdditionalOSD) { + _fullscreenWindow.DrawAlternativeOSD(graph, _label, _strikeOut); + } + if (_showInit) { + _fullscreenWindow.DrawAlternativeOSD(graph, _label, false); + } + if (_showCacheStatus) { + _fullscreenWindow.DrawCacheStatus(graph, _cacheFill); + } _fullscreenWindow.DrawWindow(graph); - } - if (_videoOSDWindow.IsWindowVisible()) { _videoOSDWindow.DrawWindow(graph); - } - if (_dialogWindow.IsWindowVisible()) { _dialogWindow.DrawWindow(graph); + _osdForm.Image = image; + _osdForm.Refresh(); + _osdForm2.Image = image; + _osdForm2.Refresh(); } - _osdForm.Image = image; - _osdForm.Refresh(); - _osdForm2.Image = image; - _osdForm2.Refresh(); } /// <summary> @@ -188,7 +198,7 @@ /// </summary> /// <returns></returns> public bool IsOSDVisible() { - return _videoOSDWindow.IsWindowVisible(); + return _videoOSDWindow.CheckVisibility(); } /// <summary> @@ -202,6 +212,7 @@ _lastUpdate = DateTime.Now; _showAdditionalOSD = true; _showCacheStatus = false; + _needUpdate = true; } /// <summary> @@ -212,6 +223,7 @@ _cacheFill = cacheFill; _showAdditionalOSD = false; _showCacheStatus = true; + _needUpdate = true; } /// <summary> @@ -219,6 +231,7 @@ /// </summary> public void HideCacheStatus() { _showCacheStatus = false; + _needUpdate = true; } /// <summary> @@ -230,6 +243,7 @@ _showInit = true; _showCacheStatus = false; _showAdditionalOSD = false; + _needUpdate = true; } /// <summary> @@ -237,6 +251,7 @@ /// </summary> public void HideInit() { _showInit = false; + _needUpdate = true; } #endregion Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/OSDForm.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/OSDForm.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/OSDForm.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -73,6 +73,7 @@ this.Opacity = 1; this.GotFocus += new EventHandler(OSDForm_GotFocus); _parent.LocationChanged += _posLocChanged; + _parent.ClientSizeChanged += _posLocChanged; _parent.SizeChanged += _posLocChanged; } #endregion @@ -105,6 +106,7 @@ private void parent_PositionSizeChanged(Object sender, EventArgs args) { this.Location = _parent.PointToScreen(new Point(0, 0)); this.Size = _parent.ClientSize; + this.BringToFront(); } #endregion @@ -117,8 +119,6 @@ try { _parent.LocationChanged -= _posLocChanged; _parent.SizeChanged -= _posLocChanged; - this.BringToFront(); - this.Refresh(); } catch (Exception ex) { Log.Error(ex); } @@ -149,8 +149,8 @@ public void ShowForm() { this.Enabled = true; this.Show(_parent); + parent_PositionSizeChanged(null, null); this.BringToFront(); - parent_PositionSizeChanged(null, null); _parent.Focus(); this.Enabled = false; } Modified: trunk/plugins/My MPlayer/ExternalOSDLibrary/OSDWindow.cs =================================================================== --- trunk/plugins/My MPlayer/ExternalOSDLibrary/OSDWindow.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/ExternalOSDLibrary/OSDWindow.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -59,7 +59,7 @@ /// Indicates if the window is currently visible /// </summary> /// <returns>true, if window is visible; false otherwise</returns> - public override bool IsWindowVisible() { + protected override bool CheckSpecificVisibility() { return GUIWindowManager.VisibleOsd == GUIWindow.Window.WINDOW_OSD; } #endregion Modified: trunk/plugins/My MPlayer/MPlayer_ExtPlayer/VideoHandler.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/VideoHandler.cs 2007-10-05 16:35:46 UTC (rev 978) +++ trunk/plugins/My MPlayer/MPlayer_ExtPlayer/VideoHandler.cs 2007-10-06 22:11:51 UTC (rev 979) @@ -451,16 +451,20 @@ /// Adss the video window to the mediaportal form /// </summary> public void AddVideoWindowToForm() { + GUIGraphicsContext.form.SuspendLayout(); GUIGraphicsContext.form.Controls.Add(_mplayerBackgroundPanel); GUIGraphicsContext.form.Controls.Add(_mplayerOuterPanel); + GUIGraphicsContext.form.ResumeLayout(); } /// <summary> /// Removes the video window from the mediaportal form /// </summary> public void RemoveVideoWindowToForm() { + GUIGraphicsContext.form.SuspendLayout(); GUIGraphicsContext.form.Controls.Remove(_mplayerBackgroundPanel); GUIGraphicsContext.form.Controls.Remove(_mplayerOuterPanel); + GUIGraphicsContext.form.ResumeLayout(); } #endregion This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |