TweetFollow Us on Twitter

Editor Extender
Volume Number:5
Issue Number:7
Column Tag:C Workshop

Related Info: Scrap Manager Desk Manager

Extend Your Favorite Editor

By Joel McNamara, Bellevue, WA

Note: Source code files accompanying article are located on MacTech CD-ROM or source code disks.

Extending Your Editor: Edit Extender DA

If you’ve programmed for awhile, you’re bound to to encounter one or two text editors you really feel comfortable with. Be it EMACS on a mainframe or QUED on a Mac, a good editor has a way of growing on you. You savor the power, the flexibility, and all of those little features that really make it stand out. Then comes the day, for some reason or another, when you’re forced to use another editor. You click on the menu bar and your favorite feature isn’t there. A keyboard command just puts a non-ASCII character on the screen. You grit your teeth and code away, wishing your preferred editor was around.

I was rudely awakened to this predicament when I started to use MPW and Lightspeed C. QUED had long been my editor of choice on the Mac, and I suddenly found a few of my favorite features weren’t around anymore. Granted, I could continue to use QUED or even be more ambitious and write my own editor with a little help from Symantec’s CAPPS, but I really like the notion of an integrated programming environment. To me, it’s a hassle to transfer from your editor into your main development environment all of the time.

Ah, but that’s the joy of being a programmer. You’re not forever an end user, hoping and praying the software gods will deliver you from want. You can rise above the masses with an idea and a compiler. The problem of creating an extendible editor can easily be solved by simply writing a desk accessory.

The theory goes like this. You have a chunk of text you want to manipulate within your editor. You just select the text, copy it into the clipboard, capitalize/count/do whatever to it, and then paste the altered text back in, replacing the previous selection. You let the text editor do all of the work, while you sit on top, adding your own features through the DA. No sweat, DA spell checkers like Thunder! do it all the time. Just combine the concepts of the sample “Windows” desk accessory included with Lightspeed C with some clipboard related code, and viola, a few quick hours of programming gives you the features of your favorite editor in a least favored one. Specifically, in the following example, capitalization, changing case, word counting, time and date insertion, and saving a selected region to a text file.

The Clipboard, Fake Keydowns, and Timing

The obvious storage location for storing text to be manipulated is the clipboard, alias the desk scrap. Once the text is there, it can be twiddled with to your heart’s content. So, the first thing to do is get the selected text into it. Now being somewhat lazy in not wanting to menu select Copy or Paste or type their keyboard equivalents all of the time, I decided there must be a better way, more in tune with the Mac interface. Something along the lines of having the text selected, pulling down the DA’s menu, and having the command executed.

The solution is to post a Command “C” (the non-case sensitive, universal Mac key command for “Copy”), and fake the editor into thinking the user had just done a copy into the clipboard. It’s a pretty easy task to post a keydown event with the PostEvent trap, but unfortunately you don’t have any control over the modifiers. If you pass in an ASCII “c” eventCode, and a “keyDwnEvt” eventMsg, all you’ll get is a lower case “c” on the screen. There are no provisions for specifying that the command/option/shift/caps lock keys may also be pressed. There are two choices in dealing with this problem: (1) Post some mousedown events with the locations of the “Edit” menu and “Copy” position, essentially faking a menu selection with the mouse. A risky proposition since you rely on the editor following Apple’s interface guidelines of where things should be. (2) Fake the Mac into thinking a command modifier key has been pressed.

The quick and dirty way is to pick door number 2 and modify the event queue. Using TMON, the location of the key modifiers are readily apparent. (Snoop around at $174 and start pressing keys.) Just change a byte here and there, and presto, the keydown “c” event is turned into a Command “C” copy event. The same technique can be used when replacing text, by posting a Command “V” for paste. You just select a menu item, Edit Extender posts a Command “C,” and the text is sitting in the clipboard ready for manipulation.

At this point, things begin to get a bit murky. If you were to implement the above method in a desk accessory, you’d see the menu bar flash, signalling the Command “C” had been posted, but no text would be copied into the clipboard. What’s going on here? The solution is a matter of timing. The DA has to tell the operating system that it’s finished, have the application take control again to do the copy, and then signal it wants to take control again. This can be accomplished with the desk accessory’s csCode parameter. Just pass in an integer in the accRun message and branch as required. With the timing problem solved, Edit Extender worked great. I now had some of my favorite features up and running. Then I was in for a rude surprise. Out of curiosity, I decided to try running it with MacWrite and Microsoft Word. It didn’t work at all. Something strange was going on. The DA worked fine with MPW, Lightspeed C, miniEdit, and QUED, but fell flat on its face when it came to “real” word processors.

Private Scraps

Despite having the same purpose, when it comes to using the clipboard and copying and pasting, text editors and word processors are two different critters. Most word processors that do any kind of text formatting (bolding, underlining, italicizing, etc.) keep the text they are dealing with in what “Inside Macintosh” refers to as a “private scrap.” This is simply a private clipboard where the application stores text and formatting information for internal use. For the sake of speed and efficiency, when the user selects some text and copies or cuts it, more than likely it’s going to end up someplace other than the desk scrap. On the other hand, virtually every text editor that deals strictly with text, will use the desk scrap for storage. This is why you can access copied text through the clipboard from the Lightspeed or MPW editor, but not from MacWrite or Word.

The Scrap Manager section of “Inside Macintosh” enlightens you to the fact that it is good and required programming etiquette for an application to transfer its private scrap to the common access desk scrap whenever a user quits the program or when a desk accessory becomes active. In doing so, formatted data should be converted into a form readable by either another application or the desk accessory. That means text turns it into a type ‘TEXT’ resource (simply a series of ASCII characters), graphics become a ‘PICT’ type, and optionally, any formatted information can be kept with its own unique resource type.

I fought off the temptation to cop-out and use Edit Extender exclusively with text editors. After all, it might be nice to have it work with word processors or even desktop publishing applications. So, what determines if a desk accessory is activated or not? Simple, if a window that is owned by the DA is brought to the front and becomes the active window, the desk accessory becomes activated. If another non-DA window comes to the front, the DA is deactivated. Not wanting to splash an ugly window on the screen, I decided to make my window appear offscreen at the upper left corner. Now when Edit Extender got a command, it brought the offscreen window to the front, the application received a message that a DA had become active and converted its private scrap into the desk scrap. The DA goes away, and presto, text now awaits us in the desk scrap.

With the window code working, Edit Extender was in business with MacWrite. With the exception of one small detail. If you had some formatted text (say italicized Geneva 10) selected, and used Edit Extender to capitalize it, when it was pasted back in, it came back as Geneva 12 plain. Clearly a case of WYDWISYG (What you don’t want is what you get!). Remember that when the private scrap is converted, it can also place formatted data in the desk scrap. That’s exactly what MacWrite is doing. In addition to the ‘TEXT’ resource, MacWrite is placing a ‘MWRT’ resource in the desk scrap that contains the text with formatting information. When MacWrite pastes back in, it will first look in the scrap for a ‘MWRT’ resource, and if it’s there, paste it in with all formatting intact. If there’s none to be found, ‘TEXT’ will be pasted in at Geneva 12. The solution to this problem is to get the clipboard format of the ‘MWRT’ text. In this case, look at Tech Note #13, MacWrite Clipboard Format. Although this version of Edit Extender doesn’t support formatted text, to do so would be fairly trivial. After you’ve posted the copy event, just scan the desk scrap for a resource with the type ‘MWRT.’ If you find it, then based on the data structure, go in and find the text and manipulate it.

Microsoft machinations

Hmmm. Now it was working with MacWrite, but wasn’t with Word. Ack! The simple DA was turning into a frustrating programming exercise. Oh well, when in doubt, get your debugger out. TMON revealed an interesting characteristic in Word. In addition to requiring the desk accessory to be activated, it also needed a Copy (Command “C”) or Paste (Command “V”) event before it would convert its private scrap to the desk scrap. Picky, picky, picky. After sliding in the appropriate code, and seeing no problems with using it for other applications, Edit Extender now seemed to work just fine. (Be advised though, that unlike MacWrite, the current version 3.0_whatever doesn’t place any formatted text into the clipboard. Rumor has it that future versions will place RTF into the desk scrap along with unformatted text.)

MultiFinder considerations

With any desk accessory that interacts directly with an application, you need to keep in mind MultiFinder and its buddy the DA Handler. Since Mr. DA Handler treats a desk accessory like an individual program, I was expecting some major complications. I know, Apple says to write small applications instead of DAs, but I still like interactive desk accessories. Fortunately in their infinite wisdom, the creators of MultiFinder left a nice loophole for DAs like Edit Extender. The solution is to hold down the Option key when initially selecting and launching the desk accessory. That means click on the apple menu, hold down the Option key, and select the DA. (If you hold down the option key before you select the apple menu, MultiFinder won’t display any DAs.) This little known technique bypasses the DA Handler, and installs Edit Extender (or any other DA for that matter) directly into the application’s heap.

(MultiFinder Caveats: In using the Option key method be aware of two things. (1) If you get out of memory errors, quit the program and increase the application’s memory size. (2) This technique allows you to run the desk accessory within only one application at a time. If you wanted to run Edit Extender in (i.e) MacWrite and PageMaker at the same time, just create a duplicate of Edit Extender and use ResEdit to give it a different DRVR resource name. Font DA/Mover will give it a unique resource I.D. when you install it, and you’ll be set.)

Conclusion

Edit Extender was built so I could have some features available no matter which Mac editor I had to use. It demonstrates some neat tricks like posting copy and paste events and converting text for DA use. But for the most part, it’s pretty much of a base to work off of. I included my pet features, and with a bit of coding, so can you. Some other options that could easily be incorporated include: sorting, search and replace, paragraph numbering, selected text printing, or indexing. Happy editor constructing!

Figure 1. Project


Listing EditExtender.c

/*  
 Edit Extender Desk Accessory
 for MacTutor Magazine
 June 1, 1988
 by Joel McNamara, Satori Software  
*/
/* the required stuff... */
#include “EventMgr.h”
#include “MenuMgr.h”
#include “MemoryMgr.h”
#include “FontMgr.h”
#include “FileMgr.h”
#include “DeviceMgr.h”
#include “DialogMgr.h”
#include “IntlPkg.h”
#include “StdFilePkg.h”

/* the globals... */
int     ALREADY_OPEN = 0;
intCONDITION = 0;
intRUNCODE = 0;
DCtlPtr DCE;
GrafPtr SAVEPORT;
MenuHandleTHE_MENUHANDLE;

/* the constants... */
/* routine returns correct resource number for the driver */
#define RsrcID(id) (0xC000 + (~DCE->dCtlRefNum << 5) + id)
/* the dialogs */
#define AboutDLOG0
#define CountsDLOG 1
#define MessageDLOG2
/* counts DITL items */
#define CharItem 2
#define WordsItem3
#define SentenceItem 4
#define ParagraphItem5
/* the fake window */
#define FakeWIND 0
/* run code commands */
#define UpperCaseCOND1
#define LowerCaseCOND2
#define ReverseCaseCOND 3
#define CapitalizeCOND  4
#define CountsCOND 5
#define TextCOND 6
#define DateCOND 7
#define TimeCOND 8
/* STR# error messages */
#define ListSTR  0
#define MemoryMSG1
#define GenericMSG 2
#define CreateMSG3
#define OpenMSG  4
#define WriteMSG 5
#define SelectMSG6
/* menu items */
#define AboutITEM1
#define UpperITEM3
#define LowerITEM4
#define ReverseITEM5
#define CapitalITEM6
#define DateITEM 8
#define TimeITEM 9
#define CountsITEM  11
#define TextITEM    13
#define QuitITEM    15
 /* DA messages */
#define OpenMessage0
#define ControlMessage  2
#define CloseMessage 4

/* let’s start... */ 
main(controlParam, dControl, message)
cntrlParam *controlParam;
DCtlPtr dControl;
short message;
{
 EvQEl  tempQElement;
 
 if ((dControl->dCtlStorage) == 0) {
 SysBeep(5);
 if (message == OpenMessage) {
 SysBeep(5);
 Display(MemoryMSG);
 CloseDriver(dControl->dCtlRefNum);
 }
 return(0);
 }
 DCE = dControl;
 switch (message) {
 case OpenMessage:
 DoOpen();
 break;
 
 case ControlMessage:
 switch (controlParam->csCode) {
   /* who needs to be in control */
 case accRun:
 if ((RUNCODE != 0) && (OSEventAvail(keyDownMask,
 &tempQElement) == 0))
 DoRuncode(RUNCODE);
 break;
 
 case accMenu:
 DoMenu(controlParam->csParam[1]);
 break;
 
 case goodBye:
 DoGoodBye();
 break;
 }
 break;
 
 case CloseMessage:
 DoClose();
 break;
 } 
return(0);
}

/* open the DA */
DoOpen()
{
 DCE->dCtlFlags |= dNeedLock| dNeedGoodBye|dCtlEnable|dNeedTime;
 
 DCE->dCtlDelay = 15;
 DCE->dCtlMenu = RsrcID(0);
 if (ALREADY_OPEN)
 return;
 
 RUNCODE = 0;  
 ALREADY_OPEN = 1;
 THE_MENUHANDLE = GetMenu( DCE->dCtlMenu);
 (*THE_MENUHANDLE)->menuID = DCE->dCtlMenu;
 InsertMenu(THE_MENUHANDLE,0);
 DrawMenuBar();
}

/* handle any menu items */
DoMenu(theItem)
inttheItem;
{
 switch (theItem)
 {
 case AboutITEM:
 DoAbout();
 break;
 
 case UpperITEM:
 DoCopy();
 CONDITION = UpperCaseCOND;
 break;
 
 case LowerITEM:
 DoCopy();
 CONDITION = LowerCaseCOND;
 break;
 
 case ReverseITEM:
 DoCopy();
 CONDITION = ReverseCaseCOND;
 break;
 
 case CapitalITEM:
 DoCopy();
 CONDITION = CapitalizeCOND;
 break;
 
 case DateITEM:
 SetRuncode();
 CONDITION = DateCOND;
 break;
 
 case TimeITEM:
 SetRuncode();
 CONDITION = TimeCOND;
 break;
 
 case CountsITEM:
 DoCopy();
 CONDITION = CountsCOND;
 break;
 
 case TextITEM:
 DoCopy();
 CONDITION = TextCOND;
 break;
 
 case QuitITEM:  
 DoClose();
 break;
 
 default:
 break;
 }
 HiliteMenu(0);
}

/* about us */
DoAbout()
{
 DialogPtr theDialog;
 int dummy;
 
 theDialog = GetNewDialog(RsrcID(AboutDLOG),0,-1);
 ModalDialog(0, &dummy);
 DisposDialog(theDialog);
}

/* close everything up */
DoClose()
{
 DeleteMenu(DCE->dCtlMenu);
 DisposeMenu(THE_MENUHANDLE);
 ALREADY_OPEN = 0;
 DCE->dCtlMenu = 0;
 DCE->dCtlWindow = 0;
 DrawMenuBar();
}

/* good bye... */
DoGoodBye()
{
 DCE->dCtlMenu = 0;
 DCE->dCtlWindow = 0;
}

/* do a control c */
DoCopy()
{
 struct keys{
 long charCode;
 long modifiers;
 } *keysPtr;
 long len;
 
 GetPort(&SAVEPORT);
 len = ZeroScrap();
 keysPtr = (struct keys*)0x174;    
 keysPtr->charCode = 0x00000000;
 keysPtr->modifiers = 0x00008000;
 PostEvent(3,67);
 keysPtr->charCode = 0x00000000;
 keysPtr->modifiers = 0x00000000;
 RUNCODE = 1;
}

/* get the DA’s attention */
SetRuncode()
{
 RUNCODE = 1;
}

/* handle any run codes */
DoRuncode(myRunCode)
short myRunCode;
{
 switch (myRunCode)
 {
 case 1: /* bring up the dummy window */
 DCE->dCtlWindow = GetNewWindow(RsrcID(FakeWIND),0,-1);
 ((WindowPeek)(DCE->dCtlWindow))->windowKind = DCE->dCtlRefNum;
 SetPort(DCE->dCtlWindow);
 RUNCODE = 2;
 break;
 
 case 2: /* do a paste event */
 PostPaste();
 RUNCODE = 3;
 break;
 
 case 3: /* now deal with our commands */
 DoText();
 break;
 
 default:
 break;
 }
}

/* here’s where we do our edit commands */
DoText()
{
 long   len;
 long   myOffset;
 long   loop;
 long   temp;
 long   theSecs;
 Handle myHandle;
 Handle newHandle;
 Handle theHandle;
 Rect   itemRect;
 int    sentences;
 int    paragraphs;
 int    words;
 int    chars;
 int    itemType;
 int    tempInt;
 char   myChar;
 char   prevChar;
 DialogPtrtheDialog;
 Ptr    myPtr;
 Str255 numStr;
 Str255 timeStr;
 
 RUNCODE = 0;    
 myHandle = NewHandle(0);
 
 len = GetScrap(myHandle,’TEXT’,&myOffset);
 if ((len <= 0) && (CONDITION <= CapitalizeCOND))
 /* nothing’s in the scrap */
 {
 SysBeep(5);
 Display(SelectMSG);
 DisposeWindow(DCE->dCtlWindow);
 DCE->dCtlWindow = 0;
 SetPort(SAVEPORT);
 }
 else
 { 
 if (CONDITION < CountsCOND)
 /* do we need a handle for manipulation? */
 newHandle = NewHandle(GetHandleSize(myHandle));
 
 switch (CONDITION)
 {
 /* the upper routine */
 case UpperCaseCOND:
 for (loop = 0; loop <= (GetHandleSize(myHandle)); loop++) 
 *(((char *)(*newHandle)) + loop) = toupper(*((char *)((long)(*myHandle) 
+ loop)));
 break;
 
 /* the lower case routine */
 case LowerCaseCOND:
 for (loop = 0; loop <= (GetHandleSize(myHandle)); loop++) 
 *((char *)((long)(*newHandle) + loop)) = tolower(*((char *)((long)(*myHandle) 
+ loop)));
 break;
 
 /* the reverse case routine */
 case ReverseCaseCOND:
 for (loop = 0; loop <= (GetHandleSize(myHandle)); loop++) {
 if (isupper(*((char *)((long)(*myHandle) + loop))))  
 *((char *)((long)(*newHandle) + loop)) = tolower(*((char *)((long)(*myHandle) 
+ loop)));
 else
 if (islower(*((char *)((long)(*myHandle) + (long)loop))))  
 *((char *)((long)(*newHandle) + loop)) = toupper(*((char *)((long)(*myHandle) 
+ loop)));
 else
 *((char *)((long)(*newHandle) + loop)) = 
 *((char *)((long) (*myHandle) + loop));     
 }
 break;
 
 /* the capitalization routine */  
 case CapitalizeCOND:
 prevChar = (char)’x’;
 for (loop = 0; loop <= (GetHandleSize(myHandle)); loop++)
 { 
 if (loop == 0)
 {
 *((char *)((long)(*newHandle) + loop)) = 
 toupper(*((char *)((long)(*myHandle) + loop)));
 prevChar = *((char *)((long)(*newHandle) + loop));
 }
 else
 {
 if ((prevChar == ‘ ‘) || (prevChar == ‘\r’) ||
 (prevChar == ‘\t’)) 
 *((char *)((long)(*newHandle) + loop)) = 
 toupper(*((char *)((long)(*myHandle) + loop)));
 else
 *((char *)((long)(*newHandle) + loop)) = 
 *((char *)((long)(*myHandle) + loop));
 prevChar = *((char *)((long)(*newHandle) + loop));
 }
 } 
 break;
 
 /* a simplistic wc */
 case CountsCOND:
 chars = sentences = paragraphs = words = 0;
 
 myPtr = *myHandle;
 for (temp = 0; temp <= len; temp++)
 {
 myChar = *((char *)((long)myPtr + temp));
 chars++;

 if (myChar == ‘\r’)
 paragraphs++;
 
 if (myChar == ‘.’ || myChar == ‘!’ || myChar == ‘?’)
 sentences++;
 
 if (myChar == ‘ ‘ || myChar == ‘\t’ || myChar == ‘\r’)
 words++;
 } 
 
 InitCursor();   
 theDialog = GetNewDialog(RsrcID(CountsDLOG),0,-1);
 SetPort(theDialog);

 NumToString(chars - paragraphs,numStr);
GetDItem(theDialog,CharItem,&itemType,&theHandle,&itemRect); 
 SetIText(theHandle,numStr);
 NumToString(words,numStr);
GetDItem(theDialog,WordsItem,&itemType,&theHandle,&itemRect); 
 SetIText(theHandle,numStr);
 NumToString(sentences,numStr);
GetDItem(theDialog,SentenceItem,&itemType,&theHandle,&itemRect); 
 SetIText(theHandle,numStr);
 NumToString(paragraphs,numStr);
GetDItem(theDialog,ParagraphItem,&itemType,&theHandle,&itemRect); 
 SetIText(theHandle,numStr);
 
 ModalDialog(0,&tempInt);
 CloseDialog(theDialog);
 break;
 
 /* text to save condition */ 
 case TextCOND:
 Extract(myHandle);
 break;
 
 /* display date condition */ 
 case DateCOND:
 GetDateTime(&theSecs);
 IUDateString(theSecs,longDate,&timeStr);
 PtoCstr(timeStr);
 ZeroScrap();
 PutScrap(strlen(timeStr),’TEXT’,&timeStr);
 PostPaste();
 break;
 
 /* display time condition */
 case TimeCOND:
 GetDateTime(&theSecs);
 IUTimeString(theSecs,TRUE,&timeStr);
 PtoCstr(timeStr);
 ZeroScrap();
 PutScrap(strlen(timeStr),’TEXT’,&timeStr);
 PostPaste();
 break;
 
 default:
 break;
 }
 
 DisposeWindow(DCE->dCtlWindow);
 DCE->dCtlWindow = 0;
 SetPort(SAVEPORT);
 
 if (CONDITION < CountsCOND)
 /* then we need to paste in the new stuff */
 {
 ZeroScrap();
 PutScrap(GetHandleSize(myHandle),’TEXT’,*newHandle);
 DisposHandle(newHandle);
 PostPaste();  
 } 
 } 
 DisposHandle(myHandle);
 CONDITION = 0;
}

/* do a paste event */
PostPaste()
{
 struct keys{
 long charCode;
 long modifiers;
 } *keysPtr;
 
 keysPtr = (struct keys*)0x174;    
 keysPtr->charCode = 0x00000000;
 keysPtr->modifiers = 0x00008000;
 PostEvent(3,86);
 keysPtr->charCode = 0x00000000;
 keysPtr->modifiers = 0x00000000;
}

/* error message display */
Display(theIndex)
int theIndex;
{
 DialogPtr theDialog;
 int    dummy;
 Str255 theMessage;
 
 GetIndString(&theMessage,RsrcID(ListSTR),theIndex);
 InitCursor();
 theDialog = GetNewDialog(RsrcID(MessageDLOG),0,-1);
 ParamText(theMessage,”\p”,”\p”,”\p”); 
 ModalDialog(0,&dummy);
 DisposDialog(theDialog);
}

/* save selected text to a file */
Extract(myHandle)
Handle myHandle;
{
 SFReply myReply;
 Point  myLoc;
 int    errCode, refNum;
 long   theCount;
 
 myLoc.v = 90;
 myLoc.h = 90;
 
 HLock(myHandle);
 SFPutFile(myLoc,”\pSave selected text to:”,”\pUntitled”,0L,&myReply);
 
 if (myReply.good)
 {
   errCode = Create(myReply.fName,myReply.vRefNum,’EDIT’,’TEXT’);
   if (errCode != noErr);
   {
 if (errCode == dupFNErr) {
 FSDelete(myReply.fName,myReply.vRefNum);
 errCode = Create(myReply.fName,myReply.vRefNum, ’EDIT’,’TEXT’);
           }
        else if (errCode != noErr) { 
 Display(CreateMSG);
 HUnlock(myHandle);
 return;
 }
 }
 
 if (FSOpen(myReply.fName,myReply.vRefNum,&refNum) != noErr) {
 Display(OpenMSG);
 FSClose(refNum);
 HUnlock(myHandle);
 return;
 }
 
 theCount = GetHandleSize(myHandle);
     if (FSWrite(refNum,&theCount,*myHandle) != noErr) {
 Display(WriteMSG);
 FSClose(refNum);
 HUnlock(myHandle);
 return;
        }
        
     FSClose(refNum);
 }
 HUnlock(myHandle);
}

/* just in case your compiler doesn’t already have these...
   otherwise, leave them out... */
strlen(s)
register char *s;
{
 char *s0 = s;
 
 while (*s++);
 return (s-s0-1);
}

inttoupper(c)
char  c;
{
 return((c>=’a’) && (c<=’z’) ? (c-32) : c);
}

inttolower(c)
char  c;
{
 return((c>=’A’) && (c<=’Z’) ? (c+32) : c);
}

intisupper(c)
char c;
{
 return((c>=’A’) && (c<=’Z’));
}

intislower(c)
char c;
{
return((c>=’a’) && (c<=’z’));
}
Listing:  EditExtender.r

* resource file for Edit Extender DA
* by Joel McNamara
* for MacTutor Magazine
* June 1, 1988

EditExtender.rsrc

TYPE DLOG
 ,-16000
blah blah
54 74 190 452
Visible NoGoAway
1
0
-16000

TYPE DLOG
 ,-15999
Counts
264 20 330 494
Visible NoGoAway
0
0
-15999

TYPE DLOG
 ,-15998
info
68 120 152 408
Visible NoGoAway
1
0
-15998

TYPE DITL
 ,-16000
4
staticText Disabled
4 10 22 330
Edit Extender version 1.0 - by Joel McNamara

button
109 274 129 353
OK

staticText Disabled
112 7 129 210
For MacTutor Magazine

staticText Disabled
30 21 96 364
Edit Extender is a series of helpful tools, not found in all text editors. 
 Use the Edit Extender DA to change, insert, and analyze selected text 
in your documents.

TYPE DITL
 ,-15999
10
button
32 367 51 443
OK

staticText Disabled
7 89 27 149
999999

staticText Disabled
32 88 52 149
999999

staticText Disabled
32 257 52 318
999999

staticText Disabled
7 257 27 318
999999

staticText Disabled
7 8 27 87
Characters:

staticText Disabled
32 8 52 56
Words:

staticText Disabled
32 171 52 246
Sentences:

staticText Disabled
7 171 27 255
Paragraphs:

staticText Disabled
6 346 25 463
Text Information

TYPE DITL
 ,-15998
3
button
60 195 79 263
OK

staticText Disabled
8 49 56 272
^0

iconItem Disabled
8 8 40 40
0

TYPE WIND
 ,-16000
Dummy
-40 -40 -20 -20
Visible NoGoAway
0
0

TYPE MENU
 ,-16000
§
About Edit Extender...
(-
Upper case
Lower case
Reverse case
Capitalize
(-
Current date
Current time
(-
Counts...
(-
Save selection as...
(-
Quit

TYPE STR#
 ,-16000)
6
Sorry, not enough memory for Edit Extender to run.
Generic error!
Sorry, couldn’t create the text file.
Sorry, couldn’t open the text file you just created.
Sorry, couldn’t write the selected text to a text file.
You must have text selected before performing a Edit Extender command.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »
MoreFun Studios has announced Season 4,...
Tension has escalated in the ever-volatile world of Arena Breakout, as your old pal Randall Fisher and bosses Fred and Perrero continue to lob insults and explosives at each other, bringing us to a new phase of warfare. Season 4, Into The Fog of... | Read more »
Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links below... | Read more »
Marvel Future Fight celebrates nine year...
Announced alongside an advertising image I can only assume was aimed squarely at myself with the prominent Deadpool and Odin featured on it, Netmarble has revealed their celebrations for the 9th anniversary of Marvel Future Fight. The Countdown... | Read more »
HoYoFair 2024 prepares to showcase over...
To say Genshin Impact took the world by storm when it was released would be an understatement. However, I think the most surprising part of the launch was just how much further it went than gaming. There have been concerts, art shows, massive... | Read more »
Explore some of BBCs' most iconic s...
Despite your personal opinion on the BBC at a managerial level, it is undeniable that it has overseen some fantastic British shows in the past, and now thanks to a partnership with Roblox, players will be able to interact with some of these... | Read more »

Price Scanner via MacPrices.net

You can save $300-$480 on a 14-inch M3 Pro/Ma...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
24-inch M1 iMacs available at Apple starting...
Apple has clearance M1 iMacs available in their Certified Refurbished store starting at $1049 and ranging up to $300 off original MSRP. Each iMac is in like-new condition and comes with Apple’s... Read more
Walmart continues to offer $699 13-inch M1 Ma...
Walmart continues to offer new Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBook for sale by... Read more
B&H has 13-inch M2 MacBook Airs with 16GB...
B&H Photo has 13″ MacBook Airs with M2 CPUs, 16GB of memory, and 256GB of storage in stock and on sale for $1099, $100 off Apple’s MSRP for this configuration. Free 1-2 day delivery is available... Read more
14-inch M3 MacBook Pro with 16GB of RAM avail...
Apple has the 14″ M3 MacBook Pro with 16GB of RAM and 1TB of storage, Certified Refurbished, available for $300 off MSRP. Each MacBook Pro features a new outer case, shipping is free, and an Apple 1-... Read more
Apple M2 Mac minis on sale for up to $150 off...
Amazon has Apple’s M2-powered Mac minis in stock and on sale for $100-$150 off MSRP, each including free delivery: – Mac mini M2/256GB SSD: $499, save $100 – Mac mini M2/512GB SSD: $699, save $100 –... Read more
Amazon is offering a $200 discount on 14-inch...
Amazon has 14-inch M3 MacBook Pros in stock and on sale for $200 off MSRP. Shipping is free. Note that Amazon’s stock tends to come and go: – 14″ M3 MacBook Pro (8GB RAM/512GB SSD): $1399.99, $200... Read more
Sunday Sale: 13-inch M3 MacBook Air for $999,...
Several Apple retailers have the new 13″ MacBook Air with an M3 CPU in stock and on sale today for only $999 in Midnight. These are the lowest prices currently available for new 13″ M3 MacBook Airs... Read more
Multiple Apple retailers are offering 13-inch...
Several Apple retailers have 13″ MacBook Airs with M2 CPUs in stock and on sale this weekend starting at only $849 in Space Gray, Silver, Starlight, and Midnight colors. These are the lowest prices... Read more
Roundup of Verizon’s April Apple iPhone Promo...
Verizon is offering a number of iPhone deals for the month of April. Switch, and open a new of service, and you can qualify for a free iPhone 15 or heavy monthly discounts on other models: – 128GB... Read more

Jobs Board

Relationship Banker - *Apple* Valley Financ...
Relationship Banker - Apple Valley Financial Center APPLE VALLEY, Minnesota **Job Description:** At Bank of America, we are guided by a common purpose to help Read more
IN6728 Optometrist- *Apple* Valley, CA- Tar...
Date: Apr 9, 2024 Brand: Target Optical Location: Apple Valley, CA, US, 92308 **Requisition ID:** 824398 At Target Optical, we help people see and look great - and Read more
Medical Assistant - Orthopedics *Apple* Hil...
Medical Assistant - Orthopedics Apple Hill York Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Now Read more
*Apple* Systems Administrator - JAMF - Activ...
…**Public Trust/Other Required:** None **Job Family:** Systems Administration **Skills:** Apple Platforms,Computer Servers,Jamf Pro **Experience:** 3 + years of Read more
Liquor Stock Clerk - S. *Apple* St. - Idaho...
Liquor Stock Clerk - S. Apple St. Boise Posting Begin Date: 2023/10/10 Posting End Date: 2024/10/14 Category: Retail Sub Category: Customer Service Work Type: Part Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.