Debian Codegraph @

modules/objectdb_profiler/editor/data_viewers/node_view.h

raw symbols SCIP
1 /**************************************************************************/
2 /* node_view.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #pragma once
32
33 #include "../snapshot_data.h"
34 #include "shared_controls.h"
35 #include "snapshot_view.h"
36
37 class Tree;
38
39 // When diffing in split view, we have two trees/filters
40 // so this struct is used to group their properties together.
41 struct NodeTreeElements {
42 NodeTreeElements() {
43 tree = nullptr;
44 filter_bar = nullptr;
45 root = nullptr;
46 }
47 Tree *tree = nullptr;
48 TreeSortAndFilterBar *filter_bar = nullptr;
49 VBoxContainer *root = nullptr;
50 };
51
52 class SnapshotNodeView : public SnapshotView {
53 GDCLASS(SnapshotNodeView, SnapshotView);
54
55 enum DiffGroup {
56 DIFF_GROUP_NONE,
57 DIFF_GROUP_ADDED,
58 DIFF_GROUP_REMOVED
59 };
60
61 NodeTreeElements main_tree;
62 NodeTreeElements diff_tree;
63 Tree *active_tree = nullptr;
64 PopupMenu *choose_object_menu = nullptr;
65 bool combined_diff_view = true;
66 HashMap<TreeItem *, LocalVector<SnapshotDataObject *>> tree_item_data;
67
68 void _node_selected(Tree *p_tree_selected_from);
69 void _notification(int p_what);
70 NodeTreeElements _make_node_tree(const String &p_tree_name);
71 void _apply_filters();
72 void _refresh_icons();
73 void _toggle_diff_mode(bool p_state);
74 void _choose_object_pressed(int p_object_idx, bool p_confirm_override);
75 void _show_choose_object_menu();
76
77 void _add_snapshot_to_tree(Tree *p_tree, GameStateSnapshot *p_snapshot, DiffGroup p_diff_group = DIFF_GROUP_NONE);
78 void _add_children_to_tree(TreeItem *p_parent_item, SnapshotDataObject *p_data, DiffGroup p_diff_group = DIFF_GROUP_NONE);
79 TreeItem *_add_item_to_tree(Tree *p_tree, TreeItem *p_parent, const String &p_item_name, DiffGroup p_diff_group = DIFF_GROUP_NONE);
80 TreeItem *_add_item_to_tree(Tree *p_tree, TreeItem *p_parent, SnapshotDataObject *p_data, DiffGroup p_diff_group = DIFF_GROUP_NONE);
81
82 public:
83 SnapshotNodeView();
84 virtual void show_snapshot(GameStateSnapshot *p_data, GameStateSnapshot *p_diff_data) override;
85 virtual void clear_snapshot() override;
86 };