Exemple #1
0
wxTreeItemId CLocalTreeView::GetNearestParent(wxString& localDir)
{
	const wxString separator = wxFileName::GetPathSeparator();
#ifdef __WXMSW__
	int pos = localDir.Find(separator);
	if (pos == -1)
		return wxTreeItemId();

	wxString drive = localDir.Left(pos);
	localDir = localDir.Mid(pos + 1);

	wxTreeItemIdValue value;
	wxTreeItemId root = GetFirstChild(m_drives, value);
	while (root)
	{
		if (!GetItemText(root).Left(drive.Length()).CmpNoCase(drive))
			break;

		root = GetNextSibling(root);
	}
	if (!root)
	{
		if (drive[1] == ':')
			return AddDrive(drive[0]);
		return wxTreeItemId();
	}
#else
		if (localDir[0] == '/')
			localDir = localDir.Mid(1);
		wxTreeItemId root = GetRootItem();
#endif

	while (localDir != _T(""))
	{
		wxString subDir;
		int pos = localDir.Find(separator);
		if (pos == -1)
			subDir = localDir;
		else
			subDir = localDir.Left(pos);

		wxTreeItemId child = GetSubdir(root, subDir);
		if (!child)
			return root;

		if (!pos)
			return child;

		root = child;
		localDir = localDir.Mid(pos + 1);
	}

	return root;
}
Exemple #2
0
void CGuiWidget::ResetAllAnimUpdateState()
{
    if (xb0_animController)
        xb0_animController->ResetListUpdateState();
    CGuiWidget* child = static_cast<CGuiWidget*>(GetChildObject());
    if (child)
        child->ResetAllAnimUpdateState();
    CGuiWidget* nextSib = static_cast<CGuiWidget*>(GetNextSibling());
    if (nextSib)
        nextSib->ResetAllAnimUpdateState();
}
Exemple #3
0
void CGuiWidget::SetAnimUpdateState(EGuiAnimBehListID id, bool state)
{
    if (xb0_animController)
        xb0_animController->SetListUpdateState(id, state);
    CGuiWidget* child = static_cast<CGuiWidget*>(GetChildObject());
    if (child)
        child->SetAnimUpdateState(id, state);
    CGuiWidget* nextSib = static_cast<CGuiWidget*>(GetNextSibling());
    if (nextSib)
        nextSib->SetAnimUpdateState(id, state);
}
Exemple #4
0
void CGuiWidget::InitializeAnimControllers(EGuiAnimBehListID id, float fval, bool flag,
                                           EGuiAnimInitMode initMode)
{
    if (xb0_animController)
        xb0_animController->InitTransform(this, id, fval, flag, initMode);
    CGuiWidget* child = static_cast<CGuiWidget*>(GetChildObject());
    if (child)
        child->InitializeAnimControllers(id, fval, flag, initMode);
    CGuiWidget* nextSib = static_cast<CGuiWidget*>(GetNextSibling());
    if (nextSib)
        nextSib->InitializeAnimControllers(id, fval, flag, initMode);
}
Exemple #5
0
void CGuiWidget::RecalculateAllRGBA()
{
    CGuiWidget* parent = static_cast<CGuiWidget*>(GetParent());
    if (parent)
        ModifyRGBA(parent);
    CGuiWidget* nextSib = static_cast<CGuiWidget*>(GetNextSibling());
    if (nextSib)
        nextSib->RecalculateAllRGBA();
    CGuiWidget* child = static_cast<CGuiWidget*>(GetChildObject());
    if (child)
        child->RecalculateAllRGBA();
}
nsTableCellFrame*  
nsTableCellFrame::GetNextCell() const
{
  nsIFrame* childFrame = GetNextSibling();
  while (childFrame) {
    if (IS_TABLE_CELL(childFrame->GetType())) {
      return (nsTableCellFrame*)childFrame;
    }
    childFrame = childFrame->GetNextSibling();
  }
  return nsnull;
}
nsTableColFrame*  
nsTableColFrame::GetNextCol() const
{
  nsIFrame* childFrame = GetNextSibling();
  while (childFrame) {
    if (nsGkAtoms::tableColFrame == childFrame->GetType()) {
      return (nsTableColFrame*)childFrame;
    }
    childFrame = childFrame->GetNextSibling();
  }
  return nullptr;
}
NS_IMETHODIMP
CompositionTransaction::DoTransaction() {
  if (NS_WARN_IF(!mEditorBase)) {
    return NS_ERROR_NOT_INITIALIZED;
  }

  // Fail before making any changes if there's no selection controller
  nsCOMPtr<nsISelectionController> selCon;
  mEditorBase->GetSelectionController(getter_AddRefs(selCon));
  NS_ENSURE_TRUE(selCon, NS_ERROR_NOT_INITIALIZED);

  // Advance caret: This requires the presentation shell to get the selection.
  if (mReplaceLength == 0) {
    ErrorResult rv;
    mTextNode->InsertData(mOffset, mStringToInsert, rv);
    if (NS_WARN_IF(rv.Failed())) {
      return rv.StealNSResult();
    }
    mEditorBase->RangeUpdaterRef().SelAdjInsertText(*mTextNode, mOffset,
                                                    mStringToInsert);
  } else {
    uint32_t replaceableLength = mTextNode->TextLength() - mOffset;
    ErrorResult rv;
    mTextNode->ReplaceData(mOffset, mReplaceLength, mStringToInsert, rv);
    if (NS_WARN_IF(rv.Failed())) {
      return rv.StealNSResult();
    }
    mEditorBase->RangeUpdaterRef().SelAdjDeleteText(mTextNode, mOffset,
                                                    mReplaceLength);
    mEditorBase->RangeUpdaterRef().SelAdjInsertText(*mTextNode, mOffset,
                                                    mStringToInsert);

    // If IME text node is multiple node, ReplaceData doesn't remove all IME
    // text.  So we need remove remained text into other text node.
    if (replaceableLength < mReplaceLength) {
      int32_t remainLength = mReplaceLength - replaceableLength;
      nsCOMPtr<nsINode> node = mTextNode->GetNextSibling();
      while (node && node->IsText() && remainLength > 0) {
        Text* text = static_cast<Text*>(node.get());
        uint32_t textLength = text->TextLength();
        text->DeleteData(0, remainLength, IgnoreErrors());
        mEditorBase->RangeUpdaterRef().SelAdjDeleteText(text, 0, remainLength);
        remainLength -= textLength;
        node = node->GetNextSibling();
      }
    }
  }

  nsresult rv = SetSelectionForRanges();
  NS_ENSURE_SUCCESS(rv, rv);

  return NS_OK;
}
Exemple #9
0
void CGuiWidget::RegisterEventHandler()
{
    bool flag = DoRegisterEventHandler();
    if (!flag)
    {
        CGuiWidget* ch = static_cast<CGuiWidget*>(GetChildObject());
        if (ch)
            ch->RegisterEventHandler();
    }
    CGuiWidget* sib = static_cast<CGuiWidget*>(GetNextSibling());
    if (sib && flag)
        sib->RegisterEventHandler();
}
Exemple #10
0
void WatchWindow::UpdateItems()
{

    wxTreeItemIdValue cookie;
    wxTreeItemId item = GetFirstChild(m_root, cookie);

    while (item.IsOk())
    {
        UpdateItem(item);        
        item = GetNextSibling(item);
    }

}
nsIFrame*
nsFrameIterator::GetFirstChild(nsIFrame* aFrame)
{
  nsIFrame* result = GetFirstChildInner(aFrame);
  if (mLockScroll && result && result->GetType() == nsGkAtoms::scrollFrame)
    return nsnull;
  if (result && mFollowOOFs) {
    result = nsPlaceholderFrame::GetRealFrameFor(result);
    
    if (IsPopupFrame(result))
      result = GetNextSibling(result);
  }
  return result;
}
Exemple #12
0
void
Layer::Dump(FILE* aFile, const char* aPrefix)
{
  DumpSelf(aFile, aPrefix);

  if (Layer* kid = GetFirstChild()) {
    nsCAutoString pfx(aPrefix);
    pfx += "  ";
    kid->Dump(aFile, pfx.get());
  }

  if (Layer* next = GetNextSibling())
    next->Dump(aFile, aPrefix);
}
Exemple #13
0
void
wxTreeListCtrl::CheckItemRecursively(wxTreeListItem item, wxCheckBoxState state)
{
    wxCHECK_RET( m_model, "Must create first" );

    m_model->CheckItem(item, state);

    for ( wxTreeListItem child = GetFirstChild(item);
          child.IsOk();
          child = GetNextSibling(child) )
    {
        CheckItemRecursively(child, state);
    }
}
Exemple #14
0
void
Layer::Dump(FILE* aFile, const char* aPrefix, bool aDumpHtml)
{
  if (aDumpHtml) {
    fprintf_stderr(aFile, "<li><a id=\"%p\" ", this);
#ifdef MOZ_DUMP_PAINTING
    if (GetType() == TYPE_CONTAINER || GetType() == TYPE_THEBES) {
      WriteSnapshotLinkToDumpFile(this, aFile);
    }
#endif
    fprintf_stderr(aFile, ">");
  }
  DumpSelf(aFile, aPrefix);

#ifdef MOZ_DUMP_PAINTING
  if (gfxUtils::sDumpPainting && AsLayerComposite() && AsLayerComposite()->GetCompositableHost()) {
    AsLayerComposite()->GetCompositableHost()->Dump(aFile, aPrefix, aDumpHtml);
  }
#endif

  if (aDumpHtml) {
    fprintf_stderr(aFile, "</a>");
  }

  if (Layer* mask = GetMaskLayer()) {
    fprintf_stderr(aFile, "%s  Mask layer:\n", aPrefix);
    nsAutoCString pfx(aPrefix);
    pfx += "    ";
    mask->Dump(aFile, pfx.get(), aDumpHtml);
  }

  if (Layer* kid = GetFirstChild()) {
    nsAutoCString pfx(aPrefix);
    pfx += "  ";
    if (aDumpHtml) {
      fprintf_stderr(aFile, "<ul>");
    }
    kid->Dump(aFile, pfx.get(), aDumpHtml);
    if (aDumpHtml) {
      fprintf_stderr(aFile, "</ul>");
    }
  }

  if (aDumpHtml) {
    fprintf_stderr(aFile, "</li>");
  }
  if (Layer* next = GetNextSibling())
    next->Dump(aFile, aPrefix, aDumpHtml);
}
Exemple #15
0
void CGuiWidget::IsAllAnimsDone(EGuiAnimBehListID id, bool& isDone)
{
    if (xb0_animController)
    {
        if (!isDone)
            return;
        xb0_animController->IsAnimsDone(id, isDone);
    }
    CGuiWidget* child = static_cast<CGuiWidget*>(GetChildObject());
    if (child)
        child->IsAllAnimsDone(id, isDone);
    CGuiWidget* nextSib = static_cast<CGuiWidget*>(GetNextSibling());
    if (nextSib)
        nextSib->IsAllAnimsDone(id, isDone);
}
Exemple #16
0
void CGuiWidget::BroadcastMessage(int id, CGuiControllerInfo* info)
{
    CGuiFuncParm a((intptr_t(x7c_selfId)));
    CGuiFuncParm b((intptr_t(id)));
    CGuiFunctionDef def(0, false, a, b);
    MAF_SendMessage(&def, info);

    CGuiWidget* ch = static_cast<CGuiWidget*>(GetChildObject());
    if (ch)
        ch->BroadcastMessage(id, info);

    CGuiWidget* sib = static_cast<CGuiWidget*>(GetNextSibling());
    if (sib)
        sib->BroadcastMessage(id, info);
}
Exemple #17
0
void CGuiWidget::GetBranchAnimLen(EGuiAnimBehListID id, float& len)
{
    if (xb0_animController)
    {
        float aLen = xb0_animController->GetAnimSetLength(id);
        if (aLen > len)
            len = aLen;
    }
    CGuiWidget* child = static_cast<CGuiWidget*>(GetChildObject());
    if (child)
        child->GetBranchAnimLen(id, len);
    CGuiWidget* nextSib = static_cast<CGuiWidget*>(GetNextSibling());
    if (nextSib)
        nextSib->GetBranchAnimLen(id, len);
}
wxTreeItemId CocaSystemTree::findId( const void* nodePointer, wxTreeItemId id ) const
{
    if ( !id.IsOk() ) { return id; }

    if ( nodePointer == getNode( id ) ) { return id; }

    wxTreeItemIdValue cookie = 0;
    id = GetFirstChild( id, cookie );
    for ( ; id.IsOk(); id = GetNextSibling( id ) )
    {
        wxTreeItemId foundId = findId( nodePointer, id );
        if ( foundId.IsOk() ) { return foundId; }
    }

    return id; // is invalid
}
Exemple #19
0
bool
wxTreeListCtrl::AreAllChildrenInState(wxTreeListItem item,
                                      wxCheckBoxState state) const
{
    wxCHECK_MSG( item.IsOk(), false, "Invalid item" );

    for ( wxTreeListItem child = GetFirstChild(item);
          child.IsOk();
          child = GetNextSibling(child) )
    {
        if ( GetCheckedState(child) != state )
            return false;
    }

    return true;
}
nsSVGTSpanFrame::GetNextGlyphFrame()
{
  nsIFrame* sibling = GetNextSibling();
  while (sibling) {
    nsISVGGlyphFragmentNode *node = do_QueryFrame(sibling);
    if (node)
      return node->GetFirstGlyphFrame();
    sibling = sibling->GetNextSibling();
  }

  // no more siblings. go back up the tree.
  
  NS_ASSERTION(GetParent(), "null parent");
  nsISVGGlyphFragmentNode *node = do_QueryFrame(GetParent());
  return node ? node->GetNextGlyphFrame() : nullptr;
}
PRBool nsSOAPUtils::HasChildElements(nsIDOMElement * aElement)
{
  nsCOMPtr<nsIDOMNode> child;

  aElement->GetFirstChild(getter_AddRefs(child));
  while (child) {
    PRUint16 type;
    child->GetNodeType(&type);
    if (nsIDOMNode::ELEMENT_NODE == type) {
      return PR_TRUE;
    }
    nsCOMPtr<nsIDOMNode> temp = child;
    GetNextSibling(temp, getter_AddRefs(child));
  }

  return PR_FALSE;
}
nsIFrame*
nsFrameIterator::GetNextSibling(nsIFrame* aFrame)
{
  nsIFrame* result = nsnull;
  if (mFollowOOFs)
    aFrame = GetPlaceholderFrame(aFrame);
  if (aFrame) {
    result = GetNextSiblingInner(aFrame);
    if (result && mFollowOOFs)
      result = nsPlaceholderFrame::GetRealFrameFor(result);
  }

  if (mFollowOOFs && IsPopupFrame(result))
    result = GetNextSibling(result);

  return result;
}
Exemple #23
0
wxTreeItemId CLocalTreeView::GetSubdir(wxTreeItemId parent, const wxString& subDir)
{
	wxTreeItemIdValue value;
	wxTreeItemId child = GetFirstChild(parent, value);
	while (child)
	{
#ifdef __WXMSW__
		if (!GetItemText(child).CmpNoCase(subDir))
#else
		if (GetItemText(child) == subDir)
#endif
			return child;

		child = GetNextSibling(child);
	}
	return wxTreeItemId();
}
Exemple #24
0
void
Layer::Log(const char* aPrefix)
{
  if (!IsLogEnabled())
    return;

  LogSelf(aPrefix);

  if (Layer* kid = GetFirstChild()) {
    nsCAutoString pfx(aPrefix);
    pfx += "  ";
    kid->Log(pfx.get());
  }

  if (Layer* next = GetNextSibling())
    next->Log(aPrefix);
}
void nsSOAPUtils::GetFirstChildElement(nsIDOMElement * aParent,
                                       nsIDOMElement ** aElement)
{
  nsCOMPtr<nsIDOMNode> child;

  *aElement = nsnull;
  aParent->GetFirstChild(getter_AddRefs(child));
  while (child) {
    PRUint16 type;
    child->GetNodeType(&type);
    if (nsIDOMNode::ELEMENT_NODE == type) {
      child->QueryInterface(NS_GET_IID(nsIDOMElement), (void **) aElement);
      break;
    }
    nsCOMPtr<nsIDOMNode> temp = child;
    GetNextSibling(temp, getter_AddRefs(child));
  }
}
Exemple #26
0
void CLocalTreeView::RemoveDrive(wxChar drive)
{
	wxString driveName = drive;
	driveName += _T(":");
	wxTreeItemIdValue value;
	wxTreeItemId driveItem = GetFirstChild(m_drives, value);
	while (driveItem)
	{
		if (!GetItemText(driveItem).Left(2).CmpNoCase(driveName))
			break;

		driveItem = GetNextSibling(driveItem);
	}
	if (!driveItem)
		return;

	Delete(driveItem);
}
void
nsContentSubtreeIterator::Next()
{
  if (mIsDone || !mCurNode) 
    return;

  if (mCurNode == mLast) 
  {
    mIsDone = PR_TRUE;
    return;
  }

  nsINode *nextNode = GetNextSibling(mCurNode, nsnull);
  NS_ASSERTION(nextNode, "No next sibling!?! This could mean deadlock!");

/*
  nextNode = GetDeepFirstChild(nextNode);
  return GetTopAncestorInRange(nextNode, address_of(mCurNode));
*/
  PRInt32 i = mEndNodes.IndexOf(nextNode);
  while (i != -1)
  {
    // as long as we are finding ancestors of the endpoint of the range,
    // dive down into their children
    nextNode = nextNode->GetChildAt(0);
    NS_ASSERTION(nextNode, "Iterator error, expected a child node!");

    // should be impossible to get a null pointer.  If we went all the way
    // down the child chain to the bottom without finding an interior node, 
    // then the previous node should have been the last, which was
    // was tested at top of routine.
    i = mEndNodes.IndexOf(nextNode);
  }

  mCurNode = nextNode;

  // This shouldn't be needed, but since our selection code can put us
  // in a situation where mLast is in generated content, we need this
  // to stop the iterator when we've walked past past the last node!
  mIsDone = mCurNode == nsnull;

  return;
}
void SkillObjectTree::SelectElementItem(Ogre::StringInterface* element)
{
	wxTreeItemId rootId = GetRootItem();
	wxTreeItemIdValue idValue;
	wxTreeItemId subId;
	wxTreeItemId childId = GetFirstChild(rootId,idValue);

	while(childId.IsOk())
	{
		SkillTreeItemData* pItemData = dynamic_cast<SkillTreeItemData*>(GetItemData(childId)); 
		Ogre::StringInterface* pElement = (Ogre::StringInterface*)pItemData->GetData();
		if(pItemData->GetDesc() == "Skill Element" && pElement == element)
		{
			this->SelectItem(childId);
			this->Expand(childId);
			return;
		}
		childId = GetNextSibling(childId);
	}
}
//选择粒子基本参数Item
void SkillObjectTree::SelectSkillSetting()
{
	wxTreeItemId rootId = GetRootItem();
	wxTreeItemIdValue idValue;
	wxTreeItemId childId = GetFirstChild(rootId,idValue);
	while(childId.IsOk())
	{
		SkillTreeItemData* pItemData = dynamic_cast<SkillTreeItemData*>(GetItemData(childId)); 
		if(pItemData->GetDesc() == "Skill BasicSetting")
		{

			//SelectItem(childId);
			Expand(childId);
			mSelectSkillObject = NULL;
			break;
		}
		childId = GetNextSibling(childId);
	}

}
Exemple #30
0
CGuiWidget* CGuiWidget::FindWidget(s16 id)
{
    if (x7c_selfId == id)
        return this;
    CGuiWidget* child = static_cast<CGuiWidget*>(GetChildObject());
    if (child)
    {
        CGuiWidget* found = child->FindWidget(id);
        if (found)
            return found;
    }
    CGuiWidget* nextSib = static_cast<CGuiWidget*>(GetNextSibling());
    if (nextSib)
    {
        CGuiWidget* found = nextSib->FindWidget(id);
        if (found)
            return found;
    }
    return nullptr;
}