Exemple #1
0
a_window W6Open( void )
{
    wnd_create_struct   info;
    a_window            wnd;

    WndInitCreateStruct( &info );
    info.info = &W6Info;
    info.style |= GUI_INIT_INVISIBLE | GUI_POPUP;
    wnd = WndCreateWithStruct( &info );
    WndSetFontInfo( wnd, "-13 0 0 0 700 0 0 0 0 1 2 1 18 \"MS Serif\"" );
    WndForcePaint( wnd );
    WndShrinkToMouse( wnd, &W6Metrics );
    GUIShowWindow( WndGui( wnd ) );
    return( wnd );
}
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 );
    }
}
static void DoWndDump( a_window *wnd, WRITERTN *rtn, handle file )
{
    int                 row;
    int                 piece;
    wnd_line_piece      line;
    int                 indent_per_char;
    int                 chars_written;
    int                 indent_pos;
    char                *font;
    gui_ord             gadget_len;
    char                *p;
    char                buff[TXT_LEN];
//    int                 len;
    int                 i;

    font = WndGetFontInfo( wnd );
    gadget_len = MaxGadgetLength;
    MaxGadgetLength = ( strlen( WndGadgetArray[0].chars ) + 1 ) * WndAvgCharX( wnd );
    WndSetSysFont( wnd, TRUE );
    indent_per_char = WndAvgCharX( wnd );
//    len = WndGetTitle( wnd, buff, TXT_LEN );
    WndGetTitle( wnd, buff, TXT_LEN );
    p = TxtBuff;
    for( i = 0; i < 7; ++i ) {
        *p++ = '=';
    }
    *p++ = '|';
    *p++ = ' ';
    p = StrCopy( buff, p );
    *p++ = ' ';
    *p++ = '|';
    for( i = 0; i < 7; ++i ) {
        *p++ = '=';
    }
    *p = '\0';
    rtn( file, TxtBuff );
    for( row = -WndTitleSize( wnd );; ++row ) {
        p = buff;
        chars_written = 0;
        for( piece = 0; ; ++piece ) {
            if( !WndGetLineAbs( wnd, row, piece, &line ) )
                break;
            indent_pos = line.indent / indent_per_char;
            while( indent_pos > chars_written ) {
                p = StrCopy( " ", p );
                ++chars_written;
            }
            if( line.bitmap ) {
                line.text = WndGadgetArray[(int)line.text[0]].chars;
                line.length = strlen( line.text );
            }
            p = StrCopy( line.text, p );
            chars_written += line.length;
        }
        if( piece == 0 )
            break;
        rtn( file, buff );
    }
    MaxGadgetLength = gadget_len;
    if( font != NULL )
        WndSetFontInfo( wnd, font );
    GUIMemFree( font );
}