IDE: pass BlockTabIndent to codetools

git-svn-id: trunk@40791 -
This commit is contained in:
mattias 2013-04-11 11:08:01 +00:00
parent 501b3263a0
commit f4cb4fec12
2 changed files with 20 additions and 5 deletions

View File

@ -116,6 +116,7 @@ type
FSourceExtensions: string; // default is '.pp;.pas;.lpr;.dpr;.dpk'
FPascalTools: TAVLTree; // tree of TCustomCodeTool sorted TCustomCodeTool(Data).Scanner.MainCode
FTabWidth: integer;
FUseTabs: boolean;
FVisibleEditorLines: integer;
FWriteExceptions: boolean;
FWriteLockCount: integer;// Set/Unset counter
@ -140,6 +141,7 @@ type
procedure SetCompleteProperties(const AValue: boolean);
procedure SetIndentSize(NewValue: integer);
procedure SetTabWidth(const AValue: integer);
procedure SetUseTabs(AValue: boolean);
procedure SetVisibleEditorLines(NewValue: integer);
procedure SetJumpCentered(NewValue: boolean);
procedure SetCursorBeyondEOL(NewValue: boolean);
@ -274,6 +276,7 @@ type
property VisibleEditorLines: integer
read FVisibleEditorLines write SetVisibleEditorLines;
property TabWidth: integer read FTabWidth write SetTabWidth;
property UseTabs: boolean read FUseTabs write SetUseTabs;
property CompleteProperties: boolean
read FCompleteProperties write SetCompleteProperties;
property AddInheritedCodeToOverrideMethod: boolean
@ -5414,6 +5417,13 @@ begin
Indenter.DefaultTabWidth:=AValue;
end;
procedure TCodeToolManager.SetUseTabs(AValue: boolean);
begin
if FUseTabs=AValue then Exit;
FUseTabs:=AValue;
SourceChangeCache.BeautifyCodeOptions.UseTabs:=UseTabs;
end;
procedure TCodeToolManager.SetVisibleEditorLines(NewValue: integer);
begin
if NewValue=FVisibleEditorLines then exit;

View File

@ -68,7 +68,7 @@ uses
EnvironmentOpts, EditorOptions, CompilerOptions, KeyMapping, IDEProcs,
Debugger, IDEOptionDefs, CodeToolsDefines, Splash, Designer,
SourceEditor, BuildManager, FindInFilesDlg,
MainBar, MainIntf, PseudoTerminalDlg;
MainBar, MainIntf, SourceSynEditor, PseudoTerminalDlg;
type
TResetToolFlag = (
@ -332,6 +332,8 @@ end;
function TMainIDEBase.BeginCodeTool(ADesigner: TDesigner;
var ActiveSrcEdit: TSourceEditor; out ActiveUnitInfo: TUnitInfo;
Flags: TCodeToolsFlags): boolean;
var
Edit: TIDESynEditor;
begin
Result:=false;
if (ctfUseGivenSourceEditor in Flags) and (Project1<>nil)
@ -370,13 +372,16 @@ begin
// init codetools
SaveSourceEditorChangesToCodeCache(nil);
if ActiveSrcEdit<>nil then begin
CodeToolBoss.VisibleEditorLines:=ActiveSrcEdit.EditorComponent.LinesInWindow;
CodeToolBoss.TabWidth:=ActiveSrcEdit.EditorComponent.TabWidth;
CodeToolBoss.IndentSize:=ActiveSrcEdit.EditorComponent.BlockIndent;
Edit:=ActiveSrcEdit.EditorComponent;
CodeToolBoss.VisibleEditorLines:=Edit.LinesInWindow;
CodeToolBoss.TabWidth:=Edit.TabWidth;
CodeToolBoss.IndentSize:=Edit.BlockIndent+Edit.BlockTabIndent*Edit.TabWidth;
CodeToolBoss.UseTabs:=Edit.BlockTabIndent>0;
end else begin
CodeToolBoss.VisibleEditorLines:=25;
CodeToolBoss.TabWidth:=EditorOpts.TabWidth;
CodeToolBoss.IndentSize:=EditorOpts.BlockIndent;
CodeToolBoss.IndentSize:=EditorOpts.BlockIndent+EditorOpts.BlockTabIndent*EditorOpts.TabWidth;
CodeToolBoss.UseTabs:=EditorOpts.BlockTabIndent>0;
end;
if ctfActivateAbortMode in Flags then