📄 basefiltereditor.pas
字号:
procedure TFormBaseFilter.PopupMenuPopup(Sender: TObject);
var
AFilter: IBaseFilter;
begin
PopupMenu.Items.Items[0].Enabled := false;
PopupMenu.Items.Items[1].Items[0].Enabled := false;
PopupMenu.Items.Items[1].Items[1].Enabled := false;
PopupMenu.Items.Items[1].Items[2].Enabled := false;
PopupMenu.Items.Items[2].Items[0].Enabled := false;
PopupMenu.Items.Items[2].Items[1].Enabled := false;
If (Filters.Selected = Nil) or (Filters.Selected.Level = 0) then Abort;
Filter.QueryInterface(IBaseFilter, AFilter);
if HaveFilterPropertyPage(AFilter, ppDefault) then PopupMenu.Items.Items[0].Enabled := true;
if HaveFilterPropertyPage(AFilter, ppVFWCapFormat) then PopupMenu.Items.Items[1].Items[0].Enabled := true;
if HaveFilterPropertyPage(AFilter, ppVFWCapSource) then PopupMenu.Items.Items[1].Items[1].Enabled := true;
if HaveFilterPropertyPage(AFilter, ppVFWCapDisplay) then PopupMenu.Items.Items[1].Items[2].Enabled := true;
if HaveFilterPropertyPage(AFilter, ppVFWCompConfig) then PopupMenu.Items.Items[2].Items[0].Enabled := true;
if HaveFilterPropertyPage(AFilter, ppVFWCompAbout) then PopupMenu.Items.Items[2].Items[1].Enabled := true;
AFilter := nil;
end;
procedure TFormBaseFilter.PropertyPageClick(Sender: TObject);
var AFilter: IBaseFilter;
begin
Filter.QueryInterface(IBaseFilter, AFilter);
ShowFilterPropertyPage(Self.Handle, AFilter, ppDefault);
AFilter := nil;
end;
procedure TFormBaseFilter.PinMenuPopup(Sender: TObject);
begin
If PageControl1.ActivePageIndex = 0 then
Begin
if Pins.ItemIndex = -1 then abort;
End
else
if Pins1.ItemIndex = -1 then abort;
end;
procedure TFormBaseFilter.PinPropertyClick(Sender: TObject);
begin
If PageControl1.ActivePageIndex = 0 then
ShowPinPropertyPage(Self.Handle, PinList.Items[Pins.ItemIndex])
else
ShowPinPropertyPage(Self.Handle, PinList.Items[Pins1.ItemIndex]);
end;
procedure TFormBaseFilter.PinsSheetShow(Sender: TObject);
begin
Pins1.Items := Pins.Items;
end;
procedure TFormBaseFilter.Pins1Click(Sender: TObject);
var
i: integer;
unk: IUnknown;
EnumMT : TEnumMediaType;
begin
PinInterfaces.Clear;
if Pins1.ItemIndex <> -1 then
try
with PinList.Items[Pins1.ItemIndex] do
for i := 0 to length(DSItfs)-1 do
if Succeeded(QueryInterface(DSItfs[i].itf, unk)) then
PinInterfaces.Items.Add(DSItfs[i].name);
finally
unk := nil;
end;
MediaTypes.Clear;
if Pins1.ItemIndex <> -1 then
begin
EnumMT:= TEnumMediaType.Create(PinList.Items[Pins1.ItemIndex]);
try
if EnumMT.Count > 0 then
for i := 0 to EnumMT.Count - 1 do
MediaTypes.Items.Add(EnumMt.MediaDescription[i]);
finally
EnumMT.Free;
end;
end;
end;
procedure TFormBaseFilter.VFWFormatClick(Sender: TObject);
var AFilter: IBaseFilter;
begin
Filter.QueryInterface(IBaseFilter, AFilter);
ShowFilterPropertyPage(Self.Handle, AFilter, ppVFWCapFormat);
AFilter := nil;
end;
procedure TFormBaseFilter.VFWSourceClick(Sender: TObject);
var AFilter: IBaseFilter;
begin
Filter.QueryInterface(IBaseFilter, AFilter);
ShowFilterPropertyPage(Self.Handle, AFilter , ppVFWCapSource);
AFilter := nil;
end;
procedure TFormBaseFilter.VFWDisplayClick(Sender: TObject);
var AFilter: IBaseFilter;
begin
Filter.QueryInterface(IBaseFilter, AFilter);
ShowFilterPropertyPage(Self.Handle, AFilter, ppVFWCapDisplay);
AFilter := nil;
end;
procedure TFormBaseFilter.Config1Click(Sender: TObject);
var AFilter: IBaseFilter;
begin
Filter.QueryInterface(IBaseFilter, AFilter);
ShowFilterPropertyPage(Self.Handle, AFilter, ppVFWCompConfig);
AFilter := nil;
end;
procedure TFormBaseFilter.VFWAboutClick(Sender: TObject);
var AFilter: IBaseFilter;
begin
Filter.QueryInterface(IBaseFilter, AFilter);
ShowFilterPropertyPage(Self.Handle, AFilter, ppVFWCompAbout);
AFilter := nil;
end;
procedure TFormBaseFilter.InterfacesDblClick(Sender: TObject);
var
AFilter: IBaseFilter;
begin
Filter.QueryInterface(IBaseFilter, AFilter);
if Interfaces.ItemIndex <> -1 then
if Interfaces.Items.Strings[Interfaces.ItemIndex] = 'ISpecifyPropertyPages' then
ShowFilterPropertyPage(Self.Handle, AFilter);
AFilter := nil;
end;
procedure TFormBaseFilter.PinInterfacesDblClick(Sender: TObject);
begin
if PinInterfaces.ItemIndex <> -1 then
if PinInterfaces.Items.Strings[PinInterfaces.ItemIndex] = 'ISpecifyPropertyPages' then
ShowPinPropertyPage(Self.Handle, PinList.Items[Pins1.ItemIndex]);
end;
procedure TFormBaseFilter.PinsDrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
Bitmap: TBitmap; { temporary variable for the item抯 bitmap }
Offset: Integer; { text offset width }
begin
with (Control as TListBox).Canvas do { draw on control canvas, not on the form }
begin
Brush.Color := (Control as TListBox).Color;
Brush.Style := bsSolid;
FillRect(Rect); { clear the rectangle }
Offset := 2; { provide default offset }
Bitmap := TBitmap((Control as TListBox).Items.Objects[Index]); { get the bitmap }
if Bitmap <> nil then
begin
BrushCopy(Bounds(Rect.Left + Offset, Rect.Top, Bitmap.Width, Bitmap.Height),
Bitmap, Bounds(0, 0, Bitmap.Width, Bitmap.Height), clOlive); {render bitmap}
Offset := Bitmap.width + 6; { add four pixels between bitmap and text}
end;
If odSelected in State then
Brush.Color := clHighLight;
TextOut(Rect.Left + Offset, Rect.Top, (Control as TListBox).Items[Index]); { display the text }
If odFocused in state then
Begin
Drawfocusrect(Rect);
Drawfocusrect(Bounds(Rect.Left + Offset, Rect.Top, TextWidth((Control as TListBox).Items[Index])+1, Rect.Bottom - Rect.Top));
End;
end;
end;
procedure TFormBaseFilter.FiltersChange(Sender: TObject;
Node: TTreeNode);
var
NodeItem : pNodeItem;
Tmp : pWidechar;
begin
if Node = nil then Exit;
Interfaces.Items.BeginUpdate;
Interfaces.Items.Clear;
Pins.Items.BeginUpdate;
Pins.Items.Clear;
MonikerTag.Clear;
Try
if Node.Level = 1 then
begin
NodeItem := pNodeItem(Node.Parent.Data);
If NodeItem = nil then exit;
SysDevEnum.SelectIndexCategory(NodeItem^.Index);
NodeItem := pNodeItem(Node.Data);
SysDevEnum.GetMoniker(NodeItem^.Index).GetDisplayName(nil, nil, Tmp);
MonikerTag.Text := Tmp;
Filter.BaseFilter.Moniker := SysDevEnum.GetMoniker(NodeItem^.Index);
IFilter(Filter).NotifyFilter(foRefresh);
GetFilterInfo;
end;
finally
Interfaces.Items.EndUpdate;
Pins.Items.EndUpdate;
end;
end;
procedure TFormBaseFilter.PinsMeasureItem(Control: TWinControl;
Index: Integer; var Height: Integer);
begin
(Control as TListBox).Canvas.Font := (Control as TListBox).Font;
If Height < (Control as TListBox).Canvas.TextHeight((Control as TListBox).Items[Index]) then
Height := (Control as TListBox).Canvas.TextHeight((Control as TListBox).Items[Index]);
end;
procedure TFormBaseFilter.FiltersDblClick(Sender: TObject);
begin
If Filters.Selected = nil then Exit;
If Filters.Selected.Level = 1 then btok.Click;
end;
procedure TFormBaseFilter.FiltersCustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
var
NodeItem : pNodeItem;
begin
Filters.Canvas.Font.Color := FilterColors[0];
if Node = nil then Exit;
if Node.Level < 1 then exit;
NodeItem := pNodeItem(Node.Data);
Filters.Canvas.Font.Color := NodeItem^.Color;
end;
procedure TFormBaseFilter.InfoBtnClick(Sender: TObject);
begin
PageControl1.ActivePageIndex := 2;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -