Another SimpleVector
nuked.
This commit is contained in:
@ -233,7 +233,6 @@ Textblock::Textblock (bool limitTextWidth, bool treatAsInline)
|
|||||||
lines = new misc::SimpleVector <Line> (1);
|
lines = new misc::SimpleVector <Line> (1);
|
||||||
nonTemporaryLines = 0;
|
nonTemporaryLines = 0;
|
||||||
words = new misc::NotSoSimpleVector <Word> (1);
|
words = new misc::NotSoSimpleVector <Word> (1);
|
||||||
anchors = new misc::SimpleVector <Anchor> (1);
|
|
||||||
|
|
||||||
wrapRefLines = wrapRefParagraphs = -1;
|
wrapRefLines = wrapRefParagraphs = -1;
|
||||||
wrapRefLinesFCX = wrapRefLinesFCY = -1;
|
wrapRefLinesFCX = wrapRefLinesFCY = -1;
|
||||||
@ -280,16 +279,15 @@ Textblock::~Textblock ()
|
|||||||
for (int i = 0; i < words->size(); i++)
|
for (int i = 0; i < words->size(); i++)
|
||||||
cleanupWord (i);
|
cleanupWord (i);
|
||||||
|
|
||||||
for (int i = 0; i < anchors->size(); i++) {
|
for( const Anchor &anchor: anchors )
|
||||||
Anchor *anchor = anchors->getRef (i);
|
{
|
||||||
/* This also frees the names (see removeAnchor() and related). */
|
/* This also frees the names (see removeAnchor() and related). */
|
||||||
removeAnchor(anchor->name);
|
removeAnchor(anchor.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete paragraphs;
|
delete paragraphs;
|
||||||
delete lines;
|
delete lines;
|
||||||
delete words;
|
delete words;
|
||||||
delete anchors;
|
|
||||||
|
|
||||||
/* Make sure we don't own widgets anymore. Necessary before call of
|
/* Make sure we don't own widgets anymore. Necessary before call of
|
||||||
parent class destructor. (???) */
|
parent class destructor. (???) */
|
||||||
@ -710,8 +708,8 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation)
|
|||||||
|
|
||||||
sizeAllocateEnd ();
|
sizeAllocateEnd ();
|
||||||
|
|
||||||
for (int i = 0; i < anchors->size(); i++) {
|
for (int i = 0; i < anchors.size(); i++) {
|
||||||
Anchor *anchor = anchors->getRef(i);
|
Anchor *anchor = &anchors.at(i);
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
if (anchor->wordIndex >= words->size() ||
|
if (anchor->wordIndex >= words->size() ||
|
||||||
@ -2583,12 +2581,11 @@ bool Textblock::addAnchor (const char *name, core::style::Style *style)
|
|||||||
*/
|
*/
|
||||||
result = false;
|
result = false;
|
||||||
else {
|
else {
|
||||||
Anchor *anchor;
|
anchors.emplace_back();
|
||||||
|
Anchor &anchor= anchors.back();
|
||||||
|
|
||||||
anchors->increase();
|
anchor.name = copy;
|
||||||
anchor = anchors->getRef(anchors->size() - 1);
|
anchor.wordIndex = words->size();
|
||||||
anchor->name = copy;
|
|
||||||
anchor->wordIndex = words->size();
|
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,7 +613,7 @@ protected:
|
|||||||
lout::misc::SimpleVector <Paragraph> *paragraphs;
|
lout::misc::SimpleVector <Paragraph> *paragraphs;
|
||||||
int nonTemporaryLines;
|
int nonTemporaryLines;
|
||||||
lout::misc::NotSoSimpleVector <Word> *words;
|
lout::misc::NotSoSimpleVector <Word> *words;
|
||||||
lout::misc::SimpleVector <Anchor> *anchors;
|
std::vector< Anchor > anchors;
|
||||||
|
|
||||||
struct { int index, nChar; }
|
struct { int index, nChar; }
|
||||||
hlStart[core::HIGHLIGHT_NUM_LAYERS], hlEnd[core::HIGHLIGHT_NUM_LAYERS];
|
hlStart[core::HIGHLIGHT_NUM_LAYERS], hlEnd[core::HIGHLIGHT_NUM_LAYERS];
|
||||||
|
@ -1440,8 +1440,8 @@ int Textblock::hyphenateWord (int wordIndex, int *addIndex1)
|
|||||||
moveWordIndices (wordIndex, numBreaks, addIndex1);
|
moveWordIndices (wordIndex, numBreaks, addIndex1);
|
||||||
|
|
||||||
// Adjust anchor indexes.
|
// Adjust anchor indexes.
|
||||||
for (int i = 0; i < anchors->size (); i++) {
|
for (int i = 0; i < anchors.size (); i++) {
|
||||||
Anchor *anchor = anchors->getRef (i);
|
Anchor *anchor = &anchors.at (i);
|
||||||
if (anchor->wordIndex > wordIndex)
|
if (anchor->wordIndex > wordIndex)
|
||||||
anchor->wordIndex += numBreaks;
|
anchor->wordIndex += numBreaks;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user