示例#1
0
IPTR Poppen__MUIM_Poppen_OpenWindow(struct IClass *cl, Object *obj, Msg msg)
{
    struct Poppen_DATA *data = INST_DATA(cl, obj);

    if (!data->wnd)
    {
        Object *ok_button, *cancel_button;
        char *penspec;

        get(obj,MUIA_Pendisplay_Spec, &penspec);

        data->wnd = (Object *)(WindowObject,
                               MUIA_Window_Title, (IPTR)data->wintitle,
                               MUIA_Window_Activate, TRUE,
                               WindowContents, (IPTR)VGroup,
                               Child, (IPTR)(data->penadjust = (Object *)PenadjustObject,
                                             MUIA_CycleChain, 1,
                                             MUIA_Penadjust_Spec, (IPTR)penspec,
                                             End),
                               Child, (IPTR)HGroup,
                               Child, (IPTR)(ok_button = MUI_MakeObject(MUIO_Button,(IPTR)"_Ok")),
                               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_Poppen_CloseWindow, TRUE);
            DoMethod(cancel_button, MUIM_Notify, MUIA_Pressed, FALSE, (IPTR)_app(obj), 5,
                     MUIM_Application_PushMethod, (IPTR)obj, 2,
                     MUIM_Poppen_CloseWindow, FALSE);
            DoMethod(data->wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, (IPTR)_app(obj), 5,
                     MUIM_Application_PushMethod, (IPTR)obj, 2,
                     MUIM_Poppen_CloseWindow, FALSE);
        }
    }

    if (data->wnd)
    {
        IPTR opened;

        set(data->wnd, MUIA_Window_Open,TRUE);
        get(data->wnd, MUIA_Window_Open, &opened);

        if (!opened)
        {
            DoMethod(obj, MUIM_Poppen_CloseWindow, FALSE);
        }
    }

    return 1;
}
示例#2
0
static IPTR mWindow_Setup(struct IClass *cl, Object *obj, struct MUIP_Window_Setup *msg)
{
  IPTR result = FALSE;

  ENTER();

  if(DoSuperMethodA(cl, obj, (Msg)msg))
  {
    struct data *data = INST_DATA(cl, obj);

    if(isFlagClear(data->flags, FLG_Notifies))
    {
      DoMethod(data->use, MUIM_Notify, MUIA_Pressed, FALSE, (IPTR)obj, 1, MUIM_BrowserEditWin_Use);
      DoMethod(data->cancel, MUIM_Notify, MUIA_Pressed, FALSE, (IPTR)obj, 3, MUIM_Set, MUIA_Window_CloseRequest, TRUE);

      DoMethod(obj, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, (IPTR)_app(obj), 6, MUIM_Application_PushMethod,
          (IPTR)_app(obj), 3, MUIM_App_CloseWin, MUIA_BrowserEditWin_Browser, (IPTR)data->bn);

      SET_FLAG(data->flags, FLG_Notifies);

      result = TRUE;
    }
  }

  RETURN(result);
  return result;
}
示例#3
0
文件: ps3eye.c 项目: michalsc/AROS
IPTR mCleanup(Class *cl, Object *obj, struct MUIP_Cleanup *msg) {
	mybug(-1, ("mCleanup gets called\n"));

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

    DoMethod(_app(obj), MUIM_Application_RemInputHandler, (IPTR)&data->tmreventihn); 
//	DoMethod(_app(obj), MUIM_Application_RemInputHandler, (IPTR)&data->psdeventihn);
    
    return DoSuperMethodA(cl, obj, (Msg)msg);
}
示例#4
0
IPTR Popstring__MUIM_Popstring_Close(struct IClass *cl, Object *obj, struct MUIP_Popstring_Close *msg)
{
    struct Popstring_DATA *data = INST_DATA(cl, obj);
    if (data->close_hook && data->open)
    {
    	DoMethod(_app(obj), MUIM_Application_PushMethod, (IPTR)obj, 4, MUIM_CallHook, (IPTR)data->close_hook, (IPTR)data->string, msg->result);
	data->open = 0;
    	set(data->button,MUIA_Disabled, FALSE);
    }
    return 0;
}
示例#5
0
文件: ps3eye.c 项目: michalsc/AROS
IPTR mSetup(Class *cl, Object *obj, struct MUIP_Setup *msg) {
	mybug(-1, ("mSetup gets called\n"));

    struct InstData *data = INST_DATA(cl, obj);
    
    if (!DoSuperMethodA(cl, obj, (Msg)msg)) return FALSE;

//    DoMethod(_app(obj), MUIM_Application_AddInputHandler, (IPTR)&data->psdeventihn);
    DoMethod(_app(obj), MUIM_Application_AddInputHandler, (IPTR)&data->tmreventihn);

    return TRUE;
}
示例#6
0
IPTR Poppen__MUIM_Hide(struct IClass *cl, Object *obj, struct opGet *msg)
{
    struct Poppen_DATA *data = INST_DATA(cl, obj);

    if (data->wnd)
    {
        set(data->wnd,MUIA_Window_Open,FALSE);
        DoMethod(_app(obj),OM_REMMEMBER,(IPTR)data->wnd);
        MUI_DisposeObject(data->wnd);
        data->wnd = NULL;
    }
    return DoSuperMethodA(cl,obj,(Msg)msg);
}
示例#7
0
IPTR Popimage__MUIM_Hide(struct IClass *cl, Object *obj, struct opGet *msg)
{
#if 0
    struct Popimage_DATA *data = INST_DATA(cl, obj);
    if (data->wnd)
    {
	D(bug("Popimage_Hide(%p) : closing window %p\n", obj, data->wnd));
    	set(data->wnd,MUIA_Window_Open,FALSE);
	D(bug("Popimage_Hide(%p) : app REMMEMBER win (%p)\n", obj, data->wnd));
    	DoMethod(_app(obj),OM_REMMEMBER,(IPTR)data->wnd);
	D(bug("Popimage_Hide(%p) : MUI_DisposeObject(%p)\n", obj, data->wnd));
    	MUI_DisposeObject(data->wnd);
    	data->wnd = NULL;
    }
#endif
    return DoSuperMethodA(cl,obj,(Msg)msg);
}
示例#8
0
IPTR Popimage__MUIM_Popimage_CloseWindow(struct IClass *cl, Object *obj,
				 struct MUIP_Popimage_CloseWindow *msg)
{
    struct Popimage_DATA *data = INST_DATA(cl, obj);
    int ok = msg->ok;

    set(data->wnd, MUIA_Window_Open, FALSE);

    if (ok)
    {
	char *spec;
	get(data->imageadjust, MUIA_Imageadjust_Spec, &spec);
/*  	D(bug("popimage: got %s\n", spec)); */
	set(obj, MUIA_Imagedisplay_Spec, (IPTR)spec);
    }

    DoMethod(_app(obj), OM_REMMEMBER, (IPTR)data->wnd);
    MUI_DisposeObject(data->wnd);
    data->wnd = NULL;
    data->imageadjust = NULL;
    return 1;
}
示例#9
0
IPTR Poppen__MUIM_Poppen_CloseWindow(struct IClass *cl, Object *obj,
                                     struct MUIP_Poppen_CloseWindow *msg)
{
    struct Poppen_DATA *data = INST_DATA(cl, obj);
    int ok = msg->ok;

    set(data->wnd, MUIA_Window_Open, FALSE);

    if (ok)
    {
        char *spec;

        get(data->penadjust, MUIA_Penadjust_Spec, &spec);

        set(obj, MUIA_Pendisplay_Spec, (IPTR)spec);
    }

    DoMethod(_app(obj), OM_REMMEMBER, (IPTR)data->wnd);
    MUI_DisposeObject(data->wnd);
    data->wnd = NULL;
    data->penadjust = NULL;
    return 1;
}
int main(int argc, char *argv[])
{
    // Signal settings.
    double rate = 1e6;
    double freq = 10e3;
    double fc = 150e3;

    // Modulation settings
    double gain = 1;
    double rel_fc = fc / rate;
    double rel_fs = freq / rate;

    // Specific Modulation Settings.
    AmDemod::SideBand sideBand = AmDemod::SideBand::DOUBLE;
    unsigned int constSize = 2;
    int supp_carrier = 0;
    double mod_index = 0.5;

    // Frame size and FFT size.
    size_t N = 2048;
    size_t frameSize = 384;

/***************************************************************************************************
 *                                      Create stream object                                       *
 **************************************************************************************************/

    // AM Stream function.
    StreamFunction * _streamFunction = new AmFunction(new cosFunction(freq), mod_index, rel_fc, sideBand, supp_carrier);

    // FM Stream Function
//    StreamFunction * _streamFunction = new FmFunction(new cosFunction(freq), mod_index, rel_fc);

    // MPSK Stream Function
//    StreamFunction * _streamFunction = new DigitalFunction(new MPskFunction(constSize), rel_fs, rel_fc);

    // ------------ Create Streamer Object ------------ //
    // UhdMock Object
    boost::scoped_ptr < Streamer > _dataStream(new UhdMock(_streamFunction, rate, gain, frameSize));
    // UhdRead Object
    //    boost::scoped_ptr < Streamer > _dataStream(new UhdRead(rate, freq, gain, frameSize));

/***************************************************************************************************
 *                                     Initialize utilities                                        *
 **************************************************************************************************/

    // Get shared buffer
    boost::shared_ptr < SharedBuffer<std::complex<double> > > _buffer(_dataStream->getBuffer());
    boost::shared_ptr < SharedType<double> > _fc(_dataStream->getFc());
    boost::shared_ptr < SharedType<double> > _window(_dataStream->getWindow());

    // Create fft generator function.
    FFTGenerator _fftGen(_buffer, rate, N);

    AmcClassifier<double, AMC::ModType> * classifier = new AmcCvDecisionTree();
    AMC::FeatureExtractor _featureExtractor(_buffer, classifier, N, rate);

    boost::shared_ptr < SharedType<AMC::ModType> > _modType(_featureExtractor.getSharedModType());

/***************************************************************************************************
 *                                      Create Demodulator                                         *
 **************************************************************************************************/

    // Create demodulator object.
    AmcRecv _amcRecv(_buffer, N);
    _amcRecv.setFc(_fc);
    _amcRecv.setModType(_modType);

    // Am Demodulator.
    _amcRecv.setDemod(new AmDemod(mod_index, rel_fc, sideBand, supp_carrier));

    // Fm Demodulator.
//    _amcRecv.setDemod(new FmDemod(mod_index, rel_fc));

    // MPSK Demodulator
//    _amcRecv.setDemod(new DigitalDemod(new MPskDemod(constSize), rel_fc));

/***************************************************************************************************
 *                                      Initialize GUI Objects                                     *
 **************************************************************************************************/

    // Initialize interface.
    QApplication _app(argc, argv);
    MainWindow _mainWindow(rate, N);
    _mainWindow.show();

/***************************************************************************************************
 *                                      Share some buffers                                         *
 **************************************************************************************************/
    _fftGen.setFc(_fc);

    _mainWindow.setData(_fftGen.getFreqVec(), _fftGen.getFftVec());
    _mainWindow.setBuffer(_buffer);
    _mainWindow.setSharedModType(_modType);
    _mainWindow.setFc(_fc);
    _mainWindow.setWindow(_window);

/***************************************************************************************************
 *                                          Start threads.                                         *
 **************************************************************************************************/

    _dataStream->startStream();
    _amcRecv.startDemod();
    _fftGen.startFft();
    _featureExtractor.start(AMC::FeatureExtractor::ExtractionMode::CLASSIFY);

    return _app.exec();
}
示例#11
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;
}
示例#12
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
}
示例#13
0
IPTR AboutWindow__MUIM_Window_Setup
(
    Class *CLASS, Object *self, Msg message
)
{
    struct AboutWindow_DATA *data    = INST_DATA(CLASS, self);
    struct Catalog          *catalog = data->awd_Catalog;
    STRPTR                   string  = NULL;
    
    if (!DoSuperMethodA(CLASS, self, message)) return FALSE;

    /*= Setup window title =================================================*/
    {
        STRPTR buffer = NULL;
        ULONG  length = 0;
        
        string = data->awd_Title;
        if (string == NULL)
        {
            GET(self, MUIA_AboutWindow_Title, &string);
            
            if (string != IGNORE)
            {
                if (string == NULL)
                {
                    GET(_app(self), MUIA_Application_Title, &string);
                }
                
                if (string != NULL)
                {
                    length = strlen(string) + strlen(_(MSG_ABOUT)) + 2; /* space + newline */
                    buffer = AllocVec(length, MEMF_ANY);
                    
                    if (buffer != NULL)
                    {
                        buffer[0] = '\0';
                        strlcat(buffer, _(MSG_ABOUT), length);
                        strlcat(buffer, " ", length);
                        strlcat(buffer, string, length);
                        
                        set(self, MUIA_Window_Title, buffer);
                        
                        FreeVec(buffer);
                    }
                }
            }
        }
    }
    
    /*= Setup image ========================================================*/
    if (data->awd_ImageObject == NULL)
    {
        DoMethod(data->awd_RootGroup, OM_REMMEMBER, (IPTR) data->awd_ImageGroup);
    }
    
    /*= Setup version ======================================================*/ 
    /* 
        The version string will have the format:
        MUIX_B"<title>"MUIX_N" <version> (<date>) [<extra>]" 
    */
    {
        STRPTR title         = data->awd_Title,
               versionNumber = data->awd_VersionNumber,
               versionDate   = data->awd_VersionDate,
               versionExtra  = data->awd_VersionExtra,
               buffer        = NULL;
        ULONG  length        = 0;
        
        /*- Setup default values -------------------------------------------*/
        if (title == NULL)
        {
            GET(_app(self), MUIA_Application_Title, &title);
        }
        
        if (versionNumber == NULL)
        {
            GET(_app(self), MUIA_Application_Version_Number, &versionNumber);
        }
        
        if (versionDate == NULL)
        {
            GET(_app(self), MUIA_Application_Version_Date, &versionDate);
        }
        
        if (versionExtra == NULL)
        {
            GET(_app(self), MUIA_Application_Version_Extra, &versionExtra);
        }
        
        /* Simplify later checks a little */
        if (title         == IGNORE) title         = NULL;
        if (versionNumber == IGNORE) versionNumber = NULL;
        if (versionDate   == IGNORE) versionDate   = NULL;
        if (versionExtra  == IGNORE) versionExtra  = NULL;
        
        /*- Calculate length -----------------------------------------------*/
        if (title != NULL)
        {
            length += strlen(MUIX_B) + strlen(title) + strlen(MUIX_N) + 1;
        }
        
        if (versionNumber != NULL)
        {
            length += 1 /* space */ + strlen(versionNumber);
        }
        
        if (versionDate != NULL)
        {
            length += 1 /* space */ + 1 /* ( */ + strlen(versionDate) + 1 /* ) */;
        }
        
        if (versionExtra != NULL)
        {
            length += 1 /* space */ + 1 /* [ */ + strlen(versionExtra) + 1 /* ] */;
        }
        
        /*- Setup version object -------------------------------------------*/
        if (length > 0)
        {
            /*- Allocate memory --------------------------------------------*/
            buffer = AllocVec(length, MEMF_ANY);
            
            if (buffer != NULL)
            {
                buffer[0] = '\0';
                
                /*- Generate text ------------------------------------------*/
                if (title != NULL)
                {
                    strlcat(buffer, MUIX_B, length);
                    strlcat(buffer, title, length);
                    strlcat(buffer, MUIX_N, length);
                }
                
                if (versionNumber != NULL)
                {
                    strlcat(buffer, " ", length);
                    strlcat(buffer, versionNumber, length);
                }
                
                if (versionDate != NULL)
                {
                    strlcat(buffer, " (", length);
                    strlcat(buffer, versionDate, length);
                    strlcat(buffer, ")", length);
                }
                
                if (versionExtra != NULL)
                {
                    strlcat(buffer, " [", length);
                    strlcat(buffer, versionExtra, length);
                    strlcat(buffer, "]", length);
                }
                
                set(data->awd_VersionObject, MUIA_Text_Contents, buffer);
                FreeVec(buffer); /* don't need it anymore */
            }
            else
            {
                DoMethod
                (
                    data->awd_RootGroup, OM_REMMEMBER, (IPTR) data->awd_VersionObject
                );
            }
        }
    }
        
    /*= Setup copyright ====================================================*/
    if (data->awd_Copyright == NULL)
    {
        GET(_app(self), MUIA_Application_Copyright, &data->awd_Copyright);
    }
    
    if (data->awd_Copyright != IGNORE && data->awd_Copyright != NULL)
    {
        SET(data->awd_CopyrightObject, MUIA_Text_Contents, data->awd_Copyright);
    }
    else
    {
        DoMethod(data->awd_RootGroup, OM_REMMEMBER, (IPTR) data->awd_CopyrightObject);
    }
    
    /*= Setup description ==================================================*/
    if (data->awd_Description == NULL)
    {
        GET(_app(self), MUIA_Application_Description, &data->awd_Description);
    }
    
    if (data->awd_Description != IGNORE && data->awd_Description != NULL)
    {
        SET
        (
            data->awd_DescriptionObject, 
            MUIA_Text_Contents, data->awd_Description
        );
    }
    else
    {
        DoMethod
        (
            data->awd_RootGroup, OM_REMMEMBER, (IPTR) data->awd_DescriptionGroup
        );
    }
    
    /* We no longer need to know whether to IGNORE or not */
    if (data->awd_Title == IGNORE) data->awd_Title = NULL;
    if (data->awd_VersionNumber == IGNORE) data->awd_VersionNumber = NULL;
    if (data->awd_VersionDate == IGNORE) data->awd_VersionDate = NULL;
    if (data->awd_VersionExtra == IGNORE) data->awd_VersionExtra = NULL;
    if (data->awd_Copyright == IGNORE) data->awd_Copyright = NULL;
    if (data->awd_Description == IGNORE) data->awd_Description = NULL;
    
    return TRUE;
}
示例#14
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);
}
示例#15
0
文件: main.cpp 项目: Cursal/CDK
int main(int _argc, char *_argv[])
{
  CDK::EngineApp _app(_argc, _argv);
  return _app.exec();
}
示例#16
0
文件: win.c 项目: michalsc/AROS
static IPTR mGetPrefs(struct IClass *cl,Object *obj, struct MUIP_Win_GetPrefs *msg)
{
    struct data            *data = INST_DATA(cl,obj);
    struct URL_Prefs       *p;
    struct URL_BrowserNode *bn;
    struct URL_MailerNode  *mn;
    struct URL_FTPNode     *fn;
    ULONG                  mode, error = 0;

    /* get the openurl.library prefs */

    switch (msg->mode)
    {
        case MUIV_Win_GetPrefs_InUse:      mode = URL_GetPrefs_Mode_InUse;   break;
        case MUIV_Win_GetPrefs_LastSaveds: mode = URL_GetPrefs_Mode_Envarc;  break;
        case MUIV_Win_GetPrefs_Restore:    mode = URL_GetPrefs_Mode_Env;     break;
        case MUIV_Win_GetPrefs_Defaults:   mode = URL_GetPrefs_Mode_Default; break;
        default: return FALSE;
    }

    p = URL_GetPrefs(URL_GetPrefs_Mode,mode,TAG_DONE);
    if (!p) error = MSG_Err_NoPrefs;
    else if (p->up_Version!=PREFS_VERSION) error = MSG_Err_BadPrefs;

    if (error)
    {
        MUI_Request(_app(obj),NULL,0,getString(MSG_ErrReqTitle),
                                     getString(MSG_ErrReqGadget),
                                     getString(error),
                                     p ? p->up_Version : 0);

        if (p) URL_FreePrefsA(p,NULL);

        return FALSE;
    }

    /* Browsers */
    set(data->browserList,MUIA_List_Quiet,TRUE);
    DoMethod(data->browserList,MUIM_List_Clear);

    for (bn = (struct URL_BrowserNode *)p->up_BrowserList.mlh_Head;
         bn->ubn_Node.mln_Succ;
         bn = (struct URL_BrowserNode *)bn->ubn_Node.mln_Succ)
    {
        DoMethod(data->browserList,MUIM_List_InsertSingle,(IPTR)bn,MUIV_List_Insert_Bottom);
    }

    set(data->browserList,MUIA_List_Quiet,FALSE);

    /* Mailers */
    set(data->mailerList,MUIA_List_Quiet,TRUE);
    DoMethod(data->mailerList,MUIM_List_Clear);

    for (mn = (struct URL_MailerNode *)p->up_MailerList.mlh_Head;
         mn->umn_Node.mln_Succ;
         mn = (struct URL_MailerNode *)mn->umn_Node.mln_Succ)
    {
        DoMethod(data->mailerList,MUIM_List_InsertSingle,(IPTR)mn,MUIV_List_Insert_Bottom);
    }

    set(data->mailerList,MUIA_List_Quiet,FALSE);

    /* FTPs */
    set(data->FTPList,MUIA_List_Quiet,TRUE);
    DoMethod(data->FTPList,MUIM_List_Clear);

    for (fn = (struct URL_FTPNode *)p->up_FTPList.mlh_Head;
         fn->ufn_Node.mln_Succ;
         fn = (struct URL_FTPNode *)fn->ufn_Node.mln_Succ)
    {
        DoMethod(data->FTPList,MUIM_List_InsertSingle,(IPTR)fn,MUIV_List_Insert_Bottom);
    }

    set(data->FTPList,MUIA_List_Quiet,FALSE);

    /* Miscellaneous */
    set(data->prepend, MUIA_Selected, isFlagSet(p->up_Flags, UPF_PREPENDHTTP));
    set(data->mailto, MUIA_Selected, isFlagSet(p->up_Flags, UPF_DOMAILTO));
    set(data->useFTP, MUIA_Selected, isFlagSet(p->up_Flags, UPF_DOFTP));

    set(data->show, MUIA_Selected, p->up_DefShow);
    set(data->toFront, MUIA_Selected, p->up_DefBringToFront);
    set(data->newWin, MUIA_Selected, p->up_DefNewWindow);
    set(data->launch, MUIA_Selected, p->up_DefLaunch);

    /* Activate the first entry */
    DoSuperMethod(cl,obj,MUIM_MultiSet,MUIA_List_Active,MUIV_List_Active_Top,
        (IPTR)data->browserList,
        (IPTR)data->mailerList,
        (IPTR)data->FTPList,
        NULL);

    URL_FreePrefsA(p,NULL);

    return TRUE;
}
示例#17
0
文件: win.c 项目: michalsc/AROS
static IPTR mStorePrefs(struct IClass *cl, Object *obj, struct MUIP_Win_StorePrefs *msg)
{
    struct data *data = INST_DATA(cl,obj);
    struct URL_Prefs     up;
    ULONG                i;

    set(_app(obj),MUIA_Application_Sleep,TRUE);

    /* Copy settings from gadgets into structure */
    up.up_Version = PREFS_VERSION;
    NewList((struct List *)&up.up_BrowserList);
    NewList((struct List *)&up.up_MailerList);
    NewList((struct List *)&up.up_FTPList);

    /* Browsers */
    for (i = 0; ; i++)
    {
        struct URL_BrowserNode *bn;

        DoMethod(data->browserList,MUIM_List_GetEntry,i,(IPTR)&bn);
        if (!bn) break;

        if(isFlagClear(bn->ubn_Flags, UNF_NEW))
            AddTail((struct List *)&up.up_BrowserList,(struct Node *)bn);
    }

    /* Mailers */
    for (i = 0; ; i++)
    {
        struct URL_MailerNode *mn;

        DoMethod(data->mailerList,MUIM_List_GetEntry,i,(IPTR)&mn);
        if (!mn) break;

        if(isFlagClear(mn->umn_Flags, UNF_NEW))
            AddTail((struct List *)&up.up_MailerList,(struct Node *)mn);
    }

    /* FTPs */
    for (i = 0; ; i++)
    {
        struct URL_FTPNode *fn;

        DoMethod(data->FTPList,MUIM_List_GetEntry,i,(IPTR)&fn);
        if (!fn) break;

        if(isFlagClear(fn->ufn_Flags, UNF_NEW))
            AddTail((struct List *)&up.up_FTPList,(struct Node *)fn);
    }

    /* Miscellaneous */
    if (xget(data->prepend,MUIA_Selected))
        SET_FLAG(up.up_Flags, UPF_PREPENDHTTP);
    else
        CLEAR_FLAG(up.up_Flags, UPF_PREPENDHTTP);

    if (xget(data->mailto,MUIA_Selected))
        SET_FLAG(up.up_Flags, UPF_DOMAILTO);
    else
        CLEAR_FLAG(up.up_Flags, UPF_DOMAILTO);

    if (xget(data->useFTP,MUIA_Selected))
        SET_FLAG(up.up_Flags, UPF_DOFTP);
    else
        CLEAR_FLAG(up.up_Flags, UPF_DOFTP);

    up.up_DefShow         = (ULONG)xget(data->show,MUIA_Selected);
    up.up_DefBringToFront = (ULONG)xget(data->toFront,MUIA_Selected);
    up.up_DefNewWindow    = (ULONG)xget(data->newWin,MUIA_Selected);
    up.up_DefLaunch       = (ULONG)xget(data->launch,MUIA_Selected);

    /* Save to disk */
    if (!URL_SetPrefs(&up,URL_SetPrefs_Save,msg->How==MUIV_Win_StorePrefs_Save,TAG_DONE))
        MUI_RequestA(_app(obj),obj,0,getString(MSG_ErrReqTitle),getString(MSG_ErrReqGadget),getString(MSG_Err_FailedSave),NULL);

    set(_app(obj),MUIA_Application_Sleep,FALSE);

    /* Quit */
    if (msg->How!=MUIV_Win_StorePrefs_Apply)
        DoMethod(_app(obj),MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);

    return TRUE;
}
int main(int argc, char *argv[])
{
    // Signal settings.
    double rate = 1e6;
    double freq = 10e3;
    double fc = 150e3;

    // Modulation settings
    double gain = 1;
    double rel_fc = fc / rate;
    double rel_fs = freq / rate;

    boost::shared_ptr<SharedType<double> > fcr(new SharedType<double>(rel_fc));

    // Specific Modulation Settings.
    AmDemod::SideBand sideBand = AmDemod::SideBand::DOUBLE;
    unsigned int constSize = 16;
    int supp_carrier = 1;
    double mod_index = 0.5;

    // Frame size and FFT size.
    size_t N = 2048;
    size_t frameSize = 384;

    /***************************************************************************************************
     *                                      Create stream object                                       *
     **************************************************************************************************/

    // AM Stream function.
    StreamFunction * _streamFunction = new AmFunction(new cosFunction(freq), mod_index, rel_fc, sideBand, supp_carrier);
    //StreamFunction * _streamFunction = new eFunction(freq);
    StreamFunction * _noisyStreamFunction = new AwgnFunction(_streamFunction, 0, 1e6, 1e6);
    // FM Stream Function
    //StreamFunction * _streamFunction = new FmFunction(new cosFunction(freq), mod_index, rel_fc);

    // MPSK Stream Function
    //StreamFunction * _streamFunction = new DigitalFunction(new MPskFunction(constSize), rel_fs, rel_fc);

    // ------------ Create Streamer Object ------------ //
    // UhdMock Object
    boost::scoped_ptr < Streamer > _dataStream(new UhdMock(_noisyStreamFunction, rate, gain, frameSize));
    // UhdRead Object
    //    boost::scoped_ptr < Streamer > _dataStream(new UhdRead(rate, freq, gain, frameSize));

    /***************************************************************************************************
     *                                     Initialize utilities                                        *
     **************************************************************************************************/

    // Get shared buffer
    boost::shared_ptr < SharedBuffer<std::complex<double> > > _buffer(_dataStream->getBuffer());

    // Create fft generator function.
    FFTGenerator _fftGen(_buffer, rate, N);

    AmcClassifier<double, AMC::ModType> * classifier = new AmcZnDecisionTree();
    //classifier->load("test0");
    std::string dir = "/home/jcq/git/Automatic-Modulation-Classification-ELEN4012/train-data/2015-10-12-3";
    ClassifierTrainer ct(classifier,dir);
    ct.train();
    ct.save("test0");
    //AMC::FeatureExtractor _featureExtractor(_buffer, classifier, N, rate);
    AMC::FeatureExtractor _featureExtractor(_buffer, classifier, rate, fcr, N);
    AMC::FeatureExtractor _featureExtractor(_buffer, rate, fcr, bwr,N,1);



    /***************************************************************************************************
     *                                      Initialize GUI Objects                                     *
     **************************************************************************************************/

    // Initialize interface.
    QApplication _app(argc, argv);
    MainWindow _mainWindow(rate, N);
    _mainWindow.show();

    _mainWindow.setData(_fftGen.getFreqVec(), _fftGen.getFftVec());
    _mainWindow.setBuffer(_buffer);
    _mainWindow.setSharedModType(_featureExtractor.getSharedModType());

    /***************************************************************************************************
     *                                          Start threads.                                         *
     **************************************************************************************************/

    _dataStream->startStream();

//    _amcRecv.startDemod();
    _fftGen.startFft();
    _featureExtractor.start(AMC::FeatureExtractor::ExtractionMode::CLASSIFY);

    return _app.exec();
}
示例#19
0
///ImageBackFill__MUIM_IconWindow_BackFill_ProcessBackground()
IPTR ImageBackFill__MUIM_IconWindow_BackFill_ProcessBackground
(
  Class *CLASS, Object *self, struct MUIP_IconWindow_BackFill_ProcessBackground *message
)
{

  LONG        Depth = 0;
  Object      *_IconWindows_PrefsObj    = NULL,
              *_IconWindows_WindowObj   = NULL;
  Object      *_IconWindows_IconListObj = NULL;

  BOOL        options_changed = FALSE;

  IPTR        prefs_processing        = 0;
  
  IPTR        BackGround_Attrib       = 0,
              BackGround_Base         = 0,
              BackGround_RenderMode   = 0,
              BackGround_TileMode     = 0,
              BackGround_XOffset      = 0,
              BackGround_YOffset      = 0;
  
  struct BackFillInfo   *this_BFI =(struct BackFillInfo   *) message->BackFill_Data;

  UBYTE                  *this_bgtype;
  char                  *this_ImageName;

  D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground()\n"));
  
  GET(_app(self), MUIA_Wanderer_Prefs, &_IconWindows_PrefsObj);

  D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: PrefsObj @ %x\n", _IconWindows_PrefsObj));
  
  GET(self, MUIA_IconWindow_Window, &_IconWindows_WindowObj);
  GET(self, MUIA_IconWindow_IconList, &_IconWindows_IconListObj);

  D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: MUIA_IconWindow_Window = %x\n", _IconWindows_WindowObj));

  if ((_IconWindows_PrefsObj == NULL) || (_IconWindows_WindowObj == NULL) || (_IconWindows_IconListObj == NULL)) return FALSE;

  GET(_IconWindows_PrefsObj, MUIA_WandererPrefs_Processing, &prefs_processing);

#if defined(DEBUG)
  if (prefs_processing)
  {
    D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Wanderer Prefs (re)loading detected\n"));
  }
#endif
  
  GET(_IconWindows_WindowObj, MUIA_IconWindow_BackgroundAttrib, &BackGround_Attrib);
  
  D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Background Attrib = '%s'\n", BackGround_Attrib));

  if (BackGround_Attrib == (IPTR) NULL) return FALSE;
  
  if ((BackGround_Base = DoMethod(_IconWindows_PrefsObj, MUIM_WandererPrefs_ViewSettings_GetAttribute,
                  BackGround_Attrib, MUIA_Background)) == -1)
    return FALSE;

  if ((BackGround_RenderMode = DoMethod(_IconWindows_PrefsObj, MUIM_WandererPrefs_ViewSettings_GetAttribute,
                  BackGround_Attrib, MUIA_IconWindowExt_ImageBackFill_BGRenderMode)) == -1)
    BackGround_RenderMode = IconWindowExt_ImageBackFill_RenderMode_Tiled;

  this_bgtype    = (UBYTE *)BackGround_Base;
  this_ImageName = (char *)(BackGround_Base + 2);
  
  D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: BackFillInfo @ %x\n", this_BFI));
  D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Background '%s', mode %d\n", BackGround_Base, BackGround_RenderMode));

  if ((this_bgtype[0] - 48) != 5)
  {
    D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Background is NOT an image - letting our windoclass handle it ..\n"));
    
    goto pb_cleanup_buffer;
  }
  
  GET(self, MUIA_Window_Screen, &this_BFI->bfi_Screen);
  GET(_IconWindows_IconListObj, MUIA_IconList_BufferRastport, &this_BFI->bfi_RastPort);

  D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Wanderers Screen @ %x, Using RastPort @ %x\n", this_BFI->bfi_Screen, this_BFI->bfi_RastPort));
  
  if (this_BFI->bfi_Source)
  {
    D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: BackFillInfo has existing source record @ %x\n", this_BFI->bfi_Source));
    if ((strcmp(this_BFI->bfi_Source->bfsir_SourceImage, this_ImageName) == 0) && (this_BFI->bfi_Source->bfsir_BackGroundRenderMode == BackGround_RenderMode))
    {
      D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: existing BackFillInfo Using the same background / mode\n"));
      goto check_imagebuffer;
    }
    else
    {
      if (this_BFI->bfi_Buffer)
      {
        ImageBackFill_CloseSourceBuffer(this_BFI->bfi_Source, this_BFI->bfi_Buffer);
        this_BFI->bfi_Buffer = NULL;
      }
      ImageBackFill_CloseSourceRecord(this_BFI->bfi_Source);
      this_BFI->bfi_Source = NULL;
    }
  }

  if (!(this_BFI->bfi_Source)) this_BFI->bfi_Source = ImageBackFill_FindSourceRecord(this_ImageName, BackGround_RenderMode);

  if (!(this_BFI->bfi_Source))
  {
    D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Creating NEW ImageSource Record\n"));
    if (!(this_BFI->bfi_Source = AllocMem(sizeof(struct BackFillSourceImageRecord), MEMF_CLEAR|MEMF_PUBLIC)))
    {
      D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Couldnt allocate enough mem for source record!\n"));      
      return FALSE;
    }

    if (!(this_BFI->bfi_Source->bfsir_SourceImage = AllocVec(strlen(this_ImageName) +1, MEMF_CLEAR|MEMF_PUBLIC)))
    {
      D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Couldnt allocate enough mem for source image name store\n"));     
      FreeMem(this_BFI->bfi_Source, sizeof(struct BackFillSourceImageRecord));
      return FALSE;
    }
    strcpy(this_BFI->bfi_Source->bfsir_SourceImage, this_ImageName);
    
    if ((this_BFI->bfi_Source->bfsir_DTPictureObject = NewDTObject(this_BFI->bfi_Source->bfsir_SourceImage,
                          DTA_SourceType,         DTST_FILE,
                          DTA_GroupID,            GID_PICTURE,
                          PDTA_DestMode,          PMODE_V43,
                          PDTA_Remap,             TRUE,
                          PDTA_Screen,            this_BFI->bfi_Screen,
                          PDTA_FreeSourceBitMap,  TRUE,
                          OBP_Precision,          PRECISION_IMAGE,
                          TAG_DONE)))
    {
      D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Opened Datatype Object @ %x for image '%s'\n", this_BFI->bfi_Source->bfsir_DTPictureObject, this_BFI->bfi_Source->bfsir_SourceImage));
      if (DoMethod(this_BFI->bfi_Source->bfsir_DTPictureObject, DTM_PROCLAYOUT, NULL, 1))
      {
        D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Caused Datatype Object LAYOUT\n"));

        GetDTAttrs(this_BFI->bfi_Source->bfsir_DTPictureObject, PDTA_BitMapHeader, &this_BFI->bfi_Source->bfsir_DTBitMapHeader, TAG_DONE);
        GetDTAttrs(this_BFI->bfi_Source->bfsir_DTPictureObject, PDTA_DestBitMap, &this_BFI->bfi_Source->bfsir_DTBitMap, TAG_DONE);

        if (!this_BFI->bfi_Source->bfsir_DTBitMap)
          GetDTAttrs(this_BFI->bfi_Source->bfsir_DTPictureObject, PDTA_BitMap, &this_BFI->bfi_Source->bfsir_DTBitMap, TAG_DONE);
      
        if (this_BFI->bfi_Source->bfsir_DTBitMap)
        {
          D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Datatype Object BitMap @ %x\n", this_BFI->bfi_Source->bfsir_DTBitMap));

          if ((this_BFI->bfi_Source->bfsir_DTRastPort = CreateRastPort()))
          {
            this_BFI->bfi_Source->bfsir_DTRastPort->BitMap = this_BFI->bfi_Source->bfsir_DTBitMap;
            this_BFI->bfi_Source->bfsir_BackGroundRenderMode = BackGround_RenderMode;
            this_BFI->bfi_Source->bfsir_OpenerCount = 0x01;

            NewList(&this_BFI->bfi_Source->bfsir_Buffers);

            AddTail(&image_backfill_images, &this_BFI->bfi_Source->bfsir_Node);
            goto check_imagebuffer;
          }
        }
        /* Failed to obtain datatype object's BM */
      }
      /* Failed to Layout datatype object */
    }
    /* Failed to open datatype object */
#if defined(DEBUG)
    if (!this_BFI->bfi_Source->bfsir_DTRastPort)
    {
      D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Failed to create ImageSource RastPort\n"));
    }
#endif
    
    if (this_BFI->bfi_Source->bfsir_DTBitMap)
    {
      FreeBitMap(this_BFI->bfi_Source->bfsir_DTBitMap);
      this_BFI->bfi_Source->bfsir_DTBitMap = NULL;
    }
#if defined(DEBUG)
    else
    {
      D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Failed to create ImageSource BitMap\n"));
    }
#endif

    if (this_BFI->bfi_Source->bfsir_DTPictureObject)
    {
      DisposeDTObject(this_BFI->bfi_Source->bfsir_DTPictureObject);
      this_BFI->bfi_Source->bfsir_DTPictureObject = NULL;
    }
#if defined(DEBUG)
    else
    {
      D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Failed to create ImageSource Datatype Object\n"));
    }
#endif
    D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Failed to create ImageSource Record\n"));
    if (this_BFI->bfi_Source->bfsir_SourceImage) FreeVec(this_BFI->bfi_Source->bfsir_SourceImage);
    FreeMem(this_BFI->bfi_Source, sizeof(struct BackFillSourceImageRecord));
    this_BFI->bfi_Source = NULL;
    return FALSE;
  }
  else
  {
    D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Using existing ImageSource Record\n"));
    this_BFI->bfi_Source->bfsir_OpenerCount += 1;
  }

check_imagebuffer:

  Depth = GetBitMapAttr(this_BFI->bfi_Source->bfsir_DTBitMap, BMA_DEPTH);
  this_BFI->bfi_CopyWidth = this_BFI->bfi_Source->bfsir_DTBitMapHeader->bmh_Width;
  this_BFI->bfi_CopyHeight = this_BFI->bfi_Source->bfsir_DTBitMapHeader->bmh_Height;

  switch (BackGround_RenderMode)
  {
    case IconWindowExt_ImageBackFill_RenderMode_Scale:
    {
      D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED mode\n"));

      this_BFI->bfi_Options.bfo_TileMode = IconWindowExt_ImageBackFill_TileMode_Fixed;
      
      SET(_IconWindows_IconListObj, MUIA_IconListview_FixedBackground, TRUE);
      SET(_IconWindows_IconListObj, MUIA_IconListview_ScaledBackground, TRUE);

      if ((BOOL)XGET(self, MUIA_IconWindow_IsRoot))
      {
        struct BackFillSourceImageBuffer *this_Buffer;
        D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - Root Window = TRUE!\n"));
        this_BFI->bfi_CopyWidth = GetBitMapAttr(this_BFI->bfi_Screen->RastPort.BitMap, BMA_WIDTH);
        this_BFI->bfi_CopyHeight = GetBitMapAttr(this_BFI->bfi_Screen->RastPort.BitMap, BMA_HEIGHT);

        D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - Base Dimensions (%d x %d)\n", this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight));

        if (!((BOOL)XGET(self, MUIA_IconWindow_IsBackdrop)))
        {
          D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - Adjusting for window border Dimensions ..\n"));
          D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED -      WBorTop %d, WBorLeft %d, WBorRight %d, WBorBottom %d\n", this_BFI->bfi_Screen->WBorTop, this_BFI->bfi_Screen->WBorLeft, this_BFI->bfi_Screen->WBorRight, this_BFI->bfi_Screen->WBorBottom));
          this_BFI->bfi_CopyWidth -= (this_BFI->bfi_Screen->WBorLeft + this_BFI->bfi_Screen->WBorRight);
          this_BFI->bfi_CopyHeight -= (this_BFI->bfi_Screen->WBorTop + this_BFI->bfi_Screen->WBorBottom);;
        }

        this_BFI->bfi_CopyHeight -= (this_BFI->bfi_Screen->BarHeight + 1);

        this_Buffer = NULL;

        if (this_BFI->bfi_Buffer)
        {
          if ((this_BFI->bfi_Buffer->bfsib_BitMapWidth == this_BFI->bfi_CopyWidth) && (this_BFI->bfi_Buffer->bfsib_BitMapHeight == this_BFI->bfi_CopyHeight))
          {
            goto pb_backfillsetup_complete;
          }
          else
          {
            ImageBackFill_CloseSourceBuffer(this_BFI->bfi_Source, this_BFI->bfi_Buffer);
            this_BFI->bfi_Buffer = NULL;
          }
        }
        
        if (!(this_Buffer = ImageBackFill_FindBufferRecord(this_BFI->bfi_Source, this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight)))
        {
          this_Buffer = AllocMem(sizeof(struct BackFillSourceImageBuffer), MEMF_CLEAR|MEMF_PUBLIC);
          this_Buffer->bfsib_BitMapWidth = this_BFI->bfi_CopyWidth;
          this_Buffer->bfsib_BitMapHeight = this_BFI->bfi_CopyHeight;

          if (!(this_Buffer->bfsib_BitMapRastPort = CreateRastPort()))
          {
            D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - Failed to create RastPort for BackFill BitMap\n"));
            break;
          }

          if ((this_Buffer->bfsib_BitMap = AllocBitMap(this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight, Depth, Depth == 8 ? BMF_MINPLANES : 0L, this_BFI->bfi_Screen->RastPort.BitMap)))
          {
            struct Rectangle CopyBounds;

            D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - Scale Dimensions (%d x %d)\n", this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight));

            
            this_Buffer->bfsib_BitMapRastPort->BitMap = this_Buffer->bfsib_BitMap;
            this_BFI->bfi_Buffer = this_Buffer;
            
            CopyBounds.MinX = 0;
            CopyBounds.MinY = 0;
            CopyBounds.MaxX = this_BFI->bfi_CopyWidth - 1;
            CopyBounds.MaxY = this_BFI->bfi_CopyHeight - 1;

            
            ImageBackFill_CopyScaledBitMap(this_BFI->bfi_Source->bfsir_DTRastPort,
                    0, 0, 
                    this_BFI->bfi_Source->bfsir_DTBitMapHeader->bmh_Width,
                    this_BFI->bfi_Source->bfsir_DTBitMapHeader->bmh_Height,
                    this_Buffer->bfsib_BitMapRastPort,
                    &CopyBounds, &CopyBounds, blit_MODE_Blit);

            this_Buffer->bfsib_OpenerCount = 0x01;

            AddTail(&this_BFI->bfi_Source->bfsir_Buffers, &this_Buffer->bfsib_Node);
            
            goto pb_backfillsetup_complete;
          }
          break;
        }
        else
        {
          this_BFI->bfi_Buffer = this_Buffer;
          this_Buffer->bfsib_OpenerCount += 1;
          goto pb_backfillsetup_complete;
        }
      }
      // We arent the "ROOT" (desktop) window so only tile ...
      D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - Drawer window scaling unsupported ...\n"));
    }
    default:
    {
      struct BackFillSourceImageBuffer *this_Buffer;
      D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: TILED mode\n"));
      if ((BackGround_TileMode = DoMethod(_IconWindows_PrefsObj, MUIM_WandererPrefs_ViewSettings_GetAttribute,
                                BackGround_Attrib, MUIA_IconWindowExt_ImageBackFill_BGTileMode)) == -1)
        BackGround_TileMode = IconWindowExt_ImageBackFill_TileMode_Float;

      if ((BackGround_XOffset = DoMethod(_IconWindows_PrefsObj, MUIM_WandererPrefs_ViewSettings_GetAttribute,
                                BackGround_Attrib, MUIA_IconWindowExt_ImageBackFill_BGXOffset)) == -1)
        BackGround_XOffset = 0;

      if ((BackGround_YOffset = DoMethod(_IconWindows_PrefsObj, MUIM_WandererPrefs_ViewSettings_GetAttribute,
                                BackGround_Attrib, MUIA_IconWindowExt_ImageBackFill_BGYOffset)) == -1)
        this_BFI->bfi_Options.bfo_OffsetY = 0;

      if (this_BFI->bfi_Options.bfo_TileMode != BackGround_TileMode)
      {
        this_BFI->bfi_Options.bfo_TileMode = BackGround_TileMode;
        options_changed = TRUE;
      }

      if (this_BFI->bfi_Options.bfo_OffsetX != BackGround_XOffset)
      {
        this_BFI->bfi_Options.bfo_OffsetX = BackGround_XOffset;
        options_changed = TRUE;
      }
      
      if (this_BFI->bfi_Options.bfo_OffsetY != BackGround_YOffset)
      {
        this_BFI->bfi_Options.bfo_OffsetY = BackGround_YOffset;
        options_changed = TRUE;
      }

      if (this_BFI->bfi_Options.bfo_TileMode == IconWindowExt_ImageBackFill_TileMode_Float)
        SET(_IconWindows_IconListObj, MUIA_IconListview_FixedBackground, FALSE);
      else
        SET(_IconWindows_IconListObj, MUIA_IconListview_FixedBackground, TRUE);

      SET(_IconWindows_IconListObj, MUIA_IconListview_ScaledBackground, FALSE);

      this_Buffer = NULL;

      if (this_BFI->bfi_Buffer)
      {
        if ((this_BFI->bfi_Buffer->bfsib_BitMapWidth == this_BFI->bfi_CopyWidth) && (this_BFI->bfi_Buffer->bfsib_BitMapHeight == this_BFI->bfi_CopyHeight))
        {
          goto pb_backfillsetup_complete;
        }
        else
        {
          ImageBackFill_CloseSourceBuffer(this_BFI->bfi_Source, this_BFI->bfi_Buffer);
          this_BFI->bfi_Buffer = NULL;
        }
      }

      D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Dimensions Width %d, Height %d\n", this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight));
      
      if (!(this_Buffer = ImageBackFill_FindBufferRecord(this_BFI->bfi_Source, this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight)))
      {
        this_Buffer = AllocMem(sizeof(struct BackFillSourceImageBuffer), MEMF_CLEAR|MEMF_PUBLIC);
        this_Buffer->bfsib_BitMapWidth = this_BFI->bfi_CopyWidth;
        this_Buffer->bfsib_BitMapHeight = this_BFI->bfi_CopyHeight;

        if ((this_Buffer->bfsib_BitMap = AllocBitMap(this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight, Depth, Depth == 8 ? BMF_MINPLANES : 0L, this_BFI->bfi_Screen->RastPort.BitMap)))
        {
          struct Rectangle CopyBounds;

          if (!(this_Buffer->bfsib_BitMapRastPort = CreateRastPort()))
          {
            D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: TILED - Failed to create RastPort for BackFill BitMap\n"));
            break;
          }

          this_Buffer->bfsib_BitMapRastPort->BitMap = this_Buffer->bfsib_BitMap;
          this_BFI->bfi_Buffer = this_Buffer;
          
          CopyBounds.MinX = 0;
          CopyBounds.MinY = 0;
          CopyBounds.MaxX = this_BFI->bfi_CopyWidth - 1;
          CopyBounds.MaxY = this_BFI->bfi_CopyHeight - 1;

          ImageBackFill_CopyTiledBitMap(this_BFI->bfi_Source->bfsir_DTRastPort,
                  0, 0, 
                  this_BFI->bfi_Source->bfsir_DTBitMapHeader->bmh_Width,
                  this_BFI->bfi_Source->bfsir_DTBitMapHeader->bmh_Height,
                  this_BFI->bfi_Buffer->bfsib_BitMapRastPort,
                  &CopyBounds, &CopyBounds, blit_MODE_Blit);

          this_Buffer->bfsib_OpenerCount = 0x01;
          
          AddTail(&this_BFI->bfi_Source->bfsir_Buffers, &this_BFI->bfi_Buffer->bfsib_Node);

          goto pb_backfillsetup_complete;
        }
        break;
      }
      else
      {
        this_BFI->bfi_Buffer = this_Buffer;
        this_Buffer->bfsib_OpenerCount += 1;
        goto pb_backfillsetup_complete;
      }
    }
  }

  D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Failed to create image datatype object\n"));  
  return FALSE;
  
pb_cleanup_buffer:
  if (this_BFI->bfi_Buffer)
  {
    ImageBackFill_CloseSourceBuffer(this_BFI->bfi_Source, this_BFI->bfi_Buffer);
    this_BFI->bfi_Buffer = NULL;
  }

pb_cleanup_source:
  if (this_BFI->bfi_Source)
  { 
    ImageBackFill_CloseSourceRecord(this_BFI->bfi_Source);
    this_BFI->bfi_Source = NULL;
  }
  
  return FALSE;
  
pb_backfillsetup_complete:
  if ((prefs_processing) && (options_changed))
    SET(self, MUIA_IconWindow_Changed, TRUE);

  return TRUE;
}