IDE.OptionsForm.pas 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. unit IDE.OptionsForm;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2025 Jordan Russell
  5. Portions by Martijn Laan
  6. For conditions of distribution and use, see LICENSE.TXT.
  7. Compiler IDE Options form
  8. }
  9. interface
  10. uses
  11. Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  12. UIStateForm, StdCtrls, ExtCtrls, NewStaticText;
  13. type
  14. TOptionsForm = class(TUIStateForm)
  15. OKButton: TButton;
  16. CancelButton: TButton;
  17. GroupBox1: TGroupBox;
  18. BackupCheck: TCheckBox;
  19. AssocButton: TButton;
  20. StartupCheck: TCheckBox;
  21. WizardCheck: TCheckBox;
  22. GroupBox3: TGroupBox;
  23. ChangeFontButton: TButton;
  24. FontPanel: TPanel;
  25. Label1: TNewStaticText;
  26. FontDialog: TFontDialog;
  27. UseSynHighCheck: TCheckBox;
  28. FullPathCheck: TCheckBox;
  29. CursorPastEOLCheck: TCheckBox;
  30. UndoAfterSaveCheck: TCheckBox;
  31. TabWidthEdit: TEdit;
  32. Label2: TNewStaticText;
  33. PauseOnDebuggerExceptionsCheck: TCheckBox;
  34. RunAsDifferentUserCheck: TCheckBox;
  35. AutosaveCheck: TCheckBox;
  36. UseFoldingCheck: TCheckBox;
  37. AutoIndentCheck: TCheckBox;
  38. IndentationGuidesCheck: TCheckBox;
  39. UseTabCharacterCheck: TCheckBox;
  40. AutoAutoCompleteCheck: TCheckBox;
  41. UnderlineErrorsCheck: TCheckBox;
  42. GutterLineNumbersCheck: TCheckBox;
  43. ColorizeCompilerOutputCheck: TCheckBox;
  44. Label3: TNewStaticText;
  45. KeyMappingComboBox: TComboBox;
  46. Label4: TNewStaticText;
  47. ThemeComboBox: TComboBox;
  48. OpenIncludedFilesCheck: TCheckBox;
  49. ShowPreprocessorOutputCheck: TCheckBox;
  50. HighlightWordAtCursorOccurrencesCheck: TCheckBox;
  51. HighlightSelTextOccurrencesCheck: TCheckBox;
  52. Label5: TNewStaticText;
  53. MemoKeyMappingComboBox: TComboBox;
  54. ShowWhiteSpaceCheck: TCheckBox;
  55. AutoreloadCheck: TCheckBox;
  56. UndoAfterReloadCheck: TCheckBox;
  57. AutoHideNewIncludedFilesCheck: TCheckBox;
  58. SmartHomeCheck: TCheckBox;
  59. procedure AssocButtonClick(Sender: TObject);
  60. procedure ChangeFontButtonClick(Sender: TObject);
  61. procedure FormCreate(Sender: TObject);
  62. procedure TabWidthEditChange(Sender: TObject);
  63. procedure FormShow(Sender: TObject);
  64. private
  65. class var
  66. FDropDownMemoKeyMappingComboBoxOnNextShow: Boolean;
  67. var
  68. {}
  69. public
  70. class property DropDownMemoKeyMappingComboBoxOnNextShow: Boolean write FDropDownMemoKeyMappingComboBoxOnNextShow;
  71. end;
  72. implementation
  73. uses
  74. Shared.CommonFunc.Vcl, Shared.CommonFunc, IDE.HelperFunc, IDE.FileAssocFunc;
  75. {$R *.DFM}
  76. procedure TOptionsForm.FormCreate(Sender: TObject);
  77. begin
  78. InitFormFont(Self);
  79. InitFormTheme(Self);
  80. { Order must match CompFunc.TKeyMappingType }
  81. KeyMappingComboBox.Items.Add('Classic');
  82. KeyMappingComboBox.Items.Add('Visual Studio / Visual Studio Code');
  83. { Order must match TIDEScintKeyMappingType }
  84. MemoKeyMappingComboBox.Items.Add('Classic / Visual Studio');
  85. MemoKeyMappingComboBox.Items.Add('Visual Studio Code');
  86. { Order must match TThemeType }
  87. ThemeComboBox.Items.Add('Light');
  88. ThemeComboBox.Items.Add('Dark');
  89. ThemeComboBox.Items.Add('Classic');
  90. end;
  91. procedure TOptionsForm.FormShow(Sender: TObject);
  92. begin
  93. if FDropDownMemoKeyMappingComboBoxOnNextShow then begin
  94. ActiveControl := MemoKeyMappingComboBox;
  95. MemoKeyMappingComboBox.DroppedDown := True;
  96. FDropDownMemoKeyMappingComboBoxOnNextShow := False;
  97. end;
  98. end;
  99. procedure TOptionsForm.AssocButtonClick(Sender: TObject);
  100. const
  101. UserStrings: array [Boolean] of String = ('the current user', 'all users');
  102. var
  103. AllUsers: Boolean;
  104. begin
  105. if RegisterISSFileAssociation(True, AllUsers) then
  106. MsgBox('The .iss extension was successfully associated for ' + UserStrings[AllUsers] + ' with:'#13#10 + NewParamStr(0),
  107. 'Associate', mbInformation, MB_OK);
  108. end;
  109. procedure TOptionsForm.ChangeFontButtonClick(Sender: TObject);
  110. begin
  111. FontDialog.Font.Assign(FontPanel.Font);
  112. if FontDialog.Execute then
  113. FontPanel.Font.Assign(FontDialog.Font);
  114. end;
  115. procedure TOptionsForm.TabWidthEditChange(Sender: TObject);
  116. begin
  117. OKButton.Enabled := StrToIntDef(TabWidthEdit.Text, 0) > 0;
  118. end;
  119. end.