| 204 | } |
| 205 | |
| 206 | Textblock::Textblock (bool limitTextWidth, bool treatAsInline) |
| 207 | { |
| 208 | DBG_OBJ_CREATE ("dw::Textblock"); |
| 209 | registerName ("dw::Textblock", &CLASS_ID); |
| 210 | setButtonSensitive(true); |
| 211 | |
| 212 | hasListitemValue = false; |
| 213 | leftInnerPadding = 0; |
| 214 | line1Offset = 0; |
| 215 | ignoreLine1OffsetSometimes = false; |
| 216 | mustQueueResize = false; |
| 217 | DBG_OBJ_SET_BOOL ("mustQueueResize", mustQueueResize); |
| 218 | redrawY = 0; |
| 219 | DBG_OBJ_SET_NUM ("redrawY", redrawY); |
| 220 | lastWordDrawn = -1; |
| 221 | DBG_OBJ_SET_NUM ("lastWordDrawn", lastWordDrawn); |
| 222 | |
| 223 | DBG_OBJ_ASSOC_CHILD (&sizeRequestParams); |
| 224 | |
| 225 | /* |
| 226 | * The initial sizes of lines and words should not be |
| 227 | * too high, since this will waste much memory with tables |
| 228 | * containing many small cells. The few more calls to realloc |
| 229 | * should not decrease the speed considerably. |
| 230 | * (Current setting is for minimal memory usage. An interesting fact |
| 231 | * is that high values decrease speed due to memory handling overhead!) |
| 232 | * TODO: Some tests would be useful. |
| 233 | */ |
| 234 | paragraphs = new misc::SimpleVector <Paragraph> (1); |
| 235 | lines = new misc::SimpleVector <Line> (1); |
| 236 | nonTemporaryLines = 0; |
| 237 | words = new misc::NotSoSimpleVector <Word> (1); |
| 238 | anchors = new misc::SimpleVector <Anchor> (1); |
| 239 | |
| 240 | wrapRefLines = wrapRefParagraphs = -1; |
| 241 | wrapRefLinesFCX = wrapRefLinesFCY = -1; |
| 242 | |
| 243 | DBG_OBJ_SET_NUM ("lines.size", lines->size ()); |
| 244 | DBG_OBJ_SET_NUM ("words.size", words->size ()); |
| 245 | DBG_OBJ_SET_NUM ("wrapRefLines", wrapRefLines); |
| 246 | DBG_OBJ_SET_NUM ("wrapRefParagraphs", wrapRefParagraphs); |
| 247 | DBG_OBJ_SET_NUM ("wrapRefLinesFCX", wrapRefLinesFCX); |
| 248 | DBG_OBJ_SET_NUM ("wrapRefLinesFCY", wrapRefLinesFCY); |
| 249 | |
| 250 | hoverLink = -1; |
| 251 | |
| 252 | // -1 means undefined. |
| 253 | lineBreakWidth = -1; |
| 254 | DBG_OBJ_SET_NUM ("lineBreakWidth", lineBreakWidth); |
| 255 | |
| 256 | this->limitTextWidth = limitTextWidth; |
| 257 | this->treatAsInline = treatAsInline; |
| 258 | |
| 259 | for (int layer = 0; layer < core::HIGHLIGHT_NUM_LAYERS; layer++) { |
| 260 | /* hlStart[layer].index > hlEnd[layer].index means no highlighting */ |
| 261 | hlStart[layer].index = 1; |
| 262 | hlStart[layer].nChar = 0; |
| 263 | hlEnd[layer].index = 0; |