CScribbleView::CScribbleView() { SetScrollSizes(MM_TEXT, CSize(0, 0)); }
void AusReihe::OnPaint() { UpdateData(TRUE); CPaintDC dc(this); // device context for painting dc.FillRect(rahmen, &stdbrush.white); CPen *oldPen = dc.SelectObject(&stdpen.gray1); if (m_xraster) { for (int index = 0; index < DemoData.get_anz_s(); index++) { int x = paddingLeft + rahmen.left + (index*(rahmen.Width() - paddingWidth)) / (DemoData.get_anz_s() - 1); dc.MoveTo(x, rahmen.top + paddingTop); dc.LineTo(x, rahmen.bottom - paddingBottom); } } if (m_yraster) { for (int index = 0; index < anzHorizontalLines; index++) { int y = paddingTop + rahmen.top + (index*(rahmen.Height() - paddingHeight)) / (anzHorizontalLines-1); /*if (y > rahmen.bottom - paddingBottom) y = rahmen.bottom - paddingBottom;*/ dc.MoveTo(rahmen.left + paddingLeft, y); dc.LineTo(rahmen.right - paddingRight, y); } } CSize dataRangeHeight, dataRangeWidth, windowRangeHeight, windowRangeWidth; dataRangeHeight = CSize(DemoData.minimum(m_selection), DemoData.maximum(m_selection)); dataRangeWidth = CSize(0, DemoData.get_anz_s()-1); //windowRangeHeight = CSize(rahmen.top + 1*paddingTop, rahmen.bottom - 1*paddingBottom); windowRangeHeight = CSize(paddingTop, rahmen.Height()-paddingHeight); windowRangeWidth = CSize(rahmen.left + paddingLeft, rahmen.right - 1*paddingRight); //draw null line dc.SelectObject(&stdpen.black2); if ((DemoData.minimum(m_selection) < 0) && (DemoData.maximum(m_selection) > 0)) { int nullLine = rahmen.bottom-scalePoint(0, &dataRangeHeight, &windowRangeHeight); dc.MoveTo(rahmen.left + paddingLeft, nullLine); dc.LineTo(rahmen.right - paddingRight, nullLine); } if (m_darstellung == 0) { CPoint oldP, newP; oldP = CPoint( scalePoint(0, &dataRangeWidth, &windowRangeWidth), rahmen.bottom - scalePoint(DemoData.get_wert(m_selection, 0), &dataRangeHeight, &windowRangeHeight) ); dc.MoveTo(oldP); for (int index = 0; index < DemoData.get_anz_s(); index++) { dc.SelectObject(&stdpen.black5); newP = CPoint( scalePoint(index, &dataRangeWidth, &windowRangeWidth), rahmen.bottom -scalePoint(DemoData.get_wert(m_selection, index), &dataRangeHeight, &windowRangeHeight) ); dc.LineTo(newP); dc.SelectObject(&stdpen.gray3); dc.MoveTo(oldP); dc.LineTo(newP); oldP = newP; } //draw the points dc.SelectObject(&stdbrush.gray); dc.SelectObject(&stdpen.black1); for (int index = 0; index < DemoData.get_anz_s(); index++) { CPoint loc = CPoint( scalePoint(index, &dataRangeWidth, &windowRangeWidth), rahmen.bottom - scalePoint(DemoData.get_wert(m_selection, index), &dataRangeHeight, &windowRangeHeight) ); dc.Ellipse(loc.x - 5, loc.y - 5, loc.x + 5, loc.y + 5); } } else { dc.SelectObject(&stdbrush.gray); dc.SelectObject(&stdpen.black1); for (int index = 0; index < DemoData.get_anz_s(); index++) { int loc = scalePoint(index, &dataRangeWidth, &windowRangeWidth); //dc.Rectangle(loc - 5, rahmen.bottom - scalePoint(0, &dataRangeHeight, &windowRangeHeight), loc + 5, rahmen.bottom - paddingBottom + nullLine - scalePoint(DemoData.get_wert(m_selection, index), &CSize(DemoData.minimum(m_selection), DemoData.maximum(m_selection)), &CSize(0, rahmen.Height() - paddingHeight))); dc.Rectangle(loc, rahmen.bottom - scalePoint(0, &dataRangeHeight, &windowRangeHeight), loc + 10, rahmen.bottom - scalePoint(DemoData.get_wert(m_selection, index), &dataRangeHeight, &windowRangeHeight)); } } //Draw all Selected dc.SelectObject(&stdfont.norm); dc.SelectObject(&stdpen.black1); dc.SelectObject(&stdbrush.yellow); dc.SetBkMode(TRANSPARENT); for (int index = 0; index < DemoData.get_anz_s(); index++) { if (infoflag[index]) { CPoint loc = CPoint( scalePoint(index, &dataRangeWidth, &windowRangeWidth), rahmen.bottom - scalePoint(DemoData.get_wert(m_selection, index), &dataRangeHeight, &windowRangeHeight) ); CRect r = CRect(loc.x, loc.y, 0, 0); CString str; str.Format("%d", DemoData.get_wert(m_selection, index)); dc.DrawText(str, &r, DT_CALCRECT); r.OffsetRect(0, -r.Height()); r.right += 6; dc.Rectangle(&r); dc.DrawText(str, &r, DT_SINGLELINE | DT_CENTER | DT_VCENTER); } } dc.SelectObject(oldPen); }
// Works out an appropriate size and position of this window void CColorPopup::SetWindowSize() { CSize TextSize; // If we are showing a custom or default text area, get the font and text size. if (m_strCustomText.GetLength() || m_strDefaultText.GetLength()) { CClientDC dc(this); CFont* pOldFont = (CFont*) dc.SelectObject(&m_Font); // Get the size of the custom text (if there IS custom text) TextSize = CSize(0,0); if (m_strCustomText.GetLength()) TextSize = dc.GetTextExtent(m_strCustomText); // Get the size of the default text (if there IS default text) if (m_strDefaultText.GetLength()) { CSize DefaultSize = dc.GetTextExtent(m_strDefaultText); if (DefaultSize.cx > TextSize.cx) TextSize.cx = DefaultSize.cx; if (DefaultSize.cy > TextSize.cy) TextSize.cy = DefaultSize.cy; } dc.SelectObject(pOldFont); TextSize += CSize(2*m_nMargin,2*m_nMargin); // Add even more space to draw the horizontal line TextSize.cy += 2*m_nMargin + 2; } // Get the number of columns and rows //m_nNumColumns = (int) sqrt((double)m_nNumColors); // for a square window (yuk) m_nNumColumns = 8; m_nNumRows = m_nNumColors / m_nNumColumns; if (m_nNumColors % m_nNumColumns) m_nNumRows++; // Get the current window position, and set the new size CRect rect; GetWindowRect(rect); m_WindowRect.SetRect(rect.left, rect.top, rect.left + m_nNumColumns*m_nBoxSize + 2*m_nMargin, rect.top + m_nNumRows*m_nBoxSize + 2*m_nMargin); // if custom text, then expand window if necessary, and set text width as // window width if (m_strDefaultText.GetLength()) { if (TextSize.cx > m_WindowRect.Width()) m_WindowRect.right = m_WindowRect.left + TextSize.cx; TextSize.cx = m_WindowRect.Width()-2*m_nMargin; // Work out the text area m_DefaultTextRect.SetRect(m_nMargin, m_nMargin, m_nMargin+TextSize.cx, 2*m_nMargin+TextSize.cy); m_WindowRect.bottom += m_DefaultTextRect.Height() + 2*m_nMargin; } // if custom text, then expand window if necessary, and set text width as // window width if (m_strCustomText.GetLength()) { if (TextSize.cx > m_WindowRect.Width()) m_WindowRect.right = m_WindowRect.left + TextSize.cx; TextSize.cx = m_WindowRect.Width()-2*m_nMargin; // Work out the text area m_CustomTextRect.SetRect(m_nMargin, m_WindowRect.Height(), m_nMargin+TextSize.cx, m_WindowRect.Height()+m_nMargin+TextSize.cy); m_WindowRect.bottom += m_CustomTextRect.Height() + 2*m_nMargin; } // Need to check it'll fit on screen: Too far right? CSize ScreenSize(::GetSystemMetrics(SM_CXSCREEN), ::GetSystemMetrics(SM_CYSCREEN)); if (m_WindowRect.right > ScreenSize.cx) m_WindowRect.OffsetRect(-(m_WindowRect.right - ScreenSize.cx), 0); // Too far left? if (m_WindowRect.left < 0) m_WindowRect.OffsetRect( -m_WindowRect.left, 0); // Bottom falling out of screen? if (m_WindowRect.bottom > ScreenSize.cy) { CRect ParentRect; m_pParent->GetWindowRect(ParentRect); m_WindowRect.OffsetRect(0, -(ParentRect.Height() + m_WindowRect.Height())); } // Set the window size and position MoveWindow(m_WindowRect, TRUE); }
void CMainFrame::SwitchView(ViewType nType) { CView* pOldView=(CView*)m_wndSplit[3]->GetPane(0,1); CCreateContext context; context.m_pCurrentDoc=pOldView->GetDocument(); pOldView->ShowWindow(SW_HIDE); switch(nType) { case COLORCONVERT: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdColor),CSize(0,0),&context); ((CCmdColor*)GetControlView())->OnInitialUpdate(); break; case FILTERING: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdFilter),CSize(0,0),&context); ((CCmdFilter*)GetControlView())->OnInitialUpdate(); break; case FOURIER: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdFourier),CSize(0,0),&context); ((CCmdFourier*)GetControlView())->OnInitialUpdate(); break; case PROJ: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdProjExt),CSize(0,0),&context); ((CCmdProjExt*)GetControlView())->OnInitialUpdate(); break; case BLOB: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdBlob),CSize(0,0),&context); ((CCmdBlob*)GetControlView())->OnInitialUpdate(); break; case COORD: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdCoord),CSize(0,0),&context); ((CCmdCoord*)GetControlView())->OnInitialUpdate(); break; case GEO: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdGF),CSize(0,0),&context); ((CCmdGF*)GetControlView())->OnInitialUpdate(); break; case STAT: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdSF),CSize(0,0),&context); ((CCmdSF*)GetControlView())->OnInitialUpdate(); break; case TEMP: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdTM),CSize(0,0),&context); ((CCmdTM*)GetControlView())->OnInitialUpdate(); break; case TH: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdTh),CSize(0,0),&context); ((CCmdTh*)GetControlView())->OnInitialUpdate(); break; case VER: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdVer),CSize(0,0),&context); ((CCmdVer*)GetControlView())->OnInitialUpdate(); break; case ALU: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdAlu),CSize(0,0),&context); ((CCmdAlu*)GetControlView())->OnInitialUpdate(); break; case FMMNN: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdFMMNN),CSize(0,0),&context); ((CCmdFMMNN*)GetControlView())->OnInitialUpdate(); break; case FNN: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdFNN),CSize(0,0),&context); ((CCmdFNN*)GetControlView())->OnInitialUpdate(); break; case NN: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdNN),CSize(0,0),&context); ((CCmdNN*)GetControlView())->OnInitialUpdate(); break; case EIGEN: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdEigen),CSize(0,0),&context); ((CCmdEigen*)GetControlView())->OnInitialUpdate(); break; case MOTION: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdMotion),CSize(0,0),&context); ((CCmdMotion*)GetControlView())->OnInitialUpdate(); break; case DEPTH: m_wndSplit[3]->DeleteView(0,1); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdDepth),CSize(0,0),&context); ((CCmdDepth*)GetControlView())->OnInitialUpdate(); break; default: break; } m_wndSplit[3]->RecalcLayout(); }
void CBCGPRecentFilesListBox::OnDrawItemContent(CDC* pDC, CRect rect, int nIndex) { if (IsSeparatorItem(nIndex)) { CBCGPListBox::OnDrawItemContent(pDC, rect, nIndex); return; } if (nIndex >= 0 && nIndex < m_arIcons.GetSize()) { HICON hIcon = m_arIcons[nIndex]; if (hIcon != NULL) { CSize sizeIcon = CSize (32, 32); if (globalData.GetRibbonImageScale () != 1.) { sizeIcon.cx = (int) (.5 + globalData.GetRibbonImageScale () * sizeIcon.cx); sizeIcon.cy = (int) (.5 + globalData.GetRibbonImageScale () * sizeIcon.cy); } ::DrawIconEx (pDC->GetSafeHdc (), rect.left + 3, rect.top + max(0, (rect.Height() - sizeIcon.cy) / 2), hIcon, sizeIcon.cx, sizeIcon.cy, 0, NULL, DI_NORMAL); rect.left += sizeIcon.cx + 1; } } CRect rectText = rect; rectText.DeflateRect (10, 0); CString strText; GetText (nIndex, strText); int nPathIndex = strText.Find(_T("\n")); if (nPathIndex < 0) { pDC->DrawText (strText, rectText, DT_LEFT); } else { CString strName = strText.Left(nPathIndex); CString strPath = strText.Mid(nPathIndex + 1); const int nMargin = max(0, (rectText.Height() - pDC->GetTextExtent(strName).cy - pDC->GetTextExtent(strPath).cy) / 3); UINT uiDTFlags = DT_SINGLELINE | DT_END_ELLIPSIS; CFont* pOldFont = pDC->SelectObject (&globalData.fontBold); ASSERT (pOldFont != NULL); rectText.top += nMargin; int nTextHeight = pDC->DrawText(strName, rectText, uiDTFlags); pDC->SelectObject (pOldFont); rectText.top += nTextHeight + nMargin; pDC->DrawText(strPath, rectText, uiDTFlags); } }
/* 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(); RECT 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_viewTreeList.Create( *this, rcDefault, NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); m_viewTreeList.Initialize(); 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); 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; }
CSketcherView::CSketcherView(): m_FirstPoint(CPoint(0,0)), m_SecondPoint(CPoint(0,0)), m_pTempElement(nullptr), m_pSelected(nullptr), m_MoveMode(false), m_CursorPos(CPoint(0,0)), m_FirstPos(CPoint(0,0)), m_Scale(1) { SetScrollSizes(MM_TEXT, CSize(0,0)); // Set arbitrary scrollers }
////////////////// // Get size information for a single entry (WINRECT). Returns size info in // the SIZEINFO argument. For a group, calculate size info as aggregate of // subentries. // void CWinMgr::OnGetSizeInfo(SIZEINFO& szi, WINRECT* wrc, CWnd* pWnd) { szi.szMin = SIZEZERO; // default min size = zero szi.szMax = SIZEMAX; // default max size = infinite szi.szDesired = wrc->GetRect().Size(); // default desired size = current if (wrc->IsGroup()) { // For groups, calculate min, max, desired size as aggregate of children szi.szDesired = SIZEZERO; BOOL bRow = wrc->IsRowGroup(); CWinGroupIterator it; for (it=wrc; it; it.Next()) { WINRECT* wrc2 = it; SIZEINFO szi2; OnGetSizeInfo(szi2, wrc2, pWnd); if (bRow) { szi.szMin.cx = max(szi.szMin.cx, szi2.szMin.cx); szi.szMin.cy += szi2.szMin.cy; szi.szMax.cx = min(szi.szMax.cx, szi2.szMax.cx); szi.szMax.cy = min(szi.szMax.cy + szi2.szMax.cy, INFINITY); szi.szDesired.cx = max(szi.szDesired.cx, szi2.szDesired.cx); szi.szDesired.cy += szi2.szDesired.cy; } else { szi.szMin.cx += szi2.szMin.cx; szi.szMin.cy = max(szi.szMin.cy, szi2.szMin.cy); szi.szMax.cx = min(szi.szMax.cx + szi2.szMax.cx, INFINITY); szi.szMax.cy = min(szi.szMax.cy, szi2.szMax.cy); szi.szDesired.cx += szi2.szDesired.cx; szi.szDesired.cy = max(szi.szDesired.cy, szi2.szDesired.cy); } } // Add margins. int w2,h2; wrc->GetMargins(w2,h2); // get margins w2<<=1; h2<<=1; // double szi.szMin.cx += max(0,w2); // negative margins ==> don't include in min szi.szMin.cy += max(0,h2); // ditto szi.szDesired.cx += abs(w2); // for desired size, use abs vallue szi.szDesired.cy += abs(h2); // ditto } else { // not a group WINRECT* parent = wrc->Parent(); ASSERT(parent); CRect& rcParent = parent->GetRect(); BOOL bRow = parent->IsRowGroup(); int hw, hwMin, hwTotal, pct; switch (wrc->Type()) { case WRCT_FIXED: hw = hwMin = wrc->GetParam(); // ht/wid is parameter if (hw<0) { // if fixed val is negative: hw = -hw; // use absolute val for desired.. hwMin = 0; // ..and zero for minimum } if (bRow) { szi.szMax.cy = szi.szDesired.cy = hw; szi.szMin.cy = hwMin; } else { szi.szMax.cx = szi.szDesired.cx = hw; szi.szMin.cx = hwMin; } break; case WRCT_PCT: pct = wrc->GetParam(); ASSERT(0<pct && pct<100); hwTotal = bRow ? rcParent.Height() : rcParent.Width(); hw = (hwTotal * pct) / 100; szi.szDesired = bRow ? CSize(rcParent.Width(), hw) : CSize(hw, rcParent.Height()); break; case WRCT_TOFIT: if (wrc->HasToFitSize()) { szi.szDesired = wrc->GetToFitSize(); } break; case WRCT_REST: break; default: ASSERT(FALSE); } // If the entry is a window, send message to get min/max/tofit size. // Only set tofit size if type is TOFIT. // if (wrc->IsWindow() && pWnd) { CWnd* pChild = pWnd->GetDlgItem(wrc->GetID()); if (pChild) { if (!pChild->IsWindowVisible() && pWnd->IsWindowVisible()) { // parent visible but child not ==> tofit size is zero // important so hidden windows use no space szi.szDesired = SIZEZERO; } else { szi.szAvail = rcParent.Size(); SendGetSizeInfo(szi, pWnd, wrc->GetID()); } } } //20090813 add by fangly being:增加对普通图元的处理 if(wrc->IsChart() && wrc->Type()) { szi.szAvail = rcParent.Size(); SendGetSizeInfo2(szi, pWnd, wrc->RectInfo()); } //end szi.szDesired = maxsize(minsize(szi.szDesired,szi.szMax), szi.szMin); } }
void ImageProcessorDlg::Impl::test(ViewPane& view) { #if 0 CImageDecoderPtr d= photos_[0]->GetDecoder(); Dib bmp; CSize size(500,500); if (d->DecodeImg(bmp, size, false) != IS_OK) return; size = CSize(bmp.GetWidth(), bmp.GetHeight()); ExceptionInfo exc; GetExceptionInfo(&exc); Image* img= ConstituteImage(bmp.GetWidth(), bmp.GetHeight(), "RGB", CharPixel, bmp.GetBuffer(), &exc); if (img) { double radius= 10.0; double sigma= 1.0; double amount= 1.0; double threshold= 0.01; // Image* sharp= UnsharpMaskImage(img, radius, sigma, amount, threshold, &exc); int w= size.cy * 16 / 9; Image* sharp= LiquidRescaleImage(img, w, size.cy, 1.0, 0.0, &exc); if (sharp) { //ImageInfo ii; //GetImageInfo(&ii); //strcpy(sharp->filename, "c:\\sharp.img"); size.cx = sharp->columns; size.cy = sharp->rows; const PixelPacket* pix= AcquireImagePixels(sharp, 0, 0, size.cx, size.cy, &exc); Dib b(size.cx, size.cy, 24); for (int y= size.cy - 1; y >= 0; --y) { BYTE* line= b.LineBuffer(y); for (int x= 0; x < size.cx; ++x) { line[0] = pix->red; line[1] = pix->green; line[2] = pix->blue; line += 3; pix++; } } b.Swap(bmp); DestroyImage(sharp); } DestroyImage(img); } view.DisplayBitmap(bmp); bmp.Save(L"c:\\resized.bmp"); #endif }
//////////////////////////////////////////////////////////////////////////////// // // FUNCTION: GetSize // // DESCRIPTION: Returns Width and Height object // // RETURNS: // // NOTES: // // MODIFICATIONS: // // Name Date Version Comments // N T ALMOND 29012002 1.0 Origin // //////////////////////////////////////////////////////////////////////////////// CSize ImageEx::GetSize() { return CSize(GetWidth(), GetHeight()); }
DWORD CmdDrawZoom::CmdDrawAjustZooming::SetPoint(DWORD MouseAction, CPoint pt) { CmdDrawZoom *p = dynamic_cast<CmdDrawZoom*>(m_pOwner); if (enCmdMouseNone == MouseAction) { LP_MATERIALINFO pTempInfo = p->m_pReceiver->getComicStripData()->getSelectedInfo(); if (NULL == pTempInfo) { return FALSE; } CSize size = CSize(pt.x - pTempInfo->GetLTPoint().x, pt.y - pTempInfo->GetLTPoint().y); size.cx = max(size.cx, 24); size.cy = max(size.cy, 24); pTempInfo->SetFinalSize(size); if (pTempInfo->isPenDraw) { int width = pTempInfo->m_image.GetWidth(); int height = pTempInfo->m_image.GetHeight(); if (width<size.cx || height<size.cy) { int newWidth = max(width, size.cx); int newHeight = max(height, size.cy); CxImage tempImage = pTempInfo->m_image; pTempInfo->m_image.Create(newWidth, newHeight, 24, CXIMAGE_FORMAT_PNG); RGBQUAD rgb = pTempInfo->m_image.GetPixelColor(1,1); pTempInfo->m_image.SetTransIndex(0); pTempInfo->m_image.SetTransColor(rgb); HDC memdcOrg = CreateCompatibleDC(NULL); HBITMAP hbitmapOrg = tempImage.MakeBitmap(); HGDIOBJ pOldGDIOBJOrg = SelectObject(memdcOrg, hbitmapOrg); HDC memdc = CreateCompatibleDC(NULL); HBITMAP hbitmap = pTempInfo->m_image.MakeBitmap(); HGDIOBJ pOldGDIOBJ = SelectObject(memdc, hbitmap); BitBlt(memdc, 0, 0, width, height, memdcOrg, 0, 0, SRCCOPY); pTempInfo->m_image.CreateFromHBITMAP(hbitmap); SelectObject(memdc, pOldGDIOBJ); DeleteObject(hbitmap); DeleteDC(memdc); SelectObject(memdcOrg, pOldGDIOBJOrg); DeleteObject(hbitmapOrg); DeleteDC(memdcOrg); } } p->m_pReceiver->UpdateComicStrip(pTempInfo->nIDOwner); } else if (enCmdMouseLUp == MouseAction) { LP_MATERIALINFO pTempInfo = p->m_pReceiver->getComicStripData()->getSelectedInfo(); if (NULL == pTempInfo) { return FALSE; } CSize size = CSize(pt.x - pTempInfo->GetLTPoint().x, pt.y - pTempInfo->GetLTPoint().y); size.cx = max(size.cx, 24); size.cy = max(size.cy, 24); pTempInfo->SetFinalSize(size); if (pTempInfo->isPenDraw) { int width = pTempInfo->m_image.GetWidth(); int height = pTempInfo->m_image.GetHeight(); if (width<size.cx || height<size.cy) { CxImage tempImage = pTempInfo->m_image; pTempInfo->m_image.Create(size.cx, size.cy, 24, CXIMAGE_FORMAT_PNG); RGBQUAD rgb = pTempInfo->m_image.GetPixelColor(1,1); pTempInfo->m_image.SetTransIndex(0); pTempInfo->m_image.SetTransColor(rgb); HDC memdcOrg = CreateCompatibleDC(NULL); HBITMAP hbitmapOrg = tempImage.MakeBitmap(); HGDIOBJ pOldGDIOBJOrg = SelectObject(memdcOrg, hbitmapOrg); HDC memdc = CreateCompatibleDC(NULL); HBITMAP hbitmap = pTempInfo->m_image.MakeBitmap(); HGDIOBJ pOldGDIOBJ = SelectObject(memdc, hbitmap); BitBlt(memdc, 0, 0, width, height, memdcOrg, 0, 0, SRCCOPY); pTempInfo->m_image.CreateFromHBITMAP(hbitmap); SelectObject(memdc, pOldGDIOBJ); DeleteObject(hbitmap); DeleteDC(memdc); SelectObject(memdcOrg, pOldGDIOBJOrg); DeleteObject(hbitmapOrg); DeleteDC(memdcOrg); } } p->m_pReceiver->SaveFile(); p->m_pReceiver->UpdateComicStrip(pTempInfo->nIDOwner); p->m_pDsState = &p->m_dsZoomBgn; p->m_pReceiver->SetCursor(); p->m_nDrawState = enDrawIdle; } return TRUE; }
BOOL CSplash::OnInitDialog() { CDialog::OnInitDialog(); CString strFileName; strFileName.Format("%s",LoginInformation.path); strFileName+="splash.bmp"; hbmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), \ strFileName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION|LR_LOADFROMFILE); ////////////////////该断程序用来取得加载的BMP的信息//////////////////////// m_bitmap.Attach( hbmp ); // DIBSECTION ds; // BITMAPINFOHEADER &bminfo = ds.dsBmih; m_bitmap.GetObject( sizeof(BITMAP), &bmp ); // TODO: Add extra initialization here /* m_bitmap.LoadBitmap(IDB_BITMAP_SPLASH); BITMAP bmp; m_bitmap.GetObject(sizeof(BITMAP),&bmp); */ CRect rtOld,rtProgress; GetWindowRect(rtOld); CPoint point = rtOld.TopLeft();//pl(bmp.bmWidth-100,bmp.bmHeight-50),pr(bmp.bmWidth-10,bmp.bmHeight-20); CRect rtNew = CRect(point,CSize(bmp.bmWidth,bmp.bmHeight)); MoveWindow(rtNew); //调整流动条控件位置 rtProgress.left=20; rtProgress.top=bmp.bmHeight-52; rtProgress.right=bmp.bmWidth-20; rtProgress.bottom=rtProgress.top+30; m_progress.MoveWindow(rtProgress); ::SetWindowPos(GetSafeHwnd() , HWND_TOPMOST , rtNew.left ,rtNew.top , rtNew.Width() , rtNew.Height(), SWP_NOSIZE ); CenterWindow(); AnimateWindow(m_hWnd,300,AW_SLIDE|AW_CENTER); Invalidate(); // DWORD pid; // ::CreateThread(NULL,NULL,::ConnectData,(LPVOID)this,0,&pid); // ::CreateThread(NULL,NULL,Schedule,(LPVOID)this,0,&pid); // UINT connectData(LPVOID); AfxBeginThread(ConnectData,(LPVOID)this); AfxBeginThread(Schedule,(LPVOID)this); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CShaderEdit::OnUpdate() { if (m_nIDEvent == (UINT_PTR)-1) { m_nIDEvent = SetTimer(1, 100, NULL); } CString text; int nStartChar = 0, nEndChar = -1; GetSel(nStartChar, nEndChar); if (nStartChar == nEndChar) { GetWindowText(text); while (nStartChar > 0 && _istalnum(text.GetAt(nStartChar-1))) { nStartChar--; } } if (nStartChar < nEndChar) { text = text.Mid(nStartChar, nEndChar - nStartChar); text.TrimRight('('); text.MakeLower(); m_acdlg.m_list.ResetContent(); CString key, value; POSITION pos = m_acdlg.m_inst.GetStartPosition(); while (pos) { POSITION cur = pos; m_acdlg.m_inst.GetNextAssoc(pos, key, value); if (key.Find(text) == 0) { CAtlList<CString> sl; Explode(value, sl, '|', 2); if (sl.GetCount() != 2) { continue; } CString name = sl.RemoveHead(); CString description = sl.RemoveHead(); int i = m_acdlg.m_list.AddString(name); m_acdlg.m_list.SetItemDataPtr(i, cur); } } if (m_acdlg.m_list.GetCount() > 0) { int lineheight = GetLineHeight(); CPoint p = PosFromChar(nStartChar); p.y += lineheight; ClientToScreen(&p); CRect r(p, CSize(100, 100)); m_acdlg.MoveWindow(r); m_acdlg.SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); m_acdlg.ShowWindow(SW_SHOWNOACTIVATE); m_nEndChar = nEndChar; return; } } m_acdlg.ShowWindow(SW_HIDE); }
DWORD CRichtextLayout::CalcSize(CCalcInfo* pci, SIZE* psize, SIZE* psizeDefault) { Assert(ElementOwner()); Assert(pci); Assert(psize); CScopeFlag csfCalcing(this); CRichtext* pTextarea = DYNCAST(CRichtext, ElementOwner()); Listen(); CSaveCalcInfo sci(pci, this); CSize sizeOriginal; DWORD grfReturn; GetSize(&sizeOriginal); if(_fForceLayout) { pci->_grfLayout |= LAYOUT_FORCE; _fForceLayout = FALSE; } grfReturn = (pci->_grfLayout & LAYOUT_FORCE); if(pci->_grfLayout & LAYOUT_FORCE) { _fSizeThis = TRUE; _fAutoBelow = FALSE; _fPositionSet = FALSE; _fContainsRelative = FALSE; } BOOL fRecalcText = FALSE; BOOL fNormalMode = pci->_smMode==SIZEMODE_NATURAL || pci->_smMode==SIZEMODE_SET || pci->_smMode==SIZEMODE_FULLSIZE; BOOL fWidthChanged = (fNormalMode ? psize->cx!=sizeOriginal.cx : FALSE); BOOL fHeightChanged = (fNormalMode ? psize->cy!=sizeOriginal.cy : FALSE); fRecalcText = (fNormalMode && (IsDirty() || _fSizeThis || fWidthChanged || fHeightChanged)) || (pci->_grfLayout&LAYOUT_FORCE) || (pci->_smMode==SIZEMODE_MMWIDTH && !_fMinMaxValid) || (pci->_smMode==SIZEMODE_MINWIDTH && (!_fMinMaxValid || _xMin<0)); // If this site is in need of sizing, then size it if(fRecalcText) { //BUGBUG (gideons) should modify Cols and Rows if user resizes CUnitValue uvWidth = pTextarea->GetFirstBranch()->GetCascadedwidth(); CUnitValue uvHeight = pTextarea->GetFirstBranch()->GetCascadedheight(); int charX = 1; int charY = 1; // If dirty, ensure display tree nodes exist if(_fSizeThis && (EnsureDispNode(pci, (grfReturn&LAYOUT_FORCE))==S_FALSE)) { grfReturn |= LAYOUT_HRESIZE | LAYOUT_VRESIZE; } SetWrap(); _fContentsAffectSize = FALSE; if(uvWidth.IsNullOrEnum() || uvHeight.IsNullOrEnum()) { charX = pTextarea->GetAAcols(); Assert(charX > 0); charY = pTextarea->GetAArows(); Assert(charY > 0); } grfReturn |= CalcSizeHelper(pci, charX, charY, psize); if(fNormalMode) { grfReturn |= super::CalcSize(pci, psize); } if(psizeDefault) { *psizeDefault = *psize; } // If size changes occurred, size the display nodes if(fNormalMode && grfReturn&(LAYOUT_FORCE|LAYOUT_HRESIZE|LAYOUT_VRESIZE)) { SizeDispNode(pci, *psize); SizeContentDispNode(CSize(_dp.GetMaxWidth(), _dp.GetHeight())); } if(pci->_smMode == SIZEMODE_MMWIDTH) { // for minmax mode min width is returned in cy. _xMin = psize->cy = psize->cx; } } else { grfReturn = super::CalcSize(pci, psize); } return grfReturn; }
//****************************************************************************** void CBCGPRibbonLabel::OnCalcTextSize (CDC* pDC) { ASSERT_VALID (this); ASSERT_VALID (pDC); if (IsMenuMode () || m_bIsPaletteGroup || !m_bIsAlwaysLarge) { CFont* pOldFont = NULL; if (IsMenuMode () || m_bIsPaletteGroup) { pOldFont = pDC->SelectObject (&globalData.fontBold); ASSERT_VALID (pOldFont); } CBCGPRibbonButton::OnCalcTextSize (pDC); if (pOldFont != NULL) { pDC->SelectObject (pOldFont); } return; } //------------------ // Multi-line label: //------------------ ASSERT_VALID (m_pParent); const CSize sizeImageLarge = m_pParent->GetImageSize (TRUE); if (sizeImageLarge == CSize (0, 0)) { ASSERT (FALSE); return; } const int nMaxHeight = 2 * sizeImageLarge.cy; int nTextHeight = 0; int nTextWidth = 0; CString strText = m_strText; for (int dx = 10; dx < 200; dx += 10) { CRect rectText (0, 0, dx, 10000); nTextHeight = pDC->DrawText (strText, rectText, DT_WORDBREAK | DT_CALCRECT); nTextWidth = rectText.Width (); if (nTextHeight <= nMaxHeight && nTextWidth >= nTextHeight) { break; } } m_sizeTextRight.cx = nTextWidth; m_sizeTextRight.cy = nTextHeight; }
void CMainFrame::InitializeRibbon() { CString strTemp; strTemp.LoadString(IDS_RIBBON_FILE); // Load panel images: m_PanelImages.SetImageSize(CSize(16, 16)); m_PanelImages.Load(IDB_BUTTONS); // Init main button: m_MainButton.SetImage(IDB_MAIN_AMT); m_MainButton.SetText(_T("\nf")); m_MainButton.SetToolTipText(strTemp); m_wndRibbonBar.SetApplicationButton(&m_MainButton, CSize (45, 45)); CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(strTemp, IDB_AMT_FILESMALL, IDB_AMT_FILELARGE); strTemp.LoadString(IDS_RIBBON_NEW); pMainPanel->Add(new CMFCRibbonButton(ID_EDIT_REFRESH, _T("Refresh\nr"), 25, 14)); pMainPanel->Add(new CMFCRibbonSeparator(TRUE)); strTemp.LoadString(IDS_RIBBON_PRINT); CMFCRibbonButton* pBtnPrint = new CMFCRibbonButton(ID_FILE_PRINT, strTemp, 6, 6); pBtnPrint->SetKeys(_T("p"), _T("w")); strTemp.LoadString(IDS_RIBBON_PRINT_LABEL); pBtnPrint->AddSubItem(new CMFCRibbonLabel(strTemp)); strTemp.LoadString(IDS_RIBBON_PRINT); pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT, strTemp, 7, 7, TRUE)); strTemp.LoadString(IDS_RIBBON_PRINT_SETUP); pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_SETUP, strTemp, 11, 11, TRUE)); pMainPanel->Add(pBtnPrint); pMainPanel->Add(new CMFCRibbonSeparator(TRUE)); pMainPanel->Add(new CMFCRibbonButton(ID_FILE_LOGOUT, _T("&Logout"), 0, 0, TRUE)); //pMainPanel->Add(new CMFCRibbonSeparator(TRUE)); //strTemp.LoadString(IDS_RIBBON_CLOSE); //pMainPanel->Add(new CMFCRibbonButton(ID_FILE_CLOSE, strTemp, 9, 9)); strTemp.LoadString(IDS_RIBBON_RECENT_DOCS); pMainPanel->AddRecentFilesList(strTemp); strTemp.LoadString(IDS_RIBBON_EXIT); pMainPanel->AddToBottom(new CMFCRibbonMainPanelButton(ID_APP_EXIT, strTemp, 15)); // Add "Home" category with "Clipboard" panel: strTemp.LoadString(IDS_RIBBON_HOME); CMFCRibbonCategory* pCategoryHome = m_wndRibbonBar.AddCategory(strTemp, IDB_AMT_WRITESMALL, IDB_AMT_WRITELARGE); // Create "Clipboard" panel: strTemp.LoadString(IDS_RIBBON_CLIPBOARD); CMFCRibbonPanel* pPanelClipboard = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon(27)); strTemp.LoadString(IDS_RIBBON_PASTE); CMFCRibbonButton* pBtnPaste = new CMFCRibbonButton(ID_EDIT_PASTE, strTemp, 0, 0); pPanelClipboard->Add(pBtnPaste); strTemp.LoadString(IDS_RIBBON_CUT); pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_CUT, strTemp, 1)); strTemp.LoadString(IDS_RIBBON_COPY); pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_COPY, strTemp, 2)); // Create "Filter" panel: CMFCRibbonPanel* pPanelFilter = pCategoryHome->AddPanel(_T("Filter")); pPanelFilter->Add(new CMFCRibbonButton(ID_EDIT_SHOW_ALL, _T("Show All\ns"), 16)); pPanelFilter->AddSeparator(); pPanelFilter->Add(new CMFCRibbonCheckBox(ID_EDIT_SHOW_ORPHANS, _T("Show Orphans\no"))); pPanelFilter->Add(new CMFCRibbonCheckBox(ID_EDIT_SHOW_NOT_MATCHING, _T("Show Differences\nd"))); pPanelFilter->Add(new CMFCRibbonCheckBox(ID_EDIT_SHOW_MATCHING, _T("Show Matching\nm"))); CMFCRibbonPanel* pPanelSelection = pCategoryHome->AddPanel(_T("Selection")); strTemp.LoadString(IDS_RIBBON_SELECTALL); pPanelSelection->Add(new CMFCRibbonButton(ID_EDIT_SELECT_ALL, strTemp, 21)); pPanelSelection->Add(new CMFCRibbonButton(ID_EDIT_CLEARALL, _T("Clear All\na"), 22)); pPanelSelection->Add(new CMFCRibbonButton(ID_EDIT_EXPANDALL, _T("Expand All"), 23)); pPanelSelection->AddSeparator(); pPanelSelection->Add(new CMFCRibbonButton(ID_EDIT_ADDTOREP, _T("Migrate\nm"), 14)); CMFCRibbonPanel* pPanelView = pCategoryHome->AddPanel(_T("View")); pPanelView->Add(new CMFCRibbonCheckBox(ID_VIEW_CRLF, _T("CR/LF"))); pPanelView->Add(new CMFCRibbonCheckBox(ID_VIEW_WHITESPACE, _T("Whitespace"))); CMFCRibbonPanel* pPanelDiferences = pCategoryHome->AddPanel(_T("Differences")); pPanelDiferences->Add(new CMFCRibbonButton(ID_DIFFERENCES_PREVIOUS, _T("Previous\nn"))); pPanelDiferences->Add(new CMFCRibbonButton(ID_DIFFERENCES_NEXT, _T("Next\np"))); CMFCRibbonPanel* pPanelDependees = pCategoryHome->AddPanel(_T("Dependees")); pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_FINDSERVICES, _T("Find Services"))); pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_CALCULATEDEPENDENCIES, _T("Recalculate Cache"))); pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_CALCULATECROSSREFERENCE, _T("Calculate Crossreference"))); pPanelDependees->AddSeparator(); pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_SYNCFROMSELECTION, _T("Sync From Selection"))); pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_SYNCTOSELECTION, _T("Sync To Selection"))); pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_COPYCROSSREFERENCE, _T("Copy Crossreference"))); // Add elements to the right side of tabs: strTemp.LoadString(IDS_RIBBON_STYLE); CMFCRibbonButton* pVisualStyleButton = new CMFCRibbonButton(-1, strTemp, -1, -1); pVisualStyleButton->SetMenu(IDR_THEME_MENU, FALSE /* No default command */, TRUE /* Right align */); strTemp.LoadString(IDS_RIBBON_STYLE_TIP); pVisualStyleButton->SetToolTipText(strTemp); strTemp.LoadString(IDS_RIBBON_STYLE_DESC); pVisualStyleButton->SetDescription(strTemp); m_wndRibbonBar.AddToTabs(pVisualStyleButton); // Add quick access toolbar commands: CList<UINT, UINT> lstQATCmds; lstQATCmds.AddTail(ID_EDIT_REFRESH); lstQATCmds.AddTail(ID_FILE_LOGOUT); lstQATCmds.AddTail(ID_FILE_PRINT); m_wndRibbonBar.SetQuickAccessCommands(lstQATCmds); m_wndRibbonBar.AddToTabs(new CMFCRibbonButton(ID_APP_ABOUT, _T("\na"), m_PanelImages.ExtractIcon(0))); }
CSize CGridCellCheck::GetCellExtent(CDC* pDC) { // Using SM_CXHSCROLL as a guide to the size of the checkbox int nWidth = GetSystemMetrics(SM_CXHSCROLL) + 2*GetMargin(); return CGridCell::GetCellExtent(pDC) + CSize(nWidth, nWidth); }
// IBasicVideo STDMETHODIMP CRealMediaGraph::SetDestinationPosition(long Left, long Top, long Width, long Height)// {return E_NOTIMPL;} { m_pRMP->SetDestRect(CRect(CPoint(Left, Top), CSize(Width, Height))); return S_OK; }
void CXTPDockingPaneSplitterContainer::_AdjustPanesLength(CXTPDockingPaneManager* pManager, CXTPDockingPaneBaseList& lst, CRect rect, BOOL bHoriz, BOOL bApply, int& nTotalLength, int& nLengthAvail) { nTotalLength = 0; nLengthAvail = 0; CXTPDockingPaneBase* pClientPane = NULL; CXTPDockingPaneBase* pClient = pManager->GetClientPane(); int nSplitterSize = pManager->GetPaintManager()->m_nSplitterSize; POSITION pos = lst.GetHeadPosition(); while (pos) { CXTPDockingPaneBase* pPane = lst.GetNext(pos); pPane->m_nLength = bHoriz ? pPane->m_szDocking.cx : pPane->m_szDocking.cy; MINMAXINFO mmi; pPane->GetMinMaxInfo(&mmi); pPane->m_nLength = max(GetMinSize(&mmi, bHoriz), min(GetMaxSize(&mmi, bHoriz), pPane->m_nLength)); if (pClientPane == NULL && pPane->ContainPane(pClient)) { if (!pManager->m_bHideClient || pPane->m_szDocking == CSize(0, 0)) { pClientPane = pPane; if (bApply) pClientPane->m_szDocking = CSize(0, 0); pClientPane->m_nLength = 0; } } nTotalLength += pPane->m_nLength; } nLengthAvail = (bHoriz ? rect.Width() : rect.Height()) - (nSplitterSize * ((int)lst.GetCount() - 1)); if (pClientPane && nTotalLength < nLengthAvail) { pClientPane->m_nLength = nLengthAvail - nTotalLength; if (bApply) { if (bHoriz) pClientPane->m_szDocking.cx = pClientPane->m_nLength; else pClientPane->m_szDocking.cy = pClientPane->m_nLength; } nTotalLength = nLengthAvail; } if (nLengthAvail > 0) { pos = lst.GetHeadPosition(); while (pos) { CXTPDockingPaneBase* pPane = lst.GetNext(pos); if ((pPane->m_nLength < 0) || (nTotalLength == 0)) continue; MINMAXINFO mmi; pPane->GetMinMaxInfo(&mmi); int nLength = pPane->m_nLength; if (nLengthAvail * nLength / nTotalLength < GetMinSize(&mmi, bHoriz)) pPane->m_nLength = -GetMinSize(&mmi, bHoriz); else if (nLengthAvail * nLength / nTotalLength > GetMaxSize(&mmi, bHoriz)) pPane->m_nLength = -GetMaxSize(&mmi, bHoriz); if (pPane->m_nLength < 0) { nLengthAvail += pPane->m_nLength; nTotalLength -= nLength; if (nLengthAvail < 0) { pPane->m_nLength -= nLengthAvail; nLengthAvail = 0; break; } pos = lst.GetHeadPosition(); } } } }
void CWndCredit::OnInitialUpdate() { CWndNeuz::OnInitialUpdate(); // 모래시계로 커서 변경 SetMouseCursor( CUR_DELAY ); // 여기에 코딩하세요 { CResFile file; CString strfile; #ifdef __FOR_PROLOGUE_UPDATE if( ::GetLanguage() != LANG_KOR ) strfile = MakePath( "Theme\\", ::GetLanguage(), _T( "Openning.inc" ) ); #else //__FOR_PROLOGUE_UPDATE if( ::GetLanguage() == LANG_JAP ) strfile = "Theme\\Japanese\\Openning.inc"; #endif //__FOR_PROLOGUE_UPDATE else strfile = "credit.txt"; if( file.Open( strfile.GetBuffer(0), "rb" ) ) { int nLength = file.GetLength(); TCHAR* pChar = new TCHAR[ nLength + 1]; file.Read( pChar, nLength ); pChar[ nLength ] = 0; TCHAR* prog = pChar; m_strArray.RemoveAll(); // while( ( *prog > 0 && *prog <= 0x20 ) && *prog ) // prog++; while( *prog != '\0' ) { TCHAR szString[ 256 ]; TCHAR* temp = szString; while( *prog && ( *prog > 0 && *prog <= 0x20 ) && *prog != '\r' && *prog != '\0' ) prog++; while( *prog!='\r' && *prog!='\0' ) *temp++ = *prog++; if( *prog == '\r') prog++; // skim comma // white space를 스킵 if( temp != szString ) { temp--; while( ( *temp > 0 && *temp <= 0x20 ) && *temp ) temp--; temp++; } *temp = '\0'; m_strArray.Add( szString ); } safe_delete( pChar ); } } m_timerScreenShot.Set( SEC( 10 ) ); if( ::GetLanguage() == LANG_JAP ) { int i; for( i = 0; i < MAX_SCREENSHOT_JAP; i++ ) { CString string; string.Format( "shotCredit%02d.dds", i ); //string = "shotCredit20.dds"; m_aTexScreenShot[ i ].LoadTexture( m_pApp->m_pd3dDevice, MakePath( "Theme\\Japanese\\", string ), 0xffff00ff ); m_aTexScreenShot[ i ].m_size = CSize( 598 + 76, 337 ); } } else { int i; for( i = 0; i < MAX_SCREENSHOT; i++ ) { CString string; string.Format( "shotCredit%02d.dds", i ); //string = "shotCredit20.dds"; m_aTexScreenShot[ i ].LoadTexture( m_pApp->m_pd3dDevice, MakePath( "Theme\\", string ), 0xffff00ff ); m_aTexScreenShot[ i ].m_size = CSize( 598 + 76, 337 ); } } //LoadScreenShot(); //m_pFont->RestoreDeviceObjects();//>InvalidateDeviceObjects(); //m_mapFont.SetAt( _T( "Arial Black9"), pFont ); // 윈도를 중앙으로 옮기는 부분. CRect rectRoot = m_pWndRoot->GetLayoutRect(); CRect rectWindow = GetWindowRect(); CPoint point( rectRoot.right - rectWindow.Width(), 110 ); Move( point ); MoveParentCenter(); if( ::GetLanguage() == LANG_JAP ) { CString filename = MakePath( DIR_SOUND, "VocThePrologue.WAV" ); g_SoundMng.Play( filename.GetBuffer(0), NULL, NULL, FALSE ); m_pSound = g_SoundMng.GetSound( filename.GetBuffer(0) ); m_fOldMusicVolume = GetVolume(); if(m_fOldMusicVolume && m_fOldMusicVolume >= 0.04f) SetVolume(0.04f); m_Starttimer.Set( SEC( 9 ) ); m_bPlayVoice = FALSE; } }
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { for (int i=0; i<6; i++) m_wndSplit[i] = new CSplitterWnd; CRect rect; GetClientRect(rect); m_wndSplit[0]->CreateStatic(this,2,1); m_wndSplit[1]->CreateStatic(m_wndSplit[0], 1, 3, WS_CHILD | WS_VISIBLE | WS_BORDER, m_wndSplit[0]->IdFromRowCol(0,0)); m_wndSplit[2]->CreateStatic(m_wndSplit[1], 4, 1, WS_CHILD | WS_VISIBLE | WS_BORDER, m_wndSplit[1]->IdFromRowCol(0,2)); m_wndSplit[3]->CreateStatic(m_wndSplit[0], 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_wndSplit[0]->IdFromRowCol(1,0)); m_wndSplit[4]->CreateStatic(m_wndSplit[3], 2, 1, WS_CHILD | WS_VISIBLE | WS_BORDER, m_wndSplit[3]->IdFromRowCol(0,0)); m_wndSplit[5]->CreateStatic(m_wndSplit[4], 1, 4, WS_CHILD | WS_VISIBLE | WS_BORDER, m_wndSplit[4]->IdFromRowCol(1,0)); m_wndSplit[1]->CreateView(0,0,RUNTIME_CLASS(CImageBaseView),CSize(320,240),pContext); m_wndSplit[1]->CreateView(0,1,RUNTIME_CLASS(CImageBaseView),CSize(320,240),pContext); m_wndSplit[2]->CreateView(0,0,RUNTIME_CLASS(CImageBaseView),CSize(160,120),pContext); m_wndSplit[2]->CreateView(1,0,RUNTIME_CLASS(CImageBaseView),CSize(160,120),pContext); m_wndSplit[2]->CreateView(2,0,RUNTIME_CLASS(CImageBaseView),CSize(160,120),pContext); m_wndSplit[2]->CreateView(3,0,RUNTIME_CLASS(CImageBaseView),CSize(160,120),pContext); m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdColor),CSize(160,120),pContext); m_wndSplit[4]->CreateView(0,0,RUNTIME_CLASS(CLogView),CSize(160,120),pContext); m_wndSplit[5]->CreateView(0,0,RUNTIME_CLASS(CImageBaseView),CSize(160,120),pContext); m_wndSplit[5]->CreateView(0,1,RUNTIME_CLASS(CImageBaseView),CSize(160,120),pContext); m_wndSplit[5]->CreateView(0,2,RUNTIME_CLASS(CImageBaseView),CSize(160,120),pContext); m_wndSplit[5]->CreateView(0,3,RUNTIME_CLASS(CImageBaseView),CSize(160,120),pContext); m_wndSplit[0]->SetRowInfo(0, rect.Width()/28*9, 0); m_wndSplit[1]->SetColumnInfo(0, rect.Width()/7*3, 0); m_wndSplit[1]->SetColumnInfo(1, rect.Width()/7*3, 0); m_wndSplit[2]->SetRowInfo(0, rect.Width()/102*9 - 5, 0); m_wndSplit[2]->SetRowInfo(1, rect.Width()/102*9 - 5, 0); m_wndSplit[2]->SetRowInfo(2, rect.Width()/102*9 - 5, 0); m_wndSplit[3]->SetColumnInfo(0, rect.Width()/2, 0); m_wndSplit[5]->SetColumnInfo(0, rect.Width()/8 - 5, 0); m_wndSplit[5]->SetColumnInfo(1, rect.Width()/8 - 5, 0); m_wndSplit[5]->SetColumnInfo(2, rect.Width()/8 - 5, 0); m_wndSplit[4]->SetRowInfo(0, rect.Width()/28*7, 0); /* m_wndWhole->SetColumnInfo(0, rect.Width()/2, 0); m_wndDebugImage->SetRowInfo(0, rect.Width()/16*3, 0); m_wndDebugImage->SetColumnInfo(0, rect.Width()/8, 0); m_wndDebugImage->SetColumnInfo(1, rect.Width()/8, 0); m_wndDebugImage->SetColumnInfo(2, rect.Width()/8, 0); m_wndMemory->SetRowInfo(0, rect.Width()/16*3, 0); m_wndMemory->SetColumnInfo(0, rect.Width()/8, 0); m_wndMemory->SetColumnInfo(1, rect.Width()/8, 0); m_wndMemory->SetColumnInfo(2, rect.Width()/8, 0); */ return TRUE; }
CSize GuiCapOutBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz) { return CSize(32767,m_iHigh); }
//************************************************************************** void CBCGPRibbonBackstageViewItemForm::OnAfterChangeRect (CDC* pDC) { SetLayoutReady(FALSE); CBCGPBaseRibbonElement::OnAfterChangeRect(pDC); if (m_rect.IsRectEmpty ()) { if (m_pWndForm->GetSafeHwnd () != NULL) { m_pWndForm->ShowWindow (SW_HIDE); } return; } BOOL bForceAdjustLocations = FALSE; if (m_pWndForm == NULL) { if ((m_pWndForm = OnCreateFormWnd()) == NULL) { return; } SetLayoutReady(FALSE); bForceAdjustLocations = TRUE; if (m_Watermark.GetImageWell() != NULL) { BOOL bMirror = FALSE; if (GetParentWnd()->GetExStyle () & WS_EX_LAYOUTRTL) { if (!m_bImageMirror) { m_bImageMirror = TRUE; bMirror = TRUE; } } else if (m_bImageMirror) { m_bImageMirror = FALSE; bMirror = TRUE; } if (bMirror) { m_Watermark.Mirror(); OnChangeVisualManager(); } } } CRect rectWindow = m_rect; CRect rectWatermark(0, 0, 0, 0); if (m_sizeWaterMark != CSize(0, 0)) { int xWatermark = max(rectWindow.Width(), m_sizeDlg.cx) - m_sizeWaterMark.cx; int yWatermark = max(rectWindow.Height(), m_sizeDlg.cy) - m_sizeWaterMark.cy; rectWatermark = CRect(CPoint(xWatermark, yWatermark), m_sizeWaterMark); } OnSetBackstageWatermarkRect(rectWatermark); m_pWndForm->SetWindowPos (NULL, rectWindow.left, rectWindow.top, rectWindow.Width (), rectWindow.Height () + 1, SWP_NOZORDER | SWP_NOACTIVATE); if (!m_pWndForm->IsWindowVisible()) { m_pWndForm->ShowWindow (SW_SHOWNOACTIVATE); } SetLayoutReady(); if (bForceAdjustLocations) { CBCGPRibbonPanel* pParentPanel = GetParentPanel(); if (pParentPanel != NULL && pParentPanel->GetParentMenuBar()->GetSafeHwnd() != NULL) { CRect rectPanel; pParentPanel->GetParentMenuBar()->GetClientRect(rectPanel); pParentPanel->GetParentMenuBar()->PostMessage(WM_SIZE, MAKEWPARAM(rectPanel.Width(), rectPanel.Height())); } } m_pWndForm->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN); }
int CStartupView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CScrollView::OnCreate(lpCreateStruct) == -1) return -1; CMainFrameA* pMainFrame = CMainFrameA::GetCurrentInstance(); if(pMainFrame!=NULL) { m_pImageManager = pMainFrame->GetCommandBars()->GetImageManager(); } WCHAR *pFontName = _T("Segoe UI"); LOGFONT logFontBtn; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn); //WCHAR *pFontName = _T("Segoe UI"); _tcscpy(logFontBtn.lfFaceName, pFontName); //logFontBtn.lfUnderline = true; logFontBtn.lfHeight = 12 + 2; m_btnFont.CreateFontIndirect(&logFontBtn); LOGFONT logFontBtn14; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn14); //WCHAR *pFontName = _T("Segoe UI"); _tcscpy(logFontBtn14.lfFaceName, pFontName); logFontBtn14.lfWeight = FW_BOLD; logFontBtn14.lfHeight = 14 + 2; m_btnFont14.CreateFontIndirect(&logFontBtn14); LOGFONT logFontBtn12; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn12); //WCHAR *pFontName = _T("Segoe UI"); _tcscpy(logFontBtn12.lfFaceName, pFontName); logFontBtn12.lfWeight = FW_BOLD; logFontBtn12.lfHeight = 12 + 2; m_btnFont12.CreateFontIndirect(&logFontBtn12); LOGFONT logFontWebBtn; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontWebBtn); //WCHAR *pFontName = _T("Segoe UI"); _tcscpy(logFontWebBtn.lfFaceName, pFontName); logFontWebBtn.lfItalic = true; logFontWebBtn.lfWeight = FW_BOLD; logFontWebBtn.lfHeight = 12 + 2; m_webBtnFont.CreateFontIndirect(&logFontWebBtn); // Calculate width and height of tab title region LOGFONT logFont; ASSISTANT::FillLogFont(logFont, m_csTabFontFamily, m_iTabFontSize, _T("bold"), _T("roman"), false); m_iTabWidth = DrawSdk::Text::GetTextWidth(m_csStartPage, m_csStartPage.GetLength(), &logFont) + 3; m_iTabHeight = DrawSdk::Text::GetTextHeight(m_csStartPage, m_csStartPage.GetLength(), &logFont); LoadBitmaps(); CreateCloseButton(); CreateWelcomeButtons(); //CreateRecentlyOpenedButtons(); CreateShowAgainButton(); CreateToolTips(); SetScrollSizes( MM_TEXT, CSize(VIEW_DEFAULT_WIDTH, VIEW_DEFAULT_HEIGHT) ); RepositionButtons(); ShowToolTips(); return 0; }
//********************************************************************************** void CBCGPRibbonBackstageViewPanel::SelectView(CBCGPBaseRibbonElement* pElem) { ASSERT_VALID(this); m_pNewSelected = NULL; if (pElem == NULL) { return; } ASSERT_VALID(pElem); if (pElem->IsDisabled()) { return; } if (pElem != m_pSelected && pElem->GetBackstageAttachedView() != NULL) { if (m_pSelected != NULL) { ASSERT_VALID(m_pSelected); if (m_pMainButton->GetParentRibbonBar () != NULL) { ASSERT_VALID (m_pMainButton->GetParentRibbonBar ()); m_PageTransitionEffect = m_pMainButton->GetParentRibbonBar ()->GetBackstagePageTransitionEffect(); m_nPageTransitionTime = m_pMainButton->GetParentRibbonBar ()->GetBackstagePageTransitionTime(); } if (m_bSelectedByMouseClick && m_PageTransitionEffect != BCGPPageTransitionNone && !globalData.IsHighContastMode()) { m_bSelectedByMouseClick = FALSE; CBCGPRibbonBackstageViewItemForm* pForm1 = DYNAMIC_DOWNCAST(CBCGPRibbonBackstageViewItemForm, m_pSelected->GetBackstageAttachedView()); if (pForm1 != NULL && pForm1->m_pWndForm->GetSafeHwnd() != NULL) { HWND hwndPanel = GetParentMenuBar()->GetSafeHwnd(); GetParentMenuBar()->SetRedraw(FALSE); CBCGPRibbonBackstageViewItemForm* pForm2 = DYNAMIC_DOWNCAST(CBCGPRibbonBackstageViewItemForm, pElem->GetBackstageAttachedView()); if (pForm2 != NULL && hwndPanel != NULL) { if (pForm2->m_pWndForm == NULL) { pForm2->m_pWndForm = pForm2->OnCreateFormWnd(); } if (pForm2->m_pWndForm->GetSafeHwnd() != NULL) { m_pNewSelected = pElem; ReposActiveForm(); pForm1->m_pWndForm->ShowWindow(SW_HIDE); pForm2->m_pWndForm->ShowWindow(SW_HIDE); CSize szPageMax(m_rect.Width(), 0); m_clrFillFrame = CBCGPVisualManager::GetInstance()->IsRibbonBackstageWhiteBackground() ? RGB(255, 255, 255) : globalData.clrBarFace; m_pNewSelected->m_bIsChecked = TRUE; m_pSelected->m_bIsChecked = FALSE; if (StartPageTransition(hwndPanel, pForm1->m_pWndForm->GetSafeHwnd(), pForm2->m_pWndForm->GetSafeHwnd(), m_pSelected->GetRect().top > pElem->GetRect().top, CSize(0, 0), szPageMax)) { RedrawElement(m_pSelected); return; } GetParentMenuBar()->SetRedraw(TRUE); } } } } CBCGPBaseRibbonElement* pView = m_pSelected->GetBackstageAttachedView(); if (pView != NULL) { ASSERT_VALID(pView); pView->SetRect(CRect(0, 0, 0, 0)); pView->OnAfterChangeRect(NULL); } m_pSelected->m_bIsChecked = FALSE; RedrawElement(m_pSelected); } m_pSelected = pElem; m_pSelected->m_bIsChecked = TRUE; ReposActiveForm(); AdjustScrollBars(); ReposActiveForm(); RedrawElement(m_pSelected); } }
void CStartupView::CreateWelcomeButtons() { BOOL bCreationSucces=FALSE; CMainFrameA* pMainFrame = CMainFrameA::GetCurrentInstance();; CRect rcButton; rcButton.SetRect(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT); CString csTitle; // Record PowerPoint button /*CString csPrefix = _T(""); csPrefix.LoadString(IDS_RECORD);*/ csTitle.LoadString(IDS_POWERPOINT); //csTitle = csPrefix + _T(" ") + csTitle; if (csTitle.IsEmpty() == false) { bCreationSucces = m_btnRecordPowerPoint.Create(csTitle, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rcButton, this, IDC_RECORDPOWERPOINT); } if (bCreationSucces==TRUE) { SetButtonImage(&m_btnRecordPowerPoint, IDR_RECORD_PPT, CSize(32,32)); SetButtonStyle(&m_btnRecordPowerPoint, xtThemeOffice2003, BS_XT_XPFLAT, &m_btnFont14, RGB(255, 255, 255)); } // Record Other button csTitle.LoadString(IDS_OTHERAPP); //csTitle = csPrefix + _T(" ") + csTitle; bCreationSucces = m_btnRecordOther.Create(csTitle, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rcButton, this, ID_START_RECORDING_STARTUP_PAGE); if (bCreationSucces == TRUE) { SetButtonImage(&m_btnRecordOther,IDR_RECORD_OTHER, CSize(32,32)); SetButtonStyle(&m_btnRecordOther, xtThemeOffice2003, BS_XT_XPFLAT, &m_btnFont14, RGB(255, 255, 255)); } // "New Source Document" button csTitle.LoadString(IDS_NEW_LSD); bCreationSucces = m_btnNewSourceDoc.Create(csTitle, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rcButton, this, ID_LSD_NEW); if (bCreationSucces == TRUE) { SetButtonImage(&m_btnNewSourceDoc,IDR_NEW_LSD, CSize(32, 32)); SetButtonStyle(&m_btnNewSourceDoc, xtThemeOffice2003, BS_XT_XPFLAT, &m_btnFont14, RGB(255, 255, 255)); } // "Open Source Document" button csTitle.LoadString(IDS_OPEN_LSD); bCreationSucces = m_btnOpenSourceDoc.Create(csTitle, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rcButton, this, ID_LSD_OPEN); if (bCreationSucces == TRUE) { SetButtonImage(&m_btnOpenSourceDoc,IDR_OPEN_LSD, CSize(32,32)); SetButtonStyle(&m_btnOpenSourceDoc, xtThemeOffice2003, BS_XT_XPFLAT, &m_btnFont14, RGB(255, 255, 255)); } // "Import PowerPoint" button csTitle.LoadString(IDS_IMPORT_PPT); bCreationSucces = m_btnImportPowerPoint.Create(csTitle, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rcButton, this, ID_PPT_IMPORT); if (bCreationSucces == TRUE) { SetButtonImage(&m_btnImportPowerPoint,IDR_IMPORT_PPT, CSize(32, 32)); SetButtonStyle(&m_btnImportPowerPoint, xtThemeOffice2003, BS_XT_XPFLAT, &m_btnFont14, RGB(255, 255, 255)); } CRect rcNewButtons; rcNewButtons.SetRect(0, 0, BUTTON_WIDTH1, BUTTON_HEIGHT1); // Tutorials button csTitle.LoadString(IDS_BUTTON_TUTORIALS); bCreationSucces = m_btnTutorial.Create(csTitle, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rcButton, this, IDS_SHOW_IMC_WEBPAGE_TUTORIALS); if(bCreationSucces) { SetButtonImage(&m_btnTutorial, IDR_PNG_TUTORIALS, CSize(32, 32)); SetButtonStyle(&m_btnTutorial, xtThemeOffice2003, BS_XT_XPFLAT /*| BS_XT_TRANSPARENT*/, &m_webBtnFont, RGB(233, 243, 249)); COLORREF clrWebButtons = 0x00333333; m_btnTutorial.SetColorText(clrWebButtons); } csTitle.LoadString(IDS_BUTTON_GUIDED); bCreationSucces = m_btnGuidedTour.Create(csTitle, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rcButton, this, IDS_SHOW_IMC_WEBPAGE_GUIDED_TOUR); if(bCreationSucces) { m_btnGuidedTour.SetTheme(xtThemeOffice2003); SetButtonImage(&m_btnGuidedTour, IDR_PNG_GUIDEDTOUR, CSize(32, 32)); SetButtonStyle(&m_btnGuidedTour, xtThemeOffice2003, BS_XT_XPFLAT /*| BS_XT_TRANSPARENT*/, &m_webBtnFont, RGB(233, 243, 249)); COLORREF clrWebButtons = 0x00333333; m_btnGuidedTour.SetColorText(clrWebButtons); } csTitle.LoadString(IDS_BUTTON_COMMUNITY); bCreationSucces = m_btnCommunity.Create(csTitle, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rcButton, this, IDS_SHOW_IMC_WEBPAGE_COMUNITY); if(bCreationSucces) { SetButtonImage(&m_btnCommunity, IDR_PNG_COMMUNITY, CSize(32, 32)); COLORREF clrWebButtons = 0x00333333; m_btnCommunity.SetColorText(clrWebButtons); SetButtonStyle(&m_btnCommunity, xtThemeOffice2003, BS_XT_XPFLAT /*| BS_XT_TRANSPARENT*/, &m_webBtnFont, RGB(233, 243, 249)); } CString csOwnVersion; csOwnVersion.LoadString(IDS_VERSION); CSecurityUtils secure; int iVersionType = secure.GetVersionType(csOwnVersion); bool bIsEvaluation = (iVersionType & EVALUATION_VERSION) != 0; if (bIsEvaluation) { csTitle.LoadString(IDS_BUYNOW); bCreationSucces = m_btnBuyNow.Create(csTitle, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON /*| BS_MULTILINE*/, CRect(0,0, 190, 60), this, IDS_SHOW_IMC_WEBPAGE_BUYNOW); if (bCreationSucces) { SetButtonImage(&m_btnBuyNow, IDR_PNG_BUYNOW, CSize(54, 54)); SetButtonStyle(&m_btnBuyNow, xtThemeOffice2003, BS_XT_XPFLAT, &m_webBtnFont, RGB(190, 217, 239)); m_btnBuyNow.SetFontEx(&m_webBtnFont); } } }
SIZE CButtonUI::EstimateSize(SIZE szAvailable) { if( m_cxyFixed.cy == 0 ) return CSize(m_cxyFixed.cx, m_pManager->GetFontInfo(GetFont())->tm.tmHeight + 8); return CControlUI::EstimateSize(szAvailable); }
void CStartupView::CreateToolTips() { // Set tooltip context // EnableToolTips(TRUE); if(m_ctrlToolTipsContext !=NULL) { ASSERT(m_ctrlToolTipsContext); return; } m_ctrlToolTipsContext = new CXTPToolTipContext(); m_ctrlToolTipsContext->SetModuleToolTipContext(); m_ctrlToolTipsContext->SetStyle(xtpToolTipOffice2007); m_ctrlToolTipsContext->SetMaxTipWidth(200); m_ctrlToolTipsContext->ShowTitleAndDescription(); m_ctrlToolTipsContext->ShowImage(TRUE,0); m_ctrlToolTipsContext->SetMargin(CRect(2, 2, 2, 2)); m_ctrlToolTipsContext->SetDelayTime(TTDT_INITIAL, 900); m_ctrlToolTipsContext->ShowToolTipAlways(); CRecentFileList *pRecentFileList = NULL; #ifndef _STUDIO CWinApp *pApp = AfxGetApp(); if (pApp && pApp->IsKindOf(RUNTIME_CLASS(CAssistantApp))) { pRecentFileList = ((CAssistantApp *)pApp)->GetRecentFileList(); } #endif if (!pRecentFileList) return; for (int i = 0; i < pRecentFileList->m_nSize; ++i) { UINT uiRecentFiles[] = { -1,-1,-1,-1,-1, -1,-1,-1,-1,-1, -1,-1,-1,-1,ID_FILE_MRU_FILE1+ i}; m_pImageManager->SetIcons(IDB_SYSTEM_MENU, uiRecentFiles, _countof(uiRecentFiles), CSize(32, 32)); } UpdateData(TRUE); }
/** * 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 ); }
int Editor::OnCreate( LPCREATESTRUCT cs ){ CWnd::OnCreate( cs ); CHARFORMAT fmt;fmt.cbSize=sizeof( fmt ); fmt.dwMask=CFM_COLOR|CFM_PROTECTED; fmt.dwEffects=CFE_PROTECTED; fmt.crTextColor=prefs.rgb_default; PARAFORMAT pf; memset( &pf,0,sizeof( pf ) ); pf.cbSize=sizeof( pf ); pf.dwMask=PFM_TABSTOPS; pf.cTabCount=MAX_TAB_STOPS; int tabTwips=1440*8/GetDeviceCaps( ::GetDC(0),LOGPIXELSX ) * prefs.edit_tabs; for( int k=0;k<MAX_TAB_STOPS;++k ) pf.rgxTabs[k]=k*tabTwips; CRect r( 0,0,0,0 ); editCtrl.Create( WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|WS_BORDER| ES_MULTILINE|ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_NOHIDESEL, r,this,1 ); editCtrl.SetFont( &prefs.editFont ); editCtrl.SetBackgroundColor( false,prefs.rgb_bkgrnd ); editCtrl.SetDefaultCharFormat( fmt ); editCtrl.SetEventMask( ENM_CHANGE|ENM_PROTECTED|ENM_KEYEVENTS|ENM_MOUSEEVENTS|ENM_SELCHANGE ); editCtrl.SetParaFormat( pf ); editCtrl.LimitText( TEXTLIMIT ); if( editCtrl.GetLimitText()!=TEXTLIMIT ) AfxMessageBox( "Unable to set editor text Limit" ); editCtrl.SetModify(false); tabber.Create( WS_CHILD|WS_VISIBLE|TCS_BUTTONS|TCS_HOTTRACK,r,this,2 ); tabber.SetFont( &prefs.tabsFont ); tabber.SetPadding( CSize(3,3) ); tabber.setListener( this ); int bk=prefs.rgb_bkgrnd; int fg=prefs.rgb_ident; int ws=WS_CHILD|WS_BORDER; funcList.Create( ws|LVS_LIST|LVS_SHOWSELALWAYS,r,&tabber,1 ); funcList.SetFont( &prefs.debugFont ); funcList.SetBkColor( bk ); funcList.SetTextColor( fg ); funcList.SetTextBkColor( bk ); typeList.Create( ws|LVS_LIST|LVS_SHOWSELALWAYS,r,&tabber,2 ); typeList.SetFont( &prefs.debugFont ); typeList.SetBkColor( bk ); typeList.SetTextColor( fg ); typeList.SetTextBkColor( bk ); labsList.Create( ws|LVS_LIST|LVS_SHOWSELALWAYS,r,&tabber,3 ); labsList.SetFont( &prefs.debugFont ); labsList.SetBkColor( bk ); labsList.SetTextColor( fg ); labsList.SetTextBkColor( bk ); tabber.insert( 0,&funcList,"funcs" ); tabber.insert( 1,&typeList,"types" ); tabber.insert( 2,&labsList,"labels" ); cursorMoved(); return 0; }