39 #ifndef __OPENFLUID_UIWARESDEV_WARESRCFILEEDITOR_HPP__ 40 #define __OPENFLUID_UIWARESDEV_WARESRCFILEEDITOR_HPP__ 43 #include <QPlainTextEdit> 45 #include <QSignalMapper> 51 #include <openfluid/ui/config.hpp> 54 namespace openfluid {
namespace ui {
namespace waresdev {
57 class WareSrcSyntaxHighlighter;
66 void updateLineNumberAreaWidth();
68 void highlightCurrentLine();
70 void updateLineNumberArea(
const QRect& Rect,
int);
72 void onChanged(
bool Changed);
74 void onInsertRequested(
const QString& Str);
76 void insertCompletion();
78 void onCompletionPopupCurrentRowChanged(
const QModelIndex &Current,
const QModelIndex& Previous);
88 QStringList m_ContentList;
90 QColor Red = QColor(openfluid::ui::config::LINEMARKER_ERRCOLOR);
91 QColor Orange = QColor(openfluid::ui::config::LINEMARKER_WARNCOLOR);
98 m_MajorMarkerType(MsgType)
100 QString Cleared = Content.trimmed();
101 if (!Cleared.isEmpty())
102 m_ContentList.append(Cleared);
110 QColor getColor()
const 122 QString getContent()
const 124 if (m_ContentList.isEmpty())
127 if (m_ContentList.size() == 1)
128 return QString(
"<html>%1</html>").arg(m_ContentList[0]);
130 return QString(
"• %1").arg(m_ContentList.join(
"<br/>• "));
141 m_MajorMarkerType = MsgType;
143 m_ContentList.append(Content.trimmed());
149 QRegExp m_SelectionTagsRegExp;
150 QRegExp m_AllTagsRegExp;
151 QRegExp m_WordPartRegExp;
153 QWidget* mp_LineNumberArea;
156 QColor m_LineNbAreaColor = QColor(
"#F8F8FF");
157 QColor m_LineNbTextColor = QColor(
"#999999");
159 QString m_IndentString;
161 int m_SpaceCharWidth;
165 QSignalMapper* mp_SignalMapper;
167 QMap<QString, QMenu*> m_InsertionMenus;
169 QCompleter* mp_Completer;
171 QMap<QTextBlock, LineMarker> m_LineMarkersByBlock;
173 bool m_ShowLineMarkers =
true;
175 void writeString(
const QString& Str,
int InitialIndentInSpaceNb);
177 void insertNewLine();
179 bool findString(
const QString& StringToFind, QTextDocument::FindFlags Options);
181 bool replaceString(
const QString& StringToFind,
const QString& StringForReplace, Qt::CaseSensitivity Cs);
186 void resizeEvent(QResizeEvent* Event);
188 void contextMenuEvent(QContextMenuEvent* Event);
190 void keyPressEvent(QKeyEvent* Event);
202 void setShowLineMarkers(
bool ShowMarkers);
211 void lineNumberAreaPaintEvent(QPaintEvent* Event);
213 int lineNumberAreaWidth();
217 void saveContentToPath(
const QString& Path);
219 void updateContent();
222 const QString& StringForReplace, QTextDocument::FindFlags Options, QString& Message);
224 QString getSelectedText();
226 void clearLineMessages();
230 void updateLineNumberArea();
232 void tooltipEvent(
const QPoint& Position);
234 void selectLine(
int LineNumber);
236 bool getShowLineMarkers();
240 void updateSettings();
244 QWidget* getWidget();
269 QAction* mp_ShowMarkersAction = 0;
286 if (Event->type() == QEvent::ToolTip)
288 QHelpEvent* HelpEvent =
static_cast<QHelpEvent*
>(Event);
291 return QWidget::event(Event);
303 QMenu* Menu =
new QMenu();
304 Menu->addAction(mp_ShowMarkersAction);
305 Menu->exec(Event->globalPos());
315 setStyleSheet(
"QToolTip {min-width:300px;}");
319 mp_ShowMarkersAction =
new QAction(
"Show markers",
this);
320 mp_ShowMarkersAction->setCheckable(
true);
322 connect(mp_ShowMarkersAction, SIGNAL(triggered(
bool)), mp_Editor, SLOT(setShowLineMarkers(
bool)));
QVector< CompletionRule > CompletionRules_t
Definition: WareSrcFiletypeManager.hpp:117
Definition: WareSrcSyntaxHighlighter.hpp:54
void lineNumberAreaPaintEvent(QPaintEvent *Event)
Definition: WareSrcFileEditor.hpp:59
MessageType
Definition: WareSrcMsgParser.hpp:62
Definition: WareSrcFileEditor.hpp:261
FindReplaceAction
Definition: FindReplaceDialog.hpp:67
LineNumberArea(WareSrcFileEditor *Editor)
Definition: WareSrcFileEditor.hpp:312
bool getShowLineMarkers()
Definition: ApplicationException.hpp:47
void tooltipEvent(const QPoint &Position)
void contextMenuEvent(QContextMenuEvent *Event)
Definition: WareSrcFileEditor.hpp:299
bool event(QEvent *Event)
Definition: WareSrcFileEditor.hpp:284
Definition: WareFileEditor.hpp:54
int lineNumberAreaWidth()
QSize sizeHint() const
Definition: WareSrcFileEditor.hpp:330
#define OPENFLUID_API
Definition: dllexport.hpp:86
Definition: WareSrcMsgParser.hpp:58
void paintEvent(QPaintEvent *Event)
Definition: WareSrcFileEditor.hpp:274