예제 #1
0
void GUImain( void )
{
    char        buff[256];
    char        *p;

    WndMaxDirtyRects = 20;
    getcmd( buff );
    p = buff;
    while( *p == ' ' ) ++p;
    if( p[0] == '-' && p[1] == 'n' ) {
        WndStyle &= ~GUI_GMOUSE;
        p += 2;
    }
    while( *p == ' ' ) ++p;
    if( p[0] == '-' && p[1] == '1' ) {
        #ifdef __DOS__
            BIOSSetPage( 1 ); // just make sure it works for the debugger
        #endif
        p += 2;
    }
    WndGadgetInit();
    WndInit( "Sample Application" );
    WndCreateStatusWindow( &WndColours[GUI_MENU_STANDOUT] );
    GUIGetDialogColours( WndDlgColours );
    WndStatusText( "Hello World!" );
    WndSetIcon( WndMain, &MainIcon );
    WndMainMenuProc( WndMain, MENU_OPEN1 );
} // returning starts the events rolling
예제 #2
0
bool    WndProcMacro( a_window wnd, gui_key key )
{
    gui_ctl_id  menu;
    int         i;

    WndStatusText( "" );
    for( i = 0; i < ArraySize( Key ); ++i ) {
        if( Key[i].key == key ) {
            WndStatusText( Key[i].name );
            break;
        }
    }
    switch( key ) {
    case GUI_KEY_PERIOD:
        WndKeyPopUp( wnd, NULL );
        return( true );
    case GUI_KEY_EQUAL: menu = MENU_MATCH; break;
    case GUI_KEY_n: menu = MENU_NEXT; break;
    case GUI_KEY_p: menu = MENU_PREV; break;
    case GUI_KEY_q: menu = MENU_QUIT; break;
    case GUI_KEY_1: menu = MENU_OPEN1; break;
    case GUI_KEY_a: menu = MENU_OPEN1A; break;
    case GUI_KEY_2: menu = MENU_OPEN2; break;
    case GUI_KEY_3: menu = MENU_OPEN3; break;
    case GUI_KEY_4: menu = MENU_OPEN4; break;
    case GUI_KEY_b: menu = MENU_OPEN4B; break;
    case GUI_KEY_5: menu = MENU_OPEN5; break;
    case GUI_KEY_6: menu = MENU_OPEN6; break;
    case GUI_KEY_7: menu = MENU_OPEN7; break;
    case GUI_KEY_8: menu = MENU_OPEN8; break;
    case GUI_KEY_w: menu = MENU_W1_NEWWORD; break;
    case GUI_KEY_c: menu = MENU_COMMAND; break;
    case GUI_KEY_SLASH: menu = MENU_SEARCH; break;
    case GUI_KEY_x: WndPopUp( wnd, NULL ); break;
    case GUI_KEY_CTRL_X:
    {
        static gui_ctl_id last_menu_pos = 0;
        WndCreateFloatingPopup( wnd, NULL, &menu_PopTart, &last_menu_pos );
    }

    default:
        return( false );
    }
    WndMainMenuProc( wnd, menu );
    return( true );
}
예제 #3
0
static void NotFound( a_window *wnd, regexp *rx, char *msg )
{
    Ring();
    WndNextRow( wnd, WND_NO_ROW, WND_RESTORE_ROW );
    WndStatusText( msg );
    WndFreeRX( rx );
    WndDoingSearch = FALSE;
    WndRepaint( wnd );
}
예제 #4
0
void GUImain( void )
/******************/
{
    WPInit();
    WndCreateStatusWindow( &WndColours[ WPA_STATUS_LINE ] );
    WndStatusText( "" );
#if defined( __OS2_PM__ )
    WndSetIcon( WndMain, &MainIcon );
#endif
    WPInitHelp();
    AboutOpen();
    WndShowAll();
    WndShowWndMain();
    if( !WPSampFound() ) {
        DlgOpenSample();
    } else {
        OpenSample();
    }
}
예제 #5
0
파일: dui.c 프로젝트: seyko2/open-watcom-v2
void DUIStatusText( const char *text )
{
    WndStatusText( text );
}
예제 #6
0
extern  bool    WndSearch( a_window *wnd, bool from_top, int direction )
{
    wnd_line_piece      line;
    regexp              *rx;
    char                *pos;
    char                *endpos;
    bool                wrap;
    int                 rows;
    bool                rc;
    bool                had_cache;
    char                *not_found;
    char                *top_of_window;
    char                *end_of_window;
    char                *search_wrapped;

    wnd_subpiece        next_occurence;
    wnd_subpiece        prev_occurence;
    wnd_subpiece        curr;
    wnd_coord           starting_pos;

    if( direction == 0 ) return( FALSE );
    if( wnd == NULL ) return( FALSE );
    if( wnd->searchitem == NULL ) return( FALSE );
    rx = WndCompileRX( wnd->searchitem );
    if( rx == NULL ) return( FALSE );
    not_found = WndLoadString( LITERAL_Not_Found );
    top_of_window = WndLoadString( LITERAL_Top_Of_Window );
    end_of_window = WndLoadString( LITERAL_End_Of_Window );
    search_wrapped = WndLoadString( LITERAL_Search_Wrapped );
    wrap = FALSE;
    starting_pos.piece = 0;
    starting_pos.col = direction > 0 ? -1 : WND_MAX_COL;
    if( from_top ) {
        curr.row = 0;
    } else if( WndHasCurrent( wnd ) ) {
        curr.row = WndVirtualRow( wnd, wnd->current.row );
        starting_pos.piece = wnd->current.piece;
        starting_pos.col = wnd->current.col;
    } else {
        curr.row = WndVirtualTop( wnd );
    }
    starting_pos.row = curr.row;
    WndNextRow( wnd, WND_NO_ROW, WND_SAVE_ROW );
    WndStatusText( "" );
    WndDoingSearch = TRUE;
    had_cache = WndSetCache( wnd, FALSE );
    for( ;; ) {
        if( curr.row < 0 ) {
            if( wrap ) {
                NotFound( wnd, rx, not_found );
                rc = FALSE;
                goto done;
            } else if( _Is( wnd, WSW_SEARCH_WRAP ) ) {
                rows = WndNumRows( wnd );
                if( rows == -1 ) {
                    WndRepaint( wnd );
                    WndScrollAbs( wnd, -wnd->title_size );
                    rows = WndScrollAbs( wnd, WND_MAX_ROW ) + WndRows( wnd );
                }
                curr.row = rows - 1;
                curr.col = 0;
                curr.piece = -1;
                wrap = TRUE;
                continue;
            } else {
                NotFound( wnd, rx, top_of_window );
                rc = FALSE;
                goto done;
            }
        }
        next_occurence.col = -1;
        prev_occurence.col = -1;
        for( curr.piece = 0;; ++curr.piece ) { // look for both next and prev match
            if( !WndGetLineAbs( wnd, curr.row, curr.piece, &line ) ) {
                if( curr.piece != 0 ) break;
                if( wrap ) {
                    NotFound( wnd, rx, not_found );
                    rc = FALSE;
                    goto done;
                } else if( _Is( wnd, WSW_SEARCH_WRAP ) ) {
                    curr.row = 0;
                    curr.col = 0;
                    curr.piece = -1;
                    wrap = TRUE;
                    continue;
                } else {
                    NotFound( wnd, rx, end_of_window );
                    rc = FALSE;
                    goto done;
                }
            }
            if( line.bitmap ) continue;
            pos = line.text;
            endpos = NULL;
            while( WndRXFind( rx, &pos, &endpos ) ) {
                curr.end = endpos - line.text;
                curr.col = pos - line.text;
                if( curr.piece < starting_pos.piece ) {
                    prev_occurence = curr;
                } else if( curr.piece > starting_pos.piece ) {
                    if( next_occurence.col == -1 ) {
                        next_occurence = curr;
                    }
                } else if( curr.col > starting_pos.col ) {
                    if( next_occurence.col == -1 ) {
                        next_occurence = curr;
                    }
                } else if( curr.col < starting_pos.col ) {
                    prev_occurence = curr;
                }
                ++pos;
            }
        }
        if( direction < 0 ) {
            next_occurence = prev_occurence;
        }
        if( next_occurence.col != -1 ) {
            WndDoingSearch = FALSE;
            WndKillCacheLines( wnd );
            WndDirtyCurr( wnd );
            WndNoSelect( wnd );
            WndNoCurrent( wnd );
            if( curr.row < WndVirtualTop( wnd ) ) {
                if( curr.row > wnd->rows / 2 ) {
                    WndRepaint( wnd );
                    WndScrollAbs( wnd, curr.row - wnd->rows / 2 );
                } else {
                    WndRepaint( wnd );
                    WndScrollAbs( wnd, -wnd->title_size );
                }
            } else if( curr.row >= WndVirtualBottom( wnd ) ) {
                WndRepaint( wnd );
                WndScrollAbs( wnd, curr.row - wnd->rows / 2 );
            }
            wnd->sel_start.row = WndScreenRow( wnd, curr.row );
            wnd->sel_start.piece = next_occurence.piece;
            wnd->sel_start.col = next_occurence.col;

            wnd->sel_end = wnd->sel_start;
            wnd->sel_end.col = next_occurence.end - 1;

            wnd->current.col = wnd->sel_end.col;
            wnd->current = wnd->sel_start;
            WndSetCurrCol( wnd );
            WndCurrVisible( wnd );
            WndDirtyCurr( wnd );
            WndFreeRX( rx );
            if( wrap ) WndStatusText( search_wrapped );
            rc = TRUE;
            goto done;
        }
        if( direction > 0 ) {
            if( wrap && curr.row > starting_pos.row ) {
                NotFound( wnd, rx, not_found );
                rc = FALSE;
                goto done;
            }
            starting_pos.col = -1;
            starting_pos.piece = 0;
            curr.row = WndNextRow( wnd, curr.row, 1 );
        } else {
            starting_pos.col = WND_MAX_COL;
            starting_pos.piece = WND_MAX_COL;
            curr.row = WndNextRow( wnd, curr.row, -1 );
        }
        curr.piece = 0;
    }
done:;
    WndSetCache( wnd, had_cache );
    WndFree( not_found );
    WndFree( top_of_window );
    WndFree( end_of_window );
    WndFree( search_wrapped );
    return( rc );
}