Ejemplo n.º 1
0
void ColourPlate::InitObject(ColourPlateType NewType)
{
	Disabled		= FALSE;

	Type			= NewType;

	Overprint		= FALSE;
	Monochrome		= TRUE;
	Negate			= FALSE;
	ActiveScreens	= FALSE;

	ScreenFunction	= SCRTYPE_NONE;		// represents no setscreen command output

	// And set up a suitable default for screen angle/frequency
	// Use the selected document's printer resolution and LPI defaults
	INT32 DPI	= 1200;		// Defaults in case of catastrophy
	INT32 LPI	= 60;
	
#if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
	TypesetInfo *TPInfo = TypesetInfo::FindTypesetInfoForDoc();
	if (TPInfo != NULL)
	{
		DPI = TPInfo->GetPrintResolution();
		LPI = (INT32) floor(TPInfo->GetDefaultScreenFrequency());
	}
#endif

	ResetScreenToDefaults(DPI, LPI);
}
Ejemplo n.º 2
0
BOOL PrintPSRenderRegion::WriteRenderPaper(KernelDC *pDC)
{
/*
	ColourPlate* pSeparation;
	GetOutputColourPlate(COLOURMODEL_CMYK, NULL, &pSeparation);

	// do nothing if we are not separating
	if (pSeparation==NULL)
		return TRUE;

	// if this plate says negative lets do it
	if (pSeparation->IsEPSNegative())
		return WriteFillPaper(pDC);
*/
	// Find the print control structure.
	PrintControl *pControl = GetRenderView()->GetPrintControl();
	if (pControl)
	{
		TypesetInfo *pTypeset = pControl->GetTypesetInfo();
		if (pTypeset && pTypeset->PrintPhotoNegative())
			return WriteFillPaper(pDC);
	}

	return TRUE;
}
Ejemplo n.º 3
0
BOOL PrintComponent::ExportImagesetting(BaseCamelotFilter *pFilter)
{
	BOOL ok = TRUE;

#if !defined(EXCLUDE_FROM_RALPH)

	TypesetInfo *TInfo = GetPrintControl()->GetTypesetInfo();
	if (TInfo == NULL)
		return(TRUE);		// If we can't find imagesetting info, don't sweat it

	CXaraFileRecord Rec(TAG_IMAGESETTING, TAG_IMAGESETTING_SIZE);
	if (ok)  ok = Rec.Init();

	if (ok)  ok = Rec.WriteINT32(TInfo->GetPrintResolution());
	if (ok)  ok = Rec.WriteDOUBLE(TInfo->GetDefaultScreenFrequency());

	if (ok)
	{
		UINT16 Func = 0;
		switch(TInfo->GetScreenFunction())
		{
			case SCRTYPE_SPOT1:			Func = 1;	break;
			case SCRTYPE_SPOT2:			Func = 2;	break;
			case SCRTYPE_TRIPLESPOT1:	Func = 3;	break;
			case SCRTYPE_TRIPLESPOT2:	Func = 4;	break;
			case SCRTYPE_ELLIPTICAL:	Func = 5;	break;
			case SCRTYPE_LINE:			Func = 6;	break;
			case SCRTYPE_CROSSHATCH:	Func = 7;	break;
			case SCRTYPE_MEZZOTINT:		Func = 8;	break;
			case SCRTYPE_SQUARE:		Func = 9;	break;
			case SCRTYPE_DITHER:		Func = 10;	break;
			default:
				break;
		}
		ok = Rec.WriteUINT16(Func);
	}

	if (ok)
	{
	  	BYTE Flags = 0x00;
		if (TInfo->AreSeparating())			Flags |= 0x01;
		if (TInfo->AreScreening())			Flags |= 0x02;
		if (TInfo->PrintEmulsionDown())		Flags |= 0x04;
		if (TInfo->PrintPhotoNegative())	Flags |= 0x08;
		if (TInfo->AlwaysOverprintBlack())	Flags |= 0x10;

		ok = Rec.WriteBYTE(Flags);
	}

	if (ok)
		pFilter->Write(&Rec);

#endif // EXCLUDE_FROM_RALPH
	return(ok);
}
Ejemplo n.º 4
0
BOOL PrintPSRenderRegion::WriteSepFunctions(KernelDC *pDC)
{
	PrintControl *pPrintCtl=NULL;
	View *pView = GetRenderView();
	if (pView) pPrintCtl = pView->GetPrintControl();
	if (!pPrintCtl)
		return TRUE;

	// Get a pointer to the typeset info structure
	TypesetInfo *pInfo = pPrintCtl->GetTypesetInfo();
	// Is screening off?
	if (!pInfo->AreScreening())
		return TRUE;

	// Get hold of our PostScript prolog resource...
	CCResTextFile ScreenFile;

	// Open the file
	if (!ScreenFile.open(_R(IDM_PS_SPOTFUNCS), _R(IDT_PS_RES)))
	{
		// Failed to open the file...
		ERROR2(FALSE, "Could not get at PostScript resource!");
	} 

	// Read each line from the file and output it to the DC.
	String_256 LineBuf;
	TCHAR *pBuf = (TCHAR *) LineBuf;
	
	while (!ScreenFile.eof())
	{
		// Copy this line to output.
		ScreenFile.read(&LineBuf);
		pDC->OutputTCHARAsChar(pBuf, LineBuf.Length());
		pDC->OutputNewLine();
	}
	
	// All done
	ScreenFile.close();

	return TRUE;
}
Ejemplo n.º 5
0
BOOL PrintComponent::EndExport(BaseCamelotFilter *pFilter, BOOL Success)
{
	BOOL ok = TRUE;

	PORTNOTETRACE("print","PrintComponent::EndExport - do nothing");
// WEBSTER - markn 14/2/97
// No print records needed in Webster
#ifndef WEBSTER
#if !defined(EXCLUDE_FROM_RALPH)
	if (pFilter == NULL)
	{
		ERROR3("PrintComponent::EndExport filter is null!");
		return(ok);
	}

	// If we're not exporting native data, or if export has failed, we do nothing here
	if (pFilter->IsWebFilter() || !Success)
		return(ok);

	// Export our 3 record types (1 print info, 1 imagesetting info, 'n' colour plates)
	ExportPrintSettings(pFilter);
	ExportImagesetting(pFilter);

	TypesetInfo *TInfo = TypesetInfo::FindTypesetInfoForDoc(pFilter->GetDocument());
	if (TInfo != NULL && TInfo->GetNumPlates() > 0)
	{
		ColourPlate *pPlate = TInfo->GetFirstPlate();
		while (pPlate != NULL)
		{
			ExportColourPlate(pFilter, pPlate);
			pPlate = TInfo->GetNextPlate(pPlate);
		}	
	}

#endif // WEBSTER
#endif
	return(ok);
}
Ejemplo n.º 6
0
void PrintComponent::ImportColourPlate(CXaraFileRecord* Rec, CamelotRecordHandler *pHandler)
{
#if !defined(EXCLUDE_FROM_RALPH)
	BOOL ok = TRUE;

	PORTNOTETRACE("print","PrintComponent::ImportColourPlate - do nothing");
	TypesetInfo *TInfo = GetPrintControl()->GetTypesetInfo();
	if (TInfo == NULL)
		return;
	
	ColourPlate *NewPlate = TInfo->CreateColourPlate();
	if (NewPlate == NULL)
		return;

	BYTE Type;
	if (ok)  ok = Rec->ReadBYTE(&Type);

	ColourPlateType PlateType = COLOURPLATE_NONE;
	if (ok)
	{
		switch(Type)
		{
			case 1: PlateType = COLOURPLATE_CYAN;		break;
			case 2: PlateType = COLOURPLATE_MAGENTA;	break;
			case 3: PlateType = COLOURPLATE_YELLOW;		break;
			case 4: PlateType = COLOURPLATE_KEY;		break;
			case 5: PlateType = COLOURPLATE_SPOT;		break;
		}
	}

	IndexedColour *pCol = NULL;
	if (ok)
	{
		INT32 ColRecordNum;
		ok = Rec->ReadINT32(&ColRecordNum);
		if (ok && PlateType == COLOURPLATE_SPOT)
		{
			DocColour SpotCol;
			ok = pHandler->GetDocColour(ColRecordNum, &SpotCol);
			if (ok)
				pCol = SpotCol.FindParentIndexedColour();
		}
	}

	// If this is a spot plate, it must reference a valid spot colour
	if (PlateType == COLOURPLATE_SPOT &&
		(pCol == NULL || pCol->GetType() != COLOURTYPE_SPOT || pCol->IsDeleted()) )
	{
		// Poohs. No point in keeping this plate around
		delete NewPlate;
		return;
	}

	NewPlate->SetType(NULL, PlateType, pCol);

	if (ok)
	{
		double Angle = 0.0;
		double Frequency = 60.0;

		ok = Rec->ReadDOUBLE(&Angle);
		if (ok)  ok = Rec->ReadDOUBLE(&Frequency);
		if (ok)  NewPlate->SetScreenInfo(Angle, Frequency);
	}

	BYTE Flags;
	if (ok)  ok = Rec->ReadBYTE(&Flags);

	if (ok)
	{
		NewPlate->SetDisabled( (Flags & 0x01) == 0);		// NOTE Flag is ENabled state!
		NewPlate->SetOverprint((Flags & 0x02) != 0);
	}


	if (ok)
	{
		// Now, it'll be quite handy if we add the new plate to the plate list!
		TInfo->AddPlate(NewPlate);
	}
#endif
}
Ejemplo n.º 7
0
void PrintComponent::ImportImagesetting(CXaraFileRecord* Rec)
{
#if !defined(EXCLUDE_FROM_RALPH)
	PORTNOTETRACE("print","PrintComponent::ImportImagesetting - do nothing");
	TypesetInfo *TInfo = GetPrintControl()->GetTypesetInfo();
	if (TInfo == NULL)
		return;

	// Vape any colour plates already resident in the typeset info
	TInfo->DestroyPlateList();

	BOOL ok = TRUE;

	if (ok)
	{
		INT32 Res;
		ok = Rec->ReadINT32(&Res);
		if (ok)  TInfo->SetPrintResolution(Res);
	}

	if (ok)
	{
		double Freq;
		ok = Rec->ReadDOUBLE(&Freq);
		if (ok)  TInfo->SetDefaultScreenFrequency(Freq);
	}

	if (ok)
	{
		UINT16 Func;
		ok = Rec->ReadUINT16(&Func);

		if (ok)
		{
			ScreenType Screen = SCRTYPE_NONE;
			switch(Func)
			{
				case 1: Screen = SCRTYPE_SPOT1;			break;
				case 2: Screen = SCRTYPE_SPOT2;			break;
				case 3: Screen = SCRTYPE_TRIPLESPOT1;	break;
				case 4: Screen = SCRTYPE_TRIPLESPOT2;	break;
				case 5: Screen = SCRTYPE_ELLIPTICAL;	break;
				case 6: Screen = SCRTYPE_LINE;			break;
				case 7: Screen = SCRTYPE_CROSSHATCH;	break;
				case 8: Screen = SCRTYPE_MEZZOTINT;		break;
				case 9: Screen = SCRTYPE_SQUARE;		break;
				case 0: Screen = SCRTYPE_DITHER;		break;
			}
			TInfo->SetScreenFunction(Screen, TRUE);
		}
	}

	if (ok)
	{
	  	BYTE Flags;
		ok = Rec->ReadBYTE(&Flags);

		TInfo->SetSeparations(	(Flags & 0x01) != 0);
		TInfo->SetOutputPrintersMarks(TInfo->AreSeparating());	// Slave Printers Marks off the Seps flag

		TInfo->SetScreening(	(Flags & 0x02) != 0);
		TInfo->SetEmulsionDown(	(Flags & 0x04) != 0);
		TInfo->SetPhotoNegative((Flags & 0x08) != 0);
		TInfo->SetOverprintBlack((Flags & 0x10) != 0);
	} 
#endif
}
Ejemplo n.º 8
0
BOOL PrintPSRenderRegion::WritePlateScreen(KernelDC *pDC)
{
	PrintControl *pPrintCtl=NULL;
	View *pView = GetRenderView();
	if (pView) pPrintCtl = pView->GetPrintControl();
	if (!pPrintCtl)
		return TRUE;

	// Get a pointer to the typeset info structure
	TypesetInfo *pInfo = pPrintCtl->GetTypesetInfo();
	
	double ang,freq;
	String_256 ScreenName;
	ScreenType scrtype;

	// If separating then interogate the current plate
	if (pInfo->AreSeparating())
	{
		ColourPlate* pSeparation;
		GetOutputColourPlate(COLOURMODEL_CMYK, NULL, &pSeparation);
		
		// do nothing if we are not separating
		if (pSeparation==NULL)
			return TRUE;

		// Make sure screening is on in this plate
		if (!pSeparation->ActiveScreening())
			return TRUE;

		// Get the screen type if enabled.
		scrtype = pSeparation->GetScreenFunction();
		if (scrtype==SCRTYPE_NONE)
			return TRUE;

		// ok we can get the angle and frequency
		ang = pSeparation->GetScreenAngle();
		freq = pSeparation->GetScreenFrequency();
	}
	else
	{
		// Is screening off?
		if (!pInfo->AreScreening())
			return TRUE;

		scrtype = pInfo->GetScreenFunction();
		if (scrtype==SCRTYPE_NONE)
			return TRUE;

		ang = 45.0;
		freq = pInfo->GetDefaultScreenFrequency();
	}

	// read the name of this screen
	pInfo->GetScreenName(scrtype, &ScreenName);
		
	String_256 fred;
	fred += String_8(_T("{"));
	fred += ScreenName;
	fred += String_8(_T("}"));

	// ok output 'freq ang screenfunc setscreen'
	BOOL ok = pDC->OutputFloat(freq, 4);
	ok = ok && pDC->OutputFloat(ang, 4);
	ok = ok && pDC->OutputToken(fred);
	ok = ok && pDC->OutputToken(_T("setscreen"));
	ok = ok && pDC->OutputNewLine();

	return ok;
}