| |||||||
| General Development (no feature request here!) You were able to fix an issue, or improved a feature? Post it here. |
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Portal Member Join Date: Oct 2007
Posts: 75
Thanks: 1
Thanked 0 Times in 0 Posts
| I know most people start MP full screen. For those of us that dont its a pain that the window is often offscreen especially with the BlueTwo Wide Skin. I have added this code in MediaPortal.cs This makes sure the window client area is the same aspect ratio as the skin and the window is on screen. I have tested on two systems with both BlueTwo skins and with / without resize to skin checked. I hope a dev will pick this up, clean it up if required and add it to the code. Best regards to all. Paul I have shown it between existing Log.Info calls to identify the section to be changed. Log.Info("Main: Loading windowmanager"); if (splashScreen != null) splashScreen.SetInformation("Initializing skin..."); Log.Info("Main: Resizing windowmanager"); using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config .Dir.Config, "MediaPortal.xml"))) { bool autosize = xmlreader.GetValueAsBool("general", "autosize", true); if (!GUIGraphicsContext.Fullscreen) { int nHBorderAllowance = this.Width - this.ClientRectangle.Width; int nVBorderAllowance = this.Height - this.ClientRectangle.Height; float fAspectRatio = 1.0f; if (GUIGraphicsContext.SkinSize.Height > 0) { fAspectRatio = (float)GUIGraphicsContext.SkinSize.Width / (float)GUIGraphicsContext.SkinSize.Height; } if (autosize) { // This will set the window size as large as possible up to the skin size, limited to the desktop size by windows ? Size = new Size(GUIGraphicsContext.SkinSize.Width + nHBorderAllowance, GUIGraphicsContext.SkinSize.Height + nVBorderAllowance); } else { //Restore aspect ratio Size = new Size((int)((float)(this.Height - nVBorderAllowance) * fAspectRatio) + nHBorderAllowance, this.Height); } if (this.Width > GUIGraphicsContext.currentScreen.WorkingArea.Width || this.Height > GUIGraphicsContext.currentScreen.WorkingArea.Heigh t) { Log.Info("Main: Limiting Window Size : fAspectRatio = {0}", fAspectRatio); //Try to fit width to working area then scale height to maintain aspect ratio int nNewWidth = GUIGraphicsContext.currentScreen.WorkingArea.Width - nHBorderAllowance; int nNewHeight = (int)((float)nNewWidth / fAspectRatio); if (nNewHeight + nVBorderAllowance > GUIGraphicsContext.currentScreen.WorkingArea.Heigh t) { // Height still too big nNewHeight = GUIGraphicsContext.currentScreen.WorkingArea.Heigh t - nVBorderAllowance; nNewWidth = (int)((float)nNewHeight * fAspectRatio); } Size = new Size(nNewWidth + nHBorderAllowance, nNewHeight + nVBorderAllowance); } Log.Info("Main: Window Size : this.Width = {0} : Height = {1} : this.ClientRectangle.Width = {2} : Height = {3}", this.Width, this.Height, this.ClientRectangle.Width, this.ClientRectangle.Height); //Position the window within the working area if (this.Right > GUIGraphicsContext.currentScreen.WorkingArea.Right ) { this.Left = GUIGraphicsContext.currentScreen.WorkingArea.Right - this.Width; } if (this.Left < GUIGraphicsContext.currentScreen.WorkingArea.Left) { this.Left = GUIGraphicsContext.currentScreen.WorkingArea.Left; } if (this.Bottom > GUIGraphicsContext.currentScreen.WorkingArea.Botto m) { this.Top = GUIGraphicsContext.currentScreen.WorkingArea.Botto m - this.Height; } if (this.Top < GUIGraphicsContext.currentScreen.WorkingArea.Top) { this.Top = GUIGraphicsContext.currentScreen.WorkingArea.Top; } } else { GUIGraphicsContext.Load(); GUIWindowManager.OnResize(); } } Log.Info("Main: Initializing windowmanager"); |
| | |
![]() |
| Bookmarks |
| Tags |
| aspect, draws, fix, offscreen, ratio, window, wrong |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Wrong aspect ratio from HD to SD | chrispazz | Get Support | 0 | 2007-11-03 18:36 |
| Wrong Aspect ratio with TVE3 | WebKnight | Get Support | 3 | 2007-10-24 13:12 |
| Live TV wrong aspect ratio with MPV codec | Sasler | pre 1.0 RC1 | 1 | 2007-03-09 13:53 |
| Playback in wrong aspect ratio on networked PC | moviebuff03 | General Support | 0 | 2006-06-06 00:28 |
| Internal DVD Player uses wrong aspect ratio | jahutch | General Support | 3 | 2006-02-11 09:08 |