home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / w3_apps / mewin10.arj / MDI.CMD < prev    next >
OS/2 REXX Batch file  |  1992-04-17  |  3KB  |  100 lines

  1. ; Screen juggling macros for MicroEMACS 3.11c for Windows (update 1.0)
  2. ;
  3. ; Pierre Perret - April 1992
  4. rename-screen $cbufname
  5. restore-screen
  6. 80  change-screen-width
  7.  
  8. store-procedure open-file
  9. ; Reads files in separate screens, thus allowing efficient use of
  10. ; the MDI feature
  11.     set %prevscr $scrname
  12.     set %prevbuf $cbufname
  13.     find-screen "Relay screen"
  14.     select-buffer %prevbuf  ; to make sure we have the right working dir
  15.     delete-other-windows
  16.     !force execute-named-command find-file
  17.     !if $status
  18. *FileFound
  19.         set %tmp $cbufname
  20.         set $scrname %tmp   ; switches screens only if named one exists
  21.         !if &seq $scrname %tmp
  22.             ; that screen already exists (we are now in it)
  23.             set $curwind 1
  24.             !while ¬ &seq $cbufname %tmp
  25.                 !if &equ $numwind $curwind
  26.                     ; we cannot find the desired buffer in any window!
  27.                     set $scrname "Relay screen"
  28.                     set %tmp &cat %tmp "."
  29.                     !force rename-screen %tmp
  30.                     !while ¬ $status
  31.                         set %tmp &cat %tmp "."
  32.                         !force rename-screen %tmp
  33.                     !endwhile
  34.                     clear-message-line
  35.                     !return
  36.                 !endif
  37.                 next-window
  38.             !endwhile
  39.             ; we found the right window within the existing screen
  40.             !force delete-screen "Relay screen"
  41.         !else
  42.             ; that screen does not exist yet
  43.             rename-screen $cbufname
  44.             80 change-screen-width
  45.         !endif
  46.     !else
  47.         ; find-file failed
  48.         !if &seq $cbufname %prevbuf
  49.             ; buf name did not change ==> file-find was canceled
  50.             find-screen %prevscr
  51.             !force delete-screen "Relay screen"
  52.         !else
  53.             ; buf name changed ==> it is a new file
  54.             !goto FileFound
  55.         !endif
  56.     !endif
  57. !endm
  58. macro-to-key    open-file   ^X^F
  59. unbind-menu     ">&File>&Open..."
  60. macro-to-menu   open-file   "&Open...@0"
  61.  
  62. store-procedure rebuild-screens
  63. ; makes sure there is one screen per visible buffer
  64. ; does not affect screens whose name do not match an existing buffer
  65.     find-screen "Relay screen"
  66.     select-buffer "Relay screen"
  67.     delete-other-windows
  68.     minimize-screen
  69.     !goto BufLoop
  70.     !while ¬ &seq $cbufname "Relay screen"
  71. *BufLoop
  72.         find-screen "Relay screen"
  73.         next-buffer
  74.         !if ¬ &sin "Relay screenBinding listFunction listVariable list" $cbufname
  75.             find-screen $cbufname
  76.             select-buffer $scrname
  77.             delete-other-windows
  78.             restore-screen
  79.         !endif
  80.     !endwhile
  81.     cascade-screens
  82.     !if &seq $scrname "Relay screen"
  83.         cycle-screens
  84.     !endif
  85.     !force delete-screen "Relay screen"
  86. !endm
  87. macro-to-menu   rebuild-screens ">S&creen>&Rebuild@0"
  88.  
  89. store-procedure kill-screen
  90.     set %prevscr $scrname
  91.     set %prevbuf $cbufname
  92.     cycle-screens
  93.     !force delete-screen %prevscr
  94.     !if $status
  95.         !force delete-buffer %prevbuf
  96.     !endif
  97. !endm
  98. macro-to-key    kill-screen A-K
  99. macro-to-menu   kill-screen     ">S&creen>&Kill@6"
  100.