/[cello]/cello/focus.lisp
ViewVC logotype

Contents of /cello/focus.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations)
Mon Jun 16 12:39:20 2008 UTC (5 years, 10 months ago) by ktilton
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +7 -3 lines
nothing special
1 ;; -*- mode: Lisp; Syntax: Common-Lisp; Package: cello; -*-
2 #|
3
4 Copyright (C) 2004 by Kenneth William Tilton
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the Lisp Lesser GNU Public License
8 (http://opensource.franz.com/preamble.html), known as the LLGPL.
9
10 This library is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 See the Lisp Lesser GNU Public License for more details.
14
15 |#
16
17 (in-package :cello)
18
19 #| To do
20
21 - IXEditSelection needs a home
22
23 ;;; also got FFComposite rule deciding it was active if any kid was
24
25 arrange for Focuser to process clicks and keys first, then mebbe dump into dvk,
26 bottom up from focus/imageunder
27
28 arrange for Controller to process clicks first, then mebbe dump into
29 bottom up from focus/imageunder
30
31 add finalization for radio button (look at others, see if ICR can ne de-celled
32
33 when focused and editactive, push caret onto kids of cttext? or work out how to show
34 it without it being a kid there
35
36 |#
37
38
39 (defmd focuser (ix-canvas)
40 (focus (c-in nil))
41 textual-focus
42 (edit-active (c-in nil))
43 (insertion-pt (c-in 0))
44 (sel-end (c-in nil))
45 (sel-range nil :documentation "selEnd identified during drag operation")
46 (undo-data nil :cell nil
47 :documentation "Data structure holding undo information")
48 :kids (c? (the-kids (^content))))
49
50
51 (export! ^focus focus .focus focus-find-first .focuser)
52
53 ;;;(defobserver focus ((self focuser))
54 ;;; (when (and (null new-value) old-value)
55 ;;; (break "focus nilling"))
56 ;;; (TRC "focus-observe" self new-value old-value))
57
58 (defun focuser (self)
59 (swdw))
60
61 (define-symbol-macro .focuser (focuser self))
62
63 (defmethod (setf focus) :around (new-focus self) ;; better be Focuser
64 (let ((curr-focus (slot-value self 'focus)))
65 #+xxx (trc "setf focus :around sees focuser,new,curr" self new-focus curr-focus)
66 (unless (eql new-focus curr-focus)
67 (focus-lose curr-focus new-focus)
68 (focus-gain new-focus))
69 (call-next-method)))
70
71 (export! focused-on ^focused-on)
72
73 (defmodel focus ()
74 ((focus-thickness :cell nil :initarg :focus-thickness
75 :initform (u96ths 3)
76 :accessor focus-thickness)
77
78 (tab-mode :documentation ":ceiling :stop or nil"
79 :cell nil :initarg :tab-mode
80 :initform :stop
81 :accessor tab-mode)
82
83 (focused-on :initarg :focused-on
84 :initform (c-in nil)
85 :accessor focused-on)))
86
87 (defun tabstopp (self)
88 (eql :stop (tab-mode self)))
89
90 (defmethod tab-mode (other)
91 (declare (ignore other))
92 nil)
93
94 (defmethod edit-requires-activation (self)
95 (declare (ignore self)))
96
97 (defmodel focus-minder ()
98 ;
99 ; an entity which remembers which descendant was focused when the
100 ; window focus moves outside the FocusMinder. This 'minded' focus
101 ; is restored as the window's focus if the FocusMinder itself
102 ; becomes the window's focus (if no minded focus, we focus-first)
103 ;
104 ((focus-minded :accessor focus-minded :initarg :focus-minded
105 :initform (c? (let ((focus (focus .w.)))
106 (if (fm-includes self focus)
107 (if (eql self focus)
108 .cache
109 focus)
110 .cache))))))
111
112 (export! focus-handle-keysym)
113
114 (defgeneric focus-handle-keysym (self keysym)
115 (:method :around (self keysym)
116 (progn ;; unless
117 (call-next-method)
118 ;; (trc "unhandled so parent?" .parent)
119 (when .parent
120 (focus-handle-keysym .parent keysym))))
121 (:method (self keysym) (declare (ignore self keysym)) nil))

  ViewVC Help
Powered by ViewVC 1.1.5