METHOD BuildWindow() CLASS TPreview
local oIcon, cTitle := "FiveWin Printing Preview", oCursor, oBar, nCol := 325
local oThis := Self
local nRow := 7
DEFAULT ::oWndMain := WndMain()
::hOldRes := GetResources()
if ! File( ::cResFile )
#ifdef __CLIPPER__
::cResFile := "Preview.dll"
#else
if ! IsWin64()
::cResFile := "Prev32.dll"
else
::cResFile = "Prev64.dll"
endif
#endif
endif
if SetResources( ::cResFile ) < 32
MsgStop( ::cResFile + " not found, imposible to continue",;
"FiveWin Printing Error" )
return nil
endif
::hNewRes := GetResources()
if ::oDevice != nil
cTitle = ::oDevice:cDocument
endif
if ::oWndMain != nil
oIcon = ::oWndMain:oIcon
else
DEFINE ICON oIcon RESOURCE "Print"
endif
DEFINE FONT ::oFont NAME GetSysFont() SIZE 0, -12
::CheckStyle()
if !::oDevice:lPrvModal .and. ::oWndMain != nil .and. ;
Upper( ::oWndMain:ClassName() ) == "TMDIFRAME"
DEFINE WINDOW ::oWnd ;
TITLE cTitle ;
COLOR CLR_BLACK,CLR_LIGHTGRAY ;
ICON oIcon ;
VSCROLL HSCROLL MDICHILD
else
DEFINE WINDOW ::oWnd /*FROM 0, 0 TO 24, 80*/ ;
TITLE cTitle ;
COLOR CLR_BLACK,CLR_LIGHTGRAY ;
ICON oIcon ;
VSCROLL HSCROLL MENU ::BuildMenu()
endif
::oWnd:SetFont( ::oFont )
::oWnd:oVScroll:SetRange( 0, 0 )
::oWnd:oHScroll:SetRange( 0, 0 )
::cPageNum = TXT_PAGENUM
::BuildButtonBar()
/*
#ifdef __CLIPPER__
SET MESSAGE OF ::oWnd TO TXT_PREVIEW CENTERED ;
NOINSET CLOCK DATE KEYBOARD
#else
if l2007
SET MESSAGE OF ::oWnd TO TXT_PREVIEW CENTERED ;
NOINSET CLOCK DATE KEYBOARD 2007
else
DEFINE STATUSBAR OF ::oWnd PROMPT " " + TXT_PREVIEW
endif
#endif
*/
if lRebar
DEFINE STATUSBAR OF ::oWnd PROMPT " " + TXT_PREVIEW
else
SET MESSAGE OF ::oWnd TO TXT_PREVIEW CENTERED ;
NOINSET CLOCK DATE KEYBOARD
::oWnd:oMsgBar:l2007 := ( nStyle == 2007 )
::oWnd:oMsgBar:l2010 := ( nStyle == 2010 )
endif
::oMeta1 := TMetaFile():New( 0, 0, 0, 0,;
::oDevice:aMeta[ 1 ],;
::oWnd,;
CLR_BLACK,;
CLR_WHITE,;
::oDevice:nHorzRes(),;
::oDevice:nVertRes() )
if ! IsWin64()
DEFINE CURSOR ::oCursor RESOURCE "LUPA"
else
DEFINE CURSOR ::oCursor RESOURCE "search"
endif
::oMeta1:oCursor := ::oCursor
::oMeta1:blDblClick := { | nRow, nCol, nKeyFlags | ;
::SetOrg1( nCol, nRow, nKeyFlags ) }
::oMeta1:bKeyDown := { | nKey, nFlags | ::CheckKey( nKey, nFlags ) }
::oMeta1:bMouseWheel := { | nKeys, nDelta, nXPos, nYPos | ;
::CheckMouseWheel( nKeys, nDelta, nXPos, nYPos ) }
#ifndef __XPP__ // XBPP bug. Warning: don't change this into #ifdef __CLIPPER__
::oMeta2 := TMetaFile():New( 0, 0, 0, 0, "",;
::oWnd, CLR_BLACK, CLR_WHITE, ::oDevice:nHorzRes(),;
::oDevice:nVertRes() )
#else
::oMeta2 := TMetaFile():New():_New( 0, 0, 0, 0, "",;
::oWnd, CLR_BLACK, CLR_WHITE, ::oDevice:nHorzRes(),;
::oDevice:nVertRes() )
#endif
::oMeta2:oCursor = ::oCursor
::oMeta2:blDblClick := { | nRow, nCol, nKeyFlags | ;
::SetOrg2( nCol, nRow, nKeyFlags ) }
::oMeta2:hide()
::SetFactor()
oBar := ::oBar
if !lRebar
nCol := ATail( oBar:aControls ):nRight + 30
nRow := Int( oBar:nHeight / 2 ) - 6
endif
if nStyle >= 2007
oBar:bPainted = { || oBar:Say( nRow, nCol, "Factor:",,, ::oFont, .T., .T. ),;
If( Len( ::oDevice:aMeta ) > 1,;
oBar:Say( nRow, nCol+100, ::cPageNum + LTrim( Str( ::nPage, 4, 0 ) ) + " / " + ;
LTrim( Str( Len( ::oDevice:aMeta ) ) ),,, ::oFont, .T., .T. ),;
oBar:Say( nRow, nCol+100, ::cPageNum + LTrim( Str( ::nPage, 4, 0 ) ),;
,,, ::oFont, .T., .T. ) ) }
endif
if nStyle < 2007
@ nRow, nCol SAY ::oSay PROMPT "Factor:" ;
SIZE 45, 15 PIXEL OF ::oBar FONT ::oFont
::oSay:lTransparent = .T.
endif
@ nRow-4, nCol+40 COMBOBOX ::oFactor VAR ::nZFactor ;
ITEMS { "1", "2", "3", "4", "5", "6", "7", "8", "9" } ;
OF ::oBar FONT ::oFont PIXEL SIZE 35,200 ;
ON CHANGE oThis:SetFactor( oThis:nZFactor )
if nStyle < 2007
if Len( ::oDevice:aMeta ) > 1
@ nRow, nCol+100 SAY ::oPage PROMPT TXT_PAGENUM + LTrim( Str( ::nPage, 4, 0 ) ) + " / " + ;
LTrim( Str( Len( ::oDevice:aMeta ) ) ) ;
SIZE 180, 15 PIXEL OF ::oBar FONT ::oFont
else
@ nRow, nCol + 100 SAY ::oPage PROMPT TXT_PAGENUM + LTrim( Str( ::nPage, 4, 0 ) ) ;
SIZE 180, 15 PIXEL OF ::oBar FONT ::oFont
endif
::oPage:lTransparent = .T.
endif
// if IsAppThemed() .or. l2007
if lRebar .or. nStyle >= 2007
FixSays( ::oBar:hWnd )
endif
#ifndef __XPP__
::oFactor:Set3dLook( .T. )
#endif
SetResources( ::hOldRes )
::oWnd:oHScroll:bPos := { | nPos | ::HScroll( GO_POS, .f., nPos ) }
::oWnd:oVScroll:bPos := { | nPos | ::VScroll( GO_POS, .f., nPos ) }
return nil