// srs.s - sticky reference stripes
string rev[50]="SrsRev1005"
<ctrlshift j><s> execmacro(rev) // activate/deactivate
macro
/***
Macro Title: Sticky Reference Stripes
Author: Hayes Smith
Written/Compiled With TSEPRO GUI 4.4
Save/Compile Date-:> 2009 04 16 @ 3:20 pm
Category: Text Accessory
Function: To allow marked text to be displayed on
screen
even when
changing files
{This Revision:}
1005- 2009 04 16 @ 3:20 pm- safe save: works
well, published
1004- 2009 04 16 @ 2:52 pm- adding support for
re-defining stripes
1003- 2009 04 16 @ 12:47 pm- readjust placement
1002-
2009 04 16 @ 12:06 pm- initial setup, choosing hook
1001- new macro
---------------------------
Description:
When executed, this macro
will allow a short marked line
block to be placed on the screen and remain
there for
reference no matter what part of a file the cursor line is
in
nor what file is current.
When the macro is first executed, if it active but nothing
happens. To
create the first stripe, you must mark a line
block and use the assigned key
as described below.
The reference stripe is created by marking from one to half
the number
of rows in a window. Once marked, the assigned
key (ctrlShift j F7) will make
that block the sticky stripe
and place it on the screen. It will remain there
until the
macro is executed again.
While visible on the screen, the sticky stripe can be
positioned at
either the top, middle, or bottom of the
screen by using the assigned key
(CtrlShift centercursor).
While the sticky stripes are visible, cursor movement and
changing files
are still supported. Text scrolls under the
stripes and is unchanged.
The sticky reference stripe can be changed to hold a
different block of
text by simply repearing the process
above, marking a line block and using
the assigned key. The
new sticky stripe does not have to have the same number
of
lines, and will be made visible immediately.
If the macro is terminated properly (using the assigned key
to
acctivate/deactivate the macro (CtrlShift j s)), and if
the macro if not
purged, and if the macro is executed again,
it will "remember" the last
sticky stripe and activate it
again.
The purpose, of course, is to have a ready reference to
material text
that might not be visible at the location
where it might be useful. The
sticky stripe provides that
convenience.
Enjoy.
(NOTE: This revision only supports striping that portion of
the
line-marked text from column one to the column at the
right edge of the
window.)
***/
// local globals
integer sp=1 // stripe placement
integer bl=0 //
lines in block
integer contrast=159 // stripe color
// place stripe
proc mFollow()
integer i=0
integer sr=query(screenrows)
integer
wc=query(windowcols)
integer wr=query(windowrows)
integer sl=0
sr=sr-wr+1
case sp
when 1
sl=sr-1
when 2
sl=(sr+wr-bl)/2
when
3
sl=wr-bl-2+sr/2
endcase
for i=1 to bl
putstrxy(2,sl+i,format(getglobalstr("srs"+str(i)):-wc:"
"),contrast)
endfor
updatedisplay(_all_windows_refresh_)
end
// stripe placement
proc mPlaceStripe()
case sp
when 1
sp=2
when
2
sp=3
when 3
sp=1
endcase
mFollow()
end
// get the block
proc mGetStripe()
integer i=0
integer wr=query(windowrows)/2
if isblockincurrfile()==_line_
bl=query(blockendline)-query(blockbegline)+1
if
bl>wr
bl=wr
endif
if bl and
bl<=wr
pushposition()
gotoblockbegin()
for i=1 to
bl
setglobalstr("srs"+str(i),gettext(1,query(windowcols)))
down()
endfor
mFollow()
popposition()
endif
endif
end
proc main()
// set hooks
if hook(_after_update_statusline_,mFollow)
mGetStripe()
else
unhook(mFollow)
updatedisplay(_all_windows_refresh_)
endif
goto ending
ending:
end
<ctrlshift j><f7>
mGetStripe() // make marked block into stripe
<ctrlshift
centercursor> mPlaceStripe() // stripe placement
toggle