[Openmcl-cvs-notifications] r7557 - in /trunk/ccl/cocoa-ide: ./ ide-contents/Resources/ ide-contents/Resources/English.lproj/preferences.nib/

rme at clozure.com rme at clozure.com
Tue Oct 30 20:37:34 MDT 2007


Author: rme
Date: Tue Oct 30 22:37:34 2007
New Revision: 7557

Log:
New preferences controller, with updated nib and some toolbar item icons.

Added:
    trunk/ccl/cocoa-ide/ide-contents/Resources/Appearance.tiff   (with prop=
s)
    trunk/ccl/cocoa-ide/ide-contents/Resources/Documentation.icns   (with p=
rops)
    trunk/ccl/cocoa-ide/ide-contents/Resources/Encodings.tiff   (with props)
    trunk/ccl/cocoa-ide/preferences.lisp
Modified:
    trunk/ccl/cocoa-ide/ide-contents/Resources/English.lproj/preferences.ni=
b/classes.nib
    trunk/ccl/cocoa-ide/ide-contents/Resources/English.lproj/preferences.ni=
b/info.nib
    trunk/ccl/cocoa-ide/ide-contents/Resources/English.lproj/preferences.ni=
b/keyedobjects.nib

Added: trunk/ccl/cocoa-ide/ide-contents/Resources/Appearance.tiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
Binary file - no diff available.

Propchange: trunk/ccl/cocoa-ide/ide-contents/Resources/Appearance.tiff
---------------------------------------------------------------------------=
---
    svn:mime-type =3D application/octet-stream

Added: trunk/ccl/cocoa-ide/ide-contents/Resources/Documentation.icns
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
Binary file - no diff available.

Propchange: trunk/ccl/cocoa-ide/ide-contents/Resources/Documentation.icns
---------------------------------------------------------------------------=
---
    svn:mime-type =3D application/octet-stream

Added: trunk/ccl/cocoa-ide/ide-contents/Resources/Encodings.tiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
Binary file - no diff available.

Propchange: trunk/ccl/cocoa-ide/ide-contents/Resources/Encodings.tiff
---------------------------------------------------------------------------=
---
    svn:mime-type =3D application/octet-stream

Modified: trunk/ccl/cocoa-ide/ide-contents/Resources/English.lproj/preferen=
ces.nib/classes.nib
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/ccl/cocoa-ide/ide-contents/Resources/English.lproj/preferences.ni=
b/classes.nib (original)
+++ trunk/ccl/cocoa-ide/ide-contents/Resources/English.lproj/preferences.ni=
b/classes.nib Tue Oct 30 22:37:34 2007
@@ -1,17 +1,57 @@
-{
-    IBClasses =3D (
-        {CLASS =3D LispPreferencesPanel; LANGUAGE =3D ObjC; SUPERCLASS =3D=
 NSPanel; }, =

-        {
-            ACTIONS =3D {
-                fontPanelForDefaultFont =3D id; =

-                fontPanelForModelineFont =3D id; =

-                selectCCLdirectory =3D id; =

-                selectHyperspecFileURL =3D id; =

-            }; =

-            CLASS =3D LispPreferencesWindowController; =

-            LANGUAGE =3D ObjC; =

-            SUPERCLASS =3D NSWindowController; =

-        }
-    ); =

-    IBVersion =3D 1; =

-}
+<?xml version=3D"1.0" encoding=3D"UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com=
/DTDs/PropertyList-1.0.dtd">
+<plist version=3D"1.0">
+<dict>
+	<key>IBClasses</key>
+	<array>
+		<dict>
+			<key>CLASS</key>
+			<string>LispPreferencesPanel</string>
+			<key>LANGUAGE</key>
+			<string>ObjC</string>
+			<key>SUPERCLASS</key>
+			<string>NSPanel</string>
+		</dict>
+		<dict>
+			<key>ACTIONS</key>
+			<dict>
+				<key>selectCCLDirectory</key>
+				<string>id</string>
+				<key>showFontPanel</key>
+				<string>id</string>
+			</dict>
+			<key>CLASS</key>
+			<string>PreferencesWindowController</string>
+			<key>LANGUAGE</key>
+			<string>ObjC</string>
+			<key>OUTLETS</key>
+			<dict>
+				<key>appearancePrefs</key>
+				<string>id</string>
+				<key>cclPathButton</key>
+				<string>id</string>
+				<key>documentationPrefs</key>
+				<string>id</string>
+				<key>editorTabViewItem</key>
+				<string>id</string>
+				<key>encodingsPrefs</key>
+				<string>id</string>
+				<key>generalPrefs</key>
+				<string>id</string>
+				<key>hyperspecURLButton</key>
+				<string>id</string>
+				<key>listenerFontName</key>
+				<string>id</string>
+				<key>listenerTabViewItem</key>
+				<string>id</string>
+				<key>tabView</key>
+				<string>id</string>
+				<key>window</key>
+				<string>id</string>
+			</dict>
+		</dict>
+	</array>
+	<key>IBVersion</key>
+	<string>1</string>
+</dict>
+</plist>

Modified: trunk/ccl/cocoa-ide/ide-contents/Resources/English.lproj/preferen=
ces.nib/info.nib
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/ccl/cocoa-ide/ide-contents/Resources/English.lproj/preferences.ni=
b/info.nib (original)
+++ trunk/ccl/cocoa-ide/ide-contents/Resources/English.lproj/preferences.ni=
b/info.nib Tue Oct 30 22:37:34 2007
@@ -1,21 +1,17 @@
 <?xml version=3D"1.0" encoding=3D"UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.=
apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com=
/DTDs/PropertyList-1.0.dtd">
 <plist version=3D"1.0">
 <dict>
-	<key>IBDocumentLocation</key>
-	<string>69 44 356 240 0 0 1280 1002 </string>
 	<key>IBFramework Version</key>
-	<string>446.1</string>
+	<string>629</string>
 	<key>IBOldestOS</key>
-	<integer>5</integer>
+	<integer>4</integer>
 	<key>IBOpenObjects</key>
 	<array>
-		<integer>1</integer>
+		<integer>1500857</integer>
 	</array>
 	<key>IBSystem Version</key>
-	<string>8R218</string>
-	<key>IBUsesTextArchiving</key>
-	<true/>
+	<string>9A581</string>
 	<key>targetFramework</key>
 	<string>IBCocoaFramework</string>
 </dict>

Modified: trunk/ccl/cocoa-ide/ide-contents/Resources/English.lproj/preferen=
ces.nib/keyedobjects.nib
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
Binary files - no diff available.

Added: trunk/ccl/cocoa-ide/preferences.lisp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/ccl/cocoa-ide/preferences.lisp (added)
+++ trunk/ccl/cocoa-ide/preferences.lisp Tue Oct 30 22:37:34 2007
@@ -1,0 +1,294 @@
+;;;-*-Mode: LISP; Package: CCL -*-
+;;;
+;;;   Copyright (C) 2007 Clozure Associates
+;;;   This file is part of OpenMCL.  =

+;;;
+;;;   OpenMCL is licensed under the terms of the Lisp Lesser GNU Public
+;;;   License , known as the LLGPL and distributed with OpenMCL as the
+;;;   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
+;;;   which is distributed with OpenMCL as the file "LGPL".  Where these
+;;;   conflict, the preamble takes precedence.  =

+;;;
+;;;   OpenMCL is referenced in the preamble as the "LIBRARY."
+;;;
+;;;   The LLGPL is also available online at
+;;;   http://opensource.franz.com/preamble.html
+
+;;; How to add a new preference pane:
+;;;
+;;; 1. Open preferences.nib with IB.  Drag a Custom View instance from
+;;;    the palette.  Use the inpector to set its class to PreferencesView.
+;;; 2. Inspect File's Owner (which represents an instance of
+;;;    PreferencesWindowController).  Add an outlet for the new
+;;;    preferences view you just made.  Hook up the outlet.  You can
+;;;    add actions here too, if your preferences view will need them.
+;;; 3. Add controls to your view, binding them to the defaults controller.
+;;; 4. Save the nib file.
+;;; 5. In preferences.lisp (this file), edit the defclass form for
+;;;    preferences-window-controller and add a slot that matches the outlet
+;;;    you created in step 2.
+;;; 6. Edit the toolbar delegate methods to add a toolbar item for your
+;;;    new preference view.
+;;; 7. Implement a #/showFooPrefs: method to swap in the view when
+;;;    the toolbar item is clicked.  (See #/showGeneralPrefs: for an
+;;;    example.
+;;; 8. Implement actions, if needed.
+
+(in-package "CCL")
+
+(eval-when (:compile-toplevel :execute)
+  (use-interface-dir :cocoa))
+
+;;; A view that keeps track of its initial size.
+(defclass preferences-view (ns:ns-view)
+  ((width :accessor width)
+   (height :accessor height))
+  (:metaclass ns:+ns-object))
+
+(objc:defmethod (#/awakeFromNib :void) ((self preferences-view))
+  (let* ((frame (#/frame self)))
+    (setf (width self) (ns-width frame)
+	  (height self) (ns-height frame))))
+
+(defclass font-to-name-transformer (ns:ns-value-transformer)
+  ()
+  (:metaclass ns:+ns-object))
+
+(objc:defmethod (#/transformedValueClass :<C>lass)
+    ((self +font-to-name-transformer))
+  ns:ns-string)
+
+(objc:defmethod (#/allowsReverseTransformation :<BOOL>)
+    ((self +font-to-name-transformer))
+  nil)
+
+;;; Produce description of NSFont object, e.g., "Monaco 10"
+(objc:defmethod #/transformedValue: ((self font-to-name-transformer) value)
+  (let* ((font (#/unarchiveObjectWithData: ns:ns-unarchiver value))
+         (name (#/displayName font))
+         (size (#/pointSize font)))
+    (#/stringWithFormat: ns:ns-string #@"%@ %.0f" :id name :<CGF>loat size=
)))
+
+(defclass preferences-window-controller (ns:ns-window-controller)
+  ((tab-view :foreign-type :id :accessor tab-view)
+   (editor-tab-view-item :foreign-type :id :accessor editor-tab-view-item)
+   (listener-tab-view-item :foreign-type :id :accessor listener-tab-view-i=
tem)
+   (ccl-path-button :foreign-type :id :accessor ccl-path-button)
+   (hyperspec-path-button :foreign-type :id :accessor hyperspec-path-butto=
n)
+   (toolbar :foreign-type :id :accessor toolbar)
+   (general-prefs :foreign-type :id :accessor general-prefs)
+   (appearance-prefs :foreign-type :id :accessor appearance-prefs)
+   (documentation-prefs :foreign-type :id :accessor documentation-prefs)
+   (encodings-prefs :foreign-type :id :accessor encodings-prefs))
+  (:metaclass ns:+ns-object))
+
+(objc:defmethod #/init ((self preferences-window-controller))
+  (#/setValueTransformer:forName: ns:ns-value-transformer
+				  (make-instance 'font-to-name-transformer)
+				  #@"FontToName")
+
+  (#/initWithWindowNibName: self #@"preferences")
+  (#/addObserver:selector:name:object: (#/defaultCenter ns:ns-notification=
-center)
+				       self
+				       (@selector #/defaultsDidChange:)
+				       #&NSUserDefaultsDidChangeNotification
+				       (#/standardUserDefaults ns:ns-user-defaults))
+
+  self)
+
+(objc:defmethod (#/windowDidLoad :void) ((self preferences-window-controll=
er))
+  (let* ((window (#/window self)))
+    (with-slots (toolbar) self
+      (setf toolbar (make-instance 'ns:ns-toolbar
+				   :with-identifier #@"preferences-window-toolbar"))
+      (#/setDelegate: toolbar self)
+      (#/setSelectedItemIdentifier: toolbar #@"appearance")
+      (#/setToolbar: window toolbar)
+      (#/release toolbar))
+    (#/showAppearancePrefs: self +null-ptr+)))
+  =

+(objc:defmethod (#/showWindow: :void) ((self preferences-window-controller)
+				       sender)
+  (#/center (#/window self))
+  (call-next-method sender))
+
+(objc:defmethod (#/defaultsDidChange: :void) ((self preferences-window-con=
troller)
+					      notification)
+  (declare (ignore notification))
+  (update-cocoa-defaults))
+
+(defconstant editor-font-button-tag 1)
+(defconstant listener-input-font-button-tag 2)
+(defconstant listener-output-font-button-tag 2)
+
+;;; Ugh.
+(defvar *listener-or-editor* nil)
+
+(objc:defmethod (#/showFontPanel: :void) ((self preferences-window-control=
ler)
+					 sender)
+  (let* ((tag (#/tag sender))
+	 (font-manager (#/sharedFontManager ns:ns-font-manager))
+	 (font nil)
+	 (panel (#/window self)))
+    (ecase tag
+      (1
+       (setq font *editor-font*)
+       (setq *listener-or-editor* :editor))
+      (2
+       (setq font *listener-input-font*)
+       (setq *listener-or-editor* :listener-input))
+      (3
+       (setq font *listener-output-font*)
+       (setq *listener-or-editor* :listener-output)))
+    (#/makeFirstResponder: panel panel)
+    (#/setSelectedFont:isMultiple: font-manager font nil)
+    (#/orderFrontFontPanel: font-manager self)))
+
+;;; This message is sent to the first responder, which is why
+;;; we do the *listener-or-editor* thing.
+(objc:defmethod (#/changeFont: :void) ((self preferences-window-controller)
+					    font-manager)
+  (let* ((defaults (#/standardUserDefaults ns:ns-user-defaults))
+	 (data nil)
+	 (font nil))
+    (ecase *listener-or-editor*
+      (:listener-input
+       (setq font (#/convertFont: font-manager *listener-input-font*))
+       (unless (%null-ptr-p font)
+	 (setq data (#/archivedDataWithRootObject: ns:ns-archiver font))
+	 (#/setObject:forKey: defaults data #@"listenerInputFont")))
+      (:listener-output
+       (setq font (#/convertFont: font-manager *listener-output-font*))
+       (unless (%null-ptr-p font)
+	 (setq data (#/archivedDataWithRootObject: ns:ns-archiver font))
+	 (#/setObject:forKey: defaults data #@"listenerOutputFont")))
+      (:editor
+       (setq font (#/convertFont: font-manager *editor-font*))
+       (unless (%null-ptr-p font)
+	 (setq data (#/archivedDataWithRootObject: ns:ns-archiver font))
+	 (#/setObject:forKey: defaults data #@"editorFont"))))))
+
+(objc:defmethod (#/selectCCLDirectory: :void) ((self preferences-window-co=
ntroller)
+					  sender)
+  (declare (ignore sender))
+  (let* ((panel (#/openPanel ns:ns-open-panel))
+	 (dc (#/sharedUserDefaultsController ns:ns-user-defaults-controller))
+         (values (#/values dc))
+	 (key #@"cclDirectory"))
+    (#/setAllowsMultipleSelection: panel nil)
+    (#/setCanChooseDirectories: panel t)
+    (#/setCanChooseFiles: panel nil)
+    (when (eql (#/runModalForDirectory:file:types: panel
+						   (#/valueForKey: values key)
+						   +null-ptr+
+						   +null-ptr+)
+	       #$NSOKButton)
+      ;; #/stringByStandardizingPath seems to strip trailing slashes
+      (let* ((filename (#/stringByAppendingString:
+                        (#/stringByStandardizingPath
+			 (#/objectAtIndex: (#/filenames panel) 0))
+			#@"/")))
+        (#/setValue:forKey: values filename key)))))
+
+
+;;; toolbar delegate methods
+
+(objc:defmethod #/toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:
+		((self preferences-window-controller)
+		 toolbar itemIdentifier (flag :<BOOL>))
+  (declare (ignore toolbar))
+  (let ((item +null-ptr+))
+    (cond
+     ((#/isEqualToString: itemIdentifier #@"general")
+      (setf item (make-instance 'ns:ns-toolbar-item
+				:with-item-identifier itemIdentifier))
+      (#/setLabel: item #@"General")
+      (#/setImage: item (#/imageNamed: ns:ns-image #&NSImageNamePreference=
sGeneral))
+      (#/setTarget: item self)
+      (#/setAction: item (@selector #/showGeneralPrefs:)))
+     ((#/isEqualToString: itemIdentifier #@"appearance")
+      (setf item (make-instance 'ns:ns-toolbar-item
+				:with-item-identifier itemIdentifier))
+      (#/setLabel: item #@"Appearance")
+      (#/setImage: item (#/imageNamed: ns:ns-image #@"Appearance"))
+      (#/setTarget: item self)
+      (#/setAction: item (@selector #/showAppearancePrefs:)))
+     ((#/isEqualToString: itemIdentifier #@"documentation")
+      (setf item (make-instance 'ns:ns-toolbar-item
+				:with-item-identifier itemIdentifier))
+      (#/setLabel: item #@"Documentation")
+      (#/setImage: item (#/imageNamed: ns:ns-image #@"Documentation"))
+      (#/setTarget: item self)
+      (#/setAction: item (@selector #/showDocumentationPrefs:)))
+     ((#/isEqualToString: itemIdentifier #@"encodings")
+      (setf item (make-instance 'ns:ns-toolbar-item
+				:with-item-identifier itemIdentifier))
+      (#/setLabel: item #@"Encodings")
+      (#/setImage: item (#/imageNamed: ns:ns-image #@"Encodings"))
+      (#/setTarget: item self)
+      (#/setAction: item (@selector #/showEncodingsPrefs:))))
+    (#/autorelease item)))
+
+(objc:defmethod #/toolbarDefaultItemIdentifiers:
+		((self preferences-window-controller) toolbar)
+  (declare (ignore toolbar))
+  (#/arrayWithObjects: ns:ns-array #@"general"
+		       #@"appearance"
+		       #@"documentation"
+		       #@"encodings"
+		       +null-ptr+)) ; don't even think about putting nil here
+
+(objc:defmethod #/toolbarAllowedItemIdentifiers:
+		((self preferences-window-controller) toolbar)
+  (declare (ignore toolbar))
+  (#/arrayWithObjects: ns:ns-array #@"general"
+		       #@"appearance"
+		       #@"documentation"
+		       #@"encodings"
+		       +null-ptr+))
+
+(objc:defmethod #/toolbarSelectableItemIdentifiers:
+		((self preferences-window-controller) toolbar)
+  (declare (ignore toolbar))
+  (#/arrayWithObjects: ns:ns-array #@"general"
+		       #@"appearance"
+		       #@"documentation"
+		       #@"encodings"
+		       +null-ptr+))
+
+(defun switch-content-view (window view)
+  (#/setContentView: window view)
+  (let* ((frame (#/frame window))
+	 (min-size (#/minSize window))
+	 (new-frame nil)
+	 (content-rect (#/contentRectForFrameRect: window frame))
+	 (dy (- (height view)
+		(ns-height content-rect))))
+    (decf (ns:ns-rect-y content-rect) dy)
+    (incf (ns:ns-rect-height content-rect) dy)
+    (setf (ns:ns-rect-width content-rect) (max (width view)
+					       (ns:ns-size-width min-size)))
+    (setq new-frame (#/frameRectForContentRect: window content-rect))
+    (#/setFrame:display:animate: window new-frame t t)))
+
+;;; toolbar actions
+
+(objc:defmethod (#/showGeneralPrefs: :void) ((self preferences-window-cont=
roller)
+						sender)
+  (declare (ignore sender))
+  (switch-content-view (#/window self) (general-prefs self)))
+
+(objc:defmethod (#/showAppearancePrefs: :void) ((self preferences-window-c=
ontroller)
+						sender)
+  (declare (ignore sender))
+  (switch-content-view (#/window self) (appearance-prefs self)))
+
+(objc:defmethod (#/showDocumentationPrefs: :void) ((self preferences-windo=
w-controller)
+						sender)
+  (declare (ignore sender))
+  (switch-content-view (#/window self) (documentation-prefs self)))
+
+(objc:defmethod (#/showEncodingsPrefs: :void) ((self preferences-window-co=
ntroller)
+						sender)
+  (declare (ignore sender))
+  (switch-content-view (#/window self) (encodings-prefs self)))




More information about the Openmcl-cvs-notifications mailing list