A few more SimpleVector
changes.
Some checks failed
CI / ubuntu-latest-html-tests (push) Has been cancelled
CI / ubuntu-latest-no-tls (push) Has been cancelled
CI / ubuntu-latest-mbedtls2 (push) Has been cancelled
CI / ubuntu-latest-openssl-3 (push) Has been cancelled
CI / ubuntu-latest-with-old-std (push) Has been cancelled
CI / ubuntu-20-04-openssl-1-1 (push) Has been cancelled
CI / alpine-mbedtls-3_6_0 (push) Has been cancelled
CI / macOS-13-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-3 (push) Has been cancelled
CI / freebsd-14-openssl-3 (push) Has been cancelled
CI / windows-mbedtls (push) Has been cancelled
Some checks failed
CI / ubuntu-latest-html-tests (push) Has been cancelled
CI / ubuntu-latest-no-tls (push) Has been cancelled
CI / ubuntu-latest-mbedtls2 (push) Has been cancelled
CI / ubuntu-latest-openssl-3 (push) Has been cancelled
CI / ubuntu-latest-with-old-std (push) Has been cancelled
CI / ubuntu-20-04-openssl-1-1 (push) Has been cancelled
CI / alpine-mbedtls-3_6_0 (push) Has been cancelled
CI / macOS-13-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-3 (push) Has been cancelled
CI / freebsd-14-openssl-3 (push) Has been cancelled
CI / windows-mbedtls (push) Has been cancelled
This commit is contained in:
@ -140,7 +140,7 @@ void Hyphenator::insertPattern (TrieBuilder *trieBuilder, char *s)
|
|||||||
// Convert the a pattern like 'a1bc3d4' into a string of chars 'abcd'
|
// Convert the a pattern like 'a1bc3d4' into a string of chars 'abcd'
|
||||||
// and a list of points [ 0, 1, 0, 3, 4 ].
|
// and a list of points [ 0, 1, 0, 3, 4 ].
|
||||||
std::string chars;
|
std::string chars;
|
||||||
SimpleVector<char> points (1);
|
std::vector< char > points;
|
||||||
|
|
||||||
// TODO numbers consisting of multiple digits?
|
// TODO numbers consisting of multiple digits?
|
||||||
// TODO Encoding: This implementation works exactly like the Python
|
// TODO Encoding: This implementation works exactly like the Python
|
||||||
@ -148,8 +148,7 @@ void Hyphenator::insertPattern (TrieBuilder *trieBuilder, char *s)
|
|||||||
int numChars = 0;
|
int numChars = 0;
|
||||||
for (int i = 0; s[i]; i++) {
|
for (int i = 0; s[i]; i++) {
|
||||||
if (s[i] >= '0' && s[i] <= '9') {
|
if (s[i] >= '0' && s[i] <= '9') {
|
||||||
points.setSize(numChars + 1, '0');
|
points.push_back( s[ i ] );
|
||||||
points.set(numChars, s[i]);
|
|
||||||
} else {
|
} else {
|
||||||
numChars++;
|
numChars++;
|
||||||
chars+= s[i];
|
chars+= s[i];
|
||||||
@ -157,8 +156,8 @@ void Hyphenator::insertPattern (TrieBuilder *trieBuilder, char *s)
|
|||||||
}
|
}
|
||||||
chars[numChars] = 0;
|
chars[numChars] = 0;
|
||||||
|
|
||||||
points.setSize(numChars + 2, '0');
|
points.resize( numChars + 2, '0' );
|
||||||
points.set(numChars + 1, '\0');
|
points.at( numChars + 1 )= '\0';
|
||||||
|
|
||||||
// Insert the pattern into the tree. Each character finds a dict
|
// Insert the pattern into the tree. Each character finds a dict
|
||||||
// another level down in the tree, and leaf nodes have the list of
|
// another level down in the tree, and leaf nodes have the list of
|
||||||
@ -166,7 +165,7 @@ void Hyphenator::insertPattern (TrieBuilder *trieBuilder, char *s)
|
|||||||
|
|
||||||
//printf("insertPattern %s\n", chars);
|
//printf("insertPattern %s\n", chars);
|
||||||
|
|
||||||
trieBuilder->insert (chars.c_str(), points.getArray ());
|
trieBuilder->insert (chars.c_str(), points.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hyphenator::insertException (char *s)
|
void Hyphenator::insertException (char *s)
|
||||||
|
20
dw/table.cc
20
dw/table.cc
@ -52,7 +52,6 @@ Table::Table(bool limitTextWidth)
|
|||||||
colExtremes = new misc::SimpleVector<core::Extremes> (8);
|
colExtremes = new misc::SimpleVector<core::Extremes> (8);
|
||||||
colWidthSpecified = new misc::SimpleVector<bool> (8);
|
colWidthSpecified = new misc::SimpleVector<bool> (8);
|
||||||
colWidthPercentage = new misc::SimpleVector<bool> (8);
|
colWidthPercentage = new misc::SimpleVector<bool> (8);
|
||||||
cumHeight = new misc::SimpleVector <int> (8);
|
|
||||||
rowSpanCells = new misc::SimpleVector <int> (8);
|
rowSpanCells = new misc::SimpleVector <int> (8);
|
||||||
baseline = new misc::SimpleVector <int> (8);
|
baseline = new misc::SimpleVector <int> (8);
|
||||||
rowStyle = new misc::SimpleVector <core::style::Style*> (8);
|
rowStyle = new misc::SimpleVector <core::style::Style*> (8);
|
||||||
@ -92,7 +91,6 @@ Table::~Table()
|
|||||||
delete colExtremes;
|
delete colExtremes;
|
||||||
delete colWidthSpecified;
|
delete colWidthSpecified;
|
||||||
delete colWidthPercentage;
|
delete colWidthPercentage;
|
||||||
delete cumHeight;
|
|
||||||
delete rowSpanCells;
|
delete rowSpanCells;
|
||||||
delete baseline;
|
delete baseline;
|
||||||
delete rowStyle;
|
delete rowStyle;
|
||||||
@ -115,7 +113,7 @@ void Table::sizeRequestSimpl (core::Requisition *requisition)
|
|||||||
requisition->width += colWidths.at (col);
|
requisition->width += colWidths.at (col);
|
||||||
|
|
||||||
requisition->ascent =
|
requisition->ascent =
|
||||||
boxDiffHeight () + cumHeight->get (numRows) + getStyle()->vBorderSpacing;
|
boxDiffHeight () + cumHeight.at (numRows) + getStyle()->vBorderSpacing;
|
||||||
requisition->descent = 0;
|
requisition->descent = 0;
|
||||||
|
|
||||||
correctRequisition (requisition, core::splitHeightPreserveDescent, true,
|
correctRequisition (requisition, core::splitHeightPreserveDescent, true,
|
||||||
@ -192,12 +190,12 @@ void Table::sizeAllocateImpl (core::Allocation *allocation)
|
|||||||
children->get(n)->cell.widget->sizeRequest (&childRequisition);
|
children->get(n)->cell.widget->sizeRequest (&childRequisition);
|
||||||
|
|
||||||
childAllocation.x = x;
|
childAllocation.x = x;
|
||||||
childAllocation.y = cumHeight->get (row) + offy;
|
childAllocation.y = cumHeight.at (row) + offy;
|
||||||
childAllocation.width = width;
|
childAllocation.width = width;
|
||||||
childAllocation.ascent = childRequisition.ascent;
|
childAllocation.ascent = childRequisition.ascent;
|
||||||
childAllocation.descent =
|
childAllocation.descent =
|
||||||
cumHeight->get (row + children->get(n)->cell.rowspan)
|
cumHeight.at (row + children->get(n)->cell.rowspan)
|
||||||
- cumHeight->get (row) - getStyle()->vBorderSpacing
|
- cumHeight.at (row) - getStyle()->vBorderSpacing
|
||||||
- childRequisition.ascent;
|
- childRequisition.ascent;
|
||||||
children->get(n)->cell.widget->sizeAllocate (&childAllocation);
|
children->get(n)->cell.widget->sizeAllocate (&childAllocation);
|
||||||
}
|
}
|
||||||
@ -920,7 +918,7 @@ void Table::actuallyCalcCellSizes (bool calcHeights)
|
|||||||
boxDiffWidth (), totalWidth);
|
boxDiffWidth (), totalWidth);
|
||||||
|
|
||||||
assert (colWidths.size () == numCols); // This is set in addCell.
|
assert (colWidths.size () == numCols); // This is set in addCell.
|
||||||
cumHeight->setSize (numRows + 1, 0);
|
cumHeight.resize (numRows + 1, 0);
|
||||||
rowSpanCells->setSize (0);
|
rowSpanCells->setSize (0);
|
||||||
baseline->setSize (numRows);
|
baseline->setSize (numRows);
|
||||||
|
|
||||||
@ -1213,7 +1211,7 @@ void Table::actuallyCalcCellSizes (bool calcHeights)
|
|||||||
} // for col
|
} // for col
|
||||||
|
|
||||||
setCumHeight (row + 1,
|
setCumHeight (row + 1,
|
||||||
cumHeight->get (row) + rowHeight + getStyle()->vBorderSpacing);
|
cumHeight.at (row) + rowHeight + getStyle()->vBorderSpacing);
|
||||||
} // for row
|
} // for row
|
||||||
|
|
||||||
apportionRowSpan ();
|
apportionRowSpan ();
|
||||||
@ -1232,7 +1230,7 @@ void Table::apportionRowSpan ()
|
|||||||
int n = rowSpanCells->get(c);
|
int n = rowSpanCells->get(c);
|
||||||
int row = n / numCols;
|
int row = n / numCols;
|
||||||
int rs = children->get(n)->cell.rowspan;
|
int rs = children->get(n)->cell.rowspan;
|
||||||
int sumRows = cumHeight->get(row+rs) - cumHeight->get(row);
|
int sumRows = cumHeight.at(row+rs) - cumHeight.at(row);
|
||||||
core::Requisition childRequisition;
|
core::Requisition childRequisition;
|
||||||
children->get(n)->cell.widget->sizeRequest (&childRequisition);
|
children->get(n)->cell.widget->sizeRequest (&childRequisition);
|
||||||
int spanHeight = childRequisition.ascent + childRequisition.descent
|
int spanHeight = childRequisition.ascent + childRequisition.descent
|
||||||
@ -1248,7 +1246,7 @@ void Table::apportionRowSpan ()
|
|||||||
if (!rowHeight) {
|
if (!rowHeight) {
|
||||||
rowHeight = new int[numRows];
|
rowHeight = new int[numRows];
|
||||||
for (int i = 0; i < numRows; i++)
|
for (int i = 0; i < numRows; i++)
|
||||||
rowHeight[i] = cumHeight->get(i+1) - cumHeight->get(i);
|
rowHeight[i] = cumHeight.at(i+1) - cumHeight.at(i);
|
||||||
}
|
}
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
MSG(" rowHeight { ");
|
MSG(" rowHeight { ");
|
||||||
@ -1276,7 +1274,7 @@ void Table::apportionRowSpan ()
|
|||||||
}
|
}
|
||||||
// Update cumHeight
|
// Update cumHeight
|
||||||
for (int i = 0; i < numRows; ++i)
|
for (int i = 0; i < numRows; ++i)
|
||||||
setCumHeight (i+1, cumHeight->get(i) + rowHeight[i]);
|
setCumHeight (i+1, cumHeight.at(i) + rowHeight[i]);
|
||||||
}
|
}
|
||||||
delete[] rowHeight;
|
delete[] rowHeight;
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ private:
|
|||||||
* cumHeight->get(0) is 0, cumHeight->get(numRows) is the total table
|
* cumHeight->get(0) is 0, cumHeight->get(numRows) is the total table
|
||||||
* height.
|
* height.
|
||||||
*/
|
*/
|
||||||
lout::misc::SimpleVector<int> *cumHeight;
|
std::vector< int > cumHeight;
|
||||||
/**
|
/**
|
||||||
* If a Cell has rowspan > 1, it goes into this array
|
* If a Cell has rowspan > 1, it goes into this array
|
||||||
*/
|
*/
|
||||||
@ -457,9 +457,9 @@ private:
|
|||||||
|
|
||||||
void setCumHeight (int row, int value)
|
void setCumHeight (int row, int value)
|
||||||
{
|
{
|
||||||
if (value != cumHeight->get (row)) {
|
if (value != cumHeight.at (row)) {
|
||||||
redrawY = std::min ( redrawY, value );
|
redrawY = std::min ( redrawY, value );
|
||||||
cumHeight->set (row, value);
|
cumHeight[ row ]= value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user