/// <summary>
        /// Handles when browser visibility is toggled
        /// </summary>
        /// <param name="o">
        /// A <see cref="System.Object"/>
        /// </param>
        /// <param name="args">
        /// A <see cref="EventArgs"/>
        /// </param>
        private void OnToggleBrowser(object o, EventArgs args)
        {
            ToggleAction action = (ToggleAction)o;

            browser_container.Visible = action.Active && ActiveSourceCanHasBrowser;
            BrowserVisible.Set(action.Active);
        }
        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;
        }
 private void ShowPack()
 {
     PackStart(container, true, true, 0);
     NoShowAll = false;
     ShowAll();
     NoShowAll = true;
     browser_container.Visible = ForcePosition != null || BrowserVisible.Get();
 }
        /// <summary>
        /// Draw the source contents
        /// </summary>
        private void ShowPack()
        {
            PackStart(container, true, true, 0);
            VBox instruct = new VBox();
            //instruct.ExposeEvent += (o, a) => {
            //    using (Cairo.Context cr = Gdk.CairoHelper.Create (instruct.GdkWindow)) {
            //        double radius = 10;
            //        int x = a.Event.Area.X;
            //        int y = a.Event.Area.Y;
            //        int width = a.Event.Area.Width;
            //        int height = a.Event.Area.Height;

            //        cr.MoveTo (x + radius, y);
            //        cr.Arc (x + width - radius, y + radius, radius, Math.PI * 1.5, Math.PI * 2);
            //        cr.Arc (x + width - radius, y + height - radius, radius, 0, Math.PI * .5);
            //        cr.Arc (x + radius, y + height - radius, radius, Math.PI * .5, Math.PI);
            //        cr.Arc (x + radius, y + radius, radius, Math.PI, Math.PI * 1.5);
            //        cr.Color = new Cairo.Color (.5, .5, .5, 1);
            //        cr.Stroke ();
            //    }
            // not yet sure which is the better code.
            //                Gdk.Window win = a.Event.Window;
            //                Gdk.Rectangle area = a.Event.Area;
            //
            //                win.DrawRectangle (Style.BaseGC (StateType.Active), false, area);
            //
            //                a.RetVal = true;
            //};
            Label help_label = new Label(
                AddinManager.CurrentLocalizer.GetString("Click a genre to load/refresh entries or type a query. Use the refresh button to refresh genres."));

            instruct.PackStart(help_label, false, true, 10);
            PackStart(instruct, false, true, 10);
            NoShowAll = false;
            ShowAll();
            NoShowAll = true;
            browser_container.Visible = ForcePosition != null || BrowserVisible.Get();
        }
Exemplo n.º 5
0
        public virtual bool SetSource(ISource source)
        {
            this.source = source;

            browser_container.Visible = ForcePosition != null || ActiveSourceCanHasBrowser && BrowserVisible.Get();
            return(true);
        }
Exemplo n.º 6
0
        protected override void OnShown()
        {
            base.OnShown();

            browser_container.Visible = ActiveSourceCanHasBrowser && BrowserVisible.Get();
        }
        /// <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;
        }