2014-06-07 19:42:41 +04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QWheelEvent>
|
|
|
|
#include <QScrollBar>
|
|
|
|
#include <QTextEdit>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include "highlighter.h"
|
|
|
|
#include "editor.h"
|
|
|
|
|
2014-06-07 19:22:14 +04:00
|
|
|
class LegacyEditor : public EditorInterface
|
2014-06-07 19:42:41 +04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
LegacyEditor(QWidget *parent);
|
|
|
|
~LegacyEditor();
|
|
|
|
QTextEdit *textedit;
|
|
|
|
QSize sizeHint() const;
|
2014-06-19 21:23:00 +04:00
|
|
|
void setInitialSizeHint(const QSize&);
|
|
|
|
void setTabStopWidth(int);
|
|
|
|
void wheelEvent (QWheelEvent*);
|
2014-06-07 19:42:41 +04:00
|
|
|
QString toPlainText();
|
|
|
|
QTextCursor textCursor() const;
|
2014-06-19 21:23:00 +04:00
|
|
|
void setTextCursor (const QTextCursor&);
|
2014-06-07 19:42:41 +04:00
|
|
|
QTextDocument *document() { return textedit->document(); }
|
2014-08-14 02:52:01 +04:00
|
|
|
bool find(const QString &, bool findNext = false, bool findBackwards = false);
|
2014-08-13 19:59:56 +04:00
|
|
|
void replaceSelectedText(QString& newText);
|
2014-08-14 02:52:01 +04:00
|
|
|
bool findString(const QString & exp, bool findBackwards) const;
|
2014-08-15 12:43:58 +04:00
|
|
|
|
2014-06-07 19:42:41 +04:00
|
|
|
public slots:
|
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
|
|
|
void setLineWrapping(bool on) { if(on) textedit->setWordWrapMode(QTextOption::WrapAnywhere); }
|
|
|
|
void setContentModified(bool y) { textedit->document()->setModified(y); }
|
|
|
|
bool isContentModified() {return textedit->document()->isModified();}
|
|
|
|
void indentSelection();
|
|
|
|
void unindentSelection();
|
|
|
|
void commentSelection();
|
|
|
|
void uncommentSelection();
|
2014-06-19 21:23:00 +04:00
|
|
|
void setPlainText(const QString&);
|
|
|
|
void highlightError(int);
|
2014-06-07 19:42:41 +04:00
|
|
|
void unhighlightLastError();
|
2014-06-19 21:23:00 +04:00
|
|
|
void setHighlightScheme(const QString&);
|
|
|
|
void insertPlainText(const QString&);
|
2014-06-07 19:42:41 +04:00
|
|
|
void undo();
|
|
|
|
void redo();
|
|
|
|
void cut();
|
|
|
|
void copy();
|
|
|
|
void paste();
|
2014-08-15 12:43:58 +04:00
|
|
|
void initFont(const QString&, uint);
|
2014-06-07 19:42:41 +04:00
|
|
|
private:
|
|
|
|
Highlighter *highlighter;
|
|
|
|
QSize initialSizeHint;
|
|
|
|
QVBoxLayout *legacyeditorLayout;
|
|
|
|
};
|