Beispiel #1
0
        public VisualizationDisplayWidget()
        {
            visualizationMenu        = new Menu();
            noVisualizationsMenuItem = new MenuItem(
                AddinManager.CurrentLocalizer.GetString("No visualizations installed"));
            noVisualizationsMenuItem.Sensitive = false;
            noVisualizationsMenuItem.Show();
            visualizationMenu.Add(noVisualizationsMenuItem);

            glWidget = new GLWidget();
            glWidget.DoubleBuffered = true;
            glWidget.Render        += OnRender;
            glWidget.SizeAllocated += OnGlSizeAllocated;
            glWidget.Show();

            Add(glWidget);
            Show();

            playerData        = new BansheePlayerData(ServiceManager.PlayerEngine.ActiveEngine);
            playerData.Active = false;

            glWidget.Realized += delegate {
                if (!loopRunning)
                {
                    loopRunning  = true;
                    renderThread = new Thread(RenderLoop);
                    renderThread.Start();
                }

                ConnectVisualization();
            };

            glWidget.Unrealized += delegate {
                DisposeRenderer();
            };

            AddinManager.AddExtensionNodeHandler("/Banshee/OpenVP/Visualization", OnVisualizationChanged);

            InterfaceActionService ias = ServiceManager.Get <InterfaceActionService>();

            ias.GlobalActions.AddImportant(new ActionEntry(SELECT_VIS_ACTION,
                                                           null,
                                                           AddinManager.CurrentLocalizer.GetString("Select visualization"),
                                                           null, null,
                                                           OnSelectVisualizationClicked));

            ias.GlobalActions.AddImportant(new ToggleActionEntry(LOW_RES_ACTION,
                                                                 null,
                                                                 AddinManager.CurrentLocalizer.GetString("Low resolution"),
                                                                 null, null,
                                                                 OnHalfResolutionToggled, false));

            ias.GlobalActions.UpdateAction(SELECT_VIS_ACTION, false);
            ias.GlobalActions.UpdateAction(LOW_RES_ACTION, false);

            global_ui_id = ias.UIManager.AddUiFromResource("ActiveSourceUI.xml");
        }
        public VisualizationDisplayWidget()
        {
            visualizationMenu = new Menu();
            noVisualizationsMenuItem = new MenuItem(
                AddinManager.CurrentLocalizer.GetString ("No visualizations installed"));
            noVisualizationsMenuItem.Sensitive = false;
            noVisualizationsMenuItem.Show();
            visualizationMenu.Add(noVisualizationsMenuItem);

            glWidget = new GLWidget();
            glWidget.DoubleBuffered = true;
            glWidget.Render += OnRender;
            glWidget.SizeAllocated += OnGlSizeAllocated;
            glWidget.Show();

            Add(glWidget);
            Show();

            playerData = new BansheePlayerData(ServiceManager.PlayerEngine.ActiveEngine);
            playerData.Active = false;

            glWidget.Realized += delegate {
                if (!loopRunning) {
                    loopRunning = true;
                    renderThread = new Thread(RenderLoop);
                    renderThread.Start();
                }

                ConnectVisualization();
            };

            glWidget.Unrealized += delegate {
                DisposeRenderer();
            };

            AddinManager.AddExtensionNodeHandler("/Banshee/OpenVP/Visualization", OnVisualizationChanged);

            InterfaceActionService ias = ServiceManager.Get<InterfaceActionService>();

            ias.GlobalActions.AddImportant(new ActionEntry(SELECT_VIS_ACTION,
                                                           null,
                                                           AddinManager.CurrentLocalizer.GetString ("Select visualization"),
                                                           null, null,
                                                           OnSelectVisualizationClicked));

            ias.GlobalActions.AddImportant(new ToggleActionEntry(LOW_RES_ACTION,
                                                                 null,
                                                                 AddinManager.CurrentLocalizer.GetString ("Low resolution"),
                                                                 null, null,
                                                                 OnHalfResolutionToggled, false));

            ias.GlobalActions.UpdateAction(SELECT_VIS_ACTION, false);
            ias.GlobalActions.UpdateAction(LOW_RES_ACTION, false);

            global_ui_id = ias.UIManager.AddUiFromResource("ActiveSourceUI.xml");
        }
        private void RenderLoop()
        {
            renderLock.Set();

            haveDataSlice = false;

            while (loopRunning) {
                if (playerData.Update(500)) {
                    haveDataSlice = true;

                    renderLock.Reset();
                    Hyena.ThreadAssist.ProxyToMain(glWidget.QueueDraw);
                    renderLock.WaitOne(500, false);
                }
            }

            lock (cleanupLock) {
                haveDataSlice = false;

                playerData.Dispose();
                playerData = null;
            }
        }