//***************************************************************************** // // Function Name: CHeadlineSheet::OnPaint // // Description: WM_PAINT handler // // Returns: VOID // // Exceptions: None // //***************************************************************************** // void CHeadlineSheet::OnPaint( ) { PAINTSTRUCT ps; HDC hdc = ::BeginPaint( GetSafeHwnd( ), &ps ); // Put it in a DcDrawingSurface RDcDrawingSurface drawingSurface; drawingSurface.Initialize( hdc ); // Create a transform R2dTransform transform; // Scale to the device DPI RRealSize deviceDPI = drawingSurface.GetDPI( ); transform.PreScale( (YFloatType)deviceDPI.m_dx / kSystemDPI, (YFloatType)deviceDPI.m_dy / kSystemDPI ); // Get the preview rectangle RRealRect previewRect; GetPreviewRect( &previewRect ); // Offset the transform by the top left corner of the preview rect transform.PreTranslate( previewRect.m_Left, previewRect.m_Top ); // Render the preview headline m_pPreviewHeadline->Render( drawingSurface, transform, RRealRect( previewRect.WidthHeight( ) ), previewRect.WidthHeight( ) ); drawingSurface.DetachDCs( ); ::EndPaint( GetSafeHwnd( ), &ps ); }
void InfoPane::ResetText() { try { file_info_.Clear(); if (photo_) { try { photo_->CompleteInfo(GetImageDataBase(true, true), file_info_); } catch (...) { ASSERT(false); } } Filter(bar_.FilterText(), bar_.IsUnknownHidden()); if (img_preview_) InvalidateRect(GetPreviewRect()); } CATCH_ALL }
BOOL CHeadlineSheet::OnInitDialog() { // //Move all child windows to bottom of inflated property sheet. MoveChildWindows( this, 0, (kSheetInflateAmt*2), FALSE ); BOOL fFocusSet = CPropertySheet::OnInitDialog(); // //Draw edit control at top of Propert Sheet CRect TextCtrlRect; GetClientRect( &TextCtrlRect ); GetClientRect( &m_cPrevRect ); TextCtrlRect.bottom = kSheetInflateAmt + kXShrinkAmt; TextCtrlRect.DeflateRect( kXShrinkAmt, (kSheetInflateAmt/6) ); TextCtrlRect.top+= kXShrinkAmt; m_cPrevRect.top = TextCtrlRect.bottom; m_cPrevRect.bottom = TextCtrlRect.bottom + kSheetInflateAmt; m_cPrevRect.left = TextCtrlRect.left; m_cPrevRect.right = TextCtrlRect.right; m_ctrlText.Create( ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_WANTRETURN | WS_CHILD | WS_VISIBLE | WS_BORDER , TextCtrlRect, this, kTextCtrlId ); m_ctrlText.LimitText( kMaxNumChars ); int nRightVal = TextCtrlRect.right; int nBottomVal = TextCtrlRect.top - 1; CRect CaptionRect(0, 0, nRightVal, nBottomVal ); m_ctrlTextCaption.Create( kHeadlineCaption, WS_CHILD | WS_VISIBLE , CaptionRect, this, kTextCaptionCtrlId ); SetTitle( kHeadlineDlgTitle, PSH_PROPTITLE ); UpdateData( FALSE ); // //Give the edit control the default focus. m_ctrlText.SetFocus(); // Create the preview headline m_pPreviewHeadline = new RHeadlineDocument( NULL, RComponentAttributes( ), kHeadlineComponent, FALSE ); // Create and add a headline view RRealRect previewRect; GetPreviewRect( &previewRect ); m_pPreviewHeadline->AddRView( m_pPreviewHeadline->CreateView( previewRect, NULL ) ); // Update the preview headline m_pParentPropSheet->UpdateHeadlinePreview( ); return fFocusSet; }
BOOL InfoPane::OnEraseBkgnd(CDC* dc) { COLORREF rgb_background = g_Settings.AppColors()[AppColors::Background];// CalcNewColor(::GetSysColor(COLOR_3DFACE), g_backgnd_brightness); MemoryDC mem_dc(*dc, this, rgb_background); if (img_preview_ && photo_) { // draw preview CRect rect= GetPreviewRect(); //mem_dc.FillSolidRect(rect.left, rect.top, rect.Width(), 1, ::GetSysColor(COLOR_3DSHADOW)); rect.DeflateRect(0, 5); photo_->Draw(&mem_dc, rect, rgb_background); } mem_dc.BitBlt(); return true; }