IDE.OptionsForm.pas 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. unit IDE.OptionsForm;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2024 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. GroupBox2: TGroupBox;
  20. AssocButton: TButton;
  21. StartupCheck: TCheckBox;
  22. WizardCheck: TCheckBox;
  23. GroupBox3: TGroupBox;
  24. ChangeFontButton: TButton;
  25. FontPanel: TPanel;
  26. Label1: TNewStaticText;
  27. FontDialog: TFontDialog;
  28. UseSynHighCheck: TCheckBox;
  29. FullPathCheck: TCheckBox;
  30. CursorPastEOLCheck: TCheckBox;
  31. UndoAfterSaveCheck: TCheckBox;
  32. TabWidthEdit: TEdit;
  33. Label2: TNewStaticText;
  34. PauseOnDebuggerExceptionsCheck: TCheckBox;
  35. RunAsDifferentUserCheck: TCheckBox;
  36. AutosaveCheck: TCheckBox;
  37. UseFoldingCheck: TCheckBox;
  38. AutoIndentCheck: TCheckBox;
  39. IndentationGuidesCheck: TCheckBox;
  40. UseTabCharacterCheck: TCheckBox;
  41. AutoAutoCompleteCheck: TCheckBox;
  42. UnderlineErrorsCheck: TCheckBox;
  43. GutterLineNumbersCheck: TCheckBox;
  44. ColorizeCompilerOutputCheck: TCheckBox;
  45. Label3: TNewStaticText;
  46. KeyMappingComboBox: TComboBox;
  47. Label4: TNewStaticText;
  48. ThemeComboBox: TComboBox;
  49. OpenIncludedFilesCheck: TCheckBox;
  50. ShowPreprocessorOutputCheck: TCheckBox;
  51. HighlightWordAtCursorOccurrencesCheck: TCheckBox;
  52. HighlightSelTextOccurrencesCheck: TCheckBox;
  53. Label5: TNewStaticText;
  54. MemoKeyMappingComboBox: TComboBox;
  55. ShowWhiteSpaceCheck: TCheckBox;
  56. procedure AssocButtonClick(Sender: TObject);
  57. procedure ChangeFontButtonClick(Sender: TObject);
  58. procedure FormCreate(Sender: TObject);
  59. procedure TabWidthEditChange(Sender: TObject);
  60. procedure FormShow(Sender: TObject);
  61. private
  62. class var
  63. FDropDownMemoKeyMappingComboBoxOnNextShow: Boolean;
  64. var
  65. {}
  66. public
  67. class property DropDownMemoKeyMappingComboBoxOnNextShow: Boolean write FDropDownMemoKeyMappingComboBoxOnNextShow;
  68. end;
  69. implementation
  70. uses
  71. Shared.CommonFunc.Vcl, Shared.CommonFunc, IDE.HelperFunc, IDE.FileAssocFunc;
  72. {$R *.DFM}
  73. procedure TOptionsForm.FormCreate(Sender: TObject);
  74. begin
  75. InitFormFont(Self);
  76. { Order must match CompFunc.TKeyMappingType }
  77. KeyMappingComboBox.Items.Add('Classic');
  78. KeyMappingComboBox.Items.Add('Visual Studio / Visual Studio Code');
  79. { Order must match TIDEScintKeyMappingType }
  80. MemoKeyMappingComboBox.Items.Add('Classic / Visual Studio');
  81. MemoKeyMappingComboBox.Items.Add('Visual Studio Code');
  82. { Order must match TThemeType }
  83. ThemeComboBox.Items.Add('Light');
  84. ThemeComboBox.Items.Add('Dark');
  85. ThemeComboBox.Items.Add('Classic');
  86. end;
  87. procedure TOptionsForm.FormShow(Sender: TObject);
  88. begin
  89. if FDropDownMemoKeyMappingComboBoxOnNextShow then begin
  90. ActiveControl := MemoKeyMappingComboBox;
  91. MemoKeyMappingComboBox.DroppedDown := True;
  92. FDropDownMemoKeyMappingComboBoxOnNextShow := False;
  93. end;
  94. end;
  95. procedure TOptionsForm.AssocButtonClick(Sender: TObject);
  96. const
  97. UserStrings: array [Boolean] of String = ('the current user', 'all users');
  98. var
  99. AllUsers: Boolean;
  100. begin
  101. if RegisterISSFileAssociation(True, AllUsers) then
  102. MsgBox('The .iss extension was successfully associated for ' + UserStrings[AllUsers] + ' with:'#13#10 + NewParamStr(0),
  103. 'Associate', mbInformation, MB_OK);
  104. end;
  105. procedure TOptionsForm.ChangeFontButtonClick(Sender: TObject);
  106. begin
  107. FontDialog.Font.Assign(FontPanel.Font);
  108. if FontDialog.Execute then
  109. FontPanel.Font.Assign(FontDialog.Font);
  110. end;
  111. procedure TOptionsForm.TabWidthEditChange(Sender: TObject);
  112. begin
  113. OKButton.Enabled := StrToIntDef(TabWidthEdit.Text, 0) > 0;
  114. end;
  115. end.