[haiku-commits] r42469 - haiku/trunk/src/apps/debugger/user_interface/gui/team_window

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 24 Jul 2011 03:31:35 +0200 (CEST)

Author: anevilyak
Date: 2011-07-24 03:31:35 +0200 (Sun, 24 Jul 2011)
New Revision: 42469
Changeset: https://dev.haiku-os.org/changeset/42469

Modified:
   
haiku/trunk/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp
Log:
* Rename and make VariableTableModel::_GetTreePath() public so VariablesView
  can make use of it, and adjust existing callers.
* For nodes that need child creation to be deferred until after value
  resolution succeeds, send a request to the view to restore their view state
  once child creation is complete. This gets the view state working again
  for things like BPoints and other complex structures embedded in a BMessage.



Modified: 
haiku/trunk/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp
===================================================================
--- 
haiku/trunk/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp  
    2011-07-23 15:41:47 UTC (rev 42468)
+++ 
haiku/trunk/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp  
    2011-07-24 01:31:35 UTC (rev 42469)
@@ -1,5 +1,6 @@
 /*
  * Copyright 2009, Ingo Weinhold, ingo_weinhold@xxxxxxx
+ * Copyright 2011, Rene Gollent, rene@xxxxxxxxxxxx
  * Distributed under the terms of the MIT License.
  */
 
@@ -48,8 +49,9 @@
 
 
 enum {
-       MSG_MODEL_NODE_HIDDEN           = 'monh',
-       MSG_VALUE_NODE_NEEDS_VALUE      = 'mvnv'
+       MSG_MODEL_NODE_HIDDEN                   = 'monh',
+       MSG_VALUE_NODE_NEEDS_VALUE              = 'mvnv',
+       MSG_RESTORE_PARTIAL_VIEW_STATE  = 'mpvs'
 };
 
 
@@ -73,6 +75,8 @@
 
        virtual void                            
ModelNodeValueRequested(ModelNode* node);
 
+       virtual void                            
ModelNodeRestoreViewStateRequested(ModelNode* node);
+
 private:
                        BHandler*                       fIndirectTarget;
                        VariableTableModel*     fModel;
@@ -364,6 +368,9 @@
        virtual bool                            GetValueAt(void* object, int32 
columnIndex,
                                                                        
BVariant& _value);
 
+                       bool                            GetTreePath(ModelNode* 
node,
+                                                                       
TreeTablePath& _path) const;
+
                        void                            NodeExpanded(ModelNode* 
node);
 
                        void                            
NotifyNodeChanged(ModelNode* node);
@@ -412,8 +419,6 @@
 
 //                     ModelNode*                      _GetNode(Variable* 
variable,
 //                                                                     
TypeComponentPath* path) const;
-                       bool                            _GetTreePath(ModelNode* 
node,
-                                                                       
TreeTablePath& _path) const;
 
 private:
                        Thread*                         fThread;
@@ -706,6 +711,21 @@
 }
 
 
+void
+VariablesView::ContainerListener::ModelNodeRestoreViewStateRequested(
+       ModelNode* node)
+{
+       BReference<ModelNode> nodeReference(node);
+
+       BMessage message(MSG_RESTORE_PARTIAL_VIEW_STATE);
+       if (message.AddPointer("node", node) == B_OK
+               && fIndirectTarget->Looper()->PostMessage(&message, 
fIndirectTarget)
+                       == B_OK) {
+               nodeReference.Detach();
+       }
+}
+
+
 // #pragma mark - VariableTableModel
 
 
@@ -869,6 +889,7 @@
                                
fContainerListener->ModelNodeValueRequested(childNode);
                }
 
+               
fContainerListener->ModelNodeRestoreViewStateRequested(modelNode);
        }
 }
 
@@ -1047,7 +1068,7 @@
 {
        if (!node->IsHidden()) {
                TreeTablePath treePath;
-               if (_GetTreePath(node, treePath)) {
+               if (GetTreePath(node, treePath)) {
                        int32 index = treePath.RemoveLastComponent();
                        NotifyNodesChanged(treePath, index, 1);
                }
@@ -1118,7 +1139,7 @@
        // notify table model listeners
        if (!node->IsHidden()) {
                TreeTablePath path;
-               if (parent == NULL || _GetTreePath(parent, path))
+               if (parent == NULL || GetTreePath(parent, path))
                        NotifyNodesAdded(path, childIndex, 1);
        }
 
@@ -1269,12 +1290,12 @@
 
 
 bool
-VariablesView::VariableTableModel::_GetTreePath(ModelNode* node,
+VariablesView::VariableTableModel::GetTreePath(ModelNode* node,
        TreeTablePath& _path) const
 {
        // recurse, if the node has a parent
        if (ModelNode* parent = node->Parent()) {
-               if (!_GetTreePath(parent, _path))
+               if (!GetTreePath(parent, _path))
                        return false;
 
                if (node->IsHidden())
@@ -1437,6 +1458,28 @@
 
                        break;
                }
+               case MSG_RESTORE_PARTIAL_VIEW_STATE:
+               {
+                       ModelNode* node;
+                       if (message->FindPointer("node", (void**)&node) == 
B_OK) {
+                               TreeTablePath path;
+                               if (fVariableTableModel->GetTreePath(node, 
path)) {
+                                       FunctionID* functionID = 
fStackFrame->Function()
+                                               ->GetFunctionID();
+                                       if (functionID == NULL)
+                                               return;
+                                       BReference<FunctionID> 
functionIDReference(functionID,
+                                               true);
+                                       VariablesViewState* viewState = 
fViewStateHistory
+                                               ->GetState(fThread->ID(), 
functionID);
+                                       if (viewState != NULL) {
+                                               
_ApplyViewStateDescendentNodeInfos(viewState, node,
+                                                       path);
+                                       }
+                               }
+                       }
+                       break;
+               }
                case MSG_VALUE_NODE_NEEDS_VALUE:
                case MSG_MODEL_NODE_HIDDEN:
                {


Other related posts:

  • » [haiku-commits] r42469 - haiku/trunk/src/apps/debugger/user_interface/gui/team_window - anevilyak