This patch improves appearance of the print dialog a bit. See attached "before.png" and "after.png" with special attention to preview area.
From 867305ce96b273cc65f0f2df9d1068eba3974dd0 Mon Sep 17 00:00:00 2001 From: Ivan Timofeev <timofeev.i.s@gmail.com> Date: Tue, 27 Sep 2011 18:52:30 +0400 Subject: [PATCH] Print preview: set frame size to preview size even if there is no preview --- vcl/source/window/printdlg.cxx | 26 ++++++++++---------------- 1 files changed, 10 insertions(+), 16 deletions(-) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 5f01ac2..969030c 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -158,21 +158,17 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) { long nTextHeight = maHorzDim.GetTextHeight(); Size aSize( GetSizePixel() ); - aSize.Width() -= nTextHeight; - aSize.Height() -= nTextHeight; + Point aOffset( (aSize.Width() - maPreviewSize.Width() + nTextHeight) / 2 , + (aSize.Height() - maPreviewSize.Height() + nTextHeight) / 2 ); + if( maReplacementString.getLength() != 0 ) { // replacement is active Push(); - Rectangle aTextRect( Point( nTextHeight, nTextHeight ), aSize ); - DecorationView aVw( this ); - aVw.DrawFrame( aTextRect, FRAME_DRAW_GROUP ); - aTextRect.Left() += 2; - aTextRect.Top() += 2; - aTextRect.Right() -= 2; - aTextRect.Bottom() -= 2; Font aFont( GetSettings().GetStyleSettings().GetLabelFont() ); SetZoomedPointFont( aFont ); + Rectangle aTextRect( aOffset + Point( 2, 2 ), + Size( maPreviewSize.Width() - 4, maPreviewSize.Height() - 4 ) ); DrawText( aTextRect, maReplacementString, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE ); @@ -182,9 +178,6 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) { GDIMetaFile aMtf( maMtf ); - Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2 + nTextHeight, - (aSize.Height() - maPreviewSize.Height()) / 2 + nTextHeight ); - Size aVDevSize( maPageVDev.GetOutputSizePixel() ); const Size aLogicSize( maPageVDev.PixelToLogic( aVDevSize, MapMode( MAP_100TH_MM ) ) ); Size aOrigSize( maOrigSize ); @@ -213,11 +206,12 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) maPageVDev.SetMapMode( MAP_PIXEL ); DrawOutDev( aOffset, maPreviewSize, Point( 0, 0 ), aVDevSize, maPageVDev ); maPageVDev.SetDrawMode( nOldDrawMode ); - - DecorationView aVw( this ); - Rectangle aFrame( aOffset + Point( -1, -1 ), Size( maPreviewSize.Width() + 2, maPreviewSize.Height() + 2 ) ); - aVw.DrawFrame( aFrame, FRAME_DRAW_GROUP ); } + + Rectangle aFrameRect( aOffset + Point( -1, -1 ), + Size( maPreviewSize.Width() + 2, maPreviewSize.Height() + 2 ) ); + DecorationView aVw( this ); + aVw.DrawFrame( aFrameRect, FRAME_DRAW_GROUP ); } void PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt ) -- 1.7.6.3
Attachment:
before.png
Description: PNG image
Attachment:
after.png
Description: PNG image