' +----------------------------------------------------------------------+ ' | | ' | - T R U E V I E W F I L E B R O W S E R - | ' | - - - - - - - - - - - - - - - - - - - | ' | | ' | Public Domain - FreeWare | ' +----------------------------------------------------------------------+ ' +----------------------------------------------------------------------+ ' | - ABOUT THE AUTHOR - | ' +----------------------------------------------------------------------+ ' | | ' | Hello. My name is Don Smith and I am a thirty-year retired teacher | ' | of Math/History/Spanish residing in Orange County, California. I | ' | am also a former six-year Sergeant of Marines. Who-Rah! On certain | ' | forums I am known as MarineDon. My email is: smithdonb@earthlink.net | ' | | ' +----------------------------------------------------------------------+ ' | - COPYING AND DISTIBUTING - | ' +----------------------------------------------------------------------+ ' | Since this code is public domain and freeware, anyone may freely | ' | copy and distribute it. If you use the QuickBasic code in one of | ' | your own programs, you do not have to cite my name as the author, | ' | and you may even change its name. | ' +----------------------------------------------------------------------+ ' +----------------------------------------------------------------------+ ' | TrueView.Bas written by Don Smith on 05/20/2002. Written for | ' | QuickBASIC 4.5. No special libraries are needed. Released to | ' | the public domain. Programmers need not give my name. They can | ' | even change the name of the program. Programmers will probably | ' | want to change the error screen with their own information. This | ' | screen appears whenever a user inputs an incorrect file name or | ' | does not enter a filename for TrueView to browse on the command | ' | line. Change lines 452 to 479. | ' +----------------------------------------------------------------------+ ' | Information about the author: | ' | ---------------------------- | ' | Hello, my name is Don Smith and I am a retired Math/History/Spanish | ' | teacher currently residing in Orange County, California. | ' | | ' | My email is: smithdonb@earthlink.net | ' +----------------------------------------------------------------------+ ' | TrueView is an ASCII text browser. TrueView is so written as to | ' | avoid having to rely on Dimensioning or Redimensioning. It | ' | continuously keeps track of where the top line is, and it | ' | continuously opens and closes the COMMAND$ file. There is never | ' | a need to worry about how much memory is needed. | ' +----------------------------------------------------------------------+ ' | To use Trueview, enter at the prompt, TRUEVIEW Filename.Txt where | ' | "Filename.Txt" is the name of an ASCII text file which the user | ' | wishes to browse or view. | ' +----------------------------------------------------------------------+ ' | Trueview probably shouldn't be used for huge files longer than | ' | 10000 lines. Beyond 10000 lines, it slows down a tad. I have a | ' | Pentium 4 2.65 CPU Ghz Gateway computer running under WindowsXP, | ' | and Trueview really did not lag in reading a 10,000 line file. I | ' | tried it out, however, on my old Pentium-S 166 Mhz computer, and | ' | it did lag a tiny bit, not too much. I do have another file browser,| ' | SeeBee.Exe, which will speedily view huge files on my old Pentium-S,| ' | 166 Mhz computer. The SeeBee file browser was written with | ' | QuickBASIC 4.5 and compiled with the Pro.Lib library instead | ' | of BCom45.Lib. This great library was written by Ethen Winer | ' | and company. See "Full Moon Software" just below: | ' +----------------------------------------------------------------------+ ' | Full Moon Software: | ' | ------------------ | ' | I use three toolboxes originally from Crescent Software. They | ' | are: QuickPak, PDQ and QuickScreen. Crescent Software was sold | ' | to Progress Software. The original owner/programmer of Crescent | ' | Software, Ethen Winer, took back the MS-DOS toolboxes so that | ' | they still would be available to MS-DOS programmers. He now | ' | operates Full Moon Software. These three toolboxes have hundreds | ' | of routines. Using their included libraries, instead of BRUN45.Lib | ' | or BCOM45.Lib and utilizing their assembly written routines, makes | ' | for an extremely tight, executable program very close to the tiny | ' | size and speed of an assembly language program. I especially enjoy | ' | using the QuickScreen program, Qscr.Exe, whick makes short work | ' | of converting a "BSaved" (.BSV) file into a linkable.OBJ file. | ' | | ' | Ethan Winer's internet site: | ' | ---------------------------- | ' | http://www.ehtanwiner.com | ' | | ' | Ethan Winer's Mailing Address: | ' | ------------------------------ | ' | FULL MOON SOFTWARE | ' | 34 Cedar Vale Drive | ' | New Milford, CT 06776 | ' | | ' | (Voice) 860-350-8188 | ' | (Fax) 860-350-6130 | ' | (Email) ethan@ethanwiner.com | ' | | ' +----------------------------------------------------------------------+ ' | If is pressed, the screen is saved and moved up | ' | or down and only one line is brought in to complete the screen. | ' | and work also to move text up or down. If | ' | is pressed then the next screen page is presented. | ' +----------------------------------------------------------------------+ ' | Please make note of the small size. Counting only lines of code, | ' | there are just 298 lines! | ' +----------------------------------------------------------------------+ ' | Compiling: | ' | | ' | BC: TrueView /e 'use /e for errors | ' | | ' | LINK: TrueView /noe | ' | LIB : BCom45 | ' | | ' +----------------------------------------------------------------------+ ComFile$ = COMMAND$ ComFile$ = RTRIM$(LTRIM$(ComFile$)) ' +----------------------------------------------------------------------+ ' | use ON ERROR to catch incorrectly entered file names or | ' | file name not given on command line. This should be the only | ' | error that will happen with TrueView.Bas. | ' +----------------------------------------------------------------------+ ON ERROR GOTO errorhandler begin: ULRow% = 2 'Upper left row to place text. ULCol% = 1 'Upper left column to place text. LRRow% = 24 'Lower right row to place text. LRCol% = 80 'Lower right column to place text. FGColr% = 15 'Foreground color of text (0-15). BGColr% = 1 'Back ground color of text (0-7). TBColrFG% = 0 'Foreground color of top/bottom strips (0-15). TBColrBG% = 7 'Background color of the top/bottom strips (0-7). TBNumColrFG% = 4 'Foreground color of top line numbering (0-15). TBNumColrBG% = 7 'Background color of bottom line numbering (0-7). EOFColrFG% = 15 'Foreground color of "End Of File" message (0-15). EOFColrBG% = 4 'Background color of "End Of File" message (0-7). ' SR.UL.Row% = ULRow% 'Upper left row to save/restore screen. SR.UL.Col% = ULCol% 'Upper left column to save/restore screen SR.LR.Row% = LRRow% 'Lower right row to save/restore screen. SR.LR.Col% = LRCol% 'Lower right column to save/restore screen. ' Temp.UL.Row% = SR.UL.Row% + 1 Temp.LR.Row% = SR.LR.Row% - 1 DownUp& = 1 ' 'next 9 lines set up the beginning screen and then closes OpeningScreen% = LRRow% - ULRow% + 1 OPEN ComFile$ FOR INPUT AS #1 COLOR FGColr%, BGColr%: CLS FOR BringIt% = 1 TO OpeningScreen% IF EOF(1) THEN EXIT FOR LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) LOCATE BringIt% + ULRow% - 1, ULCol%, 0, 0, 0 LOCATE , , 0, 0, 0 PRINT M$; CheckLines% = CheckLines% + 1 NEXT IF CheckLines% < 23 THEN EndYes% = 1: EndPg% = 1: EndOfPage% = 1 END IF GOSUB paint.top.bottom CLOSE #1 loopdeloop: DO IF DownUp& <= 0 THEN DownUp& = 1 END IF COLOR TBNumColrFG%, TBNumColrBG% LOCATE ULRow% - 1, 71, 0, 0, 0: PRINT " "; LOCATE ULRow% - 1, 71, 0, 0, 0: PRINT STR$(DownUp&); LOCATE LRRow% + 1, 71, 0, 0, 0: PRINT " "; LOCATE LRRow% + 1, 71, 0, 0, 0: PRINT STR$(DownUp& + (LRRow% - ULRow%)); COLOR FGColr%, BGColr% DO TheKey$ = INKEY$ LOOP UNTIL LEN(TheKey$) > 0 TheKey% = CVI(TheKey$ + CHR$(0)) IF TheKey% = 20480 OR TheKey% = 19712 THEN ' IF Booboo% = 1 OR CheckLines% < 23 THEN GOTO loopdeloop ELSE EndYes% = 0: EndPg% = 0 FileEnd% = 0 END IF DnAr% = 1 UpAr% = 0 IF EndOfFile% <> 1 THEN SR.UL.Row% = Temp.UL.Row% SR.LR.Row% = Temp.LR.Row% + 1 GOSUB save.screen CLOSE #1 OPEN ComFile$ FOR INPUT AS #1 FOR DnIt& = 1 TO DownUp& + (LRRow% - ULRow% + 1) IF EOF(1) THEN EndOfFile% = 1 EndPg% = 1 CLOSE #1 EXIT FOR END IF LINE INPUT #1, Fox$ IF RTRIM$(LTRIM$(Fox$)) = CHR$(12) THEN Fox$ = SPACE$(80) Fox$ = LEFT$(Fox$, 80) NEXT IF EndOfFile% <> 1 THEN IF NOT EOF(1) THEN LOCATE LRRow%, ULCol%, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE LRRow%, ULCol%, 0, 0, 0 PRINT Fox$; ELSEIF EOF(1) THEN LOCATE LRRow%, ULCol%, 0, 0, 0 COLOR EOFColrFG%, EOFColrBG% SOUND 150, 2 PRINT STRING$(35, "-") + "End Of File" + STRING$(34, "-"); END IF END IF DownUp& = DownUp& + 1 ELSEIF EndOfFile% = 1 THEN GOTO loopdeloop END IF ELSEIF TheKey% = 20736 THEN ' IF EndPg% = 1 OR EndYes% = 1 OR EndOfPage% = 1 OR CheckLines% < 23 THEN GOTO loopdeloop END IF IF FileEnd% = 0 THEN CLOSE #1 FileEnd% = 1 END IF PgDn& = DownUp& + LRRow% - ULRow% CLOSE #1 OPEN ComFile$ FOR INPUT AS #1 FOR PgDn1& = 1 TO PgDn& IF EOF(1) THEN FileEnd% = 1 CLOSE #1 EXIT FOR END IF LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) NEXT DownUp& = DownUp& + (LRRow% - ULRow% + 1) FOR PgDn2% = 1 TO (LRRow% - ULRow% + 1) IF EndPg% = 0 THEN IF EOF(1) THEN FileEnd% = 1 CLOSE #1 GOSUB end.james EXIT FOR END IF END IF LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) LOCATE PgDn2% + 1, ULCol%, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE PgDn2% + 1, ULCol%, 0, 0, 0 PRINT M$; NEXT ELSEIF TheKey% = 18688 THEN ' Booboo% = 0 EndYes% = 0: EndPg% = 0 IF PgDn& > LRRow% - ULRow% + 1 OR DownUp& > (LRRow% - ULRow% + 1) THEN PgUp& = DownUp& - (LRRow% - ULRow% + 1) CLOSE #1 OPEN ComFile$ FOR INPUT AS #1 FOR PgUp1& = 1 TO PgUp& - 1 LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) NEXT FOR PgUp2& = 1 TO (LRRow% - ULRow% + 1) LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) LOCATE PgUp2& + 1, ULCol%, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE PgUp2& + 1, ULCol%, 0, 0, 0 PRINT M$; NEXT DownUp& = DownUp& - (LRRow% - ULRow% + 1) ELSE GOSUB home.james END IF ELSEIF TheKey% = 18432 OR TheKey% = 19200 THEN ' Booboo% = 0 EndYes% = 0: EndPg% = 0 EndOfFile% = 0 EndPg% = 0 FileEnd% = 0 DnAr% = 0 UpAr% = 1 DownUp& = DownUp& - 1 IF DownUp& = 1 THEN GOSUB home.james ELSEIF DownUp& > 1 THEN SR.UL.Row% = Temp.UL.Row% - 1 SR.LR.Row% = Temp.LR.Row% GOSUB save.screen CLOSE #1 OPEN ComFile$ FOR INPUT AS #1 FOR UpIt& = 1 TO DownUp& LINE INPUT #1, M$ NEXT IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) LOCATE ULRow%, ULCol%, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE ULRow%, ULCol%, 0, 0, 0 PRINT M$; END IF ELSEIF TheKey% = 18176 THEN ' EndYes% = 0: EndPg% = 0: Booboo% = 0 GOSUB home.james ELSEIF TheKey% = 20224 THEN ' EndPg% = 0: Booboo% = 0 IF EndYes% = 0 THEN GOSUB end.james END IF ELSEIF TheKey% = 27 THEN CLOSE #1 COLOR 7, 0: CLS : LOCATE 1, 1, 1, 6, 7: END END IF LOOP paint.top.bottom: ' +---------------------------------------------------------------------+ ' | When this subroutine is called, the top and bottom | ' | rows are displayed. | ' +---------------------------------------------------------------------+ COLOR TBColrFG%, TBColrBG% LOCATE ULRow% - 1, 1, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE ULRow% - 1, 31, 0, 0, 0 PRINT CHR$(240) + " TrueView Program " + CHR$(240); LOCATE ULRow% - 1, 62, 0, 0, 0 PRINT "Top Line:"; LOCATE ULRow% - 1, 2, 0, 0, 0 PRINT "File: " + ComFile$ LOCATE LRRow% + 1, 1, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE LRRow% + 1, 2, 0, 0, 0 PRINT "EXIT: MOVE: "; LOCATE LRRow% + 1, 21, 0, 0, 0 PRINT "<" + CHR$(24) + "> <" + CHR$(25) + "> "; LOCATE LRRow% + 1, 59, 0, 0, 0 PRINT "Bottom Line: "; COLOR FGColr%, BGColr% RETURN end.james: ' +---------------------------------------------------------------------+ ' | when the end of a file is reached, the | ' | program branches to this procedure: | ' +---------------------------------------------------------------------+ EndYes% = 1: EndPg% = 1 COLOR TBColrFG%, TBColrBG% LOCATE 1, 22, 0, 0, 0: PRINT "- Please Wait -" + SPACE$(14) DownUp& = 0 EndOfFile% = 0 FileEnd% = 0 CountLines& = 0 CLOSE #1 OPEN ComFile$ FOR INPUT AS #1 DO LINE INPUT #1, ThrowAway$ IF EOF(1) THEN EXIT DO CountLines& = CountLines& + 1 LOOP UNTIL EOF(1) CLOSE #1 OPEN ComFile$ FOR INPUT AS #1 FOR LastScrn& = 1 TO CountLines& + 1 - (LRRow% - ULRow% + 1) IF EOF(1) THEN EXIT FOR END IF LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) ManyLines& = ManyLines& + 1 COLOR TBColrFG%, TBColrBG% LOCATE 1, 40, 0, 0, 0: PRINT "Loading:"; LOCATE 1, 49, 0, 0, 0: PRINT RTRIM$(LTRIM$(STR$(ManyLines&))); NEXT GOSUB paint.top.bottom FOR TheLastScrn% = ULRow% TO LRRow% IF EOF(1) THEN EXIT FOR END IF LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) COLOR FGColr%, BGColr% LOCATE TheLastScrn%, ULCol%, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE TheLastScrn%, ULCol%, 0, 0, 0 PRINT M$; NEXT CLOSE #1 DownUp& = CountLines& - (LRRow% - ULRow% + 1) + 1 COLOR TBColrFG%, TBColrBG% LOCATE 1, 22, 0, 0, 0: PRINT " - TrueView Program - "; COLOR FGColr%, BGColr% ManyLines& = 0 RETURN home.james: ' +---------------------------------------------------------------------+ ' | when the top of a file is reached, the program | ' | branches to this subroutine: | ' +---------------------------------------------------------------------+ CLOSE #1 OPEN ComFile$ FOR INPUT AS #1 FOR HomePage% = ULRow% TO LRRow% IF EOF(1) THEN EXIT FOR END IF LOCATE HomePage%, ULCol%, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) LOCATE HomePage%, ULCol%, 0, 0, 0 PRINT M$; NEXT DownUp& = 1 GOSUB paint.top.bottom RETURN save.screen: ' +---------------------------------------------------------------------+ ' | When the program asks for GOSUB save.screen, the following | ' | six lines saves the screen from row 2 to row 24: | ' +---------------------------------------------------------------------+ REDIM ReadLine$(25) FOR ViewIt% = SR.UL.Row% TO SR.LR.Row% FOR Horizon% = SR.UL.Col% TO SR.LR.Col% ReadLine$(ViewIt%) = ReadLine$(ViewIt%) + CHR$(SCREEN(ViewIt%, Horizon%)) NEXT NEXT restore.screen: ' +---------------------------------------------------------------------+ ' |This subroutine restores the above saved screen, except the saved | ' |screen is moved either up or down. If the down arrow is pressed, then| ' |DnAr% = 1 and the saved screen is moved up one place and a new line | ' |is brought in and displayed at row 24. If the up arrow is pressed, | ' |then UpAr% = 1 and the saved screen is moved down one row and a new | ' |line is displayed at row 2, just under the top linebar. | ' +---------------------------------------------------------------------+ IF DnAr% = 1 THEN StartSite% = SR.UL.Row% - 1 StopSite% = SR.LR.Row% - 1 ELSEIF UpAr% = 1 THEN StartSite% = SR.UL.Row% + 1 StopSite% = SR.LR.Row% + 1 END IF FOR FindRow% = StartSite% TO StopSite% LOCATE FindRow%, SR.UL.Col%, 0, 0, 0 PRINT SPACE$(LRRow% - ULRow% + 1); LOCATE FindRow%, SR.UL.Col%, 0, 0, 0 COLOR FGColr%, BGColr% IF DnAr% = 1 THEN PRINT ReadLine$(FindRow% + DnAr%); ELSEIF UpAr% = 1 THEN PRINT ReadLine$(FindRow% - UpAr%); END IF NEXT ERASE ReadLine$ RETURN errorhandler: COLOR 15, 0: CLS LOCATE 1, 8, 0, 0, 0: PRINT "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" LOCATE 2, 8, 0, 0, 0: PRINT "º º" LOCATE 2, 34, 0, 0, 0: COLOR 12, 0: PRINT "<<< Error >>>": COLOR 15, 0 LOCATE 3, 8, 0, 0, 0: PRINT "ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ" LOCATE 4, 8, 0, 0, 0: PRINT "º Unable to find your file, or you entered the filename º" LOCATE 5, 8, 0, 0, 0: PRINT "º incorrectly. Correct parameter: TRUEVIEW YourFile.Ext º" LOCATE 5, 46, 0, 0, 0: COLOR 14, 0: PRINT "TRUEVIEW" LOCATE 5, 55, 0, 0, 0: COLOR 11, 0: PRINT "YourFile.Ext" COLOR 15, 0 LOCATE 6, 8, 0, 0, 0: PRINT "º º" LOCATE 7, 8, 0, 0, 0: PRINT "º TRUEVIEW is the name of this program and YourFile.Ext º" LOCATE 7, 13, 0, 0, 0: COLOR 14, 0: PRINT "TRUEVIEW" LOCATE 7, 54, 0, 0, 0: COLOR 11, 0: PRINT "YourFile.Ext" COLOR 15, 0 LOCATE 8, 8, 0, 0, 0: PRINT "º is the name of an ASCII text file you wish to browse. º" LOCATE 9, 8, 0, 0, 0: PRINT "ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ" LOCATE 10, 8, 0, 0, 0: PRINT "º The TrueView Program is a Public Domain, FreeWare º" LOCATE 11, 8, 0, 0, 0: PRINT "º program, written by Don Smith on 05/20/2002. Don º" LOCATE 12, 8, 0, 0, 0: PRINT "º is a retired math/history teacher residing in Orange º" LOCATE 13, 8, 0, 0, 0: PRINT "º County, California, United States of America. º" LOCATE 14, 8, 0, 0, 0: PRINT "º º" LOCATE 15, 8, 0, 0, 0: PRINT "º EMail: smithdons@earthlink.net º" LOCATE 15, 24, 0, 0, 0: COLOR 10, 0: PRINT "Email: smithdonb@earthlink.net" COLOR 15, 0 LOCATE 16, 8, 0, 0, 0: PRINT "ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ" LOCATE 17, 8, 0, 0, 0: PRINT "º Press Any Key To Continue. º" LOCATE 18, 8, 0, 0, 0: PRINT "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" COLOR 14, 0: LOCATE 17, 26, 0, 0, 0: PRINT "Press Any Key To Continue." PRINT DO: LOOP WHILE INKEY$ = "" LOCATE , , 1, 6, 7 END