diff options
-rw-r--r-- | scintilla/include/Platform.h | 2 | ||||
-rw-r--r-- | scintilla/include/Scintilla.h | 5 | ||||
-rw-r--r-- | scintilla/include/Scintilla.iface | 15 | ||||
-rw-r--r-- | scintilla/lexlib/PropSetSimple.cxx | 7 | ||||
-rw-r--r-- | scintilla/src/Document.cxx | 16 | ||||
-rw-r--r-- | scintilla/src/Editor.cxx | 65 | ||||
-rw-r--r-- | scintilla/src/Editor.h | 1 | ||||
-rw-r--r-- | scintilla/src/LineMarker.cxx | 13 | ||||
-rw-r--r-- | scintilla/src/LineMarker.h | 7 | ||||
-rw-r--r-- | scintilla/src/PerLine.cxx | 4 | ||||
-rw-r--r-- | scintilla/src/PositionCache.cxx | 5 | ||||
-rw-r--r-- | scintilla/src/ScintillaBase.cxx | 9 | ||||
-rw-r--r-- | scintilla/src/ViewStyle.cxx | 3 | ||||
-rw-r--r-- | scintilla/src/XPM.cxx | 135 | ||||
-rw-r--r-- | scintilla/src/XPM.h | 49 | ||||
-rw-r--r-- | scintilla/win32/PlatWin.cxx | 82 | ||||
-rw-r--r-- | scintilla/win32/ScintillaWin.cxx | 47 |
17 files changed, 391 insertions, 74 deletions
diff --git a/scintilla/include/Platform.h b/scintilla/include/Platform.h index 6e05864..e96c194 100644 --- a/scintilla/include/Platform.h +++ b/scintilla/include/Platform.h @@ -339,6 +339,7 @@ public: virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int flags)=0;
+ virtual void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) = 0;
virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0;
@@ -446,6 +447,7 @@ public: virtual int Find(const char *prefix)=0;
virtual void GetValue(int n, char *value, int len)=0;
virtual void RegisterImage(int type, const char *xpm_data)=0;
+ virtual void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) = 0;
virtual void ClearRegisteredImages()=0;
virtual void SetDoubleClickAction(CallBackAction, void *)=0;
virtual void SetList(const char* list, char separator, char typesep)=0;
diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index 72c9af6..0b20d31 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -124,6 +124,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_MARK_LEFTRECT 27
#define SC_MARK_AVAILABLE 28
#define SC_MARK_UNDERLINE 29
+#define SC_MARK_RGBAIMAGE 30
#define SC_MARK_CHARACTER 10000
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
@@ -811,6 +812,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_MOVESELECTEDLINESDOWN 2621
#define SCI_SETIDENTIFIER 2622
#define SCI_GETIDENTIFIER 2623
+#define SCI_RGBAIMAGESETWIDTH 2624
+#define SCI_RGBAIMAGESETHEIGHT 2625
+#define SCI_MARKERDEFINERGBAIMAGE 2626
+#define SCI_REGISTERRGBAIMAGE 2627
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
diff --git a/scintilla/include/Scintilla.iface b/scintilla/include/Scintilla.iface index 7665ea1..17b6cc2 100644 --- a/scintilla/include/Scintilla.iface +++ b/scintilla/include/Scintilla.iface @@ -268,6 +268,7 @@ val SC_MARK_FULLRECT=26 val SC_MARK_LEFTRECT=27
val SC_MARK_AVAILABLE=28
val SC_MARK_UNDERLINE=29
+val SC_MARK_RGBAIMAGE=30
val SC_MARK_CHARACTER=10000
@@ -2153,6 +2154,20 @@ set void SetIdentifier=2622(int identifier,) # Get the identifier.
get int GetIdentifier=2623(,)
+# Set the width for future RGBA image data.
+set void RGBAImageSetWidth=2624(int width,)
+
+# Set the height for future RGBA image data.
+set void RGBAImageSetHeight=2625(int height,)
+
+# Define a marker from RGBA data.
+# It has the width and height from RGBAImageSetWidth/Height
+fun void MarkerDefineRGBAImage=2626(int markerNumber, string pixels)
+
+# Register an RGBA image for use in autocompletion lists.
+# It has the width and height from RGBAImageSetWidth/Height
+fun void RegisterRGBAImage=2627(int type, string pixels)
+
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
diff --git a/scintilla/lexlib/PropSetSimple.cxx b/scintilla/lexlib/PropSetSimple.cxx index 9bd4e5c..8b5e8cb 100644 --- a/scintilla/lexlib/PropSetSimple.cxx +++ b/scintilla/lexlib/PropSetSimple.cxx @@ -61,9 +61,10 @@ void PropSetSimple::Set(const char *keyVal) { endVal++;
const char *eqAt = strchr(keyVal, '=');
if (eqAt) {
- Set(keyVal, eqAt + 1, eqAt-keyVal, endVal - eqAt - 1);
+ Set(keyVal, eqAt + 1, static_cast<int>(eqAt-keyVal),
+ static_cast<int>(endVal - eqAt - 1));
} else if (*keyVal) { // No '=' so assume '=1'
- Set(keyVal, "1", endVal-keyVal, 1);
+ Set(keyVal, "1", static_cast<int>(endVal-keyVal), 1);
}
}
@@ -150,7 +151,7 @@ char *PropSetSimple::Expanded(const char *key) const { int PropSetSimple::GetExpanded(const char *key, char *result) const {
char *val = Expanded(key);
- const int n = strlen(val);
+ const int n = static_cast<int>(strlen(val));
if (result) {
strcpy(result, val);
}
diff --git a/scintilla/src/Document.cxx b/scintilla/src/Document.cxx index ff1638f..d07ded6 100644 --- a/scintilla/src/Document.cxx +++ b/scintilla/src/Document.cxx @@ -986,7 +986,7 @@ bool Document::InsertChar(int pos, char ch) { * Insert a null terminated string.
*/
bool Document::InsertCString(int position, const char *s) {
- return InsertString(position, s, strlen(s));
+ return InsertString(position, s, static_cast<int>(strlen(s)));
}
void Document::ChangeChar(int pos, char ch) {
@@ -1385,7 +1385,7 @@ size_t Document::ExtractChar(int pos, char *bytes) { size_t widthChar = UTF8CharLength(ch);
bytes[0] = ch;
for (size_t i=1; i<widthChar; i++) {
- bytes[i] = cb.CharAt(pos+i);
+ bytes[i] = cb.CharAt(static_cast<int>(pos+i));
if (!GoodTrailByte(static_cast<unsigned char>(bytes[i]))) { // Bad byte
widthChar = 1;
}
@@ -1483,7 +1483,8 @@ long Document::FindText(int minPos, int maxPos, const char *search, const size_t maxBytesCharacter = 4;
const size_t maxFoldingExpansion = 4;
std::vector<char> searchThing(lengthFind * maxBytesCharacter * maxFoldingExpansion + 1);
- const int lenSearch = pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind);
+ const int lenSearch = static_cast<int>(
+ pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind));
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
int widthFirstCharacter = 0;
int indexDocument = 0;
@@ -1494,11 +1495,11 @@ long Document::FindText(int minPos, int maxPos, const char *search, (indexSearch < lenSearch)) {
char bytes[maxBytesCharacter + 1];
bytes[maxBytesCharacter] = 0;
- const int widthChar = ExtractChar(pos + indexDocument, bytes);
+ const int widthChar = static_cast<int>(ExtractChar(pos + indexDocument, bytes));
if (!widthFirstCharacter)
widthFirstCharacter = widthChar;
char folded[maxBytesCharacter * maxFoldingExpansion + 1];
- const int lenFlat = pcf->Fold(folded, sizeof(folded), bytes, widthChar);
+ const int lenFlat = static_cast<int>(pcf->Fold(folded, sizeof(folded), bytes, widthChar));
folded[lenFlat] = 0;
// Does folded match the buffer
characterMatches = 0 == memcmp(folded, &searchThing[0] + indexSearch, lenFlat);
@@ -1522,7 +1523,8 @@ long Document::FindText(int minPos, int maxPos, const char *search, const size_t maxBytesCharacter = 2;
const size_t maxFoldingExpansion = 4;
std::vector<char> searchThing(lengthFind * maxBytesCharacter * maxFoldingExpansion + 1);
- const int lenSearch = pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind);
+ const int lenSearch = static_cast<int>(
+ pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind));
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
int indexDocument = 0;
int indexSearch = 0;
@@ -1536,7 +1538,7 @@ long Document::FindText(int minPos, int maxPos, const char *search, if (widthChar == 2)
bytes[1] = cb.CharAt(pos + indexDocument + 1);
char folded[maxBytesCharacter * maxFoldingExpansion + 1];
- const int lenFlat = pcf->Fold(folded, sizeof(folded), bytes, widthChar);
+ const int lenFlat = static_cast<int>(pcf->Fold(folded, sizeof(folded), bytes, widthChar));
folded[lenFlat] = 0;
// Does folded match the buffer
characterMatches = 0 == memcmp(folded, &searchThing[0] + indexSearch, lenFlat);
diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 09fd6aa..8016d0e 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -13,6 +13,7 @@ #include <string>
#include <vector>
+#include <map>
#include <algorithm>
#include <memory>
@@ -1611,8 +1612,10 @@ void Editor::LinesSplit(int pixelWidth) { unsigned int posLineStart = pdoc->LineStart(line);
LayoutLine(line, surface, vs, ll, pixelWidth);
for (int subLine = 1; subLine < ll->lines; subLine++) {
- pdoc->InsertCString(posLineStart + (subLine - 1) * strlen(eol) +
- ll->LineStart(subLine), eol);
+ pdoc->InsertCString(
+ static_cast<int>(posLineStart + (subLine - 1) * strlen(eol) +
+ ll->LineStart(subLine)),
+ eol);
targetEnd += static_cast<int>(strlen(eol));
}
}
@@ -1655,7 +1658,8 @@ static int WidthStyledText(Surface *surface, ViewStyle &vs, int styleOffset, size_t endSegment = start;
while ((endSegment+1 < len) && (static_cast<size_t>(styles[endSegment+1]) == style))
endSegment++;
- width += surface->WidthText(vs.styles[style+styleOffset].font, text + start, endSegment - start + 1);
+ width += surface->WidthText(vs.styles[style+styleOffset].font, text + start,
+ static_cast<int>(endSegment - start + 1));
start = endSegment + 1;
}
return width;
@@ -1670,7 +1674,8 @@ static int WidestLineWidth(Surface *surface, ViewStyle &vs, int styleOffset, con if (st.multipleStyles) {
widthSubLine = WidthStyledText(surface, vs, styleOffset, st.text + start, st.styles + start, lenLine);
} else {
- widthSubLine = surface->WidthText(vs.styles[styleOffset + st.style].font, st.text + start, lenLine);
+ widthSubLine = surface->WidthText(vs.styles[styleOffset + st.style].font,
+ st.text + start, static_cast<int>(lenLine));
}
if (widthSubLine > widthMax)
widthMax = widthSubLine;
@@ -1691,21 +1696,24 @@ void DrawStyledText(Surface *surface, ViewStyle &vs, int styleOffset, PRectangle while (end < length-1 && st.styles[start+end+1] == style)
end++;
style += styleOffset;
- int width = surface->WidthText(vs.styles[style].font, st.text + start + i, end - i + 1);
+ int width = surface->WidthText(vs.styles[style].font,
+ st.text + start + i, static_cast<int>(end - i + 1));
PRectangle rcSegment = rcText;
rcSegment.left = x;
rcSegment.right = x + width + 1;
surface->DrawTextNoClip(rcSegment, vs.styles[style].font,
- ascent, st.text + start + i, end - i + 1,
+ ascent, st.text + start + i,
+ static_cast<int>(end - i + 1),
vs.styles[style].fore.allocated,
vs.styles[style].back.allocated);
x += width;
i = end + 1;
}
} else {
- int style = st.style + styleOffset;
+ size_t style = st.style + styleOffset;
surface->DrawTextNoClip(rcText, vs.styles[style].font,
- rcText.top + vs.maxAscent, st.text + start, length,
+ rcText.top + vs.maxAscent, st.text + start,
+ static_cast<int>(length),
vs.styles[style].fore.allocated,
vs.styles[style].back.allocated);
}
@@ -4869,10 +4877,13 @@ void Editor::ChangeCaseOfSelection(int caseMapping) { while (sMapped[lastDifference] == sText[lastDifference])
lastDifference--;
size_t endSame = sMapped.size() - 1 - lastDifference;
- pdoc->DeleteChars(currentNoVS.Start().Position() + firstDifference,
- rangeBytes - firstDifference - endSame);
- pdoc->InsertString(currentNoVS.Start().Position() + firstDifference,
- sMapped.c_str() + firstDifference, lastDifference - firstDifference + 1);
+ pdoc->DeleteChars(
+ static_cast<int>(currentNoVS.Start().Position() + firstDifference),
+ static_cast<int>(rangeBytes - firstDifference - endSame));
+ pdoc->InsertString(
+ static_cast<int>(currentNoVS.Start().Position() + firstDifference),
+ sMapped.c_str() + firstDifference,
+ static_cast<int>(lastDifference - firstDifference + 1));
// Automatic movement changes selection so reset to exactly the same as it was.
sel.Range(r) = current;
}
@@ -5830,7 +5841,7 @@ void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) { int end = pdoc->LineEnd(currentLine);
char *text = CopyRange(start, end);
- int textLen = text ? strlen(text) : 0;
+ size_t textLen = text ? strlen(text) : 0;
// include room for \r\n\0
textLen += 3;
char *textWithEndl = new char[textLen];
@@ -5841,7 +5852,7 @@ void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) { strncat(textWithEndl, "\r", textLen);
if (pdoc->eolMode != SC_EOL_CR)
strncat(textWithEndl, "\n", textLen);
- ss->Set(textWithEndl, strlen(textWithEndl) + 1,
+ ss->Set(textWithEndl, static_cast<int>(strlen(textWithEndl) + 1),
pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, true);
delete []text;
}
@@ -5854,7 +5865,7 @@ void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) { delimiterLength = 1;
}
}
- int size = sel.Length() + delimiterLength * sel.Count();
+ size_t size = sel.Length() + delimiterLength * sel.Count();
char *text = new char[size + 1];
int j = 0;
std::vector<SelectionRange> rangesInOrder = sel.RangesCopy();
@@ -5877,7 +5888,7 @@ void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) { }
}
text[size] = '\0';
- ss->Set(text, size + 1, pdoc->dbcsCodePage,
+ ss->Set(text, static_cast<int>(size + 1), pdoc->dbcsCodePage,
vs.styles[STYLE_DEFAULT].characterSet, sel.IsRectangular(), sel.selType == Selection::selLines);
}
}
@@ -6924,9 +6935,9 @@ int Editor::WrapCount(int line) { void Editor::AddStyledText(char *buffer, int appendLength) {
// The buffer consists of alternating character bytes and style bytes
- size_t textLength = appendLength / 2;
+ int textLength = appendLength / 2;
char *text = new char[textLength];
- size_t i;
+ int i;
for (i = 0; i < textLength; i++) {
text[i] = buffer[i*2];
}
@@ -7034,7 +7045,7 @@ sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lPar }
sptr_t Editor::StringResult(sptr_t lParam, const char *val) {
- const int n = strlen(val);
+ const size_t n = strlen(val);
if (lParam != 0) {
char *ptr = reinterpret_cast<char *>(lParam);
strcpy(ptr, val);
@@ -8037,6 +8048,22 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { RedrawSelMargin();
break;
+ case SCI_RGBAIMAGESETWIDTH:
+ sizeRGBAImage.x = wParam;
+ break;
+
+ case SCI_RGBAIMAGESETHEIGHT:
+ sizeRGBAImage.y = wParam;
+ break;
+
+ case SCI_MARKERDEFINERGBAIMAGE:
+ if (wParam <= MARKER_MAX) {
+ vs.markers[wParam].SetRGBAImage(sizeRGBAImage, reinterpret_cast<unsigned char *>(lParam));
+ };
+ InvalidateStyleData();
+ RedrawSelMargin();
+ break;
+
case SCI_SETMARGINTYPEN:
if (ValidMargin(wParam)) {
vs.ms[wParam].style = lParam;
diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h index c29f633..d28e8d0 100644 --- a/scintilla/src/Editor.h +++ b/scintilla/src/Editor.h @@ -131,6 +131,7 @@ protected: // ScintillaBase subclass needs access to much of Editor * When a style attribute is changed, this cache is flushed. */
bool stylesValid;
ViewStyle vs;
+ Point sizeRGBAImage;
Palette palette;
int printMagnification;
diff --git a/scintilla/src/LineMarker.cxx b/scintilla/src/LineMarker.cxx index 688d139..c965724 100644 --- a/scintilla/src/LineMarker.cxx +++ b/scintilla/src/LineMarker.cxx @@ -7,6 +7,9 @@ #include <string.h>
+#include <vector>
+#include <map>
+
#include "Platform.h"
#include "Scintilla.h"
@@ -38,6 +41,12 @@ void LineMarker::SetXPM(const char *const *linesForm) { markType = SC_MARK_PIXMAP;
}
+void LineMarker::SetRGBAImage(Point sizeRGBAImage, const unsigned char *pixelsRGBAImage) {
+ delete image;
+ image = new RGBAImage(sizeRGBAImage.x, sizeRGBAImage.y, pixelsRGBAImage);
+ markType = SC_MARK_RGBAIMAGE;
+}
+
static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore, ColourAllocated back) {
PRectangle rc;
rc.left = centreX - armSize;
@@ -96,6 +105,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac pxpm->Draw(surface, rcWhole);
return;
}
+ if ((markType == SC_MARK_RGBAIMAGE) && (image)) {
+ surface->DrawRGBAImage(rcWhole, image->GetWidth(), image->GetHeight(), image->Pixels());
+ return;
+ }
// Restrict most shapes a bit
PRectangle rc = rcWhole;
rc.top++;
diff --git a/scintilla/src/LineMarker.h b/scintilla/src/LineMarker.h index fdb76d3..343a3f9 100644 --- a/scintilla/src/LineMarker.h +++ b/scintilla/src/LineMarker.h @@ -25,6 +25,7 @@ public: ColourPair backSelected;
int alpha;
XPM *pxpm;
+ RGBAImage *image;
LineMarker() {
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
@@ -32,6 +33,7 @@ public: backSelected = ColourDesired(0xff,0x00,0x00);
alpha = SC_ALPHA_NOALPHA;
pxpm = NULL;
+ image = NULL;
}
LineMarker(const LineMarker &) {
// Defined to avoid pxpm being blindly copied, not as real copy constructor
@@ -41,9 +43,11 @@ public: backSelected = ColourDesired(0xff,0x00,0x00);
alpha = SC_ALPHA_NOALPHA;
pxpm = NULL;
+ image = NULL;
}
~LineMarker() {
delete pxpm;
+ delete image;
}
LineMarker &operator=(const LineMarker &) {
// Defined to avoid pxpm being blindly copied, not as real assignment operator
@@ -54,11 +58,14 @@ public: alpha = SC_ALPHA_NOALPHA;
delete pxpm;
pxpm = NULL;
+ delete image;
+ image = NULL;
return *this;
}
void RefreshColourPalette(Palette &pal, bool want);
void SetXPM(const char *textForm);
void SetXPM(const char *const *linesForm);
+ void SetRGBAImage(Point sizeRGBAImage, const unsigned char *pixelsRGBAImage);
void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold);
};
diff --git a/scintilla/src/PerLine.cxx b/scintilla/src/PerLine.cxx index ef6b9b7..c7e5c99 100644 --- a/scintilla/src/PerLine.cxx +++ b/scintilla/src/PerLine.cxx @@ -425,10 +425,10 @@ void LineAnnotation::SetText(int line, const char *text) { if (annotations[line]) {
delete []annotations[line];
}
- annotations[line] = AllocateAnnotation(strlen(text), style);
+ annotations[line] = AllocateAnnotation(static_cast<int>(strlen(text)), style);
AnnotationHeader *pah = reinterpret_cast<AnnotationHeader *>(annotations[line]);
pah->style = static_cast<short>(style);
- pah->length = strlen(text);
+ pah->length = static_cast<int>(strlen(text));
pah->lines = static_cast<short>(NumberLines(text));
memcpy(annotations[line]+sizeof(AnnotationHeader), text, pah->length);
} else {
diff --git a/scintilla/src/PositionCache.cxx b/scintilla/src/PositionCache.cxx index 0a5450f..50d964d 100644 --- a/scintilla/src/PositionCache.cxx +++ b/scintilla/src/PositionCache.cxx @@ -12,6 +12,7 @@ #include <string>
#include <vector>
+#include <map>
#include "Platform.h"
@@ -604,11 +605,11 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned // Two way associative: try two probe positions.
int hashValue = PositionCacheEntry::Hash(styleNumber, s, len);
- probe = hashValue % size;
+ probe = static_cast<int>(hashValue % size);
if (pces[probe].Retrieve(styleNumber, s, len, positions)) {
return;
}
- int probe2 = (hashValue * 37) % size;
+ int probe2 = static_cast<int>((hashValue * 37) % size);
if (pces[probe2].Retrieve(styleNumber, s, len, positions)) {
return;
}
diff --git a/scintilla/src/ScintillaBase.cxx b/scintilla/src/ScintillaBase.cxx index f434beb..4cec34a 100644 --- a/scintilla/src/ScintillaBase.cxx +++ b/scintilla/src/ScintillaBase.cxx @@ -13,6 +13,7 @@ #include <string>
#include <vector>
+#include <map>
#include "Platform.h"
@@ -204,7 +205,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { if (ac.chooseSingle && (listType == 0)) {
if (list && !strchr(list, ac.GetSeparator())) {
const char *typeSep = strchr(list, ac.GetTypesep());
- size_t lenInsert = (typeSep) ? (typeSep-list) : strlen(list);
+ int lenInsert = static_cast<int>((typeSep) ? (typeSep-list) : strlen(list));
if (ac.ignoreCase) {
SetEmptySelection(sel.MainCaret() - lenEntered);
pdoc->DeleteChars(sel.MainCaret(), lenEntered);
@@ -393,7 +394,7 @@ int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) { ac.lb->GetValue(item, selected, sizeof(selected));
if (buffer != NULL)
strcpy(buffer, selected);
- return strlen(selected);
+ return static_cast<int>(strlen(selected));
}
}
if (buffer != NULL)
@@ -760,6 +761,10 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara ac.lb->RegisterImage(wParam, reinterpret_cast<const char *>(lParam));
break;
+ case SCI_REGISTERRGBAIMAGE:
+ ac.lb->RegisterRGBAImage(wParam, sizeRGBAImage.x, sizeRGBAImage.y, reinterpret_cast<unsigned char *>(lParam));
+ break;
+
case SCI_CLEARREGISTEREDIMAGES:
ac.lb->ClearRegisteredImages();
break;
diff --git a/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx index 3da8058..2c20169 100644 --- a/scintilla/src/ViewStyle.cxx +++ b/scintilla/src/ViewStyle.cxx @@ -7,6 +7,9 @@ #include <string.h>
+#include <vector>
+#include <map>
+
#include "Platform.h"
#include "Scintilla.h"
diff --git a/scintilla/src/XPM.cxx b/scintilla/src/XPM.cxx index 97d1f80..ac88c63 100644 --- a/scintilla/src/XPM.cxx +++ b/scintilla/src/XPM.cxx @@ -8,6 +8,13 @@ #include <string.h>
#include <stdlib.h>
+#ifdef _MSC_VER
+#pragma warning(disable: 4786)
+#endif
+
+#include <vector>
+#include <map>
+
#include "Platform.h"
#include "XPM.h"
@@ -38,6 +45,10 @@ static size_t MeasureLength(const char *s) { return i;
}
+ColourDesired XPM::ColourDesiredFromCode(int ch) const {
+ return colourCodeTable[ch]->desired;
+}
+
ColourAllocated XPM::ColourFromCode(int ch) const {
return colourCodeTable[ch]->allocated;
#ifdef SLOW
@@ -200,6 +211,21 @@ void XPM::Draw(Surface *surface, PRectangle &rc) { }
}
+void XPM::PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const {
+ if (!data || !codes || !colours || !lines || (x<0) || (x >= width) || (y<0) || (y >= height)) {
+ colour = 0;
+ transparent = true;
+ return;
+ }
+ int code = lines[y+nColours+1][x];
+ transparent = code == codeTransparent;
+ if (transparent) {
+ colour = 0;
+ } else {
+ colour = ColourDesiredFromCode(code).AsLong();
+ }
+}
+
const char **XPM::LinesFormFromTextForm(const char *textForm) {
// Build the lines form out of the text form
const char **linesForm = 0;
@@ -261,14 +287,14 @@ void XPMSet::Clear() { width = -1;
}
-void XPMSet::Add(int id, const char *textForm) {
+void XPMSet::Add(int ident, const char *textForm) {
// Invalidate cached dimensions
height = -1;
width = -1;
// Replace if this id already present
for (int i = 0; i < len; i++) {
- if (set[i]->GetId() == id) {
+ if (set[i]->GetId() == ident) {
set[i]->Init(textForm);
set[i]->CopyDesiredColours();
return;
@@ -278,7 +304,7 @@ void XPMSet::Add(int id, const char *textForm) { // Not present, so add to end
XPM *pxpm = new XPM(textForm);
if (pxpm) {
- pxpm->SetId(id);
+ pxpm->SetId(ident);
pxpm->CopyDesiredColours();
if (len == maximum) {
maximum += 64;
@@ -294,9 +320,9 @@ void XPMSet::Add(int id, const char *textForm) { }
}
-XPM *XPMSet::Get(int id) {
+XPM *XPMSet::Get(int ident) {
for (int i = 0; i < len; i++) {
- if (set[i]->GetId() == id) {
+ if (set[i]->GetId() == ident) {
return set[i];
}
}
@@ -324,3 +350,102 @@ int XPMSet::GetWidth() { }
return (width > 0) ? width : 0;
}
+
+RGBAImage::RGBAImage(int width_, int height_, const unsigned char *pixels_) :
+ height(height_), width(width_) {
+ pixelBytes.assign(pixels_, pixels_ + CountBytes());
+}
+
+RGBAImage::RGBAImage(const XPM &xpm) {
+ height = xpm.GetHeight();
+ width = xpm.GetWidth();
+ pixelBytes.resize(CountBytes());
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ ColourDesired colour;
+ bool transparent = false;
+ xpm.PixelAt(x, y, colour, transparent);
+ unsigned char *pixel = &pixelBytes[0] + (y*width+x) * 4;
+ // RGBA
+ pixel[0] = colour.GetRed();
+ pixel[1] = colour.GetGreen();
+ pixel[2] = colour.GetBlue();
+ pixel[3] = transparent ? 0 : 255;
+ }
+ }
+}
+
+RGBAImage::~RGBAImage() {
+}
+
+int RGBAImage::CountBytes() const {
+ return width * height * 4;
+}
+
+const unsigned char *RGBAImage::Pixels() const {
+ return &pixelBytes[0];
+}
+
+RGBAImageSet::RGBAImageSet() : height(-1), width(-1){
+}
+
+RGBAImageSet::~RGBAImageSet() {
+ Clear();
+}
+
+/// Remove all images.
+void RGBAImageSet::Clear() {
+ for (ImageMap::iterator it=images.begin(); it != images.end(); ++it) {
+ delete it->second;
+ it->second = 0;
+ }
+ images.clear();
+ height = -1;
+ width = -1;
+}
+
+/// Add an image.
+void RGBAImageSet::Add(int ident, RGBAImage *image) {
+ ImageMap::iterator it=images.find(ident);
+ if (it == images.end()) {
+ images[ident] = image;
+ } else {
+ delete it->second;
+ it->second = image;
+ }
+ height = -1;
+ width = -1;
+}
+
+/// Get image by id.
+RGBAImage *RGBAImageSet::Get(int ident) {
+ ImageMap::iterator it = images.find(ident);
+ if (it != images.end()) {
+ return it->second;
+ }
+ return NULL;
+}
+
+/// Give the largest height of the set.
+int RGBAImageSet::GetHeight() const {
+ if (height < 0) {
+ for (ImageMap::const_iterator it=images.begin(); it != images.end(); ++it) {
+ if (height < it->second->GetHeight()) {
+ height = it->second->GetHeight();
+ }
+ }
+ }
+ return (height > 0) ? height : 0;
+}
+
+/// Give the largest width of the set.
+int RGBAImageSet::GetWidth() const {
+ if (width < 0) {
+ for (ImageMap::const_iterator it=images.begin(); it != images.end(); ++it) {
+ if (width < it->second->GetWidth()) {
+ width = it->second->GetWidth();
+ }
+ }
+ }
+ return (width > 0) ? width : 0;
+}
diff --git a/scintilla/src/XPM.h b/scintilla/src/XPM.h index dbeab0b..1513e90 100644 --- a/scintilla/src/XPM.h +++ b/scintilla/src/XPM.h @@ -24,6 +24,7 @@ class XPM { char codeTransparent;
char *codes;
ColourPair *colours;
+ ColourDesired ColourDesiredFromCode(int ch) const;
ColourAllocated ColourFromCode(int ch) const;
void FillRun(Surface *surface, int code, int startX, int y, int x);
char **lines;
@@ -46,6 +47,7 @@ public: int GetId() const { return pid; }
int GetHeight() const { return height; }
int GetWidth() const { return width; }
+ void PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const;
static const char **LinesFormFromTextForm(const char *textForm);
};
@@ -64,15 +66,58 @@ public: /// Remove all XPMs.
void Clear();
/// Add a XPM.
- void Add(int id, const char *textForm);
+ void Add(int ident, const char *textForm);
/// Get XPM by id.
- XPM *Get(int id);
+ XPM *Get(int ident);
/// Give the largest height of the set.
int GetHeight();
/// Give the largest width of the set.
int GetWidth();
};
+/**
+ * An translucent image stoed as a sequence of RGBA bytes.
+ */
+class RGBAImage {
+ // Private so RGBAImage objects can not be copied
+ RGBAImage(const RGBAImage &);
+ RGBAImage &operator=(const RGBAImage &);
+ int height;
+ int width;
+ std::vector<unsigned char> pixelBytes;
+public:
+ RGBAImage(int width_, int height_, const unsigned char *pixels_);
+ RGBAImage(const XPM &xpm);
+ virtual ~RGBAImage();
+ int GetHeight() const { return height; }
+ int GetWidth() const { return width; }
+ int CountBytes() const;
+ const unsigned char *Pixels() const;
+};
+
+/**
+ * A collection of RGBAImage pixmaps indexed by integer id.
+ */
+class RGBAImageSet {
+ typedef std::map<int, RGBAImage*> ImageMap;
+ ImageMap images;
+ mutable int height; ///< Memorize largest height of the set.
+ mutable int width; ///< Memorize largest width of the set.
+public:
+ RGBAImageSet();
+ ~RGBAImageSet();
+ /// Remove all images.
+ void Clear();
+ /// Add an image.
+ void Add(int ident, RGBAImage *image);
+ /// Get image by id.
+ RGBAImage *Get(int ident);
+ /// Give the largest height of the set.
+ int GetHeight() const;
+ /// Give the largest width of the set.
+ int GetWidth() const;
+};
+
#ifdef SCI_NAMESPACE
}
#endif
diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx index eae5068..203ebcc 100644 --- a/scintilla/win32/PlatWin.cxx +++ b/scintilla/win32/PlatWin.cxx @@ -13,6 +13,13 @@ #include <time.h>
#include <limits.h>
+#ifdef _MSC_VER
+#pragma warning(disable: 4786)
+#endif
+
+#include <vector>
+#include <map>
+
/* notepad2-mod custom code start */
#if !defined(_WIN32_WINNT)
#define _WIN32_WINNT 0x0500
@@ -409,6 +416,7 @@ public: void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back);
void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int flags);
+ void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage);
void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back);
void Copy(PRectangle rc, Point from, Surface &surfaceSource);
@@ -701,6 +709,45 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated }
}
+void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) {
+ if (AlphaBlendFn && rc.Width() > 0) {
+ HDC hMemDC = ::CreateCompatibleDC(reinterpret_cast<HDC>(hdc));
+ if (rc.Width() > width)
+ rc.left += (rc.Width() - width) / 2;
+ rc.right = rc.left + width;
+ if (rc.Height() > height)
+ rc.top += (rc.Height() - height) / 2;
+ rc.bottom = rc.top + height;
+
+ BITMAPINFO bpih = {sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0};
+ unsigned char *image = 0;
+ HBITMAP hbmMem = CreateDIBSection(reinterpret_cast<HDC>(hMemDC), &bpih,
+ DIB_RGB_COLORS, reinterpret_cast<void **>(&image), NULL, 0);
+ HBITMAP hbmOld = SelectBitmap(hMemDC, hbmMem);
+
+ for (int y=height-1; y>=0; y--) {
+ for (int x=0; x<width; x++) {
+ unsigned char *pixel = image + (y*width+x) * 4;
+ unsigned char alpha = pixelsImage[3];
+ // Input is RGBA, output is BGRA with premultiplied alpha
+ pixel[2] = (*pixelsImage++) * alpha / 255;
+ pixel[1] = (*pixelsImage++) * alpha / 255;
+ pixel[0] = (*pixelsImage++) * alpha / 255;
+ pixel[3] = *pixelsImage++;
+ }
+ }
+
+ BLENDFUNCTION merge = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
+
+ AlphaBlendFn(reinterpret_cast<HDC>(hdc), rc.left, rc.top, rc.Width(), rc.Height(), hMemDC, 0, 0, width, height, merge);
+
+ SelectBitmap(hMemDC, hbmOld);
+ ::DeleteObject(hbmMem);
+ ::DeleteDC(hMemDC);
+
+ }
+}
+
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
PenColour(fore);
BrushColor(back);
@@ -1273,7 +1320,7 @@ public: };
char *LineToItem::AllocWord(const char *text) {
- int chars = strlen(text) + 1;
+ int chars = static_cast<int>(strlen(text) + 1);
int newCount = wordsCount + chars;
if (newCount > wordsSize) {
wordsSize = _ROUND2(newCount * 2, 8192);
@@ -1323,7 +1370,7 @@ ListBox::~ListBox() { class ListBoxX : public ListBox {
int lineHeight;
FontID fontCopy;
- XPMSet xset;
+ RGBAImageSet images;
LineToItem lti;
HWND lb;
bool unicodeMode;
@@ -1390,6 +1437,7 @@ public: virtual int Find(const char *prefix);
virtual void GetValue(int n, char *value, int len);
virtual void RegisterImage(int type, const char *xpm_data);
+ virtual void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage);
virtual void ClearRegisteredImages();
virtual void SetDoubleClickAction(CallBackAction action, void *data) {
doubleClickAction = action;
@@ -1470,7 +1518,7 @@ PRectangle ListBoxX::GetDesiredRect() { HDC hdc = ::GetDC(lb);
HFONT oldFont = SelectFont(hdc, fontCopy);
SIZE textSize = {0, 0};
- int len = widestItem ? strlen(widestItem) : 0;
+ int len = static_cast<int>(widestItem ? strlen(widestItem) : 0);
if (unicodeMode) {
const TextWide tbuf(widestItem, len, unicodeMode);
::GetTextExtentPoint32W(hdc, tbuf.buffer, tbuf.tlen, &textSize);
@@ -1496,7 +1544,7 @@ PRectangle ListBoxX::GetDesiredRect() { }
int ListBoxX::TextOffset() const {
- int pixWidth = const_cast<XPMSet*>(&xset)->GetWidth();
+ int pixWidth = images.GetWidth();
return pixWidth == 0 ? ItemInset.x : ItemInset.x + pixWidth + (ImageInset.x * 2);
}
@@ -1555,11 +1603,16 @@ void ListBoxX::GetValue(int n, char *value, int len) { }
void ListBoxX::RegisterImage(int type, const char *xpm_data) {
- xset.Add(type, xpm_data);
+ XPM xpmImage(xpm_data);
+ images.Add(type, new RGBAImage(xpmImage));
+}
+
+void ListBoxX::RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) {
+ images.Add(type, new RGBAImage(width, height, pixelsImage));
}
void ListBoxX::ClearRegisteredImages() {
- xset.Clear();
+ images.Clear();
}
void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) {
@@ -1583,7 +1636,7 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) { ListItemData item = lti.Get(pDrawItem->itemID);
int pixId = item.pixId;
const char *text = item.text;
- int len = strlen(text);
+ int len = static_cast<int>(strlen(text));
RECT rcText = rcBox;
::InsetRect(&rcText, TextInset.x, TextInset.y);
@@ -1599,17 +1652,16 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) { }
// Draw the image, if any
- XPM *pxpm = xset.Get(pixId);
- if (pxpm) {
+ RGBAImage *pimage = images.Get(pixId);
+ if (pimage) {
Surface *surfaceItem = Surface::Allocate();
if (surfaceItem) {
surfaceItem->Init(pDrawItem->hDC, pDrawItem->hwndItem);
- //surfaceItem->SetUnicodeMode(unicodeMode);
- //surfaceItem->SetDBCSMode(codePage);
int left = pDrawItem->rcItem.left + ItemInset.x + ImageInset.x;
PRectangle rcImage(left, pDrawItem->rcItem.top,
- left + xset.GetWidth(), pDrawItem->rcItem.bottom);
- pxpm->Draw(surfaceItem, rcImage);
+ left + images.GetWidth(), pDrawItem->rcItem.bottom);
+ surfaceItem->DrawRGBAImage(rcImage,
+ pimage->GetWidth(), pimage->GetHeight(), pimage->Pixels());
delete surfaceItem;
::SetTextAlign(pDrawItem->hDC, TA_TOP);
}
@@ -1643,7 +1695,7 @@ void ListBoxX::SetList(const char *list, char separator, char typesep) { // the listbox is not visible.
SetRedraw(false);
Clear();
- int size = strlen(list) + 1;
+ size_t size = strlen(list) + 1;
char *words = new char[size];
lti.SetWords(words);
memcpy(words, list, size);
@@ -1683,7 +1735,7 @@ void ListBoxX::AdjustWindowRect(PRectangle *rc) const { int ListBoxX::ItemHeight() const {
int itemHeight = lineHeight + (TextInset.y * 2);
- int pixHeight = const_cast<XPMSet*>(&xset)->GetHeight() + (ImageInset.y * 2);
+ int pixHeight = images.GetHeight() + (ImageInset.y * 2);
if (itemHeight < pixHeight) {
itemHeight = pixHeight;
}
diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index fc1c3d2..ca3565b 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -15,6 +15,7 @@ #include <string>
#include <vector>
+#include <map>
/* notepad2-mod custom code start */
#if !defined(_WIN32_WINNT)
@@ -1348,8 +1349,10 @@ public: if (lenMixed > utf16Mixed.size()) {
utf16Mixed.resize(lenMixed + 8);
}
- size_t nUtf16Mixed = ::MultiByteToWideChar(65001, 0, mixed, lenMixed,
- &utf16Mixed[0], utf16Mixed.size());
+ size_t nUtf16Mixed = ::MultiByteToWideChar(65001, 0, mixed,
+ static_cast<int>(lenMixed),
+ &utf16Mixed[0],
+ static_cast<int>(utf16Mixed.size()));
if (nUtf16Mixed == 0) {
// Failed to convert -> bad UTF-8
@@ -1362,11 +1365,14 @@ public: }
int lenFlat = ::LCMapStringW(LOCALE_SYSTEM_DEFAULT,
LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE,
- &utf16Mixed[0], nUtf16Mixed, &utf16Folded[0], utf16Folded.size());
+ &utf16Mixed[0],
+ static_cast<int>(nUtf16Mixed),
+ &utf16Folded[0],
+ static_cast<int>(utf16Folded.size()));
size_t lenOut = UTF8Length(&utf16Folded[0], lenFlat);
if (lenOut < sizeFolded) {
- UTF8FromUTF16(&utf16Folded[0], lenFlat, folded, lenOut);
+ UTF8FromUTF16(&utf16Folded[0], lenFlat, folded, static_cast<int>(lenOut));
return lenOut;
} else {
return 0;
@@ -1393,8 +1399,10 @@ public: if (lenMixed > utf16Mixed.size()) {
utf16Mixed.resize(lenMixed + 8);
}
- size_t nUtf16Mixed = ::MultiByteToWideChar(cp, 0, mixed, lenMixed,
- &utf16Mixed[0], utf16Mixed.size());
+ size_t nUtf16Mixed = ::MultiByteToWideChar(cp, 0, mixed,
+ static_cast<int>(lenMixed),
+ &utf16Mixed[0],
+ static_cast<int>(utf16Mixed.size()));
if (nUtf16Mixed == 0) {
// Failed to convert -> bad input
@@ -1407,7 +1415,10 @@ public: }
int lenFlat = ::LCMapStringW(LOCALE_SYSTEM_DEFAULT,
LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE,
- &utf16Mixed[0], nUtf16Mixed, &utf16Folded[0], utf16Folded.size());
+ &utf16Mixed[0],
+ static_cast<int>(nUtf16Mixed),
+ &utf16Folded[0],
+ static_cast<int>(utf16Folded.size()));
size_t lenOut = ::WideCharToMultiByte(cp, 0,
&utf16Folded[0], lenFlat,
@@ -1416,7 +1427,7 @@ public: if (lenOut < sizeFolded) {
::WideCharToMultiByte(cp, 0,
&utf16Folded[0], lenFlat,
- folded, lenOut, NULL, 0);
+ folded, static_cast<int>(lenOut), NULL, 0);
return lenOut;
} else {
return 0;
@@ -1471,7 +1482,8 @@ std::string ScintillaWin::CaseMapString(const std::string &s, int caseMapping) { UINT cpDoc = CodePageOfDocument();
- unsigned int lengthUTF16 = ::MultiByteToWideChar(cpDoc, 0, s.c_str(), s.size(), NULL, 0);
+ unsigned int lengthUTF16 = ::MultiByteToWideChar(cpDoc, 0, s.c_str(),
+ static_cast<int>(s.size()), NULL, 0);
if (lengthUTF16 == 0) // Failed to convert
return s;
@@ -1486,7 +1498,7 @@ std::string ScintillaWin::CaseMapString(const std::string &s, int caseMapping) { // Change text to UTF-16
std::vector<wchar_t> vwcText(lengthUTF16);
- ::MultiByteToWideChar(cpDoc, 0, s.c_str(), s.size(), &vwcText[0], lengthUTF16);
+ ::MultiByteToWideChar(cpDoc, 0, s.c_str(), static_cast<int>(s.size()), &vwcText[0], lengthUTF16);
// Change case
int charsConverted = ::LCMapStringW(LOCALE_SYSTEM_DEFAULT, mapFlags,
@@ -1497,12 +1509,12 @@ std::string ScintillaWin::CaseMapString(const std::string &s, int caseMapping) { // Change back to document encoding
unsigned int lengthConverted = ::WideCharToMultiByte(cpDoc, 0,
- &vwcConverted[0], vwcConverted.size(),
+ &vwcConverted[0], static_cast<int>(vwcConverted.size()),
NULL, 0, NULL, 0);
std::vector<char> vcConverted(lengthConverted);
::WideCharToMultiByte(cpDoc, 0,
- &vwcConverted[0], vwcConverted.size(),
- &vcConverted[0], vcConverted.size(), NULL, 0);
+ &vwcConverted[0], static_cast<int>(vwcConverted.size()),
+ &vcConverted[0], static_cast<int>(vcConverted.size()), NULL, 0);
return std::string(&vcConverted[0], vcConverted.size());
@@ -1512,7 +1524,8 @@ std::string ScintillaWin::CaseMapString(const std::string &s, int caseMapping) { // Change text to UTF-16
wchar_t vwcText[shortSize];
- ::MultiByteToWideChar(cpDoc, 0, s.c_str(), s.size(), vwcText, lengthUTF16);
+ ::MultiByteToWideChar(cpDoc, 0, s.c_str(), static_cast<int>(s.size()),
+ vwcText, lengthUTF16);
// Change case
int charsConverted = ::LCMapStringW(LOCALE_SYSTEM_DEFAULT, mapFlags,
@@ -1616,8 +1629,8 @@ void ScintillaWin::InsertPasteText(const char *text, int len, SelectionPosition // add the newline if necessary
if ((len > 0) && (text[len-1] != '\n' && text[len-1] != '\r')) {
const char *endline = StringFromEOLMode(pdoc->eolMode);
- pdoc->InsertString(insertPos + len, endline, strlen(endline));
- len += strlen(endline);
+ pdoc->InsertString(insertPos + len, endline, static_cast<int>(strlen(endline)));
+ len += static_cast<int>(strlen(endline));
}
if (sel.MainCaret() == insertPos) {
SetEmptySelection(sel.MainCaret() + len);
@@ -2475,7 +2488,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, if (data && convertPastes) {
// Convert line endings of the drop into our local line-endings mode
- int len = strlen(data);
+ int len = static_cast<int>(strlen(data));
char *convertedText = Document::TransformLineEnds(&len, data, len, pdoc->eolMode);
if (dataAllocated)
delete []data;
|