25 #include <ktexteditor/view.h>
26 #include <ktexteditor/texthintinterface.h>
27 #include <ktexteditor/markinterface.h>
28 #include <ktexteditor/codecompletioninterface.h>
29 #include <ktexteditor/sessionconfiginterface.h>
30 #include <ktexteditor/templateinterface.h>
31 #include <ktexteditor/templateinterface2.h>
32 #include <ktexteditor/configinterface.h>
33 #include <ktexteditor/annotationinterface.h>
35 #include <QtCore/QPointer>
36 #include <QModelIndex>
37 #include <QtGui/QMenu>
48 class AnnotationModel;
78 public KTextEditor::TextHintInterface,
79 public KTextEditor::SessionConfigInterface,
80 public KTextEditor::TemplateInterface2,
81 public KTextEditor::CodeCompletionInterface,
82 public KTextEditor::ConfigInterface,
83 public KTextEditor::AnnotationViewInterface,
84 public KTextEditor::CoordinatesToCursorInterface
87 Q_INTERFACES(KTextEditor::TextHintInterface)
88 Q_INTERFACES(KTextEditor::SessionConfigInterface)
89 Q_INTERFACES(KTextEditor::TemplateInterface)
90 Q_INTERFACES(KTextEditor::TemplateInterface2)
91 Q_INTERFACES(KTextEditor::ConfigInterface)
92 Q_INTERFACES(KTextEditor::CodeCompletionInterface)
93 Q_INTERFACES(KTextEditor::AnnotationViewInterface)
94 Q_INTERFACES(KTextEditor::CoordinatesToCursorInterface)
104 KTextEditor::Document *document () const;
112 void paste(const
QString *textToPaste = 0);
120 void applyWordWrap ();
126 void setContextMenu(
QMenu* menu );
127 QMenu* contextMenu() const;
128 QMenu* defaultContextMenu(
QMenu* menu = 0L) const;
131 void aboutToShowContextMenu();
132 void aboutToHideContextMenu();
149 void setCaretStyle(
KateRenderer::caretStyles style,
bool repaint = false );
151 bool setCursorPosition (KTextEditor::Cursor position);
153 KTextEditor::Cursor cursorPosition () const;
155 KTextEditor::Cursor cursorPositionVirtual () const;
157 QPoint cursorToCoordinate(const KTextEditor::Cursor& cursor) const;
159 KTextEditor::Cursor coordinatesToCursor(const
QPoint& coord) const;
161 QPoint cursorPositionCoordinates() const;
163 bool setCursorPositionVisual( const KTextEditor::Cursor& position );
170 int virtualCursorColumn() const;
172 virtual
bool mouseTrackingEnabled() const;
173 virtual
bool setMouseTrackingEnabled(
bool enable);
176 void notifyMousePositionChanged(const KTextEditor::Cursor& newPosition);
180 bool setCursorPositionInternal( const KTextEditor::Cursor& position, uint tabwidth = 1,
bool calledExternally = false );
191 void configChanged();
199 void foldLine (
int startLine);
205 void unfoldLine (
int startLine);
211 virtual
bool isCompletionActive() const;
212 virtual
void startCompletion(const KTextEditor::Range& word, KTextEditor::CodeCompletionModel* model);
213 virtual
void abortCompletion();
214 virtual
void forceCompletion();
215 virtual
void registerCompletionModel(KTextEditor::CodeCompletionModel* model);
216 virtual
void unregisterCompletionModel(KTextEditor::CodeCompletionModel* model);
217 virtual
bool isAutomaticInvocationEnabled() const;
218 virtual
void setAutomaticInvocationEnabled(
bool enabled = true);
221 void completionExecuted(KTextEditor::View* view, const KTextEditor::Cursor& position, KTextEditor::CodeCompletionModel* model, const
QModelIndex&);
222 void completionAborted(KTextEditor::View* view);
225 void userInvokedCompletion();
230 void sendCompletionExecuted(const KTextEditor::Cursor& position, KTextEditor::CodeCompletionModel* model, const QModelIndex& index);
231 void sendCompletionAborted();
237 void enableTextHints(
int timeout);
238 void disableTextHints();
241 void needTextHint(const KTextEditor::Cursor& position,
QString &text);
244 bool dynWordWrap()
const {
return m_hasWrap; }
250 virtual bool setSelection (
const KTextEditor::Range &selection );
254 {
return KTextEditor::View::setSelection (c, i, b); }
260 virtual bool setBlockSelection (
bool on);
261 bool toggleBlockSelection ();
263 bool clearSelection ();
264 bool clearSelection (
bool redraw,
bool finishedChangingSelection =
true);
266 bool removeSelectedText ();
271 virtual bool selection()
const;
272 virtual QString selectionText()
const;
273 virtual bool blockSelection()
const;
274 virtual const KTextEditor::Range &selectionRange()
const;
276 static void blockFix(KTextEditor::Range& range);
279 mutable KTextEditor::Range m_holdSelectionRangeForAPI;
286 void deactivateEditActions();
287 void activateEditActions();
294 bool wrapCursor ()
const;
297 bool cursorSelected(
const KTextEditor::Cursor& cursor);
298 bool lineSelected (
int line);
299 bool lineEndSelected (
const KTextEditor::Cursor& lineEndPos);
300 bool lineHasSelected (
int line);
301 bool lineIsSelection (
int line);
303 void ensureCursorColumnValid();
305 void tagSelection (
const KTextEditor::Range &oldSelection);
307 void selectWord(
const KTextEditor::Cursor& cursor );
308 void selectLine(
const KTextEditor::Cursor& cursor );
314 void editEnd (
int editTagLineStart,
int editTagLineEnd,
bool tagFrom);
316 void editSetCursor (
const KTextEditor::Cursor &cursor);
321 bool tagLine (
const KTextEditor::Cursor& virtualCursor);
323 bool tagRange (
const KTextEditor::Range& range,
bool realLines =
false);
324 bool tagLines (
int start,
int end,
bool realLines =
false );
325 bool tagLines (KTextEditor::Cursor start, KTextEditor::Cursor end,
bool realCursors =
false);
326 bool tagLines (KTextEditor::Range range,
bool realRange =
false);
332 void repaintText (
bool paintOnlyDirty =
false);
334 void updateView (
bool changed =
false);
341 void setAnnotationModel( KTextEditor::AnnotationModel* model );
342 KTextEditor::AnnotationModel* annotationModel()
const;
343 void setAnnotationBorderVisible(
bool visible);
344 bool isAnnotationBorderVisible()
const;
347 void annotationContextMenuAboutToShow( KTextEditor::View* view,
QMenu* menu,
int line );
348 void annotationActivated( KTextEditor::View* view,
int line );
349 void annotationBorderVisibilityChanged( View* view,
bool visible );
352 void navigateRight();
355 void navigateAccept();
359 KTextEditor::AnnotationModel* m_annotationModel;
369 emit navigateRight();
378 emit navigateAccept();
386 bool isOverwriteMode()
const;
387 EditMode viewEditMode()
const;
402 QString replacementPattern()
const;
408 void setSearchPattern(
const QString &searchPattern);
414 void setReplacementPattern(
const QString &replacementPattern);
423 void toggleComment();
425 void createSnippet ();
426 void showSnippetsDialog ();
450 void deleteWordLeft();
452 void deleteWordRight();
455 void shiftCursorLeft();
457 void shiftCursorRight();
459 void shiftWordLeft();
461 void shiftWordRight();
473 void shiftTopOfView();
475 void shiftBottomOfView();
479 void shiftPageDown();
484 void toMatchingBracket();
485 void shiftToMatchingBracket();
486 void toPrevModifiedLine();
487 void toNextModifiedLine();
494 void readSessionConfig(
const KConfigGroup&);
495 void writeSessionConfig(KConfigGroup&);
498 void setEol(
int eol );
499 void setAddBom(
bool enabled);
501 void findSelectedForwards();
502 void findSelectedBackwards();
507 void setFoldingMarkersOn(
bool enable );
508 void setIconBorder(
bool enable );
509 void setLineNumbersOn(
bool enable );
510 void setScrollBarMarks(
bool enable );
511 void setScrollBarMiniMap(
bool enable );
512 void setScrollBarMiniMapAll(
bool enable );
513 void setScrollBarMiniMapWidth(
int width );
514 void toggleFoldingMarkers();
515 void toggleIconBorder();
516 void toggleLineNumbersOn();
517 void toggleScrollBarMarks();
518 void toggleScrollBarMiniMap();
519 void toggleScrollBarMiniMapAll();
520 void toggleDynWordWrap ();
521 void toggleViInputMode ();
524 void showViModeEmulatedCommandBar();
526 void setDynWrapIndicators(
int mode);
535 bool lineNumbersOn();
536 bool scrollBarMarks();
537 bool scrollBarMiniMap();
538 bool scrollBarMiniMapAll();
539 int dynWrapIndicators();
540 bool foldingMarkersOn();
546 void slotSelectionChanged ();
557 void slotUpdateUndo();
560 void toggleWWMarker();
561 void toggleWriteLock();
562 void switchToCmdLine ();
563 void slotReadWriteChanged ();
564 void slotClipboardHistoryChanged ();
576 return m_textFolding;
580 void slotTextInserted ( KTextEditor::View *view,
const KTextEditor::Cursor &position,
const QString &text);
587 void slotLostFocus();
589 void slotSaveCanceled(
const QString& error );
590 void slotConfigDialog ();
593 void slotFoldToplevelNodes();
594 void slotCollapseLocal();
595 void slotCollapseLevel();
596 void slotExpandLevel();
597 void slotExpandLocal();
600 void setupConnections();
602 void setupEditActions();
603 void setupCodeFolding();
609 KToggleAction* m_toggleFoldingMarkers;
610 KToggleAction* m_toggleIconBar;
611 KToggleAction* m_toggleLineNumbers;
612 KToggleAction* m_toggleScrollBarMarks;
613 KToggleAction* m_toggleScrollBarMiniMap;
614 KToggleAction* m_toggleScrollBarMiniMapAll;
615 KToggleAction* m_toggleDynWrap;
617 KToggleAction* m_toggleWWMarker;
619 KToggleAction* m_viInputModeAction;
622 KToggleAction* m_addBom;
630 KToggleAction *m_toggleBlockSelection;
631 KToggleAction *m_toggleInsert;
632 KToggleAction *m_toggleWriteLock;
647 void slotHlChanged();
655 void updateConfig ();
657 void updateDocumentConfig();
659 void updateRendererConfig();
662 void updateFoldingConfig ();
666 bool m_updatingDocumentConfig;
678 virtual bool insertTemplateTextImplementation (
const KTextEditor::Cursor&,
const QString &templateString,
const QMap<QString,QString> &initialValues);
679 virtual bool insertTemplateTextImplementation (
const KTextEditor::Cursor&,
const QString &templateString,
const QMap<QString,QString> &initialValues, KTextEditor::TemplateScript* templateScript);
692 bool hasSearchBar ()
const {
return m_searchBar != 0; }
715 bool viInputMode()
const;
720 ViMode getCurrentViMode()
const;
736 bool viInputModeStealKeys()
const;
742 bool viRelativeLineNumbers()
const;
747 void updateViModeBarMode();
752 void updateViModeBarCmd();
755 KTextEditor::Range visibleRange();
758 void displayRangeChanged(
KateView *view);
765 void toggleOnTheFlySpellCheck(
bool b);
768 void changeDictionary();
769 void reflectOnTheFlySpellCheckStatus(
bool enabled);
774 bool m_userContextMenuSet;
780 void saveFoldingState ();
785 void applyFoldingState ();
791 QVariantList m_savedFoldingState;
800 void notifyAboutRangeChange (
int startLine,
int endLine,
bool rangeWithAttribute);
806 void slotDelayedUpdateOfView ();
812 void delayedUpdateOfView ();
831 void updateRangesIn (KTextEditor::Attribute::ActivationType activationType);
840 bool m_delayedUpdateTriggered;
845 int m_lineToUpdateMin;
850 int m_lineToUpdateMax;
891 Q_DECLARE_METATYPE(KTextEditor::Cursor)
892 Q_DECLARE_METATYPE(KTextEditor::Range)
KateSpellingMenu * m_spellingMenu
const KateDocument * doc() const
const QSet< Kate::TextRange * > * rangesCaretIn() const
set of ranges which had the caret inside last time, used for rendering
virtual bool removeSelection()
#define KATEPART_TESTS_EXPORT
Kate::TextFolding & textFolding()
Folding handler for this view.
bool setSelection(const KTextEditor::Cursor &c, int i, bool b)
Handles all of the work of rendering the text (used for the views and printing)
Class representing the folding information for a TextBuffer.
void emitNavigateAccept()
KateMessageWidget * messageWidget()
KToggleAction * m_toggleOnTheFlySpellCheck
virtual bool removeSelectionText()
KateDocument * doc()
accessor to katedocument pointer
KateViewConfig * config()
Configuration.
const QSet< Kate::TextRange * > * rangesMouseIn() const
set of ranges which had the mouse inside last time, used for rendering
A KateViewBarWidget that attempts to emulate some of the features of Vim's own command bar...