Esempio n. 1
0
bool WdeQuerySaveResOnDeleteRes( WdeResInfo *res_info, bool fatal_exit )
{
    int         ret;
    UINT        style;
    char        *file;
    char        *text;
    HWND        frame;

    if( res_info != NULL && res_info->dlg_item_list != NULL &&
            WdeIsResModified( res_info ) ) {
        WdeCheckIfActiveWindow();
        if( fatal_exit ) {
            style = MB_YESNO | MB_APPLMODAL | MB_ICONEXCLAMATION;
        } else {
            style = MB_YESNOCANCEL | MB_APPLMODAL | MB_ICONEXCLAMATION;
        }
        frame = WdeGetMDIWindowHandle();
        if( IsIconic( frame ) ) {
            SendMessage( frame, WM_MDIRESTORE, (WPARAM)res_info->res_win, 0 );
        }
        SendMessage( frame, WM_MDIACTIVATE, (WPARAM)res_info->res_win, 0 );
        file = WdeGetQueryName( res_info );
        if( WdeIsDDE() ) {
            text = WdeAllocRCString( WDE_UPDATEMODIFIEDPRJ );
        } else {
            text = WdeAllocRCString( WDE_SAVEMODIFIEDPRJ );
        }
        ret = MessageBox( res_info->res_win, text, file, style );
        if( text != NULL ) {
            WdeFreeRCString( text );
        }
        if( ret == IDYES ) {
            if( WdeIsDDE() ) {
                return( WdeUpdateDDEEditSession() );
            } else {
                return( WdeSaveResource( res_info, FALSE ) );
            }
        } else if( ret == IDCANCEL ) {
            return( FALSE );
        }
    }

    return( TRUE );
}
Esempio n. 2
0
WdeResInfo *WdeCreateNewResource( char *title )
{
    WdeResInfo  *res_info;
    bool        ok;

    ok = ((res_info = WdeAllocResInfo()) != NULL);

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

    if( ok ) {
        res_info->hash_table = WRInitHashTable();
        ok = (res_info->hash_table != NULL);
    }

    if( ok ) {
        if( title != NULL ) {
            res_info->info->save_name = WdeStrDup( title );
            ok = (res_info->info->save_name != NULL);
        }
    }

    if( ok ) {
#ifdef __NT__
        res_info->is32bit = TRUE;
#else
        res_info->is32bit = FALSE;
#endif
        ok = WdeCreateResourceWindow( res_info, 0, title );
    }

    if( ok ) {
        ListAddElt( &WdeResList, (void *)res_info );
        if( !WdeIsDDE() || title == NULL ) {
            ok = (WdeCreateNewDialog( NULL, res_info->is32bit ) != NULL);
        }
    }

    if( ok ) {
        WdeCheckBaseScrollbars( FALSE );
    }

    if( res_info ) {
        if( ok ) {
            WdeSetResModified( res_info, FALSE );
        } else {
            WdeRemoveResource( res_info );
            res_info = NULL;
        }
    }

    return( res_info );
}
Esempio n. 3
0
bool WdeInitRibbon( HINSTANCE inst )
{
    bool        ret;

    if( WdeIsDDE() ) {
        ret = WdeDoInitRibbon( inst, WdeDDERibbonNames, NUM_DDE_TOOLS );
    } else {
        ret = WdeDoInitRibbon( inst, WdeRibbonNames, NUM_TOOLS );
    }

    return( ret );
}
Esempio n. 4
0
Bool WdeInitHints( void )
{
    Bool ret;

    ret = TRUE;

    if( !WdeIsDDE() ) {
        ret = WdeCreateWdePopupListItem( 4, WdeGetInitialMenuHandle(),
                                         WdeInitialPopupHints );
    }

    if( ret ) {
        if( WdeIsDDE() ) {
            ret = WdeCreateWdePopupListItem( 10, WdeGetResMenuHandle(),
                                             WdeDDEPopupHints );
        } else {
            ret = WdeCreateWdePopupListItem( 10, WdeGetResMenuHandle(),
                                             WdeResPopupHints );
        }
    }

    return( ret );
}
Esempio n. 5
0
Bool WdeClearCurrentResource( void )
{
    Bool        ok;
    Bool        is32bit;

    ok = WdeQueryClearRes();

    if( ok ) {
        ok = WdeDeleteAllObjects();
    }

    if( ok && WdeIsDDE() ) {
#ifdef __NT__
        is32bit = TRUE;
#else
        is32bit = FALSE;
#endif
        ok = (WdeCreateNewDialog( NULL, is32bit ) != NULL);
    }

    return( ok );
}
Esempio n. 6
0
bool WdeCreateResourceWindow( WdeResInfo *res_info, int fn_offset, char *title )
{
    MDICREATESTRUCT     mdics;
    LRESULT             ret;
    HWND                win;
    bool                ok;
    bool                old;
    DWORD               style;
    RECT                r;
    HMENU               sys_menu;
    char                *win_title;
    int                 win_title_len;

    _wde_touch( fn_offset );

    WdeIncNumRes();

    style = 0;

    if( WdeGetNumRes() == 1 ) {
        WdeSetAppMenuToRes( TRUE );
        old = WdeSetStickyMode( WdeOldStickyMode );
        style = WS_MAXIMIZE;
    } else {
        if( WdeIsCurrentMDIWindowZoomed() ) {
            style = WS_MAXIMIZE;
        }
    }

    mdics.szClass = "WdeResClass";

    win_title = NULL;
    if( title == NULL ) {
        if( res_info->info->file_name ) {
            // perhaps make this an option
            //title = &res_info->info->file_name[fn_offset];
            mdics.szTitle = res_info->info->file_name;
        } else {
            WdeResCounter++;
            win_title_len = strlen( WdeResUntitled ) + 7;
            win_title = (char *)WRMemAlloc( win_title_len );
            sprintf( win_title, "%s.%d", WdeResUntitled, 0xffff & WdeResCounter );
            mdics.szTitle = win_title;
        }
    } else {
        mdics.szTitle = title;
    }

    win = WdeGetMDIWindowHandle();
    GetClientRect( win, &r );

    mdics.hOwner = WdeGetAppInstance();
    mdics.x = CW_USEDEFAULT;
    mdics.y = CW_USEDEFAULT;
    mdics.cx = CW_USEDEFAULT;
    mdics.cy = CW_USEDEFAULT;
    //mdics.cx = r.right - r.left;
    //mdics.cy = r.bottom - r.top;
    mdics.style = style;
    mdics.lParam = (LPARAM)res_info;

    ret = SendMessage( win, WM_MDICREATE, 0, (LPARAM)&mdics );

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

#ifdef __NT__
    win = (HWND)ret;
#else
    win = (HWND)LOWORD( ret );
#endif

    ok = (res_info->res_win != NULL && res_info->res_win == win);
    if( !ok ) {
        WdeWriteTrail( "WdeCreateResourceWindow: Bad window handle!" );
    }

    if( WdeIsDDE() ) {
        sys_menu = GetSystemMenu( win, FALSE );
        if( sys_menu != (HMENU)NULL ) {
            EnableMenuItem( sys_menu, SC_CLOSE, MF_GRAYED );
        }
    }

    if( ok ) {
        ok = WdeCreateEditWindows( res_info );
        if( !ok ) {
            WdeWriteTrail( "WdeCreateResourceWindow: Could not create edit windows!" );
        }
    }

    if( ok ) {
        OpenFormEdit( res_info->forms_win, WdeGetCreateTable(), MENU_NONE, SCROLL_NONE );
        WdeSetEditMode( res_info, TRUE );
        SetHorizontalInc( 1 );
        SetVerticalInc( 1 );
        InitState( res_info->forms_win );
        SetMouseRtn( res_info->forms_win, WdeMouseRtn );
        //MakeObjectCurrent( GetMainObject() );
    } else {
        if( WdeGetNumRes() == 1 ) {
            WdeSetAppMenuToRes( FALSE );
            WdeSetStickyMode( old );
        }
        WdeDecNumRes();
    }

    return( ok );
}