diff options
author | Alexey Kulakov <panda75@bk.ru> | 2012-07-18 16:47:22 +0000 |
---|---|---|
committer | Alexey Kulakov <panda75@bk.ru> | 2012-07-18 16:47:22 +0000 |
commit | c4a8c1f0443d1d39fdc0f265a0dcc9356f7092e9 (patch) | |
tree | 8a22a0abdde7a82b258d5cf6f21f209f316e4749 | |
parent | a089c5c2227ad5060cebe9e99ecf785164265104 (diff) |
API update
git-svn-id: http://svn.miranda-ng.org/main/trunk@1017 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | include/delphi/m_api.pas | 64 | ||||
-rw-r--r-- | include/delphi/m_button_int.inc | 71 | ||||
-rw-r--r-- | include/delphi/m_core.inc | 4 | ||||
-rw-r--r-- | include/delphi/m_db_int.inc | 116 | ||||
-rw-r--r-- | include/delphi/m_plugins.inc | 46 |
5 files changed, 199 insertions, 102 deletions
diff --git a/include/delphi/m_api.pas b/include/delphi/m_api.pas index df0069a7ff..133d3cf8b1 100644 --- a/include/delphi/m_api.pas +++ b/include/delphi/m_api.pas @@ -25,20 +25,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. {$IFDEF WIN64}{$A8}{$ENDIF}
{$ENDIF}
{$UNDEF AllowInline}
+
+unit m_api;
+
+interface
+
{$IFDEF FPC}
{$DEFINE AllowInline}
{$ELSE}
{$IFDEF ConditionalExpressions}
- {$IF System.ComiplerVersion >= 22.0}
+ // CompilerVersion defined in SYSTEM module, need to use not earlier
+ {$IF CompilerVersion >= 22}
{$DEFINE AllowInline}
{$IFEND}
{$ENDIF}
{$ENDIF}
-unit m_api;
-
-interface
-
uses
Windows;//, FreeImage;
@@ -166,55 +168,6 @@ const // makeDatabase() error codes
EMKPRF_CREATEFAILED = 1; // for some reason CreateFile() didnt like something
-type
- PDATABASELINK = ^TDATABASELINK;
- TDATABASELINK = record
- cbSize : int;
- {
- returns what the driver can do given the flag
- }
- getCapability : function (flag:int):int; cdecl;
- {
- buf: pointer to a string buffer
- cch: length of buffer
- shortName: if true, the driver should return a short but descriptive name, e.g. "3.xx profile"
- Affect: The database plugin must return a "friendly name" into buf and not exceed cch bytes,
- e.g. "Database driver for 3.xx profiles"
- Returns: 0 on success, non zero on failure
- }
- getFriendlyName : function (buf:PAnsiChar; cch:size_t; shortName:int):int; cdecl;
- {
- profile: pointer to a string which contains full path + name
- Affect: The database plugin should create the profile, the filepath will not exist at
- the time of this call, profile will be C:\..\<name>.dat
- Note: Do not prompt the user in anyway about this operation.
- Note: Do not initialise internal data structures at this point!
- Returns: 0 on success, non zero on failure - error contains extended error information, see EMKPRF_
- }
- makeDatabase : function (profile:PAnsiChar; error:Pint):int; cdecl;
- {
- profile: [in] a null terminated string to file path of selected profile
- error: [in/out] pointer to an int to set with error if any
- Affect: Ask the database plugin if it supports the given profile, if it does it will
- return 0, if it doesnt return 1, with the error set in error -- EGROKPRF_ can be valid error
- condition, most common error would be [EGROKPRF_UNKHEADER]
- Note: Just because 1 is returned, doesnt mean the profile is not supported, the profile might be damaged
- etc.
- Returns: 0 on success, non zero on failure
- }
- grokHeader : function (profile:PAnsiChar; error:Pint):int; cdecl;
- {
- Affect: Tell the database to create all services/hooks that a 3.xx legecy database might support into link
- Returns: 0 on success, nonzero on failure
- }
- Load : function (profile:PAnsiChar):int; cdecl;
- {
- Affect: The database plugin should shutdown, unloading things from the core and freeing internal structures
- Returns: 0 on success, nonzero on failure
- Note: Unload() might be called even if Load() was never called, wasLoaded is set to 1 if Load() was ever called.
- }
- Unload : function (wasLoaded:int):int; cdecl;
- end;
{-- end newpluginapi --}
@@ -223,8 +176,8 @@ var this means only one module can return info, you shouldn't be merging them anyway! }
PLUGININFO: TPLUGININFOEX;
- {$include m_plugins.inc}
{$include m_database.inc}
+ {$include m_db_int.inc}
{$include m_findadd.inc}
{$include m_awaymsg.inc}
{$include m_email.inc}
@@ -265,6 +218,7 @@ var {$include m_smileyadd.inc}
{$include m_tipper.inc}
{$include m_button.inc}
+ {$include m_button_int.inc}
{$include m_dbeditor.inc}
{$include m_userinfoex.inc}
{$include m_imgsrvc.inc}
diff --git a/include/delphi/m_button_int.inc b/include/delphi/m_button_int.inc new file mode 100644 index 0000000000..a358d39938 --- /dev/null +++ b/include/delphi/m_button_int.inc @@ -0,0 +1,71 @@ +{
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+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.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+
+{$IFNDEF M_BUTTON_INT}
+{$DEFINE M_BUTTON_INT}
+
+type
+ IAccPropServices = interface
+ end;
+
+type
+ pMButtonCtrl = pointer;
+ pfnPainterFunc = procedure (mb:pMButtonCtrl; dc:HDC); cdecl;
+
+type
+ MButtonCtrl = record
+ hwnd:HWND;
+ stateId:int; // button state
+ focus:int; // has focus (1 or 0)
+ hFont:HFONT; // font
+ arrow:HICON; // uses down arrow
+ hIcon:HICON;
+ hBitmap:HBITMAP;
+ hThemeButton:THANDLE; // HTHEME
+ hThemeToolbar:THANDLE; // HTHEME
+ cHot:WideChar;
+ hwndToolTips:HWND;
+
+ bIsPushBtn, // button has two states
+ bIsPushed, // is button pushed or not
+ bIsDefault, // default button
+ bIsFlat, // flat button
+ bIsThemed, // themed button
+ bIsSkinned: // skinned button
+ bool;
+ lResult:LRESULT; // custom window proc result
+ fnWindowProc:TWNDPROC; // custom window proc
+ fnPainter:pfnPainterFunc; // custom button painter
+
+ pAccPropServices:^IAccPropServices;
+ end;
+
+/////////////////////////////////////////////////////////////////
+
+type
+ MButtonCustomize = record
+ cbLen :size_t; // total length of the internal data structure
+ fnWindowProc:TWNDPROC; // subclassed windows procedure for the custom button
+ fnPainter :pfnPainterFunc; // custom button painter
+ end;
+
+{$ENDIF}
diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index 5036322301..4a7b6480f0 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -287,15 +287,17 @@ const type
PSortedList = ^TSortedList;
TSortedList = record
- items : ^pointer;
+ items : array of pointer;
realCount: int;
limit : int;
increment: int;
sortFunc : TFSortFunc;
end;
+// BUGGED with limit <> 0. list pointer must befreed by mir_free
function List_Create(limit:int; increment:int):PSortedList;stdcall;
external CoreDLL name 'List_Create';
+
procedure List_Destroy(list:PSortedList);stdcall;
external CoreDLL name 'List_Destroy';
function List_Find(list:PSortedList; value:pointer):pointer;stdcall;
diff --git a/include/delphi/m_db_int.inc b/include/delphi/m_db_int.inc new file mode 100644 index 0000000000..979ee2cb14 --- /dev/null +++ b/include/delphi/m_db_int.inc @@ -0,0 +1,116 @@ +{
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright 2012 Miranda NG project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+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.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+
+{$IFNDEF M_DB_INT}
+{$DEFINE M_DB_INT}
+
+type
+ PMIDatabase = ^TMIDatabase;
+ TMIDatabase = interface
+ procedure SetCacheSafetyMode(val:bool); stdcall;
+
+ function GetContactCount():long; stdcall;
+ function FindFirstContact(const szProto:PAnsiChar = NIL):THANDLE; stdcall;
+ function FindNextContact(hContact:THANDLE; const szProto:PAnsiChar = NIL):THANDLE; stdcall;
+
+ function DeleteContact(hContact:THANDLE):long; stdcall;
+ function AddContact():THANDLE; stdcall;
+ function IsDbContact(hContact:THANDLE):bool; stdcall;
+
+ function GetEventCount(hContact:THANDLE):long; stdcall;
+ function AddEvent(hContact:THANDLE; dbe:PDBEVENTINFO):THANDLE; stdcall;
+ function DeleteEvent(hContact:THANDLE; hDbEvent:THANDLE):bool; stdcall;
+ function GetBlobSize(hDbEvent:THANDLE):long; stdcall;
+ function GetEvent(hDbEvent:THANDLE; dbe:PDBEVENTINFO):bool; stdcall;
+ function MarkEventRead(hContact:THANDLE; hDbEvent:THANDLE):bool; stdcall;
+ function GetEventContact(hDbEvent:THANDLE):THANDLE; stdcall;
+ function FindFirstEvent(hContact:THANDLE):THANDLE; stdcall;
+ function FindFirstUnreadEvent(hContact:THANDLE):THANDLE; stdcall;
+ function FindLastEvent(hContact:THANDLE):THANDLE; stdcall;
+ function FindNextEvent(hDbEvent:THANDLE):THANDLE; stdcall;
+ function FindPrevEvent(hDbEvent:THANDLE):THANDLE; stdcall;
+
+ function EnumModuleNames(pFunc:TDBMODULEENUMPROC; pParam:pointer):bool; stdcall;
+
+ function GetContactSetting (hContact:THANDLE; dbcgs:PDBCONTACTGETSETTING):bool; stdcall;
+ function GetContactSettingStr (hContact:THANDLE; dbcgs:PDBCONTACTGETSETTING):bool; stdcall;
+ function GetContactSettingStatic(hContact:THANDLE; dbcgs:PDBCONTACTGETSETTING):bool; stdcall;
+ function FreeVariant(dbv:PDBVARIANT):bool; stdcall;
+ function WriteContactSetting (hContact:THANDLE; dbcws:PDBCONTACTWRITESETTING):bool; stdcall;
+ function DeleteContactSetting(hContact:THANDLE; dbcgs:PDBCONTACTGETSETTING):bool; stdcall;
+ function EnumContactSettings (hContact:THANDLE; dbces:PDBCONTACTENUMSETTINGS):bool; stdcall;
+ function SetSettingResident (bIsResident:bool; const pszSettingName:PAnsiChar):bool; stdcall;
+ function EnumResidentSettings(pFunc:TDBMODULEENUMPROC; pParam:pointer):bool; stdcall;
+ end;
+
+type
+ PDATABASELINK = ^TDATABASELINK;
+ TDATABASELINK = record
+ cbSize : int;
+ {
+ returns what the driver can do given the flag
+ }
+ getCapability : function (flag:int):int; cdecl;
+ {
+ buf: pointer to a string buffer
+ cch: length of buffer
+ shortName: if true, the driver should return a short but descriptive name, e.g. "3.xx profile"
+ Affect: The database plugin must return a "friendly name" into buf and not exceed cch bytes,
+ e.g. "Database driver for 3.xx profiles"
+ Returns: 0 on success, non zero on failure
+ }
+ getFriendlyName : function (buf:TChar; cch:size_t; shortName:int):int; cdecl;
+ {
+ profile: pointer to a string which contains full path + name
+ Affect: The database plugin should create the profile, the filepath will not exist at
+ the time of this call, profile will be C:\..\<name>.dat
+ Note: Do not prompt the user in anyway about this operation.
+ Note: Do not initialise internal data structures at this point!
+ Returns: 0 on success, non zero on failure - error contains extended error information, see EMKPRF_
+ }
+ makeDatabase : function (profile:TChar; error:Pint):int; cdecl;
+ {
+ profile: [in] a null terminated string to file path of selected profile
+ error: [in/out] pointer to an int to set with error if any
+ Affect: Ask the database plugin if it supports the given profile, if it does it will
+ return 0, if it doesnt return 1, with the error set in error -- EGROKPRF_ can be valid error
+ condition, most common error would be [EGROKPRF_UNKHEADER]
+ Note: Just because 1 is returned, doesnt mean the profile is not supported, the profile might be damaged
+ etc.
+ Returns: 0 on success, non zero on failure
+ }
+ grokHeader : function (profile:TChar; error:Pint):int; cdecl;
+ {
+ Affect: Tell the database to create all services/hooks that a 3.xx legecy database might support into link
+ Returns: 0 on success, nonzero on failure
+ }
+ Load : function (profile:TChar):PMIDatabase; cdecl;
+ {
+ Affect: The database plugin should shutdown, unloading things from the core and freeing internal structures
+ Returns: 0 on success, nonzero on failure
+ Note: Unload() might be called even if Load() was never called, wasLoaded is set to 1 if Load() was ever called.
+ }
+ Unload : function (wasLoaded:int):int; cdecl;
+ end;
+
+{$ENDIF}
diff --git a/include/delphi/m_plugins.inc b/include/delphi/m_plugins.inc deleted file mode 100644 index bb88804666..0000000000 --- a/include/delphi/m_plugins.inc +++ /dev/null @@ -1,46 +0,0 @@ -{
-Miranda IM: the free IM client for Microsoft* Windows*
-
-Copyright 2000-2003 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-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.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-}
-
-{$IFNDEF M_PLUGINS}
-{$DEFINE M_PLUGINS}
-
-{
- Undocumented: Do NOT use.
- Version: 0.3.4.1+ (2004/10/04)
-}
-const
- DBPE_DONE = 1;
- DBPE_CONT = 0;
- DBPE_HALT = -1;
-type
- PPLUGIN_DB_ENUM = ^TPLUGIN_DB_ENUM;
- TPLUGIN_DB_ENUM = record
- cbSize : int;
-// 0 = continue, 1 = found, -1 = stop now
- pfnEnumCallback : function (pluginname:PAnsiChar; link:pointer; lParam:LPARAM):int;cdecl;
- lParam : LPARAM;
- end;
-
-const
- MS_PLUGINS_ENUMDBPLUGINS:PAnsiChar = 'Plugins/DbEnumerate';
-
-{$ENDIF}
|