예제 #1
0
void TestDialog::handleEvent( TEvent& event )
{
	if( event.what == evKeyDown
	&& event.keyDown.keyCode == kbTab )
	{
		char buf[30];
		master->getData( buf );		// read the input
		slave->setText( buf );    // write it into static text
	}
	TDialog::handleEvent( event );
}
예제 #2
0
TOutputDevice::TOutputDevice( ushort aMode ) :
	mode( aMode )
{
	switch( mode )
		{
		case text:
		case form:

			ushort numCopies = 0;

			if( (mode == text) && formDef->numRawPrintCopiesDlg )
				{
				TDialog *dlg = new TDialog( TRect( 27, 8, 53, 15 ),
											"Anzahl Kopien" );

				dlg->insert( new TButton( TRect( 8, 4, 18, 6 ), "~O~K",
										  cmOK, bfDefault ) );

				TInputLine *il = new TInputLine( TRect( 10, 2, 16, 3 ), 3 );
				dlg->insert( il );

				char string[4];

				do
					{
					strcpy( string, "1" );
					il->setData( string );

					TProgram::deskTop->execView( dlg );

					il->getData( string );
					numCopies = atoi( string );
					}
				while( numCopies == 0 );

				destroy( dlg );
				}

			if( formDef->oldDevice && (mode == form) )
				strcpy( portName, "NUL" );
			else
				config->getPrinterPortName( portName );

			device = new fpstream( portName, ios::out | ios::trunc );

			if( config->passThrough() )
				device->writeBytes( "\x1BJ\r", 3 );

			if( mode == form )
				device->writeBytes( "@BS", 3 );

			if( (mode == text) && formDef->formatedRawPrint )
				{
				*device << (char)esc << 'E';

				if( formDef->numRawPrintCopiesDlg )
					{
					*device << (char)esc;

					char string[6];
					strcpy( string, "&l" );

					char number[4];
					itoa( numCopies, number, 10 );
					strcat( string, number );
					strcat( string, "X" );

					device->writeBytes( string, strlen( string ) );
					}

				formatingInfo = new ifstream( "FORMAT.RES" );
				char number[7];
				number[6] = 0;

				formatingInfo->read( number, 6 );
				xOrigin = atoi( number );
				formatingInfo->seekg( 2, ios::cur );

				formatingInfo->read( number, 6 );
				yOrigin = atoi( number );
				formatingInfo->seekg( 2, ios::cur );
				}

			break;

		case card:
			config->getEncoderPortName( portName );
			open( portName );
			trackBuffer = new char[noTracks * trackLength];
			memset( trackBuffer, ' ', noTracks * trackLength );

			label = new char[noLines * lineLength];
			memset( label, ' ', noLines * lineLength );

			break;
		}
}