home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
p2demo21.exe
/
PEL
/
REPEAT.PEL
< prev
next >
Wrap
Text File
|
1994-04-01
|
3KB
|
113 lines
# $Header: P:\source\wmacros\wrepeat.pev 1.2 01 Apr 1994 14:55:46 WALKER $
##############################################################################
#
# Compuware Corporation
# 31440 Northwestern Highway
# Farmington Hills, Michigan 48334-2564
#
# This source code listing contains information that is
# proprietary to Compuware Corporation and may not be copied
# duplicated, translated, transmitted, stored, retrieved
# or in any manner or by any method conveyed or disclosed
# to a third party or parties without express written
# permission from Compuware Corporation.
#
#
##############################################################################
#### $Workfile: wrepeat.pel $: repeat count support
global function repeat_key_action()
{
local repeatCount = 0
local msg = "Enter repeat count followed by the key to repeat. ["
local digit = "zip"
local keyToExecute
local keyUsedToGetHere = current_key
local binding
local c
local functionId
###
### build the repeat count
###
# begin_dialog()
notify( msg 1 "]" )
while (1)
{
while ( chr(c = getchar()) ~ /[0-9]/ )
{
digit = c - ord("0")
repeatCount = repeatCount * 10 + digit
notify( msg repeatCount "]" )
}
# Esc key to exit
if ( current_key == KEYCODE_ESC )
{
notify( "Command canceled" )
digit = ""
repeatCount = 0
break
}
# repeat key multiplies by four ala Emacs
if ( current_key == keyUsedToGetHere )
{
digit = ""
repeatCount = (repeatCount ? repeatCount : 1) * 4
notify( msg repeatCount "]" )
}
else
break
}
message( "" )
# end_dialog()
if ( digit == "zip" )
repeatCount = 1
else if ( repeatCount < 1 )
return
###
### build the string representation of the key then repeat its action
###
keyToExecute = "#" current_key
# eat the character remaining after a DOS two-character sequence
# (must be done after accessing "current_key")
if (c == 0)
getchar()
binding = keymap_binding( keyToExecute )
if ( binding !~ /repeat_key_action/ )
{
if ((functionId = function_id( binding )))
{
while (repeatCount--)
{
execute_function( functionId )
}
}
}
}
##
## execute the function bound to a given key
##
global function execute_key_action( keystring ) #PUBLIC
{
local binding = keymap_binding( keystring )
if ( binding && ( binding !~ /execute_key_action/ ))
return execute_function( binding )
}