| 302 | } |
| 303 | |
| 304 | void |
| 305 | SearcherThread::updateCanvas(void) { |
| 306 | t->layoutMutex.lock(); |
| 307 | if (t->root == nullptr) |
| 308 | return; |
| 309 | |
| 310 | if (t->autoHideFailed) { |
| 311 | t->root->hideFailed(*t->na,true); |
| 312 | } |
| 313 | for (VisualNode* n = t->currentNode; n != nullptr; n=n->getParent(*t->na)) { |
| 314 | if (n->isHidden()) { |
| 315 | t->currentNode->setMarked(false); |
| 316 | t->currentNode = n; |
| 317 | t->currentNode->setMarked(true); |
| 318 | break; |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | t->root->layout(*t->na); |
| 323 | BoundingBox bb = t->root->getBoundingBox(); |
| 324 | |
| 325 | int w = static_cast<int>((bb.right-bb.left+Layout::extent)*t->scale); |
| 326 | int h = static_cast<int>(2*Layout::extent+ |
| 327 | t->root->getShape()->depth() |
| 328 | *Layout::dist_y*t->scale); |
| 329 | t->xtrans = -bb.left+(Layout::extent / 2); |
| 330 | |
| 331 | int scale0 = static_cast<int>(t->scale*100); |
| 332 | if (t->autoZoom) { |
| 333 | QWidget* p = t->parentWidget(); |
| 334 | if (p) { |
| 335 | double newXScale = |
| 336 | static_cast<double>(p->width()) / (bb.right - bb.left + |
| 337 | Layout::extent); |
| 338 | double newYScale = |
| 339 | static_cast<double>(p->height()) / |
| 340 | (t->root->getShape()->depth() * Layout::dist_y + 2*Layout::extent); |
| 341 | |
| 342 | scale0 = static_cast<int>(std::min(newXScale, newYScale)*100); |
| 343 | if (scale0<LayoutConfig::minScale) |
| 344 | scale0 = LayoutConfig::minScale; |
| 345 | if (scale0>LayoutConfig::maxAutoZoomScale) |
| 346 | scale0 = LayoutConfig::maxAutoZoomScale; |
| 347 | double scale = (static_cast<double>(scale0)) / 100.0; |
| 348 | |
| 349 | w = static_cast<int>((bb.right-bb.left+Layout::extent)*scale); |
| 350 | h = static_cast<int>(2*Layout::extent+ |
| 351 | t->root->getShape()->depth()*Layout::dist_y*scale); |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | t->layoutMutex.unlock(); |
| 356 | emit update(w,h,scale0); |
| 357 | } |
| 358 | |
| 359 | /// A stack item for depth first search |
| 360 | class SearchItem { |
nothing calls this directly
no test coverage detected