diff --git a/components/synedit/Source/SynAutoCorrectEditor.pas b/components/synedit/Source/SynAutoCorrectEditor.pas index c2a9edf4..a804c1ba 100644 --- a/components/synedit/Source/SynAutoCorrectEditor.pas +++ b/components/synedit/Source/SynAutoCorrectEditor.pas @@ -50,6 +50,9 @@ uses QSynAutoCorrect, QSynUnicode, {$ELSE} + {$IFDEF SYN_COMPILER_17_UP} + Types, + {$ENDIF} Windows, Messages, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, Buttons, Registry, SynAutoCorrect, diff --git a/components/synedit/Source/SynCompletionProposal.pas b/components/synedit/Source/SynCompletionProposal.pas index 6e1de78c..a72ccffa 100644 --- a/components/synedit/Source/SynCompletionProposal.pas +++ b/components/synedit/Source/SynCompletionProposal.pas @@ -68,6 +68,9 @@ uses QSynEdit, QSynUnicode, {$ELSE} + {$IFDEF SYN_COMPILER_17_UP} + Types, UITypes, + {$ENDIF} Windows, Messages, Graphics, diff --git a/components/synedit/Source/SynDBEdit.pas b/components/synedit/Source/SynDBEdit.pas index 4eccbdd2..a2441e5e 100644 --- a/components/synedit/Source/SynDBEdit.pas +++ b/components/synedit/Source/SynDBEdit.pas @@ -256,7 +256,7 @@ end; procedure TCustomDBSynEdit.CMGetDataLink(var Msg: TMessage); begin - Msg.Result := Integer(FDataLink); + Msg.Result := LRESULT(FDataLink); end; {$ENDIF} diff --git a/components/synedit/Source/SynEdit.pas b/components/synedit/Source/SynEdit.pas index 0144bc7a..79b84f8b 100644 --- a/components/synedit/Source/SynEdit.pas +++ b/components/synedit/Source/SynEdit.pas @@ -83,7 +83,7 @@ uses Themes, {$ENDIF} {$IFDEF SYN_COMPILER_17_UP} - UITypes, + Types, UITypes, {$ENDIF} SynUnicode, {$ENDIF} @@ -1564,7 +1564,7 @@ begin Style := Style and not WS_BORDER; ExStyle := ExStyle or WS_EX_CLIENTEDGE; // avoid flicker while scrolling or resizing - if CheckWin32Version(5, 1) then + if not (csDesigning in ComponentState) and CheckWin32Version(5, 1) then ExStyle := ExStyle or WS_EX_COMPOSITED; end; @@ -5129,7 +5129,9 @@ end; procedure TCustomSynEdit.WMDropFiles(var Msg: TMessage); var i, iNumberDropped: Integer; + {$IFNDEF UNICODE} FileNameA: array[0..MAX_PATH - 1] of AnsiChar; + {$ENDIF} FileNameW: array[0..MAX_PATH - 1] of WideChar; Point: TPoint; FilesList: TUnicodeStringList; diff --git a/components/synedit/Source/SynEditKeyCmdEditor.pas b/components/synedit/Source/SynEditKeyCmdEditor.pas index f182967a..9838ce89 100644 --- a/components/synedit/Source/SynEditKeyCmdEditor.pas +++ b/components/synedit/Source/SynEditKeyCmdEditor.pas @@ -57,6 +57,9 @@ uses QSynEditKeyCmds, QSynEditMiscClasses, {$ELSE} + {$IFDEF SYN_COMPILER_17_UP} + UITypes, + {$ENDIF} Windows, Messages, Graphics, diff --git a/components/synedit/Source/SynEditKeyCmdsEditor.pas b/components/synedit/Source/SynEditKeyCmdsEditor.pas index a6e564cc..473c5b7c 100644 --- a/components/synedit/Source/SynEditKeyCmdsEditor.pas +++ b/components/synedit/Source/SynEditKeyCmdsEditor.pas @@ -57,6 +57,12 @@ uses QButtons, QSynEditKeyCmds, {$ELSE} + {$IFDEF SYN_COMPILER_15_UP} + Types, + {$ENDIF} + {$IFDEF SYN_COMPILER_17_UP} + UITypes, + {$ENDIF} Windows, Messages, Graphics, diff --git a/components/synedit/Source/SynEditOptionsDialog.pas b/components/synedit/Source/SynEditOptionsDialog.pas index f669db6b..29f79e02 100644 --- a/components/synedit/Source/SynEditOptionsDialog.pas +++ b/components/synedit/Source/SynEditOptionsDialog.pas @@ -63,6 +63,9 @@ uses QSynEditMiscClasses, QSynEditKeyCmds, {$ELSE} + {$IFDEF SYN_COMPILER_17_UP} + Types, + {$ENDIF} Windows, Messages, Graphics, diff --git a/components/synedit/Source/SynEditPlugins.pas b/components/synedit/Source/SynEditPlugins.pas index 92e80266..26686597 100644 --- a/components/synedit/Source/SynEditPlugins.pas +++ b/components/synedit/Source/SynEditPlugins.pas @@ -52,6 +52,9 @@ uses QSynEditKeyCmds, QSynUnicode, {$ELSE} + {$IFDEF SYN_COMPILER_17_UP} + Types, + {$ENDIF} Windows, Menus, SynEdit, diff --git a/components/synedit/Source/SynEditPrint.pas b/components/synedit/Source/SynEditPrint.pas index 14d3ed47..8e2281ba 100644 --- a/components/synedit/Source/SynEditPrint.pas +++ b/components/synedit/Source/SynEditPrint.pas @@ -107,6 +107,9 @@ uses QSynEditHighlighter, QSynUnicode, {$ELSE} + {$IFDEF SYN_COMPILER_17_UP} + UITypes, + {$ENDIF} Windows, Graphics, Printers, diff --git a/components/synedit/Source/SynEditPrintHeaderFooter.pas b/components/synedit/Source/SynEditPrintHeaderFooter.pas index f2896fce..6d5cfc81 100644 --- a/components/synedit/Source/SynEditPrintHeaderFooter.pas +++ b/components/synedit/Source/SynEditPrintHeaderFooter.pas @@ -111,6 +111,9 @@ uses QSynUnicode, QGraphics, {$ELSE} + {$IFDEF SYN_COMPILER_17_UP} + UITypes, + {$ENDIF} Windows, SynEditPrintTypes, SynEditPrintMargins, diff --git a/components/synedit/Source/SynEditPrintMarginsDialog.pas b/components/synedit/Source/SynEditPrintMarginsDialog.pas index 61cb8948..3e53f977 100644 --- a/components/synedit/Source/SynEditPrintMarginsDialog.pas +++ b/components/synedit/Source/SynEditPrintMarginsDialog.pas @@ -63,6 +63,9 @@ uses QSynEditPrintTypes, QSynEditPrintMargins, {$ELSE} + {$IFDEF SYN_COMPILER_17_UP} + UITypes, + {$ENDIF} Windows, Graphics, Forms, diff --git a/components/synedit/Source/SynEditPrintPreview.pas b/components/synedit/Source/SynEditPrintPreview.pas index cbaebc78..cf1df2e1 100644 --- a/components/synedit/Source/SynEditPrintPreview.pas +++ b/components/synedit/Source/SynEditPrintPreview.pas @@ -65,6 +65,9 @@ uses {$IFDEF SYN_COMPILER_7} Themes, {$ENDIF} + {$IFDEF SYN_COMPILER_17_UP} + Types, + {$ENDIF} Windows, Controls, Messages, diff --git a/components/synedit/Source/SynHighlighterPython.pas b/components/synedit/Source/SynHighlighterPython.pas index 62dd0323..cc1abecc 100644 --- a/components/synedit/Source/SynHighlighterPython.pas +++ b/components/synedit/Source/SynHighlighterPython.pas @@ -224,14 +224,13 @@ const ); // List of non-keyword identifiers - NONKEYWORDCOUNT = 66; + NONKEYWORDCOUNT = 65; NONKEYWORDS: array [1..NONKEYWORDCOUNT] of UnicodeString = ( '__future__', '__import__', 'abs', 'apply', - 'as', 'buffer', 'callable', 'chr', diff --git a/components/synedit/Source/SynHighlighterSQL.pas b/components/synedit/Source/SynHighlighterSQL.pas index 31da10a8..af5ff830 100644 --- a/components/synedit/Source/SynHighlighterSQL.pas +++ b/components/synedit/Source/SynHighlighterSQL.pas @@ -55,6 +55,10 @@ unit SynHighlighterSQL; interface +{$IFDEF SYN_COMPILER_12_UP} + {$DEFINE USE_TABLE_DICTIONARY} +{$ENDIF} + uses {$IFDEF SYN_CLX} Types, @@ -71,6 +75,9 @@ uses SynHighlighterHashEntries, SynUnicode, {$ENDIF} + {$IFDEF USE_TABLE_DICTIONARY} + Generics.Collections, + {$ENDIF} SysUtils, Classes; @@ -93,6 +100,9 @@ type fKeywords: TSynHashEntryList; fProcNames: TUnicodeStrings; fTableNames: TUnicodeStrings; + {$IFDEF USE_TABLE_DICTIONARY} + fTableDict: TDictionary; + {$ENDIF} fFunctionNames: TUniCodeStrings; fDialect: TSQLDialect; fCommentAttri: TSynHighlighterAttributes; @@ -1238,7 +1248,12 @@ begin end; Entry := Entry.Next; end; - Result := tkIdentifier; + {$IFDEF USE_TABLE_DICTIONARY} + if fTableDict.ContainsKey(SynWideLowerCase(Copy(StrPas(fToIdent), 1, fStringLen))) then + Result := tkTableName + else + {$ENDIF} + Result := tkIdentifier; end; constructor TSynSQLSyn.Create(AOwner: TComponent); @@ -1254,6 +1269,9 @@ begin fTableNames := TUnicodeStringList.Create; TUnicodeStringList(fTableNames).OnChange := TableNamesChanged; + {$IFDEF USE_TABLE_DICTIONARY} + fTableDict := TDictionary.Create; + {$ENDIF} fFunctionNames := TunicodeStringList.Create; TUnicodeStringList(fFunctionNames).OnChange := FunctionNamesChanged; @@ -1317,6 +1335,9 @@ begin fKeywords.Free; fProcNames.Free; fTableNames.Free; + {$IFDEF USE_TABLE_DICTIONARY} + fTableDict.Free; + {$ENDIF} fFunctionNames.Free; inherited Destroy; end; @@ -1895,7 +1916,12 @@ begin Entry := Entry.Next; end; if not Assigned(Entry) then + {$IFDEF USE_TABLE_DICTIONARY} + if not fTableDict.ContainsKey(SynWideLowerCase(fTableNames[i])) then + fTableDict.Add(SynWideLowerCase(fTableNames[i]), True); + {$ELSE} DoAddKeyword(fTableNames[i], Ord(tkTableName)); + {$ENDIF} end; end; @@ -1946,6 +1972,9 @@ begin {$ELSE} fKeywords.Clear; {$ENDIF} + {$IFDEF USE_TABLE_DICTIONARY} + fTableDict.Clear; + {$ENDIF} for I := 0 to Ord(High(TtkTokenKind)) - 1 do EnumerateKeywords(I, GetKeywords(I), IsIdentChar, DoAddKeyword); diff --git a/components/synedit/Source/SynRegExpr.pas b/components/synedit/Source/SynRegExpr.pas index 00097008..f9c907ab 100644 --- a/components/synedit/Source/SynRegExpr.pas +++ b/components/synedit/Source/SynRegExpr.pas @@ -1296,7 +1296,9 @@ var AModifiersInt : integer) : boolean; begin Result := true; IsOn := true; + {$IFNDEF SYN_COMPILER_24_UP} Mask := 0; // prevent compiler warning + {$ENDIF} for i := 1 to length (AModifiers) do if AModifiers [i] = '-' then IsOn := false diff --git a/components/synedit/Source/SynTextDrawer.pas b/components/synedit/Source/SynTextDrawer.pas index ef65102c..886a672e 100644 --- a/components/synedit/Source/SynTextDrawer.pas +++ b/components/synedit/Source/SynTextDrawer.pas @@ -68,6 +68,9 @@ unit SynTextDrawer; interface uses + {$IFDEF SYN_COMPILER_17_UP} + Types, UITypes, + {$ENDIF} SynUnicode, SysUtils, Classes, diff --git a/source/main.pas b/source/main.pas index 600218b0..683ec6aa 100644 --- a/source/main.pas +++ b/source/main.pas @@ -8068,14 +8068,12 @@ begin for Obj in DBObjects do begin case Obj.NodeType of lntTable, lntView: begin - // Limit slow highlighter to 1000 table names. See http://www.heidisql.com/forum.php?t=16307 + // Slow highlighter enhanced by uschuster. See http://www.heidisql.com/forum.php?t=16307 // ... and here: https://github.com/SynEdit/SynEdit/issues/28 - if TableNames.Count < 1000 then - TableNames.Add(Obj.Name); + TableNames.Add(Obj.Name); end; lntProcedure, lntFunction: begin - if ProcNames.Count < 1000 then - ProcNames.Add(Obj.Name); + ProcNames.Add(Obj.Name); end; end; end;