24 #ifndef _KATE_VIEW_INTERNAL_
25 #define _KATE_VIEW_INTERNAL_
27 #include "katecursor.h"
28 #include "katesupercursor.h"
29 #include "katelinerange.h"
30 #include "katetextline.h"
31 #include "katedocument.h"
35 #include <tqintdict.h>
36 #include <tqdragobject.h>
53 class KateViewInternal :
public TQWidget
57 friend class KateView;
58 friend class KateIconBorder;
60 friend class CalculatingCursor;
61 friend class BoundedCursor;
62 friend class WrappingCursor;
65 KateViewInternal ( KateView *view, KateDocument *doc );
71 void editEnd (
int editTagLineStart,
int editTagLineEnd,
bool tagFrom);
76 uint editSessionNumber;
85 bool tagLines (
int start,
int end,
bool realLines =
false);
94 void updateView (
bool changed =
false,
int viewLinesScrolled = 0);
95 void makeVisible (
const KateTextCursor& c, uint endCol,
bool force =
false,
bool center =
false,
bool calledExternally =
false);
98 inline const KateTextCursor& startPos()
const {
return m_startPos; }
99 inline uint startLine ()
const {
return m_startPos.line(); }
100 inline uint startX ()
const {
return m_startX; }
103 uint endLine ()
const;
105 KateLineRange yToKateLineRange(uint y)
const;
107 void prepareForDynWrapChange();
108 void dynWrapChanged();
110 KateView *view () {
return m_view; }
113 void slotIncFontSizes();
114 void slotDecFontSizes();
117 void scrollLines(
int line);
118 void scrollViewLines(
int offset);
119 void scrollNextPage();
120 void scrollPrevPage();
121 void scrollPrevLine();
122 void scrollNextLine();
123 void scrollColumns (
int x);
124 void viewSelectionChanged ();
131 void doDeleteWordLeft();
132 void doDeleteWordRight();
134 void cursorLeft(
bool sel=
false);
135 void cursorRight(
bool sel=
false);
136 void wordLeft(
bool sel=
false);
137 void wordRight(
bool sel=
false);
138 void home(
bool sel=
false);
139 void end(
bool sel=
false);
140 void cursorUp(
bool sel=
false);
141 void cursorDown(
bool sel=
false);
142 void cursorToMatchingBracket(
bool sel=
false);
145 void topOfView(
bool sel=
false);
146 void bottomOfView(
bool sel=
false);
147 void pageUp(
bool sel=
false);
148 void pageDown(
bool sel=
false);
149 void top(
bool sel=
false);
150 void bottom(
bool sel=
false);
151 void top_home(
bool sel=
false);
152 void bottom_end(
bool sel=
false);
155 TQPoint cursorCoordinates();
157 void paintText (
int x,
int y,
int width,
int height,
bool paintOnlyDirty =
false);
161 void paintEvent(TQPaintEvent *e);
162 bool eventFilter( TQObject *obj, TQEvent *e );
163 void keyPressEvent( TQKeyEvent* );
164 void keyReleaseEvent( TQKeyEvent* );
165 void resizeEvent( TQResizeEvent* );
166 void mousePressEvent( TQMouseEvent* );
167 void mouseDoubleClickEvent( TQMouseEvent* );
168 void mouseReleaseEvent( TQMouseEvent* );
169 void mouseMoveEvent( TQMouseEvent* );
170 void dragEnterEvent( TQDragEnterEvent* );
171 void dragMoveEvent( TQDragMoveEvent* );
172 void dropEvent( TQDropEvent* );
173 void showEvent ( TQShowEvent *);
174 void wheelEvent(TQWheelEvent* e);
175 void focusInEvent (TQFocusEvent *);
176 void focusOutEvent (TQFocusEvent *);
178 void contextMenuEvent ( TQContextMenuEvent * e );
181 void tripleClickTimeout();
185 void dropEventPass(TQDropEvent*);
188 void slotRegionVisibilityChangedAt(
unsigned int);
189 void slotRegionBeginEndAddedRemoved(
unsigned int);
190 void slotCodeFoldingChanged();
193 void moveChar( Bias bias,
bool sel );
194 void moveEdge( Bias bias,
bool sel );
196 void scrollPos(
KateTextCursor& c,
bool force =
false,
bool calledExternally =
false);
197 void scrollLines(
int lines,
bool sel );
199 uint linesDisplayed()
const;
201 int lineToY(uint viewLine)
const;
204 void updateCursor(
const KateTextCursor& newCursor,
bool force =
false,
bool center =
false,
bool calledExternally =
false );
205 void updateBracketMarks();
209 void updateMicroFocusHint();
211 void placeCursor(
const TQPoint& p,
bool keepSelection =
false,
bool updateSelection =
true );
212 bool isTargetSelected(
const TQPoint& p );
218 class KateIconBorder *leftBorder;
225 TQt::CursorShape m_mouseCursor;
231 bool possibleTripleClick;
236 enum DragState { diNone, diPending, diDragging };
241 TQTextDrag* dragObject;
244 uint iconBorderHeight;
251 TQVBoxLayout* m_lineLayout;
252 TQHBoxLayout* m_colLayout;
260 bool m_shiftKeyPressed;
263 void setAutoCenterLines(
int viewLines,
bool updateView =
true);
264 int m_autoCenterLines;
265 int m_minLinesVisible;
270 TQScrollBar *m_columnScroll;
274 bool m_selChangedByUser;
277 enum SelectionMode { Default=0, Word, Line, Mouse };
278 uint m_selectionMode;
288 TQMemArray<KateLineRange> lineRanges;
291 int maxLen(uint startLine);
294 bool columnScrollingPossible ();
297 int lineMaxCursorX(
const KateLineRange& range);
298 int lineMaxCol(
const KateLineRange& range);
302 KateLineRange range(
int realLine,
const KateLineRange* previous = 0L);
304 KateLineRange currentRange();
305 KateLineRange previousRange();
306 KateLineRange nextRange();
312 KateLineRange range(uint realLine,
int viewLine);
319 int displayViewLine(
const KateTextCursor& virtualCursor,
bool limitToVisible =
false);
322 uint lastViewLine(uint realLine);
325 uint viewLineCount(uint realLine);
336 bool m_usePlainLines;
341 return m_doc->plainKateTextLine(realLine);
343 return m_doc->kateTextLine(realLine);
347 int m_wrapChangeViewLine;
352 void startDragScroll();
353 void stopDragScroll();
357 TQTimer m_dragScrollTimer;
358 TQTimer m_scrollTimer;
359 TQTimer m_cursorTimer;
360 TQTimer m_textHintTimer;
362 static const int scrollTime = 30;
363 static const int scrollMargin = 16;
366 void scrollTimeout ();
367 void cursorTimeout ();
368 void textHintTimeout ();
372 void enableTextHints(
int timeout);
373 void disableTextHints();
376 bool m_textHintEnabled;
377 int m_textHintTimeout;
378 int m_textHintMouseX;
379 int m_textHintMouseY;
385 void imStartEvent( TQIMEvent *e );
386 void imComposeEvent( TQIMEvent *e );
387 void imEndEvent( TQIMEvent *e );
390 int m_imPreeditStartLine;
391 int m_imPreeditStart;
392 int m_imPreeditLength;
393 int m_imPreeditSelStart;
Possible additional features:
Simple cursor class with no document pointer.
TDEAction * clear(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name=0)
const TDEShortcut & end()
const TDEShortcut & home()