diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-10-08 18:43:29 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-10-08 18:43:29 +0000 |
commit | 864081102a5f252415f41950b3039a896b4ae9c5 (patch) | |
tree | c6b764651e9dd1f8f53b98eab05f16ba4a492a79 /plugins/Watrack/status/status.pas | |
parent | db5149b48346c417e18add5702a9dfe7f6e28dd0 (diff) |
Awkwars's plugins - welcome to our trunk
git-svn-id: http://svn.miranda-ng.org/main/trunk@1822 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Watrack/status/status.pas')
-rw-r--r-- | plugins/Watrack/status/status.pas | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/plugins/Watrack/status/status.pas b/plugins/Watrack/status/status.pas new file mode 100644 index 0000000000..b5db16bb1c --- /dev/null +++ b/plugins/Watrack/status/status.pas @@ -0,0 +1,142 @@ +{Statistic}
+unit Status;
+{$include compilers.inc}
+interface
+{$Resource status.res}
+implementation
+
+uses
+ windows,messages,commctrl,
+ common,m_api,mirutils,protocols,dbsettings,wrapper,
+ global,wat_api,hlpdlg,CBEx,myRTF,Tmpl;
+
+const
+ HKN_INSERT:PansiChar = 'WAT_Insert';
+
+procedure reghotkey;
+var
+ hkrec:HOTKEYDESC;
+begin
+// if DisablePlugin=dsPermanent then
+// exit;
+ FillChar(hkrec,SizeOf(hkrec),0);
+ with hkrec do
+ begin
+ cbSize :=HOTKEYDESC_SIZE_V1;
+ pszName :=HKN_INSERT;
+ pszDescription.a:='Global WATrack hotkey';
+ pszSection.a :=PluginName;
+ pszService :=MS_WAT_INSERT;
+ DefHotKey :=((HOTKEYF_ALT or HOTKEYF_CONTROL) shl 8) or VK_F5;
+// lParam :=0;
+ end;
+ CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec));
+end;
+
+{$include i_st_vars.inc}
+{$include i_st_rc.inc}
+{$include i_opt_status.inc}
+{$include i_hotkey.inc}
+{$include i_status.inc}
+{$include i_opt_3.inc}
+{$include i_opt_11.inc}
+{$include i_opt_12.inc}
+
+// ------------ base interface functions -------------
+
+var
+ mStatus:twModule;
+
+function InitProc(aGetStatus:boolean=false):integer;
+begin
+ if aGetStatus then
+ begin
+ if GetModStatus=0 then
+ begin
+ result:=0;
+ exit;
+ end;
+ end
+ else
+ SetModStatus(1);
+ result:=1;
+
+ LoadOpt;
+ CreateProtoList;
+ CreateTemplates;
+ hINS:=CreateServiceFunction(MS_WAT_INSERT,@InsertProc);
+ reghotkey;
+ plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+
+// mStatus.ModuleStat:=1;
+
+// if ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT)<>0 then
+// hLTo:=CreateServiceFunction(MS_LISTENINGTO_GETPARSEDTEXT,@ListenProc);
+end;
+
+procedure DeInitProc(aSetDisable:boolean);
+var
+ j:integer;
+begin
+ if aSetDisable then
+ SetModStatus(0);
+
+ for j:=1 to GetNumProto do
+ begin
+ if (SimpleMode<>BST_UNCHECKED) or ((GetProtoSetting(j) and psf_enabled)<>0) then
+ CallProtoService(GetProtoName(j),PS_SET_LISTENINGTO,0,0);
+ end;
+// DestroyServiceFunction(hLTo);
+ DestroyServiceFunction(hINS);
+ UnhookEvent(plStatusHook);
+ FreeProtoList;
+ FreeTemplates;
+
+// mStatus.ModuleStat:=0;
+end;
+
+function AddOptionsPage(var tmpl:pAnsiChar;var proc:pointer;var name:PAnsiChar):integer;
+const
+ count:integer=2;
+begin
+ if count=0 then
+ count:=2;
+ case count of
+ 2: begin
+ tmpl:='COMMON';
+ proc:=@DlgProcOptions3;
+ name:='Status (common)';
+ end;
+ 1: begin
+ if SimpleMode=BST_UNCHECKED then
+ begin
+ tmpl:='TEMPLATE11';
+ proc:=@DlgProcOptions11;
+ end
+ else
+ begin
+ tmpl:='TEMPLATE12';
+ proc:=@DlgProcOptions12;
+ end;
+ name:='Status (templates)';
+ end
+ end;
+
+ dec(count);
+ result:=count;
+end;
+
+procedure Init;
+begin
+ mStatus.Next :=ModuleLink;
+ mStatus.Init :=@InitProc;
+ mStatus.DeInit :=@DeInitProc;
+ mStatus.AddOption :=@AddOptionsPage;
+ mStatus.ModuleName:='Statuses';
+// mStatus.ModuleStat:=0;
+ ModuleLink :=@mStatus;
+end;
+
+begin
+ Init;
+end.
|