home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Utilities / QuickFile / ARexx / GetViewWin.quickfile < prev    next >
Text File  |  2000-05-26  |  2KB  |  65 lines

  1. /*
  2. $VER: GetViewWin.quickfile 1.3 (26 May 2000  15:06:44) By M Andre Z Eckenrode
  3.  
  4. External function for other QuickFile macros; returns information regarding
  5. the size and position of the current view window, and the size of the default
  6. font.
  7.  
  8. Requires rexxsupport.library, but no arguments.
  9.  
  10. Returns the following string:
  11.  
  12.   <win.x> <win.y> <win.w> <win.h> <win.cx> <win.cy> <fs>
  13.  
  14. Where:
  15.  
  16.   <win.x>  = window left edge offset
  17.   <win.y>  = window top edge offset
  18.   <win.w>  = window width
  19.   <win.h>  = window height
  20.   <win.cx> = window center horizontal offset
  21.   <win.cy> = window center vertical offset
  22.   <fs>     = size of the Workbench Font prefs default font
  23.  
  24. All window values are only necessarily accurate if the current view has been
  25. saved to disk, and has not been modified since. If the view has not been saved
  26. to disk, all values are assumed to be the same as for QuickFile's default
  27. window, which are:
  28.  
  29.   0 1 640 256 320 125
  30.  
  31. */
  32.  
  33. options results
  34. lib = 'rexxsupport.library'
  35. if ~show('l',lib) then call addlib(lib,0,-30)
  36.  
  37. gfxbase = showlist(l,'graphics.library',,a)
  38. fontaddr = next(gfxbase,154)
  39. call forbid()
  40. fs = c2d(import(offset(fontaddr, 20),2))
  41. call permit()
  42.  
  43. setfile
  44. db = result
  45. query file 'DB' db
  46. call pragma('d',db.path)
  47.  
  48. setview
  49. view = pragma('d')||copies('/',abs(sign(pos(':',pragma('d'),length(pragma('d'))))-1))result
  50. if ~exists(view) then return 0 1 640 256 320 125 fs
  51.  
  52. if ~open(1view,view,'r') then do
  53.     reqmsg '"Unable to open file\010\034'view'\034\010to read window size and position. Using default values."'
  54.     return 0 1 640 256 320 125 fs
  55. end
  56.  
  57. do 3
  58.     line = readln(1view)
  59. end
  60. parse var line . . win.h win.w win.x win.y .
  61. win.cx = win.x+(win.w%2)
  62. win.cy = win.y+(win.h%2)
  63.  
  64. return win.x win.y win.w win.h win.cx win.cy fs
  65.