Attempt to build Scalos core. Compiles but stops
[AROS-Contrib.git] / scalos / main / Functions.c
blob49681c9b32b6c1cb67bb6e64b665ffecdee26c0b
1 // Functions.c
2 // $Date$
3 // $Revision$
6 #include <exec/types.h>
7 #include <graphics/gels.h>
8 #include <graphics/rastport.h>
9 #include <intuition/classes.h>
10 #include <intuition/classusr.h>
11 #include <utility/hooks.h>
12 #include <intuition/gadgetclass.h>
13 #include <workbench/workbench.h>
14 #include <workbench/startup.h>
15 #include <dos/dostags.h>
16 #include <dos/datetime.h>
18 #define __USE_SYSBASE
20 #include <proto/dos.h>
21 #include <proto/exec.h>
22 #include <proto/layers.h>
23 #include <proto/intuition.h>
24 #include <proto/graphics.h>
25 #include <proto/utility.h>
26 #include <proto/iconobject.h>
27 #include "debug.h"
28 #include <proto/scalos.h>
30 #include <clib/alib_protos.h>
32 #include <defs.h>
33 #include <datatypes/iconobject.h>
34 #include <scalos/scalos.h>
36 #include <stdlib.h>
37 #include <stdio.h>
38 #include <string.h>
40 #include "scalos_structures.h"
41 #include "functions.h"
42 #include "Variables.h"
44 //----------------------------------------------------------------------------
46 // local data structures
48 //----------------------------------------------------------------------------
50 // local data items
52 // remapping of SCA_OpenIconWindow() tags to ws_Flags values
53 static const struct TagItem FlagMapTable[] =
55 { SCA_Iconify, WSV_FlagF_Iconify },
56 { SCA_NoStatusBar, WSV_FlagF_NoStatusBar },
57 { SCA_NoActivateWindow, WSV_FlagF_NoActivateWindow },
58 { SCA_BrowserMode, WSV_FlagF_BrowserMode },
59 { SCA_CheckOverlappingIcons, WSV_FlagF_CheckOverlappingIcons },
60 { SCA_DdPopupWindow, WSV_FlagF_DdPopupWindow },
61 { TAG_END, 0 },
64 // remapping of SCA_OpenIconWindow() tags to ws_MoreFlags values
65 static const struct TagItem MoreFlagMapTable[] =
67 { SCA_NoControlBar, WSV_MoreFlagF_NoControlBar },
68 { TAG_END, 0 },
71 //----------------------------------------------------------------------------
73 // local functions
75 static Object *ReadDeviceIconObject(CONST_STRPTR Path);
76 static Object *FindIconInScalosWindows(BPTR Lock, CONST_STRPTR IconName,
77 struct ScaWindowStruct **wsLocked, BOOL *windowListLocked);
78 static Object *FindIconInDeviceWindow(CONST_STRPTR IconName,
79 struct ScaWindowStruct **wsLocked, BOOL *windowListLocked);
80 static BOOL MatchDeviceIcon(CONST_STRPTR SearchPath, struct ScaIconNode *in);
81 static BOOL MatchPath(CONST_STRPTR VolPath, CONST_STRPTR DevIconPath);
83 //----------------------------------------------------------------------------
85 // implementation of SCA_OpenIconWindow()
87 LIBFUNC_P2(BOOL, sca_OpenIconWindow,
88 A0, struct TagItem *, TagList,
89 A6, struct ScalosBase *, ScalosBase, 0)
91 Object *IconObj = NULL;
92 Object *allocIconObj = NULL;
93 struct MsgPort *allocMsgPort = NULL;
94 struct ScaWindowStruct *wsNew = NULL;
95 struct ScaWindowStruct *dummyList = NULL;
96 struct SM_StartWindow *msgStart = NULL;
97 BOOL Success = FALSE;
98 struct ScaWindowStruct *wsIconListLocked = NULL;
99 BOOL WindowListLocked = FALSE;
101 (void)ScalosBase;
103 d1(KPrintF("%s/%s/%ld: START\n", __FILE__, __FUNC__, __LINE__));
105 do {
106 STATIC_PATCHFUNC(WindowTask)
107 struct ScaWindowStruct *ws;
108 struct ScaWindowStruct **ReturnWs;
109 struct IBox *WindowRect;
110 struct ScaIconNode *in;
111 struct MsgPort *ReplyPort;
112 STRPTR Path;
113 STRPTR TaskName;
114 ULONG WindowFlags;
115 CONST_STRPTR clp;
116 BOOL Found;
117 size_t length;
119 ReturnWs = (struct ScaWindowStruct **) GetTagData(SCA_WindowStruct, (ULONG)NULL, TagList);
120 d1(KPrintF("%s/%s/%ld: ReturnWs=%08lx\n", __FILE__, __FUNC__, __LINE__, ReturnWs));
122 in = (struct ScaIconNode *) GetTagData(SCA_IconNode, (ULONG)NULL, TagList);
123 if (in)
124 IconObj = in->in_Icon;
126 IconObj = (Object *) GetTagData(SCA_IconObject, (ULONG) IconObj, TagList);
128 d1(KPrintF("%s/%s/%ld: in=%08lx IconObj=%08lx\n", __FILE__, __FUNC__, __LINE__, in, IconObj));
130 WindowFlags = GetTagData(SCA_Flags, 0, TagList);
132 ReplyPort = (struct MsgPort *) GetTagData(SCA_MessagePort, (ULONG)NULL, TagList);
133 d1(KPrintF("%s/%s/%ld: ReplyPort=%08lx\n", __FILE__, __FUNC__, __LINE__, ReplyPort));
134 if (NULL == ReplyPort)
135 ReplyPort = allocMsgPort = CreateMsgPort();
136 if (NULL == ReplyPort)
137 break;
139 wsNew = (struct ScaWindowStruct *) SCA_AllocStdNode((struct ScalosNodeList *)(APTR) &dummyList, NTYP_WindowStruct);
140 if (NULL == wsNew)
141 break;
143 wsNew->ws_Left = CurrentPrefs.pref_DefWindowBox.Left;
144 wsNew->ws_Top = CurrentPrefs.pref_DefWindowBox.Top;
145 wsNew->ws_Width = CurrentPrefs.pref_DefWindowBox.Width;
146 wsNew->ws_Height = CurrentPrefs.pref_DefWindowBox.Height;
148 wsNew->ws_WindowOpacityActive = CurrentPrefs.pref_ActiveWindowTransparency;
149 wsNew->ws_WindowOpacityInactive = CurrentPrefs.pref_InactiveWindowTransparency;
151 wsNew->ws_IconSizeConstraints = CurrentPrefs.pref_IconSizeConstraints;
152 wsNew->ws_IconScaleFactor = CurrentPrefs.pref_IconScaleFactor;
154 Path = (STRPTR) GetTagData(SCA_Path, (ULONG)NULL, TagList);
155 d1(KPrintF("%s/%s/%ld: Path=%08lx <%s>\n", __FILE__, __FUNC__, __LINE__, Path, Path ? Path : (STRPTR) ""));
156 if (Path)
158 BPTR parentLock;
160 wsNew->ws_Lock = Lock(Path, ACCESS_READ);
161 debugLock_d1(wsNew->ws_Lock);
162 if ((BPTR)NULL == wsNew->ws_Lock)
163 break;
165 wsNew->ws_Name = GetWsNameFromLock(wsNew->ws_Lock);
166 d1(KPrintF("%s/%s/%ld: ws_Name=<%s>\n", __FILE__, __FUNC__, __LINE__, wsNew->ws_Name));
168 IconObj = FunctionsFindIconObjectForPath(Path, &WindowListLocked,
169 &wsIconListLocked, &allocIconObj);
171 parentLock = ParentDir(wsNew->ws_Lock);
172 debugLock_d1(parentLock);
173 if (parentLock)
175 UnLock(parentLock);
177 else
179 // this is a root window
180 wsNew->ws_Flags |= WSV_FlagF_RootWindow;
184 d1(KPrintF("%s/%s/%ld: IconObj=%08lx ws_Name=%08lx\n", __FILE__, __FUNC__, __LINE__, IconObj, wsNew->ws_Name));
186 WindowRect = (struct IBox *) GetTagData(SCA_WindowRect, (ULONG)NULL, TagList);
187 d1(KPrintF("%s/%s/%ld: WindowRect=%08lx\n", __FILE__, __FUNC__, __LINE__, WindowRect));
188 if (NULL == WindowRect)
189 GetAttr(IDTA_WindowRect, IconObj, (APTR) &WindowRect);
191 d1(kprintf("%s/%s/%ld: WindowRect=%08lx\n", __FILE__, __FUNC__, __LINE__, WindowRect));
192 if (WindowRect)
194 wsNew->ws_Left = WindowRect->Left;
195 wsNew->ws_Top = WindowRect->Top;
196 wsNew->ws_Width = WindowRect->Width;
197 wsNew->ws_Height = WindowRect->Height;
200 wsNew->ws_xoffset = wsNew->ws_yoffset = 0;
201 wsNew->ws_Viewmodes = GetTagData(SCA_ViewModes, IDTV_ViewModes_Default, TagList);
203 wsNew->ws_ThumbnailView = CurrentPrefs.pref_ShowThumbnails;
205 // determine default pattern number
206 if (IsViewByIcon(wsNew->ws_Viewmodes))
207 wsNew->ws_PatternNumber = PATTERNNR_IconWindowDefault; // default icon window pattern no.
208 else
209 wsNew->ws_PatternNumber = PATTERNNR_TextWindowDefault; // default text window pattern no.
211 wsNew->ws_ThumbnailsLifetimeDays = CurrentPrefs.pref_ThumbnailMaxAge;
213 wsNew->ws_Flags = PackBoolTags(wsNew->ws_Flags, TagList, (struct TagItem *) FlagMapTable);
214 wsNew->ws_MoreFlags = PackBoolTags(wsNew->ws_MoreFlags, TagList, (struct TagItem *) MoreFlagMapTable);
216 d1(KPrintF("%s/%s/%ld: ws_Flags=%08lx\n", __FILE__, __FUNC__, __LINE__, wsNew->ws_Flags));
218 if (IconObj)
220 struct IconWindowProperties iwp;
222 iwp.iwp_SortOrder = wsNew->ws_SortOrder;
223 iwp.iwp_ThumbnailView = wsNew->ws_ThumbnailView;
224 iwp.iwp_ThumbnailsLifetimeDays = wsNew->ws_ThumbnailsLifetimeDays;
225 iwp.iwp_ShowAll = wsNew->ws_ViewAll;
226 iwp.iwp_Viewmodes = wsNew->ws_Viewmodes;
227 iwp.iwp_PatternNumber = wsNew->ws_PatternNumber;
228 iwp.iwp_CheckOverlap = (wsNew->ws_Flags & WSV_FlagF_CheckOverlappingIcons) != 0;
229 iwp.iwp_XOffset = iwp.iwp_YOffset = 0;
230 iwp.iwp_OpacityActive = wsNew->ws_WindowOpacityActive;
231 iwp.iwp_OpacityInactive = wsNew->ws_WindowOpacityInactive;
232 iwp.iwp_IconSizeConstraints = wsNew->ws_IconSizeConstraints;
233 iwp.iwp_IconScaleFactor = wsNew->ws_IconScaleFactor;
235 FunctionsGetSettingsFromIconObject(&iwp, IconObj);
237 wsNew->ws_SortOrder = iwp.iwp_SortOrder;
238 wsNew->ws_ViewAll = iwp.iwp_ShowAll;
239 wsNew->ws_ThumbnailsLifetimeDays = iwp.iwp_ThumbnailsLifetimeDays;
240 wsNew->ws_PatternNumber = iwp.iwp_PatternNumber;
241 wsNew->ws_Viewmodes = iwp.iwp_Viewmodes;
242 wsNew->ws_ThumbnailView = iwp.iwp_ThumbnailView;
243 wsNew->ws_WindowOpacityActive = iwp.iwp_OpacityActive;
244 wsNew->ws_WindowOpacityInactive = iwp.iwp_OpacityInactive;
245 wsNew->ws_IconSizeConstraints = iwp.iwp_IconSizeConstraints;
246 wsNew->ws_IconScaleFactor = iwp.iwp_IconScaleFactor;
248 if (iwp.iwp_NoStatusBar)
249 wsNew->ws_Flags |= WSV_FlagF_NoStatusBar;
250 if (iwp.iwp_NoControlBar)
251 wsNew->ws_MoreFlags |= WSV_MoreFlagF_NoControlBar;
252 if (iwp.iwp_BrowserMode)
253 wsNew->ws_Flags |= WSV_FlagF_BrowserMode;
255 if (iwp.iwp_CheckOverlap)
256 wsNew->ws_Flags |= WSV_FlagF_CheckOverlappingIcons;
257 else
258 wsNew->ws_Flags &= ~WSV_FlagF_CheckOverlappingIcons;
261 // SCA_ShowAllMode and SCA_ShowAllFiles tags explicitly given
262 // take precedence over window/icon settings
263 wsNew->ws_ViewAll = GetTagData(SCA_ShowAllMode, wsNew->ws_ViewAll, TagList);
264 if (NULL == FindTagItem(SCA_ShowAllMode, TagList)
265 && FindTagItem(SCA_ShowAllFiles, TagList))
267 wsNew->ws_ViewAll = GetTagData(SCA_ShowAllFiles, FALSE, TagList)
268 ? DDFLAGS_SHOWALL : DDFLAGS_SHOWDEFAULT;
271 if (IsShowAll(wsNew))
272 wsNew->ws_Flags |= WSV_FlagF_ShowAllFiles;
273 else
274 wsNew->ws_Flags &= ~WSV_FlagF_ShowAllFiles;
276 wsNew->ws_xoffset = GetTagData(SCA_XOffset, wsNew->ws_xoffset, TagList);
277 wsNew->ws_yoffset = GetTagData(SCA_YOffset, wsNew->ws_yoffset, TagList);
279 wsNew->ws_PatternNumber = GetTagData(SCA_PatternNumber, wsNew->ws_PatternNumber, TagList);
280 wsNew->ws_PatternNode = GetPatternNode(wsNew->ws_PatternNumber, NULL);
282 wsNew->ws_Viewmodes = GetTagData(SCA_ViewModes, wsNew->ws_Viewmodes, TagList);
284 wsNew->ws_WindowOpacityActive = GetTagData(SCA_TransparencyActive, wsNew->ws_WindowOpacityActive, TagList);
285 wsNew->ws_WindowOpacityInactive = GetTagData(SCA_TransparencyInactive, wsNew->ws_WindowOpacityInactive, TagList);
287 d1(kprintf("%s/%s/%ld: ws_ViewModes=%ld\n", __FILE__, __FUNC__, __LINE__, wsNew->ws_Viewmodes));
288 d1(KPrintF("%s/%s/%ld: ws_Flags=%08lx\n", __FILE__, __FUNC__, __LINE__, wsNew->ws_Flags));
290 if (IsViewByIcon(wsNew->ws_Viewmodes))
291 wsNew->ms_ClassName = (STRPTR) "IconWindow.sca";
292 else
293 wsNew->ms_ClassName = (STRPTR) "TextWindow.sca";
295 wsNew->ms_ClassName = (STRPTR) GetTagData(SCA_ClassName, (ULONG) wsNew->ms_ClassName, TagList);
297 wsNew->ms_Class = (Class *) GetTagData(SCA_Class, (ULONG)NULL, TagList);
298 if (wsNew->ms_Class)
299 wsNew->ms_ClassName = NULL;
301 if ((BPTR)NULL == wsNew->ws_Lock)
303 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
305 if (in)
307 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
309 if (in->in_Lock)
311 // .withlock:
312 BPTR oldDir;
314 if (NULL == in->in_Name)
315 break;
317 wsNew->ws_Name = AllocCopyString(in->in_Name);
318 if (NULL == wsNew->ws_Name)
319 break;
321 oldDir = CurrentDir(in->in_Lock);
323 wsNew->ws_Lock = Lock(in->in_Name, ACCESS_READ);
325 CurrentDir(oldDir);
327 if ((BPTR)NULL == wsNew->ws_Lock)
328 break;
330 else
332 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
334 if (in->in_DeviceIcon)
336 wsNew->ws_Lock = DiskInfoLock(in);
337 debugLock_d1(wsNew->ws_Lock);
338 if ((BPTR)NULL == wsNew->ws_Lock)
339 break;
341 wsNew->ws_Name = AllocCopyString(in->in_DeviceIcon->di_Volume);
342 d1(kprintf("%s/%s/%ld: ws_Name=%08lx\n", __FILE__, __FUNC__, __LINE__, wsNew->ws_Name));
343 if (NULL == wsNew->ws_Name)
344 break;
346 StripTrailingColon(wsNew->ws_Name);
348 wsNew->ws_Flags |= WSV_FlagF_RootWindow;
350 else
352 // .onlyicon:
353 if (NULL == in->in_Name)
354 break;
356 wsNew->ws_Lock = Lock(in->in_Name, ACCESS_READ);
357 debugLock_d1(wsNew->ws_Lock);
358 if ((BPTR)NULL == wsNew->ws_Lock)
359 break;
361 wsNew->ws_Name = AllocCopyString(in->in_Name);
362 d1(kprintf("%s/%s/%ld: ws_Name=%08lx\n", __FILE__, __FUNC__, __LINE__, wsNew->ws_Name));
363 if (NULL == wsNew->ws_Name)
364 break;
368 else
370 // .noiconnode:
371 STRPTR iconName = NULL;
372 ULONG IconType;
374 d1(kprintf("%s/%s/%ld: IconObj=%08lx\n", __FILE__, __FUNC__, __LINE__, IconObj));
376 if (NULL == IconObj)
377 break;
379 GetAttr(DTA_Name, IconObj, (APTR) &iconName);
380 if (NULL == iconName)
381 break;
382 if ('\0' == *iconName)
383 break;
385 d1(kprintf("%s/%s/%ld: iconName=<%s> \n", __FILE__, __FUNC__, __LINE__, iconName));
387 GetAttr(IDTA_Type, IconObj, &IconType);
389 if (':' == iconName[strlen(iconName) - 1])
390 IconType = WBDISK;
392 d1(kprintf("%s/%s/%ld: IconType=%ld\n", __FILE__, __FUNC__, __LINE__, IconType));
394 if (WBDISK == IconType)
396 wsNew->ws_Name = AllocCopyString(iconName);
398 if (NULL == wsNew->ws_Name)
399 break;
401 StripTrailingColon(wsNew->ws_Name);
403 wsNew->ws_Flags |= WSV_FlagF_RootWindow;
405 else
407 wsNew->ws_Name = AllocCopyString(FilePart(iconName));
408 if (NULL == wsNew->ws_Name)
409 break;
412 wsNew->ws_Lock = Lock(iconName, ACCESS_READ);
413 debugLock_d1(wsNew->ws_Lock);
414 if ((BPTR)NULL == wsNew->ws_Lock)
415 break;
418 // .lockok:
419 d1(kprintf("%s/%s/%ld: ws_Name=%08lx\n", __FILE__, __FUNC__, __LINE__, wsNew->ws_Name));
421 if (wsIconListLocked)
423 d1(kprintf("\n" "%s/%s/%ld: wsLocked=%08lx\n", __FILE__, __FUNC__, __LINE__, wsIconListLocked));
424 ScalosReleaseSemaphore(wsIconListLocked->ws_WindowTask->wt_IconSemaphore);
425 wsIconListLocked = NULL;
427 if (WindowListLocked)
429 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
430 SCA_UnLockWindowList();
431 WindowListLocked = FALSE;
434 if (wsNew->ws_Flags & WSV_FlagF_RootWindow)
435 clp = CurrentPrefs.pref_MainWindowTitle;
436 else
437 clp = CurrentPrefs.pref_StandardWindowTitle;
439 wsNew->ws_Title = AllocCopyString((STRPTR) GetTagData(SCA_WindowTitle, (ULONG) clp, TagList));
440 if (NULL == wsNew->ws_Title)
441 break;
443 Found = FALSE;
444 SCA_LockWindowList(SCA_LockWindowList_Shared);
446 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
447 debugLock_d1(wsNew->ws_Lock);
449 for (ws=winlist.wl_WindowStruct; !Found && ws; ws = (struct ScaWindowStruct *) ws->ws_Node.mln_Succ)
451 if (ws != wsNew && ws->ws_Lock &&
452 LOCK_SAME == ScaSameLock(wsNew->ws_Lock, ws->ws_Lock))
454 Found = TRUE;
456 if (ws->ws_Flags & WSV_FlagF_Iconify)
458 struct ScalosMessage *msg = SCA_AllocMessage(MTYP_UnIconify, 0);
460 if (msg)
462 d1(kprintf("%s/%s/%ld: PutMsg iwt=%08lx Msg=%08lx \n", __FILE__, __FUNC__, __LINE__, ws->ws_WindowTask, &msg->sm_Message));
463 PutMsg(ws->ws_MessagePort, &msg->sm_Message);
466 else
468 if (ws->ws_Window)
470 ActivateWindow(ws->ws_Window);
471 WindowToFront(ws->ws_Window);
477 d1(kprintf("%s/%s/%ld: Found=%ld\n", __FILE__, __FUNC__, __LINE__, Found));
479 SCA_UnLockWindowList();
481 if (Found)
483 // requested Scalos window for drawer is already open
484 Success = TRUE;
485 break;
488 msgStart = (struct SM_StartWindow *) SCA_AllocMessage(MTYP_StartWindow, 0);
489 d1(kprintf("%s/%s/%ld: msgStart=%08lx\n", __FILE__, __FUNC__, __LINE__, msgStart));
490 if (NULL == msgStart)
491 break;
493 msgStart->ScalosMessage.sm_Message.mn_ReplyPort = ReplyPort;
494 msgStart->WindowStruct = wsNew;
496 length = 50 + strlen(wsNew->ws_Name);
498 wsNew->ws_WindowTaskName = ScalosAlloc(length);
499 if (wsNew->ws_WindowTaskName)
501 TaskName = wsNew->ws_WindowTaskName;
503 ScaFormatStringMaxLength(TaskName, length,
504 "Scalos_Window_Task <%s>", (ULONG) wsNew->ws_Name);
506 else
508 TaskName = (STRPTR) "Scalos_Window_Task";
511 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
513 wsNew->ws_Task = CreateNewProcTags(
514 NP_WindowPtr, ~0,
515 NP_StackSize, CurrentPrefs.pref_DefaultStackSize,
516 NP_Priority, 1,
517 NP_Cli, TRUE,
518 NP_CommandName, (ULONG) TaskName,
519 NP_Name, (ULONG) TaskName,
520 NP_Entry, (ULONG) PATCH_NEWFUNC(WindowTask),
521 NP_CurrentDir, wsNew->ws_Lock,
522 NP_Path, DupWBPathList(),
523 TAG_END);
525 d1(kprintf("%s/%s/%ld: ws_Task=%08lx\n", __FILE__, __FUNC__, __LINE__, wsNew->ws_Task));
526 if (NULL == wsNew->ws_Task)
527 break;
529 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
531 PutMsg(&wsNew->ws_Task->pr_MsgPort, &msgStart->ScalosMessage.sm_Message);
532 msgStart = NULL; // no SCA_FreeMessage()
534 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
536 if (WindowFlags & SCAF_OpenWindow_ScalosPort)
538 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
539 WaitReply(ReplyPort, NULL, MTYP_StartWindow);
541 else
543 BOOL Finished = FALSE;
544 struct ScalosMessage *ReplyMsg;
546 do {
547 WaitPort(ReplyPort);
549 ReplyMsg = (struct ScalosMessage *) GetMsg(ReplyPort);
551 d1(kprintf("%s/%s/%ld: MessageType=%ld\n", __FILE__, __FUNC__, __LINE__, ReplyMsg->sm_MessageType));
553 if (ReplyMsg && ID_IMSG == ReplyMsg->sm_Signature
554 && MTYP_StartWindow == ReplyMsg->sm_MessageType)
556 SCA_FreeMessage(ReplyMsg);
557 Finished = TRUE;
559 } while (!Finished);
562 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
564 if (ReturnWs)
565 *ReturnWs = wsNew;
567 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
569 wsNew = NULL;
570 Success = TRUE;
571 } while (0);
573 if (wsIconListLocked)
575 d1(kprintf("\n" "%s/%s/%ld: wsLocked=%08lx\n", __FILE__, __FUNC__, __LINE__, wsIconListLocked));
576 ScalosReleaseSemaphore(wsIconListLocked->ws_WindowTask->wt_IconSemaphore);
578 if (WindowListLocked)
580 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
581 SCA_UnLockWindowList();
584 if (msgStart)
585 SCA_FreeMessage(&msgStart->ScalosMessage);
586 if (allocIconObj)
587 DisposeIconObject(allocIconObj);
588 if (wsNew)
590 if (wsNew->ws_Lock)
591 UnLock(wsNew->ws_Lock);
592 if (wsNew->ws_Name)
593 FreeCopyString(wsNew->ws_Name);
595 SCA_FreeAllNodes((struct ScalosNodeList *)(APTR) &dummyList);
597 if (allocMsgPort)
598 DeleteMsgPort(allocMsgPort);
600 d1(kprintf("%s/%s/%ld: Success=%ld\n", __FILE__, __FUNC__, __LINE__, Success));
602 return Success;
604 LIBFUNC_END
607 BPTR DiskInfoLock(const struct ScaIconNode *in)
609 return Lock(in->in_DeviceIcon->di_Device, ACCESS_READ);
613 static Object *ReadDeviceIconObject(CONST_STRPTR Path)
615 Object *IconObj = NULL;
616 STRPTR internalName;
617 struct DosList *dList;
619 do {
620 internalName = AllocPathBuffer();
621 if (NULL == internalName)
622 break;
624 stccpy(internalName, Path, Max_PathLen);
625 StripTrailingColon(internalName);
627 d1(kprintf("%s/%s/%ld: Path=<%s> internalName=<%s>\n", __FILE__, __FUNC__, __LINE__, Path, internalName));
629 dList = LockDosList(LDF_ASSIGNS | LDF_DEVICES | LDF_VOLUMES | LDF_READ);
630 if ((dList = FindDosEntry(dList, internalName, LDF_ASSIGNS | LDF_DEVICES | LDF_VOLUMES)))
632 // First, try to get "VOLNAME:disk" icon
634 d1(kprintf("%s/%s/%ld: FOUND internalName=<%s> Type=%ld\n", __FILE__, __FUNC__, __LINE__, internalName, dList->dol_Type));
636 stccpy(internalName, Path, Max_PathLen - 5);
637 AddPart(internalName, "disk", Max_PathLen);
639 d1(kprintf("%s/%s/%ld: internalName=<%s>\n", __FILE__, __FUNC__, __LINE__, internalName));
641 IconObj = NewIconObjectTags(internalName,
642 IDTA_SizeConstraints, (ULONG) &CurrentPrefs.pref_IconSizeConstraints,
643 IDTA_ScalePercentage, CurrentPrefs.pref_IconScaleFactor,
644 TAG_END);
645 d1(kprintf("%s/%s/%ld: IconObj=%08lx internalName=<%s>\n", __FILE__, __FUNC__, __LINE__, IconObj, internalName));
647 if (NULL == IconObj && CurrentPrefs.pref_DefIconPath)
649 CONST_STRPTR DeviceName = NULL;
651 switch (dList->dol_Type)
653 case DLT_DIRECTORY:
654 case DLT_LATE:
655 case DLT_NONBINDING:
656 IconObj = NewIconObjectTags(Path,
657 IDTA_SizeConstraints, (ULONG) &CurrentPrefs.pref_IconSizeConstraints,
658 IDTA_ScalePercentage, CurrentPrefs.pref_IconScaleFactor,
659 TAG_END);
660 break;
662 case DLT_DEVICE:
663 DeviceName = Path;
664 break;
666 case DLT_VOLUME:
667 if (dList->dol_Task)
669 // no "VOLNAME:disk" icon found
670 // try "ENV:sys/def_DEVNAME"
672 // get Device name from volume name, e.g. "RAM" from "Ram Disk"
673 struct Task *SigTask = (struct Task *) dList->dol_Task->mp_SigTask;
675 if (SigTask)
676 DeviceName = SigTask->tc_Node.ln_Name;
678 break;
681 if (NULL == IconObj && DeviceName)
683 stccpy(internalName, CurrentPrefs.pref_DefIconPath, Max_PathLen);
685 AddPart(internalName, "def_", Max_PathLen - 1);
687 SafeStrCat(internalName, DeviceName, Max_PathLen - 1);
688 StripTrailingColon(internalName);
689 SafeStrCat(internalName, "disk", Max_PathLen - 1);
691 // if XXX is our device name, then
692 // look for "ENVARC:sys/def_XXXdisk"
694 d1(kprintf("%s/%s/%ld: DeviceName=<%s>\n", __FILE__, __FUNC__, __LINE__, internalName));
696 IconObj = NewIconObjectTags(internalName,
697 IDTA_SizeConstraints, (ULONG) &CurrentPrefs.pref_IconSizeConstraints,
698 IDTA_ScalePercentage, CurrentPrefs.pref_IconScaleFactor,
699 TAG_END);
704 UnLockDosList(LDF_ASSIGNS | LDF_VOLUMES | LDF_DEVICES | LDF_READ);
705 } while (0);
707 if (internalName)
708 FreePathBuffer(internalName);
710 return IconObj;
714 static Object *FindIconInScalosWindows(BPTR Lock, CONST_STRPTR IconName,
715 struct ScaWindowStruct **wsLocked, BOOL *windowListLocked)
717 struct ScaWindowStruct *ws;
719 *wsLocked = NULL;
720 *windowListLocked = FALSE;
722 SCA_LockWindowList(SCA_LockWindowList_Shared);
724 for (ws=winlist.wl_WindowStruct; ws; ws = (struct ScaWindowStruct *) ws->ws_Node.mln_Succ)
726 d1(kprintf("\n" "%s/%s/%ld: ws=%08lx <%s>\n", __FILE__, __FUNC__, __LINE__, ws, ws->ws_Name));
727 debugLock_d1(ws->ws_Lock);
729 if (LOCK_SAME == SameLock(ws->ws_Lock, Lock))
731 struct internalScaWindowTask *iwt = (struct internalScaWindowTask *) ws->ws_WindowTask;
732 struct ScaIconNode *in;
734 d1(kprintf("\n" "%s/%s/%ld: found ws=%08lx\n", __FILE__, __FUNC__, __LINE__, ws));
736 ScalosLockIconListShared(iwt);
738 for (in = iwt->iwt_WindowTask.wt_IconList; in; in = (struct ScaIconNode *) in->in_Node.mln_Succ)
740 CONST_STRPTR Name = GetIconName(in);
742 if (Name && 0 == Stricmp((STRPTR) IconName, (STRPTR) Name))
744 *wsLocked = ws;
745 *windowListLocked = TRUE;
747 d1(kprintf("\n" "%s/%s/%ld: ws=%08lx in=%08lx <%s> Icon=%08lx\n", __FILE__, __FUNC__, __LINE__, ws, in, Name, in->in_Icon));
749 return in->in_Icon;
753 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
755 ScalosUnLockIconList(iwt);
760 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
762 SCA_UnLockWindowList();
764 d1(kprintf("\n" "%s/%s/%ld: not found\n", __FILE__, __FUNC__, __LINE__));
766 return NULL;
770 static Object *FindIconInDeviceWindow(CONST_STRPTR IconName,
771 struct ScaWindowStruct **wsLocked, BOOL *windowListLocked)
773 struct internalScaWindowTask *iwt;
774 struct ScaIconNode *in;
776 *windowListLocked = FALSE;
778 d1(KPrintF("\n" "%s/%s/%ld: IconName=<%s>\n", __FILE__, __FUNC__, __LINE__, IconName));
779 d1(KPrintF("\n" "%s/%s/%ld: ii_MainWindowStruct=%08lx\n", __FILE__, __FUNC__, __LINE__, iInfos.xii_iinfos.ii_MainWindowStruct));
781 while (NULL == iInfos.xii_iinfos.ii_MainWindowStruct
782 || NULL == iInfos.xii_iinfos.ii_MainWindowStruct->ws_WindowTask)
784 d1(KPrintF("\n" "%s/%s/%ld: Wait for ii_MainWindowStruct=%08lx\n", __FILE__, __FUNC__, __LINE__, iInfos.xii_iinfos.ii_MainWindowStruct));
785 Delay(10);
787 iwt = (struct internalScaWindowTask *) iInfos.xii_iinfos.ii_MainWindowStruct->ws_WindowTask;
789 d1(KPrintF("\n" "%s/%s/%ld: wt_IconSemaphore=%08lx\n", __FILE__, __FUNC__, __LINE__, iwt->iwt_WindowTask.wt_IconSemaphore));
791 while (NULL == iwt->iwt_WindowTask.wt_IconSemaphore && !iwt->iwt_CloseWindow)
793 d1(KPrintF("\n" "%s/%s/%ld: Wait for wt_IconSemaphore=%08lx\n", __FILE__, __FUNC__, __LINE__, iwt->iwt_WindowTask.wt_IconSemaphore));
794 Delay(10);
797 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
798 ScalosLockIconListShared(iwt);
800 *wsLocked = iwt->iwt_WindowTask.mt_WindowStruct;
802 for (in = iwt->iwt_WindowTask.wt_IconList; in; in = (struct ScaIconNode *) in->in_Node.mln_Succ)
804 if (MatchDeviceIcon(IconName, in))
806 d1(KPrintF("\n" "%s/%s/%ld: iwt=%08lx in=%08lx <%s> Icon=%08lx\n", __FILE__, __FUNC__, __LINE__, iwt, in, IconName, in->in_Icon));
807 return in->in_Icon;
811 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
813 ScalosUnLockIconList(iwt);
815 *wsLocked = NULL;
817 d1(kprintf("%s/%s/%ld: \n", __FILE__, __FUNC__, __LINE__));
818 d1(kprintf("\n" "%s/%s/%ld: not found\n", __FILE__, __FUNC__, __LINE__));
820 return NULL;
823 // ----------------------------------------------------------
825 STRPTR GetWsNameFromLock(BPTR WsLock)
827 STRPTR allocPath;
828 STRPTR WsName = NULL;
830 do {
831 STRPTR lp;
833 allocPath = AllocPathBuffer();
834 if (NULL == allocPath)
835 break;
837 if (!NameFromLock(WsLock, allocPath, Max_PathLen - 1))
838 break;
840 lp = FilePart(allocPath);
841 d1(kprintf("%s/%s/%ld: FilePart=<%s>\n", __FILE__, __FUNC__, __LINE__, lp));
842 if (*lp)
844 WsName = AllocCopyString(lp);
845 if (NULL == WsName)
846 break;
848 else
850 WsName = AllocCopyString(allocPath);
851 if (NULL == WsName)
852 break;
854 StripTrailingColon(WsName);
856 } while (0);
858 if (allocPath)
859 FreePathBuffer(allocPath);
861 return WsName;
864 // ----------------------------------------------------------
866 static BOOL MatchDeviceIcon(CONST_STRPTR SearchPath, struct ScaIconNode *in)
868 if (NULL == in->in_DeviceIcon)
869 return FALSE;
871 return (BOOL) (MatchPath(SearchPath, in->in_DeviceIcon->di_Volume)
872 || MatchPath(SearchPath, in->in_DeviceIcon->di_Device)
873 || MatchPath(SearchPath, GetIconName(in)));
877 static BOOL MatchPath(CONST_STRPTR VolPath, CONST_STRPTR DevIconPath)
879 BOOL Match = FALSE;
881 if (DevIconPath)
883 size_t len = strlen(VolPath);
884 size_t diLen = strlen(DevIconPath);
886 if (':' == DevIconPath[diLen - 1])
887 Match = 0 == Stricmp(VolPath, DevIconPath);
888 else
889 Match = (diLen + 1 == len) && 0 == Strnicmp(VolPath, DevIconPath, len);
892 return Match;
895 // ----------------------------------------------------------
897 Object *FunctionsFindIconObjectForPath(CONST_STRPTR Path, BOOL *WindowListLocked,
898 struct ScaWindowStruct **wsIconListLocked, Object **allocIconObj)
900 Object *IconObj = NULL;
901 BPTR pLock;
902 BPTR parentLock = BNULL;
903 BPTR oldDir = NOT_A_LOCK;
904 STRPTR FullPath = NULL;
906 do {
907 d1(KPrintF("%s/%s/%ld: START Path=<%s>\n", __FILE__, __FUNC__, __LINE__, Path));
909 pLock = Lock(Path, ACCESS_READ);
910 debugLock_d1(pLock);
911 if (BNULL == pLock)
912 break;
914 FullPath = AllocPathBuffer();
915 if (NULL == FullPath)
916 break;
918 if (!NameFromLock(pLock, FullPath, Max_PathLen - 1))
919 break;
921 d1(KPrintF("%s/%s/%ld: FullPath=<%s>\n", __FILE__, __FUNC__, __LINE__, FullPath));
923 oldDir = CurrentDir(pLock);
924 parentLock = ParentDir(pLock);
925 debugLock_d1(parentLock);
926 if (parentLock)
928 d1(KPrintF("%s/%s/%ld: Drawer window\n", __FILE__, __FUNC__, __LINE__));
930 IconObj = FindIconInScalosWindows(parentLock, FullPath,
931 wsIconListLocked, WindowListLocked);
933 d1(KPrintF("%s/%s/%ld: IconObj=%08lx\n", __FILE__, __FUNC__, __LINE__, IconObj));
934 if (NULL == IconObj)
936 CurrentDir(parentLock);
938 IconObj = *allocIconObj = NewIconObjectTags(FullPath,
939 IDTA_SizeConstraints, (ULONG) &CurrentPrefs.pref_IconSizeConstraints,
940 IDTA_ScalePercentage, CurrentPrefs.pref_IconScaleFactor,
941 TAG_END);
943 d1(KPrintF("%s/%s/%ld: IconObj=%08lx\n", __FILE__, __FUNC__, __LINE__, IconObj));
944 if (NULL == IconObj)
946 IconObj = (Object *) DoMethod(iInfos.xii_iinfos.ii_MainWindowStruct->ws_WindowTask->mt_MainObject,
947 SCCM_IconWin_GetDefIcon,
948 FullPath,
949 ST_USERDIR,
951 WBDRAWER);
953 d1(KPrintF("%s/%s/%ld: IconObj=%08lx\n", __FILE__, __FUNC__, __LINE__, IconObj));
957 else
959 // this is a root window
960 d1(KPrintF("%s/%s/%ld: Root window\n", __FILE__, __FUNC__, __LINE__));
962 IconObj = FindIconInDeviceWindow(FullPath,
963 wsIconListLocked, WindowListLocked);
965 d1(KPrintF("%s/%s/%ld: IconObj=%08lx\n", __FILE__, __FUNC__, __LINE__, IconObj));
967 if (NULL == IconObj)
968 IconObj = *allocIconObj = ReadDeviceIconObject(FullPath);
970 } while (0);
972 if (IS_VALID_LOCK(oldDir))
973 CurrentDir(oldDir);
974 if (parentLock)
975 UnLock(parentLock);
976 if (FullPath)
977 FreePathBuffer(FullPath);
978 if (pLock)
979 UnLock(pLock);
981 d1(KPrintF("%s/%s/%ld: END IconObj=%08lx\n", __FILE__, __FUNC__, __LINE__, IconObj));
983 return IconObj;
986 // ----------------------------------------------------------
988 void FunctionsGetSettingsFromIconObject(struct IconWindowProperties *iwp, Object *IconObj)
990 ULONG ddFlags;
991 ULONG ViewBy;
992 ULONG lDummy;
993 STRPTR tt;
995 GetAttr(IDTA_ViewModes, IconObj, &ViewBy);
996 GetAttr(IDTA_Flags, IconObj, &ddFlags);
998 iwp->iwp_Viewmodes = TranslateViewModesFromIcon(ViewBy);
1000 d1(KPrintF("%s/%s/%ld: ddFlags=%08lx\n", __FILE__, __FUNC__, __LINE__, ddFlags));
1002 switch (ddFlags & DDFLAGS_SHOWMASK)
1004 case DDFLAGS_SHOWDEFAULT:
1005 iwp->iwp_ShowAll = DDFLAGS_SHOWDEFAULT;
1006 break;
1007 case DDFLAGS_SHOWICONS:
1008 iwp->iwp_ShowAll = DDFLAGS_SHOWICONS;
1009 break;
1010 case DDFLAGS_SHOWALL:
1011 default:
1012 iwp->iwp_ShowAll = DDFLAGS_SHOWALL;
1013 break;
1016 switch (ddFlags & DDFLAGS_SORTMASK)
1018 case DDFLAGS_SORTDEFAULT:
1019 default:
1020 iwp->iwp_SortOrder = SortOrder_Default;
1021 break;
1022 case DDFLAGS_SORTASC:
1023 iwp->iwp_SortOrder = SortOrder_Ascending;
1024 break;
1025 case DDFLAGS_SORTDESC:
1026 iwp->iwp_SortOrder = SortOrder_Descending;
1027 break;
1030 tt = NULL;
1031 if (DoMethod(IconObj, IDTM_FindToolType, "SCALOS_PATTERNNO", &tt))
1033 DoMethod(IconObj, IDTM_GetToolTypeValue, tt, (ULONG *) &lDummy);
1034 iwp->iwp_PatternNumber = (UWORD) lDummy;
1035 d1(KPrintF("%s/%s/%ld: iwp->iwp_PatternNumber=%lu\n", __FILE__, __FUNC__, __LINE__, iwp->iwp_PatternNumber));
1037 else
1039 // determine default pattern number
1040 if (IsViewByIcon(iwp->iwp_Viewmodes ))
1041 iwp->iwp_PatternNumber = PATTERNNR_IconWindowDefault; // default icon window pattern no.
1042 else
1043 iwp->iwp_PatternNumber = PATTERNNR_TextWindowDefault; // default text window pattern no.
1047 tt = NULL;
1048 if (DoMethod(IconObj, IDTM_FindToolType, "SCALOS_CHECKOVERLAP", &tt))
1050 DoMethod(IconObj, IDTM_GetToolTypeValue, tt, (ULONG *) &lDummy);
1051 iwp->iwp_CheckOverlap = lDummy;
1052 d1(KPrintF("%s/%s/%ld: iwp_CheckOverlap=%ld\n", __FILE__, __FUNC__, __LINE__, iwp->iwp_CheckOverlap));
1055 tt = NULL;
1056 if (DoMethod(IconObj, IDTM_FindToolType, "SCALOS_THUMBNAILS", &tt))
1058 d1(KPrintF("%s/%s/%ld: tt=<%s>\n", __FILE__, __FUNC__, __LINE__, tt));
1059 while (*tt && '=' != *tt)
1060 tt++;
1062 if ('=' == *tt)
1064 ++tt; // Skip "="
1065 if (0 == Stricmp(tt, "NEVER"))
1066 iwp->iwp_ThumbnailView = THUMBNAILS_Never;
1067 else if (0 == Stricmp(tt, "ALWAYS"))
1068 iwp->iwp_ThumbnailView = THUMBNAILS_Always;
1069 else if (0 == Stricmp(tt, "ASDEFAULT"))
1070 iwp->iwp_ThumbnailView = THUMBNAILS_AsDefault;
1072 d1(KPrintF("%s/%s/%ld: iwp->iwp_ThumbnailView=%lu\n", __FILE__, __FUNC__, __LINE__, iwp->iwp_ThumbnailView));
1075 tt = NULL;
1076 if (DoMethod(IconObj, IDTM_FindToolType, "SCALOS_THUMBNAIL_LIFETIME", &tt))
1078 DoMethod(IconObj, IDTM_GetToolTypeValue, tt, (ULONG *) &lDummy);
1079 iwp->iwp_ThumbnailsLifetimeDays = lDummy;
1082 iwp->iwp_NoStatusBar = FALSE;
1083 tt = NULL;
1084 if (DoMethod(IconObj, IDTM_FindToolType, "SCALOS_NOSTATUSBAR", &tt))
1086 iwp->iwp_NoStatusBar = TRUE;
1089 iwp->iwp_NoControlBar = FALSE;
1090 tt = NULL;
1091 if (DoMethod(IconObj, IDTM_FindToolType, "SCALOS_NOCONTROLBAR", &tt))
1093 iwp->iwp_NoControlBar = TRUE;
1096 iwp->iwp_BrowserMode = FALSE;
1097 tt = NULL;
1098 if (DoMethod(IconObj, IDTM_FindToolType, "SCALOS_BROWSERMODE", &tt))
1100 iwp->iwp_BrowserMode = TRUE;
1103 GetAttr(IDTA_WinCurrentX, IconObj, (ULONG *) &lDummy);
1104 iwp->iwp_XOffset = (WORD) lDummy;
1106 GetAttr(IDTA_WinCurrentY, IconObj, (ULONG *) &lDummy);
1107 iwp->iwp_YOffset = (WORD) lDummy;
1109 tt = NULL;
1110 if (DoMethod(IconObj, IDTM_FindToolType, "SCALOS_ACTIVETRANSPARENCY", &tt))
1112 DoMethod(IconObj, IDTM_GetToolTypeValue, tt, (ULONG *) &lDummy);
1113 iwp->iwp_OpacityActive = (UWORD) lDummy;
1114 d1(KPrintF("%s/%s/%ld: iwp->iwp_OpacityActive=%lu\n", __FILE__, __FUNC__, __LINE__, iwp->iwp_OpacityActive));
1117 tt = NULL;
1118 if (DoMethod(IconObj, IDTM_FindToolType, "SCALOS_INACTIVETRANSPARENCY", &tt))
1120 DoMethod(IconObj, IDTM_GetToolTypeValue, tt, (ULONG *) &lDummy);
1121 iwp->iwp_OpacityInactive = (UWORD) lDummy;
1122 d1(KPrintF("%s/%s/%ld: iwp->iwp_OpacityInactive=%lu\n", __FILE__, __FUNC__, __LINE__, iwp->iwp_OpacityInactive));
1125 tt = NULL;
1126 if (DoMethod(IconObj, IDTM_FindToolType, "SCALOS_ICONSCALEFACTOR", &tt))
1128 DoMethod(IconObj, IDTM_GetToolTypeValue, tt, (ULONG *) &lDummy);
1129 iwp->iwp_IconScaleFactor = lDummy;
1131 if (iwp->iwp_IconScaleFactor < IDTA_ScalePercentage_MIN)
1132 iwp->iwp_IconScaleFactor = IDTA_ScalePercentage_MIN;
1133 else if (iwp->iwp_IconScaleFactor > IDTA_ScalePercentage_MAX)
1134 iwp->iwp_IconScaleFactor = IDTA_ScalePercentage_MAX;
1136 d1(KPrintF("%s/%s/%ld: iwp_IconScaleFactor=%lu\n", __FILE__, __FUNC__, __LINE__, iwp->iwp_IconScaleFactor));
1139 tt = NULL;
1140 if (DoMethod(IconObj, IDTM_FindToolType, "SCALOS_ICONSIZECONSTRAINTS", &tt))
1142 LONG IconSizeMin, IconSizeMax;
1143 long long1, long2;
1145 d1(KPrintF("%s/%s/%ld: tt=<%s>\n", __FILE__, __FUNC__, __LINE__, tt));
1146 while (*tt && '=' != *tt)
1147 tt++;
1149 if (2 == sscanf(tt, "=%ld,%ld", &long1, &long2))
1151 IconSizeMin = long1;
1152 IconSizeMax = long2;
1153 if ((IconSizeMax > 128) || (IconSizeMax < 0))
1154 IconSizeMax = SHRT_MAX;
1155 if ((IconSizeMin < 0) || (IconSizeMin >= IconSizeMax))
1156 IconSizeMin = 0;
1158 iwp->iwp_IconSizeConstraints.MinX = iwp->iwp_IconSizeConstraints.MinY = IconSizeMin;
1159 iwp->iwp_IconSizeConstraints.MaxX = iwp->iwp_IconSizeConstraints.MaxY = IconSizeMax;
1161 d1(KPrintF("%s/%s/%ld: IconSizeMin=%ld IconSizeMax=%ld\n", __FILE__, __FUNC__, __LINE__, IconSizeMin, IconSizeMax));
1165 // ----------------------------------------------------------