(FILECREATED "16-Dec-85 16:56:22" {ERIS}<LISPUSERS>KOTO>TINYTIDY.;2 4227   

      changes to:  (FNS TINYTIDY)

      previous date: " 3-Feb-85 23:10:58" {ERIS}<LISPUSERS>KOTO>TINYTIDY.;1)


(* Copyright (c) 1984, 1985 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT TINYTIDYCOMS)

(RPAQQ TINYTIDYCOMS [(FNS MOVEICON TINYTIDY)
		       (INITVARS (TINYTIDY.DEFAULT (QUOTE RIGHTBOTTOM))
				 (TINYTIDY.DEFAULT.ALL (QUOTE LEFT)))
		       (P (COND ((NOT (FASSOC (QUOTE TinyTidy)
					      BackgroundMenuCommands))
				 (PUSH BackgroundMenuCommands (QUOTE (TinyTidy (TINYTIDY)
									       
								"aligns all icons on screen edge")))
				 (SETQ BackgroundMenu NIL])
(DEFINEQ

(MOVEICON
  [LAMBDA (WINDOW ICON X Y)                                  (* lmm "24-Aug-84 12:37")
    (if (NEQ WINDOW ICON)
	then (PUTWINDOWPROP WINDOW (QUOTE ICONPOSITION)
			    (CONS X Y)))
    (if (GETWINDOWPROP ICON (QUOTE ATTACHEDWINDOWS))
	then 

          (* this is a workaround for what I think is a bug in attached windows, namely that MOVEW coordinates move the main
	  window, not the attached windows)


	     [PROG ((REGION (WINDOWREGION ICON)))
	           (RELMOVEW ICON (CONS (IDIFFERENCE X (fetch (REGION LEFT) of REGION))
					(IDIFFERENCE Y (fetch (REGION BOTTOM) of REGION]
      else (MOVEW ICON X Y])

(TINYTIDY
  [LAMBDA (EDGE SPACING ALL)                                 (* ejs: " 3-Feb-85 23:08")
    (OR SPACING (SETQ SPACING 4))
    (OR EDGE (SETQ EDGE (if ALL
				then TINYTIDY.DEFAULT.ALL
			      else TINYTIDY.DEFAULT)))
    (for OW in (OPENWINDOWS) bind ICON (X ← 0)
					  (Y ← 0)
					  (MAXY ← 0)
					  W H REGION
       when (COND
		((GETWINDOWPROP OW (QUOTE ICONFOR))      (* I'm an icon)
		  (SETQ ICON OW))
		[(SETQ ICON (GETWINDOWPROP OW (QUOTE ICONWINDOW)))
                                                             (* I've got an icon window)
		  (AND (WINDOWP ICON)
			 (NOT (OPENWP ICON]
		([OR (GETWINDOWPROP OW (QUOTE ICONP))
		       (AND ALL (NOT (GETWINDOWPROP OW (QUOTE MAINWINDOW]
                                                             (* I have an ICONP property or else ALL is specified 
							     (unless I'm an attached window))
                                                             (* treat as icon even though not)
		  (SETQ ICON OW)))
       do (SETQ REGION (WINDOWREGION ICON))
	    (SETQ H (fetch (REGION HEIGHT) of REGION))
	    (SETQ W (fetch (REGION WIDTH) of REGION))
	    (if (ILEQ (SELECTQ EDGE
				     ((BOTTOM TOP BOTTOMRIGHT TOPRIGHT)
				       SCREENWIDTH)
				     (PROGN (swap W H)
					      SCREENHEIGHT))
			  (IPLUS X W))
		then (SETQ X 0)
		       (add Y MAXY SPACING)
		       (SETQ MAXY 0))
	    (SELECTQ EDGE
		       (BOTTOM (MOVEICON OW ICON X Y))
		       (BOTTOMRIGHT (MOVEICON OW ICON (IDIFFERENCE SCREENWIDTH (IPLUS X W))
						Y))
		       [LEFT (MOVEICON OW ICON Y (IDIFFERENCE SCREENHEIGHT (IPLUS X W]
		       (LEFTBOTTOM (MOVEICON OW ICON Y X))
		       [TOP (MOVEICON OW ICON X (IDIFFERENCE SCREENHEIGHT (IPLUS Y H]
		       [TOPRIGHT (MOVEICON OW ICON (IDIFFERENCE SCREENWIDTH (IPLUS X W))
					     (IDIFFERENCE SCREENHEIGHT (IPLUS Y H]
		       [RIGHT (MOVEICON OW ICON (IDIFFERENCE SCREENWIDTH (IPLUS Y H))
					  (IDIFFERENCE SCREENHEIGHT (IPLUS X W]
		       (RIGHTBOTTOM (MOVEICON OW ICON (IDIFFERENCE SCREENWIDTH (IPLUS Y H))
						X))
		       (SHOULDNT))
	    (add X W SPACING)
	    (SETQ MAXY (IMAX MAXY H])
)

(RPAQ? TINYTIDY.DEFAULT (QUOTE RIGHTBOTTOM))

(RPAQ? TINYTIDY.DEFAULT.ALL (QUOTE LEFT))
(COND ((NOT (FASSOC (QUOTE TinyTidy)
		    BackgroundMenuCommands))
       (PUSH BackgroundMenuCommands (QUOTE (TinyTidy (TINYTIDY)
						     "aligns all icons on screen edge")))
       (SETQ BackgroundMenu NIL)))
(PUTPROPS TINYTIDY COPYRIGHT ("Xerox Corporation" 1984 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (691 3831 (MOVEICON 701 . 1376) (TINYTIDY 1378 . 3829)))))
STOP