Remember any applied typecasts in VariableViewState.
Preserves and restores typecasts across steps like we already do for node expansion states.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2013, Rene Gollent, [email protected].
|
||||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
|
|
||||||
#include "FunctionID.h"
|
#include "FunctionID.h"
|
||||||
#include "StackFrameValues.h"
|
#include "StackFrameValues.h"
|
||||||
|
#include "Type.h"
|
||||||
#include "TypeComponentPath.h"
|
#include "TypeComponentPath.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -18,15 +20,26 @@
|
|||||||
|
|
||||||
VariablesViewNodeInfo::VariablesViewNodeInfo()
|
VariablesViewNodeInfo::VariablesViewNodeInfo()
|
||||||
:
|
:
|
||||||
fNodeExpanded(false)
|
fNodeExpanded(false),
|
||||||
|
fCastedType(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VariablesViewNodeInfo::VariablesViewNodeInfo(const VariablesViewNodeInfo& other)
|
VariablesViewNodeInfo::VariablesViewNodeInfo(const VariablesViewNodeInfo& other)
|
||||||
:
|
:
|
||||||
fNodeExpanded(other.fNodeExpanded)
|
fNodeExpanded(other.fNodeExpanded),
|
||||||
|
fCastedType(other.fCastedType)
|
||||||
{
|
{
|
||||||
|
if (fCastedType != NULL)
|
||||||
|
fCastedType->AcquireReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VariablesViewNodeInfo::~VariablesViewNodeInfo()
|
||||||
|
{
|
||||||
|
if (fCastedType != NULL)
|
||||||
|
fCastedType->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -34,6 +47,8 @@ VariablesViewNodeInfo&
|
|||||||
VariablesViewNodeInfo::operator=(const VariablesViewNodeInfo& other)
|
VariablesViewNodeInfo::operator=(const VariablesViewNodeInfo& other)
|
||||||
{
|
{
|
||||||
fNodeExpanded = other.fNodeExpanded;
|
fNodeExpanded = other.fNodeExpanded;
|
||||||
|
SetCastedType(other.fCastedType);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,6 +60,18 @@ VariablesViewNodeInfo::SetNodeExpanded(bool expanded)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
VariablesViewNodeInfo::SetCastedType(Type* type)
|
||||||
|
{
|
||||||
|
if (fCastedType != NULL)
|
||||||
|
fCastedType->ReleaseReference();
|
||||||
|
|
||||||
|
fCastedType = type;
|
||||||
|
if (fCastedType != NULL)
|
||||||
|
fCastedType->AcquireReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - Key
|
// #pragma mark - Key
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright 2013, Rene Gollent, [email protected].
|
||||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -12,6 +13,7 @@
|
|||||||
|
|
||||||
class ObjectID;
|
class ObjectID;
|
||||||
class StackFrameValues;
|
class StackFrameValues;
|
||||||
|
class Type;
|
||||||
class TypeComponentPath;
|
class TypeComponentPath;
|
||||||
|
|
||||||
|
|
||||||
@@ -20,6 +22,7 @@ public:
|
|||||||
VariablesViewNodeInfo();
|
VariablesViewNodeInfo();
|
||||||
VariablesViewNodeInfo(
|
VariablesViewNodeInfo(
|
||||||
const VariablesViewNodeInfo& other);
|
const VariablesViewNodeInfo& other);
|
||||||
|
virtual ~VariablesViewNodeInfo();
|
||||||
|
|
||||||
VariablesViewNodeInfo& operator=(
|
VariablesViewNodeInfo& operator=(
|
||||||
const VariablesViewNodeInfo& other);
|
const VariablesViewNodeInfo& other);
|
||||||
@@ -28,8 +31,13 @@ public:
|
|||||||
{ return fNodeExpanded; }
|
{ return fNodeExpanded; }
|
||||||
void SetNodeExpanded(bool expanded);
|
void SetNodeExpanded(bool expanded);
|
||||||
|
|
||||||
|
Type* GetCastedType() const
|
||||||
|
{ return fCastedType; }
|
||||||
|
void SetCastedType(Type* type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool fNodeExpanded;
|
bool fNodeExpanded;
|
||||||
|
Type* fCastedType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||||
* Copyright 2011-2012, Rene Gollent, [email protected].
|
* Copyright 2011-2013, Rene Gollent, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -111,7 +111,8 @@ public:
|
|||||||
fTableCellRenderer(NULL),
|
fTableCellRenderer(NULL),
|
||||||
fComponentPath(NULL),
|
fComponentPath(NULL),
|
||||||
fIsPresentationNode(isPresentationNode),
|
fIsPresentationNode(isPresentationNode),
|
||||||
fHidden(false)
|
fHidden(false),
|
||||||
|
fCastedType(NULL)
|
||||||
{
|
{
|
||||||
fNodeChild->AcquireReference();
|
fNodeChild->AcquireReference();
|
||||||
}
|
}
|
||||||
@@ -129,6 +130,9 @@ public:
|
|||||||
|
|
||||||
if (fComponentPath != NULL)
|
if (fComponentPath != NULL)
|
||||||
fComponentPath->ReleaseReference();
|
fComponentPath->ReleaseReference();
|
||||||
|
|
||||||
|
if (fCastedType != NULL)
|
||||||
|
fCastedType->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t Init()
|
status_t Init()
|
||||||
@@ -195,6 +199,21 @@ public:
|
|||||||
fValue->AcquireReference();
|
fValue->AcquireReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Type* GetCastedType() const
|
||||||
|
{
|
||||||
|
return fCastedType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCastedType(Type* type)
|
||||||
|
{
|
||||||
|
if (fCastedType != NULL)
|
||||||
|
fCastedType->ReleaseReference();
|
||||||
|
|
||||||
|
fCastedType = type;
|
||||||
|
if (type != NULL)
|
||||||
|
fCastedType->AcquireReference();
|
||||||
|
}
|
||||||
|
|
||||||
TypeComponentPath* GetPath() const
|
TypeComponentPath* GetPath() const
|
||||||
{
|
{
|
||||||
return fComponentPath;
|
return fComponentPath;
|
||||||
@@ -309,6 +328,7 @@ private:
|
|||||||
TypeComponentPath* fComponentPath;
|
TypeComponentPath* fComponentPath;
|
||||||
bool fIsPresentationNode;
|
bool fIsPresentationNode;
|
||||||
bool fHidden;
|
bool fHidden;
|
||||||
|
Type* fCastedType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ModelNode* fNext;
|
ModelNode* fNext;
|
||||||
@@ -1509,9 +1529,8 @@ VariablesView::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: we need to also persist/restore the casted state
|
|
||||||
// in VariableViewState
|
|
||||||
node->NodeChild()->SetNode(valueNode);
|
node->NodeChild()->SetNode(valueNode);
|
||||||
|
node->SetCastedType(type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MSG_SHOW_WATCH_VARIABLE_PROMPT:
|
case MSG_SHOW_WATCH_VARIABLE_PROMPT:
|
||||||
@@ -1967,6 +1986,7 @@ VariablesView::_AddViewStateDescendentNodeInfos(VariablesViewState* viewState,
|
|||||||
// add the node's info
|
// add the node's info
|
||||||
VariablesViewNodeInfo nodeInfo;
|
VariablesViewNodeInfo nodeInfo;
|
||||||
nodeInfo.SetNodeExpanded(fVariableTable->IsNodeExpanded(path));
|
nodeInfo.SetNodeExpanded(fVariableTable->IsNodeExpanded(path));
|
||||||
|
nodeInfo.SetCastedType(node->GetCastedType());
|
||||||
|
|
||||||
status_t error = viewState->SetNodeInfo(node->GetVariable()->ID(),
|
status_t error = viewState->SetNodeInfo(node->GetVariable()->ID(),
|
||||||
node->GetPath(), nodeInfo);
|
node->GetPath(), nodeInfo);
|
||||||
@@ -1999,6 +2019,20 @@ VariablesView::_ApplyViewStateDescendentNodeInfos(VariablesViewState* viewState,
|
|||||||
const VariablesViewNodeInfo* nodeInfo = viewState->GetNodeInfo(
|
const VariablesViewNodeInfo* nodeInfo = viewState->GetNodeInfo(
|
||||||
node->GetVariable()->ID(), node->GetPath());
|
node->GetVariable()->ID(), node->GetPath());
|
||||||
if (nodeInfo != NULL) {
|
if (nodeInfo != NULL) {
|
||||||
|
// NB: if the node info indicates that the node in question
|
||||||
|
// was being cast to a different type, this *must* be applied
|
||||||
|
// before any other view state restoration, since it potentially
|
||||||
|
// changes the child hierarchy under that node.
|
||||||
|
Type* type = nodeInfo->GetCastedType();
|
||||||
|
if (type != NULL) {
|
||||||
|
ValueNode* valueNode = NULL;
|
||||||
|
if (TypeHandlerRoster::Default()->CreateValueNode(
|
||||||
|
node->NodeChild(), type, valueNode) == B_OK) {
|
||||||
|
node->NodeChild()->SetNode(valueNode);
|
||||||
|
node->SetCastedType(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fVariableTable->SetNodeExpanded(path, nodeInfo->IsNodeExpanded());
|
fVariableTable->SetNodeExpanded(path, nodeInfo->IsNodeExpanded());
|
||||||
|
|
||||||
// recurse
|
// recurse
|
||||||
|
|||||||
Reference in New Issue
Block a user