Пример #1
0
void CImage::DeleteObject(LPOBJECT lpObject )
{
	if ( lpObject )
	{
		ObjDeleteObject(&ObjList, (LPPRIMOBJECT)lpObject);
		SetupMiniViews(NULL, NO);
	}
}
Пример #2
0
void CImage::ChangeSelection(LPOBJECT lpObject, BOOL fSelect, BOOL fExtendedSel)
{
	ASSERT(lpObject != NULL);
	if (!fExtendedSel && fSelect)
    	ObjDeselectAll(&ObjList);
	ObjSelectObject((LPPRIMOBJECT)lpObject, fSelect);
	AdjustGroupSelection(fSelect);
	SetupMiniViews(NULL, YES);
}
Пример #3
0
void CImage::InvertSelection()
{
	LPOBJECT lpObject;

	lpObject = GetBase();
	while (lpObject = GetNextObject(lpObject, YES, NO))
    	ObjSelectObject((LPPRIMOBJECT)lpObject, !lpObject->fSelected);
	SetupMiniViews(NULL, YES);          
}
Пример #4
0
BOOL CImage::DuplicateSelObjects()
{
LPOBJECT lpDupObject;
OBJECTLIST DupList;
LPOBJECT lpObject;
RECT rUpdate;
WORD wGroupID, wOldGroupID, wLastGroupID;

if (!ImgEditInit( this, ET_OBJECT, UT_DELETEOBJECTS, GetBase() ))
    return(FALSE);

DupList.lpHead = DupList.lpTail = NULL;
lpObject = NULL;
while (lpObject = GetSelObject(lpObject))
    {
    if (!(lpDupObject = ObjDuplicateObject(lpObject)))
        {
        ObjDeleteObjects(&DupList, ST_ALL);
        return(FALSE);
        }
    ObjAddTail(&DupList, (LPPRIMOBJECT)lpDupObject);
    }
wLastGroupID = wGroupID = GetNextGroupID();
lpDupObject = NULL;
while (lpDupObject = (LPOBJECT)ObjGetNextObject(&DupList,
                    (LPPRIMOBJECT)lpDupObject, YES))
    {
    if (!lpDupObject->wGroupID || lpDupObject->wGroupID >= wLastGroupID)
        continue;
    wOldGroupID = lpDupObject->wGroupID;
    lpDupObject->wGroupID = wGroupID;
    lpObject = lpDupObject;
    while (lpObject = (LPOBJECT)ObjGetNextObject(&DupList,
                    (LPPRIMOBJECT)lpObject, YES))
        {
        if (lpObject->wGroupID == wOldGroupID)
            lpObject->wGroupID = wGroupID;
        }
    ++wGroupID;
    }

RemoveObjectMarquee(this);
ObjDeselectAll(&ObjList);
while (lpObject = (LPOBJECT)ObjGetNextObject(&DupList, NULL, YES))
    {
    ObjUnlinkObject(&DupList, (LPPRIMOBJECT)lpObject);
    ObjSelectObject( (LPPRIMOBJECT)lpObject, YES ); // Select the new object
    ObjAddTail( &ObjList, (LPPRIMOBJECT)lpObject ); // Add to the image's list
    lpObject->fUndoDeleted = YES;
    }
ImgEditedObject(this, GetBase(), IDS_UNDODUPLICATE, NULL);

GetSelObjectRect(&rUpdate, NO);
UpdateImage(this, &rUpdate, YES);
SetupMiniViews(NULL, NO);
return(TRUE);
}
Пример #5
0
void CImage::AdjustLayerObject(LPOBJECT lpObject,
                        LPOBJECT lpToObject, BOOL fAfter)
{
	LPOBJECT lpBase;

	if (!lpObject || !lpToObject)
    	return;
	if (lpObject == lpToObject)
    	return;
	lpBase = GetBase();
	if (lpObject == lpBase || lpToObject == lpBase)
    	return;
	ObjUnlinkObject(&ObjList, (LPPRIMOBJECT)lpObject);
	ObjLinkObject(&ObjList, (LPPRIMOBJECT)lpToObject,
            	(LPPRIMOBJECT)lpObject, fAfter);
	SetupMiniViews(NULL, NO);
}
Пример #6
0
void ImgEditUndo( LPIMAGE lpImage, BOOL fEditUndo, BOOL fMaskUndo )
/***********************************************************************/
{
RECT rUndo, rUndoMask, rTemp;
LPOBJECT lpBase, lpObject, lpNext;
BOOL fNewSize, fSetupMiniViews, fRemoveMarquee, fUndoDelete;
BOOL fUndoAlpha, fUndoData;
int nDeleted;
LPMASK lpMask;

if (!lpImage)
	return;

// Initialize things for updating the display
fNewSize = fSetupMiniViews = fUndoDelete = NO;
AstralSetRectEmpty(&rUndo);
AstralSetRectEmpty(&rUndoMask);

// loop through objects doing undo
lpBase = ImgGetBase(lpImage);
lpObject = NULL;
while (lpObject = ImgGetNextObjectEx(lpImage, lpObject, NO, NO, fEditUndo))
	{
	// See if this is an object we are undoing
	if (fEditUndo)
		{
		// check for special undo processing of a deleted object
		if (lpObject->fDeleted) 
			{
			if (Control.UndoObjects && !ImgIsSelectedObject(lpImage, lpBase))
				continue;
			}
		else
		if (Control.UndoObjects && !ImgIsSelectedObject(lpImage, lpObject))
			continue;
		}
	// Only handle mask undo for the base object
	if (fMaskUndo)
		{
		if (lpObject != lpBase || lpObject->fBothDirty ||
			!lpObject->AlphaDirty)
		continue;
		}

	fUndoData = fUndoAlpha = NO;

	// Do preprocess for doing a data undo
	if (fEditUndo)
		{
		if (lpObject->DataDirty)
			fUndoData = YES;
		// See if we need to undo the alpha for this object
		if ((lpObject != lpBase) && lpObject->lpAlpha && lpObject->AlphaDirty)
			fUndoAlpha = YES;
		if (!fUndoData && !fUndoAlpha)
			continue;
	
		// check to see and undoing/redoing deleted objects will change
		// the select state, if so undraw the object marquee
		if (lpObject == lpBase &&
			lpObject->DataUndoType & UT_DELETEOBJECTS)
			{
			fUndoDelete = YES;
			fRemoveMarquee = NO;
			nDeleted = 0;
			lpNext = lpObject;
			while (lpNext = ImgGetNextObjectEx(lpImage, lpNext, YES, NO, YES))
				{
				if (lpNext->fUndoDeleted)
					++nDeleted;
				else
				if (lpNext->fDeleted && lpNext->fSelected)
					{
					fRemoveMarquee = YES;
					break;
					}
				}
			if (ImgGetSelObject(lpImage, NULL) == lpBase && !fRemoveMarquee)
				{
				if (ImgCountObjects(lpImage) - nDeleted <= 1)
					fRemoveMarquee = YES;
				}
			if (fRemoveMarquee)
				RemoveObjectMarqueeEx(lpImage, NO);
			}
		}
	else // fMaskUndo
	if (!lpObject->AlphaDirty)
		continue;
	else
		fUndoAlpha = YES;

	// do a preprocess for undoing the mask caused either by
	// a mask undo or by an edit function that also edits the mask
	if (((lpObject == lpBase) && fEditUndo && lpObject->fBothDirty) ||
		fMaskUndo)
		{
		if ( lpObject->AlphaUndoType & (UT_CREATEMASK|UT_DELETEMASK) )
			{
			// if the undo is going to delete the mask,
			// we need to undraw the mask
			if (ImgGetMask(lpImage))
				{
				RemoveMaskMarquee(lpImage);
				if (ImgGetMaskUpdateRect(lpImage, YES, NO, &rTemp))
					AstralUnionRect(&rUndoMask, &rUndoMask, &rTemp);
				}
			// if the undo is going to create the mask,
			// we need to undraw the object marquees if
			// not in mask and object marquee mode
			else
				{
				if (!Control.UseMaskAndObjects)
 					RemoveObjectMarqueeEx(lpImage, NO);
				}
			}
		}

	// Actually do the undo
	ObjEditUndo(lpImage, lpObject, fUndoData, fUndoAlpha);

	// do a postprocess for undoing the mask
	if ((lpMask = ImgGetMask(lpImage)) &&
		(((lpObject == lpBase) && fEditUndo && lpObject->fBothDirty) ||
		fMaskUndo))
		{
		// if the undo is going to add the mask, we need to redraw the mask
		if (lpObject->AlphaUndoType & (UT_CREATEMASK|UT_DELETEMASK) )
			{
			if (ImgGetMaskUpdateRect(lpImage, YES, NO, &rTemp))
				AstralUnionRect(&rUndoMask, &rUndoMask, &rTemp);
			}
		else
			// just redraw the undo area for the mask
			AstralUnionRect(&rUndoMask, &rUndoMask, &lpMask->Pixmap.UndoRect);
		}

	// Setup rectangle for undoing deletion of objects
	// Handled specially so that moved objects will still undo
	// and redo properly
	if (fEditUndo)
		{
		if (lpObject == lpBase &&
			lpObject->DataUndoType & UT_DELETEOBJECTS)
			{
			lpNext = lpObject;
			while (lpNext = ImgGetNextObjectEx(lpImage, lpNext, YES, NO, YES))
				{
				if (lpNext->fDeleted || lpNext->fUndoDeleted)
					AstralUnionRect(&rUndo, &rUndo, &lpNext->rObject);
				}
			fSetupMiniViews = YES;
			}

		if (lpObject->Pixmap.fNewFrame)
			{
			/* if new frame, cause window to be redisplayed */
			if (lpObject == lpBase)
				fNewSize = YES;
			else
				{
				if (!fNewSize)
					{
					AstralUnionRect(&rUndo, &rUndo, &lpObject->rObject);
					AstralUnionRect(&rUndo, &rUndo, &lpObject->rUndoObject);
					}
				}
			}
		else
			{
			AstralSetRectEmpty(&rTemp);
			if (fUndoData)
				AstralUnionRect(&rTemp, &rTemp, &lpObject->Pixmap.UndoRect);
			if (fUndoAlpha)
				AstralUnionRect(&rTemp, &rTemp,
						&lpObject->lpAlpha->Pixmap.UndoRect);
			if (rTemp.right >= rTemp.left)
				{
				if (!fNewSize)
					{
					OffsetRect(&rTemp, lpObject->rObject.left,
							lpObject->rObject.top);
					AstralUnionRect(&rUndo, &rUndo, &rTemp);
					}
				}
			}
		}
	}
// now redisplay whatever changes are necessary for the undo
if (fNewSize)
	{
	SetupImagePalette(lpImage, NO, YES);
	if (lpBase->Pixmap.UndoFrame)
		{
		if ((FrameXSize(lpBase->Pixmap.UndoFrame) ==
			FrameXSize(lpBase->Pixmap.EditFrame)) &&
			(FrameYSize(lpBase->Pixmap.UndoFrame) ==
			FrameYSize(lpBase->Pixmap.EditFrame)))
			fNewSize = NO;
		}
	if (fNewSize)
		UpdateImageSize();
	else
		UpdateImageEx(lpImage, NULL, YES, YES, YES);
	if ( Tool.hRibbon )
		SendMessage( Tool.hRibbon, WM_CONTROLENABLE, 0, 0L );
	}
else
	{
	if (rUndoMask.right >= rUndoMask.left)
		{
		File2DispRect(&rUndoMask, &rUndoMask);
		AstralToWindowsRect(&rUndoMask);
		InvalidateRect(lpImage->hWnd, NULL, NO);
		}
	if (rUndo.right >= rUndo.left)
		AnimateUndo( &rUndo );
	}
if (fUndoDelete)
	if ( Tool.hRibbon )
		SendMessage( Tool.hRibbon, WM_CONTROLENABLE, 0, 0L );
	
if (fSetupMiniViews)
	SetupMiniViews(NULL, NO);
}
Пример #7
0
void CImage::DeleteTempObjects()
{
ObjDeleteObjects(&ObjList, ST_TEMPORARY);
SetupMiniViews(NULL, NO);
}