home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / PIEREG.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-17  |  2.3 KB  |  106 lines

  1. #include <SysUtils.hpp>
  2. #include "piereg.h"
  3.  
  4. #pragma resource "*.dfm"
  5.  
  6. // TAngleEditorDlg
  7.  
  8. void __fastcall TAngleEditorDlg::STrackBarChange(TObject* Sender)
  9. {
  10.   SetStartAngle(STrackBar->Position);
  11. }
  12.  
  13. void __fastcall TAngleEditorDlg::ETrackBarChange(TObject* Sender)
  14. {
  15.   SetEndAngle(ETrackBar->Position);
  16. }
  17.  
  18. void __fastcall TAngleEditorDlg::SetStartAngle(Integer Value)
  19. {
  20.   STrackBar.Position = Value;
  21.   SAngleLabel->Caption = "StartAngle = " + IntToStr(Value)
  22.   FAngles->StartAngle = Value;
  23. }
  24.  
  25. void __fastcall TAngleEditorDlg::SetEndAngle(Integer Value)
  26. {
  27.   ETrackBar.Position = Value;
  28.   EAngleLabel->Caption = "EndAngle = " + IntToStr(Value);
  29.   FAngles->EndAngle = Value;
  30. }
  31.  
  32. void __fastcall TAngleEditorDlg::SetAngles(TAngles Value)
  33. {
  34.   FAngles = Value;
  35.   FOrigStart = Value.StartAngle;
  36.   FOrigEnd = Value.EndAngle;
  37.   SetStartAngle(Value.StartAngle);
  38.   SetEndAngle(Value.EndAngle);
  39. }
  40.  
  41. void __fastcall TAngleEditorDlg::CancelClick(TObject* Sender)
  42. {
  43.   SetStartAngle(FOrigStart);
  44.   SetEndAngle(FOrigEnd);
  45. }
  46.  
  47. // TAnglesProperty
  48.  
  49. void __fastcall TAnglesProperty::Edit()
  50. {
  51.   TAngles Angles;
  52.   TAngleEditorDlg* AngleEditor;
  53.   Angles = new TAngles(GetOrdValue);
  54.   AngleEditor = new TAngleEditorDlg(Application);
  55.   try {
  56.     AngleEditor->EditorAngles = Angles;
  57.     AngleEditor->ShowModal;
  58.   }
  59.   finally
  60.     AngleEditor->Free;
  61. }
  62.  
  63. TPropertyAttributes TAnglesProperty::GetAttributes()
  64. {
  65.   Result = [paDialog, paSubProperties];
  66. }
  67.  
  68. //TPieEditor
  69.  
  70. void __fastcall TPieEditor::EditProperty(TPropertyEditor* PropertyEditor,
  71.                                          Boolean Continue,
  72.                                          Boolean FreeEditor)
  73. {
  74.   String PropName;
  75.   PropName = PropertyEditor->GetName;
  76.   if (CompareText(PropName, "ANGLES") = 0){
  77.     PropertyEditor->Edit;
  78.     Continue = False;
  79.   }
  80. }
  81.  
  82. Integer TPieEditor::GetVerbCount()
  83. {
  84.   Result = 1;
  85. }
  86.  
  87. String TPieEditor::GetVerb(Integer Index)
  88. {
  89.   if Index = 0 {
  90.     Result = "Edit Angles"
  91.   else Result = "";
  92. }
  93.  
  94. void __fastcall TPieEditor::ExecuteVerb(Integer Index)
  95. {
  96.   if (Index = 0)  Edit;
  97. }
  98.  
  99. void __fastcall Register()
  100. {
  101.   RegisterComponents("Samples",[TPie]);
  102.   RegisterComponentEditor(TPie, TPieEditor);
  103.   RegisterPropertyEditor(TypeInfo(TAngles), NULL, "", TAnglesProperty);
  104. }
  105.  
  106.