All pastes #714026 Raw Edit

Stuff

public text v1 · immutable
#714026 ·published 2007-09-25 21:38 UTC
rendered paste body
* create the file copy window */
BOOL CreateCopyDisplay(UWORD flags, struct MUIDisplayObjects *d) 
{
    BOOL    back = FALSE;
    
    Object  *group, *fromObject, *toObject, *fileTextObject, *fileLengthObject, *gaugeGroup;

    d->stopflag = 0; // will be set to 1 when clicking on stop, than the displayhook can tell actionDir() to stop copy 
    d->bytes = 0;
    d->numfiles = 0;
    d->action = flags;
    d->smallobjects = 0;
    d->copyApp = ApplicationObject,
        MUIA_Application_Title,     (IPTR)"CopyRequester",
        MUIA_Application_Base,      (IPTR)"WANDERER_COPY",
        SubWindow, (IPTR)(d->win = WindowObject,
            MUIA_Window_Title,          (IPTR)"Copy Filesystem",
            MUIA_Window_Activate,       TRUE,
            MUIA_Window_DepthGadget,    TRUE,
            MUIA_Window_DragBar,        TRUE,
            MUIA_Window_SizeGadget,     TRUE,
            MUIA_Window_AppWindow,      FALSE,
            MUIA_Window_CloseGadget,    FALSE,
            MUIA_Window_Borderless,     FALSE,
            MUIA_Window_TopEdge,        MUIV_Window_TopEdge_Centered,
            MUIA_Window_LeftEdge,       MUIV_Window_LeftEdge_Centered,
            MUIA_Window_Width,          MUIV_Window_Width_Visible(60),
            WindowContents, (group = VGroup,
                Child, (IPTR)(fromObject = TextObject,
                    InnerSpacing(8,2),
                    MUIA_Text_PreParse, (IPTR)"\33c",
                End),
                Child, (IPTR)(d->sourceObject = TextObject,
                    TextFrame,
                    InnerSpacing(8,2),
                    MUIA_Background,    MUII_TextBack,
                    MUIA_Text_PreParse, (IPTR)"\33c",
                    MUIA_Text_Contents, (IPTR)"---",
                End),
                Child, (IPTR)(toObject = TextObject,
                    InnerSpacing(8,2),
                    MUIA_Text_PreParse, (IPTR)"\33c",
                End),
                Child, (IPTR)(d->destObject = TextObject,
                    TextFrame,
                    InnerSpacing(8,2),
                    MUIA_Background,    MUII_TextBack,
                    MUIA_Text_PreParse, (IPTR)"\33c",
                    MUIA_Text_Contents, (IPTR)"---",
                End),
                Child, (IPTR)(fileTextObject = TextObject,
                    InnerSpacing(8,2),
                    MUIA_Text_PreParse, (IPTR)"\33c",
                End),
                Child, (IPTR)(d->fileObject = TextObject,
                    TextFrame,
                    InnerSpacing(8,2),
                    MUIA_Background,    MUII_TextBack,
                    MUIA_Text_PreParse, (IPTR)"\33c",
                    MUIA_Text_Contents, (IPTR)"---",
                End),
                Child, (IPTR)(fileLengthObject = TextObject,
                    InnerSpacing(8,2),
                    MUIA_Text_PreParse, (IPTR)"\33c",
                End),
                Child, (IPTR)(gaugeGroup = VGroup,
                    TextFrame,
                    Child, d->gauge = GaugeObject,
                        MUIA_Gauge_Horiz, TRUE,
                        MUIA_Gauge_Max, 32768,
                        MUIA_Gauge_InfoText, "Processing...",
                    End,
                    Child, ScaleObject,
                        MUIA_Scale_Horiz, TRUE,
                    End,
                End),
                Child, (IPTR)( d->performanceObject = TextObject,
                    TextFrame,
                    InnerSpacing(8,2),
                    MUIA_Background,     MUII_TextBack,
                    MUIA_Text_PreParse, (IPTR)"\33c",
                    MUIA_Text_Contents, (IPTR)"...........0 Bytes...........",
                End),

                Child, (IPTR)( d->stopObject = SimpleButton("Stop") ),
            End),
        End),
    End;


    if (d->copyApp) 
    {
        if ((flags & (ACTION_COPY|ACTION_DELETE)) == (ACTION_COPY|ACTION_DELETE)) 
        {
            SET(fromObject, MUIA_Text_Contents, (IPTR)"move from");
            SET(toObject, MUIA_Text_Contents, (IPTR)"move to");
            SET(fileTextObject, MUIA_Text_Contents, (IPTR)"file");
            SET(fileLengthObject, MUIA_Text_Contents, (IPTR)"traffic");
        } 
        else if ((flags & ACTION_COPY) == ACTION_COPY) 
        {
            SET(fromObject, MUIA_Text_Contents, (IPTR)"copy from");
            SET(toObject, MUIA_Text_Contents, (IPTR)"copy to");
            SET(fileTextObject, MUIA_Text_Contents, (IPTR)"file");
            SET(fileLengthObject, MUIA_Text_Contents, (IPTR)"traffic");

        } 
        else if ((flags & ACTION_DELETE) == ACTION_DELETE) 
        {
            SET(fromObject, MUIA_Text_Contents, "delete from");
            DoMethod(group, MUIM_Group_InitChange);
            DoMethod(group, OM_REMMEMBER, toObject);
            DoMethod(group, OM_REMMEMBER, fileLengthObject);
            DoMethod(group, OM_REMMEMBER, d->performanceObject);
            DoMethod(group, OM_REMMEMBER, d->destObject);
            DoMethod(group, OM_REMMEMBER, gaugeGroup);
            DoMethod(group, MUIM_Group_ExitChange);
            SET(fileTextObject, MUIA_Text_Contents, "file to delete");
        }

        SET(d->win,MUIA_Window_Open,TRUE);
        DoMethod(d->stopObject,MUIM_Notify, MUIA_Pressed, FALSE, d->stopObject, 3, MUIM_WriteLong, 1 ,&d->stopflag);
        back = TRUE;
    }
    return back;
}