#include <texttool.h>
Inheritance diagram for TextToolBlobPosList:
Public Member Functions | |
CC_DECLARE_DYNAMIC (TextToolBlobPosList) | |
TextToolBlobPosList () | |
Constructor - sets member variables to defaults. | |
~TextToolBlobPosList () | |
Destructor. | |
BOOL | BuildFromSelection () |
Builds a list of text tool blob positions based on the current selection. | |
BOOL | RenderAllBlobs (Spread *pSpread=NULL, DocRect *pClipRect=NULL) |
Renders all the blobs currently in the list (optionally for a given spread). | |
BOOL | FindBlobStory (Spread *pSpread, DocCoord PointerPos, BOOL *pLeft, TextStory **pStory) |
Finds the textstory that the mouse is over. | |
BOOL | RenderAndRemove (TextStory *pStory) |
If the story is in the list of blobs then it's blob is rendered (off) and the blob is removed from the blob list. | |
void | RenderAndRemoveAll () |
renders off all the blobs and removes them from the list. | |
Spread * | GetBlobSpread () const |
Static Public Member Functions | |
static void | RenderBlobPair (Spread *pSpread, DocRect *pClipRect, TextToolBlobPosItem *pPair) |
Renders a pair of blobs (left, right and connecting line). | |
static void | RenderBlob (Spread *pSpread, DocRect *pClipRect, DocCoord BlobPos) |
Renders one text origin blob. | |
Protected Attributes | |
Spread * | m_pSelSpread |
Definition at line 154 of file texttool.h.
|
Constructor - sets member variables to defaults.
Definition at line 2563 of file texttool.cpp. 02564 { 02565 m_pSelSpread = NULL; 02566 }
|
|
Destructor.
Definition at line 2580 of file texttool.cpp. 02581 { 02582 DeleteAll(); 02583 }
|
|
Builds a list of text tool blob positions based on the current selection.
Definition at line 2597 of file texttool.cpp. 02598 { 02599 // Delete what we currently have 02600 DeleteAll(); 02601 m_pSelSpread = NULL; 02602 02603 // Scan the selection for selected text stories & text stories with a sub-selection 02604 SelRange* pSel = GetApplication()->FindSelection(); 02605 Node* pCurrent = pSel->FindFirst(); 02606 TextStory* pLastSelStory = NULL; 02607 while (pCurrent!=NULL) 02608 { 02609 // Are we interested in this item? 02610 if (pCurrent->IsABaseTextClass()) 02611 { 02612 TextStory* pCurrentStory = ((BaseTextClass*)pCurrent)->FindParentStory(); 02613 02614 if (pCurrentStory!=NULL && pCurrentStory!=pLastSelStory && pCurrentStory->IsWordWrapping()) 02615 { 02616 DocCoord LeftBlob; 02617 DocCoord RightBlob; 02618 02619 if (pCurrentStory->GetTextPath() != NULL) 02620 { 02621 LeftBlob = pCurrentStory->GetLeftIndentPos(); 02622 RightBlob = pCurrentStory->GetRightIndentPos(); 02623 } 02624 else 02625 { 02626 const Matrix* pStoryMat = pCurrentStory->GetpStoryMatrix(); 02627 LeftBlob = DocCoord(0,0); 02628 RightBlob = DocCoord(pCurrentStory->GetStoryWidth(),0); 02629 pStoryMat->transform(&LeftBlob); 02630 pStoryMat->transform(&RightBlob); 02631 } 02632 02633 Spread* pSpread = pCurrentStory->FindParentSpread(); 02634 02635 // Add blob to list 02636 ERROR3IF(pSpread==NULL, "Story didn't have a parent spread!"); 02637 if (pSpread!=NULL) 02638 { 02639 // Construct a list item 02640 TextToolBlobPosItem* pNewItem = new TextToolBlobPosItem(LeftBlob, RightBlob, (pCurrentStory->GetTextPath()==NULL), pCurrentStory); 02641 if (pNewItem==NULL) 02642 return FALSE; 02643 02644 // Add it to the list 02645 AddTail(pNewItem); 02646 02647 // Update spread pointer 02648 ERROR3IF(m_pSelSpread!=NULL && m_pSelSpread!=pSpread, "Selection crosses spreads! Text tool blobs wont work!"); 02649 m_pSelSpread = pSpread; 02650 } 02651 02652 pLastSelStory = pCurrentStory; 02653 } 02654 } 02655 02656 pCurrent = pSel->FindNext(pCurrent); 02657 } 02658 02659 return TRUE; 02660 }
|
|
|
|
Finds the textstory that the mouse is over.
Definition at line 2782 of file texttool.cpp. 02783 { 02784 // Is the spread the same as our current one? 02785 ERROR2IF(pSpread!=m_pSelSpread && m_pSelSpread!=NULL, FALSE, "Different spreads"); 02786 ERROR2IF(pStory==NULL, FALSE, "NULL output parameter"); 02787 02788 // Work backwards through our blob list, thus in hit test order. 02789 TextToolBlobPosItem* pItem = (TextToolBlobPosItem*) GetTail(); 02790 while (pItem!=NULL) 02791 { 02792 // Get a rectangle surrounding the left blob 02793 DocRect BlobBounds; 02794 DocCoord BlobPos = pItem->GetLeftBlobPos(); 02795 GetApplication()->GetBlobManager()->GetBlobRect(BlobPos, &BlobBounds); 02796 if (BlobBounds.ContainsCoord(PointerPos)) 02797 { 02798 if (pLeft!=NULL) 02799 *pLeft = TRUE; 02800 *pStory = pItem->GetBlobStory(); 02801 02802 return TRUE; 02803 } 02804 02805 // Test the right blob 02806 BlobPos = pItem->GetRightBlobPos(); 02807 GetApplication()->GetBlobManager()->GetBlobRect(BlobPos, &BlobBounds); 02808 if (BlobBounds.ContainsCoord(PointerPos)) 02809 { 02810 if (pLeft!=NULL) 02811 *pLeft = FALSE; 02812 *pStory = pItem->GetBlobStory(); 02813 02814 return TRUE; 02815 } 02816 02817 pItem = (TextToolBlobPosItem*) GetPrev(pItem); 02818 } 02819 02820 return TRUE; 02821 }
|
|
Definition at line 169 of file texttool.h. 00169 {return m_pSelSpread;}
|
|
Renders all the blobs currently in the list (optionally for a given spread).
Definition at line 2675 of file texttool.cpp. 02676 { 02677 TextToolBlobPosItem* pItem = (TextToolBlobPosItem*) GetHead(); 02678 02679 // If no spread specified then use current, only render onto current spread 02680 if (pSpread==NULL) 02681 pSpread = m_pSelSpread; 02682 if (m_pSelSpread!=pSpread) 02683 return TRUE; 02684 02685 while (pItem!=NULL) 02686 { 02687 RenderBlobPair(pSpread, pClipRect, pItem); 02688 02689 pItem = (TextToolBlobPosItem*) GetNext(pItem); 02690 } 02691 02692 return TRUE; 02693 }
|
|
If the story is in the list of blobs then it's blob is rendered (off) and the blob is removed from the blob list.
Definition at line 2836 of file texttool.cpp. 02837 { 02838 ERROR2IF(pStory==NULL, FALSE, "NULL story pointer"); 02839 02840 // Work through our list to find the story 02841 TextToolBlobPosItem* pItem = (TextToolBlobPosItem*) GetHead(); 02842 while (pItem!=NULL) 02843 { 02844 if (pItem->GetBlobStory() == pStory) 02845 { 02846 // Render the blob pair off 02847 RenderBlobPair(m_pSelSpread, NULL, pItem); 02848 02849 // Remove it from the list 02850 RemoveItem(pItem); 02851 delete pItem; 02852 02853 return TRUE; 02854 } 02855 else 02856 pItem = (TextToolBlobPosItem*) GetNext(pItem); 02857 } 02858 02859 ERROR3("Story not found"); 02860 02861 return TRUE; 02862 }
|
|
renders off all the blobs and removes them from the list.
Definition at line 2876 of file texttool.cpp. 02877 { 02878 // Work through our list to find the story 02879 TextToolBlobPosItem* pItem = (TextToolBlobPosItem*) RemoveHead(); 02880 while (pItem!=NULL) 02881 { 02882 // Render the blob pair off 02883 RenderBlobPair(m_pSelSpread, NULL, pItem); 02884 02885 // Delte the item now we've finshed with it. 02886 delete pItem; 02887 02888 pItem = (TextToolBlobPosItem*) RemoveHead(); 02889 } 02890 }
|
|
Renders one text origin blob.
Definition at line 2753 of file texttool.cpp. 02754 { 02755 RenderRegion* pRegion = DocView::RenderOnTop(pClipRect, pSpread, ClippedEOR); 02756 while (pRegion != NULL) 02757 { 02758 // Draw a Cross Hair 02759 pRegion->SetLineColour(COLOUR_NONE); 02760 pRegion->SetFillColour(COLOUR_BEZIERBLOB); 02761 pRegion->DrawBlob(BlobPos, BT_UNSELECTED); 02762 02763 // Get the next region in the list 02764 pRegion = DocView::GetNextOnTop(pClipRect); 02765 } 02766 }
|
|
Renders a pair of blobs (left, right and connecting line).
Definition at line 2709 of file texttool.cpp. 02710 { 02711 ERROR3IF(pPair==NULL, "NULL pointer"); 02712 02713 if (pPair!=NULL) 02714 { 02715 // This code is very similar to RenderBlob but avoids having to create 3 times as 02716 // the number of RenderOnTop loops. 02717 RenderRegion* pRegion = DocView::RenderOnTop(pClipRect, pSpread, ClippedEOR); 02718 while (pRegion != NULL) 02719 { 02720 // Draw the two blobs 02721 pRegion->SetLineColour(COLOUR_NONE); 02722 pRegion->SetFillColour(COLOUR_BEZIERBLOB); 02723 pRegion->DrawBlob(pPair->GetLeftBlobPos(), BT_UNSELECTED); 02724 pRegion->DrawBlob(pPair->GetRightBlobPos(), BT_UNSELECTED); 02725 02726 // Draw the connecting line 02727 if (pPair->IsConnected()) 02728 { 02729 pRegion->SetLineColour(COLOUR_BEZIERBLOB); 02730 pRegion->DrawLine(pPair->GetLeftBlobPos(), pPair->GetRightBlobPos()); 02731 } 02732 02733 // Get the next region in the list 02734 pRegion = DocView::GetNextOnTop(pClipRect); 02735 } 02736 } 02737 }
|
|
Definition at line 172 of file texttool.h. |