From 3bd43c9d18e565e193e555f9de0ce916f8faf807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20Vehvil=C3=A4inen?= Date: Wed, 18 Sep 2002 16:32:27 +0000 Subject: *** empty log message *** svn path=/trunk/Framestein/; revision=132 --- CHANGELOG.txt | 16 ++++++++++++ Framestein.exe | Bin 874496 -> 912384 bytes Patches/fps.pd | 4 +-- Patches/fs.copy.pd | 8 +++--- Patches/fs.main.pd | 3 ++- Plugins/argument-passing.cpp | 18 +++++++++++++ Plugins/argument-passing.dll | Bin 0 -> 40960 bytes Plugins/argument-passing.exp | Bin 0 -> 662 bytes Plugins/argument-passing.lib | Bin 0 -> 2200 bytes Plugins/argument-passing.obj | Bin 0 -> 2854 bytes Plugins/makefile | 7 +++-- Plugins/pixels.h | 30 +++++++++++++++++++-- Plugins/rowca.cpp | 16 +++++++++--- Plugins/rowca.dll | Bin 110592 -> 110592 bytes Plugins/rowca.exp | Bin 619 -> 619 bytes Plugins/rowca.lib | Bin 2042 -> 2042 bytes Plugins/rowca.obj | Bin 57594 -> 61510 bytes Plugins/subtract.cpp | 31 +++++++++++++++------- Plugins/subtract.dll | Bin 28672 -> 40960 bytes Plugins/subtract.exp | Bin 630 -> 630 bytes Plugins/subtract.lib | Bin 2080 -> 2080 bytes Plugins/subtract.obj | Bin 1409 -> 5262 bytes Source/Framestein.cfg | 10 +++---- Source/Framestein.dof | 34 +++++++++++++----------- Source/Framestein.dpr | 41 ++++++++++------------------- Source/Framestein.res | Bin 4056 -> 6980 bytes Source/configureunit.dfm | 61 ++++++++++++++++++++++++++++++++++++++++--- Source/configureunit.pas | 30 ++++++++++++++++++++- Source/fscopyunit.pas | 23 +++++++++++----- Source/fsframeunit.pas | 13 ++++----- Source/mainunit.pas | 52 ++++++++++++++++++++++++++++++++---- Source/pluginunit.pas | 36 +++++++++++-------------- Source/pshostunit.pas | 7 +---- 33 files changed, 319 insertions(+), 121 deletions(-) create mode 100644 Plugins/argument-passing.cpp create mode 100644 Plugins/argument-passing.dll create mode 100644 Plugins/argument-passing.exp create mode 100644 Plugins/argument-passing.lib create mode 100644 Plugins/argument-passing.obj diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1721b35..cc32c73 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,19 @@ +0.32 +- fs.frame: |title this is the main window( +- fs.copy: transcolor to set the transparent color +- better gol algo (Plugins\gol.c) +- added 1d cell automata where each iteration will add a new row: Plugins\rowca +- added arguments-class in pixels.h to ease parsing arguments to plugins. + example: + + void perform_effect(_frame f, _args a) + { + arguments ar(a.s); + + // ar.count() return the number of arguments + // ar[i] return i'th argument + ... + 0.31 - added plugins by Olaf Matthes: PeRColate and PixelPack. Thanks, Olaf! - the console is back. It's good for printf():ing from plugins.. diff --git a/Framestein.exe b/Framestein.exe index 1644f58..13a8fb0 100755 Binary files a/Framestein.exe and b/Framestein.exe differ diff --git a/Patches/fps.pd b/Patches/fps.pd index 3e61074..c0731bf 100644 --- a/Patches/fps.pd +++ b/Patches/fps.pd @@ -1,10 +1,10 @@ -#N canvas 17 261 466 316 12; +#N canvas 17 261 472 322 12; #X obj 307 192 /; #X obj 319 128 t b f; #X obj 67 27 inlet; #X msg 293 157 1000; #X obj 87 222 outlet; -#X obj 87 112 metro 1000; +#X obj 87 111 metro 1000; #X text 10 -1 sends bangs to make "frames per second"; #X obj 226 62 float \$1; #X obj 226 32 loadbang; diff --git a/Patches/fs.copy.pd b/Patches/fs.copy.pd index cf6a311..c646056 100644 --- a/Patches/fs.copy.pd +++ b/Patches/fs.copy.pd @@ -1,4 +1,4 @@ -#N canvas 52 54 934 446 12; +#N canvas 52 54 936 448 12; #X obj 173 21 loadbang; #X obj 208 271 fs_sender; #X msg 173 204 copy \$1; @@ -31,9 +31,11 @@ srcpaint whiteness; ; #X text 468 329 transparent_0/1 mirrorleftright_0/1 mirrorupdown_0/1 ; -#X text 467 358 "plugin_name" (see example-plugins.pd); +#X text 467 378 "plugin_name" (see example-plugins.pd); #X obj 173 51 symbol \$0C; -#X text 467 389 "filter_name" (see example-photoshopfilters.pd); +#X text 466 404 "filter_name" (see example-photoshopfilters.pd); +#X text 468 349 transcolor to set the transparent color +; #X connect 0 0 29 0; #X connect 2 0 1 0; #X connect 3 0 18 0; diff --git a/Patches/fs.main.pd b/Patches/fs.main.pd index 845121d..f68015c 100644 --- a/Patches/fs.main.pd +++ b/Patches/fs.main.pd @@ -1,4 +1,4 @@ -#N canvas 278 0 700 494 12; +#N canvas 278 0 702 496 12; #X obj 27 293 netsend; #X floatatom 27 322 4 0 0; #X obj 207 160 loadbang; @@ -31,6 +31,7 @@ configuring fs likewise (right-click fs).; #X obj 408 408 r symbolmouseup; #X text 404 364 ignore some errors; #X obj 408 431 r symbolfile; +#X obj 530 207 r fs_reset; #X connect 0 0 1 0; #X connect 2 0 6 0; #X connect 3 0 0 0; diff --git a/Plugins/argument-passing.cpp b/Plugins/argument-passing.cpp new file mode 100644 index 0000000..71ec33c --- /dev/null +++ b/Plugins/argument-passing.cpp @@ -0,0 +1,18 @@ +// +// example of passing arguments to plugin using the arguments-class (defined in pixels.h) +// + +#include "pixels.h" + +void perform_effect(_frame f, _args a) +{ + arguments ar(a.s); + + // + // ar.count() return the number of arguments + // ar[i] return i'th argument + // + + for(int i=0; i +#include "plugin.h" + class pixels { private: @@ -117,4 +118,29 @@ void pixels::updaterowp() p32 = (pixel32 *)p8; } +// +// arguments-class, to make it easier to parse parameters. +// using vector for this might be a bit overkill (??), +// but I like the ease of it. + +class arguments +{ +private: + std::vector m_ptrs; +public: + arguments(char *s) + { + char *t = s; + if(!t || !t[0]) return; + if(t[0]) m_ptrs.push_back(t); + while(t = strstr(t+1, " ")) + { + t[0]=0; + m_ptrs.push_back(t+1); + } + } + char *operator[](int i) { return m_ptrs[i]; } + int count() { return m_ptrs.size(); } +}; + #endif // #ifndef _PIXELSH diff --git a/Plugins/rowca.cpp b/Plugins/rowca.cpp index 5c776ac..de83933 100644 --- a/Plugins/rowca.cpp +++ b/Plugins/rowca.cpp @@ -42,11 +42,19 @@ void draw(const _frame &f); void perform_effect(_frame f, _args a) { - if(!a.s || !a.s[0]) return; + arguments ar(a.s); + if(!ar.count()) { + printf("Usage: rowca \n"); + printf("Example rule: 001-010-011-100\n"); + printf("Commands: draw, clear\n"); + return; + } + + char *t = ar[0]; - if(strstr(a.s, "0") || strstr(a.s, "1")) iterate(a.s); else - if(strcmp(a.s, "draw")==0) draw(f); else - if(strcmp(a.s, "clear")==0) sv.clear(); + if(strstr(t, "0") || strstr(t, "1")) iterate(t); else + if(strcmp(t, "draw")==0) draw(f); else + if(strcmp(t, "clear")==0) sv.clear(); } void iterate(const char *arg) diff --git a/Plugins/rowca.dll b/Plugins/rowca.dll index eda7177..5302341 100644 Binary files a/Plugins/rowca.dll and b/Plugins/rowca.dll differ diff --git a/Plugins/rowca.exp b/Plugins/rowca.exp index be126fa..9fcaa42 100644 Binary files a/Plugins/rowca.exp and b/Plugins/rowca.exp differ diff --git a/Plugins/rowca.lib b/Plugins/rowca.lib index 78df6e5..ce2557f 100644 Binary files a/Plugins/rowca.lib and b/Plugins/rowca.lib differ diff --git a/Plugins/rowca.obj b/Plugins/rowca.obj index c57f120..5ce3a87 100644 Binary files a/Plugins/rowca.obj and b/Plugins/rowca.obj differ diff --git a/Plugins/subtract.cpp b/Plugins/subtract.cpp index 89ba216..3172513 100644 --- a/Plugins/subtract.cpp +++ b/Plugins/subtract.cpp @@ -1,3 +1,9 @@ +// +// subtract - subtract red/green/blue color from image +// +// 0.32 +// using arguments-class +// // 0.20 // - from c to c++ // - pixelformat-aware @@ -9,30 +15,35 @@ void perform_effect(_frame f, _args a) { - pixels p(f); - char *t; - byte tr, tg, tb, r=0, g=0, b=0; - - if(!a.s) return; + arguments ar(a.s); - r = atoi(a.s); - if(t = strstr(a.s, " ")) + if(ar.count()!=3) { - g = atoi(t+1); - if (t = strstr(t+1, " ")) - b = atoi(t+1); + printf("usage: subtract \n"); + return; } + byte r, g, b; + + r = atoi(ar[0]); + g = atoi(ar[1]); + b = atoi(ar[2]); + + pixels p(f); + byte tr, tg, tb; + while(!p.eof()) { tr = p.red(); tg = p.green(); tb = p.blue(); + p.putrgb( tr>r ? tr-r : 0, tg>g ? tg-g : 0, tb>b ? tb-b : 0 ); + p.next(); } } diff --git a/Plugins/subtract.dll b/Plugins/subtract.dll index 883c541..65383b3 100644 Binary files a/Plugins/subtract.dll and b/Plugins/subtract.dll differ diff --git a/Plugins/subtract.exp b/Plugins/subtract.exp index 9a066ba..0c88e2c 100644 Binary files a/Plugins/subtract.exp and b/Plugins/subtract.exp differ diff --git a/Plugins/subtract.lib b/Plugins/subtract.lib index 5132561..ad174a2 100644 Binary files a/Plugins/subtract.lib and b/Plugins/subtract.lib differ diff --git a/Plugins/subtract.obj b/Plugins/subtract.obj index 8405ccc..bb9e9fa 100644 Binary files a/Plugins/subtract.obj and b/Plugins/subtract.obj differ diff --git a/Source/Framestein.cfg b/Source/Framestein.cfg index dc72219..6ee2f15 100644 --- a/Source/Framestein.cfg +++ b/Source/Framestein.cfg @@ -6,7 +6,7 @@ -$F- -$G+ -$H+ --$I+ +-$I- -$J+ -$K- -$L+ @@ -33,7 +33,7 @@ -K$00400000 -LE"c:\program files\borland\delphi5\Projects\Bpl" -LN"c:\program files\borland\delphi5\Projects\Bpl" --U"g:\lab\common;g:\lab\common\DelphiX2000_0717-2\Source;g:\lab\common\fastlib;g:\lab\common\pshost;g:\lab\common\G32;g:\lab\common\fastlib" --O"g:\lab\common;g:\lab\common\DelphiX2000_0717-2\Source;g:\lab\common\fastlib;g:\lab\common\pshost;g:\lab\common\G32;g:\lab\common\fastlib" --I"g:\lab\common;g:\lab\common\DelphiX2000_0717-2\Source;g:\lab\common\fastlib;g:\lab\common\pshost;g:\lab\common\G32;g:\lab\common\fastlib" --R"g:\lab\common;g:\lab\common\DelphiX2000_0717-2\Source;g:\lab\common\fastlib;g:\lab\common\pshost;g:\lab\common\G32;g:\lab\common\fastlib" +-U"E:\lab\common\DelphiX2000_0717-2\Source;E:\lab\common\fastlib;E:\lab\common\pshost;E:\lab\common\G32" +-O"E:\lab\common\DelphiX2000_0717-2\Source;E:\lab\common\fastlib;E:\lab\common\pshost;E:\lab\common\G32" +-I"E:\lab\common\DelphiX2000_0717-2\Source;E:\lab\common\fastlib;E:\lab\common\pshost;E:\lab\common\G32" +-R"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 d2d8419..ddd0c6f 100644 --- a/Source/Framestein.dof +++ b/Source/Framestein.dof @@ -7,7 +7,7 @@ E=0 F=0 G=1 H=1 -I=1 +I=0 J=1 K=0 L=1 @@ -43,8 +43,8 @@ OutputDir= UnitOutputDir= PackageDLLOutputDir= PackageDCPOutputDir= -SearchPath=g:\lab\common;g:\lab\common\DelphiX2000_0717-2\Source;g:\lab\common\fastlib;g:\lab\common\pshost;g:\lab\common\G32;g:\lab\common\fastlib -Packages=Vcl50;Vclx50;VclSmp50;Qrpt50;Vcldb50;Vclbde50;ibevnt50;vcldbx50;TeeUI50;TeeDB50;Tee50;TeeQR50;VCLIB50;vclie50;Inetdb50;Inet50;NMFast50;dclocx50;dclaxserver50;temppak;janDrawPack;pdpak +SearchPath=E:\lab\common\DelphiX2000_0717-2\Source;E:\lab\common\fastlib;E:\lab\common\pshost;E:\lab\common\G32 +Packages=Vcl50;Vclx50;VclSmp50;Qrpt50;Vcldb50;Vclbde50;ibevnt50;vcldbx50;TeeUI50;TeeDB50;Tee50;TeeQR50;VCLIB50;vclie50;Inetdb50;Inet50;NMFast50;dclocx50;dclaxserver50;DelphiX_for5;fspak Conditionals= DebugSourceDirs= UsePackages=0 @@ -56,33 +56,37 @@ ActiveLang= ProjectLang=$0000040B RootDir= [Version Info] -IncludeVerInfo=1 -AutoIncBuild=1 -MajorVer=0 -MinorVer=1 -Release=1 -Build=79 +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 Debug=0 -PreRelease=1 +PreRelease=0 Special=0 Private=0 DLL=0 -Locale=1033 +Locale=1035 CodePage=1252 [Version Info Keys] CompanyName= FileDescription= -FileVersion=0.1.1.79 +FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= -ProductName=Framestein +ProductName= ProductVersion=1.0.0.0 Comments= [HistoryLists\hlUnitAliases] Count=1 Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; [HistoryLists\hlSearchPath] -Count=1 -Item0=g:\lab\common;g:\lab\common\DelphiX2000_0717-2\Source;g:\lab\common\fastlib;g:\lab\common\pshost;g:\lab\common\G32;g:\lab\common\fastlib +Count=5 +Item0=E:\lab\common\DelphiX2000_0717-2\Source;E:\lab\common\fastlib;E:\lab\common\pshost;E:\lab\common\G32 +Item1=E:\lab\common\DelphiX2000_0717-2\Source;E:\lab\common\fastlib;E:\lab\common\pshost;E:\lab\common\G32\Packages +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 diff --git a/Source/Framestein.dpr b/Source/Framestein.dpr index 4dd00b2..f280e75 100644 --- a/Source/Framestein.dpr +++ b/Source/Framestein.dpr @@ -1,35 +1,23 @@ -{ Copyright (C) 2001-2002 Juha Vehviläinen - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details.} - program Framestein; -{%ToDo 'Framestein.todo'} - uses + ActiveX, Forms, mainunit in 'mainunit.pas' {main}, - fsframeunit in 'fsframeunit.pas' {fsframe}, + pshostunit in 'pshostunit.pas', + effectsunit in 'effectsunit.pas', + fsaviunit in 'fsaviunit.pas' {FsAvi}, + fsbrowserunit in 'fsbrowserunit.pas', fscopyunit in 'fscopyunit.pas' {fscopy}, - fstextunit in 'fstextunit.pas' {fstext}, - fsformunit in 'fsformunit.pas', fsdrawunit in 'fsdrawunit.pas' {fsdraw}, - effectsunit in 'effectsunit.pas', - pluginunit in 'pluginunit.pas', - logunit in 'logunit.pas' {log}, - fsbrowserunit in 'fsbrowserunit.pas' {fsbrowser}, + fsformunit in 'fsformunit.pas', + fsframeunit in 'fsframeunit.pas' {fsframe}, fsinfounit in 'fsinfounit.pas' {fsinfo}, - configureunit in 'configureunit.pas' {configure}, - pshostunit in 'pshostunit.pas', - fsaviunit in 'fsaviunit.pas' {FsAvi}, - progressunit in 'progressunit.pas' {Progress}; + fstextunit in 'fstextunit.pas' {fstext}, + logunit in 'logunit.pas' {log}, + pluginunit in 'pluginunit.pas', + progressunit in 'progressunit.pas' {Progress}, + configureunit in 'configureunit.pas' {configure}; {$R *.RES} @@ -37,10 +25,9 @@ begin Application.Initialize; Application.Title := 'Framestein'; Application.CreateForm(Tmain, main); - Application.CreateForm(Tlog, log); - Application.CreateForm(Tconfigure, configure); - Application.CreateForm(TFsAvi, FsAvi); Application.CreateForm(TProgress, Progress); + Application.CreateForm(Tconfigure, configure); + Application.CreateForm(Tlog, log); Application.Run; end. diff --git a/Source/Framestein.res b/Source/Framestein.res index 6b96418..62620b9 100644 Binary files a/Source/Framestein.res and b/Source/Framestein.res differ diff --git a/Source/configureunit.dfm b/Source/configureunit.dfm index 5a9e46d..f171463 100644 --- a/Source/configureunit.dfm +++ b/Source/configureunit.dfm @@ -21,9 +21,62 @@ object configure: Tconfigure Top = 0 Width = 427 Height = 275 - ActivePage = TSConnections + ActivePage = TSFolders Align = alClient TabOrder = 0 + object TSFolders: TTabSheet + Caption = 'Folders' + ImageIndex = 2 + object Label6: TLabel + Left = 16 + Top = 36 + Width = 83 + Height = 13 + Caption = 'Framestein folder:' + end + object EditFSFolder: TEdit + Left = 152 + Top = 32 + Width = 225 + Height = 21 + Ctl3D = True + ParentCtl3D = False + TabOrder = 0 + Text = 'E:\' + end + object Memo1: TMemo + Left = 16 + Top = 200 + Width = 389 + Height = 33 + BorderStyle = bsNone + Enabled = False + Lines.Strings = ( + + 'Choose the folder where Framestein will find its Plugins and Fil' + + 'ters.' + '') + ReadOnly = True + TabOrder = 1 + end + object DirectoryListBox1: TDirectoryListBox + Left = 152 + Top = 88 + Width = 225 + Height = 97 + ItemHeight = 16 + TabOrder = 2 + OnChange = DirectoryListBox1Change + end + object DriveComboBox1: TDriveComboBox + Left = 152 + Top = 64 + Width = 225 + Height = 19 + TabOrder = 3 + OnChange = DriveComboBox1Change + end + end object TSConnections: TTabSheet Caption = 'Connections' object Label1: TLabel @@ -116,7 +169,7 @@ object configure: Tconfigure Caption = 'General' ImageIndex = 1 object CBDockMain: TCheckBox - Left = 16 + Left = 26 Top = 36 Width = 377 Height = 17 @@ -134,7 +187,7 @@ object configure: Tconfigure BevelOuter = bvNone TabOrder = 1 object ButtonOk: TButton - Left = 8 + Left = 344 Top = 8 Width = 75 Height = 25 @@ -144,7 +197,7 @@ object configure: Tconfigure OnClick = ButtonOkClick end object ButtonCancel: TButton - Left = 96 + Left = 256 Top = 8 Width = 75 Height = 25 diff --git a/Source/configureunit.pas b/Source/configureunit.pas index 88dff73..b4a1dab 100644 --- a/Source/configureunit.pas +++ b/Source/configureunit.pas @@ -4,7 +4,7 @@ interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - StdCtrls, ExtCtrls, ComCtrls; + StdCtrls, ExtCtrls, ComCtrls, Buttons, FileCtrl; type Tconfigure = class(TForm) @@ -25,9 +25,17 @@ type CBEnableFSConns: TCheckBox; TSGeneral: TTabSheet; CBDockMain: TCheckBox; + TSFolders: TTabSheet; + Label6: TLabel; + EditFSFolder: TEdit; + Memo1: TMemo; + DirectoryListBox1: TDirectoryListBox; + DriveComboBox1: TDriveComboBox; procedure ButtonCancelClick(Sender: TObject); procedure ButtonOkClick(Sender: TObject); procedure FormCreate(Sender: TObject); + procedure DriveComboBox1Change(Sender: TObject); + procedure DirectoryListBox1Change(Sender: TObject); private { Private declarations } public @@ -59,6 +67,12 @@ begin main.FSPort := StrToInt(EditFsPort.Text); main.EnableFSConns := CBEnableFSConns.Checked; main.DockMain := CBDockMain.Checked; + if main.FSFolder <> EditFSFolder.Text then begin + main.FSFolder := EditFSFolder.Text; + main.Plugins.Clear; + main.Plugins.ReLoad; + main.SearchPath.Add(main.FSFolder); + end; try if Reg.OpenKey('\Software\Framestein', True) then begin @@ -68,6 +82,7 @@ begin Reg.WriteInteger('FSPort', main.FSPort); Reg.WriteBool('EnableFSConns', main.EnableFSConns); Reg.WriteBool('DockMain', main.DockMain); + Reg.WriteString('FSFolder', main.FSFolder); end; except end; @@ -106,6 +121,7 @@ begin EditFsPort.Text := IntToStr(main.FSPort); CBEnableFSConns.Checked := main.EnableFSConns; CBDockMain.Checked := main.DockMain; + EditFSFolder.Text := main.FSFolder; // show ShowModal; end; @@ -116,5 +132,17 @@ begin Execute; end; +procedure Tconfigure.DriveComboBox1Change(Sender: TObject); +begin + DirectoryListBox1.Drive := + (Sender as TDriveComboBox).Drive; +end; + +procedure Tconfigure.DirectoryListBox1Change(Sender: TObject); +begin + EditFSFolder.Text := + (Sender as TDirectoryListBox).Directory; +end; + end. diff --git a/Source/fscopyunit.pas b/Source/fscopyunit.pas index 0206d8f..72ab627 100644 --- a/Source/fscopyunit.pas +++ b/Source/fscopyunit.pas @@ -37,7 +37,9 @@ type iAlpha, iAdd, iSub: Integer; iBlend: Extended; Transparent, MirrorLeftRight, MirrorUpdown: Boolean; - iPlugin, iPluginArgs: String; + TransColor: Cardinal; + iPlugin: Integer; + iPluginArgs: String; iFilter, iFilterArgs: String; procedure GetFrames(const S: String); @@ -101,6 +103,7 @@ var df: TDDBltFX; ddck: TDDColorKey; sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2: Integer; + r, g, b: Byte; begin if (S='') then Exit; @@ -165,13 +168,19 @@ begin if s1='TRANSPARENT_0' then begin Transparent := False; Exit; end else if s1='TRANSPARENT_1' then begin Transparent := True; Exit; end else + if s1='TRANSCOLOR' then begin + r := MyStrToInt(ExtractWord(2, S, [' '])); + g := MyStrToInt(ExtractWord(3, S, [' '])); + b := MyStrToInt(ExtractWord(4, S, [' '])); + TransColor := RGB(r, g, b); + Exit; + end else if s1='MIRRORLEFTRIGHT_0' then begin MirrorLeftRight := False; Exit; end else if s1='MIRRORLEFTRIGHT_1' then begin MirrorLeftRight := True; Exit; end else if s1='MIRRORUPDOWN_0' then begin MirrorUpDown := False; Exit; end else if s1='MIRRORUPDOWN_1' then begin MirrorUpDown := True; Exit; end else - if main.Plugins.IsPlugin(s1) then begin + if main.Plugins.IsPlugin(iPlugin, s1) then begin DrawStyle := dsPlugin; - iPlugin := s1; iPluginArgs := Copy(S, Length(s1)+2, 255); Exit; end else @@ -182,7 +191,6 @@ begin Exit; end; - GetFrames(S); if (f1=nil) or (f2=nil) then Exit; if (f1.d1=nil) or (f2.d1=nil) then Exit; @@ -257,15 +265,15 @@ begin case DrawStyle of dsCopy: begin - ddck.dwColorSpaceLowValue := 0; - ddck.dwColorSpaceHighValue := 0; + ddck.dwColorSpaceLowValue := TransColor; + ddck.dwColorSpaceHighValue := TransColor; DF.dwsize := SizeOf(DF); DF.dwROP := cmSrcCopy; DF.dwDDFX := 0; DF.ddckSrcColorkey := ddck; DF.ddckDestColorkey := ddck; bltFlags := DDBLT_DDFX; - if Transparent then bltFlags := bltFlags or DDBLT_KEYSRCOVERRIDE; + if Transparent then bltFlags := bltFlags or DDBLT_KEYSRCOVERRIDE;//OVERRIDE; if MirrorLeftRight then DF.dwDDFX := DF.dwDDFX or DDBLTFX_MIRRORLEFTRIGHT; if MirrorUpDown then @@ -341,6 +349,7 @@ begin DestType := rtAll; iAlpha := 50; iAdd := 255; iSub := 255; Transparent := False; + TransColor := 0; MirrorLeftRight := False; MirrorUpDown := False; end; diff --git a/Source/fsframeunit.pas b/Source/fsframeunit.pas index e3316a7..449d8fc 100644 --- a/Source/fsframeunit.pas +++ b/Source/fsframeunit.pas @@ -1,4 +1,4 @@ -{ Copyright (C) 2001 Juha Vehviläinen +{ Copyright (C) 2001-2002 Juha Vehviläinen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 @@ -646,10 +646,14 @@ begin ExtractWord(4, s1, [' ']) // caption ); end else + if s1='TITLE' then begin + s1 := Copy(S, Length(s1)+2, 255); + Caption := s1; + end else if False{your new effect here} then begin end else - if main.Plugins.IsPlugin(s1) then begin - if main.Plugins.CallEffect(d1.Surface, s1, Copy(S, Length(s1)+2, 255)) then + if main.Plugins.IsPlugin(i, s1) then begin + if main.Plugins.CallEffect(d1.Surface, i, Copy(S, Length(s1)+2, 255)) then FlipRequest; end else if pshostunit.IsFilter(s1) then begin @@ -954,9 +958,6 @@ begin end; procedure Tfsframe.HandleDroppedFile(const S: String); -var - i: Integer; - St: String; begin Parse(S); main.SendReturnValues(PdName+'bang=1'); diff --git a/Source/mainunit.pas b/Source/mainunit.pas index 2cb7500..8a4a495 100644 --- a/Source/mainunit.pas +++ b/Source/mainunit.pas @@ -74,9 +74,9 @@ type function ItemCount( const ClassName: String ): Integer; procedure Reset; procedure minimizeall; - procedure ExceptionHandler(Sender: TObject; E: Exception); procedure DropFileHandler(const h: HWND; const DroppedFileName: String); procedure AppMessage(var Msg: Tmsg; var Handled: Boolean); + procedure ExceptionHandler(Sender: TObject; E: Exception); public { Public declarations } RunConfig: Boolean; @@ -89,6 +89,7 @@ type logstate: Boolean; Plugins: TPlugins; SearchPath: TStringList; + FSFolder: String; function CompName(const S: String): String; procedure Parse(const S: String); override; @@ -102,9 +103,20 @@ type function FileExistsInSearchPath(var S: String): Boolean; // modifying S allowed! end; +{$IFDEF FSDLL} + TMainThread = class(TThread) + public + procedure Execute; override; + end; +{$ENDIF} + const - STARTMSG = 'Framestein 0.31 running...'; - MCAPTION = 'Framestein 0.31'; +{$IFDEF FSDLL} + STARTMSG = 'FramesteinLib 0.32 DLL TEST 1 running...'; +{$ELSE} + STARTMSG = 'Framestein 0.32 dev running...'; +{$ENDIF} + MCAPTION = 'Framestein 0.32'; SocketBufferSize = 100000; var @@ -112,6 +124,10 @@ var DockTitle: String; DockHandle: HWND; +{$IFDEF FSDLL} + MainT: TMainThread; +{$ENDIF} + function WinEnumerator(h: HWND; i: LongInt): BOOL; stdcall; function WinEnumerator_Exact(h: HWND; i: LongInt): BOOL; stdcall; function WinEnumerator_SubStr(h: HWND; i: LongInt): BOOL; stdcall; @@ -125,7 +141,23 @@ uses fscopyunit, fstextunit, fsdrawunit, fsbrowserunit, fsinfounit, fsaviunit, fastfiles, - Strz, logunit, configureunit; + Strz, logunit, configureunit, progressunit; + +{$IFDEF FSDLL} +procedure TMainThread.Execute; +begin + Application.Initialize; + Application.Title := ''; + Application.CreateForm(Tmain, main); + Application.CreateForm(Tlog, log); + Application.CreateForm(Tconfigure, configure); + Application.CreateForm(TProgress, Progress); + Application.Run; +// ??? + Application.OnException := nil; + Application.OnMessage := nil; +end; +{$ENDIF} function WinEnumerator(h: HWND; i: LongInt): BOOL; stdcall; var @@ -354,6 +386,7 @@ end; procedure Tmain.FormCreate(Sender: TObject); begin + FSFolder := ExtractFilePath(Application.Exename); Randomize; RunConfig:=False; PdHost := 'localhost'; @@ -384,7 +417,7 @@ begin logstate := False; SearchPath := TStringList.Create; - SearchPath.Add(ExtractFilePath(Application.ExeName)); + SearchPath.Add(FSFolder); Application.OnException := ExceptionHandler; Application.OnMessage := AppMessage; @@ -462,6 +495,9 @@ begin FSPort := Reg.ReadInteger('FSPort'); EnableFSConns := Reg.ReadBool('EnableFSConns'); DockMain := Reg.ReadBool('DockMain'); + FSFolder := Reg.ReadString('FSFolder'); + if FSFolder='' then + FSFolder := ExtractFilePath(Application.Exename); end; except RunConfig := True; @@ -790,6 +826,8 @@ var i: Integer; f: TFsFrame; begin + if main=nil then Exit; + with main do if Pos('1400', E.Message)>0 then begin // invalid window handle // check any fs.frames with invalid window handles // (due to closing a patch with docked fs.frames) @@ -897,6 +935,10 @@ begin if main.ParentWindow<>0 then begin main.ParentWindow:=0; end; + Action := caFree; +{$IFDEF FSDLL} + MainT.Terminate; +{$ENDIF} end; end. diff --git a/Source/pluginunit.pas b/Source/pluginunit.pas index d4fd51e..e238f09 100644 --- a/Source/pluginunit.pas +++ b/Source/pluginunit.pas @@ -1,4 +1,4 @@ -{ Copyright (C) 2001 Juha Vehviläinen +{ Copyright (C) 2001-2002 Juha Vehviläinen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 @@ -49,12 +49,13 @@ type procedure Load; procedure Reload; procedure Clear; - function IsPlugin(const s: String): Boolean; + // IsPlugins sets Index if S is a plugin + function IsPlugin(var Index: Integer; const s: String): Boolean; function CallEffect(const d: TDirectDrawSurface; - const procname: String; const args: String): Boolean; + const procIndex: Integer; const args: String): Boolean; function CallCopy(const d1: TDirectDrawSurface; const d2: TDirectDrawSurface; - const procname: String; const args: String): Boolean; + const procIndex: Integer; const args: String): Boolean; end; implementation @@ -141,7 +142,7 @@ var begin sd := TScanDir.Create(Self); sd.OnHandleFile := LoadHandleFile; - sd.Scan(ExtractFilePath(Application.ExeName)+'\Plugins'); + sd.Scan(main.FSFolder+'\Plugins'); sd.Free; if Names.Count>0 then begin s := ''; @@ -159,27 +160,25 @@ begin Load; end; -function TPlugins.IsPlugin(const s: String): Boolean; +function TPlugins.IsPlugin(var Index: Integer; const s: String): Boolean; begin - Result := Names.IndexOf(s)<>-1; + Index := Names.IndexOf(s); + Result := Index<>-1; end; var argsBuf: array[0..255] of Char; function TPlugins.CallEffect(const d: TDirectDrawSurface; - const procname: String; const args: String): Boolean; + const procIndex: Integer; const args: String): Boolean; var - i: Integer; Proc: TEffectProc; sd: TDDSurfaceDesc; P: PChar; begin Result := False; - if (Names.Count=0) or (d.Width=0) or (d.Height=0) then Exit; - i := Names.IndexOf(procname); - if (i=-1) or (i>=EffectProcs.Count) then Exit; - @Proc := EffectProcs[i]; + if (procIndex=-1) or (procIndex>=EffectProcs.Count) then Exit; + @Proc := EffectProcs[procIndex]; if @Proc=nil then Exit; P:=@argsBuf; P[0]:=#0; @@ -193,21 +192,16 @@ begin end; function TPlugins.CallCopy(const d1, d2: TDirectDrawSurface; - const procname: String; const args: String): Boolean; + const procIndex: Integer; const args: String): Boolean; var - i: Integer; Proc: TCopyProc; sd1: TDDSurfaceDesc; sd2: TDDSurfaceDesc; P: PChar; begin Result := False; - if (Names.Count=0) or - (d1.Width=0) or (d1.Height=0) or - (d2.Width=0) or (d2.Height=0) then Exit; - i := Names.IndexOf(procname); - if (i=-1) or (i>=CopyProcs.Count) then Exit; - @Proc := CopyProcs[i]; + if (procIndex=-1) or (procIndex>=CopyProcs.Count) then Exit; + @Proc := CopyProcs[procIndex]; if @Proc=nil then Exit; P:=@argsBuf; P[0]:=#0; diff --git a/Source/pshostunit.pas b/Source/pshostunit.pas index 42868c3..720e24c 100644 --- a/Source/pshostunit.pas +++ b/Source/pshostunit.pas @@ -22,12 +22,9 @@ uses Windows, Graphics, DIB, mainunit; -var - FilterPath: String; - function FullFilterPath(const S: String): String; begin - Result := FilterPath+'\'+S; + Result := main.FSFolder+'\Filters\'+S; if Uppercase(ExtractFileExt(S))<>'.8BF' then Result := Result+'.8BF'; end; @@ -139,7 +136,5 @@ begin Active := False; end; -begin - FilterPath := ExtractFilePath(Application.ExeName)+'\Filters' end. -- cgit v1.2.1