public FilteredListSourceContents(string name,
                                          SchemaEntry <int> pane_top_position,
                                          SchemaEntry <int> pane_left_position)
        {
            this.name = name;
            this.pane_top_position  = pane_top_position;
            this.pane_left_position = pane_left_position;

            InitializeViews();

            string position = Layout();

            if (ForcePosition != null)
            {
                return;
            }

            if (ServiceManager.Contains("InterfaceActionService"))
            {
                action_service = ServiceManager.Get <InterfaceActionService> ();

                if (action_service.FindActionGroup("BrowserView") == null)
                {
                    browser_view_actions = new ActionGroup("BrowserView");

                    browser_view_actions.Add(new RadioActionEntry [] {
                        new RadioActionEntry("BrowserLeftAction", null,
                                             Catalog.GetString("Browser on Left"), null,
                                             Catalog.GetString("Show the artist/album browser to the left of the track list"), 0),

                        new RadioActionEntry("BrowserTopAction", null,
                                             Catalog.GetString("Browser on Top"), null,
                                             Catalog.GetString("Show the artist/album browser above the track list"), 1),
                    }, position == "top" ? 1 : 0, null);

                    browser_view_actions.Add(new ToggleActionEntry [] {
                        new ToggleActionEntry("BrowserVisibleAction", null,
                                              Catalog.GetString("Show Browser"), "<control>B",
                                              Catalog.GetString("Show or hide the artist/album browser"),
                                              null, BrowserVisible.Get())
                    });

                    action_service.AddActionGroup(browser_view_actions);
                    //action_merge_id = action_service.UIManager.NewMergeId ();
                    action_service.UIManager.AddUiFromString(menu_xml);
                }

                (action_service.FindAction("BrowserView.BrowserLeftAction") as RadioAction).Changed += OnViewModeChanged;
                (action_service.FindAction("BrowserView.BrowserTopAction") as RadioAction).Changed  += OnViewModeChanged;
                action_service.FindAction("BrowserView.BrowserVisibleAction").Activated             += OnToggleBrowser;
            }

            ServiceManager.SourceManager.ActiveSourceChanged += delegate {
                ThreadAssist.ProxyToMain(delegate {
                    browser_container.Visible = ActiveSourceCanHasBrowser ? BrowserVisible.Get() : false;
                });
            };

            NoShowAll = true;
        }
        public CompositeTrackSourceContents() : base("albumartist")
        {
            if (ServiceManager.Contains("InterfaceActionService"))
            {
                action_service = ServiceManager.Get <InterfaceActionService> ();

                if (action_service.FindActionGroup("BrowserConfiguration") == null)
                {
                    configure_browser_actions = new ActionGroup("BrowserConfiguration");

                    configure_browser_actions.Add(new ActionEntry [] {
                        new ActionEntry("BrowserContentMenuAction", null,
                                        Catalog.GetString("Browser Content"), null,
                                        Catalog.GetString("Configure the filters available in the browser"), null)
                    });

                    configure_browser_actions.Add(new ToggleActionEntry [] {
                        new ToggleActionEntry("ShowArtistFilterAction", null,
                                              Catalog.GetString("Show Artist Filter"), null,
                                              Catalog.GetString("Show a list of artists to filter by"), null, ArtistFilterVisible.Get())
                    });

                    configure_browser_actions.Add(new RadioActionEntry [] {
                        new RadioActionEntry("ShowTrackArtistFilterAction", null,
                                             Catalog.GetString("Show all Artists"), null,
                                             Catalog.GetString("Show all artists in the artist filter"), 0),

                        new RadioActionEntry("ShowAlbumArtistFilterAction", null,
                                             Catalog.GetString("Show Album Artists"), null,
                                             Catalog.GetString("Show only album artists, not artists with only single tracks"), 1),
                    }, ArtistFilterType.Get().Equals("artist") ? 0 : 1, null);

                    configure_browser_actions.Add(new ToggleActionEntry [] {
                        new ToggleActionEntry("ShowGenreFilterAction", null,
                                              Catalog.GetString("Show Genre Filter"), null,
                                              Catalog.GetString("Show a list of genres to filter by"), null, GenreFilterVisible.Get())
                    });

                    configure_browser_actions.Add(new ToggleActionEntry [] {
                        new ToggleActionEntry("ShowYearFilterAction", null,
                                              Catalog.GetString("Show Year Filter"), null,
                                              Catalog.GetString("Show a list of years to filter by"), null, YearFilterVisible.Get())
                    });

                    action_service.AddActionGroup(configure_browser_actions);
                    action_service.UIManager.AddUiFromString(menu_xml);
                }

                action_service.FindAction("BrowserConfiguration.ShowArtistFilterAction").Activated += OnArtistFilterVisibilityChanged;
                action_service.FindAction("BrowserConfiguration.ShowGenreFilterAction").Activated  += OnGenreFilterChanged;;
                action_service.FindAction("BrowserConfiguration.ShowYearFilterAction").Activated   += OnYearFilterChanged;;

                var artist_filter_action      = action_service.FindAction("BrowserConfiguration.ShowTrackArtistFilterAction") as RadioAction;
                var albumartist_filter_action = action_service.FindAction("BrowserConfiguration.ShowAlbumArtistFilterAction") as RadioAction;
                artist_filter_action.Changed       += OnArtistFilterChanged;
                artist_filter_action.Sensitive      = ArtistFilterVisible.Get();
                albumartist_filter_action.Changed  += OnArtistFilterChanged;
                albumartist_filter_action.Sensitive = ArtistFilterVisible.Get();
            }
        }
        private void OnArtistFilterVisibilityChanged(object o, EventArgs args)
        {
            ToggleAction action = (ToggleAction)o;

            ClearFilterSelections();

            ArtistFilterVisible.Set(action.Active);

            if (artist_view != null && artist_view.Parent != null)
            {
                artist_view.Parent.Visible = ArtistFilterVisible.Get();
            }
            else if (albumartist_view != null && albumartist_view.Parent != null)
            {
                albumartist_view.Parent.Visible = ArtistFilterVisible.Get();
            }

            action_service.FindAction("BrowserConfiguration.ShowTrackArtistFilterAction").Sensitive = ArtistFilterVisible.Get();
            action_service.FindAction("BrowserConfiguration.ShowAlbumArtistFilterAction").Sensitive = ArtistFilterVisible.Get();
        }
Ejemplo n.º 4
0
        void OnClose(object sender, EventArgs args)
        {
            Hide();

            /*deselect the toggle action "Show lyrics" in the View menu */
            InterfaceActionService action_service     = ServiceManager.Get <InterfaceActionService> ();
            ToggleAction           show_lyrics_action = (ToggleAction)action_service.FindAction("Lyrics.ShowLyricsAction");

            if (show_lyrics_action != null)
            {
                show_lyrics_action.Active = false;
            }
        }
        /// <summary>
        /// Constructor -- creates the source contents for a plugin and sets up the event handlers for the view
        /// and the plugin refresh events.
        /// </summary>
        /// <param name="plugin">
        /// A <see cref="ILiveRadioPlugin"/> -- the plugin to set up the source contents for.
        /// </param>
        public LiveRadioPluginSourceContents(ILiveRadioPlugin plugin)
        {
            base.Name   = plugin.Name;
            this.plugin = plugin;

            InitializeViews();

            string position = ForcePosition == null?BrowserPosition.Get() : ForcePosition;

            if (position == "top")
            {
                LayoutTop();
            }
            else
            {
                LayoutLeft();
            }

            plugin.GenreListLoaded        += OnPluginGenreListLoaded;
            plugin.RequestResultRetrieved += OnPluginRequestResultRetrieved;

            if (ForcePosition != null)
            {
                return;
            }

            if (ServiceManager.Contains("InterfaceActionService"))
            {
                action_service = ServiceManager.Get <InterfaceActionService> ();

                if (action_service.FindActionGroup("BrowserView") == null)
                {
                    browser_view_actions = new ActionGroup("BrowserView");

                    browser_view_actions.Add(new RadioActionEntry [] {
                        new RadioActionEntry("BrowserLeftAction", null,
                                             AddinManager.CurrentLocalizer.GetString("Browser on Left"), null,
                                             AddinManager.CurrentLocalizer.GetString("Show the artist/album browser to the left of the track list"), 0),

                        new RadioActionEntry("BrowserTopAction", null,
                                             AddinManager.CurrentLocalizer.GetString("Browser on Top"), null,
                                             AddinManager.CurrentLocalizer.GetString("Show the artist/album browser above the track list"), 1),
                    }, position == "top" ? 1 : 0, null);

                    browser_view_actions.Add(new ToggleActionEntry [] {
                        new ToggleActionEntry("BrowserVisibleAction", null,
                                              AddinManager.CurrentLocalizer.GetString("Show Browser"), "<control>B",
                                              AddinManager.CurrentLocalizer.GetString("Show or hide the artist/album browser"),
                                              null, BrowserVisible.Get())
                    });


                    action_service.AddActionGroup(browser_view_actions);
                    action_service.UIManager.AddUiFromString(menu_xml);
                }

                (action_service.FindAction("BrowserView.BrowserLeftAction") as RadioAction).Changed += OnViewModeChanged;
                (action_service.FindAction("BrowserView.BrowserTopAction") as RadioAction).Changed  += OnViewModeChanged;
                action_service.FindAction("BrowserView.BrowserVisibleAction").Activated             += OnToggleBrowser;
            }

            ServiceManager.SourceManager.ActiveSourceChanged += delegate {
                ThreadAssist.ProxyToMain(delegate {
                    browser_container.Visible = ActiveSourceCanHasBrowser ? BrowserVisible.Get() : false;
                });
            };

            NoShowAll = true;
        }