2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
9 /**************************************************************
11 * File/Font/Screenmode requester *
13 * (c) Nico François 1991-1994 *
14 **************************************************************/
18 /* The AmigaOS V40 ScrollWindowRaster() function is buggy and
19 causes Enforcer Hits */
21 #define NO_SCROLLWINDOWRASTER 1
26 #include <aros/debug.h>
34 /****************************************************************************************/
37 #define fib_EntryType fib_DirEntryType
40 /****************************************************************************************/
42 #ifndef MTYPE_APPWINDOW
43 #define MTYPE_APPWINDOW 7 /* msg from an app window */
46 /****************************************************************************************/
48 static const IPTR getstringtags
[] = { RTGS_Width
,180,RT_LockWindow
,TRUE
,
49 RT_ReqPos
,REQPOS_CENTERWIN
,RT_ShareIDCMP
,TRUE
,TAG_END
};
50 static const IPTR ezreqtags
[] = { RT_Underscore
,'_',RTEZ_Flags
,EZREQF_NORETURNKEY
,
51 TAG_MORE
, (IPTR
)&getstringtags
[2] };
54 /****************************************************************************************/
57 ExpandLink( GlobData
*glob
)
65 *glob
->winaddr
= ( APTR
) -1;
68 res
= ReadLink(NULL
, glob
->lock
, glob
->fib
.fib_FileName
, glob
->linkbuf
,
69 sizeof(glob
->linkbuf
));
71 fl
= BADDR( glob
->lock
);
72 res
= ReadLink(fl
->fl_Task
, glob
->lock
, glob
->fib
.fib_FileName
, glob
->linkbuf
, sizeof(glob
->linkbuf
));
79 if( ( lock
= Lock( glob
->linkbuf
, SHARED_LOCK
) ) )
81 STRPTR end
= FilePart( glob
->linkbuf
);
83 if( end
!= glob
->linkbuf
)
88 Examine( lock
, &glob
->linkfib
);
94 *glob
->winaddr
= glob
->reqwin
;
99 /****************************************************************************************/
101 ULONG ASM SAVEDS
PropReqHandler (
102 REGPARAM(a1
, struct RealHandlerInfo
*, glob
),
103 REGPARAM(d0
, ULONG
, sigs
),
104 REGPARAM(a0
, struct TagItem
*, taglist
))
106 struct IntuiMessage
*reqmsg
= NULL
, *imsg
, im
;
108 struct RealFileRequester
*freq
= NULL
;
109 struct RealFontRequester
*fontreq
= NULL
;
110 struct BufferData
*buff
;
111 struct DiskfontBase
*DiskfontBase
= glob
->diskfontbase
;
113 const struct TagItem
*tstate
= taglist
;
114 struct AvailFontsHeader
*afh
;
115 struct AvailFonts
*af
;
116 struct ReqEntry
*entry
;
117 struct DosList
*dlist
;
118 struct AppMessage
*appmsg
;
119 struct AssignList
*assignlist
, *fontslist
, **prevassign
;
120 int clicked
, ctype
, sel
, val
, code
, qual
, doubleclick
, checkbox
;
121 int i
, step
, start
, stop
, shortage
, buffsize
, mon
, doactgad
, lastpos
;
122 UBYTE
*fdir
= NULL
, *filename
= NULL
, *str
, *str2
, *str3
, key
;
128 /* uncomment if sigs is no longer ignored */
129 // if (glob->DoNotWait) sigs = SetSignal (0, 0);
131 doactgad
= !(glob
->buttoninfo
.lastcode
);
133 if (glob
->reqtype
== RT_FILEREQ
)
136 filename
= freq
->filename
;
137 fdir
= freq
->dirname
;
140 if (glob
->reqtype
== RT_FONTREQ
)
142 fontreq
= glob
->fontreq
;
143 filename
= fontreq
->fontname
;
149 while ((tag
= NextTagItem (&tstate
)))
151 tagdata
= tag
->ti_Data
;
152 if (tag
->ti_Tag
> RT_TagBase
)
156 case RTRH_EndRequest
:
157 if (tagdata
== REQ_OK
)
158 return (LeaveReq (glob
, filename
));
160 FreeAllCheckBuffer (glob
);
170 if (glob
->appwinport
)
172 while ((appmsg
= (struct AppMessage
*)GetMsg (glob
->appwinport
)))
174 if (appmsg
->am_Type
== MTYPE_APPWINDOW
)
176 if (appmsg
->am_NumArgs
>= 1)
178 NameFromLock (appmsg
->am_ArgList
->wa_Lock
, fdir
, 256);
179 my_SetStringGadget (glob
->reqwin
, glob
->filegad
,
180 appmsg
->am_ArgList
->wa_Name
);
183 ReplyMsg ((struct Message
*)appmsg
);
186 ReplyMsg ((struct Message
*)appmsg
);
195 if (!glob
->bufferentry
)
197 ClearFilesRect (glob
);
198 ClearAndInitReqBuffer (glob
);
199 AdjustScroller (glob
);
201 else RethinkReqDisplay (glob
);
203 glob
->selectedpos
= -1;
204 glob
->numselected
= 0;
205 UpdateNumSelGad (glob
);
206 glob
->lastclicked
= -1;
207 glob
->exnext
= FALSE
;
209 if (!glob
->bufferentry
)
211 if (glob
->reqtype
== RT_FILEREQ
)
213 if (!glob
->volumerequest
)
215 /* Render LED before lock, for good behaviour with ArcHandler */
218 if ((glob
->lock
= Lock (fdir
, SHARED_LOCK
)))
220 Examine (glob
->lock
, &glob
->fib
);
221 if (glob
->fib
.fib_EntryType
<= 0)
222 UnLockReqLock (glob
);
224 else if ((glob
->flags
& FREQF_SAVE
) &&
225 fdir
[strlen(fdir
)-1] != ':' &&
226 IoErr() != ERROR_DEVICE_NOT_MOUNTED
)
228 struct TagItem tags
[] =
230 {RT_Window
, (IPTR
)glob
->reqwin
},
231 {RT_IntuiMsgFunc
, (IPTR
)&glob
->intuihook
},
232 {TAG_MORE
, (IPTR
)ezreqtags
}
235 if (rtEZRequestA (GetStr (glob
->catalog
, MSG_CREATE_DRAWER
),
236 GetStr (glob
->catalog
, MSG_OK_BAR_CANCEL
),
237 NULL
, &glob
->drawerstr
, tags
))
238 glob
->lock
= CreateDir (glob
->drawerstr
);
245 SetWinTitleFlash (glob
->reqwin
,
246 GetStr (glob
->catalog
, MSG_DIR_ERROR
));
247 FreeReqBuffer (glob
->req
);
248 ClearDisplayList (glob
);
255 if (fdir
[i
-1] == '/' && i
> 1)
257 if (fdir
[i
-2] != ':' && fdir
[i
-2] != '/') fdir
[i
-1] = 0;
260 my_SetStringGadget (glob
->reqwin
, glob
->drawergad
, fdir
);
263 /* first examine before ExNext */
264 Examine (glob
->lock
, &glob
->fib
);
265 StartTimer (glob
, 500000);
266 glob
->firsttimer
= glob
->quiet
= TRUE
;
270 } /* if (glob->reqtype == RT_FILEREQ) */
273 /* Volume requester */
274 AddDiskNames (glob
, glob
->volumerequest
);
278 if (!FindCurrentPos (glob
, fdir
, MAXINT
, VOLUME
))
279 FindCurrentPos (glob
, fdir
, MAXINT
, ASSIGN
);
281 glob
->buff
->pos
-= (glob
->numentries
- 1);
283 if (glob
->buff
->pos
< 0) glob
->buff
->pos
= 0;
285 glob
->buff
->gotopos
= glob
->buff
->pos
;
288 RethinkReqDisplay (glob
);
291 } /* if (glob->reqtype == RT_FILEREQ) else ... */
293 } /* if (glob->reqtype == RT_FILEREQ) */
294 else if (glob
->reqtype
== RT_FONTREQ
)
296 winlock
= rtLockWindow (glob
->reqwin
);
297 ReqToolsBase
->AvailFontsLock
= TRUE
;
298 afh
= ReqToolsBase
->AvailFontsHeader
;
300 dlist
= LockDosList (LDF_DEVICES
|LDF_ASSIGNS
|LDF_READ
);
301 dlist
= FindDosEntry (dlist
, "FONTS", LDF_DEVICES
|LDF_ASSIGNS
);
305 if (!dlist
) afh
= NULL
;
308 if (ReqToolsBase
->FontsAssignType
!= dlist
->dol_Type
) afh
= NULL
;
311 if (ReqToolsBase
->FontsAssignLock
!= dlist
->dol_Lock
)
315 fontslist
= ReqToolsBase
->FontsAssignList
;
316 assignlist
= dlist
->dol_misc
.dol_assign
.dol_List
;
320 if (fontslist
->al_Lock
!= assignlist
->al_Lock
)
325 fontslist
= fontslist
->al_Next
;
326 assignlist
= assignlist
->al_Next
;
329 if (fontslist
) afh
= NULL
;
334 if (!afh
) FreeReqToolsFonts();
342 if (!(afh
= AllocVec (buffsize
, 0))) break;
344 shortage
= AvailFonts ((STRPTR
)afh
, buffsize
, AFF_DISK
|AFF_MEMORY
);
347 buffsize
+= shortage
;
353 ReqToolsBase
->AvailFontsHeader
= afh
;
356 ReqToolsBase
->FontsAssignType
= dlist
->dol_Type
;
357 ReqToolsBase
->FontsAssignLock
= dlist
->dol_Lock
;
359 if (dlist
->dol_Type
== DLT_DIRECTORY
)
361 assignlist
= dlist
->dol_misc
.dol_assign
.dol_List
;
362 prevassign
= &(ReqToolsBase
->FontsAssignList
);
366 fontslist
= AllocVec (sizeof (struct AssignList
), MEMF_CLEAR
);
367 *prevassign
= fontslist
;
369 if (!fontslist
) break;
371 fontslist
->al_Lock
= assignlist
->al_Lock
;
372 assignlist
= assignlist
->al_Next
;
373 prevassign
= &(fontslist
->al_Next
);
383 UnLockDosList (LDF_DEVICES
|LDF_ASSIGNS
|LDF_READ
);
389 af
= (struct AvailFonts
*)((long)afh
+ 2);
390 for (i
= 0; i
< afh
->afh_NumEntries
; i
++, af
++)
392 if ((af
->af_Type
== AFF_MEMORY
) &&
393 !(af
->af_Attr
.ta_Flags
& FPF_ROMFONT
)) continue;
395 if (glob
->filterhook
)
397 if (!CallHookPkt (glob
->filterhook
, fontreq
, &af
->af_Attr
))
402 if (glob
->flags
& FREQF_DOWILDFUNC
)
404 IPTR args
[] = { REQHOOK_WILDFONT
, (IPTR
)&af
->af_Attr
};
405 if (CallHookA (fontreq
->Hook
, (Object
*)fontreq
, args
))
410 str
= af
->af_Attr
.ta_Name
;
411 val
= strlen(str
) - 5;
414 if (!(entry
= AddEntry (glob
, buff
, str
, af
->af_Attr
.ta_YSize
, FONT
)))
418 entry
->re_Flags
= af
->af_Attr
.ta_Flags
;
419 entry
->re_Style
= af
->af_Attr
.ta_Style
;
423 val
= strlen(str
) - 5;
425 FindCurrentPos (glob
, str
, glob
->fontreq
->Attr
.ta_YSize
, FONT
);
430 ReqToolsBase
->AvailFontsLock
= FALSE
;
431 RethinkReqDisplay (glob
);
432 rtUnlockWindow (glob
->reqwin
, winlock
);
434 } /* else if (glob->reqtype == RT_FONTREQ) */
438 while ((id
= NextDisplayInfo (id
)) != INVALID_ID
)
440 if (glob
->filterhook
)
442 if (!CallHookPkt (glob
->filterhook
, glob
->scrmodereq
, (APTR
)id
))
446 /* filter out dual playfield modes */
447 if (id
& DUALPF
) continue;
448 /* filter out modes with default monitor */
449 if ((id
& MONITOR_ID_MASK
) == DEFAULT_MONITOR_ID
) continue;
450 if (!GetModeData (glob
, id
, &mon
)) continue;
451 /* is mode available ? */
452 if (glob
->dispinfo
.NotAvailable
) continue;
453 if (!(entry
= AddEntry (glob
, buff
, glob
->nameinfo
.Name
, id
, SCRMODE
)))
456 /* get mode data for currently selected mode */
457 GetModeData (glob
, glob
->modeid
, &mon
);
459 if (!FindCurrentPos (glob
, glob
->nameinfo
.Name
, glob
->modeid
, SCRMODE
))
461 if (glob
->firstentry
->re_Next
)
463 glob
->modeid
= (ULONG
)(((struct ReqEntry
*)glob
->firstentry
->re_Next
)->re_Size
);
464 SetTextGad (glob
, glob
->modetxtgad
, ((struct ReqEntry
*)glob
->firstentry
->re_Next
)->re_Name
);
465 GetModeData (glob
, glob
->modeid
, &mon
);
469 glob
->modeid
= INVALID_ID
;
470 SetTextGad (glob
, glob
->modetxtgad
, NULL
);
474 glob
->currmindepth
= glob
->currmaxdepth
= glob
->maxdepth
= glob
->mindepth
= glob
->depth
= 0;
475 UpdateDepthGad (glob
);
476 myGT_SetGadgetAttrs (glob
->maxcolgad
, glob
->reqwin
, NULL
, GTTX_Text
, (IPTR
) "0", TAG_END
);
479 if (glob
->flags
& SCREQF_SIZEGADS
)
481 myGT_SetGadgetAttrs (glob
->widthgad
, glob
->reqwin
, NULL
, GA_Disabled
, TRUE
, TAG_END
);
482 myGT_SetGadgetAttrs (glob
->defwgad
, glob
->reqwin
, NULL
, GA_Disabled
, TRUE
, TAG_END
);
483 myGT_SetGadgetAttrs (glob
->heightgad
, glob
->reqwin
, NULL
, GA_Disabled
, TRUE
, TAG_END
);
484 myGT_SetGadgetAttrs (glob
->defhgad
, glob
->reqwin
, NULL
, GA_Disabled
, TRUE
, TAG_END
);
487 if (glob
->flags
& SCREQF_OVERSCANGAD
)
488 myGT_SetGadgetAttrs (glob
->overscangad
, glob
->reqwin
, NULL
, GA_Disabled
, TRUE
, TAG_END
);
490 if (glob
->flags
& SCREQF_AUTOSCROLLGAD
)
491 myGT_SetGadgetAttrs (glob
->checkboxgad
[CHECKBOX_AUTOSCROLL
], glob
->reqwin
, NULL
,
492 GA_Disabled
, TRUE
, TAG_END
);
495 } /* else if (glob->reqtype == RT_FONTREQ)*/
497 GetModeDimensions (glob
);
498 DisplayModeAttrs (glob
);
499 RethinkReqDisplay (glob
);
502 } /* if (!glob->bufferentry) */
504 glob
->bufferentry
= glob
->newdir
= FALSE
;
506 } /* if (glob->newdir) */
510 if ((glob
->exnext
= ExNext (glob
->lock
, &glob
->fib
)))
512 ULONG size
= glob
->fib
.fib_Size
;
514 ctype
= glob
->fib
.fib_EntryType
;
516 /* Try to examine links */
517 if( ( glob
->fib
.fib_EntryType
== ST_SOFTLINK
) && ExpandLink( glob
) )
519 size
= glob
->linkfib
.fib_Size
;
520 ctype
= glob
->linkfib
.fib_EntryType
;
524 if (glob
->filterhook
)
526 SetDrawerAndFileFields (glob
);
527 val
= CallHookPkt (glob
->filterhook
, freq
, &glob
->fib
);
528 ResetDrawerAndFileFields (glob
);
530 if (!val
) goto skipfile
;
534 if (glob
->flags
& FREQF_DOWILDFUNC
)
536 IPTR args
[] = { REQHOOK_WILDFILE
, (IPTR
)&glob
->fib
};
537 SetDrawerAndFileFields (glob
);
538 val
= CallHookA (freq
->Hook
, (Object
*)freq
, args
);
539 ResetDrawerAndFileFields (glob
);
541 if (val
) goto skipfile
;
545 ctype
= ( ctype
> 0 ) ? glob
->directory_id
: glob
->file_id
;
547 if( !AddEntry( glob
, buff
, glob
->fib
.fib_FileName
, size
, ctype
) )
548 glob
->exnext
= FALSE
;
553 } /* if ((glob->exnext = ExNext (glob->lock, &glob->fib))) */
557 UnLockReqLock (glob
);
561 } /* if (glob->exnext) */
567 while ((imsg
= (struct IntuiMessage
*)GetMsg (glob
->reqwin
->UserPort
)))
569 /* Reply message from timer.device ? */
570 if ((struct timerequest
*)imsg
== &glob
->timereq
)
572 glob
->timerstarted
= FALSE
;
577 /* Message from string gadget hook ? */
578 if (!imsg
->Class
&& !imsg
->Seconds
)
580 /* Mark message so string gadget hook knows it has been received */
583 if (glob
->selectedpos
!= -1)
585 DeselectFiles (glob
, -1, FALSE
);
586 CountAllDeselect (glob
, FALSE
);
587 UpdateNumSelGad (glob
);
588 glob
->selectedpos
= -1;
591 if (*glob
->filestr
&& !glob
->disks
)
592 FindEntryPos (glob
, glob
->filestr
, glob
->file_id
);
596 if ((reqmsg
= ProcessWin_Msg_Freq (glob
, imsg
))) break;
601 memcpy( &im
, reqmsg
, sizeof( im
) );
602 Reply_GT_Msg (reqmsg
);
604 gad
= (struct Gadget
*)im
.IAddress
;
610 case IDCMP_DISKINSERTED
:
611 case IDCMP_DISKREMOVED
:
619 case IDCMP_REFRESHWINDOW
:
620 RenderReqWindow (glob
, TRUE
, FALSE
);
623 case IDCMP_CLOSEWINDOW
:
624 FreeAllCheckBuffer (glob
);
630 strcpy (glob
->tempfname
, glob
->filestr
);
632 RemoveGList (glob
->reqwin
, glob
->buttoninfo
.glist
, -1);
633 my_FreeGadgets (glob
->buttoninfo
.glist
);
634 glob
->buttoninfo
.glist
= NULL
;
635 my_FreeLabelImages (&glob
->labelimages
);
636 glob
->labelimages
.NextImage
= NULL
;
637 glob
->reqheight
= glob
->reqwin
->Height
;
639 if (!SetupReqWindow (glob
, TRUE
))
641 glob
->reqheight
= glob
->reqwin
->MinHeight
;
642 glob
->reqwidth
= glob
->reqwin
->MinWidth
;
644 if (!SetupReqWindow (glob
, TRUE
))
647 FreeAllCheckBuffer (glob
);
652 my_SetStringGadget (glob
->reqwin
, glob
->filegad
, glob
->tempfname
);
654 if (!glob
->nodir
|| glob
->disks
)
656 i
= glob
->buff
->currentnum
- glob
->numentries
;
659 glob
->buff
->gotopos
= glob
->buff
->pos
= 0;
660 else if (glob
->buff
->pos
> i
)
661 glob
->buff
->gotopos
= glob
->buff
->pos
= i
;
663 AdjustScroller (glob
);
664 UpdateDisplayList (glob
);
667 RenderReqWindow (glob
, FALSE
, FALSE
);
670 case IDCMP_MOUSEMOVE
:
671 if (!glob
->downgadget
) break;
673 if (glob
->downgadget
== FILES
)
675 if (glob
->clicked
!= ~0)
677 clicked
= CalcClicked (glob
, &im
);
678 sel
= !(glob
->displaylist
[glob
->clicked
]->re_Flags
& ENTRYF_HIGHLIGHTED
);
679 val
= !(clicked
!= glob
->clicked
|| im
.MouseX
< glob
->boxleft
680 || im
.MouseX
> glob
->boxright
);
681 if (val
== sel
) CompClicked (glob
);
684 else if (gad
->GadgetID
== FPROP
) ScrollerMoved (glob
, code
);
685 else if (gad
->GadgetID
== DEPTH
) UpdateDepthDisplay (glob
, code
, glob
->modeid
);
688 case IDCMP_MOUSEBUTTONS
:
689 glob
->downgadget
= 0;
691 if( glob
->reqtype
== RT_FILEREQ
)
693 if( ( code
== MENUDOWN
) && !glob
->volumerequest
)
701 strcpy( fdir
, glob
->drawerstr
);
705 else if( code
== MIDDLEDOWN
)
709 doit
= rtLockPrefs()->Flags
& RTPRF_MMBPARENT
;
721 case IDCMP_GADGETDOWN
:
723 glob
->downgadget
= id
= gad
->GadgetID
;
727 clicked
= CalcClicked (glob
, &im
);
728 if (ClickDown (glob
, clicked
, &im
, qual
))
729 return (LeaveReq (glob
, filename
));
731 else if (id
== FPROP
)
733 ScrollerMoved (glob
, code
);
738 if ((glob
->reqtype
== RT_FILEREQ
) && !(glob
->flags
& FREQF_NOFILES
) &&
739 (code
== RAWKEY_UP
|| code
== RAWKEY_DOWN
))
741 glob
->activegadget
= glob
->mainstrgad
;
743 if (glob
->selectcurrpos
|| !glob
->buff
->firstname
) break;
745 lastpos
= glob
->selectedpos
;
747 if (glob
->selectedpos
== -1)
749 if (qual
& IEQUALIFIER_SHIFT
)
751 if (code
== RAWKEY_UP
)
752 glob
->selectedpos
= glob
->buff
->pos
;
754 glob
->selectedpos
= glob
->buff
->pos
+
755 MIN (glob
->numentries
, glob
->buff
->currentnum
) - 1;
757 else if (qual
& IEQUALIFIER_CONTROL
)
759 if (code
== RAWKEY_UP
) glob
->selectedpos
= 0;
760 else glob
->selectedpos
= glob
->buff
->currentnum
- 1;
764 if (glob
->disks
) i
= (qual
& IEQUALIFIER_ALT
) ? ASSIGN
: VOLUME
;
765 else i
= (qual
& IEQUALIFIER_ALT
) ? glob
->directory_id
: glob
->file_id
;
766 glob
->selectedpos
= FindEntryPos (glob
, glob
->filestr
, i
);
771 if (code
== RAWKEY_UP
)
773 if (qual
& IEQUALIFIER_SHIFT
)
775 if (glob
->selectedpos
!= glob
->buff
->pos
)
776 glob
->selectedpos
= glob
->buff
->pos
;
777 else glob
->selectedpos
-= (glob
->numentries
- 1);
778 if (glob
->selectedpos
< 0) glob
->selectedpos
= 0;
780 else if (qual
& IEQUALIFIER_CONTROL
)
781 glob
->selectedpos
= 0;
782 else if (glob
->selectedpos
) glob
->selectedpos
--;
786 if (qual
& IEQUALIFIER_SHIFT
)
788 val
= (glob
->buff
->pos
+ glob
->numentries
- 1);
789 if (glob
->selectedpos
!= val
) glob
->selectedpos
= val
;
790 else glob
->selectedpos
+= glob
->numentries
- 1;
791 if (glob
->selectedpos
>= glob
->buff
->currentnum
)
792 glob
->selectedpos
= glob
->buff
->currentnum
- 1;
794 else if (qual
& IEQUALIFIER_CONTROL
)
795 glob
->selectedpos
= glob
->buff
->currentnum
- 1;
796 else if (glob
->selectedpos
< (glob
->buff
->currentnum
- 1))
801 if (glob
->selectedpos
!= lastpos
)
803 i
= (glob
->selectedpos
- glob
->buff
->pos
);
804 val
= glob
->buff
->gotopos
;
809 if (val
< 0) val
= 0;
812 if (i
>= glob
->numentries
)
814 val
+= (i
- glob
->numentries
) + 1;
815 if (val
> (glob
->buff
->currentnum
- glob
->numentries
))
816 val
= (glob
->buff
->currentnum
- glob
->numentries
);
818 ScrollerMoved (glob
, val
);
820 if (glob
->buff
->pos
!= glob
->buff
->gotopos
)
821 AdjustScroller (glob
);
823 glob
->selectcurrpos
= TRUE
;
828 if ((id
= CheckGadgetKey (code
, qual
, &key
, &glob
->buttoninfo
)))
834 if (key
== 27) /* Esc? */
836 else if (key
== glob
->gadkey
[CHECKBOX_AUTOSCROLL
])
837 checkbox
= CHECKBOX_AUTOSCROLL
;
838 else if (key
== glob
->gadkey
[CHECKBOX_BOLD
])
839 checkbox
= CHECKBOX_BOLD
;
840 else if (key
== glob
->gadkey
[CHECKBOX_ITALIC
])
841 checkbox
= CHECKBOX_ITALIC
;
842 else if (key
== glob
->gadkey
[CHECKBOX_UNDERLINE
])
843 checkbox
= CHECKBOX_UNDERLINE
;
844 else if (key
== glob
->patkey
) gad
= glob
->patgad
;
845 else if (key
== glob
->heightkey
) gad
= glob
->heightgad
;
846 else if (key
== glob
->widthkey
) gad
= glob
->widthgad
;
847 else if (key
== glob
->overscankey
)
849 if (glob
->overscangad
)
851 if (qual
& IEQUALIFIER_SHIFT
)
852 glob
->overscantype
--;
854 glob
->overscantype
++;
856 if (glob
->overscantype
> OSCAN_MAX
) glob
->overscantype
= 0;
857 if (glob
->overscantype
< 0) glob
->overscantype
= OSCAN_MAX
;
859 code
= glob
->overscantype
;
860 myGT_SetGadgetAttrs (glob
->overscangad
, glob
->reqwin
, NULL
,
861 GTCY_Active
, code
, TAG_END
);
866 else if (key
== glob
->depthkey
)
870 if (qual
& IEQUALIFIER_SHIFT
)
872 if (glob
->depth
> glob
->currmindepth
) glob
->depth
--;
876 if (glob
->depth
< glob
->currmaxdepth
) glob
->depth
++;
878 UpdateDepthGad (glob
);
882 if (gad
) glob
->activegadget
= gad
;
886 if ((gad
= glob
->checkboxgad
[checkbox
]))
889 struct TagItem get_tags
[] =
891 {GTCB_Checked
, (IPTR
)&checked
},
896 /* the other way (checking GFLG_SELECTED) does
897 not work with AROS gadtools.library, and in
898 general not with boopsi gadgets. Only with
899 non-boopsi bool gadgets it works (but not
902 GT_GetGadgetAttrsA(gad
, glob
->reqwin
, NULL
, get_tags
);
903 myGT_SetGadgetAttrs (gad
, glob
->reqwin
, NULL
,
904 GTCB_Checked
, !checked
, TAG_END
);
907 myGT_SetGadgetAttrs (gad
, glob
->reqwin
, NULL
,
908 GTCB_Checked
, !(gad
->Flags
& GFLG_SELECTED
), TAG_END
);
917 /* AROS gadtools library gadgets are boopsi gadgets, so checking
918 for GTYP_STRGADGET does not work*/
919 if ((code
== KEYB_SHORTCUT
) && ((gad
->GadgetID
== PATSTR
) ||
920 (gad
->GadgetID
== DRAWERSTR
) ||
921 (gad
->GadgetID
== FILESTR
)) )
925 if (((gad
->GadgetType
& GTYP_GTYPEMASK
) == GTYP_STRGADGET
)
926 && (code
== KEYB_SHORTCUT
))
936 glob
->downgadget
= 0;
940 clicked
= CalcClicked (glob
, &im
);
942 if (clicked
!= glob
->clicked
) break;
944 entry
= glob
->displaylist
[clicked
];
945 str
= entry
->re_Name
;
946 doubleclick
= ((clicked
== glob
->lastclicked
)
947 && DoubleClick (glob
->sec
, glob
->mic
, im
.Seconds
, im
.Micros
));
948 ctype
= entry
->re_Type
;
950 if (ctype
== glob
->directory_id
)
952 if (!(glob
->flags
& FREQF_SELECTDIRS
))
954 AddPart (fdir
, str
, 256);
957 /* CHECKME: added hoping to fix MuForce hit. See below. */
973 while (*str2
!= ' ') str2
++;
975 while (*str3
== ' ') str3
++;
976 if ((glob
->volumerequest
&& !( *str
== '-' && str
[ 1 ] == ' ' ))
978 || FindVolume (glob
, str3
, entry
))
983 else strcpy (fdir
, str3
);
985 else strcpy (fdir
, str
);
987 if (!glob
->volumerequest
)
991 /* CHECKME: added hoping to fix MuForce hit. See below. */
1000 my_SetStringGadget (glob
->reqwin
, glob
->drawergad
, fdir
);
1003 return (LeaveReq (glob
, filename
));
1005 goto rememberclicked
;
1009 strcpy (filename
, str
);
1010 StrCat (filename
, DOTFONTSTR
);
1011 my_SetStringGadget (glob
->reqwin
,
1012 glob
->filegad
, filename
);
1014 return (LeaveReq (glob
, filename
));
1016 fontreq
->Attr
.ta_YSize
= entry
->re_Size
;
1017 fontreq
->Attr
.ta_Flags
= entry
->re_Flags
;
1018 fontreq
->Attr
.ta_Style
= entry
->re_Style
;
1019 fontreq
->Attr
.ta_Style
&= ~(FSF_ITALIC
|FSF_BOLD
|FSF_UNDERLINED
);
1020 fontreq
->Attr
.ta_Style
|= glob
->fontstyle
;
1021 my_SetIntegerGadget (glob
->reqwin
,
1022 glob
->drawergad
, entry
->re_Size
);
1023 ShowFontSample (glob
, FALSE
, TRUE
);
1025 glob
->lastclicked
= clicked
;
1026 glob
->sec
= im
.Seconds
; glob
->mic
= im
.Micros
;
1031 SetTextGad (glob
, glob
->modetxtgad
, str
);
1032 glob
->modeid
= (ULONG
)entry
->re_Size
;
1033 if (!GetModeData (glob
, glob
->modeid
, &mon
))
1034 DisplayBeep (glob
->scr
);
1037 GetModeDimensions (glob
);
1038 DisplayModeAttrs (glob
);
1040 goto checkdoubleclick
;
1043 #warning check following line. causes MuForces hits on Amiga when clicking
1044 #warning on volume or assign entry. Both with old Amiga reqtools.library and
1045 #warning in new reqtools.library compiled from AROS sources.
1048 entry
->re_Flags
&= ~ENTRYF_HIGHLIGHTED
;
1050 if (entry
) entry
->re_Flags
&= ~ENTRYF_HIGHLIGHTED
;
1055 fontreq
->Attr
.ta_YSize
= ((struct StringInfo
*)glob
->drawergad
->SpecialInfo
)->LongInt
;
1056 ShowFontSample (glob
, FALSE
, TRUE
);
1057 glob
->activegadget
= glob
->mainstrgad
;
1064 struct TagItem get_tags
[] =
1066 {GTCB_Checked
, (IPTR
)&checked
},
1070 GT_GetGadgetAttrsA(glob
->checkboxgad
[CHECKBOX_ITALIC
], glob
->reqwin
, NULL
, get_tags
);
1073 glob
->fontstyle
|= FSF_ITALIC
;
1077 glob
->fontstyle
&= ~FSF_ITALIC
;
1083 if (glob
->checkboxgad
[CHECKBOX_ITALIC
]->Flags
& GFLG_SELECTED
)
1084 glob
->fontstyle
|= FSF_ITALIC
;
1085 else glob
->fontstyle
&= ~FSF_ITALIC
;
1095 struct TagItem get_tags
[] =
1097 {GTCB_Checked
, (IPTR
)&checked
},
1101 GT_GetGadgetAttrsA(glob
->checkboxgad
[CHECKBOX_UNDERLINE
], glob
->reqwin
, NULL
, get_tags
);
1104 glob
->fontstyle
|= FSF_UNDERLINED
;
1108 glob
->fontstyle
&= ~FSF_UNDERLINED
;
1114 if (glob
->checkboxgad
[CHECKBOX_UNDERLINE
]->Flags
& GFLG_SELECTED
)
1115 glob
->fontstyle
|= FSF_UNDERLINED
;
1116 else glob
->fontstyle
&= ~FSF_UNDERLINED
;
1125 struct TagItem get_tags
[] =
1127 {GTCB_Checked
, (IPTR
)&checked
},
1131 GT_GetGadgetAttrsA(glob
->checkboxgad
[CHECKBOX_BOLD
], glob
->reqwin
, NULL
, get_tags
);
1134 glob
->fontstyle
|= FSF_BOLD
;
1138 glob
->fontstyle
&= ~FSF_BOLD
;
1144 if (glob
->checkboxgad
[CHECKBOX_BOLD
]->Flags
& GFLG_SELECTED
)
1145 glob
->fontstyle
|= FSF_BOLD
;
1146 else glob
->fontstyle
&= ~FSF_BOLD
;
1149 ShowFontSample (glob
, FALSE
, TRUE
);
1154 if (!glob
->nodir
&& !glob
->disks
) SelectAll (glob
, "#?");
1159 if (!glob
->nodir
&& !glob
->disks
)
1161 struct TagItem tags
[] =
1163 {RT_Window
, (IPTR
)glob
->reqwin
},
1164 {RT_IntuiMsgFunc
, (IPTR
)&glob
->intuihook
},
1165 {TAG_MORE
, (IPTR
)getstringtags
}
1168 if (rtGetStringA (glob
->selpattern
, 123,
1169 GetStr (glob
->catalog
, MSG_MATCH_WINTITLE
),
1171 SelectAll (glob
, glob
->selpattern
);
1177 if (!glob
->nodir
&& !glob
->disks
)
1179 CountAllDeselect (glob
, FALSE
);
1180 UpdateNumSelGad (glob
);
1182 my_SetStringGadget (glob
->reqwin
, glob
->filegad
, "");
1188 if (Stricmp (freq
->patstr
, glob
->patgadstr
))
1190 strcpy (freq
->patstr
, glob
->patgadstr
);
1191 ParsePatternNoCase (freq
->patstr
, glob
->matchpat
, sizeof( glob
->matchpat
) );
1192 glob
->activegadget
= glob
->mainstrgad
;
1195 glob
->activegadget
= glob
->mainstrgad
;
1200 freq
->hideinfo
= !freq
->hideinfo
;
1202 RethinkReqDisplay (glob
);
1203 UpdateNumSelGad (glob
);
1207 glob
->activegadget
= glob
->mainstrgad
;
1209 if (glob
->flags
& FREQF_NOFILES
)
1211 if (glob
->volumerequest
||
1212 (!glob
->nodir
&& !Stricmp (fdir
, glob
->drawerstr
)))
1214 if (qual
& IEQUALIFIER_SHIFT
) break;
1216 strcpy (fdir
, glob
->drawerstr
);
1217 val
= (glob
->volumerequest
&& !*fdir
);
1218 my_SelectGadget (!val
? glob
->okgad
: glob
->cancelgad
, glob
->reqwin
);
1221 if (val
) goto docancel
;
1223 return (LeaveReq (glob
, filename
));
1227 if (!glob
->nodir
&& !glob
->disks
1228 && !Stricmp (fdir
, glob
->drawerstr
))
1234 strcpy (fdir
, glob
->drawerstr
);
1239 if (code
== 0x09) break;
1241 if (qual
& IEQUALIFIER_SHIFT
)
1243 glob
->activegadget
= glob
->drawergad
;
1247 if ((qual
& IEQUALIFIER_ALT
) && (glob
->flags
& FREQF_PATGAD
))
1249 glob
->activegadget
= glob
->patgad
;
1253 if (glob
->reqtype
== RT_FILEREQ
)
1255 /* extract path from filename if one was entered */
1257 BPTR templock
= NULL
, dirlock
, oldcd
;
1259 str
= glob
->filestr
;
1262 strcpy (tempstr
, str
+ 1);
1263 my_SetStringGadget (glob
->reqwin
, glob
->filegad
,
1270 *glob
->winaddr
= (APTR
)-1;
1272 if ((dirlock
= Lock (glob
->drawerstr
, SHARED_LOCK
)))
1274 oldcd
= CurrentDir (dirlock
);
1275 templock
= Lock (str
, SHARED_LOCK
);
1279 *glob
->winaddr
= glob
->reqwin
;
1281 if (dirlock
) UnLock (dirlock
);
1285 Examine (templock
, &glob
->fib
);
1288 if (glob
->fib
.fib_EntryType
> 0)
1292 strcpy (fdir
, glob
->drawerstr
);
1293 AddPart (fdir
, str
, 256);
1295 else strcpy (fdir
, str
);
1299 goto setfnamedirgads
;
1304 if (PathPart (str
) != str
)
1308 for (i
= 0; i
< val
; i
++)
1317 if (i
>= val
) AddPart (fdir
, str
, 256);
1319 *(PathPart (fdir
)) = 0;
1320 strcpy (tempstr
, FilePart (glob
->filestr
));
1323 my_SetStringGadget (glob
->reqwin
, glob
->filegad
, tempstr
);
1324 my_SetStringGadget (glob
->reqwin
, glob
->drawergad
, fdir
);
1329 } /* if (glob->reqtype == RT_FILEREQ) */
1333 (*glob
->filestr
|| glob
->allowempty
1334 || ((glob
->flags
& FREQF_MULTISELECT
) &&
1335 (glob
->numselected
> 0))
1337 ) ? glob
->okgad
: glob
->cancelgad
, glob
->reqwin
);
1341 return (LeaveReq (glob
, filename
));
1345 FreeAllCheckBuffer (glob
);
1350 UnLockReqLock (glob
);
1351 // strcpy (fdir, glob->drawerstr);
1352 str
= PathPart ( fdir
);
1356 my_SetStringGadget (glob
->reqwin
, glob
->drawergad
, fdir
);
1362 if ((glob
->lock
= Lock (glob
->drawerstr
, SHARED_LOCK
)))
1364 if ((parent
= ParentDir (glob
->lock
)))
1366 NameFromLock (parent
, fdir
, 256);
1383 strcpy (fdir
, glob
->drawerstr
);
1389 UpdateDepthDisplay (glob
, code
, glob
->modeid
);
1394 glob
->width
= IntGadgetBounds (glob
, glob
->widthgad
,
1395 MAX (glob
->diminfo
.MinRasterWidth
, glob
->minwidth
),
1396 MIN (glob
->diminfo
.MaxRasterWidth
, glob
->maxwidth
));
1397 glob
->usedefwidth
= (glob
->width
== glob
->defwidth
);
1398 myGT_SetGadgetAttrs (glob
->defwgad
, glob
->reqwin
, NULL
,
1399 GTCB_Checked
, glob
->usedefwidth
, TAG_END
);
1400 glob
->activegadget
= glob
->mainstrgad
;
1404 glob
->height
= IntGadgetBounds (glob
, glob
->heightgad
,
1405 MAX (glob
->diminfo
.MinRasterHeight
, glob
->minheight
),
1406 MIN (glob
->diminfo
.MaxRasterHeight
, glob
->maxheight
));
1407 glob
->usedefheight
= (glob
->height
== glob
->defheight
);
1408 myGT_SetGadgetAttrs (glob
->defhgad
, glob
->reqwin
, NULL
,
1409 GTCB_Checked
, glob
->usedefheight
, TAG_END
);
1410 glob
->activegadget
= glob
->mainstrgad
;
1414 glob
->usedefwidth
= !glob
->usedefwidth
;
1419 glob
->usedefheight
= !glob
->usedefheight
;
1424 glob
->autoscroll
= !glob
->autoscroll
;
1428 glob
->overscantype
= code
;
1429 GetModeDimensions (glob
);
1436 } /* switch (im.Class) */
1441 if ((glob
->downgadget
!= FILES
) && (glob
->buff
->gotopos
!= glob
->buff
->pos
))
1443 #if NO_SCROLLWINDOWRASTER
1444 BOOL refreshall
= FALSE
;
1447 start
= 0; stop
= glob
->numentries
;
1448 step
= glob
->buff
->gotopos
- glob
->buff
->pos
;
1450 if (ABS(step
) < stop
)
1452 if (ABS(step
) > 1) step
/= 2;
1453 if (step
> 3) step
= 3;
1454 if (step
< -3) step
= -3;
1456 SetBPen (glob
->reqrp
, glob
->pens
[BACKGROUNDPEN
]);
1457 mySetWriteMask (glob
->reqrp
, glob
->entrymask
);
1459 #if !NO_SCROLLWINDOWRASTER
1462 ScrollWindowRaster (glob
->reqwin
, 0, step
* glob
->entryheight
,
1463 glob
->boxleft
, glob
->boxtop
, glob
->boxright
,
1464 glob
->boxtop
+ glob
->boxheight
- 1);
1469 ScrollRaster (glob
->reqrp
, 0, step
* glob
->entryheight
,
1470 glob
->boxleft
, glob
->boxtop
, glob
->boxright
,
1471 glob
->boxtop
+ glob
->boxheight
- 1);
1472 if (glob
->reqrp
->Layer
->Flags
& LAYERREFRESH
)
1473 refreshall
= TRUE
; /* RenderReqWindow (glob, TRUE, FALSE); */
1475 #if !NO_SCROLLWINDOWRASTER
1478 mySetWriteMask (glob
->reqrp
, glob
->rpmask
);
1481 start
= stop
- step
;
1485 } /* if (ABS(step) < stop) */
1487 glob
->buff
->pos
+= step
;
1488 UpdateDisplayList (glob
);
1490 #if NO_SCROLLWINDOWRASTER
1493 RenderReqWindow (glob
, TRUE
, FALSE
);
1497 for (i
= start
; i
< stop
; i
++) PrintEntry (glob
, i
);
1499 glob
->DoNotWait
= TRUE
;
1501 } /* if ((glob->downgadget != FILES) && (glob->buff->gotopos != glob->buff->pos)) */
1504 glob
->DoNotWait
= glob
->exnext
|| glob
->newdir
;
1507 if (glob
->selectcurrpos
&& (glob
->buff
->pos
== glob
->buff
->gotopos
))
1509 if (glob
->selectedpos
!= -1)
1511 ClickDown (glob
, (glob
->selectedpos
- glob
->buff
->pos
), NULL
, 0);
1513 glob
->selectcurrpos
= FALSE
;
1516 } while (reqmsg
&& !glob
->newdir
);
1522 #warning Disabled this gadget activation here, as in Intuition this functions is slow (why? ask stegerg)
1525 ActivateGadget (glob
->activegadget
, glob
->reqwin
, NULL
);
1530 if (!(glob
->reqwin
->IDCMPFlags
& IDCMP_RAWKEY
))
1532 /* Add RAWKEY IDCMP only after initialzing and refreshing the window */
1533 ModifyIDCMP (glob
->reqwin
, IDCMP_RAWKEY
|REQ_IDCMP
);
1537 return ((ULONG
)CALL_HANDLER
);
1540 /****************************************************************************************/