1 /****************************************************************************
2 **
3 ** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
4 **
5 ** This file is part of the Edyuk project <http://edyuk.org>
6 **
7 ** This file may be used under the terms of the GNU General Public License
8 ** version 3 as published by the Free Software Foundation and appearing in the
9 ** file GPL.txt included in the packaging of this file.
10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 **
14 ****************************************************************************/
15
16 #ifndef Header_QEditor
17 #define Header_QEditor
18
19 #include "mostQtHeaders.h"
20
21 #include "qce-config.h"
22
23 /*!
24 \file qeditor.h
25 \brief Definition of the QEditor class
26 */
27
28 #include "qdocument.h"
29 #include "qdocumentcursor.h"
30
31 #ifdef _QMDI_
32 #include "qmdiclient.h"
33 #endif
34
35 class QMenu;
36 class QAction;
37 class QMimeData;
38 class QTextCodec;
39 class QActionGroup;
40
41 class QPropertyAnimation;
42
43 class QReliableFileWatch;
44
45 class QDocumentLineHandle;
46
47 class QLanguageDefinition;
48 class QCodeCompletionEngine;
49
50 class QEditorInputBindingInterface;
51
52 class QCE_EXPORT QEditor : public QAbstractScrollArea
53 #ifdef _QMDI_
54 , public qmdiClient
55 #endif
56 {
57 friend class QEditConfig;
58 friend class QEditorFactory;
59
60 Q_OBJECT
61
62 public:
63 enum CodecUpdatePolicy
64 {
65 NoUpdate = 0,
66 UpdateOld = 1,
67 UpdateDefault = 2,
68 UpdateCustom = 4,
69
70 UpdateAll = 7
71 };
72
73 enum EditFlag
74 {
75 None = 0,
76
77 Overwrite = 0x01,
78 CursorOn = 0x02,
79 ReadOnly = 0x04,
80 MousePressed = 0x08,
81 MaybeDrag = 0x10,
82 Selection = 0x20,
83 EnsureVisible = 0x40,
84
85 Internal = 0x000000ff,
86
87 LineWrap = 0x00000100,
88 HardLineWrap = 0x00000200,
89 LineWidthConstraint = 0x00000400,
90
91 AllowDragAndDrop = 0x00000800,
92
93 CtrlNavigation = 0x00001000,
94 CursorJumpPastWrap = 0x00002000,
95
96 SmoothScrolling = 0x00004000,
97 MouseWheelZoom = 0x00008000,
98 VerticalOverScroll = 0x04000000,
99
100 ReplaceIndentTabs = 0x00010000,
101 ReplaceTextTabs = 0x00020000,
102 RemoveTrailing = 0x00040000,
103 PreserveTrailingIndent = 0x00080000,
104 AdjustIndent = 0x00100000,
105
106 AutoCloseChars = 0x00200000,
107 AutoIndent = 0x00400000,
108 WeakIndent = 0x00800000,
109 AutoInsertLRM = 0x01000000,
110 BidiVisualColumnMode= 0x02000000,
111
112 ShowPlaceholders = 0x10000000,
113 OverwriteOpeningBracketFollowedByPlaceholder = 0x20000000,
114 OverwriteClosingBracketFollowingPlaceholder = 0x40000000,
115
116 Accessible = 0xffffff00
117 };
118 Q_DECLARE_FLAGS(State, EditFlag)
119
120 enum EditOperation{
121 NoOperation = 0,
122 Invalid = -1,
123
124 EnumForCursorStart = 0x1000,
125
126 CursorUp,
127 CursorDown,
128 CursorLeft,
129 CursorRight,
130 CursorWordLeft,
131 CursorWordRight,
132 CursorStartOfLine,
133 CursorEndOfLine,
134 CursorStartOfDocument,
135 CursorEndOfDocument,
136
137 CursorPageUp,
138 CursorPageDown,
139
140 EnumForSelectionStart = 0x2000,
141
142 SelectCursorUp,
143 SelectCursorDown,
144 SelectCursorLeft,
145 SelectCursorRight,
146 SelectCursorWordLeft,
147 SelectCursorWordRight,
148 SelectCursorStartOfLine,
149 SelectCursorEndOfLine,
150 SelectCursorStartOfDocument,
151 SelectCursorEndOfDocument,
152
153 SelectPageUp,
154 SelectPageDown,
155
156 EnumForCursorEnd = 0x3000,
157
158 DeleteLeft,
159 DeleteRight,
160 DeleteLeftWord,
161 DeleteRightWord,
162 NewLine,
163
164 ChangeOverwrite = 0x4000,
165 Undo,
166 Redo,
167 Copy,
168 Paste,
169 Cut,
170 Print,
171 SelectAll,
172 Find,
173 FindNext,
174 FindPrevious,
175 Replace,
176
177 CreateMirrorUp = 0x5000,
178 CreateMirrorDown,
179 NextPlaceHolder,
180 PreviousPlaceHolder,
181 NextPlaceHolderOrWord,
182 PreviousPlaceHolderOrWord,
183 TabOrIndentSelection,
184 InsertTab,
185 IndentSelection,
186 UnindentSelection,
187 NextPlaceHolderOrChar,
188 PreviousPlaceHolderOrChar
189 };
190
191 enum MoveFlagsEnum {
192 NoFlags = 0x0000,
193 Animated = 0x0001,
194 KeepSurrounding = 0x0002,
195 ExpandFold = 0x0004,
196 AllowScrollToTop = 0x0008,
197
198 // semantic abbreviations
199 Navigation = Animated | KeepSurrounding | ExpandFold,
200 NavigationToHeader = Animated | KeepSurrounding | ExpandFold | AllowScrollToTop,
201
202 KeepDistanceFromViewTop = 0x1000
203 };
204 Q_DECLARE_FLAGS(MoveFlags, MoveFlagsEnum)
205
206 /*
207 struct PlaceHolder
208 {
209 class Affector
210 {
211 public:
212 virtual ~Affector() {}
213 virtual void affect(const QStringList& base, int ph, const QKeyEvent *e, int mirror, QString& after) const = 0;
214 };
215
216 PlaceHolder() : length(0), autoRemove(true), autoOverride(false), affector(0) {}
217 PlaceHolder(const PlaceHolder& ph) : length(ph.length), autoRemove(ph.autoRemove), autoOverride(ph.autoOverride), affector(ph.affector)
218 {
219 cursor = ph.cursor;
220 mirrors << ph.mirrors;
221 }
222 PlaceHolder(int len, const QDocumentCursor &cur): length(len), autoRemove(true), autoOverride(false), affector(0), cursor(cur) {}
223
224 int length;
225 bool autoRemove, autoOverride;
226 Affector *affector;
227 QDocumentCursor cursor;
228 QList<QDocumentCursor> mirrors;
229 };
230 */
231 QEditor(QWidget *p = nullptr);
232 QEditor(bool actions, QWidget *p = nullptr, QDocument *doc=nullptr);
233 QEditor(const QString& s, QWidget *p = nullptr);
234 QEditor(const QString& s, bool actions, QWidget *p = nullptr);
235 virtual ~QEditor();
236
237 bool flag(EditFlag) const;
238
239 Q_INVOKABLE bool canUndo() const;
240 Q_INVOKABLE bool canRedo() const;
241
242 Q_INVOKABLE QString text() const;
243 Q_INVOKABLE QString text(int line) const;
244
245 Q_INVOKABLE QDocument* document() const;
246
247 QList<QEditorInputBindingInterface*> inputBindings() const;
248
249 Q_INVOKABLE bool isCursorVisible() const;
250 QDocumentCursor cursor() const;
251 Q_PROPERTY(QDocumentCursor cursor READ cursor WRITE setCursor DESIGNABLE false STORED false);
252 QDocumentCursorHandle* cursorHandle() const;
253
254 Q_INVOKABLE int cursorMirrorCount() const;
255 Q_INVOKABLE QDocumentCursor cursorMirror(int i) const;
256
257 Q_INVOKABLE QList<QDocumentCursor> cursors() const;
258
259 QLanguageDefinition* languageDefinition() const;
260 QCodeCompletionEngine* completionEngine() const;
261
262 QAction* action(const QString& s);
263
264 virtual QRectF cursorRect() const;
265 virtual QRectF selectionRect() const;
266 virtual QRectF lineRect(int line) const;
267 virtual QRectF cursorRect(const QDocumentCursor& c) const;
268 virtual QRectF cursorMircoFocusRect() const;
269
270
271 virtual int getFirstVisibleLine();
272 virtual int getLastVisibleLine();
273
274 Q_INVOKABLE virtual void scrollToFirstLine(int l);
275
276 void setCursorSurroundingLines(int s);
277
278 Q_INVOKABLE QString name() const;
279 Q_INVOKABLE QString fileName() const;
280 Q_INVOKABLE QFileInfo fileInfo() const;
281
282 Q_INVOKABLE bool isReadOnly() const;
283 Q_INVOKABLE void setReadOnly(bool b);
284
285 Q_INVOKABLE bool isContentModified() const;
286
287 Q_INVOKABLE bool isInConflict() const;
288 Q_INVOKABLE QTextCodec* getFileCodec() const;
289 Q_INVOKABLE void setFileCodec(QTextCodec* codec);
290 void viewWithCodec(QTextCodec* codec);
291
292 int wrapWidth() const;
293
294 bool displayModifyTime() const;
setDisplayModifyTime(bool flag)295 void setDisplayModifyTime(bool flag) {mDisplayModifyTime=flag;}
296
ignoreExternalChanges()297 bool ignoreExternalChanges() const {return mIgnoreExternalChanges;}
setIgnoreExternalChanges(bool flag)298 void setIgnoreExternalChanges(bool flag) {mIgnoreExternalChanges=flag;}
299
silentReloadOnExternalChanges()300 bool silentReloadOnExternalChanges() const {return mSilentReloadOnExternalChanges;}
setSilentReloadOnExternalChanges(bool flag)301 void setSilentReloadOnExternalChanges(bool flag) {mSilentReloadOnExternalChanges=flag;}
setUseQSaveFile(bool flag)302 void setUseQSaveFile(bool flag) {m_useQSaveFile=flag;}
303
horizontalOffset()304 inline qreal horizontalOffset() const
305 {
306 #if defined Q_OS_MAC
307 return horizontalScrollBar()->value();
308 #else
309 return horizontalScrollBar()->isVisible() ? horizontalScrollBar()->value() : 0;
310 #endif
311 }
verticalOffset()312 inline qreal verticalOffset() const
313 {
314 #if defined Q_OS_MAC
315 return verticalScrollBar()->value() * m_doc->getLineSpacing(); // does this work always ?
316 #else
317 return verticalScrollBar()->isVisible() ? 1. * verticalScrollBar()->value() * m_doc->getLineSpacing() : 0;
318 #endif
319 }
320
mapToContents(const QPoint & point)321 inline QPoint mapToContents(const QPoint &point) const
322 {
323 return QPoint( point.x() + horizontalOffset(),
324 point.y() + verticalOffset() );
325 }
326
mapFromContents(const QPoint & point)327 inline QPoint mapFromContents(const QPoint &point) const
328 {
329 return QPoint( point.x() - horizontalOffset(),
330 point.y() - verticalOffset() );
331 }
332
mapFromFrame(const QPoint & point)333 inline QPoint mapFromFrame(const QPoint &point) const
334 {
335 return QPoint( point.x() + m_margins.left(),
336 point.y() + m_margins.top() );
337 }
338
mapToFrame(const QPoint & point)339 inline QPoint mapToFrame(const QPoint &point) const
340 {
341 return QPoint( point.x() - m_margins.left(),
342 point.y() - m_margins.top() );
343 }
344
345 virtual bool protectedCursor(const QDocumentCursor& c) const;
346
347 static int defaultFlags();
348 static void setDefaultFlags(int f);
349
350 static QEditorInputBindingInterface* registeredInputBinding(const QString& n);
351 static QString defaultInputBindingId();
352 static QStringList registeredInputBindingIds();
353 static void registerInputBinding(QEditorInputBindingInterface *b);
354 static void unregisterInputBinding(QEditorInputBindingInterface *b);
355 static void setDefaultInputBinding(QEditorInputBindingInterface *b);
356 static void setDefaultInputBinding(const QString& b);
editors()357 static inline const QList<QEditor*>& editors() { return m_editors; }
358
359 static QString translateEditOperation(const EditOperation& op);
360 static void setEditOperations(const QHash<QString, int>& newOptions, bool mergeWithDefault=false);
361 static QHash<QString, int> getEditOperations(bool excludeDefault=false);
362 static QSet<int> getAvailableOperations();
363 static void registerEditOperation(const EditOperation& op);
364 static void addEditOperation(const EditOperation& op, const Qt::KeyboardModifiers& modifiers, const Qt::Key& key);
365 static void addEditOperation(const EditOperation& op, const QKeySequence::StandardKey& key);
366 EditOperation getEditOperation(const Qt::KeyboardModifiers& modifiers, const Qt::Key& key);
367
disableAccentHack(bool disable)368 void disableAccentHack(bool disable){
369 m_disableAccentHack=disable;
370 }
371
372 void addMark(int pos,QColor color,QString type="");
373 void addMarkDelayed(int pos, QColor color, QString type);
374 void addMark(QDocumentLineHandle *dlh, QColor color, QString type="");
375 void addMarkRange(int start,int end,QColor color,QString type="");
376 void removeMark(int pos, QString type="");
377 void removeMark(QDocumentLineHandle *dlh,QString type="");
378 void removeMark(QString type);
379 void removeAllMarks();
380 void paintMarks();
381
382 public slots:
383 void undo();
384 void redo();
385
386 void cut();
387 void copy();
388 void paste();
389
390 void selectAll();
391 void selectNothing();
392 void selectExpand(QDocumentCursor::SelectionType selectionType);
393 void selectExpandToNextWord();
394 void selectExpandToNextLine();
395 void selectAllOccurences();
396 void selectNextOccurence();
397 void selectPrevOccurence();
398 void selectNextOccurenceKeepMirror();
399 void selectPrevOccurenceKeepMirror();
400 void selectOccurence(bool backward, bool keepMirrors, bool all);
401
402 void relayPanelCommand(const QString& panel, const QString& command, const QList<QVariant>& args = QList<QVariant>());
403
404 void find();
405 void find(QString text, bool highlight, bool regex, bool word=false, bool caseSensitive=false);
406 void find(QString text, bool highlight, bool regex, bool word, bool caseSensitive, bool fromCursor, bool selection);
407 void findInSameDir();
408 void findNext();
409 void findPrev();
410 void findCount();
411 void selectAllMatches();
412 void replacePanel();
413 void replaceNext();
414 void replacePrev();
415 void replaceAll();
416
417 void gotoLine();
418
419 protected:
420 void insertTab(QDocumentCursor &cur);
421 public slots:
422 void tabOrIndentSelection();
423 void insertTab();
424 void indentSelection();
425 void unindentSelection();
426
427 void commentSelection();
428 void uncommentSelection();
429 void toggleCommentSelection();
430
431 void setLineWrapping(bool on);
432 void setHardLineWrapping(bool on);
433 void setSoftLimitedLineWrapping(bool on);
434 void setWrapAfterNumChars(int numChars);
435 protected:
436 void setWrapLineWidth(qreal l);
437 bool writeToFile(const QString &filename, const QByteArray &data);
438 public:
439 virtual void save();
440 void save(const QString& filename);
441 bool saveCopy(const QString& filename);
442 void saveEmergencyBackup(const QString& filename);
443
444 bool preEditSet;
445 int preEditLineNumber,preEditColumnNumber,preEditLength,m_preEditFormat;
446 public slots:
447
448 virtual void print();
449
450 virtual void retranslate();
451
452 virtual void write(const QString& s);
453
454 void addAction(QAction *a, const QString& menu, const QString& toolbar = QString());
455 void removeAction(QAction *a, const QString& menu, const QString& toolbar = QString());
456
457 void load(const QString& file, QTextCodec* codec/* = QTextCodec::codecForLocale()*/);
458 void reload();
459
460 void setText(const QString& s, bool allowUndo = true);
461
462 void setDocument(QDocument *d);
463
464 void addInputBinding(QEditorInputBindingInterface *b);
465 void removeInputBinding(QEditorInputBindingInterface *b);
466 void setInputBinding(QEditorInputBindingInterface *b);
467
468 void setCursor(const QDocumentCursor& c, bool moveView = true);
469
470 void setLanguageDefinition(QLanguageDefinition *d);
471
472 void setCompletionEngine(QCodeCompletionEngine *e);
473
474 void zoomIn();
475 void zoomOut();
476 void resetZoom();
477 void zoom(int n);
478
479 void setPanelMargins(qreal l, qreal t, qreal r, qreal b);
480 void getPanelMargins(qreal *l, qreal *t, qreal *r, qreal *b) const;
481
482 void setTitle(const QString& title);
483
484 void highlight();
485
486 void clearPlaceHolders();
487 void addPlaceHolder(const PlaceHolder& p, bool autoUpdate = true);
488 void addPlaceHolderMirror(int placeHolderId, const QDocumentCursor& c);
489 void removePlaceHolder(int id);
490 void replacePlaceHolders(const QList<PlaceHolder>& newPlaceholders);
491
492 int placeHolderCount() const;
493 int currentPlaceHolder() const;
494 const PlaceHolder& getPlaceHolder(int i) const;
495 QList<PlaceHolder> getPlaceHolders();
496 bool isAutoOverrideText(const QString& s) const;
497 void resizeAutoOverridenPlaceholder(const QDocumentCursor& start, int length);
498
499 bool nextPlaceHolder();
500 bool previousPlaceHolder();
501 void setPlaceHolder(int i, bool selectCursors=true);
502
503 virtual void setFileName(const QString& f);
504
505 signals:
506 void loaded(QEditor *e, const QString& s);
507 void saved(QEditor *e, const QString& s);
508
509 void contentModified(bool y);
510 void readOnlyChanged(bool y);
511 void titleChanged(const QString& title);
512 void focusReceived();
513
514 void textEdited(QKeyEvent *e);
515 void cursorPositionChanged();
516
517 void copyAvailable(bool y);
518
519 void undoAvailable(bool y);
520 void redoAvailable(bool y);
521
522 void markChanged(const QString& f, QDocumentLineHandle *l, int mark, bool on);
523
524 void hovered(QPoint pos);
525
526 void fileReloaded();
527 void fileInConflict();
528 void fileInConflictShowDiff();
529 void fileAutoReloading(QString fname);
530 void needUpdatedCompleter();
531 void requestClose();
532
533 void cursorHovered();
534
535 void emitWordDoubleClicked();
536
537 void visibleLinesChanged();
538
539 void slowOperationStarted();
540 void slowOperationEnded();
541 public slots:
542 void checkClipboard();
543 void reconnectWatcher();
544 void fileChanged(const QString& f);
545
546 void setContentClean(bool y);
547
548 void emitCursorPositionChanged();
549 void ensureCursorVisible(const QDocumentCursor& cursor, MoveFlags mflags = NoFlags);
550 void ensureCursorVisible(MoveFlags mflags = NoFlags);
551
552 virtual void setContentModified(bool y);
553
554 void emitNeedUpdatedCompleter();
555
556 protected:
557 void setVerticalScrollBarMaximum();
558 virtual bool event(QEvent *e);
559
560 virtual void paintEvent(QPaintEvent *e);
561 virtual void timerEvent(QTimerEvent *e);
562
563 virtual void keyPressEvent(QKeyEvent *e);
564 virtual void keyReleaseEvent(QKeyEvent *);
565 public:
566 virtual void inputMethodEvent(QInputMethodEvent* e);
567
568 virtual void mouseMoveEvent(QMouseEvent *e);
569 virtual void mousePressEvent(QMouseEvent *e);
570 virtual void mouseReleaseEvent(QMouseEvent *e);
571 virtual void mouseDoubleClickEvent(QMouseEvent *e);
572
573 virtual void dragEnterEvent(QDragEnterEvent *e);
574 virtual void dragLeaveEvent(QDragLeaveEvent *e);
575 virtual void dragMoveEvent(QDragMoveEvent *e);
576 virtual void dropEvent(QDropEvent *e);
577
578 virtual void changeEvent(QEvent *e);
579 virtual void showEvent(QShowEvent *);
580 virtual void wheelEvent(QWheelEvent *e);
581 virtual void resizeEvent(QResizeEvent *e);
582 virtual void focusInEvent(QFocusEvent *e);
583 virtual void focusOutEvent(QFocusEvent *e);
584
585 virtual void contextMenuEvent(QContextMenuEvent *e);
586
587 virtual void closeEvent(QCloseEvent *e);
588
589 virtual bool focusNextPrevChild(bool next);
590
591 virtual void cursorMoveOperation(QDocumentCursor &cursor, EditOperation op);
592 virtual void processEditOperation(QDocumentCursor& c, const QKeyEvent* e, EditOperation op);
593
594 void selectCursorMirrorBlock(const QDocumentCursor& cursor, bool horizontalSelect);
595
596 virtual void startDrag();
597 virtual QMimeData* createMimeDataFromSelection() const;
598
599 virtual void scrollContentsBy(int dx, int dy);
600
601 virtual QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
602 public:
603 virtual void insertFromMimeData(const QMimeData *d);
604
605 void setFlag(EditFlag f, bool b);
setDoubleClickSelectionType(QDocumentCursor::SelectionType type)606 void setDoubleClickSelectionType(QDocumentCursor::SelectionType type) {m_doubleClickSelectionType = type;}
setTripleClickSelectionType(QDocumentCursor::SelectionType type)607 void setTripleClickSelectionType(QDocumentCursor::SelectionType type) {m_tripleClickSelectionType = type;}
608
609 public slots:
610 void pageUp(QDocumentCursor::MoveMode moveMode);
611 void pageDown(QDocumentCursor::MoveMode moveMode);
612
613 void repaintCursor();
614 void ensureVisible(int line);
615 void ensureVisible(const QRectF &rect);
616
617 protected:
618 void preInsertUnindent(QDocumentCursor& c, const QString& text, int additionalUnindent);
619
620 public slots:
621 void insertText(QDocumentCursor& c, const QString& text);
622 void insertText(const QString& text);
623
624 public:
625 QDocumentLine lineAtPosition(const QPoint& p) const;
626 QDocumentCursor cursorForPosition(const QPoint& p, bool disallowPositionBeyondLine = false) const;
627
628 void setClipboardSelection();
629 void setCursorPosition(const QPoint& p, bool moveView = true);
630
631 void setCursorPosition(int line, int index, bool moveView = true);
632 void getCursorPosition(int &line, int &index);
633 bool getPositionBelowCursor(QPointF &offset, int width, int height, bool &above);
634 bool getPositionBelowCursor(QPointF &offset, int width=0, int height=0);
635
636 Q_INVOKABLE void clearCursorMirrors();
637 Q_INVOKABLE void addCursorMirror(const QDocumentCursor& c);
638 Q_INVOKABLE void cursorMirrorsRemoveSelectedText();
639
640 void setCursorBold(bool bold);
641
642 QString cutBuffer;
643
644 protected slots:
645 void documentWidthChanged(int newWidth);
646 void documentHeightChanged(int newWidth);
647
648 void repaintContent(int i, int n);
649 void updateContent (int i, int n);
650
651 void markChanged(QDocumentLineHandle *l, int mark, bool on);
652
653 void bindingSelected(QAction *a);
654
655 void lineEndingSelected(QAction *a);
656 void lineEndingChanged(int lineEnding);
657
658 protected:
659 enum SaveState
660 {
661 Undefined,
662 Saving,
663 Saved,
664 Conflict
665 };
666
667 void init(bool actions = true,QDocument *doc=0);
668 void updateBindingsMenu();
669
670 QMenu *pMenu;
671 QHash<QString, QAction*> m_actions;
672
673 QMenu *m_lineEndingsMenu;
674 QActionGroup *m_lineEndingsActions;
675
676 QMenu *m_bindingsMenu;
677 QAction *aDefaultBinding;
678 QActionGroup *m_bindingsActions;
679
680 char m_saveState;
681 quint16 m_checksum;
682
683 QDocument *m_doc;
684 QList<QEditorInputBindingInterface*> m_bindings;
685
686 QLanguageDefinition *m_definition;
687 QPointer<QCodeCompletionEngine> m_completionEngine;
688
689 QDocumentCursor m_cursor, m_multiClickCursor, m_dragAndDrop;
690 QDocumentCursor::SelectionType m_doubleClickSelectionType;
691 QDocumentCursor::SelectionType m_tripleClickSelectionType;
692 int m_cursorLinesFromViewTop;
693 int m_cursorMirrorBlockAnchor;
694
695 QList<QDocumentCursor> m_mirrors;
696
697 bool atPlaceholder();
698 bool isMirrored();
699 int m_curPlaceHolder, m_lastPlaceHolder, m_cphOffset;
700 bool m_placeHolderSynchronizing;
701
702 QList<PlaceHolder> m_placeHolders;
703
704 int m_state;
705 bool m_selection;
706 QRectF m_crect, m_margins;
707 QPoint m_clickPoint, m_dragPoint;
708 QBasicTimer m_blink, m_click, m_drag, m_autoScroll;
709
710 bool mDisplayModifyTime;
711 bool mIgnoreExternalChanges;
712 bool mSilentReloadOnExternalChanges;
713 bool m_useQSaveFile;
714
715 static QReliableFileWatch* watcher();
716
717 static int m_defaultFlags;
718
719 static QList<QEditor*> m_editors;
720 static QEditorInputBindingInterface *m_defaultBinding;
721 static QHash<QString, QEditorInputBindingInterface*> m_registeredBindings;
722
723 static bool m_defaultKeysSet;
724 static QHash<QString, int> m_registeredKeys;
725 static QSet<int> m_registeredOperations;
726 static QHash<QString, int> m_registeredDefaultKeys;
727
728 static int m_manageMenu;
729
730 bool m_UseTabforMoveToPlaceholder;
731
732 bool m_blockKey,m_disableAccentHack;
733
734 int m_lastLine,m_lastColumn,m_hoverCount;
735
736 int m_cursorSurroundingLines;
737
738 int m_LineWidth;
739 int m_wrapAfterNumChars;
740
741 QPropertyAnimation *m_scrollAnimation;
742 };
743
744 Q_DECLARE_OPERATORS_FOR_FLAGS(QEditor::State)
Q_DECLARE_OPERATORS_FOR_FLAGS(QEditor::MoveFlags)745 Q_DECLARE_OPERATORS_FOR_FLAGS(QEditor::MoveFlags)
746
747 inline bool QEditor::atPlaceholder() {
748 return m_curPlaceHolder >= 0 && m_curPlaceHolder<m_placeHolders.count();
749 }
750
751 const int LRM = 0x200E;
752
753 #endif
754