diff gpf/cfg/TARGET_csample_smi_lo.tcl @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gpf/cfg/TARGET_csample_smi_lo.tcl	Mon Jun 01 03:24:05 2015 +0000
@@ -0,0 +1,171 @@
+#-----------------------------------------------------------------------------#
+# PROJECT: XPANEL (8446)                $Workfile:: TARGET_csample_smi_lo.tcl$#
+# Author:: RK  CONDAT GmbH              $Revision:: 1                        $#
+# CREATED: 29.06.00                     $Modtime:: 16.02.00 15:17            $#
+# STATE  : code                                                               #
+#-----------------------------------------------------------------------------#
+
+#  MODULE  : CSAMPLE_LAYOUT (smi)
+
+#  PURPOSE : This modul provides specific layout file for a csample
+#            running a SMI version.
+
+#*==== CONSTANTS ===================================================*#
+
+# specify text display colors
+set DISPL_BG black
+set DISPL_FG white
+
+# key count
+set COLUMNS 3
+set ROWS 7
+
+# key IDs
+set KEY_NOKEY     -1
+set KEY_0         48
+set KEY_1         49 
+set KEY_2         50
+set KEY_3         51
+set KEY_4         52
+set KEY_5         53
+set KEY_6         54
+set KEY_7         55
+set KEY_8         56
+set KEY_9         57
+set KEY_MNUUP     45
+set KEY_MNUDOWN   98
+set KEY_LEFT      67
+set KEY_RIGHT     94
+set KEY_CALL      97
+set KEY_HUP       86
+set KEY_STAR      42
+set KEY_HASH      35
+set KEY_POWER     69
+
+# not used
+set KEY_VOLUP     254
+set KEY_VOLDOWN   254
+set KEY_OK        254
+set KEY_CLEAR     254
+set KEY_ABC       254
+set KEY_F1        254
+set KEY_F2        254
+set KEY_F3        254
+set KEY_F4        254
+set KEY_MAX       254
+
+# keys with their IDs
+set KEY_ID { $KEY_LEFT  $KEY_MNUUP    $KEY_RIGHT  
+             $KEY_CALL  $KEY_MNUDOWN  $KEY_HUP   
+             $KEY_NOKEY $KEY_POWER    $KEY_NOKEY    
+             $KEY_1     $KEY_2        $KEY_3    
+             $KEY_4     $KEY_5        $KEY_6  
+             $KEY_7     $KEY_8        $KEY_9 
+             $KEY_STAR  $KEY_0        $KEY_HASH }
+
+# keys with their second IDs, activated after pressing 3 sec
+set KEY_ID2 { $KEY_NOKEY  $KEY_NOKEY  $KEY_NOKEY
+              $KEY_NOKEY  $KEY_NOKEY  $KEY_POWER
+              $KEY_NOKEY  $KEY_NOKEY  $KEY_NOKEY
+              $KEY_NOKEY  $KEY_NOKEY  $KEY_NOKEY
+              $KEY_NOKEY  $KEY_NOKEY  $KEY_NOKEY
+              $KEY_NOKEY  $KEY_NOKEY  $KEY_NOKEY
+              $KEY_NOKEY  $KEY_NOKEY  $KEY_NOKEY}
+
+# key labels
+set KEY_LABEL {"----"    "/\\"     "----"   
+               "CALL"    "\\/"     "HUP"    
+               ""        "POWER"   ""    
+               "1\nl__l"  "2\nabc" "3\ndef" 
+               "4\nghi"  "5\njkl"  "6\nmno" 
+               "7\npqrs" "8\ntuv"  "9\nwxyz"
+               "*"       "0\n+"    "#"      }
+
+# optional key images instead of labels
+set KEY_IMG {""           ""     ""       
+             ""           ""     ""       
+             ""           ""     ""       
+             ""           ""     ""      
+             ""           ""     ""     
+             ""           ""     ""    
+             ""           ""     ""  } 
+
+# key sizes
+set KEY_HEIGHT {3  3  3 
+                3  3  3
+                2  2  2
+                2  2  2
+                2  2  2
+                2  2  2
+                2  2  2}
+
+set KEY_WIDTH  {5  5  5
+                5  5  5
+                0  5  0
+                4  4  4
+                4  4  4
+                4  4  4
+                4  4  4}
+
+# key positions
+set KEY_STICKY {"" "" "" 
+                "" "" "" 
+                "" "" ""
+                "" "" ""
+                "" "" ""
+                "" "" ""
+                "" "" ""}
+
+# key relief style (raised, sunken, flat, ridge, solid, groove)
+set RELIEF  raised
+
+
+
+
+#*==== IMPLEMENTATION ==============================================*#
+
+frame .keys
+pack .keys -side bottom -pady 2 -anchor center
+
+for {set q 0} {$q<$ROWS} {incr q} {	
+  for {set w 1} {$w<=$COLUMNS} {incr w} {	
+    set nr [expr $q*$COLUMNS+$w-1]
+    if {[subst [lindex $KEY_ID $nr]] == [subst $KEY_NOKEY]} continue
+
+    set key [format ".keys.no%s" $nr] 
+    set imgFile [lindex $KEY_IMG $nr]
+    if {$imgFile == ""} {
+      button $key \
+        -text [lindex $KEY_LABEL $nr] \
+        -width [lindex $KEY_WIDTH $nr] -height [lindex $KEY_HEIGHT $nr] \
+        -relief $RELIEF
+    } else {
+      set img [format "%s%s" $imgFile $nr]
+      image create photo $img -file $imgFile
+      button $key -image $img \
+        -relief $RELIEF
+#        -width [expr 7*[lindex $KEY_WIDTH $nr]] \
+#        -height [expr 13*[lindex $KEY_HEIGHT $nr]] \
+    }
+    set st [lindex $KEY_STICKY $nr]
+    if {$st == ""} {
+      if {$w == 1} {
+        set st w
+      }  
+      if {$w == $COLUMNS} {
+        set st e
+      }
+    }
+    grid $key -row $q -column $w -sticky $st
+
+    if {[subst [lindex $KEY_ID2 $nr]] == [subst $KEY_NOKEY]} {
+      set cmd [format "c_onkey %s 0" [subst [lindex $KEY_ID $nr]]]
+    } else {
+      set cmd [format "c_onkey %s 0 %s" [subst [lindex $KEY_ID $nr]] \
+                                        [subst [lindex $KEY_ID2 $nr]]]
+    }
+    bind $key <ButtonPress> $cmd
+    set cmd [format "c_onkey %s 1" [subst [lindex $KEY_ID $nr]]]
+    bind $key <ButtonRelease> $cmd
+  }
+}