protected virtual void SwitchToNextAllowedLayout(Layout selectedLayout)
        {
            int iSelectedLayout = (int)selectedLayout;
            int totalLayouts    = Enum.GetValues(typeof(Layout)).Length - 1;

            if (iSelectedLayout > totalLayouts)
            {
                iSelectedLayout = 0;
            }

            bool shouldContinue = true;

            do
            {
                if (!AllowLayout(selectedLayout) || facadeLayout.IsNullLayout(selectedLayout))
                {
                    iSelectedLayout++;
                    if (iSelectedLayout > totalLayouts)
                    {
                        iSelectedLayout = 0;
                    }
                }
                else
                {
                    shouldContinue = false;
                }
            } while (shouldContinue);

            CurrentLayout = (Layout)iSelectedLayout;
            SwitchLayout();
        }
 protected override bool AllowLayout(Layout layout)
 {
     if ((layout == Layout.Playlist) || (layout == GUIFacadeControl.Layout.AlbumView))
     {
         return(false);
     }
     return(true);
 }
Beispiel #3
0
 protected override bool AllowLayout(Layout layout)
 {
     switch (layout)
     {
     case Layout.List:
     case Layout.SmallIcons:
     case Layout.LargeIcons:
         return(true);
     }
     return(false);
 }
 protected override bool AllowLayout(Layout layout)
 {
     if (layout == Layout.List)
     {
         return(false);
     }
     if (layout == Layout.Filmstrip)
     {
         return(false);
     }
     if (layout == Layout.CoverFlow)
     {
         return(false);
     }
     return(true);
 }
        public int ProperDefaultFromLayout(Layout layout)
        {
            switch (layout)
            {
            case MediaPortal.GUI.Library.GUIFacadeControl.Layout.SmallIcons: return(1);

            case MediaPortal.GUI.Library.GUIFacadeControl.Layout.LargeIcons: return(2);

            case MediaPortal.GUI.Library.GUIFacadeControl.Layout.AlbumView: return(3);

            case MediaPortal.GUI.Library.GUIFacadeControl.Layout.Filmstrip: return(4);

            case MediaPortal.GUI.Library.GUIFacadeControl.Layout.CoverFlow: return(5);

            default: return(0);
            }
        }
 protected virtual bool AllowLayout(Layout layout)
 {
   return true;
 }
    protected virtual void SwitchToNextAllowedLayout(Layout selectedLayout)
    {
      int iSelectedLayout = (int)selectedLayout;
      int totalLayouts = Enum.GetValues(typeof(Layout)).Length - 1;
      
      if (iSelectedLayout > totalLayouts)
        iSelectedLayout = 0;

      bool shouldContinue = true;
      do
      {
        if (!AllowLayout(selectedLayout) || facadeLayout.IsNullLayout(selectedLayout))
        {
          iSelectedLayout++;
          if (iSelectedLayout > totalLayouts)
            iSelectedLayout = 0;
        }
        else
        {
          shouldContinue = false;
        }
      } while (shouldContinue);

      CurrentLayout = (Layout)iSelectedLayout;
      SwitchLayout();
    }
 protected virtual void SetLayout(Layout layout)
 {
   // Set the selected layout.
   SwitchToNextAllowedLayout(layout);
 }
Beispiel #9
0
        /// <summary>
        /// Disallow layouts not support or just dont fit
        /// </summary>
        /// <param name="layout"></param>
        /// <returns></returns>
        protected override bool AllowLayout(Layout layout)
        {
            if (layout == Layout.AlbumView || layout == Layout.List)
            return false;

              return base.AllowLayout(layout);
        }
 protected virtual void SetLayout(Layout layout)
 {
     // Set the selected layout.
     SwitchToNextAllowedLayout(layout);
 }
 protected virtual bool AllowLayout(Layout layout)
 {
     return(true);
 }
Beispiel #12
0
 public int ProperDefaultFromLayout(Layout layout)
 {
   switch (layout)
   {
     case MediaPortal.GUI.Library.GUIFacadeControl.Layout.SmallIcons: return 1;
     case MediaPortal.GUI.Library.GUIFacadeControl.Layout.LargeIcons: return 2;
     case MediaPortal.GUI.Library.GUIFacadeControl.Layout.AlbumView: return 3;
     case MediaPortal.GUI.Library.GUIFacadeControl.Layout.Filmstrip: return 4;
     case MediaPortal.GUI.Library.GUIFacadeControl.Layout.CoverFlow: return 5;
     default: return 0;
   }
 }
Beispiel #13
0
        protected virtual void OnShowLayouts()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
              if (dlg == null)
              {
            return;
              }
              dlg.Reset();
              dlg.SetHeading(792); // Layouts menu
              int dlgItems = 0;
              int totalLayouts = Enum.GetValues(typeof(GUIFacadeControl.Layout)).Length;
              bool[] allowedLayouts = new bool[totalLayouts];
              for (int i = 0; i < totalLayouts; i++)
              {
            string layoutName = Enum.GetName(typeof(GUIFacadeControl.Layout), i);
            GUIFacadeControl.Layout layout = GetLayoutNumber(layoutName);
            if (AllowLayout(layout))
            {
              if (!facadeLayout.IsNullLayout(layout))
              {
            dlg.Add(GUIFacadeControl.GetLayoutLocalizedName(layout));
            dlgItems++;
            allowedLayouts[i] = true;
              }
            }
              }
              dlg.SelectedLabel = -1;
              for (int i = 0; i <= (int)CurrentLayout; i++)
              {
            if (allowedLayouts[i])
            {
              dlg.SelectedLabel++;
            }
              }
              if (dlg.SelectedLabel >= dlgItems)
              {
            dlg.SelectedLabel = dlgItems;
              }

              dlg.DoModal(GetID);
              if (dlg.SelectedId == -1)
              {
            return;
              }
              int iSelectedLayout = dlg.SelectedLabel;
              int allowedItemsFound = -1;
              for (int i = 0; i < allowedLayouts.Length; i++)
              {
            if (allowedLayouts[i])
            {
              iSelectedLayout = i;
              allowedItemsFound++;
              if (allowedItemsFound == dlg.SelectedLabel)
            break;
            }
              }
              CurrentLayout = (Layout)iSelectedLayout;
              SwitchLayout();

              UpdateButtonStates();
        }
Beispiel #14
0
 protected virtual bool AllowLayout(Layout layout)
 {
     if (layout == Layout.AlbumView || layout == Layout.Playlist)
       {
     return false;
       }
       return true;
 }
 protected override bool AllowLayout(Layout layout)
 {
   if (layout == Layout.List)
   {
     return false;
   }
   if (layout == Layout.AlbumView)
   {
     return false;
   }
   if (layout == Layout.Filmstrip)
   {
     return false;
   }
   if (layout == Layout.CoverFlow)
   {
     return false;
   }
   return true;
 }
 protected override bool AllowLayout(Layout layout)
 {
   if ((layout == Layout.Playlist) || (layout == GUIFacadeControl.Layout.AlbumView))
   {
     return false;
   }
   return true;
 }
 protected override bool AllowLayout(Layout layout)
 {
   if (layout == Layout.Playlist)
   {
     return false;
   }
   
   return true;
 }
 protected override bool AllowLayout(Layout layout)
 {
     return(base.AllowLayout(layout));
 }
        protected virtual void UpdateButtonStates()
        {
            // skip all this if we're not active window
            if (GUIWindowManager.ActiveWindow != GetID)
            {
                return;
            }

            if (handler != null)
            {
                GUIPropertyManager.SetProperty("#view", handler.LocalizedCurrentView);
                GUIPropertyManager.SetProperty("#itemtype", handler.LocalizedCurrentViewLevel);
            }

            if (facadeLayout == null)
            {
                return;
            }

            GUIControl.HideControl(GetID, facadeLayout.GetID);
            int iControl = facadeLayout.GetID;

            GUIControl.ShowControl(GetID, iControl);
            GUIControl.FocusControl(GetID, iControl);


            string strLine = string.Empty;
            Layout layout  = CurrentLayout;

            switch (layout)
            {
            case Layout.List:
                strLine = GUILocalizeStrings.Get(101);
                break;

            case Layout.SmallIcons:
                strLine = GUILocalizeStrings.Get(100);
                break;

            case Layout.LargeIcons:
                strLine = GUILocalizeStrings.Get(417);
                break;

            case Layout.AlbumView:
                strLine = GUILocalizeStrings.Get(529);
                break;

            case Layout.Filmstrip:
                strLine = GUILocalizeStrings.Get(733);
                break;

            case Layout.Playlist:
                strLine = GUILocalizeStrings.Get(101);
                break;

            case Layout.CoverFlow:
                strLine = GUILocalizeStrings.Get(791);
                break;
            }
            GUIControl.SetControlLabel(GetID, btnLayouts.GetID, strLine);

            if (btnSortBy != null)
            {
                btnSortBy.IsAscending = CurrentSortAsc;
            }
        }