Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4 | daniel-mar | 1 | { |
2 | SXMedia Components - Beta 1 |
||
3 | -------------------------------- |
||
4 | Copyright 1999 Dean Ellis |
||
5 | http://www.sillex.freeserve.co.uk |
||
6 | |||
7 | This unit is part of the SXMedia Component Set. This code is |
||
8 | supplied as is with no guarantees and must be used at your own |
||
9 | risk. |
||
10 | |||
11 | No modifications to this code must be made without the express |
||
12 | permission of the author. Please report any problems to |
||
13 | support@sillex.freeserve.co.uk |
||
14 | |||
15 | You may use these components to create any freeware/shareware |
||
16 | applications that you wish. If the components are to be used in |
||
17 | a commercail product then credit for developement of these components |
||
18 | should be given. |
||
19 | |||
20 | Credits : |
||
21 | |||
22 | Developer : Dean Ellis |
||
23 | } |
||
24 | unit SXEditor; |
||
25 | |||
26 | {$INCLUDE DelphiXcfg.inc} |
||
27 | |||
28 | interface |
||
29 | |||
30 | uses Windows, Classes, |
||
31 | {$IfNDef VER6UP} DsgnIntf, {$Else} Designintf, DesignEditors, {$EndIf} |
||
32 | Dialogs, SXMovie, SXModPlayer, SXEngine, SXAbout; |
||
33 | |||
34 | const |
||
35 | |||
36 | SXMOVIE_FILTER = 'All Media Files|*.avi;*.mpg;*.mov|' + |
||
37 | 'AVI (*.avi)|*.avi|MPG (*.mpg)|*.mpg|MOV (*.mov)|*.mov'; |
||
38 | SXMODPLAYER_FILTER = 'All Media Files|*.mod;*.it;*.sm3|' + |
||
39 | 'Impulse Tracker (*.it)|*.it|Scream Tracker (*.s3m)|*.s3m|Fast Tracker (*.xm)|*.xm'; |
||
40 | |||
41 | type |
||
42 | |||
43 | TFilenameProperty = class(TPropertyEditor) |
||
44 | function GetAttributes : TPropertyAttributes; override; |
||
45 | function GetValue : string; override; |
||
46 | procedure SetValue(const Value : string); override; |
||
47 | procedure Edit; override; |
||
48 | end; |
||
49 | |||
50 | TSXComponentEditor = class(TComponentEditor) |
||
51 | procedure ExecuteVerb(Index: Integer); override; |
||
52 | function GetVerb(Index: Integer): string; override; |
||
53 | function GetVerbCount: Integer; override; |
||
54 | end; |
||
55 | |||
56 | implementation |
||
57 | |||
58 | {--------------------------------------} |
||
59 | { TFilename Property Editor } |
||
60 | {--------------------------------------} |
||
61 | procedure TFilenameProperty.Edit; |
||
62 | var |
||
63 | Dialog : TOpenDialog; |
||
64 | begin |
||
65 | Dialog := TOpenDialog.Create(nil); |
||
66 | with Dialog do |
||
67 | try |
||
68 | DefaultExt := 'All Media Files'; |
||
69 | if GetComponent(0) is TSXMovie then |
||
70 | Filter := SXMOVIE_FILTER |
||
71 | else |
||
72 | if GetComponent(0) is TSXModPlayer then |
||
73 | Filter := SXMODPLAYER_FILTER |
||
74 | else |
||
75 | Exit; |
||
76 | if Dialog.Execute then |
||
77 | begin |
||
78 | SetStrValue(Dialog.FileName); |
||
79 | Designer.Modified; |
||
80 | end; |
||
81 | finally |
||
82 | Free; |
||
83 | end; |
||
84 | end; |
||
85 | |||
86 | function TFilenameProperty.GetAttributes: TPropertyAttributes; |
||
87 | begin |
||
88 | Result := [paDialog]; |
||
89 | end; |
||
90 | |||
91 | function TFilenameProperty.GetValue : string; |
||
92 | begin |
||
93 | Result := GetStrValue; |
||
94 | end; |
||
95 | |||
96 | procedure TFilenameProperty.SetValue(const Value : string); |
||
97 | begin |
||
98 | SetStrValue(Value); |
||
99 | Designer.Modified; |
||
100 | end; |
||
101 | |||
102 | procedure TSXComponentEditor.ExecuteVerb(Index: Integer); |
||
103 | begin |
||
104 | with TAboutBox.Create(nil) do |
||
105 | begin |
||
106 | try |
||
107 | ShowModal; |
||
108 | finally |
||
109 | Free; |
||
110 | end; |
||
111 | end; |
||
112 | end; |
||
113 | function TSXComponentEditor.GetVerb(Index: Integer): string; |
||
114 | begin |
||
115 | Result := 'A&bout SXMedia'; |
||
116 | end; |
||
117 | function TSXComponentEditor.GetVerbCount: Integer; |
||
118 | begin |
||
119 | Result := 1; |
||
120 | end; |
||
121 | |||
122 | end. |