[comp.os.vms] Fix for SWING

nagy%warner.hepnet@LBL.GOV (Frank J. Nagy, VAX Wizard & Guru) (12/24/87)

Below is a modified version of the DRAW_SCREEN.FOR module of SWING.
There are two fixes incorporated (see the lines marked "!FJN") to
a problem encountered here.  The problem manifests itself as you use
the down arrow to run down a list of directories; when you move off
the final one, the cursor is left on a blank line.  Hitting another
down arrow will redraw the screen and show the cursor now two
directories below the last one displayed on the final screen.  Also,
if you now move the cursor up and down the column of directories,
everything functions properly - the problem only manifests in the
initial screen.  That is if AND ONLY IF there are at least two more
directories in the column; if there is only 1, you can NEVER get to it.

The modifications below fix this problem.  There still remains one
annoyance in that the initial screen is one extra row below the
strip menu.  When you first use the down arrow to move to the first
off-screen directory, the screen will completely repaint.  If you
then move up and down you find that you can NEVER reproduce the
initial entry screen.

= Frank J. Nagy   "VAX Guru & Wizard"
= Fermilab Research Division EED/Controls
= HEPNET: WARNER::NAGY (43198::NAGY) or FNAL::NAGY (43009::NAGY)
= BitNet: NAGY@FNAL
= USnail: Fermilab POB 500 MS/220 Batavia, IL 60510

....................... Cut between dotted lines and save ......................
$!..............................................................................
$! VAX/VMS archive file created by VMS_SHAR V-5.01 01-Oct-1987
$! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au)
$! To unpack, simply save and execute (@) this file.
$!
$! This archive was created by NAGY
$! on Wednesday 23-DEC-1987 14:06:08.55
$!
$! It contains the following 1 file:
$! DRAW_SCREEN.FOR
$!==============================================================================
$ Set Symbol/Scope=(NoLocal,NoGlobal)
$ Version=F$GetSYI("VERSION") ! See what VMS version we have here:
$ If Version.ges."V4.4" then goto Version_OK
$ Write SYS$Output "Sorry, you are running VMS ",Version, -
                ", but this procedure requires V4.4 or higher."
$ Exit 44
$Version_OK: CR[0,8]=13
$ Pass_or_Failed="failed!,passed."
$ Goto Start
$Convert_File:
$ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd
$No_Error1: Define/User_Mode SYS$Output NL:
$ Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' -
        VMS_SHAR_DUMMY.DUMMY
f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f);
o:=Get_Info(Command_Line,"Output_File");Set(Output_File,b,o);
Position(Beginning_of(b));Loop x:=Erase_Character(1);Loop ExitIf x<>"V";
Move_Vertical(1);x:=Erase_Character(1);Append_Line;
Move_Horizontal(-Current_Offset);EndLoop;Move_Vertical(1);
ExitIf Mark(None)=End_of(b) EndLoop;Position(Beginning_of(b));Loop
x:=Search("`",Forward,Exact);ExitIf x=0;Position(x);Erase_Character(1);
If Current_Character='`' then Move_Horizontal(1);else
Copy_Text(ASCII(INT(Erase_Character(3))));EndIf;EndLoop;Exit;
$ Delete VMS_SHAR_DUMMY.DUMMY;*
$ Checksum 'File_is
$ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
$ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd
$No_Error2: Return
$Start:
$ File_is="DRAW_SCREEN.FOR"
$ Check_Sum_is=286415148
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X      subroutine draw_screen
X
X      include    'swing.cmn'
X      include    '($smgdef)'
X
XC
XC    To cope with strange terminal screen lengths
XC        19 --- > linest - 5
XC        20 --- > linest - 4
XC        23 --- > linest - 1
XC
XC
XC       Added by EH Perkins, Aug 16, 1987
XC
X
X`009integer linest
X`009common /length/ linest
X
X      integer    ii, jj, kk, smg$change_pbd_characteristics
X      integer    smg$change_rendition
X
X      call smg$begin_pasteboard_update( board_id )
X
X      call smg$paste_virtual_display( window2, board_id, 4, 2 )
X      call smg$paste_virtual_display( window1, board_id, 2, 1 )
X      call smg$paste_virtual_display( window3, board_id,
X     .                                linest, 1 )`009`009      !FJN
X
X      call smg$set_display_scroll_region( window3, 1, 2 )
X
X      call pd_draw_bar( board_id )
X
X      top_line = 1
X      bottom_line = (linest - 5)`009`009`009`009      !FJN
X
X      node_num = node_pointer( cur_level, cur_line )
X
X      call smg$change_rendition( window2, cur_line, cur_level*17+1,
X     .                           1, 12,
X     .                           smg$m_bold + node(node_num).rend )
X
X      if ( cur_line .gt. bottom_line ) then
X`009 top_line = cur_line - (linest - 5)
X`009 bottom_line = cur_line
X`009 call smg$move_virtual_display( window2, board_id,
X     .                                  (linest - 1) - cur_line, 1 )
X`009 else if ( cur_line .lt. top_line ) then
X`009 top_line = cur_line
X`009 bottom_line = cur_line + (linest - 5)
X         call smg$move_virtual_display( window2, board_id,
X     .                                     cur_line, 1 )
X         end if
X
X      call update_window1
X
X      call smg$end_pasteboard_update( board_id )
X
X      call smg$set_cursor_abs( window2, cur_line, cur_level*17+1 )
X
X      update = .true.
X
X      return
X      end
$ GoSub Convert_File
$ Exit