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

Recruit two powerful-sounding students t...
I am a fan of anime, and I hear about a lot that comes through, but one that escaped my attention until now is A Certain Scientific Railgun T, and that name is very enticing. If it's new to you too, then players of Blue Archive can get a hands-on... | Read more »
Top Hat Studios unveils a new gameplay t...
There are a lot of big games coming that you might be excited about, but one of those I am most interested in is Athenian Rhapsody because it looks delightfully silly. The developers behind this project, the rather fancy-sounding Top Hat Studios,... | Read more »
Bound through time on the hunt for sneak...
Have you ever sat down and wondered what would happen if Dr Who and Sherlock Holmes went on an adventure? Well, besides probably being the best mash-up of English fiction, you'd get the Hidden Through Time series, and now Rogueside has announced... | Read more »
The secrets of Penacony might soon come...
Version 2.2 of Honkai: Star Rail is on the horizon and brings the culmination of the Penacony adventure after quite the escalation in the latest story quests. To help you through this new expansion is the introduction of two powerful new... | Read more »
The Legend of Heroes: Trails of Cold Ste...
I adore game series that have connecting lore and stories, which of course means the Legend of Heroes is very dear to me, Trails lore has been building for two decades. Excitedly, the next stage is upon us as Userjoy has announced the upcoming... | Read more »
Go from lowly lizard to wicked Wyvern in...
Do you like questing, and do you like dragons? If not then boy is this not the announcement for you, as Loongcheer Game has unveiled Quest Dragon: Idle Mobile Game. Yes, it is amazing Square Enix hasn’t sued them for copyright infringement, but... | Read more »
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 »

Price Scanner via MacPrices.net

May 2024 Apple Education discounts on MacBook...
If you’re a student, teacher, or staff member at any educational institution, you can use your .edu email address when ordering at Apple Education to take up to $300 off the purchase of a new MacBook... Read more
Clearance 16-inch M2 Pro MacBook Pros in stoc...
Apple has clearance 16″ M2 Pro MacBook Pros available in their Certified Refurbished store starting at $2049 and ranging up to $450 off original MSRP. Each model features a new outer case, shipping... Read more
Save $300 at Apple on 14-inch M3 MacBook Pros...
Apple has 14″ M3 MacBook Pros with 16GB of RAM, Certified Refurbished, available for $270-$300 off MSRP. Each model features a new outer case, shipping is free, and an Apple 1-year warranty is... Read more
Apple continues to offer 14-inch M3 MacBook P...
Apple has 14″ M3 MacBook Pros, Certified Refurbished, available starting at only $1359 and ranging up to $270 off MSRP. Each model features a new outer case, shipping is free, and an Apple 1-year... Read more
Apple AirPods Pro with USB-C return to all-ti...
Amazon has Apple’s AirPods Pro with USB-C in stock and on sale for $179.99 including free shipping. Their price is $70 (28%) off MSRP, and it’s currently the lowest price available for new AirPods... Read more
Apple Magic Keyboards for iPads are on sale f...
Amazon has Apple Magic Keyboards for iPads on sale today for up to $70 off MSRP, shipping included: – Magic Keyboard for 10th-generation Apple iPad: $199, save $50 – Magic Keyboard for 11″ iPad Pro/... Read more
Apple’s 13-inch M2 MacBook Airs return to rec...
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 currently... Read more
Best Buy is clearing out iPad Airs for up to...
In advance of next week’s probably release of new and updated iPad Airs, Best Buy has 10.9″ M1 WiFi iPad Airs on record-low sale prices for up to $200 off Apple’s MSRP, starting at $399. Sale prices... Read more
Every version of Apple Pencil is on sale toda...
Best Buy has all Apple Pencils on sale today for $79, ranging up to 39% off MSRP for some models. Sale prices for online orders only, in-store prices may vary. Order online and choose free shipping... Read more
Sunday Sale: Apple Studio Display with Standa...
Amazon has the standard-glass Apple Studio Display on sale for $300 off MSRP for a limited time. Shipping is free: – Studio Display (Standard glass): $1299.97 $300 off MSRP For the latest prices and... Read more

Jobs Board

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
*Apple* App Developer - Datrose (United Stat...
…year experiencein programming and have computer knowledge with SWIFT. Job Responsibilites: Apple App Developer is expected to support essential tasks for the RxASL Read more
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
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.