4 Original GPL release version 4.12
5 Copyright 1993-2000 Jonathan Potter
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 All users of Directory Opus 4 (including versions distributed
22 under the GPL) are entitled to upgrade to the latest version of
23 Directory Opus version 5 at a reduced price. Please see
24 http://www.gpsoft.com.au for more information.
26 The release of Directory Opus 4 under the GPL in NO WAY affects
27 the existing commercial status of Directory Opus 5.
33 __saveds
DoFSSetMenuStrip(register struct Window
*window
__asm("a0"),
34 register struct Menu
*firstmenu
__asm("a1"))
37 struct MenuItem
*item
;
38 struct DrawInfo
*drinfo
;
40 int y
,offset
,xpos
=0,iwidth
,comwidth
,checkwidth
;
41 struct IntuiText testtext
;
42 struct TextAttr testattr
;
45 checkwidth
=CHECKWIDTH
;
47 AskFont(&window
->WScreen
->RastPort
,&testattr
);
49 testtext
.DrawMode
=JAM1
;
50 testtext
.NextText
=NULL
;
52 if (//IntuitionBase->LibNode.lib_Version>36 &&
53 (drinfo
=GetScreenDrawInfo(window
->WScreen
))) {
54 // if (IntuitionBase->LibNode.lib_Version>=39) {
55 fpen
=drinfo
->dri_Pens
[BARDETAILPEN
];
56 bpen
=drinfo
->dri_Pens
[BARBLOCKPEN
];
57 if (drinfo
->dri_AmigaKey
) comwidth
=drinfo
->dri_AmigaKey
->Width
;
58 if (drinfo
->dri_CheckMark
) checkwidth
=drinfo
->dri_CheckMark
->Width
;
62 fpen=drinfo->dri_Pens[DETAILPEN];
63 bpen=drinfo->dri_Pens[BLOCKPEN];
66 FreeScreenDrawInfo(window
->WScreen
,drinfo
);
73 offset
=window
->WScreen
->Font
->ta_YSize
+3;
76 if (xpos
==0) xpos
=menu
->LeftEdge
;
77 else menu
->LeftEdge
=xpos
;
79 TextLength(&window
->WScreen
->RastPort
,menu
->MenuName
,strlen(menu
->MenuName
))+
80 window
->WScreen
->RastPort
.Font
->tf_XSize
;
90 if (item
->Flags
&ITEMTEXT
) {
91 struct IntuiText
*text
;
92 int wid
,mwidth
=0,first
=0;
94 item
->Height
=offset
-1;
96 text
=(struct IntuiText
*)item
->ItemFill
;
102 if (LStrnCmp(text
->IText
," ",3)==0) text
->IText
=&text
->IText
[3];
103 if (item
->Flags
&CHECKIT
) text
->LeftEdge
=checkwidth
;
104 else text
->LeftEdge
=0;
107 if (text
->ITextFont
) testtext
.ITextFont
=text
->ITextFont
;
108 else testtext
.ITextFont
=&testattr
;
109 testtext
.IText
=text
->IText
;
111 wid
=text
->LeftEdge
+IntuiTextLength(&testtext
)+window
->WScreen
->RastPort
.Font
->tf_XSize
;
112 if (wid
>mwidth
) mwidth
=wid
;
114 if (text
=text
->NextText
) {
116 text
->TopEdge
=offset
+3;
120 if (item
->Flags
&COMMSEQ
)
121 mwidth
+=comwidth
+TextLength(&window
->WScreen
->RastPort
,&item
->Command
,1);
122 if (mwidth
>iwidth
) iwidth
=mwidth
;
132 image
=(struct Image
*)item
->ItemFill
;
134 if (image
->ImageData
==NULL
) {
136 image
->PlaneOnOff
=fpen
;
139 wid
=image
->LeftEdge
+image
->Width
;
140 if (wid
>iwidth
) iwidth
=wid
;
143 y
+=image
->TopEdge
+image
->Height
;
145 image
=image
->NextImage
;
152 item
=menu
->FirstItem
;
155 if (!(item
->Flags
&ITEMTEXT
)) {
158 image
=(struct Image
*)item
->ItemFill
;
160 if (image
->ImageData
==NULL
) image
->Width
=iwidth
;
161 image
=image
->NextImage
;
170 return((int)SetMenuStrip(window
,firstmenu
));