home *** CD-ROM | disk | FTP | other *** search
- #include <SysUtils.hpp>
- #include "piereg.h"
-
- #pragma resource "*.dfm"
-
- // TAngleEditorDlg
-
- void __fastcall TAngleEditorDlg::STrackBarChange(TObject* Sender)
- {
- SetStartAngle(STrackBar->Position);
- }
-
- void __fastcall TAngleEditorDlg::ETrackBarChange(TObject* Sender)
- {
- SetEndAngle(ETrackBar->Position);
- }
-
- void __fastcall TAngleEditorDlg::SetStartAngle(Integer Value)
- {
- STrackBar.Position = Value;
- SAngleLabel->Caption = "StartAngle = " + IntToStr(Value)
- FAngles->StartAngle = Value;
- }
-
- void __fastcall TAngleEditorDlg::SetEndAngle(Integer Value)
- {
- ETrackBar.Position = Value;
- EAngleLabel->Caption = "EndAngle = " + IntToStr(Value);
- FAngles->EndAngle = Value;
- }
-
- void __fastcall TAngleEditorDlg::SetAngles(TAngles Value)
- {
- FAngles = Value;
- FOrigStart = Value.StartAngle;
- FOrigEnd = Value.EndAngle;
- SetStartAngle(Value.StartAngle);
- SetEndAngle(Value.EndAngle);
- }
-
- void __fastcall TAngleEditorDlg::CancelClick(TObject* Sender)
- {
- SetStartAngle(FOrigStart);
- SetEndAngle(FOrigEnd);
- }
-
- // TAnglesProperty
-
- void __fastcall TAnglesProperty::Edit()
- {
- TAngles Angles;
- TAngleEditorDlg* AngleEditor;
- Angles = new TAngles(GetOrdValue);
- AngleEditor = new TAngleEditorDlg(Application);
- try {
- AngleEditor->EditorAngles = Angles;
- AngleEditor->ShowModal;
- }
- finally
- AngleEditor->Free;
- }
-
- TPropertyAttributes TAnglesProperty::GetAttributes()
- {
- Result = [paDialog, paSubProperties];
- }
-
- //TPieEditor
-
- void __fastcall TPieEditor::EditProperty(TPropertyEditor* PropertyEditor,
- Boolean Continue,
- Boolean FreeEditor)
- {
- String PropName;
- PropName = PropertyEditor->GetName;
- if (CompareText(PropName, "ANGLES") = 0){
- PropertyEditor->Edit;
- Continue = False;
- }
- }
-
- Integer TPieEditor::GetVerbCount()
- {
- Result = 1;
- }
-
- String TPieEditor::GetVerb(Integer Index)
- {
- if Index = 0 {
- Result = "Edit Angles"
- else Result = "";
- }
-
- void __fastcall TPieEditor::ExecuteVerb(Integer Index)
- {
- if (Index = 0) Edit;
- }
-
- void __fastcall Register()
- {
- RegisterComponents("Samples",[TPie]);
- RegisterComponentEditor(TPie, TPieEditor);
- RegisterPropertyEditor(TypeInfo(TAngles), NULL, "", TAnglesProperty);
- }
-
-