2017-12-06 23:19:14 +00:00
|
|
|
#ifndef PSEUDOCODEWIDGET_H
|
|
|
|
#define PSEUDOCODEWIDGET_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
2019-02-22 16:50:45 +00:00
|
|
|
#include "core/Cutter.h"
|
2019-03-27 08:24:54 +00:00
|
|
|
#include "MemoryDockWidget.h"
|
2017-12-06 23:19:14 +00:00
|
|
|
|
2018-03-21 20:32:32 +00:00
|
|
|
namespace Ui {
|
|
|
|
class PseudocodeWidget;
|
2017-12-21 14:23:44 +00:00
|
|
|
}
|
2017-12-15 10:52:47 +00:00
|
|
|
|
|
|
|
class QTextEdit;
|
2019-07-11 13:21:54 +00:00
|
|
|
class QSyntaxHighlighter;
|
2019-07-12 08:57:07 +00:00
|
|
|
class QTextCursor;
|
|
|
|
struct DecompiledCodeTextLine;
|
2017-12-06 23:19:14 +00:00
|
|
|
|
2019-03-27 08:24:54 +00:00
|
|
|
class PseudocodeWidget : public MemoryDockWidget
|
2017-12-06 23:19:14 +00:00
|
|
|
{
|
2018-03-21 20:32:32 +00:00
|
|
|
Q_OBJECT
|
2017-12-06 23:19:14 +00:00
|
|
|
|
|
|
|
public:
|
2018-03-16 21:46:57 +00:00
|
|
|
explicit PseudocodeWidget(MainWindow *main, QAction *action = nullptr);
|
2017-12-06 23:19:14 +00:00
|
|
|
~PseudocodeWidget();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void fontsUpdated();
|
|
|
|
void colorsUpdatedSlot();
|
|
|
|
void refreshPseudocode();
|
2019-07-12 08:57:07 +00:00
|
|
|
void cursorPositionChanged();
|
|
|
|
void seekChanged();
|
2017-12-15 10:52:47 +00:00
|
|
|
|
|
|
|
private:
|
2018-09-08 07:12:08 +00:00
|
|
|
enum DecompilerComboBoxValues { DecompilerCBR2Dec, DecompilerCBPdc };
|
2017-12-21 14:23:44 +00:00
|
|
|
std::unique_ptr<Ui::PseudocodeWidget> ui;
|
|
|
|
|
2019-07-11 13:21:54 +00:00
|
|
|
QSyntaxHighlighter *syntaxHighlighter;
|
2017-12-21 14:23:44 +00:00
|
|
|
|
2019-07-12 08:57:07 +00:00
|
|
|
/**
|
|
|
|
* Index of all lines that are currently displayed, ordered by the position in the text
|
|
|
|
*/
|
|
|
|
QList<DecompiledCodeTextLine> textLines;
|
|
|
|
|
|
|
|
bool seekFromCursor = false;
|
|
|
|
|
2019-01-12 17:02:51 +00:00
|
|
|
void doRefresh(RVA addr);
|
2017-12-15 10:52:47 +00:00
|
|
|
void setupFonts();
|
2019-07-12 08:57:07 +00:00
|
|
|
void updateSelection();
|
|
|
|
void connectCursorPositionChanged(bool disconnect);
|
|
|
|
void updateCursorPosition();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Iterator to the first line that is after position or last if not found.
|
|
|
|
*/
|
|
|
|
QList<DecompiledCodeTextLine>::iterator findLine(int position);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Iterator to the first line that is considered to contain offset
|
|
|
|
*/
|
|
|
|
QList<DecompiledCodeTextLine>::iterator findLineByOffset(RVA offset);
|
|
|
|
RVA getOffsetAtLine(const QTextCursor &tc);
|
2019-06-18 13:02:41 +00:00
|
|
|
|
|
|
|
QString getWindowTitle() const override;
|
2017-12-06 23:19:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PSEUDOCODEWIDGET_H
|