summaryrefslogtreecommitdiff
path: root/plugins/Chess4Net/MI/PluginCommonUnit.pas
blob: c2c2bd8d326fd73b5cbf7988b7c46eb99a243bd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
unit PluginCommonUnit;

interface

uses
  ConnectorUnit,
  ControlUnit;

function CreatePluginInstance(Connector: TConnector): IMirandaPlugin;
procedure InitializeControls;
procedure DeinitializeControls;
procedure ErrorDuringPluginStart;

implementation

uses
  Windows, Forms, Dialogs, Graphics, SysUtils, Controls
  // plugin units
  , GlobalsLocalUnit, ManagerUnit.MI, ModalForm;

function CreatePluginInstance(Connector: TConnector): IMirandaPlugin;
begin
  Result := TManagerMIFactory.Create(Connector, ErrorDuringPluginStart);
end;


procedure InitializeControls;
begin
  MirandaPluginPath := MirandaPluginsPath + 'Chess4Net\';
  Chess4NetPath := MirandaPluginPath;
  if (not DirectoryExists(Chess4NetPath)) then
    CreateDir(Chess4NetPath);
  Chess4NetIcon := TIcon.Create;
  Chess4NetIcon.Handle := LoadIcon(hInstance, 'MAINICON');
  pluginIcon := Chess4NetIcon;

  MirandaPluginIcon := Chess4NetIcon;

  InitConnectorGlobals(MSG_INVITATION, PROMPT_HEAD, MSG_DATA_SEPARATOR);
end;


procedure DeinitializeControls;
begin
  StopAllPlugins;
  FreeAndNil(Chess4NetIcon);
end;


procedure ErrorDuringPluginStart;
begin
  TDialogs.ShowMessage('ERROR: Cannot start Chess4Net!');
end;

end.