[uim-commit] r1109 - branches/composer/scm

yamaken at freedesktop.org yamaken at freedesktop.org
Wed Aug 3 10:57:16 EST 2005


Author: yamaken
Date: 2005-08-02 17:57:13 -0700 (Tue, 02 Aug 2005)
New Revision: 1109

Modified:
   branches/composer/scm/ng-action.scm
   branches/composer/scm/util.scm
Log:
* scm/util.scm
  - (number->symbol, inc, dec, compensate-index): New procedure

* scm/ng-action.scm
  - (indication-figure-id, indication-set-figure-id!,
    internal-construct-indication-new, std-action-skeleton-new): New
    procedure


Modified: branches/composer/scm/ng-action.scm
===================================================================
--- branches/composer/scm/ng-action.scm	2005-08-02 20:35:54 UTC (rev 1108)
+++ branches/composer/scm/ng-action.scm	2005-08-03 00:57:13 UTC (rev 1109)
@@ -48,11 +48,13 @@
 
 ;; keep same as load-action.scm until legacy action.scm has been obsoleted
 (define indication-rec-spec
-  '((id           #f)    ;; must be first field
+  '((id           #f)    ;; must be first field. will be renamed to figure-id
     (iconic-label #f)    ;; utext or #f
     (label        #f)    ;; utext or #f
     (short-desc   #f)))  ;; utext or #f
 (define-record 'indication indication-rec-spec)
+(define indication-figure-id indication-id)
+(define indication-set-figure-id! indication-set-id!)
 
 (define label-indication-new
   (lambda (utext)
@@ -61,6 +63,13 @@
 	  utext  ;; label
 	  #f)))  ;; short-desc
 
+(define internal-construct-indication-new
+  (lambda (label)
+    (indication-new 'null
+		    ""
+		    label
+		    (N_ "*An internal construct*"))))
+
 ;;
 ;; action
 ;;
@@ -191,6 +200,17 @@
 ;; standard definitions
 ;;
 
+(define std-action-skeleton-new
+  (lambda (act-id label short-desc activate! ready?)
+    (action-skeleton-new act-id
+			 (lambda (act)
+			   (indication-new 'none
+					   ""
+					   label
+					   short-desc))
+			 activate!
+			 ready?)))
+
 (define std-indication-null
   (indication-new 'null
 		  ""
@@ -204,7 +224,7 @@
 		  (N_ "unknown")))
 
 ;; any UI should replace an indication that has 'separator as
-;; indication-id with real separator rather than label and icon
+;; indication-figure-id with real separator rather than label and icon
 (define std-indication-separator
   (indication-new 'separator
 		  (N_ "--")

Modified: branches/composer/scm/util.scm
===================================================================
--- branches/composer/scm/util.scm	2005-08-02 20:35:54 UTC (rev 1108)
+++ branches/composer/scm/util.scm	2005-08-03 00:57:13 UTC (rev 1109)
@@ -65,6 +65,10 @@
   (lambda (lst str)
     (member str lst)))
 
+;; TODO: write test
+(define number->symbol
+  (compose string->symbol number->string))
+
 (define truncate-list
   (lambda (lst n)
     (if (or (< (length lst)
@@ -188,6 +192,14 @@
     (max bottom
 	 (min x ceiling))))
 
+(define inc
+  (lambda (n)
+    (+ n 1)))
+
+(define dec
+  (lambda (n)
+    (- n 1)))
+
 ;;
 ;; R5RS procedures (don't expect 100% compatibility)
 ;;
@@ -667,6 +679,17 @@
      (else
       n))))
 
+;; TODO: write test
+;; Compensates an index number for an enumerable container
+;; .parameter idx Item index. Negative value instructs (abs idx)
+;; items before from last item
+;; .parameter size Size of the enumerable container
+(define compensate-index
+  (lambda (idx size)
+    (if (negative? idx)
+        (max 0 (+ size idx))
+        (clamp idx 0 (dec size)))))
+
 ;; update style-element vars
 ;; style-spec requires list of (style-element-name . validator)
 (define update-style



More information about the uim-commit mailing list