Ignore:
Timestamp:
Feb 19, 2023, 2:33:51 AM (3 years ago)
Author:
Alex Taylor
Message:

Various updates and refactoring of font scaling logic; documentation and WIS updates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/shared/PrintUtl.VRS

    r91 r97  
    1717 */
    1818GetDriverSource: PROCEDURE EXPOSE globals. pmdx
     19    /* Can replace with   PrManUtl */
    1920    ARG driver
    2021    IF driver == '' THEN RETURN ''
     
    8081 */
    8182GetDriverPMDD: PROCEDURE
     83    /* Can remove */
    8284    PARSE ARG driver, prdrv_lst
    8385
     
    101103 */
    102104VerifyDriverEAs: PROCEDURE EXPOSE globals.
     105    /* Can replace with PrManUtl */
    103106    PARSE ARG driver
    104107    eas.0 = 0
     
    111114            RETURN 0
    112115
    113         ADDRESS CMD '@UNLOCK' driver '2>NUL 1>NUL'
    114         ADDRESS CMD '@EAUTIL' driver ea_file '/j /p 2>NUL 1>NUL'
     116        ADDRESS CMD '@ UNLOCK' driver '2>NUL 1>NUL'
     117        ADDRESS CMD '@ EAUTIL' driver ea_file '/j /p 2>NUL 1>NUL'
    115118    END
    116119RETURN 1
     
    130133 */
    131134CopyDriverToSource: PROCEDURE EXPOSE globals.
     135    /* Can replace with CopyDriverFiles from PrManUtl */
    132136    PARSE ARG driver, newdrvdir
    133137
     
    716720RETURN success
    717721
     722/*:VRX         GetScalingFactor
     723*/
     724/* Return the UI scaling factor based on the difference between the specified
     725 * font size and the design-default font size.
     726 */
     727GetScalingFactor: PROCEDURE EXPOSE globals.
     728    PARSE ARG newSize, orgSize
     729
     730    IF orgSize == '' THEN
     731        orgSize = globals.!defaultSize
     732
     733    IF newSize < globals.!defaultSize THEN
     734        newSize = globals.!defaultSize
     735
     736    scaleFactor = newSize / orgSize
     737
     738RETURN scaleFactor
     739
     740/*:VRX         ParseFontSize
     741*/
     742ParseFontSize: PROCEDURE EXPOSE globals.
     743    PARSE ARG font
     744    IF font == '' | font == '<default>' THEN
     745        RETURN globals.!defaultSize
     746
     747    PARSE VAR font _pts'.'.
     748    IF _pts < globals.!defaultSize THEN
     749        _pts = globals.!defaultSize
     750
     751RETURN _pts
     752
     753/*:VRX         RescaleObject
     754*/
     755RescaleObject: PROCEDURE
     756    PARSE ARG object, factor, move
     757
     758    x = VRGet( object, 'Left')
     759    y = VRGet( object, 'Top')
     760    w = VRGet( object, 'Width')
     761    h = VRGet( object, 'Height')
     762    nx = TRUNC( x * factor )
     763    ny = TRUNC( y * factor  )
     764    nw = TRUNC( w * factor )
     765    nh = TRUNC( h * factor  )
     766
     767    /* SAY object ': ('||x','y','w','h') --> ('nx','ny','nw','nh')' */
     768
     769    IF move <> 0 THEN DO
     770        ok = VRSet( object, 'Left', nx )
     771        ok = VRSet( object, 'Top', ny )
     772    END
     773    ok = VRSet( object, 'Width', nw )
     774    ok = VRSet( object, 'Height', nh )
     775
     776RETURN
     777
Note: See TracChangeset for help on using the changeset viewer.