| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 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 |
|
| 40 |
|
| 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 |
}; |