[uim-commit] r1017 - branches/composer/scm
yamaken at freedesktop.org
yamaken at freedesktop.org
Sun Jul 24 16:45:38 EST 2005
Author: yamaken
Date: 2005-07-23 23:45:36 -0700 (Sat, 23 Jul 2005)
New Revision: 1017
Modified:
branches/composer/scm/composer.scm
branches/composer/scm/ng-action.scm
Log:
* scm/composer.scm
- (composer-active-text, composer-base-initialize!): New procedure
- (composer-inactive-text): Rename to composer-inactive-texts
- (composer-inactive-texts):
* Renamed from composer-inactive-text
* Revise the comment
- (composer-base-new): Accept children as ustr object directly
- (composer-finalize!, composer-idname, composer-children,
composer-base-method-table): Revise the comment
* scm/ng-action.scm
- (indication-rec-spec): Change default values
- (label-indication-new): New procedure
- (action-status): Revise the comment
Modified: branches/composer/scm/composer.scm
===================================================================
--- branches/composer/scm/composer.scm 2005-07-24 01:47:43 UTC (rev 1016)
+++ branches/composer/scm/composer.scm 2005-07-24 06:45:36 UTC (rev 1017)
@@ -91,13 +91,15 @@
;;
;; Finalize the object appropriately including constructs outside Scheme. All
;; chidlren must also be finalized and should be orphaned (i.e. make
-;; (composer-children self) empty).
+;; (composer-children self) empty). reset-event is not issued before invoking
+;; this.
;;
;; .parameter self Abstract composer object
(define composer-finalize!
(lambda (self)
((composer-method-table-finalize! (composer-methods self)) self)))
+;; FIXME: describe naming rule
;; Get a symbol for programs that uniquely identifies the composer
;; .parameter self Abstract composer object
;; .returns A symbol such as 'anthy
@@ -130,7 +132,7 @@
;; conveniently.
;;
;; .parameter self Abstract composer object
-;; .returns An ustr of child composers
+;; .returns An ustr of child composers. empty ustr if no children
(define composer-children
(lambda (self)
((composer-method-table-children (composer-methods self)) self)))
@@ -266,6 +268,13 @@
(and (not (ustr-cursor-at-beginning? children))
(- (ustr-cursor-pos children) 1)))))
+;; Get entire text of active child
+;; .parameter self Abstract composer object
+;; .returns utext
+(define composer-active-text
+ (lambda (self)
+ (composer-text (composer-active-child self) 0 -1)))
+
;; Get texts around active child
;;
;; Since the interface is compatible with supply-surrounding-text, this method
@@ -280,10 +289,11 @@
;; .parameter latter-len Length of latter part of the text counted in logical
;; character. -1 or longer than available text indicates that as long as
;; possible
-;; .returns ustr of uchar (editable utext)
+;; .returns ustr of uchar (editable utext). ownership of the ustr is
+;; transferred to caller and freely mutable
;; FIXME: add range clamping
;; TODO: make efficient
-(define composer-inactive-text
+(define composer-inactive-texts
(lambda (self former-len latter-len)
(let* ((children (ustr-dup (composer-children self)))
(sur (ustr-cursor-delete-backside! children))) ;; remove active
@@ -369,8 +379,22 @@
(children (cadr args))
(actset (and (not (null? (cddr args)))
(car (cddr args)))))
- (composer-base-new-internal methods #f (ustr-new children) actset))))
+ (composer-base-new-internal methods #f children actset))))
+;; (Re)initialize composer-base part of derived object
+;; Parent is kept untouched
+(define composer-base-initialize!
+ (lambda args
+ (let ((self (car args))
+ (methods (cadr args))
+ (children (car (cddr args)))
+ (actset (and (not (null? (cdr (cddr args))))
+ (cadr (cddr args)))))
+ (composer-base-set-methods! self methods)
+ (composer-base-set-private-children! self children)
+ (composer-base-set-actset! self actset)
+ self)))
+
(define composer-base-parent-internal composer-base-private-parent)
(define composer-base-set-parent! composer-base-set-private-parent!)
@@ -456,8 +480,10 @@
;; change of composer-method-table definition about ordering or new
;; member.
;;
-;;(define foo-composer-method-table (copy-list composer-base-method-table))
-;;(composer-method-table-set-text! foo-composer-text)
-;;(composer-method-table-set-filter-event! foo-composer-filter-event!)
+;;(define foo-composer-method-table
+;; (let ((m (copy-list composer-base-method-table)))
+;; (composer-method-table-set-text! m foo-composer-text)
+;; (composer-method-table-set-filter-event! m foo-composer-filter-event!)
+;; m))
;;
;;(composer-base-new foo-composer-method-table ())
Modified: branches/composer/scm/ng-action.scm
===================================================================
--- branches/composer/scm/ng-action.scm 2005-07-24 01:47:43 UTC (rev 1016)
+++ branches/composer/scm/ng-action.scm 2005-07-24 06:45:36 UTC (rev 1017)
@@ -29,7 +29,9 @@
;;; SUCH DAMAGE.
;;;;
-;; FIXME: write test
+;; TODO:
+;; - write test
+;; - describe naming conventions and standard actions such as act_std_commit
(require "util.scm")
(require "i18n.scm")
@@ -46,12 +48,18 @@
;; keep same as load-action.scm until legacy action.scm has been obsoleted
(define indication-rec-spec
- '((id #f) ;; must be first field
- (iconic-label "")
- (label "")
- (short-desc "")))
+ '((id #f) ;; must be first field
+ (iconic-label #f) ;; utext or #f
+ (label #f) ;; utext or #f
+ (short-desc #f))) ;; utext or #f
(define-record 'indication indication-rec-spec)
+(define label-indication-new
+ (lambda (utext)
+ (list 'none ;; id
+ #f ;; iconic-label
+ utext ;; label
+ #f))) ;; short-desc
;;
;; action
@@ -105,7 +113,7 @@
(proc act)
std-indication-fallback))))
-;; Provide useful status information about an action for human
+;; Provide visual status information for human about an action
;; intended to be used via chooser UI and so on.
;;
;; .returns A symbol indicates status of the action 'selected 'checked
More information about the uim-commit
mailing list