Kaydet (Commit) 1ae59a6f authored tarafından Enrico Tröger's avatar Enrico Tröger

Updated Scintilla to version 1.70.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@471 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst f375a6be
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
Added option in the preferences dialog to replace tabs by spaces Added option in the preferences dialog to replace tabs by spaces
when saving a file. when saving a file.
Added option for default encoding for new files. Added option for default encoding for new files.
* scintilla/*: Updated Scintilla to version 1.70.
2006-06-20 Nick Treleaven <nick.treleaven@btinternet.com> 2006-06-20 Nick Treleaven <nick.treleaven@btinternet.com>
......
...@@ -27,9 +27,9 @@ public: ...@@ -27,9 +27,9 @@ public:
Converter() { Converter() {
iconvh = iconvhBad; iconvh = iconvhBad;
} }
Converter(const char *charSetDestination, const char *charSetSource) { Converter(const char *charSetDestination, const char *charSetSource, bool transliterations) {
iconvh = iconvhBad; iconvh = iconvhBad;
Open(charSetDestination, charSetSource); Open(charSetDestination, charSetSource, transliterations);
} }
~Converter() { ~Converter() {
Close(); Close();
...@@ -37,13 +37,18 @@ public: ...@@ -37,13 +37,18 @@ public:
operator bool() const { operator bool() const {
return iconvh != iconvhBad; return iconvh != iconvhBad;
} }
void Open(const char *charSetDestination, const char *charSetSource) { void Open(const char *charSetDestination, const char *charSetSource, bool transliterations=true) {
Close(); Close();
if (*charSetSource) { if (*charSetSource) {
char fullDest[200];
strcpy(fullDest, charSetDestination);
if (transliterations) {
strcat(fullDest, "//TRANSLIT");
}
#if GTK_MAJOR_VERSION >= 2 #if GTK_MAJOR_VERSION >= 2
iconvh = g_iconv_open(charSetDestination, charSetSource); iconvh = g_iconv_open(fullDest, charSetSource);
#else #else
iconvh = iconv_open(charSetDestination, charSetSource); iconvh = iconv_open(fullDest, charSetSource);
#endif #endif
} }
} }
......
This diff is collapsed.
...@@ -305,10 +305,10 @@ protected: // ScintillaBase subclass needs access to much of Editor ...@@ -305,10 +305,10 @@ protected: // ScintillaBase subclass needs access to much of Editor
// Wrapping support // Wrapping support
enum { eWrapNone, eWrapWord, eWrapChar } wrapState; enum { eWrapNone, eWrapWord, eWrapChar } wrapState;
bool backgroundWrapEnabled; enum { wrapLineLarge = 0x7ffffff };
int wrapWidth; int wrapWidth;
int docLineLastWrapped; int wrapStart;
int docLastLineToWrap; int wrapEnd;
int wrapVisualFlags; int wrapVisualFlags;
int wrapVisualFlagsLocation; int wrapVisualFlagsLocation;
int wrapVisualStartIndent; int wrapVisualStartIndent;
...@@ -377,7 +377,7 @@ protected: // ScintillaBase subclass needs access to much of Editor ...@@ -377,7 +377,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void InvalidateCaret(); void InvalidateCaret();
virtual void UpdateSystemCaret(); virtual void UpdateSystemCaret();
void NeedWrapping(int docLineStartWrapping = 0, int docLineEndWrapping = 0x7ffffff); void NeedWrapping(int docLineStart = 0, int docLineEnd = wrapLineLarge);
bool WrapLines(bool fullWrap, int priorityWrapLineStart); bool WrapLines(bool fullWrap, int priorityWrapLineStart);
void LinesJoin(); void LinesJoin();
void LinesSplit(int pixelWidth); void LinesSplit(int pixelWidth);
...@@ -387,6 +387,7 @@ protected: // ScintillaBase subclass needs access to much of Editor ...@@ -387,6 +387,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
LineLayout *RetrieveLineLayout(int lineNumber); LineLayout *RetrieveLineLayout(int lineNumber);
void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
int width=LineLayout::wrapWidthInfinite); int width=LineLayout::wrapWidthInfinite);
ColourAllocated SelectionBackground(ViewStyle &vsDraw);
ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll); ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll);
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight); void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAllocated wrapColour); void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAllocated wrapColour);
...@@ -524,6 +525,7 @@ protected: // ScintillaBase subclass needs access to much of Editor ...@@ -524,6 +525,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void GetHotSpotRange(int& hsStart, int& hsEnd); void GetHotSpotRange(int& hsStart, int& hsEnd);
int CodePage() const; int CodePage() const;
virtual bool ValidCodePage(int /* codePage */) const { return true; }
int WrapCount(int line); int WrapCount(int line);
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0; virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;
......
...@@ -259,7 +259,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, ...@@ -259,7 +259,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
if (state == SCE_SH_DEFAULT) { if (state == SCE_SH_DEFAULT) {
if (ch == '\\') { // escaped character if (ch == '\\') { // escaped character
if (i < lengthDoc - 1) if (i < lengthDoc - 1)
i++; i++;
ch = chNext; ch = chNext;
chNext = chNext2; chNext = chNext2;
styler.ColourTo(i, SCE_SH_IDENTIFIER); styler.ColourTo(i, SCE_SH_IDENTIFIER);
......
...@@ -687,7 +687,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty ...@@ -687,7 +687,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
(ch == '<') && (ch == '<') &&
(chNext == '?') && (chNext == '?') &&
!IsScriptCommentState(state) ) { !IsScriptCommentState(state) ) {
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP); scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 10, eScriptPHP);
if (scriptLanguage != eScriptPHP && isStringState(state)) continue; if (scriptLanguage != eScriptPHP && isStringState(state)) continue;
styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state; beforePreProc = state;
......
...@@ -60,27 +60,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo ...@@ -60,27 +60,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo
bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0; bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0;
bool sqlBackticksIdentifier = styler.GetPropertyInt("lexer.sql.backticks.identifier", 0) != 0; bool sqlBackticksIdentifier = styler.GetPropertyInt("lexer.sql.backticks.identifier", 0) != 0;
int styleBeforeDCKeyword = SCE_SQL_DEFAULT; int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
bool fold = styler.GetPropertyInt("fold") != 0;
int lineCurrent = styler.GetLine(startPos);
for (; sc.More(); sc.Forward()) { for (; sc.More(); sc.Forward()) {
// Fold based on indentation
if (sc.atLineStart) {
int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags);
int level = indentCurrent;
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags);
if (indentCurrent < (indentNext & ~SC_FOLDLEVELWHITEFLAG)) {
level |= SC_FOLDLEVELHEADERFLAG;
}
}
if (fold) {
styler.SetLevel(lineCurrent, level);
}
}
// Determine if the current state should terminate. // Determine if the current state should terminate.
switch (sc.state) { switch (sc.state) {
case SCE_SQL_OPERATOR: case SCE_SQL_OPERATOR:
...@@ -242,6 +222,8 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle, ...@@ -242,6 +222,8 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) { WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;
unsigned int endPos = startPos + length; unsigned int endPos = startPos + length;
int visibleChars = 0; int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos); int lineCurrent = styler.GetLine(startPos);
...@@ -305,7 +287,7 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle, ...@@ -305,7 +287,7 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
} else { } else {
s[j] = '\0'; s[j] = '\0';
} }
if (strcmp(s, "if") == 0 || strcmp(s, "loop") == 0) { if ((!foldOnlyBegin) && (strcmp(s, "if") == 0 || strcmp(s, "loop") == 0)) {
if (endFound) { if (endFound) {
// ignore // ignore
endFound = false; endFound = false;
......
This diff is collapsed.
...@@ -15,11 +15,13 @@ public: ...@@ -15,11 +15,13 @@ public:
int markType; int markType;
ColourPair fore; ColourPair fore;
ColourPair back; ColourPair back;
int alpha;
XPM *pxpm; XPM *pxpm;
LineMarker() { LineMarker() {
markType = SC_MARK_CIRCLE; markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0); fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff); back = ColourDesired(0xff,0xff,0xff);
alpha = SC_ALPHA_NOALPHA;
pxpm = NULL; pxpm = NULL;
} }
LineMarker(const LineMarker &) { LineMarker(const LineMarker &) {
...@@ -27,6 +29,7 @@ public: ...@@ -27,6 +29,7 @@ public:
markType = SC_MARK_CIRCLE; markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0); fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff); back = ColourDesired(0xff,0xff,0xff);
alpha = SC_ALPHA_NOALPHA;
pxpm = NULL; pxpm = NULL;
} }
~LineMarker() { ~LineMarker() {
...@@ -37,6 +40,7 @@ public: ...@@ -37,6 +40,7 @@ public:
markType = SC_MARK_CIRCLE; markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0); fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff); back = ColourDesired(0xff,0xff,0xff);
alpha = SC_ALPHA_NOALPHA;
delete pxpm; delete pxpm;
pxpm = NULL; pxpm = NULL;
return *this; return *this;
......
...@@ -794,7 +794,7 @@ const char *CharacterSetID(int characterSet) { ...@@ -794,7 +794,7 @@ const char *CharacterSetID(int characterSet) {
void SurfaceImpl::SetConverter(int characterSet_) { void SurfaceImpl::SetConverter(int characterSet_) {
if (characterSet != characterSet_) { if (characterSet != characterSet_) {
characterSet = characterSet_; characterSet = characterSet_;
conv.Open("UTF-8", CharacterSetID(characterSet)); conv.Open("UTF-8", CharacterSetID(characterSet), false);
} }
} }
#endif #endif
...@@ -1016,6 +1016,8 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl ...@@ -1016,6 +1016,8 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl
} }
} }
#if GTK_MAJOR_VERSION >= 2
// Plot a point into a guint32 buffer symetrically to all 4 qudrants // Plot a point into a guint32 buffer symetrically to all 4 qudrants
static void AllFour(guint32 *pixels, int stride, int width, int height, int x, int y, guint32 val) { static void AllFour(guint32 *pixels, int stride, int width, int height, int x, int y, guint32 val) {
pixels[y*stride+x] = val; pixels[y*stride+x] = val;
...@@ -1036,6 +1038,8 @@ static unsigned int GetBValue(unsigned int co) { ...@@ -1036,6 +1038,8 @@ static unsigned int GetBValue(unsigned int co) {
return co & 0xff; return co & 0xff;
} }
#endif
#if GTK_MAJOR_VERSION < 2 #if GTK_MAJOR_VERSION < 2
void SurfaceImpl::AlphaRectangle(PRectangle rc, int , ColourAllocated , int , ColourAllocated outline, int , int ) { void SurfaceImpl::AlphaRectangle(PRectangle rc, int , ColourAllocated , int , ColourAllocated outline, int , int ) {
if (gc && drawable) { if (gc && drawable) {
...@@ -1290,7 +1294,7 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char ...@@ -1290,7 +1294,7 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char
int wclen; int wclen;
if (et == UTF8) { if (et == UTF8) {
wclen = UCS2FromUTF8(s, len, wclen = UCS2FromUTF8(s, len,
reinterpret_cast<wchar_t *>(wctext), maxLengthTextRun - 1); static_cast<wchar_t *>(static_cast<void *>(wctext)), maxLengthTextRun - 1);
} else { // dbcs, so convert using current locale } else { // dbcs, so convert using current locale
char sMeasure[maxLengthTextRun]; char sMeasure[maxLengthTextRun];
memcpy(sMeasure, s, len); memcpy(sMeasure, s, len);
...@@ -1396,7 +1400,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi ...@@ -1396,7 +1400,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
// Convert to UTF-8 so can ask Pango for widths, then // Convert to UTF-8 so can ask Pango for widths, then
// Loop through UTF-8 and DBCS forms, taking account of different // Loop through UTF-8 and DBCS forms, taking account of different
// character byte lengths. // character byte lengths.
Converter convMeasure("UCS-2", CharacterSetID(characterSet)); Converter convMeasure("UCS-2", CharacterSetID(characterSet), false);
pango_layout_set_text(layout, utfForm, strlen(utfForm)); pango_layout_set_text(layout, utfForm, strlen(utfForm));
int i = 0; int i = 0;
int utfIndex = 0; int utfIndex = 0;
...@@ -1465,7 +1469,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi ...@@ -1465,7 +1469,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
int wclen; int wclen;
if (et == UTF8) { if (et == UTF8) {
wclen = UCS2FromUTF8(s, len, wclen = UCS2FromUTF8(s, len,
reinterpret_cast<wchar_t *>(wctext), maxLengthTextRun - 1); static_cast<wchar_t *>(static_cast<void *>(wctext)), maxLengthTextRun - 1);
} else { // dbcsMode, so convert using current locale } else { // dbcsMode, so convert using current locale
char sDraw[maxLengthTextRun]; char sDraw[maxLengthTextRun];
memcpy(sDraw, s, len); memcpy(sDraw, s, len);
...@@ -1550,7 +1554,8 @@ int SurfaceImpl::WidthText(Font &font_, const char *s, int len) { ...@@ -1550,7 +1554,8 @@ int SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
#endif #endif
if (et == UTF8) { if (et == UTF8) {
GdkWChar wctext[maxLengthTextRun]; GdkWChar wctext[maxLengthTextRun];
size_t wclen = UCS2FromUTF8(s, len, (wchar_t *)wctext, sizeof(wctext) / sizeof(GdkWChar) - 1); size_t wclen = UCS2FromUTF8(s, len, static_cast<wchar_t *>(static_cast<void *>(wctext)),
sizeof(wctext) / sizeof(GdkWChar) - 1);
wctext[wclen] = L'\0'; wctext[wclen] = L'\0';
return gdk_text_width_wc(PFont(font_)->pfont, wctext, wclen); return gdk_text_width_wc(PFont(font_)->pfont, wctext, wclen);
} else { } else {
...@@ -1972,12 +1977,12 @@ static gboolean ButtonPress(GtkWidget *, GdkEventButton* ev, gpointer p) { ...@@ -1972,12 +1977,12 @@ static gboolean ButtonPress(GtkWidget *, GdkEventButton* ev, gpointer p) {
scheme that it would use if it had the focus. */ scheme that it would use if it had the focus. */
static void StyleSet(GtkWidget *w, GtkStyle*, void*) { static void StyleSet(GtkWidget *w, GtkStyle*, void*) {
GtkStyle* style; GtkStyle* style;
g_return_if_fail(w != NULL); g_return_if_fail(w != NULL);
/* Copy the selected color to active. Note that the modify calls will cause /* Copy the selected color to active. Note that the modify calls will cause
recursive calls to this function after the value is updated and w->style to recursive calls to this function after the value is updated and w->style to
be set to a new object */ be set to a new object */
style = gtk_widget_get_style(w); style = gtk_widget_get_style(w);
if (style == NULL) if (style == NULL)
return; return;
...@@ -2010,17 +2015,18 @@ void ListBoxX::Create(Window &, int, Point, int, bool) { ...@@ -2010,17 +2015,18 @@ void ListBoxX::Create(Window &, int, Point, int, bool) {
#if GTK_MAJOR_VERSION < 2 #if GTK_MAJOR_VERSION < 2
list = gtk_clist_new(1); list = gtk_clist_new(1);
gtk_widget_show(PWidget(list)); GtkWidget *wid = PWidget(list); // No code inside the GTK_OBJECT macro
gtk_container_add(GTK_CONTAINER(PWidget(scroller)), PWidget(list)); gtk_widget_show(wid);
gtk_clist_set_column_auto_resize(GTK_CLIST(PWidget(list)), 0, TRUE); gtk_container_add(GTK_CONTAINER(PWidget(scroller)), wid);
gtk_clist_set_selection_mode(GTK_CLIST(PWidget(list)), GTK_SELECTION_BROWSE); gtk_clist_set_column_auto_resize(GTK_CLIST(wid), 0, TRUE);
gtk_signal_connect(GTK_OBJECT(PWidget(list)), "unselect_row", gtk_clist_set_selection_mode(GTK_CLIST(wid), GTK_SELECTION_BROWSE);
gtk_signal_connect(GTK_OBJECT(wid), "unselect_row",
GTK_SIGNAL_FUNC(UnselectionAC), &current); GTK_SIGNAL_FUNC(UnselectionAC), &current);
gtk_signal_connect(GTK_OBJECT(PWidget(list)), "select_row", gtk_signal_connect(GTK_OBJECT(wid), "select_row",
GTK_SIGNAL_FUNC(SelectionAC), &current); GTK_SIGNAL_FUNC(SelectionAC), &current);
gtk_signal_connect(GTK_OBJECT(PWidget(list)), "button_press_event", gtk_signal_connect(GTK_OBJECT(wid), "button_press_event",
GTK_SIGNAL_FUNC(ButtonPress), this); GTK_SIGNAL_FUNC(ButtonPress), this);
gtk_clist_set_shadow_type(GTK_CLIST(PWidget(list)), GTK_SHADOW_NONE); gtk_clist_set_shadow_type(GTK_CLIST(wid), GTK_SHADOW_NONE);
#else #else
/* Tree and its model */ /* Tree and its model */
GtkListStore *store = GtkListStore *store =
...@@ -2054,11 +2060,12 @@ void ListBoxX::Create(Window &, int, Point, int, bool) { ...@@ -2054,11 +2060,12 @@ void ListBoxX::Create(Window &, int, Point, int, bool) {
gtk_tree_view_append_column(GTK_TREE_VIEW(list), column); gtk_tree_view_append_column(GTK_TREE_VIEW(list), column);
if (g_object_class_find_property(G_OBJECT_GET_CLASS(list), "fixed-height-mode")) if (g_object_class_find_property(G_OBJECT_GET_CLASS(list), "fixed-height-mode"))
g_object_set(G_OBJECT(list), "fixed-height-mode", TRUE, NULL); g_object_set(G_OBJECT(list), "fixed-height-mode", TRUE, NULL);
gtk_container_add(GTK_CONTAINER(PWidget(scroller)), PWidget(list));
gtk_widget_show(PWidget(list));
gtk_signal_connect(GTK_OBJECT(PWidget(list)), "button_press_event", GtkWidget *wid = PWidget(list); // No code inside the G_OBJECT macro
GTK_SIGNAL_FUNC(ButtonPress), this); gtk_container_add(GTK_CONTAINER(PWidget(scroller)), wid);
gtk_widget_show(wid);
g_signal_connect(G_OBJECT(wid), "button_press_event",
G_CALLBACK(ButtonPress), this);
#endif #endif
gtk_widget_realize(PWidget(id)); gtk_widget_realize(PWidget(id));
} }
...@@ -2478,7 +2485,11 @@ void Menu::CreatePopUp() { ...@@ -2478,7 +2485,11 @@ void Menu::CreatePopUp() {
void Menu::Destroy() { void Menu::Destroy() {
if (id) if (id)
#if GTK_MAJOR_VERSION < 2
gtk_object_unref(GTK_OBJECT(id)); gtk_object_unref(GTK_OBJECT(id));
#else
g_object_unref(G_OBJECT(id));
#endif
id = 0; id = 0;
} }
...@@ -2573,8 +2584,11 @@ const char *Platform::DefaultFont() { ...@@ -2573,8 +2584,11 @@ const char *Platform::DefaultFont() {
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
return "Lucida Console"; return "Lucida Console";
#else #else
#ifdef USE_PANGO
return "!Sans"; //fix for GTK2.8 until updating to sci 1.69 return "!Sans";
#else
return "lucidatypewriter";
#endif
#endif #endif
} }
...@@ -2582,7 +2596,6 @@ int Platform::DefaultFontSize() { ...@@ -2582,7 +2596,6 @@ int Platform::DefaultFontSize() {
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
return 10; return 10;
#else #else
return 12; return 12;
#endif #endif
} }
...@@ -2619,7 +2632,6 @@ bool Platform::IsDBCSLeadByte(int /* codePage */, char /* ch */) { ...@@ -2619,7 +2632,6 @@ bool Platform::IsDBCSLeadByte(int /* codePage */, char /* ch */) {
return false; return false;
} }
#if GTK_MAJOR_VERSION < 2
int Platform::DBCSCharLength(int, const char *s) { int Platform::DBCSCharLength(int, const char *s) {
int bytes = mblen(s, MB_CUR_MAX); int bytes = mblen(s, MB_CUR_MAX);
if (bytes >= 1) if (bytes >= 1)
...@@ -2627,24 +2639,6 @@ int Platform::DBCSCharLength(int, const char *s) { ...@@ -2627,24 +2639,6 @@ int Platform::DBCSCharLength(int, const char *s) {
else else
return 1; return 1;
} }
#else
int Platform::DBCSCharLength(int codePage, const char *s) {
if (codePage == 999932) {
// Experimental and disabled code - change 999932 to 932 above to
// enable locale avoiding but expensive character length determination.
// Avoid locale with explicit use of iconv
Converter convMeasure("UCS-2", CharacterSetID(SC_CHARSET_SHIFTJIS));
size_t lenChar = MultiByteLenFromIconv(convMeasure, s, strlen(s));
return lenChar;
} else {
int bytes = mblen(s, MB_CUR_MAX);
if (bytes >= 1)
return bytes;
else
return 1;
}
}
#endif
int Platform::DBCSCharMaxLength() { int Platform::DBCSCharMaxLength() {
return MB_CUR_MAX; return MB_CUR_MAX;
......
...@@ -469,7 +469,7 @@ void ScintillaBase::Colourise(int start, int end) { ...@@ -469,7 +469,7 @@ void ScintillaBase::Colourise(int start, int end) {
int styleStart = 0; int styleStart = 0;
if (start > 0) if (start > 0)
styleStart = styler.StyleAt(start - 1); styleStart = styler.StyleAt(start - 1) & pdoc->stylingBitsMask;
styler.SetCodePage(pdoc->dbcsCodePage); styler.SetCodePage(pdoc->dbcsCodePage);
if (lexCurrent && (len > 0)) { // Should always succeed as null lexer should always be available if (lexCurrent && (len > 0)) { // Should always succeed as null lexer should always be available
......
This diff is collapsed.
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "ViewStyle.h" #include "ViewStyle.h"
MarginStyle::MarginStyle() : MarginStyle::MarginStyle() :
symbol(false), width(16), mask(0xffffffff), sensitive(false) { style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false) {
} }
// A list of the fontnames - avoids wasting space in each style // A list of the fontnames - avoids wasting space in each style
...@@ -73,6 +73,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) { ...@@ -73,6 +73,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
selbackset = source.selbackset; selbackset = source.selbackset;
selbackground.desired = source.selbackground.desired; selbackground.desired = source.selbackground.desired;
selbackground2.desired = source.selbackground2.desired; selbackground2.desired = source.selbackground2.desired;
selAlpha = source.selAlpha;
foldmarginColourSet = source.foldmarginColourSet; foldmarginColourSet = source.foldmarginColourSet;
foldmarginColour.desired = source.foldmarginColour.desired; foldmarginColour.desired = source.foldmarginColour.desired;
...@@ -141,6 +142,7 @@ void ViewStyle::Init() { ...@@ -141,6 +142,7 @@ void ViewStyle::Init() {
selbackset = true; selbackset = true;
selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0); selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0); selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
selAlpha = SC_ALPHA_NOALPHA;
foldmarginColourSet = false; foldmarginColourSet = false;
foldmarginColour.desired = ColourDesired(0xff, 0, 0); foldmarginColour.desired = ColourDesired(0xff, 0, 0);
...@@ -173,13 +175,13 @@ void ViewStyle::Init() { ...@@ -173,13 +175,13 @@ void ViewStyle::Init() {
leftMarginWidth = 1; leftMarginWidth = 1;
rightMarginWidth = 1; rightMarginWidth = 1;
ms[0].symbol = false; ms[0].style = SC_MARGIN_NUMBER;
ms[0].width = 0; ms[0].width = 0;
ms[0].mask = 0; ms[0].mask = 0;
ms[1].symbol = true; ms[1].style = SC_MARGIN_SYMBOL;
ms[1].width = 16; ms[1].width = 16;
ms[1].mask = ~SC_MASK_FOLDERS; ms[1].mask = ~SC_MASK_FOLDERS;
ms[2].symbol = true; ms[2].style = SC_MARGIN_SYMBOL;
ms[2].width = 0; ms[2].width = 0;
ms[2].mask = 0; ms[2].mask = 0;
fixedColumnWidth = leftMarginWidth; fixedColumnWidth = leftMarginWidth;
...@@ -187,7 +189,7 @@ void ViewStyle::Init() { ...@@ -187,7 +189,7 @@ void ViewStyle::Init() {
maskInLine = 0xffffffff; maskInLine = 0xffffffff;
for (int margin=0; margin < margins; margin++) { for (int margin=0; margin < margins; margin++) {
fixedColumnWidth += ms[margin].width; fixedColumnWidth += ms[margin].width;
symbolMargin = symbolMargin || ms[margin].symbol; symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER);
if (ms[margin].width > 0) if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask; maskInLine &= ~ms[margin].mask;
} }
...@@ -258,7 +260,7 @@ void ViewStyle::Refresh(Surface &surface) { ...@@ -258,7 +260,7 @@ void ViewStyle::Refresh(Surface &surface) {
maskInLine = 0xffffffff; maskInLine = 0xffffffff;
for (int margin=0; margin < margins; margin++) { for (int margin=0; margin < margins; margin++) {
fixedColumnWidth += ms[margin].width; fixedColumnWidth += ms[margin].width;
symbolMargin = symbolMargin || ms[margin].symbol; symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER);
if (ms[margin].width > 0) if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask; maskInLine &= ~ms[margin].mask;
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
*/ */
class MarginStyle { class MarginStyle {
public: public:
bool symbol; int style;
int width; int width;
int mask; int mask;
bool sensitive; bool sensitive;
...@@ -53,6 +53,7 @@ public: ...@@ -53,6 +53,7 @@ public:
bool selbackset; bool selbackset;
ColourPair selbackground; ColourPair selbackground;
ColourPair selbackground2; ColourPair selbackground2;
int selAlpha;
bool whitespaceForegroundSet; bool whitespaceForegroundSet;
ColourPair whitespaceForeground; ColourPair whitespaceForeground;
bool whitespaceBackgroundSet; bool whitespaceBackgroundSet;
...@@ -70,7 +71,7 @@ public: ...@@ -70,7 +71,7 @@ public:
bool hotspotUnderline; bool hotspotUnderline;
bool hotspotSingleLine; bool hotspotSingleLine;
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin /// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
enum { margins=3 }; enum { margins=5 };
int leftMarginWidth; ///< Spacing margin on left of text int leftMarginWidth; ///< Spacing margin on left of text
int rightMarginWidth; ///< Spacing margin on left of text int rightMarginWidth; ///< Spacing margin on left of text
bool symbolMargin; bool symbolMargin;
......
...@@ -67,6 +67,10 @@ def Regenerate(filename, genfn, definition): ...@@ -67,6 +67,10 @@ def Regenerate(filename, genfn, definition):
os.rename(tempname, filename) os.rename(tempname, filename)
f = Face.Face() f = Face.Face()
f.ReadFromFile("Scintilla.iface") try:
Regenerate("Scintilla.h", printHFile, f) f.ReadFromFile("Scintilla.iface")
Regenerate("SciLexer.h", printLexHFile, f) Regenerate("Scintilla.h", printHFile, f)
Regenerate("SciLexer.h", printLexHFile, f)
print "Maximum ID is", max(x for x in f.values if int(x) < 3000)
except:
raise
...@@ -90,7 +90,8 @@ ...@@ -90,7 +90,8 @@
#define SCLEX_FREEBASIC 75 #define SCLEX_FREEBASIC 75
#define SCLEX_INNOSETUP 76 #define SCLEX_INNOSETUP 76
#define SCLEX_OPAL 77 #define SCLEX_OPAL 77
#define SCLEX_OMS 78 #define SCLEX_SPICE 78
#define SCLEX_OMS 79
#define SCLEX_AUTOMATIC 1000 #define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0 #define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1 #define SCE_P_COMMENTLINE 1
...@@ -148,6 +149,8 @@ ...@@ -148,6 +149,8 @@
#define SCE_TCL_WORD6 17 #define SCE_TCL_WORD6 17
#define SCE_TCL_WORD7 18 #define SCE_TCL_WORD7 18
#define SCE_TCL_WORD8 19 #define SCE_TCL_WORD8 19
#define SCE_TCL_COMMENT_BOX 20
#define SCE_TCL_BLOCK_COMMENT 21
#define SCE_H_DEFAULT 0 #define SCE_H_DEFAULT 0
#define SCE_H_TAG 1 #define SCE_H_TAG 1
#define SCE_H_TAGUNKNOWN 2 #define SCE_H_TAGUNKNOWN 2
...@@ -819,6 +822,7 @@ ...@@ -819,6 +822,7 @@
#define SCE_AU3_SPECIAL 12 #define SCE_AU3_SPECIAL 12
#define SCE_AU3_EXPAND 13 #define SCE_AU3_EXPAND 13
#define SCE_AU3_COMOBJ 14 #define SCE_AU3_COMOBJ 14
#define SCE_AU3_UDF 15
#define SCE_APDL_DEFAULT 0 #define SCE_APDL_DEFAULT 0
#define SCE_APDL_COMMENT 1 #define SCE_APDL_COMMENT 1
#define SCE_APDL_COMMENTBLOCK 2 #define SCE_APDL_COMMENTBLOCK 2
...@@ -1055,6 +1059,15 @@ ...@@ -1055,6 +1059,15 @@
#define SCE_OPAL_PAR 7 #define SCE_OPAL_PAR 7
#define SCE_OPAL_BOOL_CONST 8 #define SCE_OPAL_BOOL_CONST 8
#define SCE_OPAL_DEFAULT 32 #define SCE_OPAL_DEFAULT 32
#define SCE_SPICE_DEFAULT 0
#define SCE_SPICE_IDENTIFIER 1
#define SCE_SPICE_KEYWORD 2
#define SCE_SPICE_KEYWORD2 3
#define SCE_SPICE_KEYWORD3 4
#define SCE_SPICE_NUMBER 5
#define SCE_SPICE_DELIMITER 6
#define SCE_SPICE_VALUE 7
#define SCE_SPICE_COMMENTLINE 8
#define SCLEX_ASP 29 #define SCLEX_ASP 29
#define SCLEX_PHP 30 #define SCLEX_PHP 30
//--Autogenerated -- end of section automatically generated from Scintilla.iface //--Autogenerated -- end of section automatically generated from Scintilla.iface
......
...@@ -138,8 +138,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, ...@@ -138,8 +138,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_MARKERPREVIOUS 2048 #define SCI_MARKERPREVIOUS 2048
#define SCI_MARKERDEFINEPIXMAP 2049 #define SCI_MARKERDEFINEPIXMAP 2049
#define SCI_MARKERADDSET 2466 #define SCI_MARKERADDSET 2466
#define SCI_MARKERSETALPHA 2476
#define SC_MARGIN_SYMBOL 0 #define SC_MARGIN_SYMBOL 0
#define SC_MARGIN_NUMBER 1 #define SC_MARGIN_NUMBER 1
#define SC_MARGIN_BACK 2
#define SC_MARGIN_FORE 3
#define SCI_SETMARGINTYPEN 2240 #define SCI_SETMARGINTYPEN 2240
#define SCI_GETMARGINTYPEN 2241 #define SCI_GETMARGINTYPEN 2241
#define SCI_SETMARGINWIDTHN 2242 #define SCI_SETMARGINWIDTHN 2242
...@@ -196,6 +199,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, ...@@ -196,6 +199,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_STYLESETHOTSPOT 2409 #define SCI_STYLESETHOTSPOT 2409
#define SCI_SETSELFORE 2067 #define SCI_SETSELFORE 2067
#define SCI_SETSELBACK 2068 #define SCI_SETSELBACK 2068
#define SCI_GETSELALPHA 2477
#define SCI_SETSELALPHA 2478
#define SCI_SETCARETFORE 2069 #define SCI_SETCARETFORE 2069
#define SCI_ASSIGNCMDKEY 2070 #define SCI_ASSIGNCMDKEY 2070
#define SCI_CLEARCMDKEY 2071 #define SCI_CLEARCMDKEY 2071
......
...@@ -34,7 +34,11 @@ struct _ScintillaClass { ...@@ -34,7 +34,11 @@ struct _ScintillaClass {
void (* notify) (ScintillaObject *ttt); void (* notify) (ScintillaObject *ttt);
}; };
#if GLIB_MAJOR_VERSION < 2
GtkType scintilla_get_type (void); GtkType scintilla_get_type (void);
#else
GType scintilla_get_type (void);
#endif
GtkWidget* scintilla_new (void); GtkWidget* scintilla_new (void);
void scintilla_set_id (ScintillaObject *sci, uptr_t id); void scintilla_set_id (ScintillaObject *sci, uptr_t id);
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam); sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment