BOOL PrintComponent::ExportColourPlate(BaseCamelotFilter *pFilter, ColourPlate *pPlate) { ERROR3IF(pPlate == NULL, "Illegal NULL params"); BOOL ok = TRUE; #if !defined(EXCLUDE_FROM_RALPH) // --- Save any referenced spot colour IndexedColour *pCol = pPlate->GetSpotColour(); INT32 SpotRecordNumber = 0; if (pCol != NULL) { DocColour Fred; Fred.MakeRefToIndexedColour(pCol); SpotRecordNumber = pFilter->WriteRecord(&Fred); ok = (SpotRecordNumber > 0); } // -- Now save the ColourPlate CXaraFileRecord Rec(TAG_COLOURPLATE, TAG_COLOURPLATE_SIZE); if (ok) ok = Rec.Init(); BYTE Type = 0; switch(pPlate->GetType()) { case COLOURPLATE_CYAN: Type = 1; break; case COLOURPLATE_MAGENTA: Type = 2; break; case COLOURPLATE_YELLOW: Type = 3; break; case COLOURPLATE_KEY: Type = 4; break; case COLOURPLATE_SPOT: Type = 5; break; default: break; } // Size Total if (ok) ok = Rec.WriteBYTE(Type); // 1 1 if (ok) ok = Rec.WriteReference(SpotRecordNumber); // 4 5 double temp = pPlate->GetScreenAngle(); if (ok) ok = Rec.WriteDOUBLE(temp); // 8 13 temp = pPlate->GetScreenFrequency(); if (ok) ok = Rec.WriteDOUBLE(temp); // 8 21 // BYTE Flags = 0x00; // 1 22 if (!pPlate->IsDisabled()) Flags |= 0x01; if (pPlate->Overprints()) Flags |= 0x02; if (ok) ok = Rec.WriteBYTE(Flags); if (ok) pFilter->Write(&Rec); #endif // EXCLUDE_FROM_RALPH return(ok); }
IndexedColour *ColourDragInformation::GetColourForDocument(Document *pDestDoc) { // If no document supplied, assume the selected docuemnt is the destination if (pDestDoc == NULL) pDestDoc = Document::GetSelected(); // If there is no destination document, or if the colour is transparent, return NULL if (pDestDoc == NULL || TheColour.IsTransparent()) return(NULL); // If it's a document colour and already in the destination document, return it if (pParentDoc == pDestDoc) return(TheColour.FindParentIndexedColour()); // Copy the dragged colour into a temporary DocColour DocColour Temp = TheColour; IndexedColour *TempIxCol = NULL; // Check if we've got an IndexedColour to use... if (Temp.FindParentIndexedColour() == NULL) { // It's a library colour, so we must create a new IndexedColour to use TempIxCol = new IndexedColour(Temp); if (TempIxCol == NULL) return(NULL); // Failure - return "no colour" TempIxCol->SetName(ColourName); if (LibColIsSpot) // If a spot colour, make it so TempIxCol->SetLinkedParent(TempIxCol->FindLastLinkedParent(), COLOURTYPE_SPOT); // And make the DocColour reference it Temp.MakeRefToIndexedColour(TempIxCol); } // Ensure the colour (or a safe equivalent) is in the dest doc, by copying/merging it ColourManager::EnsureColourIsInDocument(pParentDoc, pDestDoc, &Temp); // And delete any temporary IndexedColour we created if (TempIxCol != NULL) delete TempIxCol; // And finally, return the resulting colour return(Temp.FindParentIndexedColour()); }
void ColourGallery::DoApplyItem(ListItem *ItemToApply) { if (ItemToApply == NULL) // Check for stupidity just in case return; // Fill colour selected so create a fill colour attribute NodeAttribute *Attrib = new AttrColourChange; if (Attrib == NULL) return; DocColour Ref = *((AttrColourChange *)Attrib)->GetStartColour(); Ref.MakeRefToIndexedColour((IndexedColour *) ItemToApply); ((AttrColourChange *)Attrib)->SetStartColour(&Ref); // AttributeSelected knows what to do with a selected attribute AttributeManager::AttributeSelected(NULL, Attrib); }
BOOL GuidesPropertiesTab::ShowColours() { if (pColourDropDown != NULL) { IndexedColour* pIndexedColour = NULL; Layer* pLayer = GetGuideLayer(); if (pLayer != NULL) { DocColour* pDocColour = pLayer->GetGuideColour(); if (pDocColour != NULL) { pIndexedColour = pDocColour->FindParentIndexedColour(); if (pIndexedColour->IsDeleted()) { pLayer->SetGuideColour(NULL); pIndexedColour = NULL; } } } pColourDropDown->ClearAllSpecialEntries(); if (pIndexedColour != NULL) { if (!pIndexedColour->IsNamed()) { String_256 LocalColourText(_R(IDS_LOCALCOLOUR)); DocColour LocalColour; LocalColour.MakeRefToIndexedColour(pIndexedColour); pColourDropDown->AddSpecialEntry(&LocalColourText,&LocalColour); } pColourDropDown->FillInColourList(pIndexedColour); } else pColourDropDown->FillInColourList(NULL,0); } return TRUE; }