Example #1
0
Bool WREQuerySaveResOnDeleteRes( WREResInfo *res_info, Bool fatal_exit )
{
    int         ret;
    UINT        style;
    HWND        frame;
    char        *text;

    if( WRENoInterface ) {
        return( TRUE );
    }

    if( res_info != NULL && WREIsResModified( res_info ) ) {
        if( fatal_exit ) {
            style = MB_YESNO | MB_APPLMODAL | MB_ICONEXCLAMATION;
        } else {
            style = MB_YESNOCANCEL | MB_APPLMODAL | MB_ICONEXCLAMATION;
        }
        WRECheckIfActiveWindow();
        frame = WREGetMDIWindowHandle();
        SendMessage( frame, WM_MDIRESTORE, (WPARAM)res_info->res_win, 0 );
        SendMessage( frame, WM_MDIACTIVATE, (WPARAM)res_info->res_win, 0 );
        text = WREAllocRCString( WRE_QUERYMODIFIED );
        ret = MessageBox( res_info->res_win, text, WREGetQueryName( res_info ), style );
        if( text != NULL ) {
            WREFreeRCString( text );
        }
        if( ret == IDYES ) {
            return( WRESaveResource( res_info, FALSE ) );
        } else if( ret == IDCANCEL ) {
            return( FALSE );
        }
    }

    return( TRUE );
}
Example #2
0
Bool WREQuerySaveSymOnDeleteRes( WREResInfo *res_info, Bool fatal_exit )
{
    int         ret;
    UINT        style;
    char        *text;
    char        *file;
    HWND        frame;

    if( WRENoInterface ) {
        return( TRUE );
    }

    if( res_info == NULL || res_info->symbol_table == NULL ) {
        return( TRUE );
    }

    if( WRIsHashTableDirty( res_info->symbol_table ) ) {
        if( fatal_exit ) {
            style = MB_YESNO | MB_APPLMODAL | MB_ICONEXCLAMATION;
        } else {
            style = MB_YESNOCANCEL | MB_APPLMODAL | MB_ICONEXCLAMATION;
        }
        WRECheckIfActiveWindow();
        frame = WREGetMDIWindowHandle();
        SendMessage( frame, WM_MDIRESTORE, (WPARAM)res_info->res_win, 0 );
        SendMessage( frame, WM_MDIACTIVATE, (WPARAM)res_info->res_win, 0 );
        file = WREGetQueryName( res_info );
        text = WREAllocRCString( WRE_SAVEMODIFIEDSYM );
        ret = MessageBox( res_info->res_win, text, file, style );
        if( text != NULL ) {
            WREFreeRCString( text );
        }
        if( ret == IDYES ) {
            if( res_info->symbol_file == NULL ) {
                res_info->symbol_file = WRECreateSymName( file );
            }
            if( !WRESaveSymbols( res_info->symbol_table, &res_info->symbol_file, FALSE ) ) {
                return( FALSE );
            }
        } else if( ret == IDCANCEL ) {
            return( FALSE );
        }
    }

    return( TRUE );
}
Example #3
0
void WREFreeResList( void )
{
    LIST        *rlist;
    WREResInfo  *info;
    HWND        frame;

    if( WREResList != NULL ) {
        frame = WREGetMDIWindowHandle();
        for( rlist = WREResList; rlist != NULL; rlist = ListNext( rlist ) ) {
            info = (WREResInfo *)ListElement( rlist );
            SendMessage( frame, WM_MDIACTIVATE, (WPARAM)info->res_win, 0 );
            WREFreeResInfo( info );
        }
        ListFree( WREResList );
        WREResList = NULL;
        WRENumRes = 0;
    }
}
Example #4
0
Bool WRECreateResourceWindow( WREResInfo *res_info )
{
    MDICREATESTRUCT     mdics;
    LRESULT             ret;
    HWND                win;
    Bool                ok;
    DWORD               style;
    int                 fn_offset;
    char                *win_title;
    int                 win_title_len;

    _wre_touch( fn_offset );

    win_title = NULL;

    ok = (res_info != NULL);

    if( ok ) {
        WREIncNumRes();
        if( res_info->info->file_name != NULL ) {
            //perhaps I should make this an option
            //fn_offset = WRFindFnOffset( res_info->info->file_name );
            //title = &res_info->info->file_name[fn_offset];
            mdics.szTitle = res_info->info->file_name;
        } else if( res_info->info->save_name != NULL ) {
            mdics.szTitle = res_info->info->save_name;
        } else {
            WREResCounter++;
            win_title_len = strlen( WREResUntitled ) + 7;
            win_title = (char *)WREMemAlloc( win_title_len );
            sprintf( win_title, "%s.%d", WREResUntitled, 0xffff & WREResCounter );
            mdics.szTitle = win_title;
        }
        style = 0;
        if( WREGetNumRes() != 1 && WREIsCurrentMDIWindowZoomed() ) {
            style = WS_MAXIMIZE;
        }
        mdics.szClass = WREResClass;
        mdics.hOwner = WREAppInst;
        mdics.x = CW_USEDEFAULT;
        mdics.y = CW_USEDEFAULT;
        mdics.cx = CW_USEDEFAULT;
        mdics.cy = CW_USEDEFAULT;
        mdics.style = style;
        mdics.lParam = (LPARAM)(LPVOID)res_info;

        ret = SendMessage( WREGetMDIWindowHandle(), WM_MDICREATE, 0, (LPARAM)(LPVOID)&mdics );
        ok = (ret != NULL);
    }

    if( ok ) {
#ifdef __NT__
        win = (HWND)ret;
#else
        win = (HWND)LOWORD( ret );
#endif
        ok = (res_info->res_win != NULL && res_info->res_win == win);
    }

    if( ok ) {
        ok = WRECreateResInfoWindow( res_info );
    }

    if( ok ) {
        WResizeInfoWindow( res_info );
        ShowWindow( res_info->info_win, SW_SHOW );
        SetFocus( res_info->info_win );
    }

    if( win_title != NULL ) {
        WREMemFree( win_title );
    }

    return( ok );
}
Example #5
0
void WREDestroyMDIWindow ( HWND win )
{
    SendMessage ( WREGetMDIWindowHandle(), WM_MDIDESTROY, (WPARAM) win, 0 );
}