diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2011-01-04 20:42:28 +0000 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2011-01-04 20:42:28 +0000 |
commit | fb41f2341b2ca0bc5bb2bf7dde1812c559381162 (patch) | |
tree | 334e2284cf4522d0047a7a56f1b8183f85878ce4 | |
parent | 7f6e5c5989fb64e1de05eab0ac36adf07590f52d (diff) | |
download | notepad2-mod-fb41f2341b2ca0bc5bb2bf7dde1812c559381162.zip notepad2-mod-fb41f2341b2ca0bc5bb2bf7dde1812c559381162.tar.gz notepad2-mod-fb41f2341b2ca0bc5bb2bf7dde1812c559381162.tar.bz2 |
update scintilla
git-svn-id: https://notepad2-mod.googlecode.com/svn/trunk@364 28bd50df-7adb-d945-0439-6e466c6a13cc
-rw-r--r-- | scintilla/include/Scintilla.h | 5 | ||||
-rw-r--r-- | scintilla/src/CallTip.cxx | 3 | ||||
-rw-r--r-- | scintilla/src/Editor.cxx | 30 | ||||
-rw-r--r-- | scintilla/src/Editor.h | 3 | ||||
-rw-r--r-- | scintilla/src/ExternalLexer.cxx | 1 | ||||
-rw-r--r-- | scintilla/src/ExternalLexer.h | 5 | ||||
-rw-r--r-- | scintilla/src/PositionCache.cxx | 2 | ||||
-rw-r--r-- | scintilla/src/Selection.h | 4 | ||||
-rw-r--r-- | scintilla/win32/ScintillaWin.cxx | 5 |
9 files changed, 44 insertions, 14 deletions
diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index 691b2f5..51d00c9 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -832,6 +832,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_MOD_CONTAINER 0x40000
#define SC_MOD_LEXERSTATE 0x80000
#define SC_MODEVENTMASKALL 0xFFFFF
+#define SC_UPDATE_CONTENT 0x1
+#define SC_UPDATE_SELECTION 0x2
+#define SC_UPDATE_V_SCROLL 0x4
+#define SC_UPDATE_H_SCROLL 0x8
#define SCEN_CHANGE 768
#define SCEN_SETFOCUS 512
#define SCEN_KILLFOCUS 256
@@ -971,6 +975,7 @@ struct SCNotification { int y; /* SCN_DWELLSTART, SCN_DWELLEND */
int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */
int annotationLinesAdded; /* SC_MOD_CHANGEANNOTATION */
+ int updated; /* SCN_UPDATEUI */
};
#ifdef SCI_NAMESPACE
diff --git a/scintilla/src/CallTip.cxx b/scintilla/src/CallTip.cxx index 45eff35..525fdd9 100644 --- a/scintilla/src/CallTip.cxx +++ b/scintilla/src/CallTip.cxx @@ -29,6 +29,7 @@ CallTip::CallTip() { rectUp = PRectangle(0,0,0,0);
rectDown = PRectangle(0,0,0,0);
lineHeight = 1;
+ offsetMain = 0;
startHighlight = 0;
endHighlight = 0;
tabSize = 0;
@@ -45,6 +46,8 @@ CallTip::CallTip() { colourSel.desired = ColourDesired(0, 0, 0x80);
colourShade.desired = ColourDesired(0, 0, 0);
colourLight.desired = ColourDesired(0xc0, 0xc0, 0xc0);
+ codePage = 0;
+ clickPlace = 0;
}
CallTip::~CallTip() {
diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 0e34f2c..d9867f8 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -175,7 +175,8 @@ Editor::Editor() { lengthForEncode = -1;
- needUpdateUI = true;
+ needUpdateUI = 0;
+ ContainerNeedsUpdate(SC_UPDATE_CONTENT);
braces[0] = invalidPosition;
braces[1] = invalidPosition;
bracesMatchStyle = STYLE_BRACEBAD;
@@ -434,7 +435,10 @@ int Editor::LineFromLocation(Point pt) { }
void Editor::SetTopLine(int topLineNew) {
- topLine = topLineNew;
+ if (topLine != topLineNew) {
+ topLine = topLineNew;
+ ContainerNeedsUpdate(SC_UPDATE_V_SCROLL);
+ }
posTopLine = pdoc->LineStart(cs.DocFromDisplay(topLine));
}
@@ -741,7 +745,7 @@ void Editor::InvalidateSelection(SelectionRange newMain, bool invalidateWholeSel lastAffected = Platform::Maximum(lastAffected, sel.Range(r).anchor.Position());
}
}
- needUpdateUI = true;
+ ContainerNeedsUpdate(SC_UPDATE_SELECTION);
InvalidateRange(firstAffected, lastAffected);
}
@@ -982,6 +986,7 @@ void Editor::HorizontalScrollTo(int xPos) { xPos = 0;
if ((wrapState == eWrapNone) && (xOffset != xPos)) {
xOffset = xPos;
+ ContainerNeedsUpdate(SC_UPDATE_H_SCROLL);
SetHorizontalScrollPos();
RedrawRect(GetClientRectangle());
}
@@ -1291,6 +1296,7 @@ void Editor::SetXYScroll(XYScrollPosition newXY) { }
if (newXY.xOffset != xOffset) {
xOffset = newXY.xOffset;
+ ContainerNeedsUpdate(SC_UPDATE_H_SCROLL);
if (newXY.xOffset > 0) {
PRectangle rcText = GetTextRectangle();
if (horizontalScrollBarVisible &&
@@ -3307,7 +3313,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { surfaceWindow->SetPalette(&palTemp, true);
NotifyUpdateUI();
- needUpdateUI = false;
+ needUpdateUI = 0;
RefreshStyleData();
RefreshPixMaps(surfaceWindow);
@@ -4213,6 +4219,7 @@ void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool void Editor::NotifyUpdateUI() {
SCNotification scn = {0};
scn.nmhdr.code = SCN_UPDATEUI;
+ scn.updated = needUpdateUI;
NotifyParent(scn);
}
@@ -4329,7 +4336,7 @@ static inline int MovePositionForDeletion(int position, int startDeletion, int l }
void Editor::NotifyModified(Document *, DocModification mh, void *) {
- needUpdateUI = true;
+ ContainerNeedsUpdate(SC_UPDATE_CONTENT);
if (paintState == painting) {
CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length));
}
@@ -4611,6 +4618,11 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar NotifyParent(scn);
}
+// Something has changed that the container should know about
+void Editor::ContainerNeedsUpdate(int flags) {
+ needUpdateUI |= flags;
+}
+
/**
* Force scroll and keep position relative to top of window.
*
@@ -5122,6 +5134,7 @@ int Editor::KeyCommand(unsigned int iMessage) { inOverstrike = !inOverstrike;
DropCaret();
ShowCaretAtCurrentPosition();
+ ContainerNeedsUpdate(SC_UPDATE_CONTENT);
NotifyUpdateUI();
break;
case SCI_CANCEL: // Cancel any modes - handled in subclass
@@ -5989,7 +6002,8 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b InvalidateSelection(SelectionRange(newPos), true);
if (sel.Count() > 1)
Redraw();
- sel.Clear();
+ if ((sel.Count() > 1) || (sel.selType != Selection::selStream))
+ sel.Clear();
sel.selType = alt ? Selection::selRectangle : Selection::selStream;
SetSelection(newPos, newPos);
}
@@ -6354,7 +6368,7 @@ void Editor::IdleStyling() { if (needUpdateUI) {
NotifyUpdateUI();
- needUpdateUI = false;
+ needUpdateUI = 0;
}
styleNeeded.Reset();
}
@@ -7011,6 +7025,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETXOFFSET:
xOffset = wParam;
+ ContainerNeedsUpdate(SC_UPDATE_H_SCROLL);
SetHorizontalScrollPos();
Redraw();
break;
@@ -7475,6 +7490,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break;
}
xOffset = 0;
+ ContainerNeedsUpdate(SC_UPDATE_H_SCROLL);
InvalidateStyleRedraw();
ReconfigureScrollBars();
break;
diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h index 9872388..7974662 100644 --- a/scintilla/src/Editor.h +++ b/scintilla/src/Editor.h @@ -208,7 +208,7 @@ protected: // ScintillaBase subclass needs access to much of Editor int posTopLine;
int lengthForEncode;
- bool needUpdateUI;
+ int needUpdateUI;
Position braces[2];
int bracesMatchStyle;
int highlightGuideColumn;
@@ -438,6 +438,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void NotifyErrorOccurred(Document *doc, void *userData, int status);
void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
+ void ContainerNeedsUpdate(int flags);
void PageMove(int direction, Selection::selTypes sel=Selection::noSel, bool stuttered = false);
enum { cmSame, cmUpper, cmLower } caseMap;
virtual std::string CaseMapString(const std::string &s, int caseMapping);
diff --git a/scintilla/src/ExternalLexer.cxx b/scintilla/src/ExternalLexer.cxx index 9af0dec..fc818ce 100644 --- a/scintilla/src/ExternalLexer.cxx +++ b/scintilla/src/ExternalLexer.cxx @@ -38,7 +38,6 @@ LexerManager *LexerManager::theInstance = NULL; void ExternalLexerModule::SetExternal(GetLexerFactoryFunction fFactory, int index) {
fneFactory = fFactory;
fnFactory = fFactory(index);
- externalLanguage = index;
}
//------------------------------------------
diff --git a/scintilla/src/ExternalLexer.h b/scintilla/src/ExternalLexer.h index dd21914..21ac490 100644 --- a/scintilla/src/ExternalLexer.h +++ b/scintilla/src/ExternalLexer.h @@ -27,11 +27,12 @@ typedef LexerFactoryFunction(EXT_LEXER_DECL *GetLexerFactoryFunction)(unsigned i class ExternalLexerModule : public LexerModule {
protected:
GetLexerFactoryFunction fneFactory;
- int externalLanguage;
char name[100];
public:
ExternalLexerModule(int language_, LexerFunction fnLexer_,
- const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_) {
+ const char *languageName_=0, LexerFunction fnFolder_=0) :
+ LexerModule(language_, fnLexer_, 0, fnFolder_),
+ fneFactory(0) {
strncpy(name, languageName_, sizeof(name));
name[sizeof(name)-1] = '\0';
languageName = name;
diff --git a/scintilla/src/PositionCache.cxx b/scintilla/src/PositionCache.cxx index f12c244..34b2219 100644 --- a/scintilla/src/PositionCache.cxx +++ b/scintilla/src/PositionCache.cxx @@ -68,6 +68,8 @@ LineLayout::LineLayout(int maxLineLength_) : widthLine(wrapWidthInfinite),
lines(1),
wrapIndent(0) {
+ bracePreviousStyles[0] = 0;
+ bracePreviousStyles[1] = 0;
Resize(maxLineLength_);
}
diff --git a/scintilla/src/Selection.h b/scintilla/src/Selection.h index 890bc78..0d73b13 100644 --- a/scintilla/src/Selection.h +++ b/scintilla/src/Selection.h @@ -60,7 +60,7 @@ public: struct SelectionSegment {
SelectionPosition start;
SelectionPosition end;
- SelectionSegment() {
+ SelectionSegment() : start(), end() {
}
SelectionSegment(SelectionPosition a, SelectionPosition b) {
if (a < b) {
@@ -86,7 +86,7 @@ struct SelectionRange { SelectionPosition caret;
SelectionPosition anchor;
- SelectionRange() {
+ SelectionRange() : caret(), anchor() {
}
SelectionRange(SelectionPosition single) : caret(single), anchor(single) {
}
diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index 174f3d8..1add9cb 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -772,8 +772,11 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam break;
case WM_RBUTTONDOWN:
- if (!PointInSelection(Point::FromLong(lParam)))
+ ::SetFocus(MainHWND());
+ if (!PointInSelection(Point::FromLong(lParam))) {
+ CancelModes();
SetEmptySelection(PositionFromLocation(Point::FromLong(lParam)));
+ }
break;
case WM_SETCURSOR:
|