fixed some DOS/Unix line-terminator confusion in the source files

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7227 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-04-21 16:44:19 +00:00
parent 9a993e53d7
commit f70cba4b45
10 changed files with 142 additions and 126 deletions

View File

@@ -344,21 +344,21 @@ void Action::Grab(Action *source) {
source->lenData = 0;
}
// The undo history stores a sequence of user operations that represent the user's view of the
// commands executed on the text.
// The undo history stores a sequence of user operations that represent the user's view of the
// commands executed on the text.
// Each user operation contains a sequence of text insertion and text deletion actions.
// All the user operations are stored in a list of individual actions with 'start' actions used
// as delimiters between user operations.
// Initially there is one start action in the history.
// As each action is performed, it is recorded in the history. The action may either become
// Initially there is one start action in the history.
// As each action is performed, it is recorded in the history. The action may either become
// part of the current user operation or may start a new user operation. If it is to be part of the
// current operation, then it overwrites the current last action. If it is to be part of a new
// current operation, then it overwrites the current last action. If it is to be part of a new
// operation, it is appended after the current last action.
// After writing the new action, a new start action is appended at the end of the history.
// The decision of whether to start a new user operation is based upon two factors. If a
// The decision of whether to start a new user operation is based upon two factors. If a
// compound operation has been explicitly started by calling BeginUndoAction and no matching
// EndUndoAction (these calls nest) has been called, then the action is coalesced into the current
// operation. If there is no outstanding BeginUndoAction call then a new operation is started
// EndUndoAction (these calls nest) has been called, then the action is coalesced into the current
// operation. If there is no outstanding BeginUndoAction call then a new operation is started
// unless it looks as if the new action is caused by the user typing or deleting a stream of text.
// Sequences that look like typing or deletion are coalesced into a single user operation.
@@ -402,7 +402,7 @@ void UndoHistory::EnsureUndoRoom() {
void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData) {
EnsureUndoRoom();
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction);
//Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at,
//Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at,
// actions[currentAction - 1].position, actions[currentAction - 1].lenData);
if (currentAction >= 1) {
if (0 == undoSequenceDepth) {
@@ -414,11 +414,11 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
currentAction++;
} else if (currentAction == savePoint) {
currentAction++;
} else if ((at == removeAction) &&
} else if ((at == removeAction) &&
((position + lengthData * 2) != actPrevious.position)) {
// Removals must be at same position to coalesce
currentAction++;
} else if ((at == insertAction) &&
} else if ((at == insertAction) &&
(position != (actPrevious.position + actPrevious.lenData*2))) {
// Insertions must be immediately after to coalesce
currentAction++;
@@ -427,7 +427,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
}
} else {
currentAction++;
}
}
} else {
currentAction++;
}
@@ -460,7 +460,7 @@ void UndoHistory::EndUndoAction() {
}
}
}
void UndoHistory::DropUndoSequence() {
undoSequenceDepth = 0;
}
@@ -490,9 +490,9 @@ int UndoHistory::StartUndo() {
// Drop any trailing startAction
if (actions[currentAction].at == startAction && currentAction > 0)
currentAction--;
// Count the steps in this action
int act = currentAction;
int act = currentAction;
while (actions[act].at != startAction && act > 0) {
act--;
}
@@ -511,9 +511,9 @@ int UndoHistory::StartRedo() {
// Drop any leading startAction
if (actions[currentAction].at == startAction && currentAction < maxAction)
currentAction++;
// Count the steps in this action
int act = currentAction;
int act = currentAction;
while (actions[act].at != startAction && act < maxAction) {
act++;
}
@@ -1000,7 +1000,7 @@ int CellBuffer::GetLineState(int line) {
int CellBuffer::GetMaxLineState() {
return lineStates.Length();
}
int CellBuffer::SetLevel(int line, int level) {
int prev = 0;
if ((line >= 0) && (line < lv.lines)) {

View File

@@ -65,27 +65,27 @@ void Document::SetSavePoint() {
NotifySavePoint(true);
}
int Document::AddMark(int line, int markerNum) {
int prev = cb.AddMark(line, markerNum);
int Document::AddMark(int line, int markerNum) {
int prev = cb.AddMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
NotifyModified(mh);
return prev;
}
void Document::DeleteMark(int line, int markerNum) {
cb.DeleteMark(line, markerNum);
void Document::DeleteMark(int line, int markerNum) {
cb.DeleteMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
NotifyModified(mh);
}
void Document::DeleteMarkFromHandle(int markerHandle) {
cb.DeleteMarkFromHandle(markerHandle);
void Document::DeleteMarkFromHandle(int markerHandle) {
cb.DeleteMarkFromHandle(markerHandle);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
NotifyModified(mh);
}
void Document::DeleteAllMarks(int markerNum) {
cb.DeleteAllMarks(markerNum);
void Document::DeleteAllMarks(int markerNum) {
cb.DeleteAllMarks(markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
NotifyModified(mh);
}
@@ -128,8 +128,8 @@ int Document::VCHomePosition(int position) {
return startText;
}
int Document::SetLevel(int line, int level) {
int prev = cb.SetLevel(line, level);
int Document::SetLevel(int line, int level) {
int prev = cb.SetLevel(line, level);
if (prev != level) {
DocModification mh(SC_MOD_CHANGEFOLD, LineStart(line), 0, 0, 0);
mh.line = line;
@@ -143,7 +143,7 @@ int Document::SetLevel(int line, int level) {
static bool IsSubordinate(int levelStart, int levelTry) {
if (levelTry & SC_FOLDLEVELWHITEFLAG)
return true;
else
else
return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK);
}
@@ -160,7 +160,7 @@ int Document::GetLastChild(int lineParent, int level) {
}
if (lineMaxSubord > lineParent) {
if (level > (GetLevel(lineMaxSubord+1) & SC_FOLDLEVELNUMBERMASK)) {
// Have chewed up some whitespace that belongs to a parent so seek back
// Have chewed up some whitespace that belongs to a parent so seek back
if ((lineMaxSubord > lineParent) && (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG)) {
lineMaxSubord--;
}
@@ -173,7 +173,7 @@ int Document::GetFoldParent(int line) {
int level = GetLevel(line);
int lineLook = line-1;
while ((lineLook > 0) && (
(!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
(!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
) {
lineLook--;
@@ -323,7 +323,7 @@ void Document::InsertStyledString(int position, char *s, int insertLength) {
if (startSavePoint && cb.IsCollectingUndo())
NotifySavePoint(!startSavePoint);
ModifiedAt(position / 2);
int modFlags = SC_MOD_INSERTTEXT | SC_PERFORMED_USER;
DocModification mh(modFlags, position / 2, insertLength / 2, LinesTotal() - prevLinesTotal, text);
NotifyModified(mh);
@@ -345,7 +345,7 @@ int Document::Undo() {
int cellPosition = action.position / 2;
ModifiedAt(cellPosition);
newPos = cellPosition;
int modFlags = SC_PERFORMED_UNDO;
// With undo, an insertion action becomes a deletion notification
if (action.at == removeAction) {
@@ -356,10 +356,10 @@ int Document::Undo() {
}
if (step == steps-1)
modFlags |= SC_LASTSTEPINUNDOREDO;
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
@@ -380,7 +380,7 @@ int Document::Redo() {
int cellPosition = action.position / 2;
ModifiedAt(cellPosition);
newPos = cellPosition;
int modFlags = SC_PERFORMED_REDO;
if (action.at == insertAction) {
newPos += action.lenData;
@@ -390,10 +390,10 @@ int Document::Redo() {
}
if (step == steps-1)
modFlags |= SC_LASTSTEPINUNDOREDO;
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
@@ -585,7 +585,7 @@ long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitiv
// Range endpoints should not be inside DBCS characters, but just in case, move them.
int startPos = MovePositionOutsideChar(minPos, increment, false);
int endPos = MovePositionOutsideChar(maxPos, increment, false);
// Compute actual search ranges needed
int lengthFind = strlen(s);
int endSearch = 0;
@@ -697,7 +697,7 @@ void Document::SetStyleFor(int length, char style) {
enteredCount++;
int prevEndStyled = endStyled;
if (cb.SetStyleFor(stylingPos, length, style, stylingMask)) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, length);
NotifyModified(mh);
}
@@ -719,7 +719,7 @@ void Document::SetStyles(int length, char *styles) {
}
endStyled = stylingPos;
if (didChange) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, endStyled - prevEndStyled);
NotifyModified(mh);
}
@@ -795,3 +795,5 @@ void Document::NotifyModified(DocModification mh) {
watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData);
}
}

View File

@@ -3,11 +3,11 @@
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
@@ -43,3 +43,5 @@ void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle,
styler.ColourTo(startPos + lengthDoc - 1, 0);
}
}

View File

@@ -15,7 +15,7 @@ Style::Style() {
Platform::DefaultFontSize(), 0,
false, false, false);
}
Style::~Style() {
if (aliasOfDefaultFont)
font.SetID(0);
@@ -39,7 +39,7 @@ Style &Style::operator=(const Style &source) {
return *this;
}
void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
bool bold_, bool italic_, bool eolFilled_) {
fore.desired = fore_;
back.desired = back_;
@@ -50,7 +50,7 @@ void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
eolFilled = eolFilled_;
if (aliasOfDefaultFont)
font.SetID(0);
else
else
font.Release();
aliasOfDefaultFont = false;
}
@@ -76,10 +76,10 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
if (aliasOfDefaultFont)
font.SetID(0);
else
font.Release();
else
font.Release();
int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72;
aliasOfDefaultFont = defaultStyle &&
aliasOfDefaultFont = defaultStyle &&
(EquivalentFontTo(defaultStyle) || !fontName);
if (aliasOfDefaultFont) {
font.SetID(defaultStyle->font.GetID());
@@ -99,3 +99,5 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
aveCharWidth = surface.AverageCharWidth(font);
spaceWidth = surface.WidthChar(font, ' ');
}

View File

@@ -13,7 +13,7 @@
#include "Style.h"
#include "ViewStyle.h"
MarginStyle::MarginStyle() :
MarginStyle::MarginStyle() :
symbol(false), width(16), mask(0xffffffff), sensitive(false) {
}
@@ -64,7 +64,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
for (int ind=0;ind<=INDIC_MAX;ind++) {
indicators[ind] = source.indicators[ind];
}
selforeset = source.selforeset;
selforeground.desired = source.selforeground.desired;
selbackset = source.selbackset;
@@ -84,7 +84,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
zoomLevel = source.zoomLevel;
viewWhitespace = source.viewWhitespace;
viewEOL = source.viewEOL;
showMarkedLines = source.showMarkedLines;
showMarkedLines = source.showMarkedLines;
}
ViewStyle::~ViewStyle() {
@@ -93,7 +93,7 @@ ViewStyle::~ViewStyle() {
void ViewStyle::Init() {
fontNames.Clear();
ResetDefaultStyle();
indicators[0].style = INDIC_SQUIGGLE;
indicators[0].fore = Colour(0, 0x7f, 0);
indicators[1].style = INDIC_TT;
@@ -118,7 +118,7 @@ void ViewStyle::Init() {
//caretcolour.desired = Colour(0xff, 0, 0);
caretcolour.desired = Colour(0, 0, 0);
edgecolour.desired = Colour(0xc0, 0xc0, 0xc0);
leftMarginWidth = 1;
rightMarginWidth = 1;
ms[0].symbol = false;
@@ -183,7 +183,7 @@ void ViewStyle::Refresh(Surface &surface) {
maxDescent = styles[i].descent;
}
}
lineHeight = maxAscent + maxDescent;
aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
spaceWidth = styles[STYLE_DEFAULT].spaceWidth;
@@ -210,11 +210,11 @@ void ViewStyle::ClearStyles() {
for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
if (i != STYLE_DEFAULT) {
styles[i].Clear(
styles[STYLE_DEFAULT].fore.desired,
styles[STYLE_DEFAULT].back.desired,
styles[STYLE_DEFAULT].size,
styles[STYLE_DEFAULT].fontName,
styles[STYLE_DEFAULT].bold,
styles[STYLE_DEFAULT].fore.desired,
styles[STYLE_DEFAULT].back.desired,
styles[STYLE_DEFAULT].size,
styles[STYLE_DEFAULT].fontName,
styles[STYLE_DEFAULT].bold,
styles[STYLE_DEFAULT].italic,
styles[STYLE_DEFAULT].eolFilled);
}
@@ -225,3 +225,5 @@ void ViewStyle::ClearStyles() {
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
styles[styleIndex].fontName = fontNames.Save(name);
}

View File

@@ -344,21 +344,21 @@ void Action::Grab(Action *source) {
source->lenData = 0;
}
// The undo history stores a sequence of user operations that represent the user's view of the
// commands executed on the text.
// The undo history stores a sequence of user operations that represent the user's view of the
// commands executed on the text.
// Each user operation contains a sequence of text insertion and text deletion actions.
// All the user operations are stored in a list of individual actions with 'start' actions used
// as delimiters between user operations.
// Initially there is one start action in the history.
// As each action is performed, it is recorded in the history. The action may either become
// Initially there is one start action in the history.
// As each action is performed, it is recorded in the history. The action may either become
// part of the current user operation or may start a new user operation. If it is to be part of the
// current operation, then it overwrites the current last action. If it is to be part of a new
// current operation, then it overwrites the current last action. If it is to be part of a new
// operation, it is appended after the current last action.
// After writing the new action, a new start action is appended at the end of the history.
// The decision of whether to start a new user operation is based upon two factors. If a
// The decision of whether to start a new user operation is based upon two factors. If a
// compound operation has been explicitly started by calling BeginUndoAction and no matching
// EndUndoAction (these calls nest) has been called, then the action is coalesced into the current
// operation. If there is no outstanding BeginUndoAction call then a new operation is started
// EndUndoAction (these calls nest) has been called, then the action is coalesced into the current
// operation. If there is no outstanding BeginUndoAction call then a new operation is started
// unless it looks as if the new action is caused by the user typing or deleting a stream of text.
// Sequences that look like typing or deletion are coalesced into a single user operation.
@@ -402,7 +402,7 @@ void UndoHistory::EnsureUndoRoom() {
void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData) {
EnsureUndoRoom();
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction);
//Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at,
//Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at,
// actions[currentAction - 1].position, actions[currentAction - 1].lenData);
if (currentAction >= 1) {
if (0 == undoSequenceDepth) {
@@ -414,11 +414,11 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
currentAction++;
} else if (currentAction == savePoint) {
currentAction++;
} else if ((at == removeAction) &&
} else if ((at == removeAction) &&
((position + lengthData * 2) != actPrevious.position)) {
// Removals must be at same position to coalesce
currentAction++;
} else if ((at == insertAction) &&
} else if ((at == insertAction) &&
(position != (actPrevious.position + actPrevious.lenData*2))) {
// Insertions must be immediately after to coalesce
currentAction++;
@@ -427,7 +427,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
}
} else {
currentAction++;
}
}
} else {
currentAction++;
}
@@ -460,7 +460,7 @@ void UndoHistory::EndUndoAction() {
}
}
}
void UndoHistory::DropUndoSequence() {
undoSequenceDepth = 0;
}
@@ -490,9 +490,9 @@ int UndoHistory::StartUndo() {
// Drop any trailing startAction
if (actions[currentAction].at == startAction && currentAction > 0)
currentAction--;
// Count the steps in this action
int act = currentAction;
int act = currentAction;
while (actions[act].at != startAction && act > 0) {
act--;
}
@@ -511,9 +511,9 @@ int UndoHistory::StartRedo() {
// Drop any leading startAction
if (actions[currentAction].at == startAction && currentAction < maxAction)
currentAction++;
// Count the steps in this action
int act = currentAction;
int act = currentAction;
while (actions[act].at != startAction && act < maxAction) {
act++;
}
@@ -1000,7 +1000,7 @@ int CellBuffer::GetLineState(int line) {
int CellBuffer::GetMaxLineState() {
return lineStates.Length();
}
int CellBuffer::SetLevel(int line, int level) {
int prev = 0;
if ((line >= 0) && (line < lv.lines)) {

View File

@@ -65,27 +65,27 @@ void Document::SetSavePoint() {
NotifySavePoint(true);
}
int Document::AddMark(int line, int markerNum) {
int prev = cb.AddMark(line, markerNum);
int Document::AddMark(int line, int markerNum) {
int prev = cb.AddMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
NotifyModified(mh);
return prev;
}
void Document::DeleteMark(int line, int markerNum) {
cb.DeleteMark(line, markerNum);
void Document::DeleteMark(int line, int markerNum) {
cb.DeleteMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
NotifyModified(mh);
}
void Document::DeleteMarkFromHandle(int markerHandle) {
cb.DeleteMarkFromHandle(markerHandle);
void Document::DeleteMarkFromHandle(int markerHandle) {
cb.DeleteMarkFromHandle(markerHandle);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
NotifyModified(mh);
}
void Document::DeleteAllMarks(int markerNum) {
cb.DeleteAllMarks(markerNum);
void Document::DeleteAllMarks(int markerNum) {
cb.DeleteAllMarks(markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
NotifyModified(mh);
}
@@ -128,8 +128,8 @@ int Document::VCHomePosition(int position) {
return startText;
}
int Document::SetLevel(int line, int level) {
int prev = cb.SetLevel(line, level);
int Document::SetLevel(int line, int level) {
int prev = cb.SetLevel(line, level);
if (prev != level) {
DocModification mh(SC_MOD_CHANGEFOLD, LineStart(line), 0, 0, 0);
mh.line = line;
@@ -143,7 +143,7 @@ int Document::SetLevel(int line, int level) {
static bool IsSubordinate(int levelStart, int levelTry) {
if (levelTry & SC_FOLDLEVELWHITEFLAG)
return true;
else
else
return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK);
}
@@ -160,7 +160,7 @@ int Document::GetLastChild(int lineParent, int level) {
}
if (lineMaxSubord > lineParent) {
if (level > (GetLevel(lineMaxSubord+1) & SC_FOLDLEVELNUMBERMASK)) {
// Have chewed up some whitespace that belongs to a parent so seek back
// Have chewed up some whitespace that belongs to a parent so seek back
if ((lineMaxSubord > lineParent) && (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG)) {
lineMaxSubord--;
}
@@ -173,7 +173,7 @@ int Document::GetFoldParent(int line) {
int level = GetLevel(line);
int lineLook = line-1;
while ((lineLook > 0) && (
(!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
(!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
) {
lineLook--;
@@ -323,7 +323,7 @@ void Document::InsertStyledString(int position, char *s, int insertLength) {
if (startSavePoint && cb.IsCollectingUndo())
NotifySavePoint(!startSavePoint);
ModifiedAt(position / 2);
int modFlags = SC_MOD_INSERTTEXT | SC_PERFORMED_USER;
DocModification mh(modFlags, position / 2, insertLength / 2, LinesTotal() - prevLinesTotal, text);
NotifyModified(mh);
@@ -345,7 +345,7 @@ int Document::Undo() {
int cellPosition = action.position / 2;
ModifiedAt(cellPosition);
newPos = cellPosition;
int modFlags = SC_PERFORMED_UNDO;
// With undo, an insertion action becomes a deletion notification
if (action.at == removeAction) {
@@ -356,10 +356,10 @@ int Document::Undo() {
}
if (step == steps-1)
modFlags |= SC_LASTSTEPINUNDOREDO;
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
@@ -380,7 +380,7 @@ int Document::Redo() {
int cellPosition = action.position / 2;
ModifiedAt(cellPosition);
newPos = cellPosition;
int modFlags = SC_PERFORMED_REDO;
if (action.at == insertAction) {
newPos += action.lenData;
@@ -390,10 +390,10 @@ int Document::Redo() {
}
if (step == steps-1)
modFlags |= SC_LASTSTEPINUNDOREDO;
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
@@ -585,7 +585,7 @@ long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitiv
// Range endpoints should not be inside DBCS characters, but just in case, move them.
int startPos = MovePositionOutsideChar(minPos, increment, false);
int endPos = MovePositionOutsideChar(maxPos, increment, false);
// Compute actual search ranges needed
int lengthFind = strlen(s);
int endSearch = 0;
@@ -697,7 +697,7 @@ void Document::SetStyleFor(int length, char style) {
enteredCount++;
int prevEndStyled = endStyled;
if (cb.SetStyleFor(stylingPos, length, style, stylingMask)) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, length);
NotifyModified(mh);
}
@@ -719,7 +719,7 @@ void Document::SetStyles(int length, char *styles) {
}
endStyled = stylingPos;
if (didChange) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, endStyled - prevEndStyled);
NotifyModified(mh);
}
@@ -795,3 +795,5 @@ void Document::NotifyModified(DocModification mh) {
watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData);
}
}

View File

@@ -3,11 +3,11 @@
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
@@ -43,3 +43,5 @@ void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle,
styler.ColourTo(startPos + lengthDoc - 1, 0);
}
}

View File

@@ -15,7 +15,7 @@ Style::Style() {
Platform::DefaultFontSize(), 0,
false, false, false);
}
Style::~Style() {
if (aliasOfDefaultFont)
font.SetID(0);
@@ -39,7 +39,7 @@ Style &Style::operator=(const Style &source) {
return *this;
}
void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
bool bold_, bool italic_, bool eolFilled_) {
fore.desired = fore_;
back.desired = back_;
@@ -50,7 +50,7 @@ void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
eolFilled = eolFilled_;
if (aliasOfDefaultFont)
font.SetID(0);
else
else
font.Release();
aliasOfDefaultFont = false;
}
@@ -76,10 +76,10 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
if (aliasOfDefaultFont)
font.SetID(0);
else
font.Release();
else
font.Release();
int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72;
aliasOfDefaultFont = defaultStyle &&
aliasOfDefaultFont = defaultStyle &&
(EquivalentFontTo(defaultStyle) || !fontName);
if (aliasOfDefaultFont) {
font.SetID(defaultStyle->font.GetID());
@@ -99,3 +99,5 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
aveCharWidth = surface.AverageCharWidth(font);
spaceWidth = surface.WidthChar(font, ' ');
}

View File

@@ -13,7 +13,7 @@
#include "Style.h"
#include "ViewStyle.h"
MarginStyle::MarginStyle() :
MarginStyle::MarginStyle() :
symbol(false), width(16), mask(0xffffffff), sensitive(false) {
}
@@ -64,7 +64,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
for (int ind=0;ind<=INDIC_MAX;ind++) {
indicators[ind] = source.indicators[ind];
}
selforeset = source.selforeset;
selforeground.desired = source.selforeground.desired;
selbackset = source.selbackset;
@@ -84,7 +84,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
zoomLevel = source.zoomLevel;
viewWhitespace = source.viewWhitespace;
viewEOL = source.viewEOL;
showMarkedLines = source.showMarkedLines;
showMarkedLines = source.showMarkedLines;
}
ViewStyle::~ViewStyle() {
@@ -93,7 +93,7 @@ ViewStyle::~ViewStyle() {
void ViewStyle::Init() {
fontNames.Clear();
ResetDefaultStyle();
indicators[0].style = INDIC_SQUIGGLE;
indicators[0].fore = Colour(0, 0x7f, 0);
indicators[1].style = INDIC_TT;
@@ -118,7 +118,7 @@ void ViewStyle::Init() {
//caretcolour.desired = Colour(0xff, 0, 0);
caretcolour.desired = Colour(0, 0, 0);
edgecolour.desired = Colour(0xc0, 0xc0, 0xc0);
leftMarginWidth = 1;
rightMarginWidth = 1;
ms[0].symbol = false;
@@ -183,7 +183,7 @@ void ViewStyle::Refresh(Surface &surface) {
maxDescent = styles[i].descent;
}
}
lineHeight = maxAscent + maxDescent;
aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
spaceWidth = styles[STYLE_DEFAULT].spaceWidth;
@@ -210,11 +210,11 @@ void ViewStyle::ClearStyles() {
for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
if (i != STYLE_DEFAULT) {
styles[i].Clear(
styles[STYLE_DEFAULT].fore.desired,
styles[STYLE_DEFAULT].back.desired,
styles[STYLE_DEFAULT].size,
styles[STYLE_DEFAULT].fontName,
styles[STYLE_DEFAULT].bold,
styles[STYLE_DEFAULT].fore.desired,
styles[STYLE_DEFAULT].back.desired,
styles[STYLE_DEFAULT].size,
styles[STYLE_DEFAULT].fontName,
styles[STYLE_DEFAULT].bold,
styles[STYLE_DEFAULT].italic,
styles[STYLE_DEFAULT].eolFilled);
}
@@ -225,3 +225,5 @@ void ViewStyle::ClearStyles() {
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
styles[styleIndex].fontName = fontNames.Save(name);
}