From 7a1fc467a4c6a04b5e2f46fa8123190696ed3bf8 Mon Sep 17 00:00:00 2001 From: neil Date: Thu, 4 Oct 2012 15:58:11 +0000 Subject: [PATCH] Tabs to spaces, more consistent formatting, childs -> children, typos in comments etc. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@45861 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/libs/muimaster/classes/group.c | 2212 ++++++++++++++++-------------- workbench/libs/muimaster/classes/group.h | 230 ++-- 2 files changed, 1352 insertions(+), 1090 deletions(-) rewrite workbench/libs/muimaster/classes/group.h (72%) diff --git a/workbench/libs/muimaster/classes/group.c b/workbench/libs/muimaster/classes/group.c index f43766253d..726d7db66f 100644 --- a/workbench/libs/muimaster/classes/group.c +++ b/workbench/libs/muimaster/classes/group.c @@ -26,7 +26,8 @@ extern struct Library *MUIMasterBase; #include "debug.h" #define ROUND(x) ((int)(x + 0.5)) -#define IS_HIDDEN(obj) (! (_flags(obj) & MADF_SHOWME) || (_flags(obj) & MADF_BORDERGADGET)) +#define IS_HIDDEN(obj) (! (_flags(obj) & MADF_SHOWME) \ + || (_flags(obj) & MADF_BORDERGADGET)) /* Attributes filtered out in OM_SET, before OM_SET gets passed to children. Tested with MUI under UAE/AOS. @@ -59,12 +60,18 @@ extern struct Library *MUIMasterBase; */ /* Private attribute/method definitions */ -#define MUIM_Group_Insert (MUIB_MUI|0x00424d34) /* MUI: V20 */ -struct MUIP_Group_Insert {STACKED ULONG MethodID; STACKED Object *obj; STACKED Object *pred;}; +#define MUIM_Group_Insert (MUIB_MUI|0x00424d34) /* MUI: V20 */ +struct MUIP_Group_Insert +{ + STACKED ULONG MethodID; + STACKED Object *obj; + STACKED Object *pred; +}; -#define MUIA_Group_ChildCount 0x80420322 /* MUI: V20 isg LONG */ +#define MUIA_Group_ChildCount 0x80420322 /* MUI: V20 isg LONG */ -struct layout2d_elem { +struct layout2d_elem +{ WORD min; WORD max; WORD dim; @@ -74,39 +81,47 @@ struct layout2d_elem { struct MUI_GroupData { - Object *family; + Object *family; struct Hook *layout_hook; - ULONG flags; - ULONG columns; - ULONG rows; + ULONG flags; + ULONG columns; + ULONG rows; struct layout2d_elem *row_infos; struct layout2d_elem *col_infos; - LONG active_page; - ULONG horiz_spacing; - ULONG vert_spacing; - ULONG num_childs; - ULONG num_visible_children; /* for horiz/vert group only */ - ULONG horiz_weight_sum; - ULONG vert_weight_sum; - ULONG samesize_maxmin_horiz; - ULONG samesize_maxmin_vert; - ULONG update; /* for MUI_Redraw() 1 - do not redraw the frame, 2 - the virtual pos has changed */ + LONG active_page; + ULONG horiz_spacing; + ULONG vert_spacing; + ULONG num_children; + ULONG num_visible_children; /* for horiz/vert group only */ + ULONG horiz_weight_sum; + ULONG vert_weight_sum; + ULONG samesize_maxmin_horiz; + ULONG samesize_maxmin_vert; + ULONG update; /* for MUI_Redraw() 1 - do not redraw the frame + * 2 - the virtual pos has changed */ struct MUI_EventHandlerNode ehn; - LONG virt_offx, virt_offy; /* diplay offsets */ - LONG old_virt_offx, old_virt_offy; /* Saved virtual positions, used for update == 2 */ - LONG virt_mwidth,virt_mheight; /* The complete width */ - LONG saved_minwidth,saved_minheight; - LONG dont_forward_get; /* Setted temporary to 1 so that the get method is not forwarded */ - LONG dont_forward_methods; /* Setted temporary to 1, meaning that the methods are not forwarded to the group's children */ + LONG virt_offx, virt_offy; /* diplay offsets */ + LONG old_virt_offx, old_virt_offy; /* Saved virtual positions, + * used for update == 2 */ + LONG virt_mwidth, virt_mheight; /* The complete width */ + LONG saved_minwidth, saved_minheight; + LONG dont_forward_get; /* Set temporarily to 1 so that the get method + * is not forwarded */ + LONG dont_forward_methods; /* Set temporarily to 1, meaning that the + * methods are not forwarded to the group's + * children */ /* MUI4 group with tabs */ - Object *titlegroup; + Object *titlegroup; }; /* Note: - * The MUI4 feature of group with tabs is implemented based on behaviour of one application. What this application - * codes suggest it seems that passing MUIV_Frame_Register together with MUIA_Group_PageMode, TRUE activates this mode. - * In such mode, the first passed group is used to register tab "titles" and is always visible. The selection of object - * in this group selects the matching (by position) group to be displayed + * The MUI4 feature of group with tabs is implemented based on behaviour of + * one application. What this application codes suggest it seems that passing + * MUIV_Frame_Register together with MUIA_Group_PageMode, TRUE activates this + * mode. + * In such mode, the first passed group is used to register tab "titles" and + * is always visible. The selection of object in this group selects the + * matching (by position) group to be displayed */ #define GROUP_HORIZ (1<<1) @@ -125,7 +140,7 @@ struct MUI_GroupData During layout objects with 0 weight must be treated like fixed-sized too, but for hgroups only in x direction, and for vgroups only in y direction. I think ... */ - + #define w0_defwidth(x) (_hweight(x) ? _defwidth(x) : _minwidth(x)) #define w0_maxwidth(x) (_hweight(x) ? _maxwidth(x) : _minwidth(x)) @@ -135,58 +150,61 @@ struct MUI_GroupData static const int __version = 1; static const int __revision = 1; -IPTR Group__MUIM_Show(struct IClass *cl, Object *obj, struct MUIP_Show *msg); -IPTR Group__MUIM_Hide(struct IClass *cl, Object *obj, struct MUIP_Hide *msg); +IPTR Group__MUIM_Show(struct IClass *cl, Object *obj, + struct MUIP_Show *msg); +IPTR Group__MUIM_Hide(struct IClass *cl, Object *obj, + struct MUIP_Hide *msg); -/******************************************************************************/ -/******************************************************************************/ +/*****************************************************************************/ +/*****************************************************************************/ static ULONG Group_DispatchMsg(struct IClass *cl, Object *obj, Msg msg); -static void change_active_page (struct IClass *cl, Object *obj, LONG page) +static void change_active_page(struct IClass *cl, Object *obj, LONG page) { struct MUI_GroupData *data = INST_DATA(cl, obj); - LONG newpage, num_childs = data->num_childs; + LONG newpage, num_children = data->num_children; - if (!(data->flags & GROUP_PAGEMODE)) return; + if (!(data->flags & GROUP_PAGEMODE)) + return; if (data->titlegroup != NULL) - num_childs--; + num_children--; switch (page) { - case MUIV_Group_ActivePage_First: - newpage = 0; - break; - case MUIV_Group_ActivePage_Last: - newpage = num_childs - 1; - break; - case MUIV_Group_ActivePage_Prev: - newpage = data->active_page - 1; - if (newpage == -1) - newpage = num_childs - 1; - break; - case MUIV_Group_ActivePage_Next: - case MUIV_Group_ActivePage_Advance: - newpage = (data->active_page + 1) % num_childs; - break; - default: - newpage = page; - break; + case MUIV_Group_ActivePage_First: + newpage = 0; + break; + case MUIV_Group_ActivePage_Last: + newpage = num_children - 1; + break; + case MUIV_Group_ActivePage_Prev: + newpage = data->active_page - 1; + if (newpage == -1) + newpage = num_children - 1; + break; + case MUIV_Group_ActivePage_Next: + case MUIV_Group_ActivePage_Advance: + newpage = (data->active_page + 1) % num_children; + break; + default: + newpage = page; + break; } if (newpage != data->active_page) { if (_flags(obj) & MADF_CANDRAW) - Group__MUIM_Hide(cl,obj,NULL); + Group__MUIM_Hide(cl, obj, NULL); data->active_page = newpage; if (_flags(obj) & MADF_CANDRAW) { - DoMethod(obj,MUIM_Layout); - Group__MUIM_Show(cl,obj,NULL); + DoMethod(obj, MUIM_Layout); + Group__MUIM_Show(cl, obj, NULL); data->update = 1; MUI_Redraw(obj, MADF_DRAWUPDATE); } @@ -198,17 +216,18 @@ static void change_active_page (struct IClass *cl, Object *obj, LONG page) /************************************************************************** Returns the number of visible children. Visible children are all children - with have MADF_SHOWME and not MADF_BORDERGADGET set. + that have MADF_SHOWME and not MADF_BORDERGADGET set. **************************************************************************/ -static int Group_GetNumVisibleChildren(struct MUI_GroupData *data, struct MinList *children) +static int Group_GetNumVisibleChildren(struct MUI_GroupData *data, + struct MinList *children) { - int num_visible_children = data->num_childs; + int num_visible_children = data->num_children; Object *cstate; Object *child; - /* As there can be unvisible children we have subtract those from the total + /* As there can be invisible children we have subtract those from the total * number of children */ - cstate = (Object *)children->mlh_Head; + cstate = (Object *) children->mlh_Head; while ((child = NextObject(&cstate))) { if (IS_HIDDEN(child)) @@ -222,28 +241,33 @@ static int Group_GetNumVisibleChildren(struct MUI_GroupData *data, struct MinLis that use it are the same for Group and Family and that struct share obj at same offset. **************************************************************************/ -struct MUIP_StructWithObj {STACKED ULONG MethodID; STACKED Object *obj;}; +struct MUIP_StructWithObj +{ + STACKED ULONG MethodID; + STACKED Object *obj; +}; static IPTR Group__MUIM_AddObject(struct IClass *cl, Object *obj, Msg msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - struct MUIP_StructWithObj * msgint = (struct MUIP_StructWithObj *)msg; + struct MUIP_StructWithObj *msgint = (struct MUIP_StructWithObj *)msg; - DoMethodA(data->family, (Msg)msg); - data->num_childs++; + DoMethodA(data->family, (Msg) msg); + data->num_children++; /* if we are in an application tree, propagate pointers */ if (muiNotifyData(obj)->mnd_GlobalInfo) { - /* Only childs of groups can have parents */ + /* Only children of groups can have parents */ - if ((_flags(obj) & MADF_INVIRTUALGROUP) || (data->flags & GROUP_VIRTUAL)) + if ((_flags(obj) & MADF_INVIRTUALGROUP) + || (data->flags & GROUP_VIRTUAL)) { _flags(msgint->obj) |= MADF_INVIRTUALGROUP; } muiNotifyData(msgint->obj)->mnd_ParentObject = obj; - DoMethod(msgint->obj, MUIM_ConnectParent, (IPTR)obj); + DoMethod(msgint->obj, MUIM_ConnectParent, (IPTR) obj); } if (_flags(obj) & MADF_SETUP) @@ -262,15 +286,16 @@ static IPTR Group__MUIM_AddObject(struct IClass *cl, Object *obj, Msg msg) IPTR Group__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg) { struct MUI_GroupData *data; - struct TagItem *tags,*tag; - BOOL bad_childs = FALSE; - IPTR disabled = FALSE; + struct TagItem *tags, *tag; + BOOL bad_children = FALSE; + IPTR disabled = FALSE; IPTR frame = MUIV_Frame_None; D(bug("[group.mui] OM_NEW, object 0x%p\n", obj)); - obj = (Object *)DoSuperMethodA(cl, obj, (Msg)msg); - if (!obj) return 0; + obj = (Object *) DoSuperMethodA(cl, obj, (Msg) msg); + if (!obj) + return 0; /* Initial local instance data */ data = INST_DATA(cl, obj); @@ -278,7 +303,7 @@ IPTR Group__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg) data->family = MUI_NewObjectA(MUIC_Family, NULL); if (!data->family) { - CoerceMethod(cl,obj,OM_DISPOSE); + CoerceMethod(cl, obj, OM_DISPOSE); return 0; } @@ -290,84 +315,86 @@ IPTR Group__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg) get(obj, MUIA_Frame, &frame); /* parse initial taglist */ - for (tags = msg->ops_AttrList; (tag = NextTagItem(&tags)); ) + for (tags = msg->ops_AttrList; (tag = NextTagItem(&tags));) { switch (tag->ti_Tag) { - case MUIA_Group_Child: - D(bug("[group.mui] Adding child 0x%p\n", tag->ti_Data)); - if (tag->ti_Data) - { - DoMethod(obj, OM_ADDMEMBER, tag->ti_Data); - /* Set first child as group title */ - if ((frame == MUIV_Frame_Register) && (data->titlegroup == NULL)) - data->titlegroup = (Object *)tag->ti_Data; - } - else bad_childs = TRUE; - break; + case MUIA_Group_Child: + D(bug("[group.mui] Adding child 0x%p\n", tag->ti_Data)); + if (tag->ti_Data) + { + DoMethod(obj, OM_ADDMEMBER, tag->ti_Data); + /* Set first child as group title */ + if ((frame == MUIV_Frame_Register) + && (data->titlegroup == NULL)) + data->titlegroup = (Object *) tag->ti_Data; + } + else + bad_children = TRUE; + break; - case MUIA_Group_ActivePage: - change_active_page(cl, obj, (LONG)tag->ti_Data); - break; + case MUIA_Group_ActivePage: + change_active_page(cl, obj, (LONG) tag->ti_Data); + break; - case MUIA_Group_Columns: - data->columns = (tag->ti_Data)>1?tag->ti_Data:1; - data->rows = 0; - break; + case MUIA_Group_Columns: + data->columns = (tag->ti_Data) > 1 ? tag->ti_Data : 1; + data->rows = 0; + break; - case MUIA_Group_Horiz: - _handle_bool_tag(data->flags, tag->ti_Data, GROUP_HORIZ); - break; + case MUIA_Group_Horiz: + _handle_bool_tag(data->flags, tag->ti_Data, GROUP_HORIZ); + break; - case MUIA_Group_HorizSpacing: - data->flags |= GROUP_HSPACING; - data->horiz_spacing = tag->ti_Data; - break; + case MUIA_Group_HorizSpacing: + data->flags |= GROUP_HSPACING; + data->horiz_spacing = tag->ti_Data; + break; - case MUIA_Group_LayoutHook: - data->layout_hook = (struct Hook *)tag->ti_Data; - break; + case MUIA_Group_LayoutHook: + data->layout_hook = (struct Hook *)tag->ti_Data; + break; - case MUIA_Group_PageMode: - _handle_bool_tag(data->flags, tag->ti_Data, GROUP_PAGEMODE); - break; + case MUIA_Group_PageMode: + _handle_bool_tag(data->flags, tag->ti_Data, GROUP_PAGEMODE); + break; - case MUIA_Group_Rows: - data->rows = MAX((ULONG)tag->ti_Data, 1); - data->columns = 0; - break; + case MUIA_Group_Rows: + data->rows = MAX((ULONG) tag->ti_Data, 1); + data->columns = 0; + break; - case MUIA_Group_SameHeight: - _handle_bool_tag(data->flags, tag->ti_Data, GROUP_SAME_HEIGHT); - break; + case MUIA_Group_SameHeight: + _handle_bool_tag(data->flags, tag->ti_Data, GROUP_SAME_HEIGHT); + break; - case MUIA_Group_SameSize: - _handle_bool_tag(data->flags, tag->ti_Data, GROUP_SAME_HEIGHT); - _handle_bool_tag(data->flags, tag->ti_Data, GROUP_SAME_WIDTH); - break; + case MUIA_Group_SameSize: + _handle_bool_tag(data->flags, tag->ti_Data, GROUP_SAME_HEIGHT); + _handle_bool_tag(data->flags, tag->ti_Data, GROUP_SAME_WIDTH); + break; - case MUIA_Group_SameWidth: - _handle_bool_tag(data->flags, tag->ti_Data, GROUP_SAME_WIDTH); - break; + case MUIA_Group_SameWidth: + _handle_bool_tag(data->flags, tag->ti_Data, GROUP_SAME_WIDTH); + break; - case MUIA_Group_Spacing: - data->flags |= (GROUP_HSPACING | GROUP_VSPACING); - data->horiz_spacing = tag->ti_Data; - data->vert_spacing = tag->ti_Data; - break; + case MUIA_Group_Spacing: + data->flags |= (GROUP_HSPACING | GROUP_VSPACING); + data->horiz_spacing = tag->ti_Data; + data->vert_spacing = tag->ti_Data; + break; - case MUIA_Group_VertSpacing: - data->flags |= GROUP_VSPACING; - data->vert_spacing = tag->ti_Data; - break; + case MUIA_Group_VertSpacing: + data->flags |= GROUP_VSPACING; + data->vert_spacing = tag->ti_Data; + break; - case MUIA_Group_Virtual: - _handle_bool_tag(data->flags, tag->ti_Data, GROUP_VIRTUAL); - break; + case MUIA_Group_Virtual: + _handle_bool_tag(data->flags, tag->ti_Data, GROUP_VIRTUAL); + break; } } - if (bad_childs) + if (bad_children) { CoerceMethod(cl, obj, OM_DISPOSE); return 0; @@ -377,25 +404,27 @@ IPTR Group__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg) if (data->flags & GROUP_VIRTUAL) { - /* This is used by MUI_Render() to determine if group is virtual. It then installs a clip region. - * Also MUI_Layout() uses this. Probably for speed up reason */ + /* This is used by MUI_Render() to determine if group is virtual. + * It then installs a clip region. + * Also MUI_Layout() uses this. Probably for speed up reason */ _flags(obj) |= MADF_ISVIRTUALGROUP; } - /* will forward MUIA_Disabled to childs */ + /* will forward MUIA_Disabled to children */ get(obj, MUIA_Disabled, &disabled); if (disabled) { set(obj, MUIA_Disabled, TRUE); } - + /* This is only used for virtual groups */ - data->ehn.ehn_Events = IDCMP_MOUSEBUTTONS; /* Will be filled on demand */ - data->ehn.ehn_Priority = 10; /* Will hear the click before all other normal objects */ - data->ehn.ehn_Flags = 0; - data->ehn.ehn_Object = obj; - data->ehn.ehn_Class = cl; - return (IPTR)obj; + data->ehn.ehn_Events = IDCMP_MOUSEBUTTONS; /* Will be filled on demand */ + data->ehn.ehn_Priority = 10; /* Will hear the click before all + * other normal objects */ + data->ehn.ehn_Flags = 0; + data->ehn.ehn_Object = obj; + data->ehn.ehn_Class = cl; + return (IPTR) obj; } /************************************************************************** @@ -419,88 +448,87 @@ IPTR Group__OM_DISPOSE(struct IClass *cl, Object *obj, Msg msg) **************************************************************************/ IPTR Group__OM_SET(struct IClass *cl, Object *obj, struct opSet *msg) { - struct MUI_GroupData *data = INST_DATA(cl, obj); - struct TagItem *tags = msg->ops_AttrList; - struct TagItem *tag; + struct MUI_GroupData *data = INST_DATA(cl, obj); + struct TagItem *tags = msg->ops_AttrList; + struct TagItem *tag; BOOL forward = TRUE; BOOL need_recalc = FALSE; IPTR retval; - + int virt_offx = data->virt_offx, virt_offy = data->virt_offy; /* There are many ways to find out what tag items provided by set() - ** we do know. The best way should be using NextTagItem() and simply - ** browsing through the list. - */ - + ** we do know. The best way should be using NextTagItem() and simply + ** browsing through the list. + */ + /* Parse group attributes before calling DoSuperMethodA(), - ** otherwise if an app for example sets up a notification - ** on MUIA_Group_ActivePage which calls a hook, and then - ** the hook function calls get(obj, MUIA_Group_ActivePage), - ** it would get returned the old active page instead of the new - ** active page - */ - + ** otherwise if an app for example sets up a notification + ** on MUIA_Group_ActivePage which calls a hook, and then + ** the hook function calls get(obj, MUIA_Group_ActivePage), + ** it would get returned the old active page instead of the new + ** active page + */ + while ((tag = NextTagItem(&tags)) != NULL) { switch (tag->ti_Tag) { - case MUIA_Group_Columns: - data->columns = MAX((ULONG)tag->ti_Data, 1); - data->rows = 0; - need_recalc = TRUE; - break; - case MUIA_Group_ActivePage: - change_active_page(cl, obj, (LONG)tag->ti_Data); - break; - case MUIA_Group_Forward: - forward = tag->ti_Data; - break; - case MUIA_Group_HorizSpacing: - data->flags |= GROUP_HSPACING; - data->horiz_spacing = tag->ti_Data; - break; - case MUIA_Group_Rows: - data->rows = MAX((ULONG)tag->ti_Data, 1); - data->columns = 0; - need_recalc = TRUE; - break; - case MUIA_Group_Spacing: - data->flags |= (GROUP_HSPACING | GROUP_VSPACING); - data->horiz_spacing = tag->ti_Data; - data->vert_spacing = tag->ti_Data; - break; - case MUIA_Group_VertSpacing: - data->flags |= GROUP_VSPACING; - data->vert_spacing = tag->ti_Data; - break; - case MUIA_Virtgroup_Left: - //kprintf("set virtgroup_left: %d\n", tag->ti_Data); - virt_offx = tag->ti_Data; - break; - - case MUIA_Group_LayoutHook: - /* - [ach] Seems like MUI supports setting this attribute after - initialization, even though the documentation states - otherwise. Atleast some programs use it... - */ - data->layout_hook = (struct Hook *)tag->ti_Data; - break; + case MUIA_Group_Columns: + data->columns = MAX((ULONG) tag->ti_Data, 1); + data->rows = 0; + need_recalc = TRUE; + break; + case MUIA_Group_ActivePage: + change_active_page(cl, obj, (LONG) tag->ti_Data); + break; + case MUIA_Group_Forward: + forward = tag->ti_Data; + break; + case MUIA_Group_HorizSpacing: + data->flags |= GROUP_HSPACING; + data->horiz_spacing = tag->ti_Data; + break; + case MUIA_Group_Rows: + data->rows = MAX((ULONG) tag->ti_Data, 1); + data->columns = 0; + need_recalc = TRUE; + break; + case MUIA_Group_Spacing: + data->flags |= (GROUP_HSPACING | GROUP_VSPACING); + data->horiz_spacing = tag->ti_Data; + data->vert_spacing = tag->ti_Data; + break; + case MUIA_Group_VertSpacing: + data->flags |= GROUP_VSPACING; + data->vert_spacing = tag->ti_Data; + break; + case MUIA_Virtgroup_Left: + //kprintf("set virtgroup_left: %d\n", tag->ti_Data); + virt_offx = tag->ti_Data; + break; + + case MUIA_Group_LayoutHook: + /* + [ach] Seems like MUI supports setting this attribute after + initialization, even though the documentation states + otherwise. At least some programs use it... + */ + data->layout_hook = (struct Hook *)tag->ti_Data; + break; + + case MUIA_Virtgroup_Top: + //kprintf("set virtgroup_top: %d\n", tag->ti_Data); + virt_offy = tag->ti_Data; + break; + } - case MUIA_Virtgroup_Top: - //kprintf("set virtgroup_top: %d\n", tag->ti_Data); - virt_offy = tag->ti_Data; - break; - - } - } - + if (muiRenderInfo(obj) && need_recalc) - DoMethod(_win(obj), MUIM_Window_RecalcDisplay, (IPTR)obj); + DoMethod(_win(obj), MUIM_Window_RecalcDisplay, (IPTR) obj); - retval = DoSuperMethodA(cl, obj, (Msg)msg); + retval = DoSuperMethodA(cl, obj, (Msg) msg); /* seems to be the documented behaviour, however it should be slow! */ @@ -509,56 +537,58 @@ IPTR Group__OM_SET(struct IClass *cl, Object *obj, struct opSet *msg) /* Attributes which are to be filtered out, so that they are ignored when OM_SET is passed to group's children */ - tags = msg->ops_AttrList; + tags = msg->ops_AttrList; while ((tag = NextTagItem(&tags)) != NULL) { switch (tag->ti_Tag) - { - case MUIA_HelpLine: - case MUIA_HelpNode: - case MUIA_ObjectID: - case MUIA_UserData: - - case MUIA_ContextMenu: - case MUIA_ContextMenuTrigger: - case MUIA_ControlChar: - case MUIA_CycleChain: - case MUIA_Draggable: - case MUIA_FillArea: - case MUIA_Group_ActivePage: - case MUIA_Frame: - case MUIA_FrameTitle: - case MUIA_HorizWeight: - case MUIA_Pressed: - case MUIA_ShortHelp: - case MUIA_ShowMe: - case MUIA_VertWeight: - case MUIA_Weight: - case MUIA_Virtgroup_Left: - case MUIA_Virtgroup_Top: - tag->ti_Tag = TAG_IGNORE; - break; - case MUIA_Selected: -/* D(bug("Group_Set(%p) MUIA_Selected forwarded\n", obj)); */ + { + case MUIA_HelpLine: + case MUIA_HelpNode: + case MUIA_ObjectID: + case MUIA_UserData: + + case MUIA_ContextMenu: + case MUIA_ContextMenuTrigger: + case MUIA_ControlChar: + case MUIA_CycleChain: + case MUIA_Draggable: + case MUIA_FillArea: + case MUIA_Group_ActivePage: + case MUIA_Frame: + case MUIA_FrameTitle: + case MUIA_HorizWeight: + case MUIA_Pressed: + case MUIA_ShortHelp: + case MUIA_ShowMe: + case MUIA_VertWeight: + case MUIA_Weight: + case MUIA_Virtgroup_Left: + case MUIA_Virtgroup_Top: + tag->ti_Tag = TAG_IGNORE; + break; + case MUIA_Selected: +/* D(bug("Group_Set(%p) MUIA_Selected forwarded\n", obj)); */ /* tag->ti_Tag = TAG_IGNORE; */ - break; + break; } } - Group_DispatchMsg(cl, obj, (Msg)msg); + Group_DispatchMsg(cl, obj, (Msg) msg); } - + if (virt_offx != data->virt_offx || virt_offy != data->virt_offy) { - if (_flags(obj) & MADF_CANDRAW) Group__MUIM_Hide(cl,obj,NULL); + if (_flags(obj) & MADF_CANDRAW) + Group__MUIM_Hide(cl, obj, NULL); data->virt_offx = virt_offx; data->virt_offy = virt_offy; /* Relayout ourself, this will also relayout all the children */ - DoMethod(obj,MUIM_Layout); - if (_flags(obj) & MADF_CANDRAW) Group__MUIM_Show(cl,obj,NULL); + DoMethod(obj, MUIM_Layout); + if (_flags(obj) & MADF_CANDRAW) + Group__MUIM_Show(cl, obj, NULL); data->update = 2; - MUI_Redraw(obj,MADF_DRAWUPDATE); + MUI_Redraw(obj, MADF_DRAWUPDATE); } return retval; @@ -577,38 +607,67 @@ IPTR Group__OM_GET(struct IClass *cl, Object *obj, struct opGet *msg) switch (msg->opg_AttrID) { - case MUIA_Version: STORE = __version; return 1; - case MUIA_Revision: STORE = __revision; return 1; - case MUIA_Group_ActivePage: STORE = data->active_page; return 1; - case MUIA_Group_ChildList: return GetAttr(MUIA_Family_List, data->family, msg->opg_Storage); - case MUIA_Group_Horiz: STORE = (data->flags & GROUP_HORIZ); return 1; - case MUIA_Group_HorizSpacing: STORE = data->horiz_spacing; return 1; - case MUIA_Group_VertSpacing: STORE = data->vert_spacing; return 1; - case MUIA_Group_ChildCount: STORE = data->num_childs; return 1; - case MUIA_Virtgroup_Left: STORE = data->virt_offx; return 1; - case MUIA_Virtgroup_Top: STORE = data->virt_offy; return 1; - case MUIA_Virtgroup_Width: STORE = data->virt_mwidth; return 1; - case MUIA_Virtgroup_Height: STORE = data->virt_mheight; return 1; - case MUIA_Virtgroup_MinWidth: STORE = data->saved_minwidth; return 1; - case MUIA_Virtgroup_MinHeight: STORE = data->saved_minheight; return 1; + case MUIA_Version: + STORE = __version; + return 1; + case MUIA_Revision: + STORE = __revision; + return 1; + case MUIA_Group_ActivePage: + STORE = data->active_page; + return 1; + case MUIA_Group_ChildList: + return GetAttr(MUIA_Family_List, data->family, msg->opg_Storage); + case MUIA_Group_Horiz: + STORE = (data->flags & GROUP_HORIZ); + return 1; + case MUIA_Group_HorizSpacing: + STORE = data->horiz_spacing; + return 1; + case MUIA_Group_VertSpacing: + STORE = data->vert_spacing; + return 1; + case MUIA_Group_ChildCount: + STORE = data->num_children; + return 1; + case MUIA_Virtgroup_Left: + STORE = data->virt_offx; + return 1; + case MUIA_Virtgroup_Top: + STORE = data->virt_offy; + return 1; + case MUIA_Virtgroup_Width: + STORE = data->virt_mwidth; + return 1; + case MUIA_Virtgroup_Height: + STORE = data->virt_mheight; + return 1; + case MUIA_Virtgroup_MinWidth: + STORE = data->saved_minwidth; + return 1; + case MUIA_Virtgroup_MinHeight: + STORE = data->saved_minheight; + return 1; } /* our handler didn't understand the attribute, we simply pass - ** it to our superclass now - */ - if (DoSuperMethodA(cl, obj, (Msg) msg)) return 1; + ** it to our superclass now + */ + if (DoSuperMethodA(cl, obj, (Msg) msg)) + return 1; /* seems to be the documented behaviour, however it should be slow! */ if (!data->dont_forward_get && !data->dont_forward_methods) { - Object *cstate; - Object *child; - struct MinList *ChildList = NULL; + Object *cstate; + Object *child; + struct MinList *ChildList = NULL; get(data->family, MUIA_Family_List, &(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) - if (DoMethodA(child, (Msg)msg)) return 1; + if (DoMethodA(child, (Msg) msg)) + return 1; } return 0; #undef STORE @@ -618,31 +677,35 @@ IPTR Group__OM_GET(struct IClass *cl, Object *obj, struct opGet *msg) /************************************************************************** MUIM_AddTail **************************************************************************/ -IPTR Group__MUIM_AddTail(struct IClass *cl, Object *obj, struct MUIP_Group_AddTail *msg) +IPTR Group__MUIM_AddTail(struct IClass *cl, Object *obj, + struct MUIP_Group_AddTail *msg) { - return Group__MUIM_AddObject(cl, obj, (Msg)msg); + return Group__MUIM_AddObject(cl, obj, (Msg) msg); } /************************************************************************** MUIM_AddHead **************************************************************************/ -IPTR Group__MUIM_AddHead(struct IClass *cl, Object *obj, struct MUIP_Group_AddHead *msg) +IPTR Group__MUIM_AddHead(struct IClass *cl, Object *obj, + struct MUIP_Group_AddHead *msg) { - return Group__MUIM_AddObject(cl, obj, (Msg)msg); + return Group__MUIM_AddObject(cl, obj, (Msg) msg); } /************************************************************************** MUIM_Insert **************************************************************************/ -IPTR Group__MUIM_Insert(struct IClass *cl, Object *obj, struct MUIP_Group_Insert *msg) +IPTR Group__MUIM_Insert(struct IClass *cl, Object *obj, + struct MUIP_Group_Insert *msg) { - return Group__MUIM_AddObject(cl, obj, (Msg)msg); + return Group__MUIM_AddObject(cl, obj, (Msg) msg); } /************************************************************************** MUIM_Remove **************************************************************************/ -IPTR Group__MUIM_Remove(struct IClass *cl, Object *obj, struct MUIP_Group_Remove *msg) +IPTR Group__MUIM_Remove(struct IClass *cl, Object *obj, + struct MUIP_Group_Remove *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); @@ -654,12 +717,12 @@ IPTR Group__MUIM_Remove(struct IClass *cl, Object *obj, struct MUIP_Group_Remove { DoMethod(msg->obj, MUIM_DisconnectParent); muiNotifyData(msg->obj)->mnd_ParentObject = NULL; - + _flags(msg->obj) &= ~MADF_INVIRTUALGROUP; } - data->num_childs--; - DoMethodA(data->family, (Msg)msg); + data->num_children--; + DoMethodA(data->family, (Msg) msg); return TRUE; } @@ -668,28 +731,30 @@ IPTR Group__MUIM_Remove(struct IClass *cl, Object *obj, struct MUIP_Group_Remove /************************************************************************** MUIM_ConnectParent **************************************************************************/ -IPTR Group__MUIM_ConnectParent(struct IClass *cl, Object *obj, struct MUIP_ConnectParent *msg) +IPTR Group__MUIM_ConnectParent(struct IClass *cl, Object *obj, + struct MUIP_ConnectParent *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - struct MinList *ChildList = NULL; + Object *cstate; + Object *child; + struct MinList *ChildList = NULL; - DoSuperMethodA(cl,obj,(Msg)msg); + DoSuperMethodA(cl, obj, (Msg) msg); get(data->family, MUIA_Family_List, &(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - if ((_flags(obj) & MADF_INVIRTUALGROUP) || (data->flags & GROUP_VIRTUAL)) + if ((_flags(obj) & MADF_INVIRTUALGROUP) + || (data->flags & GROUP_VIRTUAL)) { _flags(child) |= MADF_INVIRTUALGROUP; } - /* Only childs of groups can have parents */ + /* Only children of groups can have parents */ muiNotifyData(child)->mnd_ParentObject = obj; - DoMethod(child, MUIM_ConnectParent, (IPTR)obj); + DoMethod(child, MUIM_ConnectParent, (IPTR) obj); } return TRUE; } @@ -697,22 +762,23 @@ IPTR Group__MUIM_ConnectParent(struct IClass *cl, Object *obj, struct MUIP_Conne /************************************************************************** MUIM_DisconnectParent **************************************************************************/ -IPTR Group__MUIM_DisconnectParent(struct IClass *cl, Object *obj, struct MUIP_ConnectParent *msg) +IPTR Group__MUIM_DisconnectParent(struct IClass *cl, Object *obj, + struct MUIP_ConnectParent *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - struct MinList *ChildList = NULL; + Object *cstate; + Object *child; + struct MinList *ChildList = NULL; get(data->family, MUIA_Family_List, &(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - DoMethodA(child, (Msg)msg); + DoMethodA(child, (Msg) msg); muiNotifyData(child)->mnd_ParentObject = NULL; _flags(child) &= ~MADF_INVIRTUALGROUP; } - DoSuperMethodA(cl,obj,(Msg)msg); + DoSuperMethodA(cl, obj, (Msg) msg); return TRUE; } @@ -720,7 +786,7 @@ IPTR Group__MUIM_DisconnectParent(struct IClass *cl, Object *obj, struct MUIP_Co * Put group in exchange state */ IPTR Group__MUIM_InitChange(struct IClass *cl, Object *obj, - struct MUIP_Group_InitChange *msg) + struct MUIP_Group_InitChange *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); @@ -733,7 +799,7 @@ IPTR Group__MUIM_InitChange(struct IClass *cl, Object *obj, * Will recalculate display after dynamic adding/removing */ IPTR Group__MUIM_ExitChange(struct IClass *cl, Object *obj, - struct MUIP_Group_ExitChange *msg) + struct MUIP_Group_ExitChange *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); @@ -745,19 +811,20 @@ IPTR Group__MUIM_ExitChange(struct IClass *cl, Object *obj, { Object *win = _win(obj); Object *parent = obj; - + /* CHECKME: Don't call RecalcDisplay if one of our parents is - in GROUP_CHANGING state to prevent crash with Zune prefs - program NListtree page because NList/NListtree when - killing tree images in MUIM_Cleanup uses InitChange/ - ExitChange. Zune prefs program uses InitChange/ExitChange - when switching page -> nesting -> mess. */ - + in GROUP_CHANGING state to prevent crash with Zune prefs + program NListtree page because NList/NListtree when + killing tree images in MUIM_Cleanup uses InitChange/ + ExitChange. Zune prefs program uses InitChange/ExitChange + when switching page -> nesting -> mess. */ + while ((parent = _parent(parent))) { struct MUI_GroupData *pdata = INST_DATA(cl, parent); - if (parent == win) break; + if (parent == win) + break; if (pdata->flags & GROUP_CHANGING) { @@ -766,7 +833,7 @@ IPTR Group__MUIM_ExitChange(struct IClass *cl, Object *obj, } - DoMethod(win, MUIM_Window_RecalcDisplay, (IPTR)obj); + DoMethod(win, MUIM_Window_RecalcDisplay, (IPTR) obj); } } @@ -777,14 +844,15 @@ IPTR Group__MUIM_ExitChange(struct IClass *cl, Object *obj, /* * Sort the family */ -IPTR Group__MUIM_Sort(struct IClass *cl, Object *obj, struct MUIP_Group_Sort *msg) +IPTR Group__MUIM_Sort(struct IClass *cl, Object *obj, + struct MUIP_Group_Sort *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); /* modify message */ msg->MethodID = MUIM_Family_Sort; - DoMethodA(data->family, (APTR)msg); + DoMethodA(data->family, (APTR) msg); /* restore original message */ msg->MethodID = MUIM_Group_Sort; @@ -796,33 +864,37 @@ IPTR Group__MUIM_Sort(struct IClass *cl, Object *obj, struct MUIP_Group_Sort *ms Executes the given method but does not forward it to the children **************************************************************************/ -IPTR Group__MUIM_DoMethodNoForward(struct IClass *cl, Object *obj, struct MUIP_Group_DoMethodNoForward *msg) +IPTR Group__MUIM_DoMethodNoForward(struct IClass *cl, Object *obj, + struct MUIP_Group_DoMethodNoForward *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); IPTR rc; - data->dont_forward_methods = 1; /* disable forwarding */ - rc = DoMethodA(obj, (Msg)&msg->DoMethodID); /* Probably doesn't not work correctly on AROS? */ + data->dont_forward_methods = 1; /* disable forwarding */ + rc = DoMethodA(obj, (Msg) & msg->DoMethodID); + /* Probably doesn't work correctly on AROS? */ + data->dont_forward_methods = 0; return rc; } /* - * Propagate a method to group childs. + * Propagate a method to group children. */ static ULONG Group_DispatchMsg(struct IClass *cl, Object *obj, Msg msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - struct MinList *ChildList = NULL; + Object *cstate; + Object *child; + struct MinList *ChildList = NULL; - if (data->dont_forward_methods) return TRUE; + if (data->dont_forward_methods) + return TRUE; get(data->family, MUIA_Family_List, &(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - DoMethodA(child, (Msg)msg); + DoMethodA(child, (Msg) msg); } return TRUE; } @@ -831,16 +903,17 @@ static ULONG Group_DispatchMsg(struct IClass *cl, Object *obj, Msg msg) /************************************************************************** MUIM_Setup **************************************************************************/ -IPTR Group__MUIM_Setup(struct IClass *cl, Object *obj, struct MUIP_Setup *msg) +IPTR Group__MUIM_Setup(struct IClass *cl, Object *obj, + struct MUIP_Setup *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *cstate_copy; - Object *child; - Object *childFailed; - struct MinList *ChildList = NULL; + Object *cstate; + Object *cstate_copy; + Object *child; + Object *childFailed; + struct MinList *ChildList = NULL; - if (!DoSuperMethodA(cl, obj, (Msg)msg)) + if (!DoSuperMethodA(cl, obj, (Msg) msg)) return FALSE; ASSERT_VALID_PTR(muiGlobalInfo(obj)); @@ -850,14 +923,14 @@ IPTR Group__MUIM_Setup(struct IClass *cl, Object *obj, struct MUIP_Setup *msg) if (!(data->flags & GROUP_VSPACING)) data->vert_spacing = muiGlobalInfo(obj)->mgi_Prefs->group_vspacing; get(data->family, MUIA_Family_List, &(ChildList)); - cstate = cstate_copy = (Object *)ChildList->mlh_Head; + cstate = cstate_copy = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - #if 0 /* SHOWME affects only show/hide */ - if (! (_flags(child) & MADF_SHOWME)) +#if 0 /* SHOWME affects only show/hide */ + if (!(_flags(child) & MADF_SHOWME)) continue; - #endif - +#endif + if (!DoSetupMethod(child, msg->RenderInfo)) { /* Send MUIM_Cleanup to all objects that received MUIM_Setup. @@ -866,10 +939,10 @@ IPTR Group__MUIM_Setup(struct IClass *cl, Object *obj, struct MUIP_Setup *msg) cstate = cstate_copy; while ((child = NextObject(&cstate)) && (child != childFailed)) { - #if 0 /* SHOWME affects only show/hide */ - if (! (_flags(child) & MADF_SHOWME)) +#if 0 /* SHOWME affects only show/hide */ + if (!(_flags(child) & MADF_SHOWME)) continue; - #endif +#endif DoMethod(child, MUIM_Cleanup); } return FALSE; @@ -878,7 +951,8 @@ IPTR Group__MUIM_Setup(struct IClass *cl, Object *obj, struct MUIP_Setup *msg) if (data->flags & GROUP_VIRTUAL) { - DoMethod(_win(obj), MUIM_Window_AddEventHandler, (IPTR)&data->ehn); + DoMethod(_win(obj), MUIM_Window_AddEventHandler, + (IPTR) & data->ehn); } return TRUE; @@ -891,26 +965,27 @@ IPTR Group__MUIM_Setup(struct IClass *cl, Object *obj, struct MUIP_Setup *msg) IPTR Group__MUIM_Cleanup(struct IClass *cl, Object *obj, Msg msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - struct MinList *ChildList = NULL; + Object *cstate; + Object *child; + struct MinList *ChildList = NULL; if (data->flags & GROUP_VIRTUAL) { - DoMethod(_win(obj), MUIM_Window_RemEventHandler, (IPTR)&data->ehn); + DoMethod(_win(obj), MUIM_Window_RemEventHandler, + (IPTR) & data->ehn); } get(data->family, MUIA_Family_List, &(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - #if 0 /* SHOWME affects only show/hide */ - if (! (_flags(child) & MADF_SHOWME)) +#if 0 /* SHOWME affects only show/hide */ + if (!(_flags(child) & MADF_SHOWME)) continue; - #endif - DoMethodA(child, (Msg)msg); +#endif + DoMethodA(child, (Msg) msg); } - return DoSuperMethodA(cl, obj, (Msg)msg); + return DoSuperMethodA(cl, obj, (Msg) msg); } @@ -918,59 +993,65 @@ IPTR Group__MUIM_Cleanup(struct IClass *cl, Object *obj, Msg msg) /************************************************************************** MUIM_Draw - draw the group **************************************************************************/ -IPTR Group__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg) +IPTR Group__MUIM_Draw(struct IClass *cl, Object *obj, + struct MUIP_Draw *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - struct MinList *ChildList = NULL; - struct Rectangle group_rect; /* child_rect;*/ - int page; + Object *cstate; + Object *child; + struct MinList *ChildList = NULL; + struct Rectangle group_rect; /* child_rect; */ + int page; struct Region *region = NULL; - APTR clip = (APTR)-1; + APTR clip = (APTR) - 1; /* D(bug("Group_Draw(%lx) %ldx%ldx%ldx%ld upd=%d page=%d\n", */ /* obj,_left(obj),_top(obj),_right(obj),_bottom(obj), */ /* data->update, data->active_page)); */ -/* D(bug("Group_Draw(%p) msg=0x%08lx flags=0x%08lx\n", obj, msg->flags, _flags(obj))); */ +/* D(bug("Group_Draw(%p) msg=0x%08lx flags=0x%08lx\n", */ +/* obj, msg->flags, _flags(obj))); */ if (data->flags & GROUP_CHANGING) return FALSE; - if (muiGlobalInfo(obj)->mgi_Prefs->window_redraw == WINDOW_REDRAW_WITHOUT_CLEAR) + if (muiGlobalInfo(obj)->mgi_Prefs->window_redraw == + WINDOW_REDRAW_WITHOUT_CLEAR) { region = NewRegion(); if (region) { struct Rectangle rect; - + rect.MinX = _left(obj); rect.MinY = _top(obj); rect.MaxX = _right(obj); rect.MaxY = _bottom(obj); - + OrRectRegion(region, &rect); page = -1; get(data->family, MUIA_Family_List, &(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - /*page++;*//* redraw problem with colorwheel in coloradjust register */ - if ((data->flags & GROUP_PAGEMODE) && ((page != data->active_page) && (child != data->titlegroup))) + /*page++; */ + /* redraw problem with colorwheel in coloradjust register */ + if ((data->flags & GROUP_PAGEMODE) + && ((page != data->active_page) + && (child != data->titlegroup))) continue; if ((muiAreaData(child)->mad_Flags & MADF_CANDRAW) - && (_width(child) > 0) - && (_height(child) > 0)) + && (_width(child) > 0) && (_height(child) > 0)) { - rect.MinX = MAX(_left(child) , _mleft (obj)); - rect.MinY = MAX(_top(child) , _mtop (obj)); - rect.MaxX = MIN(_right(child) , _mright (obj)); + rect.MinX = MAX(_left(child), _mleft(obj)); + rect.MinY = MAX(_top(child), _mtop(obj)); + rect.MaxX = MIN(_right(child), _mright(obj)); rect.MaxY = MIN(_bottom(child), _mbottom(obj)); - - if ((rect.MaxX >= rect.MinX) && (rect.MaxY >= rect.MinY)) + + if ((rect.MaxX >= rect.MinX) + && (rect.MaxY >= rect.MinY)) { - ClearRectRegion(region, &rect); + ClearRectRegion(region, &rect); } } } @@ -979,17 +1060,17 @@ IPTR Group__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg) } - DoSuperMethodA(cl, obj, (Msg)msg); - + DoSuperMethodA(cl, obj, (Msg) msg); + if (region) { MUI_RemoveClipRegion(muiRenderInfo(obj), clip); region = NULL; } - } + } else { - DoSuperMethodA(cl, obj, (Msg)msg); + DoSuperMethodA(cl, obj, (Msg) msg); } /* D(bug("Group_Draw(%p) (after dsma) msg=0x%08lx flags=0x%08lx\n", */ /* obj, msg->flags, _flags(obj))); */ @@ -1001,143 +1082,157 @@ IPTR Group__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg) * need to redraw background ourself */ DoMethod(obj, MUIM_DrawBackground, - _mleft(obj), _mtop(obj), _mwidth(obj), _mheight(obj), _mleft(obj), _mtop(obj), 0); + _mleft(obj), _mtop(obj), _mwidth(obj), _mheight(obj), + _mleft(obj), _mtop(obj), 0); data->update = 0; - } else + } + else { if ((msg->flags & MADF_DRAWUPDATE) && data->update == 2) { - LONG left,top,right,bottom; + LONG left, top, right, bottom; LONG diff_virt_offx = data->virt_offx - data->old_virt_offx; LONG diff_virt_offy = data->virt_offy - data->old_virt_offy; struct Rectangle rect; struct Rectangle *clip_rect = &muiRenderInfo(obj)->mri_ClipRect; - data->update = 0; - + data->update = 0; + if (!diff_virt_offx && !diff_virt_offy) { return 1; } /* sba: I don't know how MUI handle this but ScrollRasterBF() made problems when scrolling - ** a (partly visible) virtual groups in a virtual group, because e.g. _mtop() is then - ** smaller than the region. ScrollRasterBF() on AmigaOS then marks the complete region - ** as damaged. Using ScrollWindowRaster() solved that problem but it flickers then. - ** To avoid this we prevent that the scroll area is out of the region bounds. - ** The region bounds are setted in MUI_Redraw() but should probably should go in the - ** MUI's clip functions - */ - - left = MAX(_mleft(obj),clip_rect->MinX); - top = MAX(_mtop(obj),clip_rect->MinY); - right = MIN(_mright(obj),clip_rect->MaxX); - bottom = MIN(_mbottom(obj),clip_rect->MaxY); + ** a (partly visible) virtual groups in a virtual group, because e.g. _mtop() is then + ** smaller than the region. ScrollRasterBF() on AmigaOS then marks the complete region + ** as damaged. Using ScrollWindowRaster() solved that problem but it flickers then. + ** To avoid this we prevent that the scroll area is out of the region bounds. + ** The region bounds are setted in MUI_Redraw() but should probably should go in the + ** MUI's clip functions + */ + + left = MAX(_mleft(obj), clip_rect->MinX); + top = MAX(_mtop(obj), clip_rect->MinY); + right = MIN(_mright(obj), clip_rect->MaxX); + bottom = MIN(_mbottom(obj), clip_rect->MaxY); /* old code was - ** ScrollRasterBF(_rp(obj), diff_virt_offx, diff_virt_offy, _mleft(obj), _mtop(obj), _mright(obj),_mbottom(obj)); - */ + ** ScrollRasterBF(_rp(obj), diff_virt_offx, diff_virt_offy, _mleft(obj), _mtop(obj), _mright(obj),_mbottom(obj)); + */ - ScrollWindowRaster(_window(obj), diff_virt_offx, diff_virt_offy, left, top, right,bottom); + ScrollWindowRaster(_window(obj), diff_virt_offx, diff_virt_offy, + left, top, right, bottom); if ((region = NewRegion())) { - if (diff_virt_offx) - { + if (diff_virt_offx) + { rect.MinY = top; rect.MaxY = bottom; if (diff_virt_offx > 0) { - rect.MinX = right - diff_virt_offx + 1; - if (rect.MinX < left) rect.MinX = left; - rect.MaxX = right; - } else - { + rect.MinX = right - diff_virt_offx + 1; + if (rect.MinX < left) rect.MinX = left; - rect.MaxX = left - diff_virt_offx - 1; - if (rect.MaxX > right) rect.MaxX = right; + rect.MaxX = right; + } + else + { + rect.MinX = left; + rect.MaxX = left - diff_virt_offx - 1; + if (rect.MaxX > right) + rect.MaxX = right; } if (rect.MinX <= rect.MaxX) { - DoMethod(obj, MUIM_DrawBackground, - rect.MinX, rect.MinY, - rect.MaxX - rect.MinX + 1, - rect.MaxY - rect.MinY + 1, - rect.MinX, rect.MinY, 0); + DoMethod(obj, MUIM_DrawBackground, + rect.MinX, rect.MinY, + rect.MaxX - rect.MinX + 1, + rect.MaxY - rect.MinY + 1, + rect.MinX, rect.MinY, 0); - OrRectRegion(region,&rect); + OrRectRegion(region, &rect); } } - if (diff_virt_offy) - { + if (diff_virt_offy) + { rect.MinX = left; rect.MaxX = right; if (diff_virt_offy > 0) { - rect.MinY = bottom - diff_virt_offy + 1; - if (rect.MinY < top) rect.MinY = top; - rect.MaxY = bottom; - } else - { + rect.MinY = bottom - diff_virt_offy + 1; + if (rect.MinY < top) rect.MinY = top; - rect.MaxY = top - diff_virt_offy - 1; - if (rect.MaxY > bottom) rect.MaxY = bottom; + rect.MaxY = bottom; + } + else + { + rect.MinY = top; + rect.MaxY = top - diff_virt_offy - 1; + if (rect.MaxY > bottom) + rect.MaxY = bottom; } if (rect.MinY <= rect.MaxY) { - DoMethod(obj, MUIM_DrawBackground, - rect.MinX, rect.MinY, - rect.MaxX - rect.MinX + 1, - rect.MaxY - rect.MinY + 1, - rect.MinX, rect.MinY, 0); - - OrRectRegion(region,&rect); + DoMethod(obj, MUIM_DrawBackground, + rect.MinX, rect.MinY, + rect.MaxX - rect.MinX + 1, + rect.MaxY - rect.MinY + 1, + rect.MinX, rect.MinY, 0); + + OrRectRegion(region, &rect); } } } - } else + } + else { - if (!(msg->flags & MADF_DRAWOBJECT) && !(msg->flags & MADF_DRAWALL)) + if (!(msg->flags & MADF_DRAWOBJECT) + && !(msg->flags & MADF_DRAWALL)) return TRUE; } } if (data->flags & GROUP_VIRTUAL && !region) { - /* Not really needed if MUI Draws all the objects, maybe that's where DRAWALL is for??? */ + /* Not really needed if MUI Draws all the objects, maybe that's + * what DRAWALL is for??? */ if ((region = NewRegion())) { - struct Rectangle rect; - rect.MinX = _mleft(obj); - rect.MinY = _mtop(obj); - rect.MaxX = _mright(obj); - rect.MaxY = _mbottom(obj); - OrRectRegion(region,&rect); - } + struct Rectangle rect; + rect.MinX = _mleft(obj); + rect.MinY = _mtop(obj); + rect.MaxX = _mright(obj); + rect.MaxY = _mbottom(obj); + OrRectRegion(region, &rect); + } } /* Add clipping region if we have one */ - if (region) clip = MUI_AddClipRegion(muiRenderInfo(obj),region); + if (region) + clip = MUI_AddClipRegion(muiRenderInfo(obj), region); group_rect = muiRenderInfo(obj)->mri_ClipRect; page = -1; get(data->family, MUIA_Family_List, &(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - if (! (_flags(child) & MADF_SHOWME)) + if (!(_flags(child) & MADF_SHOWME)) continue; if (child != data->titlegroup) ++page; - if ((data->flags & GROUP_PAGEMODE) && ((page != data->active_page) && (child != data->titlegroup))) + if ((data->flags & GROUP_PAGEMODE) && ((page != data->active_page) + && (child != data->titlegroup))) { continue; } @@ -1148,7 +1243,7 @@ IPTR Group__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg) // child_rect.MinY = _top(child); // child_rect.MaxX = _right(child); // child_rect.MaxY = _bottom(child); -/* g_print("intersect: a=(%d, %d, %d, %d) b=(%d, %d, %d, %d)\n", */ +/* g_print("intersect: a=(%d, %d, %d, %d) b=(%d, %d, %d, %d)\n", */ /* group_rect.x, group_rect.y, */ /* group_rect.width, group_rect.height, */ /* child_rect.x, child_rect.y, */ @@ -1157,17 +1252,18 @@ IPTR Group__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg) // if (gdk_rectangle_intersect(&group_rect, &child_rect, // &muiRenderInfo(obj)->mri_ClipRect)) // DoMethodA(child, (Msg)msg); -/* if (((msg->flags & MADF_DRAWUPDATE) && data->update) || (data->flags & GROUP_PAGEMODE)) */ - MUI_Redraw(child, MADF_DRAWOBJECT); +/* if (((msg->flags & MADF_DRAWUPDATE) && data->update) */ +/* || (data->flags & GROUP_PAGEMODE)) */ + MUI_Redraw(child, MADF_DRAWOBJECT); /* else */ /* MUI_Redraw(child, msg->flags); */ muiRenderInfo(obj)->mri_ClipRect = group_rect; -/* g_print("set back clip to (%d, %d, %d, %d)\n", */ -/* group_rect.x, group_rect.y, group_rect.width, group_rect.height); */ +/* g_print("set back clip to (%d, %d, %d, %d)\n", */ +/* group_rect.x, group_rect.y, group_rect.width, group_rect.height); */ } /* D(bug("Group_Draw(%p) end\n", obj)); */ - if (data->flags & GROUP_VIRTUAL && region && clip != (APTR)-1) + if (data->flags & GROUP_VIRTUAL && region && clip != (APTR) - 1) { MUI_RemoveClipRegion(muiRenderInfo(obj), clip); } @@ -1205,7 +1301,7 @@ IPTR Group__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg) * - Adjust minwidth w/o making object bigger than their max size. */ static void group_minmax_horiz(struct IClass *cl, Object *obj, - struct MinList *children, struct MUIP_AskMinMax *msg) + struct MinList *children, struct MUIP_AskMinMax *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); Object *cstate; @@ -1220,9 +1316,11 @@ static void group_minmax_horiz(struct IClass *cl, Object *obj, tmp.MinWidth = tmp.DefWidth = tmp.MaxWidth = (data->num_visible_children - 1) * data->horiz_spacing; - if (data->flags & GROUP_SAME_WIDTH) { - cstate = (Object *)children->mlh_Head; - while ((child = NextObject(&cstate))) { + if (data->flags & GROUP_SAME_WIDTH) + { + cstate = (Object *) children->mlh_Head; + while ((child = NextObject(&cstate))) + { if (IS_HIDDEN(child)) continue; maxminwidth = MAX(maxminwidth, _minwidth(child)); @@ -1230,11 +1328,12 @@ static void group_minmax_horiz(struct IClass *cl, Object *obj, } data->samesize_maxmin_horiz = maxminwidth; -/* D(bug("group_minmax_horiz(%p) : maxminwidth=%d\n", obj, maxminwidth)); */ +/* D(bug("group_minmax_horiz(%p) : maxminwidth=%d\n", obj, maxminwidth)); */ data->horiz_weight_sum = 0; - cstate = (Object *)children->mlh_Head; - while ((child = NextObject(&cstate))) { + cstate = (Object *) children->mlh_Head; + while ((child = NextObject(&cstate))) + { WORD minwidth; if (IS_HIDDEN(child)) @@ -1253,9 +1352,9 @@ static void group_minmax_horiz(struct IClass *cl, Object *obj, tmp.MinHeight = MAX(tmp.MinHeight, _minheight(child)); tmp.DefHeight = MAX(tmp.DefHeight, _defheight(child)); /* - if all childs have null weight then maxheight=minheight - if all but some childs have null weights, the maxheight - is the min of all maxheights + if all children have null weight then maxheight=minheight + if all but some children have null weights, the maxheight + is the min of all maxheights */ tmp.MaxHeight = MIN(tmp.MaxHeight, _maxheight(child)); data->horiz_weight_sum += _hweight(child); @@ -1283,7 +1382,7 @@ static void group_minmax_horiz(struct IClass *cl, Object *obj, /* minmax calculation for vertical groups (see group_minmax_horiz) */ static void group_minmax_vert(struct IClass *cl, Object *obj, - struct MinList *children, struct MUIP_AskMinMax *msg) + struct MinList *children, struct MUIP_AskMinMax *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); Object *cstate; @@ -1300,8 +1399,9 @@ static void group_minmax_vert(struct IClass *cl, Object *obj, if (data->flags & GROUP_SAME_HEIGHT) { - cstate = (Object *)children->mlh_Head; - while ((child = NextObject(&cstate))) { + cstate = (Object *) children->mlh_Head; + while ((child = NextObject(&cstate))) + { if (IS_HIDDEN(child)) continue; maxminheight = MAX(maxminheight, _minheight(child)); @@ -1310,7 +1410,7 @@ static void group_minmax_vert(struct IClass *cl, Object *obj, data->samesize_maxmin_vert = maxminheight; data->vert_weight_sum = 0; - cstate = (Object *)children->mlh_Head; + cstate = (Object *) children->mlh_Head; while ((child = NextObject(&cstate))) { if (IS_HIDDEN(child)) @@ -1341,17 +1441,18 @@ static void group_minmax_vert(struct IClass *cl, Object *obj, static void -minmax_2d_rows_pass (struct MUI_GroupData *data, struct MinList *children, - struct MUI_MinMax *req, WORD maxmin_height, WORD maxdef_height) +minmax_2d_rows_pass(struct MUI_GroupData *data, struct MinList *children, + struct MUI_MinMax *req, WORD maxmin_height, WORD maxdef_height) { int i, j; Object *cstate; Object *child; /* do not rewind after the while, to process line by line */ - cstate = (Object *)children->mlh_Head; + cstate = (Object *) children->mlh_Head; /* for each row */ - for (i = 0; i < data->rows; i++) { + for (i = 0; i < data->rows; i++) + { /* calculate min and max height of this row */ int min_h = 0, def_h = 0, max_h = MUI_MAXMAX; BOOL found_nonzero_vweight = FALSE; @@ -1359,7 +1460,8 @@ minmax_2d_rows_pass (struct MUI_GroupData *data, struct MinList *children, data->row_infos[i].weight = 0; j = 0; - while ((child = NextObject(&cstate))) { + while ((child = NextObject(&cstate))) + { if (IS_HIDDEN(child)) continue; if (data->flags & GROUP_SAME_HEIGHT) @@ -1399,14 +1501,15 @@ minmax_2d_rows_pass (struct MUI_GroupData *data, struct MinList *children, static void -minmax_2d_columns_pass (struct MUI_GroupData *data, struct MinList *children, - struct MUI_MinMax *req, WORD maxmin_width, WORD maxdef_width) +minmax_2d_columns_pass(struct MUI_GroupData *data, struct MinList *children, + struct MUI_MinMax *req, WORD maxmin_width, WORD maxdef_width) { int i, j; Object *cstate; Object *child; - for (i = 0; i < data->columns; i++) { + for (i = 0; i < data->columns; i++) + { /* calculate min and max width of this column */ int min_w = 0, def_w = 0, max_w = MUI_MAXMAX; BOOL found_nonzero_hweight = FALSE; @@ -1414,9 +1517,10 @@ minmax_2d_columns_pass (struct MUI_GroupData *data, struct MinList *children, data->col_infos[i].weight = 0; j = 0; - /* process all childs to get childs on a column */ - cstate = (Object *)children->mlh_Head; - while ((child = NextObject(&cstate))) { + /* process all children to get children on a column */ + cstate = (Object *) children->mlh_Head; + while ((child = NextObject(&cstate))) + { if (IS_HIDDEN(child)) continue; ++j; @@ -1430,7 +1534,7 @@ minmax_2d_columns_pass (struct MUI_GroupData *data, struct MinList *children, min_w = MAX(min_w, _minwidth(child)); def_w = MAX(def_w, w0_defwidth(child)); - /* this handles the case of null weight childs, which limit + /* this handles the case of null weight children, which limit * the max size if they're alone, but not if they are with * non-null weight obj */ @@ -1461,7 +1565,7 @@ minmax_2d_columns_pass (struct MUI_GroupData *data, struct MinList *children, static void group_minmax_2d(struct IClass *cl, Object *obj, - struct MinList *children, struct MUIP_AskMinMax *msg) + struct MinList *children, struct MUIP_AskMinMax *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); Object *cstate; @@ -1474,23 +1578,23 @@ group_minmax_2d(struct IClass *cl, Object *obj, if (!data->columns) { - if (data->num_childs % data->rows) + if (data->num_children % data->rows) { data->columns = 1; - data->rows = data->num_childs; + data->rows = data->num_children; } else - data->columns = data->num_childs / data->rows; + data->columns = data->num_children / data->rows; } else { - if (data->num_childs % data->columns) + if (data->num_children % data->columns) { data->rows = 1; - data->columns = data->num_childs; + data->columns = data->num_children; } else - data->rows = data->num_childs / data->columns; + data->rows = data->num_children / data->columns; } if (data->columns < 1) @@ -1508,32 +1612,39 @@ group_minmax_2d(struct IClass *cl, Object *obj, if (data->col_infos != NULL) mui_free(data->col_infos); - data->col_infos = mui_alloc(data->columns * sizeof(struct layout2d_elem)); + data->col_infos = + mui_alloc(data->columns * sizeof(struct layout2d_elem)); if (NULL == data->col_infos) return; data->horiz_weight_sum = 0; data->vert_weight_sum = 0; - tmp.MinHeight = tmp.DefHeight = tmp.MaxHeight = (data->rows - 1) * data->vert_spacing; - tmp.MinWidth = tmp.DefWidth = tmp.MaxWidth = (data->columns - 1) * data->horiz_spacing; - /* get minimum dims if same dims for all childs are needed */ + tmp.MinHeight = tmp.DefHeight = tmp.MaxHeight = + (data->rows - 1) * data->vert_spacing; + tmp.MinWidth = tmp.DefWidth = tmp.MaxWidth = + (data->columns - 1) * data->horiz_spacing; + /* get minimum dims if same dims for all children are needed */ maxmin_width = 0; maxmin_height = 0; maxdef_width = 0; maxdef_height = 0; - if ((data->flags & GROUP_SAME_WIDTH) || (data->flags & GROUP_SAME_HEIGHT)) { - cstate = (Object *)children->mlh_Head; - while ((child = NextObject(&cstate))) { - if (! (_flags(child) & MADF_SHOWME)) + if ((data->flags & GROUP_SAME_WIDTH) + || (data->flags & GROUP_SAME_HEIGHT)) + { + cstate = (Object *) children->mlh_Head; + while ((child = NextObject(&cstate))) + { + if (!(_flags(child) & MADF_SHOWME)) continue; maxmin_width = MAX(maxmin_width, _minwidth(child)); maxmin_height = MAX(maxmin_height, _minheight(child)); maxdef_width = MAX(maxdef_width, w0_defwidth(child)); maxdef_height = MAX(maxdef_height, w0_defheight(child)); } -/* g_print("2d group: mminw=%d mminh=%d\n", maxmin_width, maxmin_height); */ +/* g_print("2d group: mminw=%d mminh=%d\n", */ +/* maxmin_width, maxmin_height); */ } if (data->flags & GROUP_SAME_HEIGHT) data->samesize_maxmin_vert = maxmin_height; @@ -1545,8 +1656,9 @@ group_minmax_2d(struct IClass *cl, Object *obj, else data->samesize_maxmin_horiz = 0; - minmax_2d_rows_pass (data, children, &tmp, maxmin_height, maxdef_height); - minmax_2d_columns_pass (data, children, &tmp, maxmin_width, maxdef_width); + minmax_2d_rows_pass(data, children, &tmp, maxmin_height, maxdef_height); + minmax_2d_columns_pass(data, children, &tmp, maxmin_width, + maxdef_width); END_MINMAX(); } @@ -1554,34 +1666,38 @@ group_minmax_2d(struct IClass *cl, Object *obj, static void group_minmax_pagemode(struct IClass *cl, Object *obj, - struct MinList *children, struct MUIP_AskMinMax *msg) + struct MinList *children, struct MUIP_AskMinMax *msg) { Object *cstate; Object *child; struct MUI_GroupData *data = INST_DATA(cl, obj); struct MUI_MinMax tmp = { 0, 0, MUI_MAXMAX, MUI_MAXMAX, 0, 0 }; - - cstate = (Object *)children->mlh_Head; + + cstate = (Object *) children->mlh_Head; D(bug("minmax_pagemode(%lx)\n", obj, tmp.DefWidth)); while ((child = NextObject(&cstate))) { - if (! (_flags(child) & MADF_SHOWME)) + if (!(_flags(child) & MADF_SHOWME)) continue; if (child == data->titlegroup) continue; tmp.MinHeight = MAX(tmp.MinHeight, _minheight(child)); - D(bug("minmax_pagemode(%p) minh child = %d tmpmin=%d\n", obj, _minheight(child), tmp.MinHeight)); + D(bug("minmax_pagemode(%p) minh child = %d tmpmin=%d\n", obj, + _minheight(child), tmp.MinHeight)); tmp.MinWidth = MAX(tmp.MinWidth, _minwidth(child)); tmp.MaxHeight = MIN(tmp.MaxHeight, w0_maxheight(child)); tmp.MaxWidth = MIN(tmp.MaxWidth, w0_maxwidth(child)); tmp.DefHeight = MAX(tmp.DefHeight, - ((w0_defheight(child) < MUI_MAXMAX) ? w0_defheight(child) : tmp.DefHeight)); - tmp.DefWidth = MAX(tmp.DefWidth, - ((w0_defwidth(child) < MUI_MAXMAX) ? w0_defwidth(child) : tmp.DefWidth)); + ((w0_defheight(child) < + MUI_MAXMAX) ? w0_defheight(child) : tmp.DefHeight)); + tmp.DefWidth = + MAX(tmp.DefWidth, + ((w0_defwidth(child) < + MUI_MAXMAX) ? w0_defwidth(child) : tmp.DefWidth)); D(bug("minmax_pagemode(%lx) defw = %ld\n", obj, tmp.DefWidth)); } @@ -1596,23 +1712,24 @@ group_minmax_pagemode(struct IClass *cl, Object *obj, } /************************************************************************** - MUIM_AskMinMax : ask childs about min/max sizes, then + MUIM_AskMinMax : ask children about min/max sizes, then either call a hook, or the builtin method, to calculate our minmax **************************************************************************/ -IPTR Group__MUIM_AskMinMax(struct IClass *cl, Object *obj, struct MUIP_AskMinMax *msg) +IPTR Group__MUIM_AskMinMax(struct IClass *cl, Object *obj, + struct MUIP_AskMinMax *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - struct MUI_LayoutMsg lm; + struct MUI_LayoutMsg lm; struct MUIP_AskMinMax childMsg; struct MUI_MinMax childMinMax; Object *cstate; Object *child; - LONG super_minwidth,super_minheight; + LONG super_minwidth, super_minheight; /* * let our superclass first fill in its size with frame, inner spc etc ... */ - DoSuperMethodA(cl, obj, (Msg)msg); + DoSuperMethodA(cl, obj, (Msg) msg); super_minwidth = msg->MinMaxInfo->MinWidth; super_minheight = msg->MinMaxInfo->MinHeight; @@ -1623,31 +1740,35 @@ IPTR Group__MUIM_AskMinMax(struct IClass *cl, Object *obj, struct MUIP_AskMinMax childMsg.MinMaxInfo = &childMinMax; get(data->family, MUIA_Family_List, &(lm.lm_Children)); - cstate = (Object *)lm.lm_Children->mlh_Head; + cstate = (Object *) lm.lm_Children->mlh_Head; while ((child = NextObject(&cstate))) { - if (! (_flags(child) & MADF_SHOWME)) /* BORDERGADGETs should handle this itself */ + if (!(_flags(child) & MADF_SHOWME)) + /* BORDERGADGETs should handle this itself */ continue; /* Ask child */ - DoMethodA(child, (Msg)&childMsg); - /* D(bug("*** group %lx, child %lx min=%ld,%ld\n", obj, child, childMinMax.MinWidth, childMinMax.MinHeight)); */ + DoMethodA(child, (Msg) & childMsg); + /* D(bug("*** group %lx, child %lx min=%ld,%ld\n", */ + /* obj, child, childMinMax.MinWidth, childMinMax.MinHeight)); */ __area_finish_minmax(child, childMsg.MinMaxInfo); } /* - * Use childs infos to calculate group size + * Use children infos to calculate group size */ if (data->flags & GROUP_PAGEMODE) { - D(bug("minmax_pagemode(%p) minh initial = %d\n", obj, msg->MinMaxInfo->MinHeight)); + D(bug("minmax_pagemode(%p) minh initial = %d\n", obj, + msg->MinMaxInfo->MinHeight)); group_minmax_pagemode(cl, obj, lm.lm_Children, msg); - D(bug("minmax_pagemode(%p) minh = %d\n", obj, msg->MinMaxInfo->MinHeight)); + D(bug("minmax_pagemode(%p) minh = %d\n", obj, + msg->MinMaxInfo->MinHeight)); } else if (data->layout_hook) { lm.lm_Type = MUILM_MINMAX; - CallHookPkt(data->layout_hook, obj, &lm); + CallHookPkt(data->layout_hook, obj, &lm); if (lm.lm_MinMax.MaxHeight < lm.lm_MinMax.MinHeight) lm.lm_MinMax.MaxHeight = lm.lm_MinMax.MinHeight; @@ -1658,13 +1779,13 @@ IPTR Group__MUIM_AskMinMax(struct IClass *cl, Object *obj, struct MUIP_AskMinMax if (lm.lm_MinMax.DefWidth < lm.lm_MinMax.MinWidth) lm.lm_MinMax.DefWidth = lm.lm_MinMax.MinWidth; - //kprintf("### min %d x %d def %d x %d max %d x %d\n", - // msg->MinMaxInfo->MinWidth, - // msg->MinMaxInfo->MinHeight, - // msg->MinMaxInfo->DefWidth, - // msg->MinMaxInfo->DefHeight, - // msg->MinMaxInfo->MaxWidth, - // msg->MinMaxInfo->MaxHeight); + //kprintf("### min %d x %d def %d x %d max %d x %d\n", + // msg->MinMaxInfo->MinWidth, + // msg->MinMaxInfo->MinHeight, + // msg->MinMaxInfo->DefWidth, + // msg->MinMaxInfo->DefHeight, + // msg->MinMaxInfo->MaxWidth, + // msg->MinMaxInfo->MaxHeight); msg->MinMaxInfo->MinWidth += lm.lm_MinMax.MinWidth; msg->MinMaxInfo->MinHeight += lm.lm_MinMax.MinHeight; @@ -1677,20 +1798,21 @@ IPTR Group__MUIM_AskMinMax(struct IClass *cl, Object *obj, struct MUIP_AskMinMax msg->MinMaxInfo->DefWidth += lm.lm_MinMax.DefWidth; msg->MinMaxInfo->DefHeight += lm.lm_MinMax.DefHeight; - //kprintf("#### min %d x %d def %d x %d max %d x %d\n", - // msg->MinMaxInfo->MinWidth, - // msg->MinMaxInfo->MinHeight, - // msg->MinMaxInfo->DefWidth, - // msg->MinMaxInfo->DefHeight, - // msg->MinMaxInfo->MaxWidth, - // msg->MinMaxInfo->MaxHeight); + //kprintf("#### min %d x %d def %d x %d max %d x %d\n", + // msg->MinMaxInfo->MinWidth, + // msg->MinMaxInfo->MinHeight, + // msg->MinMaxInfo->DefWidth, + // msg->MinMaxInfo->DefHeight, + // msg->MinMaxInfo->MaxWidth, + // msg->MinMaxInfo->MaxHeight); } else { if ((data->rows == 1) && (data->columns == 1)) { - data->num_visible_children = Group_GetNumVisibleChildren(data, lm.lm_Children); + data->num_visible_children = + Group_GetNumVisibleChildren(data, lm.lm_Children); if (data->flags & GROUP_HORIZ) group_minmax_horiz(cl, obj, lm.lm_Children, msg); else @@ -1708,15 +1830,15 @@ IPTR Group__MUIM_AskMinMax(struct IClass *cl, Object *obj, struct MUIP_AskMinMax data->saved_minheight = msg->MinMaxInfo->MinHeight; msg->MinMaxInfo->MinWidth = super_minwidth + 2; msg->MinMaxInfo->MinHeight = super_minheight + 2; - - //kprintf("## min %d x %d def %d x %d max %d x %d\n", - // msg->MinMaxInfo->MinWidth, - // msg->MinMaxInfo->MinHeight, - // msg->MinMaxInfo->DefWidth, - // msg->MinMaxInfo->DefHeight, - // msg->MinMaxInfo->MaxWidth, - // msg->MinMaxInfo->MaxHeight); - + + //kprintf("## min %d x %d def %d x %d max %d x %d\n", + // msg->MinMaxInfo->MinWidth, + // msg->MinMaxInfo->MinHeight, + // msg->MinMaxInfo->DefWidth, + // msg->MinMaxInfo->DefHeight, + // msg->MinMaxInfo->MaxWidth, + // msg->MinMaxInfo->MaxHeight); + } return 0; } @@ -1725,17 +1847,17 @@ IPTR Group__MUIM_AskMinMax(struct IClass *cl, Object *obj, struct MUIP_AskMinMax // enforce minmax constraint, but also update total growable/shrinkable weights // while we're at it -static void Layout1D_minmax_constraint ( - WORD *sizep, WORD minsize, WORD maxsize, WORD *remainp, WORD *sizegrowp, - WORD *sizeshrinkp, ULONG *weightgrowp, ULONG *weightshrinkp, UWORD weight, - WORD samesize) +static void Layout1D_minmax_constraint(WORD *sizep, WORD minsize, + WORD maxsize, WORD *remainp, WORD *sizegrowp, WORD *sizeshrinkp, + ULONG *weightgrowp, ULONG *weightshrinkp, UWORD weight, WORD samesize) { WORD size = *sizep, remain = *remainp, sizegrow = *sizegrowp, sizeshrink = *sizeshrinkp; ULONG weightgrow = *weightgrowp, weightshrink = *weightshrinkp; -/* D(bug("L1D_minmax_c size=%d min=%d max=%d w=%d ss=%d\n", size, minsize, maxsize, */ -/* weight, samesize)); */ +/* D(bug("L1D_minmax_c size=%d min=%d max=%d w=%d ss=%d\n", */ +/* size, minsize, maxsize, */ +/* weight, samesize)); */ if ((samesize > 0) && (weight == 0)) { @@ -1745,7 +1867,7 @@ static void Layout1D_minmax_constraint ( sizegrow -= size; } - if (size <= minsize) // too little + if (size <= minsize) // too little { remain += size - minsize; size = minsize; @@ -1753,7 +1875,7 @@ static void Layout1D_minmax_constraint ( if (size == maxsize) sizegrow -= size; } - else if (size >= maxsize) // too big + else if (size >= maxsize) // too big { remain += size - maxsize; size = maxsize; @@ -1768,18 +1890,20 @@ static void Layout1D_minmax_constraint ( weightshrink += weight; } - *sizep = size; *remainp = remain; - *sizegrowp = sizegrow; *sizeshrinkp = sizeshrink; - *weightgrowp = weightgrow; *weightshrinkp = weightshrink; + *sizep = size; + *remainp = remain; + *sizegrowp = sizegrow; + *sizeshrinkp = sizeshrink; + *weightgrowp = weightgrow; + *weightshrinkp = weightshrink; } // redistribute excess size to growable child, or reduce size of a shrinkable // child -static void Layout1D_redistribution ( - WORD *sizep, WORD minsize, WORD maxsize, WORD *remainp, WORD *sizegrowp, - WORD *sizeshrinkp, ULONG *weightgrowp, ULONG *weightshrinkp, UWORD weight - ) +static void Layout1D_redistribution(WORD *sizep, WORD minsize, + WORD maxsize, WORD *remainp, WORD *sizegrowp, WORD *sizeshrinkp, + ULONG *weightgrowp, ULONG *weightshrinkp, UWORD weight) { WORD size = *sizep, remain = *remainp, sizegrow = *sizegrowp, sizeshrink = *sizeshrinkp; @@ -1794,7 +1918,7 @@ static void Layout1D_redistribution ( newsize = (sizegrow * weight + weightgrow / 2) / weightgrow; -/* D(bug("newsize=%ld == size_growa=%ld * w=%ld / weight_grow=%d\n", */ +/* D(bug("newsize=%ld == size_growa=%ld * w=%ld / weight_grow=%d\n", */ /* newsize, sizegrow, weight, weightgrow)); */ /* take care of off-by-1 errors that may toggle remainder sign @@ -1821,8 +1945,9 @@ static void Layout1D_redistribution ( newsize = (sizeshrink * weight + weightshrink / 2) / weightshrink; -/* D(bug("newsize=%ld == size_shrinkables=%ld * w=%ld / weight_shrinkables=%d\n", */ -/* newsize, sizeshrink, weight, weightshrink)); */ +/* D(bug("newsize=%ld == size_shrinkables=%ld * w=%ld " */ +/* "/ weight_shrinkables=%d\n", */ +/* newsize, sizeshrink, weight, weightshrink)); */ if (remain - newsize + size > 0) { @@ -1840,31 +1965,30 @@ static void Layout1D_redistribution ( } } - *sizep = size; *remainp = remain; - *sizegrowp = sizegrow; *sizeshrinkp = sizeshrink; - *weightgrowp = weightgrow; *weightshrinkp = weightshrink; + *sizep = size; + *remainp = remain; + *sizegrowp = sizegrow; + *sizeshrinkp = sizeshrink; + *weightgrowp = weightgrow; + *weightshrinkp = weightshrink; } // 2 passes at most, less on average (0.5 or 1.5), each does // - a minmax clamping, evenutally adding to a remainder // (remainder = missing (underflow) or remaining (overflow) space compared -// to ideal sizes where childs fill the whole group) +// to ideal sizes where children fill the whole group) // - a redistribution of the remainder, by growing (pos. remainder) or -// shrinking (neg. remainder) childs able to support it. +// shrinking (neg. remainder) children able to support it. // // Occasionnaly the first time the redistribution is done, the minmax // constraint can be broken, thus the extra pass to check and eventually // redistribute. The second redistribution never breaks minmax constraint // (there should be a mathematical proof, but feel free to prove me wrong // with an example) -static void Layout1D_minmax_constraints_and_redistrib ( - struct MinList *children, - WORD total_size, - WORD remainder, - WORD samesize, - BOOL group_horiz -) +static void Layout1D_minmax_constraints_and_redistrib(struct MinList + *children, WORD total_size, WORD remainder, WORD samesize, + BOOL group_horiz) { Object *cstate; Object *child; @@ -1877,11 +2001,12 @@ static void Layout1D_minmax_constraints_and_redistrib ( ULONG weight_growables = 0; ULONG weight_shrinkables = 0; -/* D(bug("start : rem=%ld, A=%ld, size_growables=%ld, size_shrinkables=%ld\n", */ -/* remainder, total_size, size_growables, size_shrinkables)); */ +/* D(bug("start : rem=%ld, A=%ld, size_growables=%ld, " */ +/* "size_shrinkables=%ld\n", */ +/* remainder, total_size, size_growables, size_shrinkables)); */ // minmax constraints - cstate = (Object *)children->mlh_Head; + cstate = (Object *) children->mlh_Head; while ((child = NextObject(&cstate))) { /* WORD old_size; */ @@ -1893,37 +2018,33 @@ static void Layout1D_minmax_constraints_and_redistrib ( { /* old_size = _width(child); */ - Layout1D_minmax_constraint( - &_width(child), _minwidth(child), _maxwidth(child), - &remainder, - &size_growables, &size_shrinkables, - &weight_growables, &weight_shrinkables, - _hweight(child), samesize); + Layout1D_minmax_constraint(&_width(child), _minwidth(child), + _maxwidth(child), &remainder, &size_growables, + &size_shrinkables, &weight_growables, + &weight_shrinkables, _hweight(child), samesize); -/* D(bug("loop1 on %p : width=%d was %d, rem=%d, A=%d, " */ -/* "sizegrow=%d, sizeshrink=%d w=%d min=%d max=%d\n", */ -/* child, _width(child), old_size, remainder, total_size, */ +/* D(bug("loop1 on %p : width=%d was %d, rem=%d, A=%d, " */ +/* "sizegrow=%d, sizeshrink=%d w=%d min=%d max=%d\n", */ +/* child, _width(child), old_size, remainder, total_size, */ /* size_growables, size_shrinkables, _hweight(child), */ /* _minwidth(child), _maxwidth(child))); */ } - else // ! group_horiz + else // ! group_horiz { /* old_size = _height(child); */ - Layout1D_minmax_constraint( - &_height(child), _minheight(child), _maxheight(child), - &remainder, - &size_growables, &size_shrinkables, - &weight_growables, &weight_shrinkables, - _vweight(child), samesize); - -/* D(bug("loop1 on %p : h=%ld was %d, rem=%d, A=%d, " */ -/* "sizegrow=%d, sizeshrink=%d w=%d min=%d max=%d\n", */ -/* child, _height(child), old_size, remainder, total_size, */ -/* size_growables, size_shrinkables, _vweight(child), */ -/* _minheight(child), _maxheight(child))); */ - } // if (group_horiz) - } // while child, minmax constraints + Layout1D_minmax_constraint(&_height(child), + _minheight(child), _maxheight(child), &remainder, + &size_growables, &size_shrinkables, &weight_growables, + &weight_shrinkables, _vweight(child), samesize); + +/* D(bug("loop1 on %p : h=%ld was %d, rem=%d, A=%d, " */ +/* "sizegrow=%d, sizeshrink=%d w=%d min=%d max=%d\n", */ +/* child, _height(child), old_size, remainder, total_size,*/ +/* size_growables, size_shrinkables, _vweight(child), */ +/* _minheight(child), _maxheight(child))); */ + } // if (group_horiz) + } // while child, minmax constraints // mid-pass break if (remainder == 0) @@ -1934,7 +2055,7 @@ static void Layout1D_minmax_constraints_and_redistrib ( /* size_shrinkables, weight_growables, weight_shrinkables)); */ // distribute remaining space to possible candidates - cstate = (Object *)children->mlh_Head; + cstate = (Object *) children->mlh_Head; while (((child = NextObject(&cstate)) != NULL) && (remainder != 0)) { /* WORD old_size; */ @@ -1946,36 +2067,32 @@ static void Layout1D_minmax_constraints_and_redistrib ( { /* old_size = _width(child); */ - Layout1D_redistribution( - &_width(child), _minwidth(child), _maxwidth(child), - &remainder, - &size_growables, &size_shrinkables, - &weight_growables, &weight_shrinkables, - _hweight(child)); + Layout1D_redistribution(&_width(child), _minwidth(child), + _maxwidth(child), &remainder, &size_growables, + &size_shrinkables, &weight_growables, + &weight_shrinkables, _hweight(child)); /* D(bug("loop2 on %p : h=%d was %d, rem=%d, A=%d, " */ /* "size_grow=%d, size_shrink=%d\n", child, */ /* _width(child), old_size, remainder, total_size, */ /* size_growables, size_shrinkables)); */ } - else // ! group_horiz + else // ! group_horiz { /* old_size = _height(child); */ - Layout1D_redistribution( - &_height(child), _minheight(child), _maxheight(child), - &remainder, - &size_growables, &size_shrinkables, - &weight_growables, &weight_shrinkables, - _vweight(child)); + Layout1D_redistribution(&_height(child), _minheight(child), + _maxheight(child), &remainder, &size_growables, + &size_shrinkables, &weight_growables, + &weight_shrinkables, _vweight(child)); /* D(bug("loop2 on %p : h=%d was %d, rem=%d, A=%d, " */ /* "size_grow=%d, size_shrink=%d\n", child, */ /* _height(child), old_size, remainder, total_size, */ /* size_growables, size_shrinkables)); */ - } // if (group_horiz) - - } // while child, redistribution + } // if (group_horiz) + + } // while child, redistribution /* if (remainder != 0) */ /* { */ @@ -1984,7 +2101,7 @@ static void Layout1D_minmax_constraints_and_redistrib ( /* } */ // dont break here if remainder == 0, some minmax constraints // may not be respected - } // end for + } // end for // to easily spot layout bugs, nothing like a (division by zero) exception /* if (remainder != 0) */ @@ -1996,14 +2113,9 @@ static void Layout1D_minmax_constraints_and_redistrib ( } -static void Layout1D_weight_constraint ( - WORD *total_sizep, +static void Layout1D_weight_constraint(WORD *total_sizep, WORD *total_init_sizep, - ULONG *total_weightp, - WORD *sizep, - UWORD weight, - WORD minsize -) + ULONG *total_weightp, WORD *sizep, UWORD weight, WORD minsize) { if (*total_weightp > 0) *sizep = (*total_sizep * weight + *total_weightp / 2) @@ -2011,86 +2123,95 @@ static void Layout1D_weight_constraint ( else *sizep = minsize; - *total_weightp -= weight; - *total_sizep -= *sizep; + *total_weightp -= weight; + *total_sizep -= *sizep; *total_init_sizep += *sizep; } -static void group_layout_vert(struct IClass *cl, Object *obj, struct MinList *children) +static void group_layout_vert(struct IClass *cl, Object *obj, + struct MinList *children) { struct MUI_GroupData *data = INST_DATA(cl, obj); Object *cstate; Object *child; ULONG total_weight; - WORD remainder; /* must converge to 0 to succesfully end layout */ + WORD remainder; /* must converge to 0 to successfully end layout */ WORD total_size; WORD total_size_backup; - WORD total_init_size; /* total size of the ideally sized childs */ + WORD total_init_size; /* total size of the ideally sized children */ WORD width; WORD left = 0; WORD top = 0; WORD layout_width; WORD layout_height; - //kprintf("group_layout_vert: virtoff = %d,%d\n", data->virt_offx, data->virt_offy); + //kprintf("group_layout_vert: virtoff = %d,%d\n", + // data->virt_offx, data->virt_offy); if (data->flags & GROUP_VIRTUAL) { - data->virt_mwidth = CLAMP(_mwidth(obj), data->saved_minwidth - _subwidth(obj), _maxwidth(obj) - _subwidth(obj)); - data->virt_mheight = CLAMP(_mheight(obj), data->saved_minheight - _subheight(obj), _maxheight(obj) - _subheight(obj)); - - layout_width = data->virt_mwidth; + data->virt_mwidth = + CLAMP(_mwidth(obj), data->saved_minwidth - _subwidth(obj), + _maxwidth(obj) - _subwidth(obj)); + data->virt_mheight = + CLAMP(_mheight(obj), data->saved_minheight - _subheight(obj), + _maxheight(obj) - _subheight(obj)); + + layout_width = data->virt_mwidth; layout_height = data->virt_mheight; } else { - layout_width = _mwidth(obj); + layout_width = _mwidth(obj); layout_height = _mheight(obj); } total_weight = data->vert_weight_sum; total_init_size = 0; - total_size = layout_height - (data->num_visible_children - 1) * data->vert_spacing; + total_size = + layout_height - (data->num_visible_children - + 1) * data->vert_spacing; total_size_backup = total_size; -/* D(bug("\nvert layout for %p, A=%d W=%ld\n", obj, total_size, total_weight)); */ +/* D(bug("\nvert layout for %p, A=%d W=%ld\n", */ +/* obj, total_size, total_weight)); */ // weight constraints // calculate ideal size for each object, and total ideal size - cstate = (Object *)children->mlh_Head; + cstate = (Object *) children->mlh_Head; while ((child = NextObject(&cstate))) { if (IS_HIDDEN(child)) continue; - Layout1D_weight_constraint( - &total_size, &total_init_size, &total_weight, - &_height(child), _vweight(child), _minheight(child)); + Layout1D_weight_constraint(&total_size, &total_init_size, + &total_weight, &_height(child), _vweight(child), + _minheight(child)); /* D(bug("child %p : ideal=%d w=%ld\n", */ /* child, _height(child), _vweight(child))); */ - } // while child, weight constraints + } // while child, weight constraints total_size = total_size_backup; remainder = total_size - total_init_size; if (data->flags & GROUP_VIRTUAL) { - /* This is also true for non virtual groups, but if this would be the case - ** then there is a bug in the layout function - */ - if (total_size < 0) total_size = 0; + /* This is also true for non virtual groups, but if this would be the + ** case then there is a bug in the layout function + */ + if (total_size < 0) + total_size = 0; } - Layout1D_minmax_constraints_and_redistrib ( - children, + Layout1D_minmax_constraints_and_redistrib(children, total_size, remainder, (data->flags & GROUP_SAME_HEIGHT) ? data->samesize_maxmin_vert : 0, FALSE); // do the layout - cstate = (Object *)children->mlh_Head; + cstate = (Object *) children->mlh_Head; while ((child = NextObject(&cstate))) { if (IS_HIDDEN(child)) @@ -2100,7 +2221,8 @@ static void group_layout_vert(struct IClass *cl, Object *obj, struct MinList *ch width = MAX(width, _minwidth(child)); left = (layout_width - width) / 2; -/* D(bug("child %p -> layout %d x %d\n", child, width, _height(child))); */ +/* D(bug("child %p -> layout %d x %d\n", */ +/* child, width, _height(child))); */ if (!MUI_Layout(child, left, top, width, _height(child), 0)) return; top += data->vert_spacing + _height(child); @@ -2109,64 +2231,74 @@ static void group_layout_vert(struct IClass *cl, Object *obj, struct MinList *ch } -static void group_layout_horiz(struct IClass *cl, Object *obj, struct MinList *children) +static void group_layout_horiz(struct IClass *cl, Object *obj, + struct MinList *children) { struct MUI_GroupData *data = INST_DATA(cl, obj); Object *cstate; Object *child; ULONG total_weight; - WORD remainder; /* must converge to 0 to succesfully end layout */ + WORD remainder; /* must converge to 0 to succesfully end layout */ WORD total_size; WORD total_size_backup; - WORD total_init_size; /* total size of the ideally sized childs */ + WORD total_init_size; /* total size of the ideally sized children */ WORD height; WORD top = 0; WORD left = 0; WORD layout_width; WORD layout_height; - //kprintf("group_layout_horiz: virtoff = %d,%d\n", data->virt_offx, data->virt_offy); + //kprintf("group_layout_horiz: virtoff = %d,%d\n", + // data->virt_offx, data->virt_offy); if (data->flags & GROUP_VIRTUAL) { - data->virt_mwidth = CLAMP(_mwidth(obj), data->saved_minwidth - _subwidth(obj), _maxwidth(obj) - _subwidth(obj)); - data->virt_mheight = CLAMP(_mheight(obj), data->saved_minheight - _subheight(obj), _maxheight(obj) - _subheight(obj)); - - layout_width = data->virt_mwidth; + data->virt_mwidth = + CLAMP(_mwidth(obj), data->saved_minwidth - _subwidth(obj), + _maxwidth(obj) - _subwidth(obj)); + data->virt_mheight = + CLAMP(_mheight(obj), data->saved_minheight - _subheight(obj), + _maxheight(obj) - _subheight(obj)); + + layout_width = data->virt_mwidth; layout_height = data->virt_mheight; - //kprintf("group_layout_horiz: layoutsize %d x %d virtsize %d x %d msize %d x %d\n", - // layout_width, layout_height, data->virt_mwidth, data->virt_mheight, + //kprintf("group_layout_horiz: layoutsize %d x %d " + // " virtsize %d x %d msize %d x %d\n", + // layout_width, layout_height, data->virt_mwidth, + // data->virt_mheight, // _mwidth(obj), _mheight(obj)); - } else { - layout_width = _mwidth(obj); + layout_width = _mwidth(obj); layout_height = _mheight(obj); } - + total_weight = data->horiz_weight_sum; total_init_size = 0; - total_size = layout_width - (data->num_visible_children - 1) * data->horiz_spacing; + total_size = + layout_width - (data->num_visible_children - + 1) * data->horiz_spacing; total_size_backup = total_size; -/* D(bug("\nhoriz layout for %p, A=%d W=%ld\n", obj, total_size, total_weight)); */ +/* D(bug("\nhoriz layout for %p, A=%d W=%ld\n", */ +/* obj, total_size, total_weight)); */ // weight constraints // calculate ideal size for each object, and total ideal size - cstate = (Object *)children->mlh_Head; + cstate = (Object *) children->mlh_Head; while ((child = NextObject(&cstate))) { if (IS_HIDDEN(child)) continue; - Layout1D_weight_constraint( - &total_size, &total_init_size, &total_weight, - &_width(child), _hweight(child), _minwidth(child)); + Layout1D_weight_constraint(&total_size, &total_init_size, + &total_weight, &_width(child), _hweight(child), + _minwidth(child)); /* D(bug("child %p : ideal=%d w=%ld\n", */ /* child, _width(child), _hweight(child))); */ - } // while child, weight constraints + } // while child, weight constraints total_size = total_size_backup; if (data->horiz_weight_sum > 0) @@ -2176,21 +2308,21 @@ static void group_layout_horiz(struct IClass *cl, Object *obj, struct MinList *c if (data->flags & GROUP_VIRTUAL) { - /* This is also true for non virtual groups, but if this would be the case - ** then there is a bug in the layout function - */ - if (total_size < 0) total_size = 0; + /* This is also true for non virtual groups, but if this would be the + ** case then there is a bug in the layout function + */ + if (total_size < 0) + total_size = 0; } - Layout1D_minmax_constraints_and_redistrib ( - children, + Layout1D_minmax_constraints_and_redistrib(children, total_size, remainder, (data->flags & GROUP_SAME_WIDTH) ? data->samesize_maxmin_horiz : 0, TRUE); // do the layout - cstate = (Object *)children->mlh_Head; + cstate = (Object *) children->mlh_Head; while ((child = NextObject(&cstate))) { if (IS_HIDDEN(child)) @@ -2200,7 +2332,8 @@ static void group_layout_horiz(struct IClass *cl, Object *obj, struct MinList *c height = MAX(height, _minheight(child)); top = (layout_height - height) / 2; -/* D(bug("child %p -> layout %d x %d\n", child, _width(child), height)); */ +/* D(bug("child %p -> layout %d x %d\n", */ +/* child, _width(child), height)); */ if (!MUI_Layout(child, left, top, _width(child), height, 0)) return; left += data->horiz_spacing + _width(child); @@ -2209,8 +2342,7 @@ static void group_layout_horiz(struct IClass *cl, Object *obj, struct MinList *c } -static void Layout2D_weight_constraint ( - struct MUI_GroupData *data, +static void Layout2D_weight_constraint(struct MUI_GroupData *data, struct layout2d_elem *row_infos, struct layout2d_elem *col_infos, WORD total_size_height, WORD total_size_width, @@ -2227,13 +2359,15 @@ static void Layout2D_weight_constraint ( for (i = 0; i < data->rows; i++) { if (total_weight_vert > 0) - row_infos[i].dim = (total_size_height * row_infos[i].weight + total_weight_vert / 2) - / total_weight_vert; + row_infos[i].dim = + (total_size_height * row_infos[i].weight + + total_weight_vert / 2) / total_weight_vert; else row_infos[i].dim = row_infos[i].min; -/* D(bug("l2 row %d : ideal = %d with w=%d, A=%d, W=%d\n", i, row_infos[i].dim, */ -/* row_infos[i].weight, total_size_height, total_weight_vert)); */ +/* D(bug("l2 row %d : ideal = %d with w=%d, A=%d, W=%d\n", */ +/* i, row_infos[i].dim, */ +/* row_infos[i].weight, total_size_height, total_weight_vert)); */ total_weight_vert -= row_infos[i].weight; total_size_height -= row_infos[i].dim; @@ -2244,13 +2378,15 @@ static void Layout2D_weight_constraint ( for (i = 0; i < data->columns; i++) { if (total_weight_horiz) - col_infos[i].dim = (total_size_width * col_infos[i].weight + total_weight_horiz / 2 ) - / total_weight_horiz; + col_infos[i].dim = + (total_size_width * col_infos[i].weight + + total_weight_horiz / 2) / total_weight_horiz; else col_infos[i].dim = col_infos[i].min; -/* D(bug("l2 col %d : ideal = %d with w=%d, A=%d, W=%d\n", i, col_infos[i].dim, */ -/* col_infos[i].weight, total_size_width, total_weight_horiz)); */ +/* D(bug("l2 col %d : ideal = %d with w=%d, A=%d, W=%d\n", */ +/* i, col_infos[i].dim, */ +/* col_infos[i].weight, total_size_width, total_weight_horiz)); */ total_weight_horiz -= col_infos[i].weight; total_size_width -= col_infos[i].dim; @@ -2260,16 +2396,13 @@ static void Layout2D_weight_constraint ( -static void Layout2D_minmax_constraints_and_redistrib ( - struct layout2d_elem *infos, - WORD nitems, - WORD total_size, - WORD samesize, - WORD remainder) +static void Layout2D_minmax_constraints_and_redistrib(struct layout2d_elem + *infos, WORD nitems, WORD total_size, WORD samesize, WORD remainder) { int j; -/* D(bug("L2D mc&r n=%d A=%d ss=%d rem=%d\n", nitems, total_size, samesize, remainder)); */ +/* D(bug("L2D mc&r n=%d A=%d ss=%d rem=%d\n", */ +/* nitems, total_size, samesize, remainder)); */ for (j = 0; j < 2; j++) { @@ -2291,14 +2424,10 @@ static void Layout2D_minmax_constraints_and_redistrib ( /* size_growables, size_shrinkables, infos[i].weight, */ /* infos[i].min, infos[i].max)); */ - Layout1D_minmax_constraint( - &infos[i].dim, infos[i].min, infos[i].max, - &remainder, - &size_growables, &size_shrinkables, - &weight_growables, &weight_shrinkables, - infos[i].weight, - samesize - ); + Layout1D_minmax_constraint(&infos[i].dim, infos[i].min, + infos[i].max, &remainder, &size_growables, + &size_shrinkables, &weight_growables, &weight_shrinkables, + infos[i].weight, samesize); /* D(bug("loop1 on %d : size=%d was %d, rem=%d, A=%d, " */ /* "sizegrow=%d, sizeshrink=%d w=%d min=%d max=%d\n", */ @@ -2319,11 +2448,9 @@ static void Layout2D_minmax_constraints_and_redistrib ( /* infos[i].dim, remainder, total_size, */ /* size_growables, size_shrinkables)); */ - Layout1D_redistribution( - &infos[i].dim, infos[i].min, infos[i].max, - &remainder, - &size_growables, &size_shrinkables, - &weight_growables, &weight_shrinkables, + Layout1D_redistribution(&infos[i].dim, infos[i].min, + infos[i].max, &remainder, &size_growables, + &size_shrinkables, &weight_growables, &weight_shrinkables, infos[i].weight); /* D(bug("loop2 on %d : size=%d was %d, rem=%d, A=%d, " */ @@ -2335,11 +2462,10 @@ static void Layout2D_minmax_constraints_and_redistrib ( } static void -layout_2d_distribute_space (struct MUI_GroupData *data, - struct layout2d_elem *row_infos, - struct layout2d_elem *col_infos, - struct MinList *children, - LONG left_start, LONG top_start) +layout_2d_distribute_space(struct MUI_GroupData *data, + struct layout2d_elem *row_infos, + struct layout2d_elem *col_infos, + struct MinList *children, LONG left_start, LONG top_start) { Object *cstate; Object *child; @@ -2352,7 +2478,7 @@ layout_2d_distribute_space (struct MUI_GroupData *data, /* * pass 2 : distribute space */ - cstate = (Object *)children->mlh_Head; + cstate = (Object *) children->mlh_Head; top = top_start; /* for each row */ for (i = 0; i < data->rows; i++) @@ -2360,7 +2486,7 @@ layout_2d_distribute_space (struct MUI_GroupData *data, /* left start for child layout in this row */ left = left_start; - /* max height for childs in this row */ + /* max height for children in this row */ row_height = row_infos[i].dim; j = 0; /* for each column */ @@ -2373,7 +2499,7 @@ layout_2d_distribute_space (struct MUI_GroupData *data, if (IS_HIDDEN(child)) continue; - /* max width for childs in this column */ + /* max width for children in this column */ col_width = col_infos[j].dim; /* center child if col width is bigger than child maxwidth */ @@ -2386,8 +2512,9 @@ layout_2d_distribute_space (struct MUI_GroupData *data, cheight = MAX(cheight, _minheight(child)); ctop = top + (row_height - cheight) / 2; -/* g_print("layout %d %d %d %d\n", cleft, ctop, cwidth, cheight); */ -/* D(bug("2DL/child %p -> layout %d x %d\n", child, cwidth, cheight)); */ +/* g_print("layout %d %d %d %d\n", cleft, ctop, cwidth, cheight); */ +/* D(bug("2DL/child %p -> layout %d x %d\n", */ +/* child, cwidth, cheight)); */ if (!MUI_Layout(child, cleft, ctop, cwidth, cheight, 0)) return; @@ -2405,28 +2532,30 @@ layout_2d_distribute_space (struct MUI_GroupData *data, /* - * all childs in the same row have the same maximum height - * all childs in the same column have the same maximum height + * all children in the same row have the same maximum height + * all children in the same column have the same maximum height * if a child maximum size is smaller than the biggest minimum size, * the chid will be centered in the remaining space. * * for each row, determine its height allocation * weight ? the vertical weight of a row, if no fixed-height child - * in the row, is the sum of all vertical weights of childs + * in the row, is the sum of all vertical weights of children * all row members will have the same height * * for each column, determine its width allocation * all column members will have the same width */ /* Write a proper hook function */ -static void +static void group_layout_2d(struct IClass *cl, Object *obj, struct MinList *children) { struct MUI_GroupData *data = INST_DATA(cl, obj); WORD left_start = 0; WORD top_start = 0; - WORD total_size_height = _mheight(obj) - (data->rows - 1) * data->vert_spacing; - WORD total_size_width = _mwidth(obj) - (data->columns - 1) * data->horiz_spacing; + WORD total_size_height = + _mheight(obj) - (data->rows - 1) * data->vert_spacing; + WORD total_size_width = + _mwidth(obj) - (data->columns - 1) * data->horiz_spacing; WORD total_init_height; WORD total_init_width; WORD remainder_height; @@ -2436,64 +2565,66 @@ group_layout_2d(struct IClass *cl, Object *obj, struct MinList *children) if (data->rows == 0 || data->columns == 0) return; - if (data->num_childs % data->rows || data->num_childs % data->columns) + if (data->num_children % data->rows + || data->num_children % data->columns) return; if (data->row_infos == NULL || data->col_infos == NULL) return; - - //kprintf("group_layout_horiz: virtoff = %d,%d\n", data->virt_offx, data->virt_offy); + + //kprintf("group_layout_horiz: virtoff = %d,%d\n", + // data->virt_offx, data->virt_offy); if (data->flags & GROUP_VIRTUAL) { - data->virt_mwidth = CLAMP(_mwidth(obj), data->saved_minwidth - _subwidth(obj), _maxwidth(obj) - _subwidth(obj)); - data->virt_mheight = CLAMP(_mheight(obj), data->saved_minheight - _subheight(obj), _maxheight(obj) - _subheight(obj)); - - layout_width = data->virt_mwidth; + data->virt_mwidth = + CLAMP(_mwidth(obj), data->saved_minwidth - _subwidth(obj), + _maxwidth(obj) - _subwidth(obj)); + data->virt_mheight = + CLAMP(_mheight(obj), data->saved_minheight - _subheight(obj), + _maxheight(obj) - _subheight(obj)); + + layout_width = data->virt_mwidth; layout_height = data->virt_mheight; } else { - layout_width = _mwidth(obj); + layout_width = _mwidth(obj); layout_height = _mheight(obj); } - total_size_height = layout_height - (data->rows - 1) * data->vert_spacing; - total_size_width = layout_width - (data->columns - 1) * data->horiz_spacing; + total_size_height = + layout_height - (data->rows - 1) * data->vert_spacing; + total_size_width = + layout_width - (data->columns - 1) * data->horiz_spacing; // fix left/top ? // weight constraints - Layout2D_weight_constraint ( - data, data->row_infos, data->col_infos, + Layout2D_weight_constraint(data, data->row_infos, data->col_infos, total_size_height, total_size_width, &total_init_height, &total_init_width); remainder_height = total_size_height - total_init_height; remainder_width = total_size_width - total_init_width; - Layout2D_minmax_constraints_and_redistrib( - data->row_infos, - data->rows, - total_size_height, -/* (data->flags & GROUP_SAME_HEIGHT) ? data->samesize_maxmin_vert : 0, */ - 0, - remainder_height); - - Layout2D_minmax_constraints_and_redistrib( - data->col_infos, - data->columns, - total_size_width, -/* (data->flags & GROUP_SAME_WIDTH) ? data->samesize_maxmin_horiz : 0, */ - 0, - remainder_width); - - layout_2d_distribute_space (data, data->row_infos, data->col_infos, - children, left_start, top_start); + Layout2D_minmax_constraints_and_redistrib(data->row_infos, + data->rows, total_size_height, +/* (data->flags & GROUP_SAME_HEIGHT) ? data->samesize_maxmin_vert : 0, */ + 0, remainder_height); + + Layout2D_minmax_constraints_and_redistrib(data->col_infos, + data->columns, total_size_width, +/* (data->flags & GROUP_SAME_WIDTH) ? data->samesize_maxmin_horiz : 0, */ + 0, remainder_width); + + layout_2d_distribute_space(data, data->row_infos, data->col_infos, + children, left_start, top_start); } /* Write a proper hook function */ -static void group_layout_pagemode (struct IClass *cl, Object *obj, struct MinList *children) +static void group_layout_pagemode(struct IClass *cl, Object *obj, + struct MinList *children) { struct MUI_GroupData *data = INST_DATA(cl, obj); Object *cstate; @@ -2501,13 +2632,17 @@ static void group_layout_pagemode (struct IClass *cl, Object *obj, struct MinLis WORD layout_width; WORD layout_height; int w, h, yoffset = 0; - + if (data->flags & GROUP_VIRTUAL) { - data->virt_mwidth = CLAMP(_mwidth(obj), data->saved_minwidth - _subwidth(obj), _maxwidth(obj) - _subwidth(obj)); - data->virt_mheight = CLAMP(_mheight(obj), data->saved_minheight - _subheight(obj), _maxheight(obj) - _subheight(obj)); - - layout_width = data->virt_mwidth; + data->virt_mwidth = + CLAMP(_mwidth(obj), data->saved_minwidth - _subwidth(obj), + _maxwidth(obj) - _subwidth(obj)); + data->virt_mheight = + CLAMP(_mheight(obj), data->saved_minheight - _subheight(obj), + _maxheight(obj) - _subheight(obj)); + + layout_width = data->virt_mwidth; layout_height = data->virt_mheight; } else @@ -2522,7 +2657,7 @@ static void group_layout_pagemode (struct IClass *cl, Object *obj, struct MinLis layout_height -= yoffset; } - cstate = (Object *)children->mlh_Head; + cstate = (Object *) children->mlh_Head; while ((child = NextObject(&cstate))) { w = MIN(layout_width, _maxwidth(child)); @@ -2535,8 +2670,8 @@ static void group_layout_pagemode (struct IClass *cl, Object *obj, struct MinLis else { D(bug("PM/child %p -> layout %d x %d\n", child, w, h)); - MUI_Layout(child, (layout_width - w) / 2, yoffset + (layout_height - h) / 2, - w, h, 0); + MUI_Layout(child, (layout_width - w) / 2, + yoffset + (layout_height - h) / 2, w, h, 0); } } } @@ -2546,11 +2681,12 @@ static void group_layout_pagemode (struct IClass *cl, Object *obj, struct MinLis MUIM_Layout Either use a given layout hook, or the builtin method. **************************************************************************/ -IPTR Group__MUIM_Layout(struct IClass *cl, Object *obj, struct MUIP_Layout *msg) +IPTR Group__MUIM_Layout(struct IClass *cl, Object *obj, + struct MUIP_Layout *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - struct MUI_LayoutMsg lm = {0}; - + struct MUI_LayoutMsg lm = { 0 }; + get(data->family, MUIA_Family_List, &(lm.lm_Children)); if (data->flags & GROUP_PAGEMODE) { @@ -2582,26 +2718,28 @@ IPTR Group__MUIM_Layout(struct IClass *cl, Object *obj, struct MUIP_Layout *msg) else group_layout_2d(cl, obj, lm.lm_Children); } - + if (data->flags & GROUP_VIRTUAL) { - WORD new_virt_offx, new_virt_offy; - + WORD new_virt_offx, new_virt_offy; + new_virt_offx = data->virt_offx; new_virt_offy = data->virt_offy; - + if (new_virt_offx + _mwidth(obj) > data->virt_mwidth) { new_virt_offx = data->virt_mwidth - _mwidth(obj); - } - if (new_virt_offx < 0) new_virt_offx = 0; - + } + if (new_virt_offx < 0) + new_virt_offx = 0; + if (new_virt_offy + _mheight(obj) > data->virt_mheight) { new_virt_offy = data->virt_mheight - _mheight(obj); - } - if (new_virt_offy < 0) new_virt_offy = 0; - + } + if (new_virt_offy < 0) + new_virt_offy = 0; + if (new_virt_offx != data->virt_offx) { nfset(obj, MUIA_Virtgroup_Left, new_virt_offx); @@ -2611,27 +2749,30 @@ IPTR Group__MUIM_Layout(struct IClass *cl, Object *obj, struct MUIP_Layout *msg) { nfset(obj, MUIA_Virtgroup_Top, new_virt_offy); } - + } - + return 0; } /************************************************************************** MUIM_Show **************************************************************************/ -IPTR Group__MUIM_Show(struct IClass *cl, Object *obj, struct MUIP_Show *msg) +IPTR Group__MUIM_Show(struct IClass *cl, Object *obj, + struct MUIP_Show *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - struct MinList *ChildList = NULL; + Object *cstate; + Object *child; + struct MinList *ChildList = NULL; - /* If msg is NULL, we won't want that the super method actually gets this call */ - if (msg) DoSuperMethodA(cl,obj,(Msg)msg); + /* If msg is NULL, we won't want that the super method actually gets + * this call */ + if (msg) + DoSuperMethodA(cl, obj, (Msg) msg); get(data->family, MUIA_Family_List, &(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; if (data->flags & GROUP_PAGEMODE) { @@ -2641,7 +2782,7 @@ IPTR Group__MUIM_Show(struct IClass *cl, Object *obj, struct MUIP_Show *msg) if (child == data->titlegroup) { DoShowMethod(child); - continue; /* Title group is not counted as page */ + continue; /* Title group is not counted as page */ } if (page == data->active_page) @@ -2651,14 +2792,15 @@ IPTR Group__MUIM_Show(struct IClass *cl, Object *obj, struct MUIP_Show *msg) } page++; } - } else + } + else { while ((child = NextObject(&cstate))) { if (!(data->flags & GROUP_VIRTUAL) || - IsObjectVisible(child,MUIMasterBase)) + IsObjectVisible(child, MUIMasterBase)) { - if (_flags(child) & MADF_SHOWME) + if (_flags(child) & MADF_SHOWME) DoShowMethod(child); } } @@ -2669,15 +2811,16 @@ IPTR Group__MUIM_Show(struct IClass *cl, Object *obj, struct MUIP_Show *msg) /************************************************************************** MUIM_Hide **************************************************************************/ -IPTR Group__MUIM_Hide(struct IClass *cl, Object *obj, struct MUIP_Hide *msg) +IPTR Group__MUIM_Hide(struct IClass *cl, Object *obj, + struct MUIP_Hide *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - struct MinList *ChildList = NULL; + Object *cstate; + Object *child; + struct MinList *ChildList = NULL; get(data->family, MUIA_Family_List, &(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; if (data->flags & GROUP_PAGEMODE) { @@ -2687,7 +2830,7 @@ IPTR Group__MUIM_Hide(struct IClass *cl, Object *obj, struct MUIP_Hide *msg) if (child == data->titlegroup) { DoHideMethod(child); - continue; /* Title group is not counted as page */ + continue; /* Title group is not counted as page */ } if (page == data->active_page) @@ -2697,17 +2840,20 @@ IPTR Group__MUIM_Hide(struct IClass *cl, Object *obj, struct MUIP_Hide *msg) } page++; } - } else + } + else { - while ((child = NextObject(&cstate))) + while ((child = NextObject(&cstate))) { if (_flags(child) & MADF_CANDRAW) DoHideMethod(child); } } - /* If msg is NULL, we won't want that the super method actually gets this call */ - if (msg) return DoSuperMethodA(cl,obj,(Msg)msg); + /* If msg is NULL, we won't want that the super method actually gets + * this call */ + if (msg) + return DoSuperMethodA(cl, obj, (Msg) msg); return 1; } @@ -2715,14 +2861,15 @@ IPTR Group__MUIM_Hide(struct IClass *cl, Object *obj, struct MUIP_Hide *msg) * MUIM_FindUData : tests if the MUIA_UserData of the object * contains the given and returns the object pointer in this case. */ -IPTR Group__MUIM_FindUData(struct IClass *cl, Object *obj, struct MUIP_FindUData *msg) +IPTR Group__MUIM_FindUData(struct IClass *cl, Object *obj, + struct MUIP_FindUData *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); if (muiNotifyData(obj)->mnd_UserData == msg->udata) - return (IPTR)obj; + return (IPTR) obj; - return DoMethodA(data->family, (Msg)msg); + return DoMethodA(data->family, (Msg) msg); } @@ -2731,7 +2878,8 @@ IPTR Group__MUIM_FindUData(struct IClass *cl, Object *obj, struct MUIP_FindUData * contains the given and gets to for itself * in this case. */ -IPTR Group__MUIM_GetUData(struct IClass *cl, Object *obj, struct MUIP_GetUData *msg) +IPTR Group__MUIM_GetUData(struct IClass *cl, Object *obj, + struct MUIP_GetUData *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); @@ -2741,7 +2889,7 @@ IPTR Group__MUIM_GetUData(struct IClass *cl, Object *obj, struct MUIP_GetUData * return TRUE; } - return DoMethodA(data->family, (Msg)msg); + return DoMethodA(data->family, (Msg) msg); } @@ -2749,14 +2897,15 @@ IPTR Group__MUIM_GetUData(struct IClass *cl, Object *obj, struct MUIP_GetUData * * MUIM_SetUData : This method tests if the MUIA_UserData of the object * contains the given and sets to for itself in this case. */ -IPTR Group__MUIM_SetUData(struct IClass *cl, Object *obj, struct MUIP_SetUData *msg) +IPTR Group__MUIM_SetUData(struct IClass *cl, Object *obj, + struct MUIP_SetUData *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); if (muiNotifyData(obj)->mnd_UserData == msg->udata) set(obj, msg->attr, msg->val); - DoMethodA(data->family, (Msg)msg); + DoMethodA(data->family, (Msg) msg); return TRUE; } @@ -2766,7 +2915,8 @@ IPTR Group__MUIM_SetUData(struct IClass *cl, Object *obj, struct MUIP_SetUData * * contains the given and sets to for itself in this case. * Stop after the first udata found. */ -IPTR Group__MUIM_SetUDataOnce(struct IClass *cl, Object *obj, struct MUIP_SetUData *msg) +IPTR Group__MUIM_SetUDataOnce(struct IClass *cl, Object *obj, + struct MUIP_SetUData *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); @@ -2775,37 +2925,39 @@ IPTR Group__MUIM_SetUDataOnce(struct IClass *cl, Object *obj, struct MUIP_SetUDa set(obj, msg->attr, msg->val); return TRUE; } - return DoMethodA(data->family, (Msg)msg); + return DoMethodA(data->family, (Msg) msg); } /************************************************************************** MUIM_DragQueryExtented **************************************************************************/ -IPTR Group__MUIM_DragQueryExtended(struct IClass *cl, Object *obj, struct MUIP_DragQueryExtended *msg) +IPTR Group__MUIM_DragQueryExtended(struct IClass *cl, Object *obj, + struct MUIP_DragQueryExtended *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - Object *found_obj; - struct MinList *ChildList = NULL; + Object *cstate; + Object *child; + Object *found_obj; + struct MinList *ChildList = NULL; get(data->family, MUIA_Family_List, &(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - if (! (_flags(child) & MADF_CANDRAW)) + if (!(_flags(child) & MADF_CANDRAW)) continue; - if ((found_obj = (Object*)DoMethodA(child, (Msg)msg))) - return (IPTR)found_obj; + if ((found_obj = (Object *) DoMethodA(child, (Msg) msg))) + return (IPTR) found_obj; } - return DoSuperMethodA(cl,obj,(Msg)msg); + return DoSuperMethodA(cl, obj, (Msg) msg); } /************************************************************************** MUIM_HandleEvent **************************************************************************/ -IPTR Group__MUIM_HandleEvent(struct IClass *cl, Object *obj, struct MUIP_HandleEvent *msg) +IPTR Group__MUIM_HandleEvent(struct IClass *cl, Object *obj, + struct MUIP_HandleEvent *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); @@ -2817,73 +2969,91 @@ IPTR Group__MUIM_HandleEvent(struct IClass *cl, Object *obj, struct MUIP_HandleE { switch (msg->imsg->Class) { - case IDCMP_MOUSEBUTTONS: - /* For virtual groups */ - if (msg->imsg->Code == SELECTDOWN) - { - if (_between(_mleft(obj),msg->imsg->MouseX,_mright(obj)) && _between(_mtop(obj),msg->imsg->MouseY,_mbottom(obj))) - { - DoMethod(_win(obj), MUIM_Window_RemEventHandler, (IPTR)&data->ehn); - data->ehn.ehn_Events |= IDCMP_INTUITICKS; - DoMethod(_win(obj), MUIM_Window_AddEventHandler, (IPTR)&data->ehn); - } - } else - { - if (data->ehn.ehn_Events & IDCMP_INTUITICKS) - { - DoMethod(_win(obj), MUIM_Window_RemEventHandler, (IPTR)&data->ehn); - data->ehn.ehn_Events &= ~IDCMP_INTUITICKS; - DoMethod(_win(obj), MUIM_Window_AddEventHandler, (IPTR)&data->ehn); - } - } - break; + case IDCMP_MOUSEBUTTONS: + /* For virtual groups */ + if (msg->imsg->Code == SELECTDOWN) + { + if (_between(_mleft(obj), msg->imsg->MouseX, _mright(obj)) + && _between(_mtop(obj), msg->imsg->MouseY, + _mbottom(obj))) + { + DoMethod(_win(obj), MUIM_Window_RemEventHandler, + (IPTR) & data->ehn); + data->ehn.ehn_Events |= IDCMP_INTUITICKS; + DoMethod(_win(obj), MUIM_Window_AddEventHandler, + (IPTR) & data->ehn); + } + } + else + { + if (data->ehn.ehn_Events & IDCMP_INTUITICKS) + { + DoMethod(_win(obj), MUIM_Window_RemEventHandler, + (IPTR) & data->ehn); + data->ehn.ehn_Events &= ~IDCMP_INTUITICKS; + DoMethod(_win(obj), MUIM_Window_AddEventHandler, + (IPTR) & data->ehn); + } + } + break; - case IDCMP_INTUITICKS: - if (!(data->ehn.ehn_Events & IDCMP_INTUITICKS)) break; - - if (!(_between(_mleft(obj),msg->imsg->MouseX,_mright(obj)) && _between(_mtop(obj),msg->imsg->MouseY,_mbottom(obj)))) - { - LONG new_virt_offx = data->virt_offx; - LONG new_virt_offy = data->virt_offy; - - if (msg->imsg->MouseX < _mleft(obj)) - { - /* scroll left */ - if (new_virt_offx >= 4) new_virt_offx -= 4; - else new_virt_offx = 0; - } - else if (msg->imsg->MouseX > _mright(obj)) - { - /* scroll right */ - new_virt_offx += 4; - if (new_virt_offx > data->virt_mwidth - _mwidth(obj)) new_virt_offx = data->virt_mwidth - _mwidth(obj); - if (new_virt_offx < 0) new_virt_offx = 0; - } - - if (msg->imsg->MouseY < _mtop(obj)) - { - /* scroll top */ - if (new_virt_offy >= 4) new_virt_offy -= 4; - else new_virt_offy = 0; - } - else if (msg->imsg->MouseY > _mbottom(obj)) - { - /* scroll bottom */ - new_virt_offy += 4; - if (new_virt_offy > data->virt_mheight - _mheight(obj)) new_virt_offy = data->virt_mheight - _mheight(obj); - if (new_virt_offy < 0) new_virt_offy = 0; - } - - if (new_virt_offx != data->virt_offx || new_virt_offy != data->virt_offy) - { - SetAttrs(obj, - MUIA_Virtgroup_Left, new_virt_offx, - MUIA_Virtgroup_Top, new_virt_offy, - MUIA_Group_Forward, FALSE, - TAG_DONE); - } - } - break; + case IDCMP_INTUITICKS: + if (!(data->ehn.ehn_Events & IDCMP_INTUITICKS)) + break; + + if (!(_between(_mleft(obj), msg->imsg->MouseX, _mright(obj)) + && _between(_mtop(obj), msg->imsg->MouseY, + _mbottom(obj)))) + { + LONG new_virt_offx = data->virt_offx; + LONG new_virt_offy = data->virt_offy; + + if (msg->imsg->MouseX < _mleft(obj)) + { + /* scroll left */ + if (new_virt_offx >= 4) + new_virt_offx -= 4; + else + new_virt_offx = 0; + } + else if (msg->imsg->MouseX > _mright(obj)) + { + /* scroll right */ + new_virt_offx += 4; + if (new_virt_offx > data->virt_mwidth - _mwidth(obj)) + new_virt_offx = data->virt_mwidth - _mwidth(obj); + if (new_virt_offx < 0) + new_virt_offx = 0; + } + + if (msg->imsg->MouseY < _mtop(obj)) + { + /* scroll top */ + if (new_virt_offy >= 4) + new_virt_offy -= 4; + else + new_virt_offy = 0; + } + else if (msg->imsg->MouseY > _mbottom(obj)) + { + /* scroll bottom */ + new_virt_offy += 4; + if (new_virt_offy > data->virt_mheight - _mheight(obj)) + new_virt_offy = data->virt_mheight - _mheight(obj); + if (new_virt_offy < 0) + new_virt_offy = 0; + } + + if (new_virt_offx != data->virt_offx + || new_virt_offy != data->virt_offy) + { + SetAttrs(obj, + MUIA_Virtgroup_Left, new_virt_offx, + MUIA_Virtgroup_Top, new_virt_offy, + MUIA_Group_Forward, FALSE, TAG_DONE); + } + } + break; } } @@ -2893,21 +3063,22 @@ IPTR Group__MUIM_HandleEvent(struct IClass *cl, Object *obj, struct MUIP_HandleE /************************************************************************** MUIM_DrawBackground **************************************************************************/ -IPTR Group__MUIM_DrawBackground(struct IClass *cl, Object *obj, struct MUIP_DrawBackground *msg) +IPTR Group__MUIM_DrawBackground(struct IClass *cl, Object *obj, + struct MUIP_DrawBackground *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); if (data->flags & GROUP_VIRTUAL) { - struct MUIP_DrawBackground msg2 = *msg; - + struct MUIP_DrawBackground msg2 = *msg; + msg2.xoffset += data->virt_offx; msg2.yoffset += data->virt_offy; - - return DoSuperMethodA(cl, obj, (Msg)&msg2); + + return DoSuperMethodA(cl, obj, (Msg) & msg2); } - - return DoSuperMethodA(cl, obj, (Msg)msg); + + return DoSuperMethodA(cl, obj, (Msg) msg); } /************************************************************************** @@ -2915,59 +3086,60 @@ IPTR Group__MUIM_DrawBackground(struct IClass *cl, Object *obj, struct MUIP_Draw Find the given object or return NULL **************************************************************************/ IPTR Group__MUIM_FindAreaObject(struct IClass *cl, Object *obj, - struct MUIP_FindAreaObject *msg) + struct MUIP_FindAreaObject *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - struct MinList *ChildList = NULL; + Object *cstate; + Object *child; + struct MinList *ChildList = NULL; // it's me ? if (msg->obj == obj) - return (IPTR)obj; + return (IPTR) obj; - // it's one of my childs ? + // it's one of my children ? get(data->family, MUIA_Family_List, &(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { if (msg->obj == child) - return (IPTR)child; + return (IPTR) child; } - // let the childs find it + // let the children find it get(data->family, MUIA_Family_List, &(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - Object *res = (Object *)DoMethodA(child, (Msg)msg); + Object *res = (Object *) DoMethodA(child, (Msg) msg); if (res != NULL) - return (IPTR)res; + return (IPTR) res; } - return (IPTR)NULL; + return (IPTR) NULL; } /************************************************************************** MUIM_Export : to export an objects "contents" to a dataspace object. **************************************************************************/ -static IPTR Group__MUIM_Export(struct IClass *cl, Object *obj, struct MUIP_Export *msg) +static IPTR Group__MUIM_Export(struct IClass *cl, Object *obj, + struct MUIP_Export *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - struct MinList *ChildList = NULL; + Object *cstate; + Object *child; + struct MinList *ChildList = NULL; get(data->family, MUIA_Family_List, &(ChildList)); if (!ChildList) - return 0; + return 0; - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - DoMethodA(child, (Msg)msg); + DoMethodA(child, (Msg) msg); } - + return 0; } @@ -2975,21 +3147,22 @@ static IPTR Group__MUIM_Export(struct IClass *cl, Object *obj, struct MUIP_Expor /************************************************************************** MUIM_Import : to import an objects "contents" from a dataspace object. **************************************************************************/ -static IPTR Group__MUIM_Import(struct IClass *cl, Object *obj, struct MUIP_Import *msg) +static IPTR Group__MUIM_Import(struct IClass *cl, Object *obj, + struct MUIP_Import *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - struct MinList *ChildList = NULL; + Object *cstate; + Object *child; + struct MinList *ChildList = NULL; get(data->family, MUIA_Family_List, &(ChildList)); if (!ChildList) - return 0; + return 0; - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - DoMethodA(child, (Msg)msg); + DoMethodA(child, (Msg) msg); } return 0; @@ -3000,34 +3173,37 @@ static IPTR Group__MUIM_Import(struct IClass *cl, Object *obj, struct MUIP_Impor check in MUIM_Notify which is no longer the case **************************************************************************/ #if 0 -STATIC IPTR Group_Notify(struct IClass *cl, Object *obj, struct MUIP_Notify *msg) +STATIC IPTR Group_Notify(struct IClass *cl, Object *obj, + struct MUIP_Notify *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - struct MinList *ChildList; + Object *cstate; + Object *child; + struct MinList *ChildList; /* Try at first if understand the message our self - ** We disable the forwarding of the OM_GET message - ** as the MUIM_Notify otherwise would "think" that - ** the group class actually understands the attribute - ** although a child does this only - */ + ** We disable the forwarding of the OM_GET message + ** as the MUIM_Notify otherwise would "think" that + ** the group class actually understands the attribute + ** although a child does this only + */ data->dont_forward_get = 1; - if (DoSuperMethodA(cl,obj,(Msg)msg)) + if (DoSuperMethodA(cl, obj, (Msg) msg)) { - data->dont_forward_get = 0; + data->dont_forward_get = 0; return 1; } - /* We ourself didn't understand the notify tag so we try the children now */ + /* We ourselves didn't understand the notify tag so we try the + * children now */ data->dont_forward_get = 0; - get(data->family, MUIA_Family_List, (IPTR *)&(ChildList)); - cstate = (Object *)ChildList->mlh_Head; + get(data->family, MUIA_Family_List, (IPTR *) & (ChildList)); + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - if (DoMethodA(child, (Msg)msg)) return 1; + if (DoMethodA(child, (Msg) msg)) + return 1; } return 0; } @@ -3053,12 +3229,13 @@ Zune to work like MUI one needs to choose a size which one hopes will be big enough to hold all possible attributes of all classes, old, present and future ones. */ -STATIC IPTR Group_Notify(struct IClass *cl, Object *obj, struct MUIP_Notify *msg) +STATIC IPTR Group_Notify(struct IClass *cl, Object *obj, + struct MUIP_Notify *msg) { struct MUI_GroupData *data = INST_DATA(cl, obj); - Object *cstate; - Object *child; - struct MinList *ChildList = NULL; + Object *cstate; + Object *child; + struct MinList *ChildList = NULL; IPTR attr[30]; data->dont_forward_get = 1; @@ -3066,23 +3243,23 @@ STATIC IPTR Group_Notify(struct IClass *cl, Object *obj, struct MUIP_Notify *msg if (GetAttr(msg->TrigAttr, obj, attr)) { data->dont_forward_get = 0; - return DoSuperMethodA(cl,obj,(Msg)msg); + return DoSuperMethodA(cl, obj, (Msg) msg); } data->dont_forward_get = 0; - + get(data->family, MUIA_Family_List, &(ChildList)); if (!ChildList) - return TRUE; + return TRUE; - cstate = (Object *)ChildList->mlh_Head; + cstate = (Object *) ChildList->mlh_Head; while ((child = NextObject(&cstate))) { - if (GetAttr(msg->TrigAttr, child, attr)) - { - DoMethodA(child, (Msg)msg); - /* No return here! */ - } + if (GetAttr(msg->TrigAttr, child, attr)) + { + DoMethodA(child, (Msg) msg); + /* No return here! */ + } } return TRUE; } @@ -3092,85 +3269,118 @@ BOOPSI_DISPATCHER(IPTR, Group_Dispatcher, cl, obj, msg) { switch (msg->MethodID) { - case OM_NEW: return Group__OM_NEW(cl, obj, (struct opSet *) msg); - case OM_DISPOSE: return Group__OM_DISPOSE(cl, obj, msg); - case OM_SET: return Group__OM_SET(cl, obj, (struct opSet *)msg); - case OM_GET: return Group__OM_GET(cl, obj, (struct opGet *)msg); - case OM_ADDMEMBER: /* Fall through */ - case MUIM_Group_AddTail: return Group__MUIM_AddTail(cl, obj, (APTR)msg); - case MUIM_Group_AddHead: return Group__MUIM_AddHead(cl, obj, (APTR)msg); - case MUIM_Group_Insert: return Group__MUIM_Insert(cl, obj, (APTR)msg); - case OM_REMMEMBER: /* Fall through */ - case MUIM_Group_Remove: return Group__MUIM_Remove(cl, obj, (APTR)msg); - case MUIM_AskMinMax: return Group__MUIM_AskMinMax(cl, obj, (APTR)msg); - case MUIM_Group_ExitChange: return Group__MUIM_ExitChange(cl, obj, (APTR)msg); - case MUIM_Group_InitChange: return Group__MUIM_InitChange(cl, obj, (APTR)msg); - case MUIM_Group_Sort: return Group__MUIM_Sort(cl, obj, (APTR)msg); - case MUIM_Group_DoMethodNoForward: return Group__MUIM_DoMethodNoForward(cl, obj, (APTR)msg); - case MUIM_ConnectParent: return Group__MUIM_ConnectParent(cl, obj, (APTR)msg); - case MUIM_DisconnectParent: return Group__MUIM_DisconnectParent(cl, obj, (APTR)msg); - case MUIM_Layout: return Group__MUIM_Layout(cl, obj, (APTR)msg); - case MUIM_Setup: return Group__MUIM_Setup(cl, obj, (APTR)msg); - case MUIM_Cleanup: return Group__MUIM_Cleanup(cl, obj, (APTR)msg); - case MUIM_Draw: return Group__MUIM_Draw(cl, obj, (APTR)msg); - - case MUIM_FindUData: return Group__MUIM_FindUData(cl, obj, (APTR)msg); - case MUIM_GetUData: return Group__MUIM_GetUData(cl, obj, (APTR)msg); - case MUIM_SetUData: return Group__MUIM_SetUData(cl, obj, (APTR)msg); - case MUIM_SetUDataOnce: return Group__MUIM_SetUDataOnce(cl, obj, (APTR)msg); - case MUIM_Show: return Group__MUIM_Show(cl, obj, (APTR)msg); - case MUIM_Hide: return Group__MUIM_Hide(cl, obj, (APTR)msg); - case MUIM_HandleEvent: return Group__MUIM_HandleEvent(cl,obj, (APTR)msg); - case MUIM_DrawBackground: return Group__MUIM_DrawBackground(cl, obj, (APTR)msg); - case MUIM_DragQueryExtended:return Group__MUIM_DragQueryExtended(cl, obj, (APTR)msg); - case MUIM_FindAreaObject: return Group__MUIM_FindAreaObject(cl, obj, (APTR)msg); - case MUIM_Export: return Group__MUIM_Export(cl, obj, (APTR) msg); - case MUIM_Import: return Group__MUIM_Import(cl, obj, (APTR) msg); + case OM_NEW: + return Group__OM_NEW(cl, obj, (struct opSet *)msg); + case OM_DISPOSE: + return Group__OM_DISPOSE(cl, obj, msg); + case OM_SET: + return Group__OM_SET(cl, obj, (struct opSet *)msg); + case OM_GET: + return Group__OM_GET(cl, obj, (struct opGet *)msg); + case OM_ADDMEMBER: /* Fall through */ + case MUIM_Group_AddTail: + return Group__MUIM_AddTail(cl, obj, (APTR) msg); + case MUIM_Group_AddHead: + return Group__MUIM_AddHead(cl, obj, (APTR) msg); + case MUIM_Group_Insert: + return Group__MUIM_Insert(cl, obj, (APTR) msg); + case OM_REMMEMBER: /* Fall through */ + case MUIM_Group_Remove: + return Group__MUIM_Remove(cl, obj, (APTR) msg); + case MUIM_AskMinMax: + return Group__MUIM_AskMinMax(cl, obj, (APTR) msg); + case MUIM_Group_ExitChange: + return Group__MUIM_ExitChange(cl, obj, (APTR) msg); + case MUIM_Group_InitChange: + return Group__MUIM_InitChange(cl, obj, (APTR) msg); + case MUIM_Group_Sort: + return Group__MUIM_Sort(cl, obj, (APTR) msg); + case MUIM_Group_DoMethodNoForward: + return Group__MUIM_DoMethodNoForward(cl, obj, (APTR) msg); + case MUIM_ConnectParent: + return Group__MUIM_ConnectParent(cl, obj, (APTR) msg); + case MUIM_DisconnectParent: + return Group__MUIM_DisconnectParent(cl, obj, (APTR) msg); + case MUIM_Layout: + return Group__MUIM_Layout(cl, obj, (APTR) msg); + case MUIM_Setup: + return Group__MUIM_Setup(cl, obj, (APTR) msg); + case MUIM_Cleanup: + return Group__MUIM_Cleanup(cl, obj, (APTR) msg); + case MUIM_Draw: + return Group__MUIM_Draw(cl, obj, (APTR) msg); + + case MUIM_FindUData: + return Group__MUIM_FindUData(cl, obj, (APTR) msg); + case MUIM_GetUData: + return Group__MUIM_GetUData(cl, obj, (APTR) msg); + case MUIM_SetUData: + return Group__MUIM_SetUData(cl, obj, (APTR) msg); + case MUIM_SetUDataOnce: + return Group__MUIM_SetUDataOnce(cl, obj, (APTR) msg); + case MUIM_Show: + return Group__MUIM_Show(cl, obj, (APTR) msg); + case MUIM_Hide: + return Group__MUIM_Hide(cl, obj, (APTR) msg); + case MUIM_HandleEvent: + return Group__MUIM_HandleEvent(cl, obj, (APTR) msg); + case MUIM_DrawBackground: + return Group__MUIM_DrawBackground(cl, obj, (APTR) msg); + case MUIM_DragQueryExtended: + return Group__MUIM_DragQueryExtended(cl, obj, (APTR) msg); + case MUIM_FindAreaObject: + return Group__MUIM_FindAreaObject(cl, obj, (APTR) msg); + case MUIM_Export: + return Group__MUIM_Export(cl, obj, (APTR) msg); + case MUIM_Import: + return Group__MUIM_Import(cl, obj, (APTR) msg); //#if 0 #if 1 - /* Disabled. See above */ - case MUIM_Notify: return Group_Notify(cl, obj, (APTR)msg); + /* Disabled. See above */ + case MUIM_Notify: + return Group_Notify(cl, obj, (APTR) msg); #endif - case MUIM_Set: - case MUIM_MultiSet: - case MUIM_CallHook: - case MUIM_DrawParentBackground: - case MUIM_DragBegin: - case MUIM_DragDrop: - case MUIM_DragQuery: - case MUIM_DragFinish: - case MUIM_DoDrag: - case MUIM_CreateDragImage: - case MUIM_DeleteDragImage: - case MUIM_GoActive: - case MUIM_GoInactive: - case MUIM_CreateBubble: - case MUIM_DeleteBubble: - case MUIM_CreateShortHelp: - case MUIM_DeleteShortHelp: - case OM_ADDTAIL: - case OM_REMOVE: - return DoSuperMethodA(cl, obj, (APTR)msg); /* Needs not to be forwarded? */ + case MUIM_Set: + case MUIM_MultiSet: + case MUIM_CallHook: + case MUIM_DrawParentBackground: + case MUIM_DragBegin: + case MUIM_DragDrop: + case MUIM_DragQuery: + case MUIM_DragFinish: + case MUIM_DoDrag: + case MUIM_CreateDragImage: + case MUIM_DeleteDragImage: + case MUIM_GoActive: + case MUIM_GoInactive: + case MUIM_CreateBubble: + case MUIM_DeleteBubble: + case MUIM_CreateShortHelp: + case MUIM_DeleteShortHelp: + case OM_ADDTAIL: + case OM_REMOVE: + return DoSuperMethodA(cl, obj, (APTR) msg); + /* Needs not to be forwarded? */ } /* sometimes you want to call a superclass method, * but not dispatching to child. * But what to do with list methods in a listview ? */ - Group_DispatchMsg(cl, obj, (APTR)msg); + Group_DispatchMsg(cl, obj, (APTR) msg); return DoSuperMethodA(cl, obj, msg); } BOOPSI_DISPATCHER_END - /* * Class descriptor. */ -const struct __MUIBuiltinClass _MUI_Group_desc = { - MUIC_Group, - MUIC_Area, - sizeof(struct MUI_GroupData), - (void*)Group_Dispatcher +const struct __MUIBuiltinClass _MUI_Group_desc = +{ + MUIC_Group, + MUIC_Area, + sizeof(struct MUI_GroupData), + (void *) Group_Dispatcher }; diff --git a/workbench/libs/muimaster/classes/group.h b/workbench/libs/muimaster/classes/group.h dissimilarity index 72% index f5d52d8806..4c46bb4155 100644 --- a/workbench/libs/muimaster/classes/group.h +++ b/workbench/libs/muimaster/classes/group.h @@ -1,89 +1,141 @@ -#ifndef _MUI_CLASSES_GROUP_H -#define _MUI_CLASSES_GROUP_H - -/* - Copyright © 1999, David Le Corfec. - Copyright © 2002-2012, The AROS Development Team. - All rights reserved. - - $Id$ -*/ - -/*** Name *******************************************************************/ -#define MUIC_Group "Group.mui" - -/*** Identifier base (for Zune extensions) **********************************/ -#define MUIB_Group (MUIB_ZUNE | 0x00001000) - -/*** Methods ****************************************************************/ -#define MUIM_Group_AddHead (MUIB_MUI|0x0042e200) /* MUI: V8 */ -#define MUIM_Group_AddTail (MUIB_MUI|0x0042d752) /* MUI: V8 */ -#define MUIM_Group_ExitChange (MUIB_MUI|0x0042d1cc) /* MUI: V11 */ -#define MUIM_Group_InitChange (MUIB_MUI|0x00420887) /* MUI: V11 */ -#define MUIM_Group_Sort (MUIB_MUI|0x00427417) /* MUI: V4 */ -#define MUIM_Group_Remove (MUIB_MUI|0x0042f8a9) /* MUI: V8 */ -struct MUIP_Group_AddHead {STACKED ULONG MethodID; STACKED Object *obj;}; -struct MUIP_Group_AddTail {STACKED ULONG MethodID; STACKED Object *obj;}; -struct MUIP_Group_ExitChange {STACKED ULONG MethodID;}; -struct MUIP_Group_InitChange {STACKED ULONG MethodID;}; -struct MUIP_Group_Sort {STACKED ULONG MethodID; STACKED Object *obj[1];}; -struct MUIP_Group_Remove {STACKED ULONG MethodID; STACKED Object *obj;}; - -#define MUIM_Group_DoMethodNoForward (MUIB_Group | 0x00000000) -struct MUIP_Group_DoMethodNoForward {STACKED ULONG MethodID; STACKED ULONG DoMethodID; }; /* msg stuff follows */ - -/*** Attributes *************************************************************/ -#define MUIA_Group_ActivePage (MUIB_MUI|0x00424199) /* MUI: V5 isg LONG */ -#define MUIA_Group_Child (MUIB_MUI|0x004226e6) /* MUI: V4 i.. Object * */ -#define MUIA_Group_ChildList (MUIB_MUI|0x00424748) /* MUI: V4 ..g struct List * */ -#define MUIA_Group_Columns (MUIB_MUI|0x0042f416) /* MUI: V4 is. LONG */ -#define MUIA_Group_Forward (MUIB_MUI|0x00421422) /* MUI: V11 .s. BOOL */ -#define MUIA_Group_Horiz (MUIB_MUI|0x0042536b) /* MUI: V4 i.. BOOL */ -#define MUIA_Group_HorizSpacing (MUIB_MUI|0x0042c651) /* MUI: V4 isg LONG */ -#define MUIA_Group_LayoutHook (MUIB_MUI|0x0042c3b2) /* MUI: V11 i.. struct Hook * */ -#define MUIA_Group_PageMode (MUIB_MUI|0x00421a5f) /* MUI: V5 i.. BOOL */ -#define MUIA_Group_Rows (MUIB_MUI|0x0042b68f) /* MUI: V4 is. LONG */ -#define MUIA_Group_SameHeight (MUIB_MUI|0x0042037e) /* MUI: V4 i.. BOOL */ -#define MUIA_Group_SameSize (MUIB_MUI|0x00420860) /* MUI: V4 i.. BOOL */ -#define MUIA_Group_SameWidth (MUIB_MUI|0x0042b3ec) /* MUI: V4 i.. BOOL */ -#define MUIA_Group_Spacing (MUIB_MUI|0x0042866d) /* MUI: V4 is. LONG */ -#define MUIA_Group_VertSpacing (MUIB_MUI|0x0042e1bf) /* MUI: V4 isg LONG */ - -#define MUIA_Group_Virtual (MUIB_Group | 0x00000000) /* Zune: V1 i.. BOOL */ - -enum { - MUIV_Group_ActivePage_First = 0, - MUIV_Group_ActivePage_Last = -1, - MUIV_Group_ActivePage_Prev = -2, - MUIV_Group_ActivePage_Next = -3, - MUIV_Group_ActivePage_Advance = -4, -}; - -/* This is the message you get if your custom layout hook is called */ -struct MUI_LayoutMsg -{ - STACKED ULONG lm_Type; /* the message type */ - STACKED struct MinList *lm_Children; /* exec list of the children of this group */ - STACKED struct MUI_MinMax lm_MinMax; /* here you have to place the MUILM_MINMAX results */ - struct - { - STACKED LONG Width; - STACKED LONG Height; - STACKED ULONG priv5; - STACKED ULONG priv6; - } lm_Layout; /* size (and result) for MUILM_LAYOUT */ -}; - -/* lm_Type */ -enum -{ - MUILM_MINMAX = 1, /* Please calc your min & max siizes */ - MUILM_LAYOUT = 2, /* Please layout your children */ -}; - -#define MUILM_UNKNOWN -1 /* should be returned if the hook function doesn't understand lm_Type */ - - -extern const struct __MUIBuiltinClass _MUI_Group_desc; /* PRIV */ - -#endif /* _MUI_CLASSES_GROUP_H */ +#ifndef _MUI_CLASSES_GROUP_H +#define _MUI_CLASSES_GROUP_H + +/* + Copyright © 1999, David Le Corfec. + Copyright © 2002-2012, The AROS Development Team. + All rights reserved. + + $Id$ +*/ + +/*** Name *******************************************************************/ +#define MUIC_Group "Group.mui" + +/*** Identifier base (for Zune extensions) **********************************/ +#define MUIB_Group (MUIB_ZUNE | 0x00001000) + +/*** Methods ****************************************************************/ +#define MUIM_Group_AddHead (MUIB_MUI | 0x0042e200) /* MUI: V8 */ +#define MUIM_Group_AddTail (MUIB_MUI | 0x0042d752) /* MUI: V8 */ +#define MUIM_Group_ExitChange (MUIB_MUI | 0x0042d1cc) /* MUI: V11 */ +#define MUIM_Group_InitChange (MUIB_MUI | 0x00420887) /* MUI: V11 */ +#define MUIM_Group_Sort (MUIB_MUI | 0x00427417) /* MUI: V4 */ +#define MUIM_Group_Remove (MUIB_MUI | 0x0042f8a9) /* MUI: V8 */ + +struct MUIP_Group_AddHead +{ + STACKED ULONG MethodID; + STACKED Object *obj; +}; + +struct MUIP_Group_AddTail +{ + STACKED ULONG MethodID; + STACKED Object *obj; +}; + +struct MUIP_Group_ExitChange +{ + STACKED ULONG MethodID; +}; + +struct MUIP_Group_InitChange +{ + STACKED ULONG MethodID; +}; + +struct MUIP_Group_Sort +{ + STACKED ULONG MethodID; + STACKED Object *obj[1]; +}; + +struct MUIP_Group_Remove +{ + STACKED ULONG MethodID; + STACKED Object *obj; +}; + +#define MUIM_Group_DoMethodNoForward (MUIB_Group | 0x00000000) +struct MUIP_Group_DoMethodNoForward +{ + STACKED ULONG MethodID; + STACKED ULONG DoMethodID; +}; /* msg stuff follows */ + +/*** Attributes *************************************************************/ +#define MUIA_Group_ActivePage \ + (MUIB_MUI | 0x00424199) /* MUI: V5 isg LONG */ +#define MUIA_Group_Child \ + (MUIB_MUI | 0x004226e6) /* MUI: V4 i.. Object * */ +#define MUIA_Group_ChildList \ + (MUIB_MUI | 0x00424748) /* MUI: V4 ..g struct List * */ +#define MUIA_Group_Columns \ + (MUIB_MUI | 0x0042f416) /* MUI: V4 is. LONG */ +#define MUIA_Group_Forward \ + (MUIB_MUI | 0x00421422) /* MUI: V11 .s. BOOL */ +#define MUIA_Group_Horiz \ + (MUIB_MUI | 0x0042536b) /* MUI: V4 i.. BOOL */ +#define MUIA_Group_HorizSpacing \ + (MUIB_MUI | 0x0042c651) /* MUI: V4 isg LONG */ +#define MUIA_Group_LayoutHook \ + (MUIB_MUI | 0x0042c3b2) /* MUI: V11 i.. struct Hook * */ +#define MUIA_Group_PageMode \ + (MUIB_MUI | 0x00421a5f) /* MUI: V5 i.. BOOL */ +#define MUIA_Group_Rows \ + (MUIB_MUI | 0x0042b68f) /* MUI: V4 is. LONG */ +#define MUIA_Group_SameHeight \ + (MUIB_MUI | 0x0042037e) /* MUI: V4 i.. BOOL */ +#define MUIA_Group_SameSize \ + (MUIB_MUI | 0x00420860) /* MUI: V4 i.. BOOL */ +#define MUIA_Group_SameWidth \ + (MUIB_MUI | 0x0042b3ec) /* MUI: V4 i.. BOOL */ +#define MUIA_Group_Spacing \ + (MUIB_MUI | 0x0042866d) /* MUI: V4 is. LONG */ +#define MUIA_Group_VertSpacing \ + (MUIB_MUI | 0x0042e1bf) /* MUI: V4 isg LONG */ + +#define MUIA_Group_Virtual \ + (MUIB_Group | 0x00000000) /* Zune: V1 i.. BOOL */ + +enum +{ + MUIV_Group_ActivePage_First = 0, + MUIV_Group_ActivePage_Last = -1, + MUIV_Group_ActivePage_Prev = -2, + MUIV_Group_ActivePage_Next = -3, + MUIV_Group_ActivePage_Advance = -4, +}; + +/* This is the message you get if your custom layout hook is called */ +struct MUI_LayoutMsg +{ + STACKED ULONG lm_Type; /* the message type */ + STACKED struct MinList *lm_Children; /* exec list of the children + * of this group */ + STACKED struct MUI_MinMax lm_MinMax; /* here you have to place the + * MUILM_MINMAX results */ + struct + { + STACKED LONG Width; + STACKED LONG Height; + STACKED ULONG priv5; + STACKED ULONG priv6; + } lm_Layout; /* size (and result) for MUILM_LAYOUT */ +}; + +/* lm_Type */ +enum +{ + MUILM_MINMAX = 1, /* Please calc your min & max sizes */ + MUILM_LAYOUT = 2, /* Please layout your children */ +}; + +#define MUILM_UNKNOWN -1 /* should be returned if the hook function + * doesn't understand lm_Type */ + + +extern const struct __MUIBuiltinClass _MUI_Group_desc; /* PRIV */ + +#endif /* _MUI_CLASSES_GROUP_H */ -- 2.11.4.GIT