~ubuntu-branches/ubuntu/maverick/codelite/maverick

« back to all changes in this revision

Viewing changes to sdk/wxscintilla/src/scintilla/src/Editor.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-07-29 19:42:47 UTC
  • mfrom: (1.1.9 upstream) (18.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20100729194247-cuibfk03wog33nxq
Tags: 2.6.0.4189~dfsg-1
* New upstream release.
* Bump Standards.
* Refresh patches.
* Add license information about files under ./Debugger/

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
#ifndef EDITOR_H
9
9
#define EDITOR_H
10
10
 
 
11
// Eran Ifrah
 
12
#include <string>
 
13
// Eran Ifrah - END
 
14
 
11
15
#ifdef SCI_NAMESPACE
12
16
namespace Scintilla {
13
17
#endif
46
50
};
47
51
 
48
52
/**
 
53
 * When platform has a way to generate an event before painting,
 
54
 * accumulate needed styling range in StyleNeeded to avoid unnecessary work.
 
55
 */
 
56
class StyleNeeded {
 
57
public:
 
58
        bool active;
 
59
        Position upTo;
 
60
 
 
61
        StyleNeeded() : active(false), upTo(0) {}
 
62
        void Reset() {
 
63
                active = false;
 
64
                upTo = 0;
 
65
        }
 
66
        void NeedUpTo(Position pos) {
 
67
                if (upTo < pos)
 
68
                        upTo = pos;
 
69
        }
 
70
};
 
71
 
 
72
/**
49
73
 * Hold a piece of text selected for copying or dragging.
50
74
 * The text is expected to hold a terminating '\0' and this is counted in len.
51
75
 */
98
122
 */
99
123
class Editor : public DocWatcher {
100
124
        // Private so Editor objects can not be copied
101
 
        Editor(const Editor &) : DocWatcher() {}
102
 
        Editor &operator=(const Editor &) { return *this; }
 
125
        Editor(const Editor &);
 
126
        Editor &operator=(const Editor &);
103
127
 
104
128
protected:      // ScintillaBase subclass needs access to much of Editor
105
129
 
142
166
        bool caretSticky;
143
167
        bool multipleSelection;
144
168
        bool additionalSelectionTyping;
 
169
        int multiPasteMode;
145
170
        bool additionalCaretsBlink;
146
171
        bool additionalCaretsVisible;
147
172
 
196
221
        enum { notPainting, painting, paintAbandoned } paintState;
197
222
        PRectangle rcPaint;
198
223
        bool paintingAllText;
 
224
        StyleNeeded styleNeeded;
199
225
 
200
226
        int modEventMask;
201
227
 
271
297
        bool AbandonPaint();
272
298
        void RedrawRect(PRectangle rc);
273
299
        void Redraw();
274
 
        void RedrawSelMargin(int line=-1);
 
300
        void RedrawSelMargin(int line=-1, bool allAfter=false);
275
301
        PRectangle RectangleFromRange(int start, int end);
276
302
        void InvalidateRange(int start, int end);
277
303
 
283
309
        SelectionPosition SelectionStart();
284
310
        SelectionPosition SelectionEnd();
285
311
        void SetRectangularRange();
 
312
        void ThinRectangularRange();
286
313
        void InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection=false);
287
314
        void SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_);
288
315
        void SetSelection(int currentPos_, int anchor_);
306
333
        void HorizontalScrollTo(int xPos);
307
334
        void MoveCaretInsideView(bool ensureVisible=true);
308
335
        int DisplayFromPosition(int pos);
 
336
 
 
337
        struct XYScrollPosition {
 
338
                int xOffset;
 
339
                int topLine;
 
340
                XYScrollPosition(int xOffset_, int topLine_) : xOffset(xOffset_), topLine(topLine_) {}
 
341
        };
 
342
        XYScrollPosition XYScrollToMakeVisible(const bool useMargin, const bool vert, const bool horiz);
 
343
        void SetXYScroll(XYScrollPosition newXY);
309
344
        void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true);
310
345
        void ShowCaretAtCurrentPosition();
311
346
        void DropCaret();
337
372
        PRectangle rcLine, LineLayout *ll, int subLine);
338
373
        void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
339
374
                PRectangle rcLine, LineLayout *ll, int subLine);
340
 
        void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, 
 
375
        void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine,
341
376
                int xStart, int offset, int posCaret, PRectangle rcCaret, ColourAllocated caretColour);
342
377
        void DrawCarets(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
343
378
                PRectangle rcLine, LineLayout *ll, int subLine);
357
392
        int InsertSpace(int position, unsigned int spaces);
358
393
        void AddChar(char ch);
359
394
        virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false);
 
395
        void InsertPaste(SelectionPosition selStart, const char *text, int len);
360
396
        void ClearSelection();
361
397
        void ClearAll();
362
398
        void ClearDocumentStyle();
402
438
        void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
403
439
 
404
440
        void PageMove(int direction, Selection::selTypes sel=Selection::noSel, bool stuttered = false);
405
 
        void ChangeCaseOfSelection(bool makeUpperCase);
 
441
        enum { cmSame, cmUpper, cmLower } caseMap;
 
442
        virtual std::string CaseMapString(const std::string &s, int caseMapping);
 
443
        void ChangeCaseOfSelection(int caseMapping);
406
444
        void LineTranspose();
407
445
        void Duplicate(bool forLine);
408
446
        virtual void CancelModes();
419
457
 
420
458
        void Indent(bool forwards);
421
459
 
 
460
        virtual CaseFolder *CaseFolderForEncoding();
422
461
        long FindText(uptr_t wParam, sptr_t lParam);
423
462
        void SearchAnchor();
424
463
        long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
441
480
        bool PointInSelMargin(Point pt);
442
481
        void LineSelection(int lineCurrent_, int lineAnchor_);
443
482
        void DwellEnd(bool mouseMoved);
 
483
        void MouseLeave();
444
484
        virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
445
485
        void ButtonMove(Point pt);
446
486
        void ButtonUp(Point pt, unsigned int curTime, bool ctrl);
453
493
        virtual bool HaveMouseCapture() = 0;
454
494
        void SetFocusState(bool focusState);
455
495
 
 
496
        int PositionAfterArea(PRectangle rcArea);
 
497
        void StyleToPositionInView(Position pos);
 
498
        void IdleStyling();
 
499
        virtual void QueueStyling(int upTo);
 
500
 
456
501
        virtual bool PaintContains(PRectangle rc);
457
502
        bool PaintContainsMargin();
458
503
        void CheckForChangeOutsidePaint(Range r);
460
505
 
461
506
        void SetAnnotationHeights(int start, int end);
462
507
        void SetDocPointer(Document *document);
463
 
        
 
508
 
464
509
        void SetAnnotationVisible(int visible);
465
510
 
466
511
        void Expand(int &line, bool doExpand);
467
512
        void ToggleContraction(int line);
468
513
        void EnsureLineVisible(int lineDoc, bool enforcePolicy);
 
514
        int GetTag(char *tagValue, int tagNumber);
469
515
        int ReplaceTarget(bool replacePatterns, const char *text, int length=-1);
470
516
 
471
517
        bool PositionIsHotspot(int position);