From: <kr_...@us...> - 2004-05-07 14:33:14
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13023/src/cbits/Win32 Modified Files: DockBar.c StatusBar.c Window.c Log Message: Use IsWindowVisible function instead of GetWindowLong to determine whether the window is visible Index: DockBar.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/DockBar.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DockBar.c 14 Nov 2003 22:35:20 -0000 1.8 --- DockBar.c 7 May 2004 14:33:04 -0000 1.9 *************** *** 11,15 **** HWND hWnd; } BarData; ! typedef struct { --- 11,15 ---- HWND hWnd; } BarData; ! typedef struct { *************** *** 33,45 **** int nBarOffset, nBandOffset; SIZE sz; ! nBandOffset = 0; for (i = 0; i < pData->nBandCount; i++) { pBand = &pData->pBands[i]; ! pBand->nSize = 0; pBand->nOffset = nBandOffset; ! nBarOffset = 0; for (j = 0; j < pBand->nBarCount; j++) --- 33,45 ---- int nBarOffset, nBandOffset; SIZE sz; ! nBandOffset = 0; for (i = 0; i < pData->nBandCount; i++) { pBand = &pData->pBands[i]; ! pBand->nSize = 0; pBand->nOffset = nBandOffset; ! nBarOffset = 0; for (j = 0; j < pBand->nBarCount; j++) *************** *** 47,51 **** pBar = &pBand->pBars[j]; GetToolBarSize(pBar->hWnd, &sz); ! pBar->nOffset = max(pBar->nOffset, nBarOffset); if (bVert) --- 47,51 ---- pBar = &pBand->pBars[j]; GetToolBarSize(pBar->hWnd, &sz); ! pBar->nOffset = max(pBar->nOffset, nBarOffset); if (bVert) *************** *** 53,57 **** pBand->nSize = max(pBand->nSize, sz.cx); pBar->nSize = sz.cy; ! SetWindowPos(pBar->hWnd,NULL,pBand->nOffset,pBar->nOffset,sz.cx,sz.cy,SWP_NOZORDER); } --- 53,57 ---- pBand->nSize = max(pBand->nSize, sz.cx); pBar->nSize = sz.cy; ! SetWindowPos(pBar->hWnd,NULL,pBand->nOffset,pBar->nOffset,sz.cx,sz.cy,SWP_NOZORDER); } *************** *** 60,70 **** pBand->nSize = max(pBand->nSize, sz.cy); pBar->nSize = sz.cx; ! SetWindowPos(pBar->hWnd,NULL,pBar->nOffset,pBand->nOffset,sz.cx,sz.cy,SWP_NOZORDER); } ! nBarOffset = pBar->nOffset + pBar->nSize; } ! nBandOffset = pBand->nOffset + pBand->nSize; } --- 60,70 ---- pBand->nSize = max(pBand->nSize, sz.cy); pBar->nSize = sz.cx; ! SetWindowPos(pBar->hWnd,NULL,pBar->nOffset,pBand->nOffset,sz.cx,sz.cy,SWP_NOZORDER); } ! nBarOffset = pBar->nOffset + pBar->nSize; } ! nBandOffset = pBand->nOffset + pBand->nSize; } *************** *** 75,84 **** int i, nSize; DockBarData *pData; ! nSize = 0; pData = (DockBarData *) GetWindowLong(hDockBar, GWL_USERDATA); ! RecalcDockBarLayout(pData, GetWindowLong(hDockBar, GWL_STYLE) & CCS_VERT); ! for (i = 0; i < pData->nBandCount; i++) nSize += pData->pBands[i].nSize; --- 75,84 ---- int i, nSize; DockBarData *pData; ! nSize = 0; pData = (DockBarData *) GetWindowLong(hDockBar, GWL_USERDATA); ! RecalcDockBarLayout(pData, GetWindowLong(hDockBar, GWL_STYLE) & CCS_VERT); ! for (i = 0; i < pData->nBandCount; i++) nSize += pData->pBands[i].nSize; *************** *** 93,97 **** int nWidth, nHeight; int nLeft, nTop, nRight, nBottom; ! int nStatusHeight; if (!ghWndFrame) --- 93,97 ---- int nWidth, nHeight; int nLeft, nTop, nRight, nBottom; ! int nStatusHeight; if (!ghWndFrame) *************** *** 99,104 **** pData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! ! if (GetWindowLong(pData->hStatusBar, GWL_STYLE) & WS_VISIBLE) nStatusHeight = 20; else --- 99,104 ---- pData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! ! if (IsWindowVisible(pData->hStatusBar)) nStatusHeight = 20; else *************** *** 106,110 **** GetClientRect(ghWndFrame, &rect); ! nWidth = rect.right-rect.left; nHeight = rect.bottom-rect.top-nStatusHeight; --- 106,110 ---- GetClientRect(ghWndFrame, &rect); ! nWidth = rect.right-rect.left; nHeight = rect.bottom-rect.top-nStatusHeight; *************** *** 113,117 **** nRight = GetDockBarSize(pData->hRightBar); nBottom = GetDockBarSize(pData->hBottomBar); ! SetWindowPos(pData->hLeftBar, NULL,0,nTop,nLeft,nHeight-(nBottom+nTop),SWP_NOZORDER); SetWindowPos(pData->hTopBar, NULL,0,0,nWidth,nTop,SWP_NOZORDER); --- 113,117 ---- nRight = GetDockBarSize(pData->hRightBar); nBottom = GetDockBarSize(pData->hBottomBar); ! SetWindowPos(pData->hLeftBar, NULL,0,nTop,nLeft,nHeight-(nBottom+nTop),SWP_NOZORDER); SetWindowPos(pData->hTopBar, NULL,0,0,nWidth,nTop,SWP_NOZORDER); *************** *** 120,124 **** SetWindowPos(pData->hClientWnd,NULL,nLeft,nTop,nWidth-(nRight+nLeft),nHeight-(nBottom+nTop),SWP_NOZORDER); ! SetWindowPos(pData->hStatusBar,NULL,0,nHeight,nWidth,nStatusHeight,SWP_NOZORDER); } --- 120,124 ---- SetWindowPos(pData->hClientWnd,NULL,nLeft,nTop,nWidth-(nRight+nLeft),nHeight-(nBottom+nTop),SWP_NOZORDER); ! SetWindowPos(pData->hStatusBar,NULL,0,nHeight,nWidth,nStatusHeight,SWP_NOZORDER); } *************** *** 129,133 **** { DockBarData *pData = (DockBarData *) GetWindowLong(hWnd, GWL_USERDATA); ! switch (uMsg) { --- 129,133 ---- { DockBarData *pData = (DockBarData *) GetWindowLong(hWnd, GWL_USERDATA); ! switch (uMsg) { *************** *** 135,139 **** { HMENU hMenu; ! if (((CREATESTRUCT *) lParam)->style & WS_CHILD) { --- 135,139 ---- { HMENU hMenu; ! if (((CREATESTRUCT *) lParam)->style & WS_CHILD) { *************** *** 162,166 **** { int i; ! SetWindowLong(hWnd, GWL_USERDATA, 0); for (i = 0; i < pData->nBandCount; i++) --- 162,166 ---- { int i; ! SetWindowLong(hWnd, GWL_USERDATA, 0); for (i = 0; i < pData->nBandCount; i++) *************** *** 178,187 **** TBBUTTONINFO tbbi; HWND hToolBar = (HWND) lParam; ! tbbi.cbSize = sizeof(tbbi); tbbi.dwMask = TBIF_LPARAM; tbbi.lParam = 0; SendMessage(hToolBar, TB_GETBUTTONINFO, LOWORD(wParam), (LPARAM) &tbbi); ! handle = (ToolHandle) tbbi.lParam; if (handle) osActivateToolItem(handle); --- 178,187 ---- TBBUTTONINFO tbbi; HWND hToolBar = (HWND) lParam; ! tbbi.cbSize = sizeof(tbbi); tbbi.dwMask = TBIF_LPARAM; tbbi.lParam = 0; SendMessage(hToolBar, TB_GETBUTTONINFO, LOWORD(wParam), (LPARAM) &tbbi); ! handle = (ToolHandle) tbbi.lParam; if (handle) osActivateToolItem(handle); *************** *** 193,204 **** TBBUTTONINFO tbbi; LPNMTOOLBAR lpNMToolBar = (LPNMTOOLBAR) lParam; ! if (lpNMToolBar->hdr.code == TBN_DROPDOWN) ! { tbbi.cbSize = sizeof(tbbi); tbbi.dwMask = TBIF_LPARAM; tbbi.lParam = 0; SendMessage(lpNMToolBar->hdr.hwndFrom, TB_GETBUTTONINFO, lpNMToolBar->iItem, (LPARAM) &tbbi); ! handle = (ToolHandle) tbbi.lParam; if (handle) --- 193,204 ---- TBBUTTONINFO tbbi; LPNMTOOLBAR lpNMToolBar = (LPNMTOOLBAR) lParam; ! if (lpNMToolBar->hdr.code == TBN_DROPDOWN) ! { tbbi.cbSize = sizeof(tbbi); tbbi.dwMask = TBIF_LPARAM; tbbi.lParam = 0; SendMessage(lpNMToolBar->hdr.hwndFrom, TB_GETBUTTONINFO, lpNMToolBar->iItem, (LPARAM) &tbbi); ! handle = (ToolHandle) tbbi.lParam; if (handle) *************** *** 212,216 **** int nWidth = LOWORD(lParam); int nHeight = HIWORD(lParam); ! SetWindowPos(GetWindow(hWnd, GW_CHILD),NULL,0,0,nWidth,nHeight,SWP_NOZORDER); } --- 212,216 ---- int nWidth = LOWORD(lParam); int nHeight = HIWORD(lParam); ! SetWindowPos(GetWindow(hWnd, GW_CHILD),NULL,0,0,nWidth,nHeight,SWP_NOZORDER); } *************** *** 221,225 **** break; } ! return DefWindowProc(hWnd, uMsg, wParam, lParam); } --- 221,225 ---- break; } ! return DefWindowProc(hWnd, uMsg, wParam, lParam); } *************** *** 231,240 **** int nOffset; int nCentralOffset; ! DockBarData *pData = (DockBarData *) GetWindowLong(hDockBar, GWL_USERDATA); BOOL bVert = GetWindowLong(hDockBar, GWL_STYLE) & CCS_VERT; BandData *pBand; ! RecalcDockBarLayout(pData, bVert); ! if (bVert) { --- 231,240 ---- int nOffset; int nCentralOffset; ! DockBarData *pData = (DockBarData *) GetWindowLong(hDockBar, GWL_USERDATA); BOOL bVert = GetWindowLong(hDockBar, GWL_STYLE) & CCS_VERT; BandData *pBand; ! RecalcDockBarLayout(pData, bVert); ! if (bVert) { *************** *** 247,251 **** nCentralOffset = (rect.bottom-rect.top)/2; } ! for (nBandNum = 0; nBandNum < pData->nBandCount; nBandNum++) { --- 247,251 ---- nCentralOffset = (rect.bottom-rect.top)/2; } ! for (nBandNum = 0; nBandNum < pData->nBandCount; nBandNum++) { *************** *** 254,258 **** break; } ! if (nBandNum >= pData->nBandCount) nPosition = 0; --- 254,258 ---- break; } ! if (nBandNum >= pData->nBandCount) nPosition = 0; *************** *** 260,264 **** { pBand = &pData->pBands[nBandNum]; ! if (nOffset < pBand->pBars[0].nOffset) nPosition = 0; --- 260,264 ---- { pBand = &pData->pBands[nBandNum]; ! if (nOffset < pBand->pBars[0].nOffset) nPosition = 0; *************** *** 272,276 **** } } ! DockToolBar(hDockBar, hWnd, nBandNum, nPosition, nOffset); } --- 272,276 ---- } } ! DockToolBar(hDockBar, hWnd, nBandNum, nPosition, nOffset); } *************** *** 281,287 **** BandData *pBand; DockBarData *pData = (DockBarData *) GetWindowLong(hDockBar, GWL_USERDATA); ! SetParent(hWnd, hDockBar); ! if (pData) { --- 281,287 ---- BandData *pBand; DockBarData *pData = (DockBarData *) GetWindowLong(hDockBar, GWL_USERDATA); ! SetParent(hWnd, hDockBar); ! if (pData) { *************** *** 298,302 **** nPosition = pBand->nBarCount; pBand->pBars = realloc(pBand->pBars, (pBand->nBarCount+1)*sizeof(BarData)); ! memmove(pBand->pBars+nPosition+1, pBand->pBars+nPosition, (pBand->nBarCount-nPosition)*sizeof(BarData)); pBand->nBarCount++; --- 298,302 ---- nPosition = pBand->nBarCount; pBand->pBars = realloc(pBand->pBars, (pBand->nBarCount+1)*sizeof(BarData)); ! memmove(pBand->pBars+nPosition+1, pBand->pBars+nPosition, (pBand->nBarCount-nPosition)*sizeof(BarData)); pBand->nBarCount++; *************** *** 318,324 **** SetParent(hWnd, NULL); ! if (pData) ! { for (i = 0; i < pData->nBandCount; i++) { --- 318,324 ---- SetParent(hWnd, NULL); ! if (pData) ! { for (i = 0; i < pData->nBandCount; i++) { Index: StatusBar.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/StatusBar.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** StatusBar.c 25 Feb 2004 12:57:11 -0000 1.6 --- StatusBar.c 7 May 2004 14:33:04 -0000 1.7 *************** *** 14,18 **** { FrameData *pData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! return (GetWindowLong(pData->hStatusBar, GWL_STYLE) & WS_VISIBLE) != 0; } --- 14,18 ---- { FrameData *pData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! return IsWindowVisible(pData->hStatusBar); } *************** *** 74,78 **** count++; } ! return count; }; --- 74,78 ---- count++; } ! return count; }; *************** *** 86,95 **** HFONT hFont; RECT rect; ! if (!pData || !pData->hStatusBar) return; GetClientRect(pData->hStatusBar, &rect); ! // get the actual count of indicators count = 0; --- 86,95 ---- HFONT hFont; RECT rect; ! if (!pData || !pData->hStatusBar) return; GetClientRect(pData->hStatusBar, &rect); ! // get the actual count of indicators count = 0; *************** *** 100,107 **** count++; } ! // allocate the "parts" buffer required from SB_SETPARTS message buffer = rmalloc((count+1)*sizeof(int)); ! // get the device context and the font for the status bar hDC = GetDC(pData->hStatusBar); --- 100,107 ---- count++; } ! // allocate the "parts" buffer required from SB_SETPARTS message buffer = rmalloc((count+1)*sizeof(int)); ! // get the device context and the font for the status bar hDC = GetDC(pData->hStatusBar); *************** *** 109,113 **** if (hFont) SelectObject(hDC, hFont); ! // populate the "parts" buffer i = count+1; --- 109,113 ---- if (hFont) SelectObject(hDC, hFont); ! // populate the "parts" buffer i = count+1; *************** *** 117,123 **** { SIZE sz; ! buffer[--i] = x; ! sz.cx = 0; sz.cy = 0; --- 117,123 ---- { SIZE sz; ! buffer[--i] = x; ! sz.cx = 0; sz.cy = 0; *************** *** 125,136 **** GetTextExtentPoint32(hDC, indicator->title, strlen(indicator->title), &sz); x -= sz.cx+5; ! indicator = indicator->prev; } buffer[0] = x; ! // set parts SendMessage(pData->hStatusBar, SB_SETPARTS, count+1, (LPARAM) buffer); ! // refresh the part titles i = 1; --- 125,136 ---- GetTextExtentPoint32(hDC, indicator->title, strlen(indicator->title), &sz); x -= sz.cx+5; ! indicator = indicator->prev; } buffer[0] = x; ! // set parts SendMessage(pData->hStatusBar, SB_SETPARTS, count+1, (LPARAM) buffer); ! // refresh the part titles i = 1; *************** *** 144,151 **** i++; } ! // release the device context ReleaseDC(pData->hStatusBar, hDC); ! // free parts buffer free(buffer); --- 144,151 ---- i++; } ! // release the device context ReleaseDC(pData->hStatusBar, hDC); ! // free parts buffer free(buffer); *************** *** 156,160 **** IndicatorHandle indicator, *link, last; FrameData *pData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! indicator = rmalloc(sizeof(struct IndicatorHandle)); indicator->title = NULL; --- 156,160 ---- IndicatorHandle indicator, *link, last; FrameData *pData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! indicator = rmalloc(sizeof(struct IndicatorHandle)); indicator->title = NULL; *************** *** 190,199 **** if (*link) (*link)->prev = indicator; *link = indicator; ! if (last == pData->last_indicator) pData->last_indicator = indicator; ! RefreshStatusBarIndicators(); ! return indicator; } --- 190,199 ---- if (*link) (*link)->prev = indicator; *link = indicator; ! if (last == pData->last_indicator) pData->last_indicator = indicator; ! RefreshStatusBarIndicators(); ! return indicator; } *************** *** 202,211 **** { FrameData *pData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! handleIndicatorDestroy(indicator); ! if (indicator->next) indicator->next->prev = indicator->prev; if (indicator->prev) indicator->prev->next = indicator->next; ! if (indicator == pData->first_indicator) pData->first_indicator = indicator->next; --- 202,211 ---- { FrameData *pData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! handleIndicatorDestroy(indicator); ! if (indicator->next) indicator->next->prev = indicator->prev; if (indicator->prev) indicator->prev->next = indicator->next; ! if (indicator == pData->first_indicator) pData->first_indicator = indicator->next; *************** *** 215,219 **** free(indicator->title); free(indicator); ! RefreshStatusBarIndicators(); } --- 215,219 ---- free(indicator->title); free(indicator); ! RefreshStatusBarIndicators(); } *************** *** 229,233 **** free(indicator->title); indicator->title = strdup(title); ! RefreshStatusBarIndicators(); } --- 229,233 ---- free(indicator->title); indicator->title = strdup(title); ! RefreshStatusBarIndicators(); } *************** *** 240,244 **** while ((indicator = indicator->prev) != NULL) pos++; ! return pos; } --- 240,244 ---- while ((indicator = indicator->prev) != NULL) pos++; ! return pos; } Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** Window.c 7 May 2004 13:09:46 -0000 1.65 --- Window.c 7 May 2004 14:33:04 -0000 1.66 *************** *** 20,24 **** while (hCtrl) { ! if (GetWindowLong(hCtrl,GWL_STYLE) & WS_VISIBLE) { GetWindowRect(hCtrl,&rect); --- 20,24 ---- while (hCtrl) { ! if (IsWindowVisible(hCtrl)) { GetWindowRect(hCtrl,&rect); *************** *** 39,43 **** while (hCtrl) { ! if (GetWindowLong(hCtrl,GWL_STYLE) & WS_VISIBLE) { GetWindowRect(hCtrl,&rect); --- 39,43 ---- while (hCtrl) { ! if (IsWindowVisible(hCtrl)) { GetWindowRect(hCtrl,&rect); *************** *** 1113,1117 **** BOOL osGetWindowVisible(WindowHandle window) { ! return (GetWindowLong(window, GWL_STYLE) & WS_VISIBLE) != 0; } --- 1113,1117 ---- BOOL osGetWindowVisible(WindowHandle window) { ! return IsWindowVisible(window); } *************** *** 1353,1357 **** BOOL osGetControlVisible(WindowHandle ctrl) { ! return (GetWindowLong(ctrl, GWL_STYLE) & WS_VISIBLE) != 0; } --- 1353,1357 ---- BOOL osGetControlVisible(WindowHandle ctrl) { ! return IsWindowVisible(ctrl); } *************** *** 1496,1500 **** pData->windowPosRect.bottom = y1; ! if (GetWindowLong(window,GWL_STYLE) & WS_VISIBLE) SetupWindowPosition(window); } --- 1496,1500 ---- pData->windowPosRect.bottom = y1; ! if (IsWindowVisible(window)) SetupWindowPosition(window); } |