Exemplo n.º 1
0
/*****************************************************************************

    NAME */
	LONG rtChangeReqAttr (

/*  SYNOPSIS */
	APTR req,
	Tag tag1, 
	...)

/*  FUNCTION

    INPUTS

    RESULT

    NOTES

    EXAMPLE

    BUGS

    SEE ALSO

    INTERNALS

    HISTORY

*****************************************************************************/
{
    AROS_SLOWSTACKTAGS_PRE(tag1)

    retval = rtChangeReqAttrA(req, AROS_SLOWSTACKTAGS_ARG(tag1));

    AROS_SLOWSTACKTAGS_POST
    
} /* rtChangeReqAttr */
Exemplo n.º 2
0
VOID __stdargs
__main( char *argstring )
{
    static struct Args     args;
    LONG    rev;

    /* Get arguments if started from CLI */
    if( !_WBenchMsg )
    {
        if( !( RDArgs = ReadArgs( TEMPLATE, ( IPTR * ) &args, NULL ) ) )
        {
            PrintFault( IoErr(), GetString( MSG_ERROR_ARGS ) );
            __exit( 0 );
        }
    }

    IntuiHook.h_Entry = ( HOOKFUNC ) IntuiMsgFunc;

//    DefaultPrefs.Flags = 0;
    DefaultPrefs.ReqDefaults[ RTPREF_OTHERREQ      ].ReqPos = REQPOS_POINTER;
    DefaultPrefs.ReqDefaults[ RTPREF_FILEREQ       ].Size = 75;
    DefaultPrefs.ReqDefaults[ RTPREF_FONTREQ       ].Size =
    DefaultPrefs.ReqDefaults[ RTPREF_SCREENMODEREQ ].Size =
    DefaultPrefs.ReqDefaults[ RTPREF_VOLUMEREQ     ].Size = 65;
    DefaultPrefs.ReqDefaults[ RTPREF_FILEREQ       ].ReqPos =
    DefaultPrefs.ReqDefaults[ RTPREF_FONTREQ       ].ReqPos =
    DefaultPrefs.ReqDefaults[ RTPREF_SCREENMODEREQ ].ReqPos =
    DefaultPrefs.ReqDefaults[ RTPREF_VOLUMEREQ     ].ReqPos =
    DefaultPrefs.ReqDefaults[ RTPREF_PALETTEREQ    ].ReqPos = REQPOS_TOPLEFTSCR;
    DefaultPrefs.ReqDefaults[ RTPREF_FILEREQ       ].LeftOffset =
    DefaultPrefs.ReqDefaults[ RTPREF_FONTREQ       ].LeftOffset =
    DefaultPrefs.ReqDefaults[ RTPREF_SCREENMODEREQ ].LeftOffset =
    DefaultPrefs.ReqDefaults[ RTPREF_VOLUMEREQ     ].LeftOffset =
    DefaultPrefs.ReqDefaults[ RTPREF_PALETTEREQ    ].LeftOffset =
    DefaultPrefs.ReqDefaults[ RTPREF_OTHERREQ      ].LeftOffset = 25;
    DefaultPrefs.ReqDefaults[ RTPREF_FILEREQ       ].TopOffset =
    DefaultPrefs.ReqDefaults[ RTPREF_FONTREQ       ].TopOffset =
    DefaultPrefs.ReqDefaults[ RTPREF_SCREENMODEREQ ].TopOffset =
    DefaultPrefs.ReqDefaults[ RTPREF_VOLUMEREQ     ].TopOffset =
    DefaultPrefs.ReqDefaults[ RTPREF_PALETTEREQ    ].TopOffset =
    DefaultPrefs.ReqDefaults[ RTPREF_OTHERREQ      ].TopOffset = 18;
    DefaultPrefs.ReqDefaults[ RTPREF_FILEREQ       ].MinEntries = 10;
    DefaultPrefs.ReqDefaults[ RTPREF_FONTREQ       ].MinEntries =
    DefaultPrefs.ReqDefaults[ RTPREF_SCREENMODEREQ ].MinEntries =
    DefaultPrefs.ReqDefaults[ RTPREF_VOLUMEREQ     ].MinEntries = 6;
    DefaultPrefs.ReqDefaults[ RTPREF_FILEREQ       ].MaxEntries = 50;
    DefaultPrefs.ReqDefaults[ RTPREF_FONTREQ       ].MaxEntries =
    DefaultPrefs.ReqDefaults[ RTPREF_SCREENMODEREQ ].MaxEntries =
    DefaultPrefs.ReqDefaults[ RTPREF_VOLUMEREQ     ].MaxEntries = 10;

    if( !( IntuitionBase = ( struct IntuitionBase * ) OpenLibrary( "intuition.library", 37 ) ) )
    {
        BPTR    con;

        if( ( con = Open( "CON:40/20/320/40/ReqTools 2.8", MODE_NEWFILE ) ) )
        {
            Write( con, "\nNeed OS 2.04 or better!\n", 25 );
            Delay( 120L );
            Close( con );
        }

        FreeExit( 0 );
    }

    InitLocale();
    GfxBase      = OpenLib( "graphics.library", 37 );
    UtilityBase  = OpenLib( "utility.library", 36 );
    IconBase     = OpenLib( "icon.library", 0 );
    GadToolsBase = OpenLib( "gadtools.library", 37 );
    ReqToolsBase = OpenLib( "reqtools.library", 38 );

    rev = ReqToolsBase->LibNode.lib_Revision;

    if( ( rev >= 693 && rev <= 811 ) || ( rev >= 347 && rev <= 363 ) )
    {
        LocEZReq( MSG_WRONG_REQTOOLS_VERSION, MSG_ABORT );
        FreeExit( RETURN_FAIL );
    }

    if( rtLockPrefs()->PrefsSize != PREFSLEN )
    {
        LocEZReq( MSG_ALL_PREFS_NOT_SUPPORTED, MSG_OK );
    }

    rtUnlockPrefs();

    if( _WBenchMsg )
    {
        struct WBArg    *wbarg;
        BPTR    oldcd;

        CreateIcons = TRUE;
        wbarg = &_WBenchMsg->sm_ArgList[ 0 ];
        oldcd = CurrentDir( wbarg->wa_Lock );

        if( ( DiskObject = GetDiskObject( wbarg->wa_Name ) ) )
        {
            STRPTR    str;

            if( ( str = FindToolType( (UBYTE **)DiskObject->do_ToolTypes, "CREATEICONS" ) ) )
            {
                CreateIcons = Stricmp( str, "NO" );
            }

            if( ( str = FindToolType( (UBYTE **)DiskObject->do_ToolTypes, "SCREENFONT" ) ) )
            {
                UseScreenFont = Stricmp( str, "NO" );
            }

            if( ( str = FindToolType( (UBYTE **)DiskObject->do_ToolTypes, "PUBSCREEN" ) ) )
            {
                args.PubScreen = str;
            }
        }

        CurrentDir( oldcd );
    }
    else
    {
        if( args.ScreenFont )
        {
            UseScreenFont = Stricmp( args.ScreenFont, "NO" );
        }
    }

    if( !( FileReq = rtAllocRequestA( RT_FILEREQ, NULL ) ) )
    {
        FreeExit( RETURN_FAIL );
    }

        {
        struct TagItem tags[] =
        {
            {RTFI_Dir    , (IPTR)"Presets"    },
            {TAG_DONE                }
        };
        
        rtChangeReqAttrA( FileReq, tags );
    }
    
    /* Get current prefs from ReqTools */
    CopyMem( rtLockPrefs(), &RTPrefs, sizeof( struct ReqToolsPrefs ) );
    rtUnlockPrefs();

    /* If FROM was used load prefs from disk */
    if( args.From )
    {
        if( !LoadConfig( args.From ) )
        {
            FreeExit( RETURN_ERROR );
        }
    }

    WheelType = GetWheelType( RTPrefs.Flags );

    if( !( Screen = LockPubScreen( args.PubScreen ) ) )
    {
        LocEZReq( MSG_COULDNT_LOCK_PUBSCREEN, MSG_ABORT );
        FreeExit( RETURN_ERROR );
    }

    if( !( DrawInfo = GetScreenDrawInfo( Screen ) ) )
    {
        LocEZReq( MSG_ERROR_GETSCREENDRAWINFO, MSG_ABORT );
        FreeExit( RETURN_ERROR );
    }

    if( !( VisualInfo = GetVisualInfoA( Screen, NULL ) ) )
    {
        LocEZReq( MSG_ERROR_GETVISUALINFO, MSG_ABORT );
        FreeExit( RETURN_FAIL );
    }

    if( IntuitionBase->LibNode.lib_Version >= 39 )
    {
        Zoom[ 0 ] = Zoom[ 1 ] = 65535;
    }
    else
    {
        Zoom[ 1 ] = Screen->BarHeight + 1;
    }

    Zoom[ 2 ] = 250;
    Zoom[ 3 ] = Screen->WBorTop + Screen->Font->ta_YSize + 1;
    LocalizeMenus( NewMenu );

    if( !( Menus = CreateMenusA( NewMenu, NULL ) ) )
    {
        LocEZReq( MSG_ERROR_MENUS, MSG_ABORT );
        FreeExit( RETURN_FAIL );
    }

    LayoutMenus( Menus, VisualInfo,
        GTMN_NewLookMenus,    TRUE,
    TAG_END );

    if( !OpenGUI() )
    {
        LocEZReq( MSG_COULDNT_OPEN_WINDOW, MSG_ABORT );
        FreeExit( RETURN_FAIL );
    }


    {
        struct MenuItem    *iconItem;

        iconItem = ItemAddress( Menus, FULLMENUNUM( OPTIONS_MENU, SAVEICONS_ITEM, NOSUB ) );

        if( !CreateIcons )
        {
            iconItem->Flags &= ~CHECKED;
        }
    }

    CurrentReq = RTPREF_FILEREQ;
    ReqDefs = &RTPrefs.ReqDefaults[ CurrentReq ];
    LoopGUI();
    FreeExit( 0 );
}