/******************************************************************************************** > static OpState OpRemoveClipView::GetState(String_256* pstrDescription, OpDescriptor* pOpDesc) Author: Karim_MacDonald (Xara Group Ltd) <*****@*****.**> Created: 01 February 2000 Inputs: pstrDescription pOpDesc Outputs: Returns: Purpose: Errors: See also: ********************************************************************************************/ OpState OpRemoveClipView::GetState(String_256* pstrDescription, OpDescriptor* pOpDesc) { // default is an unticked, ungreyed, *NOT* on-menu state. OpState OpSt; OpSt.RemoveFromMenu = TRUE; // obtain the app's current selection. // we want to treat bevels/contours etc. as atomic objects. Range Sel(*(GetApplication()->FindSelection())); RangeControl rc = Sel.GetRangeControlFlags(); rc.PromoteToParent = TRUE; Sel.Range::SetRangeControl(rc); // we only show ourself if the selection consists of one lone NodeClipViewController. Node* pNode = Sel.FindFirst(); if (pNode != NULL && pNode->IsANodeClipViewController()) { if (Sel.FindNext(pNode) == NULL) { OpSt.RemoveFromMenu = FALSE; // if it's selected inside, we gray ourself and give a reason. if (Sel.ContainsSelectInside()) { OpSt.Greyed = TRUE; *pstrDescription = String_256(_R(IDS_GREY_WHEN_SELECT_INSIDE)); } } } return OpSt; }
void CPActionInsertAtSel::Redo(CMainFrame &MainFrm) { CPatternEditor *pPatternEditor = GET_PATTERN_EDITOR(); CSelection Sel(m_pUndoState->Selection); Sel.m_cpEnd.Ypos.Row = pPatternEditor->GetCurrentPatternLength(Sel.m_cpEnd.Ypos.Frame) - 1; DeleteSelection(*GET_SONG_VIEW(), Sel); if (m_UndoHead.ContainsData()) pPatternEditor->PasteRaw(m_UndoHead, m_cpHeadPos); }
void CPActionDeleteAtSel::Redo(CMainFrame &MainFrm) { CPatternEditor *pPatternEditor = GET_PATTERN_EDITOR(); CSelection Sel(m_pUndoState->Selection); Sel.m_cpEnd.Ypos.Row = pPatternEditor->GetCurrentPatternLength(Sel.m_cpEnd.Ypos.Frame) - 1; DeleteSelection(*GET_SONG_VIEW(), Sel); if (m_UndoTail.ContainsData()) pPatternEditor->PasteRaw(m_UndoTail, m_pUndoState->Selection.m_cpStart); pPatternEditor->CancelSelection(); }
/******************************************************************************************** > static OpState OpApplyClipView::GetState(String_256* pstrDescription, OpDescriptor* pOpDesc) Author: Karim_MacDonald (Xara Group Ltd) <*****@*****.**> Created: 01 February 2000 Inputs: Outputs: Returns: Purpose: Errors: See also: ********************************************************************************************/ OpState OpApplyClipView::GetState(String_256* pstrDescription, OpDescriptor* pOpDesc) { // default is an unticked, *GREYED*, on-menu state. OpState OpSt; OpSt.Greyed = TRUE; *pstrDescription = String_256(_R(IDS_CLIPVIEW_NEEDS_MULTIPLE_NODES)); // obtain the app's current selection. // we want to treat bevels/contours etc. as atomic objects. Range Sel(*(GetApplication()->FindSelection())); RangeControl rc = Sel.GetRangeControlFlags(); rc.PromoteToParent = TRUE; Sel.Range::SetRangeControl(rc); // is there actually anything in the selection? Node* pNode = Sel.FindFirst(); if (pNode != NULL) { // yes - then is it only one node? if (Sel.FindNext(pNode) == NULL) { // yes - then if that node is a NodeClipViewController, remove ourself from the menu. if (pNode->IsANodeClipViewController()) { OpSt.RemoveFromMenu = TRUE; pstrDescription->Empty(); } } // two or more nodes - that's ok, but only if there is currently no select-inside. else if (Sel.ContainsSelectInside()) { *pstrDescription = String_256(_R(IDS_GREY_WHEN_SELECT_INSIDE)); } else { OpSt.Greyed = FALSE; pstrDescription->Empty(); } } return OpSt; }
/******************************************************************************************** > OpState OpMakeShapes::GetState(String_256*, OpDescriptor*) Author: Simon_Maneggio (Xara Group Ltd) <*****@*****.**> Created: 29/04/94 Inputs: - Outputs: - Returns: The state of the OpMakeShapes Purpose: For finding the OpMakeShapes's state. ********************************************************************************************/ OpState OpMakeShapes::GetState(String_256* UIDescription, OpDescriptor*) { OpState OpSt; SelRange Sel(*(GetApplication()->FindSelection())); RangeControl rg = Sel.GetRangeControlFlags(); rg.PromoteToParent = TRUE; Sel.Range::SetRangeControl(rg); // Set up the ObjChangeParam so we can ask the selected nodes if they mind being deleted ObjChangeFlags cFlags(TRUE); ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL); // Will one or more selected nodes allow this op? if (!Sel.AllowOp(&ObjChange,FALSE)) OpSt.Greyed = TRUE; return(OpSt); }
/******************************************************************************************** > OpState OpConvertToBitmap::GetState(String_256*, OpDescriptor*) Author: Will_Cowling (Xara Group Ltd) <*****@*****.**> Created: 11/6/96 Returns: The state of the OpConvertToBitmap operation Purpose: For finding the OpConvertToBitmap's state. Errors: - SeeAlso: - ********************************************************************************************/ OpState OpConvertToBitmap::GetState(String_256* UIDescription, OpDescriptor*) { OpState OpSt; String_256 DisableReason; // Ensure that a document exists if (Document::GetSelected() == NULL) { // There is no selected document OpSt.Greyed = TRUE; // Load reason why operation is disabled DisableReason = String_256(_R(IDS_NO_DOC)); *UIDescription = DisableReason; return OpSt; } // Obtain the current selections Range Sel(*(GetApplication()->FindSelection())); // This operation is disabled if there are no nodes selected, or if none of the selected // objects can become a NodePath. Node* FirstSelected = Sel.FindFirst(); OpSt.Greyed = FALSE; if (FirstSelected == NULL) { OpSt.Greyed = TRUE; // Load reason why operation is disabled DisableReason = String_256(_R(IDS_NO_OBJECTS_SELECTED)); *UIDescription = DisableReason; } return(OpSt); }
/******************************************************************************************** > virtual void OpRemoveClipView::Do(OpDescriptor* pOpDesc, OpParam* pOpParam) Author: Karim_MacDonald (Xara Group Ltd) <*****@*****.**> Created: 01 February 2000 Inputs: Outputs: Returns: Purpose: Errors: See also: ********************************************************************************************/ void OpRemoveClipView::Do(OpDescriptor* pOpDesc) { // try to record the selection state. if (DoStartSelOp(FALSE, FALSE)) { // obtain the current selection. Range Sel(*(GetApplication()->FindSelection())); RangeControl rc = Sel.GetRangeControlFlags(); rc.PromoteToParent = TRUE; Sel.Range::SetRangeControl(rc); // check that the selection is one lone NodeClipViewController. BOOL ok = FALSE; Node* pFirstNode = Sel.FindFirst(); if (pFirstNode != NULL && pFirstNode->IsANodeClipViewController()) if (Sel.FindNext(pFirstNode) == NULL) ok = TRUE; // remove tool blobs and localise any common attributes. Tool* pTool = NULL; Spread* pSpread = NULL; if (ok) { // render blobs off for tools which don't automatically redraw their blobs. pTool = Tool::GetCurrent(); pSpread = Document::GetSelectedSpread(); if (pSpread != NULL && pTool != NULL && !pTool->AreToolBlobsRenderedOnSelection()) pTool->RenderToolBlobs(pSpread, NULL); // invalidate the region of screen covering the selection. DoInvalidateNodesRegions(*(GetApplication()->FindSelection()), TRUE, FALSE, FALSE); // localise any common attributes. ok = DoLocaliseCommonAttributes((NodeGroup*)pFirstNode); } // deselect and hide the NCVC. NodeHidden* pHiddenNode = NULL; if (ok) { // deselect the NCVC, but don't ask for its blobs to be redrawn. ((NodeRenderable*)pFirstNode)->DeSelect(FALSE); ERROR3IF(pFirstNode->IsSelected(), "Deselect failed to deselect current node"); // hide the NodeClipViewController. ok = DoHideNode(pFirstNode, FALSE, &pHiddenNode, FALSE); ERROR3IF(!ok, "Unable to hide NodeClipViewController!"); } // hide the NCVC's NodeClipView node. if (ok) { NodeHidden* pDummy; NodeClipView* pClipView = ((NodeClipViewController*)pFirstNode)->GetClipView(); ok = DoHideNode(pClipView, FALSE, &pDummy, FALSE); ERROR3IF(!ok, "Unable to hide NodeClipView!"); } // show and select the NCVC's children. // a straight loop-over should do, as it should skip the now-hidden NodeClipView. if (ok) { // get the first child node (the NCVC's keyhole node). Node* pChildNode = pFirstNode->FindFirstChild(); if (pChildNode == NULL) TRACEUSER( "Karim", _T("OpRemoveClipView::Do(); Found an empty NodeClipViewController!\n")); // move and select the child nodes in turn. Node* pAnchorNode = pHiddenNode; Node* pNextChildNode = NULL; while (pChildNode != NULL) { // get the next child-node. pNextChildNode = pChildNode->FindNext(); // if the node is not a NodeHidden then move the node to its new location in // the tree - there is no need to render the node. if (!pChildNode->IsAnAttribute() && !pChildNode->IsNodeHidden()) { // move pChildNode to be the next-sibling of the anchor node. ok = DoMoveNode(pChildNode, pAnchorNode, NEXT); if (!ok) break; pAnchorNode = pChildNode; } // select the child node and invalidate its bounding rect, // but don't bother redrawing its blobs yet. if (pChildNode->IsAnObject()) { ((NodeRenderableInk*)pChildNode)->Select(FALSE); ((NodeRenderableInk*)pChildNode)->InvalidateBoundingRect(); ok = this->DoInvalidateNodeRegion(((NodeRenderableInk*)pChildNode), TRUE); if (!ok) break; } pChildNode = pNextChildNode; } } // render blobs back on for tools which don't automatically redraw their blobs. if (ok) { if (pSpread != NULL && pTool != NULL && !pTool->AreToolBlobsRenderedOnSelection()) pTool->RenderToolBlobs(pSpread, NULL); } // fail gracefully if things went pear-shaped. else FailAndExecute(); } End(); }
/******************************************************************************************** > virtual void OpApplyClipView::Do(OpDescriptor* pOpDesc, OpParam* pOpParam) Author: Karim_MacDonald (Xara Group Ltd) <*****@*****.**> Created: 01 February 2000 Inputs: Outputs: Returns: Purpose: Errors: See also: ********************************************************************************************/ void OpApplyClipView::Do(OpDescriptor* pOpDesc) { // obtain the current selection. Range Sel(*(GetApplication()->FindSelection())); RangeControl rc = Sel.GetRangeControlFlags(); rc.PromoteToParent = TRUE; Sel.Range::SetRangeControl(rc); // check that at least two nodes are selected. Node* pNode = NULL; Node* pFirstNode = Sel.FindFirst(); if (pFirstNode != NULL) pNode = Sel.FindNext(pFirstNode); if (pFirstNode == NULL || pNode == NULL) { ERROR3("OpApplyClipView invoked with less than two selected nodes. This should never occur."); End(); return; } // render blobs off for tools which don't automatically redraw their blobs. Tool* pTool = Tool::GetCurrent(); Spread* pSpread = Document::GetSelectedSpread(); if (pSpread != NULL && pTool != NULL && !pTool->AreToolBlobsRenderedOnSelection()) pTool->RenderToolBlobs(pSpread, NULL); // record the current selection state and if required, render off any selection blobs. if (!DoStartSelOp(FALSE, FALSE)) { End(); return; } // invalidate the region bounding the selection. // the commented code doesn't do the job properly (doesn't tackle undo) // though it should - I get the feeling I'm not using it correctly. // so we'll just have to invalidate the selection node by node. // if (!DoInvalidateNodesRegions(Sel, TRUE, FALSE, FALSE)) // { // End(); // return; // } Node* pSelNode = Sel.FindFirst(); while (pSelNode != NULL) { if (pSelNode->IsAnObject()) { if (!DoInvalidateNodeRegion((NodeRenderableInk*)pSelNode, TRUE)) { End(); return; } } pSelNode = Sel.FindNext(pSelNode); } // we need to insert the controller node at the position of the highest // selected node in the z-order, ie last in the selection, so find it. Node* pLastNode = NULL; while (pNode != NULL) { pLastNode = pNode; pNode = Sel.FindNext(pLastNode); } // loop terminates with pNode == NULL, pLastNode == last-node-in-sel. // create a new NodeClipViewController, which we will shortly insert into the tree; // note that ALLOC_WITH_FAIL automatically calls FailAndExecute() if things go wrong. NodeClipViewController* pClipViewController = NULL; ALLOC_WITH_FAIL(pClipViewController, new NodeClipViewController, this); BOOL ok = (pClipViewController != NULL); // put an action to hide the NodeClipViewController onto the undo action-list, // so that if the user presses undo then it will be hidden. if (ok) { HideNodeAction* pUndoHideNodeAction = NULL; ActionCode ac = HideNodeAction::Init(this, &UndoActions, pClipViewController, FALSE, // don't include subtree size (Action**)&pUndoHideNodeAction, FALSE); // don't tell subtree when undone if (ac == AC_FAIL) { delete pClipViewController; End(); return; } else { // right! we've got our node, we've got our action - lets stick it in the tree // (at a position just next to the last node which will go in the group). pClipViewController->AttachNode(pLastNode, NEXT); } } // move each item from the selection into our ClipView group, // remembering to deselect them as we go. // TODO: // sneaky suspicion I should be putting this in a Do fn in UndoableOperation... if (ok) { pNode = Sel.FindNext(pFirstNode); // the node we're moving now. ok = DoMoveNode(pFirstNode, pClipViewController, FIRSTCHILD); if (ok) ((NodeRenderable*)pFirstNode)->DeSelect(FALSE); } Node* pNextNode = NULL; // the next node to move. Node* pAnchorNode = pFirstNode; // the node we've just moved. while (ok && pNode != NULL) { // get the next node to move. pNextNode = Sel.FindNext(pNode); // now move the current node next to the anchor and deselect it. ok = DoMoveNode(pNode, pAnchorNode, NEXT); if (ok) ((NodeRenderable*)pNode)->DeSelect(FALSE); // get the new anchor node and the next node to move. pAnchorNode = pNode; pNode = pNextNode; } // try and locate a suitable candidate for a keyhole node. Node* pKeyhole = NULL; if (ok) { // now get the keyhole node, which is the first object-node child of the NCVC. pKeyhole = pClipViewController->FindFirstChild(); while (pKeyhole != NULL && !pKeyhole->IsAnObject()) { pKeyhole = pKeyhole->FindNext(); } // doh! can't find _one_ NodeRenderableInk child! I don't know... if (pKeyhole == NULL) { ok = FALSE; ERROR2RAW("ClipViewController has no object children"); } } // now attach a new NodeClipView, as the immediate NEXT-sibling of the keyhole node. NodeClipView* pClipView = NULL; if (ok) { ALLOC_WITH_FAIL(pClipView, new NodeClipView(pKeyhole, NEXT), this); ok = (pClipView != NULL); } // wow - succeeded! now all we need to do is some house-keeping. if (ok) { // tell the new NodeClipViewController that its current keyhole path is now invalid. pClipViewController->MarkKeyholeInvalid(); // invalidate ours and our parent's bounding rects. our bounding rect is almost // certainly already invalid, as we haven't done anything to make it valid yet. // this is why we invalidate *both* rects - just to cover all cases. pClipViewController->InvalidateBoundingRect(); Node* pParent = pClipViewController->FindParent(); if (pParent != NULL && pParent->IsBounded()) ((NodeRenderableBounded*)pParent)->InvalidateBoundingRect(); // select the new NodeClipViewController, but don't draw any blobs yet. pClipViewController->Select(FALSE); // invalidate the region bounding the selection. if (!DoInvalidateNodesRegions(*(GetApplication()->FindSelection()), TRUE, FALSE, FALSE)) { End(); return; } // factor out any common attributes. if (!DoFactorOutCommonChildAttributes(pClipViewController)) { End(); return; } // render blobs back on if the current tool doesn't automatically redraw its blobs. if (pSpread != NULL && pTool != NULL && !pTool->AreToolBlobsRenderedOnSelection()) pTool->RenderToolBlobs(pSpread, NULL); } else { FailAndExecute(); } // end the operation. End(); }
/******************************************************************************************** > void OpMoveToLayer::Do(OpDescriptor*) Author: Simon_Knight (Xara Group Ltd) <*****@*****.**> Created: 3/5/00 Purpose: This takes the selection and moves it to the active layer. This is a more powerful operation than the move forward/backward a layer ********************************************************************************************/ void OpMoveToLayer::Do(OpDescriptor*) { if (DoStartSelOp(FALSE,TRUE)) { // get the selection Range Sel(*(GetApplication()->FindSelection())); // set the range flags so it includes shadow and bevel manager nodes RangeControl rg = Sel.GetRangeControlFlags(); rg.PromoteToParent = TRUE; Sel.Range::SetRangeControl(rg); // Prepare an ObjChangeParam so we can mark which nodes will allow this op to happen to them ObjChangeFlags cFlags; cFlags.MoveNode = TRUE; ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,this); // add items directly after the layer node as its first child Node * pTail = (Node *) (Document::GetCurrent()->GetInsertionPosition()); AttachNodeDirection TailAttachDirection = PREV; Spread* pSpread = Document::GetSelectedSpread(); if (!pTail) { if (pSpread) { pTail = pSpread->FindActiveLayer(); // AttachNodeDirection TailAttachDirection = LASTCHILD; <--- AMB removed this and inserted the next line 2006-04-10 presuming bug TailAttachDirection = LASTCHILD; } else { FailAndExecute(); End(); return; // nowhere to put the nodes } } // Mark nodes that will allow this to happen, and error if no nodes will let it happen if (!Sel.AllowOp(&ObjChange)) { FailAndExecute(); End(); return; // op not allowed } // get a list from which to move the nodes (fixes job #10781 - the re-selection of // moved nodes caused an infinite loop) List* pNodeList = Sel.MakeListOfNodes(FALSE); NodeListItem* CurItem = (NodeListItem*)(pNodeList->GetHead()); while (CurItem) { Node* pNode = CurItem->pNode; // Make sure the current owner Layer is told about the changes // and given the chance to release any cached info it may be // holding about the selected object // (I know that the original position coincides with the destination position // but this is hte simplest way to get the original parent layer uncached // and to get a record in the undo history so that the layer cacheing will // be dealt with properly during gundo/redo) DoInvalidateNodeRegion((NodeRenderableBounded*) pNode, TRUE, FALSE); // localise attribs for this node DoLocaliseForAttrChange((NodeRenderableInk*) pNode, (AttrTypeSet *)NULL, (ObjectSet*) NULL); DoMoveNode(pNode, pTail, TailAttachDirection); // factor out common attribs if (pNode->IsCompound()) DoFactorOutCommonChildAttributes((NodeRenderableInk*) pNode); else DoFactorOutAfterAttrChange((NodeRenderableInk*) pNode, (AttrTypeSet *)NULL); // make the nodes region be redrawn DoInvalidateNodeRegion((NodeRenderableBounded*) pNode, TRUE, FALSE); CurItem = (NodeListItem*)(pNodeList->GetNext(CurItem)); } // delete the the list objects pNodeList->DeleteAll(); delete pNodeList; // the selection will have changed - after all we just deleted it BROADCAST_TO_ALL(SelChangingMsg(SelChangingMsg::NONCOLOURATTCHANGED)); GetApplication()->UpdateSelection(); ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,this); UpdateChangedNodes(&ObjChange); // end the op End(); // update the bars DialogBarOp::SetSystemStateChanged(); DialogBarOp::UpdateStateOfAllBars(); } else { // give up and go home FailAndExecute(); End(); } }
/******************************************************************************************** > void OpConvertToBitmap::Do(OpDescriptor*) Author: Will_Cowling (Xara Group Ltd) <*****@*****.**> Created: 11/6/96 Inputs: - Purpose: Convert the selection into a bitmap Errors: - SeeAlso: - ********************************************************************************************/ void OpConvertToBitmap::Do(OpDescriptor*) { // We want to include bevel/contour/shadow controller nodes in our bitmap-copy // deliberations, so set PromoteToParent on a copy of the app's SelRange. SelRange Sel(*(GetApplication()->FindSelection())); RangeControl rg = Sel.GetRangeControlFlags(); rg.PromoteToParent = TRUE; Sel.Range::SetRangeControl(rg); // Find the first node which is selected Node* CurrentNode = Sel.FindFirst(); ERROR3IF(CurrentNode == NULL, "Called ConvertToBitmap with no nodes selected"); // In the retail build it is best to do nothing if we find there are no selected nodes if (CurrentNode != NULL) // No nodes selected so End { // We need to invalidate the region if (!DoInvalidateNodesRegions(Sel, TRUE)) goto EndOperation; if (!DoStartSelOp(FALSE,FALSE)) // Try to record the selection state , don't goto EndOperation; // render the blobs though // Create a special Bitmap filter, that creates a bitmap // and puts it in the tree MakeBitmapFilter* pBitmapFilter = new MakeBitmapFilter(); if (pBitmapFilter == NULL) { FailAndExecute(); goto EndOperation; } KernelBitmap* pBitmapToCreate = NULL; if (!pBitmapFilter->DoCreateBitmap(this, Document::GetSelected(), &pBitmapToCreate)) { delete pBitmapFilter; FailAndExecute(); goto EndOperation; } if (!pBitmapFilter->InsertBitmapIntoDocument(this, pBitmapToCreate, Document::GetSelected())) { delete pBitmapToCreate; delete pBitmapFilter; FailAndExecute(); goto EndOperation; } delete pBitmapFilter; if (!DoInvalidateNodesRegions(*(GetApplication()->FindSelection()), TRUE)) { // We need to invalidate the region FailAndExecute(); goto EndOperation; } } EndOperation: SelRange* pRng = GetApplication()->FindSelection(); End(); }
void BitmapEffectAtom::Test2(UndoableOperation * Op) { BOOL CarryOn=TRUE; Range Sel(*(GetApplication()->FindSelection())); Node* FirstSelectedNode = Sel.FindFirst(); if (FirstSelectedNode != NULL) // No nodes selected so End { Node* CurrentNode = FirstSelectedNode; Node* NextCurrent; // Do all bitmaps while ((CurrentNode != NULL) && CarryOn) { NextCurrent = Sel.FindNext(CurrentNode); if ( (CurrentNode->IsSelected()) && (CurrentNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeBitmap)) ) { KernelBitmap * pBitmap = ((NodeBitmap *)(CurrentNode))->GetBitmap(); BitmapInfo BMInfo; UINT32 bpp; pBitmap->ActualBitmap->GetInfo(&BMInfo); bpp=BMInfo.PixelDepth; TRACEUSER( "Alex", _T("Bitmap found %d bpp\n"),bpp); if ((bpp==32) || TRUE) { CarryOn = FALSE; NodeBitmap *pNodeBitmap = new NodeBitmap; if ((pNodeBitmap == NULL) || (!pNodeBitmap->SetUpPath(12,12))) return; Spread *pSpread; DocCoord Origin; // For now, position Draw objects on 1st page of spread 1 Node *pNode = (Document::GetSelected())->GetFirstNode()->FindNext()->FindFirstChild(); while ((pNode != NULL) && (!pNode->IsKindOf(CC_RUNTIME_CLASS(Chapter)))) pNode = pNode->FindNext(); ENSURE(pNode->IsKindOf(CC_RUNTIME_CLASS(Chapter)), "Filter::GetFirstSpread(): Could not find Chapter"); Chapter *pChapter = (Chapter *) pNode; // pSpread is a child of pChapter pSpread = (Spread *) pChapter->FindFirstChild(); ENSURE(pSpread->IsKindOf(CC_RUNTIME_CLASS(Spread)), "Filter::GetFirstSpread(): Could not find Spread"); Page *pPage = (Page *) pSpread->FindFirstPageInSpread(); ENSURE(pPage->IsKindOf(CC_RUNTIME_CLASS(Page)), "BaseBitmapFilter::DoImport(): Could not find first Page"); // Use bottom left of page as origin DocRect PageRect = pPage->GetPageRect(); Origin = PageRect.lo; KernelBitmap* kb = new KernelBitmap(BMInfo.PixelWidth,BMInfo.PixelHeight,32,100); // Get a new bitmap object for this node. pNodeBitmap->GetBitmapRef()->Attach(kb); if (pNodeBitmap->GetBitmap() != kb) { // It didn't use the bitmap we gave it, so we can delete it delete kb; } ENSURE(pNodeBitmap->GetBitmap()->ActualBitmap != NULL, "No bitmap object found!"); // Import worked - try to add the bitmap object into the tree. // First, set the rectangle to the right size for the bitmap... BitmapInfo Info; pNodeBitmap->GetBitmap()->ActualBitmap->GetInfo(&Info); DocRect BoundsRect; BoundsRect.lo = Origin; BoundsRect.hi.x = BoundsRect.lo.x + Info.RecommendedWidth; BoundsRect.hi.y = BoundsRect.lo.y + Info.RecommendedHeight; // And set this in our bitmap node pNodeBitmap->CreateShape(BoundsRect); // Apply some default attrs for the bitmap // This Must be done before the NodeBitmap is inserted into the tree if (!pNodeBitmap->ApplyDefaultBitmapAttrs(Op)) { return; } // Insert the node, but don't invalidate its region if (!Op->DoInsertNewNode(pNodeBitmap, pSpread, FALSE)) { // It didn't work - delete the sub-tree we just created, and report error. delete pNodeBitmap; return; } // Invalidate the region Op->DoInvalidateNodeRegion(pNodeBitmap, TRUE, FALSE); // Right, now we're going to do some processing... BitmapEffectBase * pEffect; pEffect=new /*TestBitmapEffect*/ BitmapEffectSILT; pEffect->SetParameters(); pEffect->SetSourceImage(pBitmap); pEffect->UseDestinationBitmap(pNodeBitmap->GetBitmap()); pEffect->Run(); pEffect->UseDestinationBitmap(NULL); delete(pEffect); } } CurrentNode = NextCurrent; } } // if (CarryOn) BitmapEffectSILT::RunA(); return; }