FunctionsWinUnit.pas 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. unit FunctionsWinUnit;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  5. StdCtrls, SourceFileUnit;
  6. type
  7. TFunctionsForm = class(TForm)
  8. FuncList: TListBox;
  9. PrototypeButton: TButton;
  10. ImplementationButton: TButton;
  11. CancelButton: TButton;
  12. procedure FuncListDblClick(Sender: TObject);
  13. procedure FuncListClick(Sender: TObject);
  14. procedure FuncListMouseDown(Sender: TObject; Button: TMouseButton;
  15. Shift: TShiftState; X, Y: Integer);
  16. private
  17. public
  18. Funcs: PSourceFileFunctions;
  19. end;
  20. implementation
  21. {$R *.DFM}
  22. procedure TFunctionsForm.FuncListDblClick(Sender: TObject);
  23. begin
  24. if ImplementationButton.Enabled then
  25. ModalResult := mrNo
  26. else if PrototypeButton.Enabled then
  27. ModalResult := mrYes;
  28. end;
  29. procedure TFunctionsForm.FuncListClick(Sender: TObject);
  30. begin
  31. PrototypeButton.Enabled := (FuncList.ItemIndex >= 0) and (Funcs^[Integer(FuncList.Items.Objects[FuncList.ItemIndex])].PrototypeLine > 0);
  32. ImplementationButton.Enabled := (FuncList.ItemIndex >= 0) and (Funcs^[Integer(FuncList.Items.Objects[FuncList.ItemIndex])].ImplementationLine > 0);
  33. end;
  34. procedure TFunctionsForm.FuncListMouseDown(Sender: TObject;
  35. Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  36. begin
  37. FuncListClick (Sender);
  38. end;
  39. end.