MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / ByteView

Method ByteView

examples/triage/byte.cpp:22–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21
22ByteView::ByteView(QWidget* parent, BinaryViewRef data) : QAbstractScrollArea(parent), m_render(this)
23{
24 setBinaryDataNavigable(true);
25 setupView(this);
26 m_data = data;
27
28 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
29 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
30 setFocusPolicy(Qt::StrongFocus);
31
32 m_cursorAddr = m_data->GetStart();
33 m_prevCursorAddr = m_cursorAddr;
34 m_selectionStartAddr = m_cursorAddr;
35 m_topAddr = m_cursorAddr;
36 m_topLine = 0;
37 m_selectionVisible = false;
38 m_caretVisible = false;
39 m_caretBlink = true;
40 m_cols = 128;
41 m_updatesRequired = false;
42 m_visibleRows = 1;
43
44 updateRanges();
45
46 QSize areaSize = viewport()->size();
47 adjustSize(areaSize.width(), areaSize.height());
48
49 if (m_allocatedLength > 0x7fffffff)
50 m_scrollBarMultiplier = (m_allocatedLength / 0x7fffffff) + 1;
51 else
52 m_scrollBarMultiplier = 1;
53 m_wheelDelta = 0;
54 m_updatingScrollBar = false;
55 verticalScrollBar()->setRange(0, (int)((m_allocatedLength - 1) / m_scrollBarMultiplier));
56 connect(verticalScrollBar(), &QScrollBar::sliderMoved, this, &ByteView::scrollBarMoved);
57 connect(verticalScrollBar(), &QScrollBar::actionTriggered, this, &ByteView::scrollBarAction);
58
59 m_cursorTimer = new QTimer(this);
60 m_cursorTimer->setInterval(500);
61 m_cursorTimer->setSingleShot(false);
62 connect(m_cursorTimer, &QTimer::timeout, this, &ByteView::cursorTimerEvent);
63 m_cursorTimer->start();
64
65 m_updateTimer = new QTimer(this);
66 m_updateTimer->setInterval(200);
67 m_updateTimer->setSingleShot(false);
68 // connect(m_updateTimer, &QTimer::timeout, this, &ByteView::updateTimerEvent);
69
70 actionHandler()->bindAction("Move Cursor Up", UIAction([=]() { up(false); }));
71 actionHandler()->bindAction("Move Cursor Down", UIAction([=]() { down(false); }));
72 actionHandler()->bindAction("Move Cursor Left", UIAction([=]() { left(1, false); }));
73 actionHandler()->bindAction("Move Cursor Right", UIAction([=]() { right(1, false); }));
74 actionHandler()->bindAction("Move Cursor Word Left", UIAction([=]() { left(8, false); }));
75 actionHandler()->bindAction("Move Cursor Word Right", UIAction([=]() { right(8, false); }));
76 actionHandler()->bindAction("Extend Selection Up", UIAction([=]() { up(true); }));
77 actionHandler()->bindAction("Extend Selection Down", UIAction([=]() { down(true); }));
78 actionHandler()->bindAction("Extend Selection Left", UIAction([=]() { left(1, true); }));
79 actionHandler()->bindAction("Extend Selection Right", UIAction([=]() { right(1, true); }));

Callers 1

__init__Method · 0.80

Calls 11

setBinaryDataNavigableFunction · 0.85
viewportFunction · 0.85
connectFunction · 0.85
leftFunction · 0.85
rightFunction · 0.85
actionHandlerFunction · 0.50
GetStartMethod · 0.45
sizeMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected