[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] gemlib: printer dialog function



Hello!

I import in the gemlib and tos.hyp four function with used from the printer
dialog of WDialog. Can someone check my work from the gemlib.

The function disable_nvdi_errors and enable_nvdi_errors are not in the gemlib,
because they change the NVDI cookie.

Gerhard



There is the original from Wilfried Behne:
-------------------------------cut-------------------------------
static DRV_INFO *v_create_driver_info( int16 handle, int16 driver_id )
{
  VDIPB pb;
  VDI_SMALL p;                    /* Paramterstruktur */
  int16 save_conf;

  init_vdi_pb( &pb, &p );         /* PB initialisieren */

  p.intin[0] = driver_id;

  p.contrl[0] = 180;
  p.contrl[1] = 0;
  p.contrl[3] = 1;
  p.contrl[5] = 0;
  p.contrl[6] = handle;

  p.contrl[2] = 0;
  p.contrl[4] = 0;

  save_conf = disable_nvdi_errors();
  vdi( &pb );
  enable_nvdi_errors( save_conf );

  if ( p.contrl[4] >= 2 )
    return(*(DRV_INFO **) &p.intout[0] );

  return( 0L );
}

static int16  v_delete_driver_info( int16 handle, DRV_INFO *drv_info )
{
  VDIPB pb;
  VDI_SMALL p;                              /* Paramterstruktur */

  init_vdi_pb( &pb, &p );                   /* PB initialisieren */

  *(DRV_INFO **) &p.intin[0] = drv_info;

  p.contrl[0] = 181;
  p.contrl[1] = 0;
  p.contrl[3] = 2;
  p.contrl[5] = 0;
  p.contrl[6] = handle;

  vdi( &pb );

  return( p.intout[0] );
}

static int16  v_read_default_settings( int16 handle, PRN_SETTINGS *settings )
{
  VDIPB pb;
  VDI_SMALL p;                              /* Paramterstruktur */
  int16 save_conf;

  init_vdi_pb( &pb, &p );                   /* PB initialisieren */

  *(PRN_SETTINGS **) &p.intin[0] = settings; 
  
  p.contrl[0] = 182;
  p.contrl[1] = 0;
  p.contrl[3] = 2;
  p.contrl[5] = 0;                          /* Unterfunktion 0 */
  p.contrl[6] = handle;

  p.contrl[2] = 0;
  p.contrl[4] = 0;

  save_conf = disable_nvdi_errors();
  vdi( &pb );
  enable_nvdi_errors( save_conf );

  if ( p.contrl[4] >= 1 )
    return( p.intout[0] );

  return( 0 );
}

static int16  v_write_default_settings( int16 handle, PRN_SETTINGS *settings )
{
  VDIPB pb;
  VDI_SMALL p;                              /* Paramterstruktur */
  int16 save_conf;

  init_vdi_pb( &pb, &p );                   /* PB initialisieren */

  *(PRN_SETTINGS **) &p.intin[0] = settings;

  p.contrl[0] = 182;
  p.contrl[1] = 0;
  p.contrl[3] = 2;
  p.contrl[5] = 1;                          /* Unterfunktion 1 */
  p.contrl[6] = handle;

  p.contrl[2] = 0;
  p.contrl[4] = 0;

  save_conf = disable_nvdi_errors();
  vdi( &pb );
  enable_nvdi_errors( save_conf );

  if ( p.contrl[4] >= 1 )
    return( p.intout[0] );

  return( 0 );
}

-------------------------------cut-------------------------------