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.
34 iconinfo_save_gadget
[]={
35 {RO_Type
,OBJECT_GADGET
},
36 {RO_GadgetType
,GADGET_BOOLEAN
},
37 {RO_GadgetID
,II_SAVE
},
42 {RO_TextNum
,STR_SAVE
},
43 {RO_TextPos
,TEXTPOS_CENTER
},
46 iconinfo_skip_gadget
[]={
47 {RO_Type
,OBJECT_GADGET
},
48 {RO_GadgetType
,GADGET_BOOLEAN
},
49 {RO_GadgetID
,II_SKIP
},
54 {RO_TextNum
,STR_SKIP
},
55 {RO_TextPos
,TEXTPOS_CENTER
},
58 iconinfo_cancel_gadget
[]={
59 {RO_Type
,OBJECT_GADGET
},
60 {RO_GadgetType
,GADGET_BOOLEAN
},
61 {RO_GadgetID
,II_CANCEL
},
66 {RO_TextNum
,STR_CANCEL
},
67 {RO_TextPos
,TEXTPOS_CENTER
},
71 iconinfo_edittooltype_gadget
[]={
72 {RO_Type
,OBJECT_GADGET
},
73 {RO_GadgetType
,GADGET_STRING
},
74 {RO_GadgetID
,II_TOOLTYPE
},
81 iconinfo_deletetooltype_gadget
[]={
82 {RO_Type
,OBJECT_GADGET
},
83 {RO_GadgetType
,GADGET_BOOLEAN
},
84 {RO_GadgetID
,II_DELETE
},
89 {RO_TextNum
,STR_DELETE
},
90 {RO_TextPos
,TEXTPOS_CENTER
},
93 iconinfo_newtooltype_gadget
[]={
94 {RO_Type
,OBJECT_GADGET
},
95 {RO_GadgetType
,GADGET_BOOLEAN
},
101 {RO_TextNum
,STR_NEW
},
102 {RO_TextPos
,TEXTPOS_CENTER
},
103 {RO_HighRecess
,TRUE
},
106 iconinfo_tooltype_list
[]={
107 {RO_Type
,OBJECT_LISTVIEW
},
113 {RO_TextNum
,STR_TOOLTYPES
},
114 {RO_TextPos
,TEXTPOS_LEFT
},
115 {RO_HighRecess
,TRUE
},
118 iconinfo_stack_gadget
[]={
119 {RO_Type
,OBJECT_GADGET
},
120 {RO_GadgetType
,GADGET_STRING
},
121 {RO_GadgetID
,II_STACK
},
129 iconinfo_comment_gadget
[]={
130 {RO_Type
,OBJECT_GADGET
},
131 {RO_GadgetType
,GADGET_STRING
},
132 {RO_GadgetID
,II_COMMENT
},
138 {RO_TextNum
,STR_COMMENT
},
139 {RO_TextPos
,TEXTPOS_LEFT
},
142 iconinfo_defaulttool_gadget
[]={
143 {RO_Type
,OBJECT_GADGET
},
144 {RO_GadgetType
,GADGET_STRING
},
145 {RO_GadgetID
,II_DEFAULTTOOL
},
151 {RO_TextNum
,STR_DEFAULT_TOOL
},
152 {RO_TextPos
,TEXTPOS_LEFT
},
155 iconinfo_protectbit_template
[]={
156 {RO_Type
,OBJECT_GADGET
},
157 {RO_GadgetType
,GADGET_CHECK
},
162 {RO_TextPos
,TEXTPOS_RIGHT
},
166 *iconinfo_general_gadgets
[]={
167 iconinfo_save_gadget
,
168 iconinfo_skip_gadget
,
169 iconinfo_cancel_gadget
,
172 *iconinfo_short_general_gadgets
[]={
175 *iconinfo_tooltype_gadgets
[]={
176 iconinfo_edittooltype_gadget
,
177 iconinfo_deletetooltype_gadget
,
178 iconinfo_newtooltype_gadget
,
181 struct TextAttr topaz
={"topaz.font",8,0,0};
184 save_text
={1,0,JAM1
,1,1,&topaz
,NULL
,NULL
},
185 skip_text
={1,0,JAM1
,1,1,&topaz
,NULL
,NULL
},
186 cancel_text
={1,0,JAM1
,1,1,&topaz
,NULL
,NULL
};
190 NULL
,0,0,100+COMMWIDTH
,10,ITEMTEXT
|ITEMENABLED
|HIGHCOMP
|COMMSEQ
,0,
191 (APTR
)&save_text
,NULL
,'S',NULL
,0xffff},
193 &save_item
,0,11,100+COMMWIDTH
,10,ITEMTEXT
|ITEMENABLED
|HIGHCOMP
|COMMSEQ
,0,
194 (APTR
)&skip_text
,NULL
,'K',NULL
,0xffff},
196 &skip_item
,0,22,100+COMMWIDTH
,10,ITEMTEXT
|ITEMENABLED
|HIGHCOMP
|COMMSEQ
,0,
197 (APTR
)&cancel_text
,NULL
,'C',NULL
,0xffff};
200 icon_menu
={NULL
,8,0,100,0,MENUENABLED
,NULL
,&cancel_item
};
202 int doiconinfo(vis
,name
)
206 struct DiskObject
*dobj
;
207 struct DOpusListView
*view
;
209 buf
[256],namebuf
[256],inamebuf
[33],*ptr
,date
[11],time
[11],*olddeftool
,
210 **ttarray
,**oldtooltypes
,**tttemp
;
211 struct DOpusDateTime datetime
;
214 int a
,b
,x
,y
,gadgetid
,ret
,gotid
=0,/*newdef,*/ttcount
=0,curtt
=-1,compflag
=0;
216 struct InfoData __aligned infodata
;
217 struct FileInfoBlock __aligned fileinfo
;
218 struct RequesterBase icon_req
;
219 struct StringExtend stringex
;
220 struct Window
*window
;
226 *protectbitgads
=NULL
,
229 *defaulttoolgad
=NULL
;
230 char *stack_buf
,*comment_buf
,*tooltype_buf
,*defaulttool_buf
;
231 struct DOpusListView
*tooltypelist
;
232 struct IntuiMessage
*msg
;
233 struct Rectangle icon_rec
;
234 int textxoff
,textyoff
,small
=0;
239 strcpy(namebuf
,name
); if ((ptr
=strstr(namebuf
,".info"))) *ptr
=0;
240 if (!(dobj
=GetDiskObject(namebuf
))) return(-2);
241 //icongad=(struct Gadget *)&(dobj->do_Gadget);
242 oldtooltypes
=(char **)dobj
->do_ToolTypes
;
244 switch (dobj
->do_Type
) {
249 if (!(getroot(buf
,&(datetime
.dat_Stamp
)))) {
250 FreeDiskObject(dobj
);
253 case WBGARBAGE
: icon_req
.rb_heightfine
=150; break;
256 case WBDRAWER
: icon_req
.rb_heightfine
=196; break;
258 FreeDiskObject(dobj
);
262 if (lock
=Lock(namebuf
,ACCESS_READ
)) {
263 Examine(lock
,&fileinfo
);
264 Info(lock
,&infodata
);
267 strcpy(inamebuf
,BaseName(namebuf
));
269 if (dobj
->do_Type
!=WBDISK
)
270 CopyMem((char *)&(fileinfo
.fib_Date
),
271 (char *)&(datetime
.dat_Stamp
),
272 sizeof(struct DateStamp
));
274 datetime
.dat_Format
=FORMAT_DOS
;
275 datetime
.dat_StrDay
=NULL
;
276 datetime
.dat_StrDate
=date
;
277 datetime
.dat_StrTime
=time
;
278 datetime
.dat_Flags
=0;
279 StampToStr(&datetime
);
281 strcpy(buf
,BaseName(name
)); if (ptr
=strstr(buf
,".info")) *ptr
=0;
284 else if (dobj
->do_Type
==WBDISK
) {
285 FreeDiskObject(dobj
);
289 strcpy(inamebuf
,BaseName(name
)); if (ptr
=strstr(inamebuf
,".info")) *ptr
=0;
290 strcpy(date
,"???"); time
[0]=0;
293 if (dobj
->do_Type
==WBPROJECT
&& gotid
) icon_req
.rb_heightfine
+=14;
295 iconinfo_save_gadget
[4].ti_Data
=icon_req
.rb_heightfine
-16;
296 iconinfo_skip_gadget
[4].ti_Data
=icon_req
.rb_heightfine
-16;
297 iconinfo_cancel_gadget
[4].ti_Data
=icon_req
.rb_heightfine
-16;
300 icon_req
.rb_height
=0;
301 icon_req
.rb_widthfine
=540;
302 icon_req
.rb_leftoffset
=4;
303 icon_req
.rb_topoffset
=0;
306 fill_out_req(&icon_req
,vis
);
308 icon_req
.rb_privateflags
=0;
309 icon_req
.rb_screenname
=NULL
;
311 if (icon_req
.rb_screen
&& !(vis
->vi_flags
&VISF_BORDERS
)) {
312 icon_req
.rb_flags
|=RBF_STRINGS
;
313 icon_req
.rb_title
=NULL
;
316 icon_req
.rb_flags
|=RBF_BORDERS
|RBF_CLOSEGAD
|RBF_STRINGS
;
317 icon_req
.rb_title
=inamebuf
;
320 icon_req
.rb_extend
=&stringex
;
321 icon_req
.rb_idcmpflags
=
322 IDCMP_GADGETUP
|IDCMP_GADGETDOWN
|IDCMP_MOUSEBUTTONS
|
323 IDCMP_RAWKEY
|IDCMP_MOUSEMOVE
|IDCMP_CLOSEWINDOW
|IDCMP_MENUPICK
;
324 icon_req
.rb_string_table
=string_table
;
327 stringex
.Pens
[a
]=vis
->vi_stringcol
[a
];
328 stringex
.ActivePens
[a
]=vis
->vi_activestringcol
[a
];
330 stringex
.InitialModes
=0;
331 stringex
.EditHook
=NULL
;
332 stringex
.WorkBuffer
=NULL
;
333 for (a
=0;a
<4;a
++) stringex
.Reserved
[a
]=0;
336 if (window
=OpenRequester(&icon_req
)) break;
337 CloseRequester(&icon_req
);
340 icon_req
.rb_flags
&=~RBF_BORDERS
;
341 icon_req
.rb_title
=NULL
;
344 icon_req
.rb_heightfine
-=17;
348 FreeDiskObject(dobj
);
353 if (!(addreqgadgets(&icon_req
,
354 ((small
)?iconinfo_short_general_gadgets
:iconinfo_general_gadgets
)))) {
355 CloseRequester(&icon_req
);
356 FreeDiskObject(dobj
);
360 textxoff
=window
->BorderLeft
+5;
361 textyoff
=window
->BorderTop
;
363 icon_rec
.MinX
=170+textxoff
;
364 icon_rec
.MinY
=16+textyoff
;
365 icon_rec
.MaxX
=369+textxoff
;
366 icon_rec
.MaxY
=85+textyoff
;
369 if (rp
->Font
->tf_YSize
>8 || rp
->Font
->tf_Flags
&FPF_PROPORTIONAL
) {
370 struct TextFont
*icon_font
;
372 if (icon_font
=OpenFont(&topaz
)) {
373 SetFont(rp
,icon_font
);
374 icon_req
.rb_font
=icon_font
;
375 icon_req
.rb_privateflags
=RBP_CLOSEFONT
;
380 window
->Flags
&=~WFLG_RMBTRAP
;
381 if (IntuitionBase
->LibNode
.lib_Version
>=39) {
382 save_text
.FrontPen
=1;
383 skip_text
.FrontPen
=1;
384 cancel_text
.FrontPen
=1;
387 save_text
.FrontPen
=0;
388 skip_text
.FrontPen
=0;
389 cancel_text
.FrontPen
=0;
391 save_text
.IText
=string_table
[STR_SAVE
];
392 skip_text
.IText
=string_table
[STR_SKIP
];
393 cancel_text
.IText
=string_table
[STR_CANCEL
];
394 icon_menu
.MenuName
=string_table
[STR_ICON
];
395 SetMenuStrip(window
,&icon_menu
);
399 if (gotid
&& dobj
->do_Type
!=WBDISK
) {
400 struct TagItem
*iconinfo_protectbit_gadgets
[7];
403 if (iconinfo_protectbit_gadgets
[a
]=(struct TagItem
*)
404 LAllocRemember(&icon_req
.rb_memory
,sizeof(iconinfo_protectbit_template
),MEMF_CLEAR
)) {
405 CopyMem((char *)iconinfo_protectbit_template
,
406 (char *)iconinfo_protectbit_gadgets
[a
],
407 sizeof(iconinfo_protectbit_template
));
408 iconinfo_protectbit_gadgets
[a
][2].ti_Data
=a
+10;
409 iconinfo_protectbit_gadgets
[a
][4].ti_Data
=15+(a
*12);
410 iconinfo_protectbit_gadgets
[a
][5].ti_Data
=STR_SCRIPT
+a
;
411 if (fileinfo
.fib_Protection
&protect_flags
[a
]) {
412 if (protect_flags
[a
]>15) iconinfo_protectbit_gadgets
[a
][7].ti_Data
=TRUE
;
414 else if (protect_flags
[a
]<16) iconinfo_protectbit_gadgets
[a
][7].ti_Data
=TRUE
;
418 iconinfo_protectbit_gadgets
[6]=NULL
;
419 protectbitgads
=addreqgadgets(&icon_req
,iconinfo_protectbit_gadgets
);
422 if (dobj
->do_Type
==WBTOOL
|| dobj
->do_Type
==WBPROJECT
) {
423 struct TagItem
*temp_gadgets
[2];
425 temp_gadgets
[0]=iconinfo_stack_gadget
;
426 temp_gadgets
[1]=NULL
;
428 if (stackgad
=addreqgadgets(&icon_req
,temp_gadgets
)) {
429 stack_buf
=((struct StringInfo
*)stackgad
->SpecialInfo
)->Buffer
;
430 if (dobj
->do_StackSize
<4096) dobj
->do_StackSize
=4096;
431 lsprintf(stack_buf
,"%ld",(long int)dobj
->do_StackSize
);
435 if (dobj
->do_Type
==WBDISK
|| dobj
->do_Type
==WBPROJECT
|| gotid
) {
436 struct TagItem
*temp_gadgets
[2];
438 temp_gadgets
[1]=NULL
;
440 if (gotid
&& dobj
->do_Type
!=WBDISK
) {
441 temp_gadgets
[0]=iconinfo_comment_gadget
;
442 if (commentgad
=addreqgadgets(&icon_req
,temp_gadgets
)) {
443 comment_buf
=((struct StringInfo
*)commentgad
->SpecialInfo
)->Buffer
;
444 strcpy(comment_buf
,fileinfo
.fib_Comment
);
447 if (dobj
->do_Type
==WBDISK
|| dobj
->do_Type
==WBPROJECT
) {
449 iconinfo_defaulttool_gadget
[4].ti_Data
+=14;
450 iconinfo_edittooltype_gadget
[4].ti_Data
+=14;
451 iconinfo_deletetooltype_gadget
[4].ti_Data
+=14;
452 iconinfo_newtooltype_gadget
[4].ti_Data
+=14;
453 iconinfo_tooltype_list
[3].ti_Data
+=14;
455 temp_gadgets
[0]=iconinfo_defaulttool_gadget
;
456 if (defaulttoolgad
=addreqgadgets(&icon_req
,temp_gadgets
)) {
457 defaulttool_buf
=((struct StringInfo
*)defaulttoolgad
->SpecialInfo
)->Buffer
;
458 if (dobj
->do_DefaultTool
) strcpy(defaulttool_buf
,dobj
->do_DefaultTool
);
463 if (dobj
->do_Type
!=WBDISK
) {
464 UScoreText(rp
,string_table
[STR_COMMENT
],
465 117+textxoff
-((strlen(string_table
[STR_COMMENT
])+1)*8),
468 UScoreText(rp
,"---",118+textxoff
,114+textyoff
,-1);
472 icon_rec
.MinX
,icon_rec
.MinY
,
473 (icon_rec
.MaxX
-icon_rec
.MinX
+1),(icon_rec
.MaxY
-icon_rec
.MinY
+1),
474 vis
->vi_shine
,vis
->vi_shadow
);
475 drawicon(window
,dobj
,FALSE
,&icon_rec
);
477 StrCombine(buf
,inamebuf
," (",256);
478 strcat(buf
,icon_type_names
[dobj
->do_Type
-1]);
481 SetAPen(rp
,vis
->vi_fg
);
482 UScoreText(rp
,buf
,((540-(strlen(buf
)*8))/2)+textxoff
,11+textyoff
,-1);
486 ptr
=specific_gadtext
[dobj
->do_Type
-1][a
];
488 if (a
<4) x
=94+textxoff
;
490 UScoreText(rp
,ptr
,x
-(strlen(ptr
)*8)-8,y
,-1);
498 UScoreText(rp
,date
,118+textxoff
,100+textyoff
,-1);
500 Text(rp
,time
,strlen(time
));
502 switch (dobj
->do_Type
) {
504 lsprintf(buf
,"%ld",(long int)infodata
.id_NumBlocks
);
505 UScoreText(rp
,buf
,102+textxoff
,40+textyoff
,-1);
506 lsprintf(buf
,"%ld",(long int)infodata
.id_NumBlocksUsed
);
507 UScoreText(rp
,buf
,102+textxoff
,50+textyoff
,-1);
508 lsprintf(buf
,"%ld",(long int)infodata
.id_NumBlocks
-infodata
.id_NumBlocksUsed
);
509 UScoreText(rp
,buf
,102+textxoff
,60+textyoff
,-1);
510 lsprintf(buf
,"%ld",(long int)infodata
.id_BytesPerBlock
);
511 UScoreText(rp
,buf
,102+textxoff
,70+textyoff
,-1);
513 switch (infodata
.id_DiskState
) {
515 strcpy(buf
,string_table
[STR_VALIDATING
]);
517 case ID_WRITE_PROTECTED
:
518 strcpy(buf
,string_table
[STR_WRITE_PROTECTED
]);
521 strcpy(buf
,string_table
[STR_READ_WRITE
]);
525 UScoreText(rp
,buf
,380+textxoff
+((160-(strlen(buf
)*8))/2),53+textyoff
,-1);
530 Move(rp
,102+textxoff
,40+textyoff
);
532 lsprintf(buf
,"%ld",(long int)fileinfo
.fib_NumBlocks
);
533 Text(rp
,buf
,strlen(buf
));
535 else Text(rp
,"---",3);
536 Move(rp
,102+textxoff
,50+textyoff
);
538 lsprintf(buf
,"%ld",(long int)fileinfo
.fib_Size
);
539 Text(rp
,buf
,strlen(buf
));
541 else Text(rp
,"---",3);
544 if ((ttarray
=oldtooltypes
)) {
545 for (ttcount
=0;;ttcount
++) if (!ttarray
[ttcount
]) break;
546 if (ttarray
=AllocMem((ttcount
+1)*sizeof(APTR
),MEMF_CLEAR
)) {
547 for (a
=0;a
<ttcount
;a
++) {
548 if (oldtooltypes
[a
] &&
549 (ttarray
[a
]=AllocMem(strlen(oldtooltypes
[a
])+1,0)))
550 strcpy(ttarray
[a
],oldtooltypes
[a
]);
555 if (tooltypelist
=(struct DOpusListView
*)
556 AddRequesterObject(&icon_req
,iconinfo_tooltype_list
)) {
558 fix_listview(&icon_req
,tooltypelist
);
559 tooltypelist
->items
=ttarray
;
560 if (AddListView(tooltypelist
,1)) {
561 if (tooltypegads
=addreqgadgets(&icon_req
,iconinfo_tooltype_gadgets
))
562 tooltype_buf
=((struct StringInfo
*)tooltypegads
->SpecialInfo
)->Buffer
;
564 else tooltypelist
=NULL
;
569 RefreshRequesterObject(&icon_req
,NULL
);
570 RefreshGList(window
->FirstGadget
,window
,NULL
,-1);
571 if (tooltypegads
) offttgads(window
,tooltypegads
);
574 while (msg
=(struct IntuiMessage
*)GetMsg(window
->UserPort
)) {
576 (view
=ListViewIDCMP(tooltypelist
,msg
))==(struct DOpusListView
*)-1) {
583 if (class==IDCMP_GADGETUP
|| class==IDCMP_GADGETDOWN
)
584 gadgetid
=((struct Gadget
*)msg
->IAddress
)->GadgetID
;
585 ReplyMsg((struct Message
*)msg
);
588 case IDCMP_CLOSEWINDOW
:
592 case IDCMP_MOUSEBUTTONS
:
593 if (code
==SELECTDOWN
) {
594 if (x
>=icon_rec
.MinX
&& x
<=icon_rec
.MaxX
&&
595 y
>=icon_rec
.MinY
&& y
<=icon_rec
.MaxY
) {
597 compflag
= 1 - compflag
;
598 drawicon(window
,dobj
,compflag
,&icon_rec
);
604 if (protectbitgads
) {
608 if (code
==protect_keys
[a
]) {
609 gad
->Flags
^=SELECTED
;
610 RefreshGList(gad
,window
,NULL
,1);
630 switch (ITEMNUM(code
)) {
647 if (ttcount
>0 && curtt
>-1 && curtt
<ttcount
&& tooltypelist
) {
649 if (ttcount
>1 && !(tttemp
=AllocMem(ttcount
*sizeof(APTR
),MEMF_CLEAR
)))
651 if (ttarray
[curtt
]) FreeMem(ttarray
[curtt
],strlen(ttarray
[curtt
])+1);
657 if (curtt
>0) CopyMem((char *)ttarray
,(char *)tttemp
,curtt
*sizeof(APTR
));
658 if (curtt
<(ttcount
-1))
659 CopyMem((char *)&ttarray
[curtt
+1],(char *)&tttemp
[curtt
],
660 (ttcount
-1-curtt
)*sizeof(APTR
));
661 FreeMem(ttarray
,(ttcount
+1)*sizeof(APTR
)); ttarray
=tttemp
;
664 tooltypelist
->items
=ttarray
;
667 RefreshListView(tooltypelist
,1);
669 RefreshGList(tooltypegads
,window
,NULL
,1);
670 offttgads(window
,tooltypegads
);
674 if (!(tooltypegads
->Flags
&GADGDISABLED
)) {
676 RefreshStrGad(tooltypegads
,window
);
678 else if (tooltypelist
) {
679 if (!(tttemp
=AllocMem((ttcount
+2)*sizeof(APTR
),MEMF_CLEAR
))) break;
681 CopyMem((char *)ttarray
,(char *)tttemp
,ttcount
*sizeof(APTR
));
682 FreeMem(ttarray
,(ttcount
+1)*sizeof(APTR
));
686 ttarray
[curtt
]=AllocMem(1,MEMF_CLEAR
);
687 tooltypelist
->items
=ttarray
;
688 RefreshListView(tooltypelist
,1);
689 onttgads(window
,tooltypegads
);
692 ActivateStrGad(tooltypegads
,window
);
696 if (!tooltype_buf
[0]) goto deletettype
;
697 if (curtt
<ttcount
&& ttarray
) {
698 if (ttarray
[curtt
]) FreeMem(ttarray
[curtt
],strlen(ttarray
[curtt
])+1);
699 if ((ttarray
[curtt
]=AllocMem(strlen(tooltype_buf
)+1,0)))
700 strcpy(ttarray
[curtt
],tooltype_buf
);
704 RefreshGList(tooltypegads
,window
,NULL
,1);
705 offttgads(window
,tooltypegads
);
706 if (tooltypelist
) RefreshListView(tooltypelist
,1);
711 strcpy(namebuf
,name
);
712 if ((ptr
=strstr(namebuf
,".info"))) *ptr
=0;
714 if ((dobj
->do_Type
==WBTOOL
|| dobj
->do_Type
==WBPROJECT
) &&
716 dobj
->do_StackSize
=atoi(stack_buf
);
717 if (dobj
->do_StackSize
<4096) dobj
->do_StackSize
=4096;
720 if (defaulttoolgad
) {
721 olddeftool
=dobj
->do_DefaultTool
;
722 if (dobj
->do_DefaultTool
=
723 LAllocRemember(&icon_req
.rb_memory
,strlen(defaulttool_buf
)+1,0)) {
725 strcpy(dobj
->do_DefaultTool
,defaulttool_buf
);
731 SetComment(namebuf
,comment_buf
);
734 dobj
->do_ToolTypes
=(STRPTR
*)ttarray
;
735 PutDiskObject(namebuf
,dobj
);
737 if (defaulttoolgad
) dobj
->do_DefaultTool
=olddeftool
;
739 dobj
->do_ToolTypes
=(STRPTR
*)oldtooltypes
;
740 if (protectbitgads
) {
745 if (gad
->Flags
&SELECTED
) {
746 if (protect_flags
[a
]<16) b
&=~protect_flags
[a
];
747 else b
|=protect_flags
[a
];
751 SetProtection(namebuf
,b
);
767 else if (view
&& view
->listid
==0) {
768 a
=view
->itemselected
;
770 if (a
<ttcount
&& ttarray
&& ttarray
[a
] && tooltypegads
) {
772 strcpy(tooltype_buf
,ttarray
[a
]);
773 onttgads(window
,tooltypegads
);
774 ActivateStrGad(tooltypegads
,window
);
778 Wait(1<<window
->UserPort
->mp_SigBit
);
782 for (a
=0;a
<ttcount
;a
++) {
783 if (ttarray
[a
]) FreeMem(ttarray
[a
],strlen(ttarray
[a
])+1);
785 FreeMem(ttarray
,(ttcount
+1)*sizeof(APTR
));
787 if (tooltypelist
) RemoveListView(tooltypelist
,1);
788 if (small
) ClearMenuStrip(window
);
789 CloseRequester(&icon_req
);
790 FreeDiskObject(dobj
);
794 void drawicon(window
,dobj
,selected
,rect
)
795 struct Window
*window
;
796 struct DiskObject
*dobj
;
798 struct Rectangle
*rect
;
800 struct Region
*reg
,*oldreg
;
803 struct Rectangle size
= {0};
809 window
->RPort
, dobj
, NULL
, &size
,
810 ICONDRAWA_Borderless
, TRUE
,
815 w
= size
.MaxX
- size
.MinX
+ 1;
816 h
= size
.MaxY
- size
.MinY
+ 1;
820 x
= ((rect
->MaxX
- rect
->MinX
+ 1) - w
)/2;
821 y
= ((rect
->MaxY
- rect
->MinY
+ 1) - h
)/2;
825 if (reg
=NewRegion()) {
826 OrRectRegion(reg
,rect
);
827 oldreg
=InstallClipRegion(window
->WLayer
,reg
);
829 LayoutIcon(dobj
, window
->WScreen
, TAG_END
);
833 window
->RPort
, dobj
, NULL
,
834 x
+rect
->MinX
, y
+rect
->MinY
, selected
? IDS_SELECTED
: IDS_NORMAL
,
836 ICONDRAWA_Frameless
, TRUE
,
837 ICONDRAWA_Borderless
, TRUE
,
838 ICONDRAWA_EraseBackground
, TRUE
,
841 InstallClipRegion(window
->WLayer
,oldreg
);
846 void offttgads(window
,gads
)
847 struct Window
*window
;
853 DisableGadget(gads
,window
->RPort
,2,1);
854 gads
=gads
->NextGadget
;
858 void onttgads(window
,gads
)
859 struct Window
*window
;
865 EnableGadget(gads
,window
->RPort
,2,1);
866 gads
=gads
->NextGadget
;
878 for (b
=0;b
<i
;b
++) if (str
[b
]==':') { ++b
; f
=1; break; }
879 if (f
==1 && b
==i
) return(0);
880 else if (f
>0) str
[b
]=0;
884 BPTR
getrootlock(lock1
)
889 while ((lock2
=ParentDir(lock1
))) {
898 struct DateStamp
*ds
;
904 char buf
[MAXFILENAMELENGTH
];
906 //kprintf("!!!! getroot(%s)\n", name);
908 lock
= Lock(name
, ACCESS_READ
);
911 //kprintf("Could not get lock in getroot()\n");
915 /* Get lock on root device */
918 lock
= getrootlock(lock
);
920 /* Get the name from lock */
921 success
= NameFromLock(lock
, buf
, MAXFILENAMELENGTH
);
927 //kprintf("Could not get lock for name\n");
931 dl
= LockDosList(LDF_DEVICES
| LDF_VOLUMES
| LDF_READ
);
932 dl
= FindDosEntry(dl
, buf
, LDF_DEVICES
| LDF_VOLUMES
);
936 UnLockDosList(LDF_DEVICES
| LDF_VOLUMES
| LDF_READ
);
937 kprintf("Could not get device list\n");
941 /* Get the volume name */
943 BtoCStr(dl
->dol_Name
, name
, 32);
945 /* Get the volume date */
948 CopyMem(&dl
->dol_misc
.dol_volume
.dol_VolumeDate
, ds
, sizeof (*ds
));
951 UnLockDosList(LDF_DEVICES
| LDF_VOLUMES
| LDF_READ
);
957 struct FileLock
*lock2
;
959 struct DeviceList
*dl
;
962 if (!(lock1
=Lock(name
,ACCESS_READ
))) return(0);
963 lock2
=(struct FileLock
*) BADDR(lock1
);
964 for (a
=0;a
<32;a
++) name
[a
]=0;
965 dl
=(struct DeviceList
*)BADDR(lock2
->fl_Volume
);
966 p
=(char *) BADDR(dl
->dl_Name
);
967 if (p
) LStrnCpy(name
,p
+1,*p
);
968 if (ds
) CopyMem((char *)&dl
->dl_VolumeDate
,(char *)ds
,sizeof(struct DateStamp
));