Пример #1
0
status_t
VariablesView::_ApplyViewStateDescendentNodeInfos(VariablesViewState* viewState,
	void* parent, TreeTablePath& path)
{
	int32 childCount = fVariableTableModel->CountChildren(parent);
	for (int32 i = 0; i < childCount; i++) {
		ModelNode* node = (ModelNode*)fVariableTableModel->ChildAt(parent, i);
		if (!path.AddComponent(i))
			return B_NO_MEMORY;

		// apply the node's info, if any
		const VariablesViewNodeInfo* nodeInfo = viewState->GetNodeInfo(
			node->GetVariable()->ID(), node->GetPath());
		if (nodeInfo != NULL) {
			fVariableTable->SetNodeExpanded(path, nodeInfo->IsNodeExpanded());

			// recurse
			status_t error = _ApplyViewStateDescendentNodeInfos(viewState, node,
				path);
			if (error != B_OK)
				return error;
		}

		path.RemoveLastComponent();
	}

	return B_OK;
}
void
ImageFunctionsView::SetImageDebugInfo(ImageDebugInfo* imageDebugInfo)
{
	if (imageDebugInfo == fImageDebugInfo)
		return;

	TRACE_GUI("ImageFunctionsView::SetImageDebugInfo(%p)\n", imageDebugInfo);

	if (fImageDebugInfo != NULL)
		fImageDebugInfo->ReleaseReference();

	fImageDebugInfo = imageDebugInfo;

	if (fImageDebugInfo != NULL)
		fImageDebugInfo->AcquireReference();

	fFunctionsTableModel->SetImageDebugInfo(fImageDebugInfo);

	// If there's only one source file (i.e. "no source file"), expand the item.
	if (fImageDebugInfo != NULL
		&& fFunctionsTableModel->CountSourceFiles() == 1) {
		TreeTablePath path;
		path.AddComponent(0);
		fFunctionsTable->SetNodeExpanded(path, true, false);
	}

	if (fImageDebugInfo != NULL)
		fFunctionsTable->ResizeAllColumnsToPreferred();

	TRACE_GUI("ImageFunctionsView::SetImageDebugInfo(%p) done\n",
		imageDebugInfo);
}
Пример #3
0
status_t
VariablesView::_AddViewStateDescendentNodeInfos(VariablesViewState* viewState,
	void* parent, TreeTablePath& path) const
{
	int32 childCount = fVariableTableModel->CountChildren(parent);
	for (int32 i = 0; i < childCount; i++) {
		ModelNode* node = (ModelNode*)fVariableTableModel->ChildAt(parent, i);
		if (!path.AddComponent(i))
			return B_NO_MEMORY;

		// add the node's info
		VariablesViewNodeInfo nodeInfo;
		nodeInfo.SetNodeExpanded(fVariableTable->IsNodeExpanded(path));

		status_t error = viewState->SetNodeInfo(node->GetVariable()->ID(),
			node->GetPath(), nodeInfo);
		if (error != B_OK)
			return error;

		// recurse
		error = _AddViewStateDescendentNodeInfos(viewState, node, path);
		if (error != B_OK)
			return error;

		path.RemoveLastComponent();
	}

	return B_OK;
}
Пример #4
0
void
TreeTable::_GetPathForNode(TreeTableNode* node, TreeTablePath& _path) const
{
	if (node == fRootNode) {
		_path.Clear();
		return;
	}

	_GetPathForNode(node->Parent(), _path);
	_path.AddComponent(node->Parent()->IndexOf(node));
}
Пример #5
0
void
VariablesView::VariableTableModel::NotifyNodeChanged(ModelNode* node)
{
	if (!node->IsHidden()) {
		TreeTablePath treePath;
		if (_GetTreePath(node, treePath)) {
			int32 index = treePath.RemoveLastComponent();
			NotifyNodesChanged(treePath, index, 1);
		}
	}
}
Пример #6
0
bool
VariablesView::VariableTableModel::_GetTreePath(ModelNode* node,
	TreeTablePath& _path) const
{
	// recurse, if the node has a parent
	if (ModelNode* parent = node->Parent()) {
		if (!_GetTreePath(parent, _path))
			return false;

		if (node->IsHidden())
			return true;

		return _path.AddComponent(parent->IndexOf(node));
	}

	// no parent -- get the index and start the path
	int32 index = fNodes.IndexOf(node);
	_path.Clear();
	return index >= 0 && _path.AddComponent(index);
}
	bool GetFunctionPath(FunctionInstance* function, TreeTablePath& _path)
	{
		int32 index = -1;
		for (int32 i = 0; i < fFunctionCount; i++) {
			if (fFunctions[i] == function) {
				index = i;
				break;
			}
		}

		if (index < 0)
			return false;

		int32 sourceIndex = fSourceFileCount - 1;
		while (fSourceFileIndices[sourceIndex] > index)
			sourceIndex--;

		_path.Clear();
		return _path.AddComponent(sourceIndex)
			&& _path.AddComponent(index - fSourceFileIndices[sourceIndex]);
	}
	bool GetObjectForPath(const TreeTablePath& path,
		LocatableFile*& _sourceFile, FunctionInstance*& _function)
	{
		int32 componentCount = path.CountComponents();
		if (componentCount == 0 || componentCount > 2)
			return false;

		int32 sourceIndex = path.ComponentAt(0);
		if (sourceIndex < 0 || sourceIndex >= fSourceFileCount)
			return false;

		_sourceFile = fFunctions[fSourceFileIndices[sourceIndex]]->SourceFile();

		_function = NULL;

		if (componentCount == 2) {
			int32 index = path.ComponentAt(1);
			if (index >= 0 && index < _CountSourceFileFunctions(sourceIndex))
				_function = fFunctions[fSourceFileIndices[sourceIndex] + index];
		}

		return true;
	}