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 char * __regargs
getstringcopy(const char *str
)
37 //D(bug("getstringcopy(%s)\n",str);
38 if (str
&& (newstr
=AllocMem(strlen(str
)+1,0)))
43 void __regargs
freestring(char *str
)
45 if (str
) FreeMem(str
,strlen(str
)+1);
48 int __regargs
writestring(BPTR file
,char *string
)
55 if ((Write(file
,string
,b
))<b
) return(0);
57 else Write(file
,&nl
,1);
61 int __regargs
readline(char *buf
,int pos
,char *buf1
,int size
)
65 for (a
=0;a
<4096;a
++) {
66 if (size
==pos
|| buf
[pos
]==0) {
68 if (size
==pos
) return(-1);
78 void __regargs
DoAssignDrive(struct ConfigStuff
*cstuff
,int drv
,char *name
,char *path
)
80 struct Config
*config
;
82 if (!(config
=cstuff
->config
)) return;
83 if (name
!=(char *)-1) {
84 if (!name
) config
->drive
[drv
].name
[0]=0;
85 else LStrCpy(config
->drive
[drv
].name
,name
);
87 if (path
!=(char *)-1) {
88 freestring(config
->drive
[drv
].function
);
89 config
->drive
[drv
].function
=NULL
;
90 if (path
&& path
[0]) config
->drive
[drv
].function
=getstringcopy(path
);
94 void __regargs
linkinnewfiletype(struct ConfigStuff
*cstuff
,struct dopusfiletype
*temp
)
96 struct dopusfiletype
*pos
;
99 if (!(pos
=cstuff
->firsttype
)) cstuff
->firsttype
=temp
;
102 if (LStrCmp(pos
->next
->type
,"Default")==0) {
103 temp
->next
=pos
->next
;
112 int __saveds
DoReadConfig(register char *name
__asm("a0"),register struct ConfigStuff
*cstuff
__asm("a1"))
115 int a
,size
,pos
,b
,bk
,gad
,mv
;
117 char *cbuf
,*buf
,*tbuf
,buf2
[102],buf3
[102];
118 struct dopusfiletype
*newtype
;
119 struct olddopusfiletype otype
;
120 struct dopusgadgetbanks
*bank
=NULL
,*temp
;
121 struct Config
*config
;
122 struct DOpusRemember
*key
;
123 struct dopusfunction
*tempfunc
;
124 struct dopusdrive
*driveptr
;
125 struct dopushotkey
*hotkey
,*curhotkey
=NULL
;
127 if (!(config
=cstuff
->config
)) return(-1);
129 //D(bug("DoReadConfig:begin\n"));
130 DoFreeConfig(cstuff
);
131 if (DoCheckExist(name
,&size
)>=0) return(ERROR_OBJECT_NOT_FOUND
);
132 //D(bug("DoReadConfig:1\n"));
133 size
-=sizeof(struct Config
);
134 if (!(in
=Open(name
,MODE_OLDFILE
))) return(IoErr());
135 //D(bug("DoReadConfig:2\n"));
136 if ((Read(in
,(char *)&ver
,2))<2 || (Read(in
,(char *)&mag
,2))<2 ||
137 mag
!=CONFIG_MAGIC
|| ver
==0xde) {
138 if (mag
==CONFIG_MAGIC
&& ver
==0xde) {
139 struct DOpusSimpleRequest req
;
143 req
.text
=string_table
[STR_CONFIG_TOO_OLD
];
144 gads
[0]=string_table
[STR_CONTINUE
]; gads
[1]=NULL
;
148 req
.hi
=-1; req
.lo
=-1;
149 req
.fg
=-1; req
.bg
=-1;
151 req
.flags
=SRF_BORDERS
;
152 req
.font
=GfxBase
->DefaultFont
;
153 req
.title
=string_table
[STR_REQUEST
];
155 DoDoSimpleRequest(NULL
,&req
);
158 //D(bug("DoReadConfig:3\n"));
159 return(ERROR_NOT_CONFIG
);
161 Seek(in
,0,OFFSET_BEGINNING
);
162 if ((Read(in
,(char *)config
,sizeof(struct Config
)))<sizeof(struct Config
)) {
164 //D(bug("DoReadConfig:4\n"));
167 //D(bug("DoReadConfig:7\n"));
168 if (config
->version
<CONFIG_CHANGE_DISPLAY
) {
171 config
->displaypos
[a
][b
]=config
->old_displaypos
[a
][b
];
172 config
->displaylength
[a
][b
]=(config
->old2_displaylength
[a
][b
])*8;
173 config
->old_displaypos
[a
][b
]=0;
174 config
->old2_displaylength
[a
][b
]=0;
177 config
->displaypos
[a
][b
]=-1;
178 config
->displaylength
[a
][b
]=0;
182 else if (config
->version
<CONFIG_BIG_DISPLEN
) {
185 config
->displaylength
[a
][b
]=(config
->old_displaylength
[a
][b
])*8;
186 config
->old_displaylength
[a
][b
]=0;
191 if (config
->version
<CONFIG_CHANGE_CONFIGXY
) {
196 if (config
->version
<CONFIG_CHANGE_DIMENS
) {
197 config
->scr_winx
=config
->wbwinx
;
198 config
->scr_winy
=config
->wbwiny
;
199 config
->scr_winw
=config
->scrw
;
200 config
->scr_winh
=config
->scrh
;
201 config
->pubscreen_name
[0]=0;
204 if (config
->version
<CONFIG_NEW_SLIDERS
) {
205 config
->slider_pos
=1;
208 if (config
->version
<=OLD_CONFIG_VERSION
) {
210 config
->dateformat
=1;
212 for (b
=0;b
<5;b
++) config
->displaypos
[a
][b
]=b
;
213 for (b
=5;b
<16;b
++) config
->displaypos
[a
][b
]=-1;
214 config
->displaylength
[a
][DISPLAY_NAME
]=32*8;
215 config
->displaylength
[a
][DISPLAY_COMMENT
]=40*8;
216 config
->displaylength
[a
][DISPLAY_FILETYPE
]=16*8;
217 config
->displaylength
[a
][DISPLAY_OWNER
]=16*8;
218 config
->displaylength
[a
][DISPLAY_GROUP
]=16*8;
219 config
->sortmethod
[a
]=0;
220 config
->separatemethod
[a
]=1;
223 config
->scrclktype
=SCRCLOCK_MEMORY
|SCRCLOCK_DATE
|SCRCLOCK_TIME
;
224 if (config
->icontype
==3) config
->icontype
=ICON_NOWINDOW
;
225 else config
->icontype
=0;
226 config
->icontype
|=ICON_MEMORY
|ICON_DATE
|ICON_TIME
;
227 config
->showfree
=1<<config
->showfree
;
228 config
->hotkeyqual
=config
->hotkeycode
&0xff;
229 config
->hotkeycode
>>=8;
230 config
->stringfgcol
=1; config
->stringbgcol
=0;
231 config
->stringselfgcol
=1; config
->stringselbgcol
=0;
233 if (config
->version
<=CONFIG_CHANGE_PALETTE
) {
234 for (a
=0,b
=0;a
<16;a
++) {
235 config
->new_palette
[b
++]=(((config
->Palette
[a
]>>8)&0xf)<<28)|0x0fffffff;
236 config
->new_palette
[b
++]=(((config
->Palette
[a
]>>4)&0xf)<<28)|0x0fffffff;
237 config
->new_palette
[b
++]=((config
->Palette
[a
]&0xf)<<28)|0x0fffffff;
240 if (config
->version
<=CONFIG_CHANGE_BUFCOUNT
) {
242 if (config
->bufcount
<1) config
->bufcount
=1;
244 if (config
->version
<CONFIG_LESS_DODRIVES
) {
245 if (!(tempfunc
=AllocMem(sizeof(struct dopusfunction
)*DRIVECOUNT
,MEMF_CLEAR
))) {
247 //D(bug("DoReadConfig:5\n"));
248 return(ERROR_NO_FREE_STORE
);
250 driveptr
=(struct dopusdrive
*)config
->drive
;
251 for (a
=0;a
<OLDDRIVECOUNT
;a
++) {
252 LStrCpy(tempfunc
[a
].name
,driveptr
[a
].name
);
253 tempfunc
[a
].key
=driveptr
[a
].key
;
254 tempfunc
[a
].qual
=driveptr
[a
].qual
;
255 tempfunc
[a
].fpen
=driveptr
[a
].fpen
;
256 tempfunc
[a
].bpen
=driveptr
[a
].bpen
;
257 tempfunc
[a
].function
=getstringcopy(driveptr
[a
].path
);
259 for (a
=OLDDRIVECOUNT
;a
<DRIVECOUNT
;a
++) tempfunc
[a
].fpen
=3;
260 CopyMem((char *)tempfunc
,(char *)driveptr
,sizeof(struct dopusfunction
)*DRIVECOUNT
);
261 FreeMem(tempfunc
,sizeof(struct dopusfunction
)*DRIVECOUNT
);
263 if (config
->version
<=CONFIG_CHANGE_DOSREQ
) {
264 config
->errorflags
^=1;
265 config
->hotkeyflags
=0;
266 config
->pad3
=config
->pad4
=config
->pad8
=0;
268 for (a
=0;a
<2;a
++) config
->pad7
[a
]=0;
269 for ( a
= 0; a
< 224; a
++ ) config
->morepadding
[a
] = 0;
271 for (a=0;a<2;a++) config->pad5[a]=config->pad7[a]=0;
272 for (a=0;a<232;a++) config->morepadding[a]=0;
275 config
->scrollborders
[a
].MinX
=~0;
276 config
->scrollborders
[a
].MaxX
=~0;
277 config
->scrollborders
[a
].MinY
=~0;
278 config
->scrollborders
[a
].MaxY
=~0;
280 config
->generalscreenflags
=2;
282 if (config
->version
<=CONFIG_NEW_FUNCTIONS
) {
283 for (a
=0;a
<MENUCOUNT
;a
++) {
284 LStrCpy(buf2
,(char *)&config
->menu
[a
]);
285 config
->menu
[a
].name
=getstringcopy(buf2
);
286 config
->menu
[a
].pad2
[0]=0;
287 config
->menu
[a
].pad2
[1]=0;
288 config
->menu
[a
].pad2
[2]=0;
291 if (config
->version
<=CONFIG_CHANGE_ARROWS
)
292 for (a
=0;a
<3;a
++) config
->arrowsize
[a
]=8;
293 if (config
->version
<=CONFIG_CHANGE_EXTERN
) {
294 // HUX for (a=0;a<80;a++) config->pad5a[a]=config->configreturnscript[a]=0;
295 for (a
=0;a
<397;a
++) config
->pad9a
[a
]=0;
296 config
->loadexternal
=0;
299 if (!(cbuf
=(char *)DoAllocRemember(&key
,size
,MEMF_CLEAR
)) ||
300 !(buf
=(char *)DoAllocRemember(&key
,4096,MEMF_CLEAR
)) ||
301 !(tbuf
=(char *)DoAllocRemember(&key
,256,MEMF_CLEAR
))) {
303 DoFreeRemember(&key
);
304 //D(bug("DoReadConfig:6\n"));
305 return(ERROR_NO_FREE_STORE
);
309 for (a
=0;a
<MENUCOUNT
;a
++) {
310 config
->menu
[a
].function
=NULL
;
311 if (config
->version
>CONFIG_NEW_FUNCTIONS
) config
->menu
[a
].name
=NULL
;
313 if (config
->version
>OLD_CONFIG_VERSION
) {
314 for (a
=0;a
<DRIVECOUNT
;a
++) config
->drive
[a
].function
=NULL
;
317 //D(bug("DoReadConfig:8\n"));
319 for (a
=0;a
<MENUCOUNT
;a
++) {
320 pos
=readline(cbuf
,pos
,buf
,size
);
321 if (buf
[0]) DoAssignMenu(cstuff
,a
,(char *)-1,buf
);
322 if (pos
==-1) goto endthis
;
324 if (config
->version
>CONFIG_NEW_FUNCTIONS
) {
325 for (a
=0;a
<MENUCOUNT
;a
++) {
326 pos
=readline(cbuf
,pos
,buf
,size
);
327 if (buf
[0]) DoAssignMenu(cstuff
,a
,buf
,(char *)-1);
328 if (pos
==-1) goto endthis
;
331 //D(bug("DoReadConfig:9\n"));
332 if (config
->version
>OLD_CONFIG_VERSION
) {
333 for (a
=0;a
<DRIVECOUNT
;a
++) {
334 pos
=readline(cbuf
,pos
,buf
,size
);
335 if (buf
[0]) DoAssignDrive(cstuff
,a
,(char *)-1,buf
);
336 if (pos
==-1) goto endthis
;
340 for (a
=0;a
<ARCHIVECOUNT
;a
++) pos
=readline(cbuf
,pos
,buf
,size
);
344 if (pos
>=size
|| pos
==-1) break;
345 if (cbuf
[pos
]==5 && cbuf
[pos
+1]=='H') {
347 if ((pos
+sizeof(struct dopushotkey
))>=size
) break;
348 if ((hotkey
=AllocMem(sizeof(struct dopushotkey
),MEMF_CLEAR
))) {
349 CopyMem((char *)&cbuf
[pos
],(char *)hotkey
,sizeof(struct dopushotkey
));
350 hotkey
->func
.function
=NULL
;
353 pos
+=sizeof(struct dopushotkey
);
354 if ((pos
=readline(cbuf
,pos
,buf
,size
))==-1) break;
356 hotkey
->func
.function
=getstringcopy(buf
);
357 if (curhotkey
) curhotkey
->next
=hotkey
;
358 else cstuff
->firsthotkey
=hotkey
;
362 else if (cbuf
[pos
]==6 && cbuf
[pos
+1]=='F') {
364 if ((pos
+sizeof(struct wr_dopusfiletype
))>=size
) break;
365 if ((newtype
=(struct dopusfiletype
*)
366 DoAllocRemember(&cstuff
->typekey
,sizeof(struct dopusfiletype
),MEMF_CLEAR
))) {
367 CopyMem((char *)&cbuf
[pos
],(char *)newtype
,sizeof(struct wr_dopusfiletype
));
368 if (config
->version
<=CONFIG_CHANGE_FTYPE
) {
370 newtype
->typeid[0]=0;
372 pos
+=sizeof(struct wr_dopusfiletype
);
373 newtype
->recognition
=NULL
;
374 for (a
=0;a
<FILETYPE_FUNCNUM
;a
++) newtype
->function
[a
]=NULL
;
375 if ((pos
=readline(cbuf
,pos
,buf
,size
))==-1) break;
376 if ((newtype
->recognition
=DoAllocRemember(&cstuff
->typekey
,strlen(buf
)+1,0)))
377 LStrCpy(newtype
->recognition
,buf
);
378 for (a
=0;a
<FILETYPE_FUNCNUM
;a
++) {
379 if ((pos
=readline(cbuf
,pos
,buf
,size
))==-1) break;
380 if ((newtype
->function
[a
]=DoAllocRemember(&cstuff
->typekey
,strlen(buf
)+1,0)))
381 LStrCpy(newtype
->function
[a
],buf
);
383 newtype
->iconpath
=NULL
;
384 if (config
->version
>CONFIG_CHANGE_FILETYPE
) {
385 pos
=readline(cbuf
,pos
,buf
,size
);
386 if (buf
[0] && (newtype
->iconpath
=DoAllocRemember(&cstuff
->typekey
,strlen(buf
)+1,0)))
387 LStrCpy(newtype
->iconpath
,buf
);
389 linkinnewfiletype(cstuff
,newtype
);
392 else if (cbuf
[pos
]==1 && cbuf
[pos
+1]=='F') {
394 if ((pos
+sizeof(struct olddopusfiletype
))>=size
) break;
395 if ((newtype
=(struct dopusfiletype
*)
396 DoAllocRemember(&cstuff
->typekey
,sizeof(struct dopusfiletype
),MEMF_CLEAR
))) {
397 CopyMem((char *)&cbuf
[pos
],(char *)&otype
,sizeof(struct olddopusfiletype
));
398 pos
+=sizeof(struct olddopusfiletype
);
399 LStrnCpy(newtype
->type
,otype
.type
,32);
401 newtype
->typeid[0]=0;
402 for (a
=0;a
<FILETYPE_FUNCNUM
;a
++) newtype
->function
[a
]=NULL
;
404 LStrnCpy(newtype
->actionstring
[a
],otype
.actionstring
[a
],39);
405 newtype
->actionstring
[a
][39]=0;
406 newtype
->which
[a
]=otype
.which
[a
];
407 newtype
->stack
[a
]=otype
.stack
[a
];
408 newtype
->pri
[a
]=otype
.pri
[a
];
409 newtype
->delay
[a
]=otype
.delay
[a
];
411 for (a
=4;a
<FILETYPE_FUNCNUM
;a
++) {
412 newtype
->stack
[a
]=4000;
416 if ((pos
=readline(cbuf
,pos
,buf
,size
))==-1) break;
417 if ((newtype
->function
[a
]=DoAllocRemember(&cstuff
->typekey
,strlen(buf
)+1,MEMF_CLEAR
)))
418 LStrCpy(newtype
->function
[a
],buf
);
421 if (otype
.filepat
[0])
422 LSprintf(buf
,"%lc%s%lc",FTYC_MATCHNAME
,otype
.filepat
,
423 ((otype
.recogchars
[0])?((otype
.and)?FTYC_AND
:FTYC_OR
):FTYC_ENDSECTION
));
424 if (otype
.recogchars
[0]) {
426 for (a
=0;a
<100;a
++) {
427 if (!otype
.recogchars
[a
] || otype
.recogchars
[a
]==',') {
430 if ((b
=DoAtoh(buf2
,0))>0) {
431 LSprintf(buf3
,"%lc%ld%lc",FTYC_MOVETO
,b
,FTYC_ENDSECTION
);
432 DoStrConcat(buf
,buf3
,4096);
437 LSprintf(buf3
,"%lc$%s%lc",FTYC_MATCH
,buf2
,FTYC_AND
);
438 DoStrConcat(buf
,buf3
,4096);
441 if (!otype
.recogchars
[a
]) break;
445 if (mv
==1 && otype
.recogchars
[a
]=='.') {
446 buf2
[b
++]='?'; buf2
[b
++]='?';
448 else buf2
[b
++]=otype
.recogchars
[a
];
452 if (buf
[b
-1]==(char)FTYC_AND
) buf
[b
-1]=0;
454 if ((newtype
->recognition
=DoAllocRemember(&cstuff
->typekey
,strlen(buf
)+1,MEMF_CLEAR
)))
455 LStrCpy(newtype
->recognition
,buf
);
456 linkinnewfiletype(cstuff
,newtype
);
459 else if ((cbuf
[pos
]==2 || cbuf
[pos
]==3) && cbuf
[pos
+1]=='G') {
462 b
=sizeof(struct olddopusgadget
)*GADCOUNT
;
466 b
=sizeof(struct newdopusfunction
)*GADCOUNT
;
469 if ((pos
+b
)>=size
) break;
471 if (!(temp
=AllocMem(sizeof(struct dopusgadgetbanks
),MEMF_CLEAR
))) goto endthis
;
472 if (!cstuff
->firstbank
) cstuff
->firstbank
=temp
;
473 else bank
->next
=temp
;
476 CopyMem((char *)&cbuf
[pos
],(char *)bank
->gadgets
,sizeof(struct newdopusfunction
)*GADCOUNT
);
477 pos
+=(sizeof(struct newdopusfunction
)*GADCOUNT
);
480 for (a
=0;a
<GADCOUNT
;a
++) {
481 CopyMem((char *)&cbuf
[pos
],(char *)&bank
->gadgets
[a
],10);
482 CopyMem((char *)&cbuf
[pos
+10],(char *)&bank
->gadgets
[a
].which
,16);
483 pos
+=sizeof(struct olddopusgadget
);
486 for (gad
=0;gad
<GADCOUNT
;gad
++) {
487 bank
->gadgets
[gad
].function
=NULL
;
490 pos
=readline(cbuf
,pos
,buf
,size
);
491 DoAssignGadget(cstuff
,bk
,gad
,(char *)-1,buf
);
494 if (config
->version
>CONFIG_NEW_FUNCTIONS
) {
495 for (gad
=0;gad
<GADCOUNT
;gad
++) {
496 bank
->gadgets
[gad
].name
=NULL
;
499 pos
=readline(cbuf
,pos
,buf
,size
);
500 DoAssignGadget(cstuff
,bk
,gad
,buf
,(char *)-1);
505 for (gad
=0;gad
<GADCOUNT
;gad
++) {
506 LStrCpy(buf
,(char *)&bank
->gadgets
[gad
]);
507 bank
->gadgets
[gad
].name
=getstringcopy(buf
);
508 bank
->gadgets
[gad
].pad2
[0]=0;
509 bank
->gadgets
[gad
].pad2
[1]=0;
510 bank
->gadgets
[gad
].pad2
[2]=0;
516 //D(bug("pos = $%lx\n",pos++));
520 DoFreeRemember(&key
);
522 if (config
->version
< CONFIG_USERAW0_HOTKEY
)
524 for (a
= 0; a
< MENUCOUNT
; a
++) if (config
->menu
[a
].key
== 0) config
->menu
[a
].key
= 0xff;
525 for (a
= 0; a
< DRIVECOUNT
; a
++) if (config
->drive
[a
].key
== 0) config
->drive
[a
].key
= 0xff;
526 for (bank
= cstuff
->firstbank
; bank
; bank
= bank
->next
)
527 for (a
= 0; a
< GADCOUNT
; a
++) if (bank
->gadgets
[a
].key
== 0) bank
->gadgets
[a
].key
= 0xff;
529 LStrCpy(config
->autodirs
[1],config
->autodirs
[0]+30);
532 cstuff
->curbank
=cstuff
->firstbank
;
533 //D(bug("DoReadConfig:end\n");Delay(50));
537 int __saveds
DoSaveConfig(register char *name
__asm("a0"), register struct ConfigStuff
*cstuff
__asm("a1"))
541 struct dopusfiletype
*type
;
542 struct dopushotkey
*hotkey
;
543 struct dopusgadgetbanks
*bank
;
544 struct Config
*config
;
546 if (!(config
=cstuff
->config
)) return(0);
548 config
->version
=CONFIG_VERSION
;
549 config
->magic
=CONFIG_MAGIC
;
551 if (!(out
=Open(name
,MODE_NEWFILE
))) return(FALSE
);
552 if ((Write(out
,(char *)config
,sizeof(struct Config
)))<sizeof(struct Config
)) {
556 for (a
=0;a
<MENUCOUNT
;a
++)
557 if (!writestring(out
,config
->menu
[a
].function
)) goto error
;
558 for (a
=0;a
<MENUCOUNT
;a
++)
559 if (!writestring(out
,config
->menu
[a
].name
)) goto error
;
560 for (a
=0;a
<DRIVECOUNT
;a
++)
561 if (!writestring(out
,config
->drive
[a
].function
)) goto error
;
563 type
=cstuff
->firsttype
;
565 if ((Write(out
,"\006F",2))<2) goto error
;
566 if ((Write(out
,(char *)type
,sizeof(struct wr_dopusfiletype
)))<sizeof(struct wr_dopusfiletype
))
568 if (!writestring(out
,type
->recognition
)) goto error
;
569 for (a
=0;a
<FILETYPE_FUNCNUM
;a
++)
570 if (!writestring(out
,type
->function
[a
])) goto error
;
571 if (!writestring(out
,type
->iconpath
)) goto error
;
574 bank
=cstuff
->firstbank
;
576 if ((Write(out
,"\003G",2))<2) goto error
;
577 if ((Write(out
,(char *)bank
->gadgets
,sizeof(struct dopusfunction
)*GADCOUNT
))<
578 sizeof(struct dopusfunction
)*GADCOUNT
) goto error
;
579 for (a
=0;a
<GADCOUNT
;a
++)
580 if (!writestring(out
,bank
->gadgets
[a
].function
)) goto error
;
581 for (a
=0;a
<GADCOUNT
;a
++)
582 if (!writestring(out
,bank
->gadgets
[a
].name
)) goto error
;
585 hotkey
=cstuff
->firsthotkey
;
587 if ((Write(out
,"\005H",2))<2) goto error
;
588 if ((Write(out
,(char *)hotkey
,sizeof(struct dopushotkey
)))<sizeof(struct dopushotkey
))
590 if (!writestring(out
,hotkey
->func
.function
)) goto error
;
599 struct DefaultGadFlag
{
606 const static ULONG defaultpalette
[48]={
607 0xafffffff,0xafffffff,0xafffffff,
608 0x00000000,0x00000000,0x00000000,
609 0xffffffff,0xffffffff,0xffffffff,
610 0x0fffffff,0x5fffffff,0xbfffffff,
611 0xefffffff,0xafffffff,0x4fffffff,
612 0x7fffffff,0x00000000,0x7fffffff,
613 0xffffffff,0xffffffff,0x00000000,
614 0xcfffffff,0x2fffffff,0x00000000,
615 0xffffffff,0x8fffffff,0x00000000,
616 0xffffffff,0x00000000,0xffffffff,
617 0x9fffffff,0x6fffffff,0x3fffffff,
618 0x00000000,0xffffffff,0x9fffffff,
619 0x4fffffff,0xffffffff,0x3fffffff,
620 0x00000000,0x00000000,0x00000000,
621 0xffffffff,0xffffffff,0xffffffff,
622 0x2fffffff,0x5fffffff,0x9fffffff};
626 "All","Copy","Makedir","Hunt","Run","Comment","Read",
627 "None","Move","Assign","Search","","Datestamp","Hex Read",
628 "Parent","Rename","Check Fit","","","Protect","Show",
629 "Root","","GetSizes","","","Icon Info","Play",
630 "","","","","","Arc Ext","Edit",
631 "","DELETE","","","","Encrypt","Print"},
633 "Toggle","Copy As","","","","","ANSI Read",
634 "","Move As","","","","","",
635 "","Clone","","","","","",
636 "","","ClearSizes","","","Add Icon","Loop Play",
637 "","","","","","","New File"},
639 "*All","*Copy","*Makedir","*Hunt","*Run","*Comment","*Read",
640 "*None","*Move","*Assign","*Search","","*Datestamp","*HexRead",
641 "*Parent","*Rename","*CheckFit","","","*Protect","*Show",
642 "*Root","","*GetSizes","","","*IconInfo","*Play",
643 "","","","","","*User1","SYS:Tools/Editor {f}",
644 "","*DELETE","","","","*Encrypt","*Print"},
646 "*Toggle","*CopyAs","","","","","*ANSIRead",
647 "","*MoveAs","","","","","",
648 "","*Clone","","","","","",
649 "","","*ClearSizes","","","*AddIcon","*LoopPlay",
650 "","","","","","","SYS:Tools/Editor {RsEnter filename to create new file:Untitled}"},
653 "Current dir~","Help!","Error help~",
654 "Configure~","About",
655 "Version~","Iconify","Button Iconify","Quit"},
657 "*CD","*Help","*ErrorHelp",
658 "*Configure","*About",
659 "*Version","*Iconify","*ButtonIconify","*Quit"},
661 "Disk copy","Format","Install~","Relabel","Print dir","Disk info~",
662 "LHA add","Arc add","Zoo add"},
664 "*Diskcopy","*Format","*Install","*Relabel","*PrintDir","*DiskInfo",
665 "LHA -x a \"{d}{RsEnter LHA archive name}\" {O}",
666 "Arc a \"{d}{RsEnter Arc archive name}\" {O}",
667 "Zoo a \"{d}{RsEnter Zoo archive name}\" {O}"},
670 "LHA archive","ARC archive","ZOO archive","Icon","Default"},
672 "LHA","ARC","ZOO","ICON","DEFAULT"},
677 "\001$E310\376\002*.info",
679 *deftype_funcs
[5][4]={
680 {"LHA v {f}","LHA -x -M x {f}","LHA v {f}","LHA -x -M x {f}"},
681 {"Arc v {f}","Arc x {f}","Arc v {f}","Arc x {f}"},
682 {"Zoo v {f}","Zoo x// {f}","Zoo v {f}","Zoo x// {f}"},
683 {"*IconInfo",NULL
,NULL
,NULL
},
684 {"*SmartRead","*Copy",NULL
,NULL
}},
685 deftype_funcpos
[5][4]={
686 {FTFUNC_DOUBLECLICK
,FTFUNC_CLICKMCLICK
,FTFUNC_READ
,FTFUNC_AUTOFUNC1
},
687 {FTFUNC_DOUBLECLICK
,FTFUNC_CLICKMCLICK
,FTFUNC_READ
,FTFUNC_AUTOFUNC1
},
688 {FTFUNC_DOUBLECLICK
,FTFUNC_CLICKMCLICK
,FTFUNC_READ
,FTFUNC_AUTOFUNC1
},
689 {FTFUNC_DOUBLECLICK
},
690 {FTFUNC_DOUBLECLICK
,FTFUNC_CLICKMCLICK
}},
691 *deftype_action
[5][4]={
692 {"Listing LHA archive...","Extracting files from LHA archive...",
693 "Listing LHA archive...","Extracting files from LHA archive..."},
694 {"Listing Arc archive...","Extracting files from Arc archive...",
695 "Listing Arc archive...","Extracting files from Arc archive..."},
696 {"Listing Zoo archive...","Extracting files from Zoo archive...",
697 "Listing Zoo archive...","Extracting files from Zoo archive..."},
698 {"Examining icon..."},
699 {"Reading file...","Copying file..."}},
700 deftype_delay
[5][4]={
708 defmenkeys1
[10]={0xff,0x5f,0xff,0x33,0xff,0xff,0xff,0x17,0xff,0x10},
709 defmenqual1
[10]={0,0,0,0x80,0,0,0,0x80,0,0x80},
710 defmenkeys2
[9]={0x22,0x23,0x36,0xff,0xff,0xff,0xff,0xff,0xff},
711 defmenqual2
[9]={0x80,0x80,0x80,0,0,0,0,0,0};
713 const static struct DefaultGadFlag
715 {0x20,IEQUALIFIER_CONTROL
,6,3},
716 {0x33,IEQUALIFIER_CONTROL
,6,5},
717 {0x37,IEQUALIFIER_CONTROL
,5,4},
718 {0x25,IEQUALIFIER_CONTROL
|IEQUALIFIER_LSHIFT
,4,1},
719 {0x16,IEQUALIFIER_CONTROL
,1,4},
720 {0x33,IEQUALIFIER_CONTROL
|IEQUALIFIER_LSHIFT
,5,0},
721 {0x13,IEQUALIFIER_CONTROL
,6,7},
723 {0x36,IEQUALIFIER_CONTROL
,6,3},
724 {0x37,IEQUALIFIER_CONTROL
|IEQUALIFIER_LSHIFT
,6,5},
726 {0x21,IEQUALIFIER_CONTROL
|IEQUALIFIER_LSHIFT
,4,1},
728 {0x22,IEQUALIFIER_CONTROL
,5,0},
729 {0x25,IEQUALIFIER_CONTROL
,6,7},
731 {0x19,IEQUALIFIER_CONTROL
,6,3},
732 {0x13,IEQUALIFIER_CONTROL
|IEQUALIFIER_LSHIFT
,6,5},
733 {0x23,IEQUALIFIER_CONTROL
,5,4},
736 {0x14,IEQUALIFIER_CONTROL
,5,0},
737 {0x21,IEQUALIFIER_CONTROL
,6,7},
739 {0x18,IEQUALIFIER_CONTROL
,6,3},
741 {0x24,IEQUALIFIER_CONTROL
,5,4},
744 {0x17,IEQUALIFIER_CONTROL
,5,0},
745 {0x15,IEQUALIFIER_CONTROL
,6,7},
752 {0x12,IEQUALIFIER_CONTROL
,5,0},
753 {0x12,IEQUALIFIER_CONTROL
|IEQUALIFIER_LSHIFT
,6,7},
756 {0x22,IEQUALIFIER_CONTROL
|IEQUALIFIER_LSHIFT
,2,7},
761 {0x19,IEQUALIFIER_CONTROL
|IEQUALIFIER_LSHIFT
,6,7}};
764 deftype_which
[5][4]={
765 {FLAG_DOALL
|FLAG_OUTFILE
,FLAG_SCANDEST
|FLAG_DOALL
|FLAG_CDDEST
|FLAG_OUTWIND
,
766 FLAG_DOALL
|FLAG_OUTFILE
,FLAG_SCANDEST
|FLAG_DOALL
|FLAG_CDDEST
|FLAG_OUTWIND
},
767 {FLAG_DOALL
|FLAG_OUTFILE
,FLAG_SCANDEST
|FLAG_DOALL
|FLAG_CDDEST
|FLAG_OUTWIND
,
768 FLAG_DOALL
|FLAG_OUTFILE
,FLAG_SCANDEST
|FLAG_DOALL
|FLAG_CDDEST
|FLAG_OUTWIND
},
769 {FLAG_DOALL
|FLAG_OUTWIND
,FLAG_SCANDEST
|FLAG_DOALL
|FLAG_CDDEST
|FLAG_OUTWIND
,
770 FLAG_DOALL
|FLAG_OUTWIND
,FLAG_SCANDEST
|FLAG_DOALL
|FLAG_CDDEST
|FLAG_OUTWIND
},
774 int __saveds
DoDefaultConfig(register struct ConfigStuff
*cstuff
__asm("a0"))
777 struct Config
*config
;
778 struct dopusgadgetbanks
*firstbank
;
779 struct dopusfiletype
*type
;
782 if (!(config
=cstuff
->config
)) return(0);
783 DoFreeConfig(cstuff
);
785 if ((DoFindSystemFile("DirectoryOpus.DefCFG",name
,256,SYSFILE_DATA
)) &&
786 (DoReadConfig(name
,cstuff
))==1) return(1);
790 config
->copyflags
=COPY_DATE
|COPY_PROT
|COPY_NOTE
;
791 config
->dateformat
=DATE_DOS
|DATE_SUBST
|DATE_12HOUR
;
792 config
->existflags
=REPLACE_ASK
;
793 config
->deleteflags
=DELETE_ASK
;
794 config
->errorflags
=ERROR_ENABLE_DOS
|ERROR_ENABLE_OPUS
;
795 config
->generalflags
=GENERAL_DRAG
|GENERAL_DOUBLECLICK
|GENERAL_ACTIVATE
;
796 config
->iconflags
=ICONFLAG_MAKEDIRICON
|ICONFLAG_DOUNTOICONS
;
799 for (i
=0;i
<5;i
++) config
->displaypos
[h
][i
]=i
;
800 for (i
=5;i
<16;i
++) config
->displaypos
[h
][i
]=-1;
801 config
->displaylength
[h
][DISPLAY_NAME
]=32*8;
802 config
->displaylength
[h
][DISPLAY_COMMENT
]=40*8;
803 config
->displaylength
[h
][DISPLAY_FILETYPE
]=16*8;
804 config
->displaylength
[h
][DISPLAY_OWNER
]=16*8;
805 config
->displaylength
[h
][DISPLAY_GROUP
]=16*8;
806 config
->sortmethod
[h
]=0;
807 config
->separatemethod
[h
]=1;
810 config
->formatflags
=0;
812 config
->dynamicflags
=UPDATE_FREE
|UPDATE_SCROLL
|UPDATE_LEFTJUSTIFY
|UPDATE_PROGRESSINDICATOR
|UPDATE_REDRAW
;
816 LStrCpy(config
->outputcmd
,"NewCLI");
817 LStrCpy(config
->output
,"CON:20/10/600/180/Directory Opus Output");
818 LStrCpy(config
->shellstartup
,"Shell-Startup");
821 config
->icontype
=ICON_MEMORY
|ICON_DATE
|ICON_TIME
;
822 config
->scrclktype
=SCRCLOCK_MEMORY
|SCRCLOCK_DATE
|SCRCLOCK_TIME
;
825 config
->dirflags
=DIRFLAGS_FINDEMPTY
|DIRFLAGS_REREADOLD
|
826 DIRFLAGS_SMARTPARENT
|DIRFLAGS_CHECKBUFS
|
827 DIRFLAGS_AUTODISKC
|DIRFLAGS_AUTODISKL
;
828 config
->showfree
=SHOWFREE_KILO
;
830 config
->hotkeycode
=(UWORD
)~0;
831 config
->hotkeyqual
=IEQUALIFIER_CONTROL
|IEQUALIFIER_LSHIFT
|IEQUALIFIER_LALT
;
832 config
->hotkeyflags
=0;
834 config
->toolicon
[0]=0;
835 config
->projecticon
[0]=0;
836 config
->drawericon
[0]=0;
837 config
->defaulttool
[0]=0;
838 config
->addiconflags
=0;
840 config
->loadexternal
=0;
841 config
->language
[0]=0;
844 config
->showpat
[0]=0;
845 config
->hidepat
[0]=0;
846 config
->showpatparsed
[0]=0;
847 config
->hidepatparsed
[0]=0;
849 config
->autodirs
[0][0]=0;
850 config
->autodirs
[1][0]=0;
851 config
->startupscript
[0]=0;
852 config
->uniconscript
[0]=0;
853 config
->configreturnscript
[0]=0;
855 config
->viewbits
=VIEWBITS_SHOWBLACK
|VIEWBITS_TEXTBORDERS
;
863 config
->arrowpos
[a
]=2;
864 config
->arrowsize
[a
]=8;
866 config
->sliderwidth
=10;
867 config
->sliderheight
=7;
868 config
->stringheight
=8;
870 config
->statusfg
=1; config
->statusbg
=0;
871 config
->disknameselfg
=2; config
->disknameselbg
=7;
872 config
->disknamefg
=1; config
->disknamebg
=0;
873 config
->dirsselfg
=2; config
->dirsselbg
=3;
874 config
->dirsfg
=3; config
->dirsbg
=0;
875 config
->filesselfg
=2; config
->filesselbg
=1;
876 config
->filesfg
=1; config
->filesbg
=0;
877 config
->slidercol
=1; config
->sliderbgcol
=0;
878 config
->arrowfg
=1; config
->arrowbg
=0;
879 config
->littlegadfg
=1; config
->littlegadbg
=0;
880 config
->clockfg
=1; config
->clockbg
=0;
881 config
->requestfg
=1; config
->requestbg
=0;
882 config
->gadgettopcol
=2; config
->gadgetbotcol
=1;
883 config
->stringfgcol
=1; config
->stringbgcol
=0;
884 config
->stringselfgcol
=1; config
->stringselbgcol
=4;
886 for (i
=0;i
<NUMFONTS
;i
++) {
887 config
->fontsizes
[i
]=8;
888 LStrCpy(config
->fontbufs
[i
],"topaz.font");
891 config
->generalscreenflags
=SCR_GENERAL_TINYGADS
|
892 SCR_GENERAL_INDICATERMB
|
894 // SCR_GENERAL_NEWLOOKMENU|
895 SCR_GENERAL_WINBORDERS
;
897 CopyMem((char *)defaultpalette
,(char *)config
->new_palette
,sizeof(defaultpalette
));
899 config
->screenmode
=MODE_WORKBENCHCLONE
;
903 config
->screenflags
=0;
912 config
->gadgetrows
=6;
914 config
->iconx
=252; config
->icony
=0;
915 config
->wbwinx
=0; config
->wbwiny
=0;
916 config
->iconbutx
=100; config
->iconbuty
=40;
917 config
->config_x
=-1; config
->config_y
=-1;
920 config
->scrollborders
[a
].MinX
=~0;
921 config
->scrollborders
[a
].MaxX
=~0;
922 config
->scrollborders
[a
].MinY
=~0;
923 config
->scrollborders
[a
].MaxY
=~0;
926 config
->windowdelta
=0;
927 config
->slider_pos
=1;
931 for (i
=0;i
<42;i
++) DoAssignGadget(cstuff
,0,i
,defgads
[i
],deffuncs
[i
]);
932 for (i
=0;i
<35;i
++) DoAssignGadget(cstuff
,0,i
+42,revgads
[i
],revfuncs
[i
]);
933 for (i
=78;i
<GADCOUNT
;i
++) DoAssignGadget(cstuff
,0,i
,NULL
,NULL
);
935 if (firstbank
=cstuff
->firstbank
) {
936 for (i
=0;i
<GADCOUNT
;i
++) {
937 firstbank
->gadgets
[i
].which
=0;
938 firstbank
->gadgets
[i
].type
=0;
939 firstbank
->gadgets
[i
].stack
=4000;
940 firstbank
->gadgets
[i
].pri
=0;
941 firstbank
->gadgets
[i
].delay
=2;
943 firstbank
->gadgets
[i
].key
=default_gadflags
[i
].code
;
944 firstbank
->gadgets
[i
].qual
=default_gadflags
[i
].qual
;
945 firstbank
->gadgets
[i
].fpen
=default_gadflags
[i
].fpen
;
946 firstbank
->gadgets
[i
].bpen
=default_gadflags
[i
].bpen
;
949 firstbank
->gadgets
[i
].fpen
=1;
950 firstbank
->gadgets
[i
].bpen
=0;
952 firstbank
->gadgets
[i
].key
=0x28;
953 firstbank
->gadgets
[i
].qual
=IEQUALIFIER_CONTROL
;
956 firstbank
->gadgets
[i
].key
=0x17;
957 firstbank
->gadgets
[i
].qual
=IEQUALIFIER_CONTROL
|IEQUALIFIER_LSHIFT
;
960 firstbank
->gadgets
[i
].key
=0xff;
961 firstbank
->gadgets
[i
].qual
=0;
965 firstbank
->gadgets
[34].which
=FLAG_ASYNC
|FLAG_CDSOURCE
;
966 firstbank
->gadgets
[76].which
=FLAG_ASYNC
|FLAG_CDSOURCE
;
968 cstuff
->curbank
=firstbank
;
972 LStrCpy(config
->menutit
[0],"Project");
973 LStrCpy(config
->menutit
[1],"Function");
974 for (i
=2;i
<5;i
++) config
->menutit
[i
][0]=0;
977 DoAssignMenu(cstuff
,i
,defmenus1
[i
],deffuncs1
[i
]);
978 config
->menu
[i
].key
=defmenkeys1
[i
];
979 config
->menu
[i
].qual
=defmenqual1
[i
];
981 for (i
=20;i
<29;i
++) {
983 DoAssignMenu(cstuff
,i
,defmenus2
[h
],deffuncs2
[h
]);
984 config
->menu
[i
].key
=defmenkeys2
[h
];
985 config
->menu
[i
].qual
=defmenqual2
[h
];
987 for (i
=26;i
<29;i
++) {
988 config
->menu
[i
].which
=FLAG_OUTWIND
|FLAG_CDSOURCE
|FLAG_DOALL
|FLAG_SCANDEST
|((i
==27)?0:FLAG_RECURSE
);
989 config
->menu
[i
].delay
=-1;
994 DoGetDevices(cstuff
);
996 for (i
=0;i
<DRIVECOUNT
;i
++) {
997 config
->drive
[i
].key
=0xff;
998 config
->drive
[i
].qual
=0;
999 config
->drive
[i
].fpen
=1;
1000 config
->drive
[i
].bpen
=0;
1006 if ((type
=(struct dopusfiletype
*)
1007 DoAllocRemember(&cstuff
->typekey
,sizeof(struct dopusfiletype
),MEMF_CLEAR
))) {
1008 LStrCpy(type
->type
,deftype_type
[i
]);
1009 LStrCpy(type
->typeid,deftype_typeid
[i
]);
1010 if (type
->recognition
=DoAllocRemember(&cstuff
->typekey
,strlen(deftype_recog
[i
])+1,0))
1011 LStrCpy(type
->recognition
,deftype_recog
[i
]);
1013 if (deftype_funcs
[i
][a
]) {
1014 b
=deftype_funcpos
[i
][a
];
1015 LStrCpy(type
->actionstring
[b
],deftype_action
[i
][a
]);
1016 type
->which
[b
]=deftype_which
[i
][a
];
1017 type
->delay
[b
]=deftype_delay
[i
][a
];
1018 type
->stack
[b
]=4000;
1019 if (type
->function
[b
]=DoAllocRemember(&cstuff
->typekey
,strlen(deftype_funcs
[i
][a
])+1,0))
1020 LStrCpy(type
->function
[b
],deftype_funcs
[i
][a
]);
1023 linkinnewfiletype(cstuff
,type
);
1029 int __saveds
DoGetDevices(register struct ConfigStuff
*cstuff
__asm("a0"))
1031 struct DeviceList
*devlist
;
1032 struct RootNode
*rootnode
;
1033 struct DosInfo
*dosinfo
;
1034 struct Config
*config
;
1035 char devname
[16],pathname
[256];
1036 int gap
,i
,j
,k
,a
,p
,l
,d
;
1038 if (!(config
=cstuff
->config
)) return(0);
1039 rootnode
=(struct RootNode
*) DOSBase
->dl_Root
;
1040 dosinfo
=(struct DosInfo
*) BADDR(rootnode
->rn_Info
);
1041 devlist
=(struct DeviceList
*) BADDR(dosinfo
->di_DevInfo
);
1044 if (devlist
->dl_Type
==DLT_DEVICE
&& devlist
->dl_Task
) {
1045 BtoCStr((BPTR
)devlist
->dl_Name
,pathname
,256);
1046 LStrCat(pathname
,":");
1047 LStrnCpy(devname
,pathname
,15); devname
[15]=0;
1048 DoAssignDrive(cstuff
,a
,devname
,pathname
);
1049 //D(bug("%ld: %s\n",a,cstuff->config->drive[a].name)/*;Delay(50)*/);
1051 if (a
==DRIVECOUNT
) break;
1053 devlist
=(struct DeviceList
*) BADDR(devlist
->dl_Next
);
1055 for (gap
=a
/2;gap
>0;gap
/=2) {
1056 for (i
=gap
;i
<a
;i
++) {
1057 for (j
=i
-gap
;j
>=0;j
-=gap
) {
1059 if (LStrCmpI(config
->drive
[j
].name
,config
->drive
[k
].name
)<=0) break;
1060 SwapMem((char *)&config
->drive
[j
],(char *)&config
->drive
[k
],sizeof(struct dopusfunction
));
1061 //D(bug("Drives swapped!\n"));
1067 devlist
=(struct DeviceList
*) BADDR(dosinfo
->di_DevInfo
);
1069 if (devlist
->dl_Type
==DLT_DIRECTORY
) {
1070 BtoCStr((BPTR
)devlist
->dl_Name
,pathname
,256);
1071 LStrCat(pathname
,":");
1072 LStrnCpy(devname
,pathname
,15); devname
[15]=0;
1073 DoAssignDrive(cstuff
,a
,devname
,pathname
);
1074 //D(bug("%ld: %s\n",a,cstuff->config->drive[a].name));
1076 if (a
==DRIVECOUNT
) break;
1078 devlist
=(struct DeviceList
*) BADDR(devlist
->dl_Next
);
1082 for (gap
=p
/2;gap
>0;gap
/=2) {
1083 for (i
=gap
;i
<p
;i
++) {
1084 for (j
=i
-gap
;j
>=0;j
-=gap
) {
1086 if (LStrCmpI(config
->drive
[l
].name
,config
->drive
[k
].name
)<=0) break;
1087 SwapMem((char *)&config
->drive
[l
],(char *)&config
->drive
[k
],sizeof(struct dopusfunction
));
1088 //D(bug("Drives swapped!\n"));
1093 for (i
=a
;i
<DRIVECOUNT
;i
++) DoAssignDrive(cstuff
,i
,NULL
,NULL
);
1094 //D(bug("+%ld: %s\n",i,cstuff->config->drive[i].name);
1096 //for (a = 0; a < DRIVECOUNT; a++) D(bug("%ld: %s\n",a,cstuff->config->drive[a].name);
1101 void __saveds
DoAssignGadget(register struct ConfigStuff
*cstuff
__asm("a0"), register int bk
__asm("d0"), register int gad
__asm("d1"), register const char *name
__asm("a1"), register const char *func
__asm("a2"))
1103 struct dopusgadgetbanks
*bank
,*temp
;
1106 bank
=cstuff
->firstbank
;
1107 for (a
=0;a
<bk
;a
++) {
1108 if (!bank
|| !bank
->next
) break;
1111 if (a
<bk
|| !bank
) {
1112 if (!(temp
=AllocMem(sizeof(struct dopusgadgetbanks
),MEMF_CLEAR
))) return;
1113 if (bank
) bank
->next
=temp
;
1114 else cstuff
->firstbank
=temp
;
1118 if (name
!=(char *)-1) {
1119 freestring(bank
->gadgets
[gad
].name
);
1120 bank
->gadgets
[gad
].name
=NULL
;
1121 if (name
&& name
[0]) bank
->gadgets
[gad
].name
=getstringcopy(name
);
1123 if (func
!=(char *)-1) {
1124 freestring(bank
->gadgets
[gad
].function
);
1125 bank
->gadgets
[gad
].function
=NULL
;
1126 if (func
&& func
[0]) bank
->gadgets
[gad
].function
=getstringcopy(func
);
1130 void __saveds
DoAssignMenu(register struct ConfigStuff
*cstuff
__asm("a0"), register int men
__asm("d0"), const register char *name
__asm("a1"), const register char *func
__asm("a2"))
1132 struct Config
*config
;
1134 //D(bug("DoAssignMenu(%s)\n",name);
1135 if (!(config
=cstuff
->config
)) return;
1136 if (name
!=(char *)-1) {
1137 freestring(config
->menu
[men
].name
);
1138 config
->menu
[men
].name
=NULL
;
1139 if (name
&& name
[0]) config
->menu
[men
].name
=getstringcopy(name
);
1141 if (func
!=(char *)-1) {
1142 freestring(config
->menu
[men
].function
);
1143 config
->menu
[men
].function
=NULL
;
1144 if (func
&& func
[0]) config
->menu
[men
].function
=getstringcopy(func
);
1148 config->menu[men].fpen = 1;
1149 config->menu[men].bpen = 2;
1155 void __saveds
DoFreeConfig(register struct ConfigStuff
*cstuff
__asm("a0"))
1158 struct Config
*config
;
1159 struct dopusgadgetbanks
*bank
,*temp
;
1160 struct dopushotkey
*hotkey
,*temphot
;
1162 if (!(config
=cstuff
->config
)) return;
1164 for (a
=0;a
<MENUCOUNT
;a
++) {
1165 DoAssignMenu(cstuff
,a
,NULL
,NULL
);
1166 config
->menu
[a
].which
=0; config
->menu
[a
].type
=0;
1167 config
->menu
[a
].stack
=4000; config
->menu
[a
].pri
=0;
1168 config
->menu
[a
].delay
=2;
1169 config
->menu
[a
].fpen
=1; config
->menu
[a
].bpen
=2;
1170 config
->menu
[a
].key
=0; config
->menu
[a
].qual
=0;
1172 for (a
=0;a
<DRIVECOUNT
;a
++) {
1173 DoAssignDrive(cstuff
,a
,NULL
,NULL
);
1174 config
->drive
[a
].key
=0xff;
1175 config
->drive
[a
].qual
=0;
1176 config
->drive
[a
].fpen
=3; config
->drive
[a
].bpen
=0;
1179 bank
=cstuff
->firstbank
;
1181 for (a
=0;a
<GADCOUNT
;a
++) {
1182 freestring(bank
->gadgets
[a
].name
);
1183 freestring(bank
->gadgets
[a
].function
);
1186 FreeMem(bank
,sizeof(struct dopusgadgetbanks
));
1189 cstuff
->firstbank
=cstuff
->curbank
=NULL
;
1191 hotkey
=cstuff
->firsthotkey
;
1193 temphot
=hotkey
->next
;
1194 freestring(hotkey
->func
.function
);
1195 FreeMem(hotkey
,sizeof(struct dopushotkey
));
1198 cstuff
->firsthotkey
=NULL
;
1200 DoFreeRemember(&cstuff
->typekey
);
1201 cstuff
->firsttype
=NULL
;
1204 int __saveds
DoCheckConfig(register struct ConfigStuff
*cstuff
__asm("a0"))
1206 struct Config
*config
;
1208 if (!(config
=cstuff
->config
)) return(0);
1210 if (config
->sliderheight
<5) config
->sliderheight
=5;
1211 else if (config
->sliderheight
>49) config
->sliderheight
=49;
1212 if (config
->sliderwidth
<8) config
->sliderwidth
=8;
1213 else if (config
->sliderwidth
>108) config
->sliderwidth
=108;
1218 const static char *look_dirs
[]={
1222 "LIBS:","DOpus:Libs/",
1223 "REXX:","DOpus:Rexx/",
1224 "C:","DOpus:Modules/",
1225 "S:","DOpus:Requesters/"
1227 "PROGDIR:C/", "C:", "DOpus:C/", "C/",
1228 "PROGDIR:S/", "S:", "DOpus:S/", "S/",
1229 "PROGDIR:Libs/", "LIBS:","DOpus:Libs/", "Libs/",
1230 "PROGDIR:Rexx/", "REXX:","DOpus:Rexx/", "Rexx/",
1231 "PROGDIR:Modules/", "C:", "DOpus:Modules/", "Modules/",
1232 "PROGDIR:Requesters/","S:", "DOpus:Requesters/","Requesters/"
1235 int __saveds
DoFindSystemFile(register char *name
__asm("a0"), register char *buf
__asm("a1"), register int size
__asm("d0"), register int type
__asm("d1"))
1239 //D(bug("DoFindSystemFile(%s)\n",name));
1241 LStrnCpy(temp
,name
,256);
1242 if (/*DOSBase->dl_lib.lib_Version<36 ||*/ //JRZ
1243 !(FindSegment(temp
,NULL
,0))) {
1244 if (DoCheckExist(temp
,NULL
)>=0) {
1248 for (a
=0;a
<4;a
++) { // JRZ: was 2
1249 DoStrCombine(temp
,look_dirs
[(type
*4)+a
],name
,256); // JRZ: was 2
1251 if (DoCheckExist(temp
,NULL
)<0) break;
1253 if (a
==4) temp
[0]=0; // JRZ: was 2
1254 else if (lock
= Lock(temp
,ACCESS_READ
))
1256 NameFromLock(lock
,temp
,256);
1263 if (lock
=Lock("",ACCESS_READ
)) {
1264 DoPathName(lock
,temp
,256);
1266 DoTackOn(temp
,name
,256);
1271 LStrnCpy(buf
,temp
,size
);
1272 //D(bug("DoFindSystemFile:end\n");Delay(50));
1275 else if (type
==SYSFILE_MODULE
) {
1276 struct DOpusSimpleRequest req
;
1278 static char *req_gads
[3];
1279 static int req_rets
[2]={1,0};
1281 req_gads
[0]=string_table
[STR_TRY_AGAIN
];
1282 req_gads
[1]=string_table
[STR_CANCEL
];
1285 LSprintf(reqbuf
,string_table
[STR_CANNOT_FIND_FILE_REQ
],name
,req_gads
[0],req_gads
[1]);
1288 LSprintf( reqbuf, "Unable to find the file \"%s\"\n\
1290 Check your configuration and then\nTry Again, or Cancel to abort the operation", name, defpath );
1296 req
.hi
=-1; req
.lo
=-1;
1297 req
.fg
=-1; req
.bg
=-1;
1301 if (DoDoSimpleRequest(NULL
,&req
)) goto tryloop
;
1303 LStrnCpy(buf
,name
,size
);
1304 //D(bug("DoFindSystemFile:end\n");Delay(50));