#include <colormgr.h>
Inheritance diagram for OpRedrawColours:
Public Member Functions | |
OpRedrawColours () | |
OpRedrawColours constructor. | |
~OpRedrawColours () | |
OpRedrawColours destructor. | |
void | Do (OpDescriptor *) |
Generates an ERROR3 and exits - you must ALWAYS use DoWithParam. | |
void | DoWithParam (OpDescriptor *, OpParam *) |
Scans the document tree, and redraws all nodes affected by visible changes to any of the colours in the provided null-terminated array. | |
Static Public Member Functions | |
static BOOL | Init () |
OpRedrawColours initialiser method. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
For finding the OpRedrawColours's state. |
Definition at line 524 of file colormgr.h.
|
OpRedrawColours constructor.
Definition at line 3608 of file colormgr.cpp.
|
|
OpRedrawColours destructor.
Definition at line 3625 of file colormgr.cpp.
|
|
Generates an ERROR3 and exits - you must ALWAYS use DoWithParam.
Reimplemented from Operation. Definition at line 3692 of file colormgr.cpp. 03693 { 03694 ERROR3("OpRedrawColours does not provide a Do() function - Use DoWithParam"); 03695 End(); 03696 }
|
|
Scans the document tree, and redraws all nodes affected by visible changes to any of the colours in the provided null-terminated array.
Reimplemented from Operation. Definition at line 3721 of file colormgr.cpp. 03722 { 03723 ERROR3IF(Param == NULL, "Illegal NULL param"); 03724 ERROR3IF(pOurDoc == NULL, "pOurDoc is NULL"); 03725 03726 ObjChangeFlags ChangeFlags; 03727 ChangeFlags.Attribute = TRUE; 03728 03729 ObjChangeParam ChangeParam(OBJCHANGE_STARTING, ChangeFlags, NULL, NULL); 03730 03731 OpRedrawColoursInfo *Info = (OpRedrawColoursInfo *) Param; 03732 IndexedColour **Colours = Info->Colours; 03733 ERROR3IF(Colours == NULL, "Illegal NULL param"); 03734 03735 if (Info->ScopeDoc != NULL) 03736 pOurDoc = Info->ScopeDoc; 03737 03738 Node *CurNode = Node::DocFindFirstDepthFirst(pOurDoc); 03739 while (CurNode != NULL) 03740 { 03741 if (CurNode->IsAnAttribute()) 03742 { 03743 // Have found a NodeAttribute. Scan it to see if it contains any colours. 03744 // If any of these match any in our Colours list, then force a redraw of 03745 // our parent node, and return. 03746 NodeAttribute *pNodeAttr = (NodeAttribute *) CurNode; 03747 DocColour *pColour = NULL; 03748 UINT32 Context = 0; 03749 03750 // CGS .... 03751 03752 // DMc's multi stage fills do not dynamically update when we use the colour 03753 // editor (including my custom colour picker control). This has now been 03754 // fixed (by me!). Problem was to do with the fact that the following line 03755 // pColour = pNodeAttr->EnumerateColourFields(Context++); 03756 // never ever got a chance to look for a fill ramp. 03757 03758 BOOL DoneFillRampFirst = FALSE; // by default, we are NOT doing fillramp stuff 03759 BOOL FirstPass = TRUE; // were on our first pass 03760 03761 do 03762 { 03763 // do fill ramp stuff first, before anything else .... 03764 // (dosn't matter if we the node does not have a fill ramp, since 03765 // DoneFillRampFirst will NOT be held high (so processing will proceed as 03766 // normal) 03767 03768 // NOTE: I could have modifed EnumerateColourFields so that it worked properly 03769 // (thereby doing the fill ramp stuff correctly) instead of the following code 03770 // BUT when doing so, this seemed to have undesired affects, so for now; it is 03771 // done this way .... 03772 03773 if ((CurNode->IsAFillAttr ()) && (DoneFillRampFirst == FALSE)) 03774 { 03775 AttrFillGeometry* pAttrFillGeo = (AttrFillGeometry*) (CurNode); 03776 03777 if (pAttrFillGeo->IsAColourFill () && !(pAttrFillGeo->IsATranspFill ())) 03778 { 03779 FillRamp* pFillRamp = pAttrFillGeo->GetFillRamp (); 03780 03781 if (pFillRamp != NULL) 03782 { 03783 UINT32 NumberSelected = pFillRamp->CountSelBlobs (); 03784 03785 if (NumberSelected > 0) 03786 { 03787 INT32 SelectedIndex = pFillRamp->GetSelectedIndex (); 03788 ColRampItem* TheItem = (ColRampItem*) pFillRamp->GetValidIndexedItem (SelectedIndex); 03789 03790 if (TheItem != NULL) 03791 { 03792 DoneFillRampFirst = TRUE; 03793 pColour = TheItem->GetColourAddr (); 03794 } 03795 } 03796 } 03797 } 03798 } 03799 03800 // Get the next colour field from the attribute, and find the 03801 // IndexedColour (if any) to which it refers 03802 if (DoneFillRampFirst != TRUE) 03803 { 03804 pColour = pNodeAttr->EnumerateColourFields(Context++); 03805 } 03806 else 03807 { 03808 // need to reset stuff, cause otherwise pColour is always != NULL, 03809 // and we get into an infinite while loop !!!! 03810 03811 if (FirstPass == TRUE) 03812 { 03813 FirstPass = FALSE; // for next pass .... 03814 } 03815 else 03816 { 03817 pColour = NULL; // reset !!!! 03818 } 03819 } 03820 03821 IndexedColour *pColourIx = (pColour == NULL) ? NULL : pColour->FindParentIndexedColour(); 03822 if (pColourIx != NULL) 03823 { 03824 // Check if this colour matches any in our list 03825 INT32 i = 0; 03826 while (Colours[i] != NULL) 03827 { 03828 if (pColourIx == Colours[i]) 03829 { 03830 Node *Parent = CurNode->FindParent(); 03831 if (Parent != NULL && Parent->IsBounded()) 03832 { 03833 // Invoke AllowOp on the node to tag it so that parents such as blends 03834 // and moulds will also redraw if necessary. We ignore the return code 03835 // because we're not actually going to touch the node at all. 03836 CurNode->AllowOp(&ChangeParam); 03837 03838 // And redraw the directly affected node (our parent) 03839 DocRect NodeBounds = ((NodeRenderableBounded *)Parent)->GetBoundingRect(); 03840 NodeBounds = NodeBounds.Union(((NodeRenderableBounded *)Parent)->GetEffectStackBounds()); 03841 pOurDoc->ForceRedraw(Parent->FindParentSpread(), NodeBounds, FALSE, Parent); 03842 } 03843 03844 // There is no need to check further colour attributes for this node 03845 // now that we have found one that has changed 03846 break; 03847 } 03848 03849 i++; // Check the next IndexedColour 03850 } 03851 } 03852 } while ((pColour != NULL /*&& DoneFillRampFirst == FALSE*/)); // Check the next colour attribute 03853 } 03854 03855 CurNode = CurNode->DocFindNextDepthFirst(); 03856 } 03857 03858 // And make sure that the redraw occurs right away 03859 pOurDoc->FlushRedraw(); 03860 GetApplication()->ServiceRendering(); // Ensure speedy response by doing one iteration of rendering right now 03861 03862 ChangeParam.Define(OBJCHANGE_FINISHED, ChangeParam.GetChangeFlags(), NULL, NULL); 03863 UpdateAllChangedNodes(&ChangeParam); 03864 03865 End(); 03866 }
|
|
For finding the OpRedrawColours's state.
Definition at line 3673 of file colormgr.cpp. 03674 { 03675 OpState OpSt; 03676 return(OpSt); 03677 }
|
|
OpRedrawColours initialiser method.
Reimplemented from SimpleCCObject. Definition at line 3645 of file colormgr.cpp. 03646 { 03647 return (RegisterOpDescriptor( 03648 0, 03649 _R(IDS_OPREDRAWCOLOURS), 03650 CC_RUNTIME_CLASS(OpRedrawColours), 03651 OPTOKEN_REDRAWCOLOURS, 03652 OpRedrawColours::GetState, 03653 0, /* help ID */ 03654 0, /* Bubble help ID */ 03655 0 /* bitmap ID */ 03656 )); 03657 }
|