Exemplo n.º 1
0
/*
 * GetsnoopStringDialog - create dialog settings
 */
bool GetSnoopStringDialog( fancy_find **ff )
{
    FARPROC     proc;
    bool        rc;

#ifdef __NT__
    if( hInstShell == NULL ) {
        hInstShell = GetModuleHandle( "SHELL32.DLL" );
        pfnSHBrowseForFolder = (PFNSHBFF)GetProcAddress( hInstShell, "SHBrowseForFolderA" );
        pfnSHGetPathFromIDList = (PFNSHGPFIL)GetProcAddress( hInstShell, "SHGetPathFromIDListA" );
    }
#endif

    /* set case_ignore and extension defaults based on global settings
     * all other values are saved from the last fgrep before
     */
    snoopData.case_ignore = EditFlags.CaseIgnore;
    ReplaceString( &snoopData.ext, EditVars.GrepDefault );
    *ff = &snoopData; /* data is no longer copied */
    proc = MakeDlgProcInstance( SnoopDlgProc, InstanceHandle );
#ifdef __NT__
    if( pfnSHBrowseForFolder != NULL ) {
        rc = DialogBox( InstanceHandle, "SNOOPDLG95", root_window_id, (DLGPROC)proc );
    } else {
#endif
        rc = DialogBox( InstanceHandle, "SNOOPDLG", root_window_id, (DLGPROC)proc );
#ifdef __NT__
    }
#endif
    FreeProcInstance( proc );
    SetWindowCursor();
    return( rc );

} /* GetsnoopStringDialog */
Exemplo n.º 2
0
/*
 * InitGrepDialog - start the grep dialog
 */
void InitGrepDialog( void )
{
    grepProc = MakeDlgProcInstance( GrepDlgProc, InstanceHandle );
    cancelPressed = false;
    grepHwnd = CreateDialog( InstanceHandle, "GREPDLG", Root, (DLGPROC)grepProc );

} /* InitGrepDialog */
Exemplo n.º 3
0
/*
 * SpyLogOpen - open the log file
 */
BOOL SpyLogOpen( void )
{
    int         f;
    WORD        flags;
    FARPROC     fp;
    INT_PTR     ret;
    char        *msgtitle;

    flags = 0;
    if( !LogCurInfo.init ) {
        SetLogDef();
    }
    if( LogCurInfo.config.query_for_name ) {
        if( !getLogName( LogCurInfo.config.name, LogCurInfo.hwnd ) ) {
            return( FALSE );
        }
    }
    strcpy( LogCurInfo.config.curname, LogCurInfo.config.name );
    switch( LogCurInfo.config.def_action ) {
    case LOG_ACTION_TRUNC:
        flags = O_TRUNC;
        break;
    case LOG_ACTION_APPEND:
        flags = O_APPEND;
        break;
    case LOG_ACTION_QUERY:
        if( !access( LogCurInfo.config.curname, F_OK ) ) {
            fp = MakeDlgProcInstance( LogExistsDlgProc, LogCurInfo.instance );
            ret = DialogBox( LogCurInfo.instance, "LOG_EXISTS_DLG", LogCurInfo.hwnd, (DLGPROC)fp );
            FreeProcInstance( fp );
            switch( ret ) {
            case LOG_APPEND:
                flags = O_APPEND;
                break;
            case LOG_REPLACE:
                flags = O_TRUNC;
                break;
            case LOG_CANCEL:
                return( FALSE );
            }
        }
        break;
    }
    f = open( LogCurInfo.config.curname, O_TEXT | O_WRONLY | O_CREAT | flags, S_IREAD | S_IWRITE );
    if( f < 0 ) {
        msgtitle = AllocRCString( LOG_LOG_ERROR );
        RCMessageBox( LogCurInfo.hwnd, LOG_CANT_OPEN_LOG, msgtitle,
                      MB_OK | MB_ICONEXCLAMATION );
        FreeRCString( msgtitle );
        return( FALSE );
    }
    if( LogCurInfo.writefn != NULL ) {
        LogCurInfo.writefn( f );
    }
    close( f );
    LogCurInfo.config.logging = TRUE;
    LogCurInfo.config.paused = FALSE;
    return( TRUE );

} /* SpyLogOpen */
Exemplo n.º 4
0
/*
 * UsageDialog - show the startup dialog
 */
void UsageDialog( char **list, char *msg, int cnt )
{
    FARPROC     proc;

    usageList = list;
    usageStr = msg;
    usageCnt = cnt;

    proc = MakeDlgProcInstance( UsageProc, InstanceHandle );
    DialogBox( InstanceHandle, "Usage", root_window_id, (DLGPROC)proc );
    FreeProcInstance( proc );

} /* UsageDialog */
Exemplo n.º 5
0
/*
 * GetLineDialog - create dialog box & get result
 */
bool GetLineDialog( linenum *line )
{
    FARPROC     proc;
    bool        rc;

    lineStr[0] = '\0';
    lineVal = line;
    proc = MakeDlgProcInstance( GotoLineDlgProc, InstanceHandle );
    rc = DialogBox( InstanceHandle, "LINEDLG", Root, (DLGPROC)proc );
    FreeProcInstance( proc );
    SetWindowCursor();
    return( rc );

} /* GetLineDialog */
Exemplo n.º 6
0
/*
 * GetSetGenDialog - create dialog box & get result
 */
bool GetSetGenDialog( void )
{
    FARPROC     proc;
    bool        rc;

    proc = MakeDlgProcInstance( SetGenProc, InstanceHandle );
    rc = DialogBox( InstanceHandle, "SETGEN", Root, (DLGPROC)proc );
    FreeProcInstance( proc );

    // redisplay all files to ensure screen completely correct
    ReDisplayBuffers( false );
    return( rc );

} /* GetSetGenDialog */
Exemplo n.º 7
0
/*
 * ProcessMark - start a mark dialog
 */
void ProcessMark( HWND owner, HANDLE instance, void (*func)( char * ) )
{
    FARPROC             fp;

    if( WriteFn != NULL ) {
        return;
    }
    WriteFn = func;
    fp = MakeDlgProcInstance( MarkDlgProc, instance );
    DialogBox( instance, "MARK_DLG", owner, (DLGPROC)fp );
    FreeProcInstance( fp );
    WriteFn = NULL;

} /* ProcessMark */
Exemplo n.º 8
0
/*
 * LogConfigure - display a dialog to let the user configure log features
 */
void LogConfigure( void )
{
    FARPROC     fp;

    if( !LogCurInfo.init ) {
        SetLogDef();
    }
    if( LogCurInfo.config.type == LOG_TYPE_BUFFER ) {
        flushLog( TRUE );
    }
    fp = MakeDlgProcInstance( ConfigLogDlgProc, LogCurInfo.instance );
    DialogBox( LogCurInfo.instance, "LOG_CFG_DLG", LogCurInfo.hwnd, (DLGPROC)fp );
    FreeProcInstance( fp );

} /* LogConfigure */
Exemplo n.º 9
0
/*
 * Query4Aliases - display the alias list dialog box
 */
void Query4Aliases( AliasHdl hdl, HANDLE instance, HWND hwnd, char *title )
{
    FARPROC     fp;
    INT_PTR     ret;

    CurHdl = hdl;
    fp = MakeDlgProcInstance( AliasDlgProc, instance );
    for( ;; ) {
        ret = DialogBoxParam( instance, "ALIAS_DLG", hwnd, (DLGPROC)fp, (LPARAM)title );
        if( ret != ALIAS_DO_MORE ) {
            break;
        }
    }
    FreeProcInstance( fp );
    CurHdl = NULL;

} /* Query4Aliases */
Exemplo n.º 10
0
/*
 * RefreshSSbar - turn status settings bar on/off
 */
void RefreshSSbar( void )
{
    static FARPROC      proc = NULL;

    if( EditFlags.SSbar ) {
        if( !BAD_ID( hSSbar ) ) {
            return;
        }
        proc = MakeDlgProcInstance( SSDlgProc, InstanceHandle );
        hSSbar = CreateDialog( InstanceHandle, "SSBAR", root_window_id, (DLGPROC)proc );
    } else {
        if( BAD_ID( hSSbar ) ) {
            return;
        }
        SendMessage( hSSbar, WM_CLOSE, 0, 0L );
        FreeProcInstance( proc );
    }
    UpdateStatusWindow();

} /* RefreshSSbar */
Exemplo n.º 11
0
/*
 * RefreshFontbar - turn font bar on/off to reflect current editflag state
 */
void RefreshFontbar( void )
{
    static FARPROC  proc = NULL;

    if( EditFlags.Fontbar ) {
        if( hFontbar != NULL ) {
            return;
        }
        proc = MakeDlgProcInstance( FtDlgProc, InstanceHandle );
        hFontbar = CreateDialog( InstanceHandle, "FTBAR", Root, (DLGPROC)proc );
        SetMenuHelpString( "Ctrl affects all syntax elements" );
    } else {
        if( hFontbar == NULL ) {
            return;
        }
        SendMessage( hFontbar, WM_CLOSE, 0, 0L );
        FreeProcInstance( proc );
        SetMenuHelpString( "" );
    }
    UpdateStatusWindow();

} /* RefreshFontbar */
Exemplo n.º 12
0
/*
 * AboutProc - callback routine for settings dialog
 */
WINEXPORT INT_PTR CALLBACK AboutProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    char        buff[256];
    LPABOUTINFO pai;

    lparam = lparam;

    switch( msg ) {
    case WM_INITDIALOG:
        pai = (LPABOUTINFO)lparam;
        if( pai->title != NULL ) {
            SetWindowText( hwnd, pai->title );
        }
        if( pai->name != NULL ) {
            sprintf( buff, banner1p1( "%s" ), pai->name );
            SetDlgItemText( hwnd, ABOUT_NAME, buff );
        }
        if( pai->version != NULL ) {
            SetDlgItemText( hwnd, ABOUT_VERSION, pai->version );
        }
        if( pai->first_cr_year != NULL ) {
#if defined( __WATCOMC__) && !defined( __ALPHA__ )
            if( _fstrcmp( pai->first_cr_year, CURR_YEAR ) ) {
#else
            if( strcmp( pai->first_cr_year, CURR_YEAR ) ) {
#endif
                sprintf( buff, banner2a( "%s" ), pai->first_cr_year );
            } else {
                strcpy( buff, banner2a( "1984" ) );
            }
            SetDlgItemText( hwnd, ABOUT_COPYRIGHT, buff );
        }
#if defined( __WINDOWS__ ) || defined( __WINDOWS_386__ )
        {
            DWORD       flags;
            DWORD       kfree;
            WORD        pcfree;
            SYSHEAPINFO shi;
            char        work[16];
            char        info[50];

            flags = GetWinFlags();
            if( flags & WF_ENHANCED ) {
                CopyRCString( ABT_386_ENH, info, sizeof( info ) );
            } else {
                CopyRCString( ABT_STD_MODE, info, sizeof( info ) );
            }
            SetDlgItemText( hwnd, ABOUT_INFO1, info );
            kfree = GetFreeSpace( 0 ) / 1024L;
            ltoa( kfree, work, 10 );
            RCsprintf( buff, ABT_MEM_X_KB_FREE, (LPSTR)work );
            SetDlgItemText( hwnd, ABOUT_INFO2, buff );

            shi.dwSize = sizeof( shi );
            if( SystemHeapInfo( &shi ) ) {
                pcfree = shi.wGDIFreePercent;
                if( pcfree > shi.wUserFreePercent )
                    pcfree = shi.wUserFreePercent;
                RCsprintf( buff, ABT_SYS_RESOURCES_FREE, pcfree );
            } else {
                CopyRCString( ABT_SYS_RESOURCES_N_A, buff, sizeof( buff ) );
            }
            SetDlgItemText( hwnd, ABOUT_INFO3, buff );
        }
#else
        {
            SYSTEM_INFO         si;
            MEMORYSTATUS        ms;

            GetSystemInfo( &si );
            switch( si.dwProcessorType ) {
            case PROCESSOR_INTEL_386:
                CopyRCString( ABT_RUNNING_ON_386, buff, sizeof( buff ) );
                break;
            case PROCESSOR_INTEL_486:
                CopyRCString( ABT_RUNNING_ON_486, buff, sizeof( buff ) );
                break;
            case PROCESSOR_INTEL_PENTIUM:
                CopyRCString( ABT_RUNNING_ON_586, buff, sizeof( buff ) );
                break;
            case PROCESSOR_MIPS_R4000:
            case PROCESSOR_ALPHA_21064:
            default:
                buff[0] = '\0';
                break;
            }
            SetDlgItemText( hwnd, ABOUT_INFO1, buff );

            ms.dwLength = sizeof( ms );
            GlobalMemoryStatus( &ms );
            RCsprintf( buff, ABT_VIRT_MEM,
                       (ms.dwAvailPhys + ms.dwAvailPageFile) / 1024L );
            SetDlgItemText( hwnd, ABOUT_INFO2, buff );
            RCsprintf( buff, ABT_MEM_LOAD, ms.dwMemoryLoad );
            SetDlgItemText( hwnd, ABOUT_INFO3, buff );

        }
#endif
        return( TRUE );
#ifndef NOUSE3D
    case WM_SYSCOLORCHANGE:
        CvrCtl3dColorChange();
        break;
#endif
    case WM_CLOSE:
        EndDialog( hwnd, 0 );
        break;
    case WM_COMMAND:
        switch( LOWORD( wparam ) ) {
        case IDOK:
        case IDCANCEL:
            EndDialog( hwnd, 0 );
            break;
        }
    }
    return( FALSE );

} /* AboutProc */

/*
 * DoAbout - show the startup dialog
 */
void DoAbout( LPABOUTINFO ai )
{
    FARPROC     proc;

    proc = MakeDlgProcInstance( AboutProc, ai->inst );
    DialogBoxParam( ai->inst, "About", ai->owner, (DLGPROC)proc, (LPARAM)ai );
    FreeProcInstance( proc );

} /* DoAbout */