#include <range.h>
Inheritance diagram for ListRange:
Public Member Functions | |
ListRange () | |
ListRange constructor. | |
ListRange (const List &srcList) | |
SelRange constructor. | |
ListRange (const ListRange &srcRange) | |
SelRange constructor. | |
ListRange (const ListRange *pSrcRange) | |
SelRange constructor. | |
~ListRange () | |
SelRange destructor. | |
virtual Node * | FindFirst (BOOL AndChildren=FALSE) |
The purpose of this function is to find the first node in a range. | |
virtual Node * | FindLast () |
The purpose of this function is to find the last node in a range. If the range was constructed with a NULL last node specifier then the range is scanned until the last node is found. If a non NULL last node was specified however the value of last is simply returned. It's existance is not verified !. | |
virtual Node * | FindNext (Node *Previous, BOOL AndChildren=FALSE) |
virtual Node * | FindPrev (Node *pNode, BOOL AndChildren=FALSE) |
virtual void | AddNode (Node *pNode) |
virtual Node * | RemoveNode (Node *pNode) |
virtual void | Clear () |
virtual BOOL | MatchesSelectionEffectLevel (INT32 iStackPos) |
Get the current edit context for the feather UI controls Notes: VERY IMPORTANT! The node pointers held in this range could be out of date - the nodes could have been deleted. So it's important that the pointers are only used AFTER we have verified that they actually point to something! | |
Protected Member Functions | |
virtual BOOL | InRange (Node *pNode, BOOL AndChildren) const |
Private helper function for SmartFindNext. Tests whether the presented node is in the range according to the RangeControlFlags and two other locally presented flags. | |
Private Attributes | |
List | nodelist |
NodeListItem * | pLastReturnedItem |
Definition at line 773 of file range.h.
|
ListRange constructor.
Definition at line 6656 of file range.cpp. 06656 : Range(NULL, NULL, RangeControl(TRUE,FALSE,TRUE,TRUE)) // Call Range constructor 06657 { 06658 pLastReturnedItem = NULL; 06659 }
|
|
SelRange constructor.
Definition at line 6680 of file range.cpp.
|
|
SelRange constructor.
Definition at line 6705 of file range.cpp. 06705 : Range() 06706 { 06707 BOOL bOK = TRUE; 06708 NodeListItem* pNodeItem = (NodeListItem*)srcRange.nodelist.GetHead(); 06709 while (pNodeItem) 06710 { 06711 NodeListItem* pNewNodeItem = new NodeListItem(pNodeItem->pNode); 06712 if (pNewNodeItem==NULL) 06713 { 06714 bOK = FALSE; 06715 break; 06716 } 06717 nodelist.AddTail(pNewNodeItem); 06718 06719 pNodeItem = (NodeListItem*)srcRange.nodelist.GetNext(pNodeItem); 06720 } 06721 06722 if (!bOK) 06723 { 06724 // Get rid of all NodeListItems in the nodelist 06725 while (nodelist.GetHead()) 06726 delete nodelist.RemoveHead(); 06727 } 06728 pLastReturnedItem = NULL; 06729 }
|
|
SelRange constructor.
Definition at line 6750 of file range.cpp. 06750 : Range() 06751 { 06752 if (pSrcRange==NULL) 06753 return; 06754 06755 BOOL bOK = TRUE; 06756 NodeListItem* pNodeItem = (NodeListItem*)pSrcRange->nodelist.GetHead(); 06757 while (pNodeItem) 06758 { 06759 NodeListItem* pNewNodeItem = new NodeListItem(pNodeItem->pNode); 06760 if (pNewNodeItem==NULL) 06761 { 06762 bOK = FALSE; 06763 break; 06764 } 06765 nodelist.AddTail(pNewNodeItem); 06766 06767 pNodeItem = (NodeListItem*)pSrcRange->nodelist.GetNext(pNodeItem); 06768 } 06769 06770 if (!bOK) 06771 { 06772 // Get rid of all NodeListItems in the nodelist 06773 while (nodelist.GetHead()) 06774 delete nodelist.RemoveHead(); 06775 } 06776 pLastReturnedItem = NULL; 06777 }
|
|
SelRange destructor.
Definition at line 6799 of file range.cpp. 06800 { 06801 // Get rid of all NodeListItems in the nodelist 06802 while (nodelist.GetHead()) 06803 delete nodelist.RemoveHead(); 06804 06805 pLastReturnedItem = NULL; 06806 }
|
|
Definition at line 7027 of file range.cpp. 07028 { 07029 #ifdef _DEBUG_LISTCHECKS 07030 ERROR3IF(InRange(pNode, FALSE), "Attempt to add duplicate node to ListRange!\n"); 07031 #endif 07032 07033 NodeListItem* pNodeItem = new NodeListItem(pNode); 07034 nodelist.AddTail(pNodeItem); 07035 }
|
|
Definition at line 7093 of file range.cpp. 07094 { 07095 // Get rid of all NodeListItems in the nodelist 07096 while (nodelist.GetHead()) 07097 delete nodelist.RemoveHead(); 07098 07099 pLastReturnedItem = NULL; 07100 }
|
|
The purpose of this function is to find the first node in a range.
Reimplemented from Range. Definition at line 6833 of file range.cpp. 06834 { 06835 // Preconditions... 06836 ERROR2IF(this==NULL,NULL,"FindFirst called on NULL range"); 06837 // ERROR2IF(AndChildren, NULL, "ListRange can't honour AndChildren requests yet"); 06838 06839 NodeListItem* pNodeItem = (NodeListItem*)nodelist.GetHead(); 06840 pLastReturnedItem = pNodeItem; 06841 if (pNodeItem) 06842 { 06843 if (AndChildren) 06844 return pNodeItem->pNode->FindFirstDepthFirst(); 06845 else 06846 return pNodeItem->pNode; 06847 } 06848 06849 return NULL; 06850 }
|
|
The purpose of this function is to find the last node in a range. If the range was constructed with a NULL last node specifier then the range is scanned until the last node is found. If a non NULL last node was specified however the value of last is simply returned. It's existance is not verified !.
Reimplemented from Range. Definition at line 7009 of file range.cpp. 07010 { 07011 ERROR2IF(this==NULL,NULL,"FindFirst called on NULL range"); 07012 07013 // BOOL found = FALSE; 07014 NodeListItem* pNodeItem = (NodeListItem*)nodelist.GetTail(); 07015 pLastReturnedItem = pNodeItem; 07016 if (pNodeItem) 07017 return pNodeItem->pNode; 07018 07019 return NULL; 07020 }
|
|
Reimplemented from Range. Definition at line 6874 of file range.cpp. 06875 { 06876 // Preconditions 06877 // No need to check that "this" is NULL because that's already been done 06878 // in FindFirst. 06879 ERROR2IF(pPrevious == NULL, NULL, "NULL pointer passed to Range::FindNext"); 06880 // ERROR2IF(AndChildren, NULL, "ListRange can't honour AndChildren requests yet"); 06881 06882 BOOL found = FALSE; 06883 NodeListItem* pNodeItem = (NodeListItem*)nodelist.GetHead(); 06884 06885 // ------------------ 06886 // Optimisation 06887 if (pLastReturnedItem) 06888 { 06889 if (pLastReturnedItem->pNode == pPrevious) 06890 pNodeItem = pLastReturnedItem; 06891 else if (AndChildren && pLastReturnedItem->pNode->IsNodeInSubtree(pPrevious)) 06892 pNodeItem = pLastReturnedItem; 06893 } 06894 // ------------------ 06895 06896 while (pNodeItem && !found) 06897 { 06898 found = (pNodeItem->pNode == pPrevious); 06899 if (!found && AndChildren) 06900 { 06901 // If this list item contains the previous context node 06902 // Then we are still traversing the subtree of that list item 06903 // So get the next item in the subtree 06904 if (pNodeItem->pNode->IsNodeInSubtree(pPrevious)) 06905 { 06906 pLastReturnedItem = pNodeItem; 06907 return pPrevious->FindNextDepthFirst(pNodeItem->pNode); 06908 } 06909 } 06910 06911 pNodeItem = (NodeListItem*)nodelist.GetNext(pNodeItem); 06912 } 06913 06914 pLastReturnedItem = pNodeItem; 06915 06916 if (pNodeItem && found) 06917 if (AndChildren) 06918 return pNodeItem->pNode->FindFirstDepthFirst(); 06919 else 06920 return pNodeItem->pNode; 06921 06922 return NULL; 06923 }
|
|
Reimplemented from Range. Definition at line 6947 of file range.cpp. 06948 { 06949 // Preconditions 06950 // No need to check that "this" is NULL because that's already been done 06951 // in FindFirst. 06952 ERROR2IF(pNode == NULL, NULL, "NULL pointer passed to Range::FindNext"); 06953 ERROR2IF(AndChildren, NULL, "ListRange::FindPrev can't honour AndChildren requests yet"); 06954 06955 BOOL found = FALSE; 06956 NodeListItem* pNodeItem = (NodeListItem*)nodelist.GetTail(); 06957 06958 // ------------------ 06959 // Optimisation 06960 if (pLastReturnedItem && pLastReturnedItem->pNode == pNode) 06961 pNodeItem = pLastReturnedItem; 06962 // ------------------ 06963 06964 while (pNodeItem && !found) 06965 { 06966 found = (pNodeItem->pNode == pNode); 06967 06968 pNodeItem = (NodeListItem*)nodelist.GetPrev(pNodeItem); 06969 } 06970 06971 pLastReturnedItem = pNodeItem; 06972 06973 if (pNodeItem && found) 06974 return pNodeItem->pNode; 06975 06976 return NULL; 06977 }
|
|
Private helper function for SmartFindNext. Tests whether the presented node is in the range according to the RangeControlFlags and two other locally presented flags.
This function should ONLY be called on nodes that /could/ be members of Range Not Layers or Paper nodes! Scope: Protected
Reimplemented from Range. Definition at line 7070 of file range.cpp. 07071 { 07072 ERROR2IF(AndChildren, FALSE, "ListRange can't honour AndChildren requests yet"); 07073 07074 BOOL found = FALSE; 07075 NodeListItem* pNodeItem = (NodeListItem*)nodelist.GetHead(); 07076 while (pNodeItem && !found) 07077 { 07078 found = (pNodeItem->pNode == pNode); 07079 07080 pNodeItem = (NodeListItem*)nodelist.GetNext(pNodeItem); 07081 } 07082 07083 // pLastReturnedItem = pNodeItem; 07084 07085 return found; 07086 }
|
|
Get the current edit context for the feather UI controls Notes: VERY IMPORTANT! The node pointers held in this range could be out of date - the nodes could have been deleted. So it's important that the pointers are only used AFTER we have verified that they actually point to something!
Definition at line 7130 of file range.cpp. 07131 { 07132 if (iStackPos==STACKPOS_INVALID) 07133 return FALSE; 07134 07135 SelRange* pSelRange = GetApplication()->FindSelection(); 07136 EffectsStack* pStack = pSelRange->GetEffectsStack(); // From cache 07137 if (pStack==NULL || pStack->IsEmpty()) 07138 return FALSE; 07139 07140 INT32 iPos = iStackPos; 07141 Range* pLevelRange = pStack->GetLevelRange(&iPos); 07142 if (pLevelRange==NULL) 07143 return FALSE; 07144 07145 Node* pNode = pLevelRange->FindFirst(); 07146 Node* pEditNode = FindFirst(); 07147 while (pNode && pEditNode) 07148 { 07149 // If the pointers are the same then we can reasonably assume 07150 // the the pointer stored in s_pEditRange is still valid... 07151 if (pNode!=pEditNode) 07152 return FALSE; 07153 07154 // Now we know the pointer at least points to SOME kind of node 07155 // Check whether Another node has been allocated into the same 07156 // address as a deleted node... 07157 if (pNode->GetTag() != pEditNode->GetTag()) 07158 return FALSE; 07159 07160 pNode = pLevelRange->FindNext(pNode); 07161 pEditNode = FindNext(pEditNode); 07162 } 07163 07164 // If either pointer is non-null then we stopped without matching every case 07165 // So must return NULL 07166 if (pNode || pEditNode) 07167 return FALSE; 07168 07169 return TRUE; 07170 }
|
|
Definition at line 7042 of file range.cpp. 07043 { 07044 BOOL found = FALSE; 07045 Node* pFoundNode = NULL; 07046 NodeListItem* pNodeItem = (NodeListItem*)nodelist.GetHead(); 07047 while (pNodeItem && pFoundNode==NULL) 07048 { 07049 found = (pNodeItem->pNode == pNode); 07050 07051 if (found) 07052 pFoundNode = pNode; 07053 else 07054 pNodeItem = (NodeListItem*)nodelist.GetNext(pNodeItem); 07055 } 07056 07057 if (pNodeItem && pFoundNode) 07058 nodelist.RemoveItem(pNodeItem); 07059 07060 pLastReturnedItem = NULL; 07061 07062 return pFoundNode; 07063 }
|
|
|
|
|