39 #ifndef __OPENFLUID_UIWARESDEV_WARESRCFILEEDITOR_HPP__ 40 #define __OPENFLUID_UIWARESDEV_WARESRCFILEEDITOR_HPP__ 43 #include <QPlainTextEdit> 45 #include <QSignalMapper> 52 #include <openfluid/ui/config.hpp> 55 namespace openfluid {
namespace ui {
namespace waresdev {
58 class WareSrcSyntaxHighlighter;
68 void updateLineNumberAreaWidth();
70 void highlightCurrentLine();
72 void updateLineNumberArea(
const QRect& Rect,
int);
74 void onChanged(
bool Changed);
76 void onInsertRequested(
const QString& Str);
78 void insertCompletion();
80 void onCompletionPopupCurrentRowChanged(
const QModelIndex &Current,
const QModelIndex& Previous);
90 QStringList m_ContentList;
92 QColor Red = QColor(openfluid::ui::config::LINEMARKER_ERRCOLOR);
93 QColor Orange = QColor(openfluid::ui::config::LINEMARKER_WARNCOLOR);
100 m_MajorMarkerType(MsgType)
102 QString Cleared = Content.trimmed();
103 if (!Cleared.isEmpty())
105 m_ContentList.append(Cleared);
114 QColor getColor()
const 128 QString getContent()
const 130 if (m_ContentList.isEmpty())
135 if (m_ContentList.size() == 1)
137 return QString(
"<html>%1</html>").arg(m_ContentList[0]);
140 return QString(
"• %1").arg(m_ContentList.join(
"<br/>• "));
152 m_MajorMarkerType = MsgType;
155 m_ContentList.append(Content.trimmed());
161 QRegExp m_SelectionTagsRegExp;
162 QRegExp m_AllTagsRegExp;
163 QRegExp m_WordPartRegExp;
165 QWidget* mp_LineNumberArea;
168 QColor m_LineNbAreaColor = QColor(
"#F8F8FF");
169 QColor m_LineNbTextColor = QColor(
"#999999");
171 QString m_IndentString;
173 int m_SpaceCharWidth;
177 QSignalMapper* mp_SignalMapper;
179 QMap<QString, QMenu*> m_InsertionMenus;
181 QCompleter* mp_Completer;
183 QMap<QTextBlock, LineMarker> m_LineMarkersByBlock;
185 bool m_ShowLineMarkers =
true;
187 void writeString(
const QString& Str,
int InitialIndentInSpaceNb);
189 void insertNewLine();
191 bool findString(
const QString& StringToFind, QTextDocument::FindFlags Options);
193 bool replaceString(
const QString& StringToFind,
const QString& StringForReplace, Qt::CaseSensitivity Cs);
198 void resizeEvent(QResizeEvent* Event);
200 void contextMenuEvent(QContextMenuEvent* Event);
202 void keyPressEvent(QKeyEvent* Event);
214 void setShowLineMarkers(
bool ShowMarkers);
223 void lineNumberAreaPaintEvent(QPaintEvent* Event);
225 int lineNumberAreaWidth();
229 void saveContentToPath(
const QString& Path);
231 void updateContent();
234 const QString& StringForReplace, QTextDocument::FindFlags Options, QString& Message);
236 QString getSelectedText();
238 void clearLineMessages();
242 void updateLineNumberArea();
244 void tooltipEvent(
const QPoint& Position);
246 void selectLine(
int LineNumber);
248 bool getShowLineMarkers();
252 void updateSettings();
256 QWidget* getWidget();
281 QAction* mp_ShowMarkersAction =
nullptr;
298 if (Event->type() == QEvent::ToolTip)
300 QHelpEvent* HelpEvent =
static_cast<QHelpEvent*
>(Event);
303 return QWidget::event(Event);
315 QMenu* Menu =
new QMenu();
316 Menu->addAction(mp_ShowMarkersAction);
317 Menu->exec(Event->globalPos());
327 setStyleSheet(
"QToolTip {min-width:300px;}");
331 mp_ShowMarkersAction =
new QAction(
"Show markers",
this);
332 mp_ShowMarkersAction->setCheckable(
true);
334 connect(mp_ShowMarkersAction, SIGNAL(triggered(
bool)), mp_Editor, SLOT(setShowLineMarkers(
bool)));
QVector< Rule > Rules
Definition: CompletionProvider.hpp:108
Definition: WareSrcFileEditor.hpp:61
Definition: ApplicationException.hpp:47
bool event(QEvent *Event)
Definition: WareSrcFileEditor.hpp:296
Definition: WareSrcFileEditor.hpp:273
Definition: WareSrcSyntaxHighlighter.hpp:54
void lineNumberAreaPaintEvent(QPaintEvent *Event)
Definition: WareSrcMsgParser.hpp:58
Definition: WareFileEditor.hpp:54
void paintEvent(QPaintEvent *Event)
Definition: WareSrcFileEditor.hpp:286
MessageType
Definition: WareSrcMsgParser.hpp:62
bool getShowLineMarkers()
FindReplaceAction
Definition: FindReplaceDialog.hpp:67
LineNumberArea(WareSrcFileEditor *Editor)
Definition: WareSrcFileEditor.hpp:324
void tooltipEvent(const QPoint &Position)
#define OPENFLUID_API
Definition: dllexport.hpp:86
void contextMenuEvent(QContextMenuEvent *Event)
Definition: WareSrcFileEditor.hpp:311
QSize sizeHint() const
Definition: WareSrcFileEditor.hpp:342
int lineNumberAreaWidth()