-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContentTableViewer.h
More file actions
113 lines (83 loc) · 2.5 KB
/
ContentTableViewer.h
File metadata and controls
113 lines (83 loc) · 2.5 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#pragma once
#include <gtkmm.h>
#include <vector>
#include "libInfinite/ContentTable.h"
#include "libInfinite/Item.h"
#include "ViewerUtils.h"
class ContentTableViewer : public Gtk::Box{
public:
ContentTableViewer();
~ContentTableViewer();
void setItem(Item* item);
void setShowDataCallback(std::function<void(int)> callback);
private:
// start easily copyable code
Gtk::Frame* viewFrame;
Gtk::ScrolledWindow* scroller;
Gtk::TreeView* view;
Glib::RefPtr<Gtk::TreeStore> store;
// Columns
Gtk::TreeViewColumn* TypeViewColumn;
Gtk::TreeViewColumn* TypeIDViewColumn;
Gtk::TreeViewColumn* IsExternalViewColumn;
Gtk::TreeViewColumn* RefViewColumn;
Gtk::TreeViewColumn* RefSizeViewColumn;
Gtk::TreeViewColumn* ParentViewColumn;
Gtk::TreeViewColumn* FieldOffsetViewColumn;
Gtk::CellRendererText typeRenderer;
// Columns for the TreeStore
Gtk::TreeModelColumn<std::string> TypeColumn;
Gtk::TreeModelColumn<std::string> TypeIDColumn;
Gtk::TreeModelColumn<std::string> IsExternalColumn;
Gtk::TreeModelColumn<std::string> RefColumn;
Gtk::TreeModelColumn<std::string> RefSizeColumn;
Gtk::TreeModelColumn<std::string> ParentColumn;
Gtk::TreeModelColumn<std::string> FieldOffsetColumn;
Gtk::TreeModelColumn<uint32_t> IndexColumn;
Item* item;
enum{
TYPE_COLUMN,
TYPE_ID_COLUMN,
IS_EXTERNAL_COLUMN,
REF_COLUMN,
REF_SIZE_COLUMN,
PARENT_COLUMN,
FIELD_OFFET_COLUMN,
N_COLUMNS
};
// end easily copyable code
Gtk::Separator* settingsSeparator;
Gtk::Box* settingsBox; // contain the different settings for the viewer
Gtk::Label* settingsLabel;
Gtk::ComboBoxText* typeDisplayModeBox; // how the 'type' field is displayed
Gtk::Label* typeDisplayModeLabel;
Gtk::Box OffsetBox;
Gtk::Label Label0x;
Gtk::Entry OffsetEntry;
Gtk::Button SearchOffsetButton;
Gtk::RadioButton StartOffsetCheckButton;
Gtk::RadioButton TagOffsetCheckButton;
enum{
MODE_GUID,
MODE_HEXL,
MODE_HEXB,
MODE_PYTHON
};
int typeMode;
std::function<void(int)> showDataCallback;
// stuff for data storage/data handling
class TreeEntry{
public:
std::vector<TreeEntry*> children;
int idx; // index of this entry in the Content Table
bool hasParent;
};
std::vector<TreeEntry*> tree;
std::string getTypeString(TypeGUID type);
void generateTree(bool tree);
void deleteTree(); // clean up the tree
void deleteTreeRecursive(TreeEntry* entry);
void fillStore();
void fillStoreRecursive(ContentTableEntry* entry, Gtk::TreeStore::iterator iter);
bool findOffset(uint32_t off,Gtk::TreeStore::iterator iter);
};