Exemplo n.º 1
0
void WFreeAccelEInfo( WAccelEditInfo *einfo )
{
    if( einfo != NULL ) {
        if( einfo->tbl != NULL ) {
            WFreeAccelTable( einfo->tbl );
            einfo->tbl = NULL;
        }
        if( einfo->wsb != NULL ) {
            WDestroyStatusLine( einfo->wsb );
            einfo->wsb = NULL;
        }
        if( einfo->ribbon != NULL ) {
            WDestroyRibbon( einfo );
        }
        if( einfo->edit_dlg != (HWND)NULL && IsWindow( einfo->edit_dlg ) ) {
            DestroyWindow( einfo->edit_dlg );
            einfo->edit_dlg = (HWND)NULL;
        }
        if( einfo->win != (HWND)NULL && IsWindow( einfo->win ) ) {
            SET_WNDINFO( einfo->win, 0 );
            DestroyWindow( einfo->win );
            einfo->win = (HWND)NULL;
        }
        if( einfo->file_name != NULL ) {
            WRMemFree( einfo->file_name );
        }
        WRMemFree( einfo );
    }
}
Exemplo n.º 2
0
void WFreeAccelEInfo ( WAccelEditInfo *einfo )
{
    if ( einfo ) {
        if ( einfo->tbl ) {
            WFreeAccelTable ( einfo->tbl );
            einfo->tbl = NULL;
        }
        if ( einfo->wsb ) {
            WDestroyStatusLine ( einfo->wsb );
            einfo->wsb = NULL;
        }
        if ( einfo->ribbon ) {
            WDestroyRibbon ( einfo );
        }
        if ( ( einfo->edit_dlg != (HWND)NULL ) &&
             IsWindow ( einfo->edit_dlg ) ) {
            DestroyWindow ( einfo->edit_dlg );
            einfo->edit_dlg = (HWND)NULL;
        }
        if ( ( einfo->win != (HWND)NULL ) && IsWindow ( einfo->win ) ) {
            SetWindowLong( einfo->win, 0, (LONG)0 );
            DestroyWindow ( einfo->win );
            einfo->win = (HWND)NULL;
        }
        if ( einfo->file_name ) {
            WMemFree ( einfo->file_name );
        }
        WMemFree ( einfo );
    }
}
Exemplo n.º 3
0
WAccelTable *WMakeAccelTableFromInfo( WAccelInfo *info )
{
    WAccelTable *tbl;
    int          num, ok;

    tbl = NULL;

    ok = (info != NULL);

    if( ok ) {
        num = WCalcNumAccelEntries( info );
        tbl = WAllocAccelTable( num );
        ok = (tbl != NULL);
    }

    if( ok ) {
        tbl->is32bit = info->is32bit;
        if( num != 0 ) {
            WInitAccelTable( info, tbl );
        }
    }

    if( ok ) {
        info->data = NULL;
        info->data_size = 0;
    } else {
        if( tbl != NULL ) {
            WFreeAccelTable( tbl );
            tbl = NULL;
        }
    }

    return( tbl );
}
Exemplo n.º 4
0
WAccelTable *WAllocAccelTable ( int num )
{
    WAccelTable *tbl;
    WAccelEntry *entry;
    int          i;

    tbl = (WAccelTable *) WMemAlloc ( sizeof(WAccelTable) );

    if ( !tbl ) {
        return ( NULL );
    }

    tbl->num     = num;
    tbl->is32bit = FALSE;
    if ( num ) {
        entry = NULL;
        for ( i=0; i<num; i++ ) {
            if ( entry ) {
                entry->next = (WAccelEntry *) WMemAlloc(sizeof(WAccelEntry));
                if ( entry ) {
                    entry->next->symbol = NULL;
                    entry->next->prev = entry;
                    entry = entry->next;
                }
            } else {
                tbl->first_entry = (WAccelEntry *)
                    WMemAlloc ( sizeof(WAccelEntry) );
                tbl->first_entry->symbol = NULL;
                entry = tbl->first_entry;
                entry->prev = NULL;
            }
            if ( !entry ) {
                WFreeAccelTable ( tbl );
                tbl = NULL;
                break;
            }
        }
        if ( entry ) {
            entry->next = NULL;
        }
    } else {
        tbl->first_entry = NULL;
    }

    return ( tbl );
}
Exemplo n.º 5
0
WAccelTable *WAllocAccelTable( size_t num )
{
    WAccelTable *tbl;
    WAccelEntry *prev;
    WAccelEntry *entry;
    size_t      i;

    tbl = (WAccelTable *)WRMemAlloc( sizeof( WAccelTable ) );
    if( tbl == NULL ) {
        return( NULL );
    }

    tbl->num = num;
    tbl->is32bit = false;
    tbl->first_entry = NULL;
    if( num != 0 ) {
        prev = NULL;
        for( i = 0; i < num; i++ ) {
            entry = (WAccelEntry *)WRMemAlloc( sizeof( WAccelEntry ) );
            if( prev == NULL ) {
                tbl->first_entry = entry;
            } else {
                prev->next = entry;
            }
            if( entry == NULL ) {
                WFreeAccelTable( tbl );
                return( NULL );
            }
            entry->prev = prev;
            entry->symbol = NULL;
            prev = entry;
        }
        entry->next = NULL;
    }

    return( tbl );
}