forceinline void
 UnhideAllCursor::processCurrentNode(void) {
   VisualNode* n = node();
   if (n->isHidden()) {
     n->setHidden(false);
     n->dirtyUp(na);
   }
 }
 forceinline bool
 HideFailedCursor::mayMoveDownwards(void) {
   VisualNode* n = node();
   return (!onlyDirty || n->isDirty()) &&
          NodeCursor<VisualNode>::mayMoveDownwards() &&
          (n->hasSolvedChildren() || n->getNoOfOpenChildren(na) > 0) &&
          (! n->isHidden());
 }
Beispiel #3
0
  void
  SearcherThread::updateCanvas(void) {
    t->layoutMutex.lock();
    if (t->root == NULL)
      return;

    if (t->autoHideFailed) {
      t->root->hideFailed(*t->na,true);
    }
    for (VisualNode* n = t->currentNode; n != NULL; n=n->getParent(*t->na)) {
      if (n->isHidden()) {
        t->currentNode->setMarked(false);
        t->currentNode = n;
        t->currentNode->setMarked(true);
        break;
      }
    }
    
    t->root->layout(*t->na);
    BoundingBox bb = t->root->getBoundingBox();

    int w = static_cast<int>((bb.right-bb.left+Layout::extent)*t->scale);
    int h = static_cast<int>(2*Layout::extent+
                             t->root->getShape()->depth()
                              *Layout::dist_y*t->scale);
    t->xtrans = -bb.left+(Layout::extent / 2);

    int scale0 = static_cast<int>(t->scale*100);
    if (t->autoZoom) {
      QWidget* p = t->parentWidget();
      if (p) {
        double newXScale =
          static_cast<double>(p->width()) / (bb.right - bb.left +
                                             Layout::extent);
        double newYScale =
          static_cast<double>(p->height()) /
          (t->root->getShape()->depth() * Layout::dist_y + 2*Layout::extent);

        scale0 = static_cast<int>(std::min(newXScale, newYScale)*100);
        if (scale0<LayoutConfig::minScale)
          scale0 = LayoutConfig::minScale;
        if (scale0>LayoutConfig::maxAutoZoomScale)
          scale0 = LayoutConfig::maxAutoZoomScale;
        double scale = (static_cast<double>(scale0)) / 100.0;

        w = static_cast<int>((bb.right-bb.left+Layout::extent)*scale);
        h = static_cast<int>(2*Layout::extent+
                             t->root->getShape()->depth()*Layout::dist_y*scale);
      }
    }

    t->layoutMutex.unlock();
    emit update(w,h,scale0);
  }
Beispiel #4
0
 forceinline void
 LayoutCursor::processCurrentNode() {
   VisualNode* currentNode = node();
   if (currentNode->isDirty()) {
     if (currentNode->isHidden()) {
       // do nothing
     } else if (currentNode->getNumberOfChildren() < 1) {
       currentNode->setShape(Shape::leaf);
     } else {
       currentNode->computeShape(na,startNode());
     }
     currentNode->setDirty(false);
   }
   if (currentNode->getNumberOfChildren() >= 1)
     currentNode->setChildrenLayoutDone(true);
 }
Beispiel #5
0
 bool
 TreeCanvas::event(QEvent* event) {
   if (mutex.tryLock()) {
     if (event->type() == QEvent::ToolTip) {
       VisualNode* n = eventNode(event);
       if (n != NULL && !n->isHidden() &&
           (n->getStatus() == BRANCH || n->getStatus() == STOP)) {
         QHelpEvent* he = static_cast<QHelpEvent*>(event);
         QToolTip::showText(he->globalPos(),
                            QString(n->toolTip(curBest,c_d,a_d).c_str()));
       } else {
         QToolTip::hideText();
       }
     }
     mutex.unlock();
   }
   return QWidget::event(event);
 }