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:
@@ -344,21 +344,21 @@ void Action::Grab(Action *source) {
|
|||||||
source->lenData = 0;
|
source->lenData = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The undo history stores a sequence of user operations that represent the user's view of the
|
// The undo history stores a sequence of user operations that represent the user's view of the
|
||||||
// commands executed on the text.
|
// commands executed on the text.
|
||||||
// Each user operation contains a sequence of text insertion and text deletion actions.
|
// 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
|
// All the user operations are stored in a list of individual actions with 'start' actions used
|
||||||
// as delimiters between user operations.
|
// as delimiters between user operations.
|
||||||
// Initially there is one start action in the history.
|
// 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
|
// 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
|
// 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.
|
// 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.
|
// 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
|
// 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
|
// 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
|
// 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.
|
// 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.
|
// 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) {
|
void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData) {
|
||||||
EnsureUndoRoom();
|
EnsureUndoRoom();
|
||||||
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction);
|
//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);
|
// actions[currentAction - 1].position, actions[currentAction - 1].lenData);
|
||||||
if (currentAction >= 1) {
|
if (currentAction >= 1) {
|
||||||
if (0 == undoSequenceDepth) {
|
if (0 == undoSequenceDepth) {
|
||||||
@@ -414,11 +414,11 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
|
|||||||
currentAction++;
|
currentAction++;
|
||||||
} else if (currentAction == savePoint) {
|
} else if (currentAction == savePoint) {
|
||||||
currentAction++;
|
currentAction++;
|
||||||
} else if ((at == removeAction) &&
|
} else if ((at == removeAction) &&
|
||||||
((position + lengthData * 2) != actPrevious.position)) {
|
((position + lengthData * 2) != actPrevious.position)) {
|
||||||
// Removals must be at same position to coalesce
|
// Removals must be at same position to coalesce
|
||||||
currentAction++;
|
currentAction++;
|
||||||
} else if ((at == insertAction) &&
|
} else if ((at == insertAction) &&
|
||||||
(position != (actPrevious.position + actPrevious.lenData*2))) {
|
(position != (actPrevious.position + actPrevious.lenData*2))) {
|
||||||
// Insertions must be immediately after to coalesce
|
// Insertions must be immediately after to coalesce
|
||||||
currentAction++;
|
currentAction++;
|
||||||
@@ -427,7 +427,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currentAction++;
|
currentAction++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currentAction++;
|
currentAction++;
|
||||||
}
|
}
|
||||||
@@ -460,7 +460,7 @@ void UndoHistory::EndUndoAction() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UndoHistory::DropUndoSequence() {
|
void UndoHistory::DropUndoSequence() {
|
||||||
undoSequenceDepth = 0;
|
undoSequenceDepth = 0;
|
||||||
}
|
}
|
||||||
@@ -490,9 +490,9 @@ int UndoHistory::StartUndo() {
|
|||||||
// Drop any trailing startAction
|
// Drop any trailing startAction
|
||||||
if (actions[currentAction].at == startAction && currentAction > 0)
|
if (actions[currentAction].at == startAction && currentAction > 0)
|
||||||
currentAction--;
|
currentAction--;
|
||||||
|
|
||||||
// Count the steps in this action
|
// Count the steps in this action
|
||||||
int act = currentAction;
|
int act = currentAction;
|
||||||
while (actions[act].at != startAction && act > 0) {
|
while (actions[act].at != startAction && act > 0) {
|
||||||
act--;
|
act--;
|
||||||
}
|
}
|
||||||
@@ -511,9 +511,9 @@ int UndoHistory::StartRedo() {
|
|||||||
// Drop any leading startAction
|
// Drop any leading startAction
|
||||||
if (actions[currentAction].at == startAction && currentAction < maxAction)
|
if (actions[currentAction].at == startAction && currentAction < maxAction)
|
||||||
currentAction++;
|
currentAction++;
|
||||||
|
|
||||||
// Count the steps in this action
|
// Count the steps in this action
|
||||||
int act = currentAction;
|
int act = currentAction;
|
||||||
while (actions[act].at != startAction && act < maxAction) {
|
while (actions[act].at != startAction && act < maxAction) {
|
||||||
act++;
|
act++;
|
||||||
}
|
}
|
||||||
@@ -1000,7 +1000,7 @@ int CellBuffer::GetLineState(int line) {
|
|||||||
int CellBuffer::GetMaxLineState() {
|
int CellBuffer::GetMaxLineState() {
|
||||||
return lineStates.Length();
|
return lineStates.Length();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CellBuffer::SetLevel(int line, int level) {
|
int CellBuffer::SetLevel(int line, int level) {
|
||||||
int prev = 0;
|
int prev = 0;
|
||||||
if ((line >= 0) && (line < lv.lines)) {
|
if ((line >= 0) && (line < lv.lines)) {
|
||||||
|
@@ -65,27 +65,27 @@ void Document::SetSavePoint() {
|
|||||||
NotifySavePoint(true);
|
NotifySavePoint(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::AddMark(int line, int markerNum) {
|
int Document::AddMark(int line, int markerNum) {
|
||||||
int prev = cb.AddMark(line, markerNum);
|
int prev = cb.AddMark(line, markerNum);
|
||||||
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
|
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::DeleteMark(int line, int markerNum) {
|
void Document::DeleteMark(int line, int markerNum) {
|
||||||
cb.DeleteMark(line, markerNum);
|
cb.DeleteMark(line, markerNum);
|
||||||
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
|
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::DeleteMarkFromHandle(int markerHandle) {
|
void Document::DeleteMarkFromHandle(int markerHandle) {
|
||||||
cb.DeleteMarkFromHandle(markerHandle);
|
cb.DeleteMarkFromHandle(markerHandle);
|
||||||
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
|
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::DeleteAllMarks(int markerNum) {
|
void Document::DeleteAllMarks(int markerNum) {
|
||||||
cb.DeleteAllMarks(markerNum);
|
cb.DeleteAllMarks(markerNum);
|
||||||
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
|
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
}
|
}
|
||||||
@@ -128,8 +128,8 @@ int Document::VCHomePosition(int position) {
|
|||||||
return startText;
|
return startText;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::SetLevel(int line, int level) {
|
int Document::SetLevel(int line, int level) {
|
||||||
int prev = cb.SetLevel(line, level);
|
int prev = cb.SetLevel(line, level);
|
||||||
if (prev != level) {
|
if (prev != level) {
|
||||||
DocModification mh(SC_MOD_CHANGEFOLD, LineStart(line), 0, 0, 0);
|
DocModification mh(SC_MOD_CHANGEFOLD, LineStart(line), 0, 0, 0);
|
||||||
mh.line = line;
|
mh.line = line;
|
||||||
@@ -143,7 +143,7 @@ int Document::SetLevel(int line, int level) {
|
|||||||
static bool IsSubordinate(int levelStart, int levelTry) {
|
static bool IsSubordinate(int levelStart, int levelTry) {
|
||||||
if (levelTry & SC_FOLDLEVELWHITEFLAG)
|
if (levelTry & SC_FOLDLEVELWHITEFLAG)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK);
|
return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ int Document::GetLastChild(int lineParent, int level) {
|
|||||||
}
|
}
|
||||||
if (lineMaxSubord > lineParent) {
|
if (lineMaxSubord > lineParent) {
|
||||||
if (level > (GetLevel(lineMaxSubord+1) & SC_FOLDLEVELNUMBERMASK)) {
|
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)) {
|
if ((lineMaxSubord > lineParent) && (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG)) {
|
||||||
lineMaxSubord--;
|
lineMaxSubord--;
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ int Document::GetFoldParent(int line) {
|
|||||||
int level = GetLevel(line);
|
int level = GetLevel(line);
|
||||||
int lineLook = line-1;
|
int lineLook = line-1;
|
||||||
while ((lineLook > 0) && (
|
while ((lineLook > 0) && (
|
||||||
(!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
|
(!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
|
||||||
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
|
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
|
||||||
) {
|
) {
|
||||||
lineLook--;
|
lineLook--;
|
||||||
@@ -323,7 +323,7 @@ void Document::InsertStyledString(int position, char *s, int insertLength) {
|
|||||||
if (startSavePoint && cb.IsCollectingUndo())
|
if (startSavePoint && cb.IsCollectingUndo())
|
||||||
NotifySavePoint(!startSavePoint);
|
NotifySavePoint(!startSavePoint);
|
||||||
ModifiedAt(position / 2);
|
ModifiedAt(position / 2);
|
||||||
|
|
||||||
int modFlags = SC_MOD_INSERTTEXT | SC_PERFORMED_USER;
|
int modFlags = SC_MOD_INSERTTEXT | SC_PERFORMED_USER;
|
||||||
DocModification mh(modFlags, position / 2, insertLength / 2, LinesTotal() - prevLinesTotal, text);
|
DocModification mh(modFlags, position / 2, insertLength / 2, LinesTotal() - prevLinesTotal, text);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
@@ -345,7 +345,7 @@ int Document::Undo() {
|
|||||||
int cellPosition = action.position / 2;
|
int cellPosition = action.position / 2;
|
||||||
ModifiedAt(cellPosition);
|
ModifiedAt(cellPosition);
|
||||||
newPos = cellPosition;
|
newPos = cellPosition;
|
||||||
|
|
||||||
int modFlags = SC_PERFORMED_UNDO;
|
int modFlags = SC_PERFORMED_UNDO;
|
||||||
// With undo, an insertion action becomes a deletion notification
|
// With undo, an insertion action becomes a deletion notification
|
||||||
if (action.at == removeAction) {
|
if (action.at == removeAction) {
|
||||||
@@ -356,10 +356,10 @@ int Document::Undo() {
|
|||||||
}
|
}
|
||||||
if (step == steps-1)
|
if (step == steps-1)
|
||||||
modFlags |= SC_LASTSTEPINUNDOREDO;
|
modFlags |= SC_LASTSTEPINUNDOREDO;
|
||||||
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
|
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
|
||||||
LinesTotal() - prevLinesTotal, action.data));
|
LinesTotal() - prevLinesTotal, action.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool endSavePoint = cb.IsSavePoint();
|
bool endSavePoint = cb.IsSavePoint();
|
||||||
if (startSavePoint != endSavePoint)
|
if (startSavePoint != endSavePoint)
|
||||||
NotifySavePoint(endSavePoint);
|
NotifySavePoint(endSavePoint);
|
||||||
@@ -380,7 +380,7 @@ int Document::Redo() {
|
|||||||
int cellPosition = action.position / 2;
|
int cellPosition = action.position / 2;
|
||||||
ModifiedAt(cellPosition);
|
ModifiedAt(cellPosition);
|
||||||
newPos = cellPosition;
|
newPos = cellPosition;
|
||||||
|
|
||||||
int modFlags = SC_PERFORMED_REDO;
|
int modFlags = SC_PERFORMED_REDO;
|
||||||
if (action.at == insertAction) {
|
if (action.at == insertAction) {
|
||||||
newPos += action.lenData;
|
newPos += action.lenData;
|
||||||
@@ -390,10 +390,10 @@ int Document::Redo() {
|
|||||||
}
|
}
|
||||||
if (step == steps-1)
|
if (step == steps-1)
|
||||||
modFlags |= SC_LASTSTEPINUNDOREDO;
|
modFlags |= SC_LASTSTEPINUNDOREDO;
|
||||||
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
|
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
|
||||||
LinesTotal() - prevLinesTotal, action.data));
|
LinesTotal() - prevLinesTotal, action.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool endSavePoint = cb.IsSavePoint();
|
bool endSavePoint = cb.IsSavePoint();
|
||||||
if (startSavePoint != endSavePoint)
|
if (startSavePoint != endSavePoint)
|
||||||
NotifySavePoint(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.
|
// Range endpoints should not be inside DBCS characters, but just in case, move them.
|
||||||
int startPos = MovePositionOutsideChar(minPos, increment, false);
|
int startPos = MovePositionOutsideChar(minPos, increment, false);
|
||||||
int endPos = MovePositionOutsideChar(maxPos, increment, false);
|
int endPos = MovePositionOutsideChar(maxPos, increment, false);
|
||||||
|
|
||||||
// Compute actual search ranges needed
|
// Compute actual search ranges needed
|
||||||
int lengthFind = strlen(s);
|
int lengthFind = strlen(s);
|
||||||
int endSearch = 0;
|
int endSearch = 0;
|
||||||
@@ -697,7 +697,7 @@ void Document::SetStyleFor(int length, char style) {
|
|||||||
enteredCount++;
|
enteredCount++;
|
||||||
int prevEndStyled = endStyled;
|
int prevEndStyled = endStyled;
|
||||||
if (cb.SetStyleFor(stylingPos, length, style, stylingMask)) {
|
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);
|
prevEndStyled, length);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
}
|
}
|
||||||
@@ -719,7 +719,7 @@ void Document::SetStyles(int length, char *styles) {
|
|||||||
}
|
}
|
||||||
endStyled = stylingPos;
|
endStyled = stylingPos;
|
||||||
if (didChange) {
|
if (didChange) {
|
||||||
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
|
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
|
||||||
prevEndStyled, endStyled - prevEndStyled);
|
prevEndStyled, endStyled - prevEndStyled);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
}
|
}
|
||||||
@@ -795,3 +795,5 @@ void Document::NotifyModified(DocModification mh) {
|
|||||||
watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData);
|
watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -3,11 +3,11 @@
|
|||||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
@@ -43,3 +43,5 @@ void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle,
|
|||||||
styler.ColourTo(startPos + lengthDoc - 1, 0);
|
styler.ColourTo(startPos + lengthDoc - 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@ Style::Style() {
|
|||||||
Platform::DefaultFontSize(), 0,
|
Platform::DefaultFontSize(), 0,
|
||||||
false, false, false);
|
false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Style::~Style() {
|
Style::~Style() {
|
||||||
if (aliasOfDefaultFont)
|
if (aliasOfDefaultFont)
|
||||||
font.SetID(0);
|
font.SetID(0);
|
||||||
@@ -39,7 +39,7 @@ Style &Style::operator=(const Style &source) {
|
|||||||
return *this;
|
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_) {
|
bool bold_, bool italic_, bool eolFilled_) {
|
||||||
fore.desired = fore_;
|
fore.desired = fore_;
|
||||||
back.desired = back_;
|
back.desired = back_;
|
||||||
@@ -50,7 +50,7 @@ void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
|
|||||||
eolFilled = eolFilled_;
|
eolFilled = eolFilled_;
|
||||||
if (aliasOfDefaultFont)
|
if (aliasOfDefaultFont)
|
||||||
font.SetID(0);
|
font.SetID(0);
|
||||||
else
|
else
|
||||||
font.Release();
|
font.Release();
|
||||||
aliasOfDefaultFont = false;
|
aliasOfDefaultFont = false;
|
||||||
}
|
}
|
||||||
@@ -76,10 +76,10 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
|
|||||||
|
|
||||||
if (aliasOfDefaultFont)
|
if (aliasOfDefaultFont)
|
||||||
font.SetID(0);
|
font.SetID(0);
|
||||||
else
|
else
|
||||||
font.Release();
|
font.Release();
|
||||||
int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72;
|
int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72;
|
||||||
aliasOfDefaultFont = defaultStyle &&
|
aliasOfDefaultFont = defaultStyle &&
|
||||||
(EquivalentFontTo(defaultStyle) || !fontName);
|
(EquivalentFontTo(defaultStyle) || !fontName);
|
||||||
if (aliasOfDefaultFont) {
|
if (aliasOfDefaultFont) {
|
||||||
font.SetID(defaultStyle->font.GetID());
|
font.SetID(defaultStyle->font.GetID());
|
||||||
@@ -99,3 +99,5 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
|
|||||||
aveCharWidth = surface.AverageCharWidth(font);
|
aveCharWidth = surface.AverageCharWidth(font);
|
||||||
spaceWidth = surface.WidthChar(font, ' ');
|
spaceWidth = surface.WidthChar(font, ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "ViewStyle.h"
|
#include "ViewStyle.h"
|
||||||
|
|
||||||
MarginStyle::MarginStyle() :
|
MarginStyle::MarginStyle() :
|
||||||
symbol(false), width(16), mask(0xffffffff), sensitive(false) {
|
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++) {
|
for (int ind=0;ind<=INDIC_MAX;ind++) {
|
||||||
indicators[ind] = source.indicators[ind];
|
indicators[ind] = source.indicators[ind];
|
||||||
}
|
}
|
||||||
|
|
||||||
selforeset = source.selforeset;
|
selforeset = source.selforeset;
|
||||||
selforeground.desired = source.selforeground.desired;
|
selforeground.desired = source.selforeground.desired;
|
||||||
selbackset = source.selbackset;
|
selbackset = source.selbackset;
|
||||||
@@ -84,7 +84,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
|
|||||||
zoomLevel = source.zoomLevel;
|
zoomLevel = source.zoomLevel;
|
||||||
viewWhitespace = source.viewWhitespace;
|
viewWhitespace = source.viewWhitespace;
|
||||||
viewEOL = source.viewEOL;
|
viewEOL = source.viewEOL;
|
||||||
showMarkedLines = source.showMarkedLines;
|
showMarkedLines = source.showMarkedLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewStyle::~ViewStyle() {
|
ViewStyle::~ViewStyle() {
|
||||||
@@ -93,7 +93,7 @@ ViewStyle::~ViewStyle() {
|
|||||||
void ViewStyle::Init() {
|
void ViewStyle::Init() {
|
||||||
fontNames.Clear();
|
fontNames.Clear();
|
||||||
ResetDefaultStyle();
|
ResetDefaultStyle();
|
||||||
|
|
||||||
indicators[0].style = INDIC_SQUIGGLE;
|
indicators[0].style = INDIC_SQUIGGLE;
|
||||||
indicators[0].fore = Colour(0, 0x7f, 0);
|
indicators[0].fore = Colour(0, 0x7f, 0);
|
||||||
indicators[1].style = INDIC_TT;
|
indicators[1].style = INDIC_TT;
|
||||||
@@ -118,7 +118,7 @@ void ViewStyle::Init() {
|
|||||||
//caretcolour.desired = Colour(0xff, 0, 0);
|
//caretcolour.desired = Colour(0xff, 0, 0);
|
||||||
caretcolour.desired = Colour(0, 0, 0);
|
caretcolour.desired = Colour(0, 0, 0);
|
||||||
edgecolour.desired = Colour(0xc0, 0xc0, 0xc0);
|
edgecolour.desired = Colour(0xc0, 0xc0, 0xc0);
|
||||||
|
|
||||||
leftMarginWidth = 1;
|
leftMarginWidth = 1;
|
||||||
rightMarginWidth = 1;
|
rightMarginWidth = 1;
|
||||||
ms[0].symbol = false;
|
ms[0].symbol = false;
|
||||||
@@ -183,7 +183,7 @@ void ViewStyle::Refresh(Surface &surface) {
|
|||||||
maxDescent = styles[i].descent;
|
maxDescent = styles[i].descent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lineHeight = maxAscent + maxDescent;
|
lineHeight = maxAscent + maxDescent;
|
||||||
aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
|
aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
|
||||||
spaceWidth = styles[STYLE_DEFAULT].spaceWidth;
|
spaceWidth = styles[STYLE_DEFAULT].spaceWidth;
|
||||||
@@ -210,11 +210,11 @@ void ViewStyle::ClearStyles() {
|
|||||||
for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
|
for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
|
||||||
if (i != STYLE_DEFAULT) {
|
if (i != STYLE_DEFAULT) {
|
||||||
styles[i].Clear(
|
styles[i].Clear(
|
||||||
styles[STYLE_DEFAULT].fore.desired,
|
styles[STYLE_DEFAULT].fore.desired,
|
||||||
styles[STYLE_DEFAULT].back.desired,
|
styles[STYLE_DEFAULT].back.desired,
|
||||||
styles[STYLE_DEFAULT].size,
|
styles[STYLE_DEFAULT].size,
|
||||||
styles[STYLE_DEFAULT].fontName,
|
styles[STYLE_DEFAULT].fontName,
|
||||||
styles[STYLE_DEFAULT].bold,
|
styles[STYLE_DEFAULT].bold,
|
||||||
styles[STYLE_DEFAULT].italic,
|
styles[STYLE_DEFAULT].italic,
|
||||||
styles[STYLE_DEFAULT].eolFilled);
|
styles[STYLE_DEFAULT].eolFilled);
|
||||||
}
|
}
|
||||||
@@ -225,3 +225,5 @@ void ViewStyle::ClearStyles() {
|
|||||||
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
|
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
|
||||||
styles[styleIndex].fontName = fontNames.Save(name);
|
styles[styleIndex].fontName = fontNames.Save(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -344,21 +344,21 @@ void Action::Grab(Action *source) {
|
|||||||
source->lenData = 0;
|
source->lenData = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The undo history stores a sequence of user operations that represent the user's view of the
|
// The undo history stores a sequence of user operations that represent the user's view of the
|
||||||
// commands executed on the text.
|
// commands executed on the text.
|
||||||
// Each user operation contains a sequence of text insertion and text deletion actions.
|
// 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
|
// All the user operations are stored in a list of individual actions with 'start' actions used
|
||||||
// as delimiters between user operations.
|
// as delimiters between user operations.
|
||||||
// Initially there is one start action in the history.
|
// 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
|
// 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
|
// 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.
|
// 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.
|
// 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
|
// 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
|
// 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
|
// 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.
|
// 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.
|
// 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) {
|
void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData) {
|
||||||
EnsureUndoRoom();
|
EnsureUndoRoom();
|
||||||
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction);
|
//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);
|
// actions[currentAction - 1].position, actions[currentAction - 1].lenData);
|
||||||
if (currentAction >= 1) {
|
if (currentAction >= 1) {
|
||||||
if (0 == undoSequenceDepth) {
|
if (0 == undoSequenceDepth) {
|
||||||
@@ -414,11 +414,11 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
|
|||||||
currentAction++;
|
currentAction++;
|
||||||
} else if (currentAction == savePoint) {
|
} else if (currentAction == savePoint) {
|
||||||
currentAction++;
|
currentAction++;
|
||||||
} else if ((at == removeAction) &&
|
} else if ((at == removeAction) &&
|
||||||
((position + lengthData * 2) != actPrevious.position)) {
|
((position + lengthData * 2) != actPrevious.position)) {
|
||||||
// Removals must be at same position to coalesce
|
// Removals must be at same position to coalesce
|
||||||
currentAction++;
|
currentAction++;
|
||||||
} else if ((at == insertAction) &&
|
} else if ((at == insertAction) &&
|
||||||
(position != (actPrevious.position + actPrevious.lenData*2))) {
|
(position != (actPrevious.position + actPrevious.lenData*2))) {
|
||||||
// Insertions must be immediately after to coalesce
|
// Insertions must be immediately after to coalesce
|
||||||
currentAction++;
|
currentAction++;
|
||||||
@@ -427,7 +427,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currentAction++;
|
currentAction++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currentAction++;
|
currentAction++;
|
||||||
}
|
}
|
||||||
@@ -460,7 +460,7 @@ void UndoHistory::EndUndoAction() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UndoHistory::DropUndoSequence() {
|
void UndoHistory::DropUndoSequence() {
|
||||||
undoSequenceDepth = 0;
|
undoSequenceDepth = 0;
|
||||||
}
|
}
|
||||||
@@ -490,9 +490,9 @@ int UndoHistory::StartUndo() {
|
|||||||
// Drop any trailing startAction
|
// Drop any trailing startAction
|
||||||
if (actions[currentAction].at == startAction && currentAction > 0)
|
if (actions[currentAction].at == startAction && currentAction > 0)
|
||||||
currentAction--;
|
currentAction--;
|
||||||
|
|
||||||
// Count the steps in this action
|
// Count the steps in this action
|
||||||
int act = currentAction;
|
int act = currentAction;
|
||||||
while (actions[act].at != startAction && act > 0) {
|
while (actions[act].at != startAction && act > 0) {
|
||||||
act--;
|
act--;
|
||||||
}
|
}
|
||||||
@@ -511,9 +511,9 @@ int UndoHistory::StartRedo() {
|
|||||||
// Drop any leading startAction
|
// Drop any leading startAction
|
||||||
if (actions[currentAction].at == startAction && currentAction < maxAction)
|
if (actions[currentAction].at == startAction && currentAction < maxAction)
|
||||||
currentAction++;
|
currentAction++;
|
||||||
|
|
||||||
// Count the steps in this action
|
// Count the steps in this action
|
||||||
int act = currentAction;
|
int act = currentAction;
|
||||||
while (actions[act].at != startAction && act < maxAction) {
|
while (actions[act].at != startAction && act < maxAction) {
|
||||||
act++;
|
act++;
|
||||||
}
|
}
|
||||||
@@ -1000,7 +1000,7 @@ int CellBuffer::GetLineState(int line) {
|
|||||||
int CellBuffer::GetMaxLineState() {
|
int CellBuffer::GetMaxLineState() {
|
||||||
return lineStates.Length();
|
return lineStates.Length();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CellBuffer::SetLevel(int line, int level) {
|
int CellBuffer::SetLevel(int line, int level) {
|
||||||
int prev = 0;
|
int prev = 0;
|
||||||
if ((line >= 0) && (line < lv.lines)) {
|
if ((line >= 0) && (line < lv.lines)) {
|
||||||
|
@@ -65,27 +65,27 @@ void Document::SetSavePoint() {
|
|||||||
NotifySavePoint(true);
|
NotifySavePoint(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::AddMark(int line, int markerNum) {
|
int Document::AddMark(int line, int markerNum) {
|
||||||
int prev = cb.AddMark(line, markerNum);
|
int prev = cb.AddMark(line, markerNum);
|
||||||
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
|
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::DeleteMark(int line, int markerNum) {
|
void Document::DeleteMark(int line, int markerNum) {
|
||||||
cb.DeleteMark(line, markerNum);
|
cb.DeleteMark(line, markerNum);
|
||||||
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
|
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::DeleteMarkFromHandle(int markerHandle) {
|
void Document::DeleteMarkFromHandle(int markerHandle) {
|
||||||
cb.DeleteMarkFromHandle(markerHandle);
|
cb.DeleteMarkFromHandle(markerHandle);
|
||||||
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
|
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::DeleteAllMarks(int markerNum) {
|
void Document::DeleteAllMarks(int markerNum) {
|
||||||
cb.DeleteAllMarks(markerNum);
|
cb.DeleteAllMarks(markerNum);
|
||||||
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
|
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
}
|
}
|
||||||
@@ -128,8 +128,8 @@ int Document::VCHomePosition(int position) {
|
|||||||
return startText;
|
return startText;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::SetLevel(int line, int level) {
|
int Document::SetLevel(int line, int level) {
|
||||||
int prev = cb.SetLevel(line, level);
|
int prev = cb.SetLevel(line, level);
|
||||||
if (prev != level) {
|
if (prev != level) {
|
||||||
DocModification mh(SC_MOD_CHANGEFOLD, LineStart(line), 0, 0, 0);
|
DocModification mh(SC_MOD_CHANGEFOLD, LineStart(line), 0, 0, 0);
|
||||||
mh.line = line;
|
mh.line = line;
|
||||||
@@ -143,7 +143,7 @@ int Document::SetLevel(int line, int level) {
|
|||||||
static bool IsSubordinate(int levelStart, int levelTry) {
|
static bool IsSubordinate(int levelStart, int levelTry) {
|
||||||
if (levelTry & SC_FOLDLEVELWHITEFLAG)
|
if (levelTry & SC_FOLDLEVELWHITEFLAG)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK);
|
return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ int Document::GetLastChild(int lineParent, int level) {
|
|||||||
}
|
}
|
||||||
if (lineMaxSubord > lineParent) {
|
if (lineMaxSubord > lineParent) {
|
||||||
if (level > (GetLevel(lineMaxSubord+1) & SC_FOLDLEVELNUMBERMASK)) {
|
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)) {
|
if ((lineMaxSubord > lineParent) && (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG)) {
|
||||||
lineMaxSubord--;
|
lineMaxSubord--;
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ int Document::GetFoldParent(int line) {
|
|||||||
int level = GetLevel(line);
|
int level = GetLevel(line);
|
||||||
int lineLook = line-1;
|
int lineLook = line-1;
|
||||||
while ((lineLook > 0) && (
|
while ((lineLook > 0) && (
|
||||||
(!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
|
(!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
|
||||||
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
|
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
|
||||||
) {
|
) {
|
||||||
lineLook--;
|
lineLook--;
|
||||||
@@ -323,7 +323,7 @@ void Document::InsertStyledString(int position, char *s, int insertLength) {
|
|||||||
if (startSavePoint && cb.IsCollectingUndo())
|
if (startSavePoint && cb.IsCollectingUndo())
|
||||||
NotifySavePoint(!startSavePoint);
|
NotifySavePoint(!startSavePoint);
|
||||||
ModifiedAt(position / 2);
|
ModifiedAt(position / 2);
|
||||||
|
|
||||||
int modFlags = SC_MOD_INSERTTEXT | SC_PERFORMED_USER;
|
int modFlags = SC_MOD_INSERTTEXT | SC_PERFORMED_USER;
|
||||||
DocModification mh(modFlags, position / 2, insertLength / 2, LinesTotal() - prevLinesTotal, text);
|
DocModification mh(modFlags, position / 2, insertLength / 2, LinesTotal() - prevLinesTotal, text);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
@@ -345,7 +345,7 @@ int Document::Undo() {
|
|||||||
int cellPosition = action.position / 2;
|
int cellPosition = action.position / 2;
|
||||||
ModifiedAt(cellPosition);
|
ModifiedAt(cellPosition);
|
||||||
newPos = cellPosition;
|
newPos = cellPosition;
|
||||||
|
|
||||||
int modFlags = SC_PERFORMED_UNDO;
|
int modFlags = SC_PERFORMED_UNDO;
|
||||||
// With undo, an insertion action becomes a deletion notification
|
// With undo, an insertion action becomes a deletion notification
|
||||||
if (action.at == removeAction) {
|
if (action.at == removeAction) {
|
||||||
@@ -356,10 +356,10 @@ int Document::Undo() {
|
|||||||
}
|
}
|
||||||
if (step == steps-1)
|
if (step == steps-1)
|
||||||
modFlags |= SC_LASTSTEPINUNDOREDO;
|
modFlags |= SC_LASTSTEPINUNDOREDO;
|
||||||
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
|
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
|
||||||
LinesTotal() - prevLinesTotal, action.data));
|
LinesTotal() - prevLinesTotal, action.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool endSavePoint = cb.IsSavePoint();
|
bool endSavePoint = cb.IsSavePoint();
|
||||||
if (startSavePoint != endSavePoint)
|
if (startSavePoint != endSavePoint)
|
||||||
NotifySavePoint(endSavePoint);
|
NotifySavePoint(endSavePoint);
|
||||||
@@ -380,7 +380,7 @@ int Document::Redo() {
|
|||||||
int cellPosition = action.position / 2;
|
int cellPosition = action.position / 2;
|
||||||
ModifiedAt(cellPosition);
|
ModifiedAt(cellPosition);
|
||||||
newPos = cellPosition;
|
newPos = cellPosition;
|
||||||
|
|
||||||
int modFlags = SC_PERFORMED_REDO;
|
int modFlags = SC_PERFORMED_REDO;
|
||||||
if (action.at == insertAction) {
|
if (action.at == insertAction) {
|
||||||
newPos += action.lenData;
|
newPos += action.lenData;
|
||||||
@@ -390,10 +390,10 @@ int Document::Redo() {
|
|||||||
}
|
}
|
||||||
if (step == steps-1)
|
if (step == steps-1)
|
||||||
modFlags |= SC_LASTSTEPINUNDOREDO;
|
modFlags |= SC_LASTSTEPINUNDOREDO;
|
||||||
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
|
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
|
||||||
LinesTotal() - prevLinesTotal, action.data));
|
LinesTotal() - prevLinesTotal, action.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool endSavePoint = cb.IsSavePoint();
|
bool endSavePoint = cb.IsSavePoint();
|
||||||
if (startSavePoint != endSavePoint)
|
if (startSavePoint != endSavePoint)
|
||||||
NotifySavePoint(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.
|
// Range endpoints should not be inside DBCS characters, but just in case, move them.
|
||||||
int startPos = MovePositionOutsideChar(minPos, increment, false);
|
int startPos = MovePositionOutsideChar(minPos, increment, false);
|
||||||
int endPos = MovePositionOutsideChar(maxPos, increment, false);
|
int endPos = MovePositionOutsideChar(maxPos, increment, false);
|
||||||
|
|
||||||
// Compute actual search ranges needed
|
// Compute actual search ranges needed
|
||||||
int lengthFind = strlen(s);
|
int lengthFind = strlen(s);
|
||||||
int endSearch = 0;
|
int endSearch = 0;
|
||||||
@@ -697,7 +697,7 @@ void Document::SetStyleFor(int length, char style) {
|
|||||||
enteredCount++;
|
enteredCount++;
|
||||||
int prevEndStyled = endStyled;
|
int prevEndStyled = endStyled;
|
||||||
if (cb.SetStyleFor(stylingPos, length, style, stylingMask)) {
|
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);
|
prevEndStyled, length);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
}
|
}
|
||||||
@@ -719,7 +719,7 @@ void Document::SetStyles(int length, char *styles) {
|
|||||||
}
|
}
|
||||||
endStyled = stylingPos;
|
endStyled = stylingPos;
|
||||||
if (didChange) {
|
if (didChange) {
|
||||||
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
|
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
|
||||||
prevEndStyled, endStyled - prevEndStyled);
|
prevEndStyled, endStyled - prevEndStyled);
|
||||||
NotifyModified(mh);
|
NotifyModified(mh);
|
||||||
}
|
}
|
||||||
@@ -795,3 +795,5 @@ void Document::NotifyModified(DocModification mh) {
|
|||||||
watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData);
|
watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -3,11 +3,11 @@
|
|||||||
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
|
||||||
// The License.txt file describes the conditions under which this software may be distributed.
|
// The License.txt file describes the conditions under which this software may be distributed.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
@@ -43,3 +43,5 @@ void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle,
|
|||||||
styler.ColourTo(startPos + lengthDoc - 1, 0);
|
styler.ColourTo(startPos + lengthDoc - 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@ Style::Style() {
|
|||||||
Platform::DefaultFontSize(), 0,
|
Platform::DefaultFontSize(), 0,
|
||||||
false, false, false);
|
false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Style::~Style() {
|
Style::~Style() {
|
||||||
if (aliasOfDefaultFont)
|
if (aliasOfDefaultFont)
|
||||||
font.SetID(0);
|
font.SetID(0);
|
||||||
@@ -39,7 +39,7 @@ Style &Style::operator=(const Style &source) {
|
|||||||
return *this;
|
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_) {
|
bool bold_, bool italic_, bool eolFilled_) {
|
||||||
fore.desired = fore_;
|
fore.desired = fore_;
|
||||||
back.desired = back_;
|
back.desired = back_;
|
||||||
@@ -50,7 +50,7 @@ void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
|
|||||||
eolFilled = eolFilled_;
|
eolFilled = eolFilled_;
|
||||||
if (aliasOfDefaultFont)
|
if (aliasOfDefaultFont)
|
||||||
font.SetID(0);
|
font.SetID(0);
|
||||||
else
|
else
|
||||||
font.Release();
|
font.Release();
|
||||||
aliasOfDefaultFont = false;
|
aliasOfDefaultFont = false;
|
||||||
}
|
}
|
||||||
@@ -76,10 +76,10 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
|
|||||||
|
|
||||||
if (aliasOfDefaultFont)
|
if (aliasOfDefaultFont)
|
||||||
font.SetID(0);
|
font.SetID(0);
|
||||||
else
|
else
|
||||||
font.Release();
|
font.Release();
|
||||||
int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72;
|
int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72;
|
||||||
aliasOfDefaultFont = defaultStyle &&
|
aliasOfDefaultFont = defaultStyle &&
|
||||||
(EquivalentFontTo(defaultStyle) || !fontName);
|
(EquivalentFontTo(defaultStyle) || !fontName);
|
||||||
if (aliasOfDefaultFont) {
|
if (aliasOfDefaultFont) {
|
||||||
font.SetID(defaultStyle->font.GetID());
|
font.SetID(defaultStyle->font.GetID());
|
||||||
@@ -99,3 +99,5 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
|
|||||||
aveCharWidth = surface.AverageCharWidth(font);
|
aveCharWidth = surface.AverageCharWidth(font);
|
||||||
spaceWidth = surface.WidthChar(font, ' ');
|
spaceWidth = surface.WidthChar(font, ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "ViewStyle.h"
|
#include "ViewStyle.h"
|
||||||
|
|
||||||
MarginStyle::MarginStyle() :
|
MarginStyle::MarginStyle() :
|
||||||
symbol(false), width(16), mask(0xffffffff), sensitive(false) {
|
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++) {
|
for (int ind=0;ind<=INDIC_MAX;ind++) {
|
||||||
indicators[ind] = source.indicators[ind];
|
indicators[ind] = source.indicators[ind];
|
||||||
}
|
}
|
||||||
|
|
||||||
selforeset = source.selforeset;
|
selforeset = source.selforeset;
|
||||||
selforeground.desired = source.selforeground.desired;
|
selforeground.desired = source.selforeground.desired;
|
||||||
selbackset = source.selbackset;
|
selbackset = source.selbackset;
|
||||||
@@ -84,7 +84,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
|
|||||||
zoomLevel = source.zoomLevel;
|
zoomLevel = source.zoomLevel;
|
||||||
viewWhitespace = source.viewWhitespace;
|
viewWhitespace = source.viewWhitespace;
|
||||||
viewEOL = source.viewEOL;
|
viewEOL = source.viewEOL;
|
||||||
showMarkedLines = source.showMarkedLines;
|
showMarkedLines = source.showMarkedLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewStyle::~ViewStyle() {
|
ViewStyle::~ViewStyle() {
|
||||||
@@ -93,7 +93,7 @@ ViewStyle::~ViewStyle() {
|
|||||||
void ViewStyle::Init() {
|
void ViewStyle::Init() {
|
||||||
fontNames.Clear();
|
fontNames.Clear();
|
||||||
ResetDefaultStyle();
|
ResetDefaultStyle();
|
||||||
|
|
||||||
indicators[0].style = INDIC_SQUIGGLE;
|
indicators[0].style = INDIC_SQUIGGLE;
|
||||||
indicators[0].fore = Colour(0, 0x7f, 0);
|
indicators[0].fore = Colour(0, 0x7f, 0);
|
||||||
indicators[1].style = INDIC_TT;
|
indicators[1].style = INDIC_TT;
|
||||||
@@ -118,7 +118,7 @@ void ViewStyle::Init() {
|
|||||||
//caretcolour.desired = Colour(0xff, 0, 0);
|
//caretcolour.desired = Colour(0xff, 0, 0);
|
||||||
caretcolour.desired = Colour(0, 0, 0);
|
caretcolour.desired = Colour(0, 0, 0);
|
||||||
edgecolour.desired = Colour(0xc0, 0xc0, 0xc0);
|
edgecolour.desired = Colour(0xc0, 0xc0, 0xc0);
|
||||||
|
|
||||||
leftMarginWidth = 1;
|
leftMarginWidth = 1;
|
||||||
rightMarginWidth = 1;
|
rightMarginWidth = 1;
|
||||||
ms[0].symbol = false;
|
ms[0].symbol = false;
|
||||||
@@ -183,7 +183,7 @@ void ViewStyle::Refresh(Surface &surface) {
|
|||||||
maxDescent = styles[i].descent;
|
maxDescent = styles[i].descent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lineHeight = maxAscent + maxDescent;
|
lineHeight = maxAscent + maxDescent;
|
||||||
aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
|
aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
|
||||||
spaceWidth = styles[STYLE_DEFAULT].spaceWidth;
|
spaceWidth = styles[STYLE_DEFAULT].spaceWidth;
|
||||||
@@ -210,11 +210,11 @@ void ViewStyle::ClearStyles() {
|
|||||||
for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
|
for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
|
||||||
if (i != STYLE_DEFAULT) {
|
if (i != STYLE_DEFAULT) {
|
||||||
styles[i].Clear(
|
styles[i].Clear(
|
||||||
styles[STYLE_DEFAULT].fore.desired,
|
styles[STYLE_DEFAULT].fore.desired,
|
||||||
styles[STYLE_DEFAULT].back.desired,
|
styles[STYLE_DEFAULT].back.desired,
|
||||||
styles[STYLE_DEFAULT].size,
|
styles[STYLE_DEFAULT].size,
|
||||||
styles[STYLE_DEFAULT].fontName,
|
styles[STYLE_DEFAULT].fontName,
|
||||||
styles[STYLE_DEFAULT].bold,
|
styles[STYLE_DEFAULT].bold,
|
||||||
styles[STYLE_DEFAULT].italic,
|
styles[STYLE_DEFAULT].italic,
|
||||||
styles[STYLE_DEFAULT].eolFilled);
|
styles[STYLE_DEFAULT].eolFilled);
|
||||||
}
|
}
|
||||||
@@ -225,3 +225,5 @@ void ViewStyle::ClearStyles() {
|
|||||||
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
|
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
|
||||||
styles[styleIndex].fontName = fontNames.Save(name);
|
styles[styleIndex].fontName = fontNames.Save(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user