From: Nando D. <na...@us...> - 2005-02-23 11:03:14
|
Update of /cvsroot/instantobjects/Source/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18137/Core Modified Files: InstantConnectionManager.pas InstantConnectionManagerForm.pas InstantConsts.pas Log Message: formatting changes to the connection manager & form Index: InstantConsts.pas =================================================================== RCS file: /cvsroot/instantobjects/Source/Core/InstantConsts.pas,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** InstantConsts.pas 22 Feb 2005 14:25:18 -0000 1.7 --- InstantConsts.pas 23 Feb 2005 11:03:01 -0000 1.8 *************** *** 25,29 **** * * Contributor(s): Nando Dessena ! * - Added explicit ordering to externalstored collections. * ***** END LICENSE BLOCK ***** *) --- 25,29 ---- * * Contributor(s): Nando Dessena ! * * ***** END LICENSE BLOCK ***** *) *************** *** 157,161 **** SMissingImplementation = 'Method %s is not implemented in class %s'; SConnectionManagerCaption = 'Connection Manager'; ! SConnectionManExecNotAssigned = 'Error: connection manager execution procedure non available'; SConnectionDefError = 'Error: connection definitions %s not found in file %s'; SConnectionDefFilter = 'Connection files|*.con;*.xml'; --- 157,161 ---- SMissingImplementation = 'Method %s is not implemented in class %s'; SConnectionManagerCaption = 'Connection Manager'; ! SConnectionManagerExecutorNotAssigned = 'Connection manager execution procedure not assigned'; SConnectionDefError = 'Error: connection definitions %s not found in file %s'; SConnectionDefFilter = 'Connection files|*.con;*.xml'; Index: InstantConnectionManagerForm.pas =================================================================== RCS file: /cvsroot/instantobjects/Source/Core/InstantConnectionManagerForm.pas,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** InstantConnectionManagerForm.pas 22 Feb 2005 17:36:48 -0000 1.2 --- InstantConnectionManagerForm.pas 23 Feb 2005 11:03:01 -0000 1.3 *************** *** 24,29 **** * the Initial Developer. All Rights Reserved. * ! * Contributor(s): ! * Carlo Barazzetta * * ***** END LICENSE BLOCK ***** *) --- 24,28 ---- * the Initial Developer. All Rights Reserved. * ! * Contributor(s): Carlo Barazzetta * * ***** END LICENSE BLOCK ***** *) *************** *** 44,52 **** SysUtils, Classes, {$IFDEF MSWINDOWS} ! Windows, Messages, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, ImgList, Menus, ActnList, ExtCtrls, ! StdActns, {$ENDIF} {$IFDEF LINUX} ! QGraphics, QControls, QForms, QDialogs, QActnList, QMenus, QTypes, QImgList, QStdCtrls, QComCtrls, QExtCtrls, {$ENDIF} InstantConnectionManager, InstantClasses, InstantPersistence; --- 43,52 ---- SysUtils, Classes, {$IFDEF MSWINDOWS} ! Windows, Messages, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, ! ImgList, Menus, ActnList, ExtCtrls, StdActns, {$ENDIF} {$IFDEF LINUX} ! QGraphics, QControls, QForms, QDialogs, QActnList, QMenus, QTypes, QImgList, ! QStdCtrls, QComCtrls, QExtCtrls, {$ENDIF} InstantConnectionManager, InstantClasses, InstantPersistence; *************** *** 89,96 **** procedure FormShow(Sender: TObject); procedure FormCreate(Sender: TObject); ! procedure RenameActionExecute(Sender: TObject); //CB {$IFDEF MSWINDOWS} procedure ConnectionViewEditedVCL(Sender: TObject; Item: TListItem; ! var S: String); {$ENDIF} {$IFDEF LINUX} --- 89,96 ---- procedure FormShow(Sender: TObject); procedure FormCreate(Sender: TObject); ! procedure RenameActionExecute(Sender: TObject); {$IFDEF MSWINDOWS} procedure ConnectionViewEditedVCL(Sender: TObject; Item: TListItem; ! var S: string); {$ENDIF} {$IFDEF LINUX} *************** *** 145,149 **** property FileOpenDialog: TOpenDialog read GetOpenDialog; public ! function isManagerConnected : boolean; function DoBuild(ConnectionDef: TInstantConnectionDef): Boolean; virtual; property CurrentConnectionDef: TInstantConnectionDef read GetCurrentConnectionDef write SetCurrentConnectionDef; --- 145,149 ---- property FileOpenDialog: TOpenDialog read GetOpenDialog; public ! function IsManagerConnected: Boolean; function DoBuild(ConnectionDef: TInstantConnectionDef): Boolean; virtual; property CurrentConnectionDef: TInstantConnectionDef read GetCurrentConnectionDef write SetCurrentConnectionDef; *************** *** 700,706 **** end; ! function TInstantConnectionManagerForm.IsManagerConnected: boolean; begin ! Result := ConnectionManager.isConnected; end; --- 700,706 ---- end; ! function TInstantConnectionManagerForm.IsManagerConnected: Boolean; begin ! Result := ConnectionManager.IsConnected; end; *************** *** 708,710 **** --- 708,713 ---- RegisterConnectionManagerExecutor(DefaultConnectionManagerExecutor); + finalization + RegisterConnectionManagerExecutor(nil); + end. Index: InstantConnectionManager.pas =================================================================== RCS file: /cvsroot/instantobjects/Source/Core/InstantConnectionManager.pas,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** InstantConnectionManager.pas 22 Feb 2005 17:36:47 -0000 1.11 --- InstantConnectionManager.pas 23 Feb 2005 11:03:01 -0000 1.12 *************** *** 24,29 **** * the Initial Developer. All Rights Reserved. * ! * Contributor(s): ! * Carlo Barazzetta * ***** END LICENSE BLOCK ***** *) --- 24,29 ---- * the Initial Developer. All Rights Reserved. * ! * Contributor(s): Carlo Barazzetta ! * * ***** END LICENSE BLOCK ***** *) *************** *** 63,67 **** TInstantConnectionManager = class; ! TInstantConnectionManagerExecutor = procedure (ConnectionManager : TInstantConnectionManager); TInstantConnectionManager = class(TComponent) --- 63,67 ---- TInstantConnectionManager = class; ! TInstantConnectionManagerExecutor = procedure (ConnectionManager: TInstantConnectionManager); TInstantConnectionManager = class(TComponent) *************** *** 102,108 **** procedure LoadConnectionDefs; procedure SaveConnectionDefs; ! procedure ConnectByName(const ConnectionDefName : string); procedure Execute; ! function isConnected : boolean; property Model: TInstantModel read GetModel write SetModel; property ConnectionDefs: TInstantConnectionDefs read GetConnectionDefs; --- 102,108 ---- procedure LoadConnectionDefs; procedure SaveConnectionDefs; ! procedure ConnectByName(const ConnectionDefName: string); procedure Execute; ! function IsConnected: Boolean; property Model: TInstantModel read GetModel write SetModel; property ConnectionDefs: TInstantConnectionDefs read GetConnectionDefs; *************** *** 110,126 **** property Caption: string read FCaption write SetCaption; property FileName: string read FFileName write SetFileName; ! property FileFormat : TInstantStreamFormat read FFileFormat write SetFileFormat default sfBinary; ! property VisibleActions: TInstantConnectionManagerActionTypes read FVisibleActions write SetVisibleActions default [atNew, atEdit, atDelete, atRename, atConnect, atDisconnect, atBuild, atOpen]; property OnBuild: TInstantConnectionDefEvent read FOnBuild write SetOnBuild; property OnConnect: TInstantConnectionDefEvent read FOnConnect write SetOnConnect; ! property OnDisconnect: TInstantConnectionDefEvent read FOnDisconnect write SetOnDisconnect; property OnEdit: TInstantConnectionDefEvent read FOnEdit write SetOnEdit; ! property OnIsConnected: TInstantConnectionDefEvent read FOnIsConnected write SetOnIsConnected; property OnPrepare: TInstantConnectorEvent read FOnPrepare write SetOnPrepare; ! property OnSupportConnector: TInstantConnectorClassEvent read FOnSupportConnector write SetOnSupportConnector; end; ! procedure RegisterConnectionManagerExecutor(ConnectionManagerExecutor : TInstantConnectionManagerExecutor); implementation --- 110,131 ---- property Caption: string read FCaption write SetCaption; property FileName: string read FFileName write SetFileName; ! property FileFormat : TInstantStreamFormat ! read FFileFormat write SetFileFormat default sfBinary; ! property VisibleActions: TInstantConnectionManagerActionTypes ! read FVisibleActions write SetVisibleActions default [atNew, atEdit, atDelete, atRename, atConnect, atDisconnect, atBuild, atOpen]; property OnBuild: TInstantConnectionDefEvent read FOnBuild write SetOnBuild; property OnConnect: TInstantConnectionDefEvent read FOnConnect write SetOnConnect; ! property OnDisconnect: TInstantConnectionDefEvent ! read FOnDisconnect write SetOnDisconnect; property OnEdit: TInstantConnectionDefEvent read FOnEdit write SetOnEdit; ! property OnIsConnected: TInstantConnectionDefEvent ! read FOnIsConnected write SetOnIsConnected; property OnPrepare: TInstantConnectorEvent read FOnPrepare write SetOnPrepare; ! property OnSupportConnector: TInstantConnectorClassEvent ! read FOnSupportConnector write SetOnSupportConnector; end; ! procedure RegisterConnectionManagerExecutor(ConnectionManagerExecutor: TInstantConnectionManagerExecutor); implementation *************** *** 130,138 **** var ! ConnManagerExecutor : TInstantConnectionManagerExecutor; ! procedure RegisterConnectionManagerExecutor(ConnectionManagerExecutor : TInstantConnectionManagerExecutor); begin ! ConnManagerExecutor := ConnectionManagerExecutor; end; --- 135,143 ---- var ! _ConnectionManagerExecutor: TInstantConnectionManagerExecutor; ! procedure RegisterConnectionManagerExecutor(ConnectionManagerExecutor: TInstantConnectionManagerExecutor); begin ! _ConnectionManagerExecutor := ConnectionManagerExecutor; end; *************** *** 158,162 **** if Value <> FFileName then begin ! if SameText(ExtractFileExt(Value),'.xml') then FFileFormat := sfXML else --- 163,167 ---- if Value <> FFileName then begin ! if SameText(ExtractFileExt(Value), '.xml') then FFileFormat := sfXML else *************** *** 170,183 **** const Value: TInstantStreamFormat); begin ! if Value <> FFileFormat then ! FFileFormat := Value; end; procedure TInstantConnectionManager.SetModel(Value: TInstantModel); begin ! if Value <> Model then ! begin ! FModel := Value; ! end; end; --- 175,184 ---- const Value: TInstantStreamFormat); begin ! FFileFormat := Value; end; procedure TInstantConnectionManager.SetModel(Value: TInstantModel); begin ! FModel := Value; end; *************** *** 185,192 **** Value: TInstantConnectionDefEvent); begin ! if @Value <> @FOnBuild then ! begin ! FOnBuild := Value; ! end; end; --- 186,190 ---- Value: TInstantConnectionDefEvent); begin ! FOnBuild := Value; end; *************** *** 194,201 **** Value: TInstantConnectionDefEvent); begin ! if @Value <> @FOnConnect then ! begin ! FOnConnect := Value; ! end; end; --- 192,196 ---- Value: TInstantConnectionDefEvent); begin ! FOnConnect := Value; end; *************** *** 203,210 **** Value: TInstantConnectionDefEvent); begin ! if @Value <> @FOnDisconnect then ! begin ! FOnDisconnect := Value; ! end; end; --- 198,202 ---- Value: TInstantConnectionDefEvent); begin ! FOnDisconnect := Value; end; *************** *** 212,219 **** Value: TInstantConnectionDefEvent); begin ! if @Value <> @FOnEdit then ! begin ! FOnEdit := Value; ! end; end; --- 204,208 ---- Value: TInstantConnectionDefEvent); begin ! FOnEdit := Value; end; *************** *** 221,228 **** Value: TInstantConnectionDefEvent); begin ! if @Value <> @FOnIsConnected then ! begin ! FOnIsConnected := Value; ! end; end; --- 210,214 ---- Value: TInstantConnectionDefEvent); begin ! FOnIsConnected := Value; end; *************** *** 230,237 **** Value: TInstantConnectorEvent); begin ! if @Value <> @FOnPrepare then ! begin ! FOnPrepare := Value; ! end; end; --- 216,220 ---- Value: TInstantConnectorEvent); begin ! FOnPrepare := Value; end; *************** *** 239,246 **** Value: TInstantConnectorClassEvent); begin ! if @Value <> @FOnSupportConnector then ! begin ! FOnSupportConnector := Value; ! end; end; --- 222,226 ---- Value: TInstantConnectorClassEvent); begin ! FOnSupportConnector := Value; end; *************** *** 248,260 **** Value: TInstantConnectionManagerActionTypes); begin ! if Value <> FVisibleActions then ! begin ! FVisibleActions := Value; ! end; end; procedure TInstantConnectionManager.ConnectByName(const ConnectionDefName: string); var ! Result : boolean; ConnectionDef : TInstantConnectionDef; begin --- 228,237 ---- Value: TInstantConnectionManagerActionTypes); begin ! FVisibleActions := Value; end; procedure TInstantConnectionManager.ConnectByName(const ConnectionDefName: string); var ! Result: Boolean; ConnectionDef : TInstantConnectionDef; begin *************** *** 264,269 **** OnConnect(Self, ConnectionDef, Result) else ! raise EInstantError.CreateFmt(SConnectionDefError, ! [ConnectionDefName,FileName]); end; --- 241,245 ---- OnConnect(Self, ConnectionDef, Result) else ! raise EInstantError.CreateFmt(SConnectionDefError, [ConnectionDefName, FileName]); end; *************** *** 311,316 **** on E: Exception do raise EInstantError.CreateFmt( ! 'Error loading connection definitions from %s: %s', [DefsFileName, ! E.Message]); end; end; --- 287,292 ---- on E: Exception do raise EInstantError.CreateFmt( ! 'Error loading connection definitions from %s: %s', ! [DefsFileName, E.Message]); end; end; *************** *** 355,359 **** else Result := FileName; ! end else Result := ''; end; --- 331,336 ---- else Result := FileName; ! end ! else Result := ''; end; *************** *** 361,395 **** procedure TInstantConnectionManager.Execute; begin ! if Assigned(ConnManagerExecutor) then ! ConnManagerExecutor(self) else ! //WARNING: ! //If you want to use the default ConnectionmanagerForm (as in a previous version of IO) ! //simply add InstantConnectionManagerForm in uses section of your application ! raise EInstantError.Create(SConnectionManExecNotAssigned); end; procedure TInstantConnectionManager.SetCaption(const Value: string); begin ! if FCaption <> Value then ! begin ! FCaption := Value; ! end; end; function TInstantConnectionManager.isConnected: boolean; var ! i : integer; ! ConnectionDef : TInstantConnectionDef; begin Result := False; if not Assigned(OnIsConnected) then Exit; ! for i := 0 to ConnectionDefs.Count -1 do begin ! ConnectionDef := ConnectionDefs.items[i]; ! OnIsConnected(self, ConnectionDef, Result); if Result then ! break; end; end; --- 338,369 ---- procedure TInstantConnectionManager.Execute; begin ! if Assigned(_ConnectionManagerExecutor) then ! _ConnectionManagerExecutor(Self) else ! // WARNING: ! // If you want to use the default ConnectionManagerForm (as in previous versions of IO) ! // simply add InstantConnectionManagerForm in an uses section of your application. ! raise EInstantError.Create(SConnectionManagerExecutorNotAssigned); end; procedure TInstantConnectionManager.SetCaption(const Value: string); begin ! FCaption := Value; end; function TInstantConnectionManager.isConnected: boolean; var ! i: Integer; ! ConnectionDef: TInstantConnectionDef; begin Result := False; if not Assigned(OnIsConnected) then Exit; ! for i := 0 to ConnectionDefs.Count - 1 do begin ! ConnectionDef := ConnectionDefs.Items[i]; ! OnIsConnected(Self, ConnectionDef, Result); if Result then ! Break; end; end; |