예제 #1
0
/**
 * A new entry has been activated.
 */
static void filter_active(void)
{
	struct filter *f;
	DoMethod(filter_list, MUIM_NList_GetEntry, MUIV_NList_GetEntry_Active, (ULONG)&f);
	if (f)
	{
		filter_accept_rule();
		nnset(filter_name_string,MUIA_UTF8String_Contents, f->name);
		filter_refresh_rules();
		set(filter_move_text, MUIA_Text_Contents, f->dest_folder);
		set(filter_move_check, MUIA_Selected, f->use_dest_folder);
		set(filter_sound_string, MUIA_String_Contents, f->sound_file);
		set(filter_sound_check, MUIA_Selected, f->use_sound_file);
		set(filter_arexx_string, MUIA_String_Contents, f->arexx_file);
		set(filter_arexx_check, MUIA_Selected, f->use_arexx_file);

		set(filter_request_check, MUIA_Selected, !!(f->flags & FILTER_FLAG_REQUEST));
		set(filter_new_check, MUIA_Selected, !!(f->flags & FILTER_FLAG_NEW));
		set(filter_sent_check, MUIA_Selected, !!(f->flags & FILTER_FLAG_SENT));
		set(filter_remote_check, MUIA_Selected, !!(f->flags & FILTER_FLAG_REMOTE));
	} else
	{
		filter_refresh_rules();
	}

	filter_last_selected = f;

	/* Update some disable states */
	set(filter_apply_now_button,MUIA_Disabled,!filter_last_selected);
	set(filter_add_rule_button,MUIA_Disabled,!filter_last_selected);
}
예제 #2
0
static ULONG
mSets(struct IClass *cl,Object *obj,struct opSet *msg)
{
    struct TagItem *tag;

    if (tag = FindTagItem(MUIA_Calendar_StartDay,msg->ops_AttrList))
    {
        struct data *data = INST_DATA(cl,obj);
        ULONG       wsd = tag->ti_Data;
        int         i;

        if (wsd>6) wsd = 6;

        for (i = 0; i<7; i++) if (i!=wsd) nnset(data->days[i],MUIA_Selected,FALSE);
        nnset(data->days[wsd],MUIA_Selected,TRUE);

        data->wsd = wsd;
    }

    return 0;
}
예제 #3
0
파일: YAM_US.c 프로젝트: jens-maus/yam
///
/// US_GetUSEntryFunc
//  Fills form with data from selected list entry
HOOKPROTONHNONP(US_GetUSEntryFunc, void)
{
  struct US_GUIData *gui;
  int act;

  ENTER();

  gui = &G->US->GUI;
  act = xget(gui->LV_USERS, MUIA_NList_Active);

  if(act != MUIV_NList_Active_Off)
  {
    struct User *user;
    BOOL notallowed;
    BOOL iscurrent;
    BOOL limited;

    DoMethod(gui->LV_USERS, MUIM_NList_GetEntry, act, &user);

    limited = !G->US->Supervisor;
    iscurrent = (user->ID == G->Users.CurrentID);
    notallowed = limited && !iscurrent;

    nnset(gui->ST_USER,    MUIA_String_Contents, user->Name);
    nnset(gui->ST_MAILDIR, MUIA_String_Contents, user->MailDir);
    nnset(gui->ST_PASSWD,  MUIA_String_Contents, user->Password);
    nnset(gui->CH_USEADDR, MUIA_Selected, user->UseAddr);
    nnset(gui->CH_USEDICT, MUIA_Selected, user->UseDict);
    nnset(gui->CH_ROOT,    MUIA_Selected, !user->Limited);
    nnset(gui->CH_CLONE,   MUIA_Selected, user->Clone);
    set(gui->ST_USER,    MUIA_Disabled, notallowed);
    set(gui->CH_USEDICT, MUIA_Disabled, notallowed || act == 0);
    set(gui->CH_USEADDR, MUIA_Disabled, notallowed || act == 0);
    set(gui->CH_CLONE,   MUIA_Disabled, !user->IsNew || act == 0);
    set(gui->PO_MAILDIR, MUIA_Disabled, limited);
    set(gui->CH_ROOT,    MUIA_Disabled, limited);
    set(gui->ST_PASSWD,  MUIA_Disabled, notallowed);
    set(gui->BT_DEL,     MUIA_Disabled, act == 0 || iscurrent);
   }
   else
     DoMethod(G->App, MUIM_MultiSet, MUIA_Disabled, TRUE, gui->ST_USER,
                                                          gui->ST_PASSWD,
                                                          gui->PO_MAILDIR,
                                                          gui->CH_USEDICT,
                                                          gui->CH_USEADDR,
                                                          gui->CH_ROOT,
                                                          gui->CH_CLONE,
                                                          gui->BT_DEL,
                                                          NULL);

  LEAVE();
}
예제 #4
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);	
}
예제 #5
0
IPTR SMEditor__MUIM_PrefsEditor_ImportFH
(
    Class *CLASS, Object *self, 
    struct MUIP_PrefsEditor_ImportFH *message
)
{
    SETUP_INST_DATA;
    struct ContextNode     *context;
    struct IFFHandle       *handle;
    struct ScreenModePrefs  smp;
    BOOL                    success = TRUE;
    LONG                    error;
    
    if (!(handle = AllocIFF()))
        return FALSE;
    
    handle->iff_Stream = (IPTR) message->fh;
    InitIFFasDOS(handle);

    if ((error = OpenIFF(handle, IFFF_READ)) == 0)
    {
	
        BYTE i;
        
        // FIXME: We want some sanity checking here!
        for (i = 0; i < 1; i++)
        {
            if ((error = StopChunk(handle, ID_PREF, ID_SCRM)) == 0)
            {
                if ((error = ParseIFF(handle, IFFPARSE_SCAN)) == 0)
                {
                    context = CurrentChunk(handle);
                    
                    error = ReadChunkBytes
                    (
                        handle, &smp, sizeof(struct ScreenModePrefs)
                    );
                    
                    if (error < 0)
                    {
                        printf("Error: ReadChunkBytes() returned %ld!\n", error);
                    }                    
                }
                else
                {
                    printf("ParseIFF() failed, returncode %ld!\n", error);
                    success = FALSE;
                    break;
                }
            }
            else
            {
                printf("StopChunk() failed, returncode %ld!\n", error);
                success = FALSE;
            }
        }

        CloseIFF(handle);
    }
    else
    {
        //ShowError(_(MSG_CANT_OPEN_STREAM));
    }

    FreeIFF(handle);
    
    
    if (success)
    {
        SMPByteSwap(&smp);
	
	nnset(data->selector, MUIA_ScreenModeSelector_Active, smp.smp_DisplayID);
	SetAttrs
	(
	    data->properties,
	    MUIA_NoNotify,                        TRUE,
	    MUIA_ScreenModeProperties_DisplayID,  smp.smp_DisplayID,
	    MUIA_ScreenModeProperties_Width,      smp.smp_Width,
	    MUIA_ScreenModeProperties_Height,     smp.smp_Height,
	    MUIA_ScreenModeProperties_Depth,      smp.smp_Depth,
	    MUIA_ScreenModeProperties_Autoscroll, smp.smp_Control & AUTOSCROLL,
	    TAG_DONE
        );
    }
    
    return success;
}