Compared files  

Left
C:\SDK\wxWidgets-2.6.2\contrib\src\stc\scintilla\src\Document.cxx
Last modified2005-03-21 12:17:52.000 +0100
Size38 Kb (1478 Lines)
EncodingLatin 1 - ANSI (CP1252) default
Right
C:\SDK\wxWidgets-2.6.3\contrib\src\stc\scintilla\src\Document.cxx
Last modified2006-03-16 13:07:04.000 +0100
Size40.5 Kb (1594 Lines)
EncodingLatin 1 - ANSI (CP1252) default


   Comparison Statistics  

Detailed Statistics

All Changes
 BlocksLines
Unchanged501361
Inserted1498
Deleted415
Ignored00
Changed31237



   Comparison Details  

102 skipped lines
103 103  
104 104 int Document::AddMark(int line, int markerNum) {
105 105     int prev = cb.AddMark(line, markerNum);
106     DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0); 106     DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
  107     mh.line = line;
107 108     NotifyModified(mh);
108 109     return prev;
109 110 }
110 111  
  112 void Document::AddMarkSet(int line, int valueSet) {
  113     unsigned int m = valueSet;
  114     for (int i = 0; m; i++, m >>= 1)
  115         if (m & 1)
  116         cb.AddMark(line, i);
  117     DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
  118     mh.line = line;
  119     NotifyModified(mh);
  120 }
  121  
111 122 void Document::DeleteMark(int line, int markerNum) {
112 123     cb.DeleteMark(line, markerNum);
113     DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0); 124     DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
  125     mh.line = line;
114 126     NotifyModified(mh);
115 127 }
116 128  
117 129 void Document::DeleteMarkFromHandle(int markerHandle) {
118 130     cb.DeleteMarkFromHandle(markerHandle);
119 131     DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
  132     mh.line = -1;
120 133     NotifyModified(mh);
121 134 }
122 135  
123 136 void Document::DeleteAllMarks(int markerNum) {
124 137     cb.DeleteAllMarks(markerNum);
125 138     DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
  139     mh.line = -1;
126 140     NotifyModified(mh);
127 141 }
128 142  
137 skipped lines
266 280         return 1;
267 281     }
268 282 }
269 #include <assert.h> 283  
270 284 // Normalise a position so that it is not halfway through a two byte character.
271 285 // This can occur in two situations -
272 286 // When lines are terminated with \r\n pairs which should be treated as one character.
7 skipped lines
280 294     if (pos >= Length())
281 295         return Length();
282 296  
283     // asserpos > 0 && pos < Length() 297     // PLATFORM_ASSERT(pos > 0 && pos < Length());
284 298     if (checkLineEnd && IsCrLf(pos - 1)) {
285 299         if (moveDir > 0)
286 300         return pos + 1;
49 skipped lines
336 350         endStyled = pos;
337 351 }
338 352  
  353 void Document::CheckReadOnly() {
  354     if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
  355         enteredReadOnlyCount++;
  356         NotifyModifyAttempt();
  357         enteredReadOnlyCount--;
  358     }
  359 }
  360  
339 361 // Document only modified by gateways DeleteChars, InsertStyledString, Undo, Redo, and SetStyleAt.
340 362 // SetStyleAt does not change the persistent state of a document
341 363  
3 skipped lines
345 367         return false;
346 368     if ((pos + len) > Length())
347 369         return false;
348     if (cb.IsReadOnly() && enteredReadOnlyCount == 0) { 370     CheckReadOnly();
349         enteredReadOnlyCount++;  
350         NotifyModifyAttempt();  
351         enteredReadOnlyCount--;  
352     }  
353 371     if (enteredCount != 0) {
354 372         return false;
355 373     } else {
28 skipped lines
384 402  * Insert a styled string (char/style pairs) with a length.
385 403  */
386 404 bool Document::InsertStyledString(int position, char *s, int insertLength) {
387     if (cb.IsReadOnly() && enteredReadOnlyCount == 0) { 405     CheckReadOnly();
388         enteredReadOnlyCount++;  
389         NotifyModifyAttempt();  
390         enteredReadOnlyCount--;  
391     }  
392 406     if (enteredCount != 0) {
393 407         return false;
394 408     } else {
22 skipped lines
417 431 }
418 432  
419 433 int Document::Undo() {
420     int newPos = 0; 434     int newPos = -1;
  435     CheckReadOnly();
421 436     if (enteredCount == 0) {
422 437         enteredCount++;
  438         if (!cb.IsReadOnly()) {
423         bool startSavePoint = cb.IsSavePoint(); 439         bool startSavePoint = cb.IsSavePoint();
  440         bool multiLine = false;
424         int steps = cb.StartUndo(); 441         int steps = cb.StartUndo();
425         //Platform::DebugPrintf("Steps=%d\n", steps); 442         //Platform::DebugPrintf("Steps=%d\n", steps);
426         for (int step = 0; step < steps; step++) { 443         for (int step = 0; step < steps; step++) {
427         int prevLinesTotal = LinesTotal(); 444         const int prevLinesTotal = LinesTotal();
428         const Action &action = cb.GetUndoStep(); 445         const Action &action = cb.GetUndoStep();
429         if (action.at == removeAction) { 446         if (action.at == removeAction) {
430         NotifyModified(DocModification( 447         NotifyModified(DocModification(
431                            SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); 448         SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
432         } else { 449         } else {
433         NotifyModified(DocModification( 450         NotifyModified(DocModification(
434                            SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); 451         SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
435         } 452         }
436         cb.PerformUndoStep(); 453         cb.PerformUndoStep();
437         int cellPosition = action.position / 2; 454         int cellPosition = action.position;
438         ModifiedAt(cellPosition); 455         ModifiedAt(cellPosition);
439         newPos = cellPosition; 456         newPos = cellPosition;
440 457  
441         int modFlags = SC_PERFORMED_UNDO; 458         int modFlags = SC_PERFORMED_UNDO;
442         // With undo, an insertion action becomes a deletion notification 459         // With undo, an insertion action becomes a deletion notification
443         if (action.at == removeAction) { 460         if (action.at == removeAction) {
444         newPos += action.lenData; 461         newPos += action.lenData;
445         modFlags |= SC_MOD_INSERTTEXT; 462         modFlags |= SC_MOD_INSERTTEXT;
446         } else { 463         } else {
447         modFlags |= SC_MOD_DELETETEXT; 464         modFlags |= SC_MOD_DELETETEXT;
  465         }
  466         if (steps > 1)
  467         modFlags |= SC_MULTISTEPUNDOREDO;
  468         const int linesAdded = LinesTotal() - prevLinesTotal;
  469         if (linesAdded != 0)
  470         multiLine = true;
  471         if (step == steps - 1) {
  472         modFlags |= SC_LASTSTEPINUNDOREDO;
  473         if (multiLine)
  474         modFlags |= SC_MULTILINEUNDOREDO;
  475         }
  476         NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
  477            linesAdded, action.data));
448 478         }
449         if (step == steps - 1)  
450         modFlags |= SC_LASTSTEPINUNDOREDO;  
451         NotifyModified(DocModification(modFlags, cellPosition, action.lenData,  
452                                        LinesTotal() - prevLinesTotal, action.data));  
453         }  
454 479  
455         bool endSavePoint = cb.IsSavePoint(); 480         bool endSavePoint = cb.IsSavePoint();
456         if (startSavePoint != endSavePoint) 481         if (startSavePoint != endSavePoint)
457         NotifySavePoint(endSavePoint); 482         NotifySavePoint(endSavePoint);
  483         }
458 484         enteredCount--;
459 485     }
460 486     return newPos;
461 487 }
462 488  
463 489 int Document::Redo() {
464     int newPos = 0; 490     int newPos = -1;
  491     CheckReadOnly();
465 492     if (enteredCount == 0) {
466 493         enteredCount++;
  494         if (!cb.IsReadOnly()) {
467         bool startSavePoint = cb.IsSavePoint(); 495         bool startSavePoint = cb.IsSavePoint();
  496         bool multiLine = false;
468         int steps = cb.StartRedo(); 497         int steps = cb.StartRedo();
469         for (int step = 0; step < steps; step++) { 498         for (int step = 0; step < steps; step++) {
470         int prevLinesTotal = LinesTotal(); 499         const int prevLinesTotal = LinesTotal();
471         const Action &action = cb.GetRedoStep(); 500         const Action &action = cb.GetRedoStep();
472         if (action.at == insertAction) { 501         if (action.at == insertAction) {
473         NotifyModified(DocModification( 502         NotifyModified(DocModification(
474                            SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action)); 503         SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
475         } else { 504         } else {
476         NotifyModified(DocModification( 505         NotifyModified(DocModification(
477                            SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action)); 506         SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
478         } 507         }
479         cb.PerformRedoStep(); 508         cb.PerformRedoStep();
480         ModifiedAt(action.position / 2); 509         ModifiedAt(action.position);
481         newPos = action.position / 2; 510         newPos = action.position;
482 511  
483         int modFlags = SC_PERFORMED_REDO; 512         int modFlags = SC_PERFORMED_REDO;
484         if (action.at == insertAction) { 513         if (action.at == insertAction) {
485         newPos += action.lenData; 514         newPos += action.lenData;
486         modFlags |= SC_MOD_INSERTTEXT; 515         modFlags |= SC_MOD_INSERTTEXT;
487         } else { 516         } else {
488         modFlags |= SC_MOD_DELETETEXT; 517         modFlags |= SC_MOD_DELETETEXT;
  518         }
  519         if (steps > 1)
  520         modFlags |= SC_MULTISTEPUNDOREDO;
  521         const int linesAdded = LinesTotal() - prevLinesTotal;
  522         if (linesAdded != 0)
  523         multiLine = true;
  524         if (