home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / apple2 / 67 < prev    next >
Encoding:
Internet Message Format  |  1991-05-11  |  39.7 KB

  1. From: jac@yoko.rutgers.edu (Jonathan A. Chandross)
  2. Newsgroups: comp.sources.apple2
  3. Subject: v001SRC048:  Texter -- text editor (GS Only) Part 02/02
  4. Message-ID: <May.10.15.47.20.1991.13866@yoko.rutgers.edu>
  5. Date: 10 May 91 19:47:21 GMT
  6. Approved: jac@paul.rutgers.edu
  7.  
  8.  
  9. Submitted-by: Joel Sumner (q4kx@cornella.ccs.cornell.edu)
  10. Posting-number: Volume 1, Source:48
  11. Archive-name: editor/texter/part02
  12. Architecture: ONLY_2gs
  13. Version-number: 1.1.1
  14.  
  15.  
  16. =texter.pas
  17. -{$keep 'Texter'}
  18. -{$optimize -1}
  19. -Program Texter;
  20. -
  21. -Uses     Common,
  22. -         ControlMgr,
  23. -         ResourceMgr,
  24. -         MemoryMgr,
  25. -         IntegerMath,
  26. -         DeskMgr,
  27. -         ToolLocator,
  28. -         WindowMgr,
  29. -         FontMgr,
  30. -         QuickDrawII,
  31. -         PrintMgr,
  32. -         MenuMgr,
  33. -         GSOS,
  34. -         DialogMgr,
  35. -         SFToolSet,
  36. -         TextEdit,
  37. -         {$LibPrefix '0/'}
  38. -         MessUnit,       {Dave Lyon's Unit for Message Center}
  39. -         MyStuff,
  40. -         Texter2;
  41. -
  42. -
  43. -const
  44. -    Application_Menu_Bar = 1;
  45. -         Apple_Menu = 1;
  46. -              About_Menu_Item = 256;
  47. -
  48. -         File_Menu = 2;
  49. -              New_Menu_Item   = 258;
  50. -              Open_Menu_Item  = 259;
  51. -              Close_Menu_Item = 255;
  52. -              Save_Menu_Item  = 260;
  53. -              SaveAs_Menu_Item = 261;
  54. -              Page_Setup_Item = 263;
  55. -              Print_Item      = 264;
  56. -              Quit_Menu_Item  = 257;
  57. -
  58. -         Edit_Menu = 3;
  59. -              Undo_Menu_Item  = 250;
  60. -              Cut_Menu_Item   = 251;
  61. -              Copy_Menu_Item  = 252;
  62. -              Paste_Menu_Item = 253;
  63. -              Clear_Menu_Item = 254;
  64. -
  65. -         Window_Menu = 4;
  66. -              Window1_Item = 265;
  67. -              Window2_Item = 266;
  68. -              Window3_Item = 267;
  69. -              Window4_Item = 268;
  70. -              Window5_Item = 269;
  71. -
  72. -         Goodies_Menu = 5;
  73. -              Word_Wrap_Item = 270;
  74. -              Choose_Font_Item=271;
  75. -
  76. -   Text_Window          = 4090;
  77. -   Text_Window_wColor   = 1;
  78. -   Text_Edit_Control    = 1;
  79. -   Tool_Startup_Table   = 1;
  80. -
  81. -   Printing_Alert       = 1;
  82. -   Tool_Error_Alert     = 2;
  83. -   Save_Alert           = 3;
  84. -
  85. -
  86. -
  87. -var
  88. -         MyMemoryID:    Integer;
  89. -         OldWindow:     integer;
  90. -         StartStopRef:  longint;
  91. -         Done:          Boolean;
  92. -         PrintRecHandle:PrHandle;
  93. -         theGSString:   GSOSInString;
  94. -         WindowMenuStr: String[255];
  95. -         WindowItems:   Array[1..5] of String[25];
  96. -         OpenWindows:   Integer;            {Max of 5 Open Windows}
  97. -         OPTable:       OpenOSDCB;
  98. -         WindFront:     boolean;
  99. -         FormatDlog,
  100. -         ApplicPort:    GrafPortPtr;
  101. -
  102. -
  103. -procedure DoPageSetup;
  104. -var Good,
  105. -    Dummy:boolean;
  106. -begin
  107. -dummy:=PrValidate(PrintRecHandle);
  108. -If ToolError<>0 then ErrorBox(ToolError,$1301)
  109. -    else begin
  110. -    Good:=PrStlDialog(PrintRecHandle);
  111. -    If ToolError<>0 then ErrorBox(ToolError,$1301);
  112. -    end;
  113. -end;
  114. -
  115. -
  116. -procedure DoPrintDoc;
  117. -var PrintPort,
  118. -    theWindow:     GrafPortPtr;
  119. -    LineNum,
  120. -    memsize:       longint;
  121. -    hTECtl:        TEHandle;
  122. -    Error,
  123. -    Where:         integer;
  124. -    pageRect:      rect;
  125. -    dummy:         boolean;
  126. -begin
  127. -theWindow := FrontWindow;
  128. -hTECtl := TEHandle(GetCtlHandleFromID(theWindow, Text_Edit_Control));
  129. -If ToolError<>0 then ErrorBox(ToolError,$1101);
  130. -dummy:=PrValidate(PrintRecHandle);
  131. -If PrJobDialog(PrintRecHandle)>0 then
  132. -    begin
  133. -    PrintPort:=PrOpenDoc(PrintRecHandle,nil);
  134. -    If ToolError<>0 then begin
  135. -         PrSetError(prAbort);
  136. -         Where:=2;
  137. -         end;
  138. -    pageRect := PrintRecHandle^^.prInfo.rPage;
  139. -    LineNum:=0;
  140. -    Repeat
  141. -         PrOpenPage(PrintPort,nil);
  142. -         If ToolError<>0 then begin
  143. -              PrSetError(prAbort);
  144. -              Where:=3;
  145. -              end;
  146. -         LineNum:=TEPaintText(PrintPort,LineNum,PageRect,0,hTECtl);
  147. -         If ToolError<>0 then begin
  148. -              PrSetError(prAbort);
  149. -              Where:=4;
  150. -              end;
  151. -         PrClosePage(PrintPort);
  152. -         If ToolError<>0 then begin
  153. -              PrSetError(prAbort);
  154. -              Where:=5;
  155. -              end;
  156. -    Until LineNum=-1;
  157. -    PrCloseDoc(PrintPort);
  158. -    Error:=PrError;
  159. -    If Error<>0 then
  160. -         begin
  161. -         ErrorBox(Error,$1100+Where);
  162. -         result:=AlertWindow(5,nil,pointer(Printing_Alert));
  163. -         end
  164. -       else
  165. -         PrPicFile(PrintRecHandle,nil,nil);
  166. -    end;
  167. -end;
  168. -
  169. -
  170. -Function GetAWindow(WindNum:Integer):GrafPortPtr;
  171. -var tmpWindow:     GrafPortPtr;
  172. -begin
  173. -tmpWindow:=NewWindow2(@Windows[windNum].WindowTitle,
  174. -           @Windows[windnum],
  175. -           @DrawWindow,
  176. -           nil,
  177. -           refIsResource,
  178. -           Text_Window,
  179. -           $800E);
  180. -If ToolError<>0 then ErrorBox(ToolError,$1001);
  181. -SetPort(tmpWindow);
  182. -GetAWindow:=tmpWindow;
  183. -end;
  184. -
  185. -Function MakeWindow(theWindnum:integer):Boolean;
  186. -begin
  187. -Windows[theWindNum].DocWindow:=GetAWindow(theWindNum);
  188. -if Windows[theWindNum].DocWindow<>nil then
  189. -    Begin
  190. -    With Windows[theWindNum] do begin
  191. -         MakeWindow:=true;
  192. -         If Length(WindowTitle)>15 then
  193. -           WindowItems[theWindNum]:=concat('...',
  194. -                                  copy(WindowTitle,Length(WindowTitle)-15,17),
  195. -                                  '  ')
  196. -            else
  197. -           WindowItems[theWindNum]:= WindowTitle;
  198. -         SetMItemName(@WindowItems[theWindNum],theWindNum+264);
  199. -         EnableMItem(theWindNum+264);
  200. -         CalcMenuSize(0,0,4);
  201. -         end;  {of With Windows}
  202. -    end
  203. -    else MakeWindow:=false;
  204. -end;
  205. -
  206. -Procedure SetWindArr(i:integer);
  207. -begin
  208. -Windows[i].index:=i;
  209. -Windows[i].InUse:=True;
  210. -Windows[i].Wrap:=true;
  211. -EnableMItem(Close_Menu_Item);
  212. -EnableMItem(Print_Item);
  213. -EnableMItem(Save_Menu_Item);
  214. -EnableMItem(SaveAs_Menu_Item);
  215. -EnableMItem(Page_Setup_Item);
  216. -EnableMItem(Choose_Font_Item);
  217. -EnableMItem(Word_Wrap_Item);
  218. -WindFront:=true;
  219. -end;
  220. -
  221. -Procedure DoNew;
  222. -var i,
  223. -    MyWindNum:Integer;
  224. -    OpenOK,
  225. -    Success:  Boolean;
  226. -    tempStr:  Str255;
  227. -begin
  228. -myWindNum:=0;
  229. -For i:=5 downto 1 do
  230. -    If Windows[i].InUse=False then mywindnum:=i;
  231. -if mywindnum=0 then ErrorBox(-2,$F01);
  232. -tempStr:=' Untitled ';
  233. -For I:=1 to length(tempstr) do
  234. -     Windows[mywindnum].DocGSString.thestring[i]:=tempstr[i];
  235. -Windows[mywindnum].DocGSString.size:=Length(tempstr);
  236. -Windows[myWindNum].WindowTitle:=tempstr;
  237. -Windows[mywindnum].DocRef:=0;
  238. -OpenOK:=True;
  239. -Success:=True;
  240. -If Success then OpenOK:=MakeWindow(MyWindNum);
  241. -If not OpenOK then ErrorBox(-3,$F02)
  242. -    else begin
  243. -    OpenWindows:=OpenWindows+1;
  244. -    SetWindArr(mywindnum);
  245. -    Windows[mywindnum].New:=True;
  246. -    Windows[mywindnum].Saved:=False;
  247. -    end;
  248. -If OpenWindows>4 then begin
  249. -    DisableMItem(Open_Menu_Item);
  250. -    DisableMItem(New_Menu_Item);
  251. -    end;
  252. -end; {of DoNew}
  253. -
  254. -Procedure FormDlog;
  255. -var  r:        rect;
  256. -begin
  257. -ApplicPort:=GetPort;
  258. -WaitCursor;
  259. -SetRect(r,200,40,440,65);
  260. -FormatDlog :=NewModalDialog(r,true,0);
  261. -If ToolError<>0 then ErrorBox(ToolError,$E07);
  262. -SetPort(FormatDlog);
  263. -MoveTo(10,15);DrawString(@'Please Wait. Formatting Text...');
  264. -end;
  265. -
  266. -Function ReadIt(thedocnum:integer):Boolean;
  267. -var eofparm:  eofOSDCB;
  268. -    temp:     boolean;
  269. -    TextHandle:Handle;
  270. -    readparm: readWriteOSDCB;
  271. -    TEControl:TEHandle;
  272. -
  273. -begin
  274. -FormDlog;
  275. -temp:=true;
  276. -eofparm.pcount:=2;
  277. -eofparm.refnum:=Windows[thedocnum].Docref;
  278. -GetEOFGS(eofparm);
  279. -if ToolError<>0 then begin
  280. -    ErrorBox(ToolError,$E01);
  281. -    temp:=false;
  282. -    end
  283. -  else begin
  284. -    TextHandle:=NewHandle(eofparm.eofEOF,MyMemoryID,0,pointer(0));
  285. -    If ToolError<>0 then begin
  286. -         ErrorBox(ToolError,$E02);
  287. -         temp:=False;
  288. -         end;
  289. -    end;
  290. -If Temp then
  291. -    begin
  292. -    Hlock(TextHandle);
  293. -    readparm.pcount:=4;
  294. -    readparm.refnum:=Windows[thedocnum].Docref;
  295. -    readparm.databuffer:=TextHandle^;
  296. -    readparm.requestcount:=eofparm.eofEOF;
  297. -    ReadGS(readparm);
  298. -    If ToolError<>0 then begin
  299. -         ErrorBox(ToolError,$E03);
  300. -         temp:=false;
  301. -         end;
  302. -    end;
  303. -If Temp then
  304. -    begin
  305. -    TEControl:=TEHandle(GetCtlHandleFromID(Windows[thedocnum].DocWindow,
  306. -                                  Text_Edit_Control));
  307. -    If ToolError<>0 then
  308. -         ErrorBox(ToolError,$E03);
  309. -
  310. -    TESetText(8+5, {Data is in Handle in Unformatted text block}
  311. -              teTextRef(TextHandle),
  312. -              eofparm.eofEOF,  {Should be ignored}
  313. -              $0000,
  314. -              $00000000,
  315. -              TEControl);
  316. -    If ToolError<>0 then
  317. -         ErrorBox(ToolError,$E04);
  318. -    HUnlock(TextHandle);
  319. -    If ToolError<>0 then
  320. -         ErrorBox(ToolError,$E05);
  321. -    DisposeHandle(TextHandle);
  322. -    If ToolError<>0 then ErrorBox(ToolError,$E06);
  323. -    end;
  324. -ReadIt:=temp;
  325. -InitCursor;
  326. -CloseDialog(FormatDlog);
  327. -If ToolError<>0 then ErrorBox(ToolError,$E08);
  328. -SetPort(ApplicPort);
  329. -end;
  330. -
  331. -Procedure CloseFile(theref:integer);
  332. -var CloseRec:CloseOSDCB;
  333. -begin
  334. -CloseRec.pCount:=1;
  335. -CloseRec.refNum:=theref;
  336. -CloseGS(CloseRec);
  337. -If ToolError<>0 then ErrorBox(ToolError,$1401);
  338. -end;
  339. -
  340. -Procedure OpenStartUp(theFile:Str255);
  341. -var
  342. -    i,Error:  integer;
  343. -    OpenOK,
  344. -    Success:  Boolean;
  345. -    temptext: Str255;
  346. -begin
  347. -For I:=1 to Length(thefile) do
  348. -    Windows[openWindows+1].DocGSString.thestring[i]:=thefile[i];
  349. -Windows[openWindows+1].DocGSString.size:=Length(thefile);
  350. -Windows[OpenWindows+1].WindowTitle:=concat(' ',thefile,' ');
  351. -With OPtable do begin
  352. -    pCount:=       15;
  353. -    refnum:=       0;
  354. -    pathname:=     @Windows[openWindows+1].DocGSString;
  355. -    requestAccess:=1;
  356. -    ResourceNumber:=0;
  357. -    end;
  358. -OpenGS(OPtable);
  359. -Error:=ToolError;
  360. -If (OPTable.filetype<>$04) and (OPTable.Filetype<>$B0) then Error:=-1;
  361. -Windows[OpenWindows+1].DocRef:=OPtable.refnum;
  362. -OpenOK:=True;
  363. -Success:=True;
  364. -If Error<>0 then
  365. -    begin
  366. -    ErrorBox(Error,$D01);
  367. -    Success:=False;
  368. -    end;
  369. -If Success then OpenOK:=MakeWindow(OpenWindows+1);
  370. -If not OpenOK then begin
  371. -    ErrorBox(-3,$D03);
  372. -    CloseFile(Windows[openwindows+1].DocRef);
  373. -    end
  374. -    else
  375. -    begin
  376. -    OpenWindows:=OpenWindows+1;
  377. -    SetWindArr(OpenWindows);
  378. -    Windows[OpenWindows].New:=False;
  379. -    Windows[OpenWindows].Saved:=True;
  380. -    OpenOK:=ReadIt(OpenWindows);
  381. -    CloseFile(Windows[openwindows].DocRef);
  382. -    end;
  383. -end; {of OpenStartUp}
  384. -
  385. -
  386. -Procedure OpenIt(SfRecord:ReplyRecord);
  387. -var
  388. -    i,Error,
  389. -    MyWindNum:integer;
  390. -    OpenOK,
  391. -    Success:  Boolean;
  392. -    temptext: Str255;
  393. -begin
  394. -mywindnum:=0;
  395. -For i:=5 downto 1 do
  396. -    If Windows[i].InUse=False then mywindnum:=i;
  397. -if mywindnum=0 then ErrorBox(-2,$C01);
  398. -For I:=1 to Length(SFRecord.Fullpathname) do
  399. -    Windows[mywindnum].DocGSString.thestring[i]:=SFRecord.Fullpathname[i];
  400. -Windows[mywindnum].DocGSString.size:=Length(SFRecord.Fullpathname);
  401. -Windows[myWindNum].WindowTitle:=SFRecord.Fullpathname;
  402. -With OPtable do begin
  403. -    pCount:=       15;
  404. -    refnum:=       0;
  405. -    pathname:=     @Windows[mywindnum].DocGSString;
  406. -    requestAccess:=1;
  407. -    ResourceNumber:=0;
  408. -    end;
  409. -OpenGS(OPtable);
  410. -Error:=ToolError;
  411. -Windows[mywindnum].DocRef:=OPtable.refnum;
  412. -OpenOK:=True;
  413. -Success:=True;
  414. -if Error<>0 then
  415. -    begin
  416. -    ErrorBox(Error,$C02);
  417. -    Success:=False;
  418. -    end;
  419. -If Success then OpenOK:=MakeWindow(MyWindNum);
  420. -If not OpenOK then begin
  421. -    ErrorBox(Error,$C03);
  422. -    CloseFile(Windows[mywindnum].DocRef);
  423. -    end
  424. -    else begin
  425. -    OpenWindows:=OpenWindows+1;
  426. -    SetWindArr(mywindnum);
  427. -    Windows[mywindnum].New:=False;
  428. -    Windows[mywindnum].Saved:=True;
  429. -    OpenOK:=ReadIt(mywindnum);
  430. -    CloseFile(Windows[mywindnum].DocRef);
  431. -    end;
  432. -If OpenWindows>4 then begin
  433. -    DisableMItem(Open_Menu_Item);
  434. -    DisableMItem(New_Menu_Item);
  435. -    end;
  436. -end; {of OpenIt}
  437. -
  438. -Function OpenFile(i:integer):boolean;
  439. -var OCtable:OpenOSDCB;
  440. -    error:    integer;
  441. -begin
  442. -With OCtable do begin
  443. -    pCount:=       15;
  444. -    refnum:=       0;
  445. -    pathname:=     @Windows[i].DocGSString;
  446. -    requestAccess:=3;
  447. -    ResourceNumber:=0
  448. -    end;
  449. -OpenGS(OCtable);
  450. -Error:=ToolError;
  451. -Windows[i].Docref:=OCTable.refnum;
  452. -if Error<>0 then
  453. -    begin
  454. -    ErrorBox(Error,$B01);
  455. -    OpenFile:=False;
  456. -    end
  457. -    else OpenFile:=True;
  458. -end;
  459. -
  460. -Procedure DoOpen;
  461. -var      prompt:        str255;
  462. -         replyrec:      ReplyRecord;
  463. -         TheTypeList:   TypeList;
  464. -begin
  465. -prompt := 'File to Open:';
  466. -with TheTypeList do begin
  467. -    numEntries     := 2;
  468. -    fileType[1]    := $0004;
  469. -    fileType[2]    := $00B0;
  470. -    end;
  471. -SFGetFile(100,50,@prompt,nil,@TheTypeList,replyrec);
  472. -If toolError>0 then ErrorBox(ToolError,$A01);
  473. -if not(replyrec.good=false) then OpenIt(replyRec);
  474. -end;
  475. -
  476. -Function DeleteFile(var CreateTable:CreateOSDCB):boolean;
  477. -var DPTable:  DestroyOSDCB;
  478. -    I,
  479. -    error:    Integer;
  480. -begin
  481. -DPTable.pcount:=1;
  482. -DPTable.Pathname:=CreateTable.PathName;
  483. -DestroyGS(DPTable);
  484. -If ToolError>0 then
  485. -    begin
  486. -    ErrorBox(Error,$901);
  487. -    DeleteFile:=False;
  488. -    end
  489. -else begin
  490. -    CreateGS(CreateTable);
  491. -    If ToolError>0 then begin
  492. -         ErrorBox(ToolError,$902);
  493. -         DeleteFile:=False;
  494. -         end
  495. -    else DeleteFile:=True;
  496. -    end;
  497. -end; {of DeleteFile}
  498. -
  499. -Function CreateNewFile(index:integer):Boolean;
  500. -var CPtable:  CreateOSDCB;
  501. -    i,
  502. -    error:    integer;
  503. -    prompt,
  504. -    origname: String;
  505. -    reply:    ReplyRecord;
  506. -begin
  507. -prompt:='Save conversion as:';
  508. -origname:='Untitled';
  509. -SFPutFile(100,50,@prompt,@origname,15,reply);
  510. -If ToolError> 0 then ErrorBox(ToolError,$801);
  511. -if integer(reply.good)=0 then
  512. -    CreateNewFile:=False
  513. -    else
  514. -    begin
  515. -    For I:=1 to Length(reply.fullpathname) do
  516. -         theGSString.thestring[i]:=reply.fullpathname[i];
  517. -    theGSString.size:=Length(reply.fullpathname);
  518. -    With CPtable do
  519. -         begin
  520. -         pCount:=       7;
  521. -         Pathname:=     @theGSString;
  522. -         access:=       227;
  523. -         filetype:=     4;
  524. -         auxType:=      0;
  525. -         StorageType:=  1;
  526. -         DataEOF:=      1;
  527. -         resourceEOF:=  0;
  528. -         end;
  529. -    CreateGS(CPtable);
  530. -    Error:=ToolError;
  531. -    Windows[index].DocGSString:=theGSString;
  532. -    Windows[index].WindowTitle:=reply.Fullpathname;
  533. -    CreateNewFile:=True;
  534. -    If Error>0 then begin
  535. -         If Error = 71 then CreateNewFile:=DeleteFile(CPTable)
  536. -              else begin
  537. -              ErrorBox(ToolError,$802);
  538. -              CreateNewFile:=False;
  539. -              end; {If ToolError}
  540. -         End; {If IsToolError}
  541. -    end; {of If not reply.good}
  542. -end; {of CreateNewFile}
  543. -
  544. -Function WriteDocWindow(i:integer):boolean;
  545. -var eofparm:  SetMarkOSDCB;
  546. -    writeparms:readwriteOSDCB;
  547. -    uhoh:     boolean;
  548. -    TECtlHand:TEHandle;
  549. -    TextHandle:Handle;
  550. -    length:   longint;
  551. -begin
  552. -Uhoh:=false;
  553. -with eofparm do
  554. -    begin
  555. -    pcount:=       3;
  556. -    refnum:=       Windows[i].DocRef;
  557. -    base:=         0;
  558. -    displacement:= 0;
  559. -    end;
  560. -SetEOFGS(eofParm);           {Set EOF to zero to prepare for write}
  561. -TECtlHand:=TEHandle(GetCtlHandleFromID(Windows[i].DocWindow,
  562. -                                      Text_Edit_Control));
  563. -If ToolError<>0 then ErrorBox(ToolError,$701);
  564. -TextHandle:=NewHandle(TECtlHand^^.textlength,MyMemoryID,0,pointer(0));
  565. -If ToolError<>0 then
  566. -    begin
  567. -    ErrorBox(ToolError,$702);
  568. -    uhoh:=true;
  569. -    end;
  570. -If not(uhoh) then
  571. -    begin
  572. -    HLock(TextHandle);
  573. -    length:=TEGetText(8+5, {Data to Handle in Unformatted text block}
  574. -                   TextHandle,
  575. -                   $00000000,  {ignored}
  576. -                   $0000,
  577. -                   $00000000,{No style info}
  578. -                   TECtlHand);
  579. -    If ToolError<>0 then
  580. -         begin
  581. -         ErrorBox(ToolError,$703);
  582. -         uhoh:=true;
  583. -         end;
  584. -    end;
  585. -if not(uhoh) then
  586. -    begin
  587. -    With writeparms do
  588. -         begin
  589. -         pcount:=       5;
  590. -         refnum:=       Windows[i].DocRef;
  591. -         databuffer:=   TextHandle^;
  592. -         requestcount:=length;
  593. -         cachePriority:=0;
  594. -         end;
  595. -    WriteGS(writeparms);
  596. -    If ToolError<>0 then
  597. -         begin
  598. -         ErrorBox(ToolError,$704);
  599. -         uhoh:=true;
  600. -         end;
  601. -     end;
  602. -WriteDocWindow:=not(uhoh);
  603. -HUnlock(TextHandle);
  604. -DisposeHandle(TextHandle);
  605. -end;
  606. -
  607. -Procedure DoSaveAs;
  608. -var i:        integer;
  609. -    theDocptr:DocumentPtr;
  610. -    theDoc:   Document;
  611. -    success:  boolean;
  612. -    TEControl:TEHandle;
  613. -    dirty:    byte;
  614. -begin
  615. -theDocPtr:=DocumentPtr(GetWRefCon(FrontWindow));
  616. -theDoc:=theDocPtr^;
  617. -i:=theDoc.Index;
  618. -If CreateNewFile(i) then
  619. -    begin
  620. -    if OpenFile(i) then success:=writeDocWindow(i);
  621. -    CloseFile(Windows[i].DocRef);
  622. -    end;
  623. -If Success then
  624. -    With Windows[i] do begin
  625. -         If Length(WindowTitle)>15 then
  626. -           WindowItems[i]:=concat('...',
  627. -                                  copy(WindowTitle,Length(WindowTitle)-15,17),
  628. -                                  '  ')
  629. -            else
  630. -           WindowItems[i]:= WindowTitle;
  631. -         SetWTitle(@WindowTitle,DocWindow);
  632. -         SetMItemName(@WindowItems[i],i+264);
  633. -         EnableMItem(i+264);
  634. -         CalcMenuSize(0,0,4);
  635. -         saved:=true;
  636. -         new:=false;
  637. -         TEControl:=TEHandle(GetCtlHandleFromID(DocWindow,
  638. -                                                Text_Edit_Control));
  639. -         If ToolError<>0 then ErrorBox(ToolError,$601);
  640. -         TEControl^^.ctlFlag:=TEControl^^.ctlFlag & $bf;
  641. -         end; {of with windows}
  642. -end;
  643. -
  644. -procedure DoSave;
  645. -var i:   integer;
  646. -    theDocptr:DocumentPtr;
  647. -    theDoc:   Document;
  648. -    success:  boolean;
  649. -    TEControl:TEHandle;
  650. -    dirty:    byte;
  651. -begin
  652. -theDocPtr:=DocumentPtr(GetWRefCon(FrontWindow));
  653. -theDoc:=theDocPtr^;
  654. -i:=theDoc.Index;
  655. -success:=false;
  656. -if windows[i].new then DoSaveAs
  657. -    else
  658. -    begin
  659. -    if OpenFile(i) then success:=WriteDocWindow(i);
  660. -    CloseFile(windows[i].DocRef);
  661. -    end;
  662. -If success then begin
  663. -    windows[i].saved:=true;
  664. -    TEControl:=TEHandle(GetCtlHandleFromID(Windows[i].DocWindow,
  665. -                                                Text_Edit_Control));
  666. -    If ToolError<>0 then ErrorBox(ToolError,$501);
  667. -    TEControl^^.ctlFlag:=TEControl^^.ctlFlag & $bf;
  668. -    end;
  669. -end;
  670. -
  671. -procedure ContinueClose(i:integer);
  672. -begin
  673. -CloseWindow(Windows[i].DocWindow);     {close it}
  674. -Windows[i].DocWindow := nil;
  675. -Windows[i].InUse:=False;
  676. -OpenWindows:=OpenWindows-1;
  677. -EnableMItem(Open_Menu_Item);
  678. -EnableMItem(New_Menu_Item);
  679. -WindowItems[i]:=concat('Window',cnvis(i));
  680. -SetMItemName(@WindowItems[i],i+264);
  681. -CalcMenuSize(0,0,4);
  682. -DisableMItem(264+i);
  683. -If OpenWindows=0 then
  684. -    begin
  685. -    Windfront:=false;
  686. -    DisableMItem(Close_Menu_Item);
  687. -    DisableMItem(Print_Item);
  688. -    DisableMItem(Save_Menu_Item);
  689. -    DisableMItem(SaveAs_Menu_Item);
  690. -    DisableMItem(Page_Setup_Item);
  691. -    DisableMItem(Word_Wrap_Item);
  692. -    DisableMITem(Choose_Font_Item);
  693. -    end;
  694. -end;
  695. -
  696. -procedure DoClose;
  697. -var i:        integer;
  698. -    theDocptr:DocumentPtr;
  699. -    theDoc:   Document;
  700. -    TEControl:TEHandle;
  701. -    dirty:    byte;
  702. -    button:   integer;
  703. -begin
  704. -if FrontWindow <> nil then
  705. -    begin
  706. -    if GetWKind(FrontWindow)=0 then
  707. -         begin
  708. -         theDocPtr:=DocumentPtr(GetWRefCon(FrontWindow));
  709. -         theDoc:=theDocPtr^;
  710. -         i:=theDoc.Index;
  711. -         TEControl:=TEHandle(GetCtlHandleFromID(Windows[i].DocWindow,
  712. -                                                Text_Edit_Control));
  713. -         If ToolError<>0 then ErrorBox(ToolError,$401);
  714. -         dirty:=TEControl^^.ctlFlag;
  715. -         if (dirty & $0040) <> 0 then
  716. -              Windows[i].saved:=false;
  717. -         if not (Windows[i].saved) then
  718. -              begin
  719. -              button:=AlertWindow(5,nil,pointer(Save_Alert));
  720. -              if button=2 then DoSave;
  721. -              if button>0 then ContinueClose(i);
  722. -              end
  723. -              else ContinueClose(i);
  724. -         end
  725. -    end
  726. -  else begin
  727. -  CloseNDAByWinPtr(FrontWindow);
  728. -  If ToolError<>0 then ErrorBox(ToolError,$402);
  729. -  end;
  730. -end; {DoClose}
  731. -
  732. -Procedure GoGetBuffer;
  733. -var any:      integer;
  734. -    PathPtr:  StringPtr;
  735. -    NotDone:  Boolean;
  736. -    PPtable:  PrefsOSDCB;
  737. -begin
  738. -PPtable.pcount:=1;
  739. -PPtable.preferences:=$8000;
  740. -SetSysPrefsGS(PPTable);
  741. -If ToolError<>0 then ErrorBox(ToolError,$301);
  742. -
  743. -new(PathPtr);
  744. -Any:=InitReadMc(MyMemoryID);
  745. -OpenWindows:=0;
  746. -If Any>-1 then 
  747. -    Repeat
  748. -    NotDone:=ReadNextMc(PathPtr);
  749. -    if (NotDone) and (OpenWindows<5) then OpenStartUp(PathPtr^);
  750. -    Until NotDone=False;
  751. -If OpenWindows>4 then begin
  752. -    DisableMItem(Open_Menu_Item);
  753. -    DisableMItem(New_Menu_Item);
  754. -    end;
  755. -end;
  756. -
  757. -Procedure DoChooseFont;
  758. -var i:        integer;
  759. -    theDocptr:DocumentPtr;
  760. -    theDoc:   Document;
  761. -    TECtlHand:TEHandle;
  762. -    theid:    longint;
  763. -    thestyle: TEStyle;
  764. -begin
  765. -thestyle.teFont.fid:=ChooseFont(FMGetCurFID,0);
  766. -If ToolError<>0 then ErrorBox(ToolError,$1601);
  767. -theDocPtr:=DocumentPtr(GetWRefCon(FrontWindow));
  768. -theDoc:=theDocPtr^;
  769. -i:=theDoc.Index;
  770. -TECtlHand:=TEHandle(GetCtlHandleFromID(Windows[i].DocWindow,
  771. -                                      Text_Edit_Control));
  772. -FormDlog;
  773. -If ToolError<>0 then ErrorBox(ToolError,$1602);
  774. -TESetSelection(0,TECtlHand^^.textlength,TECtlHand);
  775. -If ToolError<>0 then ErrorBox(ToolError,$1603);
  776. -TEStyleChange($62,theStyle,TECtlHand);
  777. -If ToolError<>0 then ErrorBox(ToolError,$1604);
  778. -InitCursor;
  779. -CloseDialog(FormatDlog);
  780. -If ToolError<>0 then ErrorBox(ToolError,$1605);
  781. -SetPort(ApplicPort);
  782. -end;
  783. -
  784. -Procedure ChangeWrap;
  785. -var i:        integer;
  786. -    theDocptr:DocumentPtr;
  787. -    theDoc:   Document;
  788. -    TEControl:TEHandle;
  789. -    flag:     longint;
  790. -    theruler: Handle;
  791. -begin
  792. -theDocPtr:=DocumentPtr(GetWRefCon(FrontWindow));
  793. -theDoc:=theDocPtr^;
  794. -i:=theDoc.Index;
  795. -TEControl:=TEHandle(GetCtlHandleFromID(Windows[i].DocWindow,
  796. -                                       Text_Edit_Control));
  797. -If ToolError<>0 then ErrorBox(ToolError,$1501);
  798. -FormDlog;
  799. -flag:=TEControl^^.textflags;
  800. -flag:=(flag ! $10000000);
  801. -if (flag & $10000000)=0 then begin
  802. -    Windows[i].Wrap:=True;
  803. -    CheckMItem(true,Word_Wrap_Item);
  804. -    end
  805. -    else begin
  806. -    CheckMItem(false,Word_Wrap_Item);
  807. -    Windows[i].Wrap:=False;
  808. -    end;
  809. -TEControl^^.textflags:=flag;
  810. -theRuler:=NewHandle(80,MyMemoryID,
  811. -                   attrLocked+attrFixed+attrNoCross,
  812. -                   Pointer(0));
  813. -If ToolError<>0 then ErrorBox(ToolError,$1502);
  814. -TEGetRuler(terefIsHandle,theruler,TEControl);
  815. -If ToolError<>0 then ErrorBox(ToolError,$1503)
  816. -    else begin
  817. -    TESetRuler(teRefIsHandle,theruler,TEControl);
  818. -    If ToolError<>0 then ErrorBox(ToolError,$1504);
  819. -    end;
  820. -DisposeHandle(theRuler);
  821. -InitCursor;
  822. -CloseDialog(FormatDlog);
  823. -If ToolError<>0 then ErrorBox(ToolError,$1605);
  824. -SetPort(ApplicPort);
  825. -end;
  826. -
  827. -procedure ProcessMenu(Code: longint);
  828. -var menuNum : integer;
  829. -    itemNum : integer;
  830. -begin
  831. -    menuNum := HiWord(Code);
  832. -    itemNum := LoWord(Code);
  833. -    case itemNum of
  834. -         {Apple Menu}
  835. -        About_Menu_Item :    DoAbout;
  836. -         {File Menu}
  837. -         New_Menu_Item:      DoNew;
  838. -         Open_Menu_Item:     DoOpen;
  839. -         Close_Menu_Item:    DoClose;
  840. -         Save_Menu_Item:     DoSave;
  841. -         SaveAs_Menu_Item:   DoSaveAs;
  842. -         Page_Setup_Item:    DoPageSetup;
  843. -         Print_Item:         DoPrintDoc;
  844. -        Quit_Menu_Item  :    Done := true;
  845. -         {Edit Menu}
  846. -         Undo_Menu_Item:;
  847. -         Cut_Menu_Item:;
  848. -         Copy_Menu_Item:;
  849. -         Paste_Menu_Item:;
  850. -         Clear_Menu_Item:;
  851. -         Window1_Item:   DoToFront(1);
  852. -         Window2_Item:   DoToFront(2);
  853. -         Window3_Item:   DoToFront(3);
  854. -         Window4_Item:   DoToFront(4);
  855. -         Window5_Item:   DoToFront(5);
  856. -         Word_Wrap_Item: ChangeWrap;
  857. -         Choose_Font_Item:DoChooseFont;
  858. -        otherwise ;
  859. -    end; {case}
  860. -    HiliteMenu(false,menuNum);
  861. -end;
  862. -
  863. -Procedure modifymenus(i:integer);
  864. -begin
  865. -if i=0 then
  866. -    begin          {Back to Texter windows}
  867. -    If windfront=true then
  868. -         begin
  869. -         enableMItem(Save_Menu_Item);
  870. -         enableMitem(SaveAs_Menu_Item);
  871. -         enableMItem(Page_Setup_Item);
  872. -         enableMItem(Print_Item);
  873. -         enableMItem(Choose_Font_Item);
  874. -         enableMItem(Word_Wrap_Item);
  875. -         end;
  876. -    end
  877. -    else
  878. -    begin
  879. -    If windfront=true then
  880. -         begin
  881. -         disableMItem(Save_Menu_Item);
  882. -         disableMitem(SaveAs_Menu_Item);
  883. -         disableMItem(Page_Setup_Item);
  884. -         disableMItem(Print_Item);
  885. -         disableMItem(Choose_Font_Item);
  886. -         disableMItem(Word_Wrap_Item);
  887. -         end;
  888. -    end;
  889. -end;
  890. -
  891. -procedure CheckFront;
  892. -var currwindow:    integer;
  893. -    fwind:         GrafPortPtr;
  894. -    i:             integer;
  895. -    theDocptr:     DocumentPtr;
  896. -    theDoc:        Document;
  897. -begin
  898. -fWind:=FrontWindow;
  899. -currwindow:=GetWKind(Fwind);
  900. -if currwindow<>oldwindow then
  901. -    Modifymenus(currwindow);
  902. -theDocPtr:=DocumentPtr(GetWRefCon(FWind));
  903. -theDoc:=theDocPtr^;
  904. -i:=theDoc.Index;
  905. -If Windows[i].Wrap then CheckMItem(true,Word_Wrap_Item)
  906. -    else CheckMItem(false,Word_Wrap_Item);
  907. -end;
  908. -
  909. -procedure MainEventLoop;
  910. -var Event     : EventRecord;
  911. -    EventCode : integer;
  912. -begin
  913. -    Event.TaskMask := $FFFFF;
  914. -    while not done do begin
  915. -        CheckFront;
  916. -        EventCode := TaskMaster($076E,Event);
  917. -        case EventCode of
  918. -            wInSpecial,
  919. -            wInMenuBar : ProcessMenu(Event.TaskData);
  920. -            wInContent :;
  921. -            wInGoAway  : DoClose;
  922. -            otherwise ;
  923. -        end; {case}
  924. -    end; {while}
  925. -end;
  926. -
  927. -procedure SetUpMenus;
  928. -var
  929. -    height: Integer;
  930. -
  931. -begin
  932. -SetSysBar(CtlRecHndl(NewMenubar2(refIsResource,Application_Menu_Bar, nil)));
  933. -SetMenuBar(nil);
  934. -FixAppleMenu(Apple_Menu);        { Add DAs to apple menu }
  935. -If ToolError<>0 then ErrorBox(ToolError,$201);
  936. -height := FixMenuBar;             { Set sizes of menus }
  937. -DrawMenuBar;        { and draw the menu bar! }
  938. -end; { of SetUpMenus }
  939. -
  940. -
  941. -Procedure Initialize;
  942. -begin
  943. -OldWindow:=1;
  944. -ErrStringPtr:=@ErrStringArr;
  945. -PrintRecHandle:=PrHandle(NewHandle($8C,         {Size of Printer Job Rec}
  946. -                          MyMemoryID,
  947. -                          attrnocross+attrfixed+attrlocked,
  948. -                          Pointer(0)));
  949. -If ToolError<>0 then ErrorBox(ToolError,$101);
  950. -PrDefault(PrintRecHandle);
  951. -If ToolError<>0 then ErrorBox(ToolError,$102);
  952. -Windfront:=false;
  953. -end;
  954. -
  955. -
  956. -begin
  957. -TLStartUp;
  958. -MyMemoryID := MMStartUp;
  959. -
  960. -StartStopRef := StartupTools(MyMemoryID,refIsResource,Tool_StartUp_Table);
  961. -result:=ToolError;
  962. -If result=0 then
  963. -    begin
  964. -    Initialize;
  965. -    SetUpMenus;
  966. -    GoGetBuffer;
  967. -    InitCursor;
  968. -    MainEventLoop;
  969. -    end
  970. -    else
  971. -    NoRun(result);
  972. -
  973. -ShutDownTools(refIsHandle, StartStopRef);
  974. -end.
  975. -
  976. =texter.r.src
  977. -// --------------------------------------------------------------------
  978. -// Genesys created REZ data code
  979. -// Simple Software Systems International, Inc.
  980. -// APWREZ.SCG 1.2
  981. -// --------------------------------------------------------------------
  982. -
  983. -#include "types.rez"
  984. -
  985. -// --- Control Templates
  986. -
  987. -resource rControlTemplate (Text_Edit_Control, $0000) {
  988. -       $00000001,              // ID
  989. -       {  0,  0,170,590},      // rect
  990. -       editTextControl {{
  991. -               $0000,          // flag
  992. -               $7C00,          // moreFlags
  993. -               $00000000,      // refCon
  994. -               $22280000,      // textFlags
  995. -               {65535,65535,65535,65535},  // indentRect
  996. -               $FFFFFFFF,      // vertBar
  997. -               $0000,          // vertAmount
  998. -               $00000000,      // horzBar
  999. -               $0000,          // horzAmount
  1000. -               $00000000,      // styleRef
  1001. -               $0015,          // textDescriptor
  1002. -               Edit_pString,  // textRef
  1003. -               $00000000,      // textLength
  1004. -               $00000000,      // maxChars
  1005. -               $00000000,      // maxLines
  1006. -               $0000,          // maxCharsPerLine
  1007. -               $0000,          // maxHeight
  1008. -               0,              // colorTableRef
  1009. -               $0000,          // drawMode
  1010. -               $00000000       // filterProcPtr
  1011. -       }};
  1012. -};
  1013. -
  1014. -// --- rPString Templates
  1015. -
  1016. -resource rPString (Apple_pString, $C018) {
  1017. -       "@"
  1018. -};
  1019. -
  1020. -resource rPString (File_pString, $C018) {
  1021. -       "  File  "
  1022. -};
  1023. -
  1024. -resource rPString (Edit_pString, $C018) {
  1025. -       "  Edit  "
  1026. -};
  1027. -
  1028. -resource rPString (Windows_pString, $C018) {
  1029. -       "  Windows  "
  1030. -};
  1031. -
  1032. -resource rPString (Goodies_pString, $C018) {
  1033. -       "  Goodies  "
  1034. -};
  1035. -
  1036. -resource rPString (Undo_pString, $C018) {
  1037. -       "Undo"
  1038. -};
  1039. -
  1040. -resource rPString (Cut_pString, $C018) {
  1041. -       "Cut"
  1042. -};
  1043. -
  1044. -resource rPString (Copy_pString, $C018) {
  1045. -       "Copy"
  1046. -};
  1047. -
  1048. -resource rPString (Paste_pString, $C018) {
  1049. -       "Paste"
  1050. -};
  1051. -
  1052. -resource rPString (Clear_pString, $C018) {
  1053. -       "Clear"
  1054. -};
  1055. -
  1056. -resource rPString (Close_pString, $C018) {
  1057. -       "Close"
  1058. -};
  1059. -
  1060. -resource rPString (About_pString, $C018) {
  1061. -       "About..."
  1062. -};
  1063. -
  1064. -resource rPString (Quit_pString, $C018) {
  1065. -       "Quit"
  1066. -};
  1067. -
  1068. -resource rPString (New_pString, $C018) {
  1069. -       "New"
  1070. -};
  1071. -
  1072. -resource rPString (Open_pString, $C018) {
  1073. -       "Open..."
  1074. -};
  1075. -
  1076. -resource rPString (Save_pString, $C018) {
  1077. -       "Save"
  1078. -};
  1079. -
  1080. -resource rPString (SaveAs_pString, $C018) {
  1081. -       "Save as..."
  1082. -};
  1083. -
  1084. -resource rPString (Page_Setup_pString, $C018) {
  1085. -       "Page Setup..."
  1086. -};
  1087. -
  1088. -resource rPString (Print_pString, $C018) {
  1089. -       "Print..."
  1090. -};
  1091. -
  1092. -resource rPString (Window1_pString, $C018) {
  1093. -       "Window1"
  1094. -};
  1095. -
  1096. -resource rPString (Window2_pString, $C018) {
  1097. -       "Window2"
  1098. -};
  1099. -
  1100. -resource rPString (Window3_pString, $C018) {
  1101. -       "Window3"
  1102. -};
  1103. -
  1104. -resource rPString (Window4_pString, $C018) {
  1105. -       "Window4"
  1106. -};
  1107. -
  1108. -resource rPString (Window5_pString, $C018) {
  1109. -       "Window5"
  1110. -};
  1111. -
  1112. -resource rPString (Word_Wrap_pString, $C018) {
  1113. -       "Word Wrap On"
  1114. -};
  1115. -
  1116. -resource rPString (Choose_Font_pString, $C018) {
  1117. -       "Choose Font"
  1118. -};
  1119. -
  1120. -resource rPString (Text_Window_Title, $0000) {
  1121. -       " Title "
  1122. -};
  1123. -
  1124. -// --- Menu Bar Definitions
  1125. -
  1126. -resource rMenuBar (Application_Menu_Bar, $C018) {
  1127. -       {
  1128. -       Apple_Menu,
  1129. -       File_Menu,
  1130. -       Edit_Menu,
  1131. -       Window_Menu,
  1132. -       Goodies_Menu
  1133. -       };
  1134. -};
  1135. -
  1136. -// --- Menu Definitions
  1137. -
  1138. -resource rMenu (Apple_Menu, $C018) {
  1139. -       $0001,                  // menuID
  1140. -       $A008,                  // menuFlag
  1141. -       Apple_pString, {        // menuTitleRef
  1142. -               About_Menu_Item
  1143. -       };
  1144. -};
  1145. -
  1146. -resource rMenu (File_Menu, $C018) {
  1147. -       $0002,                  // menuID
  1148. -       $A008,                  // menuFlag
  1149. -       File_pString, {        // menuTitleRef
  1150. -               New_Menu_Item,
  1151. -               Open_Menu_Item,
  1152. -               Close_Menu_Item,
  1153. -               Save_Menu_Item,
  1154. -               SaveAs_Menu_Item,
  1155. -               Page_Setup_Item,
  1156. -               Print_Item,
  1157. -               Quit_Menu_Item
  1158. -       };
  1159. -};
  1160. -
  1161. -resource rMenu (Edit_Menu, $C018) {
  1162. -       $0003,                  // menuID
  1163. -       $A008,                  // menuFlag
  1164. -       Edit_pString, {        // menuTitleRef
  1165. -               Undo_Menu_Item,
  1166. -               Cut_Menu_Item,
  1167. -               Copy_Menu_Item,
  1168. -               Paste_Menu_Item,
  1169. -               Clear_Menu_Item
  1170. -       };
  1171. -};
  1172. -
  1173. -resource rMenu (Window_Menu, $C018) {
  1174. -       $0004,                  // menuID
  1175. -       $A008,                  // menuFlag
  1176. -       Windows_pString, {        // menuTitleRef
  1177. -               Window1_Item,
  1178. -               Window2_Item,
  1179. -               Window3_Item,
  1180. -               Window4_Item,
  1181. -               Window5_Item
  1182. -       };
  1183. -};
  1184. -
  1185. -resource rMenu (Goodies_Menu, $C018) {
  1186. -       $0005,                  // menuID
  1187. -       $A008,                  // menuFlag
  1188. -       Goodies_pString, {        // menuTitleRef
  1189. -               Word_Wrap_Item,
  1190. -               Choose_Font_Item
  1191. -       };
  1192. -};
  1193. -
  1194. -// --- Menu Item Definitions
  1195. -
  1196. -resource rMenuItem (Undo_Menu_Item, $C018) {
  1197. -       $00FA,                  // itemID
  1198. -       "Z","z",                // itemChar, itemAltChar
  1199. -       NIL,                    // itemCheck
  1200. -       $8040,                  // itemFlag
  1201. -       Undo_pString           // itemTitleRef
  1202. -};
  1203. -
  1204. -resource rMenuItem (Cut_Menu_Item, $C018) {
  1205. -       $00FB,                  // itemID
  1206. -       "X","x",                // itemChar, itemAltChar
  1207. -       NIL,                    // itemCheck
  1208. -       $8000,                  // itemFlag
  1209. -       Cut_pString           // itemTitleRef
  1210. -};
  1211. -
  1212. -resource rMenuItem (Copy_Menu_Item, $C018) {
  1213. -       $00FC,                  // itemID
  1214. -       "C","c",                // itemChar, itemAltChar
  1215. -       NIL,                    // itemCheck
  1216. -       $8000,                  // itemFlag
  1217. -       Copy_pString           // itemTitleRef
  1218. -};
  1219. -
  1220. -resource rMenuItem (Paste_Menu_Item, $C018) {
  1221. -       $00FD,                  // itemID
  1222. -       "V","v",                // itemChar, itemAltChar
  1223. -       NIL,                    // itemCheck
  1224. -       $8000,                  // itemFlag
  1225. -       Paste_pString           // itemTitleRef
  1226. -};
  1227. -
  1228. -resource rMenuItem (Clear_Menu_Item, $C018) {
  1229. -       $00FE,                  // itemID
  1230. -       "","",                  // itemChar, itemAltChar
  1231. -       NIL,                    // itemCheck
  1232. -       $8000,                  // itemFlag
  1233. -       Clear_pString           // itemTitleRef
  1234. -};
  1235. -
  1236. -resource rMenuItem (Close_Menu_Item, $C018) {
  1237. -       $00FF,                  // itemID
  1238. -       "W","w",                // itemChar, itemAltChar
  1239. -       NIL,                    // itemCheck
  1240. -       $8080,                  // itemFlag
  1241. -       Close_pString           // itemTitleRef
  1242. -};
  1243. -
  1244. -resource rMenuItem (About_Menu_Item, $0018) {
  1245. -       $0100,                  // itemID
  1246. -       "","",                  // itemChar, itemAltChar
  1247. -       NIL,                    // itemCheck
  1248. -       $8040,                  // itemFlag
  1249. -       About_pString           // itemTitleRef
  1250. -};
  1251. -
  1252. -resource rMenuItem (Quit_Menu_Item, $0018) {
  1253. -       $0101,                  // itemID
  1254. -       "Q","q",                // itemChar, itemAltChar
  1255. -       NIL,                    // itemCheck
  1256. -       $8000,                  // itemFlag
  1257. -       Quit_pString           // itemTitleRef
  1258. -};
  1259. -
  1260. -resource rMenuItem (New_Menu_Item, $C018) {
  1261. -       $0102,                  // itemID
  1262. -       "N","n",                // itemChar, itemAltChar
  1263. -       NIL,                    // itemCheck
  1264. -       $8000,                  // itemFlag
  1265. -       New_pString           // itemTitleRef
  1266. -};
  1267. -
  1268. -resource rMenuItem (Open_Menu_Item, $0018) {
  1269. -       $0103,                  // itemID
  1270. -       "O","o",                // itemChar, itemAltChar
  1271. -       NIL,                    // itemCheck
  1272. -       $8040,                  // itemFlag
  1273. -       Open_pString           // itemTitleRef
  1274. -};
  1275. -
  1276. -resource rMenuItem (Save_Menu_Item, $C018) {
  1277. -       $0104,                  // itemID
  1278. -       "S","s",                // itemChar, itemAltChar
  1279. -       NIL,                    // itemCheck
  1280. -       $8080,                  // itemFlag
  1281. -       Save_pString           // itemTitleRef
  1282. -};
  1283. -
  1284. -resource rMenuItem (SaveAs_Menu_Item, $C018) {
  1285. -       $0105,                  // itemID
  1286. -       "","",                  // itemChar, itemAltChar
  1287. -       NIL,                    // itemCheck
  1288. -       $80C0,                  // itemFlag
  1289. -       SaveAs_pString           // itemTitleRef
  1290. -};
  1291. -
  1292. -resource rMenuItem (Page_Setup_Item, $0018) {
  1293. -       $0107,                  // itemID
  1294. -       "","",                  // itemChar, itemAltChar
  1295. -       NIL,                    // itemCheck
  1296. -       $8080,                  // itemFlag
  1297. -       Page_Setup_pString           // itemTitleRef
  1298. -};
  1299. -
  1300. -resource rMenuItem (Print_Item, $C018) {
  1301. -       $0108,                  // itemID
  1302. -       "P","p",                // itemChar, itemAltChar
  1303. -       NIL,                    // itemCheck
  1304. -       $80C0,                  // itemFlag
  1305. -       Print_pString           // itemTitleRef
  1306. -};
  1307. -
  1308. -resource rMenuItem (Window1_Item, $C018) {
  1309. -       $0109,                  // itemID
  1310. -       "","",                  // itemChar, itemAltChar
  1311. -       NIL,                    // itemCheck
  1312. -       $8080,                  // itemFlag
  1313. -       Window1_pString           // itemTitleRef
  1314. -};
  1315. -
  1316. -resource rMenuItem (Window2_Item, $C018) {
  1317. -       $010A,                  // itemID
  1318. -       "","",                  // itemChar, itemAltChar
  1319. -       NIL,                    // itemCheck
  1320. -       $8080,                  // itemFlag
  1321. -       Window2_pString           // itemTitleRef
  1322. -};
  1323. -
  1324. -resource rMenuItem (Window3_Item, $C018) {
  1325. -       $010B,                  // itemID
  1326. -       "","",                  // itemChar, itemAltChar
  1327. -       NIL,                    // itemCheck
  1328. -       $8080,                  // itemFlag
  1329. -       Window3_pString           // itemTitleRef
  1330. -};
  1331. -
  1332. -resource rMenuItem (Window4_Item, $C018) {
  1333. -       $010C,                  // itemID
  1334. -       "","",                  // itemChar, itemAltChar
  1335. -       NIL,                    // itemCheck
  1336. -       $8080,                  // itemFlag
  1337. -       Window4_pString           // itemTitleRef
  1338. -};
  1339. -
  1340. -resource rMenuItem (Window5_Item, $C018) {
  1341. -       $010D,                  // itemID
  1342. -       "","",                  // itemChar, itemAltChar
  1343. -       NIL,                    // itemCheck
  1344. -       $8080,                  // itemFlag
  1345. -       Window5_pString           // itemTitleRef
  1346. -};
  1347. -
  1348. -resource rMenuItem (Word_Wrap_Item, $C018) {
  1349. -       $010E,                  // itemID
  1350. -       "","",                  // itemChar, itemAltChar
  1351. -       $0012,                  // itemCheck
  1352. -       $8080,                  // itemFlag
  1353. -       Word_Wrap_pString           // itemTitleRef
  1354. -};
  1355. -
  1356. -resource rMenuItem (Choose_Font_Item, $C018) {
  1357. -       $010F,                  // itemID
  1358. -       "F","f",                // itemChar, itemAltChar
  1359. -       NIL,                    // itemCheck
  1360. -       $8080,                  // itemFlag
  1361. -       Choose_Font_pString           // itemTitleRef
  1362. -};
  1363. -
  1364. -// --- Window Templates
  1365. -
  1366. -resource rWindParam1 (Text_Window, $0000) {
  1367. -       $C1A0,                  // plFrame (frame bits)
  1368. -       Text_Window_Title,          // plTitle (title ID)
  1369. -       $00000000,              // plRefCon
  1370. -       {  0,  0,  0,  0},      // plZoomRect
  1371. -       Text_Window_wColor,        // plColorTable
  1372. -       {$0000, $0000},         // plYOrigin, plXOrigin
  1373. -       {$0000, $0000},         // plDataHeight, plDataWidth
  1374. -       {$0000, $0000},         // plMaxHeight, plMaxWidth
  1375. -       {$0000, $0000},         // plVerScroll, plHorScroll
  1376. -       {$0000, $0000},         // plVerPage, plHorPage
  1377. -       $00000000,              // plInfoText (info RefCon)
  1378. -       $0000,                  // plInfoHeight
  1379. -       { 27, 24,197,614},      // plPosition
  1380. -       infront,                // plPlane
  1381. -       Text_Edit_Control,        // plControlList
  1382. -       $0A02                   // plInDesc
  1383. -};
  1384. -
  1385. -// --- Window Color Templates
  1386. -
  1387. -resource rWindColor (Text_Window_wColor, $0000) {
  1388. -       $0000,                  // frameColor
  1389. -       $0F00,                  // titleColor
  1390. -       $0207,                  // tBarColor
  1391. -       $F0FF,                  // growColor
  1392. -       $F0F0                   // infoColor
  1393. -};
  1394. -
  1395. -// --- Tool Startup Table Templates
  1396. -
  1397. -resource rToolStartup (Tool_Startup_Table, $0000) {
  1398. -       $C080, {                // videoMode
  1399. -                3, $0300,      // Miscellaneous Tools 
  1400. -                4, $0301,      // QuickDraw II 
  1401. -                5, $0302,      // Desk Manager 
  1402. -                6, $0300,      // Event Manager 
  1403. -               11, $0200,      // Integer Math 
  1404. -               14, $0301,      // Window Manager 
  1405. -               15, $0301,      // Menu Manager 
  1406. -               16, $0301,      // Control Manager 
  1407. -               18, $0301,      // QuickDraw II Aux. 
  1408. -               19, $0300,      // Print Manager 
  1409. -               20, $0301,      // LineEdit Tools 
  1410. -               21, $0301,      // Dialog Manager 
  1411. -               22, $0300,      // Scrap Manager 
  1412. -               23, $0301,      // Standard File Tools 
  1413. -               27, $0301,      // Font Manager 
  1414. -               28, $0301,      // List Manager 
  1415. -               30, $0100,      // Resource Manager 
  1416. -               34, $0101       // TextEdit Manager 
  1417. -       }
  1418. -};
  1419. -
  1420. -// --- rAlertString Templates
  1421. -
  1422. -resource rAlertString (Printing_Alert, $0000) {
  1423. -       "53~A Printing Error Has Occurred!~^#6"
  1424. -       "\$00"
  1425. -};
  1426. -
  1427. -resource rAlertString (Tool_Error_Alert, $0000) {
  1428. -       "54~Tool Error *0 Has Occurred at *1!~^#6"
  1429. -       "\$00"
  1430. -};
  1431. -
  1432. -resource rAlertString (Save_Alert, $0000) {
  1433. -       "23~"
  1434. -       "\$0D"
  1435. -       " Save Changes?~#1~#3~^#2"
  1436. -       "\$00"
  1437. -};
  1438. -
  1439. -// --- rText Templates
  1440. -
  1441. -resource rText (Window_Text, $0000) {
  1442. -       " "
  1443. -};
  1444. -
  1445. + END OF ARCHIVE
  1446.