corrections
[AROS.git] / workbench / prefs / wanderer / wpeditor.c
blob11d57a22484ce83314003adb0ecb23a00128f54a
1 /*
2 Copyright 2004-2011, The AROS Development Team. All rights reserved.
3 This file is part of the Wanderer Preferences program, which is distributed
4 under the terms of version 2 of the GNU General Public License.
6 $Id$
7 */
9 #define MUIMASTER_YES_INLINE_STDARG
11 #define DEBUG 0
13 #define WP_MAX_BG_TAG_COUNT 20
14 #define WP_IFF_CHUNK_BUFFER_SIZE 1024
15 #define WP_MAX_RENDER_MODES 4
16 #define WP_MAX_TILE_MODES 4
17 #define WP_DRAWMODE_COUNT 2
19 #define DEBUG_TOOLBARINTERNAL
20 #define DEBUG_SHOWUSERFILES
21 //#define DEBUG_FORCEWINSIZE
22 //#define DEBUG_NEWVIEWSETTINGS
23 //#define DEBUG_NETWORKBROWSER
24 //#define DEBUG_PERVIEWFONTS
25 #define DEBUG_MULTLINE
26 #define DEBUG_CHANGESCREENTITLE
28 #include <exec/types.h>
29 #include <utility/tagitem.h>
30 #include <libraries/mui.h>
31 #include <zune/customclasses.h>
32 #include <zune/prefseditor.h>
34 #include <proto/exec.h>
35 #include <proto/intuition.h>
36 #include <proto/utility.h>
37 #include <proto/muimaster.h>
38 #include <proto/dos.h>
39 #include <proto/iffparse.h>
41 #include <prefs/prefhdr.h>
42 #include <prefs/wanderer.h>
44 #include <clib/alib_protos.h>
45 #include <stdio.h>
46 #include <string.h>
48 #include "locale.h"
49 #include "wpeditor.h"
50 #include "entryelements.h"
52 /* "TODO: Include the wandererprefs definitions in a better way .." */
53 #include "../../system/Wanderer/wandererprefs.h"
54 #include "../../system/Wanderer/Classes/iconlist_attributes.h"
55 #include "../../system/Wanderer/iconwindow_attributes.h"
57 #define WPD_ADVANCED_ICONS 0
58 #define WPD_ADVANCED_LABELS 1
59 #define WPD_ADVANCED_BACKGROUND 2
61 #define WPD_ICONSORTMODE_BYNAME 0
62 #define WPD_ICONSORTMODE_BYDATE 1
63 #define WPD_ICONSORTMODE_BYSIZE 2
65 #define WPD_ICONVIEWMODE_ALL 0
66 #define WPD_ICONVIEWMODE_ICONS 1
68 struct TagItem32 {
69 ULONG ti_Tag;
70 ULONG ti_Data;
73 /*** Private Methods ********************************************************/
75 /*** Instance Data **********************************************************/
76 struct WPEditor_ViewSettingsObject
78 struct Node wpedbo_Node;
79 char *wpedbo_ViewName;
80 Object *wpedbo_ImageSpecObject;
81 Object *wpedbo_AdvancedOptionsObject;
82 IPTR wpedbo_Type;
84 /* "TODO: Replace _wpeditor_intern_IconTextRenderModeNames and co. with per view list" */
85 IPTR *wpedbo_LabelRenderModeNames;
86 IPTR *wpedbo_LabelRenderModeEntries;
87 IPTR wpedbo_LabelRenderModeCount;
89 /* "TODO: Replace _wpeditor_intern_IconListModeNames and co. with per view list" */
90 IPTR *wpedbo_ListModeNames;
91 IPTR *wpedbo_ListModeEntries;
92 IPTR wpedbo_ListModeCount;
94 IPTR *wpedbo_BFRenderModeNames;
95 IPTR *wpedbo_BFRenderModeEntries;
96 IPTR *wpedbo_BFRenderModePages;
97 IPTR wpedbo_BFRenderModeCount;
99 IPTR *wpedbo_BFTileModeNames;
100 IPTR *wpedbo_BFTileModeEntries;
101 IPTR wpedbo_BFTileModeCount;
103 struct TagItem32 *wpedbo_Options;
104 struct Hook wpedbo_Hook_CheckImage;
105 struct Hook wpedbo_Hook_OpenAdvancedOptions;
106 IPTR wpedbo_state_AdvancedDisabled;
109 struct WPEditor_AdvancedBackgroundWindow_DATA
111 Object *wpedabwd_Window_WindowObj,
112 *wpedabwd_Window_UseObj,
113 *wpedabwd_Window_CancelObj,
114 *wpedabwd_Window_BackgroundGrpObj,
115 *wpedabwd_Window_RenderModeGrpObj,
116 *wpedabwd_Window_RenderModeObj,
117 *wpedabwd_Window_RenderModePageObj,
118 *wpedabwd_Window_TileModeObjContainer,
119 *wpedabwd_Window_TileModeObj,
120 *wpedabwd_Window_XOffsetObj,
121 *wpedabwd_Window_YOffsetObj,
122 *wpedabwd_Window_IconLabel_LabelFont,
123 *wpedabwd_Window_IconLabel_InfoFont,
124 *wpedabwd_Window_Icon_ListMode,
125 *wpedabwd_Window_Icon_TextMode,
126 *wpedabwd_Window_IconLabel_MaxLineLen,
127 *wpedabwd_Window_Icon_SortMode,
128 *wpedabwd_Window_Icon_SortModeLabel,
129 *wpedabwd_Window_Icon_AutoSort,
130 *wpedabwd_Window_Icon_DragTransparent,
131 *wpedabwd_Window_Icon_ViewMode,
132 *wpedabwd_Window_Icon_ViewModeLabel,
133 #if defined(DEBUG_MULTLINE)
134 *wpedabwd_Window_IconLabel_TextMultiLine,
135 *wpedabwd_Window_IconLabel_MultiLineonFocus,
136 *wpedabwd_Window_IconLabel_MultiLineNo,
137 #endif
138 *wpedabwd_Window_Icon_HorSpacing,
139 *wpedabwd_Window_Icon_VertSpacing,
140 *wpedabwd_Window_Icon_ImageSpacing,
141 *wpedabwd_Window_IconLabel_HorPadd,
142 *wpedabwd_Window_IconLabel_VertPadd,
143 *wpedabwd_Window_IconLabel_BorderWidth,
144 *wpedabwd_Window_IconLabel_BorderHeight;
146 struct List wpedabwd_Window_AdvancedViewRenderModes;
147 struct List wpedabwd_Window_AdvancedViewTileModes;
148 struct List wpedabwd_Window_AdvancedViewIconListModes;
149 struct List wpedabwd_Window_AdvancedViewIconTextRenderModes;
151 struct Hook wpedabwd_Hook_DrawModeChage;
154 struct WPEditor_DATA
156 struct WPEditor_AdvancedBackgroundWindow_DATA *wped_AdvancedViewSettings_WindowData;
158 struct WPEditor_ViewSettingsObject *wped_ViewSettings_Current;
160 Object *wped_FirstBGImSpecObj,
161 *wped_FirstBGAdvancedObj;
163 ULONG wped_DimensionsSet;
165 Object *wped_ViewSettings_GroupObj,
166 *wped_ViewSettings_SpacerObj,
167 *wped_c_NavigationMethod,
168 *wped_cm_ToolbarEnabled,
169 #if defined(DEBUG_CHANGESCREENTITLE)
170 *wped_s_screentitle,
171 #endif
172 *wped_toolbarpreview,
173 #if defined(DEBUG_NETWORKBROWSER)
174 *wped_cm_EnableNetworkBrowser,
175 #endif
176 #if defined(DEBUG_SHOWUSERFILES)
177 *wped_cm_EnableUserFiles,
178 #endif
179 *wped_toolbarGroup;
180 struct Hook wped_Hook_CloseAdvancedOptions;
183 //static struct Hook navichangehook;
184 static STRPTR _wpeditor_intern_NavigationModes[3];
186 static STRPTR _wpeditor_intern_IconListModeNames[iconlist_ListViewModesCount + 1];
187 static ULONG _wpeditor_intern_IconListModeIDs[iconlist_ListViewModesCount + 1];
189 static STRPTR _wpeditor_intern_IconTextRenderModeNames[iconlist_LabelRenderModesCount + 1];
190 static ULONG _wpeditor_intern_IconTextRenderModeIDs[iconlist_LabelRenderModesCount + 1];
192 static STRPTR _wpeditor_intern_IconSortModeNames[4];
193 static STRPTR _wpeditor_intern_IconViewModeNames[3];
195 static STRPTR _wpeditor_intern_MainPageNames[4];
196 static STRPTR _wpeditor_intern_AdvancedPageNames[4];
198 static Class *_wpeditor_intern_CLASS = NULL;
199 static struct List _wpeditor_intern_ViewSettings;
201 static CONST_STRPTR toolbar_PrefsFile = "SYS/Wanderer/toolbar.prefs";
202 #define TOOLBAR_PREFSSIZE 1024
204 /*** Macros *****************************************************************/
205 #define SETUP_WPEDITOR_INST_DATA struct WPEditor_DATA *data = INST_DATA(CLASS, self)
207 /*** Misc Helper functions **************************************************/
208 /* 32bit replacements for utility.library tag funcs */
209 struct TagItem32 * NextTag32Item(const struct TagItem32 ** tagListPtr)
211 if(!(*tagListPtr)) return NULL;
213 while (TRUE)
215 switch ((*tagListPtr)->ti_Tag)
217 case TAG_IGNORE:
218 break;
220 case TAG_END:
221 (*tagListPtr) = NULL;
222 return NULL;
224 case TAG_SKIP:
225 (*tagListPtr) += (*tagListPtr)->ti_Data + 1;
226 continue;
228 default:
229 /* Use post-increment (return will return the current value and
230 then tagListPtr will be incremented) */
231 return (struct TagItem32 *)(*tagListPtr)++;
234 (*tagListPtr) ++;
238 struct TagItem32 * FindTag32Item(ULONG tagValue, const struct TagItem32 *tagList)
240 struct TagItem32 *tag;
241 const struct TagItem32 *tagptr = tagList;
243 while((tag = NextTag32Item(&tagptr)))
245 if(tag->ti_Tag == tagValue) return tag;
248 return NULL;
252 IPTR GetTag32Data(ULONG tagValue, ULONG defaultVal, const struct TagItem32 *tagList)
254 struct TagItem32 *ti = NULL;
256 if ((tagList != NULL) && (ti = FindTag32Item(tagValue, tagList)))
257 return ti->ti_Data;
259 return defaultVal;
262 IPTR GetRenderModePage(char *rendermode_name, STRPTR __RenderModeNames[], IPTR __DrawModePages[])
264 int i = 0;
266 for (i = 0; i < WP_MAX_RENDER_MODES; i++)
268 if (strcmp(__RenderModeNames[i], rendermode_name) == 0)
270 return __DrawModePages[i];
273 return -1;
276 IPTR SetViewSettingTag32(struct TagItem32 *this_Taglist, ULONG Tag_ID, ULONG newTag_Value)
278 int i = 0;
281 if (this_Taglist[i].ti_Tag == TAG_DONE)
282 break;
283 else if (this_Taglist[i].ti_Tag == Tag_ID)
285 if (this_Taglist[i].ti_Data == newTag_Value) return TRUE;
286 this_Taglist[i].ti_Data = newTag_Value;
287 return TRUE;
289 i ++;
290 }while(i < WP_MAX_BG_TAG_COUNT);
292 return FALSE;
295 /*** Hook functions *********************************************************/
297 AROS_UFH3(
298 void, WandererPrefs_Hook_OpenAdvancedOptionsFunc,
299 AROS_UFHA(struct Hook *, hook, A0),
300 AROS_UFHA(APTR *, obj, A2),
301 AROS_UFHA(APTR, param, A1)
304 AROS_USERFUNC_INIT
306 Object *self= (Object *)obj;
307 struct WPEditor_ViewSettingsObject *_viewSettings_Current = *(struct WPEditor_ViewSettingsObject **)param;
308 Class *CLASS = _wpeditor_intern_CLASS;
309 UBYTE *ImageSelector_Spec = NULL;
310 char *Image_Spec = NULL;
312 struct WPEditor_DATA *data = INST_DATA(CLASS, self);
314 data->wped_ViewSettings_Current = _viewSettings_Current;
316 GET(_viewSettings_Current->wpedbo_ImageSpecObject, MUIA_Imagedisplay_Spec, &ImageSelector_Spec);
318 Image_Spec = AllocVec(strlen(ImageSelector_Spec) + 1, MEMF_ANY|MEMF_CLEAR);
319 if (Image_Spec)
321 strcpy(Image_Spec, ImageSelector_Spec);
322 /* This "reloads" the dynamic controls by calling WandererPrefs_Hook_CheckImageFunc */
323 SET(_viewSettings_Current->wpedbo_ImageSpecObject, MUIA_Imagedisplay_Spec, Image_Spec);
325 struct WPEditor_ViewSettingsObject *_viewSettings_Node = NULL;
327 ForeachNode(&_wpeditor_intern_ViewSettings, _viewSettings_Node)
329 GET(_viewSettings_Node->wpedbo_AdvancedOptionsObject,
330 MUIA_Disabled,
331 &_viewSettings_Node->wpedbo_state_AdvancedDisabled);
333 SET(_viewSettings_Node->wpedbo_ImageSpecObject, MUIA_Disabled, TRUE);//1_Disable
334 SET(_viewSettings_Node->wpedbo_AdvancedOptionsObject, MUIA_Disabled, TRUE);//2_Disable
335 if (_viewSettings_Node == _viewSettings_Current)
337 ULONG current_SortFlags = GetTag32Data(MUIA_IconList_SortFlags,
338 (MUIV_IconList_Sort_AutoSort | MUIV_IconList_Sort_ByName), _viewSettings_Node->wpedbo_Options);
339 ULONG current_ViewFlags = GetTag32Data(MUIA_IconList_DisplayFlags,
340 ICONLIST_DISP_SHOWINFO, _viewSettings_Node->wpedbo_Options);
343 D(bug("[WPEditor] WandererPrefs_Hook_OpenAdvancedOptionsFunc: Found ViewSettings chunk for node we are editing\n"));
344 if (XGET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_BackgroundGrpObj, MUIA_ShowMe) == TRUE)
346 ULONG current_RenderMode = GetTag32Data(MUIA_IconWindowExt_ImageBackFill_BGRenderMode, IconWindowExt_ImageBackFill_RenderMode_Tiled, _viewSettings_Node->wpedbo_Options);
347 int i;
349 for (i = 0; i < data->wped_ViewSettings_Current->wpedbo_BFRenderModeCount; i++)
351 if ((ULONG)GetEntryElementID(data->wped_ViewSettings_Current->wpedbo_BFRenderModeEntries[i]) == current_RenderMode)
355 (Object *)data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModeObj,
356 MUIA_Cycle_Active, i
360 (Object *)data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModePageObj,
361 MUIA_Group_ActivePage, data->wped_ViewSettings_Current->wpedbo_BFRenderModePages[i]
366 //D(bug("[WPEditor] WandererPrefs_Hook_CloseAdvancedOptionsFunc: Render Mode '%s'\n", data->wped_ViewSettings_Current->wpedbo_BFRenderModeNames[current_rendermodepage]));
368 if (current_RenderMode == IconWindowExt_ImageBackFill_RenderMode_Tiled)
371 ULONG current_TileMode = GetTag32Data(MUIA_IconWindowExt_ImageBackFill_BGTileMode, IconWindowExt_ImageBackFill_TileMode_Float, _viewSettings_Node->wpedbo_Options);
373 for (i = 0; i < data->wped_ViewSettings_Current->wpedbo_BFTileModeCount; i++)
375 if ((ULONG)GetEntryElementID(data->wped_ViewSettings_Current->wpedbo_BFTileModeEntries[i]) == current_TileMode)
379 data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_TileModeObj,
380 MUIA_Cycle_Active, i
387 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_XOffsetObj, MUIA_String_Integer, GetTag32Data(MUIA_IconWindowExt_ImageBackFill_BGXOffset, 0, _viewSettings_Current->wpedbo_Options));
388 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_YOffsetObj, MUIA_String_Integer, GetTag32Data(MUIA_IconWindowExt_ImageBackFill_BGYOffset, 0, _viewSettings_Current->wpedbo_Options));
390 #if defined(DEBUG_PERVIEWFONTS)
391 // SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_LabelFont,
392 // SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_InfoFont,
393 #endif
394 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_ListMode, MUIA_Cycle_Active, GetTag32Data(MUIA_IconList_IconListMode, ICON_LISTMODE_GRID, _viewSettings_Current->wpedbo_Options));
395 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_TextMode, MUIA_Cycle_Active, GetTag32Data(MUIA_IconList_LabelText_Mode, ICON_TEXTMODE_OUTLINE, _viewSettings_Current->wpedbo_Options));
396 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MaxLineLen, MUIA_String_Integer, GetTag32Data(MUIA_IconList_LabelText_MaxLineLen, ILC_ICONLABEL_MAXLINELEN_DEFAULT, _viewSettings_Current->wpedbo_Options));
397 #if defined(DEBUG_MULTLINE)
398 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MultiLineonFocus, MUIA_Selected, GetTag32Data(MUIA_IconList_LabelText_MultiLineOnFocus, FALSE, _viewSettings_Current->wpedbo_Options));
399 LONG MultiLineNo = GetTag32Data(MUIA_IconList_LabelText_MultiLine, 1, _viewSettings_Current->wpedbo_Options);
400 if (MultiLineNo < 1) MultiLineNo = 1;
401 if (MultiLineNo > 1)
403 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_TextMultiLine, MUIA_Selected, TRUE);
404 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MultiLineNo, MUIA_Disabled, FALSE);
406 else
408 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_TextMultiLine, MUIA_Selected, FALSE);
409 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MultiLineNo, MUIA_Disabled, TRUE);
411 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MultiLineNo, MUIA_String_Integer, MultiLineNo);
412 #endif
413 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_HorSpacing, MUIA_String_Integer, GetTag32Data(MUIA_IconList_Icon_HorizontalSpacing, ILC_ICON_HORIZONTALMARGIN_DEFAULT, _viewSettings_Current->wpedbo_Options));
414 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_VertSpacing, MUIA_String_Integer, GetTag32Data(MUIA_IconList_Icon_VerticalSpacing, ILC_ICON_VERTICALMARGIN_DEFAULT, _viewSettings_Current->wpedbo_Options));
415 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_ImageSpacing, MUIA_String_Integer, GetTag32Data(MUIA_IconList_Icon_ImageSpacing, ILC_ICONLABEL_IMAGEMARGIN_DEFAULT, _viewSettings_Current->wpedbo_Options));
416 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_HorPadd, MUIA_String_Integer, GetTag32Data(MUIA_IconList_LabelText_HorizontalPadding, ILC_ICONLABEL_HORIZONTALTEXTMARGIN_DEFAULT, _viewSettings_Current->wpedbo_Options));
417 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_VertPadd, MUIA_String_Integer, GetTag32Data(MUIA_IconList_LabelText_VerticalPadding, ILC_ICONLABEL_VERTICALTEXTMARGIN_DEFAULT, _viewSettings_Current->wpedbo_Options));
418 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_BorderWidth, MUIA_String_Integer, GetTag32Data(MUIA_IconList_LabelText_BorderWidth, ILC_ICONLABEL_BORDERWIDTH_DEFAULT, _viewSettings_Current->wpedbo_Options));
419 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_BorderHeight, MUIA_String_Integer, GetTag32Data(MUIA_IconList_LabelText_BorderHeight, ILC_ICONLABEL_BORDERHEIGHT_DEFAULT, _viewSettings_Current->wpedbo_Options));
421 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_AutoSort, MUIA_Selected, !!(current_SortFlags & MUIV_IconList_Sort_AutoSort));
422 if (current_SortFlags & MUIV_IconList_Sort_ByName)
423 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_SortMode, MUIA_Cycle_Active, 0);
424 if (current_SortFlags & MUIV_IconList_Sort_ByDate)
425 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_SortMode, MUIA_Cycle_Active, 1);
426 if (current_SortFlags & MUIV_IconList_Sort_BySize)
427 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_SortMode, MUIA_Cycle_Active, 2);
429 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_DragTransparent, MUIA_Selected, GetTag32Data(MUIA_IconList_DragImageTransparent, FALSE, _viewSettings_Current->wpedbo_Options));
431 if (current_ViewFlags & ICONLIST_DISP_SHOWINFO)
432 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_ViewMode, MUIA_Cycle_Active, WPD_ICONVIEWMODE_ICONS);
433 else
434 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_ViewMode, MUIA_Cycle_Active, WPD_ICONVIEWMODE_ALL);
438 /*Enable this and remove *_Disable instructions over
439 when discovered the zune refresh problem...*/
440 //SET(data->wped_ViewSettings_GroupObj, MUIA_Disabled, TRUE);
442 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_WindowObj, MUIA_Window_Open, TRUE);
443 FreeVec(Image_Spec);
446 AROS_USERFUNC_EXIT
449 #define SETCURRENTVIEWSETTINGSTAG(tag, obj, objtag) \
450 success = SetViewSettingTag32(data->wped_ViewSettings_Current->wpedbo_Options, tag, XGET(obj, objtag)); \
451 if (success == FALSE) \
453 /* TODO: Allocate extra storage for our tags.. */ \
455 else if (success == TRUE) \
457 settings_changed = TRUE; \
460 AROS_UFH3(
461 void, WandererPrefs_Hook_CloseAdvancedOptionsFunc,
462 AROS_UFHA(struct Hook *, hook, A0),
463 AROS_UFHA(APTR *, obj, A2),
464 AROS_UFHA(APTR, param, A1)
467 AROS_USERFUNC_INIT
469 Object *self = ( Object *)obj;
470 BOOL use_settings = (BOOL) *( IPTR *)param;
471 struct WPEditor_ViewSettingsObject *_viewSettings_Node = NULL;
472 Class *CLASS = _wpeditor_intern_CLASS;
473 BOOL settings_changed = FALSE;
474 BOOL success = FALSE;
476 SETUP_WPEDITOR_INST_DATA;
478 D(bug("[WPEditor] WandererPrefs_Hook_CloseAdvancedOptionsFunc()\n"));
480 /*Enable this and remove *_Enable instructions under
481 when discovered the zune refresh problem...*/
482 //SET(data->wped_ViewSettings_GroupObj, MUIA_Disabled, FALSE);
484 ForeachNode(&_wpeditor_intern_ViewSettings, _viewSettings_Node)
486 SET(_viewSettings_Node->wpedbo_ImageSpecObject, MUIA_Disabled, FALSE);
487 SET(_viewSettings_Node->wpedbo_AdvancedOptionsObject, MUIA_Disabled, _viewSettings_Node->wpedbo_state_AdvancedDisabled);
490 if ((use_settings) && (data->wped_ViewSettings_Current))
492 D(bug("[WPEditor] WandererPrefs_Hook_CloseAdvancedOptionsFunc: Updating tags for Background ..\n"));
493 IPTR current_rendermodepage = 0;
494 ULONG current_rendermode;
496 GET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModeObj, MUIA_Cycle_Active, &current_rendermodepage);
497 IPTR current_rendermode_entry = data->wped_ViewSettings_Current->wpedbo_BFRenderModeEntries[current_rendermodepage];
499 D(bug("[WPEditor] WandererPrefs_Hook_CloseAdvancedOptionsFunc: Render Mode '%s'\n", data->wped_ViewSettings_Current->wpedbo_BFRenderModeNames[current_rendermodepage]));
500 current_rendermode = (ULONG)GetEntryElementID(current_rendermode_entry);
501 if (current_rendermode == -1)
503 D(bug("[WPEditor] WandererPrefs_Hook_CloseAdvancedOptionsFunc: ERROR: Unknown Render mode string!?!?!\n"));
505 else
507 success = SetViewSettingTag32(data->wped_ViewSettings_Current->wpedbo_Options, MUIA_IconWindowExt_ImageBackFill_BGRenderMode, current_rendermode);
508 if (success == FALSE)
510 D(bug("[WPEditor] WandererPrefs_Hook_CloseAdvancedOptionsFunc: No MUIA_IconWindowExt_ImageBackFill_BGRenderMode TAG - Adding ..\n"));
511 /* "TODO: Allocate extra storage for our tags.." */
513 else if (success == TRUE)
515 settings_changed = TRUE;
518 switch (current_rendermode)
520 case IconWindowExt_ImageBackFill_RenderMode_Scale:
521 break;
523 case IconWindowExt_ImageBackFill_RenderMode_Tiled:
524 SETCURRENTVIEWSETTINGSTAG(MUIA_IconWindowExt_ImageBackFill_BGXOffset, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_XOffsetObj, MUIA_String_Integer);
525 SETCURRENTVIEWSETTINGSTAG(MUIA_IconWindowExt_ImageBackFill_BGYOffset, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_YOffsetObj, MUIA_String_Integer);
528 IPTR current_tilemodeno = 0;
529 ULONG current_tilemode = 0;
531 GET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_TileModeObj, MUIA_Cycle_Active, &current_tilemodeno);
532 IPTR current_tilemode_entry = data->wped_ViewSettings_Current->wpedbo_BFTileModeEntries[current_tilemodeno];
534 D(bug("[WPEditor] WandererPrefs_Hook_CloseAdvancedOptionsFunc: Tile Mode '%s'\n", data->wped_ViewSettings_Current->wpedbo_BFTileModeNames[current_tilemodeno]));
535 current_tilemode = (ULONG)GetEntryElementID(current_tilemode_entry);
537 success = SetViewSettingTag32(data->wped_ViewSettings_Current->wpedbo_Options, MUIA_IconWindowExt_ImageBackFill_BGTileMode, current_tilemode);
538 if (success == FALSE)
540 D(bug("[WPEditor] WandererPrefs_Hook_CloseAdvancedOptionsFunc: No MUIA_IconWindowExt_ImageBackFill_BGTileMode TAG - Adding ..\n"));
541 /* "TODO: Allocate extra storage for our tags.." */
543 else if (success == TRUE)
545 settings_changed = TRUE;
547 break;
551 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_IconListMode, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_ListMode, MUIA_Cycle_Active);
552 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_LabelText_Mode, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_TextMode, MUIA_Cycle_Active);
553 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_LabelText_MaxLineLen, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MaxLineLen, MUIA_String_Integer);
556 #if defined(DEBUG_MULTLINE)
557 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_LabelText_MultiLineOnFocus, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MultiLineonFocus, MUIA_Selected);
558 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_LabelText_MultiLine, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MultiLineNo, MUIA_String_Integer);
559 #endif
561 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_Icon_HorizontalSpacing, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_HorSpacing, MUIA_String_Integer);
562 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_Icon_VerticalSpacing, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_VertSpacing, MUIA_String_Integer);
563 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_Icon_ImageSpacing, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_ImageSpacing, MUIA_String_Integer);
564 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_LabelText_HorizontalPadding, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_HorPadd, MUIA_String_Integer);
565 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_LabelText_VerticalPadding, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_VertPadd, MUIA_String_Integer);
566 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_LabelText_BorderWidth, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_BorderWidth, MUIA_String_Integer);
567 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_LabelText_BorderHeight, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_BorderHeight, MUIA_String_Integer);
570 ULONG new_SortFlags = 0;
572 if (XGET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_AutoSort, MUIA_Selected) == TRUE)
573 new_SortFlags |= MUIV_IconList_Sort_AutoSort;
575 switch(XGET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_SortMode, MUIA_Cycle_Active))
577 case 0: new_SortFlags |= MUIV_IconList_Sort_ByName; break;
578 case 1: new_SortFlags |= MUIV_IconList_Sort_ByDate; break;
579 case 2: new_SortFlags |= MUIV_IconList_Sort_BySize; break;
582 success = SetViewSettingTag32(data->wped_ViewSettings_Current->wpedbo_Options, MUIA_IconList_SortFlags, new_SortFlags);
583 if (success == FALSE)
585 D(bug("[WPEditor] WandererPrefs_Hook_CloseAdvancedOptionsFunc: No MUIA_IconList_SortFlags TAG - Adding ..\n"));
586 /* TODO: Allocate extra storage for our tags.. */
588 else if (success == TRUE)
590 settings_changed = TRUE;
594 SETCURRENTVIEWSETTINGSTAG(MUIA_IconList_DragImageTransparent, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_DragTransparent, MUIA_Selected);
596 if (XGET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_ViewMode, MUIA_Cycle_Active) == WPD_ICONVIEWMODE_ICONS)
597 success = SetViewSettingTag32(data->wped_ViewSettings_Current->wpedbo_Options, MUIA_IconList_DisplayFlags, ICONLIST_DISP_SHOWINFO);
598 else
599 success = SetViewSettingTag32(data->wped_ViewSettings_Current->wpedbo_Options, MUIA_IconList_DisplayFlags, 0);
600 if (success == FALSE)
602 D(bug("[WPEditor] WandererPrefs_Hook_CloseAdvancedOptionsFunc: No MUIA_IconList_DisplayFlags TAG - Adding ..\n"));
603 /* TODO: Allocate extra storage for our tags.. */
605 else if (success == TRUE)
607 settings_changed = TRUE;
610 if (settings_changed) SET(self, MUIA_PrefsEditor_Changed, TRUE);
612 else
614 D(bug("[WPEditor] WandererPrefs_Hook_CloseAdvancedOptionsFunc: Cancel selected\n"));
617 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_WindowObj, MUIA_Window_Open, FALSE);
619 AROS_USERFUNC_EXIT
623 AROS_UFH3(
624 void, WandererPrefs_Hook_DrawModeChangeFunc,
625 AROS_UFHA(struct Hook *, hook, A0),
626 AROS_UFHA(APTR *, obj, A2),
627 AROS_UFHA(APTR, param, A1)
630 AROS_USERFUNC_INIT
632 Object *self = ( Object *)obj;
633 Class *CLASS = *( Class **)param;
635 SETUP_WPEDITOR_INST_DATA;
637 D(bug("[WPEditor] WandererPrefs_Hook_DrawModeChangeFunc()\n"));
639 if (data->wped_ViewSettings_Current)
641 IPTR active_cycleentry = 0;
642 GET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModeObj, MUIA_Cycle_Active, &active_cycleentry);
644 D(bug("[WPEditor] WandererPrefs_Hook_DrawModeChangeFunc: RenderMode Cycle Active = %d, Page = %d\n", active_cycleentry, data->wped_ViewSettings_Current->wpedbo_BFRenderModePages[active_cycleentry]));
646 IPTR active_page = 0;
647 GET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModePageObj, MUIA_Group_ActivePage, &active_page);
649 if (active_page != data->wped_ViewSettings_Current->wpedbo_BFRenderModePages[active_cycleentry])
653 (Object *)data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModePageObj,
654 MUIA_Group_ActivePage, data->wped_ViewSettings_Current->wpedbo_BFRenderModePages[active_cycleentry]
656 D(bug("[WPEditor] WandererPrefs_Hook_DrawModeChangeFunc: Changing Active Page to %d\n", data->wped_ViewSettings_Current->wpedbo_BFRenderModePages[active_cycleentry]));
661 AROS_USERFUNC_EXIT
664 #define SETNEVSOPTION(tag, defvalue) \
665 newVS_Options[newVS_OptionCount].ti_Tag = tag; \
666 if (_viewSettings_Current->wpedbo_Options) \
667 newVS_Options[newVS_OptionCount++].ti_Data = GetTag32Data(tag, defvalue, _viewSettings_Current->wpedbo_Options);\
668 else \
669 newVS_Options[newVS_OptionCount++].ti_Data = defvalue;
671 AROS_UFH3(
672 void, WandererPrefs_Hook_CheckImageFunc,
673 AROS_UFHA(struct Hook *, hook, A0),
674 AROS_UFHA(APTR *, obj, A2),
675 AROS_UFHA(APTR, param, A1)
678 AROS_USERFUNC_INIT
680 Object *self = (Object *) obj;
681 struct WPEditor_ViewSettingsObject *_viewSettings_Current = *( struct WPEditor_ViewSettingsObject **)param;
682 Class *CLASS = _wpeditor_intern_CLASS;
684 SETUP_WPEDITOR_INST_DATA;
686 UBYTE *ImageSelector_Spec = NULL;
688 GET(_viewSettings_Current->wpedbo_ImageSpecObject, MUIA_Imagedisplay_Spec, &ImageSelector_Spec);
690 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: Object @ 0x%p reports image spec '%s'\n", _viewSettings_Current->wpedbo_ImageSpecObject, (char *)ImageSelector_Spec));
692 IPTR this_Background_type = (IPTR)(ImageSelector_Spec[0] - 48);
694 _viewSettings_Current->wpedbo_Type = this_Background_type;
695 data->wped_ViewSettings_Current = _viewSettings_Current;
697 if (_viewSettings_Current->wpedbo_AdvancedOptionsObject)
699 struct TagItem32 newVS_Options[WP_MAX_BG_TAG_COUNT];
700 IPTR newVS_OptionCount = 0, BFTileModeCount = 0;
701 IPTR newBG_RenderModeCount = 0;
702 IPTR newBG_RenderModePages[WP_DRAWMODE_COUNT];
703 STRPTR newBG_RenderModes[WP_DRAWMODE_COUNT];
705 if ((_viewSettings_Current->wpedbo_Type == 5)||(_viewSettings_Current->wpedbo_Type == 0))
707 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: Image-type spec (%d) - Enabling Advanced Image options ..\n", _viewSettings_Current->wpedbo_Type));
708 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_BackgroundGrpObj, MUIA_ShowMe, TRUE);
710 for (newVS_OptionCount = 0; newVS_OptionCount < WP_MAX_BG_TAG_COUNT; newVS_OptionCount++)
712 newVS_Options[newVS_OptionCount].ti_Tag = TAG_DONE;
714 newVS_OptionCount = 0;
716 if (_viewSettings_Current->wpedbo_Options)
718 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: Existing options @ 0x%p\n", _viewSettings_Current->wpedbo_Options));
721 switch ((int)_viewSettings_Current->wpedbo_Type)
723 IPTR DRAWMODEENTRY = 0;
725 case 5:
727 if ((strcmp(_viewSettings_Current->wpedbo_ViewName, "Workbench")) == 0)
729 DRAWMODEENTRY = EntryElementFindNode(&data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_AdvancedViewRenderModes, IconWindowExt_ImageBackFill_RenderMode_Scale);
730 newBG_RenderModes[newBG_RenderModeCount] = (APTR)GetEntryElementName(DRAWMODEENTRY);
731 newBG_RenderModePages[newBG_RenderModeCount++] = 0;
733 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: DrawMode %d = '%s'\n", newBG_RenderModeCount -1, newBG_RenderModes[newBG_RenderModeCount-1]));
736 case 0:
738 DRAWMODEENTRY = EntryElementFindNode(&data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_AdvancedViewRenderModes, IconWindowExt_ImageBackFill_RenderMode_Tiled);
739 newBG_RenderModes[newBG_RenderModeCount] = (APTR)GetEntryElementName((IPTR)DRAWMODEENTRY);
740 newBG_RenderModePages[newBG_RenderModeCount++] = 1;
742 IPTR old_bg_tilemodes = (IPTR)data->wped_ViewSettings_Current->wpedbo_BFTileModeNames;
743 IPTR old_bg_tilemodeentries = (IPTR)data->wped_ViewSettings_Current->wpedbo_BFTileModeEntries;
745 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: Old TileModes @ 0x%p, Entries @ 0x%p\n", old_bg_tilemodes, old_bg_tilemodeentries));
747 data->wped_ViewSettings_Current->wpedbo_BFTileModeNames = NULL;
748 data->wped_ViewSettings_Current->wpedbo_BFTileModeEntries = NULL;
750 data->wped_ViewSettings_Current->wpedbo_BFTileModeCount = EntryElementCount(&data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_AdvancedViewTileModes);
752 data->wped_ViewSettings_Current->wpedbo_BFTileModeNames = AllocVec((sizeof(STRPTR) * (data->wped_ViewSettings_Current->wpedbo_BFTileModeCount + 1)), MEMF_ANY|MEMF_CLEAR);
753 data->wped_ViewSettings_Current->wpedbo_BFTileModeEntries = AllocVec((sizeof(IPTR) * data->wped_ViewSettings_Current->wpedbo_BFTileModeCount), MEMF_ANY|MEMF_CLEAR);
755 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: Allocated %d TileModes - Array @ 0x%p, Entries @ 0x%p\n", data->wped_ViewSettings_Current->wpedbo_BFTileModeCount, data->wped_ViewSettings_Current->wpedbo_BFTileModeNames, data->wped_ViewSettings_Current->wpedbo_BFTileModeEntries));
756 struct Node *tilelist_entry = NULL;
758 ForeachNode(&data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_AdvancedViewTileModes, tilelist_entry)
760 data->wped_ViewSettings_Current->wpedbo_BFTileModeNames[BFTileModeCount] = GetEntryElementName((IPTR)tilelist_entry);
761 data->wped_ViewSettings_Current->wpedbo_BFTileModeEntries[BFTileModeCount] = (IPTR)tilelist_entry;
762 BFTileModeCount++;
765 Object *new_TileModeObj = NULL;
767 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: Creating TileModes Cycle gadget\n"));
768 new_TileModeObj = MUI_MakeObject(MUIO_Cycle,
769 NULL,
770 data->wped_ViewSettings_Current->wpedbo_BFTileModeNames
773 if (new_TileModeObj)
775 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: Object @ 0x%p\n", new_TileModeObj));
776 if (DoMethod(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_TileModeObjContainer, MUIM_Group_InitChange))
778 DoMethod(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_TileModeObjContainer, OM_REMMEMBER, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_TileModeObj);
779 DoMethod(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_TileModeObjContainer, OM_ADDMEMBER, new_TileModeObj);
780 DoMethod(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_TileModeObjContainer, MUIM_Group_ExitChange);
782 data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_TileModeObj = new_TileModeObj;
786 if (old_bg_tilemodes)
787 FreeVec((APTR)old_bg_tilemodes);
789 if (old_bg_tilemodeentries)
790 FreeVec((APTR)old_bg_tilemodeentries);
792 SETNEVSOPTION(MUIA_IconWindowExt_ImageBackFill_BGRenderMode, IconWindowExt_ImageBackFill_RenderMode_Tiled);
793 SETNEVSOPTION(MUIA_IconWindowExt_ImageBackFill_BGTileMode, IconWindowExt_ImageBackFill_TileMode_Float);
794 SETNEVSOPTION(MUIA_IconWindowExt_ImageBackFill_BGXOffset, 0);
795 SETNEVSOPTION(MUIA_IconWindowExt_ImageBackFill_BGYOffset, 0);
797 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: DrawMode %d = '%s'\n", newBG_RenderModeCount -1, newBG_RenderModes[newBG_RenderModeCount-1]));
799 break;
803 else
805 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_BackgroundGrpObj, MUIA_ShowMe, FALSE);
808 SETNEVSOPTION(MUIA_IconList_IconListMode, ICON_LISTMODE_GRID);
809 SETNEVSOPTION(MUIA_IconList_LabelText_Mode, ICON_TEXTMODE_OUTLINE);
810 SETNEVSOPTION(MUIA_IconList_SortFlags, (MUIV_IconList_Sort_AutoSort | MUIV_IconList_Sort_ByName));
811 SETNEVSOPTION(MUIA_IconList_DragImageTransparent, FALSE);
812 SETNEVSOPTION(MUIA_IconList_DisplayFlags, ICONLIST_DISP_SHOWINFO);
813 SETNEVSOPTION(MUIA_IconList_LabelText_MaxLineLen, ILC_ICONLABEL_MAXLINELEN_DEFAULT);
815 #if defined(DEBUG_MULTLINE)
816 SETNEVSOPTION(MUIA_IconList_LabelText_MultiLine, 1);
817 SETNEVSOPTION(MUIA_IconList_LabelText_MultiLineOnFocus, FALSE);
818 #endif
820 SETNEVSOPTION(MUIA_IconList_Icon_HorizontalSpacing, ILC_ICON_HORIZONTALMARGIN_DEFAULT);
821 SETNEVSOPTION(MUIA_IconList_Icon_VerticalSpacing, ILC_ICON_VERTICALMARGIN_DEFAULT);
822 SETNEVSOPTION(MUIA_IconList_Icon_ImageSpacing, ILC_ICONLABEL_IMAGEMARGIN_DEFAULT);
823 SETNEVSOPTION(MUIA_IconList_LabelText_HorizontalPadding, ILC_ICONLABEL_HORIZONTALTEXTMARGIN_DEFAULT);
824 SETNEVSOPTION(MUIA_IconList_LabelText_VerticalPadding, ILC_ICONLABEL_VERTICALTEXTMARGIN_DEFAULT);
825 SETNEVSOPTION(MUIA_IconList_LabelText_BorderWidth, ILC_ICONLABEL_BORDERWIDTH_DEFAULT);
826 SETNEVSOPTION(MUIA_IconList_LabelText_BorderHeight, ILC_ICONLABEL_BORDERHEIGHT_DEFAULT);
828 if (newVS_OptionCount > 0)
830 IPTR old_bg_options = (IPTR) _viewSettings_Current->wpedbo_Options,
831 VSOptionCountCount = 0;
833 _viewSettings_Current->wpedbo_Options = NULL;
835 _viewSettings_Current->wpedbo_Options = AllocVec((sizeof(struct TagItem32) * (newVS_OptionCount + 1)), MEMF_ANY|MEMF_CLEAR);
836 for (VSOptionCountCount = 0; VSOptionCountCount < newVS_OptionCount; VSOptionCountCount++)
838 _viewSettings_Current->wpedbo_Options[VSOptionCountCount].ti_Tag = newVS_Options[VSOptionCountCount].ti_Tag;
839 _viewSettings_Current->wpedbo_Options[VSOptionCountCount].ti_Data = newVS_Options[VSOptionCountCount].ti_Data;
842 if (old_bg_options)
843 FreeVec((struct TagItem32 *)old_bg_options);
846 if (newBG_RenderModeCount > 0)
848 IPTR old_bg_drawmodes = (IPTR)data->wped_ViewSettings_Current->wpedbo_BFRenderModeNames;
849 IPTR old_bg_drawpages = (IPTR)data->wped_ViewSettings_Current->wpedbo_BFRenderModePages;
850 IPTR BFRenderModeCount = 0;
852 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: Old RenderModes @ 0x%p, pages @ 0x%p\n", old_bg_drawmodes, old_bg_drawpages));
854 data->wped_ViewSettings_Current->wpedbo_BFRenderModeNames = NULL;
855 data->wped_ViewSettings_Current->wpedbo_BFRenderModePages = NULL;
856 data->wped_ViewSettings_Current->wpedbo_BFRenderModeEntries = NULL;
858 data->wped_ViewSettings_Current->wpedbo_BFRenderModeNames = AllocVec((sizeof(STRPTR) * (newBG_RenderModeCount + 1)), MEMF_ANY|MEMF_CLEAR);
859 data->wped_ViewSettings_Current->wpedbo_BFRenderModePages = AllocVec((sizeof(IPTR) * newBG_RenderModeCount), MEMF_ANY|MEMF_CLEAR);
860 data->wped_ViewSettings_Current->wpedbo_BFRenderModeEntries = AllocVec((sizeof(IPTR) * newBG_RenderModeCount), MEMF_ANY|MEMF_CLEAR);
861 data->wped_ViewSettings_Current->wpedbo_BFRenderModeCount = newBG_RenderModeCount;
863 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: Allocated %d RenderModes - Array @ 0x%p, page mappings @ 0x%p\n", data->wped_ViewSettings_Current->wpedbo_BFRenderModeCount, data->wped_ViewSettings_Current->wpedbo_BFRenderModeNames, data->wped_ViewSettings_Current->wpedbo_BFRenderModePages));
865 for (BFRenderModeCount = 0; BFRenderModeCount < data->wped_ViewSettings_Current->wpedbo_BFRenderModeCount; BFRenderModeCount++)
867 data->wped_ViewSettings_Current->wpedbo_BFRenderModeNames[BFRenderModeCount] = (IPTR)newBG_RenderModes[BFRenderModeCount];
868 data->wped_ViewSettings_Current->wpedbo_BFRenderModePages[BFRenderModeCount] = newBG_RenderModePages[BFRenderModeCount];
869 data->wped_ViewSettings_Current->wpedbo_BFRenderModeEntries[BFRenderModeCount] = EntryElementFindNamedNode(&data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_AdvancedViewRenderModes, newBG_RenderModes[BFRenderModeCount]);
872 Object *new_RenderModeObj = NULL;
874 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: Creating RenderModes Cycle gadget\n"));
875 new_RenderModeObj = MUI_MakeObject(MUIO_Cycle,
876 NULL,
877 data->wped_ViewSettings_Current->wpedbo_BFRenderModeNames
879 if (new_RenderModeObj)
881 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: Object @ 0x%p\n", new_RenderModeObj));
882 if (DoMethod(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModeGrpObj, MUIM_Group_InitChange))
884 DoMethod(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModeGrpObj, OM_REMMEMBER, data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModeObj);
885 DoMethod(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModeGrpObj, OM_ADDMEMBER, new_RenderModeObj);
886 DoMethod(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModeGrpObj, MUIM_Group_ExitChange);
888 data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModeObj = new_RenderModeObj;
890 DoMethod (
891 data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_RenderModeObj,
892 MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
893 (IPTR)self, 3, MUIM_CallHook,
894 &data->wped_AdvancedViewSettings_WindowData->wpedabwd_Hook_DrawModeChage, CLASS
899 if (old_bg_drawmodes)
900 FreeVec((APTR)old_bg_drawmodes);
902 if (old_bg_drawpages)
903 FreeVec((APTR)old_bg_drawpages);
906 if ((strcmp(_viewSettings_Current->wpedbo_ViewName, "Workbench")) == 0)
908 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_SortModeLabel, MUIA_ShowMe, FALSE);
909 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_SortMode, MUIA_ShowMe, FALSE);
910 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_ViewModeLabel, MUIA_ShowMe, FALSE);
911 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_ViewMode, MUIA_ShowMe, FALSE);
913 else
915 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_SortModeLabel, MUIA_ShowMe, TRUE);
916 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_SortMode, MUIA_ShowMe, TRUE);
917 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_ViewModeLabel, MUIA_ShowMe, TRUE);
918 SET(data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_Icon_ViewMode, MUIA_ShowMe, TRUE);
921 else
923 D(bug("[WPEditor] WandererPrefs_Hook_CheckImageFunc: xxxxxxx - Disabling Advanced options ..\n"));
924 SET(_viewSettings_Current->wpedbo_AdvancedOptionsObject, MUIA_Disabled, TRUE);
926 SET(self, MUIA_PrefsEditor_Changed, TRUE);
928 AROS_USERFUNC_EXIT
931 struct WPEditor_ViewSettingsObject *WPEditor__FindViewSettingObjects(char * this_Name)
933 struct WPEditor_ViewSettingsObject *_viewSettings_Current = NULL;
935 ForeachNode(&_wpeditor_intern_ViewSettings, _viewSettings_Current)
937 if ((strcmp(_viewSettings_Current->wpedbo_ViewName, this_Name)) == 0) return _viewSettings_Current;
939 return NULL;
942 /*WPEditor__NewViewSettingObjects(): Add new ViewSetting object to
943 *scrollgroup in left part of Appearance page;
944 *It wants the name of new ViewSetting object, and if this
945 *ViewSetting object supports a backfill;
946 *The function creates a new 50x50 MUIC_Popimage (a private class
947 *which is composed by an imagebutton connected to a setting
948 *window) which has "MSG_SELECT_WORKBENCH_BACKGROUND" as window
949 *title;
950 *Image contained in MUIC_Popimage is going to be inserted by a call
951 *WPEditor__MUIM_PrefsEditor_ImportFH() during the initialization
952 *of WPEditor Zune object and when these objects must be repainted;
953 *If backfillsupport is TRUE a button labelled "Advanced" is
954 *created and hooked to WandererPrefs_Hook_CheckImageFunc();
955 *The new MUIC_Popimage and eventually an "Advanced" button
956 *are added as attributes to a ViewSetting object, and this last one
957 *is added as node to the global struct _wpeditor_intern_ViewSettings;
958 *The function returns the new ViewSetting object or NULL if
959 *it failed;
961 struct WPEditor_ViewSettingsObject *WPEditor__NewViewSettingObjects(char * this_Name, BOOL backfillsupport)
963 struct WPEditor_ViewSettingsObject *_viewSettings_Current = NULL;
965 D(bug("[WPEditor] WPEditor__NewViewSettingObjects('%s')\n", this_Name));
966 _viewSettings_Current = AllocMem(sizeof(struct WPEditor_ViewSettingsObject), MEMF_ANY|MEMF_CLEAR);
967 if (_viewSettings_Current)
969 _viewSettings_Current->wpedbo_ViewName = AllocVec(strlen(this_Name) + 1, MEMF_ANY|MEMF_CLEAR);
970 if (_viewSettings_Current->wpedbo_ViewName)
972 strcpy(_viewSettings_Current->wpedbo_ViewName, this_Name);
974 _viewSettings_Current->wpedbo_ImageSpecObject = (Object *)PopimageObject,
975 MUIA_FixWidth, 50,
976 MUIA_FixHeight, 50,
977 MUIA_Window_Title, __(MSG_SELECT_WORKBENCH_BACKGROUND),
978 MUIA_Imageadjust_Type, MUIV_Imageadjust_Type_Background,
979 MUIA_CycleChain, 1,
980 End;
982 if (_viewSettings_Current->wpedbo_ImageSpecObject)
984 if (backfillsupport)
985 _viewSettings_Current->wpedbo_AdvancedOptionsObject = SimpleButton(_(MSG_ADVANCED));
987 _viewSettings_Current->wpedbo_Hook_CheckImage.h_Entry = ( HOOKFUNC )WandererPrefs_Hook_CheckImageFunc;
988 AddTail(&_wpeditor_intern_ViewSettings, &_viewSettings_Current->wpedbo_Node);
989 D(bug("[WPEditor] WPEditor__NewViewSettingObjects: Successfully created\n"));
990 return _viewSettings_Current;
992 FreeVec(_viewSettings_Current->wpedbo_ViewName);
995 FreeMem(_viewSettings_Current, sizeof(struct WPEditor_ViewSettingsObject));
996 _viewSettings_Current = NULL;
998 D(bug("[WPEditor] WPEditor__NewViewSettingObjects: Failed to create objects\n"));
1000 return NULL;
1003 /*** Methods ****************************************************************/
1004 Object *WPEditor__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
1006 struct WPEditor_DATA *data = NULL;
1007 struct WPEditor_AdvancedBackgroundWindow_DATA *advancedView_data = NULL;
1009 Object *_WP_Navigation_HGrp1 = NULL,
1010 *_WP_Navigation_InnerHGrp1 = NULL,
1011 *_WP_Navigation_TypeObj = NULL,
1012 *_WP_Navigation_InnerHGrp2 = NULL,
1013 #if defined(DEBUG_CHANGESCREENTITLE)
1014 *_WP_Navigation_HGrp2 =NULL,
1015 *_WP_Navigation_InnerHGrp3 = NULL,
1016 *_WP_Navigator_ScreenTitleObj = NULL,
1017 #endif
1018 *_WP_NavigationObj = NULL,
1019 *_WP_Appearance_GroupObj = NULL,
1020 *_WP_ViewSettings_GroupObj = NULL,
1021 *_WP_ViewSettings_SpacerObj = NULL,
1022 *_WP_ViewSettings_VirtGrpObj = NULL,
1023 *_WP_ViewSettings_ScrollGrpObj = NULL,
1024 #if defined(DEBUG_NETWORKBROWSER)
1025 *_WP_NetworkBrowser_EnabledObj = NULL,
1026 #endif
1027 #if defined(DEBUG_SHOWUSERFILES)
1028 *_WP_UserFiles_ShowFileFolderObj = NULL,
1029 #endif
1030 *_WP_Toolbar_EnabledObj = NULL,
1031 *_WP_Toolbar_GroupObj = NULL,
1032 *_WP_Toolbar_InnerGroupObj1 = NULL,
1033 *_WP_Toolbar_InnerGroupObj2 = NULL,
1034 *_WP_Toolbar_InnerGroupObj3 = NULL,
1035 *_WP_Toolbar_InnerGroupObj4 = NULL,
1036 *_WP_Toolbar_PreviewObj = NULL,
1037 *_WP_Toolbar_PreviewDirUpObj = NULL,
1038 *_WP_Toolbar_PreviewSearchObj = NULL,
1039 *_WP_Prefs_PageGroupObj = NULL;
1041 Object *_WP_AdvancedViewWindow = NULL,
1042 *_WP_AdvancedViewPageGroupObj = NULL,
1043 *_WP_AdvancedViewWindowVGrp = NULL,
1044 *_WP_AdvancedViewBackgroundGrpObj = NULL,
1045 *_WP_AdvancedViewRenderModeGrpObj = NULL,
1046 *_WP_AdvancedViewRenderModeObj = NULL,
1047 *_WP_AdvancedView_RenderModePageObj = NULL,
1048 *_WP_AdvancedView_ScaleModeGrpObj = NULL,
1049 *_WP_AdvancedView_TileModeGrpObj = NULL,
1050 *_WP_AdvancedView_TileModeObjContainer = NULL,
1051 *_WP_AdvancedView_TileModeObj = NULL,
1052 *_WP_AdvancedView_X_OffsetObj = NULL,
1053 *_WP_AdvancedView_Y_OffsetObj = NULL,
1054 *_WP_AdvancedView_IconRenderGrpObj = NULL,
1055 *_WP_AdvancedView_LabelRenderGrpObj = NULL,
1056 *_WP_AdvancedView_Icon_ListModeObj = NULL,
1057 *_WP_AdvancedView_Icon_TextModeObj = NULL,
1058 *_WP_AdvancedView_Icon_HorSpacingObj = NULL,
1059 *_WP_AdvancedView_Icon_VertSpacingObj = NULL,
1060 *_WP_AdvancedView_Icon_ImageSpacingObj = NULL,
1061 *_WP_AdvancedView_Icon_SortModeObj = NULL,
1062 *_WP_AdvancedView_Icon_SortModeLabelObj = NULL,
1063 *_WP_AdvancedView_Icon_DragTransparentObj = NULL,
1064 *_WP_AdvancedView_Icon_AutoSortObj = NULL,
1065 *_WP_AdvancedView_Icon_ViewModeObj = NULL,
1066 *_WP_AdvancedView_Icon_ViewModeLabelObj = NULL,
1067 *_WP_AdvancedView_IconLabel_LabelFontObj = NULL,
1068 *_WP_AdvancedView_IconLabel_InfoFontObj = NULL,
1069 *_WP_AdvancedView_IconLabel_MaxLineLenObj = NULL,
1070 #if defined(DEBUG_MULTLINE)
1071 *_WP_AdvancedView_IconLabel_TextMultiLineObj = NULL,
1072 *_WP_AdvancedView_IconLabel_MultiLineonFocusObj = NULL,
1073 *_WP_AdvancedView_IconLabel_MultiLineNoObj = NULL,
1074 #endif
1075 *_WP_AdvancedView_IconLabel_HorPaddObj = NULL,
1076 *_WP_AdvancedView_IconLabel_VertPaddObj = NULL,
1077 *_WP_AdvancedView_IconLabel_BorderWidthObj = NULL,
1078 *_WP_AdvancedView_IconLabel_BorderHeightObj = NULL,
1079 *_WP_AdvancedView_ButtonGrpObj = NULL,
1080 *_WP_AdvancedView_ButtonObj_Use = NULL,
1081 *_WP_AdvancedView_ButtonObj_Cancel = NULL;
1083 /**/
1084 D(bug("[WPEditor] WPEditor__OM_NEW()\n"));
1086 //Object *cm_searchenabled;
1088 /*main window----------------------------------------------------------------*/
1089 /*self : Window?-------------------------------------------------------------*/
1091 self = (Object *) DoSuperNewTags
1093 CLASS, self, NULL,
1094 MUIA_PrefsEditor_Name, __(MSG_NAME),
1095 MUIA_PrefsEditor_Path, (IPTR) "SYS/Wanderer/global.prefs",
1096 TAG_DONE
1099 /*END self-------------------------------------------------------------------*/
1101 /*_WP_Prefs_PageGroupObj = Object for handling multi (3) page groups---------*/
1102 _wpeditor_intern_MainPageNames[WPD_GENERAL] = (STRPTR)_(MSG_GENERAL);
1103 _wpeditor_intern_MainPageNames[WPD_APPEARANCE] = (STRPTR)_(MSG_APPEARANCE);
1104 _wpeditor_intern_MainPageNames[WPD_TOOLBAR] = (STRPTR)_(MSG_TOOLBAR);
1106 _WP_Prefs_PageGroupObj = (Object *)RegisterObject,
1107 MUIA_Register_Titles, (IPTR) _wpeditor_intern_MainPageNames,
1108 End;
1109 /*END _WP_Prefs_PageGroupObj-------------------------------------------------*/
1111 /*_WP_NavigationObj: "Navigation" page group---------------------------------*/
1113 _WP_NavigationObj = (Object *)GroupObject, End;
1115 _WP_Navigation_HGrp1 = (Object *)HGroup, // general
1116 MUIA_FrameTitle, __(MSG_NAVIGATION),
1117 MUIA_Group_SameSize, TRUE,
1118 MUIA_Frame, MUIV_Frame_Group,
1119 MUIA_Group_Columns, 2,
1120 End;
1122 _WP_Navigation_InnerHGrp1 = (Object *)HGroup,
1123 MUIA_Group_Columns, 2,
1124 MUIA_Group_SameSize, FALSE,
1125 Child, (IPTR) Label1(_(MSG_METHOD)),
1126 End;
1128 /*Navigation cycle button--------------------*/
1129 _wpeditor_intern_NavigationModes[WPD_NAVIGATION_CLASSIC] = (STRPTR)_(MSG_CLASSIC);
1130 _wpeditor_intern_NavigationModes[WPD_NAVIGATION_ENHANCED] = (STRPTR)_(MSG_ENHANCED);
1131 _WP_Navigation_TypeObj = MUI_MakeObject(MUIO_Cycle, NULL, _wpeditor_intern_NavigationModes);
1133 /*END Navigation cycle button----------------*/
1134 _WP_Navigation_InnerHGrp2 = (Object *)HGroup,
1135 MUIA_Group_Columns, 2,
1136 MUIA_Group_SameSize, FALSE,
1137 End;
1139 #if defined(DEBUG_SHOWUSERFILES)
1140 _WP_UserFiles_ShowFileFolderObj = MUI_MakeObject(MUIO_Checkmark,NULL);
1141 #endif
1143 #if defined(DEBUG_CHANGESCREENTITLE)
1144 _WP_Navigation_HGrp2 = (Object *)HGroup,
1145 MUIA_FrameTitle, (IPTR)_(MSG_WANDERERSCREENTITLE),
1146 MUIA_Group_SameSize, TRUE,
1147 MUIA_Frame, MUIV_Frame_Group,
1148 End;
1150 _WP_Navigation_InnerHGrp3 = (Object *)HGroup, End;
1152 _WP_Navigator_ScreenTitleObj = (Object *)StringObject,
1153 StringFrame,
1154 MUIA_String_MaxLen, 256,
1155 //MUIA_String_Contents, (IPTR)" ",
1156 End;
1157 #endif
1158 /*END _WP_NavigationObj------------------------------------------------------*/
1160 /*_WP_Appearance_GroupObj: "Appearance" page group---------------------------*/
1162 _WP_Appearance_GroupObj = (Object *)GroupObject, // appearance
1163 MUIA_Group_SameSize, FALSE,
1164 MUIA_Group_Horiz, TRUE,
1165 End;
1167 /*Left part of Appearance*/
1168 _WP_ViewSettings_ScrollGrpObj = (Object *)ScrollgroupObject,
1169 MUIA_Group_SameSize, FALSE,
1170 MUIA_Scrollgroup_FreeHoriz, FALSE,
1171 MUIA_Scrollgroup_FreeVert, TRUE,
1172 MUIA_Scrollgroup_Contents,
1173 (IPTR) (_WP_ViewSettings_VirtGrpObj = (Object *)VirtgroupObject,
1174 MUIA_FrameTitle, (IPTR)_(MSG_VIEWSETTINGS),
1175 MUIA_Frame, MUIV_Frame_ReadList,
1176 MUIA_Virtgroup_Input, FALSE,
1177 End),
1178 End;
1180 /*_WP_ViewSettings_GroupObj is going to contain nodes
1181 of list called _wpeditor_intern_ViewSettings,
1182 it's created after in this function...;
1184 _WP_ViewSettings_GroupObj = (Object *)GroupObject,
1185 MUIA_Background, MUII_SHINE,
1186 Child, (IPTR) (_WP_ViewSettings_SpacerObj = HVSpace),
1187 End;
1188 /**/
1190 /*END _WP_Appearance_GroupObj------------------------------------------------*/
1192 /*_WP_Toolbar_GroupObj: "Toolbar" page group---------------------------------*/
1194 _WP_Toolbar_GroupObj = (Object *)GroupObject, // toolbar
1195 MUIA_Group_SameSize, FALSE,
1196 End;
1198 _WP_Toolbar_InnerGroupObj1 = (Object *)HGroup,
1199 MUIA_FrameTitle, __(MSG_OBJECTS),
1200 MUIA_Group_SameSize, TRUE,
1201 MUIA_Frame, MUIV_Frame_Group,
1202 MUIA_Group_Columns, 2,
1203 End;
1205 _WP_Toolbar_InnerGroupObj2 = (Object *)HGroup,
1206 MUIA_Group_Columns, 2,
1207 MUIA_Group_SameSize, FALSE,
1208 Child, (IPTR)Label1(_(MSG_TOOLBAR_ENABLED)),
1209 End;
1211 _WP_Toolbar_EnabledObj = MUI_MakeObject(MUIO_Checkmark, NULL);
1213 _WP_Toolbar_InnerGroupObj3 = (Object *)HGroup,
1214 MUIA_Group_Columns, 2,
1215 MUIA_Group_SameSize, FALSE,
1216 Child, (IPTR) HVSpace,
1217 Child, (IPTR) HVSpace,
1218 Child, (IPTR) HVSpace,
1219 Child, (IPTR) HVSpace,
1220 End;
1222 _WP_Toolbar_PreviewObj = (Object *)HGroup,
1223 MUIA_FrameTitle, __(MSG_PREVIEW),
1224 MUIA_Frame, MUIV_Frame_Group,
1225 MUIA_Group_SameSize, FALSE,
1226 End;
1228 _WP_Toolbar_InnerGroupObj4 = (Object *)HGroup,
1229 MUIA_HorizWeight, 0,
1230 MUIA_Group_SameSize, TRUE,
1231 End;
1233 _WP_Toolbar_PreviewDirUpObj = ImageButton("", "THEME:Images/Gadgets/Revert");
1234 _WP_Toolbar_PreviewSearchObj = ImageButton("", "THEME:Images/Gadgets/Search");
1235 /*END _WP_Toolbar_GroupObj---------------------------------------------------*/
1237 /*Add main objects to main window (self?)------------------------------------*/
1239 /*Add navigation Objects to Navigation page*/
1241 DoMethod(_WP_Navigation_InnerHGrp1, OM_ADDMEMBER,_WP_Navigation_TypeObj);
1242 DoMethod(_WP_Navigation_InnerHGrp1, OM_ADDMEMBER,HVSpace);
1243 DoMethod(_WP_Navigation_InnerHGrp1, OM_ADDMEMBER,HVSpace);
1244 #if defined(DEBUG_NETWORKBROWSER)
1245 _WP_NetworkBrowser_EnabledObj = MUI_MakeObject(MUIO_Checkmark, NULL);
1246 DoMethod(_WP_Navigation_InnerHGrp2, OM_ADDMEMBER,Label1(_(MSG_NETWORKONWB)));
1247 DoMethod(_WP_Navigation_InnerHGrp2, OM_ADDMEMBER,_WP_NetworkBrowser_EnabledObj);
1248 #else
1249 DoMethod(_WP_Navigation_InnerHGrp2, OM_ADDMEMBER,HVSpace);
1250 DoMethod(_WP_Navigation_InnerHGrp2, OM_ADDMEMBER,HVSpace);
1251 #endif
1252 #if defined(DEBUG_SHOWUSERFILES)
1253 DoMethod(_WP_Navigation_InnerHGrp2, OM_ADDMEMBER,Label1(_(MSG_USERFILEONWB)));
1254 DoMethod(_WP_Navigation_InnerHGrp2, OM_ADDMEMBER,_WP_UserFiles_ShowFileFolderObj);
1255 #else
1256 DoMethod(_WP_Navigation_InnerHGrp2, OM_ADDMEMBER,HVSpace);
1257 DoMethod(_WP_Navigation_InnerHGrp2, OM_ADDMEMBER,HVSpace);
1258 #endif
1259 DoMethod(_WP_Navigation_InnerHGrp2, OM_ADDMEMBER,HVSpace);
1260 DoMethod(_WP_Navigation_InnerHGrp2, OM_ADDMEMBER,HVSpace);
1262 #if defined(DEBUG_CHANGESCREENTITLE)
1263 DoMethod(_WP_Navigator_ScreenTitleObj,MUIM_Set, MUIA_ShortHelp,_(MSG_BUBBLESCREENTITLE));
1264 DoMethod(_WP_Navigation_InnerHGrp3, OM_ADDMEMBER,_WP_Navigator_ScreenTitleObj);
1265 DoMethod(_WP_Navigation_HGrp2, OM_ADDMEMBER,_WP_Navigation_InnerHGrp3);
1266 #endif
1268 DoMethod(_WP_Navigation_HGrp1, OM_ADDMEMBER,_WP_Navigation_InnerHGrp1);
1269 DoMethod(_WP_Navigation_HGrp1, OM_ADDMEMBER,_WP_Navigation_InnerHGrp2);
1271 DoMethod(_WP_NavigationObj, OM_ADDMEMBER,_WP_Navigation_HGrp1);
1272 #if defined(DEBUG_CHANGESCREENTITLE)
1273 DoMethod(_WP_NavigationObj, OM_ADDMEMBER,_WP_Navigation_HGrp2);
1274 #endif
1275 /**/
1277 /*Add appearance Objects to Appearance page*/
1278 /*Add objects which are contain into right part*/
1279 /*Add objects which are contain into left part*/
1280 DoMethod(_WP_ViewSettings_VirtGrpObj, OM_ADDMEMBER,_WP_ViewSettings_GroupObj);
1281 /**/
1283 DoMethod(_WP_Appearance_GroupObj, OM_ADDMEMBER,_WP_ViewSettings_ScrollGrpObj);
1284 /**/
1286 /*Add toolbar Objects to Toolbar page*/
1287 DoMethod(_WP_Toolbar_InnerGroupObj4, OM_ADDMEMBER,_WP_Toolbar_PreviewDirUpObj);
1288 DoMethod(_WP_Toolbar_InnerGroupObj4, OM_ADDMEMBER,_WP_Toolbar_PreviewSearchObj);
1290 DoMethod(_WP_Toolbar_PreviewObj, OM_ADDMEMBER,HVSpace);
1291 DoMethod(_WP_Toolbar_PreviewObj, OM_ADDMEMBER, _WP_Toolbar_InnerGroupObj4);
1293 DoMethod(_WP_Toolbar_InnerGroupObj2 , OM_ADDMEMBER,_WP_Toolbar_EnabledObj);
1294 DoMethod(_WP_Toolbar_InnerGroupObj2 , OM_ADDMEMBER,HVSpace);
1295 DoMethod(_WP_Toolbar_InnerGroupObj2 , OM_ADDMEMBER,HVSpace);
1297 DoMethod(_WP_Toolbar_InnerGroupObj1 , OM_ADDMEMBER,_WP_Toolbar_InnerGroupObj2);
1298 DoMethod(_WP_Toolbar_InnerGroupObj1 , OM_ADDMEMBER,_WP_Toolbar_InnerGroupObj3);
1301 DoMethod(_WP_Toolbar_GroupObj, OM_ADDMEMBER,_WP_Toolbar_InnerGroupObj1);
1302 DoMethod(_WP_Toolbar_GroupObj, OM_ADDMEMBER,_WP_Toolbar_PreviewObj);
1303 /**/
1305 DoMethod(_WP_Prefs_PageGroupObj, OM_ADDMEMBER,_WP_NavigationObj);/*add Navigation page to pagesGroup*/
1306 DoMethod(_WP_Prefs_PageGroupObj, OM_ADDMEMBER,_WP_Appearance_GroupObj);/*add Appearance page to pagesGroup*/
1307 DoMethod(_WP_Prefs_PageGroupObj, OM_ADDMEMBER,_WP_Toolbar_GroupObj);/*add Toolbar page to pagesGroup*/
1309 DoMethod(self, OM_ADDMEMBER,_WP_Prefs_PageGroupObj);/*add pagesGroup to self*/
1310 /*END Add main objects to main window (self?)--------------------------------*/
1312 //SET( _WP_Prefs_PageGroupObj, MUIA_Group_ActivePage, 1); //Goto the Appearance page by default..
1314 /*END main window------------------------------------------------------------*/
1316 /*AdvancedViewWindow---------------------------------------------------------*/
1318 /*Window-------------------------------------------------------------*/
1319 _WP_AdvancedViewWindow = (Object *)WindowObject,
1320 MUIA_Window_CloseGadget, FALSE,
1321 MUIA_Window_Title, (IPTR)_(MSG_ADVANCEDOPTIONS),
1322 WindowContents, (IPTR) (_WP_AdvancedViewWindowVGrp = (Object *)VGroup, End),
1323 End;
1325 /*_WP_AdvancedViewPageGroupObj = Object for handling multi (3) page groups---------*/
1326 _wpeditor_intern_AdvancedPageNames[WPD_ADVANCED_ICONS] = (STRPTR)_(MSG_ADVANCEDICONS);
1327 _wpeditor_intern_AdvancedPageNames[WPD_ADVANCED_LABELS] = (STRPTR)_(MSG_ADVANCEDLABELS);
1328 _wpeditor_intern_AdvancedPageNames[WPD_ADVANCED_BACKGROUND] = (STRPTR)_(MSG_ADVANCEDBACKGROUND);
1330 _WP_AdvancedViewPageGroupObj = (Object *)RegisterObject,
1331 MUIA_Register_Titles, (IPTR) _wpeditor_intern_AdvancedPageNames,
1332 End;
1333 /*END _WP_AdvancedViewPageGroupObj-------------------------------------------------*/
1335 /*Draw Mode Group----------------------------------------------------*/
1336 _WP_AdvancedViewBackgroundGrpObj = (Object *)VGroup,
1337 MUIA_FrameTitle, (IPTR)_(MSG_BACKGROUNDOPTIONS),
1338 MUIA_Frame, MUIV_Frame_Group,
1339 End;
1341 _WP_AdvancedViewRenderModeGrpObj = (Object *)HGroup,
1342 Child, (IPTR) Label1(_(MSG_DRAWMODE)), End;
1344 /*AdvancedViewRenderMode cycle button------------------------*/
1345 _WP_AdvancedViewRenderModeObj = HVSpace;
1347 /*END AdvancedViewRenderMode cycle button------------------------*/
1348 /*END Draw Mode Group------------------------------------------------*/
1350 /*Scale Mode/Tile Mode Group-----------------------------------------*/
1351 _WP_AdvancedView_RenderModePageObj = (Object *)GroupObject,
1352 MUIA_Group_PageMode, TRUE,
1353 End;
1355 _WP_AdvancedView_ScaleModeGrpObj = (Object *)GroupObject,
1356 MUIA_Group_SameSize, FALSE,
1357 MUIA_FrameTitle, (IPTR)_(MSG_SCALEMODEOPTIONS),
1358 MUIA_Frame, MUIV_Frame_Group,
1359 Child, (IPTR)HVSpace,
1360 End;
1362 /*AdvancedView_TileModeNames cicle button--------------------*/
1363 _WP_AdvancedView_TileModeObj = HVSpace;
1364 _WP_AdvancedView_TileModeObjContainer = (Object *)HGroup, Child, (IPTR)_WP_AdvancedView_TileModeObj, End;
1365 /*END AdvancedView_TileModeNames cicle button----------------*/
1367 _WP_AdvancedView_TileModeGrpObj = (Object *)GroupObject,
1368 MUIA_Group_SameSize, FALSE,
1369 MUIA_FrameTitle, (IPTR)_(MSG_TILEMODEOPTIONS),
1370 MUIA_Frame, MUIV_Frame_Group,
1371 MUIA_Group_Columns, 2,
1372 End;
1374 _WP_AdvancedView_X_OffsetObj = (Object *)StringObject,
1375 StringFrame,
1376 MUIA_String_MaxLen, 3,
1377 MUIA_String_Accept, (IPTR)"0123456789",
1378 End;
1380 _WP_AdvancedView_Y_OffsetObj = (Object *)StringObject,
1381 StringFrame,
1382 MUIA_String_MaxLen, 3,
1383 MUIA_String_Accept, (IPTR)"0123456789",
1384 End;
1386 /*END Scale Mode/Tile Mode Group-------------------------------------*/
1387 /*Icon List Mode Cycle button------------------------*/
1388 _wpeditor_intern_IconListModeNames[WPD_ICONLISTMODE_GRID] = (STRPTR)_(MSG_ICONLISTMODE_GRID);
1389 _wpeditor_intern_IconListModeIDs[WPD_ICONLISTMODE_GRID] = WPD_ICONLISTMODE_GRID;
1390 _wpeditor_intern_IconListModeNames[WPD_ICONLISTMODE_PLAIN] = (STRPTR)_(MSG_ICONLISTMODE_PLAIN);
1391 _wpeditor_intern_IconListModeIDs[WPD_ICONLISTMODE_PLAIN] = WPD_ICONLISTMODE_PLAIN;
1392 _WP_AdvancedView_Icon_ListModeObj = MUI_MakeObject(MUIO_Cycle, NULL, _wpeditor_intern_IconListModeNames);
1394 _wpeditor_intern_IconTextRenderModeNames[WPD_ICONTEXTMODE_OUTLINE] = (STRPTR)_(MSG_ICONTEXTMODE_OUTLINE);
1395 _wpeditor_intern_IconTextRenderModeIDs[WPD_ICONTEXTMODE_OUTLINE] = WPD_ICONTEXTMODE_OUTLINE;
1396 _wpeditor_intern_IconTextRenderModeNames[WPD_ICONTEXTMODE_PLAIN] = (STRPTR)_(MSG_ICONTEXTMODE_PLAIN);
1397 _wpeditor_intern_IconTextRenderModeIDs[WPD_ICONTEXTMODE_PLAIN] = WPD_ICONTEXTMODE_PLAIN;
1398 _wpeditor_intern_IconTextRenderModeNames[ICON_TEXTMODE_DROPSHADOW] = (STRPTR)_(MSG_ICONTEXTMODE_SHADOW);
1399 _wpeditor_intern_IconTextRenderModeIDs[ICON_TEXTMODE_DROPSHADOW] = ICON_TEXTMODE_DROPSHADOW;
1400 _WP_AdvancedView_Icon_TextModeObj = MUI_MakeObject(MUIO_Cycle, NULL, _wpeditor_intern_IconTextRenderModeNames);
1402 _wpeditor_intern_IconSortModeNames[WPD_ICONSORTMODE_BYNAME] = (STRPTR)_(MSG_ICONSORTMODE_BYNAME);
1403 _wpeditor_intern_IconSortModeNames[WPD_ICONSORTMODE_BYDATE] = (STRPTR)_(MSG_ICONSORTMODE_BYDATE);
1404 _wpeditor_intern_IconSortModeNames[WPD_ICONSORTMODE_BYSIZE] = (STRPTR)_(MSG_ICONSORTMODE_BYSIZE);
1405 _WP_AdvancedView_Icon_SortModeObj = MUI_MakeObject(MUIO_Cycle, NULL, _wpeditor_intern_IconSortModeNames);
1407 _WP_AdvancedView_Icon_SortModeLabelObj = Label1(_(MSG_DEFAULT_ICONSORTMODE));
1409 _wpeditor_intern_IconViewModeNames[WPD_ICONVIEWMODE_ALL] = (STRPTR)_(MSG_ICONVIEWMODE_ALL);
1410 _wpeditor_intern_IconViewModeNames[WPD_ICONVIEWMODE_ICONS] = (STRPTR)_(MSG_ICONVIEWMODE_ICONS);
1411 _WP_AdvancedView_Icon_ViewModeObj = MUI_MakeObject(MUIO_Cycle, NULL, _wpeditor_intern_IconViewModeNames);
1413 _WP_AdvancedView_Icon_ViewModeLabelObj = Label1(_(MSG_DEFAULT_ICONVIEWMODE));
1414 /*END Icon List Mode Cycle button--------------------*/
1416 _WP_AdvancedView_Icon_AutoSortObj = MUI_MakeObject(MUIO_Checkmark, NULL);
1418 _WP_AdvancedView_Icon_DragTransparentObj = MUI_MakeObject(MUIO_Checkmark, NULL);
1420 _WP_AdvancedView_IconLabel_MaxLineLenObj = (Object *)StringObject,
1421 StringFrame,
1422 MUIA_String_MaxLen, 3,
1423 MUIA_String_Format, MUIV_String_Format_Right,
1424 MUIA_String_Accept, (IPTR)"0123456789",
1425 End;
1427 _WP_AdvancedView_Icon_HorSpacingObj = (Object *)StringObject,
1428 StringFrame,
1429 MUIA_String_MaxLen, 3,
1430 MUIA_String_Format, MUIV_String_Format_Right,
1431 MUIA_String_Accept, (IPTR)"0123456789",
1432 End;
1434 _WP_AdvancedView_Icon_VertSpacingObj = (Object *)StringObject,
1435 StringFrame,
1436 MUIA_String_MaxLen, 3,
1437 MUIA_String_Format, MUIV_String_Format_Right,
1438 MUIA_String_Accept, (IPTR)"0123456789",
1439 End;
1441 _WP_AdvancedView_Icon_ImageSpacingObj = (Object *)StringObject,
1442 StringFrame,
1443 MUIA_String_MaxLen, 3,
1444 MUIA_String_Format, MUIV_String_Format_Right,
1445 MUIA_String_Accept, (IPTR)"0123456789",
1446 End;
1448 _WP_AdvancedView_IconLabel_LabelFontObj = (Object *)StringObject,
1449 StringFrame,
1450 MUIA_String_MaxLen, 3,
1451 MUIA_String_Format, MUIV_String_Format_Right,
1452 End;
1454 _WP_AdvancedView_IconLabel_InfoFontObj = (Object *)StringObject,
1455 StringFrame,
1456 MUIA_String_MaxLen, 3,
1457 MUIA_String_Format, MUIV_String_Format_Right,
1458 End;
1460 #if defined(DEBUG_MULTLINE)
1461 _WP_AdvancedView_IconLabel_MultiLineNoObj = (Object *)StringObject,
1462 StringFrame,
1463 MUIA_String_MaxLen, 2,
1464 MUIA_String_Format, MUIV_String_Format_Right,
1465 MUIA_String_Accept, (IPTR)"0123456789",
1466 End;
1468 _WP_AdvancedView_IconLabel_TextMultiLineObj = MUI_MakeObject(MUIO_Checkmark, NULL);
1469 _WP_AdvancedView_IconLabel_MultiLineonFocusObj = MUI_MakeObject(MUIO_Checkmark, NULL);
1470 #endif
1471 _WP_AdvancedView_IconLabel_HorPaddObj = (Object *)StringObject,
1472 StringFrame,
1473 MUIA_String_MaxLen, 3,
1474 MUIA_String_Format, MUIV_String_Format_Right,
1475 MUIA_String_Accept, (IPTR)"0123456789",
1476 End;
1478 _WP_AdvancedView_IconLabel_VertPaddObj = (Object *)StringObject,
1479 StringFrame,
1480 MUIA_String_MaxLen, 3,
1481 MUIA_String_Format, MUIV_String_Format_Right,
1482 MUIA_String_Accept, (IPTR)"0123456789",
1483 End;
1485 _WP_AdvancedView_IconLabel_BorderWidthObj = (Object *)StringObject,
1486 StringFrame,
1487 MUIA_String_MaxLen, 3,
1488 MUIA_String_Format, MUIV_String_Format_Right,
1489 MUIA_String_Accept, (IPTR)"0123456789",
1490 End;
1492 _WP_AdvancedView_IconLabel_BorderHeightObj = (Object *)StringObject,
1493 StringFrame,
1494 MUIA_String_MaxLen, 3,
1495 MUIA_String_Format, MUIV_String_Format_Right,
1496 MUIA_String_Accept, (IPTR)"0123456789",
1497 End;
1499 _WP_AdvancedView_IconRenderGrpObj = (Object *)GroupObject,
1500 MUIA_Group_SameSize, FALSE,
1501 MUIA_FrameTitle, __(MSG_ICONSPREFS),
1502 MUIA_Frame, MUIV_Frame_Group,
1503 MUIA_Group_Columns, 2,
1504 End;
1506 _WP_AdvancedView_LabelRenderGrpObj = (Object *)GroupObject,
1507 MUIA_Group_SameSize, FALSE,
1508 MUIA_FrameTitle, __(MSG_LABELSPREFS),
1509 MUIA_Frame, MUIV_Frame_Group,
1510 MUIA_Group_Columns, 2,
1511 End;
1513 /*Button Group-------------------------------------------------------*/
1514 _WP_AdvancedView_ButtonGrpObj = (Object *)HGroup,
1515 Child, (IPTR)(_WP_AdvancedView_ButtonObj_Use = ImageButton(_(MSG_USE), "THEME:Images/Gadgets/Use")),
1516 Child, (IPTR)(_WP_AdvancedView_ButtonObj_Cancel = ImageButton(_(MSG_CANCEL), "THEME:Images/Gadgets/Cancel")),
1517 End;
1518 /*END Button Group--------------------------------------------------*/
1520 /*END Window--------------------------------------------------------*/
1523 /*Add advanced view objects to AdvancedViewWindow object--------------------*/
1524 DoMethod(_WP_AdvancedViewRenderModeGrpObj, OM_ADDMEMBER,_WP_AdvancedViewRenderModeObj);
1526 DoMethod(_WP_AdvancedView_TileModeGrpObj, OM_ADDMEMBER, Label1(_(MSG_TILEMODE)));
1527 DoMethod(_WP_AdvancedView_TileModeGrpObj, OM_ADDMEMBER, _WP_AdvancedView_TileModeObjContainer);
1528 DoMethod(_WP_AdvancedView_TileModeGrpObj, OM_ADDMEMBER, Label1(_(MSG_XOFFSET)));
1529 DoMethod(_WP_AdvancedView_TileModeGrpObj, OM_ADDMEMBER, _WP_AdvancedView_X_OffsetObj);
1530 DoMethod(_WP_AdvancedView_TileModeGrpObj, OM_ADDMEMBER, Label1(_(MSG_YOFFSET)));
1531 DoMethod(_WP_AdvancedView_TileModeGrpObj, OM_ADDMEMBER, _WP_AdvancedView_Y_OffsetObj);
1533 DoMethod(_WP_AdvancedView_RenderModePageObj, OM_ADDMEMBER, _WP_AdvancedView_ScaleModeGrpObj);
1534 DoMethod(_WP_AdvancedView_RenderModePageObj, OM_ADDMEMBER, _WP_AdvancedView_TileModeGrpObj);
1536 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_ICONLISTMODE)));
1537 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_Icon_ListModeObj);
1538 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_HORIZSPACINGICON)));
1539 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_Icon_HorSpacingObj);
1540 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_VERTSPACINGICON)));
1541 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_Icon_VertSpacingObj);
1542 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_PADDINGICONIMAGELABEL)));
1543 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_Icon_ImageSpacingObj);
1544 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_Icon_SortModeLabelObj);
1545 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_Icon_SortModeObj);
1546 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_ICON_AUTOSORT_ENABLED)));
1547 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_Icon_AutoSortObj );
1548 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_ICON_DRAG_TRANSPARENT)));
1549 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_Icon_DragTransparentObj);
1550 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_Icon_ViewModeLabelObj);
1551 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_Icon_ViewModeObj);
1552 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER,HVSpace);
1553 DoMethod(_WP_AdvancedView_IconRenderGrpObj, OM_ADDMEMBER,HVSpace);
1555 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_ICONTEXTMODE)));
1556 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_Icon_TextModeObj);
1558 /* "TODO: Replace with propper font selectors" */
1559 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_ICONLABELFONT)));
1560 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_IconLabel_LabelFontObj);
1561 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_ICONINFOFONT)));
1562 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_IconLabel_InfoFontObj);
1564 #if !defined(DEBUG_PERVIEWFONTS)
1565 SET(_WP_AdvancedView_IconLabel_LabelFontObj, MUIA_Disabled, TRUE);
1566 SET(_WP_AdvancedView_IconLabel_InfoFontObj, MUIA_Disabled, TRUE);
1567 #endif
1569 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_LABELLINELENGTH)));
1570 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_IconLabel_MaxLineLenObj);
1571 #if defined(DEBUG_MULTLINE)
1572 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_USEMULTILINELABELS)));
1573 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_IconLabel_TextMultiLineObj);
1574 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_SHOWFOCUSEDICON)));
1575 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_IconLabel_MultiLineonFocusObj);
1576 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_NDISPLAYLINES)));
1577 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_IconLabel_MultiLineNoObj);
1578 #endif
1580 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_HORIZPADDINGLABELTEXT)));
1581 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_IconLabel_HorPaddObj);
1583 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_VERTPADDINGLABELTEXT)));
1584 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_IconLabel_VertPaddObj);
1586 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_FRAMEWIDTH)));
1587 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_IconLabel_BorderWidthObj);
1589 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, Label1(_(MSG_FRAMEHEIGHT)));
1590 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER, _WP_AdvancedView_IconLabel_BorderHeightObj);
1592 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER,HVSpace);
1593 DoMethod(_WP_AdvancedView_LabelRenderGrpObj, OM_ADDMEMBER,HVSpace);
1596 DoMethod(_WP_AdvancedViewBackgroundGrpObj, OM_ADDMEMBER,_WP_AdvancedViewRenderModeGrpObj);
1597 DoMethod(_WP_AdvancedViewBackgroundGrpObj, OM_ADDMEMBER,_WP_AdvancedView_RenderModePageObj);
1598 DoMethod(_WP_AdvancedViewBackgroundGrpObj, OM_ADDMEMBER,HVSpace);
1600 DoMethod(_WP_AdvancedViewPageGroupObj, OM_ADDMEMBER,_WP_AdvancedView_IconRenderGrpObj);
1601 DoMethod(_WP_AdvancedViewPageGroupObj, OM_ADDMEMBER,_WP_AdvancedView_LabelRenderGrpObj);
1602 DoMethod(_WP_AdvancedViewPageGroupObj, OM_ADDMEMBER,_WP_AdvancedViewBackgroundGrpObj);
1603 DoMethod(_WP_AdvancedViewWindowVGrp, OM_ADDMEMBER,_WP_AdvancedViewPageGroupObj);/*add pagesGroup to view*/
1604 DoMethod(_WP_AdvancedViewWindowVGrp, OM_ADDMEMBER,_WP_AdvancedView_ButtonGrpObj);
1606 /*END Add advanced view objects to AdvancedViewWindow object-----------------*/
1607 /*END AdvancedViewWindow-----------------------------------------------------*/
1609 /*-------------------*/
1610 if ((self != NULL) && (_WP_AdvancedViewWindow != NULL ))
1612 _wpeditor_intern_CLASS = CLASS;
1613 data = INST_DATA(CLASS, self);
1615 D(bug("[WPEditor] WPEditor__OM_NEW: Prefs Object (self) @ 0x%p\n", self));
1617 if ((advancedView_data = AllocMem(sizeof(struct WPEditor_AdvancedBackgroundWindow_DATA), MEMF_CLEAR|MEMF_ANY)) != NULL)
1619 advancedView_data->wpedabwd_Hook_DrawModeChage.h_Entry = (HOOKFUNC) WandererPrefs_Hook_DrawModeChangeFunc;
1621 advancedView_data->wpedabwd_Window_WindowObj = _WP_AdvancedViewWindow;
1622 advancedView_data->wpedabwd_Window_BackgroundGrpObj = _WP_AdvancedViewBackgroundGrpObj;
1623 advancedView_data->wpedabwd_Window_RenderModeGrpObj = _WP_AdvancedViewRenderModeGrpObj ;
1624 advancedView_data->wpedabwd_Window_RenderModeObj = _WP_AdvancedViewRenderModeObj;
1625 advancedView_data->wpedabwd_Window_RenderModePageObj = _WP_AdvancedView_RenderModePageObj;
1626 advancedView_data->wpedabwd_Window_TileModeObjContainer = _WP_AdvancedView_TileModeObjContainer;
1627 advancedView_data->wpedabwd_Window_TileModeObj = _WP_AdvancedView_TileModeObj;
1628 advancedView_data->wpedabwd_Window_XOffsetObj = _WP_AdvancedView_X_OffsetObj;
1629 advancedView_data->wpedabwd_Window_YOffsetObj = _WP_AdvancedView_Y_OffsetObj;
1631 advancedView_data->wpedabwd_Window_Icon_ListMode = _WP_AdvancedView_Icon_ListModeObj;
1632 advancedView_data->wpedabwd_Window_Icon_TextMode = _WP_AdvancedView_Icon_TextModeObj;
1633 advancedView_data->wpedabwd_Window_Icon_SortMode = _WP_AdvancedView_Icon_SortModeObj;
1634 advancedView_data->wpedabwd_Window_Icon_SortModeLabel = _WP_AdvancedView_Icon_SortModeLabelObj;
1635 advancedView_data->wpedabwd_Window_Icon_AutoSort = _WP_AdvancedView_Icon_AutoSortObj;
1636 advancedView_data->wpedabwd_Window_Icon_DragTransparent = _WP_AdvancedView_Icon_DragTransparentObj;
1637 advancedView_data->wpedabwd_Window_Icon_ViewMode = _WP_AdvancedView_Icon_ViewModeObj;
1638 advancedView_data->wpedabwd_Window_Icon_ViewModeLabel = _WP_AdvancedView_Icon_ViewModeLabelObj;
1640 advancedView_data->wpedabwd_Window_Icon_HorSpacing = _WP_AdvancedView_Icon_HorSpacingObj;
1641 advancedView_data->wpedabwd_Window_Icon_VertSpacing = _WP_AdvancedView_Icon_VertSpacingObj;
1642 advancedView_data->wpedabwd_Window_Icon_ImageSpacing = _WP_AdvancedView_Icon_ImageSpacingObj;
1644 advancedView_data->wpedabwd_Window_IconLabel_LabelFont = _WP_AdvancedView_IconLabel_LabelFontObj;
1645 advancedView_data->wpedabwd_Window_IconLabel_InfoFont = _WP_AdvancedView_IconLabel_InfoFontObj;
1647 advancedView_data->wpedabwd_Window_IconLabel_MaxLineLen = _WP_AdvancedView_IconLabel_MaxLineLenObj;
1649 #if defined(DEBUG_MULTLINE)
1650 advancedView_data->wpedabwd_Window_IconLabel_TextMultiLine = _WP_AdvancedView_IconLabel_TextMultiLineObj;
1651 advancedView_data->wpedabwd_Window_IconLabel_MultiLineonFocus = _WP_AdvancedView_IconLabel_MultiLineonFocusObj;
1652 advancedView_data->wpedabwd_Window_IconLabel_MultiLineNo = _WP_AdvancedView_IconLabel_MultiLineNoObj;
1653 #endif
1654 advancedView_data->wpedabwd_Window_IconLabel_HorPadd = _WP_AdvancedView_IconLabel_HorPaddObj;
1655 advancedView_data->wpedabwd_Window_IconLabel_VertPadd = _WP_AdvancedView_IconLabel_VertPaddObj;
1656 advancedView_data->wpedabwd_Window_IconLabel_BorderWidth = _WP_AdvancedView_IconLabel_BorderWidthObj;
1657 advancedView_data->wpedabwd_Window_IconLabel_BorderHeight = _WP_AdvancedView_IconLabel_BorderHeightObj;
1659 advancedView_data->wpedabwd_Window_UseObj = _WP_AdvancedView_ButtonObj_Use;
1660 advancedView_data->wpedabwd_Window_CancelObj = _WP_AdvancedView_ButtonObj_Cancel;
1662 NewList(&advancedView_data->wpedabwd_Window_AdvancedViewRenderModes);
1663 EntryElementRegister(&advancedView_data->wpedabwd_Window_AdvancedViewRenderModes, IconWindowExt_ImageBackFill_RenderMode_Tiled, _(MSG_TILED));
1664 EntryElementRegister(&advancedView_data->wpedabwd_Window_AdvancedViewRenderModes, IconWindowExt_ImageBackFill_RenderMode_Scale, _(MSG_SCALED));
1666 NewList(&advancedView_data->wpedabwd_Window_AdvancedViewTileModes);
1667 EntryElementRegister(&advancedView_data->wpedabwd_Window_AdvancedViewTileModes, IconWindowExt_ImageBackFill_TileMode_Float, _(MSG_FLOATING));
1668 EntryElementRegister(&advancedView_data->wpedabwd_Window_AdvancedViewTileModes, IconWindowExt_ImageBackFill_TileMode_Fixed, _(MSG_FIXED));
1670 D(bug("[WPEditor] WPEditor__OM_NEW: 'Advanced' Window Object @ 0x%p\n", advancedView_data->wpedabwd_Window_WindowObj));
1672 data->wped_AdvancedViewSettings_WindowData = advancedView_data;
1674 data->wped_ViewSettings_GroupObj = _WP_ViewSettings_GroupObj;
1675 data->wped_ViewSettings_SpacerObj = _WP_ViewSettings_SpacerObj;
1677 data->wped_c_NavigationMethod = _WP_Navigation_TypeObj;
1678 data->wped_cm_ToolbarEnabled = _WP_Toolbar_EnabledObj;
1679 #if defined(DEBUG_CHANGESCREENTITLE)
1680 data->wped_s_screentitle =_WP_Navigator_ScreenTitleObj;
1681 #endif
1682 #if defined(DEBUG_NETWORKBROWSER)
1683 data->wped_cm_EnableNetworkBrowser = _WP_NetworkBrowser_EnabledObj;
1684 #endif
1685 #if defined(DEBUG_SHOWUSERFILES)
1686 data->wped_cm_EnableUserFiles = _WP_UserFiles_ShowFileFolderObj;
1687 #endif
1689 data->wped_toolbarpreview = _WP_Toolbar_PreviewObj;
1691 data->wped_toolbarGroup = _WP_Toolbar_GroupObj;
1692 data->wped_Hook_CloseAdvancedOptions.h_Entry = ( HOOKFUNC )WandererPrefs_Hook_CloseAdvancedOptionsFunc;
1694 //-- Setup notifications -------------------------------------------
1695 /* "TODO: The toolbar class will become an external module to wanderer with its own prefs" */
1696 #if defined(DEBUG_TOOLBARINTERNAL)
1697 /* Enhanced navigation depends on the toolbar class for
1698 control - so we disable it if the toolbar isnt available! */
1699 DoMethod
1701 data->wped_cm_ToolbarEnabled, MUIM_Notify, MUIA_Selected, FALSE,
1702 (IPTR)data->wped_c_NavigationMethod, 3, MUIM_Set, MUIA_Cycle_Active, 0
1705 DoMethod
1707 data->wped_cm_ToolbarEnabled, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1708 (IPTR)data->wped_c_NavigationMethod, 3, MUIM_Set, MUIA_Disabled, MUIV_NotTriggerValue
1711 /* Only enable the preview if the toolbar is enabled */
1712 DoMethod
1714 data->wped_cm_ToolbarEnabled, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1715 (IPTR)data->wped_toolbarpreview, 3, MUIM_Set, MUIA_Disabled, MUIV_NotTriggerValue
1718 DoMethod
1720 data->wped_cm_ToolbarEnabled, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1721 (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
1724 DoMethod
1726 data->wped_c_NavigationMethod, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
1727 (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
1730 #endif
1731 #if defined(DEBUG_NETWORKBROWSER)
1732 DoMethod
1734 data->wped_cm_EnableNetworkBrowser, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1735 (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
1737 #endif
1738 #if defined(DEBUG_SHOWUSERFILES)
1739 DoMethod
1741 data->wped_cm_EnableUserFiles, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1742 (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
1744 #endif
1746 if (data->wped_AdvancedViewSettings_WindowData)
1748 DoMethod
1750 data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MultiLineNo, MUIM_Notify, MUIA_Disabled, TRUE,
1751 (IPTR)data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MultiLineNo, 3, MUIM_Set, MUIA_String_Integer, 1
1754 DoMethod
1756 data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MultiLineNo, MUIM_Notify, MUIA_Disabled, FALSE,
1757 (IPTR)data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MultiLineNo, 3, MUIM_Set, MUIA_String_Integer, 2
1760 DoMethod
1762 data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_TextMultiLine, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
1763 (IPTR)data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_IconLabel_MultiLineNo, 3, MUIM_Set, MUIA_Disabled, MUIV_NotTriggerValue
1766 DoMethod
1768 data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_UseObj, MUIM_Notify, MUIA_Pressed, FALSE,
1769 (IPTR)self, 3, MUIM_CallHook, &data->wped_Hook_CloseAdvancedOptions, TRUE
1772 DoMethod
1774 data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_CancelObj, MUIM_Notify, MUIA_Pressed, FALSE,
1775 (IPTR)self, 3, MUIM_CallHook, &data->wped_Hook_CloseAdvancedOptions, FALSE
1778 DoMethod
1780 data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_WindowObj, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
1781 (IPTR)self, 3, MUIM_CallHook, &data->wped_Hook_CloseAdvancedOptions, FALSE
1786 /*--------------------*/
1788 /*Initialization and setup of _wpeditor_intern_ViewSettings----------*/
1789 /*_wpeditor_intern_ViewSettings is a
1790 list of objects attached to
1791 _WP_ViewSettings_GroupObj;
1793 NewList(&_wpeditor_intern_ViewSettings);
1795 WPEditor__NewViewSettingObjects("Workbench", TRUE);//add a setting node
1796 WPEditor__NewViewSettingObjects("Drawer", TRUE);//add a setting node
1797 #if defined(DEBUG_NEWVIEWSETTINGS)
1798 WPEditor__NewViewSettingObjects("Screen", TRUE);//add a setting node
1799 WPEditor__NewViewSettingObjects("Toolbar", FALSE);//add a setting node
1800 #endif
1802 struct WPEditor_ViewSettingsObject *_viewSettings_Node = NULL;
1804 ForeachNode(&_wpeditor_intern_ViewSettings, _viewSettings_Node)
1806 Object *thisViewImspecGrp = NULL;
1807 Object *thisViewAdvancedGrp = NULL;
1809 D(bug("[WPEditor] WPEditor__OM_NEW: Adding ViewSetting Objects for '%s' to Prefs GUI ..\n", _viewSettings_Node->wpedbo_ViewName));
1811 thisViewImspecGrp = (Object *)GroupObject,
1812 MUIA_Group_SameSize, FALSE,
1813 MUIA_Frame, MUIV_Frame_None,
1814 MUIA_Group_Columns, 2,
1815 Child, (IPTR) HVSpace,
1816 Child, (IPTR) HVSpace,
1817 Child, (IPTR) Label1(_viewSettings_Node->wpedbo_ViewName),
1818 Child, (IPTR) _viewSettings_Node->wpedbo_ImageSpecObject,
1819 Child, (IPTR) HVSpace,
1820 Child, (IPTR) HVSpace,
1821 End;
1823 if ((thisViewImspecGrp) && (data->wped_FirstBGImSpecObj == NULL))
1824 data->wped_FirstBGImSpecObj = thisViewImspecGrp;
1826 if (_viewSettings_Node->wpedbo_AdvancedOptionsObject)
1828 thisViewAdvancedGrp = (Object *)GroupObject,
1829 MUIA_Group_SameSize, FALSE,
1830 MUIA_Frame, MUIV_Frame_None,
1831 MUIA_Group_Columns, 2,
1832 Child, (IPTR) HVSpace,
1833 Child, (IPTR) _viewSettings_Node->wpedbo_AdvancedOptionsObject,
1834 End;
1836 if ((thisViewAdvancedGrp) && (data->wped_FirstBGAdvancedObj == NULL))
1837 data->wped_FirstBGAdvancedObj = thisViewAdvancedGrp;
1840 if ((thisViewImspecGrp) &&
1841 ((!(_viewSettings_Node->wpedbo_AdvancedOptionsObject)) ||
1842 ((_viewSettings_Node->wpedbo_AdvancedOptionsObject) && (thisViewAdvancedGrp))))
1844 D(bug("[WPEditor] WPEditor__OM_NEW: GUI Objects Created ..\n"));
1846 if (DoMethod(_WP_ViewSettings_GroupObj, MUIM_Group_InitChange))
1848 DoMethod(_WP_ViewSettings_GroupObj, OM_ADDMEMBER, thisViewImspecGrp);
1850 if (_viewSettings_Node->wpedbo_AdvancedOptionsObject)
1851 DoMethod(_WP_ViewSettings_GroupObj, OM_ADDMEMBER, thisViewAdvancedGrp);
1853 DoMethod(_WP_ViewSettings_GroupObj, MUIM_Group_ExitChange);
1856 D(bug("[WPEditor] WPEditor__OM_NEW: GUI Objects inserted in Prefs GUI ..\n"));
1857 /* Set our ViewSetting(s) notifications */
1858 DoMethod
1860 _viewSettings_Node->wpedbo_ImageSpecObject,
1861 MUIM_Notify, MUIA_Imagedisplay_Spec, MUIV_EveryTime,
1862 (IPTR)self, 3, MUIM_CallHook,
1863 &_viewSettings_Node->wpedbo_Hook_CheckImage, _viewSettings_Node
1866 if (_viewSettings_Node->wpedbo_AdvancedOptionsObject)
1868 _viewSettings_Node->wpedbo_Hook_OpenAdvancedOptions.h_Entry = ( HOOKFUNC )WandererPrefs_Hook_OpenAdvancedOptionsFunc;
1870 DoMethod
1872 _viewSettings_Node->wpedbo_AdvancedOptionsObject, MUIM_Notify, MUIA_Pressed, FALSE,
1873 (IPTR)self, 3, MUIM_CallHook, &_viewSettings_Node->wpedbo_Hook_OpenAdvancedOptions, _viewSettings_Node
1876 D(bug("[WPEditor] WPEditor__OM_NEW: GUI Objects Notifications set ..\n"));
1878 else
1880 D(bug("[WPEditor] WPEditor__OM_NEW: Failed to create objects ..\n"));
1881 if (thisViewAdvancedGrp) DoMethod(thisViewAdvancedGrp, OM_DISPOSE);
1883 if (thisViewImspecGrp) DoMethod(thisViewImspecGrp, OM_DISPOSE);
1887 else
1889 D(bug("[WPEditor] WPEditor__OM_NEW: Failed to create GUI ..\n"));
1890 if (_WP_AdvancedViewWindow) DoMethod(_WP_AdvancedViewWindow, OM_DISPOSE);
1891 if (self) DoMethod(self, OM_DISPOSE);
1893 self = NULL;
1895 /*--------------*/
1897 return self;
1901 /*BOOL WPEditor_ProccessGlobalChunk(): read a TagItem global_chunk (from global setting)
1902 *and memorize its value into correspondent attribute of an object of the gui...;
1904 BOOL WPEditor_ProccessGlobalChunk(Class *CLASS, Object *self, struct TagItem32 *global_chunk, IPTR chunk_size)
1906 SETUP_WPEDITOR_INST_DATA;
1908 int i = 0, tag_count = (chunk_size / sizeof(struct TagItem32));
1909 BOOL cont = TRUE;
1910 //BOOL state = FALSE;
1912 D(bug("[WPEditor] WPEditor_ProccessGlobalChunk(%d tags)\n", tag_count));
1914 for (i = 0; i < tag_count; i++)
1916 if (cont)
1918 /* prefs file is stored in little endian */
1919 switch ((int)AROS_LE2LONG(global_chunk[i].ti_Tag))
1921 case MUIA_IconWindow_WindowNavigationMethod:
1923 D(bug("[WPEditor] WPEditor_ProccessGlobalChunk: Tag %d = MUIA_IconWindow_WindowNavigationMethod, val = %d\n", i, AROS_LE2LONG(global_chunk[i].ti_Data)));
1924 SET(data->wped_c_NavigationMethod, MUIA_Cycle_Active, (IPTR)AROS_LE2LONG(global_chunk[i].ti_Data));
1925 break;
1927 #if defined(DEBUG_SHOWUSERFILES)
1928 case MUIA_IconWindowExt_UserFiles_ShowFilesFolder:
1930 D(bug("[WPEditor] WPEditor_ProccessGlobalChunk: Tag %d = MUIA_IconWindowExt_UserFiles_ShowFilesFolder, val = %d\n", i, AROS_LE2LONG(global_chunk[i].ti_Data)));
1931 SET(data->wped_cm_EnableUserFiles, MUIA_Selected, (BOOL)AROS_LE2LONG(global_chunk[i].ti_Data));
1932 break;
1934 #endif
1935 case TAG_DONE:
1937 D(bug("[WPEditor] WPEditor_ProccessGlobalChunk: Tag %d = TAG_DONE!!\n", i));
1938 cont = FALSE;
1939 break;
1945 return TRUE;
1948 #if defined(DEBUG_NETWORKBROWSER)
1949 BOOL WPEditor_ProccessNetworkChunk(Class *CLASS, Object *self, UBYTE *_viewSettings_Chunk)
1951 SETUP_WPEDITOR_INST_DATA;
1953 struct TagItem32 *network_tags = _viewSettings_Chunk;
1954 SET(data->wped_cm_EnableNetworkBrowser, MUIA_Selected, AROS_LE2LONG(network_tags[0].ti_Data));
1956 return TRUE;
1958 #endif
1960 #if defined(DEBUG_CHANGESCREENTITLE)
1961 BOOL WPEditor_ProccessScreenTitleChunk(Class *CLASS, Object *self, UBYTE *_ScreenTitle_Chunk)
1963 SETUP_WPEDITOR_INST_DATA;
1966 D(bug("[WPEditor] WPEditor_ProccessScreenTitleChunk: string readed = %s\n", _ScreenTitle_Chunk));
1967 SET(data->wped_s_screentitle, MUIA_String_Contents, _ScreenTitle_Chunk);
1968 D(bug("[WPEditor] WPEditor_ProccessScreenTitleChunk: string setted = %s\n", _ScreenTitle_Chunk));
1970 return TRUE;
1972 #endif
1974 /*Renabled WPEditor_ProccessViewSettingsChunk() as Nic Andrews (nicja@yahoo.com) has asked...;
1975 *Please report here what do it do this function ;)
1978 BOOL WPEditor_ProccessViewSettingsChunk(Class *CLASS, Object *self, char *_viewSettings_Name, UBYTE *_viewSettings_Chunk, IPTR chunk_size)
1980 SETUP_WPEDITOR_INST_DATA;
1982 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk('%s')\n", _viewSettings_Name));
1983 //BOOL _viewSettings_NodeFound = FALSE;//unused
1984 struct WPEditor_ViewSettingsObject *_viewSettings_Node = NULL;
1986 _viewSettings_Node = WPEditor__FindViewSettingObjects(_viewSettings_Name);
1988 if (_viewSettings_Node)
1990 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk: Updating Existing node @ 0x%p\n", _viewSettings_Node));
1992 else
1994 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk: Creating new Objects for '%s'\n", _viewSettings_Name));
1995 if (((strcmp(_viewSettings_Name, "Workbench")) == 0) ||
1996 ((strcmp(_viewSettings_Name, "Drawer")) == 0) ||
1997 ((strcmp(_viewSettings_Name, "Screen")) == 0))
1998 _viewSettings_Node = WPEditor__NewViewSettingObjects(_viewSettings_Name, TRUE);
1999 else
2000 _viewSettings_Node = WPEditor__NewViewSettingObjects(_viewSettings_Name, FALSE);
2002 Object *thisViewImspecGrp = NULL;
2003 Object *thisViewAdvancedGrp = NULL;
2005 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk: Adding ViewSetting Objects for '%s' to Prefs GUI ..\n", _viewSettings_Node->wpedbo_ViewName));
2007 thisViewImspecGrp = (Object *)GroupObject,
2008 MUIA_Group_SameSize, FALSE,
2009 MUIA_Frame, MUIV_Frame_None,
2010 MUIA_Group_Columns, 2,
2012 Child, (IPTR) HVSpace,
2013 Child, (IPTR) HVSpace,
2015 Child, (IPTR) Label1(_viewSettings_Node->wpedbo_ViewName),
2016 Child, (IPTR) _viewSettings_Node->wpedbo_ImageSpecObject,
2017 Child, (IPTR) HVSpace,
2018 Child, (IPTR) HVSpace,
2019 End;
2021 if (_viewSettings_Node->wpedbo_AdvancedOptionsObject)
2022 thisViewAdvancedGrp = (Object *)GroupObject,
2023 MUIA_Group_SameSize, FALSE,
2024 MUIA_Frame, MUIV_Frame_None,
2025 MUIA_Group_Columns, 2,
2027 Child, (IPTR) HVSpace,
2028 Child, (IPTR) _viewSettings_Node->wpedbo_AdvancedOptionsObject,
2029 End;
2031 if ((thisViewImspecGrp) &&
2032 ((!(_viewSettings_Node->wpedbo_AdvancedOptionsObject)) ||
2033 ((_viewSettings_Node->wpedbo_AdvancedOptionsObject) && (thisViewAdvancedGrp))))
2035 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk: GUI Objects Created ..\n"));
2037 if (DoMethod(data->wped_ViewSettings_GroupObj, MUIM_Group_InitChange))
2039 DoMethod(data->wped_ViewSettings_GroupObj, OM_ADDMEMBER, thisViewImspecGrp);
2041 if (_viewSettings_Node->wpedbo_AdvancedOptionsObject)
2042 DoMethod(data->wped_ViewSettings_GroupObj, OM_ADDMEMBER, thisViewAdvancedGrp);
2044 DoMethod(data->wped_ViewSettings_GroupObj, MUIM_Group_ExitChange);
2047 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk: GUI Objects inserted in Prefs GUI ..\n"));
2049 DoMethod (
2050 _viewSettings_Node->wpedbo_ImageSpecObject,
2051 MUIM_Notify, MUIA_Imagedisplay_Spec, MUIV_EveryTime,
2052 (IPTR)self, 3, MUIM_CallHook,
2053 &_viewSettings_Node->wpedbo_Hook_CheckImage, _viewSettings_Node
2056 if (_viewSettings_Node->wpedbo_AdvancedOptionsObject)
2058 _viewSettings_Node->wpedbo_Hook_OpenAdvancedOptions.h_Entry = ( HOOKFUNC )WandererPrefs_Hook_OpenAdvancedOptionsFunc;
2060 DoMethod
2062 _viewSettings_Node->wpedbo_AdvancedOptionsObject, MUIM_Notify, MUIA_Pressed, FALSE,
2063 (IPTR)self, 3, MUIM_CallHook, &_viewSettings_Node->wpedbo_Hook_OpenAdvancedOptions, _viewSettings_Node
2067 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk: GUI Objects Notifications set ..\n"));
2069 else
2071 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk: Failed to create objects ..\n"));
2072 if (thisViewAdvancedGrp) DoMethod(thisViewAdvancedGrp, OM_DISPOSE);
2074 if (thisViewImspecGrp) DoMethod(thisViewImspecGrp, OM_DISPOSE);
2078 if ((_viewSettings_Node->wpedbo_AdvancedOptionsObject) && (chunk_size > (strlen(_viewSettings_Chunk) + 1)))
2080 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk: Chunk has options Tag data ..\n"));
2081 UBYTE _viewSettings_TagOffset = ((strlen(_viewSettings_Chunk) + 1)/4);
2083 if ((_viewSettings_TagOffset * 4) != (strlen(_viewSettings_Chunk) + 1))
2085 _viewSettings_TagOffset = (_viewSettings_TagOffset + 1) * 4;
2086 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk: String length unalined - rounding up (length %d, rounded %d) \n", strlen(_viewSettings_Chunk) + 1, _viewSettings_TagOffset ));
2088 else
2090 _viewSettings_TagOffset = _viewSettings_TagOffset * 4;
2091 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk: String length doesnt need aligned (length %d) \n", strlen(_viewSettings_Chunk) + 1));
2094 if (_viewSettings_Node->wpedbo_Options)
2096 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk: Freeing old ViewSetting Tag data @ 0x%p\n", _viewSettings_Node->wpedbo_Options));
2097 FreeVec(_viewSettings_Node->wpedbo_Options);
2100 int tag_count = (chunk_size - _viewSettings_TagOffset)/sizeof(struct TagItem32);
2102 _viewSettings_Node->wpedbo_Options = AllocVec((tag_count + 1) * sizeof(struct TagItem32),
2103 MEMF_ANY|MEMF_CLEAR
2105 if (_viewSettings_Node->wpedbo_Options)
2107 D(bug("[WPEditor] WPEditor_ProccessViewSettingsChunk: Allocated new Tag storage @ 0x%p [%d bytes] \n", _viewSettings_Node->wpedbo_Options, chunk_size - _viewSettings_TagOffset));
2108 CopyMem(_viewSettings_Chunk + _viewSettings_TagOffset, _viewSettings_Node->wpedbo_Options, tag_count * sizeof(struct TagItem32));
2109 _viewSettings_Node->wpedbo_Options[tag_count].ti_Tag = TAG_DONE;
2113 SET(_viewSettings_Node->wpedbo_ImageSpecObject, MUIA_Imagedisplay_Spec, _viewSettings_Chunk);
2115 return TRUE;
2119 /*IPTR WPEditor__MUIM_PrefsEditor_ImportFH(): definition of an abstract function from
2120 *MUIC_PrefsEditor; This function basically read the iff prefs file and show in
2121 *Wanderer prefs window the data readed...;
2123 IPTR WPEditor__MUIM_PrefsEditor_ImportFH
2125 Class *CLASS, Object *self,
2126 struct MUIP_PrefsEditor_ImportFH *message
2129 //SETUP_WPEDITOR_INST_DATA;//unused
2131 D(struct ContextNode *context);
2132 struct IFFHandle *handle;
2133 BOOL success = TRUE;
2134 LONG error;
2135 IPTR iff_parse_mode = IFFPARSE_SCAN;
2136 UBYTE chunk_buffer[WP_IFF_CHUNK_BUFFER_SIZE];
2137 STRPTR buffer = AllocVec(TOOLBAR_PREFSSIZE, MEMF_ANY | MEMF_CLEAR);
2139 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH()\n"));
2141 if (!(handle = AllocIFF()))
2142 return FALSE;
2144 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: Iff current handle 0x%p, msg handle 0x%p\n", handle->iff_Stream, message->fh));
2146 handle->iff_Stream = (IPTR) message->fh;
2147 InitIFFasDOS(handle);
2149 if ((error = OpenIFF(handle, IFFF_READ)) == 0)
2151 if ((error = StopChunk(handle, ID_PREF, ID_WANDR)) == 0)
2155 if ((error = ParseIFF(handle, iff_parse_mode)) == 0)
2157 D(context = CurrentChunk(handle));
2158 iff_parse_mode = IFFPARSE_STEP;
2160 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: Context 0x%p\n", context));
2162 if ((error = ReadChunkBytes(handle, chunk_buffer, WP_IFF_CHUNK_BUFFER_SIZE)))
2164 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: ReadChunkBytes() Chunk matches Prefs Header size ..\n"));
2165 struct WandererPrefsIFFChunkHeader *this_header = (struct WandererPrefsIFFChunkHeader *) chunk_buffer;
2166 char *this_chunk_name = NULL;
2167 /* prefs file is stored in little endian */
2168 IPTR this_chunk_size = AROS_LE2LONG(this_header->wpIFFch_ChunkSize);
2171 if ((this_chunk_name = AllocVec(strlen(this_header->wpIFFch_ChunkType) +1, MEMF_ANY|MEMF_CLEAR)))
2173 strcpy(this_chunk_name, this_header->wpIFFch_ChunkType);
2174 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: Prefs Header for '%s' data size %d bytes\n", this_chunk_name, this_chunk_size));
2176 if ((error = ParseIFF(handle, IFFPARSE_STEP)) == IFFERR_EOC)
2178 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: End of header chunk ..\n"));
2180 if ((error = ParseIFF(handle, IFFPARSE_STEP)) == 0)
2182 D(context = CurrentChunk(handle));
2184 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: Context 0x%p\n", context));
2186 error = ReadChunkBytes(
2187 handle,
2188 chunk_buffer,
2189 this_chunk_size
2192 if (error == this_chunk_size)
2194 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: ReadChunkBytes() Chunk matches Prefs Data size .. (%d)\n", error));
2195 if ((strcmp(this_chunk_name, "wanderer:global")) == 0)
2197 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: Process data for wanderer global config chunk ..\n"));
2198 WPEditor_ProccessGlobalChunk(CLASS, self,(struct TagItem32 *) chunk_buffer, this_chunk_size);
2200 #if defined(DEBUG_NETWORKBROWSER)
2201 else if ((strcmp(this_chunk_name, "wanderer:network")) == 0)
2203 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: Process data for wanderer network config chunk ..\n"));
2204 WPEditor_ProccessNetworkChunk(CLASS, self, chunk_buffer);
2206 #endif
2208 #if defined(DEBUG_CHANGESCREENTITLE)
2209 else if ((strcmp(this_chunk_name, "wanderer:screentitle")) == 0)
2211 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: Process data for wanderer screentitle config chunk ..\n"));
2212 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: Chunk screentitle Data size .. (%d)\n", error));
2213 WPEditor_ProccessScreenTitleChunk(CLASS, self, chunk_buffer);
2214 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: Data for wanderer screentitle config chunk PROCESSED..\n"));
2216 #endif
2217 else if ((strncmp(this_chunk_name, "wanderer:viewsettings", strlen("wanderer:viewsettings"))) == 0)
2219 char *view_name = this_chunk_name + strlen("wanderer:viewsettings") + 1;
2220 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: Process data for wanderer background config chunk '%s'..\n", view_name));
2221 WPEditor_ProccessViewSettingsChunk(CLASS, self, view_name, chunk_buffer, this_chunk_size);
2224 }//END if (error == this_chunk_size)
2226 if ((error = ParseIFF(handle, IFFPARSE_STEP)) == IFFERR_EOC)
2228 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: End of Data chunk ..\n"));
2230 }//END if ((error = ParseIFF(handle, IFFPARSE_STEP)) == 0)
2231 }//END if ((error = ParseIFF(handle, IFFPARSE_STEP)) == IFFERR_EOC)
2232 }//END if (this_chunk_name)
2233 }//END if ((error = ReadChunkBytes(handle, chunk_buffer, WP_IFF_CHUNK_BUFFER_SIZE)))
2234 }//END if ((error = ParseIFF(handle, iff_parse_mode)) == 0)
2235 else
2237 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: ParseIFF() failed, returncode %ld!\n", error));
2238 //success = FALSE;// this brokes cancel button
2239 //break;
2242 } while (error != IFFERR_EOF);
2246 else
2248 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ImportFH: StopChunk() failed, returncode %ld!\n", error));
2249 success = FALSE;// this brokes cancel button
2250 }//END if ((error = StopChunk(handle, ID_PREF, ID_WANDR)) == 0)
2252 CloseIFF(handle);
2254 else
2256 D(bug("[WPEditor] Failed to open stream!, returncode %ld!\n", error));
2257 //ShowError(_(MSG_CANT_OPEN_STREAM));
2258 success = FALSE;
2259 }//END if ((error = OpenIFF(handle, IFFF_READ)) == 0)
2261 //Close((APTR)handle->iff_Stream);
2262 FreeIFF(handle);
2264 /* Importing toolbar preferences */
2265 if (GetVar(toolbar_PrefsFile, buffer, TOOLBAR_PREFSSIZE, GVF_GLOBAL_ONLY) != -1)
2267 SETUP_WPEDITOR_INST_DATA;
2269 if ((strcasecmp(buffer, "True")) == 0)
2271 SET(data->wped_cm_ToolbarEnabled, MUIA_Selected, TRUE);
2273 else
2275 SET(data->wped_cm_ToolbarEnabled, MUIA_Selected, FALSE);
2278 FreeVec(buffer);
2280 return success;
2283 #define SAVEVIEWSETTINGSTAG(tag, defvalue) \
2284 _viewSettings_TagList[_viewSettings_TagCount].ti_Tag = AROS_LONG2LE(tag); \
2285 _viewSettings_TagList[_viewSettings_TagCount].ti_Data = AROS_LONG2LE(GetTag32Data(tag, defvalue, _viewSettings_Node->wpedbo_Options)); \
2286 _viewSettings_TagCount += 1;
2289 /*IPTR WPEditor__MUIM_PrefsEditor_ExportFH(): definition of an abstract function from
2290 *MUIC_PrefsEditor; This function basically memorized in the correspondent iff prefs file
2291 *of Wanderer prefs the changes made with Wanderer prefs window...;
2293 IPTR WPEditor__MUIM_PrefsEditor_ExportFH
2295 Class *CLASS, Object *self,
2296 struct MUIP_PrefsEditor_ExportFH *message
2299 SETUP_WPEDITOR_INST_DATA;
2301 struct IFFHandle *handle;
2302 struct PrefHeader header = { 0 };
2303 struct WandererPrefsIFFChunkHeader wanderer_chunkdata = { };
2304 BOOL success = TRUE;
2305 LONG error = 0;
2307 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH()\n"));
2309 if ((handle = AllocIFF()))
2311 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Current IFF handle 0x%p, msg handle 0x%p\n", handle->iff_Stream, message->fh));
2313 handle->iff_Stream = (IPTR) message->fh;
2315 InitIFFasDOS(handle);
2317 if (!(error = OpenIFF(handle, IFFF_WRITE))) /* NULL = successful! */
2319 //BYTE i = 0;
2321 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Write IFF FORM Header Chunk ... \n")); /* FIXME: IFFSIZE_UNKNOWN? */
2322 if ((error = PushChunk(handle, ID_PREF, ID_FORM, IFFSIZE_UNKNOWN)) != 0)
2324 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: IFF FORM Header Chunk : Error! %d \n", error));
2325 goto exportFH_CloseIFF;
2328 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Write Preference File Header Chunk ... \n")); /* FIXME: IFFSIZE_UNKNOWN? */
2329 if ((error = PushChunk(handle, ID_PREF, ID_PRHD, IFFSIZE_UNKNOWN)) == 0)
2331 header.ph_Version = PHV_CURRENT;
2332 header.ph_Type = 0;
2334 WriteChunkBytes(handle, &header, sizeof(struct PrefHeader));
2336 if ((error = PopChunk(handle)) != 0)
2338 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Preference File Header PopChunk() = %ld\n", error));
2339 goto exportFH_CloseFORM;
2342 else
2344 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Preference File Header Chunk : Error! %d \n", error));
2345 goto exportFH_CloseFORM;
2348 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Prepare 'global' Wanderer Prefs Data Chunk Data ... \n"));
2349 /* save toolbar state*/
2350 struct TagItem32 *_wp_GlobalTags = AllocVec((256 * sizeof(struct TagItem32)), MEMF_ANY|MEMF_CLEAR);
2351 ULONG _wp_GlobalTagCounter = 0;
2352 /* helper to convert to little endian */
2353 STACKED IPTR ti_Data = 0;
2355 // save navigation bahaviour
2356 _wp_GlobalTags[_wp_GlobalTagCounter].ti_Tag = AROS_LONG2LE(MUIA_IconWindow_WindowNavigationMethod);
2357 GET(data->wped_c_NavigationMethod, MUIA_Cycle_Active, &ti_Data);
2358 _wp_GlobalTags[_wp_GlobalTagCounter].ti_Data = AROS_LONG2LE(ti_Data);
2359 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'global' MUIA_IconWindow_WindowNavigationMethod @ Tag %d, data = %d\n", _wp_GlobalTagCounter, ti_Data));
2360 _wp_GlobalTagCounter += 1;
2362 #if defined(DEBUG_SHOWUSERFILES)
2363 _wp_GlobalTags[_wp_GlobalTagCounter].ti_Tag = AROS_LONG2LE(MUIA_IconWindowExt_UserFiles_ShowFilesFolder);
2364 GET(data->wped_cm_EnableUserFiles, MUIA_Selected, &ti_Data);
2365 _wp_GlobalTags[_wp_GlobalTagCounter].ti_Data = AROS_LONG2LE(ti_Data);
2366 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'global' MUIA_IconWindowExt_UserFiles_ShowFilesFolder @ Tag %d, data = %d\n", _wp_GlobalTagCounter, ti_Data));
2367 _wp_GlobalTagCounter += 1;
2368 #endif
2370 _wp_GlobalTags[_wp_GlobalTagCounter].ti_Tag = AROS_LONG2LE(TAG_DONE);
2371 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'global' Marked Tag %d as TAG_DONE\n", _wp_GlobalTagCounter));
2373 ULONG globaldatasize = (_wp_GlobalTagCounter + 1) * sizeof(struct TagItem32);
2375 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Write 'global' Wanderer Prefs Header Chunk ... \n"));
2376 if ((error = PushChunk(handle, ID_PREF, ID_WANDR, sizeof(struct WandererPrefsIFFChunkHeader))) == 0)
2378 sprintf(wanderer_chunkdata.wpIFFch_ChunkType, "%s" , "wanderer:global");
2379 wanderer_chunkdata.wpIFFch_ChunkSize = AROS_LONG2LE(globaldatasize);
2381 WriteChunkBytes(handle, &wanderer_chunkdata, sizeof(struct WandererPrefsIFFChunkHeader));
2383 if ((error = PopChunk(handle)) != 0)
2385 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'global' Header PopChunk() = %ld\n", error));
2386 goto exportFH_CloseFORM;
2389 else
2391 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'global' Wanderer Prefs Header Chunk : Error! %d \n", error));
2392 goto exportFH_CloseFORM;
2395 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Write 'global' Wanderer Prefs Data Chunk ... \n"));
2396 if ((error = PushChunk(handle, ID_PREF, ID_WANDR, globaldatasize)) == 0)
2398 error = WriteChunkBytes(handle, _wp_GlobalTags, globaldatasize);
2399 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'global' Data Chunk | Wrote %d bytes (data size = %d bytes)\n", error, globaldatasize));
2400 if ((error = PopChunk(handle)) != 0)
2402 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'global' PopChunk() = %ld\n", error));
2403 goto exportFH_CloseFORM;
2405 FreeVec(_wp_GlobalTags);
2407 else
2409 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'global' PushChunk() = %ld failed\n", error));
2410 goto exportFH_CloseFORM;
2413 #if defined(DEBUG_NETWORKBROWSER)
2414 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Write 'network' Wanderer Prefs Header Chunk ... \n"));
2415 if ((error = PushChunk(handle, ID_PREF, ID_WANDR, sizeof(struct WandererPrefsIFFChunkHeader))) == 0)
2417 sprintf(wanderer_chunkdata.wpIFFch_ChunkType, "%s" , "wanderer:network");
2418 wanderer_chunkdata.wpIFFch_ChunkSize = AROS_LONG2LE(sizeof(struct TagItem));
2420 WriteChunkBytes(handle, &wanderer_chunkdata, sizeof(struct WandererPrefsIFFChunkHeader));
2422 if ((error = PopChunk(handle)) != 0)
2424 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'network' Header PopChunk() = %ld\n", error));
2425 goto exportFH_CloseFORM;
2428 else
2430 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'network' Wanderer Prefs Header Chunk : Error! %d \n", error));
2431 goto exportFH_CloseFORM;
2434 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Write 'network' Wanderer Prefs Data Chunk ... \n"));
2435 if ((error = PushChunk(handle, ID_PREF, ID_WANDR, sizeof(struct TagItem))) == 0)
2437 struct TagItem32 __wp_networkconfig[2];
2439 /* save network options*/
2440 __wp_networkconfig[0].ti_Tag = MUIA_IconWindowExt_NetworkBrowser_Show;
2441 GET(data->wped_cm_EnableNetworkBrowser, MUIA_Selected, &ti_Data);
2442 __wp_networkconfig[0].ti_Data = AROS_LONG2LE(ti_Data);
2444 error = WriteChunkBytes(handle, __wp_networkconfig, sizeof(struct TagItem32));
2445 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'network' Data Chunk | Wrote %d bytes (data size = %d bytes)\n", error, sizeof(struct TagItem)));
2446 if ((error = PopChunk(handle)) != 0)
2448 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'network' PopChunk() = %ld\n", error));
2449 goto exportFH_CloseFORM;
2452 else
2454 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'network' PushChunk() = %ld failed\n", error));
2455 goto exportFH_CloseFORM;
2457 #endif
2459 #if defined(DEBUG_CHANGESCREENTITLE)
2460 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Write 'screentitle' Wanderer Prefs Header Chunk ... \n"));
2461 if ((error = PushChunk(handle, ID_PREF, ID_WANDR, sizeof(struct WandererPrefsIFFChunkHeader))) == 0)
2463 sprintf(wanderer_chunkdata.wpIFFch_ChunkType, "%s" , "wanderer:screentitle");
2464 UBYTE *screentitlestr = NULL;
2466 GET(data->wped_s_screentitle, MUIA_String_Contents, &screentitlestr);
2468 wanderer_chunkdata.wpIFFch_ChunkSize = AROS_LONG2LE(strlen(screentitlestr) + 1);
2470 WriteChunkBytes(handle, &wanderer_chunkdata, sizeof(struct WandererPrefsIFFChunkHeader));
2472 if ((error = PopChunk(handle)) != 0)
2474 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'screentitle' Header PopChunk() = %ld\n", error));
2475 goto exportFH_CloseFORM;
2478 else
2480 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'screentitle' Wanderer Prefs Header Chunk : Error! %d \n", error));
2481 goto exportFH_CloseFORM;
2484 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Write 'screentitle' Wanderer Prefs Data Chunk ... \n"));
2485 if ((error = PushChunk(handle, ID_PREF, ID_WANDR, IFFSIZE_UNKNOWN)) == 0)
2487 // save screentitle options
2488 UBYTE *screentitlestr = NULL;
2490 GET(data->wped_s_screentitle, MUIA_String_Contents, &screentitlestr);
2491 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'screentitle' string to write %s\n", screentitlestr));
2492 error = WriteChunkBytes(handle, screentitlestr, strlen(screentitlestr) + 1);
2493 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'screentitle' string written %s\n", screentitlestr));
2494 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'screentitle' Data Chunk | Wrote %d bytes\n", error));
2495 if ((error = PopChunk(handle)) != 0)
2497 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'screentitle' PopChunk() = %ld\n", error));
2498 goto exportFH_CloseFORM;
2501 else
2503 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'screentitle' PushChunk() = %ld failed\n", error));
2504 goto exportFH_CloseFORM;
2506 #endif
2508 struct WPEditor_ViewSettingsObject *_viewSettings_Node = NULL;
2509 ForeachNode(&_wpeditor_intern_ViewSettings, _viewSettings_Node)
2511 IPTR _viewSettings_ChunkSize = 0, _viewSettings_TagCount = 0;
2512 struct TagItem32 _viewSettings_TagList[WP_MAX_BG_TAG_COUNT];
2514 sprintf(wanderer_chunkdata.wpIFFch_ChunkType, "%s.%s" , "wanderer:viewsettings", _viewSettings_Node->wpedbo_ViewName);
2516 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Write 'ViewSettings' Wanderer Prefs Header Chunk for '%s' ... \n", _viewSettings_Node->wpedbo_ViewName));
2518 char *background_value = NULL;
2519 GET(_viewSettings_Node->wpedbo_ImageSpecObject, MUIA_Imagedisplay_Spec, &background_value);
2521 if (background_value)
2523 PushChunk(handle, ID_PREF, ID_WANDR, sizeof(struct WandererPrefsIFFChunkHeader));
2525 UBYTE _viewSettings_TagOffset = ((strlen(background_value) + 1)/4);
2527 if ((_viewSettings_TagOffset * 4) != (strlen(background_value) + 1))
2529 _viewSettings_TagOffset = (_viewSettings_TagOffset + 1) * 4;
2530 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Write 'ViewSettings' String length unalined - rounding up (length %d, rounded %d) \n", strlen(background_value) + 1, _viewSettings_TagOffset ));
2532 else
2534 _viewSettings_TagOffset = _viewSettings_TagOffset * 4;
2535 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Write 'ViewSettings' String length doesnt need aligned (length %d) \n", strlen(background_value) + 1));
2538 _viewSettings_ChunkSize += _viewSettings_TagOffset;
2540 if (((_viewSettings_Node->wpedbo_AdvancedOptionsObject)) && (_viewSettings_Node->wpedbo_Options))
2542 //UBYTE *background_typepointer = background_value;
2543 UBYTE background_type = background_value[0] - 48;
2545 const struct TagItem32 *tstate = _viewSettings_Node->wpedbo_Options;
2546 struct TagItem32 *tag = NULL;
2548 switch (background_type)
2550 case 5:
2552 //Picture type -> store appropriate tags ..
2554 case 0:
2556 //Pattern type -> store appropriate tags ..
2557 _viewSettings_TagList[_viewSettings_TagCount].ti_Tag = MUIA_IconWindowExt_ImageBackFill_BGRenderMode;
2558 _viewSettings_TagList[_viewSettings_TagCount].ti_Data = GetTag32Data(MUIA_IconWindowExt_ImageBackFill_BGRenderMode, IconWindowExt_ImageBackFill_RenderMode_Tiled, tstate);
2559 _viewSettings_TagCount += 1;
2561 while ((tag = NextTag32Item(&tstate)) != NULL)
2563 switch (tag->ti_Tag)
2565 case MUIA_IconWindowExt_ImageBackFill_BGTileMode:
2566 case MUIA_IconWindowExt_ImageBackFill_BGXOffset:
2567 case MUIA_IconWindowExt_ImageBackFill_BGYOffset:
2568 _viewSettings_TagList[_viewSettings_TagCount].ti_Tag = tag->ti_Tag;
2569 _viewSettings_TagList[_viewSettings_TagCount].ti_Data = tag->ti_Data;
2570 _viewSettings_TagCount += 1;
2571 break;
2572 default:
2573 break;
2576 break;
2578 default:
2579 break;
2582 SAVEVIEWSETTINGSTAG(MUIA_IconList_IconListMode, ICON_LISTMODE_GRID);
2583 SAVEVIEWSETTINGSTAG(MUIA_IconList_LabelText_Mode, ICON_TEXTMODE_OUTLINE);
2584 SAVEVIEWSETTINGSTAG(MUIA_IconList_LabelText_MaxLineLen, ILC_ICONLABEL_MAXLINELEN_DEFAULT);
2586 #if defined(DEBUG_MULTLINE)
2587 SAVEVIEWSETTINGSTAG(MUIA_IconList_LabelText_MultiLine, 1);
2588 SAVEVIEWSETTINGSTAG(MUIA_IconList_LabelText_MultiLineOnFocus, FALSE);
2589 #endif
2591 SAVEVIEWSETTINGSTAG(MUIA_IconList_Icon_HorizontalSpacing, ILC_ICON_HORIZONTALMARGIN_DEFAULT);
2592 SAVEVIEWSETTINGSTAG(MUIA_IconList_Icon_VerticalSpacing, ILC_ICON_VERTICALMARGIN_DEFAULT);
2593 SAVEVIEWSETTINGSTAG(MUIA_IconList_Icon_ImageSpacing, ILC_ICONLABEL_IMAGEMARGIN_DEFAULT);
2594 SAVEVIEWSETTINGSTAG(MUIA_IconList_LabelText_HorizontalPadding, ILC_ICONLABEL_HORIZONTALTEXTMARGIN_DEFAULT);
2595 SAVEVIEWSETTINGSTAG(MUIA_IconList_LabelText_VerticalPadding, ILC_ICONLABEL_VERTICALTEXTMARGIN_DEFAULT);
2596 SAVEVIEWSETTINGSTAG(MUIA_IconList_LabelText_BorderWidth, ILC_ICONLABEL_BORDERWIDTH_DEFAULT);
2597 SAVEVIEWSETTINGSTAG(MUIA_IconList_LabelText_BorderHeight, ILC_ICONLABEL_BORDERHEIGHT_DEFAULT);
2598 SAVEVIEWSETTINGSTAG(MUIA_IconList_SortFlags, MUIV_IconList_Sort_ByName);
2599 SAVEVIEWSETTINGSTAG(MUIA_IconList_DragImageTransparent, FALSE);
2600 SAVEVIEWSETTINGSTAG(MUIA_IconList_DisplayFlags, ICONLIST_DISP_SHOWINFO);
2602 _viewSettings_ChunkSize += (_viewSettings_TagCount * sizeof(struct TagItem32));
2604 wanderer_chunkdata.wpIFFch_ChunkSize = AROS_LONG2LE(_viewSettings_ChunkSize);
2606 WriteChunkBytes(handle, &wanderer_chunkdata, sizeof(struct WandererPrefsIFFChunkHeader));
2608 PopChunk(handle);
2610 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Write 'ViewSettings' Wanderer Prefs Data Chunk for '%s' ... \n", _viewSettings_Node->wpedbo_ViewName));
2612 if ((error = PushChunk(handle, ID_PREF, ID_WANDR, _viewSettings_ChunkSize)) == 0)
2614 UBYTE *_viewSettings_ChunkData = AllocMem(_viewSettings_ChunkSize, MEMF_ANY|MEMF_CLEAR);
2615 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'ViewSettings' Chunk Data storage @ 0x%p, %d bytes\n", _viewSettings_ChunkData, _viewSettings_ChunkSize));
2617 sprintf(_viewSettings_ChunkData, "%s", background_value);
2618 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'ViewSettings' MUIA_Background = '%s'\n", _viewSettings_ChunkData));
2619 if ((_viewSettings_Node->wpedbo_AdvancedOptionsObject) && ((_viewSettings_Node->wpedbo_Options)&&(_viewSettings_TagCount > 0)))
2621 struct TagItem32 *dest_tag = (struct TagItem32 *)(_viewSettings_ChunkData + _viewSettings_TagOffset);
2622 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'ViewSettings' Writing data for %d Tags @ 0x%p\n", _viewSettings_TagCount, dest_tag));
2625 dest_tag[_viewSettings_TagCount - 1].ti_Tag = AROS_LONG2LE(_viewSettings_TagList[_viewSettings_TagCount - 1].ti_Tag);
2626 dest_tag[_viewSettings_TagCount - 1].ti_Data = AROS_LONG2LE(_viewSettings_TagList[_viewSettings_TagCount - 1].ti_Data);
2627 _viewSettings_TagCount -= 1;
2628 }while(_viewSettings_TagCount > 0);
2631 error = WriteChunkBytes(handle, _viewSettings_ChunkData, _viewSettings_ChunkSize);
2632 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'ViewSettings' Data Chunk | Wrote %d bytes (data size = %d bytes)\n", error, _viewSettings_ChunkSize));
2633 if ((error = PopChunk(handle)) != 0) // TODO: We need some error checking here!
2635 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'ViewSettings' Data PopChunk() = %ld\n", error));
2638 else
2640 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'ViewSettings' Data PushChunk() = %ld failed\n", error));
2643 else
2645 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: 'ViewSettings' Skipping (no value set) ... \n"));
2649 exportFH_CloseFORM:
2651 /* Terminate the FORM */
2652 PopChunk(handle);
2654 else
2656 //ShowError(_(MSG_CANT_OPEN_STREAM));
2657 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Can't open stream!\n"));
2658 success = FALSE;
2661 exportFH_CloseIFF:
2663 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Closing Handles ..\n"));
2665 CloseIFF(handle);
2666 FreeIFF(handle);
2668 else // AllocIFF()
2670 // Do something more here - if IFF allocation has failed, something isn't right
2671 //ShowError(_(MSG_CANT_ALLOCATE_IFFPTR));
2672 success = FALSE;
2675 D(bug("[WPEditor] WPEditor__MUIM_PrefsEditor_ExportFH: Export Finished\n"));
2677 return success;
2681 IPTR WPEditor__OM_GET
2683 Class *CLASS, Object *self, struct opGet *msg
2686 SETUP_WPEDITOR_INST_DATA;
2688 switch(msg->opg_AttrID)
2690 case MUIA_WPEditor_AdvancedViewWindow:
2691 *msg->opg_Storage = (IPTR)data->wped_AdvancedViewSettings_WindowData->wpedabwd_Window_WindowObj;
2692 return TRUE;
2695 return DoSuperMethodA(CLASS, self, (Msg) msg);
2698 IPTR WPEditor__MUIM_Show
2700 Class *CLASS, Object *self, Msg message
2703 //SETUP_WPEDITOR_INST_DATA;
2705 D(bug("[WPEditor] WPEditor__MUIM_Show()\n"));
2707 if (!DoSuperMethodA(CLASS, self, message)) return FALSE;
2709 #if defined(DEBUG_FORCEWINSIZE)
2710 Object *this_Win = _win(self);
2711 if ((this_Win) && (data->wped_DimensionsSet == NULL))
2713 LONG thisWin_Width = 0,
2714 thisWin_Height = 0,
2715 thisWin_X = 0,
2716 thisWin_Y = 0;
2718 LONG viewsettingsbox_Height = 0;
2720 struct Window *thisWin_Window = NULL;
2722 GET(this_Win, MUIA_Window_Width, &thisWin_Width);
2723 GET(this_Win, MUIA_Window_Height, &thisWin_Height);
2724 GET(this_Win, MUIA_Window_TopEdge, &thisWin_X);
2725 GET(this_Win, MUIA_Window_LeftEdge, &thisWin_Y);
2727 GET(this_Win, MUIA_Window_Window, &thisWin_Window);
2729 GET(data->wped_ViewSettings_GroupObj, MUIA_Height, &viewsettingsbox_Height);
2731 D(bug("[WPEditor] WPEditor__MUIM_Show: WindowObj @ 0x%p, Real Window @ 0x%p, %d, %d [%d x %d]\n",
2732 this_Win,
2733 thisWin_Window,
2734 thisWin_X, thisWin_Y,
2735 thisWin_Width, thisWin_Height));
2737 D(bug("[WPEditor] WPEditor__MUIM_Show: ViewSettings Group height = %d\n", viewsettingsbox_Height));
2739 if ((thisWin_Window) && (viewsettingsbox_Height > 0))
2741 LONG NEWHEIGHT = 0,
2742 ImgSpec_Height = 0,
2743 Advanced_Height = 0;
2745 if (data->wped_FirstBGImSpecObj) GET(data->wped_FirstBGImSpecObj, MUIA_Height, &ImgSpec_Height);
2746 if (data->wped_FirstBGAdvancedObj) GET(data->wped_FirstBGAdvancedObj, MUIA_Height, &Advanced_Height);
2748 if ((ImgSpec_Height > 0) && (Advanced_Height > 0))
2750 NEWHEIGHT = ImgSpec_Height + Advanced_Height;
2751 if ((2 * NEWHEIGHT) < viewsettingsbox_Height)
2753 thisWin_Height = (thisWin_Height - viewsettingsbox_Height) + (2 * NEWHEIGHT);
2754 thisWin_Y = thisWin_Y + ((viewsettingsbox_Height - (2 * NEWHEIGHT))/2);
2756 D(bug("[WPEditor] WPEditor__MUIM_Show: Changing windows dimensions to %d, %d [%d x %d]\n",
2757 thisWin_X, thisWin_Y,
2758 thisWin_Width, thisWin_Height));
2760 ChangeWindowBox(thisWin_Window, thisWin_X, thisWin_Y, thisWin_Width, thisWin_Height);
2761 data->wped_DimensionsSet = TRUE;
2766 #endif
2767 return TRUE;
2770 IPTR WPEditor__MUIM_PrefsEditor_Save
2772 Class *CLASS, Object *self, Msg message
2775 SETUP_WPEDITOR_INST_DATA;
2777 BOOL toolbar_enabled = (BOOL)XGET(data->wped_cm_ToolbarEnabled, MUIA_Selected);
2779 /* Export toolbar preferences */
2780 if (toolbar_enabled)
2781 SetVar(toolbar_PrefsFile, "True", 4, GVF_GLOBAL_ONLY | GVF_SAVE_VAR);
2782 else
2783 SetVar(toolbar_PrefsFile, "False", 5, GVF_GLOBAL_ONLY | GVF_SAVE_VAR);
2785 /* Call parent */
2786 return DoSuperMethodA(CLASS, self, message);
2789 IPTR WPEditor__MUIM_PrefsEditor_Use
2791 Class *CLASS, Object *self, Msg message
2794 SETUP_WPEDITOR_INST_DATA;
2796 BOOL toolbar_enabled = (BOOL)XGET(data->wped_cm_ToolbarEnabled, MUIA_Selected);
2798 /* Export toolbar preferences */
2799 if (toolbar_enabled)
2800 SetVar(toolbar_PrefsFile, "True", 4, GVF_GLOBAL_ONLY);
2801 else
2802 SetVar(toolbar_PrefsFile, "False", 5, GVF_GLOBAL_ONLY);
2804 /* Call parent */
2805 return DoSuperMethodA(CLASS, self, message);
2808 /*** Setup ******************************************************************/
2809 ZUNE_CUSTOMCLASS_7
2811 WPEditor, NULL, MUIC_PrefsEditor, NULL,
2812 OM_NEW, struct opSet *,
2813 OM_GET, struct opGet *,
2814 MUIM_Show, Msg,
2815 MUIM_PrefsEditor_ImportFH, struct MUIP_PrefsEditor_ImportFH *,
2816 MUIM_PrefsEditor_ExportFH, struct MUIP_PrefsEditor_ExportFH *,
2817 MUIM_PrefsEditor_Use, Msg,
2818 MUIM_PrefsEditor_Save, Msg