Changeset 764
- Timestamp:
- Apr 7, 2004, 8:45:57 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/examples/cocoa-editor.lisp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/examples/cocoa-editor.lisp
r749 r764 11 11 (use-interface-dir :cocoa)) 12 12 13 (def-cocoa-default *editor-rows* :int 24 )14 (def-cocoa-default *editor-columns* :int 80 )13 (def-cocoa-default *editor-rows* :int 24 "Initial height of editor windows, in characters") 14 (def-cocoa-default *editor-columns* :int 80 "Initial width of editor windows, in characters") 15 15 16 16 ;;; Background color components: red, blue, green, alpha. 17 17 ;;; All should be single-floats between 0.0f0 and 1.0f0, inclusive. 18 (def-cocoa-default *editor-background-red-component* :float 1.0f0 )19 (def-cocoa-default *editor-background- blue-component* :float 1.0f0)20 (def-cocoa-default *editor-background- green-component* :float 1.0f0)21 (def-cocoa-default *editor-background-alpha-component* :float 1.0f0 )18 (def-cocoa-default *editor-background-red-component* :float 1.0f0 "Red component of editor background color. Should be a float between 0.0 and 1.0, inclusive.") 19 (def-cocoa-default *editor-background-green-component* :float 1.0f0 "Green component of editor background color. Should be a float between 0.0 and 1.0, inclusive.") 20 (def-cocoa-default *editor-background-blue-component* :float 1.0f0 "Blue component of editor background color. Should be a float between 0.0 and 1.0, inclusive.") 21 (def-cocoa-default *editor-background-alpha-component* :float 1.0f0 "Alpha component of editor background color. Should be a float between 0.0 and 1.0, inclusive.") 22 22 23 23 ;;; At runtime, this'll be a vector of character attribute dictionaries. … … 611 611 (defloadvar *modeline-text-attributes* nil) 612 612 613 (def-cocoa-default *modeline-font-name* :string "Courier New Bold Italic") 614 (def-cocoa-default *modeline-font-size* :float 10.0) 613 (def-cocoa-default *modeline-font-name* :string "Courier New Bold Italic" 614 "Name of font to use in modelines") 615 (def-cocoa-default *modeline-font-size* :float 10.0 "Size of font to use in modelines" (single-float 4.0 14.0)) 615 616 616 617 … … 837 838 (defmethod hi::activate-hemlock-view ((view echo-area-view)) 838 839 (let* ((hemlock-frame (send view 'window))) 840 #+debug 0 841 (#_NSLog #@"Activating echo area") 839 842 (send hemlock-frame :make-first-responder view))) 840 843 … … 858 861 859 862 (defun make-echo-area (hemlock-frame x y width height gap-context color) 860 (slet ((frame (ns-make-rect x y width height)) 861 (containersize (ns-make-size 1.0f7 height))) 862 (let* ((buffer (hi:make-buffer (format nil "Echo Area ~d" 863 (prog1 864 *hemlock-frame-count* 865 (incf *hemlock-frame-count*))) 866 :modes '("Echo Area"))) 867 (textstorage 868 (progn 869 (setf (hi::buffer-gap-context buffer) gap-context) 870 (make-textstorage-for-hemlock-buffer buffer))) 871 (doc (make-objc-instance 'echo-area-document)) 872 (layout (make-objc-instance 'ns-layout-manager)) 873 (container (send (make-objc-instance 'ns-text-container 874 :with-container-size 875 containersize) 876 'autorelease))) 877 (send textstorage :add-layout-manager layout) 878 (send layout :add-text-container container) 879 (send layout 'release) 880 (let* ((echo (make-objc-instance 'echo-area-view 881 :with-frame frame 882 :text-container container))) 883 (send echo :set-min-size (ns-make-size 0.0f0 height)) 884 (send echo :set-max-size (ns-make-size 1.0f7 1.0f7)) 885 (send echo :set-rich-text nil) 886 (send echo :set-horizontally-resizable nil) 887 (send echo :set-vertically-resizable nil) 888 (send echo :set-autoresizing-mask #$NSViewWidthSizable) 889 (send echo :set-background-color color) 890 (send container :set-width-tracks-text-view nil) 891 (send container :set-height-tracks-text-view nil) 892 (setf (hemlock-frame-echo-area-buffer hemlock-frame) buffer 893 (slot-value doc 'textstorage) textstorage 894 (hi::buffer-document buffer) doc) 895 896 echo)))) 863 (slet ((frame (ns-make-rect x y width height))) 864 (let* ((box (make-objc-instance "NSView" 865 :with-frame frame))) 866 (send box :set-autoresizing-mask #$NSViewWidthSizable) 867 (slet* ((box-frame (send box 'bounds)) 868 (containersize (ns-make-size 1.0f7 (pref box-frame :<NSR>ect.size.height)))) 869 (let* ((clipview (make-objc-instance "NSClipView" 870 :with-frame box-frame))) 871 (send clipview :set-autoresizing-mask (logior #$NSViewWidthSizable 872 #$NSViewHeightSizable)) 873 (send clipview :set-background-color color) 874 (send box :add-subview clipview) 875 (send box :set-autoresizes-subviews t) 876 (send clipview 'release) 877 (let* ((buffer (hi:make-buffer (format nil "Echo Area ~d" 878 (prog1 879 *hemlock-frame-count* 880 (incf *hemlock-frame-count*))) 881 :modes '("Echo Area"))) 882 (textstorage 883 (progn 884 (setf (hi::buffer-gap-context buffer) gap-context) 885 (make-textstorage-for-hemlock-buffer buffer))) 886 (doc (make-objc-instance 'echo-area-document)) 887 (layout (make-objc-instance 'ns-layout-manager)) 888 (container (send (make-objc-instance 'ns-text-container 889 :with-container-size 890 containersize) 891 'autorelease))) 892 (send textstorage :add-layout-manager layout) 893 (send layout :add-text-container container) 894 (send layout 'release) 895 (let* ((echo (make-objc-instance 'echo-area-view 896 :with-frame box-frame 897 :text-container container))) 898 (send echo :set-min-size (pref box-frame :<NSR>ect.size)) 899 (send echo :set-max-size (ns-make-size 1.0f7 (pref box-frame :<NSR>ect.size))) 900 (send echo :set-rich-text nil) 901 (send echo :set-horizontally-resizable t) 902 (send echo :set-vertically-resizable nil) 903 (send echo :set-autoresizing-mask #$NSViewNotSizable) 904 (send echo :set-background-color color) 905 (send container :set-width-tracks-text-view nil) 906 (send container :set-height-tracks-text-view nil) 907 (setf (hemlock-frame-echo-area-buffer hemlock-frame) buffer 908 (slot-value doc 'textstorage) textstorage 909 (hi::buffer-document buffer) doc) 910 (send clipview :set-document-view echo) 911 (send clipview :set-autoresizes-subviews nil) 912 (send echo 'size-to-fit) 913 (values echo box)))))))) 897 914 898 915 (defun make-echo-area-for-window (w gap-context-for-echo-area-buffer color) 899 916 (let* ((content-view (send w 'content-view))) 900 917 (slet ((bounds (send content-view 'bounds))) 901 (let* ((echo-area (make-echo-area w 7.0f0 5.0f0 (- (pref bounds :<NSR>ect.size.width) 29.0f0) 15.0f0 gap-context-for-echo-area-buffer color))) 902 (send content-view :add-subview echo-area) 918 (multiple-value-bind (echo-area box) 919 (make-echo-area w 920 0.0f0 921 0.0f0 922 (- (pref bounds :<NSR>ect.size.width) 24.0f0) 923 20.0f0 924 gap-context-for-echo-area-buffer 925 color) 926 (send content-view :add-subview box) 903 927 echo-area)))) 904 928 … … 1467 1491 1468 1492 (defun initialize-user-interface () 1493 (send (find-class 'preferences-panel) 'shared-panel) 1469 1494 (update-cocoa-defaults) 1470 1495 (make-editor-style-map))
Note:
See TracChangeset
for help on using the changeset viewer.
