//调整界面 void CGameFrameDlg::RectifyControl(int nWidth, int nHeight) { //状态判断 if (m_bInitDialog==false) return; //变量定义 CRect rcVorSplitter; const int nSplitterWidth=6; const int iXExc=GetXExcursionPos(); const int iYExc=GetYExcursionPos(); const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS; //获取位置 m_VorSplitter.GetWindowRect(&rcVorSplitter); ScreenToClient(&rcVorSplitter); //调整拆分条 if (m_bRectify==false) { //设置变量 m_bRectify=true; //设置位置 if (m_bHideList==false) { rcVorSplitter.left=nWidth*75/100; rcVorSplitter.right=rcVorSplitter.left+nSplitterWidth; } else { rcVorSplitter.right=nWidth; rcVorSplitter.left=nWidth-nSplitterWidth; } } //设置拆分范围 if (m_bHideList==false) { int nLessPos=nWidth*3/5,nMaxPos=nWidth*75/100; m_VorSplitter.SetSplitterRange(nLessPos,nMaxPos); if ((nWidth!=0)&&(nHeight!=0)) { if (rcVorSplitter.left<nLessPos) { rcVorSplitter.left=nLessPos; rcVorSplitter.right=rcVorSplitter.left+nSplitterWidth; } if (rcVorSplitter.right>nMaxPos) { rcVorSplitter.right=nMaxPos; rcVorSplitter.left=rcVorSplitter.right-nSplitterWidth; } } } if (m_VorSplitter.GetSplitterType()==HorSpliter) rcVorSplitter.SetRect(nWidth,0,nWidth,nHeight); //锁定屏幕 LockWindowUpdate(); //移动控件 HDWP hDwp=BeginDeferWindowPos(32); DeferWindowPos(hDwp,m_pGameFrameView->GetSafeHwnd(),NULL,iXExc,iYExc,rcVorSplitter.left-iXExc,nHeight-iYExc,uFlags); DeferWindowPos(hDwp,m_VorSplitter,NULL,rcVorSplitter.left,iYExc,rcVorSplitter.Width(),nHeight-iYExc,uFlags); DeferWindowPos(hDwp,m_pGameFrameControl->GetSafeHwnd(),NULL,rcVorSplitter.right,iYExc,nWidth-rcVorSplitter.right,nHeight-iYExc,uFlags); EndDeferWindowPos(hDwp); //重画界面 Invalidate(FALSE); UpdateWindow(); //解除锁定 UnlockWindowUpdate(); //控制按钮 CRect rcControl; m_btControl.GetClientRect(&rcControl); m_btControl.SetWindowPos(NULL,rcVorSplitter.left+(rcVorSplitter.Width()-rcControl.Width())/2,(nHeight-rcControl.Height())/2,0,0,uFlags|SWP_NOSIZE); //设置变量 m_bRectify=false; return; }
void CTWScriptEdit::FormatTextRange(int nStart, int nEnd) { if (nStart >= nEnd) return; m_bInForcedChange = TRUE; CHARRANGE crOldSel; GetSel(crOldSel); LockWindowUpdate(); HideSelection(TRUE, FALSE); WCHAR *pBuffer = NULL; try { SetSel(nStart, nEnd); //pBuffer = new WCHAR[nEnd - nStart + 1]; CHAR* pBuffer2 = new CHAR[nEnd - nStart + 1]; long nLen = GetSelText(pBuffer2); pBuffer = GetUnicode(pBuffer2); ASSERT(nLen <= nEnd - nStart); pBuffer[nLen] = 0; WCHAR *pStart, *pPtr; pStart = pPtr = pBuffer; WCHAR* pSymbolStart = NULL; SymbolColor ic; while (*pPtr != 0) { WCHAR ch = *pPtr; if (ch == m_chComment && (m_chComment2 == 0 || pPtr[1] == m_chComment2)) { pSymbolStart = pPtr; do { ch = *(++pPtr); } while (ch != 0 && ch != '\r'); ic = m_icComment; } else if (IsStringQuote(ch)) { // Process strings pSymbolStart = pPtr; WCHAR ch1 = ch; do { ch = *(++pPtr); } while (ch != 0 && ch != ch1 && ch != '\r'); if (ch == ch1) pPtr++; ic = m_icString; } else if (_istdigit(ch)) { // Process numbers pSymbolStart = pPtr; wcstod(pSymbolStart, &pPtr); ic = m_icNumber; } else if (_istalpha(ch) || ch == '_') { // Process keywords pSymbolStart = pPtr; do { ch = *(++pPtr); } while (_istalnum(ch) || ch == '_'); *pPtr = 0; int nPos = IsKeyword(pSymbolStart); if (nPos >= 0) { ChangeCase(nStart + pSymbolStart - pBuffer, nStart + pPtr - pBuffer, m_strKeywords.Mid(nPos+1, pPtr - pSymbolStart)); if (wcsicmp(m_strComment, pSymbolStart) == 0) { *pPtr = ch; *pSymbolStart = m_chComment; if (pSymbolStart[1] != 0 && m_chComment2 != 0) pSymbolStart[1] = m_chComment2; pPtr = pSymbolStart; pSymbolStart = NULL; continue; } ic = m_icKeyword; } else { nPos = IsConstant(pSymbolStart); if (nPos >= 0) { ChangeCase(nStart + pSymbolStart - pBuffer, nStart + pPtr - pBuffer, m_strConstants.Mid(nPos+1, pPtr - pSymbolStart)); ic = m_icConstant; } else { pSymbolStart = NULL; } } *pPtr = ch; } else { pPtr++; } if (pSymbolStart != NULL) { ASSERT(pSymbolStart < pPtr); SetFormatRange(nStart + pStart - pBuffer, nStart + pSymbolStart - pBuffer, FALSE, RGB(0,0,0)); SetFormatRange(nStart + pSymbolStart - pBuffer, nStart + pPtr - pBuffer, ic.bBold, ic.clrColor); pStart = pPtr; pSymbolStart = 0; } else if (*pPtr == 0) SetFormatRange(nStart + pStart - pBuffer, nStart + pPtr - pBuffer, FALSE, RGB(0,0,0)); } } catch(...){} //delete [] pBuffer; SetSel(crOldSel); HideSelection(FALSE, FALSE); UnlockWindowUpdate(); m_bInForcedChange = FALSE; }
/** * ScrollByMoveY(const int dy) * ドラッグ中の描画処理 * 引数 * dy:マウスのY座標(point.y値、CTouchListCtrlコントロールのローカル座標、絶対値) * 戻り値 * 描画位置が先頭か最後尾になった場合にtrue、そうでない場合にfalseを返す * 関連するメンバ変数 * m_ptDragStart :(I) :ドラッグ開始点 * m_iItemHeight :(I) :アイテム1個当たりの高さ(ピクセル) * m_iDragLine :(I/O) :ドラッグ開始から現在までにスクロールした行数 * m_offsetPixelY :(O) :ピクセル単位スクロールのためのオフセット値 * 機能 * ・ドラッグ開始点(m_ptDragStart.y)からマウスの現在位置(dy)の移動量を基に * 画面に表示するItemの位置を決定し、スクロールして表示する */ bool CTouchListCtrl::ScrollByMoveY(const int dy) { util::StopWatch sw; sw.start(); // 先頭or最後尾フラグ bool bLimitOver = false; // 現時点での表示アイテム先頭位置、オフセットを保存する int iTop = GetTopIndex(); int iOffset = m_offsetPixelY; // Drag開始点からの移動行数を求める int iScrollLine = (( dy - m_ptDragStart.y ) / m_iItemHeight ) ; // ★ if (m_bBlackScrollMode) { // PIXEL単位でスクロールさせる m_offsetPixelY = -(( dy - m_ptDragStart.y ) % m_iItemHeight ); } else { #ifndef WINCE // PIXEL単位でスクロールさせる m_offsetPixelY = -(( dy - m_ptDragStart.y ) % m_iItemHeight ); #else if (theApp.m_optionMng.m_bListScrollByPixelOnMZ3) { // PIXEL単位でスクロールさせる m_offsetPixelY = -(( dy - m_ptDragStart.y ) % m_iItemHeight ); } else { // Item単位でスクロールさせる(WMデフォルト) m_offsetPixelY = 0; } #endif } // 前回の移動行数からの差分だけスクロールする // Scroll()メソッドはピクセル数指定だが、ピクセル指定すると // 1行分の半分くらいで1行移動したりしてマウスの動きと同期が取れないので // 行数×高さで動かす if( abs(iScrollLine - m_iDragLine) > 0 ){ CSize szScroll( 0 , -(( iScrollLine - m_iDragLine ) * m_iItemHeight) ); MZ3_TRACE( L" ScrollByMoveY, Scroll(%5d)\n" , szScroll.cy ); // Win32では独自処理で描画する // WMでは処理が追いつかないので標準処理に任せる // スクロール中の再描画を禁止 #ifndef WINCE LockWindowUpdate(); #endif // スクロール実行 Scroll( szScroll ); // スクロール中の再描画を再開 #ifndef WINCE UnlockWindowUpdate(); #endif } // スクロール後の先頭位置を取得する int iNextTop = GetTopIndex(); // 上端より上または下端より下ならばオフセットを効かせない if( ( iNextTop < 0 ) || ( iNextTop == 0 && m_offsetPixelY < 0) || ( GetItemCount() - GetCountPerPage() == iNextTop && m_offsetPixelY > 0) || ( GetItemCount() - GetCountPerPage() < iNextTop ) ){ m_offsetPixelY = 0; } if( ( iNextTop <= 0 ) || ( GetItemCount() - GetCountPerPage() <= iNextTop ) ){ // 先頭or最後尾フラグ bLimitOver = true; } bool bDoRedraw = false; if( iTop != iNextTop ) { // Item表示位置が変わった // トータル移動行数を蓄積する m_iDragLine += iTop - iNextTop; MZ3_TRACE( L" ScrollByMoveY, DrawBackSurface() req1\n" ); bDoRedraw = true; } else { // Item表示位置は変わらない if (iOffset != m_offsetPixelY) { // オフセットが変わった MZ3_TRACE( L" ScrollByMoveY, DrawBackSurface() req2\n" ); bDoRedraw = true; } } if (bDoRedraw) { if (m_bBlackScrollMode) { // 再描画 DrawBackSurface(); UpdateWindow(); } else { #ifndef WINCE // 再描画 // Win32では独自処理で描画する DrawBackSurface(); UpdateWindow(); #else if (theApp.m_optionMng.m_bListScrollByPixelOnMZ3) { // ピクセル単位スクロールの場合はWMでも独自処理で描画する DrawBackSurface(); UpdateWindow(); } #endif } } // MZ3LOGGER_INFO(util::FormatString(L" ScrollByMoveY elapsed : %dmsec", sw.getElapsedMilliSecUntilNow())); return bLimitOver; }
//调整控件 void CGameFrame::RectifyControl(int nWidth, int nHeight) { //状态判断 if (m_DlgGamePlaza.m_bInitDialog==false) return; if ((nWidth==0)||(nHeight==0)) return; //变量定义 const int nSplitterWidth=__max(6,m_Splitter.GetButtonSize().cx); //获取位置 CRect rcSplitter; m_Splitter.GetWindowRect(&rcSplitter); ScreenToClient(&rcSplitter); //调整拆分条 if(!m_bHideGameList) { int nLessPos=nWidth/4,nMaxPos=nWidth/2; if (m_bRectify==false) { m_bRectify=true; rcSplitter.left=nLessPos; rcSplitter.right=rcSplitter.left+nSplitterWidth; } //设置拆分范围 m_Splitter.SetSplitterRange(nLessPos,nMaxPos); if ((nWidth!=0)&&(nHeight!=0)) { if (rcSplitter.left<nLessPos) { rcSplitter.left=nLessPos; rcSplitter.right=rcSplitter.left+nSplitterWidth; } if (rcSplitter.right>nMaxPos) { rcSplitter.right=nMaxPos; rcSplitter.left=rcSplitter.right-nSplitterWidth; } } } else { //拆分位置 rcSplitter.left=0; rcSplitter.right=rcSplitter.left+nSplitterWidth; } //位置调整 rcSplitter.top=m_ImageInfoFrame.nTBorder-FRAME_EXALTATION; rcSplitter.bottom=nHeight-m_ImageInfoFrame.nBBorder; //分条控件 HDWP hDwp=BeginDeferWindowPos(32); UINT uUserTitleHeight=m_UserInfoView.GetTitleHeight(); const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS; DeferWindowPos(hDwp,m_Splitter,NULL,rcSplitter.left,rcSplitter.top,rcSplitter.Width(),rcSplitter.Height(),uFlags); //列表控件 if(!m_bHideGameList) { DeferWindowPos(hDwp,m_ServerItemView,NULL,m_ImageInfoFrame.nLBorder+m_ImageInfoServer.nLBorder,m_ImageInfoFrame.nTBorder+m_ImageInfoServer.nTBorder+uUserTitleHeight-FRAME_EXALTATION, rcSplitter.right-m_ImageInfoServer.nLBorder-m_ImageInfoServer.nRBorder-m_ImageInfoFrame.nLBorder,nHeight-m_ImageInfoServer.nTBorder-m_ImageInfoServer.nBBorder-m_ImageInfoFrame.nTBorder-uUserTitleHeight-m_ImageInfoFrame.nBBorder+FRAME_EXALTATION,uFlags); DeferWindowPos(hDwp,m_UserCompanionList,NULL,m_ImageInfoFrame.nLBorder+m_ImageInfoServer.nLBorder,m_ImageInfoFrame.nTBorder+m_ImageInfoServer.nTBorder+uUserTitleHeight-FRAME_EXALTATION, rcSplitter.right-m_ImageInfoServer.nLBorder-m_ImageInfoServer.nRBorder-m_ImageInfoFrame.nLBorder,nHeight-m_ImageInfoServer.nTBorder-m_ImageInfoServer.nBBorder-m_ImageInfoFrame.nTBorder-uUserTitleHeight-m_ImageInfoFrame.nBBorder+FRAME_EXALTATION,uFlags); } //信息控件 DeferWindowPos(hDwp,m_UserInfoView,NULL,m_ImageInfoFrame.nLBorder,m_ImageInfoFrame.nTBorder-FRAME_EXALTATION,rcSplitter.right-m_ImageInfoFrame.nLBorder,uUserTitleHeight,uFlags); //获取位置 CRect rcItemRect; m_btGamePlaza.GetWindowRect(&rcItemRect); //移动控件 INT nYPos = m_ImageInfoFrame.nTBorder-FRAME_EXALTATION; DeferWindowPos(hDwp,m_btGamePlaza,NULL,rcSplitter.right+5,nYPos,0,0,uFlags|SWP_NOSIZE); for (int i=0;i<CountArray(m_btViewItem);i++) DeferWindowPos(hDwp,m_btViewItem[i],NULL,rcSplitter.right+rcItemRect.Width()+rcItemRect.Width()*i+5,nYPos,0,0,uFlags|SWP_NOSIZE); //页面控件 HWND hWndActive=m_pActiveViewItem->GetWindowHandle(); DeferWindowPos(hDwp,hWndActive,NULL,rcSplitter.right,nYPos+rcItemRect.Height(),nWidth-m_ImageInfoFrame.nRBorder-rcSplitter.right, nHeight-(nYPos+rcItemRect.Height())-m_ImageInfoFrame.nBBorder,uFlags); //其他控件 DeferWindowPos(hDwp,m_btMin,NULL,nWidth-102,3,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_btMax,NULL,nWidth-72,3,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_btClose,NULL,nWidth-42,3,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_btExChangeSkin,NULL,nWidth-132,3,0,0,uFlags|SWP_NOSIZE); //列表按钮 m_btListControl1.GetWindowRect(&rcItemRect); INT nY = m_ImageInfoFrame.nTBorder-FRAME_EXALTATION+uUserTitleHeight+5; DeferWindowPos(hDwp,m_btListControl1,NULL,m_ImageInfoFrame.nLBorder+5,nY,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_btListControl2,NULL,m_ImageInfoFrame.nLBorder+5,nY+rcItemRect.Height()+1,0,0,uFlags|SWP_NOSIZE); //按钮位置 CRect rcButton; m_btButton1.GetWindowRect(&rcButton); //间隔计算 int nEndPos=105; int nBeginPos=560; int nWindth=nWidth-nBeginPos-rcButton.Width()*5-nEndPos; int nButtonSpace=__min((nWidth-nBeginPos-rcButton.Width()*5-nEndPos)/4,30); //广告控件 // modify by 一剑 //DeferWindowPos(hDwp,m_BrowerAD,NULL,300,8,250,52,uFlags); //导航按钮 DeferWindowPos(hDwp,m_btButton1,NULL,nWidth-rcButton.Width()*5-nButtonSpace*4-nEndPos,6,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_btButton2,NULL,nWidth-rcButton.Width()*4-nButtonSpace*3-nEndPos,6,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_btButton3,NULL,nWidth-rcButton.Width()*3-nButtonSpace*2-nEndPos,6,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_btButton4,NULL,nWidth-rcButton.Width()*2-nButtonSpace*1-nEndPos,6,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_btButton5,NULL,nWidth-rcButton.Width()*1-nButtonSpace*0-nEndPos,6,0,0,uFlags|SWP_NOSIZE); //获取位置 CRect rcButtonRect; m_btSelfOption.GetWindowRect(&rcButtonRect); //移动控件 nYPos = m_ImageInfoFrame.nTBorder-FRAME_EXALTATION-4; CButton * pButton[]={/*&m_btQuitGame,*/&m_btSelfOption,&m_btGlobalOption,&m_btSwitchUser}; for (int i=0;i<CountArray(pButton);i++) DeferWindowPos(hDwp,pButton[i]->m_hWnd,NULL,nWidth-(rcButtonRect.Width()+6)*(i+1)-8,nYPos,0,0,uFlags|SWP_NOSIZE); //结束调整 LockWindowUpdate(); EndDeferWindowPos(hDwp); UnlockWindowUpdate(); //更换皮肤 int i=0; for (;i<CountArray(m_btViewItem);i++) { if(m_pActiveViewItem==m_pRoomViewItem[i])break; } CSkinButton * pTempButton[]={&m_btViewItem[0],&m_btViewItem[1],&m_btViewItem[2],&m_btGamePlaza}; ASSERT((CountArray(m_btViewItem)+1)==CountArray(pTempButton)); for (WORD j=0;j<CountArray(pTempButton);j++) { if(i==j) { pTempButton[j]->SetTextColor(RGB(0,0,0),RGB(133,215,255),true); pTempButton[j]->SetButtonImage(GetPlatformRes().uBtFrameItemActive,GetResInstanceHandle(),false); } else { pTempButton[j]->SetTextColor(RGB(245,245,245),RGB(20,20,20),true); pTempButton[j]->SetButtonImage(GetPlatformRes().uBtFrameItemNormal,GetResInstanceHandle(),false); } } return; }
// // Removes the item at item_index from the assigned list. // void CPageAccess::Remove() { Manager *manager; Worker *worker; int new_selection; int selected_type; int item_index, old_item_index; // Check to make sure something was selected. if ( m_LAssignedAccess.GetSelectedCount() == 0 ) return; // Store the first selected index as the index to be selected after removal. new_selection = m_LAssignedAccess.GetNextItem( FIND_FIRST, LVNI_SELECTED ); // Store the manager/worker selection type since it is used inside the while loop. selected_type = theApp.pView->m_pWorkerView->GetSelectedType(); // Find out who is selected: All managers, a manager, or a worker. manager = theApp.pView->m_pWorkerView->GetSelectedManager(); worker = theApp.pView->m_pWorkerView->GetSelectedWorker(); LockWindowUpdate(); // Items must be removed in reverse order (bottom --> up). // This isn't the case for the global access spec list. // See the comment within the removal loop below. // See if the last item in the list is selected. if ( m_LAssignedAccess.GetItemState( m_LAssignedAccess.GetItemCount() - 1, LVNI_SELECTED) ) { // It is. item_index = m_LAssignedAccess.GetItemCount() - 1; } else { // It isn't. Find the next highest selected item. item_index = m_LAssignedAccess.GetNextItem( m_LAssignedAccess.GetItemCount() - 1, LVNI_ABOVE | LVNI_SELECTED ); } // Loop through all the selected list items and remove them. while ( item_index != NOTHING ) { // Remove the entry from the selected assigned (all managers, // manager, or worker). There is no point in updating the // GUI since we will just refresh the contents when we are done // deleting. switch ( selected_type ) { // Nothing is actually removed from the GUI until the call to // ShowAssignedAccess(), below. This is why we have to remove // the list items from the bottom up. case ALL_MANAGERS: theApp.manager_list.RemoveAccessSpecAt( item_index ); break; case MANAGER: manager->RemoveAccessSpecAt( item_index ); break; case WORKER: worker->RemoveAccessSpecAt( item_index ); break; } // Keep track of the last item we removed. old_item_index = item_index; // Find the next selected item above it. item_index = m_LAssignedAccess.GetNextItem( old_item_index, LVNI_ABOVE | LVNI_SELECTED ); // If the values are the same, we're at the top of the list. // (The CListCtrl should return -1, but doesn't.) if (item_index == old_item_index) break; } ShowAssignedAccess(); // See if the selected item is beyond the end of the list now. if ( new_selection >= m_LAssignedAccess.GetItemCount() ) new_selection = m_LAssignedAccess.GetItemCount() - 1; m_LAssignedAccess.SetItemState( new_selection, LVNI_SELECTED, LVNI_SELECTED ); UnlockWindowUpdate(); }
void DialogDeclBrowser::OnSize( UINT nType, int cx, int cy ) { CRect clientRect, rect; LockWindowUpdate(); CDialog::OnSize( nType, cx, cy ); GetClientRect( clientRect ); if ( declTree.GetSafeHwnd() ) { rect.left = BORDER_SIZE; rect.top = BORDER_SIZE; rect.right = clientRect.Width() - BORDER_SIZE; rect.bottom = clientRect.Height() - 100; declTree.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( findNameStatic.GetSafeHwnd() ) { rect.left = BORDER_SIZE + 2; rect.top = clientRect.Height() - 100 + BUTTON_SPACE + 2; rect.right = BORDER_SIZE + 80; rect.bottom = clientRect.Height() - 76 + 2; findNameStatic.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( findTextStatic.GetSafeHwnd() ) { rect.left = BORDER_SIZE + 2; rect.top = clientRect.Height() - 78 + BUTTON_SPACE + 2; rect.right = BORDER_SIZE + 80; rect.bottom = clientRect.Height() - 54 + 2; findTextStatic.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( findNameEdit.GetSafeHwnd() ) { rect.left = BORDER_SIZE + 80; rect.top = clientRect.Height() - 100 + BUTTON_SPACE; rect.right = clientRect.Width() - BORDER_SIZE; rect.bottom = clientRect.Height() - 76; findNameEdit.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( findTextEdit.GetSafeHwnd() ) { rect.left = BORDER_SIZE + 80; rect.top = clientRect.Height() - 78 + BUTTON_SPACE; rect.right = clientRect.Width() - BORDER_SIZE; rect.bottom = clientRect.Height() - 54; findTextEdit.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( findButton.GetSafeHwnd() ) { findButton.GetClientRect( rect ); int width = rect.Width(); int height = rect.Height(); rect.left = BORDER_SIZE; rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height; rect.right = BORDER_SIZE + width; rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT; findButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( editButton.GetSafeHwnd() ) { editButton.GetClientRect( rect ); int width = rect.Width(); int height = rect.Height(); rect.left = BORDER_SIZE + BUTTON_SPACE + width; rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height; rect.right = BORDER_SIZE + BUTTON_SPACE + 2 * width; rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT; editButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( newButton.GetSafeHwnd() ) { newButton.GetClientRect( rect ); int width = rect.Width(); int height = rect.Height(); rect.left = BORDER_SIZE + 2 * BUTTON_SPACE + 2 * width; rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height; rect.right = BORDER_SIZE + 2 * BUTTON_SPACE + 3 * width; rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT; newButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( reloadButton.GetSafeHwnd() ) { reloadButton.GetClientRect( rect ); int width = rect.Width(); int height = rect.Height(); rect.left = BORDER_SIZE + 3 * BUTTON_SPACE + 3 * width; rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height; rect.right = BORDER_SIZE + 3 * BUTTON_SPACE + 4 * width; rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT; reloadButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( cancelButton.GetSafeHwnd() ) { cancelButton.GetClientRect( rect ); int width = rect.Width(); int height = rect.Height(); rect.left = clientRect.Width() - BORDER_SIZE - width; rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height; rect.right = clientRect.Width() - BORDER_SIZE; rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT; cancelButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( statusBar.GetSafeHwnd() ) { rect.left = clientRect.Width() - 2; rect.top = clientRect.Height() - 2; rect.right = clientRect.Width() - 2; rect.bottom = clientRect.Height() - 2; statusBar.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } UnlockWindowUpdate(); }
void DialogEntityDefEditor::OnSize( UINT nType, int cx, int cy ) { CRect clientRect, rect; LockWindowUpdate(); CDialog::OnSize( nType, cx, cy ); GetClientRect( clientRect ); if ( keyValsList.GetSafeHwnd() ) { keyValsList.GetClientRect( rect ); rect.left = BORDER_SIZE; rect.right = clientRect.right - BORDER_SIZE; rect.top = (TOOLBAR_HEIGHT * 2) + (BUTTON_SPACE * 3); rect.bottom = clientRect.bottom - (TOOLBAR_HEIGHT * 4) - BUTTON_SPACE; keyValsList.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } int keyRowTop = clientRect.Height() - TOOLBAR_HEIGHT * 3 - CONTROL_HEIGHT; int keyRowBottom = keyRowTop + CONTROL_HEIGHT; int lineTop = clientRect.Height() - TOOLBAR_HEIGHT * 3 + (CONTROL_HEIGHT / 2); int buttonRowTop = clientRect.Height() - TOOLBAR_HEIGHT - CONTROL_HEIGHT; int buttonRowBottom = buttonRowTop + CONTROL_HEIGHT; if ( keyLabel.GetSafeHwnd() ) { keyLabel.GetClientRect( rect ); int width = rect.Width(); rect.left = BORDER_SIZE; rect.right = BORDER_SIZE + width; rect.top = keyRowTop + 8; rect.bottom = keyRowBottom; keyLabel.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( keyEdit.GetSafeHwnd() ) { keyEdit.GetClientRect( rect ); rect.left = 40; rect.right = 40 + 200; rect.top = keyRowTop; rect.bottom = keyRowBottom; keyEdit.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( addButton.GetSafeHwnd() ) { addButton.GetClientRect( rect ); int width = rect.Width(); rect.left = clientRect.Width() - BORDER_SIZE - BUTTON_SPACE - 2 * width; rect.right = clientRect.Width() - BORDER_SIZE - BUTTON_SPACE - width; rect.top = keyRowTop; rect.bottom = keyRowBottom; addButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( delButton.GetSafeHwnd() ) { delButton.GetClientRect( rect ); int width = rect.Width(); rect.left = clientRect.Width() - BORDER_SIZE - width; rect.right = clientRect.Width() - BORDER_SIZE; rect.top = keyRowTop; rect.bottom = keyRowBottom; delButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( line.GetSafeHwnd() ) { line.GetClientRect( rect ); int height = rect.Height(); rect.left = BORDER_SIZE; rect.right = clientRect.Width() - BORDER_SIZE; rect.top = lineTop; rect.bottom = lineTop + 3; line.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( testButton.GetSafeHwnd() ) { testButton.GetClientRect( rect ); int width = rect.Width(); rect.left = BORDER_SIZE; rect.right = BORDER_SIZE + width; rect.top = buttonRowTop; rect.bottom = buttonRowBottom; testButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( okButton.GetSafeHwnd() ) { okButton.GetClientRect( rect ); int width = rect.Width(); rect.left = clientRect.Width() - BORDER_SIZE - BUTTON_SPACE - 2 * width; rect.right = clientRect.Width() - BORDER_SIZE - BUTTON_SPACE - width; rect.top = buttonRowTop; rect.bottom = buttonRowBottom; okButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( cancelButton.GetSafeHwnd() ) { cancelButton.GetClientRect( rect ); int width = rect.Width(); rect.left = clientRect.Width() - BORDER_SIZE - width; rect.right = clientRect.Width() - BORDER_SIZE; rect.top = buttonRowTop; rect.bottom = buttonRowBottom; cancelButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } if ( statusBar.GetSafeHwnd() ) { rect.left = clientRect.Width() - 2; rect.top = clientRect.Height() - 2; rect.right = clientRect.Width() - 2; rect.bottom = clientRect.Height() - 2; statusBar.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() ); } UnlockWindowUpdate(); }
void CTestPage::OnRefresh() ///////////////////////////////////////////////////////////////////////////// { #ifdef USEHARDWARE ULONG ulVendorID; ULONG ulDeviceID; ULONG ulInterruptLine; ULONG ulBAR[ PCI_TYPE0_ADDRESSES ]; BYTE ucBusNumber; BYTE ucDeviceFunction; BYTE ucDevice; int iItem = 0; int i; // no painting during change LockWindowUpdate(); m_DeviceList.DeleteAllItems(); for( ucBusNumber=0; ucBusNumber<0xFF; ucBusNumber++ ) { for( ucDevice=0; ucDevice<0x1F; ucDevice++ ) { ucDeviceFunction = ucDevice << 3; ReadConfigurationArea( READ_CONFIG_WORD, ucBusNumber, ucDeviceFunction, PCI_CS_VENDOR_ID, &ulVendorID ); ulVendorID &= 0xFFFF; if( ulVendorID == 0xFFFF ) continue; ReadConfigurationArea( READ_CONFIG_WORD, ucBusNumber, ucDeviceFunction, PCI_CS_DEVICE_ID, &ulDeviceID ); ulDeviceID &= 0xFFFF; if( ulDeviceID == 0xFFFF ) continue; CString strText; // Insert items in the list view control. m_DeviceList.InsertItem( iItem, GetVendorName( (USHORT)ulVendorID, (USHORT)ulDeviceID ) ); strText.Format( "%d", ucBusNumber ); m_DeviceList.SetItemText( iItem, COLUMN_BUS, strText ); strText.Format( "%2d", ucDevice ); m_DeviceList.SetItemText( iItem, COLUMN_DEVICE, strText ); strText.Format( "%04lx", ulVendorID ); m_DeviceList.SetItemText( iItem, COLUMN_VENDORID, strText ); strText.Format( "%04lx", ulDeviceID ); m_DeviceList.SetItemText( iItem, COLUMN_DEVICEID, strText ); ReadConfigurationArea( READ_CONFIG_BYTE, ucBusNumber, ucDeviceFunction, PCI_CS_INTERRUPT_LINE, &ulInterruptLine ); ulInterruptLine &= 0xFF; strText.Format( "%2ld", ulInterruptLine ); m_DeviceList.SetItemText( iItem, COLUMN_IRQ, strText ); for( i=0; i<PCI_TYPE0_ADDRESSES; i++ ) { ReadConfigurationArea( READ_CONFIG_DWORD, ucBusNumber, ucDeviceFunction, PCI_CS_BASE_ADDRESS_0+(i*sizeof(DWORD)), &ulBAR[ i ] ); strText.Format( "%08lx", ulBAR[ i ] ); m_DeviceList.SetItemText( iItem, COLUMN_BAR0+i, strText ); } iItem++; } } m_DeviceList.SetColumnWidth( COLUMN_VENDORNAME, LVSCW_AUTOSIZE ); for( i=0; i<PCI_TYPE0_ADDRESSES; i++ ) { m_DeviceList.SetColumnWidth( COLUMN_BAR0+i, LVSCW_AUTOSIZE ); } // repaint changes UnlockWindowUpdate(); #else m_DeviceList.InsertItem( 0, "Use Hardware is OFF" ); m_DeviceList.SetColumnWidth( COLUMN_VENDORNAME, LVSCW_AUTOSIZE ); #endif }