[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tab size
- To: cartier@math.uqam.ca (Guillaume Cartier)
- Subject: Re: tab size
- From: moon (David A. Moon)
- Date: Mon, 16 Dec 91 15:52:59 EST
- Cc: info-mcl@cambridge.apple.com (Macintosh Common Lisp)
> Date: Thu, 12 Dec 91 15:57:11 -0500
> From: cartier@math.uqam.ca (Guillaume Cartier)
>
> Is there a way to set tab size for a specific Fred window?
Here's the hack that I use. I don't claim this is officially approved as
the right way to do this in MCL:
(add-menu-items (find-menu "Tools")
(make-instance 'menu-item
:menu-item-title "Close All Inspectors"
:menu-item-action
#'(lambda ()
(dolist (window (windows :class 'inspector::inspector-window))
(window-close window))))
(make-instance 'menu-item
:menu-item-title "Tab Width..."
:menu-item-action 'tab-width-dialog))
(defun tab-width-dialog ()
(let ((window (front-window :class 'fred-window))
answer-item)
(unless window
(#_SysBeep 1)
(return-from tab-width-dialog))
(let ((dialog (MAKE-INSTANCE 'DIALOG
:WINDOW-TYPE :DOUBLE-EDGE-BOX :VIEW-POSITION '(:TOP 60)
:VIEW-SIZE #@(300 150)
:CLOSE-BOX-P NIL
:VIEW-FONT '("Chicago" 12 :SRCOR :PLAIN)
:VIEW-SUBVIEWS
(LIST (MAKE-DIALOG-ITEM 'STATIC-TEXT-DIALOG-ITEM
#@(16 12)
#@(93 16)
"Tab width of "
NIL
:DIALOG-ITEM-ENABLED-P T)
(MAKE-DIALOG-ITEM 'STATIC-TEXT-DIALOG-ITEM
#@(108 12)
#@(183 16)
(window-title window)
NIL
:DIALOG-ITEM-ENABLED-P T)
(MAKE-DIALOG-ITEM 'BUTTON-DIALOG-ITEM
#@(37 123)
#@(62 16)
"Cancel"
#'(LAMBDA (ITEM)
ITEM
(return-from-modal-dialog t))
:DEFAULT-BUTTON NIL)
(MAKE-DIALOG-ITEM 'BUTTON-DIALOG-ITEM
#@(209 124)
#@(62 16)
"OK"
#'(LAMBDA (ITEM)
ITEM
(setf (fred-tabcount window)
(parse-integer
(dialog-item-text
answer-item)))
(invalidate-view window)
;;--- Bug: this fails to recompute
;;--- the screen position of the
;;--- insertion cursor.
(return-from-modal-dialog t))
:DEFAULT-BUTTON T)
(setq answer-item
(MAKE-DIALOG-ITEM 'EDITABLE-TEXT-DIALOG-ITEM
#@(80 47)
#@(84 16)
(princ-to-string
(fred-tabcount window))
NIL
:ALLOW-RETURNS NIL))))))
(modal-dialog dialog t))))