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
29 29 #include "Document.h"
30 30 #include "Editor.h"
31 31  
  32 /*
  33     return whether this modification represents an operation that
  34     may reasonably be deferred (not done now OR [possibly] at all)
  35 */
  36 static bool CanDeferToLastStep(const DocModification& mh) {
21 skipped lines
  58         && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0
  59         && (mh.modificationType & SC_LASTSTEPINUNDOREDO) != 0
  60         && (mh.modificationType & SC_MULTILINEUNDOREDO) != 0;
  61 }
  62  
32 63 Caret::Caret() :
33 64 active(false), on(false), period(500) {}
34 65  
19 skipped lines
54 85     edgeColumn(0),
55 86     chars(0),
56 87     styles(0),
  88     styleBitsSet(0),
57 89     indicators(0),
58 90     positions(0),
59 91     hsStart(0),
97 skipped lines
157 189  
158 190 LineLayoutCache::LineLayoutCache() :
159 191     level(0), length(0), size(0), cache(0),
160     allInvalidated(false), styleClock(-1) { 192     allInvalidated(false), styleClock(-1), useCount(0) {
161 193     Allocate(0);
162 194 }
163 195  
2 skipped lines
166 198 }
167 199  
168 200 void LineLayoutCache::Allocate(int length_) {
  201     PLATFORM_ASSERT(cache == NULL);
169 202     allInvalidated = false;
170 203     length = length_;
171 204     size = length;
8 skipped lines
180 213 }
181 214  
182 215 void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
  216     PLATFORM_ASSERT(useCount == 0);
183 217     int lengthForLevel = 0;
184 218     if (level == llcCaret) {
185 219         lengthForLevel = 1;
4 skipped lines
190 224     }
191 225     if (lengthForLevel > size) {
192 226         Deallocate();
193     } else if (lengthForLevel < length) {  
194         for (int i = lengthForLevel; i < length; i++) {  
195         delete cache[i];  
196         cache[i] = 0;  
197         }  
198     }  
199     if (!cache) {  
200 227         Allocate(lengthForLevel);
  228     } else {
  229         if (lengthForLevel < length) {
  230         for (int i = lengthForLevel; i < length; i++) {
  231         delete cache[i];
  232         cache[i] = 0;
  233         }
  234         }
  235         length = lengthForLevel;
201 236     }
  237     PLATFORM_ASSERT(length == lengthForLevel);
  238     PLATFORM_ASSERT(cache != NULL || length == 0);
202 239 }
203 240  
204 241 void LineLayoutCache::Deallocate() {
  242     PLATFORM_ASSERT(useCount == 0);
205 243     for (int i = 0; i < length; i++)
206 244         delete cache[i];
207 245     delete []cache;
208 246     cache = 0;
209 247     length = 0;
  248     size = 0;
210 249 }
211 250  
212 251 void LineLayoutCache::Invalidate(LineLayout::validLevel validity_) {
31 skipped lines
244 283         pos = 0;
245 284     } else if (level == llcPage) {
246 285         if (lineNumber == lineCaret) {
247         pos = length; 286         pos = 0;
248 287         } else {
249         pos = lineNumber % length; 288         pos = 1 + (lineNumber % (length - 1));
250 289         }
251 290     } else if (level == llcDocument) {
252 291         pos = lineNumber;
253 292     }
254 293     if (pos >= 0) {
  294         PLATFORM_ASSERT(useCount == 0);
255 295         if (cache && (pos < length)) {
256 296         if (cache[pos]) {
257 297         if ((cache[pos]->lineNumber != lineNumber) ||
9 skipped lines
267 307         cache[pos]->lineNumber = lineNumber;
268 308         cache[pos]->inCache = true;
269 309         ret = cache[pos];
  310         useCount++;
270 311         }
271 312         }
272 313     }
11 skipped lines
284 325     if (ll) {
285 326         if (!ll->inCache) {
286 327         delete ll;
287         } 328         } else {
  329         useCount--;
  330       }
288 331     }
289 332 }
290 333  
53 skipped lines
344 387     scrollWidth = 2000;
345 388     verticalScrollBarVisible = true;
346 389     endAtLastLine = true;
  390     caretSticky = false;
347 391  
348 392     pixmapLine = Surface::Allocate();
349 393     pixmapSelMargin = Surface::Allocate();
11 skipped lines
361 405     topLine = 0;
362 406     posTopLine = 0;
363 407  
364     lengthForEncode = 0; 408     lengthForEncode = -1;
365 409  
366 410     needUpdateUI = true;
367 411     braces[0] = invalidPosition;
24 skipped lines
392 436     wrapVisualStartIndent = 0;
393 437     actualWrapVisualStartIndent = 0;
394 438  
  439     convertPastes = true;
  440  
395 441     hsStart = -1;
396 442     hsEnd = -1;
397 443  
22 skipped lines
420 466     pixmapSelMargin->Release();
421 467     pixmapSelPattern->Release();
422 468     pixmapIndentGuide->Release();
  469     pixmapIndentGuideHighlight->Release();
423 470 }
424 471  
425 472 void Editor::InvalidateStyleData() {
416 skipped lines
842 889     //wMain.InvalidateAll();
843 890 }
844 891  
845 void Editor::RedrawSelMargin() { 892 void Editor::RedrawSelMargin(int line) {
846 893     if (!AbandonPaint()) {
847 894         if (vs.maskInLine) {
848 895         Redraw();
849 896         } else {
850 897         PRectangle rcSelMargin = GetClientRectangle();
851 898         rcSelMargin.right = vs.fixedColumnWidth;
  899         if (line != -1) {
  900         int position = pdoc->LineStart(line);
  901         PRectangle rcLine = RectangleFromRange(position, position);
  902         rcSelMargin.top = rcLine.top;
  903         rcSelMargin.bottom = rcLine.bottom;
  904         }
852 905         wMain.InvalidateRectangle(rcSelMargin);
853 906         }
854 907     }
44 skipped lines
899 952     return Platform::Maximum(currentPos, anchor);
900 953 }
901 954  
  955 void Editor::SetRectangularRange() {
  956     if (selType == selRectangle) {
  957         xStartSelect = XFromPosition(anchor);
  958         xEndSelect = XFromPosition(currentPos);
  959     }
  960 }
  961  
902 962 void Editor::InvalidateSelection(int currentPos_, int anchor_) {
903 963     int firstAffected = anchor;
904 964     if (firstAffected > currentPos)
21 skipped lines
926 986         currentPos = currentPos_;
927 987         anchor = anchor_;
928 988     }
929     if (selType == selRectangle) {  
930         xStartSelect = XFromPosition(anchor); 989     SetRectangularRange();
931         xEndSelect = XFromPosition(currentPos);  
932     }  
933 990     ClaimSelection();
934 991 }
935 992  
3 skipped lines
939 996         InvalidateSelection(currentPos_, currentPos_);
940 997         currentPos = currentPos_;
941 998     }
942     if (selType == selRectangle) {  
943         xStartSelect = XFromPosition(anchor); 999     SetRectangularRange();
944         xEndSelect = XFromPosition(currentPos);  
945     }  
946 1000     ClaimSelection();
947 1001 }
948 1002  
116 skipped lines
1065 1119         SetTopLine(topLineNew);
1066 1120         ShowCaretAtCurrentPosition();
1067 1121         // Perform redraw rather than scroll if many lines would be redrawn anyway.
  1122 #ifndef UNDER_CE
1068 1123         if (abs(linesToMove) <= 10) {
1069 1124         ScrollText(linesToMove);
1070 1125         } else {
1071 1126         Redraw();
1072 1127         }
  1128 #else
  1129         Redraw();
  1130 #endif
1073 1131         if (moveThumb) {
1074 1132         SetVerticalScrollPos();
1075 1133         }
796 skipped lines
1872 1930         posLineEnd = posLineStart + ll->maxLineLength;
1873 1931     }
1874 1932     if (ll->validity == LineLayout::llCheckTextAndStyle) {
1875         int lineLength = 0; 1933         int lineLength = posLineEnd - posLineStart;