#include <bmpcomp.h>
Inheritance diagram for BitmapList:
Public Member Functions | |
BitmapList () | |
~BitmapList () | |
BitmapList destructor. | |
void | Init (BaseDocument *ParentDocument) |
BitmapList initialiser. MUST be called after constructing a BitmapList in order to correctly initialise it. Note that if ParentDocument is not set to a useful value, some operations on Bitmap lists will fail. | |
BOOL | AddItem (KernelBitmap *Item) |
Adds an item to the tail of the Bitmaplist, and incremeants it's usage count. (Unless it's already in the list, in which case it's usage count is just bumped up). | |
BOOL | RemoveItem (KernelBitmap *Item) |
Removes an item from the list. | |
BOOL | MoveAfter (KernelBitmap *InsertPoint, KernelBitmap *ItemToMove) |
Re-arranges the bitmaps in the list. | |
BOOL | MoveBefore (KernelBitmap *InsertPoint, KernelBitmap *ItemToMove) |
Re-arranges the bitmaps in the list. | |
BaseDocument * | GetParentDocument (void) |
To find the parent document of this Bitmap list. | |
KernelBitmap * | FindDuplicateBitmap (OILBitmap *pBitmap) |
Looks to see if an identical bitmap is already in the bitmap list. | |
KernelBitmap * | FindDefaultBitmap () |
Finds the default bitmap in this bitmap list. | |
Private Attributes | |
BaseDocument * | ParentDoc |
Friends | |
class | GlobalBitmapList |
Definition at line 157 of file bmpcomp.h.
|
|
|
BitmapList destructor.
Definition at line 182 of file bmpcomp.cpp. 00183 { 00184 ListItem* pItem = GetHead(); 00185 ListItem* pNextItem; 00186 00187 while (pItem) 00188 { 00189 pNextItem = GetNext(pItem); 00190 00191 KernelBitmap* pBmp = (KernelBitmap*)pItem; 00192 00193 ERROR3IF(pBmp->GetParentBitmapList() != this, "Bad ParentList ptr found in bitmap (during BitmapList destructor)"); 00194 00195 // if this bitmap is used by a brush we don't want to delete it here. 00196 if (!pBmp->IsUsedByBrush()) 00197 delete pBmp; // This should remove it from the list first 00198 else 00199 { 00200 pBmp->Detach(); 00201 RemoveItem(pBmp); 00202 } 00203 00204 pItem = pNextItem; 00205 } 00206 00207 // Tidy up the global bitmap list 00208 Camelot.GetGlobalBitmapList()->DeleteAllUnusedBitmaps(); 00209 }
|
|
Adds an item to the tail of the Bitmaplist, and incremeants it's usage count. (Unless it's already in the list, in which case it's usage count is just bumped up).
Definition at line 248 of file bmpcomp.cpp. 00249 { 00250 ERROR3IF(Item == NULL, "Trying to add NULL item to Bitmap List"); 00251 00252 if (Item == NULL) 00253 return FALSE; 00254 00255 // Is this Bitmap already in the list ? 00256 LISTPOS pos = FindPosition((ListItem*)Item); 00257 00258 if (pos == NOT_IN_LIST || pos == EMPTY_LIST) 00259 { 00260 // It's not in the list yet, so add it on the end 00261 AddTail((ListItem*)Item); 00262 00263 if (ParentDoc != NULL) 00264 { 00265 BROADCAST_TO_ALL(BitmapListChangedMsg(this)); 00266 } 00267 00268 return TRUE; 00269 } 00270 else 00271 { 00272 // It's already in the list, so just return 00273 // (It's usage count has already been incremeanted) 00274 return FALSE; 00275 } 00276 }
|
|
Finds the default bitmap in this bitmap list.
Definition at line 424 of file bmpcomp.cpp. 00425 { 00426 ListItem* pItem = GetHead(); 00427 while (pItem != NULL) 00428 { 00429 KernelBitmap* pBmp = (KernelBitmap*)pItem; 00430 00431 if (pBmp->ActualBitmap && 00432 pBmp->ActualBitmap == OILBitmap::Default) 00433 { 00434 return pBmp; 00435 } 00436 00437 pItem = GetNext(pItem); 00438 } 00439 00440 return NULL; 00441 }
|
|
Looks to see if an identical bitmap is already in the bitmap list.
Definition at line 394 of file bmpcomp.cpp. 00395 { 00396 ListItem* pItem = GetHead(); 00397 while (pItem != NULL) 00398 { 00399 KernelBitmap* pBmp = (KernelBitmap*)pItem; 00400 00401 if (pBmp->ActualBitmap && 00402 pBmp->ActualBitmap != pOILBitmap && 00403 *pBmp->ActualBitmap == *pOILBitmap) 00404 { 00405 return pBmp; 00406 } 00407 00408 pItem = GetNext(pItem); 00409 } 00410 00411 return NULL; 00412 }
|
|
To find the parent document of this Bitmap list.
Definition at line 378 of file bmpcomp.cpp. 00379 { 00380 ERROR3IF(ParentDoc == NULL, "Uninitialised BitmapList detected!"); 00381 return(ParentDoc); 00382 }
|
|
BitmapList initialiser. MUST be called after constructing a BitmapList in order to correctly initialise it. Note that if ParentDocument is not set to a useful value, some operations on Bitmap lists will fail.
Definition at line 224 of file bmpcomp.cpp. 00225 { 00226 ERROR3IF(ParentDocument == NULL, "NULL ParentDoc in BitmapList::Init!\n"); 00227 00228 // Ensure the default bitmap is always in the list. 00229 KernelBitmap* Default = new KernelBitmap(); 00230 Default->Attach(this); 00231 00232 ParentDoc = ParentDocument; 00233 }
|
|
Re-arranges the bitmaps in the list.
Definition at line 354 of file bmpcomp.cpp. 00355 { 00356 List::RemoveItem((ListItem*)ItemToMove); 00357 List::InsertAfter((ListItem*)InsertPoint, (ListItem*)ItemToMove); 00358 00359 if (ParentDoc != NULL) 00360 { 00361 BROADCAST_TO_ALL(BitmapListChangedMsg(this)); 00362 } 00363 00364 return TRUE; 00365 }
|
|
Re-arranges the bitmaps in the list.
Definition at line 330 of file bmpcomp.cpp. 00331 { 00332 List::RemoveItem((ListItem*)ItemToMove); 00333 List::InsertBefore((ListItem*)InsertPoint, (ListItem*)ItemToMove); 00334 00335 if (ParentDoc != NULL) 00336 { 00337 BROADCAST_TO_ALL(BitmapListChangedMsg(this)); 00338 } 00339 00340 return TRUE; 00341 }
|
|
Removes an item from the list.
Definition at line 289 of file bmpcomp.cpp. 00290 { 00291 ERROR3IF(Item == NULL, "Trying to remove NULL item from Bitmap List"); 00292 00293 if (Item == NULL) 00294 return FALSE; 00295 00296 // Is this Bitmap in the list ? 00297 LISTPOS pos = FindPosition((ListItem*)Item); 00298 00299 if (pos != NOT_IN_LIST || pos == EMPTY_LIST) 00300 { 00301 // It's not in the list yet, so add it on the end 00302 List::RemoveItem((ListItem*)Item); 00303 Item->m_pParentList = NULL; 00304 00305 if (ParentDoc != NULL) 00306 { 00307 BROADCAST_TO_ALL(BitmapListChangedMsg(this)); 00308 } 00309 00310 return TRUE; 00311 } 00312 else 00313 { 00314 // It's not in the list, so just return 00315 return FALSE; 00316 } 00317 }
|
|
|
|
|