aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJuha Vehviläinen <jusu@users.sourceforge.net>2002-12-30 22:14:47 +0000
committerJuha Vehviläinen <jusu@users.sourceforge.net>2002-12-30 22:14:47 +0000
commitaa901783a0dc07f0dc08628d3ca091a9164b0629 (patch)
tree175410946332fe359c01f945dce6dd3a401e7747 /Source
parentd80c69296266a6169c0164467b748f197e11d25b (diff)
*** empty log message ***
svn path=/trunk/Framestein/; revision=312
Diffstat (limited to 'Source')
-rw-r--r--Source/Framestein.cfg1
-rw-r--r--Source/Framestein.dof5
-rw-r--r--Source/Framestein.dpr4
-rw-r--r--Source/mainunit.dfm6
-rw-r--r--Source/mainunit.pas10
-rw-r--r--Source/pluginunit.pas29
-rw-r--r--Source/toolbarunit.dfm104
-rw-r--r--Source/toolbarunit.pas136
8 files changed, 290 insertions, 5 deletions
diff --git a/Source/Framestein.cfg b/Source/Framestein.cfg
index 6ee2f15..d487870 100644
--- a/Source/Framestein.cfg
+++ b/Source/Framestein.cfg
@@ -31,6 +31,7 @@
-M
-$M16384,1048576
-K$00400000
+-E"e:\fs\Framestein"
-LE"c:\program files\borland\delphi5\Projects\Bpl"
-LN"c:\program files\borland\delphi5\Projects\Bpl"
-U"E:\lab\common\DelphiX2000_0717-2\Source;E:\lab\common\fastlib;E:\lab\common\pshost;E:\lab\common\G32"
diff --git a/Source/Framestein.dof b/Source/Framestein.dof
index ddd0c6f..26929b1 100644
--- a/Source/Framestein.dof
+++ b/Source/Framestein.dof
@@ -39,7 +39,7 @@ MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
-OutputDir=
+OutputDir=e:\fs\Framestein
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
@@ -90,3 +90,6 @@ Item1=E:\lab\common\DelphiX2000_0717-2\Source;E:\lab\common\fastlib;E:\lab\commo
Item2=E:\lab\common\DelphiX2000_0717-2\Source;E:\lab\common\fastlib;E:\lab\common\pshost
Item3=E:\lab\common\DelphiX2000_0717-2\Source;E:\lab\common\fastlib
Item4=E:\lab\common\DelphiX2000_0717-2\Source
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=e:\fs\Framestein
diff --git a/Source/Framestein.dpr b/Source/Framestein.dpr
index f280e75..009543a 100644
--- a/Source/Framestein.dpr
+++ b/Source/Framestein.dpr
@@ -17,7 +17,8 @@ uses
logunit in 'logunit.pas' {log},
pluginunit in 'pluginunit.pas',
progressunit in 'progressunit.pas' {Progress},
- configureunit in 'configureunit.pas' {configure};
+ configureunit in 'configureunit.pas' {configure},
+ toolbarunit in 'toolbarunit.pas' {toolbar};
{$R *.RES}
@@ -28,6 +29,7 @@ begin
Application.CreateForm(TProgress, Progress);
Application.CreateForm(Tconfigure, configure);
Application.CreateForm(Tlog, log);
+ Application.CreateForm(Ttoolbar, toolbar);
Application.Run;
end.
diff --git a/Source/mainunit.dfm b/Source/mainunit.dfm
index 46a9252..f5d438e 100644
--- a/Source/mainunit.dfm
+++ b/Source/mainunit.dfm
@@ -3505,8 +3505,12 @@ object main: Tmain
Caption = 'Reload plugins'
OnClick = MiReloadPluginsClick
end
+ object MiToolbar: TMenuItem
+ Caption = 'Show Toolbar'
+ OnClick = MiToolbarClick
+ end
object MiLog: TMenuItem
- Caption = 'Show debug'
+ Caption = 'Show Debug'
OnClick = MiLogClick
end
object MiExit: TMenuItem
diff --git a/Source/mainunit.pas b/Source/mainunit.pas
index 1b2a6e1..aebb64b 100644
--- a/Source/mainunit.pas
+++ b/Source/mainunit.pas
@@ -34,6 +34,7 @@ type
csToPd: TClientSocket;
MiExit: TMenuItem;
REConsole: TRichEdit;
+ MiToolbar: TMenuItem;
procedure ss1ClientRead(Sender: TObject; Socket: TCustomWinSocket);
procedure FormCreate(Sender: TObject);
procedure ss1ClientError(Sender: TObject; Socket: TCustomWinSocket;
@@ -63,6 +64,7 @@ type
procedure MiExitClick(Sender: TObject);
procedure ImageLogoDblClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
+ procedure MiToolbarClick(Sender: TObject);
private
{ Private declarations }
SocketMem: Pointer;
@@ -142,7 +144,7 @@ uses
fscopyunit, fstextunit, fsdrawunit, fsbrowserunit,
fsinfounit, fsaviunit,
fastfiles,
- Strz, logunit, configureunit, progressunit;
+ Strz, logunit, configureunit, progressunit, toolbarunit;
{$IFDEF FSDLL}
procedure TMainThread.Execute;
@@ -944,5 +946,11 @@ begin
{$ENDIF}
end;
+procedure Tmain.MiToolbarClick(Sender: TObject);
+begin
+ MiToolbar.Checked := not MiToolbar.Checked;
+ Toolbar.Visible := MiToolbar.Checked;
+end;
+
end.
diff --git a/Source/pluginunit.pas b/Source/pluginunit.pas
index ddee99c..f331ed8 100644
--- a/Source/pluginunit.pas
+++ b/Source/pluginunit.pas
@@ -32,18 +32,21 @@ type
const ret: PChar
); cdecl;
+ TInfoProc = procedure(const str: PChar); cdecl;
+
TPointerList = TList;
TLibraryList = TList;
TPlugins = class(TComponent)
private
- Names: TStringList;
EffectProcs: TPointerList;
CopyProcs: TPointerList;
+ InfoProcs: TPointerList;
Libs: TLibraryList;
procedure LoadHandleFile(const SearchRec: TSearchRec;
const FullPath: String);
public
+ Names: TStringList;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Load;
@@ -56,6 +59,7 @@ type
function CallCopy(const d1: TDirectDrawSurface;
const d2: TDirectDrawSurface;
const procIndex: Integer; const args: String): Boolean;
+ function Info(const procIndex: Integer): String;
end;
implementation
@@ -70,6 +74,7 @@ type
const
EffectProcName = 'perform_effect';
CopyProcName = 'perform_copy';
+ InfoProcName = 'info';
{ TPlugins }
@@ -79,6 +84,7 @@ begin
Names := TStringList.Create;
EffectProcs := TPointerList.Create;
CopyProcs := TPointerList.Create;
+ InfoProcs := TPointerList.Create;
Libs := TLibraryList.Create;
end;
@@ -114,6 +120,7 @@ var
b: array[0..255] of Char;
EffectProc: TEffectProc;
CopyProc: TCopyProc;
+ InfoProc: TInfoProc;
s: String;
i: Integer;
begin
@@ -123,12 +130,14 @@ begin
if h<>0 then begin
@EffectProc := GetProcAddress(h, EffectProcName);
@CopyProc := GetProcAddress(h, CopyProcName);
+ @InfoProc := GetProcAddress(h, InfoProcName);
s := ExtractFileName(FullPath);
i := Pos('.DLL', UpperCase(s));
if i>0 then Delete(s, i, 255);
Names.Add(s);
EffectProcs.Add(@EffectProc);
CopyProcs.Add(@CopyProc);
+ InfoProcs.Add(@InfoProc);
Libs.Add(@h);
end;
end;
@@ -217,5 +226,23 @@ begin
Result := True;
end;
+function TPlugins.Info(const procIndex: Integer): String;
+var
+ Proc: TInfoProc;
+ buf: array[0..255] of Char;
+ p: PChar;
+begin
+ if (procIndex=-1) or (procIndex>=InfoProcs.Count) then Exit;
+ @Proc := InfoProcs[procIndex];
+ if @Proc=nil then begin
+ Result := '';
+ Exit;
+ end;
+ buf[0]:=#0;
+ p := @buf;
+ Proc(p);
+ Result := StrPas(p);
+end;
+
end.
diff --git a/Source/toolbarunit.dfm b/Source/toolbarunit.dfm
new file mode 100644
index 0000000..5cd6673
--- /dev/null
+++ b/Source/toolbarunit.dfm
@@ -0,0 +1,104 @@
+object toolbar: Ttoolbar
+ Left = 264
+ Top = 454
+ Width = 567
+ Height = 282
+ BorderStyle = bsSizeToolWin
+ Caption = 'Toolbar'
+ Color = clBtnFace
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'MS Sans Serif'
+ Font.Style = []
+ OldCreateOrder = False
+ OnCreate = FormCreate
+ PixelsPerInch = 96
+ TextHeight = 13
+ object Splitter1: TSplitter
+ Left = 0
+ Top = 97
+ Width = 559
+ Height = 6
+ Cursor = crVSplit
+ Align = alTop
+ Beveled = True
+ end
+ object Panel1: TPanel
+ Left = 0
+ Top = 103
+ Width = 559
+ Height = 133
+ Align = alClient
+ BevelOuter = bvNone
+ Caption = 'Panel1'
+ TabOrder = 0
+ object LVFilters: TListView
+ Left = 0
+ Top = 0
+ Width = 559
+ Height = 133
+ Align = alClient
+ BorderStyle = bsNone
+ Color = clBtnFace
+ Columns = <
+ item
+ AutoSize = True
+ Caption = 'Name'
+ end
+ item
+ AutoSize = True
+ Caption = 'Info'
+ end>
+ ReadOnly = True
+ TabOrder = 0
+ ViewStyle = vsList
+ OnChange = LVFiltersChange
+ OnCustomDrawItem = LVFiltersCustomDrawItem
+ OnSelectItem = LVFiltersSelectItem
+ end
+ end
+ object Panel2: TPanel
+ Left = 0
+ Top = 0
+ Width = 559
+ Height = 97
+ Align = alTop
+ BevelOuter = bvNone
+ Caption = 'Panel2'
+ TabOrder = 1
+ object LVTools: TListView
+ Left = 0
+ Top = 0
+ Width = 559
+ Height = 97
+ Align = alClient
+ BorderStyle = bsNone
+ Color = clBtnFace
+ Columns = <>
+ ReadOnly = True
+ TabOrder = 0
+ ViewStyle = vsList
+ OnChange = LVFiltersChange
+ OnCustomDrawItem = LVFiltersCustomDrawItem
+ OnSelectItem = LVToolsSelectItem
+ end
+ object m1: TMemo
+ Left = 144
+ Top = 8
+ Width = 129
+ Height = 33
+ TabOrder = 1
+ Visible = False
+ WordWrap = False
+ end
+ end
+ object bar: TStatusBar
+ Left = 0
+ Top = 236
+ Width = 559
+ Height = 19
+ Panels = <>
+ SimplePanel = False
+ end
+end
diff --git a/Source/toolbarunit.pas b/Source/toolbarunit.pas
new file mode 100644
index 0000000..5449b53
--- /dev/null
+++ b/Source/toolbarunit.pas
@@ -0,0 +1,136 @@
+unit toolbarunit;
+
+interface
+
+uses
+ Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
+ ComCtrls, ToolWin, Buttons, ExtCtrls, StdCtrls, ImgList;
+
+type
+ Ttoolbar = class(TForm)
+ Panel1: TPanel;
+ LVFilters: TListView;
+ Panel2: TPanel;
+ LVTools: TListView;
+ Splitter1: TSplitter;
+ bar: TStatusBar;
+ m1: TMemo;
+ procedure FormCreate(Sender: TObject);
+ procedure LVFiltersCustomDrawItem(Sender: TCustomListView;
+ Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
+ procedure LVFiltersChange(Sender: TObject; Item: TListItem;
+ Change: TItemChange);
+ procedure LVFiltersSelectItem(Sender: TObject; Item: TListItem;
+ Selected: Boolean);
+ procedure LVToolsSelectItem(Sender: TObject; Item: TListItem;
+ Selected: Boolean);
+ private
+ { Private declarations }
+ public
+ { Public declarations }
+ end;
+
+var
+ toolbar: Ttoolbar;
+
+implementation
+
+uses
+ mainunit, strz;
+
+{$R *.DFM}
+
+procedure Ttoolbar.FormCreate(Sender: TObject);
+var
+ i: Integer;
+begin
+ // Load tools
+ if FileExists(main.FSFolder+'\toolbar.txt') then begin
+ m1.Lines.LoadFromFile(main.FSFolder+'\toolbar.txt');
+ if m1.Lines.Count>0 then
+ for i:=0 to m1.Lines.Count-1 do begin
+ with LVTools.Items.Add do begin
+ Caption := ExtractWord(1, m1.Lines[i], [' ']);
+ Data := Pointer(i);
+ end;
+ end;
+ end;
+
+ // Load filters
+ if main.Plugins.Names.Count>0 then
+ for i:=0 to main.Plugins.Names.Count-1 do begin
+ with LVFilters.Items.Add do begin
+ Caption := main.Plugins.Names[i];
+ SubItems.Add(main.Plugins.Info(i));
+ Data := Pointer(i);
+ end;
+ end;
+ Show;
+end;
+
+const
+ it: TListItem = nil;
+
+procedure Ttoolbar.LVFiltersChange(Sender: TObject; Item: TListItem;
+ Change: TItemChange);
+begin
+ if Item.Selected then
+ it := item;
+ if Item.ListView.Selected=nil then it:=nil;
+end;
+
+procedure Ttoolbar.LVFiltersCustomDrawItem(Sender: TCustomListView;
+ Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
+var
+ Title: array[0..255] of Char;
+ s, cmd: String;
+ h: THandle;
+begin
+ if (it=nil) or (Item.Caption='') then Exit;
+ if it.Caption=item.Caption then begin
+ Sleep(50); // wait for pd window to get focus
+ h := GetForegroundWindow;
+ if GetWindowText(h, Title, SizeOf(Title))>0 then begin
+ s := StrPas(@Title);
+ if Pos(' - ', S)>0 then begin
+ Delete(S, Pos(' - ', S), 255);
+ if Pos('*', S)>0 then Delete(S, Pos('*', S), 255);
+// main.Post(Item.Caption+' -> '+S);
+ if Item.ListView=LVFilters then
+ cmd := 'msg'
+ else
+ cmd := 'obj';
+ main.SendReturnValues('obj pd-'+S+'='+cmd+' 10 10 '+Item.Caption+';');
+ Item.ListView.Selected := nil;
+ end;
+ end;
+ end;
+end;
+
+procedure Ttoolbar.LVFiltersSelectItem(Sender: TObject; Item: TListItem;
+ Selected: Boolean);
+var
+ S: String;
+begin
+ S := main.Plugins.Info(Integer(Item.Data));
+ if S='' then
+ bar.SimpleText := '<no info available>'
+ else
+ bar.SimpleText := Item.Caption+': '+S;
+end;
+
+procedure Ttoolbar.LVToolsSelectItem(Sender: TObject; Item: TListItem;
+ Selected: Boolean);
+var
+ S: String;
+ i: Integer;
+begin
+ i := Integer(Item.Data);
+ if (i>=0) and (i<m1.Lines.Count) then begin
+ S := m1.Lines[i];
+ if Pos(' ', S)>0 then Delete(S, 1, Pos(' ', S));
+ bar.SimpleText := S;
+ end;
+end;
+
+end.