Ignore:
Timestamp:
Jul 4, 2000, 10:42:07 AM (25 years ago)
Author:
sandervl
Message:

Rewrote Set/GetViewportExtEx, Set/GetMapMode & moved them from gdi32 to user32 + titlebar fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/dc.cpp

    r3754 r3800  
    1 /* $Id: dc.cpp,v 1.64 2000-06-26 10:27:10 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.65 2000-07-04 08:42:05 sandervl Exp $ */
    22
    33/*
     
    16551655//******************************************************************************
    16561656//******************************************************************************
     1657int WIN32API SetMapMode(HDC hdc, int mode)
     1658{
     1659  Win32BaseWindow *wnd;
     1660  pDCData          pHps = (pDCData)GpiQueryDCData((HPS)hdc);
     1661  if(!pHps)
     1662  {
     1663      SetLastError(ERROR_INVALID_HANDLE_W);
     1664      dprintf(("GDI32: SetMapMode %x %x -> invalid hdc!!", hdc, mode));
     1665      return 0;
     1666  }
     1667  wnd = Win32BaseWindow::GetWindowFromHandle(WindowFromDC(hdc));
     1668  //todo: metafile recording
     1669
     1670  dprintf(("GDI32: SetMapMode %x %x", hdc, mode));
     1671  return setMapMode(wnd, pHps, mode);
     1672}
     1673//******************************************************************************
     1674//******************************************************************************
     1675int WIN32API GetMapMode(HDC hdc)
     1676{
     1677   pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc);
     1678   if(pHps) {
     1679      dprintf(("GDI32: GetMapMode %x -> %x", hdc, pHps->MapMode));
     1680      return pHps->MapMode;
     1681   }
     1682   dprintf(("GDI32: GetMapMode: invalid hdc %x!!!", hdc));
     1683   SetLastError(ERROR_INVALID_HANDLE_W);
     1684   return 0;
     1685}
     1686//******************************************************************************
     1687//******************************************************************************
     1688BOOL WIN32API SetViewportExtEx(HDC hdc, int xExt, int yExt, LPSIZE pSize)
     1689{
     1690  Win32BaseWindow *wnd;
     1691  pDCData          pHps = (pDCData)GpiQueryDCData((HPS)hdc);
     1692
     1693   if(!pHps)
     1694   {
     1695      dprintf(("GDI32: SetViewportExtEx %x %d %d %x -> INVALID HDC", hdc, xExt, yExt, pSize));
     1696      SetLastError(ERROR_INVALID_HANDLE_W);
     1697      return FALSE;
     1698   }
     1699
     1700   if(pSize) {
     1701        dprintf(("GDI32: SetViewportExtEx %x %d %d (%d,%d)", hdc, xExt, yExt, pSize->cx, pSize->cy));
     1702   }
     1703   else dprintf(("GDI32: SetViewportExtEx %x %d %d NULL", hdc, xExt, yExt));
     1704
     1705   if (xExt && yExt )
     1706   {
     1707      //todo: Metafile recording!! (done for any map mode)
     1708
     1709      if(pHps->MapMode == MM_ISOTROPIC_W || pHps->MapMode == MM_ANISOTROPIC_W)
     1710      {
     1711         wnd = Win32BaseWindow::GetWindowFromHandle(WindowFromDC(hdc));
     1712         if(changePageXForm(wnd, pHps, NULL, xExt, yExt, (PPOINTL) pSize))
     1713         {
     1714            SetLastError(ERROR_SUCCESS_W);
     1715            return TRUE;
     1716         }
     1717      }
     1718      else
     1719      {
     1720         pHps->lVwpXExtSave = xExt;
     1721         pHps->lVwpYExtSave = yExt;
     1722
     1723         //if map mode is not ISOTROPIC nor ANISOTROPIC, this function does
     1724         //nothing and returns TRUE (NT)
     1725         SetLastError(ERROR_SUCCESS_W);
     1726         return TRUE;
     1727      }
     1728
     1729      SetLastError(ERROR_SUCCESS_W);
     1730      return FALSE;
     1731   }
     1732
     1733   SetLastError(ERROR_INVALID_PARAMETER_W);
     1734   return FALSE;
     1735}
     1736//******************************************************************************
     1737//******************************************************************************
     1738BOOL WIN32API GetViewportExtEx(HDC hdc, LPSIZE pSize)
     1739{
     1740   pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc);
     1741   if(!pHps)
     1742   {
     1743      dprintf(("GDI32: GetViewportExtEx %x %x -> INVALID HDC", hdc, pSize));
     1744      SetLastError(ERROR_INVALID_HANDLE_W);
     1745      return FALSE;
     1746   }
     1747
     1748   if(!pSize)
     1749   {
     1750      dprintf(("GDI32: GetViewportExtEx %x NULL -> INVALID parameter", hdc));
     1751      SetLastError(ERROR_INVALID_PARAMETER_W);
     1752      return FALSE;
     1753   }
     1754
     1755   pSize->cx = (LONG)pHps->viewportXExt;
     1756   pSize->cy = (LONG)pHps->viewportYExt;
     1757   dprintf(("GDI32: GetViewportExtEx %x -> (%d,%d)", hdc, pSize->cx, pSize->cy));
     1758
     1759   SetLastError(ERROR_SUCCESS_W);
     1760   return TRUE;
     1761}
     1762//******************************************************************************
     1763//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.