Exemplo n.º 1
0
void WREDisplayHint( int id )
{
    char        *buf;
    char        *mditext;
    WREHintItem *hint;

    if( id < WRE_MDI_FIRST ) {
        hint = WREGetHintItem ( id );
        if( hint ) {
            WRESetStatusByID( -1, hint->hint );
        }
    } else {
        mditext = WREAllocRCString( WRE_HINT_MDIMSG );
        if( mditext ) {
            buf = WREMemAlloc( strlen(mditext) + 20 + 1 );
            if( buf ) {
                sprintf( buf, mditext, WRE_MDI_FIRST + 1 - id );
                WRESetStatusText( NULL, buf, TRUE );
                WREMemFree( buf );
            }
            WREFreeRCString( mditext );
        }
    }

    return;
}
Exemplo n.º 2
0
static void DumpEmptyResource( WREAccelSession *session )
{
    WRECurrentResInfo   curr;

    if( session->lnode->Info.Length == 0 ) {
        curr.info = session->rinfo;
        curr.type = session->tnode;
        curr.res = session->rnode;
        curr.lang = session->lnode;
        WRERemoveEmptyResource( &curr );
        WRESetStatusByID( -1, WRE_EMPTYREMOVED );
    }
}
Exemplo n.º 3
0
bool WRESaveSymbols( WRHashTable *table, char **file_name, bool prompt )
{
    char                *name;
    WREGetFileStruct    gf;
    bool                ok;

    if( table == NULL || file_name == NULL ) {
        return( FALSE );
    }

    if( WRIsDefaultHashTable( table ) ) {
        return( TRUE );
    }

    ok = true;
    WRESetStatusText( NULL, "", FALSE );
    WRESetStatusByID( WRE_SAVEINGSYMBOLS, -1 );

    if( prompt || *file_name == NULL ) {
        gf.file_name = *file_name;
        gf.title = WRESymSaveTitle;
        gf.filter = WRESymSaveFilter;
        gf.save_ext = FALSE;
        name = WREGetSaveFileName( &gf );
        ok = (name != NULL);
        if( ok ) {
            if( *file_name != NULL ) {
                WRMemFree( *file_name );
            }
            *file_name = name;
        }
    } else {
        name = *file_name;
    }

    if( ok ) {
        ok = WRWriteSymbolsToFile( table, name );
    }

    if( ok ) {
        WRMakeHashTableClean( table );
    }

    WRESetStatusReadyText();

    return( ok );
}
Exemplo n.º 4
0
Bool WREHandleResEdit( void )
{
    WRECurrentResInfo  curr;
    Bool               ok;

    if( WREGetPendingService() != NoServicePending ) {
        WRESetStatusByID( 0, WRE_EDITSESSIONPENDING );
        return( TRUE );
    }

    ok = WREGetCurrentResource( &curr );

    // correct ok if this the 'All Strings' entry
    if( !ok ) {
        ok = (curr.info != NULL && curr.type != NULL &&
              curr.info->current_type == (uint_16)RT_STRING);
    }

    if( ok ) {
        ok = FALSE;
        if( curr.info->current_type == (uint_16)RT_ACCELERATOR ) {
            ok = WREEditAccelResource( &curr );
        } else if( curr.info->current_type == (uint_16)RT_MENU ) {
            ok = WREEditMenuResource( &curr );
        } else if( curr.info->current_type == (uint_16)RT_STRING ) {
            ok = WREEditStringResource( &curr );
        } else if( curr.info->current_type == (uint_16)RT_DIALOG ) {
            ok =  WREEditDialogResource( &curr );
        } else if( curr.info->current_type == (uint_16)RT_GROUP_CURSOR ) {
            ok =  WREEditImageResource( &curr );
        } else if( curr.info->current_type == (uint_16)RT_GROUP_ICON ) {
            ok =  WREEditImageResource( &curr );
        } else if( curr.info->current_type == (uint_16)RT_BITMAP ) {
            ok =  WREEditImageResource( &curr );
        }
    }

    return( ok );
}
Exemplo n.º 5
0
void WREHandlePopupHint( HMENU menu, HMENU popup )
{
    WREPopupListItem    *p;
    DWORD               hint;

    hint = -1;

    p = WREFindPopupListItem( menu );

    if( p ) {
        hint = WREGetPopupHint( p, popup );
        if( hint != -1 ) {
            WRESetStatusByID( -1, hint );
        }
    }

    if( hint == -1 ) {
        WRESetStatusText( NULL, "", TRUE );
    }

    return;
}
Exemplo n.º 6
0
static char *WRELoadSymbols( WRHashTable **table, char *file_name, bool prompt )
{
    char                *name;
    int                 c;
    unsigned            flags;
    char                *inc_path;
    WREGetFileStruct    gf;
    unsigned            pp_count;
    unsigned            busy_count;
    char                busy_str[2];
    bool                ret;
    bool                ok;

    name = NULL;

    ok = (table != NULL);

    if( ok ) {
        WRESetStatusText( NULL, "", FALSE );
        WRESetStatusByID( WRE_LOADINGSYMBOLS, -1 );
    }

    if( ok ) {
        if( file_name == NULL || prompt ) {
            gf.file_name = file_name;
            gf.title = WRESymLoadTitle;
            gf.filter = WRESymSaveFilter;
            gf.save_ext = FALSE;
            name = WREGetOpenFileName( &gf );
        } else {
            name = WREStrDup( file_name );
        }
        ok = (name != NULL);
    }

    WRESetWaitCursor( TRUE );

    if( ok ) {
        flags = PPFLAG_IGNORE_INCLUDE | PPFLAG_EMIT_LINE;
        inc_path = NULL;
        ret = setjmp( SymEnv );
        if( ret ) {
            PP_Fini();
            WREDisplayErrorMsg( WRE_SYMOUTOFMEM );
            ok = false;
        }
    }

    if( ok ) {
        ok = !PP_Init( name, flags, inc_path );
        if( !ok ) {
            WREDisplayErrorMsg( WRE_NOLOADHEADERFILE );
        }
    }

    if( ok ) {
        pp_count = 0;
        busy_count = 0;
        busy_str[1] = '\0';
        do {
            pp_count++;
            c = PP_Char();
            if( pp_count == MAX_PP_CHARS ) {
                busy_count++;
                busy_str[0] = WREBusyChars[busy_count % 4];
                WRESetStatusText( NULL, busy_str, TRUE );
                pp_count = 0;
            }
        } while( c != EOF );
        if( *table == NULL ) {
            *table = WRInitHashTable();
        }
        WREAddSymbols( *table );
        WRMakeHashTableClean( *table );
        PP_Fini();
        WRESetStatusText( NULL, " ", TRUE );
    }

    if( !ok ) {
        if( name != NULL ) {
            WRMemFree( name );
            name = NULL;
        }
    }

    WRESetWaitCursor( FALSE );

    WRESetStatusReadyText();

    return( name );
}
Exemplo n.º 7
0
bool WRESetStatusReadyText( void )
{
    WRESetStatusText( NULL, "", FALSE );
    return( WRESetStatusByID( WRE_READYMSG, 0 ) );
}