DSEditors.pas 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. (*********************************************************************
  2. * DSPack 2.3.3 *
  3. * *
  4. * home page : http://www.progdigy.com *
  5. * email : hgourvest@progdigy.com *
  6. * Thanks to Michael Andersen. (DSVideoWindowEx) *
  7. * *
  8. * date : 21-02-2003 *
  9. * *
  10. * The contents of this file are used with permission, subject to *
  11. * the Mozilla Public License Version 1.1 (the "License"); you may *
  12. * not use this file except in compliance with the License. You may *
  13. * obtain a copy of the License at *
  14. * http://www.mozilla.org/MPL/MPL-1.1.html *
  15. * *
  16. * Software distributed under the License is distributed on an *
  17. * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or *
  18. * implied. See the License for the specific language governing *
  19. * rights and limitations under the License. *
  20. * *
  21. *********************************************************************)
  22. unit DSEditors;
  23. {$IFDEF VER150}
  24. {$WARN UNSAFE_CODE OFF}
  25. {$WARN UNSAFE_TYPE OFF}
  26. {$WARN UNSAFE_CAST OFF}
  27. {$ENDIF}
  28. interface
  29. uses
  30. {$IFDEF VER140} DesignIntf, DesignEditors, {$ELSE}
  31. {$IFDEF VER150} DesignIntf, DesignEditors, {$ELSE}
  32. DsgnIntf, {$ENDIF} {$ENDIF}
  33. Forms, Controls, DSUtil, DSPack;
  34. type
  35. // *****************************************************************************
  36. // TMediaTypePropertyClass
  37. // *****************************************************************************
  38. TMediaTypePropertyClass = class(TClassProperty)
  39. public
  40. procedure Edit; override;
  41. function GetAttributes: TPropertyAttributes; override;
  42. end;
  43. // *****************************************************************************
  44. // TBaseFilterPropertyClass
  45. // *****************************************************************************
  46. TBaseFilterPropertyClass = class(TClassProperty)
  47. public
  48. procedure Edit; override;
  49. function GetAttributes: TPropertyAttributes; override;
  50. end;
  51. procedure Register;
  52. implementation
  53. uses MediaTypeEditor, BaseFilterEditor, Classes;
  54. // *****************************************************************************
  55. // TMediaTypePropertyClass
  56. // *****************************************************************************
  57. procedure TMediaTypePropertyClass.Edit;
  58. var
  59. Dlg: TFormMediaType;
  60. begin
  61. Dlg := TFormMediaType.create(Application);
  62. try
  63. Dlg.MediaType.Assign(TMediaType(GetOrdValue));
  64. if Dlg.ShowModal = mrOk then
  65. begin
  66. TMediaType(GetOrdValue).Assign(Dlg.MediaType);
  67. if (GetComponent(0) is TSampleGrabber) then
  68. IFilter(GetComponent(0) as TSampleGrabber).NotifyFilter(foRefresh);
  69. Modified;
  70. end;
  71. finally
  72. Dlg.Free;
  73. end;
  74. end;
  75. function TMediaTypePropertyClass.GetAttributes: TPropertyAttributes;
  76. begin
  77. Result := [paDialog];
  78. end;
  79. // *****************************************************************************
  80. // TBaseFilterPropertyClass
  81. // *****************************************************************************
  82. procedure TBaseFilterPropertyClass.Edit;
  83. var
  84. Dlg: TFormBaseFilter;
  85. begin
  86. Dlg := TFormBaseFilter.create(Application);
  87. try
  88. Dlg.Filter.BaseFilter.Assign(TBaseFilter(GetOrdValue));
  89. if Dlg.ShowModal = mrOk then
  90. begin
  91. TBaseFilter(GetOrdValue).Assign(Dlg.Filter.BaseFilter);
  92. if (GetComponent(0) is TFilter) then
  93. IFilter(GetComponent(0) as TFilter).NotifyFilter(foRefresh);
  94. Modified;
  95. end;
  96. finally
  97. Dlg.Free;
  98. end;
  99. end;
  100. function TBaseFilterPropertyClass.GetAttributes: TPropertyAttributes;
  101. begin
  102. Result := [paDialog];
  103. end;
  104. procedure Register;
  105. begin
  106. RegisterComponents('DSPack', [TFilterGraph, TVideoWindow, TSampleGrabber,
  107. TFilter, TASFWriter, TDSTrackBar, TDSVideoWindowEx2]);
  108. RegisterPropertyEditor(TypeInfo(TMediaType), nil, '', TMediaTypePropertyClass);
  109. RegisterPropertyEditor(TypeInfo(TBaseFilter), nil, '', TBaseFilterPropertyClass);
  110. end;
  111. end.