-
Notifications
You must be signed in to change notification settings - Fork 0
/
menumgr.asm
12771 lines (10452 loc) · 264 KB
/
menumgr.asm
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
***********************************************************************************
*
* Copyright Apple Computer, Inc. 1986-92
* All Rights Reserved
* Written by Dan Oliver
*
* *** C O N F I D E N T I A L ***
*
*
* Change History:
*
* 21 June 1988 Harry Yee
* Converted version 2.1 of the menu manager that went on
* System Disk 3.2 to MAX.
*
*
* 27 June 1988 Steven Glass
*
* Changed all accesses to popXbytes. All but two loaded y-reg with zero before
* branching so we changed these to access the new pop routines that assumed
* no error. (these are now called popXbytes.)
*
* The error accesses still branch to the routines that assume y-reg has error
* code. These have been renamed EpopXbytes.
*
* 30 June 1988 Steven Glass
*
* When calling the creamed routine we did a jsr to Long_Call instead of a JSL.
*
* 10 Aug 88 Dan Oliver
*
* Free allocated data area on shutdown.
*
* 02 Oct 88 Steven Glass
*
* Changed the data structure for Menu Items. They now have two bytes for
* the item flag.
*
* Added the outline and shadow bits to the item flag
*
* Funnelled all calls to set text face to a common routine. This saved code
* and lets me futz the text face bits.
*
* Changed parse routines so that they set check mark and flag separately instead
* of both at once.
*
*
* 14 Oct 88 Steven Glass
*
* Shutdown checks to see if it's active first before doing anything.
*
* 17 Oct 88 Harry Yee
*
* Put in code for scrollable menus. Modified Size_menu, took out code that checked to see
* if menuheight was greater than 1988. (Does that mean 198?? --DAL Jan-91)
*
* 18 Oct 88 Harry Yee (released in Proto 03 ROM)
* Initialized FirstItem field for custom menus to be 1. In DeleteMItem needed to decrement
* NumOfItems each time an item gets deleted.
*
* 19 Oct 88 Harry Yee
* Now using PortRect instead of BoundsRect to check if menu needs to be adjusted or not.
*
* 20 Oct 88 Harry Yee
* Not using the fields FirstItem and NumOfItems in the menu record anymore. Making space
* on direct page to hold these values. FirstItem and NumOfItems were 1 byte values,
* since I don't need FirstItem anymore, I am making NumOfItems 1 word long. NumOfItems
* will hold the total number of items in the menu. Fixed some problems dealing with
* custom menus. Made sure that a menu is not going to be scrollable if there are less
* than 3 items.
*
* 25 Oct 88 Harry Yee
* Put in code for PopupMenuSelect and tracking the pop-up menu (TrackMenu2).
* Made change to the routine pull_down during the savescreen process. The first line of
* the menu was not being cached, this was ok for regular menus, since the menu bar was
* there, but for pop-ups this was a problem, so the first line of the menu is cached for
* all regular and pop-up menus.
*
* 28 Oct 88 (morning) Harry Yee
* Changed the makefile to include the popupproc.asm code. Added a new call DrawPopup $3D0F
* this is called by the popupproc do_draw and do_track to draw the pop-up box and drop
* shadow. A flag is also passed to this call which tells me whether to draw the name of the
* currently selected item in the pop-up box or not.
*
* 28 Oct 88 (afternoon) Harry Yee
* In routine DrawPopup set clip region to the pop-box (which is inset just a bit to account
* for the border) before drawing the item string.
*
* 31 Oct 88 Harry Yee
* Fixed problem when the pop-up rect is at bottom of the window.
*
* 02 Nov 88 Harry Yee
* Fixed more problems when the pop-up rect gets close to the bottom of the screen and the
* user trys to bring up the pop-up menu.
*
* 08 Nov 88 Harry Yee
*
* In the Oct 25 change that enabled caching of the first line of the menu this caused some
* problems in routine AllocateCache. Routine was allocating one line too less since it was
* allocating memory on the old assumption that the first line was not cached. I now increment
* the height by one so that everyone is happy (BRC #38017).
*
* 10 Nov 88 Harry Yee
*
* We now define the first two bits of the item flag. 00 = ptr, 01 = handle, 10 = resource ID.
* The first two bits of the menures byte is now also defined: 00 = ptr, 01 = handle, 10 = res ID
*
* Initial coding of NewMenu2 call ($3E0F). Don't know if it works though.
* Defined the format of menu, item and menubar resources.
*
* 11 Nov 88 Harry Yee
*
* NewMenu2 now works!! Hurrah! Now start on adding calls InsertMItem2, SetMenuTitle2,
* SetMItem2, and SetMItemName2.
*
* 15 Nov 88 Harry Yee
*
* Pop-up menus can now be resources. Hurrah! All the calls InsertMItem2, SetMenuTitle2,
* SetMItem2, and SetMItemName2 are now complete. Still need NewMenuBar2 call.
*
* 18 Nov 88 Harry Yee
*
* NewMenuBar2 has now been implemented.
*
* 23 Nov 88 Harry Yee
*
* The routines DrawPopup and PopUpMenuSelect were not unlocking the handle to the menu record
* upon exit. I now unlocke before exiting.
* DrawPopUp has been modified so that it now right justifies the result if the
* FRightJustifyResult bit was set in whatToDoFlag.
*
* I now use PPToPort to draw the up/down arrows instead of DrawIcon, so I now no longer depend
* on QDAux to be started. (BRC #37822)
*
* 29 Nov 88 Harry Yee
*
* Change PopUpMenuSelect so that the initial value passed is the item's ID instead of an offset
* into the item list (BRC #38519)
*
* In PopUpMenuSelect, if an invalid item ID is passed for the initial then an error is now
* returned (BRC #38521, #38520)
*
* Fixed problem in routine adjustTop. (WorkSheet #BCORMR518)
*
* 01 Dec 88 Harry Yee
*
* Empty menus are now valid. (BRC #38523) The routine parse was changed to check if the first
* character in the first item is a title character, if it is then I assume the menu is empty.
* (since this char. is not a valid item character and it equals the title char. then this
* signifies a termination char.) InsertMItem was also modified to support empty menus. It always
* checked to make sure that an item could be found for the insertAfter id passed to it. Since
* the menu was empty none could be found and we exited. I now check if the menu is empty first.
*
* 02 Dec 88 Harry Yee
*
* Change the way I handle a bad initial value passed to the pop-up. If the item ID is invalid then
* the item that appears under the pop-up defaults to the first item in the menu. (BRC #38521,
* #38520)
*
* PopUpMenuSelect has been modified to work for empty pop-up menus.
*
* 05 Dec 88 Harry Yee
*
* Change GetMItem back to the way it was before (just return what is in ItemName). I used to check
* the itemFlag, and if it was a resource I would load the resource, deref the handle and
* return the ptr to the string. If it's a resource I now just return the ID and let the
* app worry about what to do with it.
*
* DeleteMItem wasn't working right for empty menus. Fixed in routine Getiptr3.
*
* 08 Dec 88 Harry Yee
*
* Putting in variable speed scroller. First 5 pixels of each up/down arrow will scroll at about
* .3 seconds per item.
*
* Fixed BRC #37987. FixMenuBar now computes the width of the apple logo correctly if it gets
* zeroed by calling SetMTitleWidth.
*
* Changed the default menu bar template so that the first menu in the menubar is indented
* by 10 pixels. This is so the AppleShare "busy" arrows have somewhere to go.
*
* 09 Dec 88 Harry Yee
*
* SetMItemStyle doesn't handle shadow and outline styles correctly. Fixed (BRC #39324)
*
* Fixed problem with drawing up/down arrows in 320 mode. Was using the 640
* boundsrect and locinfo instead of the 320 one. This has been fixed.
*
* 12 Dec 88 Harry Yee
*
* Fix GetItem to return ITEM_NOT_FOUND error if item not found. (for Andy Stadler)
* Changed the pen mode to notBIC when calling PPToPort to draw up/down arrows, so these
* arrows show up correctly when the menu is in color.
*
* 15 Dec 88 Harry Yee
*
* Put in code for user to create a second type of pop-up (with white space). PopUpMenuSelect
* had to be changed. Another input param has been added, a flag parameter.
*
* Popups now handle command key equivalents (all handled in popupproc.asm).
*
* Drop shadow for menus (popups and regular menus) were not being drawn in the color that
* the app had specified as the outline color if the _SpecialRect call completed. This was
* because the setoutline routine was called only when SpecialRect failed.
*
* 22 Dec 88
*
* Fixed some problems with creating type 2 pop-ups. When 1st item was selected and pop-up
* was down near bottom of screen we had problems.
*
* Defined another bit in the menu flag. Bit 8 is defined as the ALWAYSCALLMCHOOSE flag.
* Change put in for Andy Stadler for doing tear off menus. When set the custom menu def proc
* mChoose gets called even when the mouse is not in the menu rectangle. (It sends off the
* last draw message,if there is one, before calling mChoose).
*
* 03 Jan 89 Dan O.
*
* Choose_item did a tdc ora #rect instead of tdc clc adc #rect. This worked as long as the
* direct page had bits 2-3 clear.
*
* 04 Jan 89 Harry Yee
*
* NewMenuBar now checks what mode we're in before setting the default starting position of the
* first menu title. Titles start at 10 pixels in for 640 mode and 5 pixels in, for 320 mode.
*
* Fixed bug in the type 2 pop-up. The pop-up was not being calculated correctly when the top had
* to be adjusted but not the bottom and the window the pop-up was in was off the screen.
*
* 09 Jan 89 Harry Yee
*
* Keyboard equivalents and check marks will appear in plain text regardless of the style
* of the menu item. BRC #39042, #39444.
*
* 18 Jan 89 Harry Yee
*
* Added two new calls HideMenuBar and ShowMenuBar. Both calls work only on the system menu bar.
* HideMenuBar hides the menu bar by subtracting the menu bar's rect from the desktop, ShowMenuBar
* does the exact opposite, the rect is added to the desktop. This fixes the bug where you
* change the font to a larger one then back to a smaller one.
*
* Changed routine Cache. If a regular pop-up menu extended beyond the top of the screen this
* routine doesn't expect any values to be negative. Therefore if <menurect+y1 is negative
* we use zero instead.
*
* When a large font was used for drawing menus and the menu had command-key equivalents, the width
* of the menu was not being calculated correctly. This was because in size_menu the values added
* to the menu width for an item having a command-key equiv. and a check mark was hard coded. This
* has been changed. The direct page variable Menu_type was never being used previously, I now use
* it to store the width of the widest item in the current font strike. It has been renamed to
* text_width. This value is calculated in MenuNewRes where GetFontInfo is being called.
* BRC #37985.
*
* 20 Jan 89 Harry Yee
*
* Menus in an info bar now work correctly. Changed the way I calculate if a menu needs to scroll
* or not. Before I was just using the PortRect to determine if the menu needed to be resized, now
* I use the intersection between the VisRgn, ClipRgn, and PortRect. BRC #40477.
*
* 27 Jan 89 Harry Yee
*
* Change the way empty menus work. To create an empty menu you now have to terminate the menu with
* either $00 (null character) or $0D (return). The original scheme was to terminate the menu with
* the title character but this caused some problems with an app. (Notes'n'file). BRC #39489.
*
* 29 Jan 89 Harry Yee
*
* Changed DrawPopUp. This routine first clears the current selection in the pop-up rect before
* checking if the itemnum is valid or not. If the selection being made is not valid there is no
* selection in the pop-up's rect. After deleting an item, I now check if the menu is a pop-up
* menu, if it is I check if the item just deleted was the currently selected item, if it is
* I then call SetCtlValue with the value of zero which then clears the selection just deleted
* in the pop-up's rect. BRC #39760.
*
* 30 Jan 89 Harry Yee
*
* Changed HiliteMenu to work with pop-ups.
*
* When caching menus I now switch to the menu manager's pixel map bank instead of going directly to
* bank $E1. This now allows shadowing to be enabled. (J. Mensch's idea)
*
* 01 Feb 89 Harry Yee
*
* Changed PopUpMenuSelect so that the menu's flag is saved upon entering routine and restored upon
* exit. I do this because the flag may need to be altered, the M_CACHE bit needs to be cleared
* and the M_POPUP bit needs to be set for everything to work correctly. (BRC #41040, 41041)
*
* 06 Feb 89 Harry Yee
*
* Changed Draw_Menu routine to set Text Mode to modeForeCopy. This was needed to make menus in
* windows work correctly. When menus are drawn in the Menu Manager's port the text mode is set up
* correctly when the port is first initialized, but for menus in windows this is not the case.
* (BRC #40708)
*
* 07 Feb 89 Harry Yee
*
* Changed DeleteMenu, to first release the cache for the menu being deleted and also freeing
* all the caches once the menu is deleted since the position of the menus may now be out of
* order. InsertMenu now also free's all the caches for this same reason.
*
* GetColor now checks if the ctlColor field is zero or not, if it is then the default color table
* is used. SetBarColors also checks this field and if it's zero then it doesn't do anything.
*
* 22 Feb 89 Harry Yee
*
* Fix some problems with FixMenuBar and HideMenuBar. It was doing far too much making it very
* slow if there were windows open. RefreshDesktop is no longer being called for ShowMenuBar and
* for HideMenuBar the whole screen is no longer being refreshed, only the rect for the menubar
* being hidden. Also initPalette is called after the menu is drawn.
*
* 24 Feb 89 Harry Yee
*
* I used to use MaxWidth to determine how much to add to the width of a menu item if it had
* a check mark and a command key equivalent. This caused problems for AppleWorks GS which
* installed their own font with one very very wide char. I now use the character 'W' out of
* currently installed font strike as my MaxWidth char. BRC #41164, 41415
*
* A menu in a window would have problems when, 1) the window was off the left side of the
* screen and 2) the menu title was visible but the width of the menu was greater than
* the right side of the window minus the left side of the screen. Fixed. BRC #41440
*
* 15 Mar 89 Harry Yee
*
* Removing DrawPopUp call. This makes the pop-up defproc easier to maintain.
*
* 27 Mar 89 Harry Yee
*
* I now restore original foreground color in routine draw_title.
*
* 30 Mar 89 Mensch/Yee
*
* Changed GetColor to make it work with pop-up color tables that reference handle/resources.
*
* We now save and restore all grafport shit in PopUpMenuSelect (two new routines PushPortData
* and PopPortData).
*
* 04 Apr 89 Yee
*
* Make PopUpMenuSelect scrambler proof. The menu bar's handle was not getting locked
* when it should. Fixed.
*
* 06 Apr 89 Yee
*
* When drawing a popup or regular menu title, the text mode is set to fore copy. I now
* save and restore the original text mode once I am done drawing the title.
*
* 19 Apr 89 Mensch/Yee
*
* Fixed bug in menu caching that cause a bad left mask to be used for re-blitting a chached
* menu. Was using the <X> register to save the screen mode, this was being trashed by the
* routine before it was used again. We now use <Y> save screen mode. BRC#36702
*
* Also, Tidbits (the fine routine to reblit the corners) now does the top 4 lines of a menu
* instead of 3 ( the drop shadow was 1 pixel lower than tidbits saved)
*
* 24 Apr 89 Glass/Mensch/Yee (on the Eve of freezing the ROM)
*
* In routine Draw_Title we now check whether we're in the menu manager's port before
* deciding not to save the fore color and text mode we just changed. This fixes a problem
* in Word Perfect that was depending on the menu manager's port to be set up correctly.
*
* 15 May 89 Yee
*
* Memory was being trashed when a menu extended below the screen. In routine Cache I now
* check to make sure y2 is never greater than 200. This is so the height of the menu
* never extends past the bottom of the screen and we'll restore the menu just fine.
* BRC #49085.
*
* The routines DrawDwnArrow/DrawUpArrow needed RECT to be setup. There was an instance
* that RECT was not being setup. This caused garbage to be drawn on the screen in those
* instances. Now I make sure RECT is setup.
*
* 19 May 89 Yee (for system disk d23)
*
* Calling HiliteMenu with an ID of 0 or $FFFF is not valid. ToolBox Reference manual
* says that these IDs mean first and last menu in menubar respectively.
*
* 23 May 89 Yee (for system disk d24)
*
* Take out above fix because some apps were actually creating menus with an ID
* of zero.
*
* 25 May 89 Yee
*
* Fix routine freecache. This routine never did dispose of the menu cache correctly.
*
* When this routine was fixed it uncovered a bug in routine pullup, which only affected
* a menu if it was scrollable and only if someone had scrolled it. I was disposing of
* the cache (i.e. calling freecache) before it was getting uncached. Therefore when
* we tried to restore what was behind the menu the cache was already gone.
*
* 07 Sep 89 Yee
*
* Fix bug in NewMenuBar2. The resource ID is not being copied into a temporary location
* correctly. Only the low word is being stored to. This causes problems when we use
* this temp location to release the menubar resource. Either the menubar resource is
* not released at all (whenever high word of resource ID is zero, or the call crashes
* whenever the high word of resource ID is non-zero.)
*
* 05 Jan 90 Yee
*
* Added icon support for menu items. Added calls SetItemIcon and GetItemIcon.
*
* 29 Mar 90 Yee
* Fix bug in DeleteMenu. The handle being removed was not being unlocked after
* it was removed.
*
* 05 Apr 90
* Change the way the menu item icons are drawn. I now use DrawIcon instead
* of PPToPort to draw the icon. To use icons in menu items, the menu mgr
* now requires that QDAux be started. Also the icon structure used to look
* like a locInfo record, it's now an icon structure as defined by rIcon.
*
* 10 May 90 Yee
* Fix bug in routine DrawItemIcon. I now make sure the item has an itemstruct assoc.
* with it before trying to get the itemstruct.
*
* 05 Jul 90 Yee
* Added the following calls: SetItemStruct ($490F), GetItemStruct ($4A0F),
* RemoveItemStruct ($4B0F), GetItemFlag2 ($4C0F), SetItemFlag2 ($4D0F)
*
* 17-Sep-90 Dave Lyons
*
* Removed dependency on all.macros.
*
* Note--Call $4E0F, GetItemWidth (Harry's?)
*
* 19-Sep-90 Dave Lyons
*
* Added GetMItemBlink call ($4F0F). Version is $8303.
* Adding MenuGlobal bit to make MenuSelect call InitCursor.
* (The InitCursor thing doesn't work too well yet--it flickers the cursor.)
*
* 27-Sep-90 Dave Lyons
*
* Now calls Get640Colors (QD) to get a pointer to the color_patt table
* instead of hard-coding our own.
*
* Put all.macros back.
*
* 7-Jan-91 Dave Lyons
*
* Moved the G_INITCURSOR check to where it really should be (when we decide
* the mouse was actually clicked in the menu bar).
*
* When blinking a menu item, now I call WaitUntil to wait at least MinMenuBlinkTime
* since the last blink.
*
* 9..10-Jan-91 Dave Lyons
*
* Added new call InsertPathMItems for use by Finder, Standard File, Installer.
*
* 11-Jan-91 Dave Lyons
*
* InsertPathMItems: Added InsertAfter parameter, defined bit 2 of Flags, and
* reordered parameters. Cool.
*
* 12-Jan-91 Dave Lyons
*
* Changes to InsertPathMItems (see comments there).
*
* 16-Jan-91 Dave Lyons
*
* Fixed up some comments. Fixed the bug that makes pop-up menus not
* always hilite menu items (sometimes it just inverts the icon).
* The problem was popPortData stuffing values into a grafport while
* fastPort was on. Added a SetPort after the port stuffing to make
* QD realize we dicked around with the port.
*
* Made a few $E10000 into macro calls.
*
* 22-Jan-91 Dave Lyons
*
* Fixed drawing an icon in a menu so that it always draws at an even horizontal
* location.
*
* 5-Feb-91 Dave Lyons
*
* Fixed a bug in InsertPathMItems where I was disposing of one of the handles
* that gets passed back to the caller for later disposal.
*
* Changed name of GetOSIcon to GetSysIcon.
*
* 17-Feb-91 Dave Lyons
*
* Optimized some LDA/PHA into PEIs.
* MenuStartUp now sets the default menu item blink from BRAM $5E bits 3-4.
*
* 22-Feb-91 Dave Lyons
*
* Skip InsertPathMItems DInfo call if they pass device number $FFFF.
*
* 3-Mar-91 Dave Lyons
*
* Added MenuKey feature: If the key is an Apple- key and is not the equivalent
* for any menu item in the passed menu, then we call SendRequest($0F01) to give
* system extensions a chance to handle the keypress.
*
* 14-Mar-91 Dave Lyons
*
* If the MenuKey SendRequest succeeds, I change the event into a null event so
* the caller doesn't try to handle it any further.
*
* 15-May-91 Dave Lyons
*
* InsertMenu now returns new error dupMenuID, $0F04, if a menu with the same id
* already exists in the current menu bar.
*
* 25-Jul-91 Dave Lyons
*
* Added restrictions to SendRequest($0F01=systemSaysMenuKey): Desk Manager must
* be active, CDA-events must be postable (for Installer when it disables use
* of DAs), and we must be dealing with the system menu bar.
*
* 26-Aug-91 Dave Lyons
*
* HideMenuBar now messes only with SCBs 2 through 9, instead of setting them all
* to the MasterSCB.
*
* SendRequest(systemSaysMenuKey) now has stop-after-one set.
*
* 18-Sep-91 Dave Lyons
*
* Made HideMenuBar mess with SCBs 0..MenuBarHeight-1, instead of just 2..9.
* This is for HyperCard IIgs compatibility.
*
* 7-Dec-91 Dave Lyons
*
* Moved G_INITCURSOR code to 'gotit', where it works without causing cursor flicker.
* InsertPathMItems: Added a bcc @noError after first ExpandPath. Probably dead
* code, since this call is intended to always return a buffer-too-small error
* and do a second ExpandPath.
* PopUpMenuSelect now calls get_ids instead of lda [<itemptr] to get the selected
* item's id, for compatibility with custom pop-up menus.
*
* 8-Feb-92 Dave Lyons
*
* Added safety check on top coordinate of menu bar: MenuSelect refuses to pull
* down a menu at Y>=150. Minor optimizations.
*
* Version $0303 for 6.0 final.
*
***********************************************************************************
*
* 13-Mar-92 Dave Lyons
*
* Version $8304 for 6.0.1
*
* 4-Jun-92 Dave Lyons
*
* DeleteMItem now shrinks menu handle by 12 bytes instead of 10, so we don't
* waste two bytes every time we delete an item.
*
* 25-Mar-93 Dave Lyons
*
* In AllocateCache, we now clip the menu height to 200 for computing the size
* handle needed to save the screen. We were overflowing the computation for
* tall pop-up menus.
*
* 1-Apr-93 Steve Stephenson
*
* Version $0304 for 6.0.1 (final)
*
***********************************************************************************
* 22-Jan-2023 Chris Parana
*
* New Apple logo images and colors
*
* 26-Jan-2023 Chris Parana
*
* Version $8305 for 6.0.x+
*
* New InitPalette to load the colors for the newer, better Apple logo. We have
* twice the colors now and need to load for both 320 and 640 mode accrordingly.
*
* New Apple logo data and two color tables: logocolora and logocolorb.
*
* 19-Feb-2023 Chris Parana
*
* New DrawRect draws bottom line only instead of outlining menubar
*
***********************************************************************************
blanks off
string asis
print push
print off
include 'all.macros'
INCLUDE 'e16.qdaux'
INCLUDE 'e16.resources'
print pop
include 'MenuEquates.asm'
;-----------------------------------------------
;
; Imported addresses from WCM.Lib
;
;-----------------------------------------------
IMPORT pushDpage
IMPORT pushDlong
IMPORT allocate2
IMPORT allocate3
IMPORT startup
IMPORT Epop0bytes
IMPORT Epop2bytes
IMPORT Epop4bytes
IMPORT Epop6bytes
IMPORT Epop8bytes
IMPORT Epop10bytes
IMPORT Epop12bytes
IMPORT Epop14bytes
IMPORT Epop16bytes
IMPORT Epop18bytes
IMPORT Epop26bytes
IMPORT Epop32bytes
import pop0bytes
import pop2bytes
import pop4bytes
import pop6bytes
import pop8bytes
import pop10bytes
import pop12bytes
import pop14bytes
import pop16bytes
import pop18bytes
import pop26bytes
import pop32bytes
entry FakeGetPopUpDefProc
;-----------------------------------------------
;
; Forward addresses and entries
;
;-----------------------------------------------
ENTRY GetMenuMgrPort
ENTRY InitPalette
ENTRY MenuBootInit
ENTRY MenuGlobal
ENTRY MenuNewRes
ENTRY MenuReset
ENTRY MenuShutDown
ENTRY MenuStartup
ENTRY MenuStatus
ENTRY MenuVersion
ENTRY NewMenu
ENTRY Reserved
ENTRY clearWAP
ENTRY initres
ENTRY MENUKEY
ENTRY GETMENUBAR
ENTRY MENUREFRESH
ENTRY FLASHMENUBAR
ENTRY INSERTMENU
ENTRY DELETEMENU
ENTRY GETSYSBAR
ENTRY SETSYSBAR
ENTRY FIXMENUBAR
ENTRY COUNTMITEMS
ENTRY NEWMENUBAR
ENTRY GETMHANDLE
ENTRY SETBARCOLORS
ENTRY GETBARCOLORS
ENTRY SETMTITLESTART
ENTRY GETMTITLESTART
ENTRY CALCMENUSIZE
ENTRY SETMTITLEWIDTH
ENTRY GETMTITLEWIDTH
ENTRY SETMENUFLAG
ENTRY GETMENUFLAG
ENTRY SETMENUTITLE
ENTRY GETMENUTITLE
ENTRY SETMITEM
ENTRY GETITEM
ENTRY SETMITEMFLAG
ENTRY GETITEMFLAG
ENTRY SETITEMBLINK
ENTRY DRAWMENUBAR
ENTRY MENUSELECT
ENTRY HILITEMENU
ENTRY DISPOSEMENU
ENTRY ENABLEMITEM
ENTRY DISABLEMITEM
ENTRY CHECKMITEM
ENTRY SETMITEMMARK
ENTRY INSERTMITEM
ENTRY DELETEMITEM
ENTRY GETITEMMARK
ENTRY SETMITEMSTYLE
ENTRY GETITEMSTYLE
ENTRY SETMENUID
ENTRY SETITEMID
ENTRY SETMENUBAR
ENTRY SETMITEMNAME
ENTRY ENDINITRAM
ENTRY STARTINITRAM
ENTRY DefColorTable
ENTRY SYS_CURRENT
ENTRY LOCKMENUBAR
ENTRY CLOSEMENUPORT
ENTRY EVERYCACHEFREE
ENTRY UNLOCKMENUBAR
ENTRY SAVE_PORT
ENTRY PUSHPORT
ENTRY PUSHSCINFO1
ENTRY PUSHDEFBARRECT
ENTRY TO_UPORT
ENTRY SCANBYTE
ENTRY PUSHCOLORTABLE
ENTRY LOGOCOLORA
ENTRY LOGOCOLORB
ENTRY MAKE_BLOCK
ENTRY LOCKMENUHAND
ENTRY DEREFMENUHAND
ENTRY UNLOCKMENUHAND
ENTRY NEXT_ITEM
ENTRY PUSHDEFMENU
ENTRY PUSHDATA
ENTRY TO_MYPORT
ENTRY GETCOLOR
ENTRY SETOUTLINE
ENTRY DRAWRECT
ENTRY GETMFIRST
ENTRY NEXT_MENU
ENTRY GETMPTR
ENTRY TITLEXSTART
ENTRY DISPATCH
ENTRY GETMEVENT
ENTRY ONBAR
ENTRY PULL_DOWN
ENTRY PULLUP
ENTRY PUSHYRAT
ENTRY PUSHMRECT
ENTRY GET_IDS
ENTRY GETIFIRST
ENTRY PUSHCOLOR
ENTRY ALLOCATECACHE
ENTRY FREECACHE
ENTRY MAKECACHE
ENTRY CACHE
ENTRY PUSHCOLOR2
ENTRY UNCACHE
ENTRY LONG_CALL
ENTRY DRAW_MENU
ENTRY CHOOSE_ITEM
ENTRY SIZE_MENU
ENTRY DRAW_TITLE
ENTRY DRAW_ITEM
ENTRY GET_ITEMID
ENTRY CALCITEM
ENTRY GETITEMH
ENTRY TEXT_GUTS
ENTRY GETISTRG
ENTRY GET_APPLE
ENTRY PRINTSTRG
ENTRY DIMMED
ENTRY NOR_MASK
ENTRY PUSHRECT
ENTRY PUSHMARK
ENTRY PUSHCOM_KEY
ENTRY HLINE
ENTRY GETIPTR2
ENTRY INTO_BLOCK
ENTRY GETIPTR
ENTRY GROWBLOCK
ENTRY EVERYCACHEBAD
ENTRY BADCACHE
ENTRY _320_MASK
ENTRY _320_DATA
ENTRY _640_MASK
ENTRY _640_DATA
ENTRY JustifyLeft
ENTRY JustifyRight
ENTRY FixTextFace
ENTRY ClearTextFace
ENTRY CheckForScrolling
ENTRY CheckBounds
ENTRY GetStarting
ENTRY ResetThings
ENTRY UpArrowIcon
ENTRY DownArrowIcon
ENTRY DrawUpArrow
ENTRY DrawDwnArrow
ENTRY AdjustBottom
ENTRY AdjustTop
ENTRY InitStuff
ENTRY AdjustRect
ENTRY Pull_Down2
ENTRY TrackMenu2
ENTRY GetrMenuTitle
ENTRY GetrItemName
ENTRY GetrItemIcon ; 12/19/89 H.Y. for icon drawing support
ENTRY GetIconInfo ; 12/20/89 H.Y. for icon drawing support
ENTRY DrawItemIcon ; 12/20/89 H.Y. for icon drawing support
ENTRY GetStruct
ENTRY LoadnRelease
ENTRY FillItemRec
ENTRY UpArrowLocInfo640
ENTRY UpArrowLocInfo320
ENTRY UpArrowBounds640
ENTRY UpArrowBounds320
ENTRY DownArrowLocInfo640
ENTRY DownArrowLocInfo320
ENTRY DownArrowBounds640
ENTRY DownArrowBounds320
ENTRY CommonInsert
ENTRY GetResMTitle
ENTRY PopupMenuSelect
ENTRY NewMenu2
ENTRY InsertMItem2
ENTRY SetMenuTitle2
ENTRY SetMItem2
ENTRY SetMItemName2
ENTRY NewMenuBar2
ENTRY PushSmearLow
ENTRY SaveColor
ENTRY RestoreColor
ENTRY doWhiteSpace
ENTRY addToTop
ENTRY addToBottom
ENTRY NeverMind
ENTRY HideMenuBar
ENTRY ShowMenuBar
ENTRY AddorSubRegion
ENTRY Hole
ENTRY SetItemIcon
ENTRY GetItemIcon
ENTRY SetItemStruct
ENTRY GetItemStruct
ENTRY RemoveItemStruct
ENTRY GetItemFlag2
ENTRY SetItemFlag2
ENTRY GetItemWidth
ENTRY GetMItemBlink ;19-Sep-90 DAL
entry InsertPathMItems ;10-Jan-90 DAL
;===========================================================================
; Menu Manager function table.
;===========================================================================
MenuCallTable PROC EXPORT
ENTRY FPT
FPT DC.W (ENDFPT-FPT)/4
DC.W 0
DC.L MenuBootInit-1 $010F
DC.L MenuStartup-1 $020F
DC.L MenuShutDown-1 $030F
DC.L MenuVersion-1 $040F
DC.L MenuReset-1 $050F
DC.L MenuStatus-1 $060F
DC.L Reserved-1 $070F
DC.L Reserved-1 $080F
DC.L MenuKey-1 $090F
DC.L GetMenuBar-1 $0A0F
DC.L MenuRefresh-1 $0B0F
DC.L FlashMenuBar-1 $0C0F
DC.L InsertMenu-1 $0D0F
DC.L DeleteMenu-1 $0E0F
DC.L InsertMItem-1 $0F0F
DC.L DeleteMItem-1 $100F
DC.L GetSysBar-1 $110F
DC.L SetSysBar-1 $120F
DC.L FixMenuBar-1 $130F
DC.L CountMItems-1 $140F
DC.L NewMenuBar-1 $150F
DC.L GetMHandle-1 $160F
DC.L SetBarColors-1 $170F
DC.L GetBarColors-1 $180F
DC.L SetMTitleStart-1 $190F
DC.L GetMTitleStart-1 $1A0F
DC.L GetMenuMgrPort-1 $1B0F
DC.L CalcMenuSize-1 $1C0F
DC.L SetMTitleWidth-1 $1D0F
DC.L GetMTitleWidth-1 $1E0F
DC.L SetMenuFlag-1 $1F0F
DC.L GetMenuFlag-1 $200F
DC.L SetMenuTitle-1 $210F
DC.L GetMenuTitle-1 $220F
DC.L MenuGlobal-1 $230F ;Added 2/18/87
DC.L SetMItem-1 $240F
DC.L GetItem-1 $250F
DC.L SetMItemFlag-1 $260F
DC.L GetItemFlag-1 $270F
DC.L SetItemBlink-1 $280F
DC.L MenuNewRes-1 $290F
DC.L DrawMenuBar-1 $2A0F
DC.L MenuSelect-1 $2B0F
DC.L HiliteMenu-1 $2C0F
DC.L NewMenu-1 $2D0F
DC.L DisposeMenu-1 $2E0F
DC.L InitPalette-1 $2F0F
DC.L EnableMItem-1 $300F
DC.L DisableMItem-1 $310F
DC.L CheckMItem-1 $320F
DC.L SetMItemMark-1 $330F
DC.L GetItemMark-1 $340F
DC.L SetMItemStyle-1 $350F
DC.L GetItemStyle-1 $360F
DC.L SetMenuID-1 $370F
DC.L SetItemID-1 $380F
DC.L SetMenuBar-1 $390F
DC.L SetMItemName-1 $3A0F
******* Adding new calls for System Disk 4.1 ******************************
DC.L FakeGetPopUpDefProc-1 $3B0F
DC.L PopUpMenuSelect-1 $3C0F
DC.L Hole-1 $3D0F ;used to be DrawPopUp call
DC.L NewMenu2-1 $3E0F
DC.L InsertMItem2-1 $3F0F
DC.L SetMenuTitle2-1 $400F
DC.L SetMItem2-1 $410F
DC.L SetMItemName2-1 $420F
DC.L NewMenuBar2-1 $430F
DC.L GetResMTitle-1 $440F
DC.L HideMenuBar-1 $450F
DC.L ShowMenuBar-1 $460F
DC.L SetItemIcon-1 $470F ;added 20 Dec 89 H.Y. for item icon support
DC.L GetItemIcon-1 $480F ;added 20 Dec 89 H.Y. for item icon support
DC.L SetItemStruct-1 $490F ;added 05 Jul 90
DC.L GetItemStruct-1 $4A0F ;added 05 Jul 90
DC.L RemoveItemStruct-1 $4B0F ;added 05 Jul 90
DC.L GetItemFlag2-1 $4C0F ;added 05 Jul 90
DC.L SetItemFlag2-1 $4D0F ;added 05 Jul 90
DC.L GetItemWidth-1 $4E0F ;added 10 Jul 90 for "Jay's" stuff
dc.L GetMItemBlink-1 $4F0F ;added 19 Sep 90 DAL
dc.l InsertPathMItems-1 $500F ;added 10-Jan-91 DAL
ENDFPT
ENDP
;===========================================================================
; Hole
;===========================================================================
Hole PROC
rtl
ENDP
****************************************************************
*
FakeGetPopUpDefProc PROC
*
* Jumps to code in dynamic segment so address of dynamic
* segment is not in tool table.
*
*
* Inputs:
* space for output
*
* Outputs:
* space for output
*
* External Refs:
import GetPopUpDefProc
*
* Entry Points:
* none
*
longa on ; mode
longi on
*
*
* Added 15 May 89 Steven Glass
*
****************************************************************
jml GetPopUpDefProc
ENDP
;===========================================================================
;
; MenuStartup
;
; Initialize Menu Manager
;
; IN: PUSH:WORD - ID to use.
; PUSH:WORD - zero page number to use.
;
; OUT: Nothing.
;
;===========================================================================
MenuStartup PROC
import SelfMod1Low
import SelfMod1High
import SelfMod2
TheReturnAddr equ 1 Stack offset before setup called.