diff --git a/src/apps/debuganalyzer/gui/table/TreeTable.cpp b/src/apps/debuganalyzer/gui/table/TreeTable.cpp
index 0c20843..851342a 100644
a
|
b
|
|
1 | 1 | /* |
2 | 2 | * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. |
| 3 | * Copyright 2012, Rene Gollent, rene@gollent.com. |
3 | 4 | * Distributed under the terms of the MIT License. |
4 | 5 | */ |
5 | 6 | |
… |
… |
TreeTableModel::NotifyNodesChanged(const TreeTablePath& path, int32 childIndex,
|
226 | 227 | } |
227 | 228 | |
228 | 229 | |
| 230 | // #pragma mark - TreeTableToolTipProvider |
| 231 | |
| 232 | |
| 233 | TreeTableToolTipProvider::~TreeTableToolTipProvider() |
| 234 | { |
| 235 | } |
| 236 | |
| 237 | |
229 | 238 | // #pragma mark - TreeTableListener |
230 | 239 | |
231 | 240 | |
… |
… |
TreeTable::TreeTable(const char* name, uint32 flags, border_style borderStyle,
|
650 | 659 | : |
651 | 660 | AbstractTable(name, flags, borderStyle, showHorizontalScrollbar), |
652 | 661 | fModel(NULL), |
| 662 | fToolTipProvider(NULL), |
653 | 663 | fRootNode(NULL), |
654 | 664 | fSelectionModel(this), |
655 | 665 | fIgnoreSelectionChange(0) |
… |
… |
TreeTable::SetTreeTableModel(TreeTableModel* model)
|
731 | 741 | } |
732 | 742 | |
733 | 743 | |
| 744 | void |
| 745 | TreeTable::SetToolTipProvider(TreeTableToolTipProvider* toolTipProvider) |
| 746 | { |
| 747 | fToolTipProvider = toolTipProvider; |
| 748 | } |
| 749 | |
| 750 | |
734 | 751 | TreeTableSelectionModel* |
735 | 752 | TreeTable::SelectionModel() |
736 | 753 | { |
… |
… |
TreeTable::RemoveTreeTableListener(TreeTableListener* listener)
|
810 | 827 | } |
811 | 828 | |
812 | 829 | |
| 830 | bool |
| 831 | TreeTable::GetToolTipAt(BPoint point, BToolTip** _tip) |
| 832 | { |
| 833 | if (fToolTipProvider == NULL) |
| 834 | return AbstractTable::GetToolTipAt(point, _tip); |
| 835 | |
| 836 | // get the table row |
| 837 | BRow* row = RowAt(point); |
| 838 | if (row == NULL) |
| 839 | return AbstractTable::GetToolTipAt(point, _tip); |
| 840 | |
| 841 | TreeTableRow* treeRow = dynamic_cast<TreeTableRow*>(row); |
| 842 | // get the table column |
| 843 | BColumn* column = ColumnAt(point); |
| 844 | |
| 845 | int32 columnIndex = column != NULL ? column->LogicalFieldNum() : -1; |
| 846 | |
| 847 | TreeTablePath path; |
| 848 | _GetPathForNode(treeRow->Node(), path); |
| 849 | |
| 850 | return fToolTipProvider->GetToolTipForTablePath(path, columnIndex, |
| 851 | _tip); |
| 852 | } |
| 853 | |
| 854 | |
813 | 855 | void |
814 | 856 | TreeTable::SelectionChanged() |
815 | 857 | { |
diff --git a/src/apps/debuganalyzer/gui/table/TreeTable.h b/src/apps/debuganalyzer/gui/table/TreeTable.h
index a475869..b006e08 100644
a
|
b
|
|
1 | 1 | /* |
2 | 2 | * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. |
| 3 | * Copyright 2012, Rene Gollent, rene@gollent.com. |
3 | 4 | * Distributed under the terms of the MIT License. |
4 | 5 | */ |
5 | 6 | #ifndef TREE_TABLE_H |
… |
… |
private:
|
122 | 123 | }; |
123 | 124 | |
124 | 125 | |
| 126 | class TreeTableToolTipProvider { |
| 127 | public: |
| 128 | virtual ~TreeTableToolTipProvider(); |
| 129 | |
| 130 | virtual bool GetToolTipForTablePath( |
| 131 | const TreeTablePath& path, |
| 132 | int32 columnIndex, BToolTip** _tip) = 0; |
| 133 | // columnIndex can be -1, if not in a column |
| 134 | }; |
| 135 | |
| 136 | |
125 | 137 | class TreeTableListener { |
126 | 138 | public: |
127 | 139 | virtual ~TreeTableListener(); |
… |
… |
public:
|
157 | 169 | bool SetTreeTableModel(TreeTableModel* model); |
158 | 170 | TreeTableModel* GetTreeTableModel() const { return fModel; } |
159 | 171 | |
| 172 | void SetToolTipProvider( |
| 173 | TreeTableToolTipProvider* toolTipProvider); |
| 174 | TreeTableToolTipProvider* ToolTipProvider() const |
| 175 | { return fToolTipProvider; } |
| 176 | |
160 | 177 | TreeTableSelectionModel* SelectionModel(); |
161 | 178 | |
162 | 179 | void SelectNode(const TreeTablePath& path, |
… |
… |
public:
|
177 | 194 | TreeTableListener* listener); |
178 | 195 | |
179 | 196 | protected: |
| 197 | virtual bool GetToolTipAt(BPoint point, BToolTip** _tip); |
| 198 | |
180 | 199 | virtual void SelectionChanged(); |
181 | 200 | |
182 | 201 | virtual AbstractColumn* CreateColumn(TableColumn* column); |
… |
… |
private:
|
226 | 245 | |
227 | 246 | private: |
228 | 247 | TreeTableModel* fModel; |
| 248 | TreeTableToolTipProvider* fToolTipProvider; |
229 | 249 | TreeTableNode* fRootNode; |
230 | 250 | TreeTableSelectionModel fSelectionModel; |
231 | 251 | ListenerList fListeners; |
diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp
index 04ad5d4..ece5836 100644
a
|
b
|
|
13 | 13 | |
14 | 14 | #include <Looper.h> |
15 | 15 | #include <PopUpMenu.h> |
| 16 | #include <ToolTip.h> |
16 | 17 | |
17 | 18 | #include <AutoDeleter.h> |
18 | 19 | #include <AutoLocker.h> |
… |
… |
|
25 | 26 | #include "FunctionInstance.h" |
26 | 27 | #include "GUISettingsUtils.h" |
27 | 28 | #include "MessageCodes.h" |
| 29 | #include "Register.h" |
28 | 30 | #include "SettingsMenu.h" |
29 | 31 | #include "StackFrame.h" |
30 | 32 | #include "StackFrameValues.h" |
… |
… |
protected:
|
345 | 347 | // #pragma mark - VariableTableModel |
346 | 348 | |
347 | 349 | |
348 | | class VariablesView::VariableTableModel : public TreeTableModel { |
| 350 | class VariablesView::VariableTableModel : public TreeTableModel, |
| 351 | public TreeTableToolTipProvider { |
349 | 352 | public: |
350 | 353 | VariableTableModel(); |
351 | 354 | ~VariableTableModel(); |
… |
… |
public:
|
379 | 382 | void NotifyNodeChanged(ModelNode* node); |
380 | 383 | void NotifyNodeHidden(ModelNode* node); |
381 | 384 | |
| 385 | virtual bool GetToolTipForTablePath( |
| 386 | const TreeTablePath& path, |
| 387 | int32 columnIndex, BToolTip** _tip); |
| 388 | |
382 | 389 | private: |
383 | 390 | struct NodeHashDefinition { |
384 | 391 | typedef ValueNodeChild* KeyType; |
… |
… |
VariablesView::VariableTableModel::NotifyNodeHidden(ModelNode* node)
|
1159 | 1166 | } |
1160 | 1167 | |
1161 | 1168 | |
| 1169 | bool |
| 1170 | VariablesView::VariableTableModel::GetToolTipForTablePath( |
| 1171 | const TreeTablePath& path, int32 columnIndex, BToolTip** _tip) |
| 1172 | { |
| 1173 | ModelNode* node = (ModelNode*)NodeForPath(path); |
| 1174 | if (node == NULL) |
| 1175 | return false; |
| 1176 | |
| 1177 | if (node->NodeChild()->LocationResolutionState() != B_OK) |
| 1178 | return false; |
| 1179 | |
| 1180 | ValueLocation* location = node->NodeChild()->Location(); |
| 1181 | BString tipData("Location piece(s):"); |
| 1182 | for (int32 i = 0; i < location->CountPieces(); i++) { |
| 1183 | ValuePieceLocation piece = location->PieceAt(i); |
| 1184 | BString pieceData; |
| 1185 | switch (piece.type) { |
| 1186 | case VALUE_PIECE_LOCATION_MEMORY: |
| 1187 | pieceData.SetToFormat("\n\t(%ld): Address: 0x%llx, Size: " |
| 1188 | "%lld bytes", i, piece.address, piece.size); |
| 1189 | break; |
| 1190 | case VALUE_PIECE_LOCATION_REGISTER: |
| 1191 | { |
| 1192 | Architecture* architecture = fThread->GetTeam()->GetArchitecture(); |
| 1193 | pieceData.SetToFormat("\n\t(%ld): Register (%s)", |
| 1194 | i, architecture->Registers()[piece.reg].Name()); |
| 1195 | |
| 1196 | break; |
| 1197 | } |
| 1198 | default: |
| 1199 | break; |
| 1200 | } |
| 1201 | tipData += pieceData; |
| 1202 | } |
| 1203 | |
| 1204 | *_tip = new(std::nothrow) BTextToolTip(tipData); |
| 1205 | if (*_tip == NULL) |
| 1206 | return false; |
| 1207 | |
| 1208 | return true; |
| 1209 | } |
| 1210 | |
| 1211 | |
1162 | 1212 | status_t |
1163 | 1213 | VariablesView::VariableTableModel::_AddNode(Variable* variable, |
1164 | 1214 | ModelNode* parent, ValueNodeChild* nodeChild, bool isPresentationNode, |
… |
… |
VariablesView::_Init()
|
1734 | 1784 | if (fVariableTableModel->Init() != B_OK) |
1735 | 1785 | throw std::bad_alloc(); |
1736 | 1786 | fVariableTable->SetTreeTableModel(fVariableTableModel); |
| 1787 | fVariableTable->SetToolTipProvider(fVariableTableModel); |
1737 | 1788 | |
1738 | 1789 | fContainerListener = new ContainerListener(this); |
1739 | 1790 | fVariableTableModel->SetContainerListener(fContainerListener); |
diff --git a/src/apps/debugger/value/value_nodes/CompoundValueNode.cpp b/src/apps/debugger/value/value_nodes/CompoundValueNode.cpp
index ee375de..80cec89 100644
a
|
b
|
|
1 | 1 | /* |
| 2 | * Copyright 2012, Rene Gollent, rene@gollent.com. |
2 | 3 | * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. |
3 | 4 | * Distributed under the terms of the MIT License. |
4 | 5 | */ |
… |
… |
|
8 | 9 | |
9 | 10 | #include <new> |
10 | 11 | |
| 12 | #include "AddressValue.h" |
11 | 13 | #include "Architecture.h" |
12 | 14 | #include "IntegerValue.h" |
13 | 15 | #include "Tracing.h" |
… |
… |
CompoundValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
|
186 | 188 | location->AcquireReference(); |
187 | 189 | _location = location; |
188 | 190 | _value = NULL; |
| 191 | if (location->CountPieces() == 1) { |
| 192 | ValuePieceLocation piece = location->PieceAt(0); |
| 193 | if (piece.type == VALUE_PIECE_LOCATION_MEMORY) { |
| 194 | _value = new(std::nothrow) AddressValue(piece.address); |
| 195 | if (_value == NULL) |
| 196 | return B_NO_MEMORY; |
| 197 | } |
| 198 | } |
| 199 | |
189 | 200 | return B_OK; |
190 | 201 | } |
191 | 202 | |