! *viewer/viewer - Graphical Print Preview - Fired from command line
! By Gord Davey
! (c) Copyright 2004-2005 Sage Software Canada Ltd.
! Version Info:
! Source Code File: $RCSfile: viewer.pvs,v $   Version: $Revision: 1.5 $
!      Last Edited: $Date: 2005/10/14 15:31:18 $   Author: $Author: gordd $
!
! This driver contains the logic to instantiate and control the GUI Print Previewer from the command line
!   Version$ = mid(mid("$Revision: 1.5 $",12), 1, len(mid("$Revision: 1.5 $",12)) - 2)
!
Main:
    DiskFile$ = arg(1, err=*next)
    if ucs(arg(2, err=*next)) = "DELETE" \
        then DeleteOnExit = 1

    savepc = prm('pc')
    setparam 'pc' = 20
    Viewer = new("*viewer/preview")
    Check = new("*ext/system/license", err=*next);
        IsWindXVersion = Check'CheckWindX();
        drop object Check

    Viewer'init()
    Viewer'Visible = 1

    if DiskFile$ > "" \
        then Result = Viewer'Open(DiskFile$) \
        else Result = Viewer'Open()

    if Result = 0 then \
    {   Viewer'Process()
        drop object Viewer
    }

    if DeleteOnExit \
        then erase DiskFile$, err=*proceed

    setparam 'pc' = savepc

    release
