Ejemplo n.º 1
0
ActionCode LayerColourAction::Init(	UndoableOperation* pOp,
									ActionList* pActionList,
									OpChangeLayerColourParam EntryParam)
{
	UINT32 ActSize = sizeof(LayerColourAction);

	LayerColourAction* pNewAction;
	ActionCode Ac = Action::Init(pOp,pActionList,ActSize,CC_RUNTIME_CLASS(LayerColourAction),(Action**)&pNewAction);

	if (Ac != AC_FAIL && pNewAction != NULL)
	{
		OpChangeLayerColourParam& Param = ((LayerColourAction*)pNewAction)->Param;

		Document* pDoc 	 = EntryParam.pDoc;
		Layer*    pLayer = EntryParam.pLayer;

		Param.pDoc 	 = pDoc;
		Param.pLayer = pLayer;

		if (pDoc != NULL && pLayer != NULL)
		{
			DocColour* pDocColour = pLayer->GetGuideColour();
			Param.pColour = pDocColour->FindParentIndexedColour();

			pLayer->SetGuideColour(EntryParam.pColour);
			LayerSGallery::ForceRedrawLayer(pDoc,pLayer);
			BROADCAST_TO_ALL(LayerMsg(pLayer,LayerMsg::GUIDELINES_CHANGED));
		}

		ERROR3IF(pDoc == NULL,  "pDoc is NULL");			
		ERROR3IF(pLayer == NULL,"pLayer is NULL");			
	}

	return Ac;
}
Ejemplo n.º 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;
}