Esempio n. 1
0
IPTR Virtgroup__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg)
{
    return DoSuperNewTags
    (
        cl, obj, NULL, 
        MUIA_Group_Virtual, TRUE, 
        TAG_MORE, (IPTR) msg->ops_AttrList
    );
}
Esempio n. 2
0
/*** Methods ****************************************************************/
Object *IconImage__OM_NEW
(
    Class *CLASS, Object *self, struct opSet *message 
)
{
    struct IconImage_DATA *data       = NULL; 
    const struct TagItem  *tstate = message->ops_AttrList;    
    struct TagItem        *tag        = NULL;    
    struct DiskObject     *diskObject = NULL;
    CONST_STRPTR           file       = NULL;
    
    while ((tag = NextTagItem(&tstate)) != NULL)
    {
        switch (tag->ti_Tag)
        {
            case MUIA_IconImage_DiskObject:
                diskObject = (struct DiskObject *) tag->ti_Data;
                break;
                
            case MUIA_IconImage_File:
                file = (CONST_STRPTR) tag->ti_Data;
                break;
        }
    }
    
    if (diskObject == NULL && file == NULL) goto error; /* Must specify one */
    if (diskObject != NULL && file != NULL) goto error; /* Cannot specify both */
    
    if (diskObject == NULL && file != NULL)
    {
        diskObject = GetDiskObjectNew(file);
        if (diskObject == NULL) goto error;
    }
    
    self = (Object *) DoSuperNewTags
    (
        CLASS, self, NULL,
        
        MUIA_FillArea,        FALSE,
        TAG_MORE,      (IPTR) message->ops_AttrList
    );
    
    if (self == NULL) goto error;
    
    data = INST_DATA(CLASS, self);
    data->iid_DiskObject = diskObject;

    return self;
    
error:
    return NULL;
}
Esempio n. 3
0
IPTR Popstring__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg)
{
    struct Popstring_DATA   *data;
    struct TagItem  	    *tag, *tags;
    Object *string, *button;

    button = (Object*)GetTagData(MUIA_Popstring_Button,0,msg->ops_AttrList);
    string = (Object*)GetTagData(MUIA_Popstring_String,0,msg->ops_AttrList);
    
    obj = (Object *) DoSuperNewTags
    (
        cl, obj, 0,
        
        MUIA_Group_Horiz,          TRUE,
        MUIA_Group_Spacing,        0,
        (string ? Child : TAG_IGNORE), (IPTR) string,
        Child,              (IPTR) button,
        
        TAG_MORE,           (IPTR) msg->ops_AttrList
    );
    if (!obj) return FALSE;
    
    data = INST_DATA(cl, obj);
    data->button = button;
    data->string = string;

    data->ehn.ehn_Events   = IDCMP_RAWKEY;
    data->ehn.ehn_Priority = 0;
    data->ehn.ehn_Flags    = 0;
    data->ehn.ehn_Object   = obj;
    data->ehn.ehn_Class    = cl;

    /* parse initial taglist */

    for (tags = msg->ops_AttrList; (tag = NextTagItem((const struct TagItem **)&tags)); )
    {
	switch (tag->ti_Tag)
	{
	    case MUIA_Popstring_Toggle: data->toggle = tag->ti_Data; break;
	    case MUIA_Popstring_CloseHook: data->close_hook = (struct Hook*)tag->ti_Data;break;
	    case MUIA_Popstring_OpenHook: data->open_hook = (struct Hook*)tag->ti_Data;break;
    	}
    }

    DoMethod(button,MUIM_Notify,MUIA_Pressed,FALSE,(IPTR)obj,1,MUIM_Popstring_Open);

    return (IPTR)obj;
}
Esempio n. 4
0
IPTR Levelmeter__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg)
{
    obj = (Object *)DoSuperNewTags
          (
              cl, obj, NULL,
              MUIA_FillArea, FALSE,
              TAG_MORE, (IPTR) msg->ops_AttrList
          );

    if (obj)
    {
        struct Levelmeter_DATA *data = INST_DATA(cl, obj);

        data->levelbgpen = -1;
    }

    return (IPTR)obj;
}
Esempio n. 5
0
IPTR Popimage__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg)
{
    struct Popimage_DATA *data;
    struct TagItem       *tag, *tags;
    
    obj = (Object *) DoSuperNewTags
    (
        cl, obj, NULL,
        
        ButtonFrame,
        InnerSpacing(4,4),
        MUIA_Background, MUII_ButtonBack,
        MUIA_InputMode,  MUIV_InputMode_RelVerify,
        MUIA_Draggable,  TRUE,
        
        TAG_MORE, (IPTR) msg->ops_AttrList
    );

    if (!obj) return FALSE;
    data = INST_DATA(cl, obj);
    data->wintitle = NULL;
    data->adjust_type = MUIV_Imageadjust_Type_All;

    /* parse initial taglist */
    for (tags = msg->ops_AttrList; (tag = NextTagItem((const struct TagItem**)&tags)); )
    {
	switch (tag->ti_Tag)
	{
	    case MUIA_Window_Title:
		data->wintitle = (CONST_STRPTR)tag->ti_Data;
		break;

	    case MUIA_Imageadjust_Type:
		data->adjust_type = tag->ti_Data;
		break;
	}
    }

    DoMethod(obj, MUIM_Notify, MUIA_Pressed, FALSE, (IPTR)obj, 1,
	     MUIM_Popimage_OpenWindow);

    return (IPTR)obj;
}
Esempio n. 6
0
/*** Methods ****************************************************************/
Object *Presenter__OM_NEW
(
    Class *CLASS, Object *self, struct opSet *message 
)
{
    Object *window;
    
    self = (Object *) DoSuperNewTags
    ( 
        CLASS, self, NULL,
        
        SubWindow, (IPTR) (window = WindowObject,
            MUIA_Window_Title,    (IPTR) "Presenter",
            MUIA_Window_Activate,        TRUE,
            MUIA_Window_Width,           800,
            MUIA_Window_Height,          600,
            
            WindowContents, (IPTR) (PresentationObject,
            End),
        End),
    
        TAG_MORE, (IPTR) message->ops_AttrList
    );

    if (self != NULL)
    {
        SETUP_INST_DATA;
        
        /* Store instance data ---------------------------------------------*/
        data->pd_Window = window;
        
        /* Setup notifications ---------------------------------------------*/
        DoMethod
        ( 
            window, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, 
            (IPTR) self, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit
        );
    }

    return self;
}
Esempio n. 7
0
IPTR Crawling__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg)
{
    obj = (Object *)DoSuperNewTags
    (
        cl, obj, NULL,
        TAG_MORE, (IPTR) msg->ops_AttrList
    );
    
    if (obj)
    {
    	struct Crawling_DATA *data = INST_DATA(cl, obj);
	
	data->ehn.ehn_Events   = 0;
	data->ehn.ehn_Priority = 0;
	data->ehn.ehn_Flags    = 0;
	data->ehn.ehn_Object   = obj;
	data->ehn.ehn_Class    = cl;
    	
    }
    
    return (IPTR)obj;
}
Esempio n. 8
0
static ULONG
MUIPC_LButton__OM_NEW(struct IClass *CLASS,Object *self,struct opSet *message)
{
    struct MiamiPanelLButtonClass_DATA    temp;
    struct TagItem *attrs = message->ops_AttrList;

    temp.lamp = LampObject, End;

    if (self = (Object *)DoSuperNewTags
		(
			CLASS, self, NULL,

            MUIA_Frame,              MUIV_Frame_Button,
            MUIA_Background,         MUII_ButtonBack,
            MUIA_Font,               MUIV_Font_Button,
            MUIA_InputMode,          MUIV_InputMode_RelVerify,
            MUIA_CycleChain,         TRUE,
            MUIA_Group_Horiz,        TRUE,
            MUIA_Group_HorizSpacing, 0,

            temp.lamp ? Child : TAG_IGNORE, temp.lamp,
            temp.lamp ? Child : TAG_IGNORE, temp.lamp ? (RectangleObject, MUIA_FixWidthTxt, ".", End) : NULL,

            Child, temp.text = TextObject,
                MUIA_FixWidthTxt,   btFixWidthTxt,
                MUIA_Text_PreParse, MUIX_C,
                MUIA_Text_Contents, ons,
            End,

            TAG_MORE,attrs))
    {
        struct MiamiPanelLButtonClass_DATA *data = INST_DATA(CLASS,self);

        CopyMem(&temp, data, sizeof(struct MiamiPanelLButtonClass_DATA));
    }

    return (ULONG)self;
}
Esempio n. 9
0
IPTR Numericbutton__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg)
{
    obj = (Object *)DoSuperNewTags
          (
              cl, obj, NULL,
              MUIA_Background, MUII_ButtonBack,
              MUIA_Frame, MUIV_Frame_Button,
              TAG_MORE, (IPTR) msg->ops_AttrList
          );

    if (obj)
    {
        struct Numericbutton_DATA *data = INST_DATA(cl, obj);

        data->ehn.ehn_Events = IDCMP_MOUSEBUTTONS;
        data->ehn.ehn_Priority = 0;
        data->ehn.ehn_Flags    = 0;
        data->ehn.ehn_Object   = obj;
        data->ehn.ehn_Class    = cl;
    }

    return (IPTR)obj;
}
Esempio n. 10
0
IPTR Register__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg)
{
    struct Register_DATA *data;
    int i;
    IPTR tmp;

    obj = (Object *)DoSuperNewTags(cl, obj, NULL, MUIA_Group_PageMode, TRUE,
                                   MUIA_Background, MUII_RegisterBack,
                                   TAG_MORE, (IPTR) msg->ops_AttrList);
    if (!obj) return (IPTR)NULL;

    data = INST_DATA(cl, obj);

    data->frame = GetTagData(MUIA_Register_Frame, 0, msg->ops_AttrList);

    data->labels = (char**)GetTagData(MUIA_Register_Titles, 0, msg->ops_AttrList);

    if (!data->labels)
    {
        CoerceMethod(cl, obj, OM_DISPOSE);
        return (IPTR)NULL;
    }

    for(data->numitems = 0; data->labels[data->numitems]; data->numitems++)
        ;

    if (data->numitems <= 0)
    {
        CoerceMethod(cl, obj, OM_DISPOSE);
        return (IPTR)NULL;
    }

    data->columns = (WORD)GetTagData(MUIA_Register_Columns, data->numitems, msg->ops_AttrList);
    if (data->columns <= 0) data->columns = 1;
    data->rows = (data->numitems + data->columns - 1)/data->columns;

    get(obj, MUIA_Group_ActivePage, &tmp);
    data->active = (WORD)tmp;

    if (data->active < 0 || data->active >= data->numitems)
    {
        data->active = 0;
    }
    data->oldactive = data->active;

    data->items = (struct RegisterTabItem *)AllocVec(data->numitems * sizeof(struct RegisterTabItem),
                  MEMF_PUBLIC | MEMF_CLEAR);

    if (!data->items)
    {
        CoerceMethod(cl, obj, OM_DISPOSE);
        return (IPTR)NULL;
    }

    for(i = 0; i < data->numitems; i++)
    {
        data->items[i].text = data->labels[i];
    }

    data->ehn.ehn_Events   = IDCMP_MOUSEBUTTONS | IDCMP_RAWKEY;
    data->ehn.ehn_Priority = 0;
    data->ehn.ehn_Flags    = 0;
    data->ehn.ehn_Object   = obj;
    data->ehn.ehn_Class    = cl;

    return (IPTR)obj;
}
Esempio n. 11
0
Object *ScreenModeProperties__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
{
    struct ScreenModeProperties_DATA *data;	 
    Object *width, *height, *depth,
           *def_width, *def_height;
	   
    Object *autoscroll;
    
    ULONG id;
    
    self = (Object *)DoSuperNewTags
    (
        CLASS, self, NULL,
	MUIA_Group_Horiz, TRUE,
        Child, (IPTR)ColGroup(4),
	    Child, (IPTR)Label1(__(MSG_WIDTH)),
	    Child, HLeft(width = (Object *)NumericbuttonObject, End),
	    Child, (IPTR)(def_width = (Object *)CheckMarkObject, End),
	    Child, (IPTR)Label1(__(MSG_DEFAULT)),
	        
	    Child, (IPTR)Label1(__(MSG_HEIGHT)),
	    Child, HLeft(height = (Object *)NumericbuttonObject, End),
	    Child, (IPTR)(def_height = (Object *)CheckMarkObject, End),
	    Child, (IPTR)Label1(__(MSG_DEFAULT)),
	        
	    Child, (IPTR)Label1(__(MSG_DEPTH)),
	    Child, HLeft(depth = (Object *)NumericbuttonObject, End),
	    Child, (IPTR)RectangleObject, End,
	    Child, (IPTR)RectangleObject, End,		
	End,  
	    
	Child, (IPTR)MUI_MakeObject(MUIO_VBar, 20),
	    
	Child, (IPTR)HCenter(HGroup,
	    Child, (IPTR)Label1(__(MSG_AUTOSCROLL)),
	    Child, (IPTR)(autoscroll = (Object *)CheckMarkObject, End),
	End),
	
        TAG_MORE, (IPTR)message->ops_AttrList
    );
    
    if (!self)
        goto err;
    
    data = INST_DATA(CLASS, self);    
    
    data->width      = width;
    data->height     = height;
    data->depth      = depth;
    data->def_width  = def_width;
    data->def_height = def_height;
    data->autoscroll = autoscroll;
    
    DoMethod
    (
        width, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)self, 3,
	MUIM_Set, MUIA_ScreenModeProperties_Width, MUIV_TriggerValue
    );
    
    DoMethod
    (
        height, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)self, 3,
	MUIM_Set, MUIA_ScreenModeProperties_Height, MUIV_TriggerValue
    );
    
    DoMethod
    (
        depth, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)self, 3,
	MUIM_Set, MUIA_ScreenModeProperties_Depth, MUIV_TriggerValue
    );
    
    DoMethod
    (
        def_width, MUIM_Notify, MUIA_Selected, TRUE,
	(IPTR)width, 1,
	MUIM_Numeric_SetDefault
    );

    DoMethod
    (
        width, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)def_width, 3,
	MUIM_Set, MUIA_Selected, FALSE
    );
    
    DoMethod
    (
        def_height, MUIM_Notify, MUIA_Selected, TRUE,
	(IPTR)height, 1,
	MUIM_Numeric_SetDefault
    );

    DoMethod
    (
        height, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)def_height, 3,
	MUIM_Set, MUIA_Selected, FALSE
    );
        
    id = GetTagData(MUIA_ScreenModeProperties_DisplayID, INVALID_ID, message->ops_AttrList); 
    set(self, MUIA_ScreenModeProperties_DisplayID, id);
    
    return self;

err:
    CoerceMethod(CLASS, self, OM_DISPOSE);
    return NULL;
}
Esempio n. 12
0
/*** Methods ****************************************************************/
Object * NetPEditor__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
{
    Object  *deviceString, *IPString, *maskString, *gateString,
            *DNSString[2], *hostString, *domainString, *DHCPState, *autostart;

    DHCPCycle[0] = _(MSG_IP_MODE_MANUAL);
    DHCPCycle[1] = _(MSG_IP_MODE_DHCP);

    NetworkTabs[0] = _(MSG_TAB_IP_CONFIGURATION);
    NetworkTabs[1] = _(MSG_TAB_COMPUTER_NAME);

    self = (Object *)DoSuperNewTags
           (
               CLASS, self, NULL,

               MUIA_PrefsEditor_Name, __(MSG_NAME),
               MUIA_PrefsEditor_Path, (IPTR)"AROSTCP/arostcp.prefs",


               Child, RegisterGroup((IPTR)NetworkTabs),
               Child, (IPTR)ColGroup(2),
               Child, (IPTR)Label2(__(MSG_DEVICE)),Child, (IPTR)PopaslObject,
               MUIA_Popasl_Type,              ASL_FileRequest,
               ASLFO_MaxHeight,               100,
               MUIA_Popstring_String,  (IPTR)(deviceString = (Object *)StringObject, TextFrame, MUIA_Background, MUII_TextBack, End),
               MUIA_Popstring_Button,  (IPTR)PopButton(MUII_PopUp),
               End,

               Child, (IPTR)Label2(__(MSG_IP_MODE)), Child, (IPTR)(DHCPState = (Object *)CycleObject, MUIA_Cycle_Entries, (IPTR)DHCPCycle, End),
               Child, (IPTR)Label2(__(MSG_IP)), Child, (IPTR)(IPString = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789.", End),
               Child, (IPTR)Label2(__(MSG_MASK)),Child, (IPTR)(maskString = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789.", End),
               Child, (IPTR)Label2(__(MSG_GATE)),Child, (IPTR)(gateString = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789.", End),
               Child, (IPTR)Label2(__(MSG_DNS1)),Child, (IPTR)(DNSString[0] = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789.", End),
               Child, (IPTR)Label2(__(MSG_DNS2)),Child, (IPTR)(DNSString[1] = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789.", End),
               Child, (IPTR)Label2(__(MSG_AUTOSTART_STACK)),
               Child, (IPTR)HGroup,
               Child, (IPTR)(autostart = MUI_MakeObject(MUIO_Checkmark, NULL)),
               Child, (IPTR)HVSpace,
               End,
               End,

               Child, (IPTR)ColGroup(2),
               Child, (IPTR)Label2(__(MSG_HOST_NAME)), Child, (IPTR)(hostString = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789abcdefghijklmnopqrstuvwxyz-", End),
               Child, (IPTR)Label2(__(MSG_DOMAIN_NAME)), Child, (IPTR)(domainString = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789abcdefghijklmnopqrstuvwxyz-.", End),
               End,

               End, // register

               TAG_DONE
           );


    if (self != NULL) {
        struct NetPEditor_DATA *data = INST_DATA(CLASS, self);
        data->netped_deviceString  = deviceString;
        data->netped_IPString = IPString;
        data->netped_maskString = maskString;
        data->netped_gateString = gateString;
        data->netped_DNSString[0] = DNSString[0];
        data->netped_DNSString[1] = DNSString[1];
        data->netped_hostString = hostString;
        data->netped_domainString = domainString;
        data->netped_DHCPState = DHCPState;
        data->netped_Autostart = autostart;

        /*-- Setup notifications -------------------------------------------*/
        DoMethod
        (
            deviceString, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            IPString, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            maskString, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );

        DoMethod
        (
            gateString, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            DNSString[0], MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            DNSString[1], MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            hostString, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            domainString, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            autostart, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            DHCPState, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
            (IPTR)self, 1, MUIM_NetPEditor_IPModeChanged

        );
    }

    return self;
}
Esempio n. 13
0
IPTR Prop__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg)
{
    struct Prop_DATA *data;
    struct TagItem *tags,*tag;

    obj = (Object *)DoSuperNewTags(cl, obj, NULL,         
        MUIA_Background,  MUII_PropBack,
    TAG_MORE, (IPTR) msg->ops_AttrList);
    
    if (!obj)
	return FALSE;

    data = INST_DATA(cl, obj);
    data->deltafactor = 1;

    /* parse initial taglist */
    for (tags = msg->ops_AttrList; (tag = NextTagItem((const struct TagItem **)&tags)); )
    {
	switch (tag->ti_Tag)
	{
	    case    MUIA_Prop_Entries:
		    data->entries = tag->ti_Data;
		    break;
	    case    MUIA_Prop_First:
		    data->first = tag->ti_Data;
		    break;
	    case    MUIA_Prop_Horiz:
		    data->horiz = tag->ti_Data;
		    break;
	    case    MUIA_Prop_Slider:
		    break;
	    case    MUIA_Prop_UseWinBorder:
		    data->usewinborder = tag->ti_Data;
		    break;
	    case    MUIA_Prop_Visible:
		    data->visible = tag->ti_Data;
		    break;
		    
	    case    MUIA_Prop_DeltaFactor:
	    	    data->deltafactor = tag->ti_Data;
		    break;
	}
    }

    if (data->horiz == TRUE)
    {
        data->minwidth = 6;
        data->minheight = 6;
        data->maxwidth = MUI_MAXMAX;
        data->maxheight = MUI_MAXMAX;
        data->defwidth = 50;
        data->defheight = 6;
    }
    else
    {
        data->minwidth = 6;
        data->minheight = 6;
        data->maxwidth = MUI_MAXMAX;
        data->maxheight = MUI_MAXMAX;
        data->defwidth = 6;
        data->defheight = 50;
    }

    if (data->first < 0)
	data->first = 0;

    data->ehn.ehn_Events   = IDCMP_IDCMPUPDATE;
    data->ehn.ehn_Priority = 0;
    data->ehn.ehn_Flags    = 0;
    data->ehn.ehn_Object   = obj;
    data->ehn.ehn_Class    = cl;

    if (data->usewinborder)
	_flags(obj) |= MADF_BORDERGADGET;

    calcscale16(data);
    
    return (IPTR)obj;
}
Esempio n. 14
0
Object *SMEditor__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
{
    Object *selector, *properties;
    self = (Object *) DoSuperNewTags
    (
        CLASS, self, NULL,
        
        MUIA_PrefsEditor_Name, (IPTR) __(MSG_NAME),
        MUIA_PrefsEditor_Path, (IPTR)"SYS/screenmode.prefs",
        
	Child, (IPTR)VGroup,
	    Child, (IPTR)(selector   = (Object *)ScreenModeSelectorObject, End),
	    Child, (IPTR)(properties = (Object *)ScreenModePropertiesObject, GroupFrame, End),
	End,
        
        TAG_DONE
    );
    
    if (self)
    {
        SETUP_INST_DATA;
        
	data->selector   = selector;
        data->properties = properties;
	     
        /*-- Setup notifications -------------------------------------------*/
        DoMethod
	(
	    selector, MUIM_Notify, MUIA_ScreenModeSelector_Active, MUIV_EveryTime,
	    (IPTR)properties, 3,
	    MUIM_Set, MUIA_ScreenModeProperties_DisplayID, MUIV_TriggerValue
	);
		
        DoMethod
	(
	    properties, MUIM_Notify, MUIA_ScreenModeProperties_DisplayID, MUIV_EveryTime,
	    (IPTR)self, 3,
	    MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
	);
    
        DoMethod
	(
	    properties, MUIM_Notify, MUIA_ScreenModeProperties_Width, MUIV_EveryTime,
	    (IPTR)self, 3,
	    MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
	);
        
	DoMethod
	(
	    properties, MUIM_Notify, MUIA_ScreenModeProperties_Height, MUIV_EveryTime,
	    (IPTR)self, 3,
	    MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
	);
        
	DoMethod
	(
	    properties, MUIM_Notify, MUIA_ScreenModeProperties_Depth, MUIV_EveryTime,
	    (IPTR)self, 3,
	    MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
	);
	
	DoMethod
	(
	    properties, MUIM_Notify, MUIA_ScreenModeProperties_Autoscroll, MUIV_EveryTime,
	    (IPTR)self, 3,
	    MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
	);
    }
    
    return self;
}
Esempio n. 15
0
/*** Methods ****************************************************************/
Object *AboutWindow__OM_NEW
(
    Class *CLASS, Object *self, struct opSet *message 
)
{
    struct AboutWindow_DATA *data              = NULL; 
    const struct TagItem    *tstate            = message->ops_AttrList;
    struct TagItem          *tag               = NULL, 
                            *authorsTags       = NULL,
                            *sponsorsTags      = NULL;
    struct Catalog          *catalog           = NULL;
    APTR                     pool;
    Object                  *rootGroup         = NULL,
                            *imageGroup        = NULL,
                            *imageObject       = NULL,
                            *versionObject     = NULL,
                            *copyrightObject   = NULL,
                            *descriptionGroup  = NULL,
                            *descriptionObject = NULL,
                            *authorsList       = NULL,
                            *sponsorsList      = NULL;
    
    STRPTR                   title             = NULL,
                             versionNumber     = NULL,
                             versionDate       = NULL,
                             versionExtra      = NULL,
                             description       = NULL,
                             copyright         = NULL;
                             
    CONST_STRPTR             pages[]           = { NULL, NULL, NULL }; 
    UBYTE                    nextPage          = 0;
    
    /* Allocate memory pool ------------------------------------------------*/
    pool = CreatePool(MEMF_ANY, 4096, 4096);
    if (pool == NULL) return NULL;
        
    /* Initialize locale ---------------------------------------------------*/
    catalog = OpenCatalogA
    (
        NULL, "System/Classes/Zune/AboutWindow.catalog", NULL
    );
        
    /* Parse initial attributes --------------------------------------------*/
    while ((tag = NextTagItem(&tstate)) != NULL)
    {
        switch (tag->ti_Tag)
        {
            case MUIA_AboutWindow_Image:
                imageObject = (Object *) tag->ti_Data;
                break;
            
            case MUIA_AboutWindow_Title:
                title = StrDup((STRPTR) tag->ti_Data);
                if (title == NULL) title = IGNORE;
                break;
                
            case MUIA_AboutWindow_Version_Number:
                versionNumber = StrDup((STRPTR) tag->ti_Data);
                if (versionNumber == NULL) versionNumber = IGNORE;
                break;
                
            case MUIA_AboutWindow_Version_Date:
                versionDate = StrDup((STRPTR) tag->ti_Data);
                if (versionDate == NULL) versionDate = IGNORE;
                break;
                
            case MUIA_AboutWindow_Version_Extra:
                versionExtra = StrDup((STRPTR) tag->ti_Data);
                if (versionExtra == NULL) versionExtra = IGNORE;
                break;
                
            case MUIA_AboutWindow_Copyright:
                copyright = StrDup((STRPTR) tag->ti_Data);
                if (copyright == NULL) copyright = IGNORE;
                break;
                
            case MUIA_AboutWindow_Description:
                description = StrDup((STRPTR) tag->ti_Data);
                if (description == NULL) description = IGNORE;
                break;
            
            case MUIA_AboutWindow_Authors:
                authorsTags = (struct TagItem *) tag->ti_Data;
                break; 
                
            case MUIA_AboutWindow_Sponsors:
                sponsorsTags = (struct TagItem *) tag->ti_Data;
                break;
                            
            default:
                continue; /* Don't supress non-processed tags */
        }
        
        tag->ti_Tag = TAG_IGNORE;
    }
    
    /* Setup image ---------------------------------------------------------*/
    if (imageObject == NULL)
    {
        TEXT path[512], program[1024]; path[0] = '\0'; program[0] = '\0';
        
        if (GetProgramName(program, 1024))
        {
            strlcat(path, "PROGDIR:", 512);
            strlcat(path, FilePart(program), 512);
            imageObject = (Object *)IconImageObject,
                MUIA_IconImage_File, (IPTR) path,
            End;
        }
        
        if (imageObject == NULL)
        {
            imageObject = HVSpace;
        }
    }

    /* Setup pages ---------------------------------------------------------*/
    if (authorsTags != NULL)
    {
        pages[nextPage] = _(MSG_AUTHORS);
        nextPage++;
    }
    
    if (sponsorsTags != NULL)
    {
        pages[nextPage] = _(MSG_SPONSORS);
        nextPage++;
    }
    
    self = (Object *) DoSuperNewTags
    (
        CLASS, self, NULL,
        
        MUIA_Window_Activate, TRUE,
        MUIA_Window_NoMenus,  TRUE,
        MUIA_Window_Height,   MUIV_Window_Height_Visible(25),
        MUIA_Window_Width,    MUIV_Window_Width_Visible(25),
        
        WindowContents, (IPTR) VGroup,
            GroupSpacing(6),
            
            Child, (IPTR) (imageGroup = (Object *)HGroup,
                MUIA_Weight,  0,
                
                Child, (IPTR) HVSpace,
                Child, (IPTR) imageObject,
                Child, (IPTR) HVSpace,
            End),
            Child, (IPTR) (versionObject = (Object *)TextObject,
                MUIA_Text_PreParse, (IPTR) MUIX_C,
                MUIA_Text_Contents, (IPTR) NULL,
            End),
            Child, (IPTR) (copyrightObject = (Object *)TextObject,
                MUIA_Text_PreParse, (IPTR) MUIX_C,
                MUIA_Text_Contents, (IPTR) NULL,
            End),
            Child, (IPTR) (descriptionGroup = (Object *)VGroup,
                Child, (IPTR) VSpace(6),
                Child, (IPTR) (descriptionObject = (Object *)TextObject,
                    MUIA_Text_PreParse, (IPTR) MUIX_I MUIX_C,
                    MUIA_Text_Contents, (IPTR) NULL,
                End),
            End),
            Child, (IPTR) VSpace(6),
            Child, (IPTR) RegisterGroup(pages),
                Child, (IPTR) ListviewObject,
                    MUIA_Listview_List, (IPTR) (authorsList = (Object *)ListObject,
                        ReadListFrame,
                    End),
                End,
                Child, (IPTR) ListviewObject,
                    MUIA_Listview_List, (IPTR) (sponsorsList = (Object *)ListObject,
                        ReadListFrame,
                    End),
                End,
            End, 
        End,
        
        TAG_MORE, (IPTR) message->ops_AttrList
    );
    
    if (self == NULL) goto error;
    
    data = INST_DATA(CLASS, self);
    data->awd_Catalog           = catalog;
    data->awd_Pool              = pool;
    data->awd_RootGroup         = rootGroup;
    data->awd_ImageGroup        = imageGroup;
    data->awd_ImageObject       = imageObject;
    data->awd_VersionObject     = versionObject;
    data->awd_CopyrightObject   = copyrightObject;
    data->awd_DescriptionGroup  = descriptionGroup;
    data->awd_DescriptionObject = descriptionObject;
    data->awd_Title             = title;
    data->awd_VersionNumber     = versionNumber;
    data->awd_VersionDate       = versionDate;
    data->awd_VersionExtra      = versionExtra;
    data->awd_Copyright         = copyright;
    data->awd_Description       = description;
    
    if (authorsTags != NULL)  NamesToList(authorsList, authorsTags, data);
    if (sponsorsTags != NULL) NamesToList(sponsorsList, sponsorsTags, data);
    
    /* Setup notifications */
    DoMethod
    ( 
        self, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, 
        (IPTR) self, 2, MUIA_Window_Open, FALSE
    );
        
    return self;
    
error:
    if (catalog != NULL) CloseCatalog(catalog);
    
    return NULL;
}