/*--------------------------------------------------------------------
 * FICHERO:  Vcnf.c
 * OBJETIVO: Probar el objeto Configuracin
 * AUTOR:    Pedro Reina
 * FECHA:    L.29.5.1995
 *------------------------------------------------------------------*/

/*--------------------------------------------------------------------
 * Ficheros de cabecera
 *------------------------------------------------------------------*/

#include "Config.h"

/*--------------------------------------------------------------------
 * Declaracin de funciones
 *------------------------------------------------------------------*/

void P_Cnf_Lee();

/*--------------------------------------------------------------------
 * Programa principal
 *------------------------------------------------------------------*/
void main()
  {
  int Opcion, Sigue=1;
  contador Fil, Col;

  Pan_Define (PAN_TEXTO);
  while ( Sigue )
    {
    Pan_Limpia();
    Pan_Color (NEGRO,BLANCO);
    Fil = 0, Col = 3;
    Pan_PonTexto (Fil++,Col,"Prueba del objeto Configuracin" );
    Pan_PonTexto (Fil++,Col,"===============================" );
    Fil++;
    Pan_PonTexto (Fil++,Col,"0. Fin del programa" );
    Pan_PonTexto (Fil++,Col,"1. Paso a grfico" );
    Pan_PonTexto (Fil++,Col,"2. Paso a texto" );
    Pan_PonTexto (Fil++,Col,"3. Cnf_Lee()" );
    Fil++;
    Pan_PonTexto (Fil++,Col,"Introduce nmero de opcin: " );
    scanf ( "%d", &Opcion );
    getchar();

    switch ( Opcion )
      {
      case 0:   Sigue = 0;               break;
      case 1:   Pan_Cierra();
                Pan_Define (PAN_GRAFICO);
                break;
      case 2:   Pan_Cierra();
                Pan_Define (PAN_TEXTO);
                break;
      case 3:   P_Cnf_Lee();             break;
      }
    }
  Pan_Cierra();
  }

/*--------------------------------------------------------------------
 * Funcin P_Cnf_Lee()
 *------------------------------------------------------------------*/
void P_Cnf_Lee()
  {
  cadena   Nombre, Aux;
  contador Fil;
  config   Config;

  Nombre = Fch_Nombre ("Vcnf","cnf");

  Pan_PonTexto (13,0,"Leyendo ");
  Pan_Texto (Nombre);
  Pan_Texto (" se obtiene:");

  if ( Config = Cnf_Abre (Nombre) )
    {
    Fil = 15;
    while ( Aux = Cnf_Lee (Config) )
      {
      Pan_Color (NEGRO, BLANCO);
      Pan_PonEntero (Fil, 0, Cnf_Linea(Config), 2);
      Pan_Color (BLANCO, NEGRO);
      Pan_PonTexto (Fil++,4,Aux);
      Cad_Destruye (Aux);
      }
    Cnf_Cierra ( Config );
    }

  Pan_Color (NEGRO, BLANCO);
  Pan_PonTexto (20,0,"Pulsa ENTER para seguir: ");
  getchar();
  }