Exemple #1
0
void ColourGallery::SetSelectionFromDocument(void)
{
	DocColour *SelColour[2];
	BOOL AreCurrentAttrs =
			ColourManager::GetCurrentLineAndFillColours(&SelColour[0], &SelColour[1]);

	DeselectAllItems();					// Clear the current selection
	if (!AreCurrentAttrs)
	{
		// The line/fill colours returned are those of the selection, not the current attrs
		IndexedColour *Parent;
		
		for (INT32 i = 0; i < 2; i++)		// For each colour (line, fill)
		{
			if (SelColour[i] != NULL)	// If there is a single selected colour
			{
				Parent = SelColour[i]->FindParentIndexedColour();		// Find the named IxColour
				if (Parent != NULL && Parent->IsNamed())				// (if any)
				{
					SequenceItem *SeqItem = FindSequenceItem(Parent);	// And select it

					if (SeqItem != NULL)
						SetDisplayItemSelState(SeqItem, TRUE);
				}
			}
		}
	}
}
Exemple #2
0
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;
}
Exemple #3
0
BOOL ColourGallery::DoRedefineItem(ListItem *ItemToRedefine)
{
	// Bring up the colour editor on the new colour
	if (ItemToRedefine != NULL)
		DoSpecialClick(ItemToRedefine);

	return(TRUE);

#if FALSE
	ColourList *ColList = ColourManager::GetColourList();
	if (ColList == NULL)
		return(FALSE);

	DocColour *SourceColour = NULL;
	if (ColourManager::GetCurrentLineAndFillColours(NULL, &SourceColour))
		SourceColour = NULL;				// Sourcecolour returned was current attr - don't use

	if (SourceColour == NULL)
	{
		// Nothing to copy to redefine the colour. Report this to the user
		InformError(_R(IDE_COLGAL_NOSOURCE), _R(IDS_OK));
		return(FALSE);
	}

	// We have a colour to copy...
	INT32 Result;
	IndexedColour *ParentColour = SourceColour->FindParentIndexedColour();
	if (ParentColour == NULL)
	{
		Result = AskQuestion(_R(IDS_COLGAL_QREDEFINE), _R(IDS_COLGAL_YREDEFINE), _R(IDS_CANCEL));

		if (Result == 1)		// The user said to go ahead...
		{
			// Source is an immediate colour - generate an IndexedColour from its definition
			ColourGeneric Bob;
			SourceColour->GetSourceColour(&Bob);
			*((IndexedColour *)ItemToRedefine) = IndexedColour(SourceColour->GetColourModel(), &Bob);
			return(TRUE);
		}

		return(FALSE);			// The user cancelled
	}

	if (ParentColour == (IndexedColour *) ItemToRedefine)
	{
		InformError(_R(IDE_COLGAL_SAMEITEM));
		return(FALSE);
	}

	Result = 3;			// Default to making a copy of the colour

	{
		IndexedColour *NewCol = (IndexedColour *)ItemToRedefine;
		
		*NewCol = *ParentColour;
		if (ParentColour->IsNamed())
		{
			String_128 NewName;		// Accomodate overflow- SetName clips this to String_64
			NewName.MakeMsg(_R(IDS_COPYOFCOLOUR), (TCHAR *) (*ParentColour->GetName()));
			((IndexedColour *)ItemToRedefine)->SetName(NewName);

			// If the parent was named, then remember it as the 'parent' colour, even
			// if it was not tint/linked. This will allow the colour editor to default
			// to linking to a useful colour if tint/link is turned on at a later date.
			NewCol->SetLinkedParent(ParentColour, NewCol->GetType());
		}
	}

	if (Result != 0)				// Finally, inform the world if this item has changed
		ColourManager::ColourHasChanged(GetGalleryDocument(),
										ColList, (IndexedColour *) ItemToRedefine);

	return(Result != 0);			// if Cancelled, return FALSE (no change), else TRUE

#endif


}