Beispiel #1
0
Bool WdeSetStatusByID( DWORD id1, DWORD id2 )
{
    char        *str1;
    char        *str2;
    Bool        ret;

    ret = FALSE;
    str1 = NULL;
    str2 = NULL;

    if( id1 != -1 ) {
        str1 = WdeAllocRCString( id1 );
    }

    if( id2 != -1 ) {
        str2 = WdeAllocRCString( id2 );
    }

    ret = WdeSetStatusText( str1, str2, TRUE );

    if( str1 != NULL ) {
        WdeFreeRCString( str1 );
    }

    if( str2 != NULL ) {
        WdeFreeRCString( str2 );
    }

    return( ret );
}
Beispiel #2
0
bool WdeDisplayOptions( void )
{
    HWND      dialog_owner;
    DLGPROC   dlgproc;
    HINSTANCE app_inst;
    INT_PTR   modified;

    WdeSetStatusText( NULL, " ", false );
    WdeSetStatusByID( WDE_DISPLAYOPTIONS, 0 );

    dialog_owner = WdeGetMainWindowHandle();
    app_inst = WdeGetAppInstance();
    dlgproc = MakeProcInstance_DLG( WdeOptionsDlgProc, app_inst );
    modified = JDialogBoxParam( app_inst, "WdeOptions", dialog_owner, dlgproc, (LPARAM)NULL );
    FreeProcInstance_DLG( dlgproc );

    if( modified == -1 ) {
        WdeWriteTrail( "WdeDisplayOptions: Dialog not created!" );
        return( FALSE );
    }

    WdeSetStatusReadyText();

    return( TRUE );
}
Beispiel #3
0
void WdeSetBaseObject( int menu_selection )
{
    HMENU               menu;
    OBJ_ID              obj_id;
    int                 id;
    WdeToolBar          *tbar;

    if( WdeGetNumRes() == 0 ) {
        return;
    }

    tbar = WdeControls;
    menu = WdeGetResMenuHandle();
    id = WdeGetCToolID();
    obj_id = -1;

    if( id != -1 && id != menu_selection ) {
        CheckMenuItem( menu, id, MF_BYCOMMAND | MF_UNCHECKED );
        WdeSetToolBarItemState( tbar, id, BUTTON_UP );
    }

    if( menu_selection != -1 ) {
        obj_id = WdeGetOBJIDFromMenu( menu_selection );
        if( obj_id != -1 ) {
            SetBaseObjType( obj_id );
            CheckMenuItem( menu, menu_selection, MF_BYCOMMAND | MF_CHECKED );
            WdeSetToolBarItemState( tbar, menu_selection, BUTTON_DOWN );
            WdeSetStatusText( NULL, "", true );
        }
    }
}
Beispiel #4
0
bool WdeSetStickyMode( bool mode )
{
    HMENU   menu;
    bool    old_mode;

    if( WdeGetNumRes() == 0 ) {
        return( false );
    }

    menu = WdeGetResMenuHandle();

    old_mode = WdeStickyMode;

    WdeStickyMode = mode;

    if( WdeStickyMode ) {
        WdeSetToolBarItemState( WdeControls, IDM_STICKY_TOOLS, BUTTON_DOWN );
        CheckMenuItem( menu, IDM_STICKY_TOOLS, MF_BYCOMMAND | MF_CHECKED );
    } else {
        WdeSetToolBarItemState( WdeControls, IDM_STICKY_TOOLS, BUTTON_UP );
        CheckMenuItem( menu, IDM_STICKY_TOOLS, MF_BYCOMMAND | MF_UNCHECKED );
    }

    WdeSetStatusText( NULL, "", true );

    return( old_mode );
}
Beispiel #5
0
void WdeHandleToolHint( ctl_id id, BOOL pressed )
{
    if( pressed ) {
        WdeDisplayHint( id );
    } else {
        WdeSetStatusText( NULL, "", TRUE );
    }
}
Beispiel #6
0
void WdeHandleMenuSelect( WPARAM wParam, LPARAM lParam )
{
    HMENU   menu;
    HMENU   popup;
    WORD    flags;

    menu = WdeGetMenuHandle();
    flags = GET_WM_MENUSELECT_FLAGS( wParam, lParam );

    if( flags == (WORD)-1 && GET_WM_MENUSELECT_HMENU( wParam, lParam ) == (HMENU)NULL ) {
        WdeSetStatusText( NULL, "", TRUE );
    } else if( flags & (MF_SYSMENU | MF_SEPARATOR) ) {
        WdeSetStatusText( NULL, "", TRUE );
    } else if( flags & MF_POPUP ) {
        popup = (HMENU)GET_WM_MENUSELECT_ITEM( wParam, lParam );
#ifdef __NT__
        popup = GetSubMenu( (HMENU)lParam, (int)popup );
#endif
        WdeHandlePopupHint( menu, popup );
    } else {
        WdeDisplayHint( (int)GET_WM_MENUSELECT_ITEM( wParam, lParam ) );
    }
}
Beispiel #7
0
void WdeHandlePopupHint( HMENU menu, HMENU popup )
{
    WdePopupListItem    *p;
    DWORD               hint;

    hint = -1;

    p = WdeFindPopupListItem( menu );

    if( p != NULL ) {
        hint = WdeGetPopupHint( p, popup );
        if( hint != -1 ) {
            WdeSetStatusByID( -1, hint );
        }
    }

    if( hint == -1 ) {
        WdeSetStatusText( NULL, "", TRUE );
    }
}
Beispiel #8
0
bool WdeHandleTestModeMenu( WdeResInfo *info )
{
    HWND   main_window;
    bool   ret;

    if( info == NULL ) {
        return( FALSE );
    }

    main_window = WdeGetMainWindowHandle();

    if( WdeTestMode ) {
        WdeTestMode = FALSE;
        if( WdeTestDialogHandle != NULL ) {
            DestroyWindow( WdeTestDialogHandle );
        }
        WdeSetTestModeMenu( FALSE );
        WdeSetStatusReadyText();
        WdeShowResourceWindows( SW_SHOWNA );
        if( WdeTestResource != NULL ) {
            //InitState( WdeTestResource->forms_win );
            //SendMessage( WdeTestResource->res_win, WM_MDIRESTORE, 0, 0 );
            WdeTestResource = NULL;
        }
        ret = TRUE;
    } else {
        WdeSetStatusText( NULL, "", FALSE );
        WdeSetStatusByID( WDE_TESTMODE, -1 );
        ret = WdeTestCurrentObject();
        if( ret ) {
            WdeShowResourceWindows( SW_HIDE );
            WdeSetTestModeMenu( TRUE );
            WdeTestMode = TRUE;
            WdeTestResource = info;
        } else {
            WdeSetStatusReadyText();
        }
    }

    return( ret );
}
Beispiel #9
0
void WdeDisplayHint( int id )
{
    char        *buf;
    char        *mditext;
    WdeHintItem *hint;

    if( id < WDE_MDI_FIRST ) {
        hint = WdeGetHintItem( id );
        if( hint != NULL ) {
            WdeSetStatusByID( -1, hint->hint );
        }
    } else {
        mditext = WdeAllocRCString( WDE_HINT_MDIMSG );
        if( mditext != NULL ) {
            buf = WdeMemAlloc( strlen( mditext ) + 20 + 1 );
            if( buf != NULL ) {
                sprintf( buf, mditext, WDE_MDI_FIRST + 1 - id );
                WdeSetStatusText( NULL, buf, TRUE );
                WdeMemFree( buf );
            }
            WdeFreeRCString( mditext );
        }
    }
}
Beispiel #10
0
Bool WdeSetStatusReadyText( void )
{
    WdeSetStatusText( NULL, "", FALSE );
    return( WdeSetStatusByID( WDE_READYMSG, -1 ) );
}
Beispiel #11
0
bool WdeCreateControlsToolBar( void )
{
    RECT        t, r, screen;
    HWND        parent;
    int         id;
    char        *text;

    if( WdeControls != NULL ) {
        return ( true );
    }

    WdeSetStatusText( NULL, "", false );
    WdeSetStatusByID( WDE_CREATINGTOOLBOX, 0 );

    parent = WdeGetMainWindowHandle();

    WdeGetCntlTBarPosOption( &t );

    if( t.left == t.right && t.top == t.bottom ) {
        GetWindowRect( parent, &r );
#ifdef __NT__
        if( GetModuleHandle( "COMCTL32.DLL" ) == NULL ) {
#endif
            t.left = r.right - CONTROLS_DEFX;
            t.top = r.top + CONTROLS_INSET;
            t.right = r.right;
            t.bottom = t.top + CONTROLS_DEFY;
#ifdef __NT__
        } else {
            t.left = r.right - CONTROLS_DEFXCC;
            t.top = r.top + CONTROLS_INSET;
            t.right = r.right;
            t.bottom = t.top + CONTROLS_DEFYCC;
        }
#endif
    }

    GetWindowRect( GetDesktopWindow(), &screen );
    if( !IntersectRect( &r, &screen, &t ) ) {
        r.right = t.right - t.left;
        r.bottom = t.bottom - t.top;
        r.left = 0;
        if( screen.right > r.right )
            r.left = ( screen.right - r.right ) / 2;
        r.top = 0;
        if( screen.bottom - screen.top - r.bottom  > 0 )
            r.top = ( screen.bottom - screen.top - r.bottom ) / 2;
        r.right += r.left;
        r.bottom += r.top;
        t = r;
    }

    WdeControlsInfo->dinfo.area = t;

    WdeControls = WdeCreateToolBar( WdeControlsInfo, parent );

    if( WdeControls == NULL ) {
        return( false );
    }

    text = WdeAllocRCString( WDE_TOOLBOXCAPTION );
    SendMessage( WdeControls->win, WM_SETTEXT, 0, (LPARAM)(LPCSTR)text );
    if( text != NULL ) {
        WdeFreeRCString( text );
    }

    text = WdeAllocRCString( WDE_HIDETOOLBOX );
    ModifyMenu ( WdeGetInitialMenuHandle(), IDM_SHOW_TOOLS,
                 MF_BYCOMMAND | MF_STRING, IDM_SHOW_TOOLS, text );
    ModifyMenu ( WdeGetResMenuHandle(), IDM_SHOW_TOOLS,
                 MF_BYCOMMAND | MF_STRING, IDM_SHOW_TOOLS, text );
    if( text != NULL ) {
        WdeFreeRCString( text );
    }

    if( WdeGetNumRes() ) {
        id = WdeGetMenuFromOBJID( GetBaseObjType() );
        if( id != -1 ) {
            WdeSetToolBarItemState( WdeControls, id, BUTTON_DOWN );
        }
        WdeSetStickyMode( WdeStickyMode );
    }

    WdeSetStatusReadyText();

    return( true );
}
Beispiel #12
0
Bool WdeWriteStatus ( const char * msg )
{
    WdeSetStatusText(NULL, msg, TRUE);
    return ( TRUE );
}