5/17/2023 0 Comments Avoid restoring bbedit state![]() Incidentally, you should be aware that adding a WDEF resource might trigger virus detection code in some applications. ![]() I use RGetResource just in case the standard WDEF 0 is in ROM and not in the System. However, it calls the standard WDEF to do most of the work. In order for our WDEF to be used for standard windows, we must use the resource ID 0, and override the standard WDEF in the System. ![]() All require MacHeaders, and some need the MacTraps library. There is also a small data resource of type OAP1 which is used for communication between some of the code resources.Įach of these code resources is built as a separate THINK C project. Finally, at the third level of the hierarchy, there are OAPe resources, which filter events. The OAPd code draws a small icon in the windows title bar. One of the OAPn resources installs an event patch, and the other one watches the insertion point. At the next level, there are OAPn resources that are called by the WDEF after each wNew message, and OAPd resources that are called by the WDEF after each wDraw message. At the top of the hierarchy (illustrated below), there is one WDEF resource. The project will use four types of code resources, so that individual functions can be added or deleted without recompilation. Sound like a crazy feature? Not if youre typing mathematics in TEX format, which uses pairs of dollar signs to delimit mathematical formulas. This method can fail if you happen to type a really long word at the end of a line, but it usually works.Īs another example of a feature that can be added with a one-application patch, I will make each typed dollar sign generate another dollar sign and a left arrow character. Therefore, I am going to do a cruder form of word wrapping: Detect when the insertion point is within a certain distance of the right edge of the window, and then change the next space to a carriage return. However, that would be difficult to do without knowing the applications internal data structures. ![]() In order to wrap typing, we would ideally want to detect when the insertion point has passed the right edge of the window or some other preset margin, and then change a previous space character into a carriage return. This patch will work in THINK C, BBEdit, or ASLEdit+. It will also add a little icon to the title bar of each document window, which you can click to turn wrapping on or off. (You probably wouldnt want to use word wrapping while writing program code, but you might want it for long comments.) My example will patch an editor to provide a simple form of word wrapping. For instance, BBEdit 2.1.3 can wrap text after you type it, but not as you type it, and the THINK C 5.0 editor cannot wrap words at all. That is the approach used by the CMaster and PopUpFuncs products.Īll word processors can wrap words as you type them, but not all text editors can do so. In my example, I will use a WDEF, since that makes it easy to modify the appearance of windows in an application. The tricky part is, how do you get your code called in order to install the patches? What you can do is use your own version of one of the standard definition functions, such as a WDEF, MDEF, MBDF, or CDEF. Under MultiFinder or System 7, trap patches that are installed after startup time apply to only one application, because each application has its own copy of the trap dispatch table. There is a middle ground: Code resources that can be added to an application and patch traps only in that application. Not only is that likely to be extremely difficult, you will probably have to do it over again when the next version comes out. On the other hand, you could disassemble one application and make a direct patch. The trouble with this approach is that it has to be compatible with all of the applications, and probably imposes some overhead even in applications where it isnt doing anything. To make a change in the behavior of all applications running on your Mac, you can use an INIT (now known as a system extension) to patch some traps. He now teaches mathematics at the University of South Carolina. Walker earned a Ph.D in mathematics at M.I.T. How to write an application specific extension. Related Info: Calling a Code Resource Window Manager One App Patches Volume Number: 8 Issue Number: 6 Column Tag: C Workshop Educational Institution and Student Discounts.
0 Comments
Leave a Reply. |