Ejemplo n.º 1
0
void Database::RemoveGenre(QString genre)
{
    if(!open) return;
    QMutexLocker locker(&lock);
	TRN;
    RemoveAttribute(nGenre, genre);
}
Ejemplo n.º 2
0
void Database::RenameAttribute(const QString attr, QString oldval, QString newval)
{
    if(!open) return;
    QSqlQuery q("", db);
    q.prepare("select ID, art from "+attr+" where value = :newval");
    q.bindValue(":newval", newval);
    q.exec();
    if(q.next()) {
        bool ok;
        int newID = q.value(0).toInt(&ok);
        QString newArt = q.value(1).toString();
        if(ok) {
            int oldID = AddAttribute(attr, oldval);
            q.prepare("update Song set "+attr+" = "+QString::number(newID)+" where "+attr+" = "+QString::number(oldID));
            q.exec();
            q.prepare("select refs, rating, art from "+attr+" where ID = "+QString::number(oldID));
            q.exec();
            if(q.next()) {
                int oldref = q.value(0).toString().toInt();
                int oldrat = q.value(1).toString().toInt();
                QString oldArt = q.value(2).toString();
                RefAttribute(attr, newID, oldref, oldrat);
                if(!newArt.size() && oldArt.size())
                    ArtForAttribute(attr, newval, oldArt);
            }
            RemoveAttribute(attr, oldval);
        }
    } else {
        q.prepare("update "+attr+" set value = :newval where value = :oldval");
        q.bindValue(":oldval", oldval);
        q.bindValue(":newval", newval);
        q.exec();
    }
}
Ejemplo n.º 3
0
void Database::RemoveArtist(QString artist)
{
    if(!open) return;
    QMutexLocker locker(&lock);
	TRN;
    RemoveAttribute(nArtist, artist);
}
Ejemplo n.º 4
0
void
SipccSdpAttributeList::Clear()
{
  for (size_t i = 0; i < kNumAttributeTypes; ++i) {
    RemoveAttribute(static_cast<AttributeType>(i));
  }
}
Ejemplo n.º 5
0
// DeleteAttribute
status_t
Node::DeleteAttribute(Attribute *attribute)
{
	status_t error = RemoveAttribute(attribute);
	if (error == B_OK)
		delete attribute;
	return error;
}
Ejemplo n.º 6
0
// Sets the disabled status of the form control.
void ElementFormControl::SetDisabled(bool disable)
{
	if (disable)
	{
		SetAttribute("disabled", "");
		Blur();
	}
	else
		RemoveAttribute("disabled");
}
Ejemplo n.º 7
0
	void VertexBuffer::InnerDispose()
	{
		InvalidateVBO();

		vector<VertexAttribute> attribs = GetAttributes();
		for(unsigned int i = 0; i < attribs.size(); ++i)
			RemoveAttribute(attribs[i].name);

		SetNumVerts(0);
	}
Ejemplo n.º 8
0
void
SipccSdpAttributeList::SetAttribute(SdpAttribute* attr)
{
  if (!IsAllowedHere(attr->GetType())) {
    MOZ_ASSERT(false, "This type of attribute is not allowed here");
    return;
  }
  RemoveAttribute(attr->GetType());
  mAttributes[attr->GetType()] = attr;
}
// Enables or disables word-wrapping in the text area.
void ElementFormControlTextArea::SetWordWrap(bool word_wrap)
{
	if (word_wrap != GetWordWrap())
	{
		if (word_wrap)
			RemoveAttribute("wrap");
		else
			SetAttribute("wrap", "nowrap");
	}
}
Ejemplo n.º 10
0
int main(void)
{ Attributes attr;
  WORD result;
  
  printf("\f\t\tANSI Terminal Emulation Test\n");
  printf(  "\t\t============================\n\n\n");
  
  setvbuf(stdin, NULL, _IONBF, 0);
  if ((result = GetAttributes(Heliosno(stdout), &attr)) < 0)
   { printf("Failed to get stdout attributes : %lx. Exiting.\n", result);
     exit((int)result);
   }

  printf("Window size : %d rows, %d columns.\n\n", attr.Min, attr.Time);
  rows = attr.Min; cols = attr.Time;
  AddAttribute(&attr, ConsoleRawOutput);
  RemoveAttribute(&attr, ConsolePause);
  RemoveAttribute(&attr, ConsoleEcho);
  
  if ((result = SetAttributes(Heliosno(stdout), &attr)) < 0)
   { printf("Failed to set stdout attributes : %lx. Exiting.\n", result);
     exit((int)result);
   }
   
  if ((result = GetAttributes(Heliosno(stdin), &attr)) < 0)
   { printf("Failed to get stdin attributes : %lx. Exiting.\n", result);
     exit((int)result);
   }

  AddAttribute(&attr, ConsoleRawInput);
  RemoveAttribute(&attr, ConsolePause);
  RemoveAttribute(&attr, ConsoleEcho);
  
  if ((result = SetAttributes(Heliosno(stdin), &attr)) < 0)
   { printf("Failed to set stdin attributes : %lx. Exiting.\n", result);
     exit((int) result);
   }
   
  wait_for_user();
  main_menu();
  printf("\r\n\n\n");
}
Ejemplo n.º 11
0
	void VertexBuffer::AddAttribute(string name, VertexAttributeType type, int n_per_vertex)
	{
		RemoveAttribute(name);				// in case it already exists!

		VertexAttribute attribute = VertexAttribute(name, type, n_per_vertex);
		attributes[name] = attribute;

		int num_elements = n_per_vertex * allocated_size;

		if(type == Float)
			attribute_data[name].floats = num_elements > 0 ? new float[num_elements] : NULL;
	}
Ejemplo n.º 12
0
nsresult
nsDOMAttributeMap::GetNamedItemNSInternal(const nsAString& aNamespaceURI,
                                          const nsAString& aLocalName,
                                          nsIDOMNode** aReturn,
                                          bool aRemove)
{
  NS_ENSURE_ARG_POINTER(aReturn);
  *aReturn = nsnull;

  if (!mContent) {
    return NS_OK;
  }

  PRInt32 nameSpaceID = kNameSpaceID_None;

  if (!aNamespaceURI.IsEmpty()) {
    nameSpaceID =
      nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);

    if (nameSpaceID == kNameSpaceID_Unknown) {
      return NS_OK;
    }
  }

  PRUint32 i, count = mContent->GetAttrCount();
  for (i = 0; i < count; ++i) {
    const nsAttrName* name = mContent->GetAttrNameAt(i);
    PRInt32 attrNS = name->NamespaceID();
    nsIAtom* nameAtom = name->LocalName();

    if (nameSpaceID == attrNS &&
        nameAtom->Equals(aLocalName)) {
      nsCOMPtr<nsINodeInfo> ni;
      ni = mContent->NodeInfo()->NodeInfoManager()->
        GetNodeInfo(nameAtom, name->GetPrefix(), nameSpaceID,
                    nsIDOMNode::ATTRIBUTE_NODE);
      NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);

      if (aRemove) {
        return RemoveAttribute(ni, aReturn);
      }

      NS_ADDREF(*aReturn = GetAttribute(ni, true));

      return NS_OK;
    }
  }

  return NS_OK;
}
void CAttributeLinkTableDialog::OnRemoveButton() 
{
	int selected_item[MAX_CHOSEN_ATTRIBUTES_COUNT];
	int I=0;
	POSITION pos = m_CaptionsList.GetFirstSelectedItemPosition();
	while (pos != NULL ) 
	{
		selected_item[I] = m_CaptionsList.GetNextSelectedItem(pos);
		I++;
	}
	while (I>=0)
	{
		RemoveAttribute(selected_item[I]);
		I--;
	}
	
}
Ejemplo n.º 14
0
void Database::_RemoveAlbum(QString album, int artist)
{
    if(!artist)
        RemoveAttribute(nAlbum, album);
    else {
        if(!open) return;
        int id = _AddAlbum(album, artist);
        if(id > 0) {
            QSqlQuery q("", db);
            q.prepare("select File from Song where Album = "+QString::number(id));
            q.exec();
            while(q.next()) {
                _RemoveFile(q.value(0).toString());
            }
            QSqlQuery q1("delete from Album where ID = "+QString::number(id), db);
        }
    }
}
Ejemplo n.º 15
0
PUBLIC BYTE GetAKey()
{
   BYTE c;

#ifdef SUN
   if ( TermMode == ORG_MODE )
      {
	 CurMode.c_iflag &= ~ICRNL;
	 CurMode.c_lflag &= ~(ICANON | ECHO);
	 CurMode.c_cc[VTIME] = 0;
	 CurMode.c_cc[VMIN] = 1;
	 ioctl( 0, TCSETS, &CurMode );
	 TermMode = GET_MODE;
      }
   else
      if ( TermMode == POLL_MODE )
	 {
	 CurMode.c_cc[VTIME] = 0;
	 CurMode.c_cc[VMIN] = 1;
	 ioctl( 0, TCSETS, &CurMode );
	 TermMode = GET_MODE;
	 }
   (void)read(0, &c, 1);
#endif
#ifdef MSC
   c = getch();
#endif
#ifdef HELIOS
   if ( TermMode == ORG_MODE )
      {
	 RemoveAttribute(&CurAttributes,ConsoleEcho);
	 AddAttribute(&CurAttributes,ConsoleRawInput);
	 SetAttributes(InputStream,&CurAttributes);
	 TermMode = GET_MODE;
      }
   (void)Read(InputStream, &c, 1, -1);
#endif
#ifdef VMS
    (void)SYS$QIOW(0, InputChan, (IO$_READVBLK | IO$M_NOECHO | IO$M_NOFILTR ), &iosb_desc, 0, 0, &c, 1, 0, 0L, 0, 0);
#endif

   return(c);
}
Ejemplo n.º 16
0
nsresult
nsDOMAttributeMap::SetNamedItemInternal(nsIDOMNode *aNode,
                                        nsIDOMNode **aReturn,
                                        bool aWithNS)
{
  NS_ENSURE_ARG_POINTER(aNode);
  NS_ENSURE_ARG_POINTER(aReturn);

  nsresult rv = NS_OK;
  *aReturn = nsnull;
  nsCOMPtr<nsIDOMNode> tmpReturn;

  if (mContent) {
    // XXX should check same-origin between mContent and aNode however
    // nsContentUtils::CheckSameOrigin can't deal with attributenodes yet
    
    nsCOMPtr<nsIAttribute> iAttribute(do_QueryInterface(aNode));
    if (!iAttribute) {
      return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
    }

    nsDOMAttribute *attribute = static_cast<nsDOMAttribute*>(iAttribute.get());

    // Check that attribute is not owned by somebody else
    nsDOMAttributeMap* owner = iAttribute->GetMap();
    if (owner) {
      if (owner != this) {
        return NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR;
      }

      // setting a preexisting attribute is a no-op, just return the same
      // node.
      NS_ADDREF(*aReturn = aNode);
      
      return NS_OK;
    }

    if (!mContent->HasSameOwnerDoc(iAttribute)) {
      nsCOMPtr<nsIDOMDocument> domDoc =
        do_QueryInterface(mContent->OwnerDoc(), &rv);
      NS_ENSURE_SUCCESS(rv, rv);

      nsCOMPtr<nsIDOMNode> adoptedNode;
      rv = domDoc->AdoptNode(aNode, getter_AddRefs(adoptedNode));
      NS_ENSURE_SUCCESS(rv, rv);

      NS_ASSERTION(adoptedNode == aNode, "Uh, adopt node changed nodes?");
    }

    // Get nodeinfo and preexisting attribute (if it exists)
    nsAutoString name;
    nsCOMPtr<nsINodeInfo> ni;

    // SetNamedItemNS()
    if (aWithNS) {
      // Return existing attribute, if present
      ni = iAttribute->NodeInfo();

      if (mContent->HasAttr(ni->NamespaceID(), ni->NameAtom())) {
        rv = RemoveAttribute(ni, getter_AddRefs(tmpReturn));
        NS_ENSURE_SUCCESS(rv, rv);
      }
    }
    else { // SetNamedItem()
      attribute->GetName(name);

      // get node-info of old attribute
      ni = mContent->GetExistingAttrNameFromQName(name);
      if (ni) {
        rv = RemoveAttribute(ni, getter_AddRefs(tmpReturn));
        NS_ENSURE_SUCCESS(rv, rv);
      }
      else {
        if (mContent->IsInHTMLDocument() &&
            mContent->IsHTML()) {
          nsContentUtils::ASCIIToLower(name);
        }

        rv = mContent->NodeInfo()->NodeInfoManager()->
          GetNodeInfo(name, nsnull, kNameSpaceID_None,
                      nsIDOMNode::ATTRIBUTE_NODE, getter_AddRefs(ni));
        NS_ENSURE_SUCCESS(rv, rv);
        // value is already empty
      }
    }

    nsAutoString value;
    attribute->GetValue(value);

    // Add the new attribute to the attribute map before updating
    // its value in the element. @see bug 364413.
    nsAttrKey attrkey(ni->NamespaceID(), ni->NameAtom());
    mAttributeCache.Put(attrkey, attribute);
    iAttribute->SetMap(this);

    rv = mContent->SetAttr(ni->NamespaceID(), ni->NameAtom(),
                           ni->GetPrefixAtom(), value, true);
    if (NS_FAILED(rv)) {
      DropAttribute(ni->NamespaceID(), ni->NameAtom());
    }
  }

  tmpReturn.swap(*aReturn); // transfers ref.

  return rv;
}
Ejemplo n.º 17
0
PUBLIC VOID SpGetkey()
{
#if (BOARD_ID == UDP)
/* the udp version of iserver requires that the link is kept active,
   if it is inactive for X seconds the transputer will reset itself.
   Therefore this function polls the keyboard & sends an ACTIVE frame
   every X seconds to keep the transputer alive. */
   BUFFER_DECLARATIONS;
   BYTE c;
   int timeval1,timeval2,finished;

#ifdef VMS
   struct CHARACTERISTICS {
			     short  Count;
			     char   ch;
			     char   res1;
			     long   res2;
			   } Chars;
#endif

   DEBUG(( "SP.GETKEY {udp}" ));
   INIT_BUFFERS;           
   finished = FALSE;  
   time (&timeval1);

   while (!finished) {
     time (&timeval2);
     /* if 10 seconds elapsed, check link still active */
     if ((timeval2-timeval1) >= QUIETTIMEOUT) {
       if (TestLink(TheLink) != SUCCEEDED) {
	 finished = TRUE;
	 PUT_BYTE( SP_ERROR );
	 break;
       } else {
	 time (&timeval1);
       };
     };

#ifdef MSC
     if (kbhit()) {
       c = getch();
       PUT_BYTE( SP_SUCCESS );
       PUT_BYTE( c );    
       finished = TRUE;
     };
#endif

#ifdef SUN          
     if ( TermMode == ORG_MODE ) {
       CurMode.c_iflag &= ~ICRNL;
       CurMode.c_lflag &= ~(ICANON | ECHO);
       CurMode.c_cc[VTIME] = 1;
       CurMode.c_cc[VMIN] = 0;
       ioctl( 0, TCSETS, &CurMode );
       TermMode = POLL_MODE;
      } else {
	if ( TermMode == GET_MODE ) {
	  CurMode.c_cc[VTIME] = 1;
	  CurMode.c_cc[VMIN] = 0;
	  ioctl( 0, TCSETS, &CurMode );
	  TermMode = POLL_MODE;
	};
      };
      if (read(0, &c, 1) != 0) {
	PUT_BYTE( SP_SUCCESS );
	PUT_BYTE( c );   
	finished = TRUE;
      };
#endif

#ifdef VMS
     (void)SYS$QIOW( 0, InputChan, (IO$_SENSEMODE | IO$M_TYPEAHDCNT ), &iosb_desc, 0, 0, &Chars, sizeof(struct CHARACTERISTICS), 0, 0, 0, 0 ) ;
     if (Chars.Count > 0) {
       (void)SYS$QIOW( 0, InputChan, (IO$_READVBLK | IO$M_NOECHO | IO$M_NOFILTR ), &iosb_desc, 0, 0, &c, 1, 0, 0L, 0, 0 );
       PUT_BYTE( SP_SUCCESS );
       PUT_BYTE( c );   
       finished = TRUE;
     };
#endif

#ifdef HELIOS
    if ( TermMode == ORG_MODE ) {
      RemoveAttribute(&CurAttributes,ConsoleEcho);
      AddAttribute(&CurAttributes,ConsoleRawInput);
      AddAttribute(&CurAttributes,ConsoleBreakInterrupt);
      SetAttributes(InputStream,&CurAttributes);
      TermMode = POLL_MODE;
     }
     if ( Read( InputStream, &c, 1, OneSec/10 ) == 1 ) {
       PUT_BYTE( SP_SUCCESS );
       PUT_BYTE( c );  
       finished = TRUE;
     };
#endif 
   };   /* end of while */
 
   DEBUG(("key was %c",c));
   REPLY;
#else
   BUFFER_DECLARATIONS;
   BYTE c;

   DEBUG(( "SP.GETKEY {non-udp}" ));
   INIT_BUFFERS;

   c = GetAKey();

   DEBUG(("key was %c",c));
   PUT_BYTE( SP_SUCCESS );
   PUT_BYTE( c );  
   REPLY;
#endif
}
Ejemplo n.º 18
0
bool XMLElement::RemoveAttribute(const String& name)
{
    return RemoveAttribute(name.CString());
}
Ejemplo n.º 19
0
void EC_DynamicComponent::DeserializeCommon(std::vector<DeserializeData>& deserializedAttributes, AttributeChange::Type change)
{
    // Sort both lists in alphabetical order.
    AttributeVector oldAttributes = NonEmptyAttributes();
    std::stable_sort(oldAttributes.begin(), oldAttributes.end(), &CmpAttributeById);
    std::stable_sort(deserializedAttributes.begin(), deserializedAttributes.end(), &CmpAttributeDataById);

    std::vector<DeserializeData> addAttributes;
    std::vector<DeserializeData> remAttributes;
    AttributeVector::iterator iter1 = oldAttributes.begin();
    std::vector<DeserializeData>::iterator iter2 = deserializedAttributes.begin();

    // Check what attributes we need to add or remove from the dynamic component (done by comparing two list differences).
    while(iter1 != oldAttributes.end() || iter2 != deserializedAttributes.end())
    {
        // No point to continue the iteration if other list is empty. We can just push all new attributes into the dynamic component.
        if(iter1 == oldAttributes.end())
        {
            for(;iter2 != deserializedAttributes.end(); ++iter2)
                addAttributes.push_back(*iter2);
            break;
        }
        // Only old attributes are left and they can be removed from the dynamic component.
        else if(iter2 == deserializedAttributes.end())
        {
            for(;iter1 != oldAttributes.end(); ++iter1)
                remAttributes.push_back(DeserializeData((*iter1)->Id()));
            break;
        }

        // Attribute has already created and we only need to update it's value.
        if((*iter1)->Id() == (*iter2).id_)
        {
            //SetAttribute(QString::fromStdString(iter2->name_), QString::fromStdString(iter2->value_), change);
            for(AttributeVector::const_iterator attr_iter = attributes.begin(); attr_iter != attributes.end(); ++attr_iter)
                if((*attr_iter)->Id() == iter2->id_)
                    (*attr_iter)->FromString(iter2->value_.toStdString(), change);

            ++iter2;
            ++iter1;
        }
        // Found a new attribute that need to be created and added to the component.
        else if((*iter1)->Id() > (*iter2).id_)
        {
            addAttributes.push_back(*iter2);
            ++iter2;
        }
        // Couldn't find the attribute in a new list so it need to be removed from the component.
        else
        {
            remAttributes.push_back(DeserializeData((*iter1)->Id()));
            ++iter1;
        }
    }

    while(!addAttributes.empty())
    {
        DeserializeData attributeData = addAttributes.back();
        IAttribute *attribute = CreateAttribute(attributeData.type_, attributeData.id_);
        if (attribute)
            attribute->FromString(attributeData.value_.toStdString(), change);
        addAttributes.pop_back();
    }
    while(!remAttributes.empty())
    {
        DeserializeData attributeData = remAttributes.back();
        RemoveAttribute(attributeData.id_);
        remAttributes.pop_back();
    }
}
Ejemplo n.º 20
0
/* ----------------------------------------------------------------------
   TtaRemoveAttribute

   Removes an attribute from an element and release that attribute.
   Parameters:
   element: the element with which the attribute is associated.
   attribute: the attribute to be removed.
   document: the document to which the element belongs.
   ---------------------------------------------------------------------- */
void TtaRemoveAttribute (Element element, Attribute attribute, Document document)
{
  PtrAttribute        pAttr;
  ThotBool            found;
  ThotBool            mandatory;

  UserErrorCode = 0;
  if (element == NULL || attribute == NULL)
    TtaError (ERR_invalid_parameter);
  else if (((PtrAttribute) attribute)->AeAttrSSchema == NULL ||
           ((PtrElement) element)->ElStructSchema == NULL)
    {
      TtaError (ERR_invalid_parameter);
      // should never occur
      pAttr = (PtrAttribute) attribute;
      if (pAttr == ((PtrElement) element)->ElFirstAttr)
        {
          ((PtrElement) element)->ElFirstAttr = pAttr->AeNext;
          FreeAttribute (pAttr);
        }
    }
  else
    {
      pAttr = ((PtrElement) element)->ElFirstAttr;
      found = FALSE;
      while (pAttr != NULL && !found)
        {
          if (pAttr->AeAttrNum == ((PtrAttribute) attribute)->AeAttrNum &&
              !strcmp (pAttr->AeAttrSSchema->SsName,
                       ((PtrAttribute) attribute)->AeAttrSSchema->SsName))
            found = TRUE;
          if (!found)
            pAttr = pAttr->AeNext;
        }
      if (!found)
        TtaError (ERR_attribute_element_mismatch);
      else
        {
          (void) CanAssociateAttr ((PtrElement) element, pAttr, pAttr,
                                   &mandatory);
          if (!mandatory)
            /* We prohibit to suppress the attbibute language of an element */
            /* which is the root of an abstract tree */
            if (((PtrElement) element)->ElParent == NULL)
              if (pAttr->AeAttrNum == 1)
                mandatory = TRUE;
          if (mandatory &&
              (LoadedDocument[document - 1])->DocCheckingMode & STR_CHECK_MASK)
            /* The attribute is required for this kind of element */
            TtaError (ERR_mandatory_attribute);
          else
            {
              RemoveAttribute ((PtrElement) element, pAttr);
#ifndef NODISPLAY
              UndisplayInheritedAttributes ((PtrElement) element, pAttr,
                                            document, TRUE);
              UndisplayAttribute ((PtrElement) element, 
                                  (PtrAttribute) attribute, document);
#endif
              DeleteAttribute ((PtrElement) element, pAttr);
            }
        }
    }
}
Ejemplo n.º 21
0
/*----------------------------------------------------------------------
   CheckReferences        On vient de coller le sous-arbre de racine	
   pRoot dans le document pDoc. Verifie la coherence des elements	
   reference's et des references presents dans ce sous-arbre.      
  ----------------------------------------------------------------------*/
void CheckReferences (PtrElement pRoot, PtrDocument pDoc)
{
   PtrElement          pEl, pElRef, pSource;
   PtrReference        pRef, pNextRef;
   PtrAttribute        pAttr, pNextAttr;
   PtrElement          pElemRef;
   LabelString         oldLabel;
   PtrReference        pRefClipboard;
   PtrDocument         pDocRef;
   int                 l;
   ThotBool            delAttr;

   /* on se souvient du label de l'original */
   strncpy (oldLabel, pRoot->ElLabel, MAX_LABEL_LEN);
   if (ChangeLabel || pDoc != DocOfSavedElements)
     {
	/* on affecte un nouveau label a l'element */
	l = NewLabel (pDoc);
	ConvertIntToLabel (l, pRoot->ElLabel);
     }
   if (pRoot->ElReferredDescr != NULL)
      /* l'original de l'element colle' est reference' */
     {
       /* l'element original */
       pSource = pRoot->ElReferredDescr->ReReferredElem;
       pRoot->ElReferredDescr = NULL;
       /* l'element colle' n'est pas reference', il prend le label de son
	  element original (celui qui est dans le tampon Couper-Copier)
	  si la commande precedente etait Couper et s'il ne change pas de
	  document. Dans les autres cas (commande precedente Copier ou
	  changement de document), il prend un nouveau label. */

       /* alloue a l'element un descripteur d'element reference' */
       pRoot->ElReferredDescr = NewReferredElDescr (pDoc);
       pRoot->ElReferredDescr->ReReferredElem = pRoot;
       if (!ChangeLabel && pSource != NULL && pDoc == DocOfSavedElements)
	 /* l'element prend le meme label que l'element original */
	 strncpy (pRoot->ElLabel, pSource->ElLabel, MAX_LABEL_LEN);

       /* on cherche toutes les references a l'element original et on les */
       /* fait pointer sur l'element colle'. */
       /* cherche d'abord la premiere reference */
       pDocRef = DocOfSavedElements;
       pRef = NextReferenceToEl (pSource, DocOfSavedElements, NULL);
       while (pRef)
	  {
	     /* cherche la reference suivante a l'original avant de modifier */
	     /* la reference courante */
	     pNextRef = NextReferenceToEl (pSource, DocOfSavedElements, pRef);
	     /* traite la reference courante */
	     /* si elle est dans le tampon, on n'y touche pas : sa copie dans
	        le document ou on colle a deja ete traitee ou sera traitee
		dans cette boucle */
	     if (!IsASavedElement (pRef->RdElement))
		/* on fait pointer la reference sur l'element colle' */
	       {
		  if (IsWithinANewElement (pRef->RdElement))
		     pDocRef = pDoc;
		  if (pRef->RdAttribute)
		     pElemRef = NULL;
		  else
		     pElemRef = pRef->RdElement;
		  SetReference (pElemRef, pRef->RdAttribute, pRoot, pDocRef,
				pDoc, FALSE, FALSE);
	       }
	     pRef = pNextRef;	/* passe a la reference suivante */
	     pDocRef = DocOfSavedElements;
	  }
     }
   /* Traite les attributs de type reference porte's par l'element */
   pAttr = pRoot->ElFirstAttr;
   while (pAttr != NULL)
      /* examine tous les attributs de l'element */
     {
     	pNextAttr = pAttr->AeNext;
	if (pAttr->AeAttrType == AtReferenceAttr)
	   /* c'est un attribut de type reference */
	   /* cherche l'element reference', pElRef */
	  {
	     pElRef = NULL;
	     delAttr = FALSE;
	     if (pAttr->AeAttrReference != NULL)
		 if (pAttr->AeAttrReference->RdReferred != NULL)
		   {
		     pElRef = pAttr->AeAttrReference->RdReferred->ReReferredElem;
		     /* si l'element reference' est aussi colle', */
		     /* on ne fait rien: ce cas est traite' plus haut */
		     if (pElRef != NULL)
		       if (!IsASavedElement (pElRef))
			 if (!IsWithinANewElement (pElRef))
			   {
			     if (DocOfSavedElements != pDoc)
			       /* reference et objet reference' sont */
			       /* dans des documents differents, on */
			       /* supprime l'attribut, sauf dans le */
			       /* cas particulier des tableaux. */
			       {
				 RemoveAttribute (pRoot, pAttr);
				 delAttr = TRUE;
			       }
			   }
		     if (delAttr)
			DeleteAttribute (pRoot, pAttr);
		   }  
	  }
	pAttr = pNextAttr;
     }
   /* Lorsqu'on fait un copier/coller d'un element LtReference, */
   /* il faut chainer les references entre element ancien et */
   /* element nouveau : la reference de la copie qui est dans */
   /* le tampon est dechainee entre les deux elements. */
   /* pRoot est le nouvel element cree : son descripteur */
   /* a ete chaine devant le descripteur de la copie qui est */
   /* dans le tampon, qui est devant celui de l'element copie */
   if (pRoot->ElTerminal && pRoot->ElLeafType == LtReference)
     {
	/* c'est un element reference */
	pRef = pRoot->ElReference;
	if (pRef != NULL)	/*  on cherche le suivant */
	  {
	     pRefClipboard = pRef->RdNext;
	     if (pRefClipboard != NULL
		 && IsASavedElement (pRefClipboard->RdElement))
		/* il faut retirer pRefClipboard du chainage */
	       {
		  pRef->RdNext = pRefClipboard->RdNext;
		  if (pRefClipboard->RdNext != NULL)
		     pRefClipboard->RdNext->RdPrevious = pRef;
	       }
	  }
     }

   if (!pRoot->ElTerminal && pRoot->ElSource == NULL)
      /* ce n'est ni une inclusion ni un terminal, on traite tous les fils */
     {
	pEl = pRoot->ElFirstChild;
	while (pEl != NULL)
	  {
	     CheckReferences (pEl, pDoc);
	     pEl = pEl->ElNext;
	  }
     }
}
Ejemplo n.º 22
0
void
HTMLEditor::SetFinalSize(int32_t aX,
                         int32_t aY)
{
  if (!mResizedObject) {
    // paranoia
    return;
  }

  if (mActivatedHandle) {
    mActivatedHandle->UnsetAttr(kNameSpaceID_None, nsGkAtoms::_moz_activated, true);
    mActivatedHandle = nullptr;
  }

  // we have now to set the new width and height of the resized object
  // we don't set the x and y position because we don't control that in
  // a normal HTML layout
  int32_t left   = GetNewResizingX(aX, aY);
  int32_t top    = GetNewResizingY(aX, aY);
  int32_t width  = GetNewResizingWidth(aX, aY);
  int32_t height = GetNewResizingHeight(aX, aY);
  bool setWidth  = !mResizedObjectIsAbsolutelyPositioned || (width != mResizedObjectWidth);
  bool setHeight = !mResizedObjectIsAbsolutelyPositioned || (height != mResizedObjectHeight);

  int32_t x, y;
  x = left - ((mResizedObjectIsAbsolutelyPositioned) ? mResizedObjectBorderLeft+mResizedObjectMarginLeft : 0);
  y = top - ((mResizedObjectIsAbsolutelyPositioned) ? mResizedObjectBorderTop+mResizedObjectMarginTop : 0);

  // we want one transaction only from a user's point of view
  AutoEditBatch batchIt(this);

  if (mResizedObjectIsAbsolutelyPositioned) {
    if (setHeight) {
      mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::top, y);
    }
    if (setWidth) {
      mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::left, x);
    }
  }
  if (IsCSSEnabled() || mResizedObjectIsAbsolutelyPositioned) {
    if (setWidth && mResizedObject->HasAttr(kNameSpaceID_None, nsGkAtoms::width)) {
      RemoveAttribute(mResizedObject, nsGkAtoms::width);
    }

    if (setHeight && mResizedObject->HasAttr(kNameSpaceID_None,
                                             nsGkAtoms::height)) {
      RemoveAttribute(mResizedObject, nsGkAtoms::height);
    }

    if (setWidth) {
      mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::width,
                                          width);
    }
    if (setHeight) {
      mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::height,
                                          height);
    }
  } else {
    // we use HTML size and remove all equivalent CSS properties

    // we set the CSS width and height to remove it later,
    // triggering an immediate reflow; otherwise, we have problems
    // with asynchronous reflow
    if (setWidth) {
      mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::width,
                                          width);
    }
    if (setHeight) {
      mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::height,
                                          height);
    }
    if (setWidth) {
      nsAutoString w;
      w.AppendInt(width);
      SetAttribute(mResizedObject, nsGkAtoms::width, w);
    }
    if (setHeight) {
      nsAutoString h;
      h.AppendInt(height);
      SetAttribute(mResizedObject, nsGkAtoms::height, h);
    }

    if (setWidth) {
      mCSSEditUtils->RemoveCSSProperty(*mResizedObject, *nsGkAtoms::width,
                                       EmptyString());
    }
    if (setHeight) {
      mCSSEditUtils->RemoveCSSProperty(*mResizedObject, *nsGkAtoms::height,
                                       EmptyString());
    }
  }

  // keep track of that size
  mResizedObjectWidth  = width;
  mResizedObjectHeight = height;

  RefreshResizers();
}
Ejemplo n.º 23
0
void
nsHTMLEditor::SetFinalSize(PRInt32 aX, PRInt32 aY)
{
  if (!mResizedObject) {
    // paranoia
    return;
  }

  if (mActivatedHandle) {
    mActivatedHandle->RemoveAttribute(NS_LITERAL_STRING("_moz_activated"));
    mActivatedHandle = nsnull;
  }

  // we have now to set the new width and height of the resized object
  // we don't set the x and y position because we don't control that in
  // a normal HTML layout
  PRInt32 left   = GetNewResizingX(aX, aY);
  PRInt32 top    = GetNewResizingY(aX, aY);
  PRInt32 width  = GetNewResizingWidth(aX, aY);
  PRInt32 height = GetNewResizingHeight(aX, aY);
  PRBool setWidth  = !mResizedObjectIsAbsolutelyPositioned || (width != mResizedObjectWidth);
  PRBool setHeight = !mResizedObjectIsAbsolutelyPositioned || (height != mResizedObjectHeight);
  
  PRInt32 x, y;
  x = left - ((mResizedObjectIsAbsolutelyPositioned) ? mResizedObjectBorderLeft+mResizedObjectMarginLeft : 0);
  y = top - ((mResizedObjectIsAbsolutelyPositioned) ? mResizedObjectBorderTop+mResizedObjectMarginTop : 0);

  // we need to know if we're in a CSS-enabled editor or not
  PRBool useCSS;
  GetIsCSSEnabled(&useCSS);

  // we want one transaction only from a user's point of view
  nsAutoEditBatch batchIt(this);

  NS_NAMED_LITERAL_STRING(widthStr,  "width");
  NS_NAMED_LITERAL_STRING(heightStr, "height");
  
  PRBool hasAttr = PR_FALSE;
  if (mResizedObjectIsAbsolutelyPositioned) {
    if (setHeight)
      mHTMLCSSUtils->SetCSSPropertyPixels(mResizedObject,
                                          nsEditProperty::cssTop,
                                          y,
                                          PR_FALSE);
    if (setWidth)
      mHTMLCSSUtils->SetCSSPropertyPixels(mResizedObject,
                                          nsEditProperty::cssLeft,
                                          x,
                                          PR_FALSE);
  }
  if (useCSS || mResizedObjectIsAbsolutelyPositioned) {
    if (setWidth && NS_SUCCEEDED(mResizedObject->HasAttribute(widthStr, &hasAttr)) && hasAttr)
      RemoveAttribute(mResizedObject, widthStr);

    hasAttr = PR_FALSE;
    if (setHeight && NS_SUCCEEDED(mResizedObject->HasAttribute(heightStr, &hasAttr)) && hasAttr)
      RemoveAttribute(mResizedObject, heightStr);

    if (setWidth)
      mHTMLCSSUtils->SetCSSPropertyPixels(mResizedObject,
                                          nsEditProperty::cssWidth,
                                          width,
                                          PR_FALSE);
    if (setHeight)
      mHTMLCSSUtils->SetCSSPropertyPixels(mResizedObject,
                                    nsEditProperty::cssHeight,
                                    height,
                                    PR_FALSE);
  }
  else {
    // we use HTML size and remove all equivalent CSS properties

    // we set the CSS width and height to remove it later,
    // triggering an immediate reflow; otherwise, we have problems
    // with asynchronous reflow
    if (setWidth)
      mHTMLCSSUtils->SetCSSPropertyPixels(mResizedObject,
                                          nsEditProperty::cssWidth,
                                          width,
                                          PR_FALSE);
    if (setHeight)
      mHTMLCSSUtils->SetCSSPropertyPixels(mResizedObject,
                                          nsEditProperty::cssHeight,
                                          height,
                                          PR_FALSE);

    if (setWidth) {
      nsAutoString w;
      w.AppendInt(width);
      SetAttribute(mResizedObject, widthStr, w);
    }
    if (setHeight) {
      nsAutoString h;
      h.AppendInt(height);
      SetAttribute(mResizedObject, heightStr, h);
    }

    if (setWidth)
      mHTMLCSSUtils->RemoveCSSProperty(mResizedObject,
                                       nsEditProperty::cssWidth,
                                       EmptyString(),
                                       PR_FALSE);
    if (setHeight)
      mHTMLCSSUtils->RemoveCSSProperty(mResizedObject,
                                      nsEditProperty::cssHeight,
                                      EmptyString(),
                                      PR_FALSE);
  }
  // finally notify the listeners if any
  PRInt32 listenersCount = objectResizeEventListeners.Count();
  if (listenersCount) {
    nsCOMPtr<nsIHTMLObjectResizeListener> listener;
    PRInt32 index;
    for (index = 0; index < listenersCount; index++) {
      listener = objectResizeEventListeners[index];
      listener->OnEndResizing(mResizedObject,
                              mResizedObjectWidth, mResizedObjectHeight,
                              width, height);
    }
  }

  // keep track of that size
  mResizedObjectWidth  = width;
  mResizedObjectHeight = height;

  RefreshResizers();
}
Ejemplo n.º 24
0
int main(void)
{ Object *root_obj = Locate(NULL, "/");
  Object *mouse_obj;
  Object *keyboard_obj;
  Attributes attr;
  WORD result;
  
  setvbuf(stdin, NULL, _IONBF, 0);
  if ((result = GetAttributes(Heliosno(stdin), &attr)) < 0)
   { printf("Failed to get stdin attributes : %x. Exiting.\n", result);
     exit(result);
   }

  AddAttribute(&attr, ConsoleRawOutput);
  AddAttribute(&attr, ConsoleRawInput);
  RemoveAttribute(&attr, ConsolePause);
  RemoveAttribute(&attr, ConsoleEcho);
  
  if ((result = SetAttributes(Heliosno(stdin), &attr)) < 0)
   { printf("Failed to set stdin attributes : %x. Exiting.\n", result);
     exit(result);
   }
    
  printf("\f\t\tX Support Test\r\n");
  printf(  "\t\t==============\r\n\n\n");

  mouse_obj = Locate(root_obj, "/mouse");
  if (mouse_obj eq Null(Object))
    { printf("Failed to find a mouse device : %x.\r\n", Result2(root_obj));
      exit(Result2(root_obj));
    }
    
  printf("Found a mouse server : %s.\r\n", mouse_obj->Name);
  mouse_stream = Open(mouse_obj, NULL, O_ReadOnly);
  if (mouse_stream eq Null(Stream))
   { printf("Failed to open stream : %x.\n", Result2(mouse_obj));
     exit(Result2(mouse_obj));
   }
  Close(mouse_obj);
  
  keyboard_obj = Locate(root_obj, "/keyboard");
  if (keyboard_obj eq Null(Object))
    { printf("Failed to find a keyboard device : %x.\r\n", Result2(root_obj));
      exit(Result2(root_obj));
    }
    
  printf("Found a keyboard server : %s.\r\n", keyboard_obj->Name);
  keyboard_stream = Open(keyboard_obj, NULL, O_ReadOnly);
  if (keyboard_stream eq Null(Stream))
   { printf("Failed to open stream : %x.\n", Result2(keyboard_obj));
     exit(Result2(keyboard_obj));
   }
  Close(keyboard_obj);

  Close(root_obj);   
  wait_for_user();
  main_menu();
  Close(mouse_stream);
  Close(keyboard_stream);
  printf("\r\n\n\n");
  return(0);
}
Ejemplo n.º 25
0
void
UsdMayaAdaptor::SchemaAdaptor::RemoveAttribute(const TfToken& attrName)
{
    MDGModifier modifier;
    RemoveAttribute(attrName, modifier);
}
Ejemplo n.º 26
0
PUBLIC VOID SpPollkey()
{
   BUFFER_DECLARATIONS;
   char c;
#ifdef VMS
   struct CHARACTERISTICS {
			     short  Count;
			     char   ch;
			     char   res1;
			     long   res2;
			   } Chars;
#endif

   DEBUG(( "SP.POLLKEY" ));
   INIT_BUFFERS;

#ifdef MSC
   if ( kbhit() )
      {
	 c = getch();
	 PUT_BYTE( SP_SUCCESS );
	 PUT_BYTE( c );  
      }
   else
      {
	 PUT_BYTE( SP_ERROR );
      }
#endif
#ifdef SUN
   if ( TermMode == ORG_MODE )
      {
	 CurMode.c_iflag &= ~ICRNL;
	 CurMode.c_lflag &= ~(ICANON | ECHO);
	 CurMode.c_cc[VTIME] = 1;
	 CurMode.c_cc[VMIN] = 0;
	 ioctl( 0, TCSETS, &CurMode );
	 TermMode = POLL_MODE;
      }
   else
      if ( TermMode == GET_MODE )
	 {
	    CurMode.c_cc[VTIME] = 1;
	    CurMode.c_cc[VMIN] = 0;
	    ioctl( 0, TCSETS, &CurMode );
	    TermMode = POLL_MODE;
	 }

   if ( read(0, &c, 1) == 0 )
      {
	 PUT_BYTE( SP_ERROR );
      }
   else
      {
	 PUT_BYTE( SP_SUCCESS );
	 PUT_BYTE( c );  
      }
#endif

#ifdef VMS
   (void)SYS$QIOW( 0, InputChan, (IO$_SENSEMODE | IO$M_TYPEAHDCNT ), &iosb_desc, 0, 0, &Chars, sizeof(struct CHARACTERISTICS), 0, 0, 0, 0 ) ;
   if ( Chars.Count > 0 )
      {
	 (void)SYS$QIOW( 0, InputChan, (IO$_READVBLK | IO$M_NOECHO | IO$M_NOFILTR ), &iosb_desc, 0, 0, &c, 1, 0, 0L, 0, 0 );
	 PUT_BYTE( SP_SUCCESS );
	 PUT_BYTE( c );  
      }
   else
      {
	 PUT_BYTE( SP_ERROR );
      }
#endif
#ifdef HELIOS
   if ( TermMode == ORG_MODE )
      {
	 RemoveAttribute(&CurAttributes,ConsoleEcho);
	 AddAttribute(&CurAttributes,ConsoleRawInput);
	 AddAttribute(&CurAttributes,ConsoleBreakInterrupt);
	 SetAttributes(InputStream,&CurAttributes);
	 TermMode = POLL_MODE;
      }
   if ( Read( InputStream, &c, 1, OneSec/10 ) == 1 )
      {
	 PUT_BYTE( SP_SUCCESS );
	 PUT_BYTE( c );  
      }
   else
      {
	 PUT_BYTE( SP_ERROR );
      }
#endif
   REPLY;

}
Ejemplo n.º 27
0
bool XMLElement::RemoveAttribute(const ea::string& name)
{
    return RemoveAttribute(name.c_str());
}
Ejemplo n.º 28
0
// ClearAttrDir
void
ShareAttrDir::ClearAttrDir()
{
	while (Attribute* attribute = GetFirstAttribute())
		RemoveAttribute(attribute);
}