;; vtwm-squeezed-window.gwm --- VTWM Squeezed Title Window 
;;
;; Author: Anders Holst  (aho@sans.kth.se)  
;; Copyright (C) 1995  Anders Holst
;; Version: vtwm-1.0
;; Last change: 6/6 1995
;;
;; This file is copyrighted under the same terms as the rest of GWM
;; (see the X Inc license for details). There is no warranty that it
;; works. 
;;
;; --------------------------------------------------------------------- 
;;
;; This file defines squeezed title style windows for the VTWM profile.
;; It requires that the normal "vtwm-window.gwm" is already loaded.
;; Use 'set-window' to specify which windows should have squeezed titles.
;;

(defaults-to 
  vtwm-squeezed-hilite-size 11           ;; Size of area showing focus
  vtwm-squeezed-title-position 'left     ;; Left, right or center
)

(defun vtwm-squeezed-innerbar ()
  (with (borderwidth 0
         cols (vtwm-get-color)
         vtwm-title-foreground (or (# 0 cols) vtwm-title-foreground)
         vtwm-title-background (or (# 1 cols) vtwm-title-background)
         property (+ (list 'fg vtwm-title-foreground
                           'bg vtwm-title-background)
                     property)
         background vtwm-title-background
         fsm (vtwm-titlebar-fsm) 
         plug-separator 0
         borderpixel vtwm-bordercolor
         bar-min-width 1 bar-max-width 10000
         bar-list (+ (vtwm-make-pluglist vtwm-left-plugs)
                     (list (vtwm-space-plug 5)
                           (vtwm-name-plug) 
                           (if (and vtwm-squeezed-hilite-size
                                    (> vtwm-squeezed-hilite-size 0))
                             (with (borderwidth 3
                                    borderpixel vtwm-title-background
                                    fsm (vtwm-titlebar-inner-fsm)
                                    bar-min-width vtwm-squeezed-hilite-size
                                    bar-max-width vtwm-squeezed-hilite-size)
                               (bar-make ()))
                             (vtwm-space-plug 3))
                           (vtwm-space-plug 2))
                     (vtwm-make-pluglist vtwm-right-plugs)))
    (apply bar-make bar-list)))

(defun vtwm-squeezed-titlebar ()
  (with (borderwidth 0
         tile t
         background vtwm-bordercolor
         fsm ()
         bar-max-width 10000
         plug-separator 0)
    (bar-make (bar-make (with (tile t
                               fsm (vtwm-borderbar-fsm)
                               background vtwm-bordercolor
                               bar-min-width vtwm-borderwidth
                               bar-max-width 10000)
                          (if (= vtwm-squeezed-title-position 'right)
                              (bar-make ()
                                        (with (tile ()) (bar-make ))
                                        (with (tile ()) 
                                          (bar-make (bar-make )
                                                    (vtwm-squeezed-innerbar)))
                                        (with (tile ()) (bar-make )))
                            (= vtwm-squeezed-title-position 'center)
                              (bar-make ()
                                        (with (tile ()) (bar-make ))
                                        (with (tile ()) 
                                          (bar-make (bar-make )
                                                    (vtwm-squeezed-innerbar)))
                                        (with (tile ()) (bar-make ))
                                        ())
                            (bar-make (with (tile ()) (bar-make ))
                                      (with (tile ()) 
                                        (bar-make (bar-make )
                                                  (vtwm-squeezed-innerbar)))
                                      (with (tile ()) (bar-make ))
                                      ())))
                        (with (tile ()
                               fsm (vtwm-borderbar-fsm)
                               background vtwm-bordercolor
                               bar-min-width vtwm-borderwidth
                               bar-max-width vtwm-borderwidth)
                          (bar-make ))))))


(defun vtwm-squeezed-window ()
  (with (inner-borderwidth 0
         borderwidth 0
         fsm (vtwm-titled-window-fsm)
         borderpixel vtwm-bordercolor)
    (window-make (vtwm-squeezed-titlebar)
                 (vtwm-borderbar)
                 (vtwm-borderbar)
                 (vtwm-borderbar)
                 ())))

