Пример #1
0
void WdeDisplayControlInfo( WdeInfoStruct *is )
{
    char             *str;
    char             *cp;

    str = NULL;
    cp = WdeResNameOrOrdinalToStr( is->c.text, 10 );
    if( cp != NULL ) {
        str = WRConvertStringFrom( cp, "\t\n", "tn" );
        WRMemFree( cp );
    }

    if( str != NULL ) {
        WdeSetEditWithStr( str, WdeInfoWindow, IDB_INFO_CAPTION );
        WRMemFree( str );
    } else {
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_CAPTION );
    }

    if( is->symbol ) {
        WdeSetComboWithStr( is->symbol, WdeInfoWindow, IDB_INFO_IDSTR );
    } else {
        WdeSetEditWithSINT16( (int_16)is->c.id, 10, WdeInfoWindow, IDB_INFO_IDSTR );
    }

    WdeSetEditWithSINT16( (int_16)is->c.id, 10, WdeInfoWindow, IDB_INFO_IDNUM );
}
Пример #2
0
BOOL WdeFreeCustLib( WdeCustLib *lib )
{
    if( lib != NULL ) {
        if( lib->controls != NULL ) {
            WdeFreeCustLibControls( &lib->controls );
        }
        if( lib->file_name != NULL ) {
            WRMemFree( lib->file_name );
        }
        if( lib->info_name != NULL && HIWORD( (uint_32)lib->info_name ) ) {
            WRMemFree( lib->info_name );
        }
        if( lib->style_name != NULL && HIWORD( (uint_32)lib->style_name ) ) {
            WRMemFree( lib->style_name );
        }
        if( lib->flags_name != NULL && HIWORD( (uint_32)lib->flags_name ) ) {
            WRMemFree( lib->flags_name );
        }
        if( lib->inst != NULL ) {
            FreeLibrary( lib->inst );
        }
        if( !lib->ms_lib && lib->class_list != NULL ) {
            GlobalFree( lib->class_list );
        }
        WRMemFree( lib );
    } else {
        WdeWriteTrail( "WdeFreeCustLib: NULL lib!" );
        return( FALSE );
    }

    return( TRUE );
}
Пример #3
0
bool WFreeAccelTableEntry( WAccelTable *tbl, WAccelEntry *entry )
{
    bool ok;

    ok = (tbl != NULL && entry != NULL);

    if( ok ) {
        if( entry->next != NULL ) {
            entry->next->prev = entry->prev;
        }
        if( entry->prev != NULL ) {
            entry->prev->next = entry->next;
        }
        if( tbl->first_entry == entry ) {
            tbl->first_entry = entry->next;
        }
        if( entry->symbol != NULL ) {
            WRMemFree( entry->symbol );
        }
        WRMemFree( entry );
        tbl->num--;
    }

    return( ok );
}
Пример #4
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 );
    }
}
Пример #5
0
int WRLoadBitmapFile( WRInfo *info )
{
    int                 ok;
    int                 file_handle;
    long int            file_length;
    char                fn[_MAX_FNAME];
    WResID              *type;
    WResID              *name;
    WResLangType        def_lang;

    file_handle         = -1;
    def_lang.sublang    = DEF_LANG;
    def_lang.lang       = DEF_SUBLANG;

    ok = ( info != NULL );

    if( ok ) {
        ok = ( ( file_handle = ResOpenFileRO( info->file_name ) ) != -1 );
    }

    if( ok ) {
        file_length = filelength( file_handle );
        ok = ( ( file_length != 0 ) && ( file_length != -1 ) );
    }

    if( ok ) {
        type = WResIDFromNum( (long)RT_BITMAP );
        ok = ( type != NULL );
    }

    if( ok ) {
        _splitpath( info->file_name, NULL, NULL, fn, NULL );
        name = WResIDFromStr( fn );
        ok = ( name != NULL );
    }

    if( ok ) {
        ok = ( ( info->dir = WResInitDir() ) != NULL );
    }

    if( ok ) {
        ok = !WResAddResource( type, name, 0, sizeof(BITMAPFILEHEADER),
                               file_length - sizeof(BITMAPFILEHEADER),
                               info->dir, &def_lang, NULL );
    }

    if( file_handle != -1 ) {
        ResCloseFile( file_handle );
    }

    if( name ) {
        WRMemFree( name );
    }

    if( type ) {
        WRMemFree( type );
    }

    return( ok );
}
Пример #6
0
static void WdeGetOptInfo( HWND hDlg )
{
    if( IsDlgButtonChecked( hDlg, IDB_OPT_WRES ) ) {
        WdeCurrentState.is_wres_fmt = TRUE;
    } else {
        WdeCurrentState.is_wres_fmt = FALSE;
    }

#if 0
    if( IsDlgButtonChecked( hDlg, IDB_OPT_DEFDEF ) ) {
        WdeCurrentState.use_def_dlg = TRUE;
    } else {
        WdeCurrentState.use_def_dlg = FALSE;
    }
#endif

    WdeCurrentState.grid_x = (int)WdeGetSINT32FromEdit( hDlg, IDB_OPT_HINC, NULL );
    WdeCurrentState.grid_y = (int)WdeGetSINT32FromEdit( hDlg, IDB_OPT_VINC, NULL );
    WdeCurrentState.ignore_inc = IsDlgButtonChecked( hDlg, IDB_OPT_IGNOREINC );

    if( WdeCurrentState.inc_path != NULL ) {
        WRMemFree( WdeCurrentState.inc_path );
    }

    WdeCurrentState.inc_path = WdeGetStrFromEdit( hDlg, IDB_OPT_INCPATH, NULL );

    if( WdeCurrentState.inc_path != NULL ) {
        if( WdeIsStrSpace( WdeCurrentState.inc_path ) ) {
            WRMemFree( WdeCurrentState.inc_path );
            WdeCurrentState.inc_path = NULL;
        }
    }
}
Пример #7
0
void WFreeMenuEInfo( WMenuEditInfo *einfo )
{
    if( einfo != NULL ) {
        if( einfo->menu != NULL ) {
            WFreeMenu( einfo->menu );
            einfo->menu = NULL;
        }
        if( einfo->wsb != NULL ) {
            WDestroyStatusLine( einfo->wsb );
            einfo->wsb = NULL;
        }
        if( einfo->ribbon != NULL ) {
            WDestroyRibbon( einfo );
        }
        if( einfo->preview_window != (HWND)NULL && IsWindow( einfo->preview_window ) ) {
            DestroyWindow( einfo->preview_window );
            einfo->preview_window = (HWND)NULL;
        }
        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 != NULL ) {
            WRMemFree( einfo->file_name );
        }
        WRMemFree( einfo );
    }
}
Пример #8
0
void WR_EXPORT WRFreeWRInfo( WRInfo *info )
{
    if( info != NULL ) {
        if( info->file_name != NULL ) {
            WRMemFree( info->file_name );
        }
        if( info->save_name != NULL ) {
            WRMemFree( info->save_name );
        }
        if( info->internal_filename != NULL ) {
            WRMemFree( info->internal_filename );
        }
        if( info->tmp_file != NULL ) {
            if( WRFileExists( info->tmp_file ) ) {
                WRDeleteFile( info->tmp_file );
            }
            WRMemFree( info->tmp_file );
        }
        if( info->dir != NULL ) {
            WRFreeWResDirData( info->dir );
            WResFreeDir( info->dir );
        }
        WRMemFree( info );
    }
}
Пример #9
0
bool WREGetAndAddIconImage( BYTE *data, WResDir dir, ICONDIRENTRY *id, int ord )
{
    BYTE                *icon;
    int                 dup;
    WResID              *tname;
    WResID              *rname;
    WResLangType        lang;
    bool                ok;

    dup = FALSE;
    lang.lang = DEF_LANG;
    lang.sublang = DEF_SUBLANG;
    tname = NULL;
    rname = NULL;

    ok = (data != NULL && dir != NULL && id != NULL && id->dwBytesInRes != 0);

    if( ok ) {
        icon = (BYTE *)WRMemAlloc( id->dwBytesInRes );
        ok = (icon != NULL);
    }

    if( ok ) {
        memcpy( icon, data + id->dwImageOffset, id->dwBytesInRes );
        tname = WResIDFromNum( (uint_16)RT_ICON );
        ok = (tname != NULL);
    }

    if( ok ) {
        rname = WResIDFromNum( ord );
        ok = (rname != NULL);
    }

    if ( ok ) {
        ok = !WResAddResource( tname, rname, DEF_MEMFLAGS, 0,
                               id->dwBytesInRes, dir, &lang, &dup );
    }

    if( ok ) {
        ok = WRFindAndSetData( dir, tname, rname, &lang, icon );
    }

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

    if( tname != NULL ) {
        WRMemFree( tname );
    }

    if( rname != NULL ) {
        WRMemFree( rname );
    }

    return( ok );
}
Пример #10
0
void WdeFreeToolBarInfo( WdeToolBarInfo *info )
{
    if( info != NULL ) {
        if( info->items != NULL ) {
            WRMemFree( info->items );
        }
        if( info->dinfo.background != NULL ) {
            DeleteObject( info->dinfo.background );
        }
        WRMemFree( info );
    }
}
Пример #11
0
void WOptsShutdown( void )
{
    if( WCurrentState.last_dir != NULL ) {
        WRMemFree( WCurrentState.last_dir );
    }
    WCurrentState.last_dir = WStrDup( WGetInitialDir() );
    WCurrentState.last_filter = WGetFileFilter();
    WWriteOpts( &WCurrentState );
    if( WCurrentState.last_dir != NULL ) {
        WRMemFree( WCurrentState.last_dir );
    }
}
Пример #12
0
void WFreeAccelTableEntries( WAccelEntry *entry )
{
    WAccelEntry *next;

    for( ; entry != NULL; entry = next ) {
        next = entry->next;
        if( entry->symbol != NULL ) {
            WRMemFree( entry->symbol );
        }
        WRMemFree( entry );
    }
}
Пример #13
0
void WdeInfoLookupComboEntry( HWND hWnd, WORD hw )
{
    char                *cp;
    char                *str;
    WdeHashValue        value;
    bool                found;
    LRESULT             index;
    int                 count;

    if( WdeCurrentInfo.res_info->hash_table == NULL ) {
        return;
    }

    count = SendDlgItemMessage( hWnd, IDB_INFO_IDSTR, CB_GETCOUNT, 0, 0 );
    if( count == 0 || count == CB_ERR ) {
        return;
    }

    str = NULL;
    if( hw == CBN_EDITCHANGE ) {
        str = WdeGetStrFromCombo( hWnd, IDB_INFO_IDSTR );
    } else {
        index = SendDlgItemMessage( hWnd, IDB_INFO_IDSTR, CB_GETCURSEL, 0, 0 );
        if( index != CB_ERR ) {
            str = WdeGetStrFromComboLBox( hWnd, IDB_INFO_IDSTR, index );
        }
    }

    if( str == NULL ) {
        return;
    }

    WRStripSymbol( str );

    // if the string numeric or empty then return
    strtoul( str, &cp, 0 );
    if( *cp == '\0' ) {
        WRMemFree( str );
        return;
    }

    if( _mbclen( (unsigned char *)str ) == 1 && str[0] == '"' ) {
        value = WdeLookupName( WdeCurrentInfo.res_info->hash_table, str, &found );
        if( found ) {
            WdeSetEditWithSINT32( (int_32)value, 10, hWnd, IDB_INFO_IDNUM );
        }
    }

    WRMemFree( str );
}
Пример #14
0
bool WREFindAndLoadSymbols( WREResInfo *rinfo )
{
    char        inc_path[_MAX_PATH];
    char        fn_path[_MAX_PATH];
    char        fn_drive[_MAX_DRIVE];
    char        fn_dir[_MAX_DIR];
    char        fn_name[_MAX_FNAME];
    char        *symbol_file;
    bool        prompt;
    bool        ret;

    if( rinfo == NULL || rinfo->info == NULL ||
        (rinfo->info->file_name == NULL && rinfo->info->save_name == NULL) ) {
        return( FALSE );
    }

    symbol_file = WREFindDLGInclude( rinfo->info );
    if( symbol_file == NULL ) {
        if( rinfo->info->file_name ) {
            _splitpath( rinfo->info->file_name, fn_drive, fn_dir, fn_name, NULL );
        } else {
            _splitpath( rinfo->info->save_name, fn_drive, fn_dir, fn_name, NULL );
        }
        _makepath( fn_path, fn_drive, fn_dir, fn_name, "h" );
        _makepath( inc_path, fn_drive, fn_dir, "", "" );
        WRESetInitialDir( inc_path );
        prompt = TRUE;
    } else {
        strcpy( fn_path, symbol_file );
        WRMemFree( symbol_file );
        symbol_file = NULL;
        prompt = FALSE;
    }

    ret = TRUE;

    if( WRFileExists( fn_path ) ) {
        symbol_file = WRELoadSymbols( &rinfo->symbol_table, fn_path, prompt );
        ret = (symbol_file != NULL);
        if( ret ) {
            if( rinfo->symbol_file != NULL ) {
                WRMemFree( rinfo->symbol_file );
            }
            rinfo->symbol_file = symbol_file;
        }
    }

    return( ret );
}
Пример #15
0
void WRESEAPI WMenuFreeMenuInfo( WMenuInfo *info )
{
    if( info != NULL ) {
        if( info->res_name != NULL ) {
            WRMemFree( info->res_name );
        }
        if( info->file_name != NULL ) {
            WRMemFree( info->file_name );
        }
        if( info->data != NULL ) {
            WRMemFree( info->data );
        }
        WRMemFree( info );
    }
}
Пример #16
0
void WdeDisplayDialogInfo( WdeInfoStruct *is )
{
    char          *str;
    WResID        *name;

    str = WRConvertStringFrom( is->d.caption, "\t\n", "tn" );
    if( str == NULL ) {
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_CAPTION );
    } else {
        WdeSetEditWithStr( str, WdeInfoWindow, IDB_INFO_CAPTION );
        WRMemFree( str );
    }

    name = is->d.name;
    if( name->IsName ) {
        char    *str1, *str2;
        int     len;
        bool    ok;

        ok = false;
        str1 = WResIDToStr( name );
        if( str1 != NULL ) {
            len = strlen( str1 ) + 3;
            str2 = WRMemAlloc( len );
            if( str2 != NULL ) {
                str2[0] = '"';
                strcpy( &str2[1], str1 );
                str2[len - 2] = '"';
                str2[len - 1] = '\0';
                WdeSetComboWithStr( str2, WdeInfoWindow, IDB_INFO_IDSTR );
                WRMemFree( str2 );
                ok = true;
            }
            WRMemFree( str1 );
        }
        if( !ok ) {
            WdeSetComboWithStr( "", WdeInfoWindow, IDB_INFO_IDSTR );
        }
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_IDNUM );
    } else {
        if( is->symbol != NULL ) {
            WdeSetComboWithStr( is->symbol, WdeInfoWindow, IDB_INFO_IDSTR );
        } else {
            WdeSetEditWithSINT16( (int_16)name->ID.Num, 10, WdeInfoWindow, IDB_INFO_IDSTR );
        }
        WdeSetEditWithSINT16( (int_16)name->ID.Num, 10, WdeInfoWindow, IDB_INFO_IDNUM );
    }
}
Пример #17
0
WResResNode *WRRenameWResResNode( WResTypeNode *type_node,
                                  WResResNode *res_node, char *name )
{
    WResResNode *new_res_node;
    int         len;

    len = strlen( name );
    new_res_node = (WResResNode *)WRMemAlloc( sizeof( WResResNode ) + max( 0, len - 1 ) );
    if( new_res_node == NULL ) {
        return( NULL );
    }
    if( type_node->Head == res_node ) {
        type_node->Head = new_res_node;
    }
    if( type_node->Tail == res_node ) {
        type_node->Tail = new_res_node;
    }
    new_res_node->Head = res_node->Head;
    new_res_node->Tail = res_node->Tail;
    new_res_node->Next = res_node->Next;
    new_res_node->Prev = res_node->Prev;
    new_res_node->Info.ResName.IsName = TRUE;
    new_res_node->Info.ResName.ID.Name.NumChars = len;
    memcpy( new_res_node->Info.ResName.ID.Name.Name, name, len );
    if( res_node->Prev != NULL ) {
        res_node->Prev->Next = new_res_node;
    }
    if( res_node->Next != NULL ) {
        res_node->Next->Prev = new_res_node;
    }
    WRMemFree( res_node );
    return( new_res_node );
}
Пример #18
0
int_32 WGetSINT32FromEdit( HWND edit, bool *mod )
{
    int_32  val;
    char    *cp;
    char    *ep;

    val = 0;

    cp = WGetStrFromEdit( edit, mod );

    /* find out if the edit field has changed */
    if( mod == NULL || *mod ) {
        if( cp == NULL ) {
            return( 0 );
        }
        val = (int_32)strtol( cp, &ep, 0 );
        if( *ep != '\0' ) {
            if( mod != NULL ) {
                *mod = FALSE;
            }
            val = 0;
        }
    }

    if( cp != NULL ) {
        WRMemFree( cp );
    }

    return( val );
}
Пример #19
0
WResID *WGetWResIDFromEdit( HWND edit, bool *mod )
{
    WResID  *rp;
    uint_16 ordID;
    char    *cp;
    char    *ep;

    rp = NULL;

    cp = WGetStrFromEdit( edit, mod );

    /* find out if the edit field has changed */
    if( mod == NULL || *mod ) {
        if( cp == NULL ) {
            return( NULL );
        }
        ordID = (uint_16)strtoul( cp, &ep, 0 );
        if( *ep == '\0' ) {
            rp = WResIDFromNum( ordID );
        } else {
            rp = WResIDFromStr( cp );
        }
    }

    if( cp != NULL ) {
        WRMemFree( cp );
    }

    return( rp );
}
Пример #20
0
char *WGetStrFromEdit( HWND edit, bool *mod )
{
    char    *cp;
    LRESULT text_length;
    LRESULT text_copied;

    text_copied = 0;

    if( mod != NULL ) {
        /* find out if the edit field has changed */
        if( SendMessage( edit, EM_GETMODIFY, 0, 0 ) ) {
            *mod = TRUE;
        } else {
            *mod = FALSE;
        }
    }

    text_length = SendMessage( edit, WM_GETTEXTLENGTH, 0, 0 );

    cp = (char *)WRMemAlloc( text_length + 1 );
    if( cp == NULL ) {
        return( NULL );
    }

    text_copied = SendMessage ( edit, WM_GETTEXT, text_length + 1, (LPARAM)(LPSTR)cp );

    if( text_copied > text_length ) {
        WRMemFree( cp );
        return( NULL );
    }

    cp[text_length] = '\0';

    return( cp );
}
Пример #21
0
void WdeSetIncPathOption( char *path )
{
    if( WdeCurrentState.inc_path != NULL ) {
        WRMemFree( WdeCurrentState.inc_path );
    }
    WdeCurrentState.inc_path = path;
}
Пример #22
0
static void handleLoadSymbols( WAccelEditInfo *einfo )
{
    char        *file;

    file = WLoadSymbols( &einfo->info->symbol_table, einfo->info->symbol_file,
                         einfo->win, TRUE );
    if( file == NULL ) {
        return;
    }

    if( einfo->info->symbol_file != NULL ) {
        WRMemFree( einfo->info->symbol_file );
    }
    einfo->info->symbol_file = file;

    // lookup the id associated with the symbol for all entries
    WResolveAllEntrySymIDs( einfo );

    // look for the symbol matching the id for all entries
    WResolveAllEntrySymbols( einfo );

    WInitEditWindowListBox( einfo );

    if( einfo->current_pos != -1 ) {
        SendDlgItemMessage( einfo->edit_dlg, IDM_ACCEDLIST,
                            LB_SETCURSEL, einfo->current_pos, 0 );
    }

    WRAddSymbolsToComboBox( einfo->info->symbol_table, einfo->edit_dlg,
                            IDM_ACCEDCMDID, WR_HASHENTRY_ALL );

    einfo->info->modified = true;

    WDoHandleSelChange( einfo, FALSE, TRUE );
}
Пример #23
0
WAccelInfo *WAccelGetEInfo( WAccelHandle hndl, bool keep )
{
    WAccelEditInfo  *einfo;
    WAccelInfo      *info;
    bool            ok;

    info = NULL;

    einfo = (WAccelEditInfo *)WGetEditSessionInfo( hndl );

    ok = (einfo != NULL);

    if( ok ) {
        info = einfo->info;
        ok = (info != NULL);
    }

    if( ok ) {
        if( einfo->info->modified ) {
            if( info->data != NULL ) {
                WRMemFree( info->data );
            }
            info->data = NULL;
            info->data_size = 0;
            WMakeDataFromAccelTable( einfo->tbl, &info->data, &info->data_size );
        }
        if( !keep ) {
            WUnRegisterEditSession( hndl );
            WFreeAccelEInfo( einfo );
        }
    }

    return( info );
}
Пример #24
0
void WHandleClear( WAccelEditInfo *einfo )
{
    if( einfo->tbl != NULL && einfo->tbl->num != 0 ) {
        if( WQueryClearRes( einfo ) ) {
            WResetEditWindow( einfo );
            SendDlgItemMessage( einfo->edit_dlg, IDM_ACCEDLIST, LB_RESETCONTENT, 0, 0 );
            WFreeAccelTableEntries( einfo->tbl->first_entry );
            einfo->tbl->first_entry = NULL;
            einfo->tbl->num = 0;
            einfo->current_entry = NULL;
            einfo->current_pos = -1;
            einfo->getting_key = FALSE;
            if( einfo->info->stand_alone ) {
                if( einfo->file_name != NULL ) {
                    WRMemFree( einfo->file_name );
                    einfo->file_name = NULL;
                    WSetEditTitle( einfo );
                }
                if( einfo->info->symbol_table != NULL ) {
                    WRFreeHashTable( einfo->info->symbol_table );
                    einfo->info->symbol_table = WRInitHashTable();
                }
            }
            einfo->info->modified = true;
            SetFocus( einfo->edit_dlg );
            WSetStatusByID( einfo->wsb, W_ACCELCLEARMSG, -1 );
        }
    }
}
Пример #25
0
static bool WQueryChangeEntry( WMenuEditInfo *einfo )
{
    int         ret;
    UINT        style;
    char        *title;
    char        *text;

    style = MB_YESNO | MB_APPLMODAL | MB_ICONEXCLAMATION;
    title = WCreateEditTitle( einfo );
    text = AllocRCString( W_CHANGEMODIFIEDMENUITEM );

    ret = MessageBox( einfo->edit_dlg, text, title, style );

    if( text != NULL ) {
        FreeRCString( text );
    }
    if( title != NULL ) {
        WRMemFree( title );
    }

    if( ret == IDYES ) {
        return( TRUE );
    }

    return( FALSE );
}
Пример #26
0
bool WPasteMenuItem( WMenuEditInfo *einfo )
{
    WMenuEntry  *entry;
    void        *data;
    uint_32     dsize;
    bool        ok;

    data = NULL;
    ok = (einfo != NULL);

    if( ok ) {
        ok = WGetClipData( einfo->win, WItemClipbdFormat, &data, &dsize );
    }

    if( ok ) {
        entry = WMakeMenuEntryFromClipData( data, dsize );
        ok = (entry != NULL);
    }

    if( ok ) {
        ok = WResolveEntries( entry, einfo->info->symbol_table );
    }

    if( ok ) {
        ok = WInsertMenuEntry( einfo, entry, TRUE );
    }

    if( data != NULL ) {
        WRMemFree( data );
    }

    return( ok );
}
Пример #27
0
bool WSetEditWindowText( HWND dlg, MenuFlags flags, char *text )
{
    bool    ok;
    char    *t;
    char    *n;

    ok = (dlg != (HWND)NULL);

    if( ok ) {
        if( flags & MENU_SEPARATOR ) {
            t = "";
        } else {
            t = text;
            if( t == NULL ) {
                t = "";
            }
        }
    }

    if( ok ) {
        n = WConvertStringFrom( t, "\t\x8", "ta" );
        if( n != NULL ) {
            ok = WSetEditWithStr( GetDlgItem( dlg, IDM_MENUEDTEXT ), n );
            WRMemFree( n );
        } else {
            ok = WSetEditWithStr( GetDlgItem( dlg, IDM_MENUEDTEXT ), t );
        }
    }

    return( ok );
}
Пример #28
0
static bool WQueryNukePopup( WMenuEditInfo *einfo )
{
    int         ret;
    UINT        style;
    char        *title;
    char        *text;

    style = MB_YESNO | MB_APPLMODAL | MB_ICONEXCLAMATION;
    title = WCreateEditTitle( einfo );
    text = AllocRCString( W_QUERYNUKEPOPUP );

    ret = MessageBox( einfo->edit_dlg, text, title, style );

    if( text != NULL ) {
        FreeRCString( text );
    }
    if( title != NULL ) {
        WRMemFree( title );
    }

    if( ret == IDYES ) {
        return( TRUE );
    }

    return( FALSE );
}
Пример #29
0
int WRReadResourceNames( WResDir dir, WResFileID file_handle, uint_32 name_offset )
{
    uint_8      name_len;
    char        *name;
    int         end_of_names;

    end_of_names = FALSE;

    ResReadUint8( &name_len, file_handle );

    while( !end_of_names ) {
        if( name_len == 0 ) {
            ResReadUint8( &name_len, file_handle );
            if( name_len == 0 ) {
                end_of_names = TRUE;
            } else {
                name_offset++;
            }
        } else {
            name = (char *)WRMemAlloc( name_len + 1 );
            if( read( file_handle, name, name_len ) != name_len ) {
                return( FALSE );
            }
            name[name_len] = 0;
            WRSetResName( dir, name_offset, name );
            WRMemFree( name );
            name_offset = name_offset + name_len + 1;
            ResReadUint8( &name_len, file_handle );
        }
    }

    return( TRUE );
}
Пример #30
0
WResTypeNode *WRRenameWResTypeNode( WResDir dir, WResTypeNode *type_node, char *name )
{
    WResTypeNode    *new_type_node;
    int             len;

    len = strlen( name );
    new_type_node = (WResTypeNode *)WRMemAlloc( sizeof( WResTypeNode ) + len - 1 );
    if( new_type_node == NULL ) {
        return( NULL );
    }
    if( dir->Head == type_node ) {
        dir->Head = new_type_node;
    }
    if( dir->Tail == type_node ) {
        dir->Tail = new_type_node;
    }
    new_type_node->Next = type_node->Next;
    new_type_node->Prev = type_node->Prev;
    new_type_node->Head = type_node->Head;
    new_type_node->Tail = type_node->Tail;
    new_type_node->Info.NumResources = type_node->Info.NumResources;
    new_type_node->Info.TypeName.IsName = TRUE;
    new_type_node->Info.TypeName.ID.Name.NumChars = len;
    memcpy( new_type_node->Info.TypeName.ID.Name.Name, name, len );
    if( type_node->Prev != NULL ) {
        type_node->Prev->Next = new_type_node;
    }
    if( type_node->Next != NULL ) {
        type_node->Next->Prev = new_type_node;
    }
    WRMemFree( type_node );
    return( new_type_node );
}