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 IPTR 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
;
112 struct TagItem
*tag
, *tstate
= taglist
;
113 struct AvailFontsHeader
*afh
;
114 struct AvailFonts
*af
;
115 struct ReqEntry
*entry
;
116 struct DosList
*dlist
;
117 struct AppMessage
*appmsg
;
118 struct AssignList
*assignlist
, *fontslist
, **prevassign
;
119 int clicked
, ctype
, sel
, val
, code
, qual
, doubleclick
, checkbox
;
120 int i
, step
, start
, stop
, shortage
, buffsize
, mon
, doactgad
, lastpos
;
121 UBYTE
*fdir
= NULL
, *filename
= NULL
, *str
, *str2
, *str3
, key
;
127 /* uncomment if sigs is no longer ignored */
128 // if (glob->DoNotWait) sigs = SetSignal (0, 0);
130 doactgad
= !(glob
->buttoninfo
.lastcode
);
132 if (glob
->reqtype
== RT_FILEREQ
)
135 filename
= freq
->filename
;
136 fdir
= freq
->dirname
;
139 if (glob
->reqtype
== RT_FONTREQ
)
141 fontreq
= glob
->fontreq
;
142 filename
= fontreq
->fontname
;
148 while ((tag
= NextTagItem (&tstate
)))
150 tagdata
= tag
->ti_Data
;
151 if (tag
->ti_Tag
> RT_TagBase
)
155 case RTRH_EndRequest
:
156 if (tagdata
== REQ_OK
)
157 return (LeaveReq (glob
, filename
));
159 FreeAllCheckBuffer (glob
);
169 if (glob
->appwinport
)
171 while ((appmsg
= (struct AppMessage
*)GetMsg (glob
->appwinport
)))
173 if (appmsg
->am_Type
== MTYPE_APPWINDOW
)
175 if (appmsg
->am_NumArgs
>= 1)
177 NameFromLock (appmsg
->am_ArgList
->wa_Lock
, fdir
, 256);
178 my_SetStringGadget (glob
->reqwin
, glob
->filegad
,
179 appmsg
->am_ArgList
->wa_Name
);
182 ReplyMsg ((struct Message
*)appmsg
);
185 ReplyMsg ((struct Message
*)appmsg
);
194 if (!glob
->bufferentry
)
196 ClearFilesRect (glob
);
197 ClearAndInitReqBuffer (glob
);
198 AdjustScroller (glob
);
200 else RethinkReqDisplay (glob
);
202 glob
->selectedpos
= -1;
203 glob
->numselected
= 0;
204 UpdateNumSelGad (glob
);
205 glob
->lastclicked
= -1;
206 glob
->exnext
= FALSE
;
208 if (!glob
->bufferentry
)
210 if (glob
->reqtype
== RT_FILEREQ
)
212 if (!glob
->volumerequest
)
214 /* Render LED before lock, for good behaviour with ArcHandler */
217 if ((glob
->lock
= Lock (fdir
, SHARED_LOCK
)))
219 Examine (glob
->lock
, &glob
->fib
);
220 if (glob
->fib
.fib_EntryType
<= 0)
221 UnLockReqLock (glob
);
223 else if ((glob
->flags
& FREQF_SAVE
) &&
224 fdir
[strlen(fdir
)-1] != ':' &&
225 IoErr() != ERROR_DEVICE_NOT_MOUNTED
)
227 struct TagItem tags
[] =
229 {RT_Window
, (IPTR
)glob
->reqwin
},
230 {RT_IntuiMsgFunc
, (IPTR
)&glob
->intuihook
},
231 {TAG_MORE
, (IPTR
)ezreqtags
}
234 if (rtEZRequestA (GetStr (glob
->catalog
, MSG_CREATE_DRAWER
),
235 GetStr (glob
->catalog
, MSG_OK_BAR_CANCEL
),
236 NULL
, &glob
->drawerstr
, tags
))
237 glob
->lock
= CreateDir (glob
->drawerstr
);
244 SetWinTitleFlash (glob
->reqwin
,
245 GetStr (glob
->catalog
, MSG_DIR_ERROR
));
246 FreeReqBuffer (glob
->req
);
247 ClearDisplayList (glob
);
254 if (fdir
[i
-1] == '/' && i
> 1)
256 if (fdir
[i
-2] != ':' && fdir
[i
-2] != '/') fdir
[i
-1] = 0;
259 my_SetStringGadget (glob
->reqwin
, glob
->drawergad
, fdir
);
262 /* first examine before ExNext */
263 Examine (glob
->lock
, &glob
->fib
);
264 StartTimer (glob
, 500000);
265 glob
->firsttimer
= glob
->quiet
= TRUE
;
269 } /* if (glob->reqtype == RT_FILEREQ) */
272 /* Volume requester */
273 AddDiskNames (glob
, glob
->volumerequest
);
277 if (!FindCurrentPos (glob
, fdir
, MAXINT
, VOLUME
))
278 FindCurrentPos (glob
, fdir
, MAXINT
, ASSIGN
);
280 glob
->buff
->pos
-= (glob
->numentries
- 1);
282 if (glob
->buff
->pos
< 0) glob
->buff
->pos
= 0;
284 glob
->buff
->gotopos
= glob
->buff
->pos
;
287 RethinkReqDisplay (glob
);
290 } /* if (glob->reqtype == RT_FILEREQ) else ... */
292 } /* if (glob->reqtype == RT_FILEREQ) */
293 else if (glob
->reqtype
== RT_FONTREQ
)
295 winlock
= rtLockWindow (glob
->reqwin
);
296 ReqToolsBase
->AvailFontsLock
= TRUE
;
297 afh
= ReqToolsBase
->AvailFontsHeader
;
299 dlist
= LockDosList (LDF_DEVICES
|LDF_ASSIGNS
|LDF_READ
);
300 dlist
= FindDosEntry (dlist
, "FONTS", LDF_DEVICES
|LDF_ASSIGNS
);
304 if (!dlist
) afh
= NULL
;
307 if (ReqToolsBase
->FontsAssignType
!= dlist
->dol_Type
) afh
= NULL
;
310 if (ReqToolsBase
->FontsAssignLock
!= dlist
->dol_Lock
)
314 fontslist
= ReqToolsBase
->FontsAssignList
;
315 assignlist
= dlist
->dol_misc
.dol_assign
.dol_List
;
319 if (fontslist
->al_Lock
!= assignlist
->al_Lock
)
324 fontslist
= fontslist
->al_Next
;
325 assignlist
= assignlist
->al_Next
;
328 if (fontslist
) afh
= NULL
;
333 if (!afh
) FreeReqToolsFonts();
341 if (!(afh
= AllocVec (buffsize
, 0))) break;
343 shortage
= AvailFonts ((STRPTR
)afh
, buffsize
, AFF_DISK
|AFF_MEMORY
);
346 buffsize
+= shortage
;
352 ReqToolsBase
->AvailFontsHeader
= afh
;
355 ReqToolsBase
->FontsAssignType
= dlist
->dol_Type
;
356 ReqToolsBase
->FontsAssignLock
= dlist
->dol_Lock
;
358 if (dlist
->dol_Type
== DLT_DIRECTORY
)
360 assignlist
= dlist
->dol_misc
.dol_assign
.dol_List
;
361 prevassign
= &(ReqToolsBase
->FontsAssignList
);
365 fontslist
= AllocVec (sizeof (struct AssignList
), MEMF_CLEAR
);
366 *prevassign
= fontslist
;
368 if (!fontslist
) break;
370 fontslist
->al_Lock
= assignlist
->al_Lock
;
371 assignlist
= assignlist
->al_Next
;
372 prevassign
= &(fontslist
->al_Next
);
382 UnLockDosList (LDF_DEVICES
|LDF_ASSIGNS
|LDF_READ
);
388 af
= (struct AvailFonts
*)((long)afh
+ 2);
389 for (i
= 0; i
< afh
->afh_NumEntries
; i
++, af
++)
391 if ((af
->af_Type
== AFF_MEMORY
) &&
392 !(af
->af_Attr
.ta_Flags
& FPF_ROMFONT
)) continue;
394 if (glob
->filterhook
)
396 if (!CallHookPkt (glob
->filterhook
, fontreq
, &af
->af_Attr
))
401 if (glob
->flags
& FREQF_DOWILDFUNC
)
403 IPTR args
[] = { REQHOOK_WILDFONT
, (IPTR
)&af
->af_Attr
};
404 if (CallHookA (fontreq
->Hook
, (Object
*)fontreq
, args
))
409 str
= af
->af_Attr
.ta_Name
;
410 val
= strlen(str
) - 5;
413 if (!(entry
= AddEntry (glob
, buff
, str
, af
->af_Attr
.ta_YSize
, FONT
)))
417 entry
->re_Flags
= af
->af_Attr
.ta_Flags
;
418 entry
->re_Style
= af
->af_Attr
.ta_Style
;
422 val
= strlen(str
) - 5;
424 FindCurrentPos (glob
, str
, glob
->fontreq
->Attr
.ta_YSize
, FONT
);
429 ReqToolsBase
->AvailFontsLock
= FALSE
;
430 RethinkReqDisplay (glob
);
431 rtUnlockWindow (glob
->reqwin
, winlock
);
433 } /* else if (glob->reqtype == RT_FONTREQ) */
437 while ((id
= NextDisplayInfo (id
)) != INVALID_ID
)
439 if (glob
->filterhook
)
441 if (!CallHookPkt (glob
->filterhook
, glob
->scrmodereq
, (APTR
)(IPTR
)id
))
445 /* filter out dual playfield modes */
446 if (id
& DUALPF
) continue;
447 /* filter out modes with default monitor */
448 if ((id
& MONITOR_ID_MASK
) == DEFAULT_MONITOR_ID
) continue;
449 if (!GetModeData (glob
, id
, &mon
)) continue;
450 /* is mode available ? */
451 if (glob
->dispinfo
.NotAvailable
) continue;
452 if (!(entry
= AddEntry (glob
, buff
, glob
->nameinfo
.Name
, id
, SCRMODE
)))
455 /* get mode data for currently selected mode */
456 GetModeData (glob
, glob
->modeid
, &mon
);
458 if (!FindCurrentPos (glob
, glob
->nameinfo
.Name
, glob
->modeid
, SCRMODE
))
460 if (glob
->firstentry
->re_Next
)
462 glob
->modeid
= (ULONG
)(((struct ReqEntry
*)glob
->firstentry
->re_Next
)->re_Size
);
463 SetTextGad (glob
, glob
->modetxtgad
, ((struct ReqEntry
*)glob
->firstentry
->re_Next
)->re_Name
);
464 GetModeData (glob
, glob
->modeid
, &mon
);
468 glob
->modeid
= INVALID_ID
;
469 SetTextGad (glob
, glob
->modetxtgad
, NULL
);
473 glob
->currmindepth
= glob
->currmaxdepth
= glob
->maxdepth
= glob
->mindepth
= glob
->depth
= 0;
474 UpdateDepthGad (glob
);
475 myGT_SetGadgetAttrs (glob
->maxcolgad
, glob
->reqwin
, NULL
, GTTX_Text
, (IPTR
) "0", TAG_END
);
478 if (glob
->flags
& SCREQF_SIZEGADS
)
480 myGT_SetGadgetAttrs (glob
->widthgad
, glob
->reqwin
, NULL
, GA_Disabled
, TRUE
, TAG_END
);
481 myGT_SetGadgetAttrs (glob
->defwgad
, glob
->reqwin
, NULL
, GA_Disabled
, TRUE
, TAG_END
);
482 myGT_SetGadgetAttrs (glob
->heightgad
, glob
->reqwin
, NULL
, GA_Disabled
, TRUE
, TAG_END
);
483 myGT_SetGadgetAttrs (glob
->defhgad
, glob
->reqwin
, NULL
, GA_Disabled
, TRUE
, TAG_END
);
486 if (glob
->flags
& SCREQF_OVERSCANGAD
)
487 myGT_SetGadgetAttrs (glob
->overscangad
, glob
->reqwin
, NULL
, GA_Disabled
, TRUE
, TAG_END
);
489 if (glob
->flags
& SCREQF_AUTOSCROLLGAD
)
490 myGT_SetGadgetAttrs (glob
->checkboxgad
[CHECKBOX_AUTOSCROLL
], glob
->reqwin
, NULL
,
491 GA_Disabled
, TRUE
, TAG_END
);
494 } /* else if (glob->reqtype == RT_FONTREQ)*/
496 GetModeDimensions (glob
);
497 DisplayModeAttrs (glob
);
498 RethinkReqDisplay (glob
);
501 } /* if (!glob->bufferentry) */
503 glob
->bufferentry
= glob
->newdir
= FALSE
;
505 } /* if (glob->newdir) */
509 if ((glob
->exnext
= ExNext (glob
->lock
, &glob
->fib
)))
511 ULONG size
= glob
->fib
.fib_Size
;
513 ctype
= glob
->fib
.fib_EntryType
;
515 /* Try to examine links */
516 if( ( glob
->fib
.fib_EntryType
== ST_SOFTLINK
) && ExpandLink( glob
) )
518 size
= glob
->linkfib
.fib_Size
;
519 ctype
= glob
->linkfib
.fib_EntryType
;
523 if (glob
->filterhook
)
525 SetDrawerAndFileFields (glob
);
526 val
= CallHookPkt (glob
->filterhook
, freq
, &glob
->fib
);
527 ResetDrawerAndFileFields (glob
);
529 if (!val
) goto skipfile
;
533 if (glob
->flags
& FREQF_DOWILDFUNC
)
535 IPTR args
[] = { REQHOOK_WILDFILE
, (IPTR
)&glob
->fib
};
536 SetDrawerAndFileFields (glob
);
537 val
= CallHookA (freq
->Hook
, (Object
*)freq
, args
);
538 ResetDrawerAndFileFields (glob
);
540 if (val
) goto skipfile
;
544 ctype
= ( ctype
> 0 ) ? glob
->directory_id
: glob
->file_id
;
546 if( !AddEntry( glob
, buff
, glob
->fib
.fib_FileName
, size
, ctype
) )
547 glob
->exnext
= FALSE
;
552 } /* if ((glob->exnext = ExNext (glob->lock, &glob->fib))) */
556 UnLockReqLock (glob
);
560 } /* if (glob->exnext) */
566 while ((imsg
= (struct IntuiMessage
*)GetMsg (glob
->reqwin
->UserPort
)))
568 /* Reply message from timer.device ? */
569 if ((struct timerequest
*)imsg
== &glob
->timereq
)
571 glob
->timerstarted
= FALSE
;
576 /* Message from string gadget hook ? */
577 if (!imsg
->Class
&& !imsg
->Seconds
)
579 /* Mark message so string gadget hook knows it has been received */
582 if (glob
->selectedpos
!= -1)
584 DeselectFiles (glob
, -1, FALSE
);
585 CountAllDeselect (glob
, FALSE
);
586 UpdateNumSelGad (glob
);
587 glob
->selectedpos
= -1;
590 if (*glob
->filestr
&& !glob
->disks
)
591 FindEntryPos (glob
, glob
->filestr
, glob
->file_id
);
595 if ((reqmsg
= ProcessWin_Msg_Freq (glob
, imsg
))) break;
600 memcpy( &im
, reqmsg
, sizeof( im
) );
601 Reply_GT_Msg (reqmsg
);
603 gad
= (struct Gadget
*)im
.IAddress
;
609 case IDCMP_DISKINSERTED
:
610 case IDCMP_DISKREMOVED
:
618 case IDCMP_REFRESHWINDOW
:
619 RenderReqWindow (glob
, TRUE
, FALSE
);
622 case IDCMP_CLOSEWINDOW
:
623 FreeAllCheckBuffer (glob
);
629 strcpy (glob
->tempfname
, glob
->filestr
);
631 RemoveGList (glob
->reqwin
, glob
->buttoninfo
.glist
, -1);
632 my_FreeGadgets (glob
->buttoninfo
.glist
);
633 glob
->buttoninfo
.glist
= NULL
;
634 my_FreeLabelImages (&glob
->labelimages
);
635 glob
->labelimages
.NextImage
= NULL
;
636 glob
->reqheight
= glob
->reqwin
->Height
;
638 if (!SetupReqWindow (glob
, TRUE
))
640 glob
->reqheight
= glob
->reqwin
->MinHeight
;
641 glob
->reqwidth
= glob
->reqwin
->MinWidth
;
643 if (!SetupReqWindow (glob
, TRUE
))
646 FreeAllCheckBuffer (glob
);
651 my_SetStringGadget (glob
->reqwin
, glob
->filegad
, glob
->tempfname
);
653 if (!glob
->nodir
|| glob
->disks
)
655 i
= glob
->buff
->currentnum
- glob
->numentries
;
658 glob
->buff
->gotopos
= glob
->buff
->pos
= 0;
659 else if (glob
->buff
->pos
> i
)
660 glob
->buff
->gotopos
= glob
->buff
->pos
= i
;
662 AdjustScroller (glob
);
663 UpdateDisplayList (glob
);
666 RenderReqWindow (glob
, FALSE
, FALSE
);
669 case IDCMP_MOUSEMOVE
:
670 if (!glob
->downgadget
) break;
672 if (glob
->downgadget
== FILES
)
674 if (glob
->clicked
!= ~0)
676 clicked
= CalcClicked (glob
, &im
);
677 sel
= !(glob
->displaylist
[glob
->clicked
]->re_Flags
& ENTRYF_HIGHLIGHTED
);
678 val
= !(clicked
!= glob
->clicked
|| im
.MouseX
< glob
->boxleft
679 || im
.MouseX
> glob
->boxright
);
680 if (val
== sel
) CompClicked (glob
);
683 else if (gad
->GadgetID
== FPROP
) ScrollerMoved (glob
, code
);
684 else if (gad
->GadgetID
== DEPTH
) UpdateDepthDisplay (glob
, code
, glob
->modeid
);
687 case IDCMP_MOUSEBUTTONS
:
688 glob
->downgadget
= 0;
690 if( glob
->reqtype
== RT_FILEREQ
)
692 if( ( code
== MENUDOWN
) && !glob
->volumerequest
)
700 strcpy( fdir
, glob
->drawerstr
);
704 else if( code
== MIDDLEDOWN
)
708 doit
= rtLockPrefs()->Flags
& RTPRF_MMBPARENT
;
720 case IDCMP_GADGETDOWN
:
722 glob
->downgadget
= id
= gad
->GadgetID
;
726 clicked
= CalcClicked (glob
, &im
);
727 if (ClickDown (glob
, clicked
, &im
, qual
))
728 return (LeaveReq (glob
, filename
));
730 else if (id
== FPROP
)
732 ScrollerMoved (glob
, code
);
737 if ((glob
->reqtype
== RT_FILEREQ
) && !(glob
->flags
& FREQF_NOFILES
) &&
738 (code
== RAWKEY_UP
|| code
== RAWKEY_DOWN
))
740 glob
->activegadget
= glob
->mainstrgad
;
742 if (glob
->selectcurrpos
|| !glob
->buff
->firstname
) break;
744 lastpos
= glob
->selectedpos
;
746 if (glob
->selectedpos
== -1)
748 if (qual
& IEQUALIFIER_SHIFT
)
750 if (code
== RAWKEY_UP
)
751 glob
->selectedpos
= glob
->buff
->pos
;
753 glob
->selectedpos
= glob
->buff
->pos
+
754 MIN (glob
->numentries
, glob
->buff
->currentnum
) - 1;
756 else if (qual
& IEQUALIFIER_CONTROL
)
758 if (code
== RAWKEY_UP
) glob
->selectedpos
= 0;
759 else glob
->selectedpos
= glob
->buff
->currentnum
- 1;
763 if (glob
->disks
) i
= (qual
& IEQUALIFIER_ALT
) ? ASSIGN
: VOLUME
;
764 else i
= (qual
& IEQUALIFIER_ALT
) ? glob
->directory_id
: glob
->file_id
;
765 glob
->selectedpos
= FindEntryPos (glob
, glob
->filestr
, i
);
770 if (code
== RAWKEY_UP
)
772 if (qual
& IEQUALIFIER_SHIFT
)
774 if (glob
->selectedpos
!= glob
->buff
->pos
)
775 glob
->selectedpos
= glob
->buff
->pos
;
776 else glob
->selectedpos
-= (glob
->numentries
- 1);
777 if (glob
->selectedpos
< 0) glob
->selectedpos
= 0;
779 else if (qual
& IEQUALIFIER_CONTROL
)
780 glob
->selectedpos
= 0;
781 else if (glob
->selectedpos
) glob
->selectedpos
--;
785 if (qual
& IEQUALIFIER_SHIFT
)
787 val
= (glob
->buff
->pos
+ glob
->numentries
- 1);
788 if (glob
->selectedpos
!= val
) glob
->selectedpos
= val
;
789 else glob
->selectedpos
+= glob
->numentries
- 1;
790 if (glob
->selectedpos
>= glob
->buff
->currentnum
)
791 glob
->selectedpos
= glob
->buff
->currentnum
- 1;
793 else if (qual
& IEQUALIFIER_CONTROL
)
794 glob
->selectedpos
= glob
->buff
->currentnum
- 1;
795 else if (glob
->selectedpos
< (glob
->buff
->currentnum
- 1))
800 if (glob
->selectedpos
!= lastpos
)
802 i
= (glob
->selectedpos
- glob
->buff
->pos
);
803 val
= glob
->buff
->gotopos
;
808 if (val
< 0) val
= 0;
811 if (i
>= glob
->numentries
)
813 val
+= (i
- glob
->numentries
) + 1;
814 if (val
> (glob
->buff
->currentnum
- glob
->numentries
))
815 val
= (glob
->buff
->currentnum
- glob
->numentries
);
817 ScrollerMoved (glob
, val
);
819 if (glob
->buff
->pos
!= glob
->buff
->gotopos
)
820 AdjustScroller (glob
);
822 glob
->selectcurrpos
= TRUE
;
827 if ((id
= CheckGadgetKey (code
, qual
, &key
, &glob
->buttoninfo
)))
833 if (key
== 27) /* Esc? */
835 else if (key
== glob
->gadkey
[CHECKBOX_AUTOSCROLL
])
836 checkbox
= CHECKBOX_AUTOSCROLL
;
837 else if (key
== glob
->gadkey
[CHECKBOX_BOLD
])
838 checkbox
= CHECKBOX_BOLD
;
839 else if (key
== glob
->gadkey
[CHECKBOX_ITALIC
])
840 checkbox
= CHECKBOX_ITALIC
;
841 else if (key
== glob
->gadkey
[CHECKBOX_UNDERLINE
])
842 checkbox
= CHECKBOX_UNDERLINE
;
843 else if (key
== glob
->patkey
) gad
= glob
->patgad
;
844 else if (key
== glob
->heightkey
) gad
= glob
->heightgad
;
845 else if (key
== glob
->widthkey
) gad
= glob
->widthgad
;
846 else if (key
== glob
->overscankey
)
848 if (glob
->overscangad
)
850 if (qual
& IEQUALIFIER_SHIFT
)
851 glob
->overscantype
--;
853 glob
->overscantype
++;
855 if (glob
->overscantype
> OSCAN_MAX
) glob
->overscantype
= 0;
856 if (glob
->overscantype
< 0) glob
->overscantype
= OSCAN_MAX
;
858 code
= glob
->overscantype
;
859 myGT_SetGadgetAttrs (glob
->overscangad
, glob
->reqwin
, NULL
,
860 GTCY_Active
, code
, TAG_END
);
865 else if (key
== glob
->depthkey
)
869 if (qual
& IEQUALIFIER_SHIFT
)
871 if (glob
->depth
> glob
->currmindepth
) glob
->depth
--;
875 if (glob
->depth
< glob
->currmaxdepth
) glob
->depth
++;
877 UpdateDepthGad (glob
);
881 if (gad
) glob
->activegadget
= gad
;
885 if ((gad
= glob
->checkboxgad
[checkbox
]))
888 struct TagItem get_tags
[] =
890 {GTCB_Checked
, (IPTR
)&checked
},
895 /* the other way (checking GFLG_SELECTED) does
896 not work with AROS gadtools.library, and in
897 general not with boopsi gadgets. Only with
898 non-boopsi bool gadgets it works (but not
901 GT_GetGadgetAttrsA(gad
, glob
->reqwin
, NULL
, get_tags
);
902 myGT_SetGadgetAttrs (gad
, glob
->reqwin
, NULL
,
903 GTCB_Checked
, !checked
, TAG_END
);
906 myGT_SetGadgetAttrs (gad
, glob
->reqwin
, NULL
,
907 GTCB_Checked
, !(gad
->Flags
& GFLG_SELECTED
), TAG_END
);
916 /* AROS gadtools library gadgets are boopsi gadgets, so checking
917 for GTYP_STRGADGET does not work*/
918 if ((code
== KEYB_SHORTCUT
) && ((gad
->GadgetID
== PATSTR
) ||
919 (gad
->GadgetID
== DRAWERSTR
) ||
920 (gad
->GadgetID
== FILESTR
)) )
924 if (((gad
->GadgetType
& GTYP_GTYPEMASK
) == GTYP_STRGADGET
)
925 && (code
== KEYB_SHORTCUT
))
935 glob
->downgadget
= 0;
939 clicked
= CalcClicked (glob
, &im
);
941 if (clicked
!= glob
->clicked
) break;
943 entry
= glob
->displaylist
[clicked
];
944 str
= entry
->re_Name
;
945 doubleclick
= ((clicked
== glob
->lastclicked
)
946 && DoubleClick (glob
->sec
, glob
->mic
, im
.Seconds
, im
.Micros
));
947 ctype
= entry
->re_Type
;
949 if (ctype
== glob
->directory_id
)
951 if (!(glob
->flags
& FREQF_SELECTDIRS
))
953 AddPart (fdir
, str
, 256);
956 /* CHECKME: added hoping to fix MuForce hit. See below. */
972 while (*str2
!= ' ') str2
++;
974 while (*str3
== ' ') str3
++;
975 if ((glob
->volumerequest
&& !( *str
== '-' && str
[ 1 ] == ' ' ))
977 || FindVolume (glob
, str3
, entry
))
982 else strcpy (fdir
, str3
);
984 else strcpy (fdir
, str
);
986 if (!glob
->volumerequest
)
990 /* CHECKME: added hoping to fix MuForce hit. See below. */
999 my_SetStringGadget (glob
->reqwin
, glob
->drawergad
, fdir
);
1002 return (LeaveReq (glob
, filename
));
1004 goto rememberclicked
;
1008 strcpy (filename
, str
);
1009 StrCat (filename
, DOTFONTSTR
);
1010 my_SetStringGadget (glob
->reqwin
,
1011 glob
->filegad
, filename
);
1013 return (LeaveReq (glob
, filename
));
1015 fontreq
->Attr
.ta_YSize
= entry
->re_Size
;
1016 fontreq
->Attr
.ta_Flags
= entry
->re_Flags
;
1017 fontreq
->Attr
.ta_Style
= entry
->re_Style
;
1018 fontreq
->Attr
.ta_Style
&= ~(FSF_ITALIC
|FSF_BOLD
|FSF_UNDERLINED
);
1019 fontreq
->Attr
.ta_Style
|= glob
->fontstyle
;
1020 my_SetIntegerGadget (glob
->reqwin
,
1021 glob
->drawergad
, entry
->re_Size
);
1022 ShowFontSample (glob
, FALSE
, TRUE
);
1024 glob
->lastclicked
= clicked
;
1025 glob
->sec
= im
.Seconds
; glob
->mic
= im
.Micros
;
1030 SetTextGad (glob
, glob
->modetxtgad
, str
);
1031 glob
->modeid
= (ULONG
)entry
->re_Size
;
1032 if (!GetModeData (glob
, glob
->modeid
, &mon
))
1033 DisplayBeep (glob
->scr
);
1036 GetModeDimensions (glob
);
1037 DisplayModeAttrs (glob
);
1039 goto checkdoubleclick
;
1042 /* FIXME: check following line. causes MuForces hits on Amiga when clicking
1043 * on volume or assign entry. Both with old Amiga reqtools.library and
1044 * 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
= BNULL
, 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 /****************************************************************************************/