Compared files  

Left
C:\SDK\wxWidgets-2.6.2\contrib\src\stc\scintilla\src\Editor.cxx
Last modified2005-05-31 22:46:48.001 +0200
Size204.3 Kb (7112 Lines)
EncodingLatin 1 - ANSI (CP1252) default
Right
C:\SDK\wxWidgets-2.6.3\contrib\src\stc\scintilla\src\Editor.cxx
Last modified2006-03-16 13:07:06.001 +0100
Size206.2 Kb (7231 Lines)
EncodingLatin 1 - ANSI (CP1252) default


   Comparison Statistics  

Detailed Statistics

All Changes
 BlocksLines
Unchanged1276886
Inserted45162
Deleted950
Ignored00
Changed72359



   Comparison Details  

28 skipped lines
29U29U#include "Document.h"
30U30U#include "Editor.h"
31U31U 
  32A/*
  33A    return whether this modification represents an operation that
  34A    may reasonably be deferred (not done now OR [possibly] at all)
  35A*/
  36Astatic bool CanDeferToLastStep(const DocModification& mh) {
21 skipped lines
  58A        && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0
  59A        && (mh.modificationType & SC_LASTSTEPINUNDOREDO) != 0
  60A        && (mh.modificationType & SC_MULTILINEUNDOREDO) != 0;
  61A}
  62A 
32U63UCaret::Caret() :
33U64Uactive(false), on(false), period(500) {}
34U65U 
19 skipped lines
54U85U    edgeColumn(0),
55U86U    chars(0),
56U87U    styles(0),
  88A    styleBitsSet(0),
57U89U    indicators(0),
58U90U    positions(0),
59U91U    hsStart(0),
97 skipped lines
157U189U 
158U190ULineLayoutCache::LineLayoutCache() :
159U191U    level(0), length(0), size(0), cache(0),
160C    allInvalidated(false), styleClock(-1) { 192C    allInvalidated(false), styleClock(-1), useCount(0) {
161U193U    Allocate(0);
162U194U}
163U195U 
2 skipped lines
166U198U}
167U199U 
168U200Uvoid LineLayoutCache::Allocate(int length_) {
  201A    PLATFORM_ASSERT(cache == NULL);
169U202U    allInvalidated = false;
170U203U    length = length_;
171U204U    size = length;
8 skipped lines
180U213U}
181U214U 
182U215Uvoid LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
  216A    PLATFORM_ASSERT(useCount == 0);
183U217U    int lengthForLevel = 0;
184U218U    if (level == llcCaret) {
185U219U        lengthForLevel = 1;
4 skipped lines
190U224U    }
191U225U    if (lengthForLevel > size) {
192U226U        Deallocate();
193R    } else if (lengthForLevel < length) {  
194R        for (int i = lengthForLevel; i < length; i++) {  
195R        delete cache[i];  
196R        cache[i] = 0;  
197R        }  
198R    }  
199R    if (!cache) {  
200U227U        Allocate(lengthForLevel);
  228A    } else {
  229A        if (lengthForLevel < length) {
  230A        for (int i = lengthForLevel; i < length; i++) {
  231A        delete cache[i];
  232A        cache[i] = 0;
  233A        }
  234A        }
  235A        length = lengthForLevel;
201U236U    }
  237A    PLATFORM_ASSERT(length == lengthForLevel);
  238A    PLATFORM_ASSERT(cache != NULL || length == 0);
202U239U}
203U240U 
204U241Uvoid LineLayoutCache::Deallocate() {
  242A    PLATFORM_ASSERT(useCount == 0);
205U243U    for (int i = 0; i < length; i++)
206U244U        delete cache[i];
207U245U    delete []cache;
208U246U    cache = 0;
209U247U    length = 0;
  248A    size = 0;
210U249U}
211U250U 
212U251Uvoid LineLayoutCache::Invalidate(LineLayout::validLevel validity_) {
31 skipped lines
244U283U        pos = 0;
245U284U    } else if (level == llcPage) {
246U285U        if (lineNumber == lineCaret) {
247C        pos length; 286C        pos 0;
248U287U        } else {
249C        pos = lineNumber % length; 288C        pos 1 + (lineNumber % (length - 1));
250U289U        }
251U290U    } else if (level == llcDocument) {
252U291U        pos = lineNumber;
253U292U    }
254U293U    if (pos >= 0) {
  294A        PLATFORM_ASSERT(useCount == 0);
255U295U        if (cache && (pos < length)) {
256U296U        if (cache[pos]) {
257U297U        if ((cache[pos]->lineNumber != lineNumber) ||
9 skipped lines
267U307U        cache[pos]->lineNumber = lineNumber;
268U308U        cache[pos]->inCache = true;
269U309U        ret = cache[pos];
  310A        useCount++;
270U311U        }
271U312U        }
272U313U    }
11 skipped lines
284U325U    if (ll) {
285U326U        if (!ll->inCache) {
286U327U        delete ll;
287C        } 328C        } else {
  329C        useCount--;
  330C      }
288U331U    }
289U332U}
290U333U 
53 skipped lines
344U387U    scrollWidth = 2000;
345U388U    verticalScrollBarVisible = true;
346U389U    endAtLastLine = true;
  390A    caretSticky = false;
347U391U 
348U392U    pixmapLine = Surface::Allocate();
349U393U    pixmapSelMargin = Surface::Allocate();
11 skipped lines
361U405U    topLine = 0;
362U406U    posTopLine = 0;
363U407U 
364C    lengthForEncode = 0; 408C    lengthForEncode = -1;
365U409U 
366U410U    needUpdateUI = true;
367U411U    braces[0] = invalidPosition;
24 skipped lines
392U436U    wrapVisualStartIndent = 0;
393U437U    actualWrapVisualStartIndent = 0;
394U438U 
  439A    convertPastes = true;
  440A 
395U441U    hsStart = -1;
396U442U    hsEnd = -1;
397U443U 
22 skipped lines
420U466U    pixmapSelMargin->Release();
421U467U    pixmapSelPattern->Release();
422U468U    pixmapIndentGuide->Release();
  469A    pixmapIndentGuideHighlight->Release();
423U470U}
424U471U 
425U472Uvoid Editor::InvalidateStyleData() {
416 skipped lines
842U889U    //wMain.InvalidateAll();
843U890U}
844U891U 
845Cvoid Editor::RedrawSelMargin() { 892Cvoid Editor::RedrawSelMargin(int line) {
846U893U    if (!AbandonPaint()) {
847U894U        if (vs.maskInLine) {
848U895U        Redraw();
849U896U        } else {
850U897U        PRectangle rcSelMargin = GetClientRectangle();
851U898U        rcSelMargin.right = vs.fixedColumnWidth;
  899A        if (line != -1) {
  900A        int position = pdoc->LineStart(line);
  901A        PRectangle rcLine = RectangleFromRange(position, position);
  902A        rcSelMargin.top = rcLine.top;
  903A        rcSelMargin.bottom = rcLine.bottom;
  904A        }
852U905U        wMain.InvalidateRectangle(rcSelMargin);
853U906U        }
854U907U    }
44 skipped lines
899U952U    return Platform::Maximum(currentPos, anchor);
900U953U}
901U954U 
  955Avoid Editor::SetRectangularRange() {
  956A    if (selType == selRectangle) {
  957A        xStartSelect = XFromPosition(anchor);
  958A        xEndSelect = XFromPosition(currentPos);
  959A    }
  960A}
  961A 
902U962Uvoid Editor::InvalidateSelection(int currentPos_, int anchor_) {
903U963U    int firstAffected = anchor;
904U964U    if (firstAffected > currentPos)
21 skipped lines
926U986U        currentPos = currentPos_;
927U987U        anchor = anchor_;
928U988U    }
929C    if (selType == selRectangle) {  
930C        xStartSelect = XFromPosition(anchor); 989C    SetRectangularRange();
931C        xEndSelect = XFromPosition(currentPos);  
932C    }  
933U990U    ClaimSelection();
934U991U}
935U992U 
3 skipped lines
939U996U        InvalidateSelection(currentPos_, currentPos_);
940U997U        currentPos = currentPos_;
941U998U    }
942C    if (selType == selRectangle) {  
943C        xStartSelect = XFromPosition(anchor); 999C    SetRectangularRange();
944C        xEndSelect = XFromPosition(currentPos);  
945C    }  
946U1000U    ClaimSelection();
947U1001U}
948U1002U 
116 skipped lines
1065U1119U        SetTopLine(topLineNew);
1066U1120U        ShowCaretAtCurrentPosition();
1067U1121U        // Perform redraw rather than scroll if many lines would be redrawn anyway.
  1122A#ifndef UNDER_CE
1068U1123U        if (abs(linesToMove) <= 10) {
1069U1124U        ScrollText(linesToMove);
1070U1125U        } else {
1071U1126U        Redraw();
1072U1127U        }
  1128A#else
  1129A        Redraw();
  1130A#endif
1073U1131U        if (moveThumb) {
1074U1132U        SetVerticalScrollPos();
1075U1133U        }
796 skipped lines
1872U1930U        posLineEnd = posLineStart + ll->maxLineLength;
1873U1931U    }
1874U1932U    if (ll->validity == LineLayout::llCheckTextAndStyle) {
1875C        int lineLength = 0; 1933C        int lineLength = posLineEnd - posLineStart;
  1934C        if (!vstyle.viewEOL) {
1876C        for (int cid = posLineStart; cid < posLineEnd; cid++) { 1935C        int cid = posLineEnd - 1;
1877C        char chDoc = pdoc->CharAt(cid);  
1878C        if (vstyle.viewEOL || (!IsEOLChar(chDoc))) { 1936C        while ((cid > posLineStart) && IsEOLChar(pdoc->CharAt(cid))) {
  1937C        cid--;
1879C        lineLength++; 1938C        lineLength--;
1880U1939U        }
1881U1940U        }
1882U1941U        if (lineLength == ll->numCharsInLine) {
1883R        int numCharsInLine = 0;  
1884U1942U        // See if chars, styles, indicators, are all the same
1885U1943U        bool allSame = true;
1886U1944U        const int styleMask = pdoc->stylingBitsMask;
1887U1945U        // Check base line layout
  1946C        char styleByte = 0;
  1947C        int numCharsInLine = 0;
  1948C        while (numCharsInLine < lineLength) {
1888C        for (int charInDoc = posLineStart; allSame && (charInDoc < posLineEnd); charInDoc++) { 1949C        int charInDoc = numCharsInLine + posLineStart;
1889U1950U        char chDoc = pdoc->CharAt(charInDoc);
1890C        if (vstyle.viewEOL || (!IsEOLChar(chDoc))) { 1951C        styleByte = pdoc->StyleAt(charInDoc);
  1952C        allSame = allSame &&
  1953C                (ll->styles[numCharsInLine] == static_cast<unsigned char>(styleByte & styleMask));
  1954C        allSame = allSame &&
1891C        char styleByte = pdoc->StyleAt(charInDoc); 1955C                (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask));
  1956C        if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed)
1892U1957U        allSame = allSame &&
1893C                  (ll->styles[numCharsInLine] == static_cast<char>(styleByte & styleMask)); 1958C                (ll->chars[numCharsInLine] == chDoc);
  1959C        else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower)
1894U1960U        allSame = allSame &&
1895C                  (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask));  
1896C        if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper)  
1897C        allSame = allSame &&  
1898C                  (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc))); 1961C                (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc)));
1899C        else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower) 1962C        else// Style::caseUpper
1900C        allSame = allSame && 1963C        allSame = allSame &&
1901C                  (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc))); 1964C                (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc)));
1902C        else  
1903C        allSame = allSame &&  
1904C                  (ll->chars[numCharsInLine] == chDoc);  
1905C        numCharsInLine++; 1965C        numCharsInLine++;
1906C        }  
1907U1966U        }
  1967A        allSame = allSame && (ll->styles[numCharsInLine] == styleByte);   // For eolFilled
1908U1968U        if (allSame) {
1909U1969U        ll->validity = LineLayout::llPositions;
1910U1970U        } else {
18 skipped lines
1929U1989U 
1930U1990U        char styleByte = 0;
1931U1991U        int styleMask = pdoc->stylingBitsMask;
  1992A        ll->styleBitsSet = 0;
1932U1993U        // Fill base line layout
1933U1994U        for (int charInDoc = posLineStart; charInDoc < posLineEnd; charInDoc++) {
1934U1995U        char chDoc = pdoc->CharAt(charInDoc);
1935U1996U        styleByte = pdoc->StyleAt(charInDoc);
  1997A        ll->styleBitsSet |= styleByte;
1936U1998U        if (vstyle.viewEOL || (!IsEOLChar(chDoc))) {
1937U1999U        ll->chars[numCharsInLine] = chDoc;
1938U2000U        ll->styles[numCharsInLine] = static_cast<char>(styleByte & styleMask);
20 skipped lines
1959U2021U        bool lastSegItalics = false;
1960U2022U        Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font;
1961U2023U 
  2024A        int ctrlCharWidth[32] = {0};
1962U2025U        bool isControlNext = IsControlCharacter(ll->chars[0]);
1963U2026U        for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) {
1964U2027U        bool isControl = isControlNext;
7 skipped lines
1972U2035U        ll->positions[charInLine + 1] = ((((startsegx + 2) /
1973U2036U                                           tabWidth) + 1) * tabWidth) - startsegx;
1974U2037U        } else if (controlCharSymbol < 32) {
  2038C        if (ctrlCharWidth[ll->chars[charInLine]] == 0) {
1975C        const char *ctrlChar = ControlCharacterString(ll->chars[charInLine]); 2039C        const char *ctrlChar = ControlCharacterString(ll->chars[charInLine]);
1976C        // +3 For a blank on front and rounded edge each side: 2040C        // +3 For a blank on front and rounded edge each side:
  2041C        ctrlCharWidth[ll->chars[charInLine]] =
1977C        ll->positions[charInLine + 1] = surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3; 2042C        surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3;
  2043C        }
  2044C        ll->positions[charInLine + 1] = ctrlCharWidth[ll->chars[charInLine]];
1978U2045U        } else {
1979U2046U        char cc[2] = { static_cast<char>(controlCharSymbol), '\0' };
1980U2047U        surface->MeasureWidths(ctrlCharsFont, cc, 1,
78 skipped lines
2059U2126U        continue;
2060U2127U        }
2061U2128U        if (p > 0) {
  2129C        if (wrapState == eWrapChar){
  2130C        lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1)
  2131C        - posLineStart;
  2132C        p = pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart;
  2133C        continue;
2062C        if (ll->styles[p] != ll->styles[p - 1]) { 2134C        } else if (ll->styles[p] != ll->styles[p - 1]) {
2063U2135U        lastGoodBreak = p;
2064U2136U        } else if (IsSpaceOrTab(ll->chars[p - 1]) && !IsSpaceOrTab(ll->chars[p])) {
2065U2137U        lastGoodBreak = p;
292 skipped lines
2358U2430U        }
2359U2431U        }
2360U2432U        }
  2433A        } else if (rcSegment.left > rcLine.right) {
  2434A        break;
2361U2435U        }
2362U2436U        startseg = i + 1;
2363U2437U        }
156 skipped lines
2520U2594U        rcUL.bottom = rcUL.top + 1;