BOOL OperationHistory::RedoNext() { ListItem* next; if (NowPtr == NULL) // If the NowPtr is NULL then if there are any redo operations then the first will be // found at the head of the OpHistoryList next = OpHistoryList.GetHead(); else // The first redo operation will be found after the NowPtr next = OpHistoryList.GetNext(NowPtr); if ( next != NULL) { Operation* pOp = (Operation*)next; BROADCAST_TO_ALL(OpMsg(pOp,OpMsg::BEFORE_REDO)); // There is an operation to redo if (pOp->Redo()) // REDO the operation { NowPtr = next; BROADCAST_TO_ALL(OpMsg(((Operation*)NowPtr), OpMsg::AFTER_REDO)); return (TRUE); } } return (FALSE); // There are no operations to REDO }
BOOL OperationHistory::UndoPrev() { //TRACE( _T("Called Undo\n")); if (NowPtr != NULL) // Check if there is an operation to UNDO { // Tell the world that the op is about to be undone BROADCAST_TO_ALL(OpMsg(((Operation*)NowPtr),OpMsg::BEFORE_UNDO)); Operation* pOp = (Operation*)NowPtr; if (pOp->Undo()) // Undo the operation { ERROR3IF(NowPtr == NULL, "The operation which has just been undone has been deleted"); if (NowPtr != NULL) { // We used to find the prev op before the undo, this was wrong because it may have been deleted. NowPtr = OpHistoryList.GetPrev(NowPtr); } Operation* NextOp; if (NowPtr != NULL) { NextOp = ((Operation*)OpHistoryList.GetNext(NowPtr)); } else { NextOp = ((Operation*)OpHistoryList.GetHead()); } BROADCAST_TO_ALL(OpMsg(NextOp,OpMsg::AFTER_UNDO)); return (TRUE); } } return (FALSE); // There are no operations to UNDO, or the Operation failed to undo }
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; }
Layer* OpBackground::DoCreateBackgroundLayer(UndoableOperation * pOp, Spread * pSpread) { ERROR2IF(pOp == NULL || pSpread == NULL,FALSE,"OpBackground::DoCreateBackgroundLayer Bad params error!"); // Search for our special page background layer Layer* pFoundLayer = pSpread->FindFirstPageBackgroundLayer(); // If we have found it then return this to the caller as we don't want // more than one present! if (pFoundLayer != NULL) return pFoundLayer; // We didn't find a page background layer so go and create a new one Layer* pNewLayer = CreateBackgroundLayer(); if (pNewLayer != NULL) { // If we insert the new layer as the FIRSTCHILD then this will be like the guidelayer // and behind the page. If we insert as the last child then we will be at the front of // the stacking order. We need to insert ourselves as the node after the last page node Page *pLastPage = pSpread->FindLastPageInSpread(); // Insert the new layer as the next node after the last page. if (pLastPage && pOp->DoInsertNewNode(pNewLayer, pLastPage, NEXT, FALSE,FALSE,FALSE,FALSE)) { pNewLayer->EnsureUniqueLayerID(); BROADCAST_TO_ALL(SpreadMsg(pSpread, SpreadMsg::LAYERCHANGES)); } else { delete pNewLayer; pNewLayer = NULL; } } return pNewLayer; }
void OpPush::DragFinished( DocCoord PointerPos, ClickModifiers ClickMods, Spread *, BOOL Success, BOOL bSolidDrag) { // Put up the hourglass as we have to BeginSlowJob(); // End the Drag EndDrag(); // If the drag failed, then fail the operation if (!Success) FailAndExecute(); // End the operation End(); // Send a message saying that the screen has changed, so that the brush tool can update BROADCAST_TO_ALL(ScreenChangeMsg()); }
void OpShowGuides::Do(OpDescriptor*) { DocView *pDocView = DocView::GetSelected(); if (pDocView != NULL) { pDocView->SetShowGuidesState(!pDocView->GetShowGuidesState()); Spread* pSpread = Document::GetSelectedSpread(); Document* pDoc = Document::GetSelected(); if (pSpread != NULL && pDoc != NULL) { Layer* pLayer = pSpread->FindFirstGuideLayer(); if (pLayer != NULL) LayerSGallery::ForceRedrawLayer(pDoc,pLayer); } BROADCAST_TO_ALL(SpreadMsg(pSpread,SpreadMsg::LAYERCHANGES)); } End(); }
void LiveEffectsTool::OnClick( DocCoord PointerPos, ClickType Click, ClickModifiers ClickMods, Spread* pSpread ) { // Stub out this function if the tool isn't wanted #ifndef NO_ADVANCED_TOOLS if (ClickMods.Menu) return; // Don't do anything if the user clicked the Menu button // See if there is already a drag going on if (Operation::GetCurrentDragOp()!=NULL) return; // If we get a click, treat it like a mouse move, allowing the tool to set up // any info that is passed to the operation in the drag // NEW 17/4/2000 Now we also want to click-select in the Freehand tool if (Click==CLICKTYPE_SINGLE) { OnMouseMove(PointerPos, pSpread, ClickMods); DragTool::OnClick (PointerPos, Click, ClickMods, pSpread); } if (Click == CLICKTYPE_UP) { // so long as we are not interfering with any drawing operations we will // try and change the selection //if (JoinInfo.pJoinPath == NULL) { DragTool::OnClick (PointerPos, Click, ClickMods, pSpread); SelRange* pSelRange = GetApplication()->FindSelection(); if (pSelRange) pSelRange->MakePartialSelectionWhole(TRUE, FALSE, TRUE); BROADCAST_TO_ALL(CommonAttrsChangedMsg); } } #endif // NO_ADVANCED_TOOLS }
bool CCamFrame::Destroy() { // Before anything else let's set Document::Current and DocView::Current properly... // This "event" doesn't refer to any particular doc or view so we'll set them both NULL Document::SetNoCurrent(); DocView::SetNoCurrent(); // Update the window position and state preferences // This doesn't work as well as in Xtreme due to the lack of GetWindowPlacement // GetRect returns the current size of the window even when maximised or iconised // so some effort will be needed to correctly save the normal position bool bMin = IsIconized(); bool bMax = IsMaximized(); wxSize ScreenSize = wxGetDisplaySize(); CCamApp::MainWndPosString._MakeMsg( _T("#1%d #2%d #3%d #4%d #5%d #6%d"), m_WndRect.x, m_WndRect.y, m_WndRect.width, m_WndRect.height, ScreenSize.x, ScreenSize.y ); CCamApp::MainWndMaximized = bMax ? TRUE : FALSE; CCamApp::MainWndMinimized = bMin ? TRUE : FALSE; PORTNOTE("other","Removed WindowPlacement saving") #if !defined(EXCLUDE_FROM_XARALX) #ifndef EXCLUDE_FROM_RALPH // lets write out our non-maximised window position to the .ini file WINDOWPLACEMENT wPlace; wPlace.length = sizeof(WINDOWPLACEMENT); if (GetWindowPlacement( &wPlace )) { // we must save last normal position if in full screen mode if (FullScreenMode) { wPlace = NormalModePlace; } CCamApp::MainWndPosString._MakeMsg( "#1%d #2%d #3%d #4%d #5%d #6%d", wPlace.rcNormalPosition.left, wPlace.rcNormalPosition.top, wPlace.rcNormalPosition.right - wPlace.rcNormalPosition.left, wPlace.rcNormalPosition.bottom - wPlace.rcNormalPosition.top, GetSystemMetrics( SM_CXSCREEN ), GetSystemMetrics( SM_CYSCREEN ) ); CCamApp::MainWndMaximized = (wPlace.showCmd == SW_SHOWMAXIMIZED) ? TRUE : FALSE; CCamApp::MainWndMinimized = (wPlace.showCmd == SW_SHOWMINIMIZED) ? TRUE : FALSE; } else { CCamApp::MainWndPosString = ""; // so uses default next time CCamApp::MainWndMaximized = FALSE; CCamApp::MainWndMinimized = FALSE; } #endif // EXCLUDE_FROM_RALPH #endif // Make sure that the currently selected tool is "de-initialised" before the // main window is destroyed, or it will try to use a dead info bar. // NB. Docs say that this function can be safely called more than once. Tool::DeinitTools(); // DeathMsg is the last message sent before camelot shuts down BROADCAST_TO_ALL(DeathMsg()); PORTNOTE("other","Removed ExternalClipboard usage") #if !defined(EXCLUDE_FROM_XARALX) #ifndef EXCLUDE_FROM_RALPH // And make sure we're no longer on the clipboard viewer chain ChangeClipboardChain(NextClipboardViewer); #endif #endif return wxDocMDIParentFrame::Destroy(); }
BOOL ScaleTab::CommitSection() { TRACEUSER( "Neville", _T("commit Scale section\n")); ERROR3IF(pPrefsDlg == NULL, "ScaleTab::CommitSection called with no dialog pointer"); BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_SCALE)); // The Scale tab identifier if (!ok) return TRUE; // Talk to View failed to return now // Ok has been pressed so take the values from this section of the dialog box // Takes the values in the dialog and sets the DimScale object accordingly. BOOL Valid=TRUE; // Flag for validity of value // BOOL State=FALSE; // Flag for state of button/switch BOOL SetOk=TRUE; // Preference value set ok // Section = Scale settings // Now check that we have the selected view still, just in case it has switched // without us being told about it or even we have no current document/view. // This may be a valid state now, so do not complain about it. DocView* pCurrentView = DocView::GetSelected(); if (pCurrentView != NULL) { // Only if there is a current view do we read the values. String_256 DrawingStr; String_256 RealStr; //TCHAR* pDrawingStr = DrawingStr; //TCHAR* pRealStr = RealStr; BOOL Active; // Get the values from the dialog box Active = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_USESCALEFACTOR),0,1,0, &Valid); DrawingStr = pPrefsDlg->GetStringGadgetValue(_R(IDC_OPTS_DRAWINGSCALE), &Valid); RealStr = pPrefsDlg->GetStringGadgetValue(_R(IDC_OPTS_REALSCALE), &Valid); Spread* pSpread = pCurrentView->GetFirstSelectedSpread(); // If no selected spread then use the visible spread if (pSpread == NULL) pSpread = pCurrentView->GetVisibleSpread(); // Only do the chnage if we have a valid spread pointer and we have changed something. if ( (pSpread != NULL) && ( (OldActiveState != Active) || (OldDrawingStr != DrawingStr) || (OldRealStr != RealStr) ) ) { pDimScale = pSpread->GetPtrDimScale(); if (pDimScale != NULL) { // Only if active is set do we need to try and set new strings // and hence a new drawing scale if (Active) { // Dim Scales can only be 32 characters long String_32 DrawingStr32 = _T(""); String_32 RealStr32 = _T(""); // Check if read in strings are longer than this if (DrawingStr.Length() > DrawingStr32.MaxLength()) { InformError(_R(IDE_OPTS_INVALIDDRAWSCALE)); return FALSE; } if (RealStr.Length() > RealStr32.MaxLength()) { InformError(_R(IDE_OPTS_INVALIDREALSCALE)); return FALSE; } RealStr32 = RealStr; DrawingStr32 = DrawingStr; // Try and set these strings as new drawing and real scales strings SetOk = pDimScale->SetDrawingScaleStr(DrawingStr32); if (!SetOk) { InformError(_R(IDE_OPTS_INVALIDDRAWSCALE)); return FALSE; } SetOk = SetOk && pDimScale->SetRealScaleStr(RealStr32); if (!SetOk) { InformError(_R(IDE_OPTS_INVALIDREALSCALE)); return FALSE; } // Now try to convert these into a new scaling factor if (SetOk) SetOk = SetOk && pDimScale->SetScaleFactor(); // If we failed in any of the conversions then warn the user and fail if (!SetOk) { InformError(_R(IDE_OPTS_INVALIDSCALING)); return FALSE; } } // Set up a possibly new active state pDimScale->SetActiveState(Active); } // Now tell other users of units/scaling factors that there they are likely // to need to update any currently displayed units. Document *pCurrentDoc = (Document *)pSpread->FindOwnerDoc(); BROADCAST_TO_ALL(OptionsChangingMsg(pCurrentDoc, OptionsChangingMsg::NEWUNITS)); // unfortunately pScopeDoc is NULL!, and since pCurrentDoc is calulated I thought it ought to use! - Ed 17/10/95 // BROADCAST_TO_ALL(OptionsChangingMsg(pScopeDocument, OptionsChangingMsg::OptionsState::NEWUNITS)); // Make sure the document is marked as modified. pCurrentDoc->SetModified(TRUE); // And note the new states OldActiveState = Active; OldDrawingStr = DrawingStr; OldRealStr = RealStr; } } // else // ERROR2(FALSE,_R(IDE_OPTS_READPREF_SCALE)); return TRUE; }
/******************************************************************************************** > 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(); } }
bool ScreenCamView::OnCreate( wxDocument* doc, /* TYPENOTE: Correct */ long flags ) { // Construct the (C++) child windows. PORTNOTE("other","ScreenCamView::OnCreate - Removed scroller / ruler usage") #ifndef EXCLUDE_FROM_XARALX RenderWindow = new CRenderWnd; HScrollBar = new CWinScroller(TRUE); VScrollBar = new CWinScroller(FALSE); Corner = new CScrollerCorner; // WEBSTER - markn 15/1/97 // No rulers in Webster #ifndef WEBSTER HRuler = new OILHorizontalRuler; VRuler = new OILVerticalRuler; OGadget = new OriginGadget; #endif //webster if (!RenderWindow || !HScrollBar || !VScrollBar || !Corner #ifndef WEBSTER ||!HRuler ||!VRuler ||!OGadget #endif //webster ) { Error::SetError(_R(IDE_CREATE_VIEW_FAILED), 0); InformError(); return -1; } #endif // Get base class to call CView functions, and get a document for this view. if( !CCamView::OnCreate( doc, flags ) ) // Something went wrong - pass error back. return false; PORTNOTE("other","ScreenCamView::OnCreate - Removed scroller usage") // Now get Windows to do its side of the construction. The stated sizes and // positions of the windows here will be changed very soon. #ifndef EXCLUDE_FROM_XARALX const CRect rcARect(-100,-100,-90,-90); if (!RenderWindow->Create("", "", 0, rcARect, this, 1) || !HScrollBar->Create(0, rcARect, this, 2) || !VScrollBar->Create(0, rcARect, this, 3) || !Corner->Create("", "", 0, rcARect, this, 4) // WEBSTER - markn 15/1/97 // No rulers in Webster #ifndef WEBSTER || !OGadget->Create(this) || !HRuler->Create(this) || !VRuler->Create(this) #endif //webster ) { Error::SetError(_R(IDE_CREATE_VIEW_FAILED), 0); InformError(); return -1; } #endif CreateNewDocView(); // WEBSTER - markn 15/1/97 // No rulers in Webster #ifndef WEBSTER // init the kernel rulers and establish pointer links to them PORTNOTE("other","ScreenCamView::OnCreate - Removed ruler usage") #ifndef EXCLUDE_FROM_XARALX RulerPair* pRulers=pDocView->GetpRulerPair(); pRulers->Init(pDocView,HRuler,VRuler,OGadget); HRuler->LinkToKernel(pRulers->GetpHorizontalRuler()); VRuler->LinkToKernel(pRulers->GetpVerticalRuler()); #endif #endif //webster ENSURE(pDocView != 0, "ScreenView::ScreenView can't get a new DocView!"); pDocView->ConnectToOilView(this); // find the last view so we can use some of it's settings to create the new // DocView * LastView = DocView::GetSelected(); // Link this and the DocView to the ViewState object. pDocView->SetViewState(Status); //////////////////////////////////////////////////////////////////////////////// wxScreenDC dc; wxSize pixsize=OSRenderRegion::GetFixedDCPPI(dc); PORTNOTE("other","ScreenCamView::OnCreate - Removed scroller usage") #ifndef EXCLUDE_FROM_XARALX // Set the logical pixel size accordingly (measured in millipoints). Take the // opportunity to pass the values into the scrollers and the OIL -> Windows coordinate // transform system. HScrollBar->SetGranularity(72000L / pixwidth); VScrollBar->SetGranularity(72000L / pixheight); #endif // Tell DocView how big the pixel size is. FIXED16 PixelWidth = FIXED16(72000.0/pixsize.x); FIXED16 PixelHeight = FIXED16(72000.0/pixsize.y); ERROR3IF(PixelWidth != PixelHeight, "Luke says non-square pixels are not supported"); pDocView->SetPixelSize(PixelWidth, PixelHeight); // Make our DocView the current DocView pDocView->SetCurrent(); GetCanvas()->SetScrollRate(1,1); if (GetFrame()) GetFrame()->GetClientSize(&CurrentSize.width,&CurrentSize.height); // Now the scrollers have all their information, we can set their appearance. // Make sure that they are invisible until the rest of the frame is ready /* XLONG x1 = CurrentSize.GetWidth () * PixelWidth; XLONG x2 = CurrentSize.GetHeight() * PixelHeight; GetFrame()->SetScrollbar(wxHORIZONTAL,0,x1,Status->WorkAreaExtent.hi.x-Status->WorkAreaExtent.lo.x,false); GetFrame()->SetScrollbar( wxVERTICAL,0,x2,Status->WorkAreaExtent.hi.y-Status->WorkAreaExtent.lo.y,false); */ SetScrollerStyle(ScrollerStyle = PropScrollersOn); ShowScrollers(DefaultScrollersState); ShowRulers(DefaultRulersState); /////////////////////////////////////////////////////////////////////////////// // Register for WM_DROPFILES messages // DragAcceptFiles(TRUE); // WEBSTER - markn 12/2/97 #if (_OLE_VER >= 0x200) // Register with OLE as a drop target. m_DropTarget.Register(this); #endif /////////////////////////////////////////////////////////////////////////////// // now that the ScreenView (and hence DocView) is stable, broadcast a message to let everyone know BROADCAST_TO_ALL(DocViewMsg(pDocView,DocViewMsg::NEWANDSTABLE)); // ****************** BODGE ************************** // This code will tell windows to send us messages when // the joystick gets waggled about. // We should really release the joystick at some point later, // but it gets released automatically when this ScreenView is // destroyed, so it will do for now. // The messages get passed to 'OnJoystickMove' member of this // class. #ifdef WIN32 PORTNOTE("other","ScreenCamView::OnCreate - Removed joystick usage") #ifndef EXCLUDE_FROM_XARALX JOYINFO joyinfo; UINT32 wNumDevs, wDeviceID; BOOL bDev1Attached, bDev2Attached; // Are there any Joysticks available ? if((wNumDevs = joyGetNumDevs()) == 0) return 0; // Nope. // Are there One or Two of them ? bDev1Attached = joyGetPos(JOYSTICKID1,&joyinfo) != JOYERR_UNPLUGGED; bDev2Attached = wNumDevs == 2 && joyGetPos(JOYSTICKID2,&joyinfo) != JOYERR_UNPLUGGED; if(bDev1Attached || bDev2Attached) // Decide which joystick to use wDeviceID = bDev1Attached ? JOYSTICKID1 : JOYSTICKID2; else return 0; // Grab those Messages !! MMRESULT JoyResult = joySetCapture(m_hWnd, wDeviceID, NULL, TRUE); #endif #endif // ****************** BODGE ************************** // Return success! return true; }
ActionCode ActionApplyPlugInToBitmap::Execute() { ActionApplyPlugInToBitmap ApplyPlugInAct; ActionCode ActCode = AC_FAIL; // Get the details on the stored bitmap node or fill so that we can use this to undo what we // are about to try and do KernelBitmap * pBitmap = NULL; KernelBitmapRef * pBitmapRef = NULL; if (m_pDocument != NULL && m_pBitmap != NULL && m_pBitmapRef != NULL) { // Note the bitmap currently in use on that fill or node if (m_pFoundNode != NULL) { pBitmap = m_pFoundNode->GetBitmap(); pBitmapRef = m_pFoundNode->GetBitmapRef(); } else if (m_pFoundFillAttribute != NULL) { pBitmap = m_pFoundFillAttribute->GetBitmap(); pBitmapRef = m_pFoundFillAttribute->GetBitmapRef(); } else { ERROR3("Called ActionApplyPlugInToBitmap::Execute with no node or fill selected!"); return AC_FAIL; } } else { ERROR3("Called ActionApplyPlugInToBitmap::Execute with no selected bitmap in the range!"); return AC_FAIL; } if (pBitmap == NULL || pBitmapRef == NULL) { ERROR3("Called ActionApplyPlugInToBitmap::Execute with no selected bitmap in the range!"); return AC_FAIL; } // Create an action to restore the changes we are about to make ActCode = ActionApplyPlugInToBitmap::Init( pOperation, pOppositeActLst, sizeof(ActionApplyPlugInToBitmap), m_pDocument, pBitmap, pBitmapRef, m_pFoundNode, m_pFoundFillAttribute, ( Action**)(&ApplyPlugInAct), m_bUpdateAspect ); if (ActCode != AC_FAIL) { // Make sure we have quite a few valid items before even attempting to continue if (m_pDocument != NULL && m_pBitmap != NULL && m_pBitmapRef != NULL) { // Change that bitmap if (m_pFoundNode != NULL) { if (m_bUpdateAspect) { // Ensure that the aspect ratio of the new bitmap is retained // (Must be done before the new bitmap is attached) m_pFoundNode->SetAspectRatio(m_pBitmap->GetWidth(), m_pBitmap->GetHeight(), TRUE); } // Its a node bitmap so change its bitmap reference to be the new one m_pBitmapRef->Attach(m_pBitmap, m_pDocument); BROADCAST_TO_ALL(BitmapListChangedMsg(m_pBitmap->GetParentBitmapList(), m_pBitmap)); // Say that the bitmap has changed ((UndoableOperation*)pOperation)->DoInvalidateNodeRegion((NodeRenderableInk*)m_pFoundNode, TRUE); } else if (m_pFoundFillAttribute != NULL) { // Its a bitmap fill so change its bitmap reference to be the new one m_pBitmapRef->Attach(m_pBitmap, m_pDocument); BROADCAST_TO_ALL(BitmapListChangedMsg(m_pBitmap->GetParentBitmapList(), m_pBitmap)); } else { ERROR3("Called ActionApplyPlugInToBitmap::Execute with no node or fill selected!"); return AC_FAIL; } } } return (ActCode); }