From c6f95fc457491eaac0b30f2c07283fb750b9cf27 Mon Sep 17 00:00:00 2001 From: Olly Date: Wed, 6 Sep 2023 23:25:18 +0100 Subject: [PATCH] Support changing hotkeys for completion & param hint. --- Source/Simba.lpi | 22 +- Source/editor/simba.editor_autocomplete.pas | 27 ++- Source/editor/simba.editor_paramhint.pas | 26 ++- Source/forms/simba.settingsform.lfm | 18 +- Source/forms/simba.settingsform.pas | 27 +-- Source/forms/simba.settingsform_backup.lfm | 20 +- Source/forms/simba.settingsform_codetools.lfm | 213 ++++++++++++++++++ Source/forms/simba.settingsform_codetools.pas | 125 ++++++++++ .../simba.settingsform_editor_colors.lfm | 73 +++--- .../forms/simba.settingsform_editor_font.lfm | 39 ++-- .../simba.settingsform_editor_general.lfm | 106 +++------ .../simba.settingsform_editor_general.pas | 4 - Source/forms/simba.settingsform_outputbox.lfm | 62 +++-- .../simba.settingsform_simba_general.lfm | 105 ++++----- Source/simba.settings.pas | 32 ++- 15 files changed, 605 insertions(+), 294 deletions(-) create mode 100644 Source/forms/simba.settingsform_codetools.lfm create mode 100644 Source/forms/simba.settingsform_codetools.pas diff --git a/Source/Simba.lpi b/Source/Simba.lpi index d226da27f..6c3ecd8f0 100644 --- a/Source/Simba.lpi +++ b/Source/Simba.lpi @@ -324,21 +324,24 @@ - + - + - + - + - + + + + - + @@ -969,6 +972,13 @@ + + + + + + + diff --git a/Source/editor/simba.editor_autocomplete.pas b/Source/editor/simba.editor_autocomplete.pas index 52cfef780..bd668c714 100644 --- a/Source/editor/simba.editor_autocomplete.pas +++ b/Source/editor/simba.editor_autocomplete.pas @@ -14,7 +14,7 @@ interface uses Classes, SysUtils, Graphics, StdCtrls, Controls, Forms, LCLType, Types, SynEdit, SynEditTypes, SynCompletion, SynEditKeyCmds, SynEditHighlighter, - simba.mufasatypes, simba.ide_codetools_parser, simba.ide_codetools_insight, + simba.mufasatypes, simba.settings, simba.ide_codetools_parser, simba.ide_codetools_insight, simba.component_scrollbar; type @@ -69,6 +69,8 @@ TSimbaAutoComplete = class(TSynCompletion) FColumnWidth: Integer; FDrawOffsetY: Integer; + procedure DoSettingChanged_CompletionKey(Setting: TSimbaSetting); + function GetHintText(Decl: TDeclaration; IsHint: Boolean): String; function GetDecl(Index: Integer): TDeclaration; @@ -105,7 +107,7 @@ TSimbaAutoComplete = class(TSynCompletion) implementation uses - simba.settings, simba.algo_sort, simba.editor, simba.ide_codetools_setup, simba.theme; + simba.algo_sort, simba.editor, simba.ide_codetools_setup, simba.theme; {$IFDEF WINDOWS} function SetClassLong(Handle: HWND; Index: Integer = -26; Value: Integer = 0): UInt32; stdcall; external 'user32' name 'SetClassLongA'; @@ -460,6 +462,18 @@ procedure TSimbaAutoComplete.DoExecute(Sender: TObject); end; end; +procedure TSimbaAutoComplete.DoSettingChanged_CompletionKey(Setting: TSimbaSetting); +var + Index: Integer; +begin + Index := Editor.Keystrokes.FindCommand(AutoCompleteCommand); + if (Index > -1) then + begin + Editor.Keystrokes[Index].Key := SimbaSettings.CodeTools.CompletionKey.Value; + Editor.Keystrokes[Index].Shift := TShiftState(Integer(SimbaSettings.CodeTools.CompletionKeyModifiers.Value)); + end; +end; + function TSimbaAutoComplete.GetHintText(Decl: TDeclaration; IsHint: Boolean): String; function GetMethodText(Decl: TDeclaration_Method): String; @@ -581,8 +595,8 @@ procedure TSimbaAutoComplete.DoEditorAdded(Value: TCustomSynEdit); with KeyStrokes.Add() do begin - Key := VK_SPACE; - Shift := [ssCtrl]; + Key := SimbaSettings.CodeTools.CompletionKey.Value; + Shift := TShiftState(Int32(SimbaSettings.CodeTools.CompletionKeyModifiers.Value)); Command := AutoCompleteCommand; end; end; @@ -797,6 +811,9 @@ constructor TSimbaAutoComplete.Create(AOwner: TComponent); OnExecute := @DoExecute; LongLineHintType := sclpExtendRightOnly; + + SimbaSettings.RegisterChangeHandler(Self, SimbaSettings.CodeTools.CompletionKey, @DoSettingChanged_CompletionKey); + SimbaSettings.RegisterChangeHandler(Self, SimbaSettings.CodeTools.CompletionKeyModifiers, @DoSettingChanged_CompletionKey); end; destructor TSimbaAutoComplete.Destroy; @@ -809,7 +826,7 @@ destructor TSimbaAutoComplete.Destroy; class function TSimbaAutoComplete.IsAutoCompleteCommand(Command: TSynEditorCommand; AChar: TUTF8Char): Boolean; begin - Result := ((Command = ecChar) and (AChar = '.')) or (Command = AutoCompleteCommand); + Result := (SimbaSettings.CodeTools.CompletionOpenAutomatically.Value and (Command = ecChar) and (AChar = '.')) or (Command = AutoCompleteCommand); end; class constructor TSimbaAutoComplete.Create; diff --git a/Source/editor/simba.editor_paramhint.pas b/Source/editor/simba.editor_paramhint.pas index 76a624198..c2d699152 100644 --- a/Source/editor/simba.editor_paramhint.pas +++ b/Source/editor/simba.editor_paramhint.pas @@ -12,6 +12,7 @@ interface uses Classes, SysUtils, Forms, Controls, Graphics, LCLType, SynEdit, SynEditTypes, SynEditKeyCmds, + simba.mufasatypes, simba.settings, simba.ide_codetools_insight, simba.ide_codetools_parser; type @@ -45,6 +46,8 @@ TSimbaParamHint = class(TLazSynEditPlugin) function IsShowing: Boolean; function GetParameterIndexAtCaret: Integer; + procedure DoSettingChanged_ParamHintKey(Setting: TSimbaSetting); + procedure DoEditorTopLineChanged(Sender: TObject; Changes: TSynStatusChanges); procedure DoEditorCaretMove(Sender: TObject); procedure DoEditorCommand(Sender: TObject; AfterProcessing: Boolean; var Handled: Boolean; var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: Pointer; HandlerData: Pointer); @@ -66,7 +69,7 @@ implementation uses mPasLexTypes, mPasLex, - simba.editor, simba.mufasatypes, simba.ide_codetools_setup, simba.theme; + simba.editor, simba.ide_codetools_setup, simba.theme; procedure TSimbaParamHintForm.SetBoldIndex(AValue: Integer); begin @@ -321,6 +324,18 @@ function TSimbaParamHint.GetParameterIndexAtCaret: Integer; end; end; +procedure TSimbaParamHint.DoSettingChanged_ParamHintKey(Setting: TSimbaSetting); +var + Index: Integer; +begin + Index := Editor.Keystrokes.FindCommand(ParamHintCommand); + if (Index > -1) then + begin + Editor.Keystrokes[Index].Key := SimbaSettings.CodeTools.ParamHintKey.Value; + Editor.Keystrokes[Index].Shift := TShiftState(Integer(SimbaSettings.CodeTools.ParamHintKeyModifiers.Value)); + end; +end; + procedure TSimbaParamHint.DoEditorTopLineChanged(Sender: TObject; Changes: TSynStatusChanges); begin if IsShowing then @@ -434,8 +449,8 @@ procedure TSimbaParamHint.DoEditorAdded(Value: TCustomSynEdit); with KeyStrokes.Add() do begin - Key := VK_SPACE; - Shift := [ssCtrl, ssShift]; + Key := SimbaSettings.CodeTools.ParamHintKey.Value; + Shift := TShiftState(Int32(SimbaSettings.CodeTools.ParamHintKeyModifiers.Value)); Command := ParamHintCommand; end; end; @@ -465,7 +480,7 @@ destructor TSimbaParamHint.Destroy; class function TSimbaParamHint.IsParamHintCommand(Command: TSynEditorCommand; AChar: TUTF8Char): Boolean; begin - Result := ((Command = ecChar) and (AChar = '(')) or (Command = ParamHintCommand); + Result := (SimbaSettings.CodeTools.ParamHintOpenAutomatically.Value and (Command = ecChar) and (AChar = '(')) or (Command = ParamHintCommand); end; class constructor TSimbaParamHint.Create; @@ -479,6 +494,9 @@ constructor TSimbaParamHint.Create(AOwner: TComponent); FCodeinsight := TCodeinsight.Create(); FHintForm := TSimbaParamHintForm.Create(Self); + + SimbaSettings.RegisterChangeHandler(Self, SimbaSettings.CodeTools.ParamHintKey, @DoSettingChanged_ParamHintKey); + SimbaSettings.RegisterChangeHandler(Self, SimbaSettings.CodeTools.ParamHintKeyModifiers, @DoSettingChanged_ParamHintKey); end; end. diff --git a/Source/forms/simba.settingsform.lfm b/Source/forms/simba.settingsform.lfm index c4acf8a66..9cdfc17b8 100644 --- a/Source/forms/simba.settingsform.lfm +++ b/Source/forms/simba.settingsform.lfm @@ -1,7 +1,7 @@ object SimbaSettingsForm: TSimbaSettingsForm - Left = 3652 + Left = 3352 Height = 625 - Top = 427 + Top = 69 Width = 750 Caption = 'Settings' ClientHeight = 625 @@ -9,7 +9,7 @@ object SimbaSettingsForm: TSimbaSettingsForm DesignTimePPI = 120 OnShow = FormShow Position = poMainFormCenter - LCLVersion = '2.2.4.0' + LCLVersion = '3.0.0.1' object TreeView: TTreeView Left = 0 Height = 571 @@ -21,18 +21,20 @@ object SimbaSettingsForm: TSimbaSettingsForm ReadOnly = True ScrollBars = ssAutoBoth ShowRoot = False + ShowSeparators = False TabOrder = 0 OnSelectionChanged = TreeViewSelectionChanged Options = [tvoAutoExpand, tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoToolTips, tvoThemedDraw] end object Notebook: TNotebook - Left = 211 - Height = 571 - Top = 0 + Left = 212 + Height = 561 + Top = 10 Width = 533 Align = alClient - BorderSpacing.Left = 4 - BorderSpacing.Right = 6 + BorderSpacing.Left = 5 + BorderSpacing.Top = 10 + BorderSpacing.Right = 5 TabOrder = 1 end object ButtonPanel: TButtonPanel diff --git a/Source/forms/simba.settingsform.pas b/Source/forms/simba.settingsform.pas index 78e152c8e..6d574e38d 100644 --- a/Source/forms/simba.settingsform.pas +++ b/Source/forms/simba.settingsform.pas @@ -12,7 +12,8 @@ interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, ExtCtrls, ButtonPanel, Spin, simba.settingsform_editor_font, simba.settingsform_editor_colors, simba.settingsform_editor_general, - simba.settingsform_simba_general, simba.settingsform_outputbox, simba.settingsform_backup; + simba.settingsform_simba_general, simba.settingsform_outputbox, simba.settingsform_backup, + simba.settingsform_codetools; type TSimbaSettingsForm = class(TForm) @@ -26,6 +27,7 @@ TSimbaSettingsForm = class(TForm) procedure TreeViewSelectionChanged(Sender: TObject); public SimbaGeneralFrame: TSimbaGeneralFrame; + SimbaCodetoolsFrame: TSimbaCodetoolsFrame; SimbaOutputBoxFrame: TSimbaOutputBoxFrame; SimbaBackupFrame: TSimbaBackupFrame; @@ -75,9 +77,6 @@ procedure TSimbaSettingsForm.FormShow(Sender: TObject); EditorGeneralFrame.RightMarginEdit.Value := SimbaSettings.Editor.RightMargin.Value; EditorGeneralFrame.VisibleRightMarginCheckbox.Checked := SimbaSettings.Editor.RightMarginVisible.Value; EditorGeneralFrame.CaretPastEOLCheckBox.Checked := SimbaSettings.Editor.AllowCaretPastEOL.Value; - EditorGeneralFrame.OpenAutoCompletionCheckbox.Checked := SimbaSettings.Editor.AutomaticallyOpenAutoCompletion.Value; - EditorGeneralFrame.ShowParameterHintsCheckbox.Checked := SimbaSettings.Editor.AutomaticallyShowParameterHints.Value; - EditorGeneralFrame.IgnoreCodeToolsDirectiveCheckbox.Checked := SimbaSettings.Editor.IgnoreCodeToolsIDEDirective.Value; EditorGeneralFrame.CompleteBeginCheckbox.Checked := SimbaSettings.Editor.AutomaticallyCompleteBegin.Value; EditorGeneralFrame.CompleteParenthesesCheckbox.Checked := SimbaSettings.Editor.AutomaticallyCompleteParentheses.Value; @@ -89,6 +88,7 @@ procedure TSimbaSettingsForm.FormShow(Sender: TObject); SimbaGeneralFrame.FontSizeTrackBar.OnChange(nil); SimbaGeneralFrame.Load(); + SimbaCodetoolsFrame.Load(); EditorGeneralFrame.Load(); EditorColorsFrame.Load(); SimbaOutputBoxFrame.Load(); @@ -104,25 +104,13 @@ procedure TSimbaSettingsForm.OKButtonClick(Sender: TObject); SimbaSettings.Editor.AllowCaretPastEOL.Value := EditorGeneralFrame.CaretPastEOLCheckBox.Checked; SimbaSettings.Editor.RightMargin.Value := EditorGeneralFrame.RightMarginEdit.Value; SimbaSettings.Editor.RightMarginVisible.Value := EditorGeneralFrame.VisibleRightMarginCheckbox.Checked; - SimbaSettings.Editor.AutomaticallyOpenAutoCompletion.Value := EditorGeneralFrame.OpenAutoCompletionCheckbox.Checked; - SimbaSettings.Editor.AutomaticallyShowParameterHints.Value := EditorGeneralFrame.ShowParameterHintsCheckbox.Checked; - SimbaSettings.Editor.IgnoreCodeToolsIDEDirective.Value := EditorGeneralFrame.IgnoreCodeToolsDirectiveCheckbox.Checked; SimbaSettings.Editor.AutomaticallyCompleteBegin.Value := EditorGeneralFrame.CompleteBeginCheckbox.Checked; SimbaSettings.Editor.AutomaticallyCompleteIndex.Value := EditorGeneralFrame.CompleteIndexCheckbox.Checked; SimbaSettings.Editor.AutomaticallyCompleteParentheses.Value := EditorGeneralFrame.CompleteParenthesesCheckbox.Checked; - //if (SimbaGeneralFrame.ToolbarSizeTrackBar.Position = SimbaGeneralFrame.ToolbarSizeTrackBar.Min) then - // SimbaSettings.General.ToolbarSize.Value := SimbaSettings.General.ToolbarSize.DefaultValue - //else - // SimbaSettings.General.ToolbarSize.Value := SimbaGeneralFrame.ToolbarSizeTrackBar.Position; - // - //if (SimbaGeneralFrame.FontSizeTrackBar.Position = SimbaGeneralFrame.FontSizeTrackBar.Min) then - // SimbaSettings.General.CustomFontSize.Value := SimbaSettings.General.CustomFontSize.DefaultValue - //else - // SimbaSettings.General.CustomFontSize.Value := SimbaGeneralFrame.FontSizeTrackBar.Position; - SimbaGeneralFrame.Save(); + SimbaCodetoolsFrame.Save(); EditorGeneralFrame.Save(); EditorColorsFrame.Save(); SimbaOutputBoxFrame.Save(); @@ -163,6 +151,11 @@ constructor TSimbaSettingsForm.Create(AOwner: TComponent); SimbaGeneralFrame.Align := alClient; SimbaGeneralFrame.ParentFont := True; + SimbaCodetoolsFrame := TSimbaCodetoolsFrame.Create(Self); + SimbaCodetoolsFrame.Parent := AddPage('Code Tools', Node); + SimbaCodetoolsFrame.Align := alClient; + SimbaCodetoolsFrame.ParentFont := True; + SimbaOutputBoxFrame := TSimbaOutputBoxFrame.Create(Self); SimbaOutputBoxFrame.Parent := AddPage('Output Box', Node); SimbaOutputBoxFrame.Align := alClient; diff --git a/Source/forms/simba.settingsform_backup.lfm b/Source/forms/simba.settingsform_backup.lfm index af008d1f5..4df0f8e6a 100644 --- a/Source/forms/simba.settingsform_backup.lfm +++ b/Source/forms/simba.settingsform_backup.lfm @@ -6,6 +6,7 @@ object SimbaBackupFrame: TSimbaBackupFrame ClientHeight = 305 ClientWidth = 668 DesignTimePPI = 120 + ParentFont = False TabOrder = 0 DesignLeft = 4331 DesignTop = 1010 @@ -16,7 +17,7 @@ object SimbaBackupFrame: TSimbaBackupFrame AnchorSideTop.Side = asrBottom Left = 106 Height = 28 - Top = 86 + Top = 81 Width = 144 BorderSpacing.Left = 5 BorderSpacing.Top = 10 @@ -29,7 +30,7 @@ object SimbaBackupFrame: TSimbaBackupFrame AnchorSideBottom.Side = asrBottom Left = 0 Height = 28 - Top = 86 + Top = 81 Width = 101 Anchors = [akTop, akLeft, akBottom] Caption = 'Backup Interval' @@ -41,9 +42,8 @@ object SimbaBackupFrame: TSimbaBackupFrame AnchorSideTop.Control = Owner Left = 0 Height = 20 - Top = 5 + Top = 0 Width = 195 - BorderSpacing.Top = 5 Caption = 'Script backups are located at:' Layout = tlCenter ParentColor = False @@ -55,7 +55,7 @@ object SimbaBackupFrame: TSimbaBackupFrame AnchorSideBottom.Side = asrBottom Left = 0 Height = 1 - Top = 30 + Top = 25 Width = 1 BorderSpacing.Top = 5 Layout = tlCenter @@ -69,7 +69,7 @@ object SimbaBackupFrame: TSimbaBackupFrame AnchorSideBottom.Side = asrBottom Left = 255 Height = 28 - Top = 86 + Top = 81 Width = 52 Anchors = [akTop, akLeft, akBottom] BorderSpacing.Left = 5 @@ -84,7 +84,7 @@ object SimbaBackupFrame: TSimbaBackupFrame AnchorSideBottom.Side = asrBottom Left = 0 Height = 20 - Top = 56 + Top = 51 Width = 192 Caption = 'Automatically Backup Scripts' Layout = tlCenter @@ -98,8 +98,8 @@ object SimbaBackupFrame: TSimbaBackupFrame AnchorSideBottom.Side = asrBottom Left = 202 Height = 20 - Top = 56 - Width = 24 + Top = 51 + Width = 21 Anchors = [akTop, akLeft, akBottom] BorderSpacing.Left = 10 TabOrder = 1 @@ -112,7 +112,7 @@ object SimbaBackupFrame: TSimbaBackupFrame AnchorSideRight.Side = asrBottom Left = 0 Height = 20 - Top = 36 + Top = 31 Width = 668 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 5 diff --git a/Source/forms/simba.settingsform_codetools.lfm b/Source/forms/simba.settingsform_codetools.lfm new file mode 100644 index 000000000..afc6ab037 --- /dev/null +++ b/Source/forms/simba.settingsform_codetools.lfm @@ -0,0 +1,213 @@ +object SimbaCodetoolsFrame: TSimbaCodetoolsFrame + Left = 0 + Height = 489 + Top = 0 + Width = 634 + ClientHeight = 489 + ClientWidth = 634 + DesignTimePPI = 120 + ParentFont = False + TabOrder = 0 + DesignLeft = 2565 + DesignTop = 758 + object GroupBox1: TGroupBox + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = AutoOpenCompletionCheckbox + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 0 + Height = 63 + Top = 127 + Width = 634 + Anchors = [akTop, akLeft, akRight] + AutoSize = True + BorderSpacing.Top = 5 + Caption = 'Key' + ClientHeight = 38 + ClientWidth = 630 + TabOrder = 0 + object CompletionModShiftCheckbox: TCheckBox + Left = 118 + Height = 28 + Top = 5 + Width = 51 + Align = alLeft + BorderSpacing.Left = 9 + BorderSpacing.Around = 5 + Caption = 'Shift' + TabOrder = 0 + end + object CompletionModAltCheckbox: TCheckBox + Left = 64 + Height = 28 + Top = 5 + Width = 40 + Align = alLeft + BorderSpacing.Left = 10 + BorderSpacing.Around = 5 + Caption = 'Alt' + TabOrder = 1 + end + object CompletionModCtrlCheckbox: TCheckBox + Left = 5 + Height = 28 + Top = 5 + Width = 44 + Align = alLeft + BorderSpacing.Around = 5 + Caption = 'Ctrl' + TabOrder = 2 + end + object CompletionKeyCombo: TComboBox + Left = 184 + Height = 28 + Top = 5 + Width = 441 + Align = alClient + AutoComplete = True + AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactSearchAscending] + BorderSpacing.Left = 10 + BorderSpacing.Around = 5 + ItemHeight = 20 + Style = csDropDownList + TabOrder = 3 + end + end + object GroupBox2: TGroupBox + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = AutoOpenParamHintCheckbox + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 0 + Height = 63 + Top = 254 + Width = 634 + Anchors = [akTop, akLeft, akRight] + AutoSize = True + Caption = 'Key' + ClientHeight = 38 + ClientWidth = 630 + TabOrder = 1 + object ParamHintModShiftCheckbox: TCheckBox + Left = 118 + Height = 28 + Top = 5 + Width = 51 + Align = alLeft + BorderSpacing.Left = 9 + BorderSpacing.Around = 5 + Caption = 'Shift' + TabOrder = 0 + end + object ParamHintModAltCheckbox: TCheckBox + Left = 64 + Height = 28 + Top = 5 + Width = 40 + Align = alLeft + BorderSpacing.Left = 10 + BorderSpacing.Around = 5 + Caption = 'Alt' + TabOrder = 1 + end + object ParamHintModCtrlCheckbox: TCheckBox + Left = 5 + Height = 28 + Top = 5 + Width = 44 + Align = alLeft + BorderSpacing.Around = 5 + Caption = 'Ctrl' + TabOrder = 2 + end + object ParamHintKeyCombo: TComboBox + Left = 184 + Height = 28 + Top = 5 + Width = 441 + Align = alClient + AutoComplete = True + AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactSearchAscending] + BorderSpacing.Left = 10 + BorderSpacing.Around = 5 + ItemHeight = 20 + Style = csDropDownList + TabOrder = 3 + end + end + object DividerBevel1: TDividerBevel + AnchorSideTop.Control = IgnoreDirectiveCheckbox + AnchorSideTop.Side = asrBottom + Left = 10 + Height = 20 + Top = 34 + Width = 634 + Caption = 'Completion Box' + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Top = 10 + Style = gsHorLines + end + object AutoOpenCompletionCheckbox: TCheckBox + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = CompletionKeywordsCheckbox + AnchorSideTop.Side = asrBottom + Left = 0 + Height = 24 + Top = 98 + Width = 191 + BorderSpacing.Top = 10 + Caption = 'Automatically open on "."' + TabOrder = 2 + end + object DividerBevel2: TDividerBevel + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = GroupBox1 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 0 + Height = 20 + Top = 200 + Width = 634 + Caption = 'Parameter Hint' + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Top = 10 + Style = gsHorLines + end + object AutoOpenParamHintCheckbox: TCheckBox + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = DividerBevel2 + AnchorSideTop.Side = asrBottom + Left = 0 + Height = 24 + Top = 230 + Width = 197 + BorderSpacing.Top = 10 + Caption = ' Automatically open on "("' + TabOrder = 3 + end + object IgnoreDirectiveCheckbox: TCheckBox + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = Owner + Left = 0 + Height = 24 + Top = 0 + Width = 264 + Caption = 'Ignore {%CODETOOLS OFF} directive' + TabOrder = 4 + end + object CompletionKeywordsCheckbox: TCheckBox + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = DividerBevel1 + AnchorSideTop.Side = asrBottom + Left = 0 + Height = 24 + Top = 64 + Width = 117 + BorderSpacing.Top = 10 + Caption = 'Add Keywords' + TabOrder = 5 + end +end diff --git a/Source/forms/simba.settingsform_codetools.pas b/Source/forms/simba.settingsform_codetools.pas new file mode 100644 index 000000000..82eeed54b --- /dev/null +++ b/Source/forms/simba.settingsform_codetools.pas @@ -0,0 +1,125 @@ +{ + Author: Raymond van Venetiƫ and Merlijn Wajer + Project: Simba (https://github.com/MerlijnWajer/Simba) + License: GNU General Public License (https://www.gnu.org/licenses/gpl-3.0) +} +unit simba.settingsform_codetools; + +{$i simba.inc} + +interface + +uses + Classes, SysUtils, Forms, Controls, StdCtrls, DividerBevel; + +type + TSimbaCodetoolsFrame = class(TFrame) + CompletionModShiftCheckbox: TCheckBox; + CompletionKeywordsCheckbox: TCheckBox; + CompletionModAltCheckbox: TCheckBox; + CompletionModCtrlCheckbox: TCheckBox; + ParamHintModShiftCheckbox: TCheckBox; + ParamHintModAltCheckbox: TCheckBox; + ParamHintModCtrlCheckbox: TCheckBox; + AutoOpenCompletionCheckbox: TCheckBox; + AutoOpenParamHintCheckbox: TCheckBox; + IgnoreDirectiveCheckbox: TCheckBox; + CompletionKeyCombo: TComboBox; + ParamHintKeyCombo: TComboBox; + DividerBevel1: TDividerBevel; + DividerBevel2: TDividerBevel; + GroupBox1: TGroupBox; + GroupBox2: TGroupBox; + private + FAddedKeys: Boolean; + + procedure AddKeysToComboBoxes; + public + procedure Load; + procedure Save; + end; + +implementation + +{$R *.lfm} + +uses + simba.settings, LCLType, LCLProc; + +procedure TSimbaCodetoolsFrame.AddKeysToComboBoxes; + + procedure Add(const Key: integer); + var + S: String; + begin + S := KeyAndShiftStateToKeyString(Key, []); + + if not KeyStringIsIrregular(S) then + begin + CompletionKeyCombo.Items.AddObject(S, TObject(Pointer(PtrUInt(Key)))); + ParamHintKeyCombo.Items.AddObject(S, TObject(Pointer(PtrUInt(Key)))); + end; + end; + +var + Key: Integer; +begin + if FAddedKeys then + Exit; + FAddedKeys := True; + + for Key := 0 to VK_SCROLL do + Add(Key); + for Key := VK_BROWSER_BACK to VK_OEM_8 do + Add(Key); +end; + +procedure TSimbaCodetoolsFrame.Load; +begin + AddKeysToComboBoxes(); + + IgnoreDirectiveCheckbox.Checked := SimbaSettings.CodeTools.IgnoreIDEDirective.Value; + AutoOpenParamHintCheckbox.Checked := SimbaSettings.CodeTools.ParamHintOpenAutomatically.Value; + AutoOpenCompletionCheckbox.Checked := SimbaSettings.CodeTools.CompletionOpenAutomatically.Value; + + CompletionKeyCombo.ItemIndex := CompletionKeyCombo.Items.IndexOfObject(TObject(Pointer(PtrUInt(SimbaSettings.CodeTools.CompletionKey.Value)))); + CompletionModShiftCheckbox.Checked := ssShift in TShiftState(Int32(SimbaSettings.CodeTools.CompletionKeyModifiers.Value)); + CompletionModAltCheckbox.Checked := ssAlt in TShiftState(Int32(SimbaSettings.CodeTools.CompletionKeyModifiers.Value)); + CompletionModCtrlCheckbox.Checked := ssCtrl in TShiftState(Int32(SimbaSettings.CodeTools.CompletionKeyModifiers.Value)); + + ParamHintKeyCombo.ItemIndex := ParamHintKeyCombo.Items.IndexOfObject(TObject(Pointer(PtrUInt(SimbaSettings.CodeTools.ParamHintKey.Value)))); + ParamHintModShiftCheckbox.Checked := ssShift in TShiftState(Int32(SimbaSettings.CodeTools.ParamHintKeyModifiers.Value)); + ParamHintModAltCheckbox.Checked := ssAlt in TShiftState(Int32(SimbaSettings.CodeTools.ParamHintKeyModifiers.Value)); + ParamHintModCtrlCheckbox.Checked := ssCtrl in TShiftState(Int32(SimbaSettings.CodeTools.ParamHintKeyModifiers.Value)); +end; + +procedure TSimbaCodetoolsFrame.Save; +var + CompletionKeyState, ParamKeyState: TShiftState; +begin + SimbaSettings.CodeTools.IgnoreIDEDirective.Value := IgnoreDirectiveCheckbox.Checked; + SimbaSettings.CodeTools.ParamHintOpenAutomatically.Value := AutoOpenParamHintCheckbox.Checked; + SimbaSettings.CodeTools.CompletionOpenAutomatically.Value := AutoOpenCompletionCheckbox.Checked; + + if (CompletionKeyCombo.ItemIndex > -1) then + SimbaSettings.CodeTools.CompletionKey.Value := PtrUInt(CompletionKeyCombo.Items.Objects[CompletionKeyCombo.ItemIndex]); + if (ParamHintKeyCombo.ItemIndex > -1) then + SimbaSettings.CodeTools.ParamHintKey.Value := PtrUInt(ParamHintKeyCombo.Items.Objects[ParamHintKeyCombo.ItemIndex]); + + CompletionKeyState := []; + ParamKeyState := []; + + if CompletionModShiftCheckbox.Checked then Include(CompletionKeyState, ssShift); + if CompletionModAltCheckbox.Checked then Include(CompletionKeyState, ssAlt); + if CompletionModCtrlCheckbox.Checked then Include(CompletionKeyState, ssCtrl); + + if ParamHintModShiftCheckbox.Checked then Include(ParamKeyState, ssShift); + if ParamHintModAltCheckbox.Checked then Include(ParamKeyState, ssAlt); + if ParamHintModCtrlCheckbox.Checked then Include(ParamKeyState, ssCtrl); + + SimbaSettings.CodeTools.CompletionKeyModifiers.Value := Int32(CompletionKeyState); + SimbaSettings.CodeTools.ParamHintKeyModifiers.Value := Int32(ParamKeyState); +end; + +end. + diff --git a/Source/forms/simba.settingsform_editor_colors.lfm b/Source/forms/simba.settingsform_editor_colors.lfm index 01b86e83f..f96e6a1cd 100644 --- a/Source/forms/simba.settingsform_editor_colors.lfm +++ b/Source/forms/simba.settingsform_editor_colors.lfm @@ -9,8 +9,8 @@ object EditorColorsFrame: TEditorColorsFrame OnResize = FrameResize ParentFont = False TabOrder = 0 - DesignLeft = 2689 - DesignTop = 285 + DesignLeft = 3477 + DesignTop = 286 object Panel1: TPanel Left = 0 Height = 894 @@ -31,24 +31,23 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideBottom.Control = Panel1 AnchorSideBottom.Side = asrBottom Left = 0 - Height = 622 - Top = 272 - Width = 1357 + Height = 627 + Top = 267 + Width = 1362 Anchors = [akTop, akLeft, akRight, akBottom] AutoSize = True - BorderSpacing.Right = 5 Caption = 'Customize' - ClientHeight = 597 - ClientWidth = 1353 + ClientHeight = 602 + ClientWidth = 1358 TabOrder = 0 object TreeView: TTreeView AnchorSideLeft.Control = GroupBox3 AnchorSideTop.Control = GroupBox3 AnchorSideBottom.Control = ButtonResetAttribute Left = 5 - Height = 552 + Height = 557 Top = 5 - Width = 200 + Width = 205 Align = alCustom Anchors = [akTop, akLeft, akRight, akBottom] AutoExpand = True @@ -60,6 +59,7 @@ object EditorColorsFrame: TEditorColorsFrame ReadOnly = True ScrollBars = ssAutoBoth ShowRoot = False + ShowSeparators = False TabOrder = 0 OnDeletion = TreeViewDeletion OnSelectionChanged = TreeViewSelectionChanged @@ -74,15 +74,15 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = TreeView AnchorSideBottom.Side = asrBottom - Left = 210 - Height = 402 + Left = 215 + Height = 407 Top = 155 Width = 1133 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Left = 5 BorderSpacing.Right = 10 BevelOuter = bvNone - ClientHeight = 402 + ClientHeight = 407 ClientWidth = 1133 TabOrder = 1 OnResize = Panel2Resize @@ -94,7 +94,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideBottom.Control = Panel2 AnchorSideBottom.Side = asrBottom Left = 5 - Height = 380 + Height = 385 Top = 22 Width = 202 ColorRectWidth = 31 @@ -136,7 +136,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideBottom.Control = Panel2 AnchorSideBottom.Side = asrBottom Left = 217 - Height = 380 + Height = 385 Top = 22 Width = 177 ColorRectWidth = 31 @@ -157,7 +157,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideBottom.Control = Panel2 AnchorSideBottom.Side = asrBottom Left = 404 - Height = 380 + Height = 385 Top = 22 Width = 200 ColorRectWidth = 31 @@ -189,8 +189,8 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideBottom.Side = asrBottom Left = 5 Height = 30 - Top = 562 - Width = 200 + Top = 567 + Width = 205 Align = alCustom Anchors = [akLeft, akRight, akBottom] AutoSize = True @@ -206,7 +206,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = GroupBox3 AnchorSideRight.Side = asrBottom - Left = 215 + Left = 220 Height = 20 Top = 135 Width = 1138 @@ -218,7 +218,7 @@ object EditorColorsFrame: TEditorColorsFrame object Label1: TLabel AnchorSideLeft.Control = Panel2 AnchorSideTop.Control = TreeView - Left = 215 + Left = 220 Height = 20 Top = 5 Width = 71 @@ -230,7 +230,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideLeft.Control = Panel2 AnchorSideTop.Control = Label1 AnchorSideTop.Side = asrBottom - Left = 215 + Left = 220 Height = 100 Top = 30 Width = 160 @@ -252,7 +252,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideLeft.Control = CheckListBox1 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = TreeView - Left = 385 + Left = 390 Height = 20 Top = 5 Width = 39 @@ -265,7 +265,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideTop.Control = CheckListBox1 AnchorSideBottom.Control = CheckListBox1 AnchorSideBottom.Side = asrBottom - Left = 385 + Left = 390 Height = 100 Top = 30 Width = 195 @@ -344,13 +344,12 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = TreeView AnchorSideBottom.Side = asrBottom - Left = 2 + Left = 0 Height = 30 - Top = 75 - Width = 343 + Top = 70 + Width = 345 Anchors = [akTop, akLeft, akRight] AutoSize = True - BorderSpacing.Left = 2 BorderSpacing.Top = 5 Caption = 'Save To File' OnClick = DoSaveButtonClick @@ -361,14 +360,12 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideTop.Control = Panel1 AnchorSideRight.Control = ButtonLoadFromURL AnchorSideRight.Side = asrBottom - Left = 2 + Left = 0 Height = 30 - Top = 5 - Width = 343 + Top = 0 + Width = 345 Anchors = [akTop, akLeft, akRight] AutoSize = True - BorderSpacing.Left = 2 - BorderSpacing.Top = 5 BorderSpacing.Bottom = 5 Caption = 'Load From File' OnClick = LoadButtonClick @@ -381,7 +378,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideRight.Control = Panel3 Left = 2 Height = 30 - Top = 40 + Top = 35 Width = 343 Anchors = [akTop, akLeft, akRight] AutoSize = True @@ -400,13 +397,12 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = TreeView AnchorSideBottom.Side = asrBottom - Left = 2 + Left = 0 Height = 30 - Top = 110 - Width = 343 + Top = 105 + Width = 345 Anchors = [akTop, akLeft, akRight] AutoSize = True - BorderSpacing.Left = 2 BorderSpacing.Top = 5 Caption = 'Reset' OnClick = DoResetButtonClick @@ -419,10 +415,9 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideRight.Side = asrBottom Left = 355 Height = 265 - Top = 5 + Top = 0 Width = 1002 Anchors = [akTop, akRight] - BorderSpacing.Top = 5 BorderSpacing.Right = 5 BorderSpacing.Bottom = 2 BevelOuter = bvNone diff --git a/Source/forms/simba.settingsform_editor_font.lfm b/Source/forms/simba.settingsform_editor_font.lfm index 2813f7d1f..ab2068d84 100644 --- a/Source/forms/simba.settingsform_editor_font.lfm +++ b/Source/forms/simba.settingsform_editor_font.lfm @@ -12,13 +12,13 @@ object EditorFontFrame: TEditorFontFrame DesignTop = 858 object Panel1: TPanel Left = 0 - Height = 110 + Height = 95 Top = 0 Width = 400 Align = alTop AutoSize = True BevelOuter = bvNone - ClientHeight = 110 + ClientHeight = 95 ClientWidth = 400 TabOrder = 0 object Label1: TLabel @@ -28,7 +28,7 @@ object EditorFontFrame: TEditorFontFrame AnchorSideBottom.Side = asrBottom Left = 0 Height = 28 - Top = 10 + Top = 0 Width = 73 Anchors = [akTop, akLeft, akBottom] Caption = 'Font Name' @@ -41,14 +41,12 @@ object EditorFontFrame: TEditorFontFrame AnchorSideTop.Control = Panel1 AnchorSideRight.Control = Panel1 AnchorSideRight.Side = asrBottom - Left = 79 + Left = 78 Height = 28 - Top = 10 - Width = 315 + Top = 0 + Width = 322 Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 6 - BorderSpacing.Top = 10 - BorderSpacing.Right = 6 + BorderSpacing.Left = 5 ItemHeight = 20 OnChange = FontsNameComboBoxChange TabOrder = 0 @@ -57,8 +55,8 @@ object EditorFontFrame: TEditorFontFrame AnchorSideLeft.Control = Panel1 AnchorSideBottom.Side = asrBottom Left = 0 - Height = 19 - Top = 50 + Height = 14 + Top = 40 Width = 60 Anchors = [akTop, akLeft, akBottom] Caption = 'Font Size' @@ -71,9 +69,9 @@ object EditorFontFrame: TEditorFontFrame AnchorSideTop.Side = asrBottom Left = 0 Height = 24 - Top = 86 - Width = 106 - BorderSpacing.Top = 10 + Top = 71 + Width = 103 + BorderSpacing.Top = 5 Caption = 'Anti-Aliased' OnChange = FontAntiAliasedCheckboxChange TabOrder = 1 @@ -85,22 +83,21 @@ object EditorFontFrame: TEditorFontFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Panel1 AnchorSideRight.Side = asrBottom - Left = 79 + Left = 78 Height = 28 - Top = 48 - Width = 315 + Top = 38 + Width = 322 Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 6 + BorderSpacing.Left = 5 BorderSpacing.Top = 10 - BorderSpacing.Right = 6 OnChange = FontSizeSpinEditChange TabOrder = 2 end end object EditorPanel: TPanel Left = 0 - Height = 180 - Top = 120 + Height = 195 + Top = 105 Width = 400 Align = alClient BorderSpacing.Top = 10 diff --git a/Source/forms/simba.settingsform_editor_general.lfm b/Source/forms/simba.settingsform_editor_general.lfm index 4341cee33..6aa8ea85d 100644 --- a/Source/forms/simba.settingsform_editor_general.lfm +++ b/Source/forms/simba.settingsform_editor_general.lfm @@ -8,69 +8,29 @@ object EditorGeneralFrame: TEditorGeneralFrame DesignTimePPI = 120 ParentFont = False TabOrder = 0 - DesignLeft = 2843 - DesignTop = 75 + DesignLeft = 3792 + DesignTop = 388 object CaretPastEOLCheckBox: TCheckBox AnchorSideLeft.Control = Owner AnchorSideTop.Control = Owner Left = 0 Height = 24 - Top = 10 - Width = 162 - BorderSpacing.Top = 10 + Top = 0 + Width = 159 Caption = 'Allow Caret Past EOL' TabOrder = 0 end - object DividerBevel1: TDividerBevel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = RightMarginEdit - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 0 - Height = 20 - Top = 146 - Width = 946 - Caption = 'Code Tools' - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Top = 10 - Style = gsHorLines - end - object ShowParameterHintsCheckbox: TCheckBox - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = DividerBevel1 - AnchorSideTop.Side = asrBottom - Left = 0 - Height = 24 - Top = 176 - Width = 262 - BorderSpacing.Top = 10 - Caption = 'Automatically show parameter hints' - TabOrder = 1 - end - object OpenAutoCompletionCheckbox: TCheckBox - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = ShowParameterHintsCheckbox - AnchorSideTop.Side = asrBottom - Left = 0 - Height = 24 - Top = 210 - Width = 255 - BorderSpacing.Top = 10 - Caption = 'Automatically open auto complete' - TabOrder = 2 - end object VisibleRightMarginCheckbox: TCheckBox AnchorSideLeft.Control = Owner AnchorSideTop.Control = DividerBevel4 AnchorSideTop.Side = asrBottom Left = 0 Height = 24 - Top = 74 - Width = 68 + Top = 64 + Width = 65 BorderSpacing.Top = 10 Caption = 'Visible' - TabOrder = 3 + TabOrder = 1 end object RightMarginEdit: TSpinEdit AnchorSideLeft.Control = MarginValueLabel @@ -79,12 +39,12 @@ object EditorGeneralFrame: TEditorGeneralFrame AnchorSideTop.Side = asrBottom Left = 46 Height = 28 - Top = 108 + Top = 98 Width = 125 BorderSpacing.Left = 10 BorderSpacing.Top = 10 MaxValue = 1000 - TabOrder = 4 + TabOrder = 2 end object MarginValueLabel: TLabel AnchorSideLeft.Control = Owner @@ -93,7 +53,7 @@ object EditorGeneralFrame: TEditorGeneralFrame AnchorSideBottom.Side = asrBottom Left = 0 Height = 28 - Top = 108 + Top = 98 Width = 36 Anchors = [akTop, akLeft, akBottom] Caption = 'Value' @@ -108,34 +68,22 @@ object EditorGeneralFrame: TEditorGeneralFrame AnchorSideRight.Side = asrBottom Left = 0 Height = 20 - Top = 44 + Top = 34 Width = 946 Caption = 'Right Margin' Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 10 Style = gsHorLines end - object IgnoreCodetoolsDirectiveCheckbox: TCheckBox - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = OpenAutoCompletionCheckbox - AnchorSideTop.Side = asrBottom - Left = 0 - Height = 24 - Top = 244 - Width = 267 - BorderSpacing.Top = 10 - Caption = 'Ignore {%CODETOOLS OFF} directive' - TabOrder = 5 - end object CompleteDivider: TDividerBevel AnchorSideLeft.Control = Owner - AnchorSideTop.Control = IgnoreCodetoolsDirectiveCheckbox + AnchorSideTop.Control = RightMarginEdit AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 Height = 20 - Top = 278 + Top = 136 Width = 946 Caption = 'Block Completion' Anchors = [akTop, akLeft, akRight] @@ -148,11 +96,11 @@ object EditorGeneralFrame: TEditorGeneralFrame AnchorSideTop.Side = asrBottom Left = 0 Height = 24 - Top = 338 - Width = 145 + Top = 196 + Width = 142 BorderSpacing.Top = 10 Caption = '"begin" add "end"' - TabOrder = 6 + TabOrder = 3 end object CompleteParenthesesCheckbox: TCheckBox AnchorSideLeft.Control = CompleteBeginCheckbox @@ -160,11 +108,11 @@ object EditorGeneralFrame: TEditorGeneralFrame AnchorSideTop.Side = asrBottom Left = 0 Height = 24 - Top = 372 - Width = 92 + Top = 230 + Width = 89 BorderSpacing.Top = 10 Caption = '"(" add ")"' - TabOrder = 7 + TabOrder = 4 end object CompleteIndexCheckbox: TCheckBox AnchorSideLeft.Control = CompleteParenthesesCheckbox @@ -172,11 +120,11 @@ object EditorGeneralFrame: TEditorGeneralFrame AnchorSideTop.Side = asrBottom Left = 0 Height = 24 - Top = 406 - Width = 92 + Top = 264 + Width = 89 BorderSpacing.Top = 10 Caption = '"[" add "]"' - TabOrder = 8 + TabOrder = 5 end object CompleteLabel: TLabel AnchorSideLeft.Control = Owner @@ -184,7 +132,7 @@ object EditorGeneralFrame: TEditorGeneralFrame AnchorSideTop.Side = asrBottom Left = 0 Height = 20 - Top = 308 + Top = 166 Width = 248 BorderSpacing.Top = 10 Caption = 'Automatically complete the block on:' @@ -198,7 +146,7 @@ object EditorGeneralFrame: TEditorGeneralFrame AnchorSideRight.Side = asrBottom Left = 0 Height = 20 - Top = 440 + Top = 298 Width = 946 Caption = 'Documentation Comment' Anchors = [akTop, akLeft, akRight] @@ -212,13 +160,13 @@ object EditorGeneralFrame: TEditorGeneralFrame AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom Left = 0 - Height = 192 - Top = 470 + Height = 334 + Top = 328 Width = 408 Anchors = [akTop, akLeft, akBottom] BorderSpacing.Top = 10 BorderSpacing.Bottom = 10 ScrollBars = ssAutoBoth - TabOrder = 9 + TabOrder = 6 end end diff --git a/Source/forms/simba.settingsform_editor_general.pas b/Source/forms/simba.settingsform_editor_general.pas index a1c49d274..7c0bf4134 100644 --- a/Source/forms/simba.settingsform_editor_general.pas +++ b/Source/forms/simba.settingsform_editor_general.pas @@ -19,16 +19,12 @@ TEditorGeneralFrame = class(TFrame) CompleteParenthesesCheckbox: TCheckBox; CompleteIndexCheckbox: TCheckBox; CompleteDivider: TDividerBevel; - IgnoreCodetoolsDirectiveCheckbox: TCheckBox; CaretPastEOLCheckBox: TCheckBox; DividerBevel4: TDividerBevel; CompleteLabel: TLabel; DocCommentMemo: TMemo; VisibleRightMarginCheckbox: TCheckBox; MarginValueLabel: TLabel; - ShowParameterHintsCheckbox: TCheckBox; - OpenAutoCompletionCheckbox: TCheckBox; - DividerBevel1: TDividerBevel; RightMarginEdit: TSpinEdit; public procedure Load; diff --git a/Source/forms/simba.settingsform_outputbox.lfm b/Source/forms/simba.settingsform_outputbox.lfm index 32e7d2cfe..bce59c0d0 100644 --- a/Source/forms/simba.settingsform_outputbox.lfm +++ b/Source/forms/simba.settingsform_outputbox.lfm @@ -17,14 +17,13 @@ object SimbaOutputBoxFrame: TSimbaOutputBoxFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - Left = 103 + Left = 98 Height = 28 - Top = 69 - Width = 487 + Top = 59 + Width = 502 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 25 BorderSpacing.Top = 10 - BorderSpacing.Right = 10 ItemHeight = 20 OnChange = FontNameComboBoxChange TabOrder = 0 @@ -34,12 +33,11 @@ object SimbaOutputBoxFrame: TSimbaOutputBoxFrame AnchorSideTop.Control = FontNameComboBox AnchorSideBottom.Control = FontNameComboBox AnchorSideBottom.Side = asrBottom - Left = 5 + Left = 0 Height = 28 - Top = 69 + Top = 59 Width = 73 Anchors = [akTop, akLeft, akBottom] - BorderSpacing.Left = 5 Caption = 'Font Name' Layout = tlCenter ParentColor = False @@ -49,12 +47,11 @@ object SimbaOutputBoxFrame: TSimbaOutputBoxFrame AnchorSideTop.Control = FontSizeSpinEdit AnchorSideBottom.Control = FontSizeSpinEdit AnchorSideBottom.Side = asrBottom - Left = 5 + Left = 0 Height = 28 - Top = 102 + Top = 92 Width = 60 Anchors = [akTop, akLeft, akBottom] - BorderSpacing.Left = 5 Caption = 'Font Size' Layout = tlCenter ParentColor = False @@ -63,9 +60,9 @@ object SimbaOutputBoxFrame: TSimbaOutputBoxFrame AnchorSideLeft.Control = FontNameComboBox AnchorSideTop.Control = FontNameComboBox AnchorSideTop.Side = asrBottom - Left = 103 + Left = 98 Height = 28 - Top = 102 + Top = 92 Width = 142 BorderSpacing.Top = 5 OnChange = FontSizeSpinEditChange @@ -73,19 +70,18 @@ object SimbaOutputBoxFrame: TSimbaOutputBoxFrame end object ButtonReset: TButton AnchorSideLeft.Control = Owner - AnchorSideTop.Control = AntiAliasingCheckbox + AnchorSideTop.Control = Panel1 AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - Left = 421 + Left = 431 Height = 30 - Top = 168 + Top = 155 Width = 169 Anchors = [akTop, akRight] AutoSize = True BorderSpacing.Left = 5 BorderSpacing.Top = 10 - BorderSpacing.Right = 10 Caption = 'Reset Font To Default' OnClick = ButtonResetClick TabOrder = 2 @@ -96,13 +92,12 @@ object SimbaOutputBoxFrame: TSimbaOutputBoxFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - Left = 5 + Left = 0 Height = 20 - Top = 39 - Width = 590 + Top = 29 + Width = 595 Caption = 'Font' Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 5 BorderSpacing.Top = 5 BorderSpacing.Right = 5 Style = gsHorLines @@ -110,13 +105,11 @@ object SimbaOutputBoxFrame: TSimbaOutputBoxFrame object CheckBox1: TCheckBox AnchorSideLeft.Control = Owner AnchorSideTop.Control = Owner - Left = 5 + Left = 0 Height = 24 Hint = 'Clear output box when script is compiled or run.' - Top = 10 - Width = 214 - BorderSpacing.Left = 5 - BorderSpacing.Top = 10 + Top = 0 + Width = 211 Caption = 'Clear On Script Compile/Run' ParentShowHint = False ShowHint = True @@ -126,16 +119,15 @@ object SimbaOutputBoxFrame: TSimbaOutputBoxFrame AnchorSideLeft.Control = Owner AnchorSideTop.Control = FontSizeSpinEdit AnchorSideTop.Side = asrBottom - Left = 5 - Height = 23 - Top = 135 - Width = 123 + Left = 0 + Height = 20 + Top = 125 + Width = 120 AutoSize = True - BorderSpacing.Left = 5 BorderSpacing.Top = 5 BevelOuter = bvNone - ClientHeight = 23 - ClientWidth = 123 + ClientHeight = 20 + ClientWidth = 120 TabOrder = 4 object Label5: TLabel AnchorSideLeft.Control = Panel1 @@ -143,7 +135,7 @@ object SimbaOutputBoxFrame: TSimbaOutputBoxFrame AnchorSideBottom.Control = Panel1 AnchorSideBottom.Side = asrBottom Left = 0 - Height = 23 + Height = 20 Top = 0 Width = 84 Anchors = [akTop, akLeft, akBottom] @@ -158,9 +150,9 @@ object SimbaOutputBoxFrame: TSimbaOutputBoxFrame AnchorSideBottom.Control = Panel1 AnchorSideBottom.Side = asrBottom Left = 99 - Height = 23 + Height = 20 Top = 0 - Width = 24 + Width = 21 Anchors = [akTop, akLeft, akBottom] BorderSpacing.Left = 15 OnChange = AntiAliasingCheckboxChange diff --git a/Source/forms/simba.settingsform_simba_general.lfm b/Source/forms/simba.settingsform_simba_general.lfm index b9e2b4690..7b68113a2 100644 --- a/Source/forms/simba.settingsform_simba_general.lfm +++ b/Source/forms/simba.settingsform_simba_general.lfm @@ -1,15 +1,15 @@ object SimbaGeneralFrame: TSimbaGeneralFrame Left = 0 - Height = 642 + Height = 653 Top = 0 Width = 934 - ClientHeight = 642 + ClientHeight = 653 ClientWidth = 934 DesignTimePPI = 120 ParentFont = False TabOrder = 0 - DesignLeft = 1496 - DesignTop = 447 + DesignLeft = 3939 + DesignTop = 176 object ToolbarSizeTrackBar: TTrackBar AnchorSideLeft.Control = PlaceholderLabel AnchorSideLeft.Side = asrBottom @@ -18,10 +18,10 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom AnchorSideBottom.Side = asrBottom - Left = 140 + Left = 135 Height = 31 - Top = 117 - Width = 779 + Top = 107 + Width = 784 Max = 32 Min = 12 OnChange = ToolbarSizeTrackBarChange @@ -41,17 +41,16 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = FontSizeLabel AnchorSideBottom.Side = asrBottom - Left = 140 + Left = 135 Height = 31 - Top = 10 - Width = 779 + Top = 0 + Width = 784 Max = 24 Min = 8 OnChange = FontSizeTrackBarChange Position = 8 Align = alCustom Anchors = [akTop, akLeft, akRight] - BorderSpacing.Top = 10 BorderSpacing.Right = 15 TabOrder = 1 end @@ -60,13 +59,12 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideTop.Control = FontSizeTrackBar AnchorSideBottom.Control = FontSizeTrackBar AnchorSideBottom.Side = asrBottom - Left = 5 + Left = 0 Height = 31 - Top = 10 + Top = 0 Width = 60 Align = alCustom Anchors = [akTop, akLeft, akBottom] - BorderSpacing.Left = 5 Caption = 'Font Size' Layout = tlCenter ParentColor = False @@ -76,12 +74,11 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideTop.Control = ToolbarSizeTrackBar AnchorSideBottom.Control = ToolbarSizeTrackBar AnchorSideBottom.Side = asrBottom - Left = 5 + Left = 0 Height = 31 - Top = 117 + Top = 107 Width = 27 Anchors = [akTop, akLeft, akBottom] - BorderSpacing.Left = 5 Caption = 'Size' Layout = tlCenter ParentColor = False @@ -93,17 +90,17 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - Left = 140 + Left = 135 Height = 31 - Top = 264 - Width = 779 + Top = 254 + Width = 774 Max = 38 Min = 8 OnChange = DoScrollBarTrackBarChange Position = 10 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 10 - BorderSpacing.Right = 15 + BorderSpacing.Right = 25 TabOrder = 2 end object ScrollBarArrowSizeTrackBar: TTrackBar @@ -113,16 +110,16 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - Left = 140 + Left = 135 Height = 31 - Top = 305 - Width = 779 + Top = 295 + Width = 774 Min = 1 OnChange = DoScrollBarArrowTrackBarChange Position = 10 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 10 - BorderSpacing.Right = 15 + BorderSpacing.Right = 25 TabOrder = 3 end object ScrollBarSizeLabel: TLabel @@ -130,12 +127,11 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideTop.Control = ScrollBarSizeTrackBar AnchorSideBottom.Control = ScrollBarSizeTrackBar AnchorSideBottom.Side = asrBottom - Left = 5 + Left = 0 Height = 31 - Top = 264 + Top = 254 Width = 27 Anchors = [akTop, akLeft, akBottom] - BorderSpacing.Left = 5 Caption = 'Size' Layout = tlCenter ParentColor = False @@ -145,12 +141,11 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideTop.Control = ScrollBarArrowSizeTrackBar AnchorSideBottom.Control = ScrollBarArrowSizeTrackBar AnchorSideBottom.Side = asrBottom - Left = 5 + Left = 0 Height = 31 - Top = 305 + Top = 295 Width = 71 Anchors = [akTop, akLeft, akBottom] - BorderSpacing.Left = 5 Caption = 'Arrow Size' Layout = tlCenter ParentColor = False @@ -161,24 +156,21 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - Left = 5 + Left = 0 Height = 20 - Top = 234 - Width = 924 + Top = 224 + Width = 934 Caption = 'Scroll Bar' Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 5 BorderSpacing.Top = 10 - BorderSpacing.Right = 5 Style = gsHorLines end object PlaceholderLabel: TLabel AnchorSideLeft.Control = Owner - Left = 5 + Left = 0 Height = 20 Top = 600 Width = 129 - BorderSpacing.Left = 5 BorderSpacing.Right = 6 Caption = 'Image Size: Default' ParentColor = False @@ -189,24 +181,22 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - Left = 5 + Left = 0 Height = 20 - Top = 87 - Width = 924 + Top = 77 + Width = 934 Caption = 'Tool Bar' Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 5 BorderSpacing.Top = 5 - BorderSpacing.Right = 5 Style = gsHorLines end object ToolbarPositionComboBox: TComboBox AnchorSideLeft.Control = ToolbarSizeTrackBar AnchorSideTop.Control = ToolbarSizeTrackBar AnchorSideTop.Side = asrBottom - Left = 140 + Left = 135 Height = 28 - Top = 158 + Top = 148 Width = 252 BorderSpacing.Top = 10 ItemHeight = 20 @@ -225,12 +215,11 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideTop.Control = ToolbarPositionComboBox AnchorSideBottom.Control = ToolbarPositionComboBox AnchorSideBottom.Side = asrBottom - Left = 5 + Left = 0 Height = 28 - Top = 158 + Top = 148 Width = 52 Anchors = [akTop, akLeft, akBottom] - BorderSpacing.Left = 5 Caption = 'Position' Layout = tlCenter ParentColor = False @@ -241,9 +230,9 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = ToolbarPositionComboBox AnchorSideRight.Side = asrBottom - Left = 140 + Left = 135 Height = 28 - Top = 196 + Top = 186 Width = 252 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 10 @@ -256,12 +245,11 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideTop.Control = ToolbarSpacingSpinEdit AnchorSideBottom.Control = ToolbarSpacingSpinEdit AnchorSideBottom.Side = asrBottom - Left = 5 + Left = 0 Height = 28 - Top = 196 + Top = 186 Width = 53 Anchors = [akTop, akLeft, akBottom] - BorderSpacing.Left = 5 Caption = 'Spacing' Layout = tlCenter ParentColor = False @@ -271,13 +259,12 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideTop.Control = ImageSizeTrackBar AnchorSideBottom.Control = ImageSizeTrackBar AnchorSideBottom.Side = asrBottom - Left = 5 + Left = 0 Height = 31 - Top = 51 + Top = 41 Width = 73 Align = alCustom Anchors = [akTop, akLeft, akBottom] - BorderSpacing.Left = 5 Caption = 'Image Size' Layout = tlCenter ParentColor = False @@ -291,10 +278,10 @@ object SimbaGeneralFrame: TSimbaGeneralFrame AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = ImageSizeLabel AnchorSideBottom.Side = asrBottom - Left = 140 + Left = 135 Height = 31 - Top = 51 - Width = 779 + Top = 41 + Width = 784 Max = 32 Min = 15 OnChange = ImageSizeTrackBarChange diff --git a/Source/simba.settings.pas b/Source/simba.settings.pas index b9754f24d..57223f18f 100644 --- a/Source/simba.settings.pas +++ b/Source/simba.settings.pas @@ -114,9 +114,7 @@ TSimbaSettings = class RightMarginVisible: TSimbaSetting; AntiAliased: TSimbaSetting; AllowCaretPastEOL: TSimbaSetting; - IgnoreCodeToolsIDEDirective: TSimbaSetting; - AutomaticallyOpenAutoCompletion: TSimbaSetting; - AutomaticallyShowParameterHints: TSimbaSetting; + AutomaticallyCompleteBegin: TSimbaSetting; AutomaticallyCompleteParentheses: TSimbaSetting; AutomaticallyCompleteIndex: TSimbaSetting; @@ -129,6 +127,18 @@ TSimbaSettings = class FindPanelVisible: TSimbaSetting; end; + CodeTools: record + IgnoreIDEDirective: TSimbaSetting; + + CompletionOpenAutomatically: TSimbaSetting; + CompletionKey: TSimbaSetting; + CompletionKeyModifiers: TSimbaSetting; + + ParamHintOpenAutomatically: TSimbaSetting; + ParamHintKey: TSimbaSetting; + ParamHintKeyModifiers: TSimbaSetting; + end; + OutputBox: record FontName: TSimbaSetting; FontSize: TSimbaSetting; @@ -172,7 +182,7 @@ function GetSimbaSettingsFileName: String; implementation uses - Forms, SynEdit, + Forms, SynEdit, LCLType, simba.mufasatypes, simba.encoding, simba.env, simba.editor_docgenerator, simba.ide_initialization, simba.theme, simba.fonthelpers; @@ -497,10 +507,8 @@ constructor TSimbaSettings.Create; Editor.FontSize := TSimbaSetting_Integer.Create(Self, 'Editor', 'FontSize', SynDefaultFontSize); Editor.FontName := TSimbaSetting_String.Create(Self, 'Editor', 'FontName', SynDefaultFontName); Editor.AntiAliased := TSimbaSetting_Boolean.Create(Self, 'Editor', 'AntiAliased', True); - Editor.IgnoreCodeToolsIDEDirective := TSimbaSetting_Boolean.Create(Self, 'Editor', 'IgnoreCodeToolsIDEDirective', False); Editor.AllowCaretPastEOL := TSimbaSetting_Boolean.Create(Self, 'Editor', 'AllowCaretPastEOL', True); - Editor.AutomaticallyOpenAutoCompletion := TSimbaSetting_Boolean.Create(Self, 'Editor', 'AutomaticallyOpenAutoCompletion', True); - Editor.AutomaticallyShowParameterHints := TSimbaSetting_Boolean.Create(Self, 'Editor', 'AutomaticallyShowParameterHints', True); + Editor.RightMargin := TSimbaSetting_Integer.Create(Self, 'Editor', 'RightMargin', 80); Editor.RightMarginVisible := TSimbaSetting_Boolean.Create(Self, 'Editor', 'RightMarginVisible', False); Editor.DocumentationComment := TSimbaSetting_BinaryString.Create(Self, 'Editor', 'DocumentationComment', DEFAULT_DOCUMENTATION_COMMENT); @@ -513,6 +521,16 @@ constructor TSimbaSettings.Create; Editor.AutoCompleteWidth := TSimbaSetting_Integer.Create(Self, 'Editor', 'AutoCompleteWidth', 400); Editor.AutoCompleteLines := TSimbaSetting_Integer.Create(Self, 'Editor', 'AutoCompleteLines', 8); + CodeTools.IgnoreIDEDirective := TSimbaSetting_Boolean.Create(Self, 'CodeTools', 'IgnoreIDEDirective', False); + + CodeTools.CompletionOpenAutomatically := TSimbaSetting_Boolean.Create(Self, 'CodeTools', 'CompletionOpenAutomatically', True); + CodeTools.CompletionKey := TSimbaSetting_Integer.Create(Self, 'CodeTools', 'CompletionKey', VK_SPACE); + CodeTools.CompletionKeyModifiers := TSimbaSetting_Integer.Create(Self, 'CodeTools', 'CompletionKeyModifiers', Integer(TShiftState([ssCtrl]))); + + CodeTools.ParamHintOpenAutomatically := TSimbaSetting_Boolean.Create(Self, 'CodeTools', 'ParamHintOpenAutomatically', True); + CodeTools.ParamHintKey := TSimbaSetting_Integer.Create(Self, 'CodeTools', 'ParamHintKey', VK_SPACE); + CodeTools.ParamHintKeyModifiers := TSimbaSetting_Integer.Create(Self, 'CodeTools', 'ParamHintKeyModifiers', Integer(TShiftState([ssCtrl, ssShift]))); + OutputBox.FontSize := TSimbaSetting_Integer.Create(Self, 'OutputBox', 'FontSize', Editor.FontSize.DefaultValue); OutputBox.FontName := TSimbaSetting_String.Create(Self, 'OutputBox', 'FontName', Editor.FontName.DefaultValue); OutputBox.FontAntiAliased := TSimbaSetting_Boolean.Create(Self, 'OutputBox', 'FontAntiAliased', Editor.AntiAliased.DefaultValue);