2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
5 File requester specific code.
9 #include <proto/exec.h>
10 #include <proto/dos.h>
11 #include <proto/utility.h>
12 #include <proto/intuition.h>
13 #include <proto/graphics.h>
14 #include <proto/gadtools.h>
15 #include <exec/memory.h>
17 #include <intuition/screens.h>
18 #include <intuition/icclass.h>
19 #include <intuition/gadgetclass.h>
20 #include <graphics/gfx.h>
21 #include <devices/rawkeycodes.h>
22 #include <libraries/gadtools.h>
23 #include <workbench/startup.h>
26 #include "asl_intern.h"
27 #include "filereqhooks.h"
29 #include "filereqsupport.h"
30 #include "specialreq.h"
32 #if USE_SHARED_COOLIMAGES
33 #include <libraries/coolimages.h>
34 #include <proto/coolimages.h>
36 #include "coolimages.h"
39 #define CATCOMP_NUMBERS
45 #include <aros/debug.h>
47 /*****************************************************************************************/
49 STATIC BOOL
FRGadInit(struct LayoutData
*, struct AslBase_intern
*);
50 STATIC BOOL
FRGadLayout(struct LayoutData
*, struct AslBase_intern
*);
51 STATIC VOID
FRGadCleanup(struct LayoutData
*, struct AslBase_intern
*);
52 STATIC ULONG
FRHandleEvents(struct LayoutData
*, struct AslBase_intern
*);
53 STATIC ULONG
FRGetSelectedFiles(struct LayoutData
*, struct AslBase_intern
*AslBase
);
55 /*****************************************************************************************/
57 #define ID_BUTOK ID_MAINBUTTON_OK
58 #define ID_BUTVOLUMES ID_MAINBUTTON_MIDDLELEFT
59 #define ID_BUTPARENT ID_MAINBUTTON_MIDDLERIGHT
60 #define ID_BUTCANCEL ID_MAINBUTTON_CANCEL
63 #define ID_STRDRAWER 2
64 #define ID_STRPATTERN 3
70 #define CLASS_ASLBASE ((struct AslBase_intern *)cl->cl_UserData)
71 #define HOOK_ASLBASE ((struct AslBase_intern *)hook->h_Data)
73 #define AslBase HOOK_ASLBASE
75 /*****************************************************************************************/
77 AROS_UFH3(IPTR
, ASLFRRenderHook
,
78 AROS_UFHA(struct Hook
*, hook
, A0
),
79 AROS_UFHA(struct ASLLVFileReqNode
*,node
, A2
),
80 AROS_UFHA(struct ASLLVDrawMsg
*, msg
, A1
)
87 if (msg
->lvdm_MethodID
== LV_DRAW
)
89 struct DrawInfo
*dri
= msg
->lvdm_DrawInfo
;
90 struct RastPort
*rp
= msg
->lvdm_RastPort
;
92 WORD min_x
= msg
->lvdm_Bounds
.MinX
;
93 WORD min_y
= msg
->lvdm_Bounds
.MinY
;
94 WORD max_x
= msg
->lvdm_Bounds
.MaxX
;
95 WORD max_y
= msg
->lvdm_Bounds
.MaxY
;
97 UWORD erasepen
= BACKGROUNDPEN
;
98 UWORD textpen
= TEXTPEN
;
100 if (node
) switch(node
->type
)
102 case ASLLV_FRNTYPE_DIRECTORY
:
103 if (node
->subtype
> 0) textpen
= SHINEPEN
;
105 case ASLLV_FRNTYPE_VOLUMES
:
106 switch(node
->subtype
)
119 switch (msg
->lvdm_State
)
121 case ASLLVR_SELECTED
:
123 textpen
= FILLTEXTPEN
;
130 struct TextExtent te
;
132 SetAPen(rp
, dri
->dri_Pens
[erasepen
]);
133 RectFill(rp
, min_x
, min_y
, max_x
, max_y
);
137 struct LayoutData
*ld
= ((struct LayoutData
*)node
->userdata
);
138 struct FRUserData
*udata
= (struct FRUserData
*)ld
->ld_UserData
;
141 SetFont(rp
, ld
->ld_Font
);
143 min_x
+= BORDERLVITEMSPACINGX
;
144 min_y
+= BORDERLVITEMSPACINGY
;
146 max_x
-= BORDERLVITEMSPACINGX
;
147 max_y
-= BORDERLVITEMSPACINGY
;
149 for(i
= 0; i
< ASLLV_MAXCOLUMNS
;i
++)
154 if (node
->text
[i
] == NULL
) continue;
156 len
= strlen(node
->text
[i
]);
158 switch(udata
->LVColumnAlign
[i
])
160 case ASLLV_ALIGN_RIGHT
:
161 x
= min_x
+ udata
->LVColumnWidth
[i
] -
162 TextLength(rp
, node
->text
[i
], len
);
170 if (x
> max_x
) break;
181 if (numfit
< len
) numfit
++;
183 if (numfit
< 1) break;
185 SetAPen(rp
, dri
->dri_Pens
[textpen
]);
188 Move(rp
, x
, min_y
+ rp
->Font
->tf_Baseline
);
189 Text(rp
, node
->text
[i
], numfit
);
191 min_x
+= udata
->LVColumnWidth
[i
] + rp
->TxWidth
* 2;
193 } /* for(i = 0; i < ASLLV_MAXCOLUMNS;i++) */
199 } /* switch (msg->lvdm_State) */
203 } /* if (msg->lvdm_MethodID == LV_DRAW) */
206 retval
= ASLLVCB_UNKNOWN
;
214 /*****************************************************************************************/
218 /*****************************************************************************************/
220 AROS_UFH3(VOID
, FRTagHook
,
221 AROS_UFHA(struct Hook
*, hook
, A0
),
222 AROS_UFHA(struct ParseTagArgs
*, pta
, A2
),
223 AROS_UFHA(struct AslBase_intern
*, AslBase
, A1
)
229 const struct TagItem
*tstate
;
230 struct IntFileReq
*ifreq
;
233 EnterFunc(bug("FRTagHook(hook=%p, pta=%p)\n", hook
, pta
));
235 ifreq
= (struct IntFileReq
*)pta
->pta_IntReq
;
237 tstate
= pta
->pta_Tags
;
238 while ((tag
= NextTagItem(&tstate
)) != NULL
)
240 tidata
= tag
->ti_Data
;
244 /* The tags that are put "in a row" are defined as the same value,
245 and therefor we only use one of them, but the effect is for all of them
247 case ASLFR_InitialDrawer
:
248 /* case ASL_Dir: Obsolete */
250 ifreq
->ifr_Drawer
= (STRPTR
)tidata
;
253 case ASLFR_InitialFile
:
254 /* case ASL_File: Obsolete */
256 ifreq
->ifr_File
= (STRPTR
)tidata
;
259 case ASLFR_InitialPattern
:
260 /* case ASL_Pattern: Obsolete */
262 ifreq
->ifr_Pattern
= (STRPTR
)tidata
;
266 ((struct FileRequester
*)pta
->pta_Req
)->fr_UserData
= (APTR
)tidata
;
272 ifreq
->ifr_Flags1
= (UBYTE
)tidata
;
273 /* Extract some flags that are common to all requester types and
274 put them into IntReq->ir_Flags
276 if (ifreq
->ifr_Flags1
& FRF_PRIVATEIDCMP
)
277 GetIR(ifreq
)->ir_Flags
|= IF_PRIVATEIDCMP
;
279 GetIR(ifreq
)->ir_Flags
&= ~IF_PRIVATEIDCMP
;
283 ifreq
->ifr_Flags2
= (UBYTE
)tidata
;
286 case ASLFR_DoSaveMode
:
288 ifreq
->ifr_Flags1
|= FRF_DOSAVEMODE
;
290 ifreq
->ifr_Flags1
&= ~FRF_DOSAVEMODE
;
293 case ASLFR_DoMultiSelect
:
295 ifreq
->ifr_Flags1
|= FRF_DOMULTISELECT
;
297 ifreq
->ifr_Flags1
&= ~FRF_DOMULTISELECT
;
300 case ASLFR_DoPatterns
:
302 ifreq
->ifr_Flags1
|= FRF_DOPATTERNS
;
304 ifreq
->ifr_Flags1
&= ~FRF_DOPATTERNS
;
307 case ASLFR_DrawersOnly
:
309 ifreq
->ifr_Flags2
|= FRF_DRAWERSONLY
;
311 ifreq
->ifr_Flags2
&= ~FRF_DRAWERSONLY
;
314 case ASLFR_FilterFunc
:
315 ifreq
->ifr_FilterFunc
= (struct Hook
*)tidata
;
316 ifreq
->ifr_Flags1
|= FRF_FILTERFUNC
;
319 case ASLFR_RejectIcons
:
321 ifreq
->ifr_Flags2
|= FRF_REJECTICONS
;
323 ifreq
->ifr_Flags2
&= ~FRF_REJECTICONS
;
326 case ASLFR_RejectPattern
:
328 ifreq
->ifr_RejectPattern
= (STRPTR
)tidata
;
331 case ASLFR_AcceptPattern
:
333 ifreq
->ifr_AcceptPattern
= (STRPTR
)tidata
;
336 case ASLFR_FilterDrawers
:
338 ifreq
->ifr_Flags2
|= FRF_FILTERDRAWERS
;
340 ifreq
->ifr_Flags2
&= ~FRF_FILTERDRAWERS
;
344 ifreq
->ifr_HookFunc
= (APTR
)tidata
;
347 case ASLFR_SetSortBy
:
348 ifreq
->ifr_SortBy
= tidata
;
351 case ASLFR_GetSortBy
:
352 ifreq
->ifr_GetSortBy
= (ULONG
*)tidata
;
355 case ASLFR_SetSortOrder
:
356 ifreq
->ifr_SortOrder
= tidata
;
359 case ASLFR_GetSortOrder
:
360 ifreq
->ifr_GetSortOrder
= (ULONG
*)tidata
;
363 case ASLFR_SetSortDrawers
:
364 ifreq
->ifr_SortDrawers
= tidata
;
367 case ASLFR_GetSortDrawers
:
368 ifreq
->ifr_GetSortDrawers
= (ULONG
*)tidata
;
371 case ASLFR_InitialShowVolumes
:
372 ifreq
->ifr_InitialShowVolumes
= tidata
? TRUE
: FALSE
;
378 } /* switch (tag->ti_Tag) */
380 } /* while ((tag = NextTagItem(&tstate)) != 0) */
382 /* DrawersOnly excludes multiselect */
384 if (ifreq
->ifr_Flags2
& FRF_DRAWERSONLY
)
386 ifreq
->ifr_Flags1
&= ~FRF_DOMULTISELECT
;
389 ReturnVoid("FRTagHook");
394 /*****************************************************************************************/
396 AROS_UFH3(ULONG
, FRGadgetryHook
,
397 AROS_UFHA(struct Hook
*, hook
, A0
),
398 AROS_UFHA(struct LayoutData
*, ld
, A2
),
399 AROS_UFHA(struct AslBase_intern
*, AslBase
, A1
)
406 switch (ld
->ld_Command
)
409 retval
= (ULONG
)FRGadInit(ld
, ASLB(AslBase
));
413 retval
= (ULONG
)FRGadLayout(ld
, ASLB(AslBase
));
416 case LDCMD_HANDLEEVENTS
:
417 retval
= (ULONG
)FRHandleEvents(ld
, ASLB(AslBase
));
421 FRGadCleanup(ld
, ASLB(AslBase
));
435 /*****************************************************************************************/
441 #if USE_SHARED_COOLIMAGES
444 const struct CoolImage
*coolimage
;
446 const struct CoolImage
*coolimage
;
451 /*****************************************************************************************/
453 STATIC BOOL
FRGadInit(struct LayoutData
*ld
, struct AslBase_intern
*AslBase
)
455 struct FRUserData
*udata
= ld
->ld_UserData
;
456 struct IntFileReq
*ifreq
= (struct IntFileReq
*)ld
->ld_IntReq
;
457 #if USE_SHARED_COOLIMAGES
458 ULONG okid
= (GetIR(ifreq
)->ir_Flags
& IF_USER_POSTEXT
) ? COOL_USEIMAGE_ID
:
459 ((ifreq
->ifr_Flags1
& FRF_DOSAVEMODE
) ? COOL_SAVEIMAGE_ID
:
461 struct ButtonInfo bi
[NUMBUTS
] =
463 { ID_BUTOK
, GetIR(ifreq
)->ir_PositiveText
, okid
, &udata
->OKBut
},
464 { ID_BUTVOLUMES
, NULL
, COOL_DOTIMAGE_ID
, &udata
->VolumesBut
},
465 { ID_BUTPARENT
, NULL
, COOL_DOTIMAGE_ID
, &udata
->ParentBut
},
466 { ID_BUTCANCEL
, GetIR(ifreq
)->ir_NegativeText
, COOL_CANCELIMAGE_ID
, &udata
->CancelBut
}
469 const struct CoolImage
*okimage
= (GetIR(ifreq
)->ir_Flags
& IF_USER_POSTEXT
) ? &cool_useimage
:
470 ((ifreq
->ifr_Flags1
& FRF_DOSAVEMODE
) ? &cool_saveimage
:
472 struct ButtonInfo bi
[NUMBUTS
] =
474 { ID_BUTOK
, GetIR(ifreq
)->ir_PositiveText
, okimage
, &udata
->OKBut
},
475 { ID_BUTVOLUMES
, NULL
, &cool_dotimage
, &udata
->VolumesBut
},
476 { ID_BUTPARENT
, NULL
, &cool_dotimage
, &udata
->ParentBut
},
477 { ID_BUTCANCEL
, GetIR(ifreq
)->ir_NegativeText
, &cool_cancelimage
, &udata
->CancelBut
}
481 STRPTR butstr
[NUMBUTS
];
482 LONG error
= ERROR_NO_FREE_STORE
;
483 WORD gadrows
, x
, y
, w
, h
, i
, y2
;
485 NEWLIST(&udata
->ListviewList
);
487 udata
->StringEditHook
.h_Entry
= (APTR
)AROS_ASMSYMNAME(StringEditFunc
);
488 udata
->StringEditHook
.h_SubEntry
= NULL
;
489 udata
->StringEditHook
.h_Data
= AslBase
;
491 udata
->ListviewHook
.h_Entry
= (APTR
)AROS_ASMSYMNAME(ASLFRRenderHook
);
492 udata
->ListviewHook
.h_SubEntry
= NULL
;
493 udata
->ListviewHook
.h_Data
= AslBase
;
495 /* calc. min. size */
497 if (!bi
[0].text
) bi
[0].text
= GetString(MSG_FILEREQ_POSITIVE_GAD
, GetIR(ifreq
)->ir_Catalog
, AslBase
);
498 bi
[1].text
= GetString(MSG_FILEREQ_VOLUMES_GAD
, GetIR(ifreq
)->ir_Catalog
, AslBase
);
499 bi
[2].text
= GetString(MSG_FILEREQ_PARENT_GAD
, GetIR(ifreq
)->ir_Catalog
, AslBase
);
500 if (!bi
[3].text
) bi
[3].text
= GetString(MSG_FILEREQ_NEGATIVE_GAD
, GetIR(ifreq
)->ir_Catalog
, AslBase
);
504 for(i
= 0; i
< NUMBUTS
; i
++)
506 x
= TextLength(&ld
->ld_DummyRP
, bi
[i
].text
, strlen(bi
[i
].text
));
508 #if FREQ_COOL_BUTTONS
509 #if USE_SHARED_COOLIMAGES
512 bi
[i
].coolimage
= (const struct CoolImage
*)COOL_ObtainImageA(bi
[i
].coolid
, NULL
);
517 if (ld
->ld_TrueColor
)
519 x
+= IMAGEBUTTONEXTRAWIDTH
+ bi
[i
].coolimage
->width
;
526 udata
->ButWidth
= w
+ BUTTONEXTRAWIDTH
;
528 ld
->ld_ButWidth
= udata
->ButWidth
;
529 ld
->ld_NumButtons
= 4;
531 #if FREQ_COOL_BUTTONS
533 #if USE_SHARED_COOLIMAGES
537 y
= BUTTONEXTRAHEIGHT
+ ld
->ld_Font
->tf_YSize
;
538 if (ld
->ld_TrueColor
)
540 y2
= IMAGEBUTTONEXTRAHEIGHT
+ DEF_COOLIMAGEHEIGHT
;
544 udata
->ButHeight
= (y
> y2
) ? y
: y2
;
545 #if USE_SHARED_COOLIMAGES
549 udata
->ButHeight
= BUTTONEXTRAHEIGHT
+ ld
->ld_Font
->tf_YSize
;
554 udata
->ButHeight
= BUTTONEXTRAHEIGHT
+ ld
->ld_Font
->tf_YSize
;
557 gadrows
= 3; /* button row + file string + drawer string */
558 if (ifreq
->ifr_Flags1
& FRF_DOPATTERNS
) gadrows
++;
559 if (ifreq
->ifr_Flags2
& FRF_DRAWERSONLY
) gadrows
--;
561 ld
->ld_MinWidth
= OUTERSPACINGX
* 2 +
563 udata
->ButWidth
* NUMBUTS
;
565 ld
->ld_MinHeight
= OUTERSPACINGY
* 2 +
566 (GADGETSPACINGY
+ udata
->ButHeight
) * gadrows
+
567 BORDERLVSPACINGY
* 2 +
568 (ld
->ld_Font
->tf_YSize
+ BORDERLVITEMSPACINGY
* 2) * FREQ_MIN_VISIBLELINES
;
570 /* make listview gadget */
572 x
= ld
->ld_WBorLeft
+ OUTERSPACINGX
;
573 y
= ld
->ld_WBorTop
+ OUTERSPACINGY
;
574 w
= -ld
->ld_WBorRight
- ld
->ld_WBorLeft
- OUTERSPACINGX
* 2 - PROPSIZE
;
575 h
= -ld
->ld_WBorBottom
- ld
->ld_WBorTop
- OUTERSPACINGY
* 2 -
576 udata
->ButHeight
* gadrows
-
577 GADGETSPACINGY
* gadrows
;
580 struct TagItem lv_tags
[] =
586 {GA_UserData
, (IPTR
)ld
},
587 {GA_ID
, ID_LISTVIEW
},
588 {GA_RelVerify
, TRUE
},
589 {ASLLV_CallBack
, (IPTR
)&udata
->ListviewHook
},
590 {ASLLV_DoMultiSelect
, (ifreq
->ifr_Flags1
& FRF_DOMULTISELECT
) },
594 udata
->Listview
= gad
= NewObjectA(AslBase
->asllistviewclass
, NULL
, lv_tags
);
595 if (!udata
->Listview
) goto failure
;
599 /* make scroller gadget for listview */
601 x
= -ld
->ld_WBorRight
- OUTERSPACINGX
- PROPSIZE
+ 1;
602 y
= ld
->ld_WBorTop
+ OUTERSPACINGY
;
604 h
= -ld
->ld_WBorBottom
- ld
->ld_WBorTop
- OUTERSPACINGY
* 2 -
605 udata
->ButHeight
* gadrows
-
606 GADGETSPACINGY
* gadrows
;
608 struct TagItem scroller_tags
[] =
614 {GA_ID
, ID_LISTVIEW
},
615 {PGA_NewLook
, TRUE
},
616 {PGA_Borderless
, TRUE
},
617 {PGA_Freedom
, FREEVERT
},
621 {GA_Previous
, (IPTR
)gad
},
625 if (!makescrollergadget(&udata
->ScrollGad
, ld
, scroller_tags
, AslBase
)) goto failure
;
626 gad
= udata
->ScrollGad
.arrow2
;
629 connectscrollerandlistview(&udata
->ScrollGad
, udata
->Listview
, AslBase
);
631 /* make button row */
633 y
= -ld
->ld_WBorBottom
- OUTERSPACINGY
- udata
->ButHeight
+ 1;
636 struct TagItem button_tags
[] =
641 #if FREQ_COOL_BUTTONS
642 {ASLBT_CoolImage
, 0 },
646 {GA_UserData
, (IPTR
)ld
},
649 {GA_Width
, udata
->ButWidth
},
650 {GA_Height
, udata
->ButHeight
},
651 {GA_RelVerify
, TRUE
},
652 {GA_Image
, 0 }, /* means we want a frame */
656 for(i
= 0; i
< NUMBUTS
; i
++)
658 button_tags
[0].ti_Data
= (IPTR
)bi
[i
].text
;
659 button_tags
[1].ti_Data
= (IPTR
)gad
;
660 button_tags
[2].ti_Data
= bi
[i
].gadid
;
662 #if USE_SHARED_COOLIMAGES
663 if (CoolImagesBase
== NULL
) button_tags
[3].ti_Tag
= TAG_IGNORE
;
665 button_tags
[3].ti_Data
= (IPTR
)bi
[i
].coolimage
;
667 *(bi
[i
].objvar
) = gad
= NewObjectA(AslBase
->aslbuttonclass
, NULL
, button_tags
);
668 if (!gad
) goto failure
;
683 {TRUE
, (STRPTR
)MSG_FILEREQ_PATTERN_LABEL
, &udata
->PatternLabel
},
684 {TRUE
, (STRPTR
)MSG_FILEREQ_DRAWER_LABEL
, &udata
->DrawerLabel
},
685 {TRUE
, (STRPTR
)MSG_FILEREQ_FILE_LABEL
, &udata
->FileLabel
}
688 struct TagItem label_tags
[] =
693 {GA_Height
, udata
->ButHeight
},
695 {GA_Previous
, (IPTR
)gad
},
696 {GA_UserData
, (IPTR
)ld
},
697 {GA_Disabled
, TRUE
},
701 for(i
= 0; i
< 3; i
++)
703 li
[i
].text
= GetString((LONG
)li
[i
].text
, GetIR(ifreq
)->ir_Catalog
, AslBase
);
706 /* Drawer label is always there */
708 w
= TextLength(&ld
->ld_DummyRP
, li
[1].text
, strlen(li
[1].text
)) +
710 ld
->ld_Font
->tf_XSize
* 2; /* Frame symbol showing directory scan activity */
713 if (ifreq
->ifr_Flags1
& FRF_DOPATTERNS
)
715 butstr
[i
++] = li
[0].text
;
722 if (!(ifreq
->ifr_Flags2
& FRF_DRAWERSONLY
))
724 butstr
[i
++] = li
[2].text
;
733 x
= BiggestTextLength(butstr
, i
, &(ld
->ld_DummyRP
), AslBase
);
737 x
= ld
->ld_WBorLeft
+ OUTERSPACINGX
;
738 y
= -ld
->ld_WBorBottom
- OUTERSPACINGY
- udata
->ButHeight
-
739 (udata
->ButHeight
+ GADGETSPACINGY
) * (gadrows
- 1) + 1;
741 label_tags
[1].ti_Data
= y
;
743 for(i
= 0; i
< 3;i
++)
745 if (!li
[i
].doit
) continue;
749 label_tags
[2].ti_Data
= TextLength(&ld
->ld_DummyRP
, li
[i
].text
, strlen(li
[i
].text
));
750 label_tags
[0].ti_Data
= x
+ w
- label_tags
[2].ti_Data
;
751 label_tags
[4].ti_Data
= (IPTR
)li
[i
].text
;
752 label_tags
[5].ti_Data
= (IPTR
)gad
;
754 *(li
[i
].objvar
) = gad
= NewObjectA(AslBase
->aslbuttonclass
, NULL
, label_tags
);
755 if (!gad
) goto failure
;
757 y
+= udata
->ButHeight
+ GADGETSPACINGY
;
758 label_tags
[1].ti_Data
= y
;
762 /* Directory Scan Symbol */
765 struct TagItem sym_tags
[] =
768 {GA_RelBottom
, y2
+ 1 },
769 {GA_Width
, ld
->ld_Font
->tf_XSize
* 2 },
770 {GA_Height
, udata
->ButHeight
- 2 },
771 {GA_Image
, 0 }, /* means we want a frame */
772 {GA_Previous
, (IPTR
)gad
},
773 {GA_Disabled
, TRUE
},
774 {GA_UserData
, (IPTR
)ld
},
778 udata
->DirectoryScanSymbol
= gad
= NewObjectA(AslBase
->aslbuttonclass
, NULL
, sym_tags
);
779 if (!udata
->DirectoryScanSymbol
) goto failure
;
782 /* make string gadgets */
784 y
= -ld
->ld_WBorBottom
- OUTERSPACINGY
- udata
->ButHeight
-
785 (udata
->ButHeight
+ GADGETSPACINGY
) * (gadrows
- 1) + 1;
786 x
= ld
->ld_WBorLeft
+ OUTERSPACINGX
+ w
+ LABELSPACINGX
;
788 w
= -ld
->ld_WBorLeft
- ld
->ld_WBorRight
- OUTERSPACINGX
* 2 -
800 {ID_STRPATTERN
, ifreq
->ifr_Pattern
, MAX_PATTERN_LEN
, &udata
->PatternGad
},
801 {ID_STRDRAWER
, ifreq
->ifr_Drawer
, MAX_PATH_LEN
, &udata
->PathGad
},
802 {ID_STRFILE
, ifreq
->ifr_File
, MAX_FILE_LEN
, &udata
->FileGad
},
805 struct TagItem string_tags
[] =
810 {GA_Height
, udata
->ButHeight
},
811 {GA_Previous
, (IPTR
)gad
},
812 {STRINGA_TextVal
, (IPTR
)ifreq
->ifr_Pattern
},
813 {STRINGA_MaxChars
, MAX_PATTERN_LEN
},
814 {GA_ID
, ID_STRPATTERN
},
815 {GA_RelVerify
, TRUE
},
816 {GA_UserData
, (IPTR
)ld
},
817 {GA_TabCycle
, TRUE
},
818 {STRINGA_EditHook
, (IPTR
)&udata
->StringEditHook
},
819 {STRINGA_Font
, (IPTR
)ld
->ld_Font
},
823 if (!(ifreq
->ifr_Flags1
& FRF_DOPATTERNS
)) si
[0].gadid
= 0;
824 if (ifreq
->ifr_Flags2
& FRF_DRAWERSONLY
) si
[2].gadid
= 0;
826 for(i
= 0;i
< 3; i
++)
828 if (si
[i
].gadid
== 0) continue;
830 string_tags
[4].ti_Data
= (IPTR
)gad
;
831 string_tags
[5].ti_Data
= (IPTR
)si
[i
].text
;
832 string_tags
[6].ti_Data
= si
[i
].maxchars
;
833 string_tags
[7].ti_Data
= si
[i
].gadid
;
835 *(si
[i
].objvar
) = gad
= NewObjectA(AslBase
->aslstringclass
, NULL
, string_tags
);
836 if (!gad
) goto failure
;
838 y
+= udata
->ButHeight
+ GADGETSPACINGY
;
839 string_tags
[1].ti_Data
= y
;
845 struct TagItem eraser_tags
[] =
847 {GA_Previous
, (IPTR
)gad
},
851 udata
->EraserGad
= gad
= NewObjectA(AslBase
->asleraserclass
, NULL
, eraser_tags
);
852 /* Doesn't matter if this failed */
856 if (ifreq
->ifr_InitialShowVolumes
)
858 FRGetVolumes(ld
, AslBase
);
860 FRNewPath((STRPTR
)ifreq
->ifr_Drawer
, ld
, AslBase
);
863 SetAttrs(udata
->Listview
, ASLLV_Labels
, (IPTR
)&udata
->ListviewList
,
866 ld
->ld_GList
= (struct Gadget
*)udata
->Listview
;
870 struct NewMenu nm
[] =
872 {NM_TITLE
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL
}, /* 0 */
873 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL_LASTNAME
, 0 , 0 , 0 , (APTR
)FRMEN_LASTNAME
}, /* 1 */
874 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL_NEXTNAME
, 0, 0 , 0 , (APTR
)FRMEN_NEXTNAME
}, /* 2 */
875 {NM_ITEM
, NM_BARLABEL
}, /* 3 */
876 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL_RESTORE
, 0, 0 , 0 , (APTR
)FRMEN_RESTORE
}, /* 4 */
877 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL_PARENT
, 0, 0 , 0 , (APTR
)FRMEN_PARENT
}, /* 5 */
878 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL_VOLUMES
, 0, 0 , 0 , (APTR
)FRMEN_VOLUMES
}, /* 6 */
879 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL_UPDATE
, 0, 0 , 0 , (APTR
)FRMEN_UPDATE
}, /* 7 */
880 {NM_ITEM
, NM_BARLABEL
}, /* 8 */
881 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL_DELETE
, 0, 0 , 0 , (APTR
)FRMEN_DELETE
}, /* 9 */
882 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL_CREATEDRAWER
, 0, 0 , 0 , (APTR
)FRMEN_NEWDRAWER
}, /* 10 */
883 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL_RENAME
, 0, 0 , 0 , (APTR
)FRMEN_RENAME
}, /* 11 */
884 {NM_ITEM
, NM_BARLABEL
}, /* 12 */
885 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL_SELECT
, 0, 0 , 0 , (APTR
)FRMEN_SELECT
}, /* 13 */
886 {NM_ITEM
, NM_BARLABEL
}, /* 14 */
887 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL_OK
, 0, 0 , 0 , (APTR
)FRMEN_OK
}, /* 15 */
888 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_CONTROL_CANCEL
, 0, 0 , 0 , (APTR
)FRMEN_CANCEL
}, /* 16 */
889 {NM_TITLE
, (STRPTR
)MSG_FILEREQ_MEN_FILELIST
}, /* 17 */
890 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_FILELIST_SORTNAME
, 0, CHECKIT
, 2 + 4 , (APTR
)FRMEN_BYNAME
}, /* 18 */
891 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_FILELIST_SORTDATE
, 0, CHECKIT
, 1 + 4 , (APTR
)FRMEN_BYDATE
}, /* 19 */
892 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_FILELIST_SORTSIZE
, 0, CHECKIT
, 1 + 2 , (APTR
)FRMEN_BYSIZE
}, /* 20 */
893 {NM_ITEM
, NM_BARLABEL
}, /* 21 */
894 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_FILELIST_SORTUP
, 0, CHECKIT
, 32 , (APTR
)FRMEN_ASCENDING
}, /* 22 */
895 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_FILELIST_SORTDOWN
, 0, CHECKIT
, 16 , (APTR
)FRMEN_DESCENDING
}, /* 23 */
896 {NM_ITEM
, NM_BARLABEL
}, /* 24 */
897 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_FILELIST_SORTDRAWERFIRST
, 0, CHECKIT
, 256 + 512 , (APTR
)FRMEN_DRAWERSFIRST
}, /* 25 */
898 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_FILELIST_SORTDRAWERSAME
, 0, CHECKIT
, 128 + 512 , (APTR
)FRMEN_DRAWERSMIX
}, /* 26 */
899 {NM_ITEM
, (STRPTR
)MSG_FILEREQ_MEN_FILELIST_SORTDRAWERLAST
, 0, CHECKIT
, 128 + 256 , (APTR
)FRMEN_DRAWERSLAST
}, /* 27 */
903 struct TagItem menu_tags
[] =
905 {GTMN_NewLookMenus
, TRUE
},
906 {GTMN_TextAttr
, (IPTR
)GetIR(ifreq
)->ir_TextAttr
},
910 if (menu_tags
[1].ti_Data
== 0) menu_tags
[1].ti_Tag
= TAG_IGNORE
;
912 LocalizeMenus(nm
, GetIR(ifreq
)->ir_Catalog
, AslBase
);
914 nm
[18 + ifreq
->ifr_SortBy
].nm_Flags
|= CHECKED
;
915 nm
[22 + ifreq
->ifr_SortOrder
].nm_Flags
|= CHECKED
;
916 nm
[25 + ifreq
->ifr_SortDrawers
].nm_Flags
|= CHECKED
;
918 /* Show "Select" menu item only if this is a multiselect file requester.
919 The orig Amiga asl.library disables (ghosts) the item, but why
920 show it if it cannot be used anyway. */
922 if (!(ifreq
->ifr_Flags1
& FRF_DOMULTISELECT
))
924 nm
[13].nm_Type
= NM_IGNORE
;
925 nm
[14].nm_Type
= NM_IGNORE
;
928 /* No Rename in drawersonly requesters */
930 if (ifreq
->ifr_Flags2
& FRF_DRAWERSONLY
)
932 nm
[11].nm_Type
= NM_IGNORE
;
935 /* Don't fail, if menus cannot be created/layouted, because a requester
936 without menus is still better than no requester at all */
938 if ((ld
->ld_Menu
= CreateMenusA(nm
, NULL
)))
940 if (!LayoutMenusA(ld
->ld_Menu
, ld
->ld_VisualInfo
, menu_tags
))
942 FreeMenus(ld
->ld_Menu
);ld
->ld_Menu
= NULL
;
949 ReturnBool ("FRGadInit", TRUE
);
954 FRGadCleanup(ld
, ASLB(AslBase
));
958 ReturnBool ("FRGadInit", FALSE
);
962 /*****************************************************************************************/
964 STATIC BOOL
FRGadLayout(struct LayoutData
*ld
, struct AslBase_intern
*AslBase
)
966 FRActivateMainStringGadget(ld
, AslBase
);
968 ReturnBool ("FRGadLayout", TRUE
);
971 /*****************************************************************************************/
973 STATIC VOID
FRClickOnVolumes(struct LayoutData
*ld
, struct AslBase_intern
*AslBase
)
975 struct FRUserData
*udata
= (struct FRUserData
*)ld
->ld_UserData
;
977 if (udata
->Flags
& FRFLG_SHOWING_VOLUMES
)
985 GetAttr(STRINGA_TextVal
, udata
->PathGad
, &foo
.baz
);
986 FRGetDirectory(foo
.dir
, ld
, AslBase
);
988 FRGetVolumes(ld
, AslBase
);
992 /*****************************************************************************************/
994 STATIC ULONG
FRHandleEvents(struct LayoutData
*ld
, struct AslBase_intern
*AslBase
)
996 struct IntuiMessage
*imsg
;
997 ULONG retval
= GHRET_OK
;
998 struct FRUserData
*udata
;
999 struct IntFileReq
*ifreq
;
1002 EnterFunc(bug("FRHandleEvents: Class: %d\n", imsg
->Class
));
1004 udata
= (struct FRUserData
*)ld
->ld_UserData
;
1005 ifreq
= (struct IntFileReq
*)ld
->ld_IntReq
;
1007 imsg
= ld
->ld_Event
;
1009 switch (imsg
->Class
)
1011 case IDCMP_CLOSEWINDOW
:
1015 case IDCMP_MOUSEBUTTONS
:
1016 FRActivateMainStringGadget(ld
, AslBase
);
1023 FRChangeActiveLVItem(ld
, -1, imsg
->Qualifier
, 0, AslBase
);
1027 FRChangeActiveLVItem(ld
, -1, IEQUALIFIER_LSHIFT
, 0, AslBase
);
1031 FRChangeActiveLVItem(ld
, -1, IEQUALIFIER_LALT
, 0, AslBase
);
1034 case RAWKEY_NM_WHEEL_UP
:
1035 FRChangeActiveLVItem(ld
, -3, imsg
->Qualifier
, 0, AslBase
);
1039 FRChangeActiveLVItem(ld
, 1, imsg
->Qualifier
, 0, AslBase
);
1042 case RAWKEY_PAGEDOWN
:
1043 FRChangeActiveLVItem(ld
, 1, IEQUALIFIER_LSHIFT
, 0, AslBase
);
1047 FRChangeActiveLVItem(ld
, 1, IEQUALIFIER_LALT
, 0, AslBase
);
1050 case RAWKEY_NM_WHEEL_DOWN
:
1051 FRChangeActiveLVItem(ld
, 3, imsg
->Qualifier
, 0, AslBase
);
1057 case IDCMP_VANILLAKEY
:
1066 case IDCMP_GADGETUP
:
1067 gadid
= ((struct Gadget
*)imsg
->IAddress
)->GadgetID
;
1069 D(bug("GADGETUP! gadgetid=%d\n", gadid
));
1078 FRClickOnVolumes(ld
, AslBase
);
1082 FRParentPath(ld
, AslBase
);
1086 if (imsg
->Code
== STRINGCODE_CURSORUP
)
1088 FRChangeActiveLVItem(ld
, -1, imsg
->Qualifier
, (struct Gadget
*)udata
->FileGad
, AslBase
);
1091 else if (imsg
->Code
== STRINGCODE_CURSORDOWN
)
1093 FRChangeActiveLVItem(ld
, 1, imsg
->Qualifier
, (struct Gadget
*)udata
->FileGad
, AslBase
);
1096 else if ((imsg
->Code
== 0) || (imsg
->Code
== 9))
1098 char filestring
[MAX_FILE_LEN
], checkstring
[MAX_FILE_LEN
], *file
;
1099 BOOL fall_through
= (imsg
->Code
== 9) ? FALSE
: TRUE
;
1100 BOOL has_colon
= FALSE
;
1101 BOOL has_slash
= FALSE
;
1103 GetAttr(STRINGA_TextVal
, udata
->FileGad
, (IPTR
*)&file
);
1104 strcpy(filestring
, file
);
1106 has_colon
= strchr(filestring
, ':') ? TRUE
: FALSE
;
1107 has_slash
= strchr(filestring
, '/') ? TRUE
: FALSE
;
1109 if (has_colon
|| has_slash
)
1111 fall_through
= FALSE
;
1113 if (strcmp(filestring
, ":") == 0)
1115 FRNewPath(filestring
, ld
, AslBase
);
1116 FRSetFile("", ld
, AslBase
);
1117 } else if (stricmp(filestring
, "/") == 0)
1119 FRParentPath(ld
, AslBase
);
1120 FRSetFile("", ld
, AslBase
);
1127 strcpy(checkstring
, filestring
);
1131 GetAttr(STRINGA_TextVal
, udata
->PathGad
, (IPTR
*)&dir
);
1133 strcpy(checkstring
, dir
);
1134 AddPart(checkstring
, filestring
, MAX_FILE_LEN
);
1137 if ((lock
= Lock(checkstring
, ACCESS_READ
)))
1139 struct FileInfoBlock
*fib
;
1140 BOOL isfile
= FALSE
;
1142 if ((fib
= AllocDosObject(DOS_FIB
, NULL
)))
1144 if (Examine(lock
, fib
))
1146 if (fib
->fib_DirEntryType
> 0) isfile
= FALSE
;
1148 FreeDosObject(DOS_FIB
, fib
);
1155 char *fp
= FilePart(checkstring
);
1159 FRNewPath(checkstring
, ld
, AslBase
);
1162 FRSetFile(fp
, ld
, AslBase
);
1165 FRNewPath(filestring
, ld
, AslBase
);
1166 FRSetFile("", ld
, AslBase
);
1170 ActivateGadget((struct Gadget
*)udata
->FileGad
, ld
->ld_Window
, NULL
);
1172 } /* has colon or slash */
1174 if (!fall_through
) break;
1176 } /* if ((imsg->Code == 0) || (imsg->Code == 9)) */
1185 retval
= FRGetSelectedFiles(ld
, ASLB(AslBase
));
1189 if (imsg
->Code
== STRINGCODE_CURSORUP
)
1191 FRChangeActiveLVItem(ld
, -1, imsg
->Qualifier
, (struct Gadget
*)udata
->PatternGad
, AslBase
);
1194 else if (imsg
->Code
== STRINGCODE_CURSORDOWN
)
1196 FRChangeActiveLVItem(ld
, 1, imsg
->Qualifier
, (struct Gadget
*)udata
->PatternGad
, AslBase
);
1199 else if ((imsg
->Code
== 0) || (imsg
->Code
== 9))
1201 if (imsg
->Code
== 0) ActivateGadget((struct Gadget
*)udata
->PathGad
, ld
->ld_Window
, NULL
);
1202 /* fall through to ID_STRDRAWER */
1208 /* no break here!! */
1211 if (imsg
->Code
== STRINGCODE_CURSORUP
)
1213 FRChangeActiveLVItem(ld
, -1, imsg
->Qualifier
, (struct Gadget
*)udata
->PathGad
, AslBase
);
1215 else if (imsg
->Code
== STRINGCODE_CURSORDOWN
)
1217 FRChangeActiveLVItem(ld
, 1, imsg
->Qualifier
, (struct Gadget
*)udata
->PathGad
, AslBase
);
1219 else if ((imsg
->Code
== 0) || (imsg
->Code
== 9))
1223 if ((imsg
->Code
== 0) && (gadid
== ID_STRDRAWER
))
1225 if (ifreq
->ifr_Flags2
& FRF_DRAWERSONLY
)
1227 retval
= FRGetSelectedFiles(ld
, ASLB(AslBase
));
1230 ActivateGadget((struct Gadget
*)udata
->FileGad
, ld
->ld_Window
, NULL
);
1233 GetAttr(STRINGA_TextVal
, udata
->PathGad
, (IPTR
*)&dir
);
1234 FRNewPath(dir
, ld
, AslBase
);
1240 struct ASLLVFileReqNode
*node
;
1243 GetAttr(ASLLV_Active
, udata
->Listview
, &active
);
1245 if ((node
= (struct ASLLVFileReqNode
*)FindListNode(&udata
->ListviewList
, (WORD
)active
)))
1249 case ASLLV_FRNTYPE_VOLUMES
:
1250 FRNewPath((STRPTR
)node
->text
[0], ld
, AslBase
);
1253 case ASLLV_FRNTYPE_DIRECTORY
:
1254 if (node
->subtype
> 0)
1256 FRAddPath((STRPTR
)node
->text
[0], ld
, AslBase
);
1258 FRSetFile((STRPTR
)node
->text
[0], ld
, AslBase
);
1260 if (imsg
->Code
) /* TRUE if double clicked */
1262 retval
= FRGetSelectedFiles(ld
, AslBase
);
1267 } /* switch(node->type) */
1269 } /* if ((node = (struct ASLLVFileReqNode *)FindNode(&udata->ListviewList, (WORD)active))) */
1271 FRActivateMainStringGadget(ld
, AslBase
);
1276 } /* switch (gadget ID) */
1278 break; /* case IDCMP_GADGETUP: */
1280 case IDCMP_MENUPICK
:
1283 UWORD men
= imsg
->Code
;
1285 while(men
!= MENUNULL
)
1287 struct MenuItem
*item
;
1288 BOOL resort
= FALSE
;
1290 if ((item
= ItemAddress(ld
->ld_Menu
, men
)))
1292 switch((IPTR
)GTMENUITEM_USERDATA(item
))
1296 case FRMEN_LASTNAME
:
1297 FRChangeActiveLVItem(ld
, -1, 0, 0, AslBase
);
1300 case FRMEN_NEXTNAME
:
1301 FRChangeActiveLVItem(ld
, 1, 0, 0, AslBase
);
1305 if (ifreq
->ifr_Flags1
& FRF_DOPATTERNS
)
1307 FRSetPattern(ifreq
->ifr_Pattern
, ld
, AslBase
);
1309 if (!(ifreq
->ifr_Flags2
& FRF_DRAWERSONLY
))
1311 FRSetFile(ifreq
->ifr_File
, ld
, AslBase
);
1313 FRNewPath(ifreq
->ifr_Drawer
, ld
, AslBase
);
1317 FRParentPath(ld
, AslBase
);
1321 FRClickOnVolumes(ld
, AslBase
);
1325 /* WARNING: a bit hacky */
1326 udata
->Flags
^= FRFLG_SHOWING_VOLUMES
;
1327 FRClickOnVolumes(ld
, AslBase
);
1331 FRDeleteRequester(ld
, AslBase
);
1334 case FRMEN_NEWDRAWER
:
1335 FRNewDrawerRequester(ld
, AslBase
);
1339 FRRenameRequester(ld
, AslBase
);
1343 FRSelectRequester(ld
, AslBase
);
1347 retval
= FRGetSelectedFiles(ld
, ASLB(AslBase
));
1354 /* File list menu */
1357 ifreq
->ifr_SortBy
= ASLFRSORTBY_Name
;
1362 ifreq
->ifr_SortBy
= ASLFRSORTBY_Date
;
1367 ifreq
->ifr_SortBy
= ASLFRSORTBY_Size
;
1371 case FRMEN_ASCENDING
:
1372 ifreq
->ifr_SortOrder
= ASLFRSORTORDER_Ascend
;
1376 case FRMEN_DESCENDING
:
1377 ifreq
->ifr_SortOrder
= ASLFRSORTORDER_Descend
;
1381 case FRMEN_DRAWERSFIRST
:
1382 ifreq
->ifr_SortDrawers
= ASLFRSORTDRAWERS_First
;
1386 case FRMEN_DRAWERSMIX
:
1387 ifreq
->ifr_SortDrawers
= ASLFRSORTDRAWERS_Mix
;
1391 case FRMEN_DRAWERSLAST
:
1392 ifreq
->ifr_SortDrawers
= ASLFRSORTDRAWERS_Last
;
1400 FRReSortListview(ld
, AslBase
);
1403 men
= item
->NextSelect
;
1404 } /* if ((item = ItemAddress(ld->ld_Menu, men))) */
1410 } /* while(men != MENUNULL) */
1412 } /* if (ld->ld_Menu) */
1414 break; /* case IDCMP_MENUPICK: */
1416 } /* switch (imsg->Class) */
1418 ReturnInt ("FRHandleEvents", ULONG
, retval
);
1421 /*****************************************************************************************/
1423 STATIC VOID
FRGadCleanup(struct LayoutData
*ld
, struct AslBase_intern
*AslBase
)
1425 struct FRUserData
*udata
;
1426 struct FileRequester
*req
;
1427 struct IntReq
*intreq
;
1429 EnterFunc(bug("FRGadCleanup(ld=%p)\n", ld
));
1431 udata
= (struct FRUserData
*)ld
->ld_UserData
;
1432 req
= (struct FileRequester
*)ld
->ld_Req
;
1433 intreq
= ld
->ld_IntReq
;
1435 if (ld
->ld_Window
&& ld
->ld_GList
)
1437 RemoveGList(ld
->ld_Window
, ld
->ld_GList
, -1);
1440 FreeObjects(&FREQ_FIRST_OBJECT(udata
), &FREQ_LAST_OBJECT(udata
), AslBase
);
1442 killscrollergadget(&udata
->ScrollGad
, AslBase
);
1444 FRFreeListviewList(ld
, AslBase
);
1448 req
->fr_LeftEdge
= intreq
->ir_LeftEdge
= ld
->ld_Window
->LeftEdge
;
1449 req
->fr_TopEdge
= intreq
->ir_TopEdge
= ld
->ld_Window
->TopEdge
;
1450 req
->fr_Width
= intreq
->ir_Width
= ld
->ld_Window
->Width
;
1451 req
->fr_Height
= intreq
->ir_Height
= ld
->ld_Window
->Height
;
1454 ReturnVoid("FRGadCleanup");
1457 /*****************************************************************************************/
1459 STATIC ULONG
FRGetSelectedFiles(struct LayoutData
*ld
, struct AslBase_intern
*AslBase
)
1461 struct FRUserData
*udata
= (struct FRUserData
*)ld
->ld_UserData
;
1462 struct IntReq
*intreq
= ld
->ld_IntReq
;
1463 struct IntFileReq
*ifreq
= (struct IntFileReq
*)intreq
;
1464 struct FileRequester
*req
= (struct FileRequester
*)ld
->ld_Req
;
1467 ULONG retval
= GHRET_OK
;
1469 /* Kill possible old output variables from a previous AslRequest call
1470 on the same requester */
1473 #define GetFR(r) ((struct FileRequester *)r)
1475 * must be done here and NOT in StripRequester
1477 MyFreeVecPooled(GetFR(req
)->fr_Drawer
, AslBase
);
1478 GetFR(req
)->fr_Drawer
= NULL
;
1480 MyFreeVecPooled(GetFR(req
)->fr_File
, AslBase
);
1481 GetFR(req
)->fr_File
= NULL
;
1483 MyFreeVecPooled(GetFR(req
)->fr_Pattern
, AslBase
);
1484 GetFR(req
)->fr_Pattern
= NULL
;
1486 StripRequester(req
, ASL_FileRequest
, AslBase
);
1488 /* Save drawer string gadget text in fr_Drawer */
1490 GetAttr(STRINGA_TextVal
, udata
->PathGad
, (IPTR
*)&name
);
1491 if (!(req
->fr_Drawer
= VecPooledCloneString(name
, NULL
, intreq
->ir_MemPool
, AslBase
))) goto bye
;
1492 D(bug("FRGetSelectedFiles: fr_Drawer 0x%lx <%s>\n",req
->fr_Drawer
,req
->fr_Drawer
));
1493 ifreq
->ifr_Drawer
= req
->fr_Drawer
;
1495 /* Save file string gadget text in fr_File */
1497 if (!(ifreq
->ifr_Flags2
& FRF_DRAWERSONLY
))
1499 GetAttr(STRINGA_TextVal
, udata
->FileGad
, (IPTR
*)&name
);
1501 if (!(req
->fr_File
= VecPooledCloneString(name
, NULL
, intreq
->ir_MemPool
, AslBase
))) goto bye
;
1502 D(bug("FRGetSelectedFiles: fr_File 0x%lx <%s>\n",req
->fr_File
,req
->fr_File
));
1503 ifreq
->ifr_File
= req
->fr_File
;
1506 /* Save pattern string gadget text in fr_Patterns */
1508 if (ifreq
->ifr_Flags1
& FRF_DOPATTERNS
)
1510 GetAttr(STRINGA_TextVal
, udata
->PatternGad
, (IPTR
*)&name
);
1512 if (!(req
->fr_Pattern
= VecPooledCloneString(name
, NULL
, intreq
->ir_MemPool
, AslBase
))) goto bye
;
1513 ifreq
->ifr_Pattern
= req
->fr_Pattern
;
1516 /* Create ArgList in case of ASLFR_DoMultiSelect requesters */
1518 req
->fr_NumArgs
= 0;
1520 if (ifreq
->ifr_Flags1
& FRF_DOMULTISELECT
)
1522 struct WBArg
*wbarg
;
1525 if ((lock
= Lock(req
->fr_Drawer
, ACCESS_READ
)))
1527 WORD numargs
, numselected
= 0;
1529 if (!(udata
->Flags
& FRFLG_SHOWING_VOLUMES
))
1531 numselected
= CountNodes(&udata
->ListviewList
, NODEPRIF_SELECTED
| NODEPRIF_MULTISEL
);
1533 numargs
= numselected
> 0 ? numselected
: 1;
1535 if ((wbarg
= MyAllocVecPooled(intreq
->ir_MemPool
, sizeof(struct WBArg
) * numargs
, AslBase
)))
1537 struct ASLLVFileReqNode
*node
;
1540 req
->fr_ArgList
= wbarg
;
1542 ForeachNode(&udata
->ListviewList
, node
)
1544 if (i
== numselected
) break;
1546 if ((node
->node
.ln_Pri
& (NODEPRIF_SELECTED
| NODEPRIF_MULTISEL
)) == (NODEPRIF_SELECTED
| NODEPRIF_MULTISEL
))
1548 char *filename
= node
->text
[0] ? node
->text
[0] : "";
1550 if ((wbarg
->wa_Name
= VecPooledCloneString(filename
, NULL
, intreq
->ir_MemPool
, AslBase
)))
1552 wbarg
->wa_Lock
= lock
;
1558 } /* ForeachNode(&udata->ListviewList, node) */
1562 if ((wbarg
->wa_Name
= VecPooledCloneString(req
->fr_File
, NULL
, intreq
->ir_MemPool
, AslBase
)))
1564 wbarg
->wa_Lock
= lock
;
1571 MyFreeVecPooled(req
->fr_ArgList
, AslBase
);
1572 req
->fr_ArgList
= NULL
;
1574 req
->fr_NumArgs
= i
;
1575 lock
= 0; /* clear lock to avoid that it is unlocked below */
1578 } /* if ((wbarg = MyAllocVecPooled(intreq->ir_MemPool, sizeof(struct WBArg) * numargs, AslBase))) */
1580 if (lock
) UnLock(lock
);
1582 } /* if ((lock = Lock(req->fr_Drawer, ACCESS_READ))) */
1584 } /* if (ifreq->ifr_Flags1 & FRF_DOMULTISELECT) */
1586 if (ifreq
->ifr_GetSortBy
) *ifreq
->ifr_GetSortBy
= ifreq
->ifr_SortBy
;
1587 if (ifreq
->ifr_GetSortOrder
) *ifreq
->ifr_GetSortOrder
= ifreq
->ifr_SortOrder
;
1588 if (ifreq
->ifr_GetSortDrawers
) *ifreq
->ifr_GetSortDrawers
= ifreq
->ifr_SortDrawers
;
1590 retval
= GHRET_FINISHED_OK
;
1596 /*****************************************************************************************/