Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f6f8c33

Browse files
committed
Allow pgaccess to input Japanese. See included mail.
Subject: [HACKERS] pgaccess Japanese input capability patch From: Tatsuo Ishii <t-ishii@sra.co.jp> To: teo@flex.ro Cc: pgsql-hackers@postgresql.org, pgsql-interfaces@postgresql.org Date: Sat, 24 Feb 2001 21:41:14 +0900 Hi Teodorescu, I have made patches which enable pgaccess to input Japanese characters in the table editing window. As you might know, to input Japanese characters, we first type in "hiragana" then convert it to "kanji". To make this proccess transparent to tcl application programs, libraries are provided with localized version of Tcl/Tk. The patches bind certain keys to initiate a function (kanjiInput) that is responsible for the conversion process. If the function is not available, those keys will not be binded. Comments? -- Tatsuo Ishii
1 parent 9c99365 commit f6f8c33

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

src/bin/pgaccess/lib/tables.tcl

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,10 @@ set PgAcVar(mw,$wn,toprec) 0
813813
setScrollbar $wn
814814
if {$PgAcVar(mw,$wn,updatable)} then {
815815
$wn.c bind q <Key> "Tables::editText $wn %A %K"
816+
if {[info commands kanjiInput] == "kanjiInput"} then {
817+
$wn.c bind q <Control-backslash> "pgaccess_kinput_start %W";
818+
$wn.c bind q <Control-Kanji> "pg_access_kinput_start %W";
819+
}
816820
} else {
817821
$wn.c bind q <Key> {}
818822
}
@@ -2161,3 +2165,80 @@ proc vTclWindow.pgaw:Permissions {base} {
21612165
grid $base.fb.btncancel \
21622166
-in .pgaw:Permissions.fb -column 1 -row 0 -columnspan 1 -rowspan 1
21632167
}
2168+
2169+
#
2170+
# NOTE: following two procedures _kinput_trace_root and _kinput_trace_over
2171+
# were originaly part of kinput.tcl.
2172+
# -- Tatuso Ishii 2000/08/18
2173+
2174+
# kinput.tcl --
2175+
#
2176+
# This file contains Tcl procedures used to input Japanese text.
2177+
#
2178+
# $Header: /cvsroot/pgsql/src/bin/pgaccess/lib/Attic/tables.tcl,v 1.7 2001/02/26 05:15:48 ishii Exp $
2179+
#
2180+
# Copyright (c) 1993 Software Research Associates, Inc.
2181+
#
2182+
# Permission to use, copy, modify, and distribute this software and its
2183+
# documentation for any purpose and without fee is hereby granted, provided
2184+
# that the above copyright notice appear in all copies and that both that
2185+
# copyright notice and this permission notice appear in supporting
2186+
# documentation, and that the name of Software Research Associates not be
2187+
# used in advertising or publicity pertaining to distribution of the
2188+
# software without specific, written prior permission. Software Research
2189+
# Associates makes no representations about the suitability of this software
2190+
# for any purpose. It is provided "as is" without express or implied
2191+
# warranty.
2192+
#
2193+
2194+
# The procedure below is invoked in order to start Japanese text input
2195+
# for the specified widget. It sends a request to the input server to
2196+
# start conversion on that widget.
2197+
# Second argument specifies input style. Valid values are "over" (for
2198+
# over-the-spot style) and "root" (for root window style). See X11R5
2199+
# Xlib manual for the meaning of these styles). The default is root
2200+
# window style.
2201+
2202+
proc pgaccess_kinput_start {w {style root}} {
2203+
global _kinput_priv
2204+
catch {unset _kinput_priv($w)}
2205+
if {$style=="over"} then {
2206+
set spot [_kinput_spot $w]
2207+
if {"$spot" != ""} then {
2208+
trace variable _kinput_priv($w) w _pgaccess_kinput_trace_$style
2209+
kanjiInput start $w \
2210+
-variable _kinput_priv($w) \
2211+
-inputStyle over \
2212+
-foreground [_kinput_attr $w -foreground] \
2213+
-background [_kinput_attr $w -background] \
2214+
-fonts [list [_kinput_attr $w -font] \
2215+
[_kinput_attr $w -kanjifont]] \
2216+
-clientArea [_kinput_area $w] \
2217+
-spot $spot
2218+
return
2219+
}
2220+
}
2221+
trace variable _kinput_priv($w) w _pgaccess_kinput_trace_root
2222+
kanjiInput start $w -variable _kinput_priv($w) -inputStyle root
2223+
}
2224+
2225+
# for root style
2226+
proc _pgaccess_kinput_trace_root {name1 name2 op} {
2227+
global PgAcVar
2228+
set wn [string trimright $name2 ".c"]
2229+
upvar #0 $name1 trvar
2230+
set c $trvar($name2)
2231+
Tables::editText $wn $c $c
2232+
unset $trvar($name2)
2233+
}
2234+
2235+
# for over-the-spot style
2236+
proc _pgaccess_kinput_trace_over {name1 name2 op} {
2237+
global PgAcVar
2238+
set wn [string trimright $name2 ".c"]
2239+
upvar #0 $name1 trvar
2240+
set c $trvar($name2)
2241+
Tables::editText $wn $c $c
2242+
kinput_send_spot $name2
2243+
unset $trvar($name2)
2244+
}

0 commit comments

Comments
 (0)