void
BasePlatformInterface::ResizeToWindow()
{
  // Only resize based on our XUL element if we're not in fullscreen mode.
  if (!mFullscreen) {
    LOG(("Resizing video to fit window in non-fullscreen mode"));
    PRInt32 x, y, width, height;

    if (mVideoBox) {
      mVideoBox->GetX(&x);
      mVideoBox->GetY(&y);
      mVideoBox->GetWidth(&width);
      mVideoBox->GetHeight(&height);

      SetDisplayArea(x, y, width, height);
      ResizeVideo();
    }
    else {
      LOG(("Not resizing video: no video box"));
    }
  }
  else {
    LOG(("Not resizing video: in fullscreen mode"));
  }
}
void
BasePlatformInterface::SetDisplayAspectRatio(int aNumerator, int aDenominator)
{
  mDARNum = aNumerator;
  mDARDenom = aDenominator;

  ResizeVideo();
}
void MagicView::OnSize(UINT nType, int cx, int cy) 
{
	CView::OnSize(nType, cx, cy);

   window_style = GetWindowLong(m_hWnd, GWL_STYLE);

   if (nType == SIZE_MINIMIZED) {
      is_minimized = true;
      is_maximized = false;
   }

   else if (nType == SIZE_MAXIMIZED) {
      is_minimized = false;
      is_maximized = true;
      ResizeVideo();
   }

   else if (nType == SIZE_RESTORED) {
      if (is_maximized) {
         is_maximized = false;
         ResizeVideo();
      }

      else if (is_minimized) {
         is_minimized = false;
         ResizeVideo();
      }
      else if (!is_sizing) {
         // if this is not a resize due to dragging...
         ResizeVideo();
      }
      else {
         // If we're neither maximized nor minimized, the window size 
         // is changing by the user dragging the window edges.  In this 
         // case, we don't reset the device yet -- we wait until the 
         // user stops dragging, and a WM_EXITSIZEMOVE message comes.
      }
   }
}
void
BasePlatformInterface::SetFullscreen(bool aFullscreen)
{
  if (aFullscreen && !mFullscreen) {
    mFullscreen = true;
    FullScreen();
  }
  else if (!aFullscreen && mFullscreen) {
    mFullscreen = false;
    UnFullScreen();

    // Make sure we're in the right place and the right size
    ResizeToWindow();
    ResizeVideo();
  }
  // Otherwise, we're already in the right mode, so don't do anything.
}
void MagicView::OnExitSizeMove()
{
   is_sizing = false;
   ResizeVideo();
}