39 #ifndef __OPENFLUID_UIWARESDEV_WARESRCFILEEDITOR_HPP__
40 #define __OPENFLUID_UIWARESDEV_WARESRCFILEEDITOR_HPP__
44 #include <QPlainTextEdit>
46 #include <QSignalMapper>
52 #include <openfluid/ui/config.hpp>
55 namespace openfluid {
namespace ui {
namespace waresdev {
57 class WareSrcSyntaxHighlighter;
70 QStringList m_ContentList;
72 QColor Red = QColor(openfluid::ui::config::LINEMARKER_ERRCOLOR);
73 QColor Orange = QColor(openfluid::ui::config::LINEMARKER_WARNCOLOR);
80 m_MajorMarkerType(MsgType)
82 QString Cleared = Content.trimmed();
83 if (!Cleared.isEmpty())
84 m_ContentList.append(Cleared);
92 QColor getColor()
const
104 QString getContent()
const
106 if (m_ContentList.isEmpty())
109 if (m_ContentList.size() == 1)
110 return QString(
"<html>%1</html>").arg(m_ContentList[0]);
112 return QString(
"• %1").arg(m_ContentList.join(
"<br/>• "));
123 m_MajorMarkerType = MsgType;
125 m_ContentList.append(Content.trimmed());
133 QRegExp m_SelectionTagsRegExp;
134 QRegExp m_AllTagsRegExp;
135 QRegExp m_WordPartRegExp;
137 QWidget* mp_LineNumberArea;
140 QColor m_LineNbAreaColor = QColor(
"#F8F8FF");
141 QColor m_LineNbTextColor = QColor(
"#999999");
143 QString m_IndentString;
145 int m_SpaceCharWidth;
149 QSignalMapper* mp_SignalMapper;
151 QMap<QString, QMenu*> m_InsertionMenus;
153 QCompleter* mp_Completer;
155 QMap<QTextBlock, LineMarker> m_LineMarkersByBlock;
157 bool m_ShowLineMarkers =
true;
159 void writeString(
const QString& Str,
int InitialIndentInSpaceNb);
161 void insertNewLine();
163 bool findString(
const QString& StringToFind, QTextDocument::FindFlags Options);
165 bool replaceString(
const QString& StringToFind,
const QString& StringForReplace, Qt::CaseSensitivity Cs);
170 void updateLineNumberAreaWidth();
172 void highlightCurrentLine();
174 void updateLineNumberArea(
const QRect& Rect,
int);
176 void onChanged(
bool Changed);
178 void onInsertRequested(
const QString& Str);
180 void insertCompletion();
182 void onCompletionPopupCurrentRowChanged(
const QModelIndex &Current,
const QModelIndex& Previous);
187 void resizeEvent(QResizeEvent* Event);
189 void contextMenuEvent(QContextMenuEvent* Event);
191 void keyPressEvent(QKeyEvent* Event);
200 void lineNumberAreaPaintEvent(QPaintEvent* Event);
202 int lineNumberAreaWidth();
204 QString getFilePath();
208 void saveContentToPath(
const QString& Path);
210 void updateContent();
213 const QString& StringForReplace, QTextDocument::FindFlags Options, QString& Message);
215 QString getSelectedText();
217 void clearLineMessages();
221 void updateLineNumberArea();
223 void tooltipEvent(
const QPoint& Position);
225 void selectLine(
int LineNumber);
227 bool getShowLineMarkers();
231 void updateSettings();
235 void setShowLineMarkers(
bool ShowMarkers);
259 QAction* mp_ShowMarkersAction = 0;
276 if (Event->type() == QEvent::ToolTip)
278 QHelpEvent* HelpEvent =
static_cast<QHelpEvent*
>(Event);
281 return QWidget::event(Event);
293 QMenu* Menu =
new QMenu();
294 Menu->addAction(mp_ShowMarkersAction);
295 Menu->exec(Event->globalPos());
305 setStyleSheet(
"QToolTip {min-width:300px;}");
309 mp_ShowMarkersAction =
new QAction(
"Show markers",
this);
310 mp_ShowMarkersAction->setCheckable(
true);
312 connect(mp_ShowMarkersAction, SIGNAL(triggered(
bool)), mp_Editor, SLOT(setShowLineMarkers(
bool)));
void paintEvent(QPaintEvent *Event)
Definition: WareSrcFileEditor.hpp:264
Definition: WareSrcFileEditor.hpp:251
LineNumberArea(WareSrcFileEditor *Editor)
Definition: WareSrcFileEditor.hpp:302
Definition: WareSrcMsgParser.hpp:61
QVector< CompletionRule > CompletionRules_t
Definition: WareSrcFiletypeManager.hpp:104
void lineNumberAreaPaintEvent(QPaintEvent *Event)
int lineNumberAreaWidth()
QSize sizeHint() const
Definition: WareSrcFileEditor.hpp:320
Definition: WareSrcMsgParser.hpp:67
MessageType
Definition: WareSrcMsgParser.hpp:65
bool event(QEvent *Event)
Definition: WareSrcFileEditor.hpp:274
Definition: WareSrcSyntaxHighlighter.hpp:53
void contextMenuEvent(QContextMenuEvent *Event)
Definition: WareSrcFileEditor.hpp:289
FindReplaceAction
Definition: FindReplaceDialog.hpp:61
Definition: WareSrcFileEditor.hpp:59
void tooltipEvent(const QPoint &Position)
#define OPENFLUID_API
Definition: dllexport.hpp:87
bool getShowLineMarkers()