Exemplo n.º 1
0
void ObjectBrowserWidget::setOutputVector(std::vector< const CCopasiObject * > * pObjectVector)
{
  mOutputObjectVector = pObjectVector;
  this->clearClicked();

  if (mOutputObjectVector) selectObjects(mOutputObjectVector);
}
Exemplo n.º 2
0
void Sample_13_2::draw()
{
	glClearColor (0.0, 0.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	drawScene ();
	selectObjects ();
}
Exemplo n.º 3
0
static void display(void)
{
   glClearColor (0.0, 0.0, 0.0, 0.0);
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   drawScene ();
   selectObjects ();
   glFlush();
}
void CCopasiSimpleSelectionTree::setOutputVector(std::vector< const CCopasiObject * > * outputVector)
{
  mpOutputVector = outputVector;

  if (mpOutputVector)
    {
      selectObjects(mpOutputVector);
    }
}
Exemplo n.º 5
0
    void DialogDistance::valueChanged(QtProperty* property,
                                      const QVariant &value) {
      (void)value;
  
      if (filled == false) return;

      if (property == viewNodes) {
        if (value.toBool() == false) {
          QList<QListWidgetItem*> nodeItems = objectList->findItems("Node ", Qt::MatchStartsWith);
          for (unsigned int i = 0; i < (unsigned int)nodeItems.size(); i++) 
            (void)objectList->takeItem(objectList->row(nodeItems[i]));
          selectedNodes.clear();
          selectObjects();
        } else {
          control->nodes->getListNodes(&simNodes);
          QStringList nodeItems;
          for (unsigned int i = 0; i < simNodes.size(); i++ )
            nodeItems << "Node " + QString::number(simNodes[i].index) 
              + ":" + QString::fromStdString(simNodes[i].name);
          objectList->insertItems(0, nodeItems);
        }
      } else if (property == viewJoints) {
        if (value.toBool() == false) {
          QList<QListWidgetItem*> jointItems = objectList->findItems("Joint ", Qt::MatchStartsWith);
          for (unsigned int i = 0; i < (unsigned int)jointItems.size(); i++)
            (void)objectList->takeItem(objectList->row(jointItems[i]));
          selectedJoints.clear();
          selectObjects();
        } else {
          control->joints->getListJoints(&simJoints);
          QStringList jointItems;
          for (unsigned int i = 0; i < simJoints.size(); i++ )
            jointItems << "Joint " + QString::number(simJoints[i].index) 
              + ":" + QString::fromStdString(simJoints[i].name);
          objectList->addItems(jointItems);
        }
      }

      if (property == distance) 
        changeDistance(value.toDouble());

    }
Exemplo n.º 6
0
void ObjectBrowserWidget::selectObjects(std::vector< const CCopasiObject * > * pObjectVector)
{
  unsigned int i;
  ObjectBrowserItem* rootItem;

  rootItem = objectItemList->getRoot()->pItem;

  for (i = 0; i < pObjectVector->size(); i++)
    {
      if ((*pObjectVector)[i]) selectObjects(rootItem, (*pObjectVector)[i]);
    }

  updateUI();
}
Exemplo n.º 7
0
void KTagsView::showEvent(QShowEvent* event)
{
  emit aboutToShow();

  if (m_needReload) {
    loadTags();
    m_needReload = false;
  }

  // don't forget base class implementation
  QWidget::showEvent(event);

  QList<MyMoneyTag> list;
  selectedTags(list);
  emit selectObjects(list);
}
Exemplo n.º 8
0
    DialogDistance::DialogDistance(interfaces::ControlCenter* c)
      : main_gui::BaseWidget(0, c->cfg, "DialogDistance"),
        pDialog(new main_gui::PropertyDialog(NULL)) {
      filled = false;
      control = c;
      selection = distance = ap1 = ap2 = rp1 = rp2 = NULL;
 
      this->setWindowTitle(tr("Object Distance Info"));
 
      pDialog->setPropCallback(this);
      pDialog->hideAllButtons();


      viewNodes = pDialog->addGenericProperty("../Nodes", QVariant::Bool, true);
      viewJoints = pDialog->addGenericProperty("../Joints", QVariant::Bool, true);
  
      objectList = new QListWidget(NULL);
      objectList->setSelectionMode(QAbstractItemView::MultiSelection);
      connect(objectList, SIGNAL(itemSelectionChanged()), this, SLOT(selectObjects()));

      control->nodes->getListNodes(&simNodes);

      for (unsigned int i =0 ; i<simNodes.size(); i++ )
        objectList->addItem("Node " + QString::number(simNodes[i].index) + 
                            ":" + QString::fromStdString(simNodes[i].name));

      control->joints->getListJoints(&simJoints);

      for (unsigned int i =0 ; i<simJoints.size(); i++ )
        objectList->addItem("Joint " + QString::number(simJoints[i].index) + 
                            ":" + QString::fromStdString(simJoints[i].name));

      QVBoxLayout *vLayout = new QVBoxLayout;
      vLayout->setAlignment(Qt::AlignTop);
      vLayout->addWidget(pDialog);

      QGridLayout *layout = new QGridLayout;
      layout->addWidget(objectList, 0, 0);
      layout->addLayout(vLayout, 0, 1);
      layout->setColumnStretch(1, 1);

      this->setLayout(layout);
      filled = true;
    }
Exemplo n.º 9
0
void ObjectBrowserWidget::selectObjects(ObjectBrowserItem* browserItem,
                                        const CCopasiObject * selectObject)
{
  ObjectBrowserItem* pCurrent;
  pCurrent = browserItem;

  if (pCurrent->firstChild())
    {
      ObjectBrowserItem* pChild = static_cast< ObjectBrowserItem * >(pCurrent->firstChild());

      for (; pChild != NULL; pChild = static_cast< ObjectBrowserItem * >(pChild->nextSibling()))
        if (pChild->getType() != FIELDATTR)
          selectObjects(pChild, selectObject);
    }
  else
    {//it has no child
      if (pCurrent->getType() != FIELDATTR)
        {
          if (pCurrent->getObject() && (pCurrent->getObject()->pCopasiObject == selectObject))
            {
              refreshList->insert(pCurrent);

              ObjectBrowserItem* pTmp = pCurrent;

              while (pTmp->parent() != NULL)
                {
                  pTmp = static_cast< ObjectBrowserItem * >(pTmp->parent());
                  refreshList->insert(pTmp);
                }

              pCurrent->getObject()->mChecked = ALLCHECKED;
              setCheck(static_cast< ObjectBrowserItem * >(pCurrent->firstChild()));
            }

          // else skip current item
        }
    }
}
Exemplo n.º 10
0
void MapBox::createMenus()
{
    QAction * menuItem;
    QMenu * subMenuItem;
    m_popupMenu = new QMenu(this);
    m_popupMenuMapObject = new QMenu(this);

    //**************************************************************

    // MapObject-specific context menu. The map object is in m_lastClickedMapObject.
    subMenuItem = m_popupMenuMapObject->addMenu(tr("MapObject"));

    menuItem = subMenuItem->addAction(tr("Remove"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(removeMapObject()));

    //**************************************************************

    /*

    // These are gread for testing, but not really what we want in
    // an example application.
    // We should probably creating a testing branch which tracks
    // the master branch and has various "test enabled" versions
    // of the examples at some point anyhow.

    subMenuItem = m_popupMenuMapObject->addMenu(tr("Spawn stuff"));
    m_popupMenu->addMenu(subMenuItem);

    menuItem = subMenuItem->addAction(tr("Items near the dateline"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(demo1()));

    menuItem = subMenuItem->addAction(tr("Regular grid of items"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(demo2()));

    menuItem = subMenuItem->addAction(tr("Clusters"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(demo3()));

    */

    //**************************************************************
    subMenuItem = m_popupMenuMapObject->addMenu(tr("Marker"));
    m_popupMenu->addMenu(subMenuItem);

    menuItem = subMenuItem->addAction(tr("Set marker"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(drawPixmap()));

    menuItem = subMenuItem->addAction(tr("Remove markers"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(removePixmaps()));

    menuItem = subMenuItem->addAction(tr("Select objects"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(selectObjects()));

    //**************************************************************
    subMenuItem = m_popupMenu->addMenu(tr("Draw"));
    m_popupMenu->addMenu(subMenuItem);

    menuItem = subMenuItem->addAction(tr("Rectangle"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(drawRect()));

    menuItem = subMenuItem->addAction(tr("Polyline"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(drawPolyline()));

    menuItem = subMenuItem->addAction(tr("Polygon"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(drawPolygon()));

    menuItem = subMenuItem->addAction(tr("Circle"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(drawCircle()));

    menuItem = subMenuItem->addAction(tr("Text"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(drawText()));

    //**************************************************************
    subMenuItem = m_popupMenuMapObject->addMenu(tr("Route"));
    m_popupMenu->addMenu(subMenuItem);

    menuItem = subMenuItem->addAction(tr("Calculate route"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(calcRoute()));

    //**************************************************************
    subMenuItem = m_popupMenuMapObject->addMenu(tr("Coordinates"));
    m_popupMenu->addMenu(subMenuItem);

    menuItem = subMenuItem->addAction(tr("Capture"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(captureCoordinates()));
    connect(menuItem, SIGNAL(triggered()),
            m_coordControlDialog, SLOT(show()));

    menuItem = subMenuItem->addAction(tr("Go to"));
    connect(menuItem, SIGNAL(triggered()),
            m_coordControlDialog, SLOT(show()));

    //**************************************************************
    subMenuItem = m_popupMenuMapObject->addMenu(tr("Tests"));
    m_popupMenu->addMenu(subMenuItem);

    menuItem = subMenuItem->addAction(tr("Dateline"));
    connect(menuItem, SIGNAL(triggered()),
            this, SLOT(testDateline()));
}
Exemplo n.º 11
0
void MapHelperUniversal::selectObjects(MapObject *object)
{
    if (object)
        selectObjects(QList<MapObject *>() << object);
}
Exemplo n.º 12
0
void KTagsView::slotSelectTag()
{
  // check if the content of a currently selected tag was modified
  // and ask to store the data
  if (m_updateButton->isEnabled()) {
    if (KMessageBox::questionYesNo(this, QString("<qt>%1</qt>").arg(
                                     i18n("Do you want to save the changes for <b>%1</b>?", m_newName)),
                                   i18n("Save changes")) == KMessageBox::Yes) {
      m_inSelection = true;
      slotUpdateTag();
      m_inSelection = false;
    }
  }
  // loop over all tags and count the number of tags, also
  // obtain last selected tag
  QList<MyMoneyTag> tagsList;
  selectedTags(tagsList);

  emit selectObjects(tagsList);

  if (tagsList.isEmpty()) {
    m_tabWidget->setEnabled(false); // disable tab widget
    m_balanceLabel->hide();
    m_deleteButton->setEnabled(false); //disable delete and rename button
    m_renameButton->setEnabled(false);
    clearItemData();
    m_tag = MyMoneyTag();
    return; // make sure we don't access an undefined tag
  }

  m_deleteButton->setEnabled(true); //re-enable delete button

  // if we have multiple tags selected, clear and disable the tag information
  if (tagsList.count() > 1) {
    m_tabWidget->setEnabled(false); // disable tab widget
    m_renameButton->setEnabled(false); // disable also the rename button
    m_balanceLabel->hide();
    clearItemData();
  } else m_renameButton->setEnabled(true);

  // otherwise we have just one selected, enable tag information widget and renameButton
  m_tabWidget->setEnabled(true);
  m_balanceLabel->show();

  // as of now we are updating only the last selected tag, and until
  // selection mode of the QListView has been changed to Extended, this
  // will also be the only selection and behave exactly as before - Andreas
  try {
    m_tag = tagsList[0];

    m_newName = m_tag.name();
    m_colorbutton->setEnabled(true);
    m_colorbutton->setColor(m_tag.tagColor());
    m_closed->setEnabled(true);
    m_closed->setChecked(m_tag.isClosed());
    m_notes->setEnabled(true);
    m_notes->setText(m_tag.notes());
    slotTagDataChanged();

    showTransactions();

  } catch (const MyMoneyException &e) {
    qDebug("exception during display of tag: %s at %s:%ld", qPrintable(e.what()), qPrintable(e.file()), e.line());
    m_register->clear();
    m_tag = MyMoneyTag();
  }
  m_allowEditing = true;
}