Exemplo n.º 1
0
IPTR SMEditor__MUIM_PrefsEditor_Use
(
    Class *CLASS, Object *self, Msg message
)
{
    #warning "FIXME: Closing the window here only works because we're lucky   "
    #warning "       and nothing needs to access anything that is put in the  "
    #warning "       RenderInfo structure, which gets deallocated when closing"
    #warning "       the window. This needs to be fixed directly in the       "
    #warning "       PrefsEditor class.                                       "
    if (muiRenderInfo(self) && _win(self))
        set(_win(self), MUIA_Window_Open, FALSE);
	    
    return DoSuperMethodA(CLASS, self, message);
}
Exemplo n.º 2
0
static void KillPopupWin(Object *obj, struct Numericbutton_DATA *data)
{
    if (data->popwin)
    {
        CloseWindow(data->popwin);
        data->popwin = NULL;
    }

    if (data->ehn.ehn_Events & IDCMP_MOUSEMOVE)
    {
        DoMethod(_win(obj), MUIM_Window_RemEventHandler, (IPTR)&data->ehn);
        data->ehn.ehn_Events &= ~IDCMP_MOUSEMOVE;
        DoMethod(_win(obj), MUIM_Window_AddEventHandler, (IPTR)&data->ehn);
    }

}
Exemplo n.º 3
0
STATIC ULONG SingleString_GoInactive(struct IClass *cl, Object *obj,Msg msg)
{
	struct SingleString_Data *data = (struct SingleString_Data*)INST_DATA(cl,obj);
	DoMethod(_win(obj), MUIM_Window_RemEventHandler, (ULONG)&data->ehnode);
	set(obj, MUIA_BetterString_SelectSize, 0);
	return DoSuperMethodA(cl, obj, msg);
}
Exemplo n.º 4
0
/**************************************************************************
 MUIM_Cleanup
**************************************************************************/
IPTR Numeric__MUIM_Cleanup(struct IClass *cl, Object *obj, struct MUIP_Cleanup *msg)
{
    struct MUI_NumericData *data = INST_DATA(cl, obj);

    DoMethod(_win(obj), MUIM_Window_RemEventHandler, (IPTR)(&data->ehn));
    return DoSuperMethodA(cl,obj,(Msg)msg);
}
Exemplo n.º 5
0
IPTR Register__MUIM_Cleanup(struct IClass *cl, Object *obj, struct MUIP_Cleanup *msg)
{
    struct Register_DATA *data = INST_DATA(cl, obj);

    DoMethod(_win(obj), MUIM_Window_RemEventHandler, (IPTR)&data->ehn);

    return DoSuperMethodA(cl,obj,(Msg)msg);
}
Exemplo n.º 6
0
IPTR Crawling__MUIM_Hide(struct IClass *cl, Object *obj, struct MUIP_Hide *msg)
{
    struct Crawling_DATA *data = INST_DATA(cl, obj);

    DoMethod(_win(obj), MUIM_Window_RemEventHandler, (IPTR)&data->ehn);
    data->ehn.ehn_Events &= ~IDCMP_INTUITICKS;
    
    return DoSuperMethodA(cl, obj, (Msg)msg);

}
Exemplo n.º 7
0
Object *MkNewGrp(Object *o, SW_IDATA *idata, STRPTR Name)
{
   if (SWGetUL(idata->SWA_NList_L, MUIA_List_Entries) < SWV_NGroupList_MaxUnreg ||
       NN_RegMsg(idata, GetS(SWS_L_UnregMsg), _win(o)) == SUCCESS)
      return MUI_NewObject(SWC_NGroup,
                           AppBaseDefTop(idata),
                           SWA_NGroup_Name, SW_STRDEF(Name, ""),
                           TAG_DONE);
   
   return NULL;
}
Exemplo n.º 8
0
IPTR Popstring__MUIM_Setup(struct IClass *cl, Object *obj, struct MUIP_Setup *msg)
{
    struct Popstring_DATA *data = INST_DATA(cl, obj);

    if (!(DoSuperMethodA(cl, obj, (Msg) msg)))
	return FALSE;

    DoMethod(_win(obj), MUIM_Window_AddEventHandler, (IPTR)&data->ehn);

    return TRUE;
}
Exemplo n.º 9
0
IPTR Crawling__MUIM_Show(struct IClass *cl, Object *obj, struct MUIP_Show *msg)
{
    struct Crawling_DATA *data = INST_DATA(cl, obj);
    IPTR    	    	  retval;
    
    retval = DoSuperMethodA(cl, obj, (Msg)msg);
        
    data->ehn.ehn_Events |= IDCMP_INTUITICKS;    
    DoMethod(_win(obj), MUIM_Window_AddEventHandler, (IPTR)&data->ehn);
    
    return retval;
}
Exemplo n.º 10
0
IPTR Numericbutton__MUIM_Cleanup(struct IClass *cl, Object *obj, struct MUIP_Cleanup *msg)
{
    struct Numericbutton_DATA *data = INST_DATA(cl, obj);

    if (data->knob_bg)
    {
        zune_imspec_cleanup(data->knob_bg);
        data->knob_bg = NULL;
    }

    DoMethod(_win(obj), MUIM_Window_RemEventHandler, (IPTR)&data->ehn);

    return DoSuperMethodA(cl, obj, (Msg)msg);
}
Exemplo n.º 11
0
/**************************************************************************
 MUIM_Setup
**************************************************************************/
IPTR Numeric__MUIM_Setup(struct IClass *cl, Object *obj, struct MUIP_Setup *msg)
{
    struct MUI_NumericData *data = INST_DATA(cl, obj);

    if (!DoSuperMethodA(cl,obj,(Msg)msg))
	return FALSE;

    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;
    DoMethod(_win(obj), MUIM_Window_AddEventHandler, (IPTR)(&data->ehn));

    return TRUE;
}
Exemplo n.º 12
0
///
/// ShowSelectPointer()
void ShowSelectPointer(struct InstData *data, Object *obj)
{
  ENTER();

  // even if it seems to be a waste of performance, but
  // we unfortunately have to always set the window pointer
  // regardless of the point if it was previously set or not.
  // This is required as any other gadget or process might
  // reset the window pointer and as such we would end up
  // with no custom pointer as well. So we only check the window
  // sleep status here :(
  if(data->PointerObj != NULL &&
     xget(_win(obj), MUIA_Window_Sleep) == FALSE)
  {
    // try to identify the black/white colors
    // of the current screen colormap
    if(data->activeSelectPointer == FALSE)
      IdentifyPointerColors(obj);

    // now we set the actual new custom window pointer. Please note
    // that we can't unfortunately check for data->activeSelectPointer
    // here because otherwise we might end up with the standard
    // window pointer when quickly switching pointer TE.mcc
    #if defined(__amigaos4__)
    SetWindowPointer(_window(obj), LIB_VERSION_IS_AT_LEAST(IntuitionBase, 53, 407) ? WA_PointerType : WA_Pointer, data->PointerObj, TAG_DONE);
    #elif defined(__MORPHOS__)
    SetWindowPointer(_window(obj), IS_MORPHOS2 ? WA_PointerType : WA_Pointer, data->PointerObj, TAG_DONE);
    #else
    if(LIB_VERSION_IS_AT_LEAST(IntuitionBase, 39, 0))
      SetWindowPointer(_window(obj), WA_Pointer, data->PointerObj, TAG_DONE);
    else
      SetPointer(_window(obj), (APTR)data->PointerObj, selectPointerHeight,
                                                       selectPointerWidth,
                                                       selectPointerXOffset,
                                                       selectPointerYOffset);
    #endif

    data->activeSelectPointer = TRUE;
  }

  LEAVE();
}
Exemplo n.º 13
0
IPTR Numericbutton__MUIM_Setup(struct IClass *cl, Object *obj, struct MUIP_Setup *msg)
{
    struct Numericbutton_DATA *data = INST_DATA(cl, obj);
//  const struct ZuneFrameGfx *knob_frame;
    IPTR    	    	       retval;

    retval = DoSuperMethodA(cl, obj, (Msg)msg);
    if (retval)
    {
        //knob_frame = zune_zframe_get(obj, &muiGlobalInfo(obj)->mgi_Prefs->frames[MUIV_Frame_Knob]);

        data->knob_bg = zune_imspec_setup(MUII_ButtonBack, muiRenderInfo(obj));

        DoMethod(_win(obj), MUIM_Window_AddEventHandler, (IPTR)&data->ehn);

        data->needs_to_recalculate_sizes = TRUE;
    }

    return retval;
}
Exemplo n.º 14
0
IPTR mSet(Class *cl, Object *obj, struct opSet *msg) {
    mybug(-1, ("mSet gets called\n"));

    struct InstData *data = INST_DATA(cl, obj);

    struct TagItem *tags  = msg->ops_AttrList;
    struct TagItem *tag;

    UBYTE regval;

    while ((tag = NextTagItem(&tags)) != NULL) {
        switch(tag->ti_Tag) {
            case MUIA_Resolution:
                data->resolutionvga = tag->ti_Data;

                if(data->ps3eye_ep1pipe) {
                    if(data->resolutionvga) {
                        /* Turn red led on */
                        regval = 0x80;
                        ov534_reg_bitset(data, OV534_REG_GPIO_C0, &regval);
                        ov534_reg_bitset(data, OV534_REG_GPIO_V0, &regval);
                    } else {
                        /* Turn red led off */
                        regval = 0x80;
                        ov534_reg_bitset(data, OV534_REG_GPIO_C0, &regval);
                        ov534_reg_bitclr(data, OV534_REG_GPIO_V0, &regval);
                    }
                }

                SetAttrs(_win(obj), MUIA_Window_Open, FALSE, MUIA_Window_Open, TRUE, TAG_DONE);
            break;

        }
    }

    return DoSuperMethodA(cl, obj, (Msg)msg);
}
Exemplo n.º 15
0
/* /// "CfgListDispatcher()" */
AROS_UFH3(IPTR, CfgListDispatcher,
          AROS_UFHA(struct IClass *, cl, A0),
          AROS_UFHA(Object *, obj, A2),
          AROS_UFHA(Msg, msg, A1))
{
    AROS_USERFUNC_INIT
    // There should never be an uninitialized pointer, but just in case, try to get an mungwall hit if so.
    struct CfgListData *data = (struct CfgListData *) 0xABADCAFE;

    // on OM_NEW the obj pointer will be void, so don't try to get the data base in this case.
    if(msg->MethodID != OM_NEW) data = INST_DATA(cl,obj);

    switch(msg->MethodID)
    {
        case OM_NEW:
            if(!(obj = (Object *) DoSuperMethodA(cl,obj,msg)))
                return(0);
            return((IPTR) obj);

        case MUIM_DragBegin:
            data->cl_Dragging = TRUE;
            break;

        case MUIM_DragFinish:
            data->cl_Dragging = FALSE;
            break;

        case MUIM_DragQuery:
        {
            struct MUI_List_TestPos_Result tpr;
            struct Window *win;

            win = _window(obj);
            if(!win)
            {
                return(MUIV_DragQuery_Refuse);
            }
            DoMethod(obj, MUIM_List_TestPos, win->MouseX, win->MouseY, &tpr);
            return((IPTR) (CheckDragAccept(obj, tpr.entry) ? MUIV_DragQuery_Accept : MUIV_DragQuery_Refuse));
        }

#ifndef MUI_LPR_FULLDROP
#define MUI_LPR_FULLDROP (1<<15)
#endif
        case MUIM_List_TestPos:
        {
            struct MUIP_List_TestPos *tpmsg = (struct MUIP_List_TestPos *) msg;
            struct MUI_List_TestPos_Result *res = tpmsg->res;
            IPTR rc;
            rc = DoSuperMethodA(cl, obj, msg);
            if(data->cl_Dragging && (res->entry != -1))
            {
                if(!CheckDragAccept(obj, res->entry))
                {
                    res->entry = -1; // illegal combination
                } else {
                    res->flags |= MUI_LPR_FULLDROP;
                }
            }
            return(rc);
        }

        case MUIM_DragDrop:
        {
            //struct MUIP_DragDrop *ddmsg = (struct MUIP_DragDrop *) msg;
            struct MUI_List_TestPos_Result tpr;
            struct Window *win;

            win = _window(obj);
            if(!win)
            {
                return(FALSE);
            }
            DoMethod(obj, MUIM_List_TestPos, win->MouseX, win->MouseY, &tpr);
            //DoMethod(obj, MUIM_List_TestPos, ddmsg->x, ddmsg->y, &tpr);
            if(CheckDragAccept(obj, tpr.entry))
            {
                ApplyDragAction(obj, tpr.entry);
            } else {
                MUI_RequestA(_app(obj), _win(obj), 0, NULL, "Oops!",
                             "Sorry, drag'n drop operation to\n"
                             "that target is not supported.", NULL);
                return(FALSE);
            }
            return(TRUE);
        }

    }
    return(DoSuperMethodA(cl,obj,msg));
    AROS_USERFUNC_EXIT
}
Exemplo n.º 16
0
STATIC ULONG SingleString_GoActive(struct IClass *cl, Object *obj,Msg msg)
{
	struct SingleString_Data *data = (struct SingleString_Data*)INST_DATA(cl,obj);
	DoMethod(_win(obj), MUIM_Window_AddEventHandler, (ULONG)&data->ehnode);
	return DoSuperMethodA(cl, obj, msg);
}
Exemplo n.º 17
0
IPTR Prop__MUIM_Setup(struct IClass *cl, Object *obj, struct MUIP_Setup *msg)
{
    struct Prop_DATA *data = INST_DATA(cl, obj);
    ULONG rc = DoSuperMethodA(cl, obj, (Msg)msg);
    if (!rc) return 0;

    DoMethod(_win(obj),MUIM_Window_AddEventHandler,(IPTR)&data->ehn);

    data->buffer = NULL;
    data->temp = NULL;
    data->mapbuffer = NULL;
    data->maptemp = NULL;
    data->tmprp = NULL;

    if (!data->usewinborder)
    {
	data->gadgetid = DoMethod(_win(obj),MUIM_Window_AllocGadgetID);
        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;
        }

        struct MUI_AreaData *adata = muiAreaData(obj);
        struct MUI_ImageSpec_intern *spec = adata->mad_Background;

        if (spec)
        {
            if (spec->type == IST_BITMAP)
            {
                struct dt_node *node = spec->u.bitmap.dt;
                if (node)
                {
                    if (node->mode == MODE_PROP)
                    {
                        set(obj, MUIA_Frame, MUIV_Frame_None);
 
                        if (data->horiz == TRUE)
                        {
                            data->minheight = node->img_horizontalcontainer->h >> 1;
                            data->defheight = data->minheight;
                            data->maxheight = data->minheight;
                        }
                        else
                        {
                            data->minwidth = node->img_verticalcontainer->w >> 1;
                            data->defwidth = data->minwidth;
                            data->maxwidth = data->minwidth;
                        }
                    }
                }
Exemplo n.º 18
0
IPTR Register__MUIM_Setup(struct IClass *cl, Object *obj, struct MUIP_Setup *msg)
{
    struct Register_DATA *data = INST_DATA(cl, obj);
    WORD    	    i, h = 0;

    if (!DoSuperMethodA(cl, obj, (Msg)msg))
    {
        return FALSE;
    }

    _font(obj) = zune_font_get(obj, MUIV_Font_Title);
    data->fonth = _font(obj)->tf_YSize;
    data->fontb = _font(obj)->tf_Baseline;

    h = 0;

    i = data->fonth + REGISTERTAB_EXTRA_HEIGHT;
    h = (i > h) ? i : h;

    data->tab_height = h;
    data->ty = data->fontb + 1 + (data->tab_height - data->fonth) / 2;

    /*      D(bug("Register_Setup : data->height=%d\n", data->tab_height)); */

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

    data->total_hspacing = (data->columns + 1) * INTERTAB - 2;
    /*      D(bug("Register_AskMinMax : data->total_hspacing = %d\n", data->total_hspacing)); */

    data->min_width = data->total_hspacing * 3;
    data->def_width = data->total_hspacing;

    if (!(muiGlobalInfo(obj)->mgi_Prefs->register_truncate_titles))
    {
        struct RastPort temprp;
        int i;
        WORD textpixmax;

        InitRastPort(&temprp);
        SetFont(&temprp, _font(obj));

        textpixmax = 0;
        for(i = 0; i < data->numitems; i++)
        {
            WORD textpix = TextLength(&temprp, data->items[i].text, data->items[i].textlen);
            textpixmax = MAX(textpix, textpixmax);
        }
        data->def_width += (textpixmax + TEXTSPACING + 1) * data->numitems;
        data->def_width = MAX(data->min_width, data->def_width);

        DeinitRastPort(&temprp);
    }

    SetHardCoord(obj,data);
    muiAreaData(obj)->mad_Flags     	|= (MADF_INNERLEFT | MADF_INNERTOP | MADF_INNERRIGHT | MADF_INNERBOTTOM);

    DoMethod(_win(obj), MUIM_Window_AddEventHandler, (IPTR)&data->ehn);

    return TRUE;
}
Exemplo n.º 19
0
/**************************************************************************
 MUIM_HandleEvent
**************************************************************************/
IPTR Numericbutton__MUIM_HandleEvent(struct IClass *cl, Object *obj, struct MUIP_HandleEvent *msg)
{
    struct Numericbutton_DATA *data = INST_DATA(cl, obj);

    if (!msg->imsg)
    {
        return 0;
    }

    switch(msg->imsg->Class)
    {
    case IDCMP_MOUSEBUTTONS:
        switch(msg->imsg->Code)
        {
        case SELECTDOWN:
            if (_between(_left(obj), msg->imsg->MouseX, _right(obj)) &&
                    _between(_top(obj), msg->imsg->MouseY, _bottom(obj)) &&
                    (muiAreaData(obj)->mad_Flags & MADF_CANDRAW) &&
                    !data->popwin)
            {
                data->knob_clickoffset_x = msg->imsg->MouseX - _mleft(obj);

                if (MakePopupWin(obj, data))
                {
                    DoMethod(_win(obj), MUIM_Window_RemEventHandler, (IPTR)&data->ehn);
                    data->ehn.ehn_Events |= IDCMP_MOUSEMOVE;
                    DoMethod(_win(obj), MUIM_Window_AddEventHandler, (IPTR)&data->ehn);

                    return 0;
                }
            }
            break;

        case SELECTUP:
        case MENUUP:
        case MIDDLEUP:
        default:
            if (data->popwin)
            {
                KillPopupWin(obj, data);
                if ((msg->imsg->Code == SELECTUP))
                {
                    set(obj, MUIA_Numeric_Value, data->knob_val);
                }
                return 0;
            }
            break;


        } /* switch(msg->imsg->Code) */
        break;

    case IDCMP_MOUSEMOVE:
        if (data->popwin)
        {
            DrawKnob(obj, data, FALSE);

            return 0;
        }
        break;

    } /* switch(msg->imsg->Class) */

    return 0;
}
Exemplo n.º 20
0
    SEE ALSO

    INTERNALS

    HISTORY

*****************************************************************************/
{
    AROS_LIBFUNC_INIT

    if (muiRenderInfo(obj) && (_flags(obj) & MADF_SETUP) && _win(obj))
    {
	if (muiAreaData(obj)->mad_hiehn.ehn_Events)
	{
	    DoMethod(_win(obj), MUIM_Window_RemEventHandler, (IPTR)&muiAreaData(obj)->mad_hiehn);
	}
	muiAreaData(obj)->mad_hiehn.ehn_Events &= ~flags;
	if (muiAreaData(obj)->mad_hiehn.ehn_Events)
	{
	    DoMethod(_win(obj), MUIM_Window_AddEventHandler, (IPTR)&muiAreaData(obj)->mad_hiehn);
	}
    }
    else
    {
	muiAreaData(obj)->mad_hiehn.ehn_Events &= ~flags;
    }

    AROS_LIBFUNC_EXIT

} /* MUIA_RejectIDCMP */
Exemplo n.º 21
0
/* /// "ApplyDragAction()" */
BOOL ApplyDragAction(Object *obj, LONG targetentry)
{
    struct PrefsListEntry *targetplnode = NULL;
    struct PrefsListEntry *sourceplnode = NULL;
    ULONG sourceid, targetid;
    IPTR sourceentry = -1;
    LONG result;
    APTR pic, spic, tpic;
    APTR form;

    get(obj, MUIA_List_Active, &sourceentry);
    if((((LONG) sourceentry) < 0) || (targetentry < 0))
    {
        return(FALSE);
    }
    DoMethod(obj, MUIM_List_GetEntry, sourceentry, &sourceplnode);
    DoMethod(obj, MUIM_List_GetEntry, targetentry, &targetplnode);
    if((!(sourceplnode && targetplnode)) || (sourceplnode == targetplnode))
    {
        return(FALSE);
    }
    sourceid = sourceplnode->chunkid;
    targetid = targetplnode->chunkid;

    switch(sourceid)
    {
        case IFFFORM_DEVICECFG:
            if(targetid == IFFFORM_DEVICECFG)
            {
                result = MUI_Request(_app(obj), _win(obj), 0, NULL, "Replace|Merge|Cancel",
                                     "Do you want to \33breplace\33n or \33bmerge\33n the prefs of\n"
                                     "\33b%s\33n\n"
                                     "with the contents from\n"
                                     "\33b%s\33n?", targetplnode->id, sourceplnode->id);
                if(result < 1)
                {
                    return(FALSE);
                }
                tpic = NULL;
                spic = NULL;
                pic = psdFindCfgForm(NULL, IFFFORM_DEVICECFG);
                while(pic)
                {
                    if(psdMatchStringChunk(pic, IFFCHNK_DEVID, targetplnode->devid))
                    {
                        tpic = pic;
                    }
                    if(psdMatchStringChunk(pic, IFFCHNK_DEVID, sourceplnode->devid))
                    {
                        spic = pic;
                    }
                    pic = psdNextCfgForm(pic);
                }
                if(!(tpic && spic))
                {
                    return(FALSE);
                }
                // delete old contents
                if(result == 1)
                {
                    while((pic = psdFindCfgForm(tpic, IFFFORM_DEVCFGDATA)))
                    {
                        psdRemCfgForm(pic);
                    }
                    while((pic = psdFindCfgForm(tpic, IFFFORM_IFCFGDATA)))
                    {
                        psdRemCfgForm(pic);
                    }
                }

                // copy device cfg data
                pic = psdFindCfgForm(spic, IFFFORM_DEVCFGDATA);
                while(pic)
                {
                    form = psdWriteCfg(pic);
                    if(form)
                    {
                        psdAddCfgEntry(tpic, form);
                        psdFreeVec(form);
                    }
                    pic = psdNextCfgForm(pic);
                }
                // copy interface cfg data
                pic = psdFindCfgForm(spic, IFFFORM_IFCFGDATA);
                while(pic)
                {
                    form = psdWriteCfg(pic);
                    if(form)
                    {
                        psdAddCfgEntry(tpic, form);
                        psdFreeVec(form);
                    }
                    pic = psdNextCfgForm(pic);
                }
                return(TRUE);
            }
            break;

        case IFFFORM_IFCFGDATA:
        case IFFFORM_DEVCFGDATA:
            if((targetid == IFFFORM_DEVCFGDATA) || (targetid == IFFFORM_IFCFGDATA))
            {
                if(strcmp(sourceplnode->owner, targetplnode->owner))
                {
                    result = MUI_RequestA(_app(obj), _win(obj), 0, NULL, "Add to device|Cancel",
                                          "Sorry, but only prefs of the same owner can\n"
                                          "be replaced.\n\n"
                                          "Do you wish to add this prefs\n"
                                          "to the device instead?", NULL);
                    if(result < 1)
                    {
                        return(FALSE);
                    }
                    targetid = IFFFORM_DEVICECFG;
                } else {
                    result = MUI_Request(_app(obj), _win(obj), 0, NULL, "Replace|Cancel",
                                         "Do you want to \33breplace\33n the prefs of\n"
                                         "\33b%s\33n\n"
                                         "by those of\n"
                                         "\33b%s\33n?", targetplnode->id, sourceplnode->id);

                    if(result < 1)
                    {
                        return(FALSE);
                    }
                    pic = psdGetUsbDevCfg(sourceplnode->owner, sourceplnode->devid, sourceplnode->ifid);
                    if(pic)
                    {
                        form = psdWriteCfg(pic);
                        if(form)
                        {
                            psdSetUsbDevCfg(sourceplnode->owner, targetplnode->devid, targetplnode->ifid, form);
                            psdFreeVec(form);
                        }
                    }
                    return(TRUE);
                }
            }
            if(targetid == IFFFORM_DEVICECFG)
            {
                pic = psdGetUsbDevCfg(sourceplnode->owner, targetplnode->devid, sourceplnode->ifid);
                if(pic)
                {
                    result = MUI_Request(_app(obj), _win(obj), 0, NULL, "Replace|Cancel",
                                         "Do you want to \33breplace\33n the prefs of\n"
                                         "\33b%s\33n\n"
                                         "by the one in\n"
                                         "\33b%s\33n?", targetplnode->id, sourceplnode->id);
                } else {
                    result = MUI_Request(_app(obj), _win(obj), 0, NULL, "Add|Cancel",
                                         "Do you want to \33badd\33n the prefs of\n"
                                         "\33b%s\33n\n"
                                         "to the device\n"
                                         "\33b%s\33n?", sourceplnode->id, targetplnode->id);
                }
                if(result < 1)
                {
                    return(FALSE);
                }
                pic = psdGetUsbDevCfg(sourceplnode->owner, sourceplnode->devid, sourceplnode->ifid);
                if(pic)
                {
                    form = psdWriteCfg(pic);
                    if(form)
                    {
                        psdSetUsbDevCfg(sourceplnode->owner, targetplnode->devid, sourceplnode->ifid, form);
                        psdFreeVec(form);
                    }
                }
                return(TRUE);
            }
            break;

        case IFFCHNK_FORCEDBIND:
            if((targetid == IFFFORM_DEVICECFG) ||
               (targetid == IFFFORM_DEVCFGDATA) ||
               (targetid == IFFFORM_IFCFGDATA) ||
               (targetid == IFFCHNK_FORCEDBIND))
            {
                psdSetForcedBinding(sourceplnode->owner, targetplnode->devid, targetplnode->ifid);
                return(TRUE);
            }
            break;
    }
    return(FALSE);
}
Exemplo n.º 22
0
IPTR Popimage__MUIM_Popimage_OpenWindow(struct IClass *cl, Object *obj, Msg msg)
{
    struct Popimage_DATA *data = INST_DATA(cl, obj);

    if (!data->wnd)
    {
    	Object *ok_button, *cancel_button;
    	char *img_spec;
	ULONG x = 0, y = 0;

	get(_win(obj), MUIA_Window_LeftEdge, &x);
	get(_win(obj), MUIA_Window_TopEdge, &y);

	get(obj,MUIA_Imagedisplay_Spec, &img_spec);

    	data->wnd = (Object *)WindowObject,
            MUIA_Window_Title,       (IPTR) data->wintitle,
            MUIA_Window_Activate,           TRUE,
            MUIA_Window_IsSubWindow,        TRUE,
            MUIA_Window_LeftEdge,           _left(obj) + x,
            MUIA_Window_TopEdge,            _bottom(obj) + y + 1,
            
            WindowContents, (IPTR) VGroup,
                Child, (IPTR) (data->imageadjust = MUI_NewObject
                (
                    MUIC_Imageadjust,
                    MUIA_CycleChain,              1,
                    MUIA_Imageadjust_Spec,        (IPTR) img_spec,
                    MUIA_Imageadjust_Type,        data->adjust_type,
		    MUIA_Imageadjust_Originator,  (IPTR) obj,
                    TAG_DONE
                )),
                Child, (IPTR) HGroup,
                    MUIA_Group_SameWidth, TRUE,
                    Child, (IPTR) (ok_button = MUI_MakeObject
                    (
                        MUIO_Button, (IPTR) "_Ok"
                    )),
                    Child, (IPTR) HVSpace,
                    Child, (IPTR) HVSpace,
                    Child, (IPTR) (cancel_button = MUI_MakeObject
                    (
                        MUIO_Button, (IPTR) "_Cancel"
                    )),
                End,
            End,
        End;

	if (data->wnd)
	{
	    set(ok_button, MUIA_CycleChain, 1);
	    set(cancel_button, MUIA_CycleChain, 1);

	    DoMethod(_app(obj),OM_ADDMEMBER,(IPTR)data->wnd);

	    DoMethod
            (
                ok_button, MUIM_Notify, MUIA_Pressed, FALSE, 
                (IPTR) _app(obj), 5, MUIM_Application_PushMethod, 
                (IPTR) obj, 2, MUIM_Popimage_CloseWindow, TRUE
            );
	    DoMethod
            (
                cancel_button, MUIM_Notify, MUIA_Pressed, FALSE, 
                (IPTR) _app(obj), 5, MUIM_Application_PushMethod, 
                (IPTR) obj, 2, MUIM_Popimage_CloseWindow, FALSE
            );
	    DoMethod
            (
                data->wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, 
                (IPTR) _app(obj), 5, MUIM_Application_PushMethod, 
                (IPTR) obj, 2, MUIM_Popimage_CloseWindow, FALSE
            );
	}
    }

    if (data->wnd)
    {
	ULONG opened;

	set(data->wnd, MUIA_Window_Open,TRUE);
	get(data->wnd, MUIA_Window_Open, &opened);
	if (!opened)
	{
	    DoMethod(obj, MUIM_Popimage_CloseWindow, FALSE);
	}
    }

    return 1;
}