diff --git a/ide/environmentopts.pp b/ide/environmentopts.pp index 6965b9dc3e..7b2ec26610 100644 --- a/ide/environmentopts.pp +++ b/ide/environmentopts.pp @@ -162,6 +162,9 @@ type FHideIDEOnRun: boolean; FHideMessagesIcons: boolean; FComponentPaletteVisible: boolean; + // CompletionWindow + FCompletionWindowWidth: Integer; + FCompletionWindowHeight: Integer; // designer FCreateComponentFocusNameProperty: boolean; @@ -342,6 +345,11 @@ type property IDESpeedButtonsVisible: boolean read FIDESpeedButtonsVisible write FIDESpeedButtonsVisible; + property CompletionWindowWidth: Integer read FCompletionWindowWidth + write FCompletionWindowWidth; + property CompletionWindowHeight: Integer read FCompletionWindowHeight + write FCompletionWindowHeight; + // EnvironmentOptionsDialog editor property ShowBorderSpacing: boolean read FShowBorderSpacing write FShowBorderSpacing; property ShowGrid: boolean read FShowGrid write FShowGrid; @@ -930,6 +938,10 @@ begin Path+'Desktop/ComponentPaletteVisible/Value',true); FIDESpeedButtonsVisible:=XMLConfig.GetValue( Path+'Desktop/IDESpeedButtonsVisible/Value',true); + FCompletionWindowWidth:=XMLConfig.GetValue( + Path+'Desktop/CompletionWindowWidth/Value', 320); + FCompletionWindowHeight:=XMLConfig.GetValue( + Path+'Desktop/CompletionWindowHeight/Value', 6); // EnvironmentOptionsDialog editor FShowGrid:=XMLConfig.GetValue( @@ -1250,6 +1262,10 @@ begin FComponentPaletteVisible,true); XMLConfig.SetDeleteValue(Path+'Desktop/IDESpeedButtonsVisible/Value', FIDESpeedButtonsVisible,true); + XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowWidth/Value', + FCompletionWindowWidth, 320); + XMLConfig.SetDeleteValue(Path+'Desktop/CompletionWindowHeight/Value', + FCompletionWindowHeight, 6); // EnvironmentOptionsDialog editor XMLConfig.SetDeleteValue(Path+'FormEditor/ShowBorderSpacing', diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index e8df5d358e..eefe7b7408 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -57,7 +57,7 @@ uses SrcEditorIntf, MenuIntf, LazIDEIntf, PackageIntf, IDEHelpIntf, IDEImagesIntf, IDEWindowIntf, ProjectIntf, // IDE units - IDEDialogs, LazarusIDEStrConsts, IDECommands, EditorOptions, + IDEDialogs, LazarusIDEStrConsts, IDECommands, EditorOptions, EnvironmentOpts, WordCompletion, FindReplaceDialog, IDEProcs, IDEOptionDefs, MacroPromptDlg, TransferMacros, CodeContextForm, SrcEditHintFrm, MsgView, InputHistory, CodeMacroPrompt, CodeTemplatesDlg, CodeToolsOptions, @@ -108,6 +108,7 @@ type { TSourceEditCompletion } TSourceEditCompletion=class(TSynCompletion) + procedure CompletionFormResized(Sender: TObject); private FIdentCompletionJumpToError: boolean; ccSelection: String; @@ -1423,6 +1424,12 @@ end; { TSourceEditCompletion } +procedure TSourceEditCompletion.CompletionFormResized(Sender: TObject); +begin + EnvironmentOptions.CompletionWindowWidth := TheForm.Width; + EnvironmentOptions.CompletionWindowHeight := TheForm.NbLinesInWindow; +end; + procedure TSourceEditCompletion.ccExecute(Sender: TObject); // init completion form // called by OnExecute just before showing @@ -1970,6 +1977,10 @@ begin OnUTF8KeyPress:=@OnSynCompletionUTF8KeyPress; OnPositionChanged:=@OnSynCompletionPositionChanged; ShortCut:=Menus.ShortCut(VK_UNKNOWN,[]); + TheForm.ShowSizeDrag := True; + TheForm.Width := EnvironmentOptions.CompletionWindowWidth; + TheForm.NbLinesInWindow := EnvironmentOptions.CompletionWindowHeight; + TheForm.OnDragResized := @CompletionFormResized; end; { TSourceEditorSharedValues }