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 old_general_font
[30];
38 UWORD code
,gadgetid
,qual
;
39 struct ConfigUndo
*undo
;
41 int mode
=-1,realpen
=1,x
,y
,cursel
=-1,a
,b
,fontnum
=0,arrowact
=0,c
;
42 char *fg
=NULL
,*bg
=NULL
,buf
[256],*ptr
;
43 struct DOpusListView
*view
;
47 showconfigscreen(CFG_SCREEN
);
48 undo
=makeundo(UNDO_MAIN
);
50 /*if (version2)*/ fontsizelistview
.h
=52;
53 Wait(1<<Window
->UserPort
->mp_SigBit
);
54 while (IMsg
=getintuimsg()) {
55 if (!(mode
==SCREEN_SCREENMODE
&&
56 (view
=ListViewIDCMP(&screenmodeview
,IMsg
))!=(struct DOpusListView
*)-1) &&
57 !(mode
==SCREEN_FONTS
&&
58 (view
=ListViewIDCMP(&fontplacelist
,IMsg
))!=(struct DOpusListView
*)-1) &&
59 !(mode
==SCREEN_PALETTE
&&
60 (view
=ListViewIDCMP(&palettelist
,IMsg
))!=(struct DOpusListView
*)-1)) {
61 class=IMsg
->Class
; code
=IMsg
->Code
; qual
=IMsg
->Qualifier
;
62 x
=IMsg
->MouseX
; y
=IMsg
->MouseY
;
63 if (class==GADGETUP
|| class==GADGETDOWN
) {
64 gad
=(struct Gadget
*)IMsg
->IAddress
;
65 gadgetid
=gad
->GadgetID
;
67 ReplyMsg((struct Message
*)IMsg
);
70 if (code
==MENUNULL
) break;
72 select_gadget(&maingad
[mode
],0);
73 removescreenedit(mode
);
74 mode
=realpen
=cursel
=-1;
76 switch ((a
=ITEMNUM(code
))) {
79 if (doload(CFG_SCREEN
,a
)) {
80 if (config
->scrdepth
!=screen_depth
)
83 showconfigscreen(CFG_SCREEN
);
89 case IDCMP_MOUSEBUTTONS
:
90 if (code
==SELECTDOWN
) {
91 if (mode
==SCREEN_PALETTE
) {
92 if (x
>x_off
+297 && y
>y_off
+33 && x
<x_off
+514 && y
<y_off
+46) {
93 for (a
=0;a
<(1<<((screen_depth
> 4) ? 4 : screen_depth
));a
++) {
94 if (x
>=palettegad_xy
[a
][0] && x
<=palettegad_xy
[a
][2] &&
95 y
>=palettegad_xy
[a
][1] && y
<=palettegad_xy
[a
][3]) {
96 realpen
=screen_pens
[a
].pen
;
97 showcolourvals(realpen
,1);
104 else if (mode
==SCREEN_ARROWS
) {
106 if (x
>x_off
+182+(a
*129) && x
<x_off
+307+(a
*129) &&
107 y
>y_off
+32 && y
<y_off
+89) {
109 showarrowborders(a
,arrowact
);
111 DoCycleGadget(&arrowgadgets
[7],Window
,arrowtypetxt
,arrowact
);
112 fixarrowgads(arrowact
);
118 else if (mode
==SCREEN_COLOURS
&& fg
&& bg
) {
120 if (docolourgad(rp
,x_off
+208,y_off
+33,x
,y
,
121 (cursel
==COLBIT_3DBOXES
)?NULL
:cfg_string
[STR_EXAMPLE
],&a
,&b
,CFG_GADGET
)) {
123 if (cursel
==COLBIT_3DBOXES
) {
124 showfuncob(rp
,cfg_string
[STR_EXAMPLE
],1,0,CFG_GADGET
,x_off
+302,y_off
+23);
125 showscreencolours(COLOURS_ALL
,NULL
,NULL
,4);
127 else showscreencolours((1<<cursel
),NULL
,NULL
,0);
131 if (coloursel
[a
].item
==-1) break;
132 if (x
>=x_off
+coloursel
[a
].x1
&& x
<=x_off
+coloursel
[a
].x2
&&
133 y
>=y_off
+coloursel
[a
].y1
&& y
<=y_off
+coloursel
[a
].y2
) {
134 if (/*version2 ||*/ (a
!=COLBIT_STRINGS
&& a
!=COLBIT_SELSTRINGS
)) {
135 cursel
=coloursel
[a
].item
;
136 showscreencolours((1<<cursel
),&fg
,&bg
,0);
137 showcolourscycle(*fg
,*bg
,cursel
);
138 setupcolourbox(rp
,x_off
+208,y_off
+33,*fg
,*bg
);
149 if ((code
>=0x60 && code
<=0x67) || code
&0x80) break;
151 RawkeyToStr(code
,qual
,NULL
,buf
,10);
152 k
= LToLower(buf
[0]);
153 if (mode
==SCREEN_PALETTE
)
155 if (k
== getkeyshortcut(cfg_string
[STR_PALETTE_RED
]))
156 ActivateStrGad(&palettegads
[3],Window
);
157 else if (k
== getkeyshortcut(cfg_string
[STR_PALETTE_GREEN
]))
158 ActivateStrGad(&palettegads
[4],Window
);
159 else if (k
== getkeyshortcut(cfg_string
[STR_PALETTE_BLUE
]))
160 ActivateStrGad(&palettegads
[5],Window
);
162 else if (mode
==SCREEN_SCREENMODE
)
164 if (k
== getkeyshortcut(cfg_string
[STR_SCREENMODE_WIDTH
]))
165 ActivateStrGad(&screenmodegads
[0],Window
);
166 else if (k
== getkeyshortcut(cfg_string
[STR_SCREENMODE_HEIGHT
]))
167 ActivateStrGad(&screenmodegads
[1],Window
);
168 else if (k
== getkeyshortcut(cfg_string
[STR_SCREENMODE_COLORS
]))
169 ActivateStrGad(&screenmodegads
[2],Window
);
173 case IDCMP_GADGETDOWN
:
174 if (gadgetid
>=PALETTE_SLIDER
&& gadgetid
<PALETTE_SLIDER
+3) {
175 updatecolourvals(realpen
,0);
177 Wait(1<<Window
->UserPort
->mp_SigBit
);
178 while (IMsg
=getintuimsg()) {
180 ReplyMsg((struct Message
*)IMsg
);
181 if (class==GADGETUP
) break;
182 if (class==MOUSEMOVE
) updatecolourvals(realpen
,0);
184 if (class==GADGETUP
) {
185 updatecolourvals(realpen
,1);
190 else if (gadgetid
>=ARROWBASE
+3 && gadgetid
<ARROWBASE
+7) {
191 gadgetid
-=ARROWBASE
+3; a
=0;
193 if (IntuitionBase
->ActiveWindow
!=Window
||
194 !(gad
->Flags
&SELECTED
)) break;
195 if ((arrowact
==0 && gadgetid
>1) ||
196 (arrowact
>0 && gadgetid
<2)) {
197 b
=config
->arrowsize
[arrowact
];
198 if ((arrowact
==0 && gadgetid
==2) ||
199 (arrowact
>0 && gadgetid
==0))
200 ++config
->arrowsize
[arrowact
];
201 else --config
->arrowsize
[arrowact
];
207 showleftrightslider();
213 if (b
==config
->arrowsize
[arrowact
]) a
=-1;
218 b
=config
->sliderwidth
;
219 if (gadgetid
==1) config
->sliderwidth
-=2;
220 else config
->sliderwidth
+=2;
222 if (b
==config
->sliderwidth
) {
228 b
=config
->sliderheight
;
229 if (gadgetid
==3) config
->sliderheight
-=2;
230 else config
->sliderheight
+=2;
231 showleftrightslider();
232 if (b
==config
->sliderheight
) {
238 b
=config
->stringheight
;
239 if (gadgetid
==3) config
->stringheight
-=2;
240 else config
->stringheight
+=2;
242 if (b
==config
->stringheight
) {
255 while (IMsg
=getintuimsg()) {
257 ReplyMsg((struct Message
*)IMsg
);
258 if (class==GADGETUP
) break;
260 if (class==GADGETUP
) break;
263 else if (gadgetid
>=ARROWBASE
&& gadgetid
<ARROWBASE
+3) {
265 if (config
->arrowpos
[arrowact
]!=gadgetid
) {
266 config
->arrowpos
[arrowact
]=gadgetid
;
267 if (arrowact
==0) showupdownslider();
268 else if (arrowact
==1) showleftrightslider();
269 else showstringgadget();
271 fixarrowgads(arrowact
);
276 if (mode
==SCREEN_GENERAL
&& gadgetid
>GAD_BASE
) {
277 config
->generalscreenflags
=processtickgad(scr_generalgadgets
,config
->generalscreenflags
,gadgetid
-GAD_BASE
,-1);
280 if (gadgetid
<SCREEN_OKAY
) {
281 if (mode
==gadgetid
) {
282 removescreenedit(mode
);
283 mode
=realpen
=cursel
=-1;
284 makehelpname((char *)-1);
285 doscreentitle(cfg_string
[STR_SCREEN_SCREEN
]);
289 if (mode
==SCREEN_SCREENMODE
|| mode
==SCREEN_FONTS
)
290 select_gadget(&maingad
[gadgetid
],0);
291 select_gadget(&maingad
[mode
],0);
292 removescreenedit(mode
);
293 if (mode
==SCREEN_SCREENMODE
|| mode
==SCREEN_FONTS
)
294 select_gadget(&maingad
[gadgetid
],1);
295 mode
=realpen
=cursel
=-1;
296 makehelpname((char *)-1);
298 makehelpname(screengadgets
[gadgetid
]);
299 doscreentitle(currenthelpname
);
301 if (gadgetid
>=PALETTE_STRING
&& gadgetid
<PALETTE_STRING
+3) {
302 updatecolourvals(realpen
,-1);
303 if (code
!=0x9) getnextgadget(gad
);
305 else switch (gadgetid
) {
307 // if (!version2) break;
308 RefreshStrGad(&fontsizegadget
,Window
);
309 a
=atoi(fontsize_buf
);
310 c
=config
->fontsizes
[fontnum
];
311 config
->fontsizes
[fontnum
]=a
;
312 for (b
=0;b
<fontsizelistview
.count
;b
++)
313 if (atoi(fontsizelistview
.items
[b
])==a
) break;
314 if (b
<fontsizelistview
.count
) {
315 fontsizelistview
.itemselected
=b
;
316 if (b
<fontsizelistview
.topitem
||
317 b
>fontsizelistview
.topitem
+fontsizelistview
.lines
-1)
318 fontsizelistview
.topitem
=b
;
319 RefreshListView(&fontsizelistview
,1);
321 RefreshStrGad(&fontsizegadget
,Window
);
324 fontsizelistview
.itemselected
=-1;
325 RefreshListView(&fontsizelistview
,1);
327 if (c
!=a
) dofontdemo(config
->fontbufs
[fontnum
],config
->fontsizes
[fontnum
]);
332 if (qual
&IEQUALIFIER_LSHIFT
|| qual
&IEQUALIFIER_RSHIFT
) {
333 if ((--arrowact
)<0) arrowact
=2;
335 else if ((++arrowact
)==3) arrowact
=0;
336 showarrowborders(arrowact
,a
);
337 DoCycleGadget(&arrowgadgets
[7],Window
,arrowtypetxt
,arrowact
);
338 fixarrowgads(arrowact
);
341 case SCREEN_SLIDER_LEFTCYCLE
:
342 config
->slider_pos
^=1;
343 show_slider_setup(182,32,0);
346 case SCREEN_SLIDER_RIGHTCYCLE
:
347 config
->slider_pos
^=2;
348 show_slider_setup(373,32,1);
352 realpen
=screen_pens
[1].pen
;
359 case SCREEN_SCREENMODE
:
362 makescreenedit(mode
);
363 if (gadgetid
==SCREEN_COLOURS
) {
365 fg
=&config
->statusfg
; bg
=&config
->statusbg
;
370 if (qual
&IEQUALIFIER_LSHIFT
|| qual
&IEQUALIFIER_RSHIFT
) {
371 if ((--cursel
)<0) cursel
= /*(version2)?*/COLBIT_SELSTRINGS
/*:COLBIT_3DBOXES*/;
374 if (!coloursgadgets
[++cursel
]/* ||
375 (!version2 && cursel==COLBIT_STRINGS)*/) cursel
=0;
377 showscreencolours((1<<cursel
),&fg
,&bg
,0);
378 showcolourscycle(*fg
,*bg
,cursel
);
379 setupcolourbox(rp
,x_off
+208,y_off
+33,*fg
,*bg
);
382 case SCREENMODE_WIDTH
:
383 a
=atoi(screenwidth_buf
);
384 if (a
%2) lsprintf(screenwidth_buf
,"%ld",(long int)(a
+1));
385 CheckNumGad(&screenmodegads
[SCREENMODE_WIDTH
-300],Window
,curmode
->minw
,curmode
->maxw
);
386 config
->scrw
=atoi(screenwidth_buf
);
387 config
->scr_winw
=config
->scrw
;
388 if (code
!=0x9) getnextgadget(gad
);
391 case SCREENMODE_HEIGHT
:
392 CheckNumGad(&screenmodegads
[SCREENMODE_HEIGHT
-300],Window
,curmode
->minh
,curmode
->maxh
);
393 config
->scrh
=atoi(screenheight_buf
);
394 config
->scr_winh
=config
->scrh
;
395 if (code
!=0x9) getnextgadget(gad
);
398 case SCREENMODE_DEPTH
:
399 a
=atoi(screendepth_buf
);
400 for (b
=curmode
->maxdepth
;b
>=2;b
--) {
408 case SCREENMODE_SLIDER
:
409 if (gadgetid
==SCREENMODE_SLIDER
)
410 a
=GetSliderPos(&screenmodegads
[SCREENMODE_SLIDER
-300],curmode
->maxdepth
-1,1)+2;
411 if (a
>curmode
->maxdepth
) a
=curmode
->maxdepth
;
413 lsprintf(screendepth_buf
,"%ld",(long int)(1<<a
));
414 RefreshStrGad(&screenmodegads
[SCREENMODE_DEPTH
-300],Window
);
416 FixSliderPot(Window
,&screenmodegads
[SCREENMODE_SLIDER
-300],config
->scrdepth
-2,curmode
->maxdepth
-1,1,2);
417 if (gadgetid
==SCREENMODE_DEPTH
&& code
!=0x9) getnextgadget(gad
);
420 case SCREENMODE_DEFWIDTH
:
421 if (screenmodegads
[SCREENMODE_DEFWIDTH
-300].Flags
&SELECTED
) {
422 config
->screenflags
|=SCRFLAGS_DEFWIDTH
;
423 EnableGadget(&screenmodegads
[SCREENMODE_WIDTH
-300],rp
,0,0);
424 config
->scrw
=curmode
->defw
;
425 config
->scr_winw
=config
->scrw
;
426 fixmodegads(curmode
);
428 else config
->screenflags
&=~SCRFLAGS_DEFWIDTH
;
429 fixdefaultgads(curmode
);
430 fixmodegads(curmode
);
433 case SCREENMODE_DEFHEIGHT
:
434 if (screenmodegads
[SCREENMODE_DEFHEIGHT
-300].Flags
&SELECTED
) {
435 config
->screenflags
|=SCRFLAGS_DEFHEIGHT
;
436 EnableGadget(&screenmodegads
[SCREENMODE_HEIGHT
-300],rp
,0,0);
437 config
->scrh
=curmode
->defh
;
438 config
->scr_winh
=config
->scrh
;
439 fixmodegads(curmode
);
441 else config
->screenflags
&=~SCRFLAGS_DEFHEIGHT
;
442 fixdefaultgads(curmode
);
443 fixmodegads(curmode
);
446 case SCREENMODE_HALFHEIGHT
:
447 if (screenmodegads
[SCREENMODE_HALFHEIGHT
-300].Flags
&SELECTED
)
448 config
->screenflags
|=SCRFLAGS_HALFHEIGHT
;
449 else config
->screenflags
&=~SCRFLAGS_HALFHEIGHT
;
453 doundo(undo
,UNDO_MAIN
);
454 if (config
->scrdepth
!=screen_depth
) {
456 removescreenedit(mode
);
463 if (mode
>-1) removescreenedit(mode
);
465 return((gadgetid
==SCREEN_OKAY
));
471 if (mode
==SCREEN_FONTS
) {
472 if (view
->listid
==1) {
475 RefreshStrGad(&fontsizegadget
,Window
);
477 fontnum
=fontplacevals
[view
->itemselected
];
478 initfontlist(fontnum
,1,fontplaceflags
[fontnum
]);
480 else if (fontnum
>=0 && fontnum
<NUMFONTS
) {
481 if (view
->listid
==2) {
482 strcpy(buf
,config
->fontbufs
[fontnum
]);
483 if ((ptr
=strstri(buf
,".font"))) *ptr
=0;
484 if (strcmp(buf
,view
->items
[view
->itemselected
])) {
487 RefreshStrGad(&fontsizegadget
,Window
);
489 strcpy(config
->fontbufs
[fontnum
],view
->items
[view
->itemselected
]);
490 config
->fontsizes
[fontnum
]=initfontlist(fontnum
,0,fontplaceflags
[fontnum
]);
491 StrConcat(config
->fontbufs
[fontnum
],".font",40);
494 else if (view
->listid
==3) {
497 RefreshStrGad(&fontsizegadget
,Window
);
499 a
=config
->fontsizes
[fontnum
];
500 config
->fontsizes
[fontnum
]=atoi(view
->items
[view
->itemselected
]);
501 if (a
!=config
->fontsizes
[fontnum
])
502 dofontdemo(config
->fontbufs
[fontnum
],config
->fontsizes
[fontnum
]);
506 else if (view
->listid
==1) {
507 curmode
=showdisplaydesc();
508 fixdefaultgads(curmode
);
509 if (screenmodegads
[SCREENMODE_DEFWIDTH
-300].Flags
&SELECTED
) {
510 config
->scrw
=curmode
->defw
;
511 config
->scr_winw
=config
->scrw
;
512 EnableGadget(&screenmodegads
[SCREENMODE_WIDTH
-300],rp
,0,0);
514 if (screenmodegads
[SCREENMODE_DEFHEIGHT
-300].Flags
&SELECTED
) {
515 config
->scrh
=curmode
->defh
;
516 config
->scr_winh
=config
->scrh
;
517 EnableGadget(&screenmodegads
[SCREENMODE_HEIGHT
-300],rp
,0,0);
519 fixmodegads(curmode
);
520 if (config
->screenflags
&SCRFLAGS_DEFWIDTH
)
521 DisableGadget(&screenmodegads
[SCREENMODE_WIDTH
-300],rp
,0,0);
522 if (config
->screenflags
&SCRFLAGS_DEFHEIGHT
)
523 DisableGadget(&screenmodegads
[SCREENMODE_HEIGHT
-300],rp
,0,0);
524 config
->screenmode
=curmode
->mode
;
526 if (curmode
->mode
==MODE_PUBLICSCREENUSE
/* ||
527 curmode->mode==MODE_PUBLICSCREENCLONE */ ) {
529 if (!curmode
->name
[a
]) break;
530 if (a
>0 && curmode
->name
[a
-1]==':') {
531 if ((strcmp(&curmode
->name
[a
],cfg_string
[STR_SCREEN_MODE_USE
]))==0)
534 if ((strcmp(&curmode->name[a],cfg_string[STR_SCREEN_MODE_CLONE]))==0)
539 if (a
>0 && curmode
->name
[a
]) {
540 strncpy(config
->pubscreen_name
,curmode
->name
,a
);
541 config
->pubscreen_name
[a
-1]=0;
544 else config
->pubscreen_name
[0]=0;
546 if (version2<OSVER_39) {
547 if (config->screenmode==MODE_WORKBENCHUSE ||
548 curmode->mode==MODE_PUBLICSCREENUSE)
549 DisableGadget(&maingad[SCREEN_PALETTE],rp,2,1);
550 else EnableGadget(&maingad[SCREEN_PALETTE],rp,2,1);
553 else if (view
->listid
==2) {
554 if (view
->itemselected
>=0 && view
->itemselected
<13) {
555 if (view
->itemselected
==0)
556 load_palette(Screen
,palette_backup
,1<<((screen_depth
> 4) ? 4 : screen_depth
));
557 else if (view
->itemselected
==1)
558 loadrgb4(Screen
,def_dopus_palette
,1<<((screen_depth
> 4) ? 4 : screen_depth
));
559 else if (view
->itemselected
==3) {
563 GetWBScreen(&scrbuf
);
564 wbdepth
=1<<scrbuf
.RastPort
.BitMap
->Depth
;
565 if (wbdepth
> 256) wbdepth
= 256;
566 size
=(wbdepth
*3)*sizeof(ULONG
);
567 if (palbuf
=AllocMem(size
,MEMF_CLEAR
)) {
570 get_palette(&scrbuf
,palbuf
,wbdepth
);
572 palette
[(a
*3)]=palbuf
[(a
*3)];
573 palette
[(a
*3)+1]=palbuf
[(a
*3)+1];
574 palette
[(a
*3)+2]=palbuf
[(a
*3)+2];
577 palette
[(a
*3)]=config
->new_palette
[(a
*3)];
578 palette
[(a
*3)+1]=config
->new_palette
[(a
*3)+1];
579 palette
[(a
*3)+2]=config
->new_palette
[(a
*3)+2];
581 if (wbdepth
>4 && screen_depth
>2) {
585 endme
=(1<<screen_depth
)-4;
588 palette
[((a
+endme
)*3)]=palbuf
[((a
+endwb
)*3)];
589 palette
[((a
+endme
)*3)+1]=palbuf
[((a
+endwb
)*3)+1];
590 palette
[((a
+endme
)*3)+2]=palbuf
[((a
+endwb
)*3)+2];
593 load_palette(Screen
,palette
,1<<((screen_depth
> 4) ? 4 : screen_depth
));
594 FreeMem(palbuf
,size
);
597 else loadrgb4(Screen
,defpalettes
[view
->itemselected
-2],4);
598 get_palette(Screen
,config
->new_palette
,1<<((screen_depth
> 4) ? 4 : screen_depth
));
599 showcolourvals(realpen
,1);
608 void makescreenedit(mode
)
611 int a
,b
,wclone
,shortage
,size
,fnum
,fontnum
,nopropnum
,only8num
,num
;
614 DisplayInfoHandle
*handle
;
615 struct DisplayInfo
*dispinfo
;
616 struct AvailFonts
*avail
;
620 SetAPen(rp
,screen_pens
[1].pen
);
624 /*if (version2>=OSVER_39)*/ {
625 modeid
=GetVPModeID(vp
);
626 if ((handle
=FindDisplayInfo(config
->screenmode
)) ||
627 (handle
=FindDisplayInfo(modeid
))) {
628 GetDisplayInfoData(handle
,buf
,256,DTAG_DISP
,0);
629 dispinfo
=(struct DisplayInfo
*)buf
;
630 bpg
=(dispinfo
->RedBits
+dispinfo
->GreenBits
+dispinfo
->BlueBits
)/3;
634 fix_slider(&palettegads
[a
]);
635 FixSliderBody(Window
,&palettegads
[a
],1<<bpg
,1,2);
641 screen_pens
[config
->gadgettopcol
].pen
,screen_pens
[config
->gadgetbotcol
].pen
,1);
642 do3dbox(x_off
+296,y_off
+33,220,14);
643 do3dbox(x_off
+250,y_off
+33,40,14);
644 setuplist(&palettelist
,250,93);
645 AddListView(&palettelist
,1);
647 showcolourvals(screen_pens
[1].pen
,1);
648 get_palette(Screen
,palette_backup
,1<<((screen_depth
> 4) ? 4 : screen_depth
));
652 if (config
->stringfgcol
==config
->stringbgcol
) ++config
->stringfgcol
;
653 do3dbox(x_off
+142,y_off
+61,464,122);
654 AddGadgetBorders(&borderkey
,
657 screen_pens
[config
->gadgettopcol
].pen
,screen_pens
[config
->gadgetbotcol
].pen
);
662 screen_pens
[config
->gadgettopcol
].pen
,screen_pens
[config
->gadgetbotcol
].pen
,1);
663 setupcolourbox(rp
,x_off
+208,y_off
+33,config
->statusfg
,config
->statusbg
);
664 showscreencolours(COLOURS_ALL
,NULL
,NULL
,0);
665 showcolourscycle(config
->statusfg
,config
->statusbg
,0);
668 case SCREEN_SCREENMODE
:
669 screenkey
=NULL
; firstmode
=NULL
;
670 screenmodeview
.itemselected
=-1; wclone
=0;
672 if ((a
=initscreenmodes()) &&
673 (screenmodelist
=LAllocRemember(&screenkey
,(a
+1)*sizeof(APTR
),MEMF_CLEAR
))) {
674 screenmode
=firstmode
;
676 if (screenmodelist
[b
]=LAllocRemember(&screenkey
,DISPLAYNAMELEN
,MEMF_CLEAR
))
677 strcpy(screenmodelist
[b
],screenmode
->name
);
678 if (screenmode
->mode
==MODE_WORKBENCHCLONE
) wclone
=b
;
679 if (screenmode
->mode
==config
->screenmode
) {
680 if (screenmode
->mode
==MODE_PUBLICSCREENUSE
) {
681 lsprintf(buf
,"%s:%s",config
->pubscreen_name
,cfg_string
[STR_SCREEN_MODE_USE
]);
682 if (LStrCmpI(buf
,screenmode
->name
)==0) screenmodeview
.itemselected
=b
;
685 else if (screenmode->mode==MODE_PUBLICSCREENCLONE) {
686 lsprintf(buf,"%s:%s",config->pubscreen_name,cfg_string[STR_SCREEN_MODE_CLONE]);
687 if (LStrCmpI(buf,screenmode->name)==0) screenmodeview.itemselected=b;
690 else screenmodeview
.itemselected
=b
;
692 if (!(screenmode
=screenmode
->next
)) break;
696 if (screenmodeview
.itemselected
==-1) screenmodeview
.itemselected
=wclone
;
697 setuplist(&screenmodeview
,238,17);
698 screenmodeview
.items
=screenmodelist
;
699 screenmodeview
.topitem
=screenmodeview
.itemselected
;
700 AddListView(&screenmodeview
,1);
701 screenmodegads
[0].Flags
&=~GFLG_DISABLED
;
702 screenmodegads
[1].Flags
&=~GFLG_DISABLED
;
703 for (a
=SCREENMODE_DEFWIDTH
-300;a
<SCREENMODE_SLIDER
-300;a
++)
704 screenmodegads
[a
].Flags
&=~(GFLG_SELECTED
|GFLG_DISABLED
);
705 if (config
->screenflags
&SCRFLAGS_HALFHEIGHT
)
706 screenmodegads
[SCREENMODE_HALFHEIGHT
-300].Flags
|=GFLG_SELECTED
;
707 else screenmodegads
[SCREENMODE_HALFHEIGHT
-300].Flags
&=~GFLG_SELECTED
;
708 fix_slider(&screenmodegads
[SCREENMODE_SLIDER
-300]);
713 screen_pens
[config
->gadgettopcol
].pen
,screen_pens
[config
->gadgetbotcol
].pen
,1);
717 screen_pens
[config
->gadgetbotcol
].pen
,screen_pens
[config
->gadgettopcol
].pen
);
718 SetAPen(rp
,screen_pens
[1].pen
);
720 cfg_string
[STR_DISPLAY_MODE_DESCRIPTION
],
723 fixmodegads((curmode
=showdisplaydesc()));
724 fixdefaultgads(curmode
);
730 size
=(sizeof(struct AvailFonts
)*512)+sizeof(struct AvailFontsHeader
);
732 if (!(fontdatabuf
=LAllocRemember(&fontkey
,size
,MEMF_CLEAR
)))
734 if (shortage
=AvailFonts(fontdatabuf
,size
,AFF_MEMORY
|AFF_DISK
)) {
735 LFreeRemember(&fontkey
);
741 if (!fontdatabuf
) break;
742 num
=((struct AvailFontsHeader
*)fontdatabuf
)->afh_NumEntries
;
744 !(fontlist
=LAllocRemember(&fontkey
,(num
+1)*sizeof(APTR
),MEMF_CLEAR
)) ||
745 !(fontsizelist
=LAllocRemember(&fontkey
,(num
+1)*sizeof(APTR
),MEMF_CLEAR
)))
747 if (!(noproplist
=LAllocRemember(&fontkey
,(num
+1)*sizeof(APTR
),MEMF_CLEAR
)) ||
748 !(nopropsizelist
=LAllocRemember(&fontkey
,(num
+1)*4,MEMF_CLEAR
))) {
750 nopropsizelist
=fontsizelist
;
752 if (!(only8list
=LAllocRemember(&fontkey
,(num
+1)*sizeof(APTR
),MEMF_CLEAR
)))
754 avail
=(struct AvailFonts
*)&fontdatabuf
[sizeof(UWORD
)];
755 sortfontlist(avail
,num
,0);
756 sortfontlist(avail
,num
,1);
757 for (fnum
=0;fnum
<num
;fnum
++) {
758 if (ptr
=strstri(avail
[fnum
].af_Attr
.ta_Name
,".font")) *ptr
=0;
759 avail
[fnum
].af_Attr
.ta_Style
=0;
761 for (fnum
=0;fnum
<num
;fnum
++) {
762 for (a
=0;a
<num
;a
++) {
763 if (!stricmp((char *)avail
[a
].af_Attr
.ta_Name
,(char *)avail
[fnum
].af_Attr
.ta_Name
))
764 ++avail
[fnum
].af_Attr
.ta_Style
;
767 //D(for(fnum=0;fnum<num;fnum++){bug("%s has %ld sizes\n",avail[fnum].af_Attr.ta_Name,avail[fnum].af_Attr.ta_Style);});
768 for (fnum
=0,fontnum
=0,nopropnum
=0,only8num
=0;fnum
<num
;fnum
++) {
769 for (a
=0;a
<fontnum
;a
++) {
770 if (strcmp(fontlist
[a
],(char *)avail
[fnum
].af_Attr
.ta_Name
)==0) break;
773 fontlist
[fontnum
]=(char *)avail
[fnum
].af_Attr
.ta_Name
;
774 fontsizelist
[fontnum
]=LAllocRemember(&fontkey
,(avail
[fnum
].af_Attr
.ta_Style
+1)*sizeof(APTR
),MEMF_CLEAR
);
775 if (!(avail
[fnum
].af_Attr
.ta_Flags
&FPF_PROPORTIONAL
)) {
776 noproplist
[nopropnum
]=fontlist
[fontnum
];
777 nopropsizelist
[nopropnum
]=fontsizelist
[fontnum
];
779 if (avail
[fnum
].af_Attr
.ta_YSize
==8) {
780 only8list
[only8num
]=fontlist
[fontnum
];
786 if (fontsizelist
[a
]) {
788 if (!fontsizelist
[a
][b
])
790 if (/*b>-1 &&*/ (fontsizelist
[a
][b
]=LAllocRemember(&fontkey
,8,MEMF_CLEAR
)))
791 lsprintf(fontsizelist
[a
][b
],"%4ld",(long int)avail
[fnum
].af_Attr
.ta_YSize
);
794 //D(bug("fontsizelist[%ld][%ld]=%lx (%s)\n",a,b,fontsizelist[a][b],fontsizelist[a][b]));
795 if (atoi(fontsizelist
[a
][b
])==avail
[fnum
].af_Attr
.ta_YSize
) {
803 setuplist(&fontplacelist
,146,18);
804 setuplist(&fontlistview
,360,18);
805 setuplist(&fontsizelistview
,566,18);
806 fontplacelist
.itemselected
=fontplacelist
.topitem
=0;
807 fontsizelistview
.items
=fontlistview
.items
=NULL
;
808 AddListView(&fontplacelist
,3);
809 SetAPen(rp
,screen_pens
[1].pen
);
811 cfg_string
[STR_DISPLAY_ITEM
],
815 cfg_string
[STR_FONT
],
819 cfg_string
[STR_FONT_SIZE
],
828 screen_pens
[config
->gadgettopcol
].pen
,screen_pens
[config
->gadgetbotcol
].pen
,1);
830 initfontlist(FONT_CLOCK
,1,0);
831 strcpy(old_general_font
,config
->fontbufs
[0]);
835 inittickgads(scr_generalgadgets
,config
->generalscreenflags
,0);
840 arrowgadgets
[a
].GadgetRender
=(APTR
)buttonoffimage
;
841 arrowgadgets
[a
].SelectRender
=(APTR
)buttononimage
;
842 do3dbox(x_off
+184+(a
*129),y_off
+33,121,55);
845 AddGadgetBorders(&borderkey
,
848 screen_pens
[config
->gadgettopcol
].pen
,screen_pens
[config
->gadgetbotcol
].pen
);
849 AddGadgetBorders(&borderkey
,
852 screen_pens
[config
->gadgettopcol
].pen
,screen_pens
[config
->gadgetbotcol
].pen
);
853 AddGadgetBorders(&borderkey
,
856 screen_pens
[config
->gadgettopcol
].pen
,screen_pens
[config
->gadgetbotcol
].pen
);
862 screen_pens
[config
->gadgettopcol
].pen
,screen_pens
[config
->gadgetbotcol
].pen
,1);
864 DoArrow(rp
,x_off
+420+(a
*34),y_off
+144,10,9,screen_pens
[1].pen
,screen_pens
[0].pen
,3-a
);
865 DoArrow(rp
,x_off
+436,y_off
+138+(a
*12),12,9,screen_pens
[1].pen
,screen_pens
[0].pen
,a
);
868 showleftrightslider();
870 showarrowborders(0,-1);
872 SetAPen(rp
,screen_pens
[1].pen
);
874 cfg_string
[STR_MODIFY_SIZE
],
877 DoCycleGadget(&arrowgadgets
[7],Window
,arrowtypetxt
,0);
882 AddGadgetBorders(&borderkey
,
883 &screen_sliders_gadgets
[a
],
885 screen_pens
[config
->gadgettopcol
].pen
,screen_pens
[config
->gadgetbotcol
].pen
);
889 screen_sliders_gadgets
,
892 screen_pens
[config
->gadgettopcol
].pen
,screen_pens
[config
->gadgetbotcol
].pen
,1);
894 for (a
=0;a
<2;a
++) show_slider_setup(182+(a
*191),32,a
);
899 void removescreenedit(mode
)
902 SetAPen(rp
,screen_pens
[0].pen
);
906 SetAPen(rp
,screen_pens
[1].pen
);
909 RemoveGList(Window
,palettegads
,6);
910 RemoveListView(&palettelist
,1);
914 RemoveGList(Window
,&coloursgad
,1);
918 case SCREEN_SCREENMODE
:
919 RemoveListView(&screenmodeview
,1);
920 RemoveGList(Window
,screenmodegads
,7);
921 LFreeRemember(&screenkey
);
922 if (config
->scrdepth
!=screen_depth
) {
925 showconfigscreen(CFG_SCREEN
);
930 RemoveListView(&fontplacelist
,3);
931 /*if (version2)*/ RemoveGList(Window
,&fontsizegadget
,1);
932 if (LStrCmpI(config
->fontbufs
[0],old_general_font
)!=0) {
935 showconfigscreen(CFG_SCREEN
);
940 RemoveGList(Window
,arrowgadgets
,8);
948 RemoveGList(Window
,screen_sliders_gadgets
,2);
951 LFreeRemember(&borderkey
);