Example #1
0
void ViewHeaderCompleto()
{
	ViewHeader();
	emit_arquivo("exemplo/html/header_barra.html");

	emit_button("/", "InĂ­cio");
	emit_button("/blog", "Blog");
	emit_button("/fotos", "Fotos");
	emit_button("/sobre", "Sobre");
	emit_button("/links", "Links");
	emit_button("/contato", "contato");

	emit("\t</ul>\r\n</div>\r\n<div id=\"page\">");
}
/*-------------------------------------------------------------------------*/
INT ViewMsg( CHAR *file, INT renew )
{
    INT              y = 0;
    KEY              k;
    INDEXTXT        *p;
#ifndef _LITE_
    INT              code;
#endif

    WActive ( wmain );
    WActive ( wtext );
    WActive ( wbar  );
#ifndef _LITE_
    SetBar  ( BarView );
#endif
    if( renew )
    {
        ViewHeader( file );
        ViewPage  ( maxXtext, maxYtext, 0 );
    }

    while( 1 )
    {
        k = MGetKey( FALSE );

        switch( k.key )
        {
#ifndef _LITE_
            
            case KEY_F1:
                ViewHelp( "PktView" );
                SetBar( BarView );
                break;

            case KEY_F5:
                CheckUpdatePkt( file );
                CopyPkt( file );
                SetBar( BarView );
                break;
                
            case KEY_F6:
                CheckUpdatePkt( file );
                code = MovePkt( file );
                SetBar( BarView );
                if( code ) break;
                if( mode == FILE_TYPE_MSG )
                {
                    ReindexPkt();
                    WDeactive( wmain );
                    WDeactive( wtext );
                    return( KEY_ESC );
                }
                if( mode == FILE_TYPE_PKT )
                {
                    reload = 1;
                    return( KEY_ESC );
                }
                return( 0 );
                
            case KEY_F8: case KEY_DEL:
                code = DelPkt( file );
                SetBar( BarView );
                if( code ) break;
                if( mode == FILE_TYPE_MSG )
                {
                    ReindexPkt();
                    WDeactive( wmain );
                    WDeactive( wtext );
                    return( KEY_ESC );
                }
                if( mode == FILE_TYPE_PKT )
                {
                    reload = 1;
                    return( KEY_ESC );
                }
                return( 0 );

            case KEY_i: case KEY_I: case ALT_I:
                ShowInfo( file );
                SetBar( BarView );
                break;
                
            case KEY_SPACE: case KEY_INS:
                if( pktIndex == NULL )
                    break;
                if( Current -> sel != ' ' )
                {
                    Current -> sel = ' ';
                    selected--;
                }
                else
                {
                    Current -> sel = '*';
                    selected++;
                }
                ViewSelected();
                break;
                
            case KEY_F3:
                return( KEY_F3 );
                
            case ALT_C:
                SetAttr();
                SetBar( BarView );
                break;
                
            case KEY_F9:
                ChangeConfig();
                SetBar( BarView );
                if( altx )
                {
                    WDeactive( wmain );
                    WDeactive( wtext );
                    return( KEY_ESC );
                }
                break;
                
            case SHIFT_F9:
                SaveConfig( ConfFile );
                break;

#endif

            case KEY_HOME:
                if( y == 0 )
                    break;
                y = 0;
                ViewPage( maxXtext, maxYtext, y );
                break;

            case KEY_DOWN:
                if( txtcount < y + maxYtext + 1 )
                    break;
                y++;
                WSetXY( wtext, 0, 0 ); WDelLine( wtext );
                p = GetCurrentTxt( y + maxYtext - 1 );
                ViewStr ( wtext, maxYtext - 1, maxXtext, p -> str, p -> color );
                break;

            case KEY_UP:
                if( y == 0 )
                    break;
                y--;
                WSetXY( wtext, 0, 0 ); WInsLine( wtext );
                p = GetCurrentTxt( y );
                ViewStr ( wtext, 0, maxXtext, p -> str, p -> color );
                break;

            case KEY_PAGEUP:
                if( y == 0 )
                    break;
                if( y < maxYtext - 1 )
                    y = 0;
                else
                    y -= maxYtext - 1;
                ViewPage( maxXtext, maxYtext, y );
                break;

            case KEY_PAGEDOWN:
                if( txtcount < maxYtext )
                    break;
                if( y + 2 * maxYtext < txtcount )
                    y += maxYtext - 1;
                else
                    y  = txtcount - maxYtext;
                ViewPage( maxXtext, maxYtext, y );
                break;

            case KEY_END:
                if( txtcount < maxYtext )
                    break;
                y = txtcount - maxYtext;
                ViewPage( maxXtext, maxYtext, y );
                break;

            case KEY_LEFT: case CTRL_ENTER: case SHIFT_TAB:
                if( pktcount > 1 && pktNumber > 0 )
                    return( KEY_LEFT );
                break;

            case KEY_RIGHT: case KEY_ENTER: case KEY_GRENTER: case KEY_TAB:
                if( pktcount > 1 && pktNumber + 1 != pktcount )
                    return( KEY_RIGHT );
                break;

            case ALT_X:
                altx = 1;
                
            case KEY_ESC: case KEY_F10: case KEY_L: case KEY_l: case ALT_L:
                WDeactive( wmain );
                WDeactive( wtext );
                return( KEY_ESC );

        }
    }
}