[comp.os.vms] Enhancements to swing

zu@ethz.UUCP (Urs Zurbuchen) (09/09/87)

Hello Netlanders,

some kind soul recently posted a new version of swing to which I added
some new features.
	- in a pulldown menu (e.g. the option menu) you can use the first
	  letter of a command to invoke it
	- in the FILER you can use the following keys:
		t - go to first file (top)
		b - go to last file (bottom)
		prev.screen - scroll backward one screen of files
		forw.screen - scroll forward one screen of files

		For VT100s which don't have prev.screen and forw.screen,
		respectively, you can use ^B and ^F instead.

	- the file SWING.LIS now gets printed directly with the same command
	  as to print a file and is deleted afterwards.
	- in pulldown mode, if you work with the cursor keys, you now have
	  wrap-around (go from last to first entry and vice versa).

I also corrected a error which occured when you chose the Option command
and then hit the cursor right or cursor left key while not being in pull-
down mode (activated by ^P).

This is my first exposure to fortran. So any hints and tips about programming
in fortran are welcome. Flames should be directed to /dev/nul (or sys$scratch).

I will not support these changes since I have my last day at this office
today. And it doesn't seem that I will have access to another VMS Vax in
the near future.

		Have a nice day,

		     ...urs


UUCP: ...!seismo!mcvax!cernvax!ethz!zu

	(this is my favourite unix site).

....................... Cut between dotted lines and save ......................
$!..............................................................................
$! VAX/VMS archive file created by VMS_SHAR V-4.03 05-Aug-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 IB1_EXT
$!      on Wednesday 9-SEP-1987 08:19:59.21
$!
$! It contains the following 4 files:
$! 2.DIF 3.DIF 4.DIF 5.DIF
$!==============================================================================
$ 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;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="2.DIF"
$ Check_Sum_is=1246046390
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]2.ORG;1
X  275        .                        choice, code, do_bar )
X  276         end if
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]2.FOR;5
X  275        .                        choice, .false., code, do_bar )
X  276         end if
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]2.ORG;1
X  552         sub_choices(7).choice(2) = 'Display Directory'
X  553         sub_choices(7).code(2) = 72
X  554         sub_choices(7).choice(3) = 'Filer'
X  555         sub_choices(7).code(3) = 73
X  556   
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]2.FOR;5
X  559         sub_choices(7).key(1) = 68
X  560         sub_choices(7).choice(2) = 'Filer'
X  561         sub_choices(7).code(2) = 73
X  562         sub_choices(7).key(2) = 70
X  563         sub_choices(7).choice(3) = 'Show Directory Name'
X  564         sub_choices(7).code(3) = 72
X  565         sub_choices(7).key(3) = 83
X  566   
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]2.ORG;1
X  562         sub_choices(9).choice(2) = 'cancel'
X  563         sub_choices(9).code(2) = 92
X  564   
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]2.FOR;5
X  572         sub_choices(9).key(1) = 79
X  573         sub_choices(9).choice(2) = 'cancel'
X  574         sub_choices(9).code(2) = 92
X  575         sub_choices(9).key(2) = 67
X  576   
X************
$ GoSub Convert_File
$ File_is="3.DIF"
$ Check_Sum_is=676077234
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]3.ORG;1
X  245        .                        choice, code, do_bar )
X  246         end if
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]3.FOR;8
X  258        .                        choice, .false., code, do_bar )
X  259         end if
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]3.ORG;1
X  385   
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]3.FOR;8
X  398         include    '($ssdef)'
X  399         include    '($clidef)'
X  400   
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]3.ORG;1
X  390   
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]3.FOR;8
X  405         character  logical_name*50, string*255
X  406         integer    istat, len_string
X  407         integer*4  translate_logical
X  408   
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]3.ORG;1
X  467         return
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]3.FOR;8
X  485         logical_name = 'SWING$PRINT'           !Check for user's printer
X  486         istat = translate_logical( logical_name, string )
X  487         if ( istat .eq. ss$_normal ) then
X  488            call str$trim( string, string, len_string )
X  489            call lib$spawn( string(1:len_string)
X  490        .                   //'/noidentify/nonotify/delete '
X  491        .                   //'swing.lis',,,cli$m_nowait)
X  492         else
X  493            call lib$spawn( '$print/noidentify/nonotify/delete '
X  494        .                   //'swing.lis',,,cli$m_nowait)
X  495            end if
X  496   
X  497         call print_message( 'Sent file to printer.', 0 )
X  498   
X  499         return
X************
$ GoSub Convert_File
$ File_is="4.DIF"
$ Check_Sum_is=457795157
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]4.ORG;1
X  429               if ( pos .gt. 1 ) new_pos = pos - 1
X  430               else if ( key .eq. smg$k_trm_right ) then
X  431               if ( pos .lt. pd_num_choices ) new_pos = pos + 1
X  432               else if ( key .eq. smg$k_trm_down ) then
X  433               if ( pd_choices.ptr(pos) .ne. 0 ) down = .true.
X  434               else if ( key .eq. smg$k_trm_ctrlz ) then
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]4.FOR;16
X  429               if ( pos .gt. 1 ) then
X  430                 new_pos = pos - 1
X  431                 else
X  432                 new_pos = pd_num_choices
X  433                 end if
X  434   
X  435               else if ( key .eq. smg$k_trm_right ) then
X  436               if ( pos .lt. pd_num_choices ) then
X  437                 new_pos = pos + 1
X  438                 else
X  439                 new_pos = 1
X  440                 end if
X  441   
X  442               else if ( key .eq. smg$k_trm_down ) then
X  443               if ( pd_choices.ptr(pos) .ne. 0 ) down = .true.
X  444   
X  445               else if ( key .eq. smg$k_trm_ctrlz ) then
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]4.ORG;1
X  536        .                           choice, code, do_bar )
X  537            end do
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]4.FOR;16
X  547        .                           choice, .true., code, do_bar )
X  548            end do
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]4.ORG;1
X  564        .                           pd_choices, choice, code, do_bar)
X  565   
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]4.FOR;16
X  575        .                           pd_choices, choice, pullmode,
X  576        .                           code, do_bar)
X  577   
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]4.ORG;1
X  568         include 'pulldown.cmn'
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]4.FOR;16
X  580         include '($ssdef)'
X  581         include 'pulldown.cmn'
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]4.ORG;1
X  576         logical exit, do_bar
X  577         character choice*(PD_MAX_CHOICE_LEN)
X  578   
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]4.FOR;16
X  589         logical exit, do_bar, direct, pullmode
X  590         character choice*(PD_MAX_CHOICE_LEN), key_upcase
X  591   
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]4.ORG;1
X  624         key = 0
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]4.FOR;16
X  637         direct = .false.
X  638         key = 0
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]4.ORG;1
X  633        .           key .ne. smg$k_trm_cr .and. .not. exit ) 
X  634   
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]4.FOR;16
X  647        .           key .ne. smg$k_trm_cr .and.
X  648        .           .not. exit .and. .not. direct ) 
X  649   
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]4.ORG;1
X  646               else if ( key .eq. smg$k_trm_down ) then
X  647               if ( pos .lt. ii ) new_pos = pos + 1
X  648               else if ( key .eq. smg$k_trm_left ) then
X  649               if ( num_choice .gt. 1 ) num_choice = num_choice - 1
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]4.FOR;16
X  661             else if ( key .eq. smg$k_trm_down ) then
X  662               if ( pos .lt. ii ) then
X  663                 new_pos = pos + 1
X  664                 else
X  665                 new_pos = 1
X  666                 end if
X  667   
X  668             else if ( key .eq. smg$k_trm_left .and.
X  669        .              pullmode .eq. .true. ) then
X  670               if ( num_choice .gt. 1 ) num_choice = num_choice - 1
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]4.ORG;1
X  652               else if ( key .eq. smg$k_trm_right ) then
X  653               if ( num_choice .lt. pd_num_choices ) 
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]4.FOR;16
X  673   
X  674             else if ( key .eq. smg$k_trm_right .and.
X  675        .              pullmode .eq. .true. ) then
X  676               if ( num_choice .lt. pd_num_choices ) 
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]4.ORG;1
X  657               else if ( key .eq. smg$k_trm_ctrlz ) then
X  658               exit = .true.
X  659               end if
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]4.FOR;16
X  680   
X  681             else if ( key .eq. smg$k_trm_ctrlz ) then
X  682               exit = .true.
X  683   
X  684             else
X  685               ii = 1
X  686               do while ( ii .le. pd_choices.number )
X  687                 if ( key .eq. pd_choices.key(ii) .or.
X  688        .             key .eq. pd_choices.key(ii) + 32 ) then
X  689                   direct = .true.
X  690                   new_pos = ii
X  691                 end if
X  692                 ii = ii + 1
X  693               end do
X  694               end if
X************
$ GoSub Convert_File
$ File_is="5.DIF"
$ Check_Sum_is=292134951
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]5.ORG;1
X  225         sub_choices(8).number = 2
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]5.FOR;20
X  225         sub_choices(4).key(1) = 68
X  226         sub_choices(8).number = 2
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]5.ORG;1
X  228         sub_choices(8).choice(2) = 'Cancel'
X  229         sub_choices(8).code(2) = 182
X  230   
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]5.FOR;20
X  229         sub_choices(8).key(1) = 79
X  230         sub_choices(8).choice(2) = 'Cancel'
X  231         sub_choices(8).code(2) = 182
X  232         sub_choices(8).key(2) = 67
X  233   
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]5.ORG;1
X  625   
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]5.FOR;20
X  631               else if ( ikey .eq. smg$k_trm_prev_screen .or.
X  632        .                ikey .eq. smg$k_trm_ctrlb ) then
X  633               jj = file_num - 11
X  634               if ( jj .lt. 1 ) jj = 1
X  635               file_num = jj
X  636               call update_file_window
X  637   
X  638               else if ( ikey .eq. smg$k_trm_next_screen .or.
X  639        .                ikey .eq. smg$k_trm_ctrlf ) then
X  640               jj = file_num + 11
X  641               if ( jj .gt. num_files ) jj = num_files
X  642               file_num = jj
X  643               call update_file_window
X  644   
X  645               else if ( ikey .eq. smg$k_trm_lowercase_t .or.
X  646        .                ikey .eq. smg$k_trm_uppercase_t ) then
X  647               file_num = 1
X  648               call update_file_window
X  649   
X  650               else if ( ikey .eq. smg$k_trm_lowercase_b .or.
X  651        .                ikey .eq. smg$k_trm_uppercase_b ) then
X  652               file_num = num_files
X  653               call update_file_window
X  654   
X  655   
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]5.ORG;1
X  775                  call pd_get_choice( board_id, keyboard, width, 
X  776        .                             pull_choices, choice, code )
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]5.FOR;20
X  834                  call pd_get_choice( board_id, keyboard, width,
X  835        .                             pull_choices, choice, code )
X************
X************
XFile IB1$ROOT:[EXT.ZU.DL.ORIGINAL]5.ORG;1
V  961         if ( file_num .gt. bottom_file_line ) then        !If cursor at b
Xottom
X  962            top_file_line = top_file_line + 6              !Scroll up
X  963            bottom_file_line = bottom_file_line + 6
X  964   
V  965            else if ( file_num .lt. top_file_line ) then   !If cursor at t
Xop
X  966            top_file_line = top_file_line - 6              !Scroll down
X  967            bottom_file_line = bottom_file_line - 6
X  968            end if
X  969   
X******
XFile IB1$ROOT:[EXT.ZU.DL.SWING]5.FOR;20
V 1023         if ( file_num .eq. bottom_file_line +1 ) then      !If cursor at 
Xbottom
X 1024            top_file_line = top_file_line + 6               !Scroll up
X 1025            bottom_file_line = bottom_file_line + 6
X 1026   
V 1027            else if ( file_num .eq. top_file_line -1 ) then !If cursor at 
Xtop
X 1028            top_file_line = top_file_line - 6               !Scroll down
X 1029            bottom_file_line = bottom_file_line - 6
X 1030   
X 1031            else if ( file_num .gt. bottom_file_line ) then
X 1032            top_file_line = file_num
X 1033            bottom_file_line = top_file_line + 11
X 1034   
X 1035            else if ( file_num .lt. top_file_line ) then
X 1036            top_file_line = file_num
X 1037            bottom_file_line = top_file_line + 11
X 1038            end if
X 1039   
X 1040         if ( bottom_file_line .gt. num_files ) then
X 1041            top_file_line = num_files -11
X 1042         end if
X 1043   
X 1044         if ( top_file_line .lt. 1 ) then
X 1045            top_file_line = 1
X 1046            bottom_file_line = 12
X 1047         end if
X 1048   
X 1049         if ( bottom_file_line .gt. top_file_line + 11 )
X 1050        .     bottom_file_line = top_file_line + 11
X 1051   
X************
$ GoSub Convert_File
$ Exit