Update of /cvsroot/synedit/SynEdit/Source In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17521 Modified Files: Tag: Unicode_2004_08_31 SynEdit.pas SynEditHighlighter.pas SynEditMiscProcs.pas SynHighlighterProgress.pas SynUnicode.pas Log Message: - AdditionalWordBreakChars/IdentChars options by Peter Schmitz - Fixes by Erik Berry - Tab-related fix by Jan Fiala Index: SynEdit.pas =================================================================== RCS file: /cvsroot/synedit/SynEdit/Source/SynEdit.pas,v retrieving revision 1.386.2.75 retrieving revision 1.386.2.76 diff -u -d -r1.386.2.75 -r1.386.2.76 --- SynEdit.pas 17 Sep 2008 13:59:11 -0000 1.386.2.75 +++ SynEdit.pas 28 Sep 2009 17:54:20 -0000 1.386.2.76 @@ -486,6 +486,9 @@ fChainUndoAdded: TNotifyEvent; fChainRedoAdded: TNotifyEvent; + FAdditionalWordBreakChars: TSysCharSet; + FAdditionalIdentChars: TSysCharSet; + {$IFDEF SYN_COMPILER_6_UP} fSearchNotFound: TCustomSynEditSearchNotFoundEvent; OnFindBeforeSearch: TNotifyEvent; @@ -610,6 +613,8 @@ procedure UpdateScrollBars; procedure WriteAddedKeystrokes(Writer: TWriter); procedure WriteRemovedKeystrokes(Writer: TWriter); + procedure SetAdditionalIdentChars(const Value: TSysCharSet); + procedure SetAdditionalWordBreakChars(const Value: TSysCharSet); {$IFDEF SYN_COMPILER_6_UP} procedure DoSearchFindFirstExecute(Action: TSearchFindFirst); @@ -876,6 +881,8 @@ aUndo, aRedo: TSynEditUndoList); procedure UnHookTextBuffer; public + property AdditionalIdentChars: TSysCharSet read FAdditionalIdentChars write SetAdditionalIdentChars; + property AdditionalWordBreakChars: TSysCharSet read FAdditionalWordBreakChars write SetAdditionalWordBreakChars; property BlockBegin: TBufferCoord read GetBlockBegin write SetBlockBegin; property BlockEnd: TBufferCoord read GetBlockEnd write SetBlockEnd; property CanPaste: Boolean read GetCanPaste; @@ -7426,10 +7433,13 @@ if SpaceCount2 > 0 then begin SpaceBuffer := Copy(Lines[BackCounter], 1, SpaceCount2); + InternalCaretXY := BufferCoord(1, CaretY +1); for i := 1 to Length(SpaceBuffer) do - CommandProcessor(ecChar, SpaceBuffer[i], nil); + if SpaceBuffer[i] = #9 then + CommandProcessor(ecTab, #0, nil) + else + CommandProcessor(ecChar, SpaceBuffer[i], nil); end; - InternalCaretXY := BufferCoord(SpaceCount2 +1, CaretY +1); end; fUndoList.AddChange(crLineBreak, Caret, Caret, '', smNormal); end; @@ -7956,6 +7966,16 @@ end; end; +procedure TCustomSynEdit.SetAdditionalIdentChars(const Value: TSysCharSet); +begin + FAdditionalIdentChars := Value; +end; + +procedure TCustomSynEdit.SetAdditionalWordBreakChars(const Value: TSysCharSet); +begin + FAdditionalWordBreakChars := Value; +end; + procedure TCustomSynEdit.BeginUndoBlock; begin fUndoList.BeginBlock; @@ -10291,6 +10311,11 @@ else Result := AChar >= #33; + if Assigned(Highlighter) then + Result := Result or CharInSet(AChar, Highlighter.AdditionalIdentChars) + else + Result := Result or CharInSet(AChar, Self.AdditionalIdentChars); + Result := Result and not IsWordBreakChar(AChar); end; @@ -10320,6 +10345,17 @@ else Result := False; end; + + if Assigned(Highlighter) then + begin + Result := Result or CharInSet(AChar, Highlighter.AdditionalWordBreakChars); + Result := Result and not CharInSet(AChar, Highlighter.AdditionalIdentChars); + end + else + begin + Result := Result or CharInSet(AChar, Self.AdditionalWordBreakChars); + Result := Result and not CharInSet(AChar, Self.AdditionalIdentChars); + end; end; procedure TCustomSynEdit.SetSearchEngine(Value: TSynEditSearchCustom); Index: SynEditHighlighter.pas =================================================================== RCS file: /cvsroot/synedit/SynEdit/Source/SynEditHighlighter.pas,v retrieving revision 1.36.2.18 retrieving revision 1.36.2.19 diff -u -d -r1.36.2.18 -r1.36.2.19 --- SynEditHighlighter.pas 14 Sep 2008 16:24:58 -0000 1.36.2.18 +++ SynEditHighlighter.pas 28 Sep 2009 17:54:20 -0000 1.36.2.19 @@ -129,7 +129,13 @@ fAttrChangeHooks: TSynNotifyEventChain; fUpdateCount: Integer; fEnabled: Boolean; + FAdditionalWordBreakChars: TSysCharSet; + FAdditionalIdentChars: TSysCharSet; + FExportName: string; + function GetExportName: string; procedure SetEnabled(const Value: Boolean); + procedure SetAdditionalIdentChars(const Value: TSysCharSet); + procedure SetAdditionalWordBreakChars(const Value: TSysCharSet); protected fCasedLine: PWideChar; fCasedLineStr: UnicodeString; @@ -205,7 +211,7 @@ {$IFNDEF SYN_CLX} function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; virtual; function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; virtual; - function LoadFromFile(AFileName: string): Boolean; + function LoadFromFile(AFileName: string): Boolean; function SaveToFile(AFileName: string): Boolean; {$ENDIF} procedure HookAttrChangeEvent(ANotifyEvent: TNotifyEvent); @@ -216,6 +222,8 @@ property FriendlyLanguageName: UnicodeString read GetFriendlyLanguageNameProp; property LanguageName: string read GetLanguageNameProp; public + property AdditionalIdentChars: TSysCharSet read FAdditionalIdentChars write SetAdditionalIdentChars; + property AdditionalWordBreakChars: TSysCharSet read FAdditionalWordBreakChars write SetAdditionalWordBreakChars; property AttrCount: Integer read GetAttribCount; property Attribute[Index: Integer]: TSynHighlighterAttributes read GetAttribute; @@ -233,6 +241,7 @@ index SYN_ATTR_SYMBOL read GetDefaultAttribute; property WhitespaceAttribute: TSynHighlighterAttributes index SYN_ATTR_WHITESPACE read GetDefaultAttribute; + property ExportName: string read GetExportName; published property DefaultFilter: string read GetDefaultFilter write SetDefaultFilter stored IsFilterStored; @@ -265,6 +274,7 @@ implementation uses + SynEditMiscProcs, {$IFDEF UNICODE} WideStrUtils, {$ENDIF} @@ -978,6 +988,13 @@ Result := fExpandedTokenPos; end; +function TSynCustomHighlighter.GetExportName: string; +begin + if FExportName = '' then + FExportName := SynEditMiscProcs.DeleteTypePrefixAndSynSuffix(ClassName); + Result := FExportName; +end; + function TSynCustomHighlighter.GetExpandedToken: UnicodeString; var Len: Integer; @@ -1154,6 +1171,18 @@ begin end; +procedure TSynCustomHighlighter.SetAdditionalIdentChars( + const Value: TSysCharSet); +begin + FAdditionalIdentChars := Value; +end; + +procedure TSynCustomHighlighter.SetAdditionalWordBreakChars( + const Value: TSysCharSet); +begin + FAdditionalWordBreakChars := Value; +end; + procedure TSynCustomHighlighter.SetAttributesOnChange(AEvent: TNotifyEvent); var i: Integer; Index: SynEditMiscProcs.pas =================================================================== RCS file: /cvsroot/synedit/SynEdit/Source/SynEditMiscProcs.pas,v retrieving revision 1.35.2.7 retrieving revision 1.35.2.8 diff -u -d -r1.35.2.7 -r1.35.2.8 --- SynEditMiscProcs.pas 14 Sep 2008 16:24:58 -0000 1.35.2.7 +++ SynEditMiscProcs.pas 28 Sep 2009 17:54:20 -0000 1.35.2.8 @@ -173,6 +173,8 @@ procedure SynDrawGradient(const ACanvas: TCanvas; const AStartColor, AEndColor: TColor; ASteps: Integer; const ARect: TRect; const AHorizontal: Boolean); +function DeleteTypePrefixAndSynSuffix(S: string): string; + implementation uses @@ -844,7 +846,7 @@ for i := 0 to Schemes.Count - 1 do begin - UniqueAttriName := DeleteTypePrefixAndSynSuffix(Highlighter.ClassName) + + UniqueAttriName := Highlighter.ExportName + IntToStr(GetHighlighterIndex(Highlighter, HighlighterList)) + '.' + Schemes[i].MarkerAttri.Name + IntToStr(i + 1); @@ -860,7 +862,7 @@ else if Assigned(Highlighter) then for i := 0 to Highlighter.AttrCount - 1 do begin - UniqueAttriName := DeleteTypePrefixAndSynSuffix(Highlighter.ClassName) + + UniqueAttriName := Highlighter.ExportName + IntToStr(GetHighlighterIndex(Highlighter, HighlighterList)) + '.' + Highlighter.Attribute[i].Name; Index: SynUnicode.pas =================================================================== RCS file: /cvsroot/synedit/SynEdit/Source/Attic/SynUnicode.pas,v retrieving revision 1.1.2.45 retrieving revision 1.1.2.46 diff -u -d -r1.1.2.45 -r1.1.2.46 --- SynUnicode.pas 23 Feb 2009 15:43:50 -0000 1.1.2.45 +++ SynUnicode.pas 28 Sep 2009 17:54:20 -0000 1.1.2.46 @@ -2567,7 +2567,7 @@ ErrorMessage: UnicodeString; {$ENDIF} begin - if Mode = fmCreate then + if ((Mode and fmCreate) = fmCreate) then begin inherited Create(WideFileCreate(FileName, Rights)); if Handle < 0 then Index: SynHighlighterProgress.pas =================================================================== RCS file: /cvsroot/synedit/SynEdit/Source/SynHighlighterProgress.pas,v retrieving revision 1.16.2.6 retrieving revision 1.16.2.7 diff -u -d -r1.16.2.6 -r1.16.2.7 --- SynHighlighterProgress.pas 14 Aug 2009 14:20:48 -0000 1.16.2.6 +++ SynHighlighterProgress.pas 28 Sep 2009 17:54:20 -0000 1.16.2.7 @@ -275,7 +275,7 @@ DefaultNonReservedKeywords: UnicodeString = 'abs absolute accelerator across add-events-procedure ' + - 'add-first add-last advise alert-box allow-replication ' + + 'add-first add-interval add-last advise alert-box allow-replication ' + 'ansi-only anywhere append appl-alert appl-alert-boxes ' + 'application as-cursor ask-overwrite attachment auto-endkey ' + 'auto-end-key auto-go auto-indent auto-resize auto-zap ' + |