![]() The program allows the user to select a file, opens a window, reads the contents of the file into the window, and then allows the user to change the contents of the window by typing, by using the mouse, and by selecting from the Edit menu. To try out some simple versions of these undoable editing routines, we will write a very simple editing program. We can then use the various TextEdit procedures to move text from the clipboard to the private scrap or vice versa. We use the second Text Edit record as a private scrap area to save the text removed by the user's last editing operation. We use the state variable to reset the Undo item of the Edit Menu and to call the proper procedure when the user requests Undo. The key design elements for undo (and redo) are a state variable for the next possible undo operation and a second Text Edit record. To read the clipboard to the TextEdit scrap you must call TEfromScrap. To actually put the TextEdit scrap in the clipboard file (also called the desk scrap) you must call TEtoScrap. Note that I use the term clipboard to refer to the TextEdit scrap, not the clipboard file. Insert character in text at insertion point. Insert unsaved character at beginning of saved selection. If backspace over previously unsaved character: Paste clipboard to current selection, and Ĝopy current selection to clipboard, and To make sure that we can undo an operation, we have to save any information that the operation destroys. If the user requested Undo Typing, the text and selection would revert toĪnd if the user followed the request with Redo Typing, the text and selection would once again become: That is, if the text and selection had been as follows: The effective typing sequence is the string of characters remaining after the user backspaced. ![]() Reinsert the "effective" typing sequence that the user Undid. Remove any characters that the user had backspaced over. We merely perform a Cut, Copy, Paste, or Clear. Redo Cut, Copy, Paste, and Clear are straightforward. ![]() Reinsert the selection overlaid by the typing including any removed by backspacing.įor each Undo operation except copy, we also must reset the selection as it was before the user requested the "undid" operation. Remove all characters typed since the user made the last selection. Restore the previous contents of the clipboard. Reinsert the cut text from the clipboard. We want to give the user the following Undo capabilities: I modeled my Undo by observing the behavior of MacWrite. I designed and coded a text-file version for my own development system in less that two weeks. Even if a program does contain an Edit Menu with the recommended items, Undo might not really be available.Īn Undo command is a very helpful feature, especially if you just did Clear when you meant to do Cut or if you backspaced one word too many or whatever! It is remarkable that Undo is not included in all editing type programs because it is not that difficult to program. Honored more in the breech than not is the standard Edit Menu Apple published in Inside Macintosh (page I-58). Undo Volume Number: 3 Issue Number: 5 Column Tag: Programmer's Workshopīy Melvyn D. Educational Institution and Student Discounts.Then later I just type "Status: Not Read" into Spotlight's search box and all the PDF's I have tagged appear. So what I do is type "Status: Not Read" in the Spotlight Comments' field to flag these PDFs as files I haven't read. Sometimes I can't read them all in one day. Then you can use Spotlight (OS X's built-in search technology) to search your files for text you have entered in these comment boxes.įor example, I download a lot of PDF articles everyday. You can type whatever you want inside this box (description of the file, keywords, etc.). At the top of this dialog is a box called "Spotlight Comments". On Mac OS X, if you select a file and choose File > Get Info from the Finder, you will be presented with a properties dialog for your file. It has a lot of features and is pretty powerful. Path Finder (version 4 was just released) For a really nice alternative Mac OS X file browser check out. ![]() It is missing a lot of power user features. While the file browser (the Finder) is pretty good at browsing your file system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |