From: <kr_...@us...> - 2004-05-07 13:41:18
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1037/src/cbits/Win32 Modified Files: Frame.c Log Message: comments Index: Frame.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Frame.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Frame.c 25 Feb 2004 12:57:11 -0000 1.23 --- Frame.c 7 May 2004 13:41:09 -0000 1.24 *************** *** 17,21 **** int n = 0; while (lpchText[n] && lpchText[n] != '\t') n++; ! DrawText(hdc, lpchText, n, lpRect, DT_SINGLELINE|DT_VCENTER|DT_LEFT); DrawText(hdc, lpchText+n+1, -1, lpRect, DT_SINGLELINE|DT_VCENTER|DT_RIGHT); --- 17,21 ---- int n = 0; while (lpchText[n] && lpchText[n] != '\t') n++; ! DrawText(hdc, lpchText, n, lpRect, DT_SINGLELINE|DT_VCENTER|DT_LEFT); DrawText(hdc, lpchText+n+1, -1, lpRect, DT_SINGLELINE|DT_VCENTER|DT_RIGHT); *************** *** 41,45 **** free(pData->lpszAppVersion); deleteMenuHandlesMap(pData->pMenuHandlesMap); ! while (pData->statusContexts) { --- 41,46 ---- free(pData->lpszAppVersion); deleteMenuHandlesMap(pData->pMenuHandlesMap); ! ! // clear StatusBar context stack while (pData->statusContexts) { *************** *** 48,60 **** free(context); } ! while (pData->first_indicator) { IndicatorHandle indicator; ! indicator = pData->first_indicator; handleIndicatorDestroy(indicator); pData->first_indicator = pData->first_indicator->next; ! if (pData->first_indicator) pData->first_indicator->prev = NULL; --- 49,62 ---- free(context); } ! ! // clear StatusBar indicators list while (pData->first_indicator) { IndicatorHandle indicator; ! indicator = pData->first_indicator; handleIndicatorDestroy(indicator); pData->first_indicator = pData->first_indicator->next; ! if (pData->first_indicator) pData->first_indicator->prev = NULL; *************** *** 64,68 **** } pData->last_indicator = NULL; ! free(pData); PostQuitMessage(0); --- 66,70 ---- } pData->last_indicator = NULL; ! free(pData); PostQuitMessage(0); *************** *** 92,96 **** GetWindowText(hWnd,pData->lpszAppName,nLen+1); } ! pData->hLeftBar = CreateWindow("HDOCKBAR", NULL, --- 94,98 ---- GetWindowText(hWnd,pData->lpszAppName,nLen+1); } ! pData->hLeftBar = CreateWindow("HDOCKBAR", NULL, *************** *** 137,141 **** pData->first_indicator = NULL; pData->last_indicator = NULL; ! SetWindowLong(hWnd,GWL_USERDATA,(LONG) pData); } --- 139,143 ---- pData->first_indicator = NULL; pData->last_indicator = NULL; ! SetWindowLong(hWnd,GWL_USERDATA,(LONG) pData); } *************** *** 154,158 **** osSetMenuItemChecked(handle, !osGetMenuItemChecked(handle)); else ! handleMenuCommand(handle); } } --- 156,160 ---- osSetMenuItemChecked(handle, !osGetMenuItemChecked(handle)); else ! handleMenuCommand(handle); } } *************** *** 161,169 **** { LPMEASUREITEMSTRUCT lpMIS = (LPMEASUREITEMSTRUCT) lParam; ! if (lpMIS->CtlType == ODT_MENU) { handle = getMenuHandle(pData->pMenuHandlesMap, lpMIS->itemID); ! if (handle && handle->bitmap) { --- 163,171 ---- { LPMEASUREITEMSTRUCT lpMIS = (LPMEASUREITEMSTRUCT) lParam; ! if (lpMIS->CtlType == ODT_MENU) { handle = getMenuHandle(pData->pMenuHandlesMap, lpMIS->itemID); ! if (handle && handle->bitmap) { *************** *** 174,195 **** long lDims; WORD wCheckWidth, wCheckHeight; ! hDC = GetDC(hWnd); ! ZeroMemory(&ncm,sizeof(ncm)); ncm.cbSize = sizeof(ncm); ! // Get the menu dimensions SystemParametersInfo(SPI_GETNONCLIENTMETRICS,0,(PVOID)&ncm,FALSE); ! ! // Create a font based on menu metrics hFont = CreateFontIndirect(&ncm.lfMenuFont); hOldFont = SelectObject(hDC, hFont); ! // Draw out menu item caption - text. pos = getMenuPos(pData->pMenuHandlesMap, handle); hParent = getParentHMENU(handle); ! ZeroMemory(&mii,sizeof(mii)); mii.cbSize = sizeof(mii); --- 176,197 ---- long lDims; WORD wCheckWidth, wCheckHeight; ! hDC = GetDC(hWnd); ! ZeroMemory(&ncm,sizeof(ncm)); ncm.cbSize = sizeof(ncm); ! // Get the menu dimensions SystemParametersInfo(SPI_GETNONCLIENTMETRICS,0,(PVOID)&ncm,FALSE); ! ! // Create a font based on menu metrics hFont = CreateFontIndirect(&ncm.lfMenuFont); hOldFont = SelectObject(hDC, hFont); ! // Draw out menu item caption - text. pos = getMenuPos(pData->pMenuHandlesMap, handle); hParent = getParentHMENU(handle); ! ZeroMemory(&mii,sizeof(mii)); mii.cbSize = sizeof(mii); *************** *** 201,221 **** mii.cch++; mii.dwTypeData = malloc(mii.cch); ! if (mii.dwTypeData) { GetMenuItemInfo(hParent, pos, TRUE, &mii); ! ZeroMemory(&rc,sizeof(rc)); DrawText(hDC,mii.dwTypeData,mii.cch,&rc,DT_SINGLELINE|DT_VCENTER|DT_LEFT|DT_CALCRECT); ! lDims = GetMenuCheckMarkDimensions(); wCheckWidth = (WORD)(LOWORD(lDims)+Spacing); wCheckHeight = (WORD)(HIWORD(lDims)+Spacing); ! wCheckWidth = (WORD)max(handle->bitmap->destsize.cx, wCheckWidth); wCheckHeight = (WORD)max(handle->bitmap->destsize.cy, wCheckHeight); ! lpMIS->itemWidth = (rc.right-rc.left) + wCheckWidth + (Spacing*3); // Text width ! lpMIS->itemHeight = max((rc.bottom-rc.top),wCheckHeight) + (Spacing*2); // Text Height } --- 203,223 ---- mii.cch++; mii.dwTypeData = malloc(mii.cch); ! if (mii.dwTypeData) { GetMenuItemInfo(hParent, pos, TRUE, &mii); ! ZeroMemory(&rc,sizeof(rc)); DrawText(hDC,mii.dwTypeData,mii.cch,&rc,DT_SINGLELINE|DT_VCENTER|DT_LEFT|DT_CALCRECT); ! lDims = GetMenuCheckMarkDimensions(); wCheckWidth = (WORD)(LOWORD(lDims)+Spacing); wCheckHeight = (WORD)(HIWORD(lDims)+Spacing); ! wCheckWidth = (WORD)max(handle->bitmap->destsize.cx, wCheckWidth); wCheckHeight = (WORD)max(handle->bitmap->destsize.cy, wCheckHeight); ! lpMIS->itemWidth = (rc.right-rc.left) + wCheckWidth + (Spacing*3); // Text width ! lpMIS->itemHeight = max((rc.bottom-rc.top),wCheckHeight) + (Spacing*2); // Text Height } *************** *** 226,230 **** DeleteObject(hFont); ReleaseDC(hWnd,hDC); ! } } } --- 228,232 ---- DeleteObject(hFont); ReleaseDC(hWnd,hDC); ! } } } *************** *** 237,241 **** { handle = getMenuHandle(pData->pMenuHandlesMap, lpDIS->itemID); ! if (handle && handle->bitmap) { --- 239,243 ---- { handle = getMenuHandle(pData->pMenuHandlesMap, lpDIS->itemID); ! if (handle && handle->bitmap) { *************** *** 248,275 **** HBRUSH hFillBrush; struct CanvasHandle canvas; ! canvas.hDC = lpDIS->hDC; ! // Check box dimensions lDims = GetMenuCheckMarkDimensions(); wCheckWidth = LOWORD(lDims); wCheckHeight = HIWORD(lDims); ! wWidth = max(handle->bitmap->destsize.cx, wCheckWidth) + (Spacing*2); wHeight = max(handle->bitmap->destsize.cy, wCheckHeight) + (Spacing*2); ! rcFrame.left = lpDIS->rcItem.left; rcFrame.top = lpDIS->rcItem.top; rcFrame.right = lpDIS->rcItem.bottom - lpDIS->rcItem.top; rcFrame.bottom= lpDIS->rcItem.top+wHeight; ! rcBox.left = rcFrame.left+1; rcBox.top = rcFrame.top+1; rcBox.right = rcFrame.right-1; rcBox.bottom= rcFrame.bottom-1; ! // Save off context attributes nIndexDC = SaveDC(lpDIS->hDC); ! // create brush for selection state if (lpDIS->itemState & ODS_SELECTED) --- 250,277 ---- HBRUSH hFillBrush; struct CanvasHandle canvas; ! canvas.hDC = lpDIS->hDC; ! // Check box dimensions lDims = GetMenuCheckMarkDimensions(); wCheckWidth = LOWORD(lDims); wCheckHeight = HIWORD(lDims); ! wWidth = max(handle->bitmap->destsize.cx, wCheckWidth) + (Spacing*2); wHeight = max(handle->bitmap->destsize.cy, wCheckHeight) + (Spacing*2); ! rcFrame.left = lpDIS->rcItem.left; rcFrame.top = lpDIS->rcItem.top; rcFrame.right = lpDIS->rcItem.bottom - lpDIS->rcItem.top; rcFrame.bottom= lpDIS->rcItem.top+wHeight; ! rcBox.left = rcFrame.left+1; rcBox.top = rcFrame.top+1; rcBox.right = rcFrame.right-1; rcBox.bottom= rcFrame.bottom-1; ! // Save off context attributes nIndexDC = SaveDC(lpDIS->hDC); ! // create brush for selection state if (lpDIS->itemState & ODS_SELECTED) *************** *** 280,286 **** else hFillBrush = CreateSolidBrush(GetBkColor(lpDIS->hDC)); ! SetBkMode(lpDIS->hDC,TRANSPARENT); ! // Add some spacing before drawing the text and hi-lite rcFill.left = lpDIS->rcItem.left; --- 282,288 ---- else hFillBrush = CreateSolidBrush(GetBkColor(lpDIS->hDC)); ! SetBkMode(lpDIS->hDC,TRANSPARENT); ! // Add some spacing before drawing the text and hi-lite rcFill.left = lpDIS->rcItem.left; *************** *** 288,301 **** rcFill.right = lpDIS->rcItem.right; rcFill.bottom= lpDIS->rcItem.bottom; ! if ((lpDIS->itemState & ODS_SELECTED) && (lpDIS->itemState & ODS_CHECKED)) rcFill.left+=wWidth+Spacing; ! FillRect(lpDIS->hDC, &rcFill, hFillBrush); ! rc = lpDIS->rcItem; rc.left += wWidth+Spacing; rc.right-= Spacing; ! // Draw out the bitmap associated with the menu item. pt.x = rcFrame.left+(((rcFrame.right-rcFrame.left) - handle->bitmap->destsize.cx)/2); --- 290,303 ---- rcFill.right = lpDIS->rcItem.right; rcFill.bottom= lpDIS->rcItem.bottom; ! if ((lpDIS->itemState & ODS_SELECTED) && (lpDIS->itemState & ODS_CHECKED)) rcFill.left+=wWidth+Spacing; ! FillRect(lpDIS->hDC, &rcFill, hFillBrush); ! rc = lpDIS->rcItem; rc.left += wWidth+Spacing; rc.right-= Spacing; ! // Draw out the bitmap associated with the menu item. pt.x = rcFrame.left+(((rcFrame.right-rcFrame.left) - handle->bitmap->destsize.cx)/2); *************** *** 303,317 **** osDrawBitmap(pt.x, pt.y, handle->bitmap, &canvas); ! ! // Draw bounding frame if (lpDIS->itemState & ODS_SELECTED) DrawEdge(lpDIS->hDC,&rcFrame,BDR_RAISEDINNER,BF_RECT); ! rc.left+=Spacing; ! ! // Draw out menu item caption - text. pos = getMenuPos(pData->pMenuHandlesMap, handle); hParent = getParentHMENU(handle); ! ZeroMemory(&mii,sizeof(mii)); mii.cbSize = sizeof(mii); --- 305,319 ---- osDrawBitmap(pt.x, pt.y, handle->bitmap, &canvas); ! ! // Draw bounding frame if (lpDIS->itemState & ODS_SELECTED) DrawEdge(lpDIS->hDC,&rcFrame,BDR_RAISEDINNER,BF_RECT); ! rc.left+=Spacing; ! ! // Draw out menu item caption - text. pos = getMenuPos(pData->pMenuHandlesMap, handle); hParent = getParentHMENU(handle); ! ZeroMemory(&mii,sizeof(mii)); mii.cbSize = sizeof(mii); *************** *** 323,337 **** mii.cch++; mii.dwTypeData = malloc(mii.cch); ! if (mii.dwTypeData) { GetMenuItemInfo(hParent, pos, TRUE, &mii); ! if (lpDIS->itemState & ODS_GRAYED) ! { ! // This will give it a disable text look if (!(lpDIS->itemState & ODS_SELECTED)) { ! SetTextColor(lpDIS->hDC, GetSysColor(COLOR_3DHILIGHT)); OffsetRect(&rc,1,1); DrawMenuText(lpDIS->hDC,mii.dwTypeData,&rc); --- 325,339 ---- mii.cch++; mii.dwTypeData = malloc(mii.cch); ! if (mii.dwTypeData) { GetMenuItemInfo(hParent, pos, TRUE, &mii); ! if (lpDIS->itemState & ODS_GRAYED) ! { ! // This will give it a disable text look if (!(lpDIS->itemState & ODS_SELECTED)) { ! SetTextColor(lpDIS->hDC, GetSysColor(COLOR_3DHILIGHT)); OffsetRect(&rc,1,1); DrawMenuText(lpDIS->hDC,mii.dwTypeData,&rc); *************** *** 351,357 **** DrawMenuText(lpDIS->hDC,mii.dwTypeData,&rc); } ! free(mii.dwTypeData); ! RestoreDC(lpDIS->hDC,nIndexDC); } --- 353,359 ---- DrawMenuText(lpDIS->hDC,mii.dwTypeData,&rc); } ! free(mii.dwTypeData); ! RestoreDC(lpDIS->hDC,nIndexDC); } *************** *** 363,367 **** HMENU hMenu; int i, nCount; ! hMenu = (HMENU) wParam; nCount = GetMenuItemCount((HMENU) wParam); --- 365,369 ---- HMENU hMenu; int i, nCount; ! hMenu = (HMENU) wParam; nCount = GetMenuItemCount((HMENU) wParam); *************** *** 371,375 **** mii.fMask = MIIM_ID; GetMenuItemInfo(hMenu, i, TRUE, &mii); ! handle = getMenuHandle(pData->pMenuHandlesMap, (UINT) mii.wID); if (handle) handleMenuUpdate(handle); --- 373,377 ---- mii.fMask = MIIM_ID; GetMenuItemInfo(hMenu, i, TRUE, &mii); ! handle = getMenuHandle(pData->pMenuHandlesMap, (UINT) mii.wID); if (handle) handleMenuUpdate(handle); *************** *** 398,402 **** IndicatorHandle indicator; LPNMMOUSE lpnm = (LPNMMOUSE) lParam; ! if (lpnm->hdr.code == NM_DBLCLK && lpnm->dwItemSpec > 0) { --- 400,404 ---- IndicatorHandle indicator; LPNMMOUSE lpnm = (LPNMMOUSE) lParam; ! if (lpnm->hdr.code == NM_DBLCLK && lpnm->dwItemSpec > 0) { *************** *** 463,467 **** if (!pData->hClientWnd) return -1; ! DrawMenuBar(hWnd); } --- 465,469 ---- if (!pData->hClientWnd) return -1; ! DrawMenuBar(hWnd); } |