diff --git a/components/jcf2/CommandLine/Lazarus/jcf.lpi b/components/jcf2/CommandLine/Lazarus/jcf.lpi
index 7dbf983577..06de69296e 100644
--- a/components/jcf2/CommandLine/Lazarus/jcf.lpi
+++ b/components/jcf2/CommandLine/Lazarus/jcf.lpi
@@ -75,7 +75,7 @@
-
+
@@ -560,14 +560,10 @@
-
-
-
-
-
+
diff --git a/components/jcf2/CommandLine/Lazarus/jcf.lpr b/components/jcf2/CommandLine/Lazarus/jcf.lpr
index dd22c24b3a..30a47953d1 100644
--- a/components/jcf2/CommandLine/Lazarus/jcf.lpr
+++ b/components/jcf2/CommandLine/Lazarus/jcf.lpr
@@ -29,7 +29,6 @@ See http://www.gnu.org/licenses/gpl.html
uses
SysUtils,
JcfStringUtils in '..\..\Utils\JcfStringUtils.pas',
- JcfSystemUtils in '..\..\Utils\JcfSystemUtils.pas',
Converter in '..\..\ReadWrite\Converter.pas',
FileConverter in '..\..\ReadWrite\FileConverter.pas',
ConvertTypes in '..\..\ReadWrite\ConvertTypes.pas',
diff --git a/components/jcf2/IdePlugin/lazarus/jcfidelazarus.lpk b/components/jcf2/IdePlugin/lazarus/jcfidelazarus.lpk
index 51a17a8514..0ddabbe72e 100644
--- a/components/jcf2/IdePlugin/lazarus/jcfidelazarus.lpk
+++ b/components/jcf2/IdePlugin/lazarus/jcfidelazarus.lpk
@@ -491,10 +491,6 @@
- -
-
-
-
-
@@ -727,10 +723,6 @@
- -
-
-
-
-
diff --git a/components/jcf2/IdePlugin/lazarus/jcfidelazarus.pas b/components/jcf2/IdePlugin/lazarus/jcfidelazarus.pas
index 0362463c45..871087a0fc 100644
--- a/components/jcf2/IdePlugin/lazarus/jcfidelazarus.pas
+++ b/components/jcf2/IdePlugin/lazarus/jcfidelazarus.pas
@@ -34,14 +34,14 @@ uses
SetClarify, SetComments, SetIndent, SetObfuscate, SetPreProcessor,
SetReplace, SetReturns, SetSpaces, SettingsTypes, SetTransform, SetUses,
SetWordList, SettingsStream, fJcfErrorDisplay, Delay, IntList,
- JcfFontSetFunctions, JcfHelp, JcfLog, JcfMiscFunctions, fAbout,
+ JcfHelp, JcfLog, JcfMiscFunctions, fAbout,
JcfVersionConsts, frFiles, frObfuscateSettings, frClarify, frClarifySpaces,
frClarifyIndent, frBlankLines, frClarifyAlign, frClarifyLongLineBreaker,
frClarifyReturns, frCompilerDirectReturns, frClarifyBlocks,
frClarifyCaseBlocks, frComments, frWarnings, frReservedCapsSettings,
frAnyCapsSettings, frIdentifierCapsSettings, frNotIdentifierCapsSettings,
frUnitCaps, frReplace, frUses, frTransform, frAsm, frPreProcessor,
- JcfUIConsts, Diff, diffmerge, JcfStringUtils, JcfSystemUtils,
+ JcfUIConsts, Diff, diffmerge, JcfStringUtils,
JcfUnicodeFiles, JcfUiTools, LazarusPackageIntf;
implementation
diff --git a/components/jcf2/Parse/BuildTokenList.pas b/components/jcf2/Parse/BuildTokenList.pas
index 9eab8b6de8..8d5f2b0fce 100644
--- a/components/jcf2/Parse/BuildTokenList.pas
+++ b/components/jcf2/Parse/BuildTokenList.pas
@@ -110,8 +110,7 @@ implementation
uses
{ local }
- JcfStringUtils, JcfSystemUtils,
- JcfRegistrySettings, ParseError;
+ JcfStringUtils, JcfRegistrySettings, ParseError;
const
CurlyLeft = '{'; //widechar(123);
@@ -120,8 +119,8 @@ const
function CheckMultiByte(const pcChar: char): boolean;
begin
Result := False;
- if GetRegSettings.CheckMultiByteChars then
- Result := IsMultiByte(pcChar);
+// if GetRegSettings.CheckMultiByteChars then
+// Result := IsMultiByte(pcChar); //IsMultiByte(pcChar)-->Result := IsDBCSLeadByte(Byte(pcChar));
end;
function CharIsOctDigit(const c: Char): Boolean;
diff --git a/components/jcf2/Parse/UI/fShowParseTree.lfm b/components/jcf2/Parse/UI/fShowParseTree.lfm
index f608bfea07..a5230d2f7e 100644
--- a/components/jcf2/Parse/UI/fShowParseTree.lfm
+++ b/components/jcf2/Parse/UI/fShowParseTree.lfm
@@ -9,15 +9,14 @@ object frmShowParseTree: TfrmShowParseTree
ClientHeight = 555
ClientWidth = 581
KeyPreview = True
- OnCreate = FormCreate
OnKeyUp = FormKeyUp
OnShow = FormShow
Position = poScreenCenter
- LCLVersion = '1.9.0.0'
+ LCLVersion = '2.3.0.0'
object StatusBar1: TStatusBar
Left = 0
- Height = 21
- Top = 534
+ Height = 23
+ Top = 532
Width = 581
Panels = <>
end
@@ -35,25 +34,27 @@ object frmShowParseTree: TfrmShowParseTree
TabOrder = 1
object lblTreeCount: TLabel
Left = 11
- Height = 17
+ Height = 15
Top = 31
- Width = 110
+ Width = 87
Caption = 'Tree has ? nodes'
+ Color = clDefault
ParentColor = False
end
object lblTreeDepth: TLabel
Left = 11
- Height = 17
+ Height = 15
Top = 55
- Width = 165
+ Width = 130
Caption = 'Tree has max depth of ??'
+ Color = clDefault
ParentColor = False
end
object cbShowWhiteSpace: TCheckBox
Left = 11
- Height = 24
+ Height = 19
Top = 5
- Width = 145
+ Width = 109
Caption = 'Show whitespace'
OnClick = cbShowWhiteSpaceClick
TabOrder = 0
@@ -62,7 +63,7 @@ object frmShowParseTree: TfrmShowParseTree
object pnlBottom: TPanel
Left = 0
Height = 50
- Top = 484
+ Top = 482
Width = 581
Align = alBottom
BevelOuter = bvNone
@@ -71,40 +72,44 @@ object frmShowParseTree: TfrmShowParseTree
TabOrder = 2
object lblCurrent: TLabel
Left = 11
- Height = 17
+ Height = 15
Top = 2
- Width = 57
+ Width = 43
Caption = 'Current:'
+ Color = clDefault
ParentColor = False
end
object lblDepth: TLabel
Left = 11
- Height = 17
+ Height = 15
Top = 26
- Width = 47
+ Width = 35
Caption = 'Depth:'
+ Color = clDefault
ParentColor = False
end
object lblTotalNodeCount: TLabel
Left = 271
- Height = 17
+ Height = 15
Top = 26
- Width = 119
+ Width = 94
Caption = 'Total node count:'
+ Color = clDefault
ParentColor = False
end
object lblImmediateChildCount: TLabel
Left = 271
- Height = 17
+ Height = 15
Top = 2
- Width = 156
+ Width = 123
Caption = 'Immediate child count:'
+ Color = clDefault
ParentColor = False
end
end
object pcPages: TPageControl
Left = 6
- Height = 387
+ Height = 385
Top = 91
Width = 569
ActivePage = tsTokens
@@ -114,13 +119,13 @@ object frmShowParseTree: TfrmShowParseTree
TabOrder = 3
object tsTokens: TTabSheet
Caption = 'Tokens'
- ClientHeight = 356
- ClientWidth = 565
+ ClientHeight = 357
+ ClientWidth = 561
object lvTokens: TListView
Left = 0
- Height = 356
+ Height = 357
Top = 0
- Width = 565
+ Width = 561
Align = alClient
Columns = <
item
@@ -146,14 +151,14 @@ object frmShowParseTree: TfrmShowParseTree
end
object tsTree: TTabSheet
Caption = 'Tree'
- ClientHeight = 356
- ClientWidth = 565
+ ClientHeight = 357
+ ClientWidth = 561
ImageIndex = 1
object tvParseTree: TTreeView
Left = 0
- Height = 363
+ Height = 357
Top = 0
- Width = 577
+ Width = 561
Align = alClient
HideSelection = False
Indent = 22
diff --git a/components/jcf2/Parse/UI/fShowParseTree.pas b/components/jcf2/Parse/UI/fShowParseTree.pas
index 1543739278..a11e5b33d3 100644
--- a/components/jcf2/Parse/UI/fShowParseTree.pas
+++ b/components/jcf2/Parse/UI/fShowParseTree.pas
@@ -68,7 +68,6 @@ type
procedure lvTokensDblClick(Sender: TObject);
procedure tvParseTreeDblClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: word; {%H-}Shift: TShiftState);
- procedure FormCreate(Sender: TObject);
private
fcRootNode: TParseTreeNode;
procedure ShowTreeNodeDetails(const pcNode: TParseTreeNode);
@@ -86,7 +85,7 @@ implementation
{$R *.lfm}
uses
- SourceToken, Tokens, JcfHelp, JcfFontSetFunctions;
+ SourceToken, Tokens, JcfHelp;
procedure ShowParseTree(const pcRoot: TParseTreeNode);
var
@@ -302,11 +301,6 @@ begin
end;
end;
-procedure TfrmShowParseTree.FormCreate(Sender: TObject);
-begin
- SetObjectFontToSystemFont(Self);
-end;
-
procedure TfrmShowParseTree.FormKeyUp(Sender: TObject; var Key: word;
Shift: TShiftState);
begin
diff --git a/components/jcf2/Settings/JcfRegistrySettings.pas b/components/jcf2/Settings/JcfRegistrySettings.pas
index 4ad8e0f3f2..18fad8043a 100644
--- a/components/jcf2/Settings/JcfRegistrySettings.pas
+++ b/components/jcf2/Settings/JcfRegistrySettings.pas
@@ -190,7 +190,7 @@ implementation
uses
{ jcf }
- JcfStringUtils, JcfSystemUtils, JcfMiscFunctions, JcfUiTools
+ JcfStringUtils, JcfMiscFunctions, JcfUiTools
{$ifndef COMMAND_LINE}
,lclintf //< OpenDocument
{$endif}
@@ -505,7 +505,7 @@ function TJCFRegistrySettings.LogDirectory: string;
begin
case feLogPlace of
eLogTempDir:
- Result := GetWindowsTempFolder;
+ Result := GetTempDir;
eLogAppDir:
Result := ExtractFileDir(ParamStr(0));
eLogSpecifiedDir:
diff --git a/components/jcf2/TestApplication/JcfSettings.pas b/components/jcf2/TestApplication/JcfSettings.pas
deleted file mode 100644
index 6bcc359fa3..0000000000
--- a/components/jcf2/TestApplication/JcfSettings.pas
+++ /dev/null
@@ -1,536 +0,0 @@
-{(*}
-(*------------------------------------------------------------------------------
- Delphi Code formatter source code
-
-The Original Code is Settings.pas, released April 2000.
-The Initial Developer of the Original Code is Anthony Steele.
-Portions created by Anthony Steele are Copyright (C) 1999-2008 Anthony Steele.
-All Rights Reserved.
-Contributor(s): Anthony Steele.
-
-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/NPL/
-
-Software distributed under the License is distributed on an "AS IS" basis,
-WITHOUT WARRANTY OF ANY KIND, either express or implied.
-See the License for the specific language governing rights and limitations
-under the License.
-
-Alternatively, the contents of this file may be used under the terms of
-the GNU General Public License Version 2 or later (the "GPL")
-See http://www.gnu.org/licenses/gpl.html
-------------------------------------------------------------------------------*)
-{*)}
-
-unit JcfSettings;
-
-{ this is the settings on how to parse. As of 2.0 this is always from a file
- The file name is stored in registry
- This allows centralised settings on a shared dir }
-
-{$I JcfGlobal.inc}
-
-interface
-
-uses
- { local }
- SetObfuscate, SetClarify,
- SetIndent, SetSpaces, SetReturns,
- SetComments, SetCaps, SetWordList,
- SetAlign, SetReplace, SetUses, SetPreProcessor,
- SettingsStream, SetTransform, SetAsm,
- JcfVersionConsts; //, IDEOptionsIntf;
-
-type
-
- { TFormatSettings }
-
- //TFormatSettings = class(TAbstractIDEEnvironmentOptions)
- TFormatSettings = class(TObject)
- private
- fcObfuscate: TSetObfuscate;
- fcClarify: TSetClarify;
- fcSpaces: TSetSpaces;
- fcIndent: TSetIndent;
- fcReturns: TSetReturns;
- fcComments: TSetComments;
-
- fcCaps: TSetCaps;
- fcSpecificWordCaps: TSetWordList;
- fcIdentifierCaps: TSetWordList;
- fcNotIdentifierCaps: TSetWordList;
- fcUnitNameCaps: TSetWordList;
-
- fcSetAsm: TSetAsm;
-
- fcPreProcessor: TSetPreProcessor;
- fcAlign: TSetAlign;
- fcUses: TSetUses;
-
- fcReplace: TSetReplace;
-
- fcTransform: TSetTransform;
-
- fbWriteOnExit: boolean;
- fbHasRead: boolean;
- fbDirty: boolean;
-
- fsDescription: string;
- fdtWriteDateTime: TDateTime;
- fsWriteVersion: string;
-
- procedure FromStream(const pcStream: TSettingsInput);
- public
- constructor Create(const pbReadRegFile: boolean);
- destructor Destroy; override;
- //class function GetGroupCaption: String; override;
- //class function GetInstance: TAbstractIDEOptions; override;
- //procedure DoAfterWrite({%H-}Restore: boolean); override;
-
- procedure Read;
- procedure ReadFromFile(const psFileName: string; const pbMustExist: boolean);
- procedure ReadDefaults;
- procedure Write;
-
- procedure MakeConsistent;
-
- procedure ToStream(const pcStream: TSettingsOutput);
-
- property Description: string Read fsDescription Write fsDescription;
- property WriteDateTime: TDateTime Read fdtWriteDateTime Write fdtWriteDateTime;
- property WriteVersion: string Read fsWriteVersion Write fsWriteVersion;
-
- property Obfuscate: TSetObfuscate Read fcObfuscate;
- property Clarify: TSetClarify Read fcClarify;
- property Indent: TSetIndent Read fcIndent;
- property Spaces: TSetSpaces Read fcSpaces;
- property Returns: TSetReturns Read fcReturns;
- property Comments: TSetComments Read fcComments;
-
- property Caps: TSetCaps Read fcCaps;
- property SpecificWordCaps: TSetWordList Read fcSpecificWordCaps;
- property IdentifierCaps: TSetWordList Read fcIdentifierCaps;
- property NotIdentifierCaps: TSetWordList Read fcNotIdentifierCaps;
- property UnitNameCaps: TSetWordList Read fcUnitNameCaps;
- property SetAsm: TSetAsm Read fcSetAsm;
-
- property PreProcessor: TSetPreProcessor Read fcPreProcessor;
-
-
- property Align: TSetAlign Read fcAlign;
- property Replace: TSetReplace Read fcReplace;
- property UsesClause: TSetUses Read fcUses;
-
- property Transform: TSetTransform read fcTransform;
-
- property WriteOnExit: boolean Read fbWriteOnExit Write fbWriteOnExit;
- property Dirty: boolean Read fbDirty Write fbDirty;
- property HasRead: boolean read fbHasRead write fbHasRead;
- end;
-
-function FormattingSettings: TFormatSettings;
-
-// create from a settings file
-function FormatSettingsFromFile(const psFileName: string): TFormatSettings;
-
-var
- JCFOptionsGroup: Integer;
-const
- JCFOptionFormatFile = 1;
- JCFOptionObfuscate = 2;
- JCFOptionClarify = 3;
- JCFOptionSpaces = 4;
- JCFOptionIndentation = 5;
- JCFOptionBlankLines = 6;
- JCFOptionAlign = 7;
- JCFOptionLongLines = 8;
- JCFOptionReturns = 9;
- JCFOptionCaseBlocks = 10;
- JCFOptionBlocks = 11;
- JCFOptionCompilerDirectives = 12;
- JCFOptionComments = 13;
- JCFOptionWarnings = 14;
- JCFOptionObjectPascal = 15;
- JCFOptionAnyWord = 16;
- JCFOptionIdentifiers = 17;
- JCFOptionNotIdentifiers = 18;
- JCFOptionUnitName = 19;
- JCFOptionFindAndReplace = 20;
- JCFOptionUses = 21;
- JCFOptionBasic = 22;
- JCFOptionTransform = 23;
- JCFOptionAsm = 24;
- JCFOptionPreProcessor = 25;
-
-const
- GUI_PAD = 3;
-
-implementation
-
-uses
- { delphi }
- {$IFNDEF FPC}Windows,{$ELSE}LazFileUtils, LazUTF8,{$ENDIF} SysUtils, Dialogs,
- { local }
- JcfStringUtils,
- JcfSetBase,
- JcfRegistrySettings,
- jcfuiconsts in '../IdePlugin/lazarus/jcfuiconsts.pas';
-
-
-constructor TFormatSettings.Create(const pbReadRegFile: boolean);
-begin
- inherited Create();
-
- fcObfuscate := TSetObfuscate.Create;
- fcClarify := TSetClarify.Create;
- fcIndent := TSetIndent.Create;
- fcSpaces := TSetSpaces.Create;
- fcReturns := TSetReturns.Create;
-
- fcComments := TSetComments.Create;
-
- fcCaps := TSetCaps.Create;
- fcSpecificWordCaps := TSetWordList.Create('SpecificWordCaps');
- fcIdentifierCaps := TSetWordList.Create('Identifiers');
- fcNotIdentifierCaps := TSetWordList.Create('NotIdent');
- fcUnitNameCaps := TSetWordList.Create('UnitNameCaps');
-
- fcSetAsm := TSetAsm.Create();
-
- fcPreProcessor := TSetPreProcessor.Create;
-
- fcAlign := TSetAlign.Create;
- fcReplace := TSetReplace.Create;
- fcUses := TSetUses.Create;
- fcTransform := TSetTransform.Create;
-
- if pbReadRegFile then
- begin
- Read;
- end;
-
- fbWriteOnExit := True;
- fbDirty := False;
-end;
-
-destructor TFormatSettings.Destroy;
-begin
- if WriteOnExit then
- Write;
-
- FreeAndNil(fcObfuscate);
- FreeAndNil(fcClarify);
- FreeAndNil(fcIndent);
- FreeAndNil(fcSpaces);
- FreeAndNil(fcReturns);
- FreeAndNil(fcComments);
-
- FreeAndNil(fcCaps);
- FreeAndNil(fcSpecificWordCaps);
- FreeAndNil(fcIdentifierCaps);
- FreeAndNil(fcNotIdentifierCaps);
- FreeAndNil(fcUnitNameCaps);
- FreeAndNil(fcSetAsm);
-
- FreeAndNil(fcPreProcessor);
-
- FreeAndNil(fcReplace);
- FreeAndNil(fcAlign);
- FreeAndNil(fcUses);
- FreeAndNil(fcTransform);
-
- inherited;
-end;
-
-//class function TFormatSettings.GetGroupCaption: String;
-//begin
-// Result := lisJCFFormatSettings;
-//end;
-//
-//class function TFormatSettings.GetInstance: TAbstractIDEOptions;
-//begin
-// Result := FormatSettings;
-//end;
-//
-//procedure TFormatSettings.DoAfterWrite(Restore: boolean);
-//begin
-// { settings are now in need of saving }
-// Dirty := True;
-// { check consistency of settings }
-// MakeConsistent;
-// { save to file }
-// Write;
-//end;
-
-const
- CODEFORMAT_SETTINGS_SECTION = 'JediCodeFormatSettings';
-
- REG_VERSION = 'WriteVersion';
- REG_WRITE_DATETIME = 'WriteDateTime';
- REG_DESCRIPTION = 'Description';
-
-procedure TFormatSettings.Read;
-var
- lcReg: TJCFRegistrySettings;
-begin
- // use the Settings File if it exists
- lcReg := GetRegSettings;
- ReadFromFile(lcReg.FormatConfigFileName, lcReg.FormatConfigNameSpecified);
-end;
-
-procedure TFormatSettings.ReadFromFile(const psFileName: string; const pbMustExist: boolean);
-var
- lsText: string;
- lcFile: TSettingsInputString;
-begin
- if {$ifdef FPC}FileExistsUTF8(psFileName){$else}FileExists(psFileName){$endif} then
- begin
- // debug ShowMessage('Reading settings from file ' + lsSettingsFileName);
-
- // now we know the file exists - try get settings from it
- {$ifdef FPC}
- lsText := string(FileToString(UTF8ToSys(psFileName)));
- {$else}
- lsText := string(FileToString(psFileName));
- {$endif}
- lcFile := TSettingsInputString.Create(lsText);
- try
- FromStream(lcFile);
- finally
- lcFile.Free;
- end;
- end
- else
- begin
- if pbMustExist then
- begin
- //MessageDlg(Format(lisTheSettingsFileDoesNotExist, [psFileName, NativeLineBreak]), mtError, [mbOK], 0);
- writeln(Format(lisTheSettingsFileDoesNotExist, [psFileName, NativeLineBreak]));
- end;
- end;
-end;
-
-
-procedure TFormatSettings.ReadDefaults;
-var
- lcSetDummy: TSettingsInputDummy;
-begin
- lcSetDummy := TSettingsInputDummy.Create;
- try
- FromStream(lcSetDummy);
- finally
- lcSetDummy.Free;
- end;
-end;
-
-procedure TFormatSettings.Write;
-var
- lcReg: TJCFRegistrySettings;
- lcFile: TSettingsStreamOutput;
-begin
- if not Dirty then
- exit;
-
- { user may have specified no-write }
- lcReg := GetRegSettings;
- if lcReg.FormatFileWriteOption = eNeverWrite then
- exit;
-
- if lcReg.FormatConfigFileName = '' then
- exit;
-
- {$ifdef FPC}
- if FileExistsUTF8(lcReg.FormatConfigFileName) and FileIsReadOnlyUTF8(lcReg.FormatConfigFileName) then
- {$else}
- if FileExists(lcReg.FormatConfigFileName) and FileIsReadOnly(lcReg.FormatConfigFileName) then
- {$endif}
- begin
- { fail quietly? }
- if lcReg.FormatFileWriteOption = eAlwaysWrite then
- //MessageDlg(Format(lisErrorWritingSettingsFileReadOnly, [lcReg.FormatConfigFileName]), mtError, [mbOK], 0);
- writeln(Format(lisErrorWritingSettingsFileReadOnly, [lcReg.FormatConfigFileName]));
- exit;
- end;
-
- try
- // use the Settings file name
- {$ifdef FPC}
- lcFile := TSettingsStreamOutput.Create(UTF8ToSys(GetRegSettings.FormatConfigFileName));
- {$else}
- lcFile := TSettingsStreamOutput.Create(GetRegSettings.FormatConfigFileName);
- {$endif}
- try
- ToStream(lcFile);
-
- // not dirty any more
- fbDirty := False;
- finally
- lcFile.Free;
- end;
- except
- on e: Exception do
- begin
- if lcReg.FormatFileWriteOption = eAlwaysWrite then
- begin
- //MessageDlg(Format(lisErrorWritingSettingsException, [GetRegSettings.FormatConfigFileName, NativeLineBreak, E.Message]), mtError, [mbOK], 0);
- writeln(Format(lisErrorWritingSettingsException, [GetRegSettings.FormatConfigFileName, NativeLineBreak, E.Message]));
- end;
- end;
- end;
-end;
-
-
-procedure TFormatSettings.ToStream(const pcStream: TSettingsOutput);
-
- procedure WriteToStream(const pcSet: TSetBase);
- begin
- Assert(pcSet <> nil);
- pcStream.OpenSection(pcSet.Section);
- pcSet.WriteToStream(pcStream);
- pcStream.CloseSection(pcSet.Section);
- end;
-
-begin
- Assert(pcStream <> nil);
- pcStream.WriteXMLHeader;
-
- pcStream.OpenSection(CODEFORMAT_SETTINGS_SECTION);
-
- pcStream.Write(REG_VERSION, PROGRAM_VERSION);
- pcStream.Write(REG_WRITE_DATETIME, Now);
- pcStream.Write(REG_DESCRIPTION, Description);
-
- WriteToStream(fcObfuscate);
- WriteToStream(fcClarify);
- WriteToStream(fcIndent);
- WriteToStream(fcSpaces);
- WriteToStream(fcReturns);
- WriteToStream(fcComments);
-
- WriteToStream(fcCaps);
- WriteToStream(fcSpecificWordCaps);
- WriteToStream(fcIdentifierCaps);
- WriteToStream(fcNotIdentifierCaps);
- WriteToStream(fcUnitNameCaps);
- WriteToStream(fcSetAsm);
-
- WriteToStream(fcPreProcessor);
- WriteToStream(fcAlign);
- WriteToStream(fcReplace);
- WriteToStream(fcUses);
- WriteToStream(fcTransform);
-
- pcStream.CloseSection(CODEFORMAT_SETTINGS_SECTION);
-end;
-
-procedure TFormatSettings.FromStream(const pcStream: TSettingsInput);
-var
- lcAllSettings: TSettingsInput;
-
- procedure ReadFromStream(const pcSet: TSetBase);
- var
- lcSection: TSettingsInput;
- begin
- Assert(pcSet <> nil);
-
- lcSection := lcAllSettings.ExtractSection(pcSet.Section);
- if lcSection <> nil then
- begin
- pcSet.ReadFromStream(lcSection);
- lcSection.Free;
- end
- else
- begin
- lcSection := TSettingsInputDummy.Create;
- try
- pcSet.ReadFromStream(lcSection);
- finally
- lcSection.Free;
- end;
- //ShowMessage('Skipping section ' + pcSet.Section + ' as it was not found');
- end;
- end;
-
-begin
-
- { basic test - we are only interested in the
- ... part of the file
- If this start & end is not present, then is is the wrong file }
- lcAllSettings := pcStream.ExtractSection(CODEFORMAT_SETTINGS_SECTION);
- if lcAllSettings = nil then
- begin
- //ShowMessage(lisNoSettingsFound);
- writeln(lisNoSettingsFound);
- exit;
- end;
-
- try
- fsWriteVersion := pcStream.Read(REG_VERSION, '');
- fsDescription := pcStream.Read(REG_DESCRIPTION, '');
- fdtWriteDateTime := pcStream.Read(REG_WRITE_DATETIME, 0.0);
-
- ReadFromStream(fcObfuscate);
- ReadFromStream(fcClarify);
- ReadFromStream(fcIndent);
- ReadFromStream(fcSpaces);
- ReadFromStream(fcReturns);
- ReadFromStream(fcComments);
- ReadFromStream(fcCaps);
- ReadFromStream(fcSpecificWordCaps);
- ReadFromStream(fcIdentifierCaps);
- ReadFromStream(fcNotIdentifierCaps);
- ReadFromStream(fcUnitNameCaps);
- ReadFromStream(fcSetAsm);
-
- ReadFromStream(fcPreProcessor);
-
- ReadFromStream(fcAlign);
- ReadFromStream(fcReplace);
- ReadFromStream(fcUses);
- ReadFromStream(fcTransform);
-
- fbHasRead := True;
- finally
- lcAllSettings.Free;
- end;
-end;
-
-
-var
- // a module var
- mcFormatSettings: TFormatSettings = nil;
-
-function FormattingSettings: TFormatSettings;
-begin
- if mcFormatSettings = nil then
- mcFormatSettings := TFormatSettings.Create(true);
-
- Result := mcFormatSettings;
-end;
-
-function FormatSettingsFromFile(const psFileName: string): TFormatSettings;
-begin
- if mcFormatSettings = nil then
- mcFormatSettings := TFormatSettings.Create(false);
-
- mcFormatSettings.ReadFromFile(psFileName, true);
- Result := mcFormatSettings;
-end;
-
-
-procedure TFormatSettings.MakeConsistent;
-begin
- { one consistency check so far
- - if linebreaking is off, then "remove returns in expressions" must also be off }
-
- if Returns.RebreakLines = rbOff then
- Returns.RemoveExpressionReturns := False;
-end;
-
-initialization
- //JCFOptionsGroup := GetFreeIDEOptionsGroupIndex(GroupEditor);
- //RegisterIDEOptionsGroup(JCFOptionsGroup, TFormatSettings);
-finalization
- FreeAndNil(mcFormatSettings);
-end.
diff --git a/components/jcf2/TestApplication/TestJCF.lpi b/components/jcf2/TestApplication/TestJCF.lpi
index 4b322b3692..ff46a49fe6 100644
--- a/components/jcf2/TestApplication/TestJCF.lpi
+++ b/components/jcf2/TestApplication/TestJCF.lpi
@@ -34,7 +34,7 @@
-
+
@@ -147,26 +147,290 @@
-
+
-
+
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -177,7 +441,7 @@
-
+
diff --git a/components/jcf2/TestApplication/TestJCF.lpr b/components/jcf2/TestApplication/TestJCF.lpr
index 76cd7854b7..e66eb2bc47 100644
--- a/components/jcf2/TestApplication/TestJCF.lpr
+++ b/components/jcf2/TestApplication/TestJCF.lpr
@@ -6,21 +6,33 @@ uses {$IFDEF UNIX}
cthreads, {$ENDIF} {$IFDEF HASAMIGA}
athreads, {$ENDIF}
Interfaces, // this includes the LCL widgetset
- Forms,
- unit1,
- BuildParseTree,
- fShowParseTree,
- Converter, JcfUiTools, SettingsStream,
- ReturnBefore,
- MoveSpaceToBeforeColon,
- Indenter,
- SysUtils;
+ Forms, unit1, JcfSettings, BuildParseTree, PreProcessorExpressionParser,
+ PreProcessorExpressionTokenise, PreProcessorExpressionTokens,
+ PreProcessorParseTree, fShowParseTree, Converter, JcfUiTools, JcfStringUtils,
+ SettingsStream, ReturnAfter, NoReturnBefore, RemoveReturnsBeforeEnd,
+ PropertyOnOneLine, NoReturnAfter, LongLineBreaker, BlockStyles,
+ RemoveBlankLinesAfterProcHeader, RemoveBlankLinesInVars,
+ RemoveConsecutiveReturns, RemoveReturnsAfter, RemoveReturnsAfterBegin,
+ ReturnBefore, ReturnChars, ReturnsAfterFinalEnd, SingleSpaceBefore,
+ NoSpaceAfter, NoSpaceBefore, MaxSpaces, SingleSpaceAfter, SpaceToTab,
+ TabToSpace, MoveSpaceToBeforeColon, SpaceBeforeColon, RemoveSpaceAtLineEnd,
+ IndentAsmParam, Indenter, AlignAssign, AlignBase, AlignComment, AlignConst,
+ AlignField, AlignTypedef, AlignVars, Capitalisation, IdentifierCaps,
+ SpecificWordCaps, UnitNameCaps, AddBeginEnd, AddBlockEndSemicolon,
+ FindReplace, SortUses, SortUsesData, UsesClauseFindReplace, UsesClauseInsert,
+ UsesClauseRemove, BasicStats, FixCase, RebreakLines, ReduceWhiteSpace,
+ RemoveBlankLine, RemoveComment, RemoveConsecutiveWhiteSpace, RemoveReturn,
+ RemoveUnneededWhiteSpace, WarnAssignToFunctionName, WarnCaseNoElse,
+ WarnDestroy, WarnEmptyBlock, WarnImbalancedComment, Warning, WarnRealType,
+ WarnUnusedParam, AllProcesses, BaseVisitor, FormatFlags, Nesting,
+ RemoveEmptyComment, SwitchableVisitor, TreeWalker, VisitSetNesting,
+ VisitSetXY, VisitStripEmptySpace, SysUtils;
{$R *.res}
begin
RequireDerivedFormResource := True;
- Application.Scaled := True;
+ Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
diff --git a/components/jcf2/TestApplication/unit1.pas b/components/jcf2/TestApplication/unit1.pas
index ccb57cbbf7..4e4165fd4b 100644
--- a/components/jcf2/TestApplication/unit1.pas
+++ b/components/jcf2/TestApplication/unit1.pas
@@ -59,11 +59,8 @@ implementation
uses
JcfStringUtils in '..\..\Utils\JcfStringUtils.pas',
- //JcfFileUtils in '..\..\Utils\JcfFileUtils.pas',
- JcfSystemUtils in '..\..\Utils\JcfSystemUtils.pas',
Converter in '..\..\ReadWrite\Converter.pas',
FileConverter in '..\..\ReadWrite\FileConverter.pas',
- // ConvertTypes in '..\..\ReadWrite\ConvertTypes.pas',
BuildParseTree in '..\..\Parse\BuildParseTree.pas',
BuildTokenList in '..\..\Parse\BuildTokenList.pas',
ParseError in '..\..\Parse\ParseError.pas',
@@ -74,12 +71,10 @@ uses
VisitSetXY in '..\..\Process\VisitSetXY.pas',
BaseVisitor in '..\..\Process\BaseVisitor.pas',
JcfMiscFunctions in '..\..\Utils\JcfMiscFunctions.pas',
- //FileUtils in '..\..\Utils\FileUtils.pas',
JcfLog in '..\..\Utils\JcfLog.pas',
- //fShowParseTree in '..\..\Parse\UI\fShowParseTree.pas' {frmShowParseTree},
SetUses in '..\..\Settings\SetUses.pas',
JcfSetBase in '..\..\Settings\JcfSetBase.pas',
- JcfSettings,
+ JcfSettings in '..\..\Settings\JcfSettings.pas',
SetAlign in '..\..\Settings\SetAlign.pas',
SetCaps in '..\..\Settings\SetCaps.pas',
SetClarify in '..\..\Settings\SetClarify.pas',
@@ -155,7 +150,6 @@ uses
UnitNameCaps in '..\..\Process\Capitalisation\UnitNameCaps.pas',
RemoveSpaceAtLineEnd in '..\..\Process\Spacing\RemoveSpaceAtLineEnd.pas',
FindReplace in '..\..\Process\Transform\FindReplace.pas',
- //fJcfErrorDisplay in '..\..\Ui\fJcfErrorDisplay.pas' {ExceptionDialog},
ReturnsAfterFinalEnd in '..\..\Process\Returns\ReturnsAfterFinalEnd.pas',
PreProcessorParseTree in '..\..\Parse\PreProcessor\PreProcessorParseTree.pas',
RemoveEmptyComment in '..\..\Process\RemoveEmptyComment.pas',
@@ -174,7 +168,6 @@ uses
SortUsesData in '..\..\Process\Transform\SortUsesData.pas',
IdentifierCaps in '..\..\Process\Capitalisation\IdentifierCaps.pas',
WarnUnusedParam in '..\..\Process\Warnings\WarnUnusedParam.pas',
- //JcfFontSetFunctions in '..\..\Utils\JcfFontSetFunctions.pas',
SetAsm in '..\..\Settings\SetAsm.pas',
RemoveReturnsAfter in '..\..\Process\Returns\RemoveReturnsAfter.pas',
IndentAsmParam in '..\..\Process\Indent\IndentAsmParam.pas',
diff --git a/components/jcf2/Ui/fJcfErrorDisplay.lfm b/components/jcf2/Ui/fJcfErrorDisplay.lfm
index a6916088f1..91354f6e8c 100644
--- a/components/jcf2/Ui/fJcfErrorDisplay.lfm
+++ b/components/jcf2/Ui/fJcfErrorDisplay.lfm
@@ -7,8 +7,7 @@ object ExceptionDialog: TExceptionDialog
Caption = 'JCF Exception'
ClientHeight = 180
ClientWidth = 420
- OnCreate = FormCreate
- LCLVersion = '1.9.0.0'
+ LCLVersion = '2.3.0.0'
object mExceptionMessage: TMemo
Left = 6
Height = 133
diff --git a/components/jcf2/Ui/fJcfErrorDisplay.pas b/components/jcf2/Ui/fJcfErrorDisplay.pas
index 79da6f4b0a..9c2c9e13eb 100644
--- a/components/jcf2/Ui/fJcfErrorDisplay.pas
+++ b/components/jcf2/Ui/fJcfErrorDisplay.pas
@@ -43,7 +43,6 @@ type
TExceptionDialog = class(TForm)
BtnPanel: TButtonPanel;
mExceptionMessage: TMemo;
- procedure FormCreate(Sender: TObject);
private
public
procedure DisplayException(const pE: Exception);
@@ -59,7 +58,7 @@ implementation
uses
{ local }
- ParseError, JcfStringUtils, JcfFontSetFunctions, JcfUIConsts;
+ ParseError, JcfStringUtils, JcfUIConsts;
{$R *.lfm}
@@ -140,9 +139,4 @@ begin
ShowModal;
end;
-procedure TExceptionDialog.FormCreate(Sender: TObject);
-begin
- SetObjectFontToSystemFont(Self);
-end;
-
end.
diff --git a/components/jcf2/Ui/jcfuitools.pas b/components/jcf2/Ui/jcfuitools.pas
index f5fb6a4c52..c7eb732619 100644
--- a/components/jcf2/Ui/jcfuitools.pas
+++ b/components/jcf2/Ui/jcfuitools.pas
@@ -57,10 +57,6 @@ procedure RestoreCursorUI;
begin
end;
-procedure ShowParseTreeUI;
-begin
-end;
-
procedure ShowParseTreeUI(const pcRoot: TParseTreeNode);
begin
end;
diff --git a/components/jcf2/Utils/JcfFontSetFunctions.pas b/components/jcf2/Utils/JcfFontSetFunctions.pas
deleted file mode 100644
index 61a14d8cdd..0000000000
--- a/components/jcf2/Utils/JcfFontSetFunctions.pas
+++ /dev/null
@@ -1,98 +0,0 @@
-unit JcfFontSetFunctions;
-
-{(*}
-(*------------------------------------------------------------------------------
- Delphi Code formatter source code
-
-The Original Code is JcfFontSetFunctions, released May 2007.
-The Initial Developer of the Original Code is Jean-Fabien Connault.
-Portions created by Jean-Fabien Connault are Copyright (C) 1999-2008 Jean-Fabien Connault.
-All Rights Reserved.
-Contributor(s):
-SetObjectFontToSystemFont by Jean-Fabien Connault
-Integrated to JCF by Anthony Steele
-
-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/NPL/
-
-Software distributed under the License is distributed on an "AS IS" basis,
-WITHOUT WARRANTY OF ANY KIND, either express or implied.
-See the License for the specific language governing rights and limitations
-under the License.
-
-Alternatively, the contents of this file may be used under the terms of
-the GNU General Public License Version 2 or later (the "GPL")
-See http://www.gnu.org/licenses/gpl.html
-------------------------------------------------------------------------------*)
-{*)}
-
-{$I JcfGlobal.inc}
-
-interface
-
-uses
- TypInfo,
- Graphics;
-
-type
- TFontType = (ftAuto, ftCaption, ftContent);
-
-procedure SetObjectFontToSystemFont(
- const AObject: TObject; const FontType: TFontType = ftAuto);
-
-implementation
-
-uses
- JcfSystemUtils;
-
-procedure SetCaptionFont(const AObjectFont: TFont);
-begin
- if IsWinVista or IsWinServer2008 or IsWin7 or IsWinServer2008R2 then
- begin
- AObjectFont.Name := 'Segoe UI';
- AObjectFont.Size := 9;
- end
- else if IsWinXP or IsWin2k or IsWin2003 then
- begin
- // MS Shell Dlg 2
- AObjectFont.Name := 'Tahoma';
- AObjectFont.Size := 8;
- end
- else
- begin
- // MS Shell Dlg
- AObjectFont.Name := 'default';
- AObjectFont.Size := 10;
- end;
-end;
-
-procedure SetContentFont(const AObjectFont: TFont);
-begin
- if IsWinVista or IsWinServer2008 or IsWin7 or IsWinServer2008R2 then
- begin
- AObjectFont.Name := 'Calibri';
- AObjectFont.Size := 9;
- end
- else if IsWinXP or IsWin2k or IsWin2003 then
- begin
- // MS Shell Dlg 2
- AObjectFont.Name := 'Verdana';
- AObjectFont.Size := 8;
- end
- else
- begin
- // MS Shell Dlg
- AObjectFont.Name := 'default';
- AObjectFont.Size := 10;
- end;
-end;
-
-
-procedure SetObjectFontToSystemFont(const AObject: TObject; const FontType: TFontType);
-begin
- exit; // Lazarus forms have "default" font set
-end;
-
-
-end.
diff --git a/components/jcf2/Utils/JcfSystemUtils.pas b/components/jcf2/Utils/JcfSystemUtils.pas
deleted file mode 100644
index 765aa5de54..0000000000
--- a/components/jcf2/Utils/JcfSystemUtils.pas
+++ /dev/null
@@ -1,144 +0,0 @@
-unit JcfSystemUtils;
-
-{(*}
-(*------------------------------------------------------------------------------
- Delphi Code formatter source code
-
-The Original Code is JcfSystemUtils, released Jan 2009
-The Initial Developer of the Original Code is Paul Ishenin
-Portions created by Paul Ishenin are Copyright (C) 1999-2008 Paul Ishenin
-All Rights Reserved.
-Contributor(s): Anthony Steele.
-
-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/NPL/
-
-Software distributed under the License is distributed on an "AS IS" basis,
-WITHOUT WARRANTY OF ANY KIND, either express or implied.
-See the License for the specific language governing rights and limitations
-under the License.
-
-Alternatively, the contents of this file may be used under the terms of
-the GNU General Public License Version 2 or later (the "GPL")
-See http://www.gnu.org/licenses/gpl.html
-------------------------------------------------------------------------------*)
-{*)}
-
-{$I JcfGlobal.inc}
-
-{
-This unit contains OS and File utility code
-For use when the JCL functions are not available
-}
-interface
-
-uses
- SysUtils, Classes;
-
-function GetWindowsTempFolder: string;
-
-function IsMultiByte(const {%H-}pcChar: Char): Boolean;
-
-function IsWinServer2008R2: Boolean;
-function IsWin7: Boolean;
-function IsWinServer2008: Boolean;
-function IsWinVista: Boolean;
-function IsWinXP: Boolean;
-function IsWin2k: Boolean;
-function IsWin2003: Boolean;
-
-implementation
-
-// We know that this unit contains platform-specific code guarded by ifdefs
-{$WARN SYMBOL_PLATFORM OFF}
-
-uses
- {$ifdef MSWINDOWS}
- Windows
- {$endif}
- {$ifdef Unix}
- Unix
- {$endif}
- ,FileUtil;
-
-function GetWindowsTempFolder: string;
-begin
- Result := GetTempDir;
-end;
-
-function IsMultiByte(const pcChar: Char): Boolean;
-begin
- //Result := IsDBCSLeadByte(Byte(pcChar));
- Result := False;
-end;
-
-function IsWinServer2008R2: Boolean;
-begin
-{$IFDEF MSWINDOWS}
- Result := (Win32MajorVersion = 6) and (Win32MinorVersion = 1);
- // Should also make sure it's a server (see JclSysInfo)
-{$ELSE}
- Result := False;
-{$ENDIF}
-end;
-
-function IsWin7: Boolean;
-begin
-{$IFDEF MSWINDOWS}
- Result := (Win32MajorVersion = 6) and (Win32MinorVersion = 1);
- // Should also make sure it's a workstation (see JclSysInfo)
-{$ELSE}
- Result := False;
-{$ENDIF}
-end;
-
-function IsWinServer2008: Boolean;
-begin
-{$IFDEF MSWINDOWS}
- Result := (Win32MajorVersion = 6) and (Win32MinorVersion = 0);
- // Should also make sure it's a server (see JclSysInfo)
-{$ELSE}
- Result := False;
-{$ENDIF}
-end;
-
-function IsWinVista: Boolean;
-begin
-{$IFDEF MSWINDOWS}
- Result := (Win32MajorVersion = 6) and (Win32MinorVersion = 0);
- // Should also make sure it's a workstation (see JclSysInfo)
-{$ELSE}
- Result := False;
-{$ENDIF}
-end;
-
-function IsWinXP: Boolean;
-begin
-{$IFDEF MSWINDOWS}
- Result := (Win32MajorVersion = 5) and (Win32MinorVersion = 1);
-{$ELSE}
- Result := False;
-{$ENDIF}
-end;
-
-function IsWin2k: Boolean;
-begin
-{$IFDEF MSWINDOWS}
- Result := (Win32MajorVersion = 5) and (Win32MinorVersion = 0);
-{$ELSE}
- Result := False;
-{$ENDIF}
-end;
-
-function IsWin2003: Boolean;
-begin
-{$IFDEF MSWINDOWS}
- Result := (Win32MajorVersion = 5) and (Win32MinorVersion = 2);
- // can be also window xp 64 bit
-{$ELSE}
- Result := False;
-{$ENDIF}
-end;
-
-end.