|
From: Andreas H. <ah...@pr...> - 2004-01-27 04:05:04
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25963/run Modified Files: JvEditor.pas JvHLEditor.pas JvHLEditorPropertyForm.pas JvHLParser.pas JvJCLUtils.pas JvUnicodeEditor.pas JvUnicodeHLEditor.pas Added Files: JvEditorCommon.pas Log Message: Splitted JvEditor into JvEditorCommon, JvEditor, JvUnicodeEditor Index: JvUnicodeHLEditor.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvUnicodeHLEditor.pas,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** JvUnicodeHLEditor.pas 15 Jan 2004 18:08:21 -0000 1.5 --- JvUnicodeHLEditor.pas 26 Jan 2004 08:58:24 -0000 1.6 *************** *** 9,13 **** the specific language governing rights and limitations under the License. ! The Original Code is: JvHLEditor.PAS, released on 2002-07-04. The Initial Developers of the Original Code are: Andrei Prygounkov <a.p...@gm...> --- 9,13 ---- the specific language governing rights and limitations under the License. ! The Original Code is: JvUnicodeHLEditor.PAS, released on 2002-07-04. [...1402 lines suppressed...] + end; + + function TJvWideHLEditor.GetSyntaxHighlighting: Boolean; + begin + Result := FSyntaxHighlighting; + end; + + procedure TJvWideHLEditor.SetSyntaxHighlighting(Value: Boolean); + begin + FSyntaxHighlighting := Value; + Invalidate; + end; + + function TJvWideHLEditor.GetHighlighter: TJvHighlighter; + begin + Result := FHighlighter; + end; + end. Index: JvHLEditorPropertyForm.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvHLEditorPropertyForm.pas,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** JvHLEditorPropertyForm.pas 15 Jan 2004 08:23:57 -0000 1.22 --- JvHLEditorPropertyForm.pas 26 Jan 2004 08:58:24 -0000 1.23 *************** *** 36,40 **** Windows, Messages, SysUtils, Classes, Graphics, ComCtrls, Controls, Forms, StdCtrls, ExtCtrls, ! JvFormPlacement, JvEditor, JvHLEditor, JvComponent; type --- 36,40 ---- Windows, Messages, SysUtils, Classes, Graphics, ComCtrls, Controls, Forms, StdCtrls, ExtCtrls, ! JvFormPlacement, JvEditorCommon, JvComponent, JvHLEditor; type *************** *** 103,107 **** private JvHLEditorPreview: TJvHLEditor; ! FHighLighter: THighLighter; SC: TJvSymbolColor; InChanging: boolean; --- 103,107 ---- private JvHLEditorPreview: TJvHLEditor; ! FHighlighter: TJvHighlighter; SC: TJvSymbolColor; InChanging: boolean; *************** *** 139,143 **** TJvHLEdPropDlg = class(TComponent) private ! FJvHLEditor: TJvHLEditor; FStorage: TJvFormStorage; FColorSamples: TStrings; --- 139,143 ---- TJvHLEdPropDlg = class(TComponent) private ! FJvHLEditor: TJvCustomEditorBase; FStorage: TJvFormStorage; FColorSamples: TStrings; *************** *** 152,155 **** --- 152,156 ---- procedure SetColorSamples(Value: TStrings); function IsPagesStored: boolean; + procedure SetJvHLEditor(const Value: TJvCustomEditorBase); protected procedure Notification(AComponent: TComponent; Operation: TOperation); override; *************** *** 159,169 **** procedure Save; procedure Restore; ! procedure LoadHighlighterColors(AJvHLEditor: TJvHLEditor; AHighLighter: THighLighter); ! procedure SaveHighlighterColors(AJvHLEditor: TJvHLEditor; AHighLighter: THighLighter); ! function Execute: boolean; procedure LoadCurrentHighlighterColors; procedure SaveCurrentHighlighterColors; published ! property JvHLEditor: TJvHLEditor read FJvHLEditor write FJvHLEditor; property Storage: TJvFormStorage read FStorage write FStorage; property ColorSamples: TStrings read GetColorSamples write SetColorSamples; --- 160,170 ---- procedure Save; procedure Restore; ! procedure LoadHighlighterColors(AJvHLEditor: TJvCustomEditorBase; AHighlighter: TJvHighlighter); ! procedure SaveHighlighterColors(AJvHLEditor: TJvCustomEditorBase; AHighlighter: TJvHighlighter); ! function Execute: Boolean; procedure LoadCurrentHighlighterColors; procedure SaveCurrentHighlighterColors; published ! property JvHLEditor: TJvCustomEditorBase read FJvHLEditor write SetJvHLEditor; property Storage: TJvFormStorage read FStorage write FStorage; property ColorSamples: TStrings read GetColorSamples write SetColorSamples; *************** *** 178,182 **** const ! HighLighters: array[THighLighter] of string = ('None', 'Pascal', 'CBuilder', 'Sql', 'Python', 'Java', 'VB', 'Html', 'Perl', 'Ini', 'CocoR', 'Php', 'NQC', 'User Defined'); --- 179,183 ---- const ! Highlighters: array[TJvHighlighter] of string = ('None', 'Pascal', 'CBuilder', 'Sql', 'Python', 'Java', 'VB', 'Html', 'Perl', 'Ini', 'CocoR', 'Php', 'NQC', 'User Defined'); *************** *** 252,256 **** begin TmpEd.Lines := Lines; ! TmpEd.HighLighter := HighLighter; { color values corresponds to lbElements ListBox } TmpEd.Font.Color := 0; --- 253,257 ---- begin TmpEd.Lines := Lines; ! TmpEd.Highlighter := Highlighter; { color values corresponds to lbElements ListBox } TmpEd.Font.Color := 0; *************** *** 271,275 **** TmpEd.SelForeColor := 12; Str := TmpEd.Lines[YY]; ! TJvSampleViewer(TmpEd).GetLineAttr(Str, YY, 0, JvEditor.Max_X - 1); F := TJvSampleViewer(TmpEd).LineAttrs[XX].FC; end; --- 272,276 ---- TmpEd.SelForeColor := 12; Str := TmpEd.Lines[YY]; ! TJvSampleViewer(TmpEd).GetLineAttr(Str, YY, 0, Max_X - 1); F := TJvSampleViewer(TmpEd).LineAttrs[XX].FC; end; *************** *** 300,307 **** --- 301,310 ---- var S: string; + HLed: IJvHLEditor; begin if Storage <> nil then begin // raise Exception.Create(RsEHLEdPropDlg_RegAutoNotAssigned); + FJvHLEditor.GetInterface(IJvHLEditor, HLed); S := AddSlash2(FStorageSection) + cParams; with Storage do *************** *** 315,319 **** StoredValue['GroupUndo'] := FJvHLEditor.GroupUndo; StoredValue['CursorBeyondEOF'] := FJvHLEditor.CursorBeyondEOF; ! StoredValue['SyntaxHighlighting'] := FJvHLEditor.SyntaxHighlighting; StoredValue['TabStops'] := FJvHLEditor.TabStops; StoredValue['RightMargin'] := FJvHLEditor.RightMargin; --- 318,322 ---- StoredValue['GroupUndo'] := FJvHLEditor.GroupUndo; StoredValue['CursorBeyondEOF'] := FJvHLEditor.CursorBeyondEOF; ! StoredValue['SyntaxHighlighting'] := HLed.SyntaxHighlighting; StoredValue['TabStops'] := FJvHLEditor.TabStops; StoredValue['RightMargin'] := FJvHLEditor.RightMargin; *************** *** 327,330 **** --- 330,334 ---- var S: string; + HLed: IJvHLEditor; begin if Storage <> nil then *************** *** 332,335 **** --- 336,340 ---- // raise Exception.Create(RsEHLEdPropDlg_RegAutoNotAssigned); S := AddSlash2(StorageSection) + cParams; + FJvHLEditor.GetInterface(IJvHLEditor, HLed); with Storage do begin *************** *** 342,346 **** FJvHLEditor.GroupUndo := DefaultValue['GroupUndo', FJvHLEditor.GroupUndo]; FJvHLEditor.CursorBeyondEOF := DefaultValue['CursorBeyondEOF', FJvHLEditor.CursorBeyondEOF]; ! FJvHLEditor.SyntaxHighlighting := DefaultValue['SyntaxHighlighting', FJvHLEditor.SyntaxHighlighting]; FJvHLEditor.TabStops := DefaultValue['TabStops', FJvHLEditor.TabStops]; FJvHLEditor.RightMargin := DefaultValue['RightMargin', FJvHLEditor.RightMargin]; --- 347,351 ---- FJvHLEditor.GroupUndo := DefaultValue['GroupUndo', FJvHLEditor.GroupUndo]; FJvHLEditor.CursorBeyondEOF := DefaultValue['CursorBeyondEOF', FJvHLEditor.CursorBeyondEOF]; ! HLed.SyntaxHighlighting := DefaultValue['SyntaxHighlighting', HLed.SyntaxHighlighting]; FJvHLEditor.TabStops := DefaultValue['TabStops', FJvHLEditor.TabStops]; FJvHLEditor.RightMargin := DefaultValue['RightMargin', FJvHLEditor.RightMargin]; *************** *** 349,353 **** end; ! procedure TJvHLEdPropDlg.SaveHighlighterColors(AJvHLEditor: TJvHLEditor; AHighLighter: THighLighter); var Section: string; --- 354,362 ---- end; ! type ! TOpenCustomEditorBase = class(TJvCustomEditorBase); ! ! procedure TJvHLEdPropDlg.SaveHighlighterColors(AJvHLEditor: TJvCustomEditorBase; ! AHighlighter: TJvHighlighter); var Section: string; *************** *** 355,387 **** procedure SaveColor(AColor: TJvSymbolColor; const Prefix: string); begin ! Storage.StoredValue[Section + Prefix] := ColorToString(AColor.ForeColor) + ', ' + ColorToString(AColor.BackColor) + ', ' + IntToStr(byte(AColor.Style)); end; begin if Storage <> nil then begin // raise Exception.Create(RsEHLEdPropDlg_RegAutoNotAssigned); ! Section := AddSlash2(StorageSection) + HighLighters[AHighLighter]; ! Storage.StoredValue[Section + 'BackColor'] := ColorToString(AJvHLEditor.Color); ! Storage.StoredValue[Section + 'FontName'] := AJvHLEditor.Font.Name; ! Storage.StoredValue[Section + 'Charset'] := IntToStr(AJvHLEditor.Font.CharSet); ! Storage.StoredValue[Section + 'FontSize'] := AJvHLEditor.Font.Size; ! Storage.StoredValue[Section + 'RightMarginColor'] := ColorToString(AJvHLEditor.RightMarginColor); ! SaveColor(AJvHLEditor.Colors.Number, 'Number'); ! SaveColor(AJvHLEditor.Colors.Strings, 'Strings'); ! SaveColor(AJvHLEditor.Colors.Symbol, 'Symbol'); ! SaveColor(AJvHLEditor.Colors.Comment, 'Comment'); ! SaveColor(AJvHLEditor.Colors.Reserved, 'Reserved'); ! SaveColor(AJvHLEditor.Colors.Identifier, 'Identifier'); ! SaveColor(AJvHLEditor.Colors.Preproc, 'Preproc'); ! SaveColor(AJvHLEditor.Colors.FunctionCall, 'FunctionCall'); ! SaveColor(AJvHLEditor.Colors.Declaration, 'Declaration'); ! SaveColor(AJvHLEditor.Colors.Statement, 'Statement'); ! SaveColor(AJvHLEditor.Colors.PlainText, 'PlainText'); end; end; ! procedure TJvHLEdPropDlg.LoadHighlighterColors(AJvHLEditor: TJvHLEditor; AHighLighter: THighLighter); var Section: string; --- 364,403 ---- procedure SaveColor(AColor: TJvSymbolColor; const Prefix: string); begin ! Storage.StoredValue[Section + Prefix] := ! ColorToString(AColor.ForeColor) + ', ' + ColorToString(AColor.BackColor) + ', ' + IntToStr(byte(AColor.Style)); end; + var + ed: TOpenCustomEditorBase; + HLed: IJvHLEditor; begin if Storage <> nil then begin // raise Exception.Create(RsEHLEdPropDlg_RegAutoNotAssigned); ! ed := TOpenCustomEditorBase(AJvHLEditor); ! FJvHLEditor.GetInterface(IJvHLEditor, HLed); ! Section := AddSlash2(StorageSection) + Highlighters[AHighlighter]; ! Storage.StoredValue[Section + 'BackColor'] := ColorToString(ed.Color); ! Storage.StoredValue[Section + 'FontName'] := ed.Font.Name; ! Storage.StoredValue[Section + 'Charset'] := IntToStr(ed.Font.CharSet); ! Storage.StoredValue[Section + 'FontSize'] := ed.Font.Size; ! Storage.StoredValue[Section + 'RightMarginColor'] := ColorToString(ed.RightMarginColor); ! SaveColor(HLed.Colors.Number, 'Number'); ! SaveColor(HLed.Colors.Strings, 'Strings'); ! SaveColor(HLed.Colors.Symbol, 'Symbol'); ! SaveColor(HLed.Colors.Comment, 'Comment'); ! SaveColor(HLed.Colors.Reserved, 'Reserved'); ! SaveColor(HLed.Colors.Identifier, 'Identifier'); ! SaveColor(HLed.Colors.Preproc, 'Preproc'); ! SaveColor(HLed.Colors.FunctionCall, 'FunctionCall'); ! SaveColor(HLed.Colors.Declaration, 'Declaration'); ! SaveColor(HLed.Colors.Statement, 'Statement'); ! SaveColor(HLed.Colors.PlainText, 'PlainText'); end; end; ! procedure TJvHLEdPropDlg.LoadHighlighterColors(AJvHLEditor: TJvCustomEditorBase; ! AHighlighter: TJvHighlighter); var Section: string; *************** *** 411,430 **** end; begin if Storage <> nil then begin // raise Exception.Create(RsEHLEdPropDlg_RegAutoNotAssigned); ! Section := AddSlash2(StorageSection) + HighLighters[AHighLighter]; ! LoadColor(AJvHLEditor.Colors.Number, clNavy, clWindow, [], 'Number'); ! LoadColor(AJvHLEditor.Colors.Strings, clMaroon, clWindow, [], 'Strings'); ! LoadColor(AJvHLEditor.Colors.Symbol, clBlue, clWindow, [], 'Symbol'); ! LoadColor(AJvHLEditor.Colors.Comment, clOlive, clWindow, [fsItalic], 'Comment'); ! LoadColor(AJvHLEditor.Colors.Reserved, clWindowText, clWindow, [fsBold], 'Reserved'); ! LoadColor(AJvHLEditor.Colors.Identifier, clWindowText, clWindow, [], 'Identifier'); ! LoadColor(AJvHLEditor.Colors.Preproc, clGreen, clWindow, [], 'Preproc'); ! LoadColor(AJvHLEditor.Colors.FunctionCall, clWindowText, clWindow, [], 'FunctionCall'); ! LoadColor(AJvHLEditor.Colors.Declaration, clWindowText, clWindow, [], 'Declaration'); ! LoadColor(AJvHLEditor.Colors.Statement, clWindowText, clWindow, [], 'Statement'); ! LoadColor(AJvHLEditor.Colors.PlainText, clWindowText, clWindow, [], 'PlainText'); try AJvHLEditor.Color := StringToColor(Storage.ReadString(Section + 'BackColor', 'clWindow')); --- 427,451 ---- end; + var + ed: TOpenCustomEditorBase; + HLed: IJvHLEditor; begin if Storage <> nil then begin // raise Exception.Create(RsEHLEdPropDlg_RegAutoNotAssigned); ! ed := TOpenCustomEditorBase(AJvHLEditor); ! FJvHLEditor.GetInterface(IJvHLEditor, HLed); ! Section := AddSlash2(StorageSection) + Highlighters[AHighlighter]; ! LoadColor(HLed.Colors.Number, clNavy, clWindow, [], 'Number'); ! LoadColor(HLed.Colors.Strings, clMaroon, clWindow, [], 'Strings'); ! LoadColor(HLed.Colors.Symbol, clBlue, clWindow, [], 'Symbol'); ! LoadColor(HLed.Colors.Comment, clOlive, clWindow, [fsItalic], 'Comment'); ! LoadColor(HLed.Colors.Reserved, clWindowText, clWindow, [fsBold], 'Reserved'); ! LoadColor(HLed.Colors.Identifier, clWindowText, clWindow, [], 'Identifier'); ! LoadColor(HLed.Colors.Preproc, clGreen, clWindow, [], 'Preproc'); ! LoadColor(HLed.Colors.FunctionCall, clWindowText, clWindow, [], 'FunctionCall'); ! LoadColor(HLed.Colors.Declaration, clWindowText, clWindow, [], 'Declaration'); ! LoadColor(HLed.Colors.Statement, clWindowText, clWindow, [], 'Statement'); ! LoadColor(HLed.Colors.PlainText, clWindowText, clWindow, [], 'PlainText'); try AJvHLEditor.Color := StringToColor(Storage.ReadString(Section + 'BackColor', 'clWindow')); *************** *** 433,441 **** AJvHLEditor.RightMarginColor := clWindow; end; ! AJvHLEditor.Font.Name := Storage.ReadString(Section + 'FontName', 'Courier New'); ! AJvHLEditor.Font.CharSet := Storage.ReadInteger(Section + 'Charset', DEFAULT_CHARSET); ! AJvHLEditor.Font.Size := Storage.ReadInteger(Section + 'FontSize', 10); try ! AJvHLEditor.RightMarginColor := StringToColor(Storage.ReadString(Section + 'RightMarginColor', 'clSilver')); except on E: EConvertError do --- 454,462 ---- AJvHLEditor.RightMarginColor := clWindow; end; ! ed.Font.Name := Storage.ReadString(Section + 'FontName', 'Courier New'); ! ed.Font.CharSet := Storage.ReadInteger(Section + 'Charset', DEFAULT_CHARSET); ! ed.Font.Size := Storage.ReadInteger(Section + 'FontSize', 10); try ! ed.RightMarginColor := StringToColor(Storage.ReadString(Section + 'RightMarginColor', 'clSilver')); except on E: EConvertError do *************** *** 445,452 **** end; ! function TJvHLEdPropDlg.Execute: boolean; var ! F: integer; Form: TJvHLEditorParamsForm; begin if FJvHLEditor = nil then --- 466,474 ---- end; ! function TJvHLEdPropDlg.Execute: Boolean; var ! F: Integer; Form: TJvHLEditorParamsForm; + HLed: IJvHLEditor; begin if FJvHLEditor = nil then *************** *** 456,460 **** with Form do try ! FHighLighter := FJvHLEditor.HighLighter; Params := Self; ParamsToControls; --- 478,483 ---- with Form do try ! FJvHLEditor.GetInterface(IJvHLEditor, HLed); ! FHighlighter := HLed.Highlighter; Params := Self; ParamsToControls; *************** *** 497,507 **** procedure TJvHLEdPropDlg.LoadCurrentHighlighterColors; begin ! LoadHighlighterColors(FJvHLEditor, FJvHLEditor.HighLighter); end; procedure TJvHLEdPropDlg.SaveCurrentHighlighterColors; begin ! SaveHighlighterColors(FJvHLEditor, FJvHLEditor.HighLighter); end; --- 520,536 ---- procedure TJvHLEdPropDlg.LoadCurrentHighlighterColors; + var + HLed: IJvHLEditor; begin ! if FJvHLEditor.GetInterface(IJvHLEditor, HLed) then ! LoadHighlighterColors(FJvHLEditor, HLed.Highlighter); end; procedure TJvHLEdPropDlg.SaveCurrentHighlighterColors; + var + HLed: IJvHLEditor; begin ! if FJvHLEditor.GetInterface(IJvHLEditor, HLed) then ! SaveHighlighterColors(FJvHLEditor, HLed.Highlighter); end; *************** *** 548,552 **** --- 577,584 ---- var I: integer; + HLed: IJvHLEditor; begin + Params.FJvHLEditor.GetInterface(IJvHLEditor, HLed); + cbDoubleClickLine.Checked := Params.FJvHLEditor.DoubleClickLine; cbUndoAfterSave.Checked := Params.FJvHLEditor.UndoAfterSave; *************** *** 557,563 **** cbGroupUndo.Checked := Params.FJvHLEditor.GroupUndo; cbCursorBeyondEOF.Checked := Params.FJvHLEditor.CursorBeyondEOF; ! cbSytaxHighlighting.Checked := Params.FJvHLEditor.SyntaxHighlighting; eTabStops.Text := Params.FJvHLEditor.TabStops; ! cbColorSettings.ItemIndex := integer(FHighLighter); cbColorSettingsChange(nil); JvHLEditorPreview.RightMargin := Params.FJvHLEditor.RightMargin; --- 589,595 ---- cbGroupUndo.Checked := Params.FJvHLEditor.GroupUndo; cbCursorBeyondEOF.Checked := Params.FJvHLEditor.CursorBeyondEOF; ! cbSytaxHighlighting.Checked := HLed.SyntaxHighlighting; eTabStops.Text := Params.FJvHLEditor.TabStops; ! cbColorSettings.ItemIndex := Integer(FHighlighter); cbColorSettingsChange(nil); JvHLEditorPreview.RightMargin := Params.FJvHLEditor.RightMargin; *************** *** 573,577 **** --- 605,613 ---- procedure TJvHLEditorParamsForm.ControlsToParams; + var + HLed: IJvHLEditor; begin + Params.FJvHLEditor.GetInterface(IJvHLEditor, HLed); + Params.FJvHLEditor.DoubleClickLine := cbDoubleClickLine.Checked; Params.FJvHLEditor.UndoAfterSave := cbUndoAfterSave.Checked; *************** *** 582,589 **** Params.FJvHLEditor.GroupUndo := cbGroupUndo.Checked; Params.FJvHLEditor.CursorBeyondEOF := cbCursorBeyondEOF.Checked; ! Params.FJvHLEditor.SyntaxHighlighting := cbSytaxHighlighting.Checked; Params.FJvHLEditor.TabStops := eTabStops.Text; if Params.Storage <> nil then ! Params.SaveHighlighterColors(JvHLEditorPreview, JvHLEditorPreview.HighLighter); end; --- 618,625 ---- Params.FJvHLEditor.GroupUndo := cbGroupUndo.Checked; Params.FJvHLEditor.CursorBeyondEOF := cbCursorBeyondEOF.Checked; ! HLed.SyntaxHighlighting := cbSytaxHighlighting.Checked; Params.FJvHLEditor.TabStops := eTabStops.Text; if Params.Storage <> nil then ! Params.SaveHighlighterColors(JvHLEditorPreview, JvHLEditorPreview.Highlighter); end; *************** *** 874,878 **** procedure ReadColorSampleSection(Ini: TStrings; const Section: string; Lines: TStrings); var ! I: integer; S: string; InSection: boolean; --- 910,914 ---- procedure ReadColorSampleSection(Ini: TStrings; const Section: string; Lines: TStrings); var ! I: Integer; S: string; InSection: boolean; *************** *** 898,914 **** procedure TJvHLEditorParamsForm.cbColorSettingsChange(Sender: TObject); var ! I: integer; begin if (Sender <> nil) and (Params.Storage <> nil) then ! Params.SaveHighlighterColors(JvHLEditorPreview, JvHLEditorPreview.HighLighter); ReadColorSampleSection(ColorSamples, cbColorSettings.Text, JvHLEditorPreview.Lines); ! JvHLEditorPreview.HighLighter := THighLighter(cbColorSettings.ItemIndex); ! if JvHLEditorPreview.HighLighter = hlIni then for I := 0 to JvHLEditorPreview.Lines.Count - 1 do JvHLEditorPreview.Lines[I] := Copy(JvHLEditorPreview.Lines[I], 2, 10000); if Params.Storage <> nil then ! Params.LoadHighlighterColors(JvHLEditorPreview, JvHLEditorPreview.HighLighter); lbElementsClick(nil); end; --- 934,950 ---- procedure TJvHLEditorParamsForm.cbColorSettingsChange(Sender: TObject); var ! I: Integer; begin if (Sender <> nil) and (Params.Storage <> nil) then ! Params.SaveHighlighterColors(JvHLEditorPreview, JvHLEditorPreview.Highlighter); ReadColorSampleSection(ColorSamples, cbColorSettings.Text, JvHLEditorPreview.Lines); ! JvHLEditorPreview.Highlighter := TJvHighlighter(cbColorSettings.ItemIndex); ! if JvHLEditorPreview.Highlighter = hlIni then for I := 0 to JvHLEditorPreview.Lines.Count - 1 do JvHLEditorPreview.Lines[I] := Copy(JvHLEditorPreview.Lines[I], 2, 10000); if Params.Storage <> nil then ! Params.LoadHighlighterColors(JvHLEditorPreview, JvHLEditorPreview.Highlighter); lbElementsClick(nil); end; *************** *** 955,958 **** --- 991,995 ---- '[Pascal]'#10 + '{ Syntax highlighting }'#10 + + '{$DEFINE DELPHI}'#10 + 'procedure TMain.JvHLEditorPreviewChangeStatus(Sender: TObject);'#10 + 'const'#10 + *************** *** 1322,1328 **** begin if AComponent = JvHLEditor then ! JvHLEditor := nil else if AComponent = Storage then ! Storage := nil; end; end; --- 1359,1381 ---- begin if AComponent = JvHLEditor then ! FJvHLEditor := nil // do not call SetJvHLEditor else if AComponent = Storage then ! FStorage := nil; ! end; ! end; ! ! procedure TJvHLEdPropDlg.SetJvHLEditor(const Value: TJvCustomEditorBase); ! var ! HLed: IJvHLEditor; ! begin ! if Value <> FJvHLEditor then ! begin ! if Value <> nil then ! begin ! if Value.GetInterface(IJvHLEditor, HLed) then ! FJvHLEditor := Value; ! end ! else ! FJvHLEditor := nil; end; end; Index: JvUnicodeEditor.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvUnicodeEditor.pas,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** JvUnicodeEditor.pas 20 Jan 2004 20:42:23 -0000 1.20 --- JvUnicodeEditor.pas 26 Jan 2004 08:58:24 -0000 1.21 *************** *** 9,13 **** the specific language governing rights and limitations under the License. ! The Original Code is: JvEditor.PAS, released on 2002-07-04. The Initial Developers of the Original Code are: Andrei Prygounkov <a.p...@gm...> --- 9,13 ---- the specific language governing rights and limitations under the License. ! The Original Code is: JvUnicodeEditor.PAS, released on 2004-01-25. [...8277 lines suppressed...] ! procedure TJvWideCompletion.ReplaceWordItemIndex(SubStrStart: Integer); begin ! ReplaceWord(SubStrW(Items[ItemIndex], SubStrStart, FSeparator)); end; ! function TJvCustomWideEditor.GetCompletion: TJvWideCompletion; begin ! Result := TJvWideCompletion(inherited Completion); end; ! procedure TJvCustomWideEditor.SetCompletion(const Value: TJvWideCompletion); begin ! inherited Completion := Value; end; ! function TJvWideCompletion.GetAnsiSeparator: AnsiString; begin ! Result := FSeparator; end; --- NEW FILE: JvEditorCommon.pas --- {----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is: JvEditorCommon.PAS, released on 2004-01-25 The Initial Developers of the Original Code are: Andrei Prygounkov <a.p...@gm...> Copyright (c) 1999, 2002 Andrei Prygounkov All Rights Reserved. Contributor(s): Burov Dmitry, translation of russian text. Andreas Hausladen [...5238 lines suppressed...] { The following options are set directly by JvHLEditorPropertyForm FKeyboard.Assign(Src.Keyboard); FGroupUndo := Src.GroupUndo; FUndoAfterSave := Src.UndoAfterSave; FTabStops := Src.TabStops; FDoubleClickLine := Src.DoubleClickLine; FSmartTab := Src.SmartTab; FBackSpaceUnindents := Src.BackSpaceUnindents; FAutoIndent := Src.AutoIndent; FKeepTrailingBlanks := Src.KeepTrailingBlanks; FCursorBeyondEOF := Src.CursorBeyondEOF; FBlockOverwrite := Src.BlockOverwrite; FPersistentBlocks := Src.PersistentBlocks;} finally EndUpdate; end; end; end; end. Index: JvHLParser.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvHLParser.pas,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** JvHLParser.pas 25 Jan 2004 01:22:30 -0000 1.9 --- JvHLParser.pas 26 Jan 2004 08:58:24 -0000 1.10 *************** *** 45,49 **** uses ! SysUtils, Classes, JvTypes, JvJCLUtils; const --- 45,50 ---- uses ! SysUtils, Classes, JvTypes, JvJCLUtils, ! WStrUtils, Dialogs; const *************** *** 90,133 **** end; - // do not replace by JclUnicode.TWideStringList (speed and size issue) - PWStringItem = ^TWStringItem; - TWStringItem = record - FString: WideString; - FObject: TObject; - end; - - TWStrings = class(TPersistent) - private - FList: TList; - function GetCount: Integer; - function GetStrings(Index: Integer): WideString; - function GetObjects(Index: Integer): TObject; - procedure SetObjects(Index: Integer; const Value: TObject); - function GetItem(Index: Integer): PWStringItem; - function GetPStrings(Index: Integer): PWideString; - procedure SetStrings(Index: Integer; const Value: WideString); - public - constructor Create; - destructor Destroy; override; - - procedure Clear; virtual; - - function Add(const Value: WideString): Integer; - function AddObject(const Value: WideString; Data: TObject): Integer; - procedure Insert(Index: Integer; const Value: WideString); - procedure InsertObject(Index: Integer;const Value: WideString; Data: TObject); - procedure Delete(Index: Integer); - - function IndexOf(const Value: WideString): Integer; - - property Count: Integer read GetCount; - property PStrings[Index: Integer]: PWideString read GetPStrings; - property Strings[Index: Integer]: WideString read GetStrings write SetStrings; default; - property Objects[Index: Integer]: TObject read GetObjects write SetObjects; - end; - - TWStringList = class(TWStrings); - - TJvIParserW = class protected --- 91,94 ---- *************** *** 188,194 **** procedure ParseStringW(const S: WideString; Ss: TWStrings); - function StrScanW(P: PWideChar; Ch: WideChar): PWideChar; - function StrEndW(P: PWideChar): PWideChar; - implementation --- 149,152 ---- *************** *** 196,215 **** JvConsts; - function StrScanW(P: PWideChar; Ch: WideChar): PWideChar; - begin - Result := P; - if Result <> nil then - while (Result[0] <> #0) and (Result[0] <> Ch) do - Inc(Result); - end; - - function StrEndW(P: PWideChar): PWideChar; - begin - Result := P; - if Result <> nil then - while Result[0] <> #0 do - Inc(Result); - end; - //=== EJvIParserError ======================================================== --- 154,157 ---- *************** *** 262,265 **** --- 204,209 ---- if (FStyle in [psPascal, psCocoR]) and (P[1] = '*') then begin + if P[2] = #0 then + Exit; // line end F := P + 2; while True do *************** *** 299,302 **** --- 243,248 ---- if (FStyle in [psCpp, psCocoR, psPhp]) and (P[1] = '*') then begin + if P[2] = #0 then + Exit; // line end F := P + 2; while True do *************** *** 620,623 **** --- 566,571 ---- if (FStyle in [psPascal, psCocoR]) and (P[1] = '*') then begin + if P[2] = #0 then + Exit; // line end F := P + 2; while True do *************** *** 657,660 **** --- 605,610 ---- if (FStyle in [psCpp, psCocoR, psPhp]) and (P[1] = '*') then begin + if P[2] = #0 then + Exit; // line end F := P + 2; while True do *************** *** 1158,1265 **** end; - { TWStrings } - - constructor TWStrings.Create; - begin - inherited Create; - FList := TList.Create; - end; - - destructor TWStrings.Destroy; - begin - Clear; - FList.Free; - inherited Destroy; - end; - - procedure TWStrings.Clear; - var - i: Integer; - begin - for i := 0 to Count - 1 do - Dispose(GetItem(i)); - FList.Clear; - end; - - procedure TWStrings.Delete(Index: Integer); - var - P: PWStringItem; - begin - P := GetItem(Index); - FList.Delete(Index); // may raise EListError - Dispose(P); - end; - - function TWStrings.GetCount: Integer; - begin - Result := FList.Count; - end; - - function TWStrings.GetItem(Index: Integer): PWStringItem; - begin - Result := FList[Index]; - end; - - function TWStrings.GetObjects(Index: Integer): TObject; - begin - Result := GetItem(Index).FObject; - end; - - function TWStrings.GetStrings(Index: Integer): WideString; - begin - Result := GetItem(Index).FString; - end; - - procedure TWStrings.SetObjects(Index: Integer; const Value: TObject); - begin - GetItem(Index).FObject := Value; - end; - - function TWStrings.Add(const Value: WideString): Integer; - begin - Result := Count; - InsertObject(Result, Value, nil); - end; - - function TWStrings.AddObject(const Value: WideString; Data: TObject): Integer; - begin - Result := Count; - InsertObject(Result, Value, Data); - end; - - procedure TWStrings.Insert(Index: Integer; const Value: WideString); - begin - InsertObject(Index, Value, nil); - end; - - procedure TWStrings.InsertObject(Index: Integer; const Value: WideString; - Data: TObject); - var - P: PWStringItem; - begin - New(P); - P.FString := Value; - P.FObject := Data; - FList.Insert(Index, P); - end; - - function TWStrings.IndexOf(const Value: WideString): Integer; - begin - for Result := 0 to Count - 1 do - if WideCompareText(Value, GetItem(Result).FString) = 0 then - Exit; - Result := -1; - end; - - function TWStrings.GetPStrings(Index: Integer): PWideString; - begin - Result := @GetItem(Index).FString; - end; - - procedure TWStrings.SetStrings(Index: Integer; const Value: WideString); - begin - GetItem(Index).FString := Value; - end; - end. --- 1108,1111 ---- Index: JvHLEditor.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvHLEditor.pas,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** JvHLEditor.pas 25 Jan 2004 09:02:09 -0000 1.12 --- JvHLEditor.pas 26 Jan 2004 08:58:24 -0000 1.13 *************** *** 97,160 **** {$ENDIF COMPILER6_UP} SysUtils, Classes, Graphics, ! JvEditor, JvHLParser; ! ! const ! { Max_Line - maximum line numbers, scanned by editor for comments } ! Max_Line = 64 * 1024; type - THighlighter = (hlNone, hlPascal, hlCBuilder, hlSql, hlPython, hlJava, hlVB, - hlHtml, hlPerl, hlIni, hlCocoR, hlPhp, hlNQC, hlSyntaxHighlighter); - TLongTokenType = 0..255; - TJvHLEditor = class; - TJvSymbolColor = class(TPersistent) - private - FStyle: TFontStyles; - FForeColor: TColor; - FBackColor: TColor; - public - constructor Create; - procedure SetColor(const ForeColor, BackColor: TColor; const Style: TFontStyles); - procedure Assign(Source: TPersistent); override; - published - // (rom) defaults and constructor added - property Style: TFontStyles read FStyle write FStyle default []; - property ForeColor: TColor read FForeColor write FForeColor default clWindowText; - property BackColor: TColor read FBackColor write FBackColor default clWindow; - end; - - TJvColors = class(TPersistent) - private - FComment: TJvSymbolColor; - FNumber: TJvSymbolColor; - FString: TJvSymbolColor; - FSymbol: TJvSymbolColor; - FReserved: TJvSymbolColor; - FIdentifier: TJvSymbolColor; - FPreproc: TJvSymbolColor; - FFunctionCall: TJvSymbolColor; - FDeclaration: TJvSymbolColor; - FStatement: TJvSymbolColor; - FPlainText: TJvSymbolColor; - public - constructor Create; - destructor Destroy; override; - procedure Assign(Source: TPersistent); override; - published - property Comment: TJvSymbolColor read FComment write FComment; - property Number: TJvSymbolColor read FNumber write FNumber; - property Strings: TJvSymbolColor read FString write FString; - property Symbol: TJvSymbolColor read FSymbol write FSymbol; - property Reserved: TJvSymbolColor read FReserved write FReserved; - property Identifier: TJvSymbolColor read FIdentifier write FIdentifier; - property Preproc: TJvSymbolColor read FPreproc write FPreproc; - property FunctionCall: TJvSymbolColor read FFunctionCall write FFunctionCall; - property Declaration: TJvSymbolColor read FDeclaration write FDeclaration; - property Statement: TJvSymbolColor read FStatement write FStatement; - property PlainText: TJvSymbolColor read FPlainText write FPlainText; - end; - TOnReservedWord = procedure(Sender: TObject; Token: string; var Reserved: Boolean) of object; --- 97,105 ---- {$ENDIF COMPILER6_UP} SysUtils, Classes, Graphics, ! JvEditor, JvEditorCommon, JvHLParser; type TJvHLEditor = class; TOnReservedWord = procedure(Sender: TObject; Token: string; var Reserved: Boolean) of object; *************** *** 162,166 **** TJvEditorHighlighter = class(TComponent) protected ! procedure GetAttr(Editor: TJvHLEditor; Lines: Tstrings; Line, ColBeg, ColEnd: Integer; LongToken: TLongTokenType; var LineAttrs: TLineAttrs); virtual; abstract; procedure ScanLongTokens(Editor: TJvHLEditor; Lines: TStrings; Line: Integer; --- 107,111 ---- TJvEditorHighlighter = class(TComponent) protected ! procedure GetAttr(Editor: TJvHLEditor; Lines: TStrings; Line, ColBeg, ColEnd: Integer; LongToken: TLongTokenType; var LineAttrs: TLineAttrs); virtual; abstract; procedure ScanLongTokens(Editor: TJvHLEditor; Lines: TStrings; Line: Integer; *************** *** 170,177 **** end; ! TJvHLEditor = class(TJvEditor) private Parser: TJvIParser; ! FHighlighter: THighlighter; FColors: TJvColors; FLine: string; --- 115,122 ---- end; ! TJvHLEditor = class(TJvEditor, IJvHLEditor) private Parser: TJvIParser; ! FHighlighter: TJvHighlighter; FColors: TJvColors; FLine: string; *************** *** 189,195 **** procedure CheckInLong; function FindLongEnd: Integer; ! procedure SetHighlighter(Value: THighlighter); function GetDelphiColors: Boolean; procedure SetDelphiColors(Value: Boolean); protected procedure Loaded; override; --- 134,145 ---- procedure CheckInLong; function FindLongEnd: Integer; ! procedure SetHighlighter(const Value: TJvHighlighter); function GetDelphiColors: Boolean; procedure SetDelphiColors(Value: Boolean); + function GetColors: TJvColors; + procedure SetColors(const Value: TJvColors); + function GetSyntaxHighlighting: Boolean; + procedure SetSyntaxHighlighting(Value: Boolean); + function GetHighlighter: TJvHighlighter; protected procedure Loaded; override; *************** *** 206,215 **** procedure Assign(Source: TPersistent); override; published ! property Highlighter: THighlighter read FHighlighter write SetHighlighter default hlPascal; ! property Colors: TJvColors read FColors write FColors; property DelphiColors: Boolean read GetDelphiColors write SetDelphiColors stored False; property LongTokens: Boolean read FLongTokens write FLongTokens default True; property OnReservedWord: TOnReservedWord read FOnReservedWord write FOnReservedWord; ! property SyntaxHighlighting: Boolean read FSyntaxHighlighting write FSyntaxHighlighting stored False; property SyntaxHighlighter: TJvEditorHighlighter read FSyntaxHighlighter write SetSyntaxHighlighter; end; --- 156,165 ---- procedure Assign(Source: TPersistent); override; published ! property Highlighter: TJvHighlighter read GetHighlighter write SetHighlighter default hlPascal; ! property Colors: TJvColors read GetColors write SetColors; property DelphiColors: Boolean read GetDelphiColors write SetDelphiColors stored False; property LongTokens: Boolean read FLongTokens write FLongTokens default True; property OnReservedWord: TOnReservedWord read FOnReservedWord write FOnReservedWord; ! property SyntaxHighlighting: Boolean read GetSyntaxHighlighting write SetSyntaxHighlighting stored False; property SyntaxHighlighter: TJvEditorHighlighter read FSyntaxHighlighter write SetSyntaxHighlighter; end; *************** *** 221,235 **** JvJCLUtils; - const - lgNone = TLongTokenType(0); - lgComment1 = TLongTokenType(1); - lgComment2 = TLongTokenType(2); - lgString = TLongTokenType(4); - lgTag = TLongTokenType(5); - lgPreproc = TLongTokenType(6); - lgPreproc1 = lgPreproc; - lgPreproc2 = TLongTokenType(7); - lgUndefined = High(TLongTokenType); - function LastNonSpaceChar(const S: string): Char; var --- 171,174 ---- *************** *** 313,411 **** end; - //=== TJvSymbolColor ========================================================= - - constructor TJvSymbolColor.Create; - begin - inherited Create; - FStyle := []; - FForeColor := clWindowText; - FBackColor := clWindow; - end; - - procedure TJvSymbolColor.SetColor(const ForeColor, BackColor: TColor; const Style: TFontStyles); - begin - FForeColor := ForeColor; - FBackColor := BackColor; - FStyle := Style; - end; - - procedure TJvSymbolColor.Assign(Source: TPersistent); - begin - if Source is TJvSymbolColor then - begin - FForeColor := TJvSymbolColor(Source).FForeColor; - FBackColor := TJvSymbolColor(Source).FBackColor; - FStyle := TJvSymbolColor(Source).FStyle; - end - else - inherited Assign(Source); - end; - - //=== TJvColors ============================================================== - - constructor TJvColors.Create; - begin - inherited Create; - FComment := TJvSymbolColor.Create; - FNumber := TJvSymbolColor.Create; - FString := TJvSymbolColor.Create; - FSymbol := TJvSymbolColor.Create; - FReserved := TJvSymbolColor.Create; - FStatement := TJvSymbolColor.Create; - FIdentifier := TJvSymbolColor.Create; - FPreproc := TJvSymbolColor.Create; - FFunctionCall := TJvSymbolColor.Create; - FDeclaration := TJvSymbolColor.Create; - FPlainText := TJvSymbolColor.Create; - FPreproc.SetColor(clGreen, clWindow, []); - FComment.SetColor(clOlive, clWindow, [fsItalic]); - FNumber.SetColor(clNavy, clWindow, []); - FString.SetColor(clPurple, clWindow, []); - FSymbol.SetColor(clBlue, clWindow, []); - FReserved.SetColor(clWindowText, clWindow, [fsBold]); - FStatement.SetColor(clWindowText, clWindow, [fsBold]); - FIdentifier.SetColor(clWindowText, clWindow, []); - FFunctionCall.SetColor(clWindowText, clWindow, []); - FDeclaration.SetColor(clWindowText, clWindow, []); - FPlainText.SetColor(clWindowText, clWindow, []); - end; - - destructor TJvColors.Destroy; - begin - FComment.Free; - FNumber.Free; - FString.Free; - FSymbol.Free; - FReserved.Free; - FStatement.Free; - FIdentifier.Free; - FPreproc.Free; - FFunctionCall.Free; - FDeclaration.Free; - FPlainText.Free; - inherited Destroy; - end; - - procedure TJvColors.Assign(Source: TPersistent); - begin - if Source is TJvColors then - begin - FComment.Assign(TJvColors(Source).FComment); - FNumber.Assign(TJvColors(Source).FNumber); - FString.Assign(TJvColors(Source).FString); - FSymbol.Assign(TJvColors(Source).FSymbol); - FReserved.Assign(TJvColors(Source).FReserved); - FStatement.Assign(TJvColors(Source).FStatement); - FIdentifier.Assign(TJvColors(Source).FIdentifier); - FPreproc.Assign(TJvColors(Source).FPreproc); - FFunctionCall.Assign(TJvColors(Source).FFunctionCall); - FDeclaration.Assign(TJvColors(Source).FDeclaration); - FPlainText.Assign(TJvColors(Source).FPlainText); - end - else - inherited Assign(Source); - end; - - //=== TJvHLEditor ============================================================ --- 252,255 ---- *************** *** 442,446 **** end; ! procedure TJvHLEditor.SetHighlighter(Value: THighlighter); begin if FHighlighter <> Value then --- 286,290 ---- end; ! procedure TJvHLEditor.SetHighlighter(const Value: TJvHighlighter); begin if FHighlighter <> Value then *************** *** 505,509 **** ' wchar_t while '; ! NQCKeyWords: string = {Not Quite C - a C similar language for programming LEGO MindStorm(R) robots } ' __event_src __type acquire break __sensor abs asm case catch const' + ' continue default do else false for if inline' + --- 349,353 ---- ' wchar_t while '; ! NQCKeyWords = {Not Quite C - a C similar language for programming LEGO MindStorm(R) robots } ' __event_src __type acquire break __sensor abs asm case catch const' + ' continue default do else false for if inline' + *************** *** 511,515 **** ' until void while '; ! SQLKeyWords: string = ' active as add asc after ascending all at alter auto' + ' and autoddl any avg based between basename blob' + --- 355,359 ---- ' until void while '; ! SQLKeyWords = ' active as add asc after ascending all at alter auto' + ' and autoddl any avg based between basename blob' + *************** *** 1732,1738 **** if FSyntaxHighlighter <> nil then begin ! if Action = maAll then ! ACaretY := -1 // rescan all lines ! else if FSyntaxHighlighter.GetRescanLongKeys(Self, Action, ACaretX, ACaretY, Text) then begin if RescanLong(ACaretY) then --- 1576,1580 ---- if FSyntaxHighlighter <> nil then begin ! if FSyntaxHighlighter.GetRescanLongKeys(Self, Action, ACaretX, ACaretY, Text) then begin if RescanLong(ACaretY) then *************** *** 1758,1769 **** else begin ! if (Highlighter = hlPascal) and (ACaretY < Max_Line) then begin // comment <-> preproc S := Lines[ACaretY]; ! if ((ACaretX > 0) and (S[ACaretX - 1] = '{')) or ! ((ACaretX > 1) and (S[ACaretX - 2] = '(') and (S[ACaretX - 1] = '*')) or ! ((ACaretX > 0) and (S[ACaretX] = '{')) or ! ((ACaretX > 1) and (S[ACaretX - 1] = '(') and (S[ACaretX] = '*')) then begin if RescanLong(ACaretY) then --- 1600,1611 ---- else begin ! if (Highlighter = hlPascal) and (Cardinal(ACaretY) < Max_Line) then begin // comment <-> preproc S := Lines[ACaretY]; ! if ((ACaretX > 1) and (S[ACaretX - 1] = '{')) or ! ((ACaretX > 2) and (S[ACaretX - 2] = '(') and (S[ACaretX - 1] = '*')) or ! ((ACaretX > 1) and (S[ACaretX] = '{')) or ! ((ACaretX > 2) and (S[ACaretX - 1] = '(') and (S[ACaretX] = '*')) then begin if RescanLong(ACaretY) then *************** *** 1811,1844 **** procedure TJvHLEditor.Assign(Source: TPersistent); begin if Source is TJvHLEditor then begin ! Colors.Assign((Source as TJvHLEditor).Colors); ! SelForeColor := (Source as TJvHLEditor).SelForeColor; ! SelBackColor := (Source as TJvHLEditor).SelBackColor; ! Color := (Source as TJvHLEditor).Color; ! FSyntaxHighlighter := (Source as TJvHLEditor).SyntaxHighlighter; ! RightMarginColor := (Source as TJvHLEditor).RightMarginColor; Invalidate; - end - else - inherited Assign(Source); - end; - - - type - TDelphiColor = record - ForeColor, BackColor: TColor; - Style: TFontStyles; end; ! ! const ! DelphiColor_Comment: TDelphiColor = (ForeColor: clNavy; BackColor: clWindow; Style: [fsItalic]); ! DelphiColor_Preproc: TDelphiColor = (ForeColor: clGreen; BackColor: clWindow; Style: []); ! DelphiColor_Number: TDelphiColor = (ForeColor: clNavy; BackColor: clWindow; Style: []); ! DelphiColor_Strings: TDelphiColor = (ForeColor: clBlue; BackColor: clWindow; Style: []); ! DelphiColor_Symbol: TDelphiColor = (ForeColor: clBlack; BackColor: clWindow; Style: []); ! DelphiColor_Reserved: TDelphiColor = (ForeColor: clBlack; BackColor: clWindow; Style: [fsBold]); ! DelphiColor_Identifier: TDelphiColor = (ForeColor: clBlack; BackColor: clWindow; Style: []); ! DelphiColor_PlainText: TDelphiColor = (ForeColor: clWindowText; BackColor: clWindow; Style: []); function TJvHLEditor.GetDelphiColors: Boolean; --- 1653,1669 ---- procedure TJvHLEditor.Assign(Source: TPersistent); begin + inherited Assign(Source); if Source is TJvHLEditor then begin ! FHighlighter := TJvHLEditor(Source).Highlighter; ! Colors.Assign(TJvHLEditor(Source).Colors); ! SelForeColor := TJvHLEditor(Source).SelForeColor; ! SelBackColor := TJvHLEditor(Source).SelBackColor; ! Color := TJvHLEditor(Source).Color; ! FSyntaxHighlighting := TJvHLEditor(Source).SyntaxHighlighting; ! RightMarginColor := TJvHLEditor(Source).RightMarginColor; Invalidate; end; ! end; function TJvHLEditor.GetDelphiColors: Boolean; *************** *** 1898,1901 **** --- 1723,1752 ---- end; + function TJvHLEditor.GetColors: TJvColors; + begin + Result := FColors; + end; + + procedure TJvHLEditor.SetColors(const Value: TJvColors); + begin + FColors.Assign(Value); + end; + + function TJvHLEditor.GetSyntaxHighlighting: Boolean; + begin + Result := FSyntaxHighlighting; + end; + + procedure TJvHLEditor.SetSyntaxHighlighting(Value: Boolean); + begin + FSyntaxHighlighting := Value; + Invalidate; + end; + + function TJvHLEditor.GetHighlighter: TJvHighlighter; + begin + Result := FHighlighter; + end; + end. Index: JvJCLUtils.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvJCLUtils.pas,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** JvJCLUtils.pas 25 Jan 2004 21:41:24 -0000 1.61 --- JvJCLUtils.pas 26 Jan 2004 08:58:24 -0000 1.62 *************** *** 118,125 **** --- 118,141 ---- function GetWordOnPos(const S: string; const P: Integer): string; function GetWordOnPosW(const S: WideString; const P: Integer): WideString; + function GetWordOnPos2(const S: string; P: Integer; var iBeg, iEnd: Integer): string; + function GetWordOnPos2W(const S: WideString; P: Integer; var iBeg, iEnd: Integer): WideString; { GetWordOnPosEx working like GetWordOnPos function, but also returns Word position in iBeg, iEnd variables } function GetWordOnPosEx(const S: string; const P: Integer; var iBeg, iEnd: Integer): string; function GetWordOnPosExW(const S: WideString; const P: Integer; var iBeg, iEnd: Integer): WideString; + function GetNextWordPosEx(const Text: string; StartIndex: Integer; + var iBeg, iEnd: Integer): string; + function GetNextWordPosExW(const Text: WideString; StartIndex: Integer; + var iBeg, iEnd: Integer): WideString; + procedure GetEndPosCaret(const Text: string; CaretX, CaretY: Integer; + var X, Y: Integer); + { GetEndPosCaret returns the caret position of the last char. For the position + after the last char of Text you must add 1 to the returned X value. } + procedure GetEndPosCaretW(const Text: WideString; CaretX, CaretY: Integer; + var X, Y: Integer); + { GetEndPosCaret returns the caret position of the last char. For the position + after the last char of Text you must add 1 to the returned X value. } + + { SubStr returns substring from string, S, separated with Separator string} function SubStr(const S: string; const Index: Integer; const Separator: string): string; *************** *** 1147,1150 **** --- 1163,1219 ---- end; + function GetWordOnPos2(const S: string; P: Integer; var iBeg, iEnd: Integer): string; + begin + Result := ''; + if P < 1 then + Exit; + if (S[P] in Separators) and ((P < 1) or (S[P - 1] in Separators)) then + Inc(P); + iBeg := P; + while iBeg >= 1 do + if (S[iBeg] in Separators) then + Break + else + Dec(iBeg); + Inc(iBeg); + iEnd := P; + while iEnd <= Length(S) do + if (S[iEnd] in Separators) then + Break + else + Inc(iEnd); + if iEnd > iBeg then + Result := Copy(S, iBeg, iEnd - iBeg) + else + Result := S[P]; + end; + + function GetWordOnPos2W(const S: WideString; P: Integer; var iBeg, iEnd: Integer): WideString; + begin + Result := ''; + if P < 1 then + Exit; + if (CharInSetW(S[P], Separators)) and + ((P < 1) or (CharInSetW(S[P - 1], Separators))) then + Inc(P); + iBeg := P; + while iBeg >= 1 do + if CharInSetW(S[iBeg],Separators) then + Break + else + Dec(iBeg); + Inc(iBeg); + iEnd := P; + while iEnd <= Length(S) do + if CharInSetW(S[iEnd], Separators) then + Break + else + Inc(iEnd); + if iEnd > iBeg then + Result := Copy(S, iBeg, iEnd - iBeg) + else + Result := S[P]; + end; + function GetWordOnPosEx(const S: string; const P: Integer; var iBeg, iEnd: Integer): string; begin *************** *** 1209,1212 **** --- 1278,1381 ---- end; + function GetNextWordPosEx(const Text: string; StartIndex: Integer; + var iBeg, iEnd: Integer): string; + var + Len: Integer; + begin + Len := Length(Text); + Result := ''; + if (StartIndex < 1) or (StartIndex > Len) then + Exit; + if (Text[StartIndex] in Separators) and + ((StartIndex < 1) or (Text[StartIndex - 1] in Separators)) then + Inc(StartIndex); + iBeg := StartIndex; + while iBeg >= 1 do + if (Text[iBeg] in Separators) then + Break + else + Dec(iBeg); + Inc(iBeg); + iEnd := StartIndex; + while iEnd <= Len do + if (Text[iEnd] in Separators) then + Break + else + Inc(iEnd); + Dec(iEnd); + if iEnd >= iBeg then + Result := Copy(Text, iBeg, iEnd - iBeg) + else + Result := Text[StartIndex]; + + // go right + iEnd := iBeg; + while (iEnd <= Len) and (not (Text[iEnd] in Separators)) do Inc(iEnd); + if iEnd > Len then iEnd := Len else Dec(iEnd); + Result := Copy(Text, iBeg, iEnd - iBeg + 1); + end; + + function GetNextWordPosExW(const Text: WideString; StartIndex: Integer; + var iBeg, iEnd: Integer): WideString; + var + Len: Integer; + begin + Len := Length(Text); + Result := ''; + if (StartIndex < 1) or (StartIndex > Len) then + Exit; + if CharInSetW(Text[StartIndex], Separators) and + ((StartIndex < 1) or CharInSetW(Text[StartIndex - 1], Separators)) then + Inc(StartIndex); + iBeg := StartIndex; + while iBeg >= 1 do + if CharInSetW(Text[iBeg], Separators) then + Break + else + Dec(iBeg); + Inc(iBeg); + iEnd := StartIndex; + while iEnd <= Len do + if CharInSetW(Text[iEnd], Separators) then + Break + else + Inc(iEnd); + Dec(iEnd); + if iEnd >= iBeg then + Result := Copy(Text, iBeg, iEnd - iBeg) + else + Result := Text[StartIndex]; + + // go right + iEnd := iBeg; + while (iEnd <= Len) and (not CharInSetW(Text[iEnd], Separators)) do Inc(iEnd); + if iEnd > Len then iEnd := Len else Dec(iEnd); + Result := Copy(Text, iBeg, iEnd - iBeg + 1); + end; + + procedure GetEndPosCaret(const Text: string; CaretX, CaretY: Integer; + var X, Y: Integer); + begin + GetXYByPos(Text, Length(Text), X, Y); + if Y = 0 then + Inc(X, CaretX) + else + Inc(X); + Dec(X); + Inc(Y, CaretY); + end; + + procedure GetEndPosCaretW(const Text: WideString; CaretX, CaretY: Integer; + var X, Y: Integer); + begin + GetXYByPosW(Text, Length(Text), X, Y); + if Y = 0 then + Inc(X, CaretX) + else + Inc(X); + Dec(X); + Inc(Y, CaretY); + end; + { (rb) This function seems to translate a number to a russian string, but is half translated (only const part), need to roll back to an all russian Index: JvEditor.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvEditor.pas,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** JvEditor.pas 25 Jan 2004 09:02:07 -0000 1.41 --- JvEditor.pas 26 Jan 2004 08:58:24 -0000 1.42 *************** *** 27,31 **** component : TJvEditor ! description : 'Delphi IDE'-like Editor (unicode) Known Issues: --- 27,31 ---- component : TJvEditor ! description : 'Delphi IDE'-like Editor (ansi) [...8091 lines suppressed...] ! procedure TJvCompletion.ReplaceWordItemIndex(SubStrStart: Integer); begin ! ReplaceWord(SubStr(Items[ItemIndex], SubStrStart, FSeparator)); end; ! function TJvCustomEditor.GetCompletion: TJvCompletion; begin ! Result := TJvCompletion(inherited Completion); end; ! procedure TJvCustomEditor.SetCompletion(const Value: TJvCompletion); begin ! inherited Completion := Value; end; ! function TJvCompletion.GetAnsiSeparator: AnsiString; begin ! Result := FSeparator; end; |