Beispiel #1
0
Bool WdeSetCurrentCustControl( int which )
{
    int       ret;
    HINSTANCE inst;
    FARPROC   proc;

    if( WdeCustomLibList == NULL ) {
        WdeSetStatusByID( -1, WDE_NOCUSTLOADED );
        return( TRUE );
    }

    if( !WDE_CHECK_WHICH( which ) ) {
        WdeWriteTrail( "WdeSetCurrentCustControl: bad which!" );
        return( FALSE );
    }

    inst = WdeGetAppInstance();
    proc = MakeProcInstance( (FARPROC)WdeSelectCustProc, inst );
    if( proc == NULL ) {
        WdeWriteTrail( "WdeSetCurrentCustomControl: MakeProcInstance failed!" );
        return( FALSE );
    }
    ret = JDialogBoxParam( inst, "WdeSelectCustom", WdeGetMainWindowHandle(),
                           (DLGPROC)proc, (LPARAM)(LPVOID)&which );
    FreeProcInstance( proc );

    /* if the window could not be created return FALSE */
    if( ret == -1 ) {
        WdeWriteTrail( "WdeSetCurrentCustomControl: Could not create selection window!" );
        return( FALSE );
    }

    return( TRUE );
}
Beispiel #2
0
BOOL WdeCreateAndAddCustControl ( WdeCustLib *lib,
                                  WdeCustInfoProc  info_proc,
                                  WdeCustStyleProc style_proc,
                                  WdeCustFlagsProc flags_proc )
{
    HGLOBAL          info_global;
    uint_8          *info_locked;
    WdeCustControl  *control;

    if ( !lib || !info_proc || !style_proc || !flags_proc ) {
        WdeWriteTrail("WdeCreateAndAddCustControl: NULL param!");
        return ( FALSE );
    }

    info_global = (*info_proc) ();

    if ( info_global == NULL ) {
        WdeWriteTrail("WdeCreateAndAddCustControl: Info proc returned NULL!");
        return ( FALSE );
    }

    info_locked = (uint_8 *) GlobalLock ( info_global );
    if ( info_locked == NULL ) {
        WdeWriteTrail("WdeCreateAndAddCustControl: GlobalLock failed!");
        GlobalFree( info_global );
        return ( FALSE );
    }

    control = WdeAllocCustControlFromWDECTLINFO ( (WDECTLINFO *) info_locked,
                                                  lib->ms_lib );
    if ( control == NULL ) {
        WdeWriteTrail("WdeCreateAndAddCustControl: Could alloc control!");
        GlobalUnlock( info_global );
        GlobalFree( info_global );
        return ( FALSE );
    }

    control->lib        = lib;

    control->info_proc  = info_proc;
    control->style_proc = style_proc;
    control->flags_proc = flags_proc;

    WdeAddCustControlToCustLib ( lib, control );

    GlobalUnlock( info_global );

    GlobalFree( info_global );

    WdeMemValidate ( lib );

    return ( TRUE );
}
Beispiel #3
0
BOOL WdeLoadMSCustomControls( WdeCustLib *lib )
{
    WdeCustInfoProc  info_proc;
    WdeCustStyleProc style_proc;
    WdeCustFlagsProc flags_proc;
    HWND             dialog_owner;
    FARPROC          proc_inst;
    HINSTANCE        app_inst;
    INT_PTR          ok;

    dialog_owner = WdeGetMainWindowHandle();
    app_inst = WdeGetAppInstance();
    proc_inst = MakeProcInstance ( (FARPROC)WdeLoadCustProc, app_inst );
    ok = JDialogBoxParam( app_inst, "WdeLoadCustom", dialog_owner,
                          (DLGPROC)proc_inst, (LPARAM)(LPVOID)lib );
    FreeProcInstance ( proc_inst );

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

    if( !ok ) {
        return( FALSE );
    }

    if( !HIWORD( (uint_32)lib->info_name ) ) {
        if( !WdeQueryUnsafeMSLoad() ) {
            WdeWriteTrail( "WdeLoadMSCustomControls: User aborted unsafe load!" );
            return( FALSE );
        }
    }

    info_proc = (WdeCustInfoProc)GetProcAddress( lib->inst, lib->info_name );
    style_proc = (WdeCustStyleProc)GetProcAddress ( lib->inst, lib->style_name );
    flags_proc = (WdeCustFlagsProc)GetProcAddress ( lib->inst, lib->flags_name );

    if( info_proc == NULL || style_proc == NULL || flags_proc == NULL ) {
        WdeWriteTrail( "WdeLoadMSCustomControls: Could not get proc address of ordinal!" );
        return( FALSE );
    }

    if( !WdeCreateAndAddCustControl( lib, info_proc, style_proc, flags_proc ) ) {
        WdeWriteTrail( "WdeLoadMSCustomControls: Control not added to list!" );
        return( FALSE );
    }

    WRMemValidate( lib );

    return( TRUE );
}
Beispiel #4
0
bool WdeRemoveResource( WdeResInfo *res_info )
{
    LIST *node;

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

    if( (node = ListFindElt( WdeResList, res_info )) != NULL ) {
        ListRemoveElt( &WdeResList, (void *)ListElement( node ) );
    } else {
        WdeWriteTrail( "WdeRemoveResource: res_info not found!" );
        return( FALSE );
    }

    if( WdeGetNumRes() == 1 ) {
        WdeOldStickyMode = WdeSetStickyMode( FALSE );
        WdeSetBaseObject( IDM_SELECT_MODE );
    }

    WdeFreeResInfo( res_info );

    if( WdeGetNumRes() == 1 ) {
        WdeSetAppMenuToRes( FALSE );
    }

    WdeDecNumRes();

    return( TRUE );
}
Beispiel #5
0
bool WdeCreateInfoWindow( HWND main_window, HINSTANCE inst )
{
    if( !WdeInitInfoText() ) {
        return( FALSE );
    }

    WdeInfoWinProc = (DLGPROC)MakeProcInstance ( (FARPROC)WdeInfoWndProc, inst );

    WdeInfoColor = GetSysColor( COLOR_BTNFACE );
    WdeInfoBrush = CreateSolidBrush( WdeInfoColor );

    WdeInfoWindow = JCreateDialog( inst, "WdeInfo", main_window, WdeInfoWinProc );

    /* if the window could not be created return FALSE */
    if ( WdeInfoWindow == NULL ) {
        WdeWriteTrail( "WdeCreateInfoWindow: Could not create info window!" );
        return( FALSE );
    }

    WdeInfoWindowDepth = 0;

    WdeResizeWindows();

    return( TRUE );
}
Beispiel #6
0
BOOL WdeFreeCustLib ( WdeCustLib *lib )
{
    if (lib != NULL) {
        if  ( lib->controls != NULL ) {
            WdeFreeCustLibControls ( &(lib->controls) );
        }
        if ( lib->file_name != NULL ) {
            WdeMemFree ( lib->file_name );
        }
        if ( lib->info_name && HIWORD((uint_32)lib->info_name) ) {
            WdeMemFree ( lib->info_name );
        }
        if ( lib->style_name && HIWORD((uint_32)lib->style_name) ) {
            WdeMemFree ( lib->style_name );
        }
        if ( lib->flags_name && HIWORD((uint_32)lib->flags_name) ) {
            WdeMemFree ( lib->flags_name );
        }
        if  ( lib->inst != NULL ) {
            FreeLibrary ( lib->inst );
        }
        if  ( !lib->ms_lib && (lib->class_list != NULL) ) {
            GlobalFree ( lib->class_list );
        }
        WdeMemFree ( lib );
    } else {
        WdeWriteTrail("WdeFreeCustLib: NULL lib!");
        return ( FALSE );
    }

    return ( TRUE );
}
Beispiel #7
0
void WdeDebugCreate ( char *name, void * parent, RECT *obj_rect,
                      void * handle)
{
    char temp[512];

    sprintf(WdeDebugString, "%7s: Create: ", name);

    if ( parent == NULL ) {
        strcat(WdeDebugString, "Parent: NULL,");
    } else {
        sprintf(temp, "Handle: %p, ", (void *)parent );
        strcat(WdeDebugString, temp );
    }

    if ( handle == NULL ) {
        strcat(WdeDebugString, "Handle: NULL, ");
    } else {
        sprintf(temp, "Handle: %p, ", (void *)handle );
        strcat(WdeDebugString, temp );
    }

    if ( obj_rect == NULL ) {
        strcat(WdeDebugString, "Rect: NULL, ");
    } else {
        sprintf(temp,"Rect: (%d,%d),(%d,%d), ",
                obj_rect->left,
                obj_rect->top,
                obj_rect->right,
                obj_rect->bottom);
        strcat(WdeDebugString, temp );
    }

    WdeWriteTrail(WdeDebugString);
}
Beispiel #8
0
void WdeDebugDispatch (char *name, ACTION act, void * obj, void *p1, void *p2)
{
    WdeDebugActionItem *act_item;
    char temp[512];

    if ( (act!=LOCATE) &&
         (act!=RESIZE_INFO) ) {

        act_item = WdeDebugGetActionItem ( act );

        if ( act_item->act == -1 ) {
            sprintf(WdeDebugString, "%7s: %21.21d, ", name, act);
        } else {
            sprintf(WdeDebugString, "%7s: %s, ", name,
                    act_item->act_name);
        }

        if ( obj == NULL ) {
            strcat(WdeDebugString, "OBJ: NULL, ");
        } else {
            sprintf(temp, "OBJ: %p, ", (void *)obj );
            strcat(WdeDebugString, temp );
        }

        WdeDebugInterpretParam ( act_item->p1, p1, temp );
        strcat(WdeDebugString, temp );

        WdeDebugInterpretParam ( act_item->p2, p2, temp );
        strcat(WdeDebugString, temp );

        WdeWriteTrail(WdeDebugString);

    }

}
Beispiel #9
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 #10
0
void WdeGetCurrentCustControl( int which, WdeCustControl **control, UINT *type )
{
    if( !WDE_CHECK_WHICH( which ) ) {
        WdeWriteTrail( "WdeGetCurrentCustControl: bad which!" );
        return;
    }
    *control = WdeCurrControl[which].control;
    *type = WdeCurrControl[which].type;
}
Beispiel #11
0
void WdeGetCurrentCustControl( int which, WdeCustLib **lib, UINT *index )
{
    if( !WDE_CHECK_WHICH( which ) ) {
        WdeWriteTrail( "WdeGetCurrentCustControl: bad which!" );
        return;
    }
    *lib = WdeCurrControl[which].lib;
    *index = WdeCurrControl[which].index;
}
Beispiel #12
0
void PP_OutOfMemory( void )
{
    if( WdePopEnv( &Env ) ) {
        longjmp( Env, 1 );
    } else {
        WdeWriteTrail( "Wde PreProc: Fatal error!" );
        exit( -1 );
    }
}
Beispiel #13
0
OBJPTR WdeGetCurrentDialog( void )
{
    WdeResInfo  *info;
    OBJPTR      curr_obj;
    OBJPTR      ancestor;
    OBJ_ID      id;

    info = WdeGetCurrentRes();
    if( info == NULL ) {
        return( NULL );
    }
    InitState( info->forms_win );

    curr_obj = GetCurrObject();
    if( curr_obj == NULL ) {
        return( NULL );
    }

    if( !Forward( curr_obj, IDENTIFY, &id, NULL ) ) {
        WdeWriteTrail( "WdeGetCurrentDialog: IDENTIFY failed!" );
        return( NULL );
    }

    while( id != DIALOG_OBJ && id != BASE_OBJ ) {
        GetObjectParent( curr_obj, &ancestor );
        if( ancestor == NULL ) {
            WdeWriteTrail( "WdeGetCurrentDialog: IDENTIFY failed!" );
            return( NULL );
        }
        curr_obj = ancestor;
        if( !Forward( curr_obj, IDENTIFY, &id, NULL ) ) {
            WdeWriteTrail( "WdeGetCurrentDialog: IDENTIFY failed!" );
            return( NULL );
        }
    }

    if( id != DIALOG_OBJ ) {
        return( NULL );
    }

    return( curr_obj );
}
Beispiel #14
0
Bool WdeCreateEditWindows( WdeResInfo *info )
{
    RECT      rect;
    HINSTANCE app_inst;

    if( info == NULL || info->res_win == NULL ) {
        return( FALSE );
    }

    app_inst = WdeGetAppInstance();

    GetClientRect( info->res_win, &rect );

    info->forms_win = CreateWindow( "WdeFormsClass", NULL, WS_CHILD | WS_VISIBLE,
                                    0, 0, rect.right - rect.left, rect.bottom - rect.top,
                                    info->res_win, (HMENU)NULL, app_inst, NULL );

    if( info->forms_win == NULL ) {
        WdeWriteTrail( "WdeCreateEditWindow: failed to create forms window!" );
        return( FALSE );
    }

    GetClientRect( info->forms_win, &rect );

    info->edit_win = CreateWindow( "WdeEditClass", NULL, WS_CHILD | WS_VISIBLE, 0, 0,
                                   rect.right - rect.left, rect.bottom - rect.top,
                                   info->res_win, (HMENU)NULL, app_inst, NULL );

    if( info->edit_win == NULL ) {
        WdeWriteTrail( "WdeCreateEditWindow: failed to create forms window!" );
        return( FALSE );
    }

    SetWindowLong( info->edit_win, 0, (LONG)info );
    SetWindowLong( info->forms_win, 0, (LONG)info );

    SetWindowPos( info->forms_win, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );

    return( TRUE );
}
Beispiel #15
0
BOOL WdeLoadMSCustomControls( WdeCustLib *lib )
{
    LPFNCCINFO  info_proc;
    UINT        num_classes;

    info_proc = (LPFNCCINFO)GetProcAddress( lib->inst, "CustomControlInfoA" );

    if( info_proc == NULL ) {
        info_proc = (LPFNCCINFO)GetProcAddress( lib->inst, "CustomControlInfoW" );
        if( info_proc == NULL ) {
            WdeWriteTrail( "WdeLoadMSCustomControls: Info Proc not found!" );
        } else {
            WdeSetStatusByID( -1, WDE_UNICUSTNOTSUPPORTED );
        }
        return( FALSE );
    }

    num_classes = (*info_proc)( NULL );

    if( num_classes == 0 ) {
        WdeWriteTrail( "WdeLoadMSCustomControls: Info Proc returned NULL!" );
        return( FALSE );
    }

    lib->lpcci = (LPCCINFO)WdeMemAlloc( sizeof( CCINFO ) * num_classes );
    if( lib->lpcci == NULL ) {
        WdeWriteTrail( "WdeLoadMSCustomControls: LPCCINFO alloc failed!" );
        return( FALSE );
    }
    memset( lib->lpcci, 0, sizeof( CCINFO ) * num_classes );

    lib->num_classes = (*info_proc)( lib->lpcci );

    if( lib->num_classes != num_classes ) {
        WdeWriteTrail( "WdeLoadMSCustomControls: LPCCINFO inconsistent!" );
    }

    return( TRUE );
}
Beispiel #16
0
WdeCustControl *WdeAllocCustControl ( void )
{
    WdeCustControl  *control;

    control = (WdeCustControl *) WdeMemAlloc ( sizeof(WdeCustControl) );

    if ( control == NULL ) {
        WdeWriteTrail("WdeAllocCustControl: WdeCustControl alloc failed!");
        return ( NULL );
    }

    memset ( control, 0, sizeof(WdeCustControl) );

    return ( control );
}
Beispiel #17
0
void WdeFreeCustLibControls ( LIST **control_list )
{
    LIST           *clist;
    WdeCustControl *control;

    if ( (control_list != NULL) && (*control_list != NULL) ) {
        for ( clist = *control_list; clist; clist = ListNext(clist) ) {
            control = (WdeCustControl *) ListElement(clist);
            WdeFreeCustControl ( control );
        }
        ListFree ( *control_list );
        *control_list = NULL;
    } else {
        WdeWriteTrail("WdeFreeCustLibControls: NULL control_list!");
    }
}
Beispiel #18
0
bool WdeDestroyResourceWindow( WdeResInfo *res_info )
{
    bool        ret;

    ret = (res_info != NULL && WdeQuerySaveResOnDeleteRes( res_info, FALSE ) &&
           WdeQuerySaveSymOnDeleteRes( res_info, FALSE ));

    WdeHashClearSaveRejected( res_info->hash_table );

    if( ret ) {
        if( !WdeRemoveResource( res_info ) ) {
            WdeWriteTrail( "WdeDestroyResourceWindow: RemoveResource failed!" );
        }
    }

    return( ret );
}
Beispiel #19
0
WdeCustLib *WdeAllocCustLib ( void )
{
    WdeCustLib  *lib;

    lib = (WdeCustLib *) WdeMemAlloc ( sizeof(WdeCustLib) );

    if ( lib == NULL ) {
        WdeWriteTrail("WdeAllocCustLib: WdeCustLib alloc failed!");
        return ( NULL );
    }

    memset ( lib, 0, sizeof(WdeCustLib) );

    WdeMemValidate ( lib );

    return ( lib );
}
Beispiel #20
0
BOOL WdeAddBorControlsToCustLib( WdeCustLib *lib, WdeBorlandClassList *class_list )
{
    uint_16 num;

    for( num = 0; num < class_list->nClasses; num++ ) {
        if( !WdeCreateAndAddCustControl( lib, class_list->Classes[num].info_proc,
                                         class_list->Classes[num].style_proc,
                                         class_list->Classes[num].flags_proc ) ) {
            WdeWriteTrail( "WdeAddBorControlsToCustLib: Control not added to list!" );
            return( FALSE );
        }
    }

    WRMemValidate( lib );

    return( TRUE );
}
Beispiel #21
0
BOOL WdeFreeCustLib( WdeCustLib *lib )
{
    if( lib != NULL ) {
        if( lib->file_name != NULL ) {
            WdeMemFree( lib->file_name );
        }
        if( lib->inst != NULL ) {
            FreeLibrary( lib->inst );
        }
        if( lib->lpcci != NULL ) {
            WdeMemFree( lib->lpcci );
        }
        WdeMemFree( lib );
    } else {
        WdeWriteTrail( "WdeFreeCustLib: NULL lib!" );
        return( FALSE );
    }

    return( TRUE );
}
Beispiel #22
0
WdeCustControl *WdeAllocCustControlFromWDECTLINFO( WDECTLINFO *info, BOOL ms_lib )
{
    WdeCustControl  *control;

    control = WdeAllocCustControl();
    if( control == NULL ) {
        WdeWriteTrail( "WdeAllocCustControlFromWDECTLINFO: "
                       "WdeCustControl alloc failed!" );
        return( NULL );
    }

    control->ms_lib = ms_lib;

    if( ms_lib ) {
        memcpy( &control->control_info.ms, info, sizeof( CTLINFO ) );
    } else {
        memcpy( &control->control_info.bor, info, sizeof( WDECTLINFO ) );
    }

    return( control );
}
Beispiel #23
0
BOOL WdeFreeCustControl( WdeCustControl *control )
{
    uint_16 type;
    uint_16 num_types;

    if( control != NULL ) {
        if( !control->ms_lib ) {
            num_types = control->control_info.bor.wCtlTypes;
            for( type = 0; type < num_types; type++ ) {
                if( control->control_info.bor.Type[type].hToolBit ) {
                    DeleteObject( control->control_info.bor.Type[type].hToolBit );
                }
            }
        }
        WRMemFree( control );
    } else {
        WdeWriteTrail( "WdeFreeCustControl: NULL control!" );
        return( FALSE );
    }

    return( TRUE );
}
Beispiel #24
0
WINEXPORT LRESULT CALLBACK WdeMainWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
    HMENU       menu;
    LRESULT     ret;
    bool        pass_to_def;
    WdeResInfo  *res_info;
    WORD        wp;
    about_info  ai;

    if( WdeCleanupStarted ) {
        if( message == WM_DESTROY ) {
            PostQuitMessage( 0 );
        }
        return( DefFrameProc( hWnd, hWinWdeMDIClient, message, wParam, lParam ) );
    }

    pass_to_def = TRUE;
    ret = FALSE;
    res_info = WdeGetCurrentRes();
    menu = WdeGetMenuHandle();

    switch( message ) {
    case WM_INITMENU:
        handleInitMenu( menu );
        break;

    case WM_USER:
        WdeSetStatusByID( -1, WDE_ONLYONEINSTANCE );
        break;

    case WM_MENUSELECT:
        WdeHandleMenuSelect( wParam, lParam );
        break;

    case WM_MEASUREITEM:
        WdeHandleMeasureItem( (MEASUREITEMSTRUCT *)lParam );
        ret = TRUE;
        pass_to_def = FALSE;
        break;

    case WM_DRAWITEM:
        WdeHandleDrawItem( (DRAWITEMSTRUCT *)lParam );
        ret = TRUE;
        pass_to_def = FALSE;
        break;

    case WM_MOVE:
        if( IsZoomed( hWnd ) ) {
            WdeSetOption( WdeOptIsScreenMax, TRUE );
        } else if( !IsIconic( hWnd ) ) {
            WdeUpdateScreenPosOpt();
            WdeSetOption( WdeOptIsScreenMax, FALSE );
        }
        break;

    case WM_SIZE:
        if( wParam == SIZE_MAXIMIZED ) {
            WdeSetOption( WdeOptIsScreenMax, TRUE );
        } else if( wParam != SIZE_MINIMIZED ) {
            WdeUpdateScreenPosOpt();
            WdeSetOption( WdeOptIsScreenMax, FALSE );
        }

        if( wParam != SIZE_MINIMIZED ) {
            WdeResizeWindows();
        }

        pass_to_def = FALSE;
        break;

    case WM_COMMAND:
        wp = LOWORD( wParam );
        if( !WdeIsMenuIDValid( menu, wp ) ) {
            break;
        }
        switch( wp ) {
        case IDM_SELECT_MODE:
        case IDM_DIALOG_TOOL:
        case IDM_PBUTTON_TOOL:
        case IDM_CBUTTON_TOOL:
        case IDM_RBUTTON_TOOL:
        case IDM_GBUTTON_TOOL:
        case IDM_FRAME_TOOL:
        case IDM_TEXT_TOOL:
        case IDM_ICON_TOOL:
        case IDM_EDIT_TOOL:
        case IDM_LISTBOX_TOOL:
        case IDM_COMBOBOX_TOOL:
        case IDM_HSCROLL_TOOL:
        case IDM_VSCROLL_TOOL:
        case IDM_SIZEBOX_TOOL:
        case IDM_STATUSBAR_TOOL:
        case IDM_LISTVIEW_TOOL:
        case IDM_TREEVIEW_TOOL:
        case IDM_TABCNTL_TOOL:
        case IDM_ANIMATE_TOOL:
        case IDM_UPDOWN_TOOL:
        case IDM_TRACKBAR_TOOL:
        case IDM_PROGRESS_TOOL:
        case IDM_HOTKEY_TOOL:
        case IDM_HEADER_TOOL:
        case IDM_CUSTOM1_TOOL:
        case IDM_CUSTOM2_TOOL:
            WdeSetBaseObject( wp );
            pass_to_def = FALSE;
            break;

        case IDM_STICKY_TOOLS:
            WdeToggleStickyTools();
            pass_to_def = FALSE;
            break;

        case IDM_FMLEFT:
        case IDM_FMRIGHT:
        case IDM_FMTOP:
        case IDM_FMBOTTOM:
        case IDM_FMVCENTRE:
        case IDM_FMHCENTRE:
        case IDM_ESCAPE:
        case IDM_DELETEOBJECT:
        case IDM_SPACE_HORZ:
        case IDM_SPACE_VERT:
            ret = WdePassToEdit( message, wParam, lParam );
            pass_to_def = FALSE;
            break;

        case IDM_SELECT_DIALOG:
            WdeSelectDialog( res_info );
            pass_to_def = FALSE;
            break;

        case IDM_OPTIONS:
            WdeDisplayOptions ();
            pass_to_def = FALSE;
            break;

        case IDM_NEW_RES:
            WdeCreateNewResource( NULL );
            pass_to_def = FALSE;
            break;

        case IDM_DDE_CLEAR:
            WdeClearCurrentResource();
            pass_to_def = FALSE;
            break;

        case IDM_OPEN_RES:
            WdeOpenResource( NULL );
            pass_to_def = FALSE;
            break;

        case IDM_SAVE_RES:
            WdeSaveResource( res_info, FALSE );
            pass_to_def = FALSE;
            break;

        case IDM_SAVEAS_RES:
            WdeSaveResource( res_info, TRUE );
            pass_to_def = FALSE;
            break;

        case IDM_DDE_UPDATE_PRJ:
            WdeUpdateDDEEditSession();
            break;

        case IDM_PASTEOBJECT:
            if( FMPasteValid() ) {
                ret = WdePassToEdit( message, wParam, lParam );
            }
            pass_to_def = FALSE;
            break;

        case IDM_CUTOBJECT:
        case IDM_COPYOBJECT:
            ret = WdePassToEdit( message, wParam, lParam );
            pass_to_def = FALSE;
            break;

        case IDM_SAME_WIDTH:
            WdeSameSize( R_RIGHT );
            pass_to_def = FALSE;
            break;

        case IDM_SAME_HEIGHT:
            WdeSameSize( R_BOTTOM );
            pass_to_def = FALSE;
            break;

        case IDM_SAME_SIZE:
            WdeSameSize( R_BOTTOM | R_RIGHT );
            pass_to_def = FALSE;
            break;

        case IDM_SIZETOTEXT:
            WdeHandleSizeToText();
            pass_to_def = FALSE;
            break;

        case IDM_GOTO_INFOBAR:
            WdeSetFocusToInfo();
            pass_to_def = FALSE;
            break;

        case IDM_GOTO_OBJECT:
            WdeHandleGotoCurrentObject();
            pass_to_def = FALSE;
            break;

        case IDM_DIALOG_RESTORE:
            WdeRestoreCurrentDialog();
            pass_to_def = FALSE;
            break;

        case IDM_TAB:
        case IDM_STAB:
            WdeHandleTabEvent( wp == IDM_TAB );
            pass_to_def = FALSE;
            break;

#if 0
        /* this strategy has been rejected in favor of the hide option */
        case IDM_REMOVE_DIALOG:
            WdeRemoveDialog( res_info );
            pass_to_def = FALSE;
            break;
#endif

        case IDM_HIDE_DIALOG:
            WdeHideCurrentDialog();
            pass_to_def = FALSE;
            break;

        case IDM_TEST_MODE:
            WdeHandleTestModeMenu( res_info );
            pass_to_def = FALSE;
            break;

        case IDM_DIALOG_NEW:
            if( WdeCreateNewDialog( NULL, res_info->is32bit ) ) {
                WdeHandleGotoCurrentObject();
            }
            pass_to_def = FALSE;
            break;

        case IDM_DIALOG_SAVE:
        case IDM_DIALOG_SAVEAS:
        case IDM_DIALOG_SAVEINTO:
            WdeSaveCurrentDialog( wp );
            pass_to_def = FALSE;
            break;

        case IDM_SET_ORDER:
        case IDM_SET_TABS:
        case IDM_SET_GROUPS:
            WdeSetDialogMode( wp );
            pass_to_def = FALSE;
            break;

        case IDM_DEFINEOBJECT:
        case IDM_GEN_DEFINEOBJECT:
            if( !WdeDefineCurrentObject( wp ) ) {
                WdeWriteTrail( "WdeResWndProc: Define failed!" );
            }
            pass_to_def = FALSE;
            break;

        case IDM_MDI_CASCADE:
        case IDM_MDI_TILEV:
        case IDM_MDI_TILEH:
        case IDM_MDI_ARRANGE:
            WdeHandleMDIArrangeEvents( wp );
            pass_to_def = FALSE;
            break;

        case IDM_EXIT:
            /* clean up before we exit */
            PostMessage( hWinWdeMain, WM_CLOSE, 0, 0 );
            break;

        case IDM_SELCUST1:
        case IDM_SELCUST2:
            if( !WdeSetCurrentCustControl( wp - IDM_SELCUST1 ) ) {
                WdeWriteTrail( "WdeMainWndProc: WdeSetCurrentCustControl failed!" );
                WdeSetStatusByID( -1, WDE_SETFAILED );
            }
            pass_to_def = FALSE;
            break;

        case IDM_MS_CUSTOM:
            WdeLoadCustomLib( TRUE, FALSE );
            pass_to_def = FALSE;
            break;

#ifndef __NT__
        case IDM_BOR_CUSTOM:
            WdeLoadCustomLib( FALSE, FALSE );
            pass_to_def = FALSE;
            break;
#endif

        case IDM_LOADLIB:
            WdeLoadCustomLib( FALSE, TRUE );
            pass_to_def = FALSE;
            break;

        case IDM_WRITE_SYMBOLS:
            WdeResourceHashTableAction( res_info, WRITE_HASH );
            pass_to_def = FALSE;
            break;

        case IDM_LOAD_SYMBOLS:
            WdeResourceHashTableAction( res_info, LOAD_HASH );
            pass_to_def = FALSE;
            break;

        case IDM_VIEW_SYMBOLS:
            WdeResourceHashTableAction( res_info, VIEW_HASH );
            pass_to_def = FALSE;
            break;

        case IDM_SHOW_TOOLS:
            WdeHandleShowToolsMenu();
            pass_to_def = FALSE;
            break;

        case IDM_SHOW_RIBBON:
            WdeShowRibbon();
            pass_to_def = FALSE;
            break;

        case IDM_HELP:
            WdeHelpRoutine();
            pass_to_def = FALSE;
            break;

       case IDM_HELP_SEARCH:
            WdeHelpSearchRoutine();
            pass_to_def = FALSE;
            break;

       case IDM_HELP_ON_HELP:
            WdeHelpOnHelpRoutine();
            pass_to_def = FALSE;
            break;

       case IDM_ABOUT:
            ai.owner = hWnd;
            ai.inst = hInstWde;
            ai.name = AllocRCString( WDE_ABOUT_NAME );
            ai.version = AllocRCString( WDE_ABOUT_VERSION );
            ai.first_cr_year = "1984";
            ai.title = AllocRCString( WDE_ABOUT_TITLE );
            DoAbout( &ai );
            FreeRCString( ai.name );
            FreeRCString( ai.version );
            FreeRCString( ai.title );
            pass_to_def = FALSE;
            break;
        }
        break;

    case WM_DESTROY:
        WWinHelp( hWinWdeMain, "resdlg.hlp", HELP_QUIT, 0 );
        PostQuitMessage( 0 );
        break;

    case WDE_FATAL_EXIT:
        WdeFatalExit = TRUE;
        WdeQueryKillApp( TRUE );
        PostMessage( hWinWdeMain, WM_CLOSE, 0, 0 );
        break;

    case WM_ENDSESSION:
        if ( !wParam ) {
            WdeFatalExit = FALSE;
        }
        break;

    case WM_QUERYENDSESSION:
        ret = WdeQueryKillApp( FALSE );
        if( ret ) {
            WdeFatalExit = TRUE;
            pass_to_def = FALSE;
        }
        break;

    case WM_CLOSE:
        // this prevents the user from closing the editor during
        // DDE initialization
        if( !wParam && !EnableMenuInput ) {
            return( 0 );
        }
        /* clean up before we exit */
        WdeCleanupStarted = TRUE;
        if( wParam ) {  // wParam is non-zero if the DDE connection died
            WdeFatalExit = TRUE;
            WdeQueryKillApp( TRUE );
            wParam = 0;
        }
        if( !WdeCleanup( res_info, WdeFatalExit ) ) {
            WdeCleanupStarted = FALSE;
            pass_to_def = FALSE;
        }
    }

    if( pass_to_def ) {
        ret = DefFrameProc( hWnd, hWinWdeMDIClient, message, wParam, lParam );
    }
    return( ret );
}
Beispiel #25
0
BOOL WdeLoadBorCustomControls ( WdeCustLib *lib )
{
    WdeListClassesProc   list_proc;
    HGLOBAL              list_global;
    uint_8              *list_locked;
    uint_16              num_classes;
    WdeBorlandClassList *class_list;
    uint_32              class_list_size;

    /* touch unused var to get rid of warning */
    _wde_touch( lib );

    list_proc = (WdeListClassesProc) GetProcAddress(lib->inst, "ListClasses");

    if ( list_proc == NULL ) {
        if ( WdeQueryAssumeMS () ) {
            lib->ms_lib = TRUE;
            return ( WdeLoadMSCustomControls ( lib ) );
        } else {
            WdeWriteTrail("WdeLoadBorCustomControls: User aborted load!");
            return ( FALSE );
        }
    }

    if ( WdeCustLOADRESInst == NULL ) {
        WdeCustLOADRESInst = MakeProcInstance ( (FARPROC) WdeCustLOADRES,
                                                WdeGetAppInstance() );
    }

    if ( WdeCustEDITRESInst == NULL ) {
        WdeCustEDITRESInst = MakeProcInstance ( (FARPROC) WdeCustEDITRES,
                                                WdeGetAppInstance() );
    }

#if 0
    list_global = (*list_proc) ( "WdeMainClass", WDE_VERSION,
                                 (LPFNLOADRES) WdeCustLOADRES,
                                 (LPFNEDITRES) WdeCustEDITRES );
#else
    list_global = (*list_proc) ( "WdeMainClass", WDE_VERSION,
                                 (LPFNLOADRES) WdeCustLOADRESInst,
                                 (LPFNEDITRES) WdeCustEDITRESInst );
#endif

    if ( list_global == NULL ) {
        WdeWriteTrail("WdeLoadBorCustomControls: ListClasses returned NULL!");
        return ( FALSE );
    }

    list_locked = (uint_8 *) GlobalLock ( list_global );
    if ( list_locked == NULL ) {
        WdeWriteTrail("WdeLoadBorCustomControls: Could lock global memory!");
        GlobalFree( list_global );
        return ( FALSE );
    }

    num_classes = *((uint_16 *) list_locked);

    class_list_size = sizeof(WdeBorlandClassList) +
                      (num_classes-1) * sizeof(WdeBorlandCtlClass);

    class_list = ( WdeBorlandClassList *) WdeMemAlloc ( class_list_size );
    if ( class_list == NULL ) {
        WdeWriteTrail("WdeLoadBorCustomControls: class list alloc failed!");
        GlobalUnlock ( list_global );
        GlobalFree( list_global );
        return ( FALSE );
    }

    memcpy ( class_list, list_locked, class_list_size );

    lib->class_list = list_global;

    if ( !WdeAddBorControlsToCustLib ( lib, class_list ) ) {
        WdeWriteTrail("WdeLoadBorCustomControls: Add to CustLib failed!");
        WdeMemFree    ( class_list );
        GlobalUnlock ( list_global );
        GlobalFree   ( list_global );
        return ( FALSE );
    }

    WdeMemFree    ( class_list );
    GlobalUnlock ( list_global );

    WdeMemValidate ( lib );

    return ( TRUE );
}
Beispiel #26
0
Bool WdeLoadCustomLib ( Bool ms_lib, Bool load_only )
{
    char              *name;
    HINSTANCE          inst;
    WdeCustLib        *lib;
    BOOL               ret;
    WdeGetFileStruct   gf;

    gf.file_name = NULL;
    gf.title     = WdeCustOpenTitle;
    gf.filter    = WdeCustFilter;

    name = WdeGetOpenFileName ( &gf );

    if ( !name ) {
        return ( FALSE );
    }

    inst = LoadLibrary ( name );

    if ( inst <= HINSTANCE_ERROR ) {
        WdeWriteTrail("WdeLoadCustomLib: LoadLibrary call failed!");
        WdeMemFree ( name );
        return ( FALSE );
    }

    lib = WdeAllocCustLib ();
    if ( lib == NULL ) {
        WdeWriteTrail("WdeLoadCustomLib: WdeAllocCustLib failed!");
        WdeMemFree ( name );
        FreeLibrary ( inst );
        return ( FALSE );
    }

    lib->inst      = inst;
    lib->ms_lib    = ms_lib;
    lib->load_only = load_only;
    lib->file_name = name;

    if( load_only ) {
        WdeSetStatusByID( -1, WDE_LIBRARYLOADED );
        ret = TRUE;
    } else {
        if( ms_lib ) {
            ret = WdeLoadMSCustomControls( lib );
        } else {
            ret = WdeLoadBorCustomControls( lib );
        }
    }

    if ( !ret ) {
        WdeFreeCustLib ( lib );
        return ( FALSE );
    }

    if ( load_only ) {
        WdeInsertObject ( &WdeLibList, (void *) lib );
    } else {
        WdeInsertObject ( &WdeCustomLibList, (void *) lib );
    }

    return( TRUE );
}
Beispiel #27
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 );
}
Beispiel #28
0
void WdeWriteInfo( WdeInfoStruct *is )
{
    static WdeHashTable *last_table = NULL;
    static WdeResInfo   *last_res = NULL;
    static OBJ_ID       last_obj = 0;
    char                *cap_text, *id;
    bool                same_hash;

    if( WdeInfoWindowDepth == 0 || WdeInfoWindow == NULL ) {
        return;
    }

    if( is == NULL || is->obj == NULL || is->res_info == NULL ) {
        WdeWriteTrail( "WdeWriteDialogInfo: NULL parameter!" );
        return;
    }

    /* make sure the resource window is not robbed of focus */
    if( GetFocus() != is->res_info->res_win ) {
        SetFocus( is->res_info->res_win );
    }

    WdeCurrentInfo = *is;

    same_hash = (last_res == is->res_info && last_table == is->res_info->hash_table);

    WdeWriteSymInfo( is, same_hash, NULL );

    last_table = is->res_info->hash_table;
    last_res = is->res_info;

    if( is->obj_id == BASE_OBJ ) {
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_SIZE );
        WdeEnableInfoWindowInput( FALSE );
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_CAPTION );
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_IDSTR );
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_IDNUM );
    } else {
        WdeWriteObjectDimensions( (int_16)is->size.x, (int_16)is->size.y,
                                  (int_16)is->size.width, (int_16)is->size.height );
        WdeEnableInfoWindowInput( TRUE );
        if( is->obj_id == DIALOG_OBJ ) {
            WdeDisplayDialogInfo( is );
        } else if( is->obj_id == CONTROL_OBJ ) {
            WdeDisplayControlInfo( is );
        }
    }

    if( last_obj != is->obj_id ) {
        if( is->obj_id == DIALOG_OBJ ) {
            cap_text = WdeCaptionText;
            id = WdeDlgNameText;
        } else if( is->obj_id == CONTROL_OBJ ) {
            cap_text = WdeTextText;
            id = WdeIDText;
        } else if( is->obj_id == BASE_OBJ ) {
            cap_text = "";
            id       = "";
        }
        WdeSetEditWithStr( cap_text, WdeInfoWindow, IDB_INFO_CAPTEXT );
        WdeSetEditWithStr( id, WdeInfoWindow, IDB_INFO_NAMETEXT );
        last_obj = is->obj_id;
    }
}