Esempio n. 1
0
bool WREStatusHookProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    /* touch unused vars to get rid of warning */
    _wre_touch( hWnd );
    _wre_touch( wParam );
    _wre_touch( lParam );

    if( msg == WM_DESTROY ) {
        WREStatusWindow = NULL;
    }

    return( false );
}
Esempio n. 2
0
void WRERibbonHelpHook( HWND hwnd, WPARAM wParam, BOOL pressed )
{
    _wre_touch( hwnd );

    if( !pressed ) {
        WRESetStatusText( NULL, "", TRUE );
    } else {
        WREDisplayHint( wParam );
    }
}
Esempio n. 3
0
BOOL WRERibbonHook( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    Bool         ret;

    _wre_touch( hwnd );
    _wre_touch( wParam );
    _wre_touch( lParam );

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

    ret = FALSE;

    switch( msg ) {
    case WM_DESTROY:
        WRECloseToolBar( WRERibbon );
        WRERibbon = NULL;
        break;
    }

    return( ret );
}
Esempio n. 4
0
UINT WINEXPORT WREOpenHookProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    char    *title;

    _wre_touch( wparam );
    _wre_touch( lparam );

    switch( msg ) {
    case WM_INITDIALOG:
        // We must call this to subclass the directory listbox even
        // if the app calls Ctl3dAutoSubclass (commdlg bug)
        //WRECtl3dSubclassDlg( hwnd, CTL3D_ALL );

        title = WREAllocRCString( WRE_GETFNCOMBOTITLE );
        if( title != NULL ) {
            SendDlgItemMessage( hwnd, stc2, WM_SETTEXT, 0, (LPARAM)title );
            WREFreeRCString( title );
        }
        return( TRUE );
    }

    return( FALSE );
}
Esempio n. 5
0
bool WRESetStatusText( const char *status1, const char *status2, int redisplay )
{
    int len;
    int pos;

    /* touch unused vars to get rid of warning */
    _wre_touch( redisplay );

    if( WREStatusWindow == NULL ) {
        return( true );
    }

    if( status1 != NULL ) {
        len = strlen( status1 );
        if( len > MAX_STATUS_TEXT )
            len = MAX_STATUS_TEXT;
        if( len != 0 ) {
            memcpy( WREStatusText, status1, len );
            pos = len;
        } else {
            WREStatusText[0] = ' ';
            pos = 1;
        }
    } else {
        pos = 0;
    }

    if( status2 != NULL ) {
        WREStatusText[pos++] = STATUS_ESC_CHAR;
        WREStatusText[pos++] = STATUS_NEXT_BLOCK;
        len = strlen( status2 );
        if( len > MAX_STATUS_TEXT )
            len = MAX_STATUS_TEXT;
        if( len != 0 ) {
            memcpy ( WREStatusText + pos, status2, len );
            WREStatusText[pos + len] = '\0';
        } else {
            WREStatusText[pos++] = ' ';
            WREStatusText[pos]   = '\0';
        }
    } else {
        WREStatusText[pos++] = '\0';
    }

    if( status1 != NULL || status2 != NULL ) {
        return( WREDisplayStatusText( WREStatusText ) );
    }

    return( true );
}
Esempio n. 6
0
void WREActivateResourceWindow( WREResInfo *res_info, WPARAM wParam, LPARAM lParam )
{
    WREResInfo  *info;
    Bool        fActivate;
    HWND        hwndDeact;

    _wre_touch( wParam );

    if( res_info != NULL ) {
        fActivate = GET_WM_MDIACTIVATE_FACTIVATE( res_info->res_win, wParam, lParam );
        hwndDeact = GET_WM_MDIACTIVATE_HWNDDEACTIVATE( wParam, lParam );
        res_info->active = fActivate;
        if( fActivate ) {
            WRESetCurrentRes( res_info );
            if( res_info->info_win != (HWND)NULL ) {
                SetFocus( res_info->info_win );
            }
            info = WREResInfoFromWin( hwndDeact );
            if( info != NULL ) {
                info->active = FALSE;
            }
        }
    }
}
Esempio n. 7
0
int PASCAL WinMain( HINSTANCE hinstCurrent, HINSTANCE hinstPrevious,
                    LPSTR lpszCmdLine, int nCmdShow )
{
    extern char **_argv;
    extern int  _argc;
    MSG         msg;
    Bool        ret;

    /* touch unused vars to get rid of warning */
    _wre_touch( lpszCmdLine );
    _wre_touch( nCmdShow );
#ifdef __NT__
    _wre_touch( hinstPrevious );
#endif

    WRInit();
    WAccelInit();
    WMenuInit();
    WStringInit();
    WREInitDisplayError( hinstCurrent );

    /* store the handle to this instance of WRE in a static variable */
    WREInst = hinstCurrent;

    peekArgs( _argv, _argc );

    /* is this the first instance of the application? */
#ifndef __NT__
    if( hinstPrevious == NULL ) {
#endif
        /* if so call the routine to initialize the application */
        if( !WREInit( hinstCurrent ) ) {
            return( FALSE );
        }
#ifndef __NT__
    }
#endif

    if( !WREInitInst( hinstCurrent ) ) {
        WREDisplayErrorMsg( WRE_INITFAILED );
        return( FALSE );
    }

    if( !WREDDEStart( hinstCurrent ) ) {
        WREDisplayErrorMsg( WRE_DDEINITFAILED );
        return( FALSE );
    }

    ret = WREProcessArgs( _argv, _argc );

    startEditors();

    // create a new empty res if none have been created at this point
    if( ret && WREGetNumRes() == 0 ) {
        WRECreateNewResource( NULL );
    }

    /* create the message loop */
    while( GetMessage( &msg, (HWND)NULL, 0, 0 ) ) {
        if( !WREIsEditWindowDialogMessage( &msg ) &&
                !WREWasAcceleratorHandled( &msg ) &&
                !WREIsResInfoWinMsg( &msg ) &&
                !WRIsWRDialogMsg( &msg ) ) {
            TranslateMessage( &msg );
            DispatchMessage( &msg );
        }
    }

    WREDDEEnd();
    WStringFini();
    WMenuFini();
    WAccelFini();
    WRFini();

    return( msg.wParam );
}
Esempio n. 8
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 );
}
Esempio n. 9
0
HDDEDATA CALLBACK DdeCallBack( UINT wType, UINT wFmt, HCONV hConv,
                                HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
                                ULONG_PTR lData1, ULONG_PTR lData2 )
{
    HDDEDATA    ret;
    HSZPAIR     hszpair[2];
    HSZ         htopic;
    HCONV       htconv;
    void        *data;
    uint_32     size;
    bool        ok;

    _wre_touch( hdata );
    _wre_touch( lData1 );
    _wre_touch( lData2 );

    ret = (HDDEDATA)FALSE;

    switch( wType ) {
    case XTYP_CONNECT:
    case XTYP_WILDCONNECT:
        if( PendingService == NoServicePending ) {
            htopic = (HSZ)NULL;
        } else {
            htopic = (HSZ)Topics[PendingService].htopic;
        }
        break;
    }

    switch( wType ) {
    case XTYP_CONNECT_CONFIRM:
        htconv = (HCONV)NULL;
        if( PendingService != NoServicePending ) {
                htconv = DdeConnect( IdInst, EditServers[PendingService].hservice,
                                     EditServers[PendingService].htopic, (LPVOID)NULL );
        }
        if( htconv != (HCONV)NULL ) {
            if( PendingService == DialogService ) {
                ok = WRECommitDialogSession( hConv, htconv );
            } else {
                ok = WRECommitImageSession( hConv, htconv );
            }
            if( !ok ) {
                DdeDisconnect( htconv );
                DdeDisconnect( hConv );
            }
        } else {
            DdeDisconnect( hConv );
        }
        break;

    case XTYP_DISCONNECT:
        if( !WREEndEditImageResource( hConv ) ) {
            WREEndEditDialogResource( hConv );
        }
        break;

    case XTYP_CONNECT:
        if( hsz1 == hDialogDump ) {
            WREDumpPendingDialogSession();
        } else if( hsz1 == hImageDump ) {
            WREDumpPendingImageSession();
        } else if( hsz1 == htopic ) {
            ret = (HDDEDATA)TRUE;
        }
        break;

    case XTYP_WILDCONNECT:
        if( hsz2 != hServiceName ) {
            break;
        }
        if( htopic == (HSZ)NULL ) {
            break;
        }
        hszpair[0].hszSvc = hServiceName;
        hszpair[0].hszTopic = htopic;
        hszpair[1].hszSvc = (HSZ)NULL;
        hszpair[1].hszTopic = (HSZ)NULL;
        ret = (HDDEDATA)DdeCreateDataHandle( IdInst, (LPBYTE)&hszpair[0], sizeof( hszpair ),
                                             0L, 0, CF_TEXT, 0 );
        break;

    case XTYP_REQUEST:
        data = NULL;
        size = 0;
        ok = false;
        if( hsz1 == Topics[DialogService].htopic ) {
            if( hsz2 == hFileItem ) {
                ok = WREGetDlgSessionFileName( hConv, &data, &size );
            } else if( hsz2 == hDataItem ) {
                ok = WREGetDlgSessionData( hConv, &data, &size );
            } else if( hsz2 == hNameItem ) {
                ok = WREGetDlgSessionResName( hConv, &data, &size );
            } else if( hsz2 == hIs32BitItem ) {
                ok = WREGetDlgSessionIs32Bit( hConv, &data, &size );
            }
        } else if( hsz1 == Topics[BitmapService].htopic ||
                   hsz1 == Topics[CursorService].htopic ||
                   hsz1 == Topics[IconService].htopic ) {
            if( hsz2 == hFileItem ) {
                ok = WREGetImageSessionFileName( hConv, &data, &size );
            } else if( hsz2 == hDataItem ) {
                ok = WREGetImageSessionData( hConv, &data, &size );
            } else if( hsz2 == hNameItem ) {
                ok = WREGetImageSessionResName( hConv, &data, &size );
            }
        }
        if( data != NULL ) {
            if( ok ) {
                ret = DdeCreateDataHandle( IdInst, (LPBYTE)data, size, 0, hsz2, wFmt, 0 );
            }
            WRMemFree( data );
        }
        break;

    case XTYP_POKE:
        data = NULL;
        size = 0;
        ok = false;
        ret = (HDDEDATA)DDE_FNOTPROCESSED;
        if( hsz1 == Topics[DialogService].htopic ) {
            if( hsz2 == hDataItem ) {
                ok = WRESetDlgSessionResData( hConv, hdata );
            } else if( hsz2 == hNameItem ) {
                ok = WRESetDlgSessionResName( hConv, hdata );
            }
        } else if( hsz1 == Topics[BitmapService].htopic ||
                   hsz1 == Topics[CursorService].htopic ||
                   hsz1 == Topics[IconService].htopic ) {
            if( hsz2 == hDataItem ) {
                ok = WRESetImageSessionResData( hConv, hdata );
            } else if( hsz2 == hNameItem ) {
                ok = WRESetImageSessionResName( hConv, hdata );
            }
        }
        ret = (HDDEDATA)DDE_FACK;
        break;
    }

    return( ret );
}
Esempio n. 10
0
bool WREDDEStart( HINSTANCE inst )
{
    UINT        ret;
    DWORD       flags;
    int         i;

    _wre_touch( inst ); /* MakeProcInstance vanishes in NT */

    if( IdInst != 0 ) {
        return( FALSE );
    }

    DdeProc = MakeProcInstance( (FARPROC)DdeCallBack, inst );
    if( DdeProc == (FARPROC)NULL ) {
        return( FALSE );
    }

    flags = APPCLASS_STANDARD | APPCMD_FILTERINITS |
            CBF_FAIL_ADVISES | CBF_FAIL_SELFCONNECTIONS |
            CBF_SKIP_REGISTRATIONS | CBF_SKIP_UNREGISTRATIONS;

    ret = DdeInitialize( &IdInst, (PFNCALLBACK)DdeProc, flags, 0 );
    if( ret != DMLERR_NO_ERROR ) {
        return( FALSE );
    }

    for( i = 0; i < NUM_SERVERS; i++ ) {
        EditServers[i].htopic = DdeCreateStringHandle( IdInst, EditServers[i].topic, CP_WINANSI );
        if( EditServers[i].htopic == (HSZ)NULL ) {
            return( FALSE );
        }
        EditServers[i].hservice = DdeCreateStringHandle( IdInst, EditServers[i].service, CP_WINANSI );
        if( EditServers[i].hservice == (HSZ)NULL ) {
            return( FALSE );
        }
    }

    for( i = 0; i < NUM_TOPICS; i++ ) {
        Topics[i].htopic = DdeCreateStringHandle( IdInst, Topics[i].topic, CP_WINANSI );
        if( Topics[i].htopic == (HSZ)NULL ) {
            return( FALSE );
        }
    }

    hDialogDump = DdeCreateStringHandle( IdInst, WRE_DIALOG_DUMP, CP_WINANSI );
    if( hDialogDump == (HSZ)NULL ) {
        return( FALSE );
    }

    hImageDump = DdeCreateStringHandle( IdInst, WRE_IMAGE_DUMP, CP_WINANSI );
    if( hImageDump == (HSZ)NULL ) {
        return( FALSE );
    }

    hServiceName = DdeCreateStringHandle( IdInst, WRE_SERVICE_NAME, CP_WINANSI );
    if( hServiceName == (HSZ)NULL ) {
        return( FALSE );
    }

    hFileItem = DdeCreateStringHandle( IdInst, WRE_FILE_ITEM, CP_WINANSI );
    if( hFileItem == (HSZ)NULL ) {
        return( FALSE );
    }

    hIs32BitItem = DdeCreateStringHandle( IdInst, WRE_32BIT_ITEM, CP_WINANSI );
    if( hIs32BitItem == (HSZ)NULL ) {
        return( FALSE );
    }

    hDataItem = DdeCreateStringHandle( IdInst, WRE_DATA_ITEM, CP_WINANSI );
    if( hDataItem == (HSZ)NULL ) {
        return( FALSE );
    }

    hNameItem = DdeCreateStringHandle( IdInst, WRE_NAME_ITEM, CP_WINANSI );
    if( hNameItem == (HSZ)NULL ) {
        return( FALSE );
    }

    DdeNameService( IdInst, hServiceName, (HSZ)NULL, DNS_REGISTER );

    return( TRUE );
}