Ejemplo n.º 1
0
void WdeSetBaseObjectMenu( Bool has_hash )
{
    HMENU   menu;
    int     i;

    i = WdeIsCurrentMDIWindowZoomed() ? 1 : 0;

    menu = WdeGetMenuHandle();

    if( WdeLastObject != BASE ) {
        WdeEnableAllMenuItems( GetSubMenu( menu, EDIT_MENU + i ), FALSE );
        EnableMenuItem( menu, IDM_OPTIONS, MF_ENABLED | MF_BYCOMMAND );

        WdeEnableAllMenuItems( GetSubMenu( menu, DIALOG_MENU + i ), FALSE );
        EnableMenuItem( menu, IDM_DIALOG_NEW, MF_ENABLED | MF_BYCOMMAND );

        if( has_hash ) {
            EnableMenuItem( menu, IDM_WRITE_SYMBOLS, MF_ENABLED | MF_BYCOMMAND );
        } else {
            EnableMenuItem( menu, IDM_WRITE_SYMBOLS, MF_GRAYED | MF_BYCOMMAND );
        }

        WdeLastObject = BASE;
    }

    WdeEnableSelectDialogItem( menu );
    //WdeEnableGotoMenu( menu );

    menu = GetSubMenu( menu, EDIT_MENU + i );
    EnableMenuItem( menu, SYMBOLS_SUBMENU, MF_ENABLED | MF_BYPOSITION );

#if 0
    DrawMenuBar( WdeGetMainWindowHandle() );
#endif
}
Ejemplo n.º 2
0
void WdeSetDialogObjectMenu ( Bool restorable, Bool res_has_hash, WdeOrderMode mode )
{
    HMENU   menu;
    int     i;

    i = WdeIsCurrentMDIWindowZoomed() ? 1 : 0;

    menu = WdeGetMenuHandle();

    if( WdeLastObject != DIALOG || WdeLastDlgRestorable != restorable ||
        mode != WdeLastOrderMode ) {

        WdeSetDialogObjectDialogMenu( menu, i, restorable, res_has_hash, mode );
        WdeEnableAllMenuItems( GetSubMenu( menu, EDIT_MENU + i ), TRUE );
        WdeLastObject = DIALOG;
        WdeLastDlgRestorable = restorable;
    }

    WdeEnableSelectDialogItem( menu );
    WdeEnableAlignTools( menu, i );
    //WdeEnableTest( menu, mode == WdeSelect );
    //WdeEnableGotoMenu( menu );

#if 0
    DrawMenuBar( WdeGetMainWindowHandle() );
#endif
}
Ejemplo n.º 3
0
void WdeEnableCommonControlsMenu( HMENU menu )
{
    int i;

    i = WdeIsCurrentMDIWindowZoomed() ? 1 : 0;
    menu = GetSubMenu( menu, TOOLS_MENU + i );
    menu = GetSubMenu( menu, COMM_CTRL_MENU );

    WdeEnableAllMenuItems( menu, IsCommCtrlLoaded() );
}
Ejemplo n.º 4
0
void WdeSetControlObjectMenu ( Bool dlg_is_parent, Bool dlg_restorable,
                               Bool res_has_hash, WdeOrderMode mode )
{
    HMENU   menu;
    int     i;

    i = WdeIsCurrentMDIWindowZoomed() ? 1 : 0;

    menu = WdeGetMenuHandle();

    if ( WdeLastObject != CONTROL || mode != WdeLastOrderMode ||
         WdeLastDlgIsParent != dlg_is_parent ) {
        if( dlg_is_parent ) {
            WdeSetDialogObjectDialogMenu( menu, i, dlg_restorable, res_has_hash, mode );
        } else {
            if( mode != WdeLastOrderMode ) {
                WdeCheckModeMenu( menu, WdeLastOrderMode, MF_UNCHECKED );
                WdeCheckModeMenu( menu, mode, MF_CHECKED );
                WdeLastOrderMode = mode;
            }
            WdeEnableAllMenuItems( GetSubMenu( menu, DIALOG_MENU + i ), FALSE );
            EnableMenuItem( menu, IDM_DIALOG_NEW, MF_ENABLED );
        }

        WdeEnableAllMenuItems( GetSubMenu( menu, EDIT_MENU + i ), TRUE );

        WdeLastObject = CONTROL;
        WdeLastDlgIsParent = dlg_is_parent;
    }

    WdeEnableSelectDialogItem( menu );
    WdeEnableAlignTools( menu, i );
    //WdeEnableTest( menu, mode == WdeSelect );
    //WdeEnableGotoMenu( menu );

#if 0
    DrawMenuBar( WdeGetMainWindowHandle() );
#endif
}
Ejemplo n.º 5
0
void WdeSetTestModeMenu( Bool testing )
{
    HMENU   menu;
    int     i;

    i = WdeIsCurrentMDIWindowZoomed() ? 1 : 0;

    menu = WdeGetMenuHandle();
    WdeEnableAllMenuItems( menu, !testing );
    WdeEnableAllMenuItems( GetSubMenu( menu, DIALOG_MENU + i ), !testing );

    if( testing ) {
        EnableMenuItem( menu, DIALOG_MENU + i, MF_ENABLED | MF_BYPOSITION );
        EnableMenuItem( menu, IDM_TEST_MODE, MF_ENABLED );
        CheckMenuItem( menu, IDM_TEST_MODE, MF_CHECKED );
    } else {
        CheckMenuItem( menu, IDM_TEST_MODE, MF_UNCHECKED );
    }

    WdeSetRibbonItemState( IDM_TEST_MODE, testing );

    DrawMenuBar( WdeGetMainWindowHandle() );
}
Ejemplo 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 );
}