StyleSelectionUnit.pas 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. {
  2. TIGCC IDE
  3. Copyright (C) 2000-2004 Sebastian Reichelt
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software Foundation,
  14. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. }
  16. unit StyleSelectionUnit;
  17. interface
  18. uses
  19. Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  20. StdCtrls, ExtCtrls;
  21. type
  22. TStyleSelectionForm = class(TForm)
  23. CheckBox1: TCheckBox;
  24. CheckBox2: TCheckBox;
  25. CheckBox3: TCheckBox;
  26. CheckBox4: TCheckBox;
  27. CheckBox5: TCheckBox;
  28. Bevel1: TBevel;
  29. Button1: TButton;
  30. Button2: TButton;
  31. procedure CheckBox1Click(Sender: TObject);
  32. procedure FormShow(Sender: TObject);
  33. procedure FormClose(Sender: TObject; var Action: TCloseAction);
  34. private
  35. public
  36. Style: TFontStyles;
  37. CustomStyle: Boolean;
  38. end;
  39. implementation
  40. {$R *.DFM}
  41. procedure TStyleSelectionForm.CheckBox1Click(Sender: TObject);
  42. begin
  43. CheckBox2.Enabled := CheckBox1.Checked;
  44. CheckBox3.Enabled := CheckBox1.Checked;
  45. CheckBox4.Enabled := CheckBox1.Checked;
  46. CheckBox5.Enabled := CheckBox1.Checked;
  47. if not CheckBox2.Enabled then
  48. CheckBox2.Checked := False;
  49. if not CheckBox3.Enabled then
  50. CheckBox3.Checked := False;
  51. if not CheckBox4.Enabled then
  52. CheckBox4.Checked := False;
  53. if not CheckBox5.Enabled then
  54. CheckBox5.Checked := False;
  55. end;
  56. procedure TStyleSelectionForm.FormShow(Sender: TObject);
  57. begin
  58. CheckBox1.Checked := CustomStyle;
  59. CheckBox2.Checked := fsBold in Style;
  60. CheckBox3.Checked := fsItalic in Style;
  61. CheckBox4.Checked := fsUnderline in Style;
  62. CheckBox5.Checked := fsStrikeOut in Style;
  63. CheckBox1Click (Sender);
  64. end;
  65. procedure TStyleSelectionForm.FormClose(Sender: TObject;
  66. var Action: TCloseAction);
  67. begin
  68. CustomStyle := CheckBox1.Checked;
  69. if CustomStyle then begin
  70. Style := [];
  71. if CheckBox2.Checked then
  72. Include (Style, fsBold);
  73. if CheckBox3.Checked then
  74. Include (Style, fsItalic);
  75. if CheckBox4.Checked then
  76. Include (Style, fsUnderline);
  77. if CheckBox5.Checked then
  78. Include (Style, fsStrikeOut);
  79. end;
  80. end;
  81. end.