home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gwm18a.zip / data / vtwm-squeezed-window2.gwm < prev    next >
Lisp/Scheme  |  1995-07-03  |  7KB  |  180 lines

  1. ;; vtwm-squeezed-window2.gwm --- VTWM Squeezed Title Window 
  2. ;;
  3. ;; Author: Anders Holst  (aho@sans.kth.se)  
  4. ;; Copyright (C) 1995  Anders Holst
  5. ;; Version: vtwm-1.0
  6. ;; Last change: 6/6 1995
  7. ;;
  8. ;; This file is copyrighted under the same terms as the rest of GWM
  9. ;; (see the X Inc license for details). There is no warranty that it
  10. ;; works. 
  11. ;;
  12. ;; --------------------------------------------------------------------- 
  13. ;;
  14. ;; This file defines squeezed title style windows for the VTWM profile.
  15. ;; It requires that the normal "vtwm-window.gwm" is already loaded.
  16. ;; Use 'set-window' to specify which windows should have squeezed titles.
  17. ;;
  18. ;; The windows defined here are slightly different from those in
  19. ;; "vtwm-squeezed-window.gwm", in that the title is never truncated. This
  20. ;; looks better, but makes resize more complicated, and slightly
  21. ;; unintuitive in some cases.
  22. ;;
  23.  
  24. (defaults-to 
  25.   vtwm-squeezed-hilite-size 11           ;; Size of area showing focus
  26.   vtwm-squeezed-title-position 'left     ;; Left, right or center
  27. )
  28.  
  29. (defun vtwm-squeezed2-innerbar ()
  30.   (with (borderwidth 0
  31.          cols (vtwm-get-color)
  32.          vtwm-title-foreground (or (# 0 cols) vtwm-title-foreground)
  33.          vtwm-title-background (or (# 1 cols) vtwm-title-background)
  34.          property (+ (list 'fg vtwm-title-foreground
  35.                            'bg vtwm-title-background)
  36.                      property)
  37.          background vtwm-title-background
  38.          fsm (vtwm-titlebar-fsm) 
  39.          plug-separator 0
  40.          borderpixel vtwm-bordercolor
  41.          bar-min-width 1 bar-max-width 10000
  42.          bar-list (+ (vtwm-make-pluglist vtwm-left-plugs)
  43.                      (list (vtwm-space-plug 5)
  44.                            (vtwm-name-plug) 
  45.                            (with (borderwidth 3
  46.                                   borderpixel vtwm-title-background
  47.                                   fsm (fsm-make vtwm-titlebar-inner-behavior)
  48.                                   bar-min-width vtwm-squeezed-hilite-size
  49.                                   bar-max-width vtwm-squeezed-hilite-size)
  50.                              (bar-make ))
  51.                            (vtwm-space-plug 2))
  52.                      (vtwm-make-pluglist vtwm-right-plugs)))
  53.     (apply bar-make bar-list)))
  54.  
  55. (defun vtwm-squeezed2-titlebar ()
  56.   (with (borderwidth 0
  57.          tile t
  58.          background vtwm-bordercolor
  59.          fsm (fsm-make vtwm-squeezed2-resize-behavior1)
  60.          bar-max-width 10000
  61.          plug-separator 0)
  62.     (bar-make (with (fsm (vtwm-borderbar-fsm))
  63.                 (bar-make (with (tile t
  64.                                  background vtwm-bordercolor
  65.                                  bar-min-width vtwm-borderwidth
  66.                                  bar-max-width 10000)
  67.                           (if (= vtwm-squeezed-title-position 'right)
  68.                               (bar-make ()
  69.                                         (with (tile ()) (bar-make ))
  70.                                         (with (tile ()) 
  71.                                           (bar-make (bar-make )
  72.                                                     (vtwm-squeezed2-innerbar)))
  73.                                         (with (tile ()) (bar-make )))
  74.                             (= vtwm-squeezed-title-position 'center)
  75.                               (bar-make ()
  76.                                         (with (tile ()) (bar-make ))
  77.                                         (with (tile ()) 
  78.                                           (bar-make (bar-make )
  79.                                                     (vtwm-squeezed2-innerbar)))
  80.                                         (with (tile ()) (bar-make ))
  81.                                         ())
  82.                             (bar-make (with (tile ()) (bar-make ))
  83.                                       (with (tile ()) 
  84.                                         (bar-make (bar-make )
  85.                                                   (vtwm-squeezed2-innerbar)))
  86.                                       (with (tile ()) (bar-make ))
  87.                                       ())))
  88.                           (with (tile ()
  89.                                  background vtwm-bordercolor
  90.                                  bar-min-width vtwm-borderwidth
  91.                                  bar-max-width vtwm-borderwidth)
  92.                                 (bar-make )))))))
  93.  
  94. (defun vtwm-squeezed2-leftborder ()
  95.   (with (borderwidth 0
  96.          tile t
  97.          background vtwm-bordercolor
  98.          fsm (fsm-make vtwm-squeezed2-resize-behavior1)
  99.          plug-separator 0
  100.          border (with (tile ()
  101.                             fsm (vtwm-borderbar-fsm)
  102.                             background vtwm-bordercolor
  103.                             bar-min-width vtwm-borderwidth
  104.                             bar-max-width vtwm-borderwidth)
  105.                         (bar-make )))
  106.     (if (or (= vtwm-squeezed-title-position 'right)
  107.             (= vtwm-squeezed-title-position 'center))
  108.         (bar-make (with (fsm ())
  109.                     (bar-make () border)))
  110.       border)))
  111.  
  112. (defun vtwm-squeezed2-rightborder ()
  113.   (with (borderwidth 0
  114.          tile t
  115.          background vtwm-bordercolor
  116.          fsm (fsm-make vtwm-squeezed2-resize-behavior1)
  117.          plug-separator 0
  118.          border (with (tile ()
  119.                             fsm (vtwm-borderbar-fsm)
  120.                             background vtwm-bordercolor
  121.                             bar-min-width vtwm-borderwidth
  122.                             bar-max-width vtwm-borderwidth)
  123.                         (bar-make )))
  124.     (if (not (= vtwm-squeezed-title-position 'right))
  125.         (bar-make (with (fsm ())
  126.                     (bar-make border ())))
  127.       border)))
  128.  
  129. (: vtwm-squeezed2-resize-behavior1
  130.    (state-make 
  131.     (on geometry-change (send-user-event 'bar-resize wob-parent))))
  132.  
  133. (: vtwm-squeezed2-resize-behavior2
  134.    (state-make 
  135.     (on (user-event 'bar-resize)
  136.         (with (newsize (+ window-client-width (* 2 vtwm-borderwidth))
  137.                oldsize wob-width)
  138.           (if (not (= oldsize newsize))
  139.               (wob-tile (pixmap-make newsize
  140.                                      vtwm-borderwidth)))))))
  141.  
  142. (defun vtwm-squeezed2-bottomborder-fsm ()
  143.   (fsm-make
  144.     (state-make
  145.      vtwm-squeezed2-resize-behavior2
  146.      vtwm-borderbar-behavior
  147.      standard-title-behavior)))
  148.  
  149. (defun vtwm-squeezed2-bottomborder ()
  150.   (with (borderwidth 0
  151.          tile t
  152.          background vtwm-bordercolor
  153.          fsm () 
  154.          plug-separator 0
  155.          bottom (with (tile ()
  156.                        fsm (vtwm-squeezed2-bottomborder-fsm)
  157.                        background vtwm-bordercolor
  158.                        bar-min-width vtwm-borderwidth
  159.                        bar-max-width vtwm-borderwidth)
  160.                   (plug-make (pixmap-make (+ window-client-width 
  161.                                              (* 2 vtwm-borderwidth))
  162.                                           vtwm-borderwidth))))
  163.     (if (= vtwm-squeezed-title-position 'right)
  164.         (bar-make () bottom)
  165.       (= vtwm-squeezed-title-position 'center)
  166.         (bar-make () bottom ())
  167.         (bar-make bottom ()))))
  168.  
  169. (defun vtwm-squeezed-window2 ()
  170.   (with (inner-borderwidth 0
  171.          borderwidth 0
  172.          fsm (vtwm-titled-window-fsm)
  173.          borderpixel vtwm-bordercolor)
  174.     (window-make (vtwm-squeezed2-titlebar)
  175.                  (vtwm-squeezed2-leftborder)
  176.                  (vtwm-squeezed2-rightborder)
  177.                  (vtwm-squeezed2-bottomborder)
  178.                  ())))
  179.  
  180.