From 71dd58676215710ee7c2dc2fb0cca28fd6a93aa3 Mon Sep 17 00:00:00 2001 From: Jeff Hobbs Date: Mon, 18 Jun 2001 17:24:46 +0000 Subject: [PATCH] * tkcon.tcl: (InitUI) added WM_DELETE_WINDOW hook to exit to correctly deconstruct slave consoles. (tkcon congets/getc) added tkcon show to ensure that tkcon would be displayed when input is expected. (GetSelection) new command to handle getting selection, this supports the new UTF8_STRING type. --- ChangeLog | 11 +++++++++++ tkcon.tcl | 25 ++++++++++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 98ac99d..43ea93d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-06-18 Jeff Hobbs + + * tkcon.tcl: (InitUI) added WM_DELETE_WINDOW hook to exit to + correctly deconstruct slave consoles. + (tkcon congets/getc) added tkcon show to ensure that tkcon would + be displayed when input is expected. + (GetSelection) new command to handle getting selection, this + supports the new UTF8_STRING type. + 2001-05-28 Jeff Hobbs * docs/start.html: added note about ::tkcon::OPT(gets) var. @@ -21,6 +30,8 @@ 2001-05-04 Jeff Hobbs + TKCON 2.1 RELEASE + * docs/style.css: new file for html files to use. * README.txt: * index.html: diff --git a/tkcon.tcl b/tkcon.tcl index 0d44e48..35a2072 100755 --- a/tkcon.tcl +++ b/tkcon.tcl @@ -492,6 +492,7 @@ proc ::tkcon::InitUI {title} { if {!$PRIV(WWW)} { wm withdraw $root } + wm protocol $root WM_DELETE_WINDOW exit set PRIV(base) $w ## Text Console @@ -990,7 +991,7 @@ proc ::tkcon::About {} { if {[winfo exists $w]} { wm deiconify $w } else { - global tk_patchLevel tcl_patchLevel tcl_platform + global tk_patchLevel tcl_patchLevel toplevel $w wm title $w "About tkcon v$PRIV(version)" button $w.b -text Dismiss -command [list wm withdraw $w] @@ -2463,6 +2464,7 @@ proc tkcon {cmd args} { if {[llength $args]} { return -code error "wrong # args: must be \"tkcon congets\"" } + tkcon show set old [bind TkConsole <>] bind TkConsole <> { set ::tkcon::PRIV(wait) 0 } set w $::tkcon::PRIV(console) @@ -2482,6 +2484,7 @@ proc tkcon {cmd args} { if {[llength $args]} { return -code error "wrong # args: must be \"tkcon getcommand\"" } + tkcon show set old [bind TkConsole <>] bind TkConsole <> { set ::tkcon::PRIV(wait) 0 } set w $::tkcon::PRIV(console) @@ -4026,6 +4029,17 @@ proc ::tkcon::Bindings {} { bind TkConsole <$paste> {::tkcon::Paste %W} } + proc ::tkcon::GetSelection {w} { + if { + ![catch {selection get -displayof $w -type UTF8_STRING} txt] || + ![catch {selection get -displayof $w} txt] || + ![catch {selection get -displayof $w -selection CLIPBOARD} txt] + } { + return $txt + } + return -code error "could not find default selection" + } + proc ::tkcon::Cut w { if {[string match $w [selection own -displayof $w]]} { clipboard clear -displayof $w @@ -4048,10 +4062,7 @@ proc ::tkcon::Bindings {} { } } proc ::tkcon::Paste w { - if { - ![catch {selection get -displayof $w} txt] || - ![catch {selection get -displayof $w -selection CLIPBOARD} txt] - } { + if {![catch {GetSelection $w} txt]} { if {[$w compare insert < limit]} { $w mark set insert end } $w insert insert $txt $w see insert @@ -4065,7 +4076,7 @@ proc ::tkcon::Bindings {} { ::tkcon::ClipboardKeysyms bind TkConsole { - catch { ::tkcon::Insert %W [selection get -displayof %W] } + catch { ::tkcon::Insert %W [::tkcon::GetSelection %W] } } bind TkConsole {+ @@ -4219,7 +4230,7 @@ proc ::tkcon::Bindings {} { bind TkConsole { if { (!$tkPriv(mouseMoved) || $tk_strictMotif) && - ![catch {selection get -displayof %W} ::tkcon::PRIV(tmp)] + ![catch {::tkcon::GetSelection %W} ::tkcon::PRIV(tmp)] } { if {[%W compare @%x,%y < limit]} { %W insert end $::tkcon::PRIV(tmp) -- 2.23.0