MCPcopy Create free account
hub / github.com/KDE/kdiff3 / recalcWordWrap

Method recalcWordWrap

src/pdiff.cpp:1242–1310  ·  view source on GitHub ↗

visibleTextWidthForPrinting is >=0 only for printing, otherwise the really visible width is used

Source from the content-addressed store, hash-verified

1240
1241// visibleTextWidthForPrinting is >=0 only for printing, otherwise the really visible width is used
1242void KDiff3App::recalcWordWrap(qint32 visibleTextWidthForPrinting)
1243{
1244 m_bRecalcWordWrapPosted = true;
1245 mainWindowEnable(false);
1246
1247 if(m_firstD3LIdx < 0)
1248 {
1249 m_firstD3LIdx = 0;
1250 if(!m_pDiffTextWindow1)
1251 return; //Nothing that happens from here on makes any sense if we don't have a DiffTextWindow.
1252
1253 m_firstD3LIdx = m_pDiffTextWindow1->convertLineToDiff3LineIdx(m_pDiffTextWindow1->getFirstLine());
1254 }
1255
1256 // Convert selection to D3L-coords (converting back happens in DiffTextWindow::recalcWordWrap()
1257 if(m_pDiffTextWindow1)
1258 m_pDiffTextWindow1->convertSelectionToD3LCoords();
1259 if(m_pDiffTextWindow2)
1260 m_pDiffTextWindow2->convertSelectionToD3LCoords();
1261 if(m_pDiffTextWindow3)
1262 m_pDiffTextWindow3->convertSelectionToD3LCoords();
1263
1264 g_pProgressDialog->clearCancelState(); // clear cancelled state if previously set
1265
1266 if(!m_diff3LineList.empty())
1267 {
1268 if(gOptions->wordWrapOn())
1269 {
1270 m_diff3LineList.recalcWordWrap(true);
1271
1272 // Let every window calc how many lines will be needed.
1273 if(m_pDiffTextWindow1)
1274 {
1275 m_pDiffTextWindow1->recalcWordWrap(true, 0, visibleTextWidthForPrinting);
1276 }
1277 if(m_pDiffTextWindow2)
1278 {
1279 m_pDiffTextWindow2->recalcWordWrap(true, 0, visibleTextWidthForPrinting);
1280 }
1281 if(m_pDiffTextWindow3)
1282 {
1283 m_pDiffTextWindow3->recalcWordWrap(true, 0, visibleTextWidthForPrinting);
1284 }
1285 }
1286 else
1287 {
1288 m_neededLines = SafeInt<LineType>(m_diff3LineList.size());
1289 if(m_pDiffTextWindow1)
1290 m_pDiffTextWindow1->recalcWordWrap(false, 0, 0);
1291 if(m_pDiffTextWindow2)
1292 m_pDiffTextWindow2->recalcWordWrap(false, 0, 0);
1293 if(m_pDiffTextWindow3)
1294 m_pDiffTextWindow3->recalcWordWrap(false, 0, 0);
1295 }
1296 mRunnablesStarted = DiffTextWindow::startRunnables();
1297 if(!mRunnablesStarted)
1298 slotFinishRecalcWordWrap(visibleTextWidthForPrinting);
1299 else

Callers 1

Calls 7

clearCancelStateMethod · 0.80
wordWrapOnMethod · 0.80
getFirstLineMethod · 0.45
sizeMethod · 0.45
setInformationMethod · 0.45

Tested by

no test coverage detected