File Browser 1.0 Philip J. Erdelsky pje@acm.org http://www.alumni.caltech.edu/~pje/ Public Domain - No Restrictions on Use February 21, 1997 1. Introduction The File Browser is a simple Windows utility that displays as many as ten text files in a single window. (1) You can scroll the window horizontally and vertically. (2) You can move the window and change its size. (3) You can "zoom in" to view small parts of the file with larger type. (4) You can "zoom out" to view large parts of the file with smaller type. (5) You can mark a rectangular block of text and then (a) copy it to the Windows Clipboard, -- or -- (b) print it on the default printer. (6) You can switch rapidly from one file to another. (7) You can open files for viewing by "dropping" them onto the File Browser window or icon. (8) Yes, you can display files of any size. You can't do operations (3), (4), (6) and (8) with the Windows Notepad. The File Browser requires Windows 3.1. There are no specific memory requirements, although program performance will suffer if you have too little memory, or if you have too many other applications loaded at the same time. The File Browser program and help files occupy approximately 41K of hard disk space. The File Browser will also work under Windows 95, but it will not use certain features specific to Windows 95, such as long file names. 2. Installation Installing the File Browser is easy, even though there's no installation routine. Just copy the files BROWSE.EXE and BROWSE.HLP to any subdirectory on your hard disk. You'll probably want to put them into the Windows subdirectory (normally C:\WINDOWS) with other Windows applications. The File Browser is not important enough to warrant its very own subdirectory. That's all. There are no DLL of VBX files to copy. Of course, the File Browser uses DLL files, but only the ones that come with Windows 3.1. These should already be on your hard disk. If you are interested in source code, you should also copy the following files: BROWSE.CPP BROWSE.H BROWSE.RC BROWSE.DEF BROWSE.RTF FILEDIAL.CPP FILEDIAL.H BROWSE.HPJ You may also want to put a program item for the File Browser into the Windows Program Manager. First of all, decide which program group to use for this purpose. The File Browser is not important enough to warrant its very own program group, but if you want to create a new program group for the it, look for directions in Chapter 3 of your Windows manual or search for the keywords "groups, creating" in the online help for the Program Manager. When you have decided which group to use, create a program item for the File Browser. Look for directions in Chapter 3 of your Windows manual or search for the keywords "program items, creating" in the online help for the Program Manager. The File Browser does not use a working directory, so you can leave this item blank. If you want to create a program item which brings up the File Browser with a particular file displayed, just put the complete file specifications for that file on the command line, as in the following example: C:\WINDOWS\BROWSE.EXE C:\SOMEAPP\READ.ME If there are files with a particular extension that you want to view with the File Browser, you can use the Windows File Manager to create an association between files with that extension and the File Browser. Look for directions in Chapter 4 of your Windows manual or search for the keywords "associating files" in the online help for the File Manager. 3. Bringing up the File Browser You can bring up the File Browser in the same manner as any other Windows program. For example, (1) If you have created a program item for the File Browser, open the program group and double click on the File Browser icon. (2) If you have created an association between the File Browser and files with a particular extension, use the File Manager to find the file that you want to view and double click on the file. (3) From the File Manager, double click on the file BROWSE.EXE. (4) Drop the File menu in the Program Manager and choose Run. Then enter the file specifications of the BROWSE.EXE file or any file with which the File Browser has been associated, and push the OK button. 3. Moving and Resizing the File Browser Window The File Browser window can be moved and resized just as any other Windows application window. You can also reduce the File Browser window to an icon or expand it to fill the entire screen. 4. Opening a File for Viewing To open a file for viewing, (1) Drop the File menu and choose Open, or strike the O key. A standard file dialog box appears. (2) Type the file specifications or choose the drive, directory and file from the boxes. (3) Push the OK button. The new becomes the currently displayed file. Any files that were already open remain open. The number of open files is limited to 10. If there are already 10 open files, this menu item is disabled. 5. Closing a File To close the currently displayed file: (1) Drop the File menu and choose Close. The next file, if any, becomes the currently displayed file. To close all files: (1) Drop the File menu and choose Close All. 5. Switching to Another Open File To switch the display to another open file: (1) To switch to the next file, drop the File menu and choose Next, or strike the Tab key. (2) To switch to the previous file, drop the File menu and choose Previous, or hold the Shift key down and strike the Tab key. (3) To switch to any open file, drop the File menu and choose List, or strike the L key. A list of currently open files will appear. Choose the desired file and press the OK button (or double-click on the desired file). 6. Using the File Browser as a Blink Comparator On a reasonably fast machine that is not overloaded with other applications, the File Browser can switch from one open file to another as fast as you can strike the Tab key. If you want to compare parts of two files, open both of them, position the displays to the parts of the files you want to compare, and then hold the Tab key down. The display will switch from one file to the other rapidly, and any parts that differ will attract your attention by flashing. 7. Scrolling the Window To scroll the window either horizontally or vertically, (1) Click on an arrow at one end of a scroll bar to scroll the window one row or column in the direction of the arrow. (2) Click on a blank area of a scroll bar to scroll the window approximately one window height or width from the position of the runner toward the position of the mouse cursor. (3) Move the mouse cursor to a scroll bar runner, depress the left mouse button and hold it down. Then move the mouse cursor to the desired position on the scroll bar. The runner will follow it. When the runner reaches the desired position, release the left mouse button. The text cursor will not be moved when the window is scrolled in this manner. To move the text cursor, just move the mouse cursor to the desired position on the text and tap the left mouse button. Note: The scroll bars will not respond to the keyboard. To scroll the window with the keyboard, move the text cursor. The window will be scrolled to keep the text cursor in view. 8. Moving the Text Cursor To move the text cursor: (1) Strike one of the arrow keys (up, down, left, or right), to move the text cursor one row or column in the direction of the arrow. (2) Strike the Home key to move the cursor to the left end of the row. (3) Strike the End key to move the text cursor to the right end of the row. (4) Strike the PgUp key to move the text cursor up a distance approximately equal to the height of the window. (5) Strike the PgDn key to move the text cursor down a distance approximately equal to the height of the window. (6) Hold the Control key down and strike the Home key to move the text cursor to the left end of the first (top) row. (7) Hold the Control key down and strike the End key to move the text cursor to the right end of the last (bottom) row. (8) Move the mouse cursor to the desired position and tap the left mouse button. (9) Search for text to move the text cursor to the end of a specific word, number or phrase. Note: The window will scroll, if necessary, to keep the text cursor in view. Note: The text cursor cannot be moved below the last row of the file or farther right than the end of the longest row that has been read from the file. 9. Marking a Block To mark a rectangular block of text (to be printed or copied to the Clipboard): (1) Move the text cursor to one corner of the block and use the keyboard to move the text cursor to the opposite corner, while holding the Shift key down. -- or -- (2) Move the mouse cursor to one corner of the block and use the mouse to move the mouse cursor to the opposite corner, while holding the left mouse button down. -- or -- (3) Move the text cursor to one corner of the block. Drop the Copy menu and choose Beginning, or strike the B key. Move the text cursor to the opposite corner. Drop the Copy menu and choose End, or strike the E key. Note: To remove the mark, move the text cursor without holding down the Shift key as described in (1), or move the mouse cursor over the text and tap the left mouse button. Note: Use method (3) when you must search for text to find the end of the block. 10. Copying a Block to the Clipboard To copy a block to the Clipboard: (1) Mark a block. (2) Drop the Copy menu and choose Clipboard, or strike the C key. Note: The File Browser will not copy a large block (more than about 10K). 11. Printing a Block To print a block (on the default Windows printer): (1) Mark a block. (2) Drop the Copy menu and choose Printer. Note: The use of the Print Manager is suggested, since it allows you to abort the printing. Note: At most one page of text will be printed. 12. Search for Text To search for text: (1) Move the text cursor, if necessary, so the text cursor is before (above) the text to be found. (2) Drop the View menu and choose Search, or strike the S key. A dialog box will appear. (3) Enter the text you want to find, and check the Match Case box if you want the search to be case-sensitive. (4) Push the Search button. The search will begin at the text cursor position and proceed forward to the end of the file. If the text is found, the text cursor will be positioned to the right of the text. To search for the same text again: (1) Drop the View menu and choose Again, or strike the F3 key. A search is case-sensitive if an exact match is required. A search is case-insensitive if capital letters are not distinguished from the corresponding small letters. For example, "Hello" matches "hello" only if the search is case-insensitive. 13. Zoom In or Out To zoom in (i.e, to see a magnified view of a smaller part of the text): (1) Move the text cursor to the part of the text that you want to view more closely. (2) Drop the View menu and select Zoom In. To zoom out (i.e., to see a less detailed view of a larger area): (1) Move the text cursor to the center of part of the text that you want to view . (2) Drop the View menu and select Zoom Out. 14. Help To view the online help table of contents: (1) Drop the Help Menu and choose Contents, or strike the F1 key. To search for help by key word: (1) Drop the Help Menu and choose Search, or hold the Shift key down and strike the F1 key. 15. Exit To close the File Browser window: (1) Drop the File menu and choose Exit. -- or -- (2) Drop the system menu and choose Close. -- or -- (3) Double click on the horizontal line in the extreme upper left corner of the window. -- or -- (4) Bring up the task list and close the File Browser. 16. Status Bar The Status Bar at the bottom of the window shows: (1) The row and column that contain the text cursor. (If no file is displayed, these numbers are meaningless.) (2) If the file has been read to the end: (a) The file height:, i.e., the total number of rows. (b) The file width; i.e., the number of columns in the widest row. The first (top) row is number 1. The leftmost column is number 1. Note: To force the File Browser to display the height and width, hold the Shift key down and strike the End key to move the text cursor to the end of the file. 17. Compilation Instructions The File Browser was compiled with Turbo C 3.1 for Windows. The files BROWSE.CPP, BROWSE.RC, BROWSE.DEF and FILEDIAL.CPP were included in a project named BROWSE.PRJ and compiled to a Windows application BROIWSE.EXE in the Samll memory model. The files BROWSE.H and FILEDIAL.H must be in the same subdirectory so they can be included as header files. The help file BROWSE.HLP was compiled from the RTF file BROWSE.RTF and the Help Project file BROWSE.HPJ with the Microsoft Help Compiler.