/
MorphWind.c
1103 lines (908 loc) · 21.1 KB
/
MorphWind.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#define LOGFILE 0
#define PROFILE 0
#define FILTERS 1
/*
DumbEdit - Multiple-window TransEdit Demonstration.
The project should include DumbEdit.c (this file), TransEdit.c,
FakeAlert.c, TransSkel.c (or a project made from TransSkel.c)
and MacTraps.
28 October 1986 Paul DuBois
*/
#include <stdio.h>
#include <strings.h>
#include <dialect.h>
#include <prntflags.h>
# include <MenuMgr.h>
# include <FontMgr.h>
# include <SegmentLdr.h>
# include "TransEdit.h"
# define locmaxSize 8 /* no. font sizes made available */
/*# define hSize 300 /* horiz, vert size of new windows */
/* horizontal size increased so that the default window will show
* 80 column lines easily -- grc 6/27/87 */
# define hSize 400 /* horiz, vert size of new windows */
# define vSize 205
# define aboutAlrt 1000
static int is_dumpform = 0;
extern int Use_hqdict;
typedef enum /* File menu item numbers */
{
new = 1, /* begin new window */
open, /* open existing file */
close, /* close file */
/* --- */
save = 5, /* save file */
saveAs, /* save under another name */
saveCopy, /* save a copy w/o switching file binding */
revert, /* revert to version on disk */
/* --- */
quit = 10,
dumpform
};
typedef enum /* Edit menu item numbers */
{
undo = 1,
/* --- */
cut = 3,
copy,
paste,
clear
};
typedef enum /* Format menu item numbers */
{
wordWrap = 1,
noWrap,
/* --- */
leftJust = 4,
centerJust,
rightJust
};
typedef enum /* Dictionary menu item numbers */
{
AnalSelection = 1,
AnalDocument,
AnalClipboard,
/* --- */
AnyDialect = 5,
Attic,
Ionic,
Doric,
Epic,
Aeolic,
Prose,
Paradigm,
/* --- */
QuickSearch = 14
/* CheckPreverb grc 6/7/88 */
};
typedef enum /* various filter options */
{
Beta2Smarta = 1,
Beta2SMK
};
int quickflag = 0;
PrntFlags prntflags/* = CHECK_PREVERB grc 6/7/88 */;
Dialect GetWindowDialect(), GetWantDialect();
typedef struct {
WindowPtr aWindowPtr;
Dialect WindowDialect;
} DialectMap;
#define MAXGKWINDOWS 16
#include "MorphWind.proto.h"
DialectMap dial_map[MAXGKWINDOWS];
WindowPtr lastFront = nil; /* keeps track of front window */
WindowPtr ErrWindow = nil;
WindowPtr DictWindow;
char ErrMess[256];
MenuHandle fileMenu;
MenuHandle editMenu;
MenuHandle fontMenu;
MenuHandle sizeMenu;
MenuHandle formatMenu;
/* beginning of mods */
MenuHandle dictMenu;
MenuHandle filtMenu;
int smarta_font;
/* end of mods */
int sizes[locmaxSize] = { 9, 10, 12, 14, 18, 20, 24, 48 };
/*
Uncheck all the items in a menu
*/
UncheckMenu (MenuHandle theMenu)
{
register int i, nItems;
nItems = CountMItems (theMenu);
for (i = 1; i <= nItems; ++i)
{
CheckItem (theMenu, i, false);
SetItemStyle (theMenu, i, 0);
}
}
/*
Set the Font, Size and Format menus so that the items corresponding
to the text characteristics of the window are checked. If the
window isn't an edit window, dim all three menus.
*/
SetTextMenus (Boolean drawBar)
{
WindowPtr theWind;
Str255 wFontName;
Str255 mFontName;
register int i, nItems;
register TEHandle te;
theWind = FrontWindow ();
UncheckMenu (fontMenu); /* toss current check marks */
UncheckMenu (sizeMenu);
UncheckMenu (formatMenu);
UncheckMenu (dictMenu);
UncheckMenu (filtMenu);
if (!IsEWindow (theWind)) /* disable the menus */
{
DisableItem (fontMenu, 0);
DisableItem (sizeMenu, 0);
DisableItem (formatMenu, 0);
DisableItem (dictMenu, 0);
DisableItem (filtMenu, 0);
}
else
{
EnableItem (fontMenu, 0);
EnableItem (sizeMenu, 0);
EnableItem (formatMenu, 0);
EnableItem (dictMenu, 0);
EnableItem (filtMenu, 0);
te = GetEWindowTE (theWind);
/*
Check appropriate word wrap item
*/
CheckItem (formatMenu, (**te).crOnly < 0 ? noWrap : wordWrap, true);
/*
Check appropriate justification item
*/
switch ((**te).just)
{
case teJustLeft:
CheckItem (formatMenu, leftJust, true);
break;
case teJustRight:
CheckItem (formatMenu, rightJust, true);
break;
case teJustCenter:
CheckItem (formatMenu, centerJust, true);
break;
}
/*
Check appropriate font size item, and outline items for sizes
present in resource files
*/
for (i = 0; i < locmaxSize; ++i)
{
if ((**te).txSize == sizes[i])
CheckItem (sizeMenu, i + 1, true);
if (RealFont ((**te).txFont, sizes[i]))
SetItemStyle (sizeMenu, i + 1, outline);
else
SetItemStyle (sizeMenu, i + 1, 0); /* plain */
}
/*
Check appropriate font name item
*/
GetFontName ((**te).txFont, wFontName); /* name of window font */
nItems = CountMItems (fontMenu); /* # fonts in menu */
for (i = 1; i <= nItems; ++i)
{
GetItem (fontMenu, i, mFontName); /* get font name */
if (EqualString (wFontName, mFontName, false, true))
{
CheckItem (fontMenu, i, true);
break;
}
}
}
if (drawBar)
DrawMenuBar ();
}
/*
Set File/Edit menu items according to type of front window.
The general behavior is:
New and Open always enabled, since a new edit window can always be
opened.
Close enabled when an edit or DA window in front (i.e., when there's
a window at all).
Save enabled for edit windows not bound to a file, and edit windows
bound to a file when they're dirty (typed into, Edit menu used to
do something to them).
Save As and Save a Copy As enabled for edit windows.
Revert enabled for edit windows bound to a file when they're dirty.
Undo disabled when there's an edit window in front.
*/
SetNonTextMenus (void)
{
WindowPtr theWind;
int theKind;
DisableItem (fileMenu, close); /* assume no window at all */
DisableItem (fileMenu, save);
DisableItem (fileMenu, saveAs);
DisableItem (fileMenu, saveCopy);
DisableItem (fileMenu, revert);
EnableItem (editMenu, undo);
theKind = 0;
if ((theWind = FrontWindow ()) != nil)
theKind = ((WindowPeek) theWind)->windowKind;
if (theKind < 0) /* DA in front */
{
EnableItem (fileMenu, close);
}
else if (IsEWindow (theWind)) /* edit window in front */
{
EnableItem (fileMenu, close);
EnableItem (fileMenu, saveAs);
EnableItem (fileMenu, saveCopy);
if (GetEWindowFile (theWind, nil) == false) /* not bound to file */
{
EnableItem (fileMenu, save);
}
else if (IsEWindowDirty (theWind)) /* bound - is it dirty? */
{
EnableItem (fileMenu, save);
EnableItem (fileMenu, revert);
}
DisableItem (editMenu, undo);
}
}
/*
Got an activate or deactivate. It doesn't matter which, really.
Set the text menus appropriately for the front window, and draw
the menu bar, as these menus might change state from enabled to
disabled or vice-versa.
*/
Activate (Boolean active)
{
CheckFront ();
}
/*
Got a keyclick in an edit window.
*/
Key (void)
{
SetNonTextMenus ();
}
/*
Close selected from File menu, or close box of edit window
clicked.
*/
Close (void)
{
WindowPtr theWind;
GetPort (&theWind);
if( theWind == DictWindow ) {
(void) EWindowClose (theWind);
DictWindow = NULL;
}
else
(void) EWindowClose (theWind);
CheckFront ();
}
MakeWind (Boolean bindToFile, StringPtr title, AppFile *theFile)
{
Rect r;
static int windCount = 0;
int offset;
WindowPtr theWind;
char theFontName[256];
int font;
Ptr CtoPstr();
if (FrontWindow () == nil)
windCount = 0;
SetRect (&r, 0, 0, hSize, vSize);
offset = 50 + 25 * (windCount++ % 4);
OffsetRect (&r, offset, offset);
Xstrncpy(theFontName,"Sparta" ,sizeof theFontName);
(char *) CtoPstr(theFontName);
GetFNum (theFontName, &font);
SetEWindowStyle (nil, font, 10, 0, teJustLeft);
(void) NewEWindow (&r, title, true, -1L, true, 0L, bindToFile , theFile);
SetWindowDialect(FrontWindow(),(Dialect)(ATTIC|PROSE));
}
MakeDWindow (Boolean bindToFile)
{
Rect r;
static int windCount = 0;
int offset;
if (FrontWindow () == nil)
windCount = 0;
SetRect (&r, 0, 0, hSize, vSize);
offset = 50 + 25 * (windCount++ % 4);
OffsetRect (&r, offset, offset);
/* ErrWindow = */ NewDWindow (&r, nil, true, -1L, true, 0L);
}
/*
File menu handler
*/
DoFileMenu (int item)
{
WindowPtr theWind;
theWind = FrontWindow ();
switch (item)
{
case new:
MakeWind (false,nil,nil);
break;
case open:
MakeWind (true,nil,nil);
break;
case close:
if (IsEWindow (theWind))
Close();
/*(void) EWindowClose (theWind);*/
else
CloseDeskAcc (((WindowPeek) theWind)->windowKind); /* DA in front */
break;
case save:
(void) EWindowSave (theWind);
break;
case saveAs:
(void) EWindowSaveAs (theWind);
break;
case saveCopy:
(void) EWindowSaveCopy (theWind);
break;
case revert:
(void) EWindowRevert (theWind);
break;
case quit:
if (ClobberEWindows () == true)
SkelWhoa ();
break;
case dumpform:
if( is_dumpform == 0 ) {
CheckItem(dictMenu,dumpform,is_dumpform ? true : false );
is_dumpform = 1;
} else {
is_dumpform = 0;
}
break;
}
SetNonTextMenus ();
}
/*
Handle Font menu items
*/
DoFontMenu (int item)
{
int font;
TEHandle te;
WindowPtr theWind;
Str255 theFontName;
theWind = FrontWindow ();
if ((te = GetEWindowTE (theWind)) == nil)
return; /* not an edit window */
GetItem (fontMenu, item, theFontName);
GetFNum (theFontName, &font);
SetEWindowStyle (theWind, font, (**te).txSize, (**te).crOnly, (**te).just);
SetTextMenus (false);
}
/*
Handle Size menu items
*/
DoSizeMenu (int item)
{
TEHandle te;
WindowPtr theWind;
theWind = FrontWindow ();
if ((te = GetEWindowTE (theWind)) == nil)
return; /* not an edit window */
SetEWindowStyle (theWind, (**te).txFont, sizes[item-1], (**te).crOnly, (**te).just);
SetTextMenus (false);
}
/*
Handle Format menu items
*/
DoFormatMenu (int item)
{
int font, size, just, wrap;
TEHandle te;
WindowPtr theWind;
theWind = FrontWindow ();
if ((te = GetEWindowTE (theWind)) == nil)
return; /* not an edit window */
font = (**te).txFont;
size = (**te).txSize;
just = (**te).just;
wrap = (**te).crOnly;
switch (item)
{
case wordWrap:
wrap = 0;
break;
case noWrap:
wrap = -1;
break;
case leftJust:
just = teJustLeft;
break;
case centerJust:
just = teJustCenter;
break;
case rightJust:
just = teJustRight;
break;
}
SetEWindowStyle (theWind, font, size, wrap, just);
SetTextMenus (false);
}
#if LOGFILE
FILE * flog = NULL;
#endif
DoFiltMenu (int item)
{
TEHandle te;
WindowPtr theWind;
char * locbuf = NULL;
char * smkbuf = NULL;
char *malloc();
int len;
theWind = FrontWindow ();
if ((te = GetEWindowTE (theWind)) == nil)
return; /* not an edit window */
switch(item) {
case Beta2Smarta:
len = (**te).teLength;
locbuf = malloc(len+1);
smkbuf = malloc(len+1);
strncpy(locbuf,*(TEGetText(te)),len);
locbuf[len] = 0;
GetDictWindow();
te = GetEWindowTE (DictWindow);
beta2smarta(locbuf,smkbuf);
TEInsert(smkbuf,(long)strlen(smkbuf),te);
xFree(locbuf,"locbuf");
xFree(smkbuf,"smkbuf");
locbuf = smkbuf = NULL;
return;
case Beta2SMK:
len = (**te).teLength;
locbuf = malloc(len+1);
smkbuf = malloc(len+1);
strncpy(locbuf,*(TEGetText(te)),len);
locbuf[len] = 0;
GetDictWindow();
te = GetEWindowTE (DictWindow);
beta2smk(locbuf,smkbuf);
TEInsert(smkbuf,(long)strlen(smkbuf),te);
xFree(locbuf,"locbuf");
xFree(smkbuf,"smkbuf");
locbuf = smkbuf = NULL;
return;
default:
return;
}
}
DoDictMenu (int item)
{
int font, size, just, wrap;
TEHandle te;
WindowPtr theWind;
char * locbuf = NULL;
char * smkbuf = NULL;
char * malloc();
char * NextGkWord();
char betastring[128];
char * bp = NULL;
char * anal_buf();
long off = 0;
int sa, sb;
int len;
int nwords = 0;
int nhits = 0;
char tmp[128];
Ptr CtoPstr();
char * strncpy();
char * curp;
Handle hdest;
theWind = FrontWindow ();
if ((te = GetEWindowTE (theWind)) == nil)
return; /* not an edit window */
switch (item)
{
case AnalSelection:
sa = (**te).selStart;
sb = (**te).selEnd;
len = sb - sa;
locbuf = malloc(len+1);
GetSelection(locbuf,te,len);
locbuf[len] = 0;
break;
case AnalDocument:
len = (**te).teLength;
locbuf = malloc(len+1);
strncpy(locbuf,*(TEGetText(te)),len);
locbuf[len] = 0;
break;
case AnalClipboard:
hdest = NewHandle(0);
len = (int) GetScrap(hdest,'TEXT',&off);
locbuf = malloc(len+1);
strncpy(locbuf,*hdest,len);
locbuf[len] = 0;
break;
case AnyDialect:
case Attic:
case Ionic:
case Doric:
case Epic:
case Aeolic:
case Prose:
case Paradigm:
SetNewDialect(item);
return;
case QuickSearch:
toggle_quickflag();
return;
/* grc 6/6/88
case CheckPreverb:
toggle_checkpreverb();
return;
*/
default:
return;
}
GetDictWindow();
te = GetEWindowTE (DictWindow);
/* (**te).txFont = monaco;*/
if( smarta_font == 0 ){
char theFontName[256];
Xstrncpy(theFontName,"Smarta" ,sizeof theFontName);
CtoPstr(theFontName);
GetFNum (theFontName, &smarta_font);
}
(**te).txFont = smarta_font;
(**te).txSize = 10;
curp = locbuf;
#if LOGFILE
fprintf(flog,"len %d strlen %d s [%s]\n", len, strlen(locbuf), locbuf);
fflush(flog);
#endif
while(curp=NextGkWord(curp,betastring)) {
if( want_to_quit() )
break;
#if LOGFILE
fprintf(flog,"b [%s]\n", betastring );
fflush(flog);
#endif
if( (**te).teLength > 30000 ) {
sprintf(tmp,"Hey! This window almost full. Save contents and start a new one!\r");
TEInsert(tmp,(long)strlen(tmp),te);
}
if( checkstring(betastring,prntflags) ) {
#if LOGFILE
fprintf(flog,"a hit!\n");
fflush(flog);
#endif
bp = anal_buf();
if( is_dumpform ) {
printf("%d %d %s %2.2f\n", ++nwords, ++nhits, betastring ,
(float)nhits/(float)nwords);
printdump(bp);
} else {
#if LOGFILE
fprintf(flog,"%s", bp);
fflush(flog);
#endif
TEInsert(bp,(long)strlen(bp),te);
}
} else {
char failmess[80];
char tmpfail[80];
if( is_dumpform ) {
printf("%d %d %s X %2.2f\n", ++nwords, nhits, betastring ,
(float)nhits/(float)nwords);
sprintf(failmess,"&Could not understand $[%s]& \r\r", betastring);
beta2smarta(failmess,tmpfail);
printdump(tmpfail);
} else {
sprintf(failmess,"&Could not understand $[%s]& \r\r", betastring);
beta2smarta(failmess,tmpfail);
TEInsert(tmpfail,(long)strlen(tmpfail),te);
}
}
EWindowOverhaul(DictWindow,true,true,true);
}
xFree(locbuf,"locbuf");
locbuf = NULL;
}
#if LOGFILE
LOGFILE(char *s)
{
if( flog ) {
fprintf(flog,"%s", s);
fflush(flog);
}
}
#endif
EnableDialects(void)
{
EnableItem(dictMenu,AnyDialect);
EnableItem(dictMenu,Attic);
EnableItem(dictMenu,Ionic);
EnableItem(dictMenu,Doric);
EnableItem(dictMenu,Epic);
EnableItem(dictMenu,Aeolic);
EnableItem(dictMenu,Prose);
EnableItem(dictMenu,Paradigm);
}
DisableDialects(void)
{
DisableItem(dictMenu,AnyDialect);
DisableItem(dictMenu,Attic);
DisableItem(dictMenu,Ionic);
DisableItem(dictMenu,Doric);
DisableItem(dictMenu,Epic);
DisableItem(dictMenu,Aeolic);
DisableItem(dictMenu,Prose);
DisableItem(dictMenu,Paradigm);
}
toggle_quickflag(void)
{
if( quickflag ) quickflag = 0;
else quickflag = 1;
CheckQuickFlag();
}
CheckQuickFlag(void)
{
CheckItem(dictMenu,QuickSearch,quickflag ? true : false );
}
/*
toggle_checkpreverb()
{
if( prntflags & CHECK_PREVERB ) prntflags &= (~CHECK_PREVERB);
else prntflags |= CHECK_PREVERB;
CheckCheckPreverb();
}
*/
/* grc 6/6/88
CheckCheckPreverb()
{
CheckItem(dictMenu,CheckPreverb,(prntflags & CHECK_PREVERB) ? true : false );
}
*/
ZapWindowDialect(WindowPtr curWind)
{
int i;
for(i=0;i<MAXGKWINDOWS;i++) {
if( dial_map[i].aWindowPtr == curWind ) {
dial_map[i].aWindowPtr = NULL;
dial_map[i].WindowDialect = 0;
return;
}
}
}
Dialect
GetWindowDialect(WindowPtr curWind)
{
int i;
for(i=0;i<MAXGKWINDOWS;i++) {
if( dial_map[i].aWindowPtr == curWind ) {
return( dial_map[i].WindowDialect);
}
}
return((Dialect)0);
}
SetWindowDialect(WindowPtr curWind, Dialect dial)
{
int i;
for(i=0;i<MAXGKWINDOWS;i++) {
if( dial_map[i].aWindowPtr == curWind ) {
dial_map[i].WindowDialect = dial;
/*printf("a) i %d dial %lo\n", i , dial );*/
return;
}
if( dial_map[i].aWindowPtr == NULL ) {
dial_map[i].aWindowPtr = curWind;
dial_map[i].WindowDialect = dial;
/*printf("b) i %d dial %lo\n", i , dial );*/
return;
}
}
/*printf("failing on SetWindowDialect\n");*/
}
SetDialectMenu(WindowPtr curWind)
{
updateDialect((Dialect)0);
updateDialect(GetWindowDialect(curWind));
CheckDialects(GetWantDialect());
}
SetNewDialect(int item)
{
switch(item) {
case AnyDialect:
updateDialect((Dialect)0);
break;
case Attic:
updateDialect((Dialect)ATTIC);
break;
case Ionic:
updateDialect((Dialect)IONIC);
break;
case Epic:
updateDialect((Dialect)EPIC);
break;
case Aeolic:
updateDialect((Dialect)AEOLIC);
break;
case Doric:
updateDialect((Dialect)DORIC);
break;
case Prose:
updateDialect((Dialect)PROSE);
break;
case Paradigm:
updateDialect((Dialect)PARADIGM);
break;
default:
break;
}
SetWindowDialect(FrontWindow(),GetWantDialect());
CheckDialects(GetWantDialect());
}
CheckDialects(Dialect dial)
{
/*
printf("dial [%lo]\n", dial );
*/
/* if( dial == 0 )
CheckItem(dictMenu,AnyDialect, true );
else
CheckItem(dictMenu,AnyDialect, false );
*/
CheckItem(dictMenu,AnyDialect, (dial == 0) ? true : false );
CheckItem(dictMenu,Attic, (dial & ATTIC) ? true : false );
CheckItem(dictMenu,Ionic, (dial & IONIC) ? true : false );
CheckItem(dictMenu,Doric, (dial & DORIC) ? true : false );
CheckItem(dictMenu,Prose, (dial & PROSE) ? true : false );
CheckItem(dictMenu,Epic, (dial & EPIC) ? true : false );
CheckItem(dictMenu,Aeolic, (dial & AEOLIC) ? true : false );
CheckItem(dictMenu,Paradigm, (dial & PARADIGM) ? true : false );
}
GetDictWindow(void)
{
if( ! DictWindow ) {
MakeWind (false,"\pResult Window",nil);
DictWindow = FrontWindow();
#if LOGFILE
flog = fopen("logfile", "w");
#endif
} else {
(void) SelectWindow(DictWindow);
ShowWindow (DictWindow);
EWindowOverhaul (DictWindow, false, false, IsEWindowDirty (DictWindow));
SetPort (DictWindow);
ValidRect (&DictWindow->portRect);
}
}
/*
Handle selection of AboutÉ item from Apple menu
*/
DoAbout (void)
{
/*
(void) Alert (aboutAlrt, nil);
*/
ErrMesg("\pMorpheus was written by Gregory Crane, Joshua Kosman, and Neel Smith");
}
/*
Background procedure. Check front window, reset menus if it
changes. The menu bar doesn't need redrawing by SetTextMenus
if the previous and current front window are either both edit
windows or both not edit windows. This check eliminates some
needless menu flashing.
*/
CheckFront (void)
{
if (FrontWindow () != lastFront )
{
SetNonTextMenus ();
if (IsEWindow (FrontWindow ()) == IsEWindow (lastFront))
SetTextMenus (false);
else {
SetTextMenus (true);
}
if( FrontWindow() != DictWindow ) {
EnableDialects();
SetDialectMenu(FrontWindow());
/* grc 6/6/88
CheckCheckPreverb();
*/
CheckQuickFlag();
} else
DisableDialects();
lastFront = FrontWindow ();
}
}
#if PROFILE
extern _profile;
#endif