Esempio n. 1
0
        private void OnSkinChanged()
        {
            // Backup the buttons, needed later
            BackupButtons();

            // Set the skin to the selected skin and reload GUI
            GUIGraphicsContext.Skin = _btnSkin.Label;
            SaveSettings();
            GUITextureManager.Clear();
            GUITextureManager.Init();
            SkinSettings.Load();
            GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml"));
            GUIFontManager.InitializeDeviceObjects();
            GUIExpressionManager.ClearExpressionCache();
            GUIControlFactory.ClearReferences();
            GUIControlFactory.LoadReferences(GUIGraphicsContext.GetThemedSkinFile(@"\references.xml"));
            GUIWindowManager.OnResize();
            GUIWindowManager.ActivateWindow(GetID);
            GUIControl.FocusControl(GetID, _btnSkin.GetID);

            // Apply the selected buttons again, since they are cleared when we reload
            RestoreButtons();
            using (Settings xmlreader = new MPSettings())
            {
                xmlreader.SetValue("general", "skinobsoletecount", 0);
                if (!GUIGraphicsContext.Fullscreen)
                {
                    try
                    {
                        var border = new Size(GUIGraphicsContext.form.Width - GUIGraphicsContext.form.ClientSize.Width,
                                              GUIGraphicsContext.form.Height - GUIGraphicsContext.form.ClientSize.Height);
                        if (GUIGraphicsContext.SkinSize.Width + border.Width <= GUIGraphicsContext.currentScreen.WorkingArea.Width &&
                            GUIGraphicsContext.SkinSize.Height + border.Height <= GUIGraphicsContext.currentScreen.WorkingArea.Height)
                        {
                            GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                        }
                        else
                        {
                            double ratio = Math.Min((double)(GUIGraphicsContext.currentScreen.WorkingArea.Width - border.Width) / GUIGraphicsContext.SkinSize.Width,
                                                    (double)(GUIGraphicsContext.currentScreen.WorkingArea.Height - border.Height) / GUIGraphicsContext.SkinSize.Height);
                            GUIGraphicsContext.form.ClientSize = new Size((int)(GUIGraphicsContext.SkinSize.Width * ratio), (int)(GUIGraphicsContext.SkinSize.Height * ratio));
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error("OnSkinChanged exception:{0}", ex.ToString());
                        Log.Error(ex);
                    }
                }
            }
            if (BassMusicPlayer.Player != null && BassMusicPlayer.Player.VisualizationWindow != null)
            {
                BassMusicPlayer.Player.VisualizationWindow.Reinit();
            }

            // Send a message that the skin has changed.
            var msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SKIN_CHANGED, 0, 0, 0, 0, 0, null);

            GUIGraphicsContext.SendMessage(msg);
        }
        public void RevertSkin()
        {
            //int ActiveWindowID = GUIWindowManager.ActiveWindow;
            // Change skin back to OutdatedSkinName
            GUIGraphicsContext.Skin = _userSkin;
            GUITextureManager.Clear();
            GUITextureManager.Init();
            SkinSettings.Load();
            GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml"));
            GUIFontManager.InitializeDeviceObjects();
            GUIExpressionManager.ClearExpressionCache();
            GUIControlFactory.ClearReferences();
            GUIControlFactory.LoadReferences(GUIGraphicsContext.GetThemedSkinFile(@"\references.xml"));
            GUIWindowManager.OnResize();
            //GUIWindowManager.ActivateWindow(ActiveWindowID);

            using (Settings xmlreader = new MPSettings())
            {
                xmlreader.SetValue("general", "skinobsoletecount", 0);
                if (!GUIGraphicsContext.Fullscreen)
                {
                    try
                    {
                        GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("OnSkinChanged exception:{0}", ex.ToString());
                        Log.Error(ex);
                    }
                }
            }
        }
Esempio n. 3
0
 private void OnLanguageChanged()
 {
     // Backup the buttons, needed later
     BackupButtons();
     SaveSettings();
     GUILocalizeStrings.ChangeLanguage(_btnLanguage.Label);
     GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml"));
     GUIFontManager.InitializeDeviceObjects();
     GUIWindowManager.OnResize();
     GUIWindowManager.ActivateWindow(GetID); // without this you cannot change skins / lang any more..
     GUIControl.FocusControl(GetID, _btnLanguage.GetID);
     // Apply the selected buttons again, since they are cleared when we reload
     RestoreButtons();
 }
        private void OnSkinChanged()
        {
            // Backup the buttons, needed later
            BackupButtons();

            // Set the skin to the selected skin and reload GUI
            GUIGraphicsContext.Skin = btnSkin.Label;
            SaveSettings();
            GUITextureManager.Clear();
            GUITextureManager.Init();
            SkinSettings.Load();
            GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml"));
            GUIFontManager.InitializeDeviceObjects();
            GUIExpressionManager.ClearExpressionCache();
            GUIControlFactory.ClearReferences();
            GUIControlFactory.LoadReferences(GUIGraphicsContext.GetThemedSkinFile(@"\references.xml"));
            GUIWindowManager.OnResize();
            GUIWindowManager.ActivateWindow(GetID);
            GUIControl.FocusControl(GetID, btnSkin.GetID);

            // Apply the selected buttons again, since they are cleared when we reload
            RestoreButtons();
            using (Settings xmlreader = new MPSettings())
            {
                xmlreader.SetValue("general", "skinobsoletecount", 0);
                bool autosize = xmlreader.GetValueAsBool("gui", "autosize", true);
                if (autosize && !GUIGraphicsContext.Fullscreen)
                {
                    try
                    {
                        GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                        //Form.ActiveForm.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("OnSkinChanged exception:{0}", ex.ToString());
                        Log.Error(ex);
                    }
                }
            }
            if (BassMusicPlayer.Player != null && BassMusicPlayer.Player.VisualizationWindow != null)
            {
                BassMusicPlayer.Player.VisualizationWindow.Reinit();
            }

            // Send a message that the skin has changed.
            GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SKIN_CHANGED, 0, 0, 0, 0, 0, null);

            GUIGraphicsContext.SendMessage(msg);
        }
Esempio n. 5
0
        public override bool OnMessage(GUIMessage message)
        {
            switch (message.Message)
            {
            case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT:
            {
                GUIWindowManager.OnResize();
                GUIWindowManager.PreInit();
                GUIGraphicsContext.Save();
                if (m_orgZoomVertical != GUIGraphicsContext.ZoomVertical) // only vertical zoom affects font sizes
                {
                    GUIDialogNotify dlgNotify =
                        (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY);
                    if (dlgNotify != null)
                    {
                        dlgNotify.Reset();
                        dlgNotify.ClearAll();
                        dlgNotify.SetHeading(213);                       // UI Calibration
                        dlgNotify.SetText(GUILocalizeStrings.Get(2650)); // Reloading fonts, please wait...
                        dlgNotify.TimeOut = 1;
                        dlgNotify.DoModal(GUIWindowManager.ActiveWindow);
                    }
                    GUIFontManager.LoadFonts(Config.GetFile(Config.Dir.Skin, GUIGraphicsContext.Skin, "fonts.xml"));
                    GUIFontManager.InitializeDeviceObjects();
                }
            }
            break;

            case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT:
            {
                base.OnMessage(message);
                m_iSpeed          = 1;
                m_iCountU         = 0;
                m_iCountD         = 0;
                m_iCountL         = 0;
                m_iCountR         = 0;
                m_iMode           = 0;
                m_bModeLocked     = true;
                m_orgZoomVertical = GUIGraphicsContext.ZoomVertical;
                m_iLogWidth       = (int)Math.Round((float)GUIGraphicsContext.Width * (float)GUIGraphicsContext.ZoomHorizontal);
                m_iLogHeight      = (int)Math.Round((float)GUIGraphicsContext.Height * (float)GUIGraphicsContext.ZoomVertical);
                ClampLogicalScreenSize();
                UpdateControlLabel();
                return(true);
            }
            }
            return(base.OnMessage(message));
        }
Esempio n. 6
0
        public void RevertSkin()
        {
            //int ActiveWindowID = GUIWindowManager.ActiveWindow;
            // Change skin back to OutdatedSkinName
            GUIGraphicsContext.Skin = _userSkin;
            GUITextureManager.Clear();
            GUITextureManager.Init();
            GUIFontManager.LoadFonts(GUIGraphicsContext.Skin + @"\fonts.xml");
            GUIFontManager.InitializeDeviceObjects();
            GUIExpressionManager.ClearExpressionCache();
            GUIControlFactory.ClearReferences();
            GUIControlFactory.LoadReferences(GUIGraphicsContext.Skin + @"\references.xml");
            GUIWindowManager.OnResize();
            //GUIWindowManager.ActivateWindow(ActiveWindowID);
            using (Settings xmlreader = new MPSettings())
            {
                xmlreader.SetValue("general", "skinobsoletecount", 0);
                bool autosize = xmlreader.GetValueAsBool("gui", "autosize", true);
                if (autosize && !GUIGraphicsContext.Fullscreen)
                {
                    try
                    {
                        GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                        //Form.ActiveForm.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("OnSkinChanged exception:{0}", ex.ToString());
                        Log.Error(ex);
                    }
                }
            }

            if (BassMusicPlayer.Player != null && BassMusicPlayer.Player.VisualizationWindow != null)
            {
                BassMusicPlayer.Player.VisualizationWindow.Reinit();
            }
        }