From 40b978309aff626a41ecb1ffdc904f5f8aa3f785 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 8 Sep 2011 10:22:56 +0000 Subject: [PATCH] IDE, DBG: add option for class auto-typecast for hints git-svn-id: trunk@32226 - --- ide/editoroptions.pp | 8 +++ ide/frames/editor_codetools_options.lfm | 85 ++++++++++++++----------- ide/frames/editor_codetools_options.pas | 4 ++ ide/lazarusidestrconsts.pas | 1 + ide/main.pp | 8 ++- 5 files changed, 68 insertions(+), 38 deletions(-) diff --git a/ide/editoroptions.pp b/ide/editoroptions.pp index cb88785351..f36a9e0c29 100644 --- a/ide/editoroptions.pp +++ b/ide/editoroptions.pp @@ -993,6 +993,7 @@ type FAutoRemoveEmptyMethods: Boolean; fAutoToolTipExprEval: Boolean; fAutoToolTipSymbTools: Boolean; + FDbgHintAutoTypeCastClass: Boolean; fCodeTemplateFileName: String; fCTemplIndentToTokenStart: Boolean; @@ -1143,6 +1144,10 @@ type read fAutoToolTipExprEval write fAutoToolTipExprEval default True; // debugger hints property AutoToolTipSymbTools: Boolean read fAutoToolTipSymbTools write fAutoToolTipSymbTools default True; // declaration hints + published + property DbgHintAutoTypeCastClass: Boolean + read FDbgHintAutoTypeCastClass write FDbgHintAutoTypeCastClass default True; // declaration hints + public property AutoDelayInMSec: Integer read fAutoDelayInMSec write fAutoDelayInMSec default 1000; property CodeTemplateFileName: String @@ -3084,6 +3089,9 @@ begin FMarkupCurWordTrim := True; FMarkupCurWordNoTimer := False; + // hints + FDbgHintAutoTypeCastClass := True; + // Code Tools options FCompletionLongLineHintType := DefaultCompletionLongLineHintType; diff --git a/ide/frames/editor_codetools_options.lfm b/ide/frames/editor_codetools_options.lfm index 630c3dae41..3f10dfdcea 100644 --- a/ide/frames/editor_codetools_options.lfm +++ b/ide/frames/editor_codetools_options.lfm @@ -1,10 +1,11 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame Height = 492 Width = 634 + HorzScrollBar.Page = 634 + VertScrollBar.Page = 492 AutoScroll = True ClientHeight = 492 ClientWidth = 634 - TabOrder = 0 Visible = False DesignLeft = 263 DesignTop = 222 @@ -12,10 +13,10 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame AnchorSideLeft.Control = AutoHintAndCompletionDelayLabel AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = AutoHintAndCompletionDelayLabel - Left = 193 - Height = 14 - Top = 107 - Width = 76 + Left = 218 + Height = 16 + Top = 134 + Width = 84 BorderSpacing.Left = 20 Caption = 'AutoDelayLabel' ParentColor = False @@ -28,7 +29,7 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame AnchorSideRight.Side = asrBottom Left = 0 Height = 3 - Top = 52 + Top = 56 Width = 634 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 6 @@ -38,9 +39,9 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame AnchorSideLeft.Control = Owner AnchorSideTop.Control = Owner Left = 6 - Height = 17 + Height = 19 Top = 6 - Width = 189 + Width = 210 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'AutoRemoveEmptyMethodsOnSave' @@ -51,9 +52,9 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame AnchorSideTop.Control = ToolTipBevel AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 61 - Width = 173 + Height = 19 + Top = 65 + Width = 198 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'AutoToolTipSymbToolsCheckBox' @@ -64,9 +65,9 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame AnchorSideTop.Control = AutoRemoveEmptyMethodsOnSave AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 29 - Width = 157 + Height = 19 + Top = 31 + Width = 179 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'AutoCompleteBlockCheckBox' @@ -77,9 +78,9 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame AnchorSideTop.Control = AutoToolTipSymbToolsCheckBox AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 84 - Width = 164 + Height = 19 + Top = 90 + Width = 182 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'AutoToolTipExprEvalCheckBox' @@ -93,7 +94,7 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame AnchorSideRight.Side = asrBottom Left = 6 Height = 30 - Top = 122 + Top = 151 Width = 622 Frequency = 250 Max = 4000 @@ -109,12 +110,12 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame end object AutoHintAndCompletionDelayLabel: TLabel[7] AnchorSideLeft.Control = ToolTipBevel - AnchorSideTop.Control = AutoToolTipExprEvalCheckBox + AnchorSideTop.Control = DbgToolTipAutoCastClass AnchorSideTop.Side = asrBottom Left = 6 - Height = 14 - Top = 107 - Width = 167 + Height = 16 + Top = 134 + Width = 192 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'AutoHintAndCompletionDelayLabel' @@ -128,7 +129,7 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame AnchorSideRight.Side = asrBottom Left = 6 Height = 30 - Top = 173 + Top = 204 Width = 622 Frequency = 250 Max = 4000 @@ -146,9 +147,9 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame AnchorSideTop.Control = AutoDelayTrackBar AnchorSideTop.Side = asrBottom Left = 6 - Height = 14 - Top = 158 - Width = 129 + Height = 16 + Top = 187 + Width = 149 BorderSpacing.Left = 6 BorderSpacing.Top = 6 Caption = 'CompletionDropDownLabel' @@ -158,10 +159,10 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame AnchorSideLeft.Control = CompletionDropDownLabel AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CompletionDropDownLabel - Left = 155 - Height = 14 - Top = 158 - Width = 156 + Left = 175 + Height = 16 + Top = 187 + Width = 178 BorderSpacing.Left = 20 Caption = 'CompletionDropDownDelayLabel' ParentColor = False @@ -173,12 +174,12 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom Left = 6 - Height = 21 - Top = 205 + Height = 23 + Top = 236 Width = 220 BorderSpacing.Left = 6 BorderSpacing.Top = 2 - ItemHeight = 13 + ItemHeight = 15 Style = csDropDownList TabOrder = 6 end @@ -188,11 +189,23 @@ inherited EditorCodetoolsOptionsFrame: TEditorCodetoolsOptionsFrame AnchorSideTop.Control = CompletionDropDownHint AnchorSideTop.Side = asrCenter Left = 232 - Height = 14 - Top = 208 - Width = 148 + Height = 16 + Top = 239 + Width = 172 BorderSpacing.Around = 6 Caption = 'CompletionDropDownHintLabel' ParentColor = False end + object DbgToolTipAutoCastClass: TCheckBox[13] + AnchorSideLeft.Control = AutoToolTipExprEvalCheckBox + AnchorSideTop.Control = AutoToolTipExprEvalCheckBox + AnchorSideTop.Side = asrBottom + Left = 26 + Height = 19 + Top = 109 + Width = 159 + BorderSpacing.Left = 20 + Caption = 'DbgToolTipAutoCastClass' + TabOrder = 7 + end end diff --git a/ide/frames/editor_codetools_options.pas b/ide/frames/editor_codetools_options.pas index b1aa2707aa..d865f29bf4 100644 --- a/ide/frames/editor_codetools_options.pas +++ b/ide/frames/editor_codetools_options.pas @@ -36,6 +36,7 @@ type TEditorCodetoolsOptionsFrame = class(TAbstractIDEOptionsEditor) AutoCompleteBlockCheckBox: TCheckBox; AutoDelayLabel: TLabel; + DbgToolTipAutoCastClass: TCheckBox; CompletionDropDownHintLabel: TLabel; CompletionDropDownHint: TComboBox; CompletionDropDownDelayLabel: TLabel; @@ -79,6 +80,7 @@ begin AutoRemoveEmptyMethodsOnSave.Caption := dlgAutoRemoveEmptyMethods; AutoToolTipSymbToolsCheckBox.Caption := lisShowDeclarationHints; AutoToolTipExprEvalCheckBox.Caption := lisShowValueHintsWhileDebugging; + DbgToolTipAutoCastClass.Caption := lisDebugHintAutoTypeCastClass; AutoCompleteBlockCheckBox.Caption := dlgEdCompleteBlocks; AutoHintAndCompletionDelayLabel.Caption:=lisDelayForHintsAndCompletionBox; @@ -98,6 +100,7 @@ begin AutoCompleteBlockCheckBox.Checked := AutoBlockCompletion; AutoToolTipExprEvalCheckBox.Checked := AutoToolTipExprEval; AutoToolTipSymbToolsCheckBox.Checked := AutoToolTipSymbTools; + DbgToolTipAutoCastClass.Checked := DbgHintAutoTypeCastClass; AutoDelayTrackBar.Position := AutoDelayInMSec; AutoRemoveEmptyMethodsOnSave.Checked := AutoRemoveEmptyMethods; @@ -115,6 +118,7 @@ begin AutoBlockCompletion := AutoCompleteBlockCheckBox.Checked; AutoToolTipExprEval := AutoToolTipExprEvalCheckBox.Checked; AutoToolTipSymbTools := AutoToolTipSymbToolsCheckBox.Checked; + DbgHintAutoTypeCastClass := DbgToolTipAutoCastClass.Checked; AutoDelayInMSec := AutoDelayTrackBar.Position; AutoRemoveEmptyMethods := AutoRemoveEmptyMethodsOnSave.Checked; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 7793845526..25c0a54df8 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -1464,6 +1464,7 @@ resourcestring dlgEdIdComlet = 'Identifier completion'; dlgEdCompleteBlocks = 'Add close statement for pascal blocks'; lisShowValueHintsWhileDebugging = 'Show value hints while debugging'; + lisDebugHintAutoTypeCastClass = 'Automatic type-cast for objects'; dlgTooltipEval = 'Tooltip expression evaluation'; dlgTooltipTools = 'Tooltip symbol Tools'; dlgMarkupGroup = 'Word under Caret Highlight'; diff --git a/ide/main.pp b/ide/main.pp index 440170f07c..60ee6d0f07 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -16197,6 +16197,7 @@ var DBGType,DBGTypeDerefer: TDBGType; HasHint: Boolean; p: SizeInt; + Opts: TDBGEvaluateFlags; begin //DebugLn(['TMainIDE.OnSrcNotebookShowHintForSource START']); if (SrcEdit=nil) then exit; @@ -16231,7 +16232,10 @@ begin //DebugLn(['TMainIDE.OnSrcNotebookShowHintForSource Expression="',Expression,'"']); DBGType:=nil; DBGTypeDerefer:=nil; - if not DebugBoss.Evaluate(Expression, DebugEval, DBGType, [defClassAutoCast]) or (DebugEval = '') then + Opts := []; + if EditorOpts.DbgHintAutoTypeCastClass + then Opts := [defClassAutoCast]; + if not DebugBoss.Evaluate(Expression, DebugEval, DBGType, Opts) or (DebugEval = '') then DebugEval := '???'; // deference a pointer - maybe it is a class if Assigned(DBGType) and (DBGType.Kind in [skPointer]) and @@ -16240,7 +16244,7 @@ begin begin if DBGType.Value.AsPointer <> nil then begin - if DebugBoss.Evaluate(Expression + '^', DebugEvalDerefer, DBGTypeDerefer, [defClassAutoCast]) then + if DebugBoss.Evaluate(Expression + '^', DebugEvalDerefer, DBGTypeDerefer, Opts) then begin if Assigned(DBGTypeDerefer) and ( (DBGTypeDerefer.Kind <> skPointer) or