25 #include "katedocument.h"
26 #include "kateviewinternal.h"
27 #include "kateconfig.h"
29 #include "../interfaces/view.h"
31 #include <ktexteditor/sessionconfiginterface.h>
32 #include <ktexteditor/viewstatusmsginterface.h>
33 #include <ktexteditor/texthintinterface.h>
35 #include <tqguardedptr.h>
41 class KateCodeCompletion;
43 class KateViewSchemaAction;
58 public KTextEditor::SessionConfigInterface,
59 public KTextEditor::ViewStatusMsgInterface,
60 public KTextEditor::TextHintInterface,
61 public KTextEditor::SelectionInterface,
62 public KTextEditor::SelectionInterfaceExt,
63 public KTextEditor::BlockSelectionInterface
67 friend class KateViewInternal;
68 friend class KateIconBorder;
69 friend class KateCodeCompletion;
72 KateView( KateDocument* doc, TQWidget* parent = 0L,
const char* name = 0 );
79 KTextEditor::Document*
document()
const {
return m_doc; }
97 TQString selectionAsHtml ();
98 TQString textAsHtml ( uint startLine, uint startCol, uint endLine, uint endCol,
bool blockwise);
99 void textAsHtmlStream ( uint startLine, uint startCol, uint endLine, uint endCol,
bool blockwise, TQTextStream *ts);
113 void lineAsHTML (
KateTextLine::Ptr line, uint startCol, uint length, TQTextStream *outputStream);
116 void exportAsHTML ();
122 void installPopup( TQPopupMenu* menu ) { m_rmbMenu = menu; }
123 TQPopupMenu* popup()
const {
return m_rmbMenu; }
129 TQPoint cursorCoordinates()
130 {
return m_viewInternal->cursorCoordinates(); }
131 void cursorPosition( uint* l, uint* c )
132 {
if( l ) *l = cursorLine();
if( c ) *c = cursorColumn(); }
133 void cursorPositionReal( uint* l, uint* c )
134 {
if( l ) *l = cursorLine();
if( c ) *c = cursorColumnReal(); }
135 bool setCursorPosition( uint line, uint col )
136 {
return setCursorPositionInternal( line, col, tabWidth(),
true ); }
137 bool setCursorPositionReal( uint line, uint col)
138 {
return setCursorPositionInternal( line, col, 1,
true ); }
140 {
return m_viewInternal->getCursor().line(); }
142 uint cursorColumnReal()
143 {
return m_viewInternal->getCursor().col(); }
146 void cursorPositionChanged();
152 void showArgHint( TQStringList arg1,
const TQString& arg2,
const TQString& arg3 );
153 void showCompletionBox( TQValueList<KTextEditor::CompletionEntry> arg1,
int offset = 0,
bool cs =
true );
156 void completionAborted();
157 void completionDone();
158 void argHintHidden();
159 void completionDone(KTextEditor::CompletionEntry);
160 void filterInsertString(KTextEditor::CompletionEntry*,TQString *);
161 void aboutToShowCompletionBox();
167 void enableTextHints(
int timeout);
168 void disableTextHints();
171 void needTextHint(
int line,
int col, TQString &text);
177 void setDynWordWrap(
bool b );
178 bool dynWordWrap()
const {
return m_hasWrap; }
186 bool setSelection ( uint startLine, uint startCol,
187 uint endLine, uint endCol );
188 bool clearSelection ();
189 bool clearSelection (
bool redraw,
bool finishedChangingSelection =
true);
191 bool hasSelection ()
const;
192 TQString selection ()
const ;
194 bool removeSelectedText ();
201 int selStartLine() {
return selectStart.line(); };
202 int selStartCol() {
return selectStart.col(); };
203 int selEndLine() {
return selectEnd.line(); };
204 int selEndCol() {
return selectEnd.col(); };
207 void selectionChanged ();
217 inline const KateSuperCursor &selStart ()
const {
return selectStart; }
229 bool lineColSelected (
int line,
int col);
230 bool lineSelected (
int line);
231 bool lineEndSelected (
int line,
int endCol);
232 bool lineHasSelected (
int line);
233 bool lineIsSelection (
int line);
243 void syncSelectionCache();
249 bool blockSelectionMode ();
250 bool setBlockSelectionMode (
bool on);
251 bool toggleBlockSelectionMode ();
257 void editEnd (
int editTagLineStart,
int editTagLineEnd,
bool tagFrom);
266 bool tagLines (
int start,
int end,
bool realLines =
false );
273 void repaintText (
bool paintOnlyDirty =
false);
275 void updateView (
bool changed =
false);
286 {
return getDoc()->textLine( cursorLine() ); }
288 {
return m_doc->getWord( m_viewInternal->getCursor() ); }
290 {
getDoc()->insertText( cursorLine(), cursorColumnReal(), mark ); }
292 int tabWidth() {
return m_doc->config()->tabWidth(); }
293 void setTabWidth(
int w ) { m_doc->config()->setTabWidth(w); }
294 void setEncoding( TQString e ) { m_doc->setEncoding(e); }
295 bool isLastView() {
return m_doc->isLastView(1); }
302 void indent() { m_doc->indent(
this, cursorLine(), 1 ); }
303 void unIndent() { m_doc->indent(
this, cursorLine(), -1 ); }
304 void cleanIndent() { m_doc->indent(
this, cursorLine(), 0 ); }
305 void align() { m_doc->align(
this, cursorLine() ); }
306 void comment() { m_doc->comment(
this, cursorLine(), cursorColumnReal(), 1 ); }
307 void uncomment() { m_doc->comment(
this, cursorLine(), cursorColumnReal(),-1 ); }
308 void killLine() { m_doc->removeLine( cursorLine() ); }
313 void uppercase() { m_doc->transform(
this, m_viewInternal->cursor, KateDocument::Uppercase ); }
317 void lowercase() { m_doc->transform(
this, m_viewInternal->cursor, KateDocument::Lowercase ); }
322 void capitalize() { m_doc->transform(
this, m_viewInternal->cursor, KateDocument::Capitalize ); }
329 void keyReturn() { m_viewInternal->doReturn(); }
330 void backspace() { m_viewInternal->doBackspace(); }
331 void deleteWordLeft() { m_viewInternal->doDeleteWordLeft(); }
332 void keyDelete() { m_viewInternal->doDelete(); }
333 void deleteWordRight() { m_viewInternal->doDeleteWordRight(); }
334 void transpose() { m_viewInternal->doTranspose(); }
335 void cursorLeft() { m_viewInternal->cursorLeft(); }
336 void shiftCursorLeft() { m_viewInternal->cursorLeft(
true); }
337 void cursorRight() { m_viewInternal->cursorRight(); }
338 void shiftCursorRight() { m_viewInternal->cursorRight(
true); }
339 void wordLeft() { m_viewInternal->wordLeft(); }
340 void shiftWordLeft() { m_viewInternal->wordLeft(
true); }
341 void wordRight() { m_viewInternal->wordRight(); }
342 void shiftWordRight() { m_viewInternal->wordRight(
true); }
343 void home() { m_viewInternal->home(); }
344 void shiftHome() { m_viewInternal->home(
true); }
345 void end() { m_viewInternal->end(); }
346 void shiftEnd() { m_viewInternal->end(
true); }
347 void up() { m_viewInternal->cursorUp(); }
348 void shiftUp() { m_viewInternal->cursorUp(
true); }
349 void down() { m_viewInternal->cursorDown(); }
350 void shiftDown() { m_viewInternal->cursorDown(
true); }
351 void scrollUp() { m_viewInternal->scrollUp(); }
352 void scrollDown() { m_viewInternal->scrollDown(); }
353 void topOfView() { m_viewInternal->topOfView(); }
354 void shiftTopOfView() { m_viewInternal->topOfView(
true); }
355 void bottomOfView() { m_viewInternal->bottomOfView(); }
356 void shiftBottomOfView() { m_viewInternal->bottomOfView(
true); }
357 void pageUp() { m_viewInternal->pageUp(); }
358 void shiftPageUp() { m_viewInternal->pageUp(
true); }
359 void pageDown() { m_viewInternal->pageDown(); }
360 void shiftPageDown() { m_viewInternal->pageDown(
true); }
361 void top() { m_viewInternal->top_home(); }
362 void shiftTop() { m_viewInternal->top_home(
true); }
363 void bottom() { m_viewInternal->bottom_end(); }
364 void shiftBottom() { m_viewInternal->bottom_end(
true); }
365 void toMatchingBracket() { m_viewInternal->cursorToMatchingBracket();}
366 void shiftToMatchingBracket() { m_viewInternal->cursorToMatchingBracket(
true);}
369 void gotoLineNumber(
int linenumber );
380 void find(
const TQString&,
long,
bool add=
true );
382 void replace(
const TQString&,
const TQString &,
long );
388 void setFoldingMarkersOn(
bool enable );
391 void setScrollBarMarks(
bool enable );
392 void showCmdLine (
bool enable );
393 void toggleFoldingMarkers();
396 void toggleScrollBarMarks();
397 void toggleDynWordWrap ();
398 void toggleCmdLine ();
399 void setDynWrapIndicators(
int mode);
401 void applyWordWrap ();
408 bool scrollBarMarks();
409 int dynWrapIndicators();
410 bool foldingMarkersOn();
413 void setActive(
bool b ) { m_active = b; }
414 bool isActive() {
return m_active; }
417 void gotoMark( KTextEditor::Mark* mark ) { setCursorPositionInternal ( mark->line, 0, 1 ); }
418 void slotSelectionChanged ();
430 KateDocument* doc()
const {
return m_doc; }
439 void toggleWWMarker();
440 void toggleWriteLock();
441 void switchToCmdLine ();
442 void slotReadWriteChanged ();
445 void dropEventPass(TQDropEvent*);
446 void viewStatusMsg (
const TQString &msg);
449 bool setCursorPositionInternal( uint line, uint col, uint tabwidth = 1,
bool calledExternally =
false );
452 void contextMenuEvent( TQContextMenuEvent* );
453 bool checkOverwrite(
KURL );
456 void slotSelectionTypeChanged();
460 void slotLostFocus();
461 void slotDropEventPass( TQDropEvent* ev );
462 void slotStatusMsg();
463 void slotSaveCanceled(
const TQString& error );
464 void slotExpandToplevel();
465 void slotCollapseLocal();
466 void slotExpandLocal();
469 void setupConnections();
471 void setupEditActions();
472 void setupCodeFolding();
473 void setupCodeCompletion();
502 KateViewInternal* m_viewInternal;
504 KateSearch* m_search;
506 KateBookmarks* m_bookmarks;
507 TQGuardedPtr<TQPopupMenu> m_rmbMenu;
508 KateCodeCompletion* m_codeCompletion;
510 KateCmdLine *m_cmdLine;
513 TQGridLayout *m_grid;
519 void slotNeedTextHint(
int line,
int col, TQString &text);
520 void slotHlChanged();
526 inline KateViewConfig *config () {
return m_config; };
528 void updateConfig ();
530 void updateDocumentConfig();
532 void updateRendererConfig();
535 void updateFoldingConfig ();
538 KateViewConfig *m_config;
540 bool m_updatingDocumentConfig;
554 void setIMSelectionValue( uint imStartLine, uint imStart, uint imEnd,
555 uint imSelStart, uint imSelEnd,
bool m_imComposeEvent );
556 void getIMSelectionValue( uint *imStartLine, uint *imStart, uint *imEnd,
557 uint *imSelStart, uint *imSelEnd );
558 bool isIMSelection(
int _line,
int _column );
559 bool isIMEdit(
int _line,
int _column );
560 bool imComposeEvent ()
const {
return m_imComposeEvent; }
568 bool m_imComposeEvent;