void CLogGraph::OnMouseMove(UINT nFlags, CPoint point) { if (hitRect(point, m_rectGraph) && m_bNav) { CDC* pDC = GetDC(); if (pDC) { int oldRop = pDC->GetROP2(); pDC->SetROP2(R2_XORPEN); CPen pen(PS_DOT, 1, RGB(255, 255, 255)); CPen* pOldPen = pDC->SelectObject(&pen); if (m_nLastCursorPos != -1) { pDC->MoveTo(m_rectGraph.left + m_nLastCursorPos, m_rectGraph.top); pDC->LineTo(m_rectGraph.left + m_nLastCursorPos, m_rectGraph.bottom); } m_nLastCursorPos = (point.x - m_rectGraph.left); pDC->MoveTo(m_rectGraph.left + m_nLastCursorPos, m_rectGraph.top); pDC->LineTo(m_rectGraph.left + m_nLastCursorPos, m_rectGraph.bottom); pDC->SelectObject(pOldPen); pDC->SetROP2(oldRop); if (m_bNav) { int pos = m_nCurrentPos + int(m_fZoomFactor * m_nLastCursorPos); // lib->mque_getn(m_hQue, pos, m_aTmp); // calcStat(m_aTmp, false); sendMsg(LG_NAV_MSG, pos); m_tLastNav = time(NULL); } ReleaseDC(pDC); } } if (m_bLdown) { m_bDragSel = true; m_ptEtMouse = point; redraw(); } if (m_bLoad){ tdata *tp = getTptr(m_nCurrentPos); //getPtrLeftPos(); int x = point.x - m_rectGraph.left; if (x < 0) goto NOMATCH; int last = getLength(); int pos = m_nCurrentPos + point.x * (int)m_fZoomFactor - m_rectGraph.left; if (pos > last){ goto NOMATCH; } tp = tp+ x*((int)m_fZoomFactor); Channel* pCh = m_aChannels[0]; int ey = m_rectGraph.top + m_rectGraph.Height(); int ry = ey - int(pCh->C * (int(tp->temp) / pCh->scale - pCh->low)); // TRACE("%s %d\n", __FUNCTION__ , tp->temp); CString strTemp; CString stime = tformat("%Y-%m-%d %H:%M:%S", tp->time); strTemp.Format("%s\t %d℃",stime, tp->temp/100 ); // strTemp.Format("%5ld",lUnitSize); m_ctrTooltip.Activate(TRUE); m_ctrTooltip.AddTool(this,strTemp, CRect(point.x-1,point.y-1,point.x+1,point.y+1), TRUE); // skin[i].rc 각 버튼들의 Rect... m_ctrTooltip.Update(); } NOMATCH: // TRACE("%s : cpos %d\n", __FUNCTION__, m_nCurrentPos); CWnd::OnMouseMove(nFlags, point); }
void CRenderSystemGL::ResetScissors() { SetScissors(CRect(0, 0, (float)m_width, (float)m_height)); }
void Graph::OnPaint() { CPaintDC dc(this); // device context for painting CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd(); CLogicSimulatorDoc* pDoc = (CLogicSimulatorDoc *)pFrame->GetActiveDocument(); dc.SetBkMode(TRANSPARENT); if (previousInput < 0) previousInput = pDoc->currBox->NumInput; else if (previousInput != pDoc->currBox->NumInput) { UpdateGraph = 1; previousInput = pDoc->currBox->NumInput; } dc.DrawText(_T("입력핀"), CRect(0, 0, 50, 50), DT_LEFT); int input = 0 , curr =20; for (int i = 0; i < pDoc->currBox->logicInfo.size(); i++) { CString Fornumber; if (pDoc->currBox->logicInfo.at(i)->objectName == PIN) { Pin* PT = (Pin*)pDoc->currBox->logicInfo.at(i); Fornumber.Format(_T("ID : %d, Label : %s"), PT->getConNum(), PT->label); if (PT->getConNum() >= 0) inputValue[PT->getConNum()] = PT->getOutput(); dc.TextOutW(0, curr, Fornumber); curr += 50; } } dc.TextOutW(0, curr, _T("출력핀")); curr += 20; for (int i = 0; i < pDoc->currBox->logicInfo.size(); i++) { CString Fornumber; if (pDoc->currBox->logicInfo.at(i)->objectName == OUTPIN) { Out* PT = (Out*)pDoc->currBox->logicInfo.at(i); Fornumber.Format(_T("ID : %d, Label : %s"), PT->getConNum(), PT->label); if (PT->getConNum() >= 0) outputValue[PT->getConNum()] = PT->getOutput(); dc.TextOutW(0, curr, Fornumber); curr += 50; } } int i ,final_i; CPen pen; pen.CreatePen(PS_SOLID, 3, RGB(255, 0, 0)); // 빨간색 펜 생성 dc.SelectObject(&pen); for (i = 0; i < pDoc->currBox->NumInput; i++) { for (int j = 1; j < (count < 200 ? count : 200); j++) { inputline[i][j - 1].x += 5; } for (int j = (count < 200 ? count : 200); j >= 1; j--) { inputline[i][j].x = inputline[i][j - 1].x; inputline[i][j].y = inputline[i][j - 1].y; } //그리기 if (inputValue[i]) { inputline[i][0].x = 0; inputline[i][0].y = 45 + 50 * i; } else { inputline[i][0].x = 0; inputline[i][0].y = 60 + 50 * i; } dc.Polyline(inputline[i], (count < 200 ? count : 200)); } final_i = i; if (UpdateGraph) { for (i = 0; i < 10; i++) { for (int j = 0; j < 250; j++) { outputline[i][j].y = 80 + 50 * (i + final_i); } } UpdateGraph = false; } pen.DeleteObject(); pen.CreatePen(PS_SOLID, 3, RGB(0, 0, 255)); // 파란색 펜 생성 dc.SelectObject(&pen); for (i = 0; i < pDoc->currBox->NumOuput; i++) { for (int j = 1; j < (count < 200 ? count : 200); j++) { outputline[i][j - 1].x += 5; } for (int j = (count < 200 ? count : 200); j >= 1; j--) { outputline[i][j].x = outputline[i][j - 1].x; outputline[i][j].y = outputline[i][j - 1].y; } //그리기 if (outputValue[i]) { outputline[i][0].x = 0; outputline[i][0].y = 65 + 50 * (i + final_i); } else { outputline[i][0].x = 0; outputline[i][0].y = 80 + 50 * (i + final_i); } dc.Polyline(outputline[i], (count < 200 ? count : 200)); } //dc.Rectangle(10, 10, 10, 100); }
// CSheetExchMain message handlers BOOL CSheetExchMain::OnInitDialog() { SetPlaceholderID(IDC_PAGEPOS); CExchCalcMain* pCalcData = GetData(); if( pCalcData == NULL ) { ASSERT(FALSE); return CHSNewWizDialog::OnInitDialog(); } // 设置数据指针 CWizPageExchBase::SetMainTech(pCalcData); GetData()->SetMsgWnd(this); GetData()->SetMsg(HX_USER_COMPILEDATA); // 初始化项面 CWizPageExchBase* pPage = new CWizPageExchSelIndicator(this); if( pPage != NULL ) { AddPage(pPage,IDD_EXCHANGE_SELECT); } else { ASSERT(FALSE); return CHSNewWizDialog::OnInitDialog(); } pPage->InitialData(pCalcData->GetExchExp()); pPage = new CWizPageExchBuy(this); if( pPage != NULL ) { AddPage(pPage,IDD_EXCHANGE_BUY); } else { ASSERT(FALSE); return CHSNewWizDialog::OnInitDialog(); } pPage->InitialData(pCalcData->GetBuy()); pPage = new CWizPageExchSell(this); if( pPage != NULL ) { AddPage(pPage,IDD_EXCHANGE_SELL); } else { ASSERT(FALSE); return CHSNewWizDialog::OnInitDialog(); } pPage->InitialData(pCalcData->GetSell()); pPage = new CWizPageExchModel(this); if( pPage != NULL ) { AddPage(pPage,IDD_EXCHANGE_MODEL); } else { ASSERT(FALSE); return CHSNewWizDialog::OnInitDialog(); } pPage->InitialData(pCalcData->GetMode()); pPage = new CWizPageExchResult(this); if( pPage != NULL ) { AddPage(pPage,IDD_EXCHANGE_RESULT); } else { ASSERT(FALSE); return CHSNewWizDialog::OnInitDialog(); } // 初始化进度条,并隐藏 m_wndPress.Create(WS_CHILD|WS_VISIBLE|PBS_SMOOTH, CRect(0, 0, 0, 0), this, PROGRESS_ID); m_wndPress.ShowWindow(SW_HIDE); // 初始化TAB项签 ①②③④⑤⑥⑦⑧⑨⑩ m_wndPageTab.Create(this, TAB_ID, 5, CRect(0, 0, 0, 0)); m_wndPageTab.SetItem(0, "①", IDD_EXCHANGE_SELECT); m_wndPageTab.SetItem(1, "②", IDD_EXCHANGE_BUY ); m_wndPageTab.SetItem(2, "③", IDD_EXCHANGE_SELL ); m_wndPageTab.SetItem(3, "④", IDD_EXCHANGE_MODEL ); m_wndPageTab.SetItem(4, "⑤", IDD_EXCHANGE_RESULT); //m_wndPageTab.SetColors(RGB(255, 0, 0), RGB(0, 0, 0), ::GetSysColor(CTLCOLOR_DLG), RGB(0, 255, 0)); m_wndPageTab.SetCallBreak((HS_Call_Notify)OnMsgPress, (DWORD)m_hWnd); m_wndPageTab.SetActive((int)0); // 设置位置 CRect rtClient; GetClientRect(&rtClient); rtClient.left += 4; CWnd* pWnd = GetDlgItem(ID_WIZBACK); if( pWnd ) { CRect rtButton; pWnd->GetClientRect(&rtButton); pWnd->ClientToScreen(&rtButton); ScreenToClient(&rtButton); rtClient.right = rtButton.left - 8; rtClient.top = rtButton.top + 1; rtClient.bottom = rtButton.bottom - 1; } else { rtClient.bottom -= 10; rtClient.right = rtClient.left + 100; rtClient.top = rtClient.bottom - 10; } m_wndPress.MoveWindow(rtClient); m_wndPageTab.MoveWindow(rtClient); m_wndPageTab.ShowWindow(SW_SHOW); return CHSNewWizDialog::OnInitDialog(); }
BOOL CDrawQuoteTab::DrawButton( CDC* pDC, CRect& rect, short nMask) { m_rcTab.SetRectEmpty(); if (rect.IsRectEmpty()) return FALSE; const ColorProperty* colorFrame = m_pColor->GetQuoteTabFrameColorProp(); // 边框颜色; CPen pen(colorFrame->m_nPenStyle,colorFrame->m_nWidth,colorFrame->m_lColor); CFont* pFont = m_pFont->GetQuoteTabFont(); CFont* pOldFont = pDC->SelectObject(pFont); // 字体宽度 CSize size = pDC->GetTextExtent(m_strName); COLORREF clrTabText = 0; COLORREF clrFill = 0; COLORREF clrArrow = 0; switch(nMask) { case Tab_Pressed: { clrTabText = m_pColor->GetQuoteActiveTabTextColor(); //字体颜色 clrFill = m_pColor->GetQuoteActiveTabBKColor(); // 选中时填充色 clrArrow = colorFrame->m_lColor; break; } case Tab_Disabled: { clrTabText = GetSysColor(COLOR_BTNSHADOW); clrFill = m_pColor->GetQuoteTabBKColor(); clrArrow = GetSysColor(COLOR_BTNSHADOW); break; } default: { clrTabText = m_pColor->GetQuoteTabTextColor(); clrFill = m_pColor->GetQuoteTabBKColor(); clrArrow = colorFrame->m_lColor; break; } } CBrush brush(clrFill); CPen* pOldPen = pDC->SelectObject(&pen); CBrush* pOldBrush = pDC->SelectObject(&brush); COLORREF clrOldTabText = pDC->SetTextColor(clrTabText); // 计算当前大小 m_rcTab = rect; m_rcTab.top += 1; if (m_lMenuMask & CDrawQuoteTabCtrl::TabPrev) { m_rcTab.right = m_rcTab.left + size.cx; pDC->Rectangle(CRect(m_rcTab.left, m_rcTab.top, m_rcTab.right, m_rcTab.bottom+1)); POINT pt[4]; CBrush brushTemp(clrArrow); pDC->SelectObject(&brushTemp); pDC->MoveTo(m_rcTab.left + 3,m_rcTab.CenterPoint().y); pt[0].x = m_rcTab.left + 3; pt[0].y = m_rcTab.CenterPoint().y; pt[1].x = m_rcTab.right - 3; pt[1].y = m_rcTab.top + 3; pt[2].x = m_rcTab.right - 3; pt[2].y = m_rcTab.bottom - 3; pt[3] = pt[0]; pDC->Polygon(pt,4); pDC->SelectObject(&brush); brushTemp.DeleteObject(); rect.left = m_rcTab.right - 1; } else if (m_lMenuMask & CDrawQuoteTabCtrl::TabNext) { m_rcTab.right = m_rcTab.left + size.cx; pDC->Rectangle(CRect(m_rcTab.left, m_rcTab.top, m_rcTab.right, m_rcTab.bottom+1)); POINT pt[4]; CBrush brushTemp(clrArrow); pDC->SelectObject(&brushTemp); pDC->MoveTo(m_rcTab.left + 3,m_rcTab.CenterPoint().y); pt[0].x = m_rcTab.left + 3; pt[0].y = m_rcTab.top + 3; pt[1].x = m_rcTab.right - 3; pt[1].y = m_rcTab.CenterPoint().y; pt[2].x = m_rcTab.left + 3; pt[2].y = m_rcTab.bottom - 3; pt[3] = pt[0]; pDC->Polygon(pt,4); pDC->SelectObject(&brush); brushTemp.DeleteObject(); rect.left = m_rcTab.right - 1; } else { m_rcTab.left = m_rcTab.right - size.cx - 8; rect.right = m_rcTab.left - 15; pDC->Rectangle(CRect(m_rcTab.left, m_rcTab.top, m_rcTab.right, m_rcTab.bottom+1)); pDC->DrawText(m_strName, m_rcTab, DT_SINGLELINE|DT_VCENTER|DT_CENTER); brush.DeleteObject(); } // CleanGUI pDC->SelectObject(pOldFont); pDC->SelectObject(pOldPen); pDC->SelectObject(pOldBrush); pDC->SetTextColor(clrOldTabText); pen.DeleteObject(); brush.DeleteObject(); return TRUE; }
void CWarnPopVideo::FullScreenPopVideo(void) { if (m_bFullScreen==false) //full screen { //Hide OK Button CButton *pBtnOK = (CButton *)GetDlgItem(IDOK); if (pBtnOK) pBtnOK->ShowWindow(SW_HIDE); CEdit *pEdit = (CEdit*)GetDlgItem(IDC_TIMEOUT); if (pEdit) pEdit->ShowWindow(SW_HIDE); CButton *pBtnPause = (CButton*)GetDlgItem(IDC_PAUSE_ALARM); if (pBtnPause) pBtnPause->ShowWindow(SW_HIDE); //Full Video Screen GetWindowPlacement(&m_struOldPlacement); //Remove WS_SIZEBOX windows style. or not the window can't be full-creen. ModifyStyle(WS_SIZEBOX,0,0); CRect WindowRect, ClientRect; RECT m_FullScreenRect; //ReDraw the window. Get the correct edge value. GetWindowRect(&WindowRect); WindowRect.left+=1; WindowRect.right+=1; MoveWindow(CRect(0,0,352,288),TRUE); GetWindowRect(&WindowRect); GetClientRect(&ClientRect); ClientToScreen(&ClientRect); //get the dest window rect. int x = GetSystemMetrics(SM_CXSCREEN); int y = GetSystemMetrics(SM_CYSCREEN); m_FullScreenRect.left = WindowRect.left - ClientRect.left; m_FullScreenRect.top = WindowRect.top - ClientRect.top; m_FullScreenRect.right = WindowRect.right - ClientRect.right + x; m_FullScreenRect.bottom = WindowRect.bottom - ClientRect.bottom + y; // m_FullScreenRect.left = 0; // m_FullScreenRect.top = 0; // m_FullScreenRect.right = GetSystemMetrics(SM_CXSCREEN); // m_FullScreenRect.bottom = GetSystemMetrics(SM_CYSCREEN); //Move the main window to the dest rect. WINDOWPLACEMENT wndpl; wndpl.length = sizeof(WINDOWPLACEMENT); wndpl.flags = 0; wndpl.showCmd = SW_SHOWNORMAL; wndpl.rcNormalPosition = m_FullScreenRect; SetWindowPlacement(&wndpl); //Move the view winow to full-screen. RECT rc; GetClientRect(&rc); m_pPopView->MoveWindow(&rc,TRUE); // m_bFullScreen = true; } else //Restore normal screen { //Show OK Button CRect btnRect; CButton *pBtnOK = (CButton *)GetDlgItem(IDOK); if (pBtnOK) { pBtnOK->ShowWindow(SW_SHOW); pBtnOK->GetClientRect(&btnRect); } CEdit *pEdit = (CEdit*)GetDlgItem(IDC_TIMEOUT); if (pEdit) pEdit->ShowWindow(SW_SHOW); CButton *pBtnPause = (CButton*)GetDlgItem(IDC_PAUSE_ALARM); if (pBtnPause) pBtnPause->ShowWindow(SW_SHOW); //Restore old position ModifyStyle(0,WS_SIZEBOX,0); SetWindowPlacement(&m_struOldPlacement); RECT rc; GetClientRect(&rc); rc.bottom -= (btnRect.Height()+3); m_pPopView->MoveWindow(&rc,TRUE); //SetWindowSize(); // m_bFullScreen = false; } }
BOOL Page1::OnInitDialog() { txt_info.Create(L"选择待压缩文件夹", WS_VISIBLE, CRect(10, 10, 600, 100), this); // _input_path.Create(WS_VISIBLE, CRect(10, 10, 300, 100), this,0); str = CSelectFolderDlg::Show(); txt_info.SetWindowTextW( str); // CString ss = "\""; //str.Insert(0, toUnicode( "\"")); //str.Insert(str.GetLength(), toUnicode("\"")); p = new UnCompressor(UnicodeToANSI(str.GetBuffer(0))); p->setCompressCallback([&](string name) { name.insert(0, "\\"); CString ss = toUnicode(name.c_str()); ss.Insert(0, toUnicode(p->dir.c_str())); ss.Insert(0, toUnicode("正在提取 ")); txt_info.SetWindowTextW(ss); }); // p->UnCompress(); /* p = new Compressor(( UnicodeToANSI( str.GetBuffer(0) ))); TRACE("76................................."); p->setCompressCallback( [=](string, int, int) { } ,[=](string name) { auto s = (LPCTSTR)(p->dir.c_str()); // txt_info.SetWindowTextW(s); }); p->Compress(); */ return TRUE; }
bool CMpaDecSettingsWnd::OnActivate() { DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP; CRect r; CPoint p(10, 10); m_outputformat_static.Create(ResStr(IDS_MPADECSETTINGSWND_0), dwStyle, CRect(p, CSize(120, m_fontheight)), this); p.y += m_fontheight + 5; m_outputformat_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(10, 0), CSize(100, 200)), this, IDC_PP_COMBO1); m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 16 Bit")), SF_PCM16); m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 24 Bit")), SF_PCM24); m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 32 Bit")), SF_PCM32); m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("IEEE Float")), SF_FLOAT32); m_outputformat_combo.SetCurSel(0); for(int i = 0; i < m_outputformat_combo.GetCount(); i++) if((int)m_outputformat_combo.GetItemData(i) == m_outputformat) { m_outputformat_combo.SetCurSel(i); } p.y += 30; CString strSpeak; strSpeak.Format (_T("%s%s"), ResStr(IDS_MPADECSETTINGSWND_1), GetDolbyMode(m_ddmode)); m_ac3spkcfg_static.Create(ResStr(IDS_MPADECSETTINGSWND_1) + GetDolbyMode(m_ddmode), dwStyle, CRect(p, CSize(220, m_fontheight)), this); p.y += m_fontheight + 5; m_ac3spkcfg_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(150, 0), CSize(100, 200)), this, IDC_PP_COMBO2); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Mono")), A52_MONO); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Dual Mono")), A52_CHANNEL); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Stereo")), A52_STEREO); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Dolby Stereo")), A52_DOLBY); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_3F)), A52_3F); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_2F_1R)), A52_2F1R); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_3F_1R)), A52_3F1R); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_2F_2R)), A52_2F2R); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_3F_2R)), A52_3F2R); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_CHANNEL_1)), A52_CHANNEL1); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_CHANNEL_2)), A52_CHANNEL2); for(int i = 0, sel = abs(m_ac3spkcfg) & A52_CHANNEL_MASK; i < m_ac3spkcfg_combo.GetCount(); i++) if((int)m_ac3spkcfg_combo.GetItemData(i) == sel) { m_ac3spkcfg_combo.SetCurSel(i); } m_ac3spkcfg_combo.GetWindowRect(r); ScreenToClient(r); m_ac3lfe_check.Create(_T("LFE"), dwStyle|BS_AUTOCHECKBOX, CRect(CPoint(r.left, r.bottom + 3), CSize(50, m_fontheight)), this, IDC_PP_CHECK4); m_ac3lfe_check.SetCheck(!!(abs(m_ac3spkcfg) & A52_LFE)); for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_ac3spkcfg_radio); i++, p.y += h) { static const TCHAR* labels[] = {m_strDecodeToSpeaker, _T("SPDIF")}; m_ac3spkcfg_radio[i].Create(labels[i], dwStyle|BS_AUTORADIOBUTTON|(i == 0 ? WS_GROUP : 0), CRect(p + CPoint(10, 0), CSize(140, h)), this, IDC_PP_RADIO1+i); } CheckRadioButton(IDC_PP_RADIO1, IDC_PP_RADIO2, m_ac3spkcfg >= 0 ? IDC_PP_RADIO1 : IDC_PP_RADIO2); p.y += 5; m_ac3spkcfg_check.Create(ResStr(IDS_MPA_DYNRANGE), dwStyle|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(205, m_fontheight)), this, IDC_PP_CHECK1); m_ac3spkcfg_check.SetCheck(m_ac3drc); p.y += m_fontheight + 10; m_dtsspkcfg_static.Create(ResStr(IDS_MPADECSETTINGSWND_7), dwStyle, CRect(p, CSize(120, m_fontheight)), this); p.y += m_fontheight + 5; m_dtsspkcfg_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(150, 0), CSize(100, 200)), this, IDC_PP_COMBO3); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Mono")), DTS_MONO); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Dual Mono")), DTS_CHANNEL); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo")), DTS_STEREO); //m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo ..")), DTS_STEREO_SUMDIFF); //m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo ..")), DTS_STEREO_TOTAL); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F)), DTS_3F); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_2F_1R)), DTS_2F1R); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F_1R)), DTS_3F1R); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_2F_2R)), DTS_2F2R); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F_2R)), DTS_3F2R); for(int i = 0, sel = abs(m_dtsspkcfg) & DTS_CHANNEL_MASK; i < m_dtsspkcfg_combo.GetCount(); i++) if((int)m_dtsspkcfg_combo.GetItemData(i) == sel) { m_dtsspkcfg_combo.SetCurSel(i); } m_dtsspkcfg_combo.GetWindowRect(r); ScreenToClient(r); m_dtslfe_check.Create(_T("LFE"), dwStyle|BS_AUTOCHECKBOX, CRect(CPoint(r.left, r.bottom + 3), CSize(50, m_fontheight)), this, IDC_PP_CHECK5); m_dtslfe_check.SetCheck(!!(abs(m_dtsspkcfg) & DTS_LFE)); for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_dtsspkcfg_radio); i++, p.y += h) { static const TCHAR* labels[] = {m_strDecodeToSpeaker, _T("SPDIF")}; m_dtsspkcfg_radio[i].Create(labels[i], dwStyle|BS_AUTORADIOBUTTON|(i == 0 ? WS_GROUP : 0), CRect(p + CPoint(10, 0), CSize(140, h)), this, IDC_PP_RADIO3+i); } CheckRadioButton(IDC_PP_RADIO3, IDC_PP_RADIO4, m_dtsspkcfg >= 0 ? IDC_PP_RADIO3 : IDC_PP_RADIO4); p.y += 5; m_dtsspkcfg_check.Create(ResStr(IDS_MPA_DYNRANGE), dwStyle|WS_DISABLED|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(205, m_fontheight)), this, IDC_PP_CHECK2); m_dtsspkcfg_check.SetCheck(m_dtsdrc); p.y += m_fontheight + 10; m_aacspkcfg_static.Create(ResStr(IDS_MPADECSETTINGSWND_11), dwStyle, CRect(p, CSize(120, m_fontheight)), this); p.y += m_fontheight + 5; m_aacdownmix_check.Create(ResStr(IDS_MPADECSETTINGSWND_12), dwStyle|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK3); m_aacdownmix_check.SetCheck(m_aacdownmix); for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) { pWnd->SetFont(&m_font, FALSE); } return true; }
bool CDepotView::CreateContent() { if(!m_depotTreeCtrl.Create( WS_CHILD | WS_VISIBLE, CRect(0, 0, 10, 10), this, 1)) return false; return true; }
/* void SetPaneWidths(int* arrWidths, int nPanes) { // find the size of the borders int arrBorders[3]; m_status.GetBorders(arrBorders); // calculate right edge of default pane (0) arrWidths[0] += arrBorders[2]; for (int i = 1; i < nPanes; i++) arrWidths[0] += arrWidths[i]; // calculate right edge of remaining panes (1 thru nPanes-1) for (int j = 1; j < nPanes; j++) arrWidths[j] += arrBorders[2] + arrWidths[j - 1]; // set the pane widths m_status.SetParts(m_status.m_nPanes, arrWidths); } */ LRESULT CMainFrame::OnCreate(LPCREATESTRUCT /*lParam*/) { // // create command bar window // HWND hWndCmdBar = m_CmdBar.Create( m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.SetImageSize(CSize(9,9)); // m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); // set title WTL::CString strTitle; strTitle.LoadString( IDS_APPLICATION ); SetWindowText(strTitle); // // setting up a tool bar // HWND hWndToolBar = CreateSimpleToolBarCtrl( m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE | TBSTYLE_LIST); m_wndToolBar.Attach( hWndToolBar ); m_wndToolBar.SetExtendedStyle( TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS ); // // patria: // // Some bitmaps are distorted when used with TB_ADDBITMAP // which is sent from CreateSimpleToolBarCtrl when the bitmap is not true color. // This is the case with IO-DATA's tool bar image. // As an workaround, we can directly create a image list directly // and replace the image list of the tool bar, which corrects such misbehaviors. // { CImageList imageList; WORD wWidth = 32; // we are using 32 x 32 buttons imageList.CreateFromImage( IDR_MAINFRAME, wWidth, 1, CLR_DEFAULT, IMAGE_BITMAP, LR_CREATEDIBSECTION | LR_DEFAULTSIZE); m_wndToolBar.SetImageList(imageList); } TBBUTTON tbButton = { 0 }; TBBUTTONINFO tbButtonInfo = { 0 }; TBREPLACEBITMAP replaceBitmap = { 0 }; // Add strings to the tool bar m_wndToolBar.SetButtonStructSize(sizeof(TBBUTTON)); for ( int i=0; i < m_wndToolBar.GetButtonCount(); i++ ) { WTL::CString strCommand; m_wndToolBar.GetButton( i, &tbButton ); tbButtonInfo.cbSize = sizeof(TBBUTTONINFO); tbButtonInfo.dwMask = TBIF_STYLE; m_wndToolBar.GetButtonInfo( tbButton.idCommand, &tbButtonInfo ); tbButtonInfo.dwMask = TBIF_TEXT | TBIF_STYLE; strCommand.LoadString( tbButton.idCommand ); strCommand = strCommand.Right( strCommand.GetLength() - strCommand.Find('\n') - 1 ); tbButtonInfo.pszText = const_cast<LPTSTR>(static_cast<LPCTSTR>(strCommand)); tbButtonInfo.cchText = strCommand.GetLength(); tbButtonInfo.fsStyle |= BTNS_SHOWTEXT | BTNS_AUTOSIZE; m_wndToolBar.AddString( tbButton.idCommand ); m_wndToolBar.SetButtonInfo( tbButton.idCommand, &tbButtonInfo ); } // // Modify mirror button as drop down button // { TBBUTTON tb; m_wndToolBar.GetButton( m_wndToolBar.CommandToIndex(IDM_AGGR_MIRROR), &tb); TBBUTTONINFO tbi = {0}; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STYLE; m_wndToolBar.GetButtonInfo(IDM_AGGR_MIRROR, &tbi); tbi.fsStyle |= TBSTYLE_DROPDOWN; m_wndToolBar.SetButtonInfo( IDM_AGGR_MIRROR, &tbi); } #define ATL_CUSTOM_REBAR_STYLE \ ((ATL_SIMPLE_REBAR_STYLE & ~RBS_AUTOSIZE) | CCS_NODIVIDER) // // patria: reason to use ATL_CUSTOM_REBAR_STYLE // // ATL_SIMPLE_REBAR_STYLE (not a NO_BRODER style) has a problem // with theme-enabled Windows XP, // rendering some transparent lines above the rebar. // CreateSimpleReBar(ATL_CUSTOM_REBAR_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(m_wndToolBar.m_hWnd, NULL, TRUE); CReBarCtrl reBar = m_hWndToolBar; DWORD cBands = reBar.GetBandCount(); for (DWORD i = 0; i < cBands; ++i) { REBARBANDINFO rbi = {0}; rbi.cbSize = sizeof(REBARBANDINFO); rbi.fMask = RBBIM_STYLE; reBar.GetBandInfo(i, &rbi); rbi.fStyle |= RBBS_NOGRIPPER; reBar.SetBandInfo(i, &rbi); } // work on status bar, progress bar CreateSimpleStatusBar(); // m_wndStatusBar.SubclassWindow(m_hWndStatusBar); RECT rectRefreshProgress; /* #define ID_PANE_REFRESH_STATUS 1 int anPanes[] = {ID_DEFAULT_PANE, ID_PANE_REFRESH_STATUS}; m_wndStatusBar.SetPanes(anPanes, sizeof(anPanes) / sizeof(int), false); int anWidths[] = {400, -1}; m_wndStatusBar.SetParts(sizeof(anWidths) / sizeof(int), anWidths); m_wndStatusBar.GetPaneRect(ID_DEFAULT_PANE, &rectRefreshProgress); m_wndStatusBar.GetPaneRect(ID_PANE_REFRESH_STATUS, &rectRefreshProgress); */ // m_wndStatusBar.GetWindowRect(&rectRefreshProgress); ::GetClientRect(m_hWndStatusBar, &rectRefreshProgress); rectRefreshProgress.right = 300; m_wndRefreshProgress.Create(m_hWndStatusBar, &rectRefreshProgress, NULL, WS_CHILD | WS_VISIBLE); m_wndRefreshProgress.SetRange32(0, 100); m_wndRefreshProgress.SetPos(50); m_wndRefreshProgress.ShowWindow(SW_HIDE); /* m_wndStatusBar.SetPaneText(ID_DEFAULT_PANE, _T("text1")); m_wndStatusBar.SetPaneText(ID_PANE_REFRESH_STATUS, _T("text2")); */ m_wndHorzSplit.Create(*this, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); m_viewTree.Create( m_wndHorzSplit, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TVS_HASLINES | /* TVS_LINESATROOT | */ TVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE ); m_viewList.Create( m_wndHorzSplit, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LVS_ICON | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | LVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE ); m_viewList.Initialize(); m_wndHorzSplit.SetSplitterPanes(m_viewList, m_viewTree); m_wndHorzSplit.m_cxyMin = 130; m_viewTreeList.Create( *this, rcDefault, NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); m_viewTreeList.Initialize(); // m_viewTreeList._Init(); // m_viewTreeList.SubclassWindow(m_hWnd); m_hWndClient = m_wndHorzSplit; m_hWndClient = m_viewTreeList; UIAddToolBar(m_wndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // TODO : It will be better if we display splash window while // the treeview is initialized m_bRefreshing = FALSE; ::InitializeCriticalSection(&m_csThreadRefreshStatus); // StartRefreshStatus(); // PostMessage(WM_COMMAND, IDM_AGGR_REFRESH, 0); m_hEventCallback = ::NdasRegisterEventCallback(pNdasEventProc,m_hWnd); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); // FIXME : We need to remember the window size CRect rectResize; GetClientRect( rectResize ); rectResize = CRect( rectResize.TopLeft(), CSize(500, 500) ); ClientToScreen( rectResize ); MoveWindow( rectResize ); CenterWindow(); return 0; }
void CTreeListCtrl::OnPaint() { CPaintDC dc(this); // device context for painting CRect rcClip, rcClient; dc.GetClipBox( &rcClip ); GetClientRect(&rcClient); // Set clip region to be same as that in paint DC CRgn rgn; rgn.CreateRectRgnIndirect( &rcClip ); dc.SelectClipRgn(&rgn); rgn.DeleteObject(); COLORREF m_wndColor = GetSysColor( COLOR_WINDOW ); dc.SetViewportOrg(m_nOffset, 0); dc.SetTextColor(m_wndColor); // First let the control do its default drawing. CWnd::DefWindowProc( WM_PAINT, (WPARAM)dc.m_hDC, 0 ); HTREEITEM hItem = GetFirstVisibleItem(); int n = GetVisibleCount(), m_nWidth; dc.FillSolidRect(GetColumnWidth(0),1,rcClient.Width(),rcClient.Height(),m_wndColor); CTreeListItem *pItem; // the most urgent thing is to erase the labels that were drawn by the tree while(hItem!=NULL && n>=0) { CRect rect; UINT selflag = TVIS_DROPHILITED | TVIS_SELECTED; CRect m_labelRect; GetItemRect( hItem, &m_labelRect, TRUE ); GetItemRect( hItem, &rect, FALSE ); if (GetColumnsNum()>1) rect.left = min(m_labelRect.left, GetColumnWidth(0)); else rect.left = m_labelRect.left; rect.right = m_nColumnsWidth; dc.FillSolidRect(rect.left,rect.top,rect.Width(),rect.Height(),m_wndColor); hItem = GetNextVisibleItem( hItem ); n--; } // create the font CFont *pFontDC; CFont fontDC, boldFontDC; LOGFONT logfont; CFont *pFont = GetFont(); pFont->GetLogFont( &logfont ); fontDC.CreateFontIndirect( &logfont ); pFontDC = dc.SelectObject( &fontDC ); logfont.lfWeight = 700; boldFontDC.CreateFontIndirect( &logfont ); // and now let's get to the painting itself hItem = GetFirstVisibleItem(); n = GetVisibleCount(); while (hItem != NULL && n >= 0) { CRect rect; UINT selflag = TVIS_DROPHILITED | TVIS_SELECTED; if ( !(GetItemState( hItem, selflag ) & selflag )) { dc.SetBkMode(TRANSPARENT); pItem = (CTreeListItem *)CTreeCtrl::GetItemData(hItem); CString sItem = ((pItem != NULL) ? pItem->GetItemText() : ""); CRect m_labelRect; GetItemRect( hItem, &m_labelRect, TRUE ); GetItemRect( hItem, &rect, FALSE ); if (GetColumnsNum()>1) rect.left = min(m_labelRect.left, GetColumnWidth(0)); else rect.left = m_labelRect.left; rect.right = m_nColumnsWidth; dc.SetBkColor( m_wndColor ); if (pItem != NULL) { dc.SetTextColor( pItem->m_Color ); if (pItem->m_Bold) { dc.SelectObject( &boldFontDC ); } } int imageIndex; int selectedImageIndex; GetItemImage(hItem,imageIndex,selectedImageIndex); int imageOffset = 0; if (imageIndex >= 0) { m_imageList->Draw(&dc,imageIndex,rect.TopLeft(),ILD_TRANSPARENT); imageOffset = 16; } DrawItemText(&dc, sItem, CRect(rect.left+2+imageOffset, rect.top, GetColumnWidth(0)-imageOffset, rect.bottom), GetColumnWidth(0)-rect.left-2-imageOffset, GetColumnAlign(0)); m_nWidth = 0; for (int i = 1;i < m_nColumns;i++) { CString subString = ((pItem != NULL) ? pItem->GetSubstring(*this,hItem,i) : ""); m_nWidth += GetColumnWidth(i-1); DrawItemText(&dc,subString,CRect(m_nWidth, rect.top, m_nWidth+GetColumnWidth(i), rect.bottom), GetColumnWidth(i), GetColumnAlign(i)); } dc.SetTextColor(::GetSysColor (COLOR_WINDOWTEXT )); if (pItem != NULL && pItem->m_Bold) { dc.SelectObject( &fontDC ); } } else { CRect m_labelRect; GetItemRect( hItem, &m_labelRect, TRUE ); GetItemRect( hItem, &rect, FALSE ); if (GetColumnsNum() > 1) rect.left = min(m_labelRect.left, GetColumnWidth(0)); else rect.left = m_labelRect.left; rect.right = m_nColumnsWidth; int imageIndex; int selectedImageIndex; GetItemImage(hItem,imageIndex,selectedImageIndex); int imageOffset = 0; if (selectedImageIndex >= 0) { m_imageList->Draw(&dc,selectedImageIndex,rect.TopLeft(),ILD_TRANSPARENT); imageOffset = 16; } // If the item is selected, paint the rectangle with the system color // COLOR_HIGHLIGHT COLORREF m_highlightColor = ::GetSysColor (COLOR_HIGHLIGHT); CBrush brush(m_highlightColor); CRect fillRect(rect); fillRect.left += imageOffset; dc.FillRect (fillRect, &brush); // draw a dotted focus rectangle dc.DrawFocusRect (rect); pItem = (CTreeListItem *)CTreeCtrl::GetItemData(hItem); CString sItem = ((pItem != NULL) ? pItem->GetItemText() : ""); dc.SetBkColor(m_highlightColor); dc.SetTextColor(::GetSysColor (COLOR_HIGHLIGHTTEXT)); if (pItem != NULL && pItem->m_Bold) { dc.SelectObject( &boldFontDC ); } //DrawItemText(&dc, sItem, CRect(rect.left+2, rect.top, GetColumnWidth(0), rect.bottom), GetColumnWidth(0)-rect.left-2, GetColumnAlign(0)); DrawItemText(&dc, sItem, CRect(rect.left+2+imageOffset, rect.top, GetColumnWidth(0)-imageOffset, rect.bottom), GetColumnWidth(0)-rect.left-2-imageOffset, GetColumnAlign(0)); m_nWidth = 0; for (int i = 1;i < m_nColumns;i++) { CString subString = ((pItem != NULL) ? pItem->GetSubstring(*this,hItem,i) : ""); m_nWidth += GetColumnWidth(i-1); DrawItemText(&dc,subString,CRect(m_nWidth, rect.top, m_nWidth+GetColumnWidth(i), rect.bottom), GetColumnWidth(i), GetColumnAlign(i)); } if (pItem != NULL && pItem->m_Bold) { dc.SelectObject( &fontDC ); } } hItem = GetNextVisibleItem( hItem ); n--; } dc.SelectObject( pFontDC ); }
bool CGUIProgressControl::UpdateLayout(void) { bool bChanged(false); if (m_width == 0) m_width = m_guiBackground.GetTextureWidth(); if (m_height == 0) m_height = m_guiBackground.GetTextureHeight(); bChanged |= m_guiBackground.SetHeight(m_height); bChanged |= m_guiBackground.SetWidth(m_width); float fScaleX, fScaleY; fScaleY = m_guiBackground.GetTextureHeight() ? m_height / m_guiBackground.GetTextureHeight() : 1.0f; fScaleX = m_guiBackground.GetTextureWidth() ? m_width / m_guiBackground.GetTextureWidth() : 1.0f; float posX = m_guiBackground.GetXPosition(); float posY = m_guiBackground.GetYPosition(); if (m_guiLeft.GetFileName().empty() && m_guiRight.GetFileName().empty()) { // rendering without left and right image - fill the mid image completely float width = m_fPercent * m_width * 0.01f; float offset = fabs(fScaleY * 0.5f * (m_guiMid.GetTextureHeight() - m_guiBackground.GetTextureHeight())); if (offset > 0) // Center texture to the background if necessary bChanged |= m_guiMid.SetPosition(posX, posY + offset); else bChanged |= m_guiMid.SetPosition(posX, posY); bChanged |= m_guiMid.SetHeight(fScaleY * m_guiMid.GetTextureHeight()); if (m_bReveal) { bChanged |= m_guiMid.SetWidth(m_width); float x = posX, y = posY + offset, w = width, h = fScaleY * m_guiMid.GetTextureHeight(); CRect rect(x, y, x + w, y + h); if (rect != m_guiMidClipRect) { m_guiMidClipRect = rect; bChanged = true; } } else { bChanged |= m_guiMid.SetWidth(width); m_guiMidClipRect = CRect(); } } else { float fWidth = m_fPercent; float fFullWidth = m_guiBackground.GetTextureWidth() - m_guiLeft.GetTextureWidth() - m_guiRight.GetTextureWidth(); fWidth /= 100.0f; fWidth *= fFullWidth; float offset = fabs(fScaleY * 0.5f * (m_guiLeft.GetTextureHeight() - m_guiBackground.GetTextureHeight())); if (offset > 0) // Center texture to the background if necessary bChanged |= m_guiLeft.SetPosition(posX, posY + offset); else bChanged |= m_guiLeft.SetPosition(posX, posY); bChanged |= m_guiLeft.SetHeight(fScaleY * m_guiLeft.GetTextureHeight()); bChanged |= m_guiLeft.SetWidth(fScaleX * m_guiLeft.GetTextureWidth()); posX += fScaleX * m_guiLeft.GetTextureWidth(); offset = fabs(fScaleY * 0.5f * (m_guiMid.GetTextureHeight() - m_guiBackground.GetTextureHeight())); if (offset > 0) // Center texture to the background if necessary bChanged |= m_guiMid.SetPosition(posX, posY + offset); else bChanged |= m_guiMid.SetPosition(posX, posY); bChanged |= m_guiMid.SetHeight(fScaleY * m_guiMid.GetTextureHeight()); if (m_bReveal) { bChanged |= m_guiMid.SetWidth(fScaleX * fFullWidth); float x = posX, y = posY + offset, w = fScaleX * fWidth, h = fScaleY * m_guiMid.GetTextureHeight(); CRect rect(x, y, x + w, y + h); if (rect != m_guiMidClipRect) { m_guiMidClipRect = rect; bChanged = true; } } else { bChanged |= m_guiMid.SetWidth(fScaleX * fWidth); m_guiMidClipRect = CRect(); } posX += fWidth * fScaleX; offset = fabs(fScaleY * 0.5f * (m_guiRight.GetTextureHeight() - m_guiBackground.GetTextureHeight())); if (offset > 0) // Center texture to the background if necessary bChanged |= m_guiRight.SetPosition(posX, posY + offset); else bChanged |= m_guiRight.SetPosition(posX, posY); bChanged |= m_guiRight.SetHeight(fScaleY * m_guiRight.GetTextureHeight()); bChanged |= m_guiRight.SetWidth(fScaleX * m_guiRight.GetTextureWidth()); } float offset = fabs(fScaleY * 0.5f * (m_guiOverlay.GetTextureHeight() - m_guiBackground.GetTextureHeight())); if (offset > 0) // Center texture to the background if necessary bChanged |= m_guiOverlay.SetPosition(m_guiBackground.GetXPosition(), m_guiBackground.GetYPosition() + offset); else bChanged |= m_guiOverlay.SetPosition(m_guiBackground.GetXPosition(), m_guiBackground.GetYPosition()); bChanged |= m_guiOverlay.SetHeight(fScaleY * m_guiOverlay.GetTextureHeight()); bChanged |= m_guiOverlay.SetWidth(fScaleX * m_guiOverlay.GetTextureWidth()); return bChanged; }
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext) { // Hauptfenster aufteilen: // +---------------------------------------------------+ // | CMenuChooseView 0 CGalaxyMenuView / CMainBaseViews | // | 0 | // | 0 | // | 0 | // | 0 | // | 0 | // | 0 | // | 0 | // | 0 | // | 0 | // | 0 | // | 0 | // | 0 | // |ooooooooooooooooooooooooooooooooooooooooooooooooooo| // | CSmallInfoView 0 CBottomBaseViews | // | 0 | // | 0 | // | 0 | // | 0 | // | 0 | // +---------------------------------------------------+ /* Größe der CGalaxyMenuView mit ScrollBars: 1058 | 733 ohne Scrollbars: 1075 | 750 Größe der CCMenuChooseView: 200 | 750 Größe der CView3: 1075 | 249 Größe der CCSmallInfoView: 200 | 249 Alle Ansichten haben bei dieser angegebenen Größe nicht mehr den Rahmen der SplitterWindows. Also den, womit man die Größe der einzelnen Fenster verschieben konnte. Die Monitorauflösung muß 1280*1024 betragen. (Scrollbars haben also eine Dicke von 17 Pixeln bei einer Monitorauflösung von 1280*1024) */ CRect r; this->GetDesktopWindow()->GetClientRect(r); m_wndSplitter.CreateStatic(this, 2, 2, WS_CHILD | WS_VISIBLE); // Größen der Splitter festlegen. Der Mulitplikator kommt zustande, so dass es auf jeder Monitorauflösung trotzdem noch // das selbe Verhältnis hat. Deswegen können dort keine statischen Werte verwendet werden. // m_wndSplitter.SetRowInfo(0, r.bottom * VERT_PROPORTION, r.bottom * VERT_PROPORTION); // m_wndSplitter.SetColumnInfo(0, r.right * HORZ_PROPORTION, r.right * HORZ_PROPORTION); /* m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CMenuChooseView), CSize(r.right * 0.15625, r.bottom * 0.732421875), pContext); m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CGalaxyMenuView), CSize(r.Width() - r.right * 0.15625, r.bottom * 0.732421875), pContext); m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CSmallInfoView), CSize(r.right * 0.15625, r.Height() - r.bottom * 0.732421875), pContext); m_wndSplitter.CreateView(1, 1, RUNTIME_CLASS(CPlanetBottomView), CSize(r.Width() - r.right * 0.15625, r.Height() - r.bottom * 0.732421875), pContext); */ // View hinzufügen // Hauptmenü m_wndSplitter.AddSwitchableView(m_wndSplitter.IdFromRowCol(0, 1), RUNTIME_CLASS(CStartMenuView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , true , VIEWS::START_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::NEWGAME_VIEW, RUNTIME_CLASS(CNewGameView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , false , VIEWS::NEWGAME_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::CHOOSERACE_VIEW, RUNTIME_CLASS(CChooseRaceView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , false , VIEWS::CHOOSERACE_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::GALAXY_VIEW, RUNTIME_CLASS(CGalaxyMenuView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , false , VIEWS::GALAXY_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::SYSTEM_VIEW, RUNTIME_CLASS(CSystemMenuView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , false , VIEWS::SYSTEM_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::RESEARCH_VIEW, RUNTIME_CLASS(CResearchMenuView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , false , VIEWS::RESEARCH_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::INTEL_VIEW, RUNTIME_CLASS(CIntelMenuView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , false , VIEWS::INTEL_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::DIPLOMACY_VIEW, RUNTIME_CLASS(CDiplomacyMenuView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , false , VIEWS::DIPLOMACY_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::TRADE_VIEW, RUNTIME_CLASS(CTradeMenuView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , false , VIEWS::TRADE_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::EMPIRE_VIEW, RUNTIME_CLASS(CEmpireMenuView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , false , VIEWS::EMPIRE_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::FLEET_VIEW, RUNTIME_CLASS(CFleetMenuView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , false , VIEWS::FLEET_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::SHIPDESIGN_VIEW, RUNTIME_CLASS(CShipDesignMenuView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , false , VIEWS::SHIPDESIGN_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::TRANSPORT_VIEW, RUNTIME_CLASS(CTransportMenuView), pContext, CRect(r.right * HORZ_PROPORTION, 0, r.Width(), r.bottom * VERT_PROPORTION) , false , VIEWS::TRANSPORT_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::EVENT_VIEW, RUNTIME_CLASS(CEventMenuView), pContext, CRect(r.right, 0, r.Width(), r.bottom) , false , VIEWS::EVENT_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::COMBAT_VIEW, RUNTIME_CLASS(CCombatMenuView), pContext, CRect(r.right, 0, r.Width(), r.bottom) , false , VIEWS::COMBAT_VIEW); // kleine View unten/links m_wndSplitter.AddSwitchableView(m_wndSplitter.IdFromRowCol(1, 0), RUNTIME_CLASS(CSmallInfoView), pContext, CRect(0, 0, r.Width(), r.Height()) , true); // Planeten/Schiffsansichtsmenü m_wndSplitter.AddSwitchableView(m_wndSplitter.IdFromRowCol(1, 1), RUNTIME_CLASS(CPlanetBottomView), pContext, CRect(0, 0, r.Width(), r.Height()) , true, VIEWS::PLANET_BOTTOM_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::SHIP_BOTTOM_VIEW, RUNTIME_CLASS(CShipBottomView), pContext, CRect(0, 0, r.Width(), r.Height()) , false , VIEWS::SHIP_BOTTOM_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::RESEARCH_BOTTOM_VIEW, RUNTIME_CLASS(CResearchBottomView), pContext, CRect(0, 0, r.Width(), r.Height()) , false , VIEWS::RESEARCH_BOTTOM_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::INTEL_BOTTOM_VIEW, RUNTIME_CLASS(CIntelBottomView), pContext, CRect(0, 0, r.Width(), r.Height()) , false , VIEWS::INTEL_BOTTOM_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::DIPLOMACY_BOTTOM_VIEW, RUNTIME_CLASS(CDiplomacyBottomView), pContext, CRect(0, 0, r.Width(), r.Height()) , false , VIEWS::DIPLOMACY_BOTTOM_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::TRADE_BOTTOM_VIEW, RUNTIME_CLASS(CTradeBottomView), pContext, CRect(0, 0, r.Width(), r.Height()) , false , VIEWS::TRADE_BOTTOM_VIEW); m_wndSplitter.AddSwitchableView(VIEWS::SHIPDESIGN_BOTTOM_VIEW, RUNTIME_CLASS(CShipDesignBottomView), pContext, CRect(0, 0, r.Width(), r.Height()) , false , VIEWS::SHIPDESIGN_BOTTOM_VIEW); // linke Menüleiste m_wndSplitter.AddSwitchableView(m_wndSplitter.IdFromRowCol(0, 0), RUNTIME_CLASS(CMenuChooseView), pContext, CRect(0, 0, r.Width(), r.Height()) , true, VIEWS::MENU_CHOOSE_VIEW); //FullScreenMainView(true); return TRUE; // return CFrameWnd::OnCreateClient(lpcs, pContext); }
CRect CStatisticForm::GetDefaultRect() const { return CRect(50, 200, 750, 600); }
BOOL CStatDialog::OnInitDialog() { CDialog::OnInitDialog(); // m_Graph.SubclassWindow( GetDlgItem(IDC_GRAPH)->m_hWnd ); #if(0) RECT CtrlRect, DlgRect; GetDlgItem(IDC_GRAPH)->GetWindowRect(&CtrlRect); GetDlgItem(IDC_GRAPH)->DestroyWindow(); GetWindowRect(&DlgRect); CRect NewRect = CtrlRect; NewRect.OffsetRect(-CRect(DlgRect).TopLeft()); m_Graph.Create("LINE_CHART_CTRL", "", WS_VISIBLE | WS_CHILD, NewRect, this, IDC_GRAPH); m_Graph.Add(RGB(0,255,0),100, 0, "Connections"); #endif #if (_MFC_VER > 0x0421) m_GraphTab.InsertItem(0, "Logins"); m_GraphTab.InsertItem(1, "Login Duration"); m_GraphTab.InsertItem(2, "Login Duration Avg."); m_GraphTab.InsertItem(3, "Password Failures"); m_GraphTab.InsertItem(4, "Download Count"); m_GraphTab.InsertItem(5, "Download Size"); m_GraphTab.InsertItem(6, "Download Duration"); m_GraphTab.InsertItem(7, "Upload Count"); m_GraphTab.InsertItem(8, "Upload Size"); m_GraphTab.InsertItem(9, "Upload Duration"); #else TC_ITEM tcItem; tcItem.mask = TCIF_TEXT; tcItem.pszText = "Logins"; m_GraphTab.InsertItem(0, &tcItem); tcItem.pszText = "Login Duration"; m_GraphTab.InsertItem(1, &tcItem); tcItem.pszText = "Login Duration Avg."; m_GraphTab.InsertItem(2, &tcItem); m_GraphTab.InsertItem(3, &tcItem); m_GraphTab.InsertItem(4, &tcItem); m_GraphTab.InsertItem(5, &tcItem); m_GraphTab.InsertItem(6, &tcItem); m_GraphTab.InsertItem(7, &tcItem); m_GraphTab.InsertItem(8, &tcItem); m_GraphTab.InsertItem(9, &tcItem); #endif // CImageList* ImageList = new CImageList(); // ImageList->Create(MAKEINTRESOURCE(IDB_BITMAP_2), 22, 1, RGB(192,192,192)); // m_ChartWnd.SetImageList(ImageList); m_ChartWnd.SetUserColTitle("Logins"); m_StatCallback(&m_FullStat, -1, "", "", &m_GroupArray, &m_UserArray); FillUserGroupList(); GetStats(m_User, m_Group); STAT_ADD_PLOTS(LoginCount); m_ChartWnd.EnableTitleTips(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void COKJDlg::OnCam1() { CamPreview(TRUE,CRect(80,0,720,480)); }
BOOL CReportCtrl::StartEdit(int nItem, int nSubItem) { // Get the grid width and height if (!m_bAllowEdit || !_IsValidIndex(nItem) || nSubItem < 0 || nSubItem >= GetColumnCount()) return FALSE; if (m_ptEditting.x == nItem && m_ptEditting.y == nSubItem) return TRUE; EndEdit(TRUE); m_ptEditting.x = nItem; m_ptEditting.y = nSubItem; SetAllItemStates(RC_ITEM_SELECTED, RC_ITEM_UNSELECTED); // unselect all SetItemStates(m_ptEditting.x, RC_ITEM_SELECTED | RC_ITEM_FOCUSED); // determine editbox font and alignment const DWORD FMT = _GetHeaderTextFormat(nSubItem); if (FMT != m_dwPrevEditFmt) { m_dwPrevEditFmt = FMT; // Funny thing: // Changing CEdit style among ES_LEFT, ES_CENTER, ES_RIGHT at runtime works // sometimes and fails other times. It just cannot guarantee to be succeed. // So I decided to destroy and recreate the CEdit every time when the text // format changes. if (m_pWndEdit->GetSafeHwnd() != NULL) m_pWndEdit->DestroyWindow(); if (!m_pWndEdit->Create(ES_READONLY | ES_AUTOHSCROLL | ES_NOHIDESEL | WS_CHILD | WS_BORDER | FMT, CRect(0, 0, 1, 1), this, 0)) return FALSE; } else { if (m_pWndEdit->GetSafeHwnd() == NULL && !m_pWndEdit->Create(ES_READONLY | ES_AUTOHSCROLL | ES_NOHIDESEL | WS_CHILD | WS_BORDER | FMT, CRect(0, 0, 1, 1), this, 0)) { return FALSE; } } m_pWndEdit->SetFont(GetFont()); CRect rcEdit; ListView_GetSubItemRect(GetSafeHwnd(), m_ptEditting.x, m_ptEditting.y, LVIR_LABEL, &rcEdit); if (m_ptEditting.y > 0 && GetImageList() != NULL && GetItemImage(m_ptEditting.x, m_ptEditting.y) >= 0) rcEdit.DeflateRect(16, 0, 0, 0); // Move the editbox to that grid, obtain text from the grid, display the // editbox, and, finally, highlights all text in the editbox and set the // windows focus to the editbox. m_pWndEdit->MoveWindow(&rcEdit); m_pWndEdit->SetWindowText(GetItemText(m_ptEditting.x, m_ptEditting.y)); m_pWndEdit->ShowWindow(SW_SHOW); m_pWndEdit->SetSel(0, -1); m_pWndEdit->SetFocus(); return TRUE; }
CRect rect; rect.SetRect(256, 256, 512, 512); ASSERT(rect == CRect(256, 256, 512, 512));
int CEventDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) { CString strCurrentPath; strCurrentPath = CMyUtil::GetCurrentPath(); CRect rc; if (CDialogEx::OnCreate(lpCreateStruct) == -1) return -1; if (!m_btnEventIn.Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, CRect(0, 0, 0, 0), this, IDC_EVENT_IN_BUTTON)) { TRACE("\n [&rino-error&] Can't Create.... [m_btnEventIn]"); return false; } m_btnEventIn.LoadStdImage(strCurrentPath + IMAGES_FOLDER + L"\\4_btn_entering.png", strCurrentPath + IMAGES_FOLDER + L"\\4_btn_enteringOn.png", L"", L""); rc = m_btnEventIn.GetStdImageRect(); rc.MoveToXY(450, 1640); m_btnEventIn.MoveWindow(rc); if (!m_btnHome.Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, CRect(0, 0, 0, 0), this, IDC_SURVEY_HOME_PNG_BUTTON)) { TRACE("\n [&rino-error&] Can't Create.... [m_btnHome]"); return false; } m_btnHome.LoadStdImage(strCurrentPath + IMAGES_FOLDER + L"\\2_btn_home.png", strCurrentPath + IMAGES_FOLDER + L"\\2_btn_homeOn.png", L"", L""); rc = m_btnHome.GetStdImageRect(); rc.MoveToXY(780, 1770); m_btnHome.MoveWindow(rc); if(!m_btnAgree1.Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, CRect(0, 0, 0, 0), this, IDC_AGREE_1_BUTTON)) { TRACE("\n [&rino-error&] Can't Create.... [m_btAgree1]"); return false; } m_btnAgree1.LoadToggleImages(strCurrentPath + IMAGES_FOLDER + L"\\4_btn_uncheck.png", strCurrentPath + IMAGES_FOLDER + L"\\4_btn_check.png", L"", L""); rc = m_btnAgree1.GetStdImageRect(); rc.MoveToXY(297, 1547); m_btnAgree1.MoveWindow(rc); if(!m_btnAgree2.Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, CRect(0, 0, 0, 0), this, IDC_AGREE_2_BUTTON)) { TRACE("\n [&rino-error&] Can't Create.... [m_btAgree2]"); return false; } m_btnAgree2.LoadToggleImages(strCurrentPath + IMAGES_FOLDER + L"\\4_btn_uncheck.png", strCurrentPath + IMAGES_FOLDER + L"\\4_btn_check.png", L"", L""); rc = m_btnAgree2.GetStdImageRect(); rc.MoveToXY(562, 1547); m_btnAgree2.MoveWindow(rc); strCurrentPath = CMyUtil::GetCurrentPath(); CString filePath = strCurrentPath + L"kiosk_data" + m_strEventImage; m_SponsorImage.Load(filePath); CreatePhone(); LoadMagnetok(); return 0; }
void CGuiTabWnd::Drawtabs(CDC* dc) { CPen light(PS_SOLID,1,GetSysColor(COLOR_BTNHIGHLIGHT)); CPen Dark(PS_SOLID,1,GetSysColor(COLOR_BTNSHADOW)); CPen Black(PS_SOLID,1,GetSysColor(BLACK_PEN)); CRect rectText; CFont* m_fontOld=dc->SelectObject(&m_cfont); for (int iCont=0; iCont< m_Numtabs;iCont++) { CGuiTab* ct=(CGuiTab*) m_pArray[iCont]; CPen* oldPen= dc->SelectObject(&light); //si es la carpeta seleccionada, se debe //eliminar las lineas oscuras de encima if (iCont ==m_iSelectTab) { CBrush cbr; CRect m_rectTabAux=ct->rect; m_rectTabAux.DeflateRect(1,1); m_rectTabAux.top-=4; m_rectTabAux.bottom=m_rectTabAux.top+4; cbr.CreateSysColorBrush(COLOR_BTNFACE); dc->FillRect(ct->rect,&cbr); dc->MoveTo(ct->rect.left,ct->rect.top-3); dc->LineTo(ct->rect.left,ct->rect.bottom-1); dc->FillRect(m_rectTabAux,&cbr); dc->SelectStockObject(BLACK_PEN); dc->MoveTo(ct->rect.left,ct->rect.bottom-1); dc->LineTo(ct->rect.right,ct->rect.bottom-1); //linea derecha observe que se pinta dos veces para //dar el efecto de redondeada en la puntas dc->SelectStockObject(BLACK_PEN); dc->MoveTo(ct->rect.right-1,ct->rect.top-1); dc->LineTo(ct->rect.right-1,ct->rect.bottom-1); } else { if ((iCont+1) != m_iSelectTab) { dc->SelectObject(&Dark); dc->MoveTo(ct->rect.right-1,ct->rect.top+2); dc->LineTo(ct->rect.right-1,ct->rect.bottom-2); } } //se dibuja el icono int nMode = dc->SetBkMode(TRANSPARENT); CSize m_sChar=dc->GetTextExtent(ct->lpMsg,strlen(ct->lpMsg)); if (m_sizeImag.cx+m_sChar.cx < ct->rect.Width()-8) { Image.Draw(dc,ct->uIcon,CPoint(ct->rect.left+2,ct->rect.top+2),ILD_TRANSPARENT); rectText=ct->rect; rectText.left+=m_sizeImag.cx+8; rectText.right-=2; dc->DrawText(ct->lpMsg,rectText,DT_SINGLELINE|DT_LEFT|DT_VCENTER); CToolTip.SetToolRect(this,iCont+1,CRect(0,0,0,0)); } else { //verificamos si se puede poner algun texto o //por lo memos el icono if (m_sizeImag.cx < ct->rect.Width()) { Image.Draw(dc,ct->uIcon,CPoint(ct->rect.left+2,ct->rect.top+2),ILD_TRANSPARENT); rectText=ct->rect; rectText.left+=m_sizeImag.cx+8; rectText.right-=5; CString m_cadBreak=ct->lpMsg; int c=0; int cont=m_cadBreak.GetLength(); while(cont > 1 ) { CString m_scadtemp=m_cadBreak+"..."; CSize coor=dc->GetTextExtent(m_scadtemp,m_scadtemp.GetLength()); if(coor.cx > rectText.Width()) m_cadBreak=m_cadBreak.Left(m_cadBreak.GetLength()-1); else break; cont--; } m_cadBreak+=_T("..."); rectText.right+=3; dc->DrawText(m_cadBreak,rectText,DT_SINGLELINE|DT_LEFT|DT_VCENTER); CToolTip.SetToolRect(this,iCont+1,&ct->rect); } } dc->SetBkMode(nMode); // Modified By SunZhenyu dc->SelectObject(oldPen); } dc->SelectObject(m_fontOld); }
int CAboutDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDialog::OnCreate(lpCreateStruct) == -1) return -1; LOGFONT lf; LOGFONT lf1; GetObject(GetStockObject(SYSTEM_FONT),sizeof(lf),&lf); cf.DeleteObject(); cf.CreatePointFont(10 * 10, _T("Tahoma")); cf.GetLogFont(&lf1); lf.lfHeight=lf1.lfHeight; lf.lfWidth=lf1.lfWidth; lf.lfWeight = FW_NORMAL; _tcscpy(lf.lfFaceName, _T("Tahoma")); cf.DeleteObject(); cf.CreateFontIndirect(&lf); this->SetFont(&cf); // TODO: Add your specialized creation code here RECT rect; this->SetIcon(LoadIcon(NULL, MAKEINTRESOURCE(IDR_MAINFRAME)), false); HBITMAP hBmp =(HBITMAP)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP_OUTCALL), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT); m_picture.Create(_T("text"), WS_VISIBLE | WS_CHILD | SS_BITMAP | SS_CENTERIMAGE, CRect(0,13,50,35), this); // IDC_STATIC_PICTURE); m_picture.SetBitmap(hBmp); //m_picture.SetWindowPos(&this->wndBottom, 10, 10, 40, 40,SWP_NOZORDER); m_picture.ShowWindow(1); m_version.Create(_T(""), WS_CHILD, rect, this, IDC_STATIC_VERSION); m_version.SetFont(lf); m_version.SetWindowPos(&this->wndBottom, 45, 10, 320, 20, SWP_NOZORDER); m_version.ShowWindow(1); m_version.Invalidate(); m_bsLink.Create(BRAND_COPYRIGHT, WS_CHILD, rect, this, IDC_STATIC_BS_LINK); m_bsLink.ModifyStyle(0, SS_NOTIFY); m_bsLink.SetFont(lf); m_bsLink.SetWindowPos(&this->wndBottom, 45, 35, 320, 20, SWP_NOZORDER); m_bsLink.ShowWindow(1); m_bsLink.UpdateWindow(); m_bsLink.SetTextColor(RGB(0,0,255)); m_bsLink.SetCursor(LoadCursor(NULL, IDC_HAND)); m_btnOK.Create(_("&OK"), WS_CHILD, rect, this, IDOK); m_btnOK.SetWindowPos(&this->wndBottom, 220, 74, 100, 23, SWP_NOZORDER); m_btnOK.ShowWindow(1); m_btnOK.SetFont(&cf); m_version.ShowWindow(1); this->Invalidate(); this->UpdateWindow(); InitLocaleGUI(); return 0; }
/** * Called by the MFC framework to allow the window to create any client windows. This method * creates all of the spliter windows and registers all of the views with the document manager. */ BOOL MEMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { CCreateContext consoleContext; consoleContext.m_pNewViewClass = RUNTIME_CLASS(ConsoleView); m_consoleView = (ConsoleView*)CreateView(&consoleContext); m_consoleView->ShowWindow(SW_HIDE); m_tabs.Create(TCS_BOTTOM | TCS_FLATBUTTONS | WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), this, TAB_CONTROL); m_tabs.InsertItem(0, "Editor"); m_tabs.InsertItem(1, "Console"); m_tabs.SetFont(materialEditorFont); m_splitterWnd.CreateStatic(this, 2, 1); m_editSplitter.CreateStatic(&m_splitterWnd, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_splitterWnd.IdFromRowCol(0, 0)); if(!m_editSplitter.CreateView(0, 0, RUNTIME_CLASS(MaterialTreeView), CSize(300, 200), pContext)) { TRACE0("Failed to create material list pane\n"); return FALSE; } if(!m_editSplitter.CreateView(0, 1, RUNTIME_CLASS(MaterialEditView), CSize(200, 200), pContext)) { TRACE0("Failed to create stage property pane\n"); return FALSE; } m_previewSplitter.CreateStatic(&m_splitterWnd, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_splitterWnd.IdFromRowCol(1, 0)); if(!m_previewSplitter.CreateView(0, 0, RUNTIME_CLASS(MaterialPreviewPropView), CSize(300, 200), pContext)) { TRACE0("Failed to create preview property pane\n"); return FALSE; } if(!m_previewSplitter.CreateView(0, 1, RUNTIME_CLASS(MaterialPreviewView), CSize(100, 200), pContext)) { TRACE0("Failed to create preview pane\n"); return FALSE; } //Get references to all of the views m_materialTreeView = (MaterialTreeView*)m_editSplitter.GetPane(0, 0); m_previewPropertyView = (MaterialPreviewPropView*)m_previewSplitter.GetPane(0, 0); m_materialPreviewView = (MaterialPreviewView*)m_previewSplitter.GetPane(0, 1); m_materialEditView = (MaterialEditView*)m_editSplitter.GetPane(0, 1); m_stageView = m_materialEditView->m_stageView; m_materialPropertyView = m_materialEditView->m_materialPropertyView; m_materialEditSplitter = &m_materialEditView->m_editSplitter; //Load the splitter positions from the registry int val = options.GetMaterialEditHeight(); if(val <= 0) val = 300; m_splitterWnd.SetRowInfo(0, val, 0); val = options.GetMaterialTreeWidth(); if(val <= 0) val = 300; m_editSplitter.SetColumnInfo(0, val, 0); val = options.GetStageWidth(); if(val <= 0) val = 200; m_materialEditSplitter->SetColumnInfo(0, val, 0); val = options.GetPreviewPropertiesWidth(); if(val <= 0) val = 300; m_previewSplitter.SetColumnInfo(0, val, 0); //Register the views with the document manager materialDocManager.RegisterMaterialView(this); materialDocManager.RegisterMaterialView(m_materialTreeView); materialDocManager.RegisterMaterialView(m_stageView); materialDocManager.RegisterMaterialView(m_materialPropertyView); materialDocManager.RegisterMaterialView(m_materialPreviewView); materialDocManager.RegisterMaterialView(m_materialEditView); //Let the stage window know about the prop window m_stageView->SetMaterialPropertyView(m_materialPropertyView); //Let the preview props now about the preview window m_previewPropertyView->RegisterPreviewView(m_materialPreviewView); m_previewPropertyView->InitializePropTree(); m_previewPropertyView->GetPropertyTreeCtrl().SetColumn(120); MaterialDefManager::InitializeMaterialDefLists(); //Some prop tree initialization //m_materialPropertyView->InitializePropTreeDefs(); val = options.GetMaterialPropHeadingWidth(); if(val <= 0) val = 200; m_materialPropertyView->GetPropertyTreeCtrl().SetColumn(val); m_materialPropertyView->LoadSettings(); val = options.GetPreviewPropHeadingWidth(); if(val <= 0) val = 120; m_previewPropertyView->GetPropertyTreeCtrl().SetColumn(val); //Build the material list m_materialTreeView->InitializeMaterialList(true); SetActiveView(m_materialTreeView); return CFrameWnd::OnCreateClient(lpcs, pContext); }
void CXTPReportInplaceList::Create(XTP_REPORTRECORDITEM_ARGS* pItemArgs, CXTPReportRecordItemConstraints* pConstaints) { SetItemArgs(pItemArgs); CRect rect(pItemArgs->rcItem); if (!m_hWnd) { CListBox::CreateEx(WS_EX_TOOLWINDOW | (pControl->GetExStyle() & WS_EX_LAYOUTRTL), _T("LISTBOX"), _T(""), LBS_NOTIFY | WS_CHILD | WS_BORDER | WS_VSCROLL, CRect(0, 0, 0, 0), pControl, 0); SetOwner(pControl); } SetFont(pControl->GetPaintManager()->GetTextFont()); ResetContent(); int dx = rect.right - rect.left + 1; CWindowDC dc(pControl); CXTPFontDC font(&dc, GetFont()); int nThumbLength = GetSystemMetrics(SM_CXHTHUMB); CString strCaption = pItem->GetCaption(pColumn); DWORD dwData = pItem->GetSelectedConstraintData(pItemArgs); for (int i = 0; i < pConstaints->GetCount(); i++) { CXTPReportRecordItemConstraint* pConstaint = pConstaints->GetAt(i); CString str = pConstaint->m_strConstraint; int nIndex = AddString(str); SetItemDataPtr(nIndex, pConstaint); dx = max(dx, dc.GetTextExtent(str).cx + nThumbLength); if ((dwData == (DWORD)-1 && strCaption == str) || (dwData == pConstaint->m_dwData)) SetCurSel(nIndex); } int nHeight = GetItemHeight(0); rect.top = rect.bottom; //rect.bottom += nHeight * min(10, GetCount()) + 2; rect.bottom += nHeight * min(m_Items2Show, GetCount()) + 2; rect.left = rect.right - dx; pControl->ClientToScreen(&rect); CRect rcWork = XTPMultiMonitor()->GetWorkArea(rect); if (rect.bottom > rcWork.bottom && rect.top > rcWork.CenterPoint().y) rect.OffsetRect(0, - rect.Height() - pItemArgs->rcItem.Height()); if (rect.left < rcWork.left) rect.OffsetRect(rcWork.left - rect.left, 0); if (rect.right > rcWork.right) rect.OffsetRect(rcWork.right - rect.right, 0); SetFocus(); if (!m_hWnd) // Can be destroyed after focus set return; SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, 0); ModifyStyle(WS_CHILD, WS_POPUP); SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, (LONG_PTR)pControl->m_hWnd); SetWindowPos(&CWnd::wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOOWNERZORDER); CXTPMouseMonitor::SetupHook(this); }
void _PreprocessText() { u32 lastSpace = -1; u32 lineWidth = 0; u32 currWidth = 0; u32 lineStart = 0; u32 maxWidth = 0; m_TextLines.Clear(); m_GlyphCount = 0; for(u32 i = 0; i < m_Text.Size(); i++) { CFont2D::SGlyph* glyph = m_Font->GetGlyph(m_Text[i]); if(m_Text[i] == ' ') { lastSpace = i; lineWidth = currWidth; } if(glyph) { currWidth += glyph->Xa; m_GlyphCount++; } if(i == (m_Text.Size() - 1)) { STextLine line; line.Text = CWString(m_Text.CStr() + lineStart, i - lineStart + 1); line.Width = currWidth; if(currWidth > maxWidth) maxWidth = currWidth; m_TextLines.PushBack(line); break; } if(m_Text[i] == '\n') { STextLine line; line.Text = CWString(m_Text.CStr() + lineStart, i - lineStart); line.Width = currWidth; if(currWidth > maxWidth) maxWidth = currWidth; m_TextLines.PushBack(line); lineWidth = 0; currWidth = 0; lineStart = i+1; lastSpace = -1; continue; } if(!glyph) { currWidth += m_Font->GetSize(); } if(m_TextSize.X > 0 && currWidth > m_TextSize.X && lineWidth != 0) { if(lastSpace == -1) lastSpace = i; STextLine line; line.Text = CWString(m_Text.CStr() + lineStart, lastSpace - lineStart); line.Width = lineWidth; if(lineWidth > maxWidth) maxWidth = lineWidth; m_TextLines.PushBack(line); currWidth = currWidth - lineWidth; lineWidth = 0; lineStart = lastSpace + 1; lastSpace = -1; } } m_Size.X = maxWidth; m_Size.Y = m_Font->GetSize() * m_TextLines.Size(); m_Center.X = m_Size.X - m_TextSize.X; m_Center.Y = m_Size.Y - m_TextSize.Y; if(m_HAlignment == EHA_CENTER) { m_Center.X /= 2.0f; } if(m_VAlignment == EVA_CENTER) { m_Center.Y /= 2.0f; } m_Bound = CRect(-m_Center.X, -m_Center.Y, m_Size.X, m_Size.Y); m_Transform.TransformAARect(m_Bound); m_VertexesDirty = true; if(m_CurrentBatch) { m_CurrentBatch->MarkDirty(); } }
void CGUIScrollBarVertical::Draw() { if (!GetStyle()) { LOGWARNING(L"Attempt to draw scrollbar without a style."); return; } // Only draw the scrollbar if the GUI exists and there is something to scroll. if (GetGUI() && GetMaxPos() != 1) { CRect outline = GetOuterRect(); // Draw background GetGUI()->DrawSprite(GetStyle()->m_SpriteBackVertical, 0, m_Z+0.1f, CRect(outline.left, outline.top+(m_UseEdgeButtons?GetStyle()->m_Width:0), outline.right, outline.bottom-(m_UseEdgeButtons?GetStyle()->m_Width:0)) ); if (m_UseEdgeButtons) { // Get Appropriate sprites const CGUISpriteInstance *button_top, *button_bottom; // figure out what sprite to use for top button if (m_ButtonMinusHovered) { if (m_ButtonMinusPressed) button_top = &GUI<>::FallBackSprite(GetStyle()->m_SpriteButtonTopPressed, GetStyle()->m_SpriteButtonTop); else button_top = &GUI<>::FallBackSprite(GetStyle()->m_SpriteButtonTopOver, GetStyle()->m_SpriteButtonTop); } else button_top = &GetStyle()->m_SpriteButtonTop; // figure out what sprite to use for bottom button if (m_ButtonPlusHovered) { if (m_ButtonPlusPressed) button_bottom = &GUI<>::FallBackSprite(GetStyle()->m_SpriteButtonBottomPressed, GetStyle()->m_SpriteButtonBottom); else button_bottom = &GUI<>::FallBackSprite(GetStyle()->m_SpriteButtonBottomOver, GetStyle()->m_SpriteButtonBottom); } else button_bottom = &GetStyle()->m_SpriteButtonBottom; // Draw top button GetGUI()->DrawSprite(*button_top, 0, m_Z+0.2f, CRect(outline.left, outline.top, outline.right, outline.top+GetStyle()->m_Width) ); // Draw bottom button GetGUI()->DrawSprite(*button_bottom, 0, m_Z+0.2f, CRect(outline.left, outline.bottom-GetStyle()->m_Width, outline.right, outline.bottom) ); } // Draw bar GetGUI()->DrawSprite(GetStyle()->m_SpriteBarVertical, 0, m_Z + 0.2f, GetBarRect()); } }
void ifuzzPluginDlg::init() { // skin status: // ------------------------ // mf=this.kxl [if exists] // mf.next=[attached]=kX Mixer's mf // mf.priority=1; this.kxl is accessed first // process kxefx.kxs now TCHAR tmp_str[MAX_PATH]; efx_skin.get_full_skin_path(_T("kxefx.kxs"),tmp_str); efx_skin.set_skin(tmp_str); mf.attach_skin(&efx_skin); efx_skin.attach_skin(kxmixer_skin); efx_skin.set_attach_priority(1); // skin status: // ------------------------- // [1] mf=this.kxl // [2] mf.next=efx_skin // [3] efx_skin=kxefx.kxs // [4] efx_skin.next=kxmixer skin // [1,2,3,4] -- access order CKXPluginGUI::init(); // this is necessary // init() should be called -after- skin initialization //----------------------------------------------------------------------------------------------- // custom dialog initialization here... // (title, Width, Height) create_dialog(plugin_name(fuzz), 250, 120); grpbox.hide();//hide useless GUI elements w_label.hide(); /*LCDs*/ count_drive.Create("",WS_VISIBLE|SS_NOTIFY,CRect(CPoint(62,86),CSize(29,18)), this); //count_drive.SetID(COUNT_DRIVE); count_drive.SetBlankPadding(3);//празни полета от ляво count_drive.SetColours(RGB(0,220,0), RGB(0,0,0), RGB(0,0,0));//цифри, блат, слайдер count_drive.SetAllowInteraction(false);//не може да се настройва count_drive.SetDraw3DBar(false);//без слайдър count_drive.DisplayInt(true); count_level_drive.Create("",WS_VISIBLE|SS_NOTIFY,CRect(CPoint(187,86),CSize(29,18)), this); //count_level_drive.SetID(COUNT_LEVEL_DRIVE); count_level_drive.SetBlankPadding(3);//празни полета от ляво count_level_drive.SetColours(RGB(0,220,0), RGB(0,0,0), RGB(0,0,0));//цифри, блат, слайдер count_level_drive.SetAllowInteraction(false);//не може да се настройва count_level_drive.SetDraw3DBar(false);//без слайдър count_level_drive.DisplayInt(true); count_level_clean.Create("",WS_VISIBLE|SS_NOTIFY,CRect(CPoint(62,149),CSize(29,18)), this); //count_level_clean.SetID(COUNT_LEVEL_CLEAN); count_level_clean.SetBlankPadding(3);//празни полета от ляво count_level_clean.SetColours(RGB(0,220,0), RGB(0,0,0), RGB(0,0,0));//цифри, блат, слайдер count_level_clean.SetAllowInteraction(false);//не може да се настройва count_level_clean.SetDraw3DBar(false);//без слайдър count_level_clean.DisplayInt(true); count_o_freq.Create("",WS_VISIBLE|SS_NOTIFY,CRect(CPoint(281,92),CSize(32,14)), this); //count_o_freq.SetID(COUNT_O_FREQ); count_o_freq.SetBlankPadding(4);//празни полета от ляво count_o_freq.SetColours(RGB(0,220,0), RGB(0,0,0), RGB(0,0,0));//цифри, блат, слайдер count_o_freq.SetAllowInteraction(false);//не може да се настройва count_o_freq.SetDraw3DBar(false);//без слайдър count_o_freq.DisplayInt(true); count_i_freq.Create("",WS_VISIBLE|SS_NOTIFY,CRect(CPoint(381,92),CSize(32,14)), this); //count_i_freq.SetID(COUNT_I_FREQ); count_i_freq.SetBlankPadding(4);//празни полета от ляво count_i_freq.SetColours(RGB(0,220,0), RGB(0,0,0), RGB(0,0,0));//цифри, блат, слайдер count_i_freq.SetAllowInteraction(false);//не може да се настройва count_i_freq.SetDraw3DBar(false);//без слайдър count_i_freq.DisplayInt(true); /*count_i_width.Create("",WS_VISIBLE|SS_NOTIFY,CRect(CPoint(252,145),CSize(29,18)), this); count_i_width.SetID(COUNT_I_WID); //count_i_width.SetFormatString("%.f2"); count_i_width.SetBlankPadding(3);//празни полета от ляво count_i_width.SetColours(RGB(0,220,0), RGB(0,0,0), RGB(0,0,0));//цифри, блат, слайдер count_i_width.SetAllowInteraction(false);//не може да се настройва count_i_width.SetDraw3DBar(false);//без слайдър count_i_width.DisplayInt(true); count_o_width.Create("",WS_VISIBLE|SS_NOTIFY,CRect(CPoint(153,145),CSize(29,18)), this); count_o_width.SetID(COUNT_O_WID); //count_o_width.SetFormatString("%.f2"); count_o_width.SetBlankPadding(3);//празни полета от ляво count_o_width.SetColours(RGB(0,220,0), RGB(0,0,0), RGB(0,0,0));//цифри, блат, слайдер count_o_width.SetAllowInteraction(false);//не може да се настройва count_o_width.SetDraw3DBar(false);//без слайдър count_o_width.DisplayInt(true);*/ /*for loading the bitmap frames for the knobs*///valid for filenames kx.bmp (e.g. k1.bmp for(i=0;i<FRAMES;i++){ //k2.bmp, k3.bmp etc.) sprintf(filename, "k%d.bmp", i+1); // bitmaps[i] = mf.load_image(filename); // } // /*end*/////////////////////////////////////////// /*Knobs*/ knob_drive.SetBitmaps(bitmaps); knob_drive.Create("",WS_CHILD| WS_VISIBLE|SS_NOTIFY, CRect(CPoint(13,76),CSize(40,40)), this); knob_drive.SetID(DRIVE); knob_drive.SetPos(plugin->_params[DRIVE]); knob_level_drive.SetBitmaps(bitmaps); knob_level_drive.Create("",WS_CHILD| WS_VISIBLE|SS_NOTIFY, CRect(CPoint(138,76),CSize(40,40)), this); knob_level_drive.SetID(LEVEL_DRIVE); knob_level_drive.SetPos(plugin->_params[LEVEL_DRIVE]); knob_level_clean.SetBitmaps(bitmaps); knob_level_clean.Create("",WS_CHILD| WS_VISIBLE|SS_NOTIFY, CRect(CPoint(13,139),CSize(40,40)), this); knob_level_clean.SetID(LEVEL_CLEAN); knob_level_clean.SetPos(plugin->_params[LEVEL_CLEAN]); knob_tone.SetBitmaps(bitmaps); knob_tone.Create("",WS_CHILD| WS_VISIBLE|SS_NOTIFY, CRect(CPoint(333,80),CSize(40,40)), this); knob_tone.SetID(I_FREQ); knob_tone.SetPos(plugin->_params[I_FREQ]); knob_i_width.SetBitmaps(bitmaps); knob_i_width.Create("",WS_CHILD| WS_VISIBLE|SS_NOTIFY, CRect(CPoint(355,133),CSize(40,40)), this); knob_i_width.SetID(I_WID); knob_i_width.SetPos(plugin->_params[I_WID]); knob_polish.SetBitmaps(bitmaps); knob_polish.Create("",WS_CHILD| WS_VISIBLE|SS_NOTIFY, CRect(CPoint(235,80),CSize(40,40)), this); knob_polish.SetID(O_FREQ); knob_polish.SetPos(plugin->_params[O_FREQ]); knob_o_width.SetBitmaps(bitmaps); knob_o_width.Create("",WS_CHILD| WS_VISIBLE|SS_NOTIFY, CRect(CPoint(256,133),CSize(40,40)), this); knob_o_width.SetID(O_WID); knob_o_width.SetPos(plugin->_params[O_WID]); /*Checkboxes*/ led_clean.set_bitmaps( mf.load_image("led_off.bmp"), mf.load_image("led_off.bmp"), mf.load_image("led_on.bmp"), mf.load_image("led_on.bmp")); create_checkbox (led_clean, LED_DC, "" , 73, 47, 150); led_clean.set_method(kMETHOD_TRANS); led_norm.set_bitmaps( mf.load_image("led_off.bmp"), mf.load_image("led_off.bmp"), mf.load_image("led_on.bmp"), mf.load_image("led_on.bmp")); create_checkbox (led_norm, LED_X2, "" , 73, 110, 150); led_norm.set_method(kMETHOD_TRANS); led_bps1.set_bitmaps( mf.load_image("led_off.bmp"), mf.load_image("led_off.bmp"), mf.load_image("led_on_red.bmp"), mf.load_image("led_on_red.bmp")); create_checkbox (led_bps1, LED_BPS1, "" , 238, 109, 150); led_bps1.set_method(kMETHOD_TRANS); led_bps2.set_bitmaps( mf.load_image("led_off.bmp"), mf.load_image("led_off.bmp"), mf.load_image("led_on_red.bmp"), mf.load_image("led_on_red.bmp")); create_checkbox (led_bps2, LED_BPS2, "" , 337, 109, 150); led_bps2.set_method(kMETHOD_TRANS); sw_st.set_bitmaps( mf.load_image("switch_up.bmp"), mf.load_image("switch_up.bmp"), mf.load_image("switch_down.bmp"), mf.load_image("switch_down.bmp")); create_checkbox (sw_st, SW_ST, "" , 106, 57, 150); sw_st.set_method(kMETHOD_TRANS); sw_oc.set_bitmaps( mf.load_image("switch_up.bmp"), mf.load_image("switch_up.bmp"), mf.load_image("switch_down.bmp"), mf.load_image("switch_down.bmp")); create_checkbox (sw_oc, SW_OC, "" , 151, 118, 150); sw_oc.set_method(kMETHOD_TRANS); controls_enabled = 1; // enable updating GUI when the parameters are changed sync(EVERYPM_ID); // update all 'GUI' elements to the preset plugin parameters }
BOOL CMainFrame::CreateCommonBar() { CBCGPToolBar::EnableQuickCustomization(); if (!m_wndMenuBar.CreateMenuBar(this)) { TRACE0("Failed to create menubar\n"); return FALSE; // fail to create } DockControlBar(&m_wndMenuBar); //******************************************************************************* if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP /*| CBRS_GRIPPER*/ | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC | CBRS_HIDE_INPLACE, CRect(1, 1, 1, 1), AFX_IDW_TOOLBAR+1) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME, 0, 0, FALSE, 0, 0, IDB_TOOLBAR256)) { TRACE0("Failed to create toolbar\n"); return FALSE; // fail to create } SIZE sizeImage = {32, 32}; CBCGPToolBar::GetLargeImages()->Load(IDB_TOOLBARLARGE); CBCGPToolBar::GetLargeImages()->SetImageSize(sizeImage, TRUE); CBCGPToolBar::SetLargeIcons(TRUE); CIBAString strTmp; strTmp.LoadString(IDS_STANDARD); m_wndToolBar.SetWindowText(strTmp); strTmp.LoadString(IDS_COSTOM); //m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strTmp); m_wndToolBar.EnableTextLabels(); DockControlBar(&m_wndToolBar); //******************************************************************************* if (!m_wndFastLane.CreateFastLane(this)) { return FALSE; } DockControlBar(&m_wndFastLane); //******************************************************************************* UINT indicators[] = {0, 0, 0}; if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return FALSE; // fail to create } //m_wndStatusBar.SetPaneStyle(1, SBPS_STRETCH | SBPS_NOBORDERS); //m_wndStatusBar.EnablePaneDoubleClick(); return TRUE; }
void CXCCTMPEditorView::OnDraw(CDC* pDC) { CXCCTMPEditorDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pDC->GetClipBox(&m_clip_rect); TEXTMETRIC tm; pDC->GetTextMetrics(&tm); int x = 0; int y = 0; int y_inc = tm.tmHeight; t_rect global = pDoc->get_rect(view_true_height()); { int cx = global.r - global.x; int cy = global.b - global.y; byte* d = new byte[cx * cy]; pDoc->draw(d, m_selected, view_true_height()); load_color_table(pDoc->palet()); draw_image8(d, cx, cy, pDC, 0, y); y += cy + y_inc; delete[] d; } typedef CXCCTMPEditorDoc::t_map t_map; int cx = pDoc->header().cx; int cy = pDoc->header().cy; byte* d = new byte[cx * cy]; t_map map = pDoc->map(); int selection_color = 0xffffff; CBrush brush(selection_color); for (t_map::const_iterator i = map.begin(); i != map.end(); i++) { const t_tmp_image_header& header = i->second.header; if (i->second.extra_data.data()) { load_color_table(pDoc->palet()); draw_image8(i->second.extra_data.data(), header.cx_extra, header.cy_extra, pDC, 0, y); if (m_selected == i->first) pDC->FrameRect(CRect(CPoint(header.x_extra - global.x, header.y_extra - global.y - header.height * (cy / 2)), CSize(header.cx_extra, header.cy_extra)), &brush); // pDC->FrameRect(CRect(CPoint(header.x_extra - global.x, header.y_extra - global.y), CSize(header.cx_extra, header.cy_extra)), &brush); if (i->second.extra_z_data.data()) { load_grey_table(32); draw_image8(i->second.extra_z_data.data(), header.cx_extra, header.cy_extra, pDC, cx + y_inc, y); } y += header.cy_extra + y_inc; } decode_tile(i->second.data.data(), d, cx); load_color_table(pDoc->palet()); draw_image8(d, cx, cy, pDC, 0, y); if (m_selected == i->first) { // pDC->FrameRect(CRect(CPoint(header.x - global.x, header.y - global.y), CSize(cx, cy)), &brush); /* int half_cx = cx >> 1; int half_cy = cy >> 1; CPoint tl = CPoint(header.x - global.x, header.y - global.y); CPen pen(PS_SOLID, 1, selection_color); CPen* old_pen = pDC->SelectObject(&pen); pDC->MoveTo(tl + CPoint(half_cx, 0)); pDC->LineTo(tl + CPoint(cx, half_cy)); pDC->LineTo(tl + CPoint(half_cx, cy)); pDC->LineTo(tl + CPoint(0, half_cy)); pDC->LineTo(tl + CPoint(half_cx, 0)); pDC->SelectObject(old_pen); */ } if (i->second.z_data.data()) { decode_tile(i->second.z_data.data(), d, cx); load_grey_table(32); draw_image8(d, cx, cy, pDC, cx + y_inc, y); x = max(x, 2 * cx + y_inc); } y += cy + y_inc; } delete[] d; SetScrollSizes(MM_TEXT, CSize(x, y)); }
//------------------------------------------------------------------------ //! Overrides the custom draw handler, to allow custom coloring of rows. //! - Focus rectangle display //! - Use font size to increase row-height, but keep cell font-size //! - Alternate row coloring //! //! @param owner The list control drawing //! @param pLVCD Pointer to NMLVCUSTOMDRAW structure //! @param pResult Modification to the drawing stage (CDRF_NEWFONT, etc.) //------------------------------------------------------------------------ void CGridRowTraitText::OnCustomDraw(CGridListCtrlEx& owner, NMLVCUSTOMDRAW* pLVCD, LRESULT* pResult) { int nRow = (int)pLVCD->nmcd.dwItemSpec; switch (pLVCD->nmcd.dwDrawStage) { case CDDS_ITEMPREPAINT | CDDS_SUBITEM: { // Remove the selection color for the focus cell, to make it easier to see focus if (m_InvertCellSelection) { int nCol = pLVCD->iSubItem; if (pLVCD->nmcd.uItemState & CDIS_SELECTED) { if (owner.GetFocusCell()==nCol && owner.GetFocusRow()==nRow) { if (owner.GetExtendedStyle() & LVS_EX_FULLROWSELECT) pLVCD->nmcd.uItemState &= ~CDIS_SELECTED; } } } // Bug in Vista causes the cell color from previous cell to be used in the next // even if having reverted the cell coloring in subitem-post-paint if (pLVCD->clrText <= RGB(255,255,255) || pLVCD->clrTextBk <= RGB(255,255,255)) { pLVCD->clrText = 4278190080; pLVCD->clrTextBk = 4278190080; if (UpdateTextColor(nRow, pLVCD->clrText)) *pResult |= CDRF_NEWFONT; if (UpdateBackColor(nRow, pLVCD->clrTextBk)) *pResult |= CDRF_NEWFONT; if (owner.OnDisplayRowColor(nRow, pLVCD->clrText, pLVCD->clrTextBk)) *pResult |= CDRF_NEWFONT; } } break; // Before painting a row case CDDS_ITEMPREPAINT: { if (UpdateTextColor(nRow, pLVCD->clrText)) *pResult |= CDRF_NEWFONT; if (UpdateBackColor(nRow, pLVCD->clrTextBk)) *pResult |= CDRF_NEWFONT; if (owner.OnDisplayRowColor(nRow, pLVCD->clrText, pLVCD->clrTextBk)) *pResult |= CDRF_NEWFONT; LOGFONT newFont = {0}; if (owner.OnDisplayRowFont(nRow, newFont)) { // New font provided CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc); CFont* pNewFont = new CFont; VERIFY( pNewFont->CreateFontIndirect(&newFont) ); m_pOldFont = pDC->SelectObject(pNewFont); m_FontAllocated = true; *pResult |= CDRF_NOTIFYPOSTPAINT; // We need to restore the original font *pResult |= CDRF_NEWFONT; } else { if (owner.GetFont()!=owner.GetCellFont()) { // Using special cell font because of SetMargin() CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc); m_pOldFont = pDC->SelectObject(owner.GetCellFont()); *pResult |= CDRF_NOTIFYPOSTPAINT; // We need to restore the original font *pResult |= CDRF_NEWFONT; } } if (pLVCD->nmcd.uItemState & CDIS_FOCUS) { // If drawing focus row, then remove focus state and request to draw it later // - Row paint request can come twice, with and without focus flag // - Only respond to the one with focus flag, else DrawFocusRect XOR will cause solid or blank focus-rectangle if (owner.GetFocusRow()==nRow) { if (owner.GetFocusCell() >= 0) { // We want to draw a cell-focus-rectangle instead of row-focus-rectangle pLVCD->nmcd.uItemState &= ~CDIS_FOCUS; *pResult |= CDRF_NOTIFYPOSTPAINT; } else if (owner.GetExtendedStyle() & LVS_EX_GRIDLINES) { // Avoid bug where bottom of focus rectangle is missing when using grid-lines // - Draw the focus-rectangle for the entire row (explicit) pLVCD->nmcd.uItemState &= ~CDIS_FOCUS; *pResult |= CDRF_NOTIFYPOSTPAINT; } } } } break; // After painting a row case CDDS_ITEMPOSTPAINT: { if (m_pOldFont!=NULL) { // Restore the original font CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc); CFont* pNewFont = pDC->SelectObject(m_pOldFont); if (m_FontAllocated) { m_FontAllocated = false; delete pNewFont; } m_pOldFont = NULL; } if (CRect(pLVCD->nmcd.rc)==CRect(0,0,0,0)) break; if (owner.GetFocusRow()!=nRow) break; // Perform the drawing of the focus rectangle if (owner.GetFocusCell() >= 0) { // Draw the focus-rectangle for a single-cell CRect rcHighlight; CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc); VERIFY( owner.GetCellRect(nRow, owner.GetFocusCell(), LVIR_BOUNDS, rcHighlight) ); int cxborder = ::GetSystemMetrics(SM_CXBORDER); // When the label column is placed first it has a left-margin if (owner.GetFocusCell()==0 && owner.GetFocusCell()==owner.GetFirstVisibleColumn()) { rcHighlight.left += cxborder*2; } else // Prevent focus rectangle to overlap with cell-image (Only room for this when not first column) if (owner.GetFirstVisibleColumn()!=owner.GetFocusCell()) { rcHighlight.left -= cxborder; } // Adjust rectangle according to grid-lines if (owner.GetExtendedStyle() & LVS_EX_GRIDLINES) { rcHighlight.bottom -= cxborder; } pDC->DrawFocusRect(rcHighlight); } else if (owner.GetExtendedStyle() & LVS_EX_GRIDLINES) { // Avoid bug where bottom of focus rectangle is missing when using grid-lines // - Draw the focus-rectangle for the entire row (explicit) CRect rcHighlight; CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc); // Using LVIR_BOUNDS to get the entire row-rectangle VERIFY( owner.GetItemRect(nRow, rcHighlight, LVIR_BOUNDS) ); // Adjust rectangle according to grid-lines int cxborder = ::GetSystemMetrics(SM_CXBORDER); rcHighlight.bottom -= cxborder; pDC->DrawFocusRect(rcHighlight); } } break; } }
bool CDialogRange::getValue(CWnd* pParent, double& fLower, double& fUpper) { int l = 0; int t = 0; int w = 300; int h = 140; int ch = 21; // control's height int bw = 80; // button width CString s = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW, LoadCursor(NULL, IDC_ARROW), CBrush(::GetSysColor(COLOR_BTNFACE))); if (!CreateEx(WS_EX_DLGMODALFRAME, s, "Set Graph's Upper && Lower limit", WS_SYSMENU | WS_POPUP | WS_BORDER | WS_CAPTION, l, t, w, h, pParent->GetSafeHwnd(), NULL)) return 0; CenterWindow(); DWORD dwStaticStyles = WS_VISIBLE | WS_CHILD | SS_NOPREFIX | SS_RIGHT; DWORD dwEditStyles = WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_AUTOHSCROLL; DWORD dwButtonStyles = WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON; l = 6; t = 6; if (!m_cLowerLegend.Create("Lower Limit", dwStaticStyles, CRect(l,t,l+100,t+ch), this)) return false; l += 120; s.Format("%.2f", fLower); if (!m_cLower.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), s, dwEditStyles, CRect(l,t,l+100,t+ch), this, 1)) return false; l = 6; t += ch + 10; if (!m_cUpperLegend.Create("Upper Limit", dwStaticStyles, CRect(l,t,l+100,t+ch), this)) return false; l += 120; s.Format("%.2f", fUpper); if (!m_cUpper.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), s, dwEditStyles, CRect(l,t,l+100,t+ch), this, 2)) return false; l = w / 2 - (bw + 5); t += ch + 10; if (!m_cOk.Create(_T("OK"), dwButtonStyles, CRect(l, t, l+bw, t+ch), this, IDOK)) return false; l = w / 2 + 5; if (!m_cCancel.Create(_T("Cancel"), dwButtonStyles, CRect(l, t, l+bw, t+ch), this, IDCANCEL)) return false; CFont m_Font; m_Font.CreatePointFont(80, "MS Sans Serif"); m_cLowerLegend.SetFont(&m_Font, false); m_cUpperLegend.SetFont(&m_Font, false); m_cLower.SetFont(&m_Font, false); m_cUpper.SetFont(&m_Font, false); m_cOk.SetFont(&m_Font, false); m_cCancel.SetFont(&m_Font, false); ShowWindow(SW_SHOW); pParent->EnableWindow(false); EnableWindow(true); // enter modal loop DWORD dwFlags = MLF_SHOWONIDLE; if (GetStyle() & DS_NOIDLEMSG) dwFlags |= MLF_NOIDLEMSG; m_cLower.SetFocus(); int nRet = RunModalLoop(MLF_NOIDLEMSG); if (nRet == IDOK) { m_cLower.GetWindowText(s); fLower = atof(s); m_cUpper.GetWindowText(s); fUpper = atof(s); } if (m_hWnd != NULL) SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER); pParent->SetFocus(); if (GetParent() != NULL && ::GetActiveWindow() == m_hWnd) ::SetActiveWindow(pParent->m_hWnd); if (::IsWindow(m_hWnd)) DestroyWindow(); pParent->EnableWindow(true); return true; }