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

Aether Gazer unveils Chapter 16 of its m...
After a bit of maintenance, Aether Gazer has released Chapter 16 of its main storyline, titled Night Parade of the Beasts. This big update brings a new character, a special outfit, some special limited-time events, and, of course, an engaging... | Read more »
Challenge those pesky wyverns to a dance...
After recently having you do battle against your foes by wildly flailing Hello Kitty and friends at them, GungHo Online has whipped out another surprising collaboration for Puzzle & Dragons. It is now time to beat your opponents by cha-cha... | Read more »
Pack a magnifying glass and practice you...
Somehow it has already been a year since Torchlight: Infinite launched, and XD Games is celebrating by blending in what sounds like a truly fantastic new update. Fans of Cthulhu rejoice, as Whispering Mist brings some horror elements, and tests... | Read more »
Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
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 »

Price Scanner via MacPrices.net

Free iPhone 15 plus Unlimited service for $60...
Boost Infinite, part of MVNO Boost Mobile using AT&T and T-Mobile’s networks, is offering a free 128GB iPhone 15 for $60 per month including their Unlimited service plan (30GB of premium data).... Read more
$300 off any new iPhone with service at Red P...
Red Pocket Mobile has new Apple iPhones on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide MVNO using all the major wireless carrier... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, available for $759 for 8-Core CPU/7-Core GPU/256GB models and $929 for 8-Core CPU/8-Core GPU/512GB models. Apple’s one-year warranty is... Read more
Updated Apple MacBook Price Trackers
Our Apple award-winning MacBook Price Trackers are continually updated with the latest information on prices, bundles, and availability for 16″ and 14″ MacBook Pros along with 13″ and 15″ MacBook... Read more
Every model of Apple’s 13-inch M3 MacBook Air...
Best Buy has Apple 13″ MacBook Airs with M3 CPUs in stock and on sale today for $100 off MSRP. Prices start at $999. Their prices are the lowest currently available for new 13″ M3 MacBook Airs among... Read more
Sunday Sale: Apple iPad Magic Keyboards for 1...
Walmart has Apple Magic Keyboards for 12.9″ iPad Pros, in Black, on sale for $150 off MSRP on their online store. Sale price for online orders only, in-store price may vary. Order online and choose... Read more
Apple Watch Ultra 2 now available at Apple fo...
Apple has, for the first time, begun offering Certified Refurbished Apple Watch Ultra 2 models in their online store for $679, or $120 off MSRP. Each Watch includes Apple’s standard one-year warranty... Read more
AT&T has the iPhone 14 on sale for only $...
AT&T has the 128GB Apple iPhone 14 available for only $5.99 per month for new and existing customers when you activate unlimited service and use AT&T’s 36 month installment plan. The fine... Read more
Amazon is offering a $100 discount on every M...
Amazon is offering a $100 instant discount on each configuration of Apple’s new 13″ M3 MacBook Air, in Midnight, this weekend. These are the lowest prices currently available for new 13″ M3 MacBook... Read more
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

Jobs Board

Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
IT Systems Engineer ( *Apple* Platforms) - S...
IT Systems Engineer ( Apple Platforms) at SpaceX Hawthorne, CA SpaceX was founded under the belief that a future where humanity is out exploring the stars is 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
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.