Changeset 2437 for trunk/src


Ignore:
Timestamp:
Jan 14, 2000, 3:45:18 PM (26 years ago)
Author:
sandervl
Message:

MsgFormat bugfix

Location:
trunk/src/user32/new
Files:
7 edited

Legend:

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

    r2433 r2437  
    1 /* $Id: dc.cpp,v 1.12 2000-01-13 20:11:36 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.13 2000-01-14 14:45:15 sandervl Exp $ */
    22
    33/*
  • trunk/src/user32/new/oslibwin.cpp

    r2410 r2437  
    1 /* $Id: oslibwin.cpp,v 1.36 2000-01-11 17:34:43 cbratschi Exp $ */
     1/* $Id: oslibwin.cpp,v 1.37 2000-01-14 14:45:16 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    905905//******************************************************************************
    906906//******************************************************************************
    907 BOOL OSLibWinEnableScrollBar(HWND hwndParent, int scrollBar, BOOL fEnable)
    908 {
    909  HWND hwndScroll;
    910 
    911    if(scrollBar == OSLIB_VSCROLL) {
    912         hwndScroll = WinWindowFromID(hwndParent, FID_VERTSCROLL);
    913    }
    914    else hwndScroll = WinWindowFromID(hwndParent, FID_HORZSCROLL);
    915 
    916    if(hwndScroll == NULL)
    917         return FALSE;
    918 
    919    return WinEnableWindow(hwndScroll, fEnable);
    920 }
    921 //******************************************************************************
    922 //******************************************************************************
    923907HWND OSLibWinQueryObjectWindow(VOID)
    924908{
    925909  return WinQueryObjectWindow(HWND_DESKTOP);
    926 }
    927 //******************************************************************************
    928 //******************************************************************************
    929 ULONG OSLibWinGetScrollPos(HWND hwndParent, HWND hwndScroll)
    930 {
    931    if(hwndScroll == NULL)
    932         return 0;
    933 
    934    return (ULONG)WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0);
    935 }
    936 //******************************************************************************
    937 //******************************************************************************
    938 ULONG OSLibWinSetScrollPos(HWND hwndParent, HWND hwndScroll, int pos, int fRedraw)
    939 {
    940  ULONG oldPos;
    941 
    942    if(hwndScroll == NULL)
    943         return 0;
    944 
    945    oldPos = (ULONG)WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0);
    946 
    947    if(WinSendMsg(hwndScroll, SBM_SETPOS, MPFROMSHORT(pos), MPFROMLONG(fRedraw)) == FALSE)
    948         return 0;
    949 
    950    return oldPos;
    951 }
    952 //******************************************************************************
    953 //******************************************************************************
    954 BOOL OSLibWinSetScrollRange(HWND hwndParent, HWND hwndScroll, int minpos,
    955                             int maxpos, int fRedraw)
    956 {
    957    if(hwndScroll == NULL)
    958         return 0;
    959 
    960    return (BOOL)WinSendMsg( hwndScroll, SBM_SETSCROLLBAR,
    961                             MPFROMLONG(WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0)),
    962                             MPFROM2SHORT( minpos ,maxpos ) );
    963 }
    964 //******************************************************************************
    965 //******************************************************************************
    966 BOOL OSLibWinSetScrollPageSize(HWND hwndParent, HWND hwndScroll, int pagesize,
    967                                int totalsize, int fRedraw)
    968 {
    969    if(hwndScroll == NULL)
    970         return 0;
    971 
    972    return (BOOL)WinSendMsg( hwndScroll, SBM_SETTHUMBSIZE,
    973                             MPFROM2SHORT(pagesize, totalsize),
    974                             0);
    975 }
    976 //******************************************************************************
    977 //******************************************************************************
    978 void OSLibTranslateScrollCmdAndMsg(ULONG *msg, ULONG *scrollcmd)
    979 {
    980     switch(*scrollcmd)
    981     {
    982         case SB_LINEUP:
    983                *scrollcmd = SB_LINEUP_W;
    984                break;
    985         case SB_LINEDOWN:
    986                *scrollcmd = SB_LINEDOWN_W;
    987                break;
    988         case SB_PAGEUP:
    989                *scrollcmd = SB_PAGEUP_W;
    990                break;
    991         case SB_PAGEDOWN:
    992                *scrollcmd = SB_PAGEDOWN_W;
    993                break;
    994         case SB_SLIDERTRACK:
    995                *scrollcmd = SB_THUMBTRACK_W;
    996                break;
    997         case SB_SLIDERPOSITION:
    998                *scrollcmd = SB_THUMBPOSITION_W;
    999                break;
    1000         case SB_ENDSCROLL:
    1001                *scrollcmd = SB_ENDSCROLL_W;
    1002                break;
    1003     }
    1004     *msg = (*msg == WM_HSCROLL) ? WM_HSCROLL_W : WM_VSCROLL_W;
    1005     return;
    1006 }
    1007 //******************************************************************************
    1008 //******************************************************************************
    1009 void OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle, BOOL fTaskList)
    1010 {
    1011   ULONG OSWinStyle, OSFrameStyle, borderWidth, borderHeight,dwExStyle;
    1012 
    1013   OSLibWinConvertStyle(dwStyle, &dwExStyle, &OSWinStyle, &OSFrameStyle, &borderWidth, &borderHeight);
    1014 
    1015   if(fTaskList)
    1016   {
    1017     OSFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
    1018   }
    1019 
    1020 //  OSWinStyle = OSWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
    1021   OSWinStyle = OSWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPCHILDREN);
    1022 
    1023   WinSetWindowULong(hwnd, QWL_STYLE,
    1024                     (WinQueryWindowULong(hwnd, QWL_STYLE) & ~0xffff0000) |
    1025                     OSWinStyle);
    1026 
    1027   if(OSFrameStyle & FCF_TITLEBAR)
    1028   {
    1029       WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_TITLEBAR), hwnd, FALSE);
    1030       WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_MENU), hwnd, FALSE);
    1031   }
    1032   else
    1033   {
    1034       WinSetParent(WinWindowFromID(hwnd, FID_TITLEBAR), HWND_OBJECT, FALSE);
    1035       WinSetParent(WinWindowFromID(hwnd, FID_MENU), HWND_OBJECT, FALSE);
    1036   }
    1037   if(OSFrameStyle & FCF_SYSMENU)
    1038       WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_SYSMENU), hwnd, FALSE);
    1039   else
    1040       WinSetParent(WinWindowFromID(hwnd, FID_SYSMENU), HWND_OBJECT, FALSE);
    1041 
    1042   if((OSFrameStyle & FCF_MINBUTTON) || (OSFrameStyle & FCF_MAXBUTTON))
    1043       WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_MINMAX), hwnd, FALSE);
    1044   else
    1045       WinSetParent(WinWindowFromID(hwnd, FID_MINMAX), HWND_OBJECT, FALSE);
    1046 
    1047   if(OSFrameStyle & FCF_VERTSCROLL)
    1048       WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_VERTSCROLL), hwnd, FALSE);
    1049   else
    1050       WinSetParent(WinWindowFromID(hwnd, FID_VERTSCROLL), HWND_OBJECT, FALSE);
    1051 
    1052   if(OSFrameStyle & FCF_HORZSCROLL)
    1053       WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_HORZSCROLL), hwnd, FALSE);
    1054   else
    1055       WinSetParent(WinWindowFromID(hwnd, FID_HORZSCROLL), HWND_OBJECT, FALSE);
    1056 
    1057 #if 0
    1058   WNDPARAMS wndparam = {0};
    1059   FRAMECDATA framecdata = {0};
    1060 
    1061   framecdata.cb = sizeof(FRAMECDATA);
    1062 
    1063   wndparam.fsStatus  = WPM_CTLDATA;
    1064   wndparam.cbCtlData = framecdata.cb;
    1065   wndparam.pCtlData  = (PVOID)&framecdata;
    1066   WinSendMsg(hwnd, WM_QUERYWINDOWPARAMS, &wndparam, 0);
    1067 
    1068   wndparam.fsStatus = WPM_CTLDATA;
    1069   wndparam.pCtlData = (PVOID)&framecdata;
    1070   framecdata.flCreateFlags = OSFrameStyle;
    1071   WinSendMsg(hwnd, WM_SETWINDOWPARAMS, &wndparam, 0);
    1072 #endif
    1073 
    1074   WinSendMsg(hwnd, WM_UPDATEFRAME,
    1075              MPFROMLONG(FCF_TITLEBAR | FCF_SYSMENU | FCF_MINMAX |
    1076                         FCF_MENU | FCF_VERTSCROLL | FCF_HORZSCROLL),
    1077              MPVOID);
    1078910}
    1079911//******************************************************************************
  • trunk/src/user32/new/oslibwin.h

    r2406 r2437  
    1 /* $Id: oslibwin.h,v 1.29 2000-01-11 13:06:26 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.30 2000-01-14 14:45:16 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    259259HWND  OSLibWinObjectWindowFromID(HWND hwndOwner, ULONG ID);
    260260
    261 #define OSLIB_HSCROLL   0
    262 #define OSLIB_VSCROLL   1
    263 BOOL  OSLibWinEnableScrollBar(HWND hwndParent, int scrollBar, BOOL fEnable);
    264261HWND  OSLibWinQueryObjectWindow(VOID);
    265 ULONG OSLibWinGetScrollPos(HWND hwndParent, HWND hwndScroll);
    266 ULONG OSLibWinSetScrollPos(HWND hwndParent, HWND hwndScroll, int pos, int fRedraw);
    267 BOOL  OSLibWinSetScrollRange(HWND hwndParent, HWND hwndScroll, int minpos,
    268                              int maxpos, int fRedraw);
    269 BOOL  OSLibWinSetScrollPageSize(HWND hwndParent, HWND hwndScroll, int pagesize,
    270                                 int totalsize, int fRedraw);
    271 
    272 void  OSLibTranslateScrollCmdAndMsg(ULONG *msg, ULONG *scrollcmd);
    273262
    274263PVOID OSLibWinSubclassWindow(HWND hwnd,PVOID newWndProc);
  • trunk/src/user32/new/pmwindow.cpp

    r2435 r2437  
    1 /* $Id: pmwindow.cpp,v 1.41 2000-01-14 13:16:57 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.42 2000-01-14 14:45:16 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    459459//******************************************************************************
    460460//******************************************************************************
    461 MRESULT EXPENTRY Win32SubclassWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
    462 {
    463   Win32BaseWindow* win32wnd;
    464 
    465   //Restore our FS selector
    466   SetWin32TIB();
    467 
    468   win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
    469 
    470   if (!win32wnd)
    471   {
    472     dprintf(("Invalid win32wnd pointer for subclassed window %x!!", hwnd));
    473     goto RunDefWndProc;
    474   }
    475 
    476   switch (msg)
    477   {
    478     case WM_WINDOWPOSCHANGED:
    479       {
    480         PSWP      pswp  = (PSWP)mp1;
    481         SWP       swpOld = *(pswp + 1);
    482         WINDOWPOS wp;
    483         HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE;
    484 
    485         dprintf(("OS2Subclass: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    486         if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
    487 
    488         hParent = hFrame = WinQueryWindow(hwnd, QW_PARENT);
    489 
    490         OSLibMapSWPtoWINDOWPOS(pswp,&wp, &swpOld,hParent,hFrame);
    491 
    492         win32wnd->setWindowRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
    493         //win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
    494         wp.x = swpOld.x;
    495         wp.y = swpOld.y;
    496         wp.cx = swpOld.cx;
    497         wp.cy = swpOld.cy;
    498 
    499         wp.hwnd = win32wnd->getWindowHandle();
    500 
    501         win32wnd->MsgPosChanged((LPARAM)&wp);
    502 
    503         goto RunOldWndProc;
    504       }
    505 
    506     default:
    507       goto RunDefHandler;
    508   }
    509 
    510 RunDefWndProc:
    511   RestoreOS2TIB();
    512   return WinDefWindowProc(hwnd,msg,mp1,mp2);
    513 
    514 RunOldWndProc:
    515   RestoreOS2TIB();
    516   return ((PFNWP)win32wnd->getOldWndProc())(hwnd,msg,mp1,mp2);
    517 
    518 RunDefHandler:
    519   RestoreOS2TIB();
    520   return Win32WindowProc(hwnd,msg,mp1,mp2);
    521 }
    522 
    523 PVOID SubclassWithDefHandler(HWND hwnd)
    524 {
    525   return WinSubclassWindow(hwnd,Win32SubclassWindowProc);
    526 }
  • trunk/src/user32/new/win32wbase.cpp

    r2435 r2437  
    1 /* $Id: win32wbase.cpp,v 1.40 2000-01-14 13:16:58 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.41 2000-01-14 14:45:17 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    7171//******************************************************************************
    7272//******************************************************************************
    73 Win32BaseWindow::Win32BaseWindow(HWND os2Handle,VOID* win32WndProc) : GenericObject(&windows,OBJTYPE_WINDOW)
    74 {
    75   Init();
    76   OS2Hwnd = OS2HwndFrame = os2Handle;
    77   dwStyle = WS_VISIBLE;
    78   setWindowProc((WNDPROC)win32WndProc);
    79   fIsSubclassedOS2Wnd = TRUE;
    80   fFirstShow = FALSE;
    81   fCreated = TRUE;
    82 
    83   SetLastError(0);
    84 
    85   //CB: replace by a secure method
    86 
    87   if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
    88         dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));
    89         SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    90         return;
    91   }
    92   if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
    93         dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
    94         SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    95         return;
    96   }
    97 
    98   OSLibWinQueryWindowRect(OS2Hwnd,&rectClient,RELATIVE_TO_WINDOW);
    99   OSLibWinQueryWindowRect(OS2Hwnd,&rectWindow,RELATIVE_TO_SCREEN);
    100 
    101   setOldWndProc(SubclassWithDefHandler(OS2Hwnd));
    102 }
    103 //******************************************************************************
    104 //******************************************************************************
    10573Win32BaseWindow::Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode)
    10674                        : GenericObject(&windows, OBJTYPE_WINDOW), ChildWindow()
     
    11583{
    11684  isUnicode        = FALSE;
    117   fIsSubclassedOS2Wnd = FALSE;
    11885  fFirstShow       = TRUE;
    11986  fIsDialog        = FALSE;
     
    749716 Win32BaseWindow *child;
    750717 HWND hwnd = getWindowHandle();
    751 
    752     if (isSubclassedOS2Wnd) OSLibWinSubclassWindow(OS2Hwnd,pOldWndProc);
    753718
    754719    fIsDestroyed = TRUE;
     
    971936
    972937        /* Activate the window if needed */
    973         if(isSubclassedOS2Wnd()) {
    974                 Win32BaseWindow *parentwnd = GetWindowFromOS2FrameHandle(OSLibWinQueryWindow(OS2Hwnd, QWOS_PARENT));
    975                 if(parentwnd) {
    976                         hwndTop = (parentwnd->GetTopParent()) ? parentwnd->GetTopParent()->getWindowHandle() : 0;
    977                 }
    978                 else    hwndTop = 0;
    979         }
    980         else    hwndTop = (GetTopParent()) ? GetTopParent()->getWindowHandle() : 0;
     938        hwndTop = (GetTopParent()) ? GetTopParent()->getWindowHandle() : 0;
    981939
    982940        HWND hwndActive = GetActiveWindow();
     
    10931051    wndPos.hwndInsertAfter = 0;
    10941052    newWindowRect= rectWindow;
    1095     if (getParent()) mapWin32Rect(OSLIB_HWND_DESKTOP,getParent()->getOS2WindowHandle(),&newWindowRect);
     1053    if (getParent()) {
     1054        mapWin32Rect(OSLIB_HWND_DESKTOP,getParent()->getOS2WindowHandle(),&newWindowRect);
     1055    }
    10961056    wndPos.x     = newWindowRect.left;
    10971057    wndPos.y     = newWindowRect.top;
     
    11001060    wndPos.flags = SWP_FRAMECHANGED;
    11011061    lpWndPos     = &wndPos;
     1062
     1063    if (getParent()) {
     1064        newWindowRect= rectWindow; //reset; was modified
     1065    }
    11021066  }
    11031067
     
    27392703  if ((dwStyle & 0xFFFF0000) != (oldStyle & 0xFFFF0000))
    27402704  {
    2741     //CB: update
    2742     //OSLibSetWindowStyle(OS2HwndFrame, dwStyle, fTaskList);
     2705        FrameUpdateClient(this);
    27432706  }
    27442707}
  • trunk/src/user32/new/win32wbase.h

    r2433 r2437  
    1 /* $Id: win32wbase.h,v 1.27 2000-01-13 20:11:38 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.28 2000-01-14 14:45:18 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    9595
    9696                Win32BaseWindow(DWORD objType);
    97                 Win32BaseWindow(HWND os2Handle,VOID* win32WndProc);
    9897                Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
    9998virtual        ~Win32BaseWindow();
     
    294293       PVOID getOldWndProc() { return pOldWndProc; }
    295294       VOID  setOldWndProc(PVOID aOldWndProc) { pOldWndProc = aOldWndProc; }
    296        BOOL  isSubclassedOS2Wnd() { return fIsSubclassedOS2Wnd; };
    297295
    298296protected:
     
    353351
    354352        PVOID   pOldWndProc;
    355         BOOL    fIsSubclassedOS2Wnd;  //subclassed OS/2 window: Netscape plug-in/scrollbar
    356353
    357354   Win32BaseWindow *owner;
  • trunk/src/user32/new/windowword.cpp

    r2290 r2437  
    1 /* $Id: windowword.cpp,v 1.5 2000-01-01 14:57:36 cbratschi Exp $ */
     1/* $Id: windowword.cpp,v 1.6 2000-01-14 14:45:18 sandervl Exp $ */
    22
    33/*
     
    2626      return window->SetWindowLongA(nIndex,lNewLong);
    2727    }
    28     else
    29     {
    30       if (nIndex == GWL_WNDPROC && !Win32BaseWindow::GetWindowFromOS2Handle(hwnd))
    31       {
    32         dprintf(("Start subclassing OS/2 window"));
    33 
    34         window = new Win32BaseWindow(hwnd,(PVOID)lNewLong);
    35 
    36         if(window == NULL)
    37         {
    38           dprintf(("Win32BaseWindow creation failed!!"));
    39           return 0;
    40         }
    41 
    42         if(GetLastError() != 0)
    43         {
    44           dprintf(("Win32BaseWindow error found!!"));
    45           delete window;
    46           return 0;
    47         }
    48 
    49         return (LONG)window->getOldWndProc();
    50       }
    51       else dprintf(("SetWindowLongA; window %x not found!", hwnd));
     28    else {
     29         dprintf(("SetWindowLongA; window %x not found!", hwnd));
    5230    }
    5331    return 0;
     
    6442      return window->SetWindowLongA(nIndex,lNewLong, TRUE);
    6543    }
    66     else
    67     {
    68       if (nIndex == GWL_WNDPROC && !Win32BaseWindow::GetWindowFromOS2Handle(hwnd))
    69       {
    70         dprintf(("Start subclassing OS/2 window"));
    71 
    72         window = new Win32BaseWindow(hwnd,(PVOID)lNewLong);
    73 
    74         if(window == NULL)
    75         {
    76           dprintf(("Win32BaseWindow creation failed!!"));
    77           return 0;
    78         }
    79 
    80         if(GetLastError() != 0)
    81         {
    82           dprintf(("Win32BaseWindow error found!!"));
    83           delete window;
    84           return 0;
    85         }
    86 
    87         return (LONG)window->getOldWndProc();
    88       }
    89       else dprintf(("SetWindowLongW; window %x not found!", hwnd));
     44    else {
     45         dprintf(("SetWindowLongW; window %x not found!", hwnd));
    9046    }
    9147    return 0;
Note: See TracChangeset for help on using the changeset viewer.