-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathinterfacedisasm.cpp
34 lines (27 loc) · 1.31 KB
/
interfacedisasm.cpp
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
#include "interfacedisasm.h"
InterfaceDisasm::InterfaceDisasm(QPlainTextEdit* _screen)
{
screen=_screen;
current_cursor = _screen->textCursor();
current_cursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); // moves the cursor to the top
screen->setTextCursor(current_cursor); //sets the pain text edit cursor to the top
}
void InterfaceDisasm::HighLighLine(QString addr)
{
screen->setTextCursor(current_cursor);
screen->find(addr); //finds addr string now cursor should be on the found line
current_cursor = screen->textCursor();
QList<QTextEdit::ExtraSelection> Extra_selections; //create extra selections
QTextEdit::ExtraSelection selection; //selection
QColor line_color = QColor(Qt::cyan).darker(200);
selection.format.setBackground(line_color);
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
selection.cursor = current_cursor;
selection.cursor.clearSelection();
Extra_selections.append(selection);
screen->setExtraSelections(Extra_selections); //formats selection stuff and applies to the current_cursor
}
void InterfaceDisasm::ToTop(){
current_cursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); // moves the cursor to the top
screen->setTextCursor(current_cursor); //sets the pain text edit cursor to the top
}