[Prime-cvs] CVS update: prime/uim

Back to archive index

Hiroyuki Komatsu komat****@users*****
2005年 3月 30日 (水) 01:18:21 JST


Index: prime/uim/ChangeLog
diff -u prime/uim/ChangeLog:1.5 prime/uim/ChangeLog:1.6
--- prime/uim/ChangeLog:1.5	Thu Mar 10 13:01:35 2005
+++ prime/uim/ChangeLog	Wed Mar 30 01:18:21 2005
@@ -1,3 +1,14 @@
+2005-03-30  Hiroyuki Komatsu  <komat****@taiya*****>
+
+	* Makefile.am: 
+	- Fixed the installation bug that uim files will be installed with
+	  the command 'make install'.
+	  Thanks for the notice from UTUMI Hirosi.
+	
+	* prime.scm:
+	- Allowed to select a candidate with a number key in a segment state.
+	  Thanks for the notice from UTUMI Hirosi.
+
 2005-03-10  Hiroyuki Komatsu  <komat****@taiya*****>
 
 	* prime.scm: 
Index: prime/uim/Makefile.am
diff -u prime/uim/Makefile.am:1.3 prime/uim/Makefile.am:1.4
--- prime/uim/Makefile.am:1.3	Thu Mar 10 13:01:35 2005
+++ prime/uim/Makefile.am	Wed Mar 30 01:18:21 2005
@@ -1,5 +1,5 @@
 # Makefile.am: Template of Automake for uim/prime.
-# $Id: Makefile.am,v 1.3 2005/03/10 04:01:35 komatsu Exp $
+# $Id: Makefile.am,v 1.4 2005/03/29 16:18:21 komatsu Exp $
 #
 # Copyright (C) 2005 Hiroyuki Komatsu <komat****@taiya*****>
 #     All rights reserved.
@@ -9,7 +9,7 @@
 # the GNU General Public License version 2.
 
 
-uimscmfilesdir = $(uim_scheme_dir)
+uimscmfilesdir = @PRIME_DOC_DIR@/uim
 uimscmfiles_DATA = prime.scm prime-custom.scm prime-key-custom.scm
 
 EXTRA_DIST = ChangeLog $(uimscmfiles_DATA)
Index: prime/uim/prime.scm
diff -u prime/uim/prime.scm:1.6 prime/uim/prime.scm:1.7
--- prime/uim/prime.scm:1.6	Thu Mar 17 21:01:57 2005
+++ prime/uim/prime.scm	Wed Mar 30 01:18:21 2005
@@ -353,6 +353,7 @@
     (prime-commit-key?         . prime-command-modify-commit)
     (prime-next-candidate-key? . prime-command-segment-next)
     (prime-prev-candidate-key? . prime-command-segment-prev)
+    (prime-cand-select-key?    . prime-command-segment-select)
     (prime-go-left-edge-key?   . prime-command-modify-cursor-left-edge)
     (prime-go-right-edge-key?  . prime-command-modify-cursor-right-edge)
     (prime-go-left-key?        . prime-command-modify-cursor-left)
@@ -657,9 +658,31 @@
     (prime-context-set-state! context 'prime-state-fund)
     (prime-context-reset-preedit-line!  context)
     (prime-context-set-nth! context 0)
-    (print "/prime-preedit-reset!")
     ))
 
+(define prime-candidates-get-nth
+  (lambda (context index-no)
+    (if (>= index-no (prime-candidates-get-length context))
+	#f
+	(let ((state (prime-context-state context)))
+	  (if (= state 'prime-state-segment)
+	      (car (nth index-no (prime-context-segment-candidates context)))
+	      (car (nth index-no (prime-context-candidates context))))))))
+
+(define prime-candidates-get-length
+  (lambda (context)
+    (let ((state (prime-context-state context)))
+      (if (= state 'prime-state-segment)
+	  (length (prime-context-segment-candidates context))
+	  (length (prime-context-candidates context))))))
+
+(define prime-candidates-get-index
+  (lambda (context)
+    (let ((state (prime-context-state context)))
+      (if (= state 'prime-state-segment)
+	  (prime-context-segment-nth context)
+	  (prime-context-nth context)))))
+
 (define prime-get-nth-candidate
   (lambda (context n)
     (if (>= n (prime-get-nr-candidates context))
@@ -738,12 +761,15 @@
 ;;;; prime-uim:
 ;;;; ------------------------------------------------------------
 
+;; This returns a pair of the beginning index and the end index of displayed
+;; candidates.
 (define prime-uim-candwin-get-range
   (lambda (context)
-    (let* ((beginning (* (/ (prime-context-nth context) prime-nr-candidate-max)
+    (let* ((beginning (* (/ (prime-candidates-get-index context)
+			    prime-nr-candidate-max)
 			 prime-nr-candidate-max))
 	   (end       (min (+ beginning prime-nr-candidate-max)
-			   (prime-get-nr-candidates context))))
+			   (prime-candidates-get-length context))))
       (cons beginning end))))
 
 ;;;; ------------------------------------------------------------
@@ -1101,11 +1127,24 @@
     (let* ((nth0 (number->candidate-index (numeral-char->number key)))
 	   (cand-range (prime-uim-candwin-get-range context))
 	   (nth (min (+ (car cand-range) nth0) (cdr cand-range)))
-	   (cand (prime-get-nth-candidate context nth)))
+	   (cand (prime-candidates-get-nth context nth)))
       (if cand
 	  (prime-commit-candidate context nth))
       )))
 
+;; FIXME: Integrate into the above prime-command-conv-select.
+;; FIXME: <Hiroyuki Komatsu> (2005-03-30)
+(define prime-command-segment-select
+  (lambda (context key key-state)
+    (let* ((nth0 (number->candidate-index (numeral-char->number key)))
+	   (cand-range (prime-uim-candwin-get-range context))
+	   (nth (min (+ (car cand-range) nth0) (cdr cand-range)))
+	   (cand (prime-candidates-get-nth context nth)))
+      (print cand-range)
+      (if cand
+	  (prime-commit-segment-nth context nth))
+      )))
+
 (define prime-command-conv-input
   (lambda (context key key-state)
     (prime-commit-candidate context (prime-context-nth context))
@@ -1593,7 +1632,6 @@
 	(begin
 	  ;; Reset the current prime-context
 	  (prime-engine-context-reset (prime-context-session context))
-
 	  (im-commit-raw context)
 	  (prime-context-set-last-word! context "")
 	  (prime-preedit-reset! context)


Prime-cvs メーリングリストの案内
Back to archive index