# text.tcl -- # # This file defines the default bindings for Tk text widgets. # # @(#) text.tcl 1.18 94/12/17 16:05:26 # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. # perl/Tk version: # Copyright (c) 1995-2004 Nick Ing-Simmons # Copyright (c) 1999 Greg London # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. package Tk::Text; use AutoLoader; use Carp; use strict; use Text::Tabs; use vars qw($VERSION); $VERSION = sprintf '4.%03d', q$Revision: #24 $ =~ /\D(\d+)\s*$/; use Tk qw(Ev $XS_VERSION); use base qw(Tk::Clipboard Tk::Widget); Construct Tk::Widget 'Text'; bootstrap Tk::Text; sub Tk_cmd { \&Tk::text } sub Tk::Widget::ScrlText { shift->Scrolled('Text' => @_) } Tk::Methods('bbox','compare','debug','delete','dlineinfo','dump','edit', 'get','image','index','insert','mark','scan','search', 'see','tag','window','xview','yview'); use Tk::Submethods ( 'mark' => [qw(gravity names next previous set unset)], 'scan' => [qw(mark dragto)], 'tag' => [qw(add bind cget configure delete lower names nextrange prevrange raise ranges remove)], 'window' => [qw(cget configure create names)], 'image' => [qw(cget configure create names)], 'xview' => [qw(moveto scroll)], 'yview' => [qw(moveto scroll)], 'edit' => [qw(modified redo reset separator undo)], ); sub Tag; sub Tags; sub bindRdOnly { my ($class,$mw) = @_; # Standard Motif bindings: $mw->bind($class,'','NoOp'); $mw->bind($class,'','NoOp'); $mw->bind($class,'','NoOp'); $mw->bind($class,'','unselectAll'); $mw->bind($class,'<1>',['Button1',Ev('x'),Ev('y')]); $mw->bind($class,'','B1_Motion' ) ; $mw->bind($class,'','B1_Leave' ) ; $mw->bind($class,'','CancelRepeat'); $mw->bind($class,'','CancelRepeat'); $mw->bind($class,'',['markSet','insert',Ev('@')]); $mw->bind($class,'','selectWord' ) ; $mw->bind($class,'','selectLine' ) ; $mw->bind($class,'','adjustSelect' ) ; $mw->bind($class,'',['SelectTo',Ev('@'),'word']); $mw->bind($class,'',['SelectTo',Ev('@'),'line']); # $mw->bind($class,'',['SetCursor',Ev('index','insert-1c')]); $mw->bind($class,'',['LeftNumLock', Ev('A')]); $mw->bind($class,'',['KeySelect',Ev('index','insert-1c')]); $mw->bind($class,'',['SetCursor',Ev('index','insert-1c wordstart')]); $mw->bind($class,'',['KeySelect',Ev('index','insert-1c wordstart')]); # $mw->bind($class,'',['SetCursor',Ev('index','insert+1c')]); $mw->bind($class,'',['RightNumLock', Ev('A')]); $mw->bind($class,'',['KeySelect',Ev('index','insert+1c')]); $mw->bind($class,'',['SetCursor',Ev('index','insert+1c wordend')]); $mw->bind($class,'',['KeySelect',Ev('index','insert wordend')]); # $mw->bind($class,'',['SetCursor',Ev('UpDownLine',-1)]); $mw->bind($class,'',['UpNumLock', Ev('A')]); $mw->bind($class,'',['KeySelect',Ev('UpDownLine',-1)]); $mw->bind($class,'',['SetCursor',Ev('PrevPara','insert')]); $mw->bind($class,'',['KeySelect',Ev('PrevPara','insert')]); # $mw->bind($class,'',['SetCursor',Ev('UpDownLine',1)]); $mw->bind($class,'',['DownNumLock', Ev('A')]); $mw->bind($class,'',['KeySelect',Ev('UpDownLine',1)]); $mw->bind($class,'',['SetCursor',Ev('NextPara','insert')]); $mw->bind($class,'',['KeySelect',Ev('NextPara','insert')]); $mw->bind($class,'',['SetCursor','insert linestart']); $mw->bind($class,'',['KeySelect','insert linestart']); $mw->bind($class,'',['SetCursor','1.0']); $mw->bind($class,'',['KeySelect','1.0']); $mw->bind($class,'',['SetCursor','insert lineend']); $mw->bind($class,'',['KeySelect','insert lineend']); $mw->bind($class,'',['SetCursor','end-1char']); $mw->bind($class,'',['KeySelect','end-1char']); $mw->bind($class,'',['SetCursor',Ev('ScrollPages',-1)]); $mw->bind($class,'',['KeySelect',Ev('ScrollPages',-1)]); $mw->bind($class,'',['xview','scroll',-1,'page']); $mw->bind($class,'',['SetCursor',Ev('ScrollPages',1)]); $mw->bind($class,'',['KeySelect',Ev('ScrollPages',1)]); $mw->bind($class,'',['xview','scroll',1,'page']); $mw->bind($class,'', 'NoOp'); # Needed only to keep binding from triggering; does not have to actually do anything. $mw->bind($class,'','focusNext'); $mw->bind($class,'','focusPrev'); $mw->bind($class,'',['markSet','anchor','insert']); $mw->bind($class,'