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/PrManUtl.VRS

    r91 r97  
    229229            RETURN 0
    230230
    231         ADDRESS CMD '@UNLOCK' driver '2>NUL 1>NUL'
    232         ADDRESS CMD '@EAUTIL' driver ea_file '/j /p 2>NUL 1>NUL'
     231        ADDRESS CMD '@ UNLOCK' driver '2>NUL 1>NUL'
     232        ADDRESS CMD '@ EAUTIL' driver ea_file '/j /p 2>NUL 1>NUL'
    233233    END
    234234RETURN 1
     
    350350    IF VRFileExists( newdrvdir'\'eafile ) THEN
    351351        CALL VRDeleteFile newdrvdir'\'eafile
    352     ADDRESS CMD '@EAUTIL' newdrvdir'\'drv_name newdrvdir'\'eafile '/s /p 2>NUL 1>NUL'
     352    ADDRESS CMD '@ EAUTIL' newdrvdir'\'drv_name newdrvdir'\'eafile '/s /p 2>NUL 1>NUL'
    353353
    354354RETURN 1
     
    11861186RETURN success
    11871187
     1188
     1189/*:VRX         GetScalingFactor
     1190 */
     1191/* Return the UI scaling factor based on the difference between the specified
     1192 * font size and the design-default font size.
     1193 */
     1194GetScalingFactor: PROCEDURE EXPOSE globals.
     1195    PARSE ARG newSize, orgSize
     1196
     1197    IF orgSize == '' THEN
     1198        orgSize = globals.!defaultSize
     1199
     1200    IF newSize < globals.!defaultSize THEN
     1201        newSize = globals.!defaultSize
     1202
     1203    scaleFactor = newSize / orgSize
     1204
     1205RETURN scaleFactor
     1206
     1207
     1208/*:VRX         ParseFontSize
     1209 */
     1210ParseFontSize: PROCEDURE EXPOSE globals.
     1211    PARSE ARG font
     1212    IF font == '' | font == '<default>' THEN
     1213        RETURN globals.!defaultSize
     1214
     1215    PARSE VAR font _pts'.'.
     1216    IF _pts < globals.!defaultSize THEN
     1217        _pts = globals.!defaultSize
     1218
     1219RETURN _pts
     1220
     1221
     1222/*:VRX         RescaleObject
     1223 */
     1224RescaleObject: PROCEDURE
     1225    PARSE ARG object, factor, move
     1226
     1227    x = VRGet( object, 'Left')
     1228    y = VRGet( object, 'Top')
     1229    w = VRGet( object, 'Width')
     1230    h = VRGet( object, 'Height')
     1231    nx = TRUNC( x * factor )
     1232    ny = TRUNC( y * factor  )
     1233    nw = TRUNC( w * factor )
     1234    nh = TRUNC( h * factor  )
     1235
     1236    /* SAY object ': ('||x','y','w','h') --> ('nx','ny','nw','nh')' */
     1237
     1238    IF move <> 0 THEN DO
     1239        ok = VRSet( object, 'Left', nx )
     1240        ok = VRSet( object, 'Top', ny )
     1241    END
     1242    ok = VRSet( object, 'Width', nw )
     1243    ok = VRSet( object, 'Height', nh )
     1244
     1245RETURN
     1246
     1247
    11881248/*:VRX         StringTokenize
    11891249*/
Note: See TracChangeset for help on using the changeset viewer.