2 ** OpenURL - MUI preferences for openurl.library
4 ** Written by Troels Walsted Hansen <troels@thule.no>
5 ** Placed in the public domain.
8 ** - Alfonso Ranieri <alforan@tin.it>
9 ** - Stefan Kost <ensonic@sonicpulse.de>
11 ** Ported to OS4 by Alexandre Balaban <alexandre@balaban.name>
18 #define CATCOMP_NUMBERS
20 #include "libraries/openurl.h"
22 /**************************************************************************/
39 struct URL_MailerNode
*mn
;
49 /**************************************************************************/
51 static STRPTR syms
[] =
62 static STRPTR names
[] =
64 (STRPTR
)MSG_Mailer_PopAddress
,
65 (STRPTR
)MSG_Mailer_Popsubject
,
66 (STRPTR
)MSG_Mailer_PopBodyText
,
67 (STRPTR
)MSG_Mailer_PopBodyFile
,
68 (STRPTR
)MSG_Edit_PopURL
,
69 (STRPTR
)MSG_Edit_PopScreen
,
75 mNew(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
78 struct URL_MailerNode
*mn
;
79 struct TagItem
*attrs
= msg
->ops_AttrList
;
81 memset(&temp
,0,sizeof(temp
));
83 temp
.mailerList
= (Object
*)GetTagData(MUIA_MailerEditWin_ListObj
,(ULONG
)NULL
,attrs
);
84 if (!temp
.mailerList
) return 0;
86 mn
= temp
.mn
= (struct URL_MailerNode
*)GetTagData(MUIA_MailerEditWin_Mailer
,(ULONG
)NULL
,attrs
);
89 if (obj
= (Object
*)DoSuperNew(cl
,obj
,
90 MUIA_HelpNode
, "MWIN",
91 MUIA_Window_ID
, MAKE_ID('E', 'D', 'M', 'L'),
92 MUIA_Window_Title
, getString(MSG_Mailer_WinTitle
),
93 MUIA_Window_AllowTopMenus
, FALSE
,
94 MUIA_Window_ScreenTitle
, getString(MSG_App_ScreenTitle
),
96 WindowContents
, VGroup
,
98 GroupFrameT(getString(MSG_Edit_Definitions
)),
100 Child
, olabel2(MSG_Edit_Name
),
101 Child
, temp
.name
= ostring(NAME_LEN
,MSG_Edit_Name
,MSG_Edit_Name_Help
),
103 Child
, olabel2(MSG_Edit_Path
),
104 Child
, temp
.path
= opopph(syms
,names
,PATH_LEN
,MSG_Edit_Path
,TRUE
,MSG_Edit_Path_Help
),
106 Child
, olabel2(MSG_Edit_Port
),
107 Child
, temp
.port
= opopport(PORT_LEN
,MSG_Edit_Port
,MSG_Edit_Port_Help
),
111 GroupFrameT(getString(MSG_Edit_ARexx
)),
113 Child
, olabel2(MSG_Edit_Show
),
114 Child
, temp
.show
= ostring(SHOWCMD_LEN
,MSG_Edit_Show
,MSG_Edit_Show_Help
),
116 Child
, olabel2(MSG_Edit_Screen
),
117 Child
, temp
.toFront
= ostring(TOFRONTCMD_LEN
,MSG_Edit_Screen
,MSG_Edit_Screen_Help
),
119 Child
, olabel2(MSG_Mailer_Write
),
120 Child
, temp
.write
= opopph(syms
,names
,WRITEMAILCMD_LEN
,MSG_Mailer_Write
,FALSE
,MSG_Mailer_Write_Help
),
124 Child
, temp
.use
= obutton(MSG_Edit_Use
,MSG_Edit_Use_Help
),
125 Child
, RectangleObject
, End
,
126 Child
, temp
.cancel
= obutton(MSG_Edit_Cancel
,MSG_Edit_Cancel_Help
),
131 struct data
*data
= INST_DATA(cl
,obj
);
133 CopyMem(&temp
,data
,sizeof(*data
));
135 set(data
->name
,MUIA_String_Contents
,mn
->umn_Name
);
136 set(data
->path
,MUIA_String_Contents
,mn
->umn_Path
);
137 set(data
->port
,MUIA_String_Contents
,mn
->umn_Port
);
138 set(data
->show
,MUIA_String_Contents
,mn
->umn_ShowCmd
);
139 set(data
->toFront
,MUIA_String_Contents
,mn
->umn_ToFrontCmd
);
140 set(data
->write
,MUIA_String_Contents
,mn
->umn_WriteMailCmd
);
146 /**************************************************************************/
149 mGet(struct IClass
*cl
,Object
*obj
,struct opGet
*msg
)
151 struct data
*data
= INST_DATA(cl
,obj
);
153 switch (msg
->opg_AttrID
)
155 case MUIA_MailerEditWin_Mailer
: *msg
->opg_Storage
= (ULONG
)data
->mn
; return TRUE
;
156 case MUIA_App_IsSubWin
: *msg
->opg_Storage
= TRUE
; return TRUE
;
157 default: return DoSuperMethodA(cl
,obj
,(Msg
)msg
);
161 /**************************************************************************/
164 mWindow_Setup(struct IClass
*cl
,Object
*obj
,struct MUIP_Window_Setup
*msg
)
166 struct data
*data
= INST_DATA(cl
,obj
);
168 if (!DoSuperMethodA(cl
,obj
,(Msg
)msg
)) return FALSE
;
170 if (!(data
->flags
& FLG_Notifies
))
172 DoMethod(data
->use
,MUIM_Notify
,MUIA_Pressed
,FALSE
,(ULONG
)obj
,1,MUIM_MailerEditWin_Use
);
173 DoMethod(data
->cancel
,MUIM_Notify
,MUIA_Pressed
,FALSE
,(ULONG
)obj
,3,MUIM_Set
,MUIA_Window_CloseRequest
,TRUE
);
175 DoMethod(obj
,MUIM_Notify
,MUIA_Window_CloseRequest
,TRUE
,(ULONG
)_app(obj
),6,MUIM_Application_PushMethod
,
176 (ULONG
)_app(obj
),3,MUIM_App_CloseWin
,MUIA_MailerEditWin_Mailer
,(ULONG
)data
->mn
);
178 data
->flags
|= FLG_Notifies
;
184 /**************************************************************************/
187 mUse(struct IClass
*cl
,Object
*obj
,Msg msg
)
189 struct data
*data
= INST_DATA(cl
,obj
);
190 struct URL_MailerNode
*mn
= data
->mn
;
191 LONG i
, visible
, first
;
193 mn
->umn_Flags
&= ~UNF_NEW
;
195 strcpy((STRPTR
)mn
->umn_Name
,(STRPTR
)xget(data
->name
,MUIA_String_Contents
));
196 strcpy((STRPTR
)mn
->umn_Path
,(STRPTR
)xget(data
->path
,MUIA_String_Contents
));
197 strcpy((STRPTR
)mn
->umn_Port
,(STRPTR
)xget(data
->port
,MUIA_String_Contents
));
199 strcpy((STRPTR
)mn
->umn_ShowCmd
,(STRPTR
)xget(data
->show
,MUIA_String_Contents
));
200 strcpy((STRPTR
)mn
->umn_ToFrontCmd
,(STRPTR
)xget(data
->toFront
,MUIA_String_Contents
));
201 strcpy((STRPTR
)mn
->umn_WriteMailCmd
,(STRPTR
)xget(data
->write
,MUIA_String_Contents
));
203 get(data
->mailerList
,MUIA_List_Visible
,&visible
);
206 get(data
->mailerList
,MUIA_List_First
,&first
);
208 for (i
= first
; i
<(first
+ visible
); i
++)
210 DoMethod(data
->mailerList
,MUIM_List_GetEntry
,i
,(ULONG
)&mn
);
215 DoMethod(data
->mailerList
,MUIM_List_Redraw
,i
);
221 set(obj
,MUIA_Window_CloseRequest
,TRUE
);
226 /**************************************************************************/
232 switch (msg
->MethodID
)
234 case OM_NEW
: return mNew(cl
,obj
,(APTR
)msg
);
235 case OM_GET
: return mGet(cl
,obj
,(APTR
)msg
);
237 case MUIM_Window_Setup
: return mWindow_Setup(cl
,obj
,(APTR
)msg
);
238 case MUIM_MailerEditWin_Use
: return mUse(cl
,obj
,(APTR
)msg
);
240 default: return DoSuperMethodA(cl
,obj
,msg
);
244 M_DISPEND(dispatcher
)
246 /**************************************************************************/
249 initMailerEditWinClass(void)
251 if (g_mailerEditWinClass
= MUI_CreateCustomClass(NULL
,MUIC_Window
,NULL
,sizeof(struct data
),DISP(dispatcher
)))
253 localizeStrings(names
);
261 /**************************************************************************/
264 disposeMailerEditWinClass(void)
266 if (g_mailerEditWinClass
) MUI_DeleteCustomClass(g_mailerEditWinClass
);
269 /**************************************************************************/