Get the variable view state more or less usable again. Still needs some more work to
do things like preserve renderer settings and some other details. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42254 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -70,14 +70,16 @@ private:
|
|||||||
|
|
||||||
class VariablesView::ModelNode : public BReferenceable {
|
class VariablesView::ModelNode : public BReferenceable {
|
||||||
public:
|
public:
|
||||||
ModelNode(ModelNode* parent, ValueNodeChild* nodeChild,
|
ModelNode(ModelNode* parent, Variable* variable, ValueNodeChild* nodeChild,
|
||||||
bool isPresentationNode)
|
bool isPresentationNode)
|
||||||
:
|
:
|
||||||
fParent(parent),
|
fParent(parent),
|
||||||
fNodeChild(nodeChild),
|
fNodeChild(nodeChild),
|
||||||
|
fVariable(variable),
|
||||||
fValue(NULL),
|
fValue(NULL),
|
||||||
fValueHandler(NULL),
|
fValueHandler(NULL),
|
||||||
fTableCellRenderer(NULL),
|
fTableCellRenderer(NULL),
|
||||||
|
fComponentPath(NULL),
|
||||||
fIsPresentationNode(isPresentationNode),
|
fIsPresentationNode(isPresentationNode),
|
||||||
fHidden(false)
|
fHidden(false)
|
||||||
{
|
{
|
||||||
@@ -94,6 +96,29 @@ public:
|
|||||||
child->ReleaseReference();
|
child->ReleaseReference();
|
||||||
|
|
||||||
fNodeChild->ReleaseReference();
|
fNodeChild->ReleaseReference();
|
||||||
|
|
||||||
|
if (fComponentPath != NULL)
|
||||||
|
fComponentPath->ReleaseReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
status_t Init()
|
||||||
|
{
|
||||||
|
fComponentPath = new(std::nothrow) TypeComponentPath();
|
||||||
|
if (fComponentPath == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
if (fParent != NULL)
|
||||||
|
*fComponentPath = *fParent->GetPath();
|
||||||
|
|
||||||
|
TypeComponent component;
|
||||||
|
// TODO: this should actually discriminate between different
|
||||||
|
// classes of type component kinds
|
||||||
|
component.SetToBaseType(fNodeChild->GetType()->Kind(),
|
||||||
|
0, fNodeChild->Name());
|
||||||
|
|
||||||
|
fComponentPath->AddComponent(component);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelNode* Parent() const
|
ModelNode* Parent() const
|
||||||
@@ -116,6 +141,11 @@ public:
|
|||||||
return fNodeChild->GetType();
|
return fNodeChild->GetType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Variable* GetVariable() const
|
||||||
|
{
|
||||||
|
return fVariable;
|
||||||
|
}
|
||||||
|
|
||||||
Value* GetValue() const
|
Value* GetValue() const
|
||||||
{
|
{
|
||||||
return fValue;
|
return fValue;
|
||||||
@@ -135,6 +165,11 @@ public:
|
|||||||
fValue->AcquireReference();
|
fValue->AcquireReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TypeComponentPath* GetPath() const
|
||||||
|
{
|
||||||
|
return fComponentPath;
|
||||||
|
}
|
||||||
|
|
||||||
ValueHandler* GetValueHandler() const
|
ValueHandler* GetValueHandler() const
|
||||||
{
|
{
|
||||||
return fValueHandler;
|
return fValueHandler;
|
||||||
@@ -219,10 +254,12 @@ private:
|
|||||||
private:
|
private:
|
||||||
ModelNode* fParent;
|
ModelNode* fParent;
|
||||||
ValueNodeChild* fNodeChild;
|
ValueNodeChild* fNodeChild;
|
||||||
|
Variable* fVariable;
|
||||||
Value* fValue;
|
Value* fValue;
|
||||||
ValueHandler* fValueHandler;
|
ValueHandler* fValueHandler;
|
||||||
TableCellValueRenderer* fTableCellRenderer;
|
TableCellValueRenderer* fTableCellRenderer;
|
||||||
ChildList fChildren;
|
ChildList fChildren;
|
||||||
|
TypeComponentPath* fComponentPath;
|
||||||
bool fIsPresentationNode;
|
bool fIsPresentationNode;
|
||||||
bool fHidden;
|
bool fHidden;
|
||||||
|
|
||||||
@@ -353,7 +390,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
// container must be locked
|
// container must be locked
|
||||||
|
|
||||||
status_t _AddNode(ModelNode* parent,
|
status_t _AddNode(Variable* variable, ModelNode* parent,
|
||||||
ValueNodeChild* nodeChild,
|
ValueNodeChild* nodeChild,
|
||||||
bool isPresentationNode = false);
|
bool isPresentationNode = false);
|
||||||
void _AddNode(Variable* variable);
|
void _AddNode(Variable* variable);
|
||||||
@@ -780,8 +817,10 @@ VariablesView::VariableTableModel::ValueNodeChildrenCreated(
|
|||||||
int32 childCount = valueNode->CountChildren();
|
int32 childCount = valueNode->CountChildren();
|
||||||
for (int32 i = 0; i < childCount; i++) {
|
for (int32 i = 0; i < childCount; i++) {
|
||||||
ValueNodeChild* child = valueNode->ChildAt(i);
|
ValueNodeChild* child = valueNode->ChildAt(i);
|
||||||
if (fNodeTable.Lookup(child) == NULL)
|
if (fNodeTable.Lookup(child) == NULL) {
|
||||||
_AddNode(modelNode, child, child->IsInternal());
|
_AddNode(modelNode->GetVariable(), modelNode, child,
|
||||||
|
child->IsInternal());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -956,8 +995,8 @@ VariablesView::VariableTableModel::NotifyNodeChanged(ModelNode* node)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
VariablesView::VariableTableModel::_AddNode(ModelNode* parent,
|
VariablesView::VariableTableModel::_AddNode(Variable* variable,
|
||||||
ValueNodeChild* nodeChild, bool isPresentationNode)
|
ModelNode* parent, ValueNodeChild* nodeChild, bool isPresentationNode)
|
||||||
{
|
{
|
||||||
// Don't create nodes for unspecified types -- we can't get/show their
|
// Don't create nodes for unspecified types -- we can't get/show their
|
||||||
// value anyway.
|
// value anyway.
|
||||||
@@ -965,10 +1004,10 @@ VariablesView::VariableTableModel::_AddNode(ModelNode* parent,
|
|||||||
if (nodeChildRawType->Kind() == TYPE_UNSPECIFIED)
|
if (nodeChildRawType->Kind() == TYPE_UNSPECIFIED)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
ModelNode* node = new(std::nothrow) ModelNode(parent, nodeChild,
|
ModelNode* node = new(std::nothrow) ModelNode(parent, variable, nodeChild,
|
||||||
isPresentationNode);
|
isPresentationNode);
|
||||||
BReference<ModelNode> nodeReference(node, true);
|
BReference<ModelNode> nodeReference(node, true);
|
||||||
if (node == NULL)
|
if (node == NULL || node->Init() != B_OK)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
int32 childIndex;
|
int32 childIndex;
|
||||||
@@ -1029,7 +1068,7 @@ VariablesView::VariableTableModel::_AddNode(Variable* variable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create the model node
|
// create the model node
|
||||||
status_t error = _AddNode(NULL, nodeChild, false);
|
status_t error = _AddNode(variable, NULL, nodeChild, false);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1231,7 +1270,7 @@ VariablesView::SetStackFrame(Thread* thread, StackFrame* stackFrame)
|
|||||||
if (thread == fThread && stackFrame == fStackFrame)
|
if (thread == fThread && stackFrame == fStackFrame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// _SaveViewState();
|
_SaveViewState();
|
||||||
|
|
||||||
_FinishContextMenu(true);
|
_FinishContextMenu(true);
|
||||||
|
|
||||||
@@ -1262,7 +1301,7 @@ VariablesView::SetStackFrame(Thread* thread, StackFrame* stackFrame)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// _RestoreViewState();
|
_RestoreViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1490,7 +1529,7 @@ VariablesView::_FinishContextMenu(bool force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
void
|
void
|
||||||
VariablesView::_SaveViewState() const
|
VariablesView::_SaveViewState() const
|
||||||
{
|
{
|
||||||
@@ -1574,7 +1613,7 @@ VariablesView::_AddViewStateDescendentNodeInfos(VariablesViewState* viewState,
|
|||||||
nodeInfo.SetNodeExpanded(fVariableTable->IsNodeExpanded(path));
|
nodeInfo.SetNodeExpanded(fVariableTable->IsNodeExpanded(path));
|
||||||
|
|
||||||
status_t error = viewState->SetNodeInfo(node->GetVariable()->ID(),
|
status_t error = viewState->SetNodeInfo(node->GetVariable()->ID(),
|
||||||
node->Path(), nodeInfo);
|
node->GetPath(), nodeInfo);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
@@ -1602,7 +1641,7 @@ VariablesView::_ApplyViewStateDescendentNodeInfos(VariablesViewState* viewState,
|
|||||||
|
|
||||||
// apply the node's info, if any
|
// apply the node's info, if any
|
||||||
const VariablesViewNodeInfo* nodeInfo = viewState->GetNodeInfo(
|
const VariablesViewNodeInfo* nodeInfo = viewState->GetNodeInfo(
|
||||||
node->GetVariable()->ID(), node->Path());
|
node->GetVariable()->ID(), node->GetPath());
|
||||||
if (nodeInfo != NULL) {
|
if (nodeInfo != NULL) {
|
||||||
fVariableTable->SetNodeExpanded(path, nodeInfo->IsNodeExpanded());
|
fVariableTable->SetNodeExpanded(path, nodeInfo->IsNodeExpanded());
|
||||||
|
|
||||||
@@ -1618,7 +1657,6 @@ VariablesView::_ApplyViewStateDescendentNodeInfos(VariablesViewState* viewState,
|
|||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
#endif // 0
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - Listener
|
// #pragma mark - Listener
|
||||||
|
|||||||
@@ -65,14 +65,14 @@ private:
|
|||||||
void _RequestNodeValue(ModelNode* node);
|
void _RequestNodeValue(ModelNode* node);
|
||||||
void _FinishContextMenu(bool force);
|
void _FinishContextMenu(bool force);
|
||||||
|
|
||||||
// void _SaveViewState() const;
|
void _SaveViewState() const;
|
||||||
// void _RestoreViewState();
|
void _RestoreViewState();
|
||||||
// status_t _AddViewStateDescendentNodeInfos(
|
status_t _AddViewStateDescendentNodeInfos(
|
||||||
// VariablesViewState* viewState, void* parent,
|
VariablesViewState* viewState, void* parent,
|
||||||
// TreeTablePath& path) const;
|
TreeTablePath& path) const;
|
||||||
// status_t _ApplyViewStateDescendentNodeInfos(
|
status_t _ApplyViewStateDescendentNodeInfos(
|
||||||
// VariablesViewState* viewState, void* parent,
|
VariablesViewState* viewState, void* parent,
|
||||||
// TreeTablePath& path);
|
TreeTablePath& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Thread* fThread;
|
Thread* fThread;
|
||||||
|
|||||||
Reference in New Issue
Block a user