Update of /cvsroot/jvcl/dev/JVCL3/examples/JvPlugin/6PluginPackage/PlgMainApp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17978/examples/JvPlugin/6PluginPackage/PlgMainApp Modified Files: JvPlgMainApp.dof JvPlgMainApp.res ufrmMain.dfm ufrmMain.pas Log Message: -Mantis #0002278: Expand the 6PluginPackage example Index: JvPlgMainApp.dof =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/examples/JvPlugin/6PluginPackage/PlgMainApp/JvPlgMainApp.dof,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JvPlgMainApp.dof 9 Feb 2004 14:34:19 -0000 1.6 --- JvPlgMainApp.dof 31 Oct 2004 18:24:33 -0000 1.7 *************** *** 4,8 **** UnsafeCast=0 [Directories] ! OutputDir=..\..\..\..\bin UnitOutputDir=..\..\..\..\dcu SearchPath=..\..\..\..\run;..\..\..\..\common --- 4,8 ---- UnsafeCast=0 [Directories] ! OutputDir= UnitOutputDir=..\..\..\..\dcu SearchPath=..\..\..\..\run;..\..\..\..\common Index: JvPlgMainApp.res =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/examples/JvPlugin/6PluginPackage/PlgMainApp/JvPlgMainApp.res,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsRORQTo and /tmp/cvsi43Pu9 differ Index: ufrmMain.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/examples/JvPlugin/6PluginPackage/PlgMainApp/ufrmMain.pas,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ufrmMain.pas 8 Jan 2004 09:50:56 -0000 1.3 --- ufrmMain.pas 31 Oct 2004 18:24:33 -0000 1.4 *************** *** 31,38 **** uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ! StdCtrls, JvPluginManager, ExtCtrls, JvComponent; type ! TfrmMain = class(TForm) JvPluginManager1: TJvPluginManager; Memo1: TMemo; --- 31,38 ---- uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ! StdCtrls, JvPluginManager, ExtCtrls, JvComponent, JvPlgIntf; type ! TfrmMain = class(TForm, IUnknown, IMyMainAppInterface) JvPluginManager1: TJvPluginManager; Memo1: TMemo; *************** *** 45,55 **** procedure butLoadPluginsClick(Sender: TObject); procedure butShowPlugClick(Sender: TObject); ! procedure JvPluginManager1ErrorLoading(Sender: TObject; s: String); procedure butUnloadClick(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private-Deklarationen } public { Public-Deklarationen } end; --- 45,60 ---- procedure butLoadPluginsClick(Sender: TObject); procedure butShowPlugClick(Sender: TObject); ! procedure JvPluginManager1ErrorLoading(Sender: TObject; s: string); procedure butUnloadClick(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private-Deklarationen } + public { Public-Deklarationen } + // + function GetPosition : TPoint; + procedure SetPosition(const NewPos : TPoint); + procedure DoSomethingSpecial(Name: String; OnClick: TNotifyEvent); end; *************** *** 59,131 **** implementation ! uses JvPlugin, JvPlgIntf; {$R *.DFM} procedure TfrmMain.butLoadPluginsClick(Sender: TObject); ! var counter : integer; ! Plug : TJvPlugin; ! MyPlug : IMyPlugInInterface; begin ! butLoadPlugins.Enabled:=False; ! // Loading Plugins ! Memo1.LInes.Add('Looking in '+ExtractFilePath(Application.Exename)+' for Plugins'); ! JvPluginManager1.LoadPlugins; ! Memo1.Lines.Add(IntToStr(JvPluginManager1.PluginCount)+' plugins loaded.'); ! // Check if plugins have correct interface ! counter:=0; ! while counter < JvPluginManager1.PluginCount do ! begin ! Plug:=JvPluginManager1.Plugins[counter]; ! if Plug.GetInterface(IMyPlugInInterface, MyPlug) then ! begin ! Memo1.LInes.Add(IntToStr(counter)+' : '+Plug.Description+' V '+Plug.PluginVersion); ! lstPlugins.Items.Add(Plug.Description+' V '+Plug.PluginVersion); ! Plug.Configure; ! Inc(counter); ! end ! else ! begin ! Memo1.Lines.Add('Warning : Plugin '+Plug.Description+' has unknown interface - unloaded!'); ! JvPluginManager1.UnloadPlugin(counter); ! end; ! end; end; procedure TfrmMain.butShowPlugClick(Sender: TObject); ! var MyPlug : IMyPlugInInterface; begin ! if (lstPlugins.ItemIndex<0) or ! (lstPlugins.ItemIndex>lstPlugins.Items.Count) ! then ! Exit; ! JvPluginManager1.Plugins[lstPlugins.ItemIndex].GetInterface(IMyPlugInInterface, MyPlug); ! MyPlug.ShowPlug(self); end; procedure TfrmMain.JvPluginManager1ErrorLoading(Sender: TObject; ! s: String); begin ! Memo1.Lines.Add(s); end; procedure TfrmMain.butUnloadClick(Sender: TObject); begin ! while JvPluginManager1.PluginCount<>0 do ! JvPluginManager1.UnloadPlugin(0); ! lstPlugins.Clear; ! butLoadPlugins.Enabled:=True; end; procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction); begin ! butUnloadClick(nil); end; end. --- 64,157 ---- implementation ! uses JvPlugin; {$R *.DFM} procedure TfrmMain.butLoadPluginsClick(Sender: TObject); ! var ! counter: integer; ! Plug: TJvPlugin; ! MyPlug: IMyPlugInInterface; begin ! butLoadPlugins.Enabled := False; ! // Loading Plugins ! Memo1.Lines.Add('Looking in ' + ExtractFilePath(Application.Exename) + ' for Plugins'); ! JvPluginManager1.LoadPlugins; ! Memo1.Lines.Add(IntToStr(JvPluginManager1.PluginCount) + ' plugins loaded.'); ! // Check if plugins have correct interface ! counter := 0; ! while counter < JvPluginManager1.PluginCount do ! begin ! Plug := JvPluginManager1.Plugins[counter]; ! if Plug.GetInterface(IMyPlugInInterface, MyPlug) then ! begin ! Memo1.Lines.Add(IntToStr(counter) + ' : ' + Plug.Description + ' V ' + Plug.PluginVersion); ! lstPlugins.Items.Add(Plug.Description + ' V ' + Plug.PluginVersion); ! Plug.Configure; ! MyPlug.Init(Self); // make the plugin aware of the main app ! Inc(counter); ! end ! else ! begin ! Memo1.Lines.Add('Warning : Plugin ' + Plug.Description + ' has unknown interface - unloaded!'); ! JvPluginManager1.UnloadPlugin(counter); ! end; ! end; ! if (lstPlugins.ItemIndex < 0) then ! lstPlugins.ItemIndex := 0; end; procedure TfrmMain.butShowPlugClick(Sender: TObject); ! var ! MyPlug: IMyPlugInInterface; begin ! if (lstPlugins.ItemIndex < 0) or ! (lstPlugins.ItemIndex > lstPlugins.Items.Count) then ! Exit; ! JvPluginManager1.Plugins[lstPlugins.ItemIndex].GetInterface(IMyPlugInInterface, MyPlug); ! MyPlug.ShowPlug(self); end; procedure TfrmMain.JvPluginManager1ErrorLoading(Sender: TObject; ! s: string); begin ! Memo1.Lines.Add(s); end; procedure TfrmMain.butUnloadClick(Sender: TObject); begin ! while JvPluginManager1.PluginCount <> 0 do ! JvPluginManager1.UnloadPlugin(0); ! lstPlugins.Clear; ! butLoadPlugins.Enabled := True; end; procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction); begin ! butUnloadClick(nil); ! end; ! ! procedure TfrmMain.DoSomethingSpecial(Name: String; OnClick: TNotifyEvent); ! begin ! ShowMessageFmt('DoSomethingSpecial was called with "%s" as the Name parameter',[Name]); ! end; ! ! function TfrmMain.GetPosition: TPoint; ! begin ! Result := ClientOrigin; ! end; ! ! procedure TfrmMain.SetPosition(const NewPos: TPoint); ! begin ! Top := NewPos.Y; ! Left := NewPos.X; end; end. + Index: ufrmMain.dfm =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/examples/JvPlugin/6PluginPackage/PlgMainApp/ufrmMain.dfm,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ufrmMain.dfm 19 Feb 2004 22:47:31 -0000 1.2 --- ufrmMain.dfm 31 Oct 2004 18:24:33 -0000 1.3 *************** *** 24,28 **** Top = 0 Width = 3 ! Height = 330 Cursor = crHSplit end --- 24,28 ---- Top = 0 Width = 3 ! Height = 337 Cursor = crHSplit end *************** *** 31,35 **** Top = 0 Width = 374 ! Height = 330 Align = alClient ScrollBars = ssBoth --- 31,35 ---- Top = 0 Width = 374 ! Height = 337 Align = alClient ScrollBars = ssBoth *************** *** 41,45 **** Top = 0 Width = 161 ! Height = 330 Align = alLeft BevelOuter = bvLowered --- 41,45 ---- Top = 0 Width = 161 ! Height = 337 Align = alLeft BevelOuter = bvLowered |