Пример #1
0
    public FontRenderContext(GUIFont font, string t)
    {
      string text = font.GetRTLText(t);

      _outOfBounds = font.containsOutOfBoundsChar(text);

      _ptrStr = Marshal.StringToCoTaskMemUni(text);
    }
Пример #2
0
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();

      HasCamera = _hasCamera;
      Camera = new System.Drawing.Point(_cameraXPos, _cameraYPos);

      _font1 = GUIFontManager.GetFont(_fontName1);
      _font2 = GUIFontManager.GetFont(_fontName2);

      // Create the background.
      _imageBackground = LoadAnimationControl(_controlId, 0, _backgroundPositionX, _backgroundPositionY,
                                              _backgroundWidth, _backgroundHeight, _backgroundTextureName);
      _imageBackground.ParentControl = this;
      _imageBackground.DimColor = DimColor;

      // Create the foreground.
      _imageForeground = LoadAnimationControl(_controlId, 0, _foregroundPositionX, _foregroundPositionY,
                                              _foregroundWidth, _foregroundHeight, _foregroundTextureName);
      _imageForeground.ParentControl = this;
      _imageForeground.DimColor = DimColor;

      // Create a single focus frame for the card that is in focus.
      _frameFocus = LoadAnimationControl(0, 0,
                                         0, 0,
                                         _cardWidth, _cardHeight,
                                         _frameFocusName);
      _frameFocus.ParentControl = null;
      _frameFocus.DimColor = DimColor;
      _frameFocus.FlipY = _flipY;
      _frameFocus.DiffuseFileName = _diffuseFilename;
      _frameFocus.MaskFileName = _maskFilename;
      _frameFocus.AllocResources();

      // Create the card labels.
      int y = _positionY + _label1OffsetY;
      _label1 = new GUILabelControl(_controlId, 0,
                                    0, y,
                                    Width, 0,
                                    _fontName1, "", 0x0,
                                    Alignment.ALIGN_CENTER, VAlignment.ALIGN_TOP,
                                    false,
                                    _shadowAngle, _shadowDistance, _shadowColor);

      y = _positionY + _label2OffsetY;
      _label2 = new GUILabelControl(_controlId, 0,
                                    0, y,
                                    Width, 0,
                                    _fontName2, "", 0x0,
                                    Alignment.ALIGN_CENTER, VAlignment.ALIGN_TOP,
                                    false,
                                    _shadowAngle, _shadowDistance, _shadowColor);

      // Create the horizontal scrollbar.
      int scrollbarWidth = _scrollbarWidth;
      int scrollbarHeight = _scrollbarHeight;
      GUIGraphicsContext.ScaleHorizontal(ref scrollbarWidth);
      GUIGraphicsContext.ScaleVertical(ref scrollbarHeight);
      int scrollbarPosX = _positionX + (_width / 2) - (scrollbarWidth / 2);

      _horizontalScrollbar = new GUIHorizontalScrollbar(_controlId, 0,
                                                        scrollbarPosX, _positionY + _scrollbarOffsetY,
                                                        scrollbarWidth, scrollbarHeight,
                                                        _scrollbarBackgroundTextureName, _scrollbarLeftTextureName,
                                                        _scrollbarRightTextureName);
      _horizontalScrollbar.ParentControl = this;
      _horizontalScrollbar.DimColor = DimColor;

      // Create controls for the back of the selected card.  All of the controls are provided as a single subitem.      
      XmlDocument doc = new XmlDocument();

      if (SubItemCount > 0) // avoid exception when no SubItems are available
      {
        doc.LoadXml((string)GetSubItem(0));
        XmlNodeList nodeList = doc.DocumentElement.SelectNodes("/controls/*");
        IDictionary<string, string> defines = new Dictionary<string, string>(); // An empty set of defines.
        foreach (XmlNode node in nodeList)
        {
          try
          {
            GUIControl newControl = GUIControlFactory.Create(_windowId, node, defines, null);
            _cardBackControls.Add(newControl);
          }
          catch (Exception ex)
          {
            Log.Error("GUICoverFlow: Unable to load control. exception:{0}", ex.ToString());
          }
        }
      }
    }
    public override void Dispose()
    {
      _font = null;
      _upDownControl.SafeDispose();

      _listItems.DisposeAndClear();
      _horizontalScrollbar.SafeDispose();
      _imageBackground.SafeDispose();
      _imageInfo.SafeDispose();

      _frameControl.DisposeAndClear();
      _frameFocusControl.DisposeAndClear();
      _imageFolder.DisposeAndClear();
      _imageFolderFocus.DisposeAndClear();
      _listLabels.DisposeAndClear();
      base.Dispose();
    }
Пример #4
0
    /// <summary> 
    /// This function is called after all of the XmlSkinnable fields have been filled
    /// with appropriate data.
    /// Use this to do any construction work other than simple data member assignments,
    /// for example, initializing new reference types, extra calculations, etc..
    /// </summary>
    public override sealed void FinalizeConstruction()
    {
      base.FinalizeConstruction();

      if (_fontName == null)
      {
        _fontName = string.Empty;
      }
      if (_fontName != "" && _fontName != "-")
      {
        _font = GUIFontManager.GetFont(_fontName);
      }

      GUILocalizeStrings.LocalizeLabel(ref _labelText);

      if (_labelText == null)
      {
        _labelText = string.Empty;
      }
      if (_labelText.IndexOf("#") >= 0)
      {
        _containsProperty = true;
      }
      CachedLabel();
    }
Пример #5
0
    /// <summary>
    /// Allocate any direct3d sources
    /// </summary>
    public override void AllocResources()
    {
      _propertyHasChanged = true;

      if (_registeredForEvent == false)
      {
        GUIPropertyManager.OnPropertyChanged -= GUIPropertyManager_OnPropertyChanged;
        GUIPropertyManager.OnPropertyChanged += GUIPropertyManager_OnPropertyChanged;
        _registeredForEvent = true;
      }
      _font = GUIFontManager.GetFont(_fontName);
      Update();
      base.AllocResources();
    }
 public override void Dispose()
 {
   _previousProperty = "";
   _listItems.DisposeAndClearList();
   _font = null;
   base.Dispose();
 }
Пример #7
0
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      _lowItemHeight = _itemHeight;
      _lowItemWidth = _itemWidth;
      _lowTextureWidth = _textureWidth;
      _lowTextureHeight = _textureHeight;

      _controlUpDown = new GUISpinControl(GetID, 0, _spinControlPositionX, _spinControlPositionY,
                                          _spinControlWidth, _spinControlHeight,
                                          _upTextureName, _downTextureName, _upTextureNameFocus, _downTextureNameFocus,
                                          _fontName, _spinControlColor,
                                          GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT,
                                          _spinControlAlignment);
      _controlUpDown.ParentControl = this;
      _controlUpDown.DimColor = DimColor;

      int xpos = 5 + _positionX + _width;
      if (xpos + 15 > GUIGraphicsContext.Width)
      {
        xpos = GUIGraphicsContext.Width - 15;
      }
      _verticalScrollBar = new GUIVerticalScrollbar(_controlId, 0,
                                                    5 + _positionX + _width + _scrollbarXOff, _positionY,
                                                    _scrollbarWidth, _height,
                                                    _scrollbarBackGroundTextureName, _scrollbarTopTextureName,
                                                    _scrollbarBottomTextureName);
      _verticalScrollBar.ParentControl = this;
      _verticalScrollBar.SendNotifies = false;
      _verticalScrollBar.DimColor = DimColor;
      _font = GUIFontManager.GetFont(_fontName);
      SetTextureDimensions(_textureWidth, _textureHeight);
      SetThumbDimensionsLow(_xPositionThumbNail, _yPositionThumbNail, _thumbNailWidth, _thumbNailHeight);

      _frameNoFocusControl = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth,
                                                  _itemHeight,
                                                  _frameNoFocusName);
      _frameNoFocusControl.ParentControl = this;
      _frameNoFocusControl.DimColor = DimColor;
      _frameNoFocusControl.MaskFileName = _frameNoFocusMask;
      _frameNoFocusControl.SetAnimations(_allThumbAnimations);


      _frameFocusControl = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth,
                                                _itemHeight,
                                                _frameFocusName);
      _frameFocusControl.ParentControl = this;
      _frameFocusControl.DimColor = DimColor;
      _frameFocusControl.MaskFileName = _frameFocusMask;
      _frameFocusControl.SetAnimations(_allThumbAnimations);

      using (Settings xmlreader = new MPSettings())
      {
        _loopDelay = xmlreader.GetValueAsInt("gui", "listLoopDelay", 100);
      }
    }
Пример #8
0
    public override void AllocResources()
    {
      _sleeper = 0;
      _font = GUIFontManager.GetFont(_fontName);
      base.AllocResources();
      _controlUpDown.AllocResources();
      _controlUpDown.DimColor = DimColor;
      _verticalScrollBar.AllocResources();
      _verticalScrollBar.DimColor = DimColor;

      if (ThumbAnimations == null || ThumbAnimations.Count < 1)
        _allThumbAnimations.Add(new VisualEffect());
      else
        _allThumbAnimations.AddRange(ThumbAnimations);

      if (_showFrame)
      {
        _frameFocusControl.AllocResources();
        _frameNoFocusControl.AllocResources();
        _frameFocusControl.DimColor = DimColor;
        _frameNoFocusControl.DimColor = DimColor;

        _frameFocusControl.SetAnimations(_allThumbAnimations);
        _frameNoFocusControl.SetAnimations(_allThumbAnimations);
      }

      Calculate();
    }
 /// <summary>
 /// Allocates the control its DirectX resources.
 /// </summary>
 public override void AllocResources()
 {
   base.AllocResources();
   _imageCheckMarkFocused.AllocResources();
   _imageCheckMarkNonFocused.AllocResources();
   _font = GUIFontManager.GetFont(_fontName);
 }
Пример #10
0
 /// <summary>
 /// Frees the control its DirectX resources.
 /// </summary>
 public override void Dispose()
 {
   base.Dispose();
   _previousText = "";
   _listLabels.DisposeAndClearList();
   _font = null;
 }
Пример #11
0
 /// <summary>
 /// Allocates the control its DirectX resources.
 /// </summary>
 public override void AllocResources()
 {
   _font = GUIFontManager.GetFont(_fontName);
 }
Пример #12
0
    /// <summary> 
    /// This function is called after all of the XmlSkinnable fields have been filled
    /// with appropriate data.
    /// Use this to do any construction work other than simple data member assignments,
    /// for example, initializing new reference types, extra calculations, etc..
    /// </summary>
    public override sealed void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      GUILocalizeStrings.LocalizeLabel(ref _label);

      // The labelTail is used to fill the backend of a scrolling label for both wrapping and non-wrapping labels
      // The wrapString is the text that joins the back to the front of a wrapping label (not used if the label should not wrap).
      if (_userWrapString.Length > 0)
      {
        _labelTail = "" + _userWrapString[_userWrapString.Length - 1];
        _wrapString = _userWrapString.Substring(0, _userWrapString.Length - 1);
      }

      _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName,
                                          _label, _textColor, _textAlignment, _textVAlignment, false,
                                          _shadowAngle, _shadowDistance, _shadowColor)
                        {
                          CacheFont = false,
                          ParentControl = this
                        };
      _labelControl.SetAnimations(Animations);
      if (_fontName != "" && _fontName != "-")
      {
        _font = GUIFontManager.GetFont(_fontName);
      }
      if (_label.IndexOf("#", System.StringComparison.Ordinal) >= 0)
      {
        _containsProperty = true;
      }
    }
Пример #13
0
    /// <summary>
    /// Allocates the control its DirectX resources.
    /// </summary>
    public override void AllocResources()
    {
      base.AllocResources();
      _frameCounter = 0;
      _imageFocused.AllocResources();
      _imageNonFocused.AllocResources();
      _width = _imageFocused.Width;
      _height = _imageFocused.Height;
      _imageBackground.AllocResources();

      _imageLeft.AllocResources();
      _imageLeftFocus.AllocResources();

      _imageRight.AllocResources();
      _imageRightFocus.AllocResources();

      _font = GUIFontManager.GetFont(_fontName);

      PositionLeftAndRightImages();

      _labelControl.AllocResources();
    }
Пример #14
0
    /// <summary>
    /// Frees the control its DirectX resources.
    /// </summary>
    public override void Dispose()
    {
      //UnsubscribeEventHandlers();

      base.Dispose();
      _imageFocused.SafeDispose();
      _imageNonFocused.SafeDispose();
      _imageBackground.SafeDispose();
      _imageLeft.SafeDispose();
      _imageLeftFocus.SafeDispose();
      _imageRight.SafeDispose();
      _imageRightFocus.SafeDispose();
      _labelControl.SafeDispose();
      _font = null;

      _showSelect = false;

      Clear();
    }
Пример #15
0
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      int x1 = 16;
      int y1 = 16;
      GUIGraphicsContext.ScalePosToScreenResolution(ref x1, ref y1);
      _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                           _textureFocusName);
      _imageFocused.ParentControl = this;
      _imageFocused.DimColor = DimColor;

      _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _textureNoFocusName);
      _imageNonFocused.ParentControl = this;
      _imageNonFocused.DimColor = DimColor;

      _imageBackground = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                              _backgroundTextureName);
      _imageBackground.ParentControl = this;
      _imageBackground.DimColor = DimColor;

      _imageLeft = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _leftTextureWidth, _leftTextureHeight, _leftTextureName);
      _imageLeft.DimColor = DimColor;
      _imageLeft.ParentControl = this;

      _imageLeftFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _leftTextureFocusWidth, _leftTextureFocusHeight,
                                             _leftFocusName);
      _imageLeftFocus.ParentControl = this;
      _imageLeftFocus.DimColor = DimColor;

      _imageRight = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _rightTextureWidth, _rightTextureHeight, _rightTextureName);
      _imageRight.ParentControl = this;
      _imageRight.DimColor = DimColor;

      _imageRightFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _rightTextureFocusWidth, _rightTextureFocusHeight,
                                              _rightFocusName);
      _imageRightFocus.ParentControl = this;
      _imageRightFocus.DimColor = DimColor;

      if (_fontName != "" && _fontName != "-")
      {
        _font = GUIFontManager.GetFont(_fontName);
      }
      GUILocalizeStrings.LocalizeLabel(ref _label);
      _imageFocused.Filtering = false;
      _imageNonFocused.Filtering = false;
      _imageBackground.Filtering = false;
      _imageLeft.Filtering = false;
      _imageLeftFocus.Filtering = false;
      _imageRight.Filtering = false;
      _imageRightFocus.Filtering = false;
      _labelControl = new GUILabelControl(_parentControlId);
      _labelControl.CacheFont = true;
      _labelControl.ParentControl = this;
      _labelControl.SetShadow(_shadowAngle, _shadowDistance, _shadowColor);
    }
 /// <summary>
 /// Frees the control its DirectX resources.
 /// </summary>
 public override void Dispose()
 {
   base.Dispose();
   _imageCheckMarkFocused.SafeDispose();
   _imageCheckMarkNonFocused.SafeDispose();
   _font = null;
 }
Пример #17
0
    /// <summary>
    /// Loads the fonts from a file.
    /// </summary>
    /// <param name="strFilename">The filename from where the fonts are loaded.</param>
    /// <returns>true if loaded else false</returns>
    public static bool LoadFonts(string strFilename)
    {
      // Clear current set of fonts
      Dispose();
      lock (Renderlock)
      {
        int counter = 0;
        Log.Info("  Load fonts from {0}", strFilename);
        _listFonts.DisposeAndClear();

        // Load the debug font
        GUIFont fontDebug = new GUIFont("debug", "Arial", 12);
        fontDebug.ID = counter++;
        fontDebug.Load();
        _listFonts.Add(fontDebug);

        try
        {
          // Load the XML document
          XmlDocument doc = new XmlDocument();
          doc.Load(strFilename);
          // Check the root element
          if (doc.DocumentElement == null)
          {
            return false;
          }
          string strRoot = doc.DocumentElement.Name;
          if (strRoot != "fonts")
          {
            return false;
          }
          // Select the list of fonts
          XmlNodeList list = doc.DocumentElement.SelectNodes("/fonts/font");
          foreach (XmlNode node in list)
          {
            XmlNode nodeStart = node.SelectSingleNodeFast("startchar");
            XmlNode nodeEnd = node.SelectSingleNodeFast("endchar");
            XmlNode nodeName = node.SelectSingleNodeFast("name");
            XmlNode nodeFileName = node.SelectSingleNodeFast("filename");
            XmlNode nodeHeight = node.SelectSingleNodeFast("height");
            XmlNode nodeBold = node.SelectSingleNodeFast("bold");
            XmlNode nodeItalics = node.SelectSingleNodeFast("italic");
            if (nodeHeight != null && nodeName != null && nodeFileName != null)
            {
              bool bold = false;
              bool italic = false;
              if (nodeBold != null && nodeBold.InnerText != null && nodeBold.InnerText.Equals("yes"))
              {
                bold = true;
              }
              if (nodeItalics != null && nodeItalics.InnerText != null && nodeItalics.InnerText.Equals("yes"))
              {
                italic = true;
              }
              string strName = nodeName.InnerText;
              string strFileName = nodeFileName.InnerText;
              int iHeight = Int32.Parse(nodeHeight.InnerText);

              // height is based on 720x576
              float fPercent = (((float)GUIGraphicsContext.Height) * GUIGraphicsContext.ZoomVertical) / 576.0f;
              fPercent *= iHeight;
              iHeight = (int)fPercent;
              FontStyle style = new FontStyle();
              style = FontStyle.Regular;
              if (bold)
              {
                style |= FontStyle.Bold;
              }
              if (italic)
              {
                style |= FontStyle.Italic;
              }
              GUIFont font = new GUIFont(strName, strFileName, iHeight, style);
              font.ID = counter++;

              // .NET's LocalisationProvider should give the correct amount of chars.
              if (nodeStart != null && nodeStart.InnerText != "" && nodeEnd != null && nodeEnd.InnerText != "")
              {
                int start = Int32.Parse(nodeStart.InnerText);
                int end = Int32.Parse(nodeEnd.InnerText);
                font.SetRange(start, end);
              }
              else
              {
                font.SetRange(0, GUIGraphicsContext.CharsInCharacterSet);
              }

              font.Load();
              _listFonts.Add(font);
            }
          }

          // Select the list of aliases
          XmlNodeList listAlias = doc.DocumentElement.SelectNodes("/fonts/alias");
          foreach (XmlNode node in listAlias)
          {
            XmlNode nodeName = node.SelectSingleNodeFast("name");
            XmlNode nodeFontName = node.SelectSingleNodeFast("fontname");
            _dictFontAlias.Add(nodeName.InnerText, nodeFontName.InnerText);
          }

          return true;
        }
        catch (Exception ex)
        {
          Log.Info("GUIFontManager: Exception loading fonts {0} err:{1} stack:{2}", strFilename, ex.Message,
                   ex.StackTrace);
        }

        return false;
      }
    }
 /// <summary>
 /// Set the text of the control. 
 /// </summary>
 /// <param name="strFontName">The font name.</param>
 /// <param name="strLabel">The text.</param>
 /// <param name="dwColor">The font color.</param>
 public void SetLabel(string strFontName, string strLabel, long dwColor)
 {
   if (strFontName == null || strLabel == null)
   {
     return;
   }
   _label = strLabel;
   _textColor = dwColor;
   _fontName = strFontName;
   _font = GUIFontManager.GetFont(_fontName);
 }
Пример #19
0
    public override void Dispose()
    {
      _listItems.DisposeAndClear();
      _listButtons.DisposeAndClear();
      _listLabels.DisposeAndClear();

      _listButtons = null;
      _listLabels = null;
      base.Dispose();
      _controlUpDown.SafeDispose();
      _verticalScrollBar.SafeDispose();
      //_font.Dispose(null, null);
      _font = null;

      _frameFocusControl.SafeDispose();
      _frameNoFocusControl.SafeDispose();
    }
    /// <summary>
    /// This method gets called when the control is created and all properties has been set
    /// It allows the control todo any initialization
    /// </summary>
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();

      _imageCheckMarkFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY,
                                                    _checkMarkWidth, _checkMarkHeight, _checkMarkFocusTextureName);
      _imageCheckMarkFocused.ParentControl = this;
      _imageCheckMarkFocused.DimColor = DimColor;

      _imageCheckMarkNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY,
                                                       _checkMarkWidth, _checkMarkHeight, _checkMarkNoFocusTextureName);
      _imageCheckMarkNonFocused.ParentControl = this;
      _imageCheckMarkNonFocused.DimColor = DimColor;

      if (_fontName != "" && _fontName != "-")
      {
        _font = GUIFontManager.GetFont(_fontName);
      }

      GUILocalizeStrings.LocalizeLabel(ref _label);
    }
    public override void PreAllocResources()
    {
      base.PreAllocResources();
      float fWidth = 0, fHeight = 0;

      _font = GUIFontManager.GetFont(_fontName);
      if (null == _font)
      {
        return;
      }
      _font.GetTextExtent("afy", ref fWidth, ref fHeight);
      try
      {
        _itemHeight = (int)(fHeight);
        float fTotalHeight = (float)_height;
        _itemsPerPage = (int)Math.Floor(fTotalHeight / (fHeight  * _lineSpacing));
        if (_itemsPerPage == 0)
        {
          _itemsPerPage = 1;
        }
      }
      catch (Exception)
      {
        _itemHeight = 1;
        _itemsPerPage = 1;
      }
    }
Пример #22
0
    /// <summary>
    /// Allocates the control its DirectX resources.
    /// </summary>
    public override void AllocResources()
    {
      Dispose();
      base.AllocResources();
      _upDownControl.AllocResources();
      _verticalScrollbar.AllocResources();
      _font = GUIFontManager.GetFont(_fontName);
      _font2 = GUIFontManager.GetFont(_fontName2Name);


      float fHeight = (float)_itemHeight + _spaceBetweenItems;
      float fTotalHeight = _height - _upDownControl.Height - 5;
      _itemsPerPage = (int)(fTotalHeight / fHeight);

      _listButtons = new List<GUIControl>();
      _labelControls1 = new List<GUILabelControl>();
      _labelControls2 = new List<GUILabelControl>();
      _labelControls3 = new List<GUILabelControl>();
      AllocButtons();
      for (int i = 0; i < _itemsPerPage; ++i)
      {
        GUILabelControl cntl1 = new GUILabelControl(_controlId, 0, 0, 0, 0, 0, _fontName, "", _textColor,
                                                    Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false,
                                                    _shadowAngle, _shadowDistance, _shadowColor);
        GUILabelControl cntl2 = new GUILabelControl(_controlId, 0, 0, 0, 0, 0, _fontName2Name, "", _textColor2,
                                                    Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false,
                                                    _shadowAngle, _shadowDistance, _shadowColor);
        GUILabelControl cntl3 = new GUILabelControl(_controlId, 0, 0, 0, 0, 0, _fontName2Name, "", _textColor3,
                                                    Alignment.ALIGN_RIGHT, VAlignment.ALIGN_TOP, false,
                                                    _shadowAngle, _shadowDistance, _shadowColor);
        cntl1.ParentControl = this;
        cntl2.ParentControl = this;
        cntl3.ParentControl = this;
        cntl1.AllocResources();
        cntl2.AllocResources();
        cntl3.AllocResources();
        cntl1.DimColor = DimColor;
        cntl2.DimColor = DimColor;
        cntl3.DimColor = DimColor;
        _labelControls1.Add(cntl1);
        _labelControls2.Add(cntl2);
        _labelControls3.Add(cntl3);
      }

      int iPages = 1;
      if (_listItems.Count > 0)
      {
        iPages = _itemsPerPage == 0 ? 0 : _listItems.Count / _itemsPerPage;
        if (_itemsPerPage != 0)
        {
          if ((_listItems.Count % _itemsPerPage) != 0)
          {
            iPages++;
          }
        }
      }
      _upDownControl.SetRange(1, iPages);
      _upDownControl.Value = 1;
      _upDownControl.DimColor = DimColor;
      _verticalScrollbar.DimColor = DimColor;
    }
 public override void FinalizeConstruction()
 {
   base.FinalizeConstruction();
   _font = GUIFontManager.GetFont(_fontName);
   if (_property.IndexOf("#", StringComparison.Ordinal) >= 0)
   {
     _containsProperty = true;
   }
 }
Пример #24
0
    /// <summary>
    /// Frees the control its DirectX resources.
    /// </summary>
    public override void Dispose()
    {
      base.Dispose();

      _font = null;
      _font2 = null;
      _font3 = null;

      _upDownControl.SafeDispose();
      _listButtons.DisposeAndClear();
      _verticalScrollbar.SafeDispose();

      _listItems.DisposeAndClear();
      _labelControls1.DisposeAndClear();
      _labelControls2.DisposeAndClear();
      _labelControls3.DisposeAndClear();
    }
Пример #25
0
 /// <summary>
 /// Free any direct3d resources
 /// </summary>
 public override void Dispose()
 {
   //_labelText = string.Empty;
   _font = null;
   _reCalculate = true;
   GUIPropertyManager.OnPropertyChanged -= GUIPropertyManager_OnPropertyChanged;
   base.Dispose();
 }
Пример #26
0
    public override sealed void FinalizeConstruction()
    {
      base.FinalizeConstruction();

      _font = GUIFontManager.GetFont(_fontName);
      if (_fontName2Name == string.Empty)
      {
        _fontName2Name = _fontName;
      }
      if (_fontName3Name == string.Empty)
      {
        _fontName3Name = _fontName2Name;
      }
      Font2 = _fontName2Name;
      Font3 = _fontName3Name;

      _upDownControl = new GUISpinControl(_controlId, 0, _spinControlPositionX, _spinControlPositionY, _spinControlWidth,
                                          _spinControlHeight, _upTextureName, _downTextureName, _upTextureNameFocus,
                                          _downTextureNameFocus, _fontName, _spinControlColor,
                                          GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT, _spinControlAlignment)
                         {
                           ParentControl = this,
                           DimColor = DimColor
                         };

      _verticalScrollbar = new GUIVerticalScrollbar(_controlId, 0, 5 + _positionX + _width + _scrollbarXOff, _positionY,
                                                    _scrollbarWidth, _height,
                                                    _scrollbarBackgroundName, _scrollbarTopName, _scrollbarBottomName)
                             {
                               ParentControl = this,
                               SendNotifies = false,
                               DimColor =DimColor
                             };
      _upDownControl.WindowId = WindowId;

      using (Settings xmlreader = new MPSettings())
      {
        _loopDelay = xmlreader.GetValueAsInt("gui", "listLoopDelay", 100);
      }
    }
    public override void AllocResources()
    {
      _sleeper = 0;

      base.AllocResources();
      _font = GUIFontManager.GetFont(_fontName);
      if (_imageBackground != null)
      {
        _imageBackground.AllocResources();
      }
      if (_imageInfo != null)
      {
        _imageInfo.AllocResources();
      }
      if (_upDownControl != null)
      {
        _upDownControl.AllocResources();
      }

      if (ThumbAnimations == null || ThumbAnimations.Count < 1)
        _allThumbAnimations.Add(new VisualEffect());
      else
        _allThumbAnimations.AddRange(ThumbAnimations);

      for (int i = 0; i < _imageFolder.Count; ++i)
      {
        _imageFolder[i].AllocResources();
        _imageFolderFocus[i].AllocResources();
        _frameControl[i].AllocResources();
        _frameFocusControl[i].AllocResources();
        _listLabels[i].AllocResources();

        _imageFolder[i].SetAnimations(_allThumbAnimations);
        _imageFolderFocus[i].SetAnimations(_allThumbAnimations);
        _frameControl[i].SetAnimations(_allThumbAnimations);
        _frameFocusControl[i].SetAnimations(_allThumbAnimations);
      }
      if (_horizontalScrollbar != null)
      {
        _horizontalScrollbar.AllocResources();
      }

      Calculate();

      _upDownControl.ParentID = GetID;
    }
Пример #28
0
    public override void AllocResources()
    {
      base.AllocResources();
      _font = GUIFontManager.GetFont(_fontName);
      _imageTop.AllocResources();
      _imageBottom.AllocResources();
      _imageMid.AllocResources();
      _imageRight.AllocResources();
      _imageLeft.AllocResources();
      _imageFillBackground.AllocResources();
      _imageFill1.AllocResources();
      _imageFill2.AllocResources();
      _imageFill3.AllocResources();
      if (_imageFillMarker != null)
      {
        _imageFillMarker.AllocResources();
        _imageFillMarker.Height = _height - 6;
        _imageFillMarker.Filtering = false;
      }
      _imageTick.AllocResources();
      _imageLogo.AllocResources();

      _imageTop.Filtering = false;
      _imageBottom.Filtering = false;
      _imageMid.Filtering = false;
      _imageRight.Filtering = false;
      _imageLeft.Filtering = false;
      _imageFill1.Filtering = false;
      _imageFill2.Filtering = false;
      _imageFill3.Filtering = false;
      _imageTick.Filtering = false;
      if (_height == 0)
      {
        _height = _imageRight.TextureHeight;
      }
      //      _imageTop.Height=_height;
      _imageRight.Height = _height;
      _imageLeft.Height = _height;
      _imageMid.Height = _height;
      _imageFill1.Height = _height - 6;
      _imageFill2.Height = _height - 6;
      _imageFill3.Height = _height - 6;
      //_imageTick.Height=_height;
    }
    /*public GUIFilmstripControl(int dwParentID, int dwControlId, int dwPosX, int dwPosY, int dwWidth, int dwHeight, 
      string strFontName, 
      string strImageIcon, 
      string strImageIconFocus, 
      int dwitemWidth, int dwitemHeight, 
      int dwSpinWidth, int dwSpinHeight, 
      string strUp, string strDown, 
      string strUpFocus, string strDownFocus, 
      long dwSpinColor, int dwSpinX, int dwSpinY, 
      string strFont, long dwTextColor, long dwSelectedColor, 
      string strScrollbarBackground, string strScrollbarTop, string strScrollbarBottom)
      : base(dwParentID, dwControlId, dwPosX, dwPosY, dwWidth, dwHeight)
    {
    }*/

    /// <summary> 
    /// This function is called after all of the XmlSkinnable fields have been filled
    /// with appropriate data.
    /// Use this to do any construction work other than simple data member assignments,
    /// for example, initializing new reference types, extra calculations, etc..
    /// </summary>
    public override void FinalizeConstruction()
    {
      base.FinalizeConstruction();
      if (_positionY > _positionY && _spinControlPositionY < _positionY + _height)
      {
        _spinControlPositionY = _positionY + _height;
      }
      for (int i = 0; i < 30; ++i)
      {
        GUIAnimation anim = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth,
                                                 _itemHeight, _imageFolderName);
        anim.ParentControl = this;
        anim.DimColor = DimColor;
        anim.FlipX = _flipX;
        anim.FlipY = _flipY;
        anim.DiffuseFileName = _diffuseFileName;
        anim.MaskFileName = _imageFolderMask;
        //anim.SetAnimations(ThumbAnimations);
        _imageFolder.Add(anim);

        anim = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth, _itemHeight,
                                    _imageFolderNameFocus);
        anim.ParentControl = this;
        anim.DimColor = DimColor;
        anim.FlipX = _flipX;
        anim.FlipY = _flipY;
        anim.DiffuseFileName = _diffuseFileName;
        anim.MaskFileName = _imageFolderFocusMask;
        //anim.SetAnimations(ThumbAnimations);
        _imageFolderFocus.Add(anim);

        anim = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth, _itemHeight,
                                    _frameName);
        anim.ParentControl = this;
        anim.DimColor = DimColor;
        //anim.FlipX = _flipX;
        //anim.FlipY = _flipY;
        anim.DiffuseFileName = _diffuseFileName;
        anim.MaskFileName = _frameMask;
        //anim.SetAnimations(ThumbAnimations);
        _frameControl.Add(anim);

        anim = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _itemWidth, _itemHeight,
                                    _frameFocusName);
        anim.ParentControl = this;
        anim.DimColor = DimColor;
        //anim.FlipX = _flipX;
        //anim.FlipY = _flipY;
        anim.DiffuseFileName = _diffuseFileName;
        anim.MaskFileName = _frameFocusMask;
        //anim.SetAnimations(ThumbAnimations);
        _frameFocusControl.Add(anim);

        // for label
        GUIFadeLabel fadelabel = new GUIFadeLabel(_parentControlId, _controlId, _positionX, _positionY, _textureWidth,
                                                  _textureHeight, _fontName, _textColor, Alignment.ALIGN_LEFT,
                                                  VAlignment.ALIGN_TOP, 0, 0, 0, " | ");
        fadelabel.ParentControl = this;
        fadelabel.AllowScrolling = false;
        fadelabel.DimColor = DimColor;
        //fadelabel.AllowFadeIn = false;
        _listLabels.Add(fadelabel);
      }

      _upDownControl = new GUISpinControl(_controlId, 0, _spinControlPositionX, _spinControlPositionY, _spinControlWidth,
                                          _spinControlHeight, _upTextureName, _downTextureName, _upTextureNameFocus,
                                          _downTextureNameFocus, _fontName, _spinControlColor,
                                          GUISpinControl.SpinType.SPIN_CONTROL_TYPE_INT, _spinControlAlignment);
      _upDownControl.ParentControl = this;
      _upDownControl.DimColor = DimColor;

      _font = GUIFontManager.GetFont(_fontName);



      // Create the horizontal scrollbar.
      int scrollbarWidth = _scrollbarWidth;
      int scrollbarHeight = _scrollbarHeight;
      GUIGraphicsContext.ScaleHorizontal(ref scrollbarWidth);
      GUIGraphicsContext.ScaleVertical(ref scrollbarHeight);
      int scrollbarPosX = _positionX + (_width / 2) - (scrollbarWidth / 2);

      _horizontalScrollbar = new GUIHorizontalScrollbar(_controlId, 0,
                                                        scrollbarPosX, _positionY + _scrollbarOffsetY,
                                                        scrollbarWidth, scrollbarHeight,
                                                        _scrollbarBackgroundName, _scrollbarLeftName,
                                                        _scrollbarRightName);
      _horizontalScrollbar.ParentControl = this;
      _horizontalScrollbar.DimColor = DimColor;


      _upDownControl.Orientation = eOrientation.Horizontal;
      _upDownControl.SetReverse(true);

      _imageBackground = LoadAnimationControl(0, 0, _backGroundPositionX, _backGroundPositionY, _backGroundWidth,
                                              _backGroundHeight, _backgroundTextureName);
      _imageBackground.ParentControl = this;
      _imageBackground.DimColor = DimColor;

      _imageInfo = new GUIImage(0, 0, _infoImagePositionX, _infoImagePositionY, _infoImageWidth, _infoImageHeight,
                                _infoImageName, 0);
      _imageInfo.ParentControl = this;
      _imageInfo.Filtering = true;
      _imageInfo.KeepAspectRatio = true;
      _imageInfo.ImageAlignment = Alignment.ALIGN_CENTER;
      _imageInfo.ImageVAlignment = VAlignment.ALIGN_MIDDLE;
      _imageInfo.HorizontalAlignment = MediaPortal.Drawing.HorizontalAlignment.Center;
      _imageInfo.VerticalAlignment = MediaPortal.Drawing.VerticalAlignment.Center;
      _imageInfo.DimColor = DimColor;
      _imageInfo.FlipX = _flipInfoImageX;
      _imageInfo.FlipY = _flipInfoImageY;
      _imageInfo.DiffuseFileName = _diffuseInfoImageFileName;
      _imageInfo.MaskFileName = _infoImageMask;

      SetThumbDimensionsLow(_thumbNailPositionX, _thumbNailPositionY, _thumbNailWidth, _thumbNailHeight);
      SetTextureDimensions(_textureWidth, _textureHeight);
    }
Пример #30
0
    public override void AllocResources()
    {
      _fontNamedKey = GUIFontManager.GetFont(_namedKeyFont);
      _fontCharKey = GUIFontManager.GetFont(_charKeyFont);
      _fontSearchText = GUIFontManager.GetFont(_inputTextFont);

      labelBox = new GUIImage(GetID, 1, 0, 0, 10, 10, _labelBoxTexture, 1);
      labelBox.AllocResources();

      label = new GUILabelControl(GetID);
      label.FontName = _labelFont;
      label.SetShadow(_labelShadowAngle, _labelShadowDistance, _labelShadowColor);
      label.AllocResources();

      inputTextBox = new GUIImage(GetID, 1, 0, 0, 10, 10, _inputTextBoxTexture, 1);
      inputTextBox.AllocResources();

      inputText = new GUILabelControl(GetID);
      inputText.FontName = _inputTextFont;
      inputText.SetShadow(_inputTextShadowAngle, _inputTextShadowDistance, _inputTextShadowColor);
      inputText.AllocResources();

      inputTextCaret = new GUILabelControl(GetID);
      inputTextCaret.FontName = _inputTextFont;
      inputTextCaret.SetShadow(_inputTextShadowAngle, _inputTextShadowDistance, _inputTextShadowColor);
      inputTextCaret.AllocResources();

      base.AllocResources();
      _isAllocated = true;
    }