2 #include <libraries/mui.h>
4 /* Some internal macros */
7 #define BOOLSAME(a,b) (((a) ? TRUE : FALSE)==((b) ? TRUE : FALSE))
9 /***********************************************************************/
21 /***********************************************************************/
26 /* Message used to wake-up the proc */
41 /* Message prototype */
52 MPV_Msg_Flags_Reply
= 1<<0, /* The message must be replied */
58 MPV_Msg_Type_Cleanup
= 0,
59 MPV_Msg_Type_AddInterface
,
60 MPV_Msg_Type_DelInterface
,
61 MPV_Msg_Type_SetInterfaceState
,
62 MPV_Msg_Type_SetInterfaceSpeed
,
63 MPV_Msg_Type_InterfaceReport
,
65 MPV_Msg_Type_InhibitRefresh
,
66 MPV_Msg_Type_GetCoord
,
68 MPV_Msg_Type_RefreshName
,
73 /* Message used to add an inteerface */
74 struct MPS_Msg_AddInterface
84 /* Message used to delete an interface */
85 struct MPS_Msg_DelInterface
91 /* Message used to change state/ontime */
92 struct MPS_Msg_SetInterfaceState
100 /* Message used to change the speed */
101 struct MPS_Msg_SetInterfaceSpeed
108 /* Message used to change rate/ontime/traffic */
109 struct MPS_Msg_InterfaceReport
118 /* Message used to start/stop an interface add/delete phase */
119 struct MPS_Msg_InhibitRefresh
125 /* Message used to get the window x/y - Unused */
126 struct MPS_Msg_GetCoord
133 /* Message used to report a sinal bit event - Unused */
140 /* Message used to change an interface name */
141 struct MPS_Msg_RefreshName
148 /***********************************************************************/
153 #define MUIMPANEL_TAG(n) ((int)(0xfec90000+(n)))
155 /***********************************************************************/
160 /* The actual preferences version */
163 MPV_Prefs_Version
= 1,
176 struct MinList iflist
;
193 MPV_Layout_Horiz
= 1<<0,
194 MPV_Layout_Left
= 1<<1,
195 MPV_Layout_Right
= 1<<2,
196 MPV_Layout_PureTop
= 1<<3,
197 MPV_Layout_PureBottom
= 1<<4,
198 MPV_Layout_Top
= MPV_Layout_PureTop
|MPV_Layout_Horiz
,
199 MPV_Layout_Bottom
= MPV_Layout_PureBottom
|MPV_Layout_Horiz
,
205 MPV_Flags_TrafficShort
= 1<<0,
206 MPV_Flags_TrafficNoGrouping
= 1<<1,
207 MPV_Flags_RateShort
= 1<<2,
208 MPV_Flags_RateNoGrouping
= 1<<3,
209 MPV_Flags_UseBusyBar
= 1<<4,
210 MPV_Flags_Iconify
= 1<<5,
211 MPV_Flags_BWin
= 1<<6,
212 MPV_Flags_BWinBorders
= 1<<7,
213 MPV_Flags_UseTransparency
= 1<<8,
219 MPV_BTFlags_Borderless
= 1<<0,
220 MPV_BTFlags_Sunny
= 1<<1,
221 MPV_BTFlags_Raised
= 1<<2,
222 MPV_BTFlags_Scaled
= 1<<3,
223 MPV_BTFlags_Underscore
= 1<<4,
224 MPV_BTFlags_Frame
= 1<<5,
225 MPV_BTFlags_DragBar
= 1<<6,
228 #define PREFS(p) ((struct MPS_Prefs *)(p))
230 /* An interface in iflist */
239 /* To use with loadIFFPrefs() */
242 MPV_LoadPrefs_Env
= 1<<0,
243 MPV_LoadPrefs_EnvArc
= 1<<1,
244 MPV_LoadPrefs_FallBack
= 1<<2,
247 /***********************************************************************/
249 ** App - Application.mui subclass
256 MPM_Rebuild
= MUIMPANEL_TAG(0),
257 MPM_Quit
= MUIMPANEL_TAG(1),
258 MPM_DisposeWin
= MUIMPANEL_TAG(2),
259 MPM_Save
= MUIMPANEL_TAG(3),
260 MPM_Load
= MUIMPANEL_TAG(4),
261 MPM_About
= MUIMPANEL_TAG(5),
262 MPM_Miami
= MUIMPANEL_TAG(6),
263 MPM_Prefs
= MUIMPANEL_TAG(7),
266 struct MPP_DisposeWin
300 MPA_Application
= MUIMPANEL_TAG(0),
301 MPA_Show
= MUIMPANEL_TAG(1),
302 MPA_Prefs
= MUIMPANEL_TAG(2),
303 MPA_OneWay
= MUIMPANEL_TAG(3),
304 MPA_Bar
= MUIMPANEL_TAG(4),
305 MPA_Value
= MUIMPANEL_TAG(5),
306 MPA_NoIfList
= MUIMPANEL_TAG(6),
307 MPA_SkipBar
= MUIMPANEL_TAG(7),
310 /***********************************************************************/
312 ** Prefs - Window.mui subclass
319 MPM_Prefs_UsePrefs
= MUIMPANEL_TAG(15),
322 struct MPP_Prefs_UsePrefs
330 MPV_Prefs_UsePrefs_Save
,
331 MPV_Prefs_UsePrefs_Use
,
332 MPV_Prefs_UsePrefs_Apply
,
333 MPV_Prefs_UsePrefs_Test
,
334 MPV_Prefs_UsePrefs_Cancel
,
337 /* No attribute defined */
339 /***********************************************************************/
341 ** MGroup - Group.mui subclass
342 ** Made of IFGroup & CGroup.
343 ** May change layout on the fly.
349 MPM_MGroup_GrabIFList
= MUIMPANEL_TAG(16),
350 MPM_MGroup_UpdateTransparency
= MUIMPANEL_TAG(17),
353 /* No attribute defined */
355 /***********************************************************************/
357 ** IfGroup - Virtgroup.mui subclass
364 MPM_IfGroup_HandleEvent
= MUIMPANEL_TAG(20),
365 MPM_IfGroup_GrabIFList
,
368 /* No attribute defined */
372 TAG_SCALE
= MUIMPANEL_TAG(30),
386 /***********************************************************************/
388 ** If - Group.mui subclass
389 ** Rappresents an interface.
395 MPM_If_Switch
= MUIMPANEL_TAG(50),
401 MPA_If_Unit
= MUIMPANEL_TAG(50),
402 MPA_If_Name
= MUIMPANEL_TAG(51),
403 MPA_If_State
= MUIMPANEL_TAG(52),
404 MPA_If_Ontime
= MUIMPANEL_TAG(53),
405 MPA_If_Traffic
= MUIMPANEL_TAG(54),
406 MPA_If_Rate
= MUIMPANEL_TAG(55),
407 MPA_If_Now
= MUIMPANEL_TAG(56),
408 MPA_If_Speed
= MUIMPANEL_TAG(57),
409 MPA_If_PMExLlst
= MUIMPANEL_TAG(58),
410 MPA_If_Scale
= MUIMPANEL_TAG(59),
413 /***********************************************************************/
415 ** LButton - Group.mui subclass
416 ** Made of a Lamp and a Text.
419 /* No method defined */
424 MPA_LButton_State
= MUIMPANEL_TAG(70),
427 /***********************************************************************/
433 #define MTITLE(t) {NM_TITLE,NULL,0,0,0,(APTR)(t)}
434 #define MITEM(t) {NM_ITEM,NULL,0,0,0,(APTR)(t)}
435 #define MBAR {NM_ITEM,(UBYTE *)NM_BARLABEL,0,0,0,NULL}
436 #define MXSUB(t,m) {NM_SUB,NULL,0,CHECKIT,(LONG)(m),(APTR)(t)}
437 #define MEND {NM_END,NULL,0,0,0,NULL}
440 #define PMMenuIDNoTitle(id) PM_MakeMenu(\
441 PM_Item, PM_MakeItem(PM_Hidden,TRUE,TAG_DONE),\
442 PM_Item, PM_MakeItem(PM_Title,"",PM_NoSelect,TRUE,PM_ShinePen,TRUE,PM_Shadowed,TRUE,PM_Center,TRUE,PM_ID,id,TAG_DONE),\
443 PM_Item, PM_MakeItem(PM_WideTitleBar,TRUE,TAG_DONE)
444 #define _pmenu(pm) ((struct PopupMenu *)(pm))
445 #define pmset(pm,attr,value) PM_SetItemAttrs(_pmenu(pm),attr,value,TAG_DONE)
448 #if !defined(__AROS__)
449 #define appObject NewObject(MiamiPanelBaseIntern->mpb_appClass->mcc_Class,NULL
450 #define aboutObject NewObject(MiamiPanelBaseIntern->mpb_aboutClass->mcc_Class,NULL
451 #define prefsObject NewObject(MiamiPanelBaseIntern->mpb_prefsClass->mcc_Class,NULL
452 #define mgroupObject NewObject(MiamiPanelBaseIntern->mpb_mgroupClass->mcc_Class,NULL
453 #define ifGroupObject NewObject(MiamiPanelBaseIntern->mpb_ifGroupClass->mcc_Class,NULL
454 #define ifObject NewObject(MiamiPanelBaseIntern->mpb_ifClass->mcc_Class,NULL
455 #define lbuttonObject NewObject(MiamiPanelBaseIntern->mpb_lbuttonClass->mcc_Class,NULL
456 #define rateObject NewObject(MiamiPanelBaseIntern->mpb_rateClass->mcc_Class,NULL
457 #define trafficObject NewObject(MiamiPanelBaseIntern->mpb_trafficClass->mcc_Class,NULL
458 #define timeTextObject NewObject(MiamiPanelBaseIntern->mpb_timeTextClass->mcc_Class,NULL
462 #define IDS(s) ((ULONG *)(s+sizeof(s)/sizeof(UBYTE *)/2))
464 /***********************************************************************/
466 ** Default preferecences
468 #define DEF_Layout MPV_Layout_Top
469 #define DEF_Flags (MPV_Flags_TrafficShort|MPV_Flags_RateShort|MPV_Flags_UseBusyBar|MPV_Flags_BWin|MPV_Flags_BWinBorders)
470 #define DEF_TBLayout MUIV_TheBar_BarPos_Left
471 #define DEF_TBVMode MUIV_TheBar_ViewMode_TextGfx
472 #define DEF_TBLPos MUIV_TheBar_LabelPos_Right
473 #define DEF_TBFlags (MPV_BTFlags_Underscore|MPV_BTFlags_Frame|MPV_BTFlags_DragBar)
474 #define DEF_Scale (scales[0].ti_Data)
476 /***********************************************************************/
478 ** Global definitions
481 #define DEF_Author "Alfonso Ranieri"
482 #define DEF_EMail "alforan@tin.it"
483 #define DEF_HomePage "http://alfie.altervista.org"
484 #define DEF_Base "MUI.MiamiPanel"
485 #define DEF_Guide "MIAMI:"DEF_Base".guide"
486 #define DEF_Icon "ENVARC:Sys/MiamiPanel"
487 #define DEF_Catalog DEF_Base".catalog"
488 #define DEF_ENVFILE "ENV:MUI/"DEF_Base
489 #define DEF_ENVARCFILE "ENVARC:MUI/"DEF_Base
491 /*****************************************************************************/
493 ** Callback types definitions
496 typedef long (MiamiPanelCallBackType
)(APTR code
,LONG count
,UBYTE
*args
);
498 /*****************************************************************************/
505 MIAMIPANELV_CallBack_Code_UnitOnline
= 112,
506 MIAMIPANELV_CallBack_Code_UnitOffline
= 113,
508 MIAMIPANELV_CallBack_Code_ShowMainGUI
= 56,
509 MIAMIPANELV_CallBack_Code_HideMainGUI
= 19,
510 MIAMIPANELV_CallBack_Code_ClosePanel
= 110,
511 MIAMIPANELV_CallBack_Code_QuitMiami
= 123,
513 MIAMIPANELV_CallBack_Code_Localize
= 27,
516 /*****************************************************************************/
523 MIAMIPANELV_AddInterface_State_GoingOnline
= 1<<8,
524 MIAMIPANELV_AddInterface_State_GoingOffline
= 1<<9,
525 MIAMIPANELV_AddInterface_State_Suspending
= 1<<10,
526 MIAMIPANELV_AddInterface_State_Offline
= 1<<0,
527 MIAMIPANELV_AddInterface_State_Online
= 1<<1,
528 MIAMIPANELV_AddInterface_State_Suspended
= 1<<2,
531 /*****************************************************************************/
533 ** Flags defining the appearance of the control panel
538 MIAMIPANELV_Init_Flags_ShowSpeed
= 1<<0,
539 MIAMIPANELV_Init_Flags_ShowDataTransferRate
= 1<<1,
540 MIAMIPANELV_Init_Flags_ShowUpTime
= 1<<2,
541 MIAMIPANELV_Init_Flags_ShowTotal
= 1<<3,
542 MIAMIPANELV_Init_Flags_ShowStatusButton
= 1<<4,
543 MIAMIPANELV_Init_Flags_Control
= 1<<5,
546 /*****************************************************************************/
553 MIAMIPANELV_String_Status_GoingOnline
= 5000, /* ">On" */
554 MIAMIPANELV_String_Status_GoingOffline
= 5001, /* ">Of" */
555 MIAMIPANELV_String_Status_Suspending
= 5002, /* ">Su" */
556 MIAMIPANELV_String_Status_Online
= 5003, /* "Onl" */
557 MIAMIPANELV_String_Status_Offline
= 5004, /* "Off" */
558 MIAMIPANELV_String_Status_Suspended
= 5005, /* "Sus" */
560 MIAMIPANELV_String_Button_Show
= 5006, /* "Show" */
561 MIAMIPANELV_String_Button_Hide
= 5007, /* "Hide" */
562 MIAMIPANELV_String_Button_Quit
= 5008, /* "Quit" */
563 MIAMIPANELV_String_Button_Online
= 5009, /* "Onl" */
564 MIAMIPANELV_String_Button_Offline
= 5010, /* "Off" */
567 /*****************************************************************************/