Ejemplo n.º 1
0
void QUserPanel::DropItem(const char* itemname, TClass* cl, int kind)
{
   switch (TabWidget->currentIndex()) {
      case 0:
         DragLbl->setText("User dropped item");
         DragItemLbl->setText(itemname);
         DragClassLbl->setText(cl==0 ? "No class specified" : cl->GetName());
         DragKindLbl->setText(kindString(kind));
         break;
      case 1:
         if (cl==0) {
            PrintLbl->setText("Can not drop item of uncknown class");
         } else {
            PrintLbl->setText(QString("Print item: ") + itemname);
            RemoveLink("PrintItem");
            AddLink(itemname, "PrintItem");
            PrintObject(GetLinked("PrintItem", 2));
         }

         break;
      case 2:
        DrawObjectOnCanvas(itemname);
        break;
   }
}
Ejemplo n.º 2
0
/*
===============
SV_UnlinkEdict

===============
*/
void SV_UnlinkEdict (edict_t *ent)
{
	if (!ent->area.prev)
		return;		// not linked in anywhere
	RemoveLink (&ent->area);
	ent->area.prev = ent->area.next = NULL;
}
Ejemplo n.º 3
0
void cLuaTCPLink::Terminated(void)
{
	// Disable the callbacks:
	if (m_Callbacks.IsValid())
	{
		m_Callbacks.UnRef();
	}

	// If the managing server is still alive, let it know we're terminating:
	auto Server = m_Server.lock();
	if (Server != nullptr)
	{
		Server->RemoveLink(this);
	}

	// If the link is still open, close it:
	{
		cTCPLinkPtr Link = m_Link;
		if (Link != nullptr)
		{
			Link->Close();
			m_Link.reset();
		}
	}

	// If the SSL context still exists, free it:
	m_SslContext.reset();
}
Ejemplo n.º 4
0
void cLuaTCPLink::Terminated(void)
{
	// Disable the callbacks:
	if (m_Callbacks->IsValid())
	{
		m_Callbacks->Clear();
	}

	// If the managing server is still alive, let it know we're terminating:
	auto Server = m_Server.lock();
	if (Server != nullptr)
	{
		Server->RemoveLink(this);
	}

	// If the link is still open, close it:
	{
		auto link= m_Link;
		if (link != nullptr)
		{
			link->Close();
			m_Link.reset();
		}
	}
}
Ejemplo n.º 5
0
void Dynamic::Move(double deltaTime)
{
	m_Acceleration.y+= m_Gravity * deltaTime*60;
	m_OldVelocity= m_Velocity;
	m_Velocity+= m_Acceleration;
	//*m_PosPtr+=  m_Velocity     * deltaTime;
	m_Acceleration= DOUBLE2();

	RayBounceWrapper(deltaTime); // Kan ook multi-tretherd! Zie GameEngine (concurrency problemen...)
	//RayBounce(deltaTime, &m_Pos,  &m_Velocity);

	//DOUBLE2 pos= *m_PosPtr;
	if( GAME_ENGINE->IsKeyDown('X') ){
		for( unsigned int myLink=0; myLink<m_LinkList.size(); ++myLink ){
			if( rand()%140 < deltaTime*60 )
				RemoveLink(myLink);
		}
	}

	if(  m_Pos.x<0 ) ApplyForce(DOUBLE2(-m_Pos.x*4, 0));

	double xTeVeel=  m_MasterOfListsPtr->GetLevelMaxPos().x - m_Pos.x;
	if( xTeVeel<0 ) ApplyForce(DOUBLE2( xTeVeel*4, 0));

	//xMarge= m_Pos.x - m_LevelMaxPos.x;
	//if(  xMarge>0 ) ApplyForce(DOUBLE2(-xMarge*2, 0));
}
Ejemplo n.º 6
0
CDoubleLink *CDoubleList::RemoveLast( void )
{
	CDoubleLink *pItem = m_pLast;

	RemoveLink( pItem );

	return (pItem);
}
Ejemplo n.º 7
0
//====================== class ItemProperties ============================
LinkProperties::LinkProperties(QWidget *parent)
     : QDialog(parent)
{
     ui.setupUi(this);
     
     connect(ui.BRemove, SIGNAL(clicked()), this, SLOT(RemoveLink()) );
     connect(ui.BChooseFile, SIGNAL(clicked()), this, SLOT(chooseFile()) );  
}
Ejemplo n.º 8
0
Dynamic::~Dynamic() {
	
	unsigned int max= m_LinkList.size();
	for (unsigned int plaats=0; plaats<m_LinkList.size(); ++plaats){
		RemoveLink( 0 );
		//RemoveLink( plaats ); // delete alles dat naar dit object verwijst.
	}
	
	//m_DynamicListPtr->Delete(this);
}
Ejemplo n.º 9
0
void QUserPanel::linkedObjectRemoved(const char* linkname)
{
    if (strcmp(linkname, "PrintItem")==0)
      PrintObject(0);
    else
    if (strcmp(linkname, "DrawItem")==0) {
      RemoveLink("DrawItem");
      fxDrawCanvas->getCanvas()->Clear();
      fxDrawCanvas->getCanvas()->Update();
    }
}
Ejemplo n.º 10
0
void QUserPanel::DrawObjectOnCanvas(const char* itemname)
{
   RemoveLink("DrawItem");
   AddLink(itemname, "DrawItem");
   TObject* obj = GetLinked("DrawItem", 2);
   if (obj!=0) {
      fxDrawCanvas->getCanvas()->Clear();
      fxDrawCanvas->getCanvas()->cd();
      obj->Draw("");
      fxDrawCanvas->getCanvas()->Update();
   }
}
Ejemplo n.º 11
0
void Dynamic::TickSetDistance(double deltaTime){
		
	for( unsigned int b= 0; b<m_LinkList.size(); ++b ){

		Dynamic *bPtr= m_LinkList.at(b);
		
		DOUBLE2 AB= bPtr->m_Pos - m_Pos; // difference vector
		double deltaLength= AB.Length();
		
		double verschil=   deltaLength - m_LinkLen.at(b); //Hooke's Law

		
		// Power
		double power;
		//power= pow( abs(verschil)/2, 1.5 )*10;		if( verschil<0 ) power= -power;
		double k= 50;							power= k * verschil;	// veerconstante;

		this->ApplyForce( AB.Normalized() * power );
		bPtr->ApplyForce( AB.Normalized() *-power );//*/

		// bij te grote impuls gaat de conectie kapot. Dit voorkomt ook dynamics explotions
		if(  abs(deltaLength/m_LinkLen.at(b) - 1)> 1.2){ //power>6000 ||
			RemoveLink(b);
			OutputDebugString("\nImpulsBreak!");
			return;
		}
		

		//this->m_Velocity*=0.9;
		//bPtr->m_Velocity*=0.9;

		/*if( false ){ // niet werkende friction.
			DOUBLE2 velocity1, velocity2;
			velocity1= AB.Normalized() * AB.DotProduct( m_Velocity );
			velocity2= m_Velocity - velocity1;
			velocity1*= 0.8;
			m_Velocity= velocity1 + velocity2;
			
			/*velocity1= AB * AB.DotProduct( bPtr->m_Velocity );
			velocity2= bPtr->m_Velocity - velocity1;
			velocity1*= 0.8;
			bPtr->m_Velocity= velocity1 + velocity2;//*/
		//}
	}

}
Ejemplo n.º 12
0
void
inDOMView::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer,
                          nsIContent* aChild, PRInt32 aIndexInContainer,
                          nsIContent* aPreviousSibling)
{
  if (!mTree)
    return;

  nsresult rv;

  // find the inDOMViewNode for the old child
  nsCOMPtr<nsIDOMNode> oldDOMNode(do_QueryInterface(aChild));
  PRInt32 row = 0;
  if (NS_FAILED(rv = NodeToRow(oldDOMNode, &row)))
    return;
  inDOMViewNode* oldNode;
  if (NS_FAILED(rv = RowToNode(row, &oldNode)))
    return;

  nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
  
  // The parent may no longer be a container.  Note that we don't want
  // to access oldNode after calling RemoveNode, so do this now.
  inDOMViewNode* parentNode = oldNode->parent;
  bool isOnlyChild = oldNode->previous == nsnull && oldNode->next == nsnull;
  
  // Keep track of how many rows we are removing.  It's at least one,
  // but if we're open it's more.
  PRInt32 oldCount = GetRowCount();
  
  if (oldNode->isOpen)
    CollapseNode(row);

  RemoveLink(oldNode);
  RemoveNode(row);

  if (isOnlyChild) {
    // Fix up the parent
    parentNode->isContainer = PR_FALSE;
    parentNode->isOpen = PR_FALSE;
    mTree->InvalidateRow(NodeToRow(parentNode));
  }
    
  mTree->RowCountChanged(row, GetRowCount() - oldCount);
}
Ejemplo n.º 13
0
void C4ObjectList::Sort()
{
	C4ObjectLink *cLnk;
	bool fSorted;
	// Sort by id
	do
	{
		fSorted = true;
		for (cLnk=First; cLnk && cLnk->Next; cLnk=cLnk->Next)
			if (cLnk->Obj->id > cLnk->Next->Obj->id)
			{
				RemoveLink(cLnk);
				InsertLink(cLnk,cLnk->Next);
				fSorted = false;
				break;
			}
	}
	while (!fSorted);
}
Ejemplo n.º 14
0
bool C4ObjectList::Remove(C4Object *pObj)
{
	C4ObjectLink *cLnk;

	// Find link
	for (cLnk=First; cLnk; cLnk=cLnk->Next)
		if (cLnk->Obj==pObj) break;
	if (!cLnk) return false;

	// Fix iterators
	for (iterator * i = FirstIter; i; i = i->Next)
	{
		// adjust pointers of internal link field
		if (i->link.Prev == cLnk)
		{
			i->link.Prev = cLnk->Prev;
		}
		else if (i->link.Next == cLnk)
		{
			i->link.Next = cLnk->Next;
		}
		else if (i->link.Obj == cLnk->Obj)
		{
			i->link.Obj = nullptr;
		}
	}

	// Remove link from list
	RemoveLink(cLnk);

	// Deallocate link
	delete cLnk;

	// Remove mass
	Mass-=pObj->Mass; if (Mass<0) Mass=0;

#if defined(_DEBUG)
	if (GetLink(pObj)) BREAKPOINT_HERE;
#endif

	return true;
}
Ejemplo n.º 15
0
void KVDBKey::Unlink(KVDBRecord* rec, Bool_t linkback)
{
   //This function removes a record from the list of cross-references
   //if linkback is kTRUE then the reference in record "rec" is also removed.

   RemoveLink(rec);

   if (linkback) {

      //check parent is set
      if (!GetParent()) {
         Error("Unlink", "Parent not set for key %s", GetName());
         return;
      }
      const Char_t* table_name = GetParent()->GetTable()->GetName();

      KVDBKey* key = rec->GetKey(table_name);
      if (key) key->Unlink(GetParent(), kFALSE); //linkback=kFALSE otherwise infinite circular linkage results !!!
   }
}
Ejemplo n.º 16
0
void SV_UnlinkEdict(edict_t *ent)
{
	guard(SV_UnlinkEdict);

	if (!ent->area.prev) return;			// not linked
	RemoveLink(ent->area);
	ent->area.prev = ent->area.next = NULL;

	entityHull_t &ex = ents[NUM_FOR_EDICT(ent)];
	areanode_t *node = ex.area;
	if (ent->solid == SOLID_TRIGGER)
		for ( ; node; node = node->parent)
			node->numTrigEdicts--;
	else
		for ( ; node; node = node->parent)
			node->numSolidEdicts--;

	ex.area = NULL;

	unguard;
}
Ejemplo n.º 17
0
void
inDOMView::AttributeChanged(nsIDocument* aDocument, dom::Element* aElement,
                            PRInt32 aNameSpaceID, nsIAtom* aAttribute,
                            PRInt32 aModType)
{
  if (!mTree) {
    return;
  }

  if (!(mWhatToShow & nsIDOMNodeFilter::SHOW_ATTRIBUTE)) {
    return;
  }

  nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
  
  // get the dom attribute node, if there is any
  nsCOMPtr<nsIDOMNode> content(do_QueryInterface(aElement));
  nsCOMPtr<nsIDOMElement> el(do_QueryInterface(aElement));
  nsCOMPtr<nsIDOMAttr> domAttr;
  nsDependentAtomString attrStr(aAttribute);
  if (aNameSpaceID) {
    nsCOMPtr<nsINameSpaceManager> nsm =
      do_GetService(NS_NAMESPACEMANAGER_CONTRACTID);
    if (!nsm) {
      // we can't find out which attribute we want :(
      return;
    }
    nsString attrNS;
    nsresult rv = nsm->GetNameSpaceURI(aNameSpaceID, attrNS);
    if (NS_FAILED(rv)) {
      return;
    }
    (void)el->GetAttributeNodeNS(attrNS, attrStr, getter_AddRefs(domAttr));
  } else {
    (void)el->GetAttributeNode(attrStr, getter_AddRefs(domAttr));
  }

  if (aModType == nsIDOMMutationEvent::MODIFICATION) {
    // No fancy stuff here, just invalidate the changed row
    if (!domAttr) {
      return;
    }
    PRInt32 row = 0;
    NodeToRow(domAttr, &row);
    mTree->InvalidateRange(row, row);
  } else if (aModType == nsIDOMMutationEvent::ADDITION) {
    if (!domAttr) {
      return;
    }
    // get the number of attributes on this content node
    nsCOMPtr<nsIDOMNamedNodeMap> attrs;
    content->GetAttributes(getter_AddRefs(attrs));
    PRUint32 attrCount;
    attrs->GetLength(&attrCount);

    inDOMViewNode* contentNode = nsnull;
    PRInt32 contentRow;
    PRInt32 attrRow;
    if (mRootNode == content &&
        !(mWhatToShow & nsIDOMNodeFilter::SHOW_ELEMENT)) {
      // if this view has a root node but is not displaying it,
      // it is ok to act as if the changed attribute is on the root.
      attrRow = attrCount - 1;
    } else {
      if (NS_FAILED(NodeToRow(content, &contentRow))) {
        return;
      }
      RowToNode(contentRow, &contentNode);
      if (!contentNode->isOpen) {
        return;
      }
      attrRow = contentRow + attrCount;
    }

    inDOMViewNode* newNode = CreateNode(domAttr, contentNode);
    inDOMViewNode* insertNode = nsnull;
    RowToNode(attrRow, &insertNode);
    if (insertNode) {
      if (contentNode &&
          insertNode->level <= contentNode->level) {
        RowToNode(attrRow-1, &insertNode);
        InsertLinkAfter(newNode, insertNode);
      } else
        InsertLinkBefore(newNode, insertNode);
    }
    InsertNode(newNode, attrRow);
    mTree->RowCountChanged(attrRow, 1);
  } else if (aModType == nsIDOMMutationEvent::REMOVAL) {
    // At this point, the attribute is already gone from the DOM, but is still represented
    // in our mRows array.  Search through the content node's children for the corresponding
    // node and remove it.

    // get the row of the content node
    inDOMViewNode* contentNode = nsnull;
    PRInt32 contentRow;
    PRInt32 baseLevel;
    if (NS_SUCCEEDED(NodeToRow(content, &contentRow))) {
      RowToNode(contentRow, &contentNode);
      baseLevel = contentNode->level;
    } else {
      if (mRootNode == content) {
        contentRow = -1;
        baseLevel = -1;
      } else
        return;
    }

    // search for the attribute node that was removed
    inDOMViewNode* checkNode = nsnull;
    PRInt32 row = 0;
    for (row = contentRow+1; row < GetRowCount(); ++row) {
      checkNode = GetNodeAt(row);
      if (checkNode->level == baseLevel+1) {
        domAttr = do_QueryInterface(checkNode->node);
        if (domAttr) {
          nsAutoString attrName;
          domAttr->GetNodeName(attrName);
          if (attrName.Equals(attrStr)) {
            // we have found the row for the attribute that was removed
            RemoveLink(checkNode);
            RemoveNode(row);
            mTree->RowCountChanged(row, -1);
            break;
          }
        }
      }
      if (checkNode->level <= baseLevel)
        break;
    }

 }
}