Пример #1
0
bool FileOpenGadget( a_window *wnd, wnd_line_piece *line, mod_handle mod )
{
    a_window    *curr;
    for( curr = WndNext( NULL ); curr != NULL; curr = WndNext( curr ) ) {
        if( WndClass( curr ) != WND_SOURCE ) continue;
        if( mod == WndFile( curr )->mod ) {
            if( line != NULL ) SetGadgetLine( wnd, line, GADGET_OPEN_SOURCE );
            return( TRUE );
        }
    }
    if( line != NULL ) SetGadgetLine( wnd, line, GADGET_CLOSED_SOURCE );
    return( FALSE );
}
Пример #2
0
void WndMainResized( void )
{
    a_window    *wnd;
    gui_rect    rect;

    if( _IsOff( SW_DETACHABLE_WINDOWS ) ) {
        WndGetRect( WndMain, &WndMainRect );
        for( wnd = WndNext( NULL ); wnd != NULL; wnd = WndNext( wnd ) ) {
            if( !WndHasClass( wnd ) )
                continue;
            WndPosToRect( &WndPosition[WndClass( wnd )], &rect, WndMainClientSize() );
            WndResizeWindow( wnd, &rect );
        }
    }
}
Пример #3
0
extern  void    AsmNewSrcNotify( a_window *src, mod_handle mod, bool track )
{
    asm_window  *asw;
    a_window    *wnd;

    for( wnd = WndNext( NULL ); wnd != NULL; wnd = WndNext( wnd ) ) {
        if( WndClass( wnd ) != WND_ASSEMBLY ) continue;
        asw = WndAsm( wnd );
        if( track != asw->track ) continue;
        if( mod != asw->mod ) continue;
        if( asw->src != NULL ) continue;
        SrcJoinAsm( src, wnd );
        AsmJoinSrc( wnd, src );
        break;
    }
}
Пример #4
0
extern  void    SrcNewAsmNotify( a_window *asw, mod_handle mod, bool track )
{
    file_window *file;
    a_window    *wnd;

    for( wnd = WndNext( NULL ); wnd != NULL; wnd = WndNext( wnd ) ) {
        if( WndClass( wnd ) != WND_SOURCE ) continue;
        file = WndFile( wnd );
        if( track != file->track ) continue;
        if( mod != file->mod ) continue;
        if( file->asw != NULL ) continue;
        AsmJoinSrc( asw, wnd );
        SrcJoinAsm( wnd, asw );
        break;
    }
}
Пример #5
0
extern  void    WndFreshAll()
{
    a_window            *wnd;

    if( WndDoingRefresh )
        return;
    WndDoingRefresh = TRUE;
    for( wnd = WndNext( NULL ); wnd != NULL; wnd = WndNext( wnd ) ) {
        if( wnd->info->chkflags != NULL && wnd->info->chkflags( wnd->info->flags ) ) {
            WndRefresh( wnd );
        }
    }
    WndStartFreshAll();
    WndPaintDirt( NULL );
    WndEndFreshAll();
    WndDoingRefresh = FALSE;
}
Пример #6
0
void    WndFreshAll( void )
{
    a_window        wnd;

    if( WndDoingRefresh )
        return;
    WndDoingRefresh = true;
    for( wnd = WndNext( NULL ); wnd != NULL; wnd = WndNext( wnd ) ) {
        if( wnd->info->chkupdate != NoChkUpdate && wnd->info->chkupdate() ) {
            WndRefresh( wnd );
        }
    }
    WndStartFreshAll();
    WndPaintDirty( NULL );
    WndEndFreshAll();
    WndDoingRefresh = false;
}
Пример #7
0
void ProcPendingPaint( void )
{
    gui_colour_set      *set;
    a_window            *wnd;

    if( _IsOff( SW_PENDING_REPAINT ) ) return;
    _SwitchOff( SW_PENDING_REPAINT );
    for( wnd = WndNext( NULL ); wnd != NULL; wnd = WndNext( wnd ) ) {
        if( WndHasClass( wnd ) ) {
            set = WndClassColour[WndClass( wnd )];
        } else {
            set = NULL;
        }
        if( set == NULL ) {
            set = WndClassColour[WND_ALL];
        }
        if( set == NULL ) {
            set = WndColours;
        }
        WndSetFontInfo( wnd, GetWndFont( wnd ) );
        WndSetColours( wnd, WndNumColours, set );
    }
}
Пример #8
0
void ConfigDisp( void )
{

    a_window        *wnd, *scan;
    char            buff[20];
    char            buff2[20];
    a_window        *head, *next;
    int             h;
    wnd_class_wv    wndclass;
    gui_rect        rect;

    ReqEOC();
    GetCmdEntry( WndNameTab, WND_ALL, buff );
    GetCmdEntry( DispOptions, CLOSE, buff2 );
    Format( TxtBuff, "%s %s /%s", GetCmdName( CMD_DISPLAY ), buff, buff2 );
    WndDlgTxt( TxtBuff );
    if( WndHaveStatusWindow() ) {
        GetCmdEntry( MiscTab, MISC_STATUS, buff );
        Format( TxtBuff, "%s %s", GetCmdName( CMD_DISPLAY ), buff );
        WndDlgTxt( TxtBuff );
    }
    if( WndHaveToolBar() ) {
        h = WndToolHeight();
        GetCmdEntry( MiscTab, MISC_TOOL, buff );
        GetCmdEntry( DispOptions, WndToolFixed() ? FIXED : FLOATING, buff2 );
        Format( TxtBuff, "%s %s /%s %d", GetCmdName( CMD_DISPLAY ),
                buff, buff2, h );
        WndDlgTxt( TxtBuff );
    }
    for( wndclass = 0; wndclass < WND_NUM_CLASSES; ++wndclass ) {
        if( wndclass == WND_ALL )
            continue;
        if( WndFindClass( NULL, wndclass ) != NULL )
            continue;
        WndPosToRect( &WndPosition[wndclass], &rect, &WndScreen );
        if( rect.width == 0 )
            continue;
        if( rect.height == 0 )
            continue;
        PrintPosition( CLOSE, wndclass, &rect, buff, buff2 );
    }
    head = WndNext( NULL );
    if( head == NULL )
        return;
    // traverse in reverse order so that windows get created in correct order
    for( wnd = head; (next = WndNext( wnd )) != NULL; wnd = next )
        ;
    for( ;; ) {
        if( WndHasClass( wnd ) ) {
            wndclass = WndClass( wnd );
            switch( wndclass ) {
            case WND_ALL:
                break;
            case WND_BINARY:
            case WND_FILE:
            case WND_MEMORY:
                WndResizeHook( wnd );
                WndPosToRect( &WndPosition[wndclass], &rect, &WndScreen );
                PrintPosition( CLOSE, wndclass, &rect, buff, buff2 );
                break;
            case WND_VARIABLE:
            case WND_TMPFILE:
                break;
            default:
                WndResizeHook( wnd );
                WndPosToRect( &WndPosition[wndclass], &rect, &WndScreen );
                PrintPosition( OPEN, wndclass, &rect, buff, buff2 );
                break;
            }
        }
        if( wnd == head )
            break;
        for( scan = head; (next = WndNext( scan )) != wnd; scan = next )
            ;
        wnd = scan;
    }
}
Пример #9
0
static void ProcSize( wnd_class_wv wndclass )
{
    gui_rect    size;
    disp_optn   optn;
    a_window    *wnd;
    a_window    *next;
    gui_coord   min;
    bool        coord_specified;
    gui_rect    def_rect;

    optn = GetOption();
    if( optn == FLOATING || optn == FIXED ) {
        Error( ERR_LOC, LIT_ENG( ERR_BAD_OPTION ), GetCmdName( CMD_DISPLAY ) );
    }
    size.x = OptExpr( -1 );
    size.y = -1;
    size.width = -1;
    size.height = -1;
    if( CurrToken == T_COMMA ) {
        Scan();
        size.y = OptExpr( -1 );
        if( CurrToken == T_COMMA ) {
            Scan();
            size.width = OptExpr( -1 );
            if( CurrToken == T_COMMA ) {
                Scan();
                size.height = OptExpr( -1 );
            }
        }
    }
    ReqEOC();

    GUIGetMinSize( &min );
    if( size.x != -1 || size.y != -1 || size.width != -1 || size.height != -1 ) {
        coord_specified = true;
    } else {
        coord_specified = false;
    }
    WndPosToRect( &WndPosition[wndclass], &def_rect, &WndScreen );
    size.x = range( size.x, 0, WndScreen.x, def_rect.x );
    size.y = range( size.y, 0, WndScreen.y, def_rect.y );
    if( size.x + size.width > WndScreen.x ) size.width = WndScreen.x - size.x;
    if( size.y + size.height > WndScreen.y ) size.height = WndScreen.y - size.y;
    size.width = range( size.width, min.x, WndScreen.x, def_rect.width );
    size.height = range( size.height, min.y, WndScreen.y, def_rect.height );
    if( coord_specified ) {
        WndRectToPos( &size, &WndPosition[wndclass], &WndScreen );
    }
    if( wndclass == WND_CURRENT ) {
        wnd = WndFindActive();
    } else {
        wnd = WndFindClass( NULL, wndclass );
    }
    switch( optn ) {
    case OPEN:
    case NEW:
        if( optn == NEW || wnd == NULL ) {
            WndOpenTab[wndclass]();
        } else {
            WndRestoreToFront( wnd );
            WndPosToRect( &WndPosition[wndclass], &size, WndMainClientSize() );
            WndResizeWindow( wnd, &size );
        }
        break;
    case CLOSE:
        if( wndclass == WND_ALL ) {
            for( wnd = WndNext( NULL ); wnd != NULL; wnd = next ) {
                next = WndNext( wnd );
                if( WndHasClass( wnd ) ) WndClose( wnd );
            }
        } else {
            if( wnd != NULL ) {
                WndClose( wnd );
            }
        }
        break;
    case MINIMIZE:
        if( wnd == NULL )
            wnd = WndOpenTab[wndclass]();
        WndMinimizeWindow( wnd );
        break;
    case MAXIMIZE:
        if( wnd == NULL )
            wnd = WndOpenTab[wndclass]();
        WndMaximizeWindow( wnd );
        break;
    case RESTORE:
        if( wnd == NULL )
            wnd = WndOpenTab[wndclass]();
        WndRestoreWindow( wnd );
        break;
    }
}
Пример #10
0
void WndPaintDirt( a_window *wnd )
{
    int                 i;
    wnd_line_piece      line;
    wnd_line_piece      next_piece_line;
    gui_rect            rect;
    wnd_dirt            *dirt;
    gui_coord           size;
    gui_coord           half_char;
    a_window            *next;
//    a_window            *last;

//    last = NULL;
    for( wnd = WndNext( NULL ); wnd != NULL; wnd = next ) {
        next = WndNext( wnd );
        if( wnd->vscroll_pending != 0 ) {
            if( wnd->hscroll_pending != -1 ) {
                _Set( wnd, WSW_REPAINT );
            }
            if( _Is( wnd, WSW_REPAINT ) ) {
                if( wnd->hscroll_pending != -1 ) {
                    GUIInitHScroll( wnd->gui, wnd->hscroll_pending );
                }
                WndRepaint( wnd );
                wnd->hscroll_pending = -1;
                wnd->vscroll_pending = 0;
            } else {
                for( i = 0; i < wnd->title_size; ++i ) {
                    GUIDrawTextExtent( wnd->gui, " ", 1, i, 0, GUI_BACKGROUND, GUI_NO_COLUMN );
                }
                GUIDoVScrollClip( wnd->gui, wnd->vscroll_pending,
                                  wnd->title_size, wnd->rows - 1 );
                wnd->vscroll_pending = 0;
            }
        }
        if( _Is( wnd, WSW_REPAINT ) ) {
            _Clr( wnd, WSW_REPAINT );
            WndKillCacheLines( wnd );
            WndCheckCurrentValid( wnd );
            GUIWndDirty( wnd->gui );
            if( wnd->max_indent != 0 && wnd->width >= wnd->max_indent ) {
                GUISetHScroll( wnd->gui, 0 );
                wnd->hscroll_pending = -1;
                GUISetHScrollRange( wnd->gui, wnd->max_indent );
            }
            next = wnd;
        } else {
            for( i = 0; i < wnd->dirtyrects; ++i ) {
                dirt = &wnd->dirty[i];
                if( dirt->row < 0 ) continue;
                if( dirt->row >= wnd->rows ) continue;
                if( dirt->piece == WND_NO_PIECE ) {
                    if( !WndGetLine( wnd, dirt->row, 0, &line ) ) continue;
                    GUIWndDirtyRow( wnd->gui, dirt->row );
                } else {
                    if( !WndGetLine( wnd, dirt->row, dirt->piece, &line ) ) continue;
                    if( line.bitmap ) {
                        GUIGetHotSpotSize( line.text[0], &size );
                        rect.x = line.indent;
                        rect.y = dirt->row * wnd->max_char.y;
                        rect.width = line.length;
                        rect.height = size.y;
                    } else if( dirt->col != WND_NO_COL ) {
                        if( line.length == 0 ) line.text = " ";
                        rect.x = line.indent;
                        rect.x += GUIGetExtentX(wnd->gui, line.text, dirt->col);
                        rect.y = dirt->row * wnd->max_char.y;
                        rect.width = GUIGetExtentX( wnd->gui, line.text+dirt->col, dirt->end_col-dirt->col+GUICharLen( line.text[dirt->col] ) );
                        rect.height = wnd->max_char.y;
                    } else if( line.extent == WND_MAX_EXTEND || line.master_tabstop ) {
                        rect.width = 0;
                        rect.height = 0;
                        GUIWndDirtyRow( wnd->gui, dirt->row );
                    } else {
                        rect.x = line.indent;
                        if( WndGetLine( wnd, dirt->row, dirt->piece+1, &next_piece_line ) ) {
                            if( next_piece_line.indent < line.indent ) {
                                rect.width = WND_APPROX_SIZE;
                            } else {
                                rect.width = next_piece_line.indent - line.indent;
                            }
                        } else {
                            rect.width = WND_APPROX_SIZE;
                        }
                        rect.y = dirt->row * wnd->max_char.y;
                        rect.height = wnd->max_char.y;
                    }
                    /* begin kludge for Kerning problem */
                    if( rect.width != 0 || rect.height != 0 ) {
                        half_char.x = WndAvgCharX( wnd ) / 2;
                        half_char.y = 0;
                        GUITruncToPixel( &half_char );
                        if( rect.x < half_char.x ) {
                            rect.width += half_char.x + rect.x;
                            rect.x = 0;
                        } else {
                            rect.x -= half_char.x;
                            rect.width += half_char.x + half_char.x;
                        }
                        GUIWndDirtyRect( wnd->gui, &rect );
                    }
                }
            }
        }
        if( wnd->hscroll_pending != -1 ) {
            GUISetHScroll( wnd->gui, wnd->hscroll_pending );
            wnd->hscroll_pending = -1;
        }
        wnd->dirtyrects = 0;
        WndSetThumb( wnd );
    }
}