IPTR Register__MUIM_HandleEvent(struct IClass *cl, Object *obj, struct MUIP_HandleEvent *msg) { struct Register_DATA *data = INST_DATA(cl, obj); WORD i, x, y; if (msg->muikey != MUIKEY_NONE) { switch (msg->muikey) { case MUIKEY_PRESS: case MUIKEY_RIGHT: case MUIKEY_TOGGLE: nfset(obj, MUIA_Group_ActivePage, MUIV_Group_ActivePage_Next); return MUI_EventHandlerRC_Eat; case MUIKEY_LEFT: nfset(obj, MUIA_Group_ActivePage, MUIV_Group_ActivePage_Prev); return MUI_EventHandlerRC_Eat; case MUIKEY_WORDLEFT: case MUIKEY_LINESTART: nfset(obj, MUIA_Group_ActivePage, MUIV_Group_ActivePage_First); return MUI_EventHandlerRC_Eat; case MUIKEY_WORDRIGHT: case MUIKEY_LINEEND: nfset(obj, MUIA_Group_ActivePage, MUIV_Group_ActivePage_Last); return MUI_EventHandlerRC_Eat; } } if (msg->imsg) { if ((msg->imsg->Class == IDCMP_MOUSEBUTTONS) && (msg->imsg->Code == SELECTDOWN)) { x = msg->imsg->MouseX - data->left; y = msg->imsg->MouseY - data->top; /* D(bug("Register_HandleEvent : %d,%d,%d -- %d,%d,%d\n", 0, x, _width(obj), 0, y, data->tab_height)); */ if (_between(0, x, _width(obj))) { /* D(bug("Register_HandleEvent : in tab, %d,%d\n", x, y)); */ for(i = 0; i < data->numitems; i++) { if (_between(data->items[i].x1, x, data->items[i].x2) && _between(data->items[i].y1, y, data->items[i].y2)) { if (data->active != i) { nfset(obj, MUIA_Group_ActivePage, i); return MUI_EventHandlerRC_Eat; } break; } } } } } return 0; }
__asm __saveds LONG ocfunc(a1 struct MUIS_Listtree_TreeNode *tn) { // -- save open/closed state each time it changes ------------------------- nfset(tn->tn_User,SWA_Invocation_ListOpen,(tn->tn_Flags&TNF_OPEN)?TRUE:FALSE); return 0; }
IPTR ScreenModeProperties__OM_SET(Class *CLASS, Object *self, struct opSet *message) { struct ScreenModeProperties_DATA *data = INST_DATA(CLASS, self); const struct TagItem *tags; struct TagItem *tag; struct TagItem noforward_tags[] = { {MUIA_Group_Forward , FALSE }, {TAG_MORE , (IPTR)message->ops_AttrList } }; struct opSet noforward_message = *message; noforward_message.ops_AttrList = noforward_tags; ULONG id = INVALID_ID; IPTR no_notify = TAG_IGNORE; for (tags = message->ops_AttrList; (tag = NextTagItem(&tags)); ) { switch (tag->ti_Tag) { case MUIA_NoNotify: no_notify = MUIA_NoNotify; break; case MUIA_ScreenModeProperties_DisplayID: { struct TagItem width_tags[] = { { no_notify, TRUE }, { MUIA_Numeric_Min, 0 }, { MUIA_Numeric_Max, 0 }, { MUIA_Numeric_Default, 0 }, { TAG_DONE, 0 } }; struct TagItem height_tags[] = { { no_notify, TRUE }, { MUIA_Numeric_Min, 0 }, { MUIA_Numeric_Max, 0 }, { MUIA_Numeric_Default, 0 }, { TAG_DONE, 0 } }; struct TagItem depth_tags[] = { { no_notify, TRUE }, { MUIA_Numeric_Min, 0 }, { MUIA_Numeric_Max, 0 }, { MUIA_Numeric_Default, 0 }, { TAG_DONE, 0 } }; struct DimensionInfo dim; BOOL autoscroll; if (GetDisplayInfoData(NULL, (UBYTE *)&dim, sizeof(dim), DTAG_DIMS, tag->ti_Data)) { width_tags[1].ti_Data = dim.MinRasterWidth; height_tags[1].ti_Data = dim.MinRasterHeight; depth_tags[1].ti_Data = 1; width_tags[2].ti_Data = dim.MaxRasterWidth; height_tags[2].ti_Data = dim.MaxRasterHeight; depth_tags[2].ti_Data = dim.MaxDepth; width_tags[3].ti_Data = dim.Nominal.MaxX - dim.Nominal.MinX + 1; height_tags[3].ti_Data = dim.Nominal.MaxY - dim.Nominal.MinY + 1; depth_tags[3].ti_Data = dim.MaxDepth; id = tag->ti_Data; } /* Enable autoscroll only if the maximum sizes are bigger than the resolution. */ autoscroll = width_tags[2].ti_Data > width_tags[3].ti_Data && height_tags[2].ti_Data > height_tags[3].ti_Data; data->DisplayID = id; nfset(self, MUIA_Disabled, id == INVALID_ID); SetAttrsA(data->width, width_tags); SetAttrsA(data->height, height_tags); SetAttrsA(data->depth, depth_tags); SetAttrs(data->autoscroll, no_notify, TRUE, MUIA_Disabled, !autoscroll, MUIA_Selected, autoscroll, TAG_DONE); break; } case MUIA_ScreenModeProperties_Width: if (id != INVALID_ID) { WORD width = tag->ti_Data; if (width != -1) SetAttrs(data->width, no_notify, TRUE, MUIA_Numeric_Value, width, TAG_DONE); else DoMethod(data->width, MUIM_Numeric_SetDefault); nnset(data->def_width, MUIA_Selected, width == -1); } break; case MUIA_ScreenModeProperties_Height: if (id != INVALID_ID) { WORD height = tag->ti_Data; if (height != -1) SetAttrs(data->height, no_notify, TRUE, MUIA_Numeric_Value, height, TAG_DONE); else DoMethod(data->height, MUIM_Numeric_SetDefault); nnset(data->def_height, MUIA_Selected, height == -1); } break; case MUIA_ScreenModeProperties_Depth: if (id != INVALID_ID) { WORD depth = tag->ti_Data; if (depth != -1) SetAttrs(data->depth, no_notify, TRUE, MUIA_Numeric_Value, depth, TAG_DONE); else DoMethod(data->depth, MUIM_Numeric_SetDefault); } break; case MUIA_ScreenModeProperties_Autoscroll: if (id != INVALID_ID && !XGET(data->autoscroll, MUIA_Disabled)) SetAttrs(data->autoscroll, no_notify, TRUE, MUIA_Selected, tag->ti_Data != 0); break; } } return DoSuperMethodA(CLASS, self, (Msg)&noforward_message); }