From 60df08c2f6194702ec180c2d2adf20d3675edae1 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Sat, 14 Jul 2012 19:29:11 +0000 Subject: API update Updater support removed History++ toolbar button fix git-svn-id: http://svn.miranda-ng.org/main/trunk@974 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/interfaces.inc | 5 +- include/delphi/m_api.pas | 10 +++- include/delphi/m_button.inc | 2 +- include/delphi/m_clistint.inc | 21 ++++--- include/delphi/m_core.inc | 6 +- include/delphi/m_fontservice.inc | 2 +- include/delphi/m_helpers.inc | 65 +++++++++++++------- include/delphi/m_langpack.inc | 8 +++ include/delphi/m_timezones.inc | 7 ++- include/delphi/m_toolbar.inc | 96 ----------------------------- include/delphi/m_toptoolbar.inc | 122 ++++++++++++++++++++++++++++++------- include/delphi/m_updater.inc | 126 --------------------------------------- 12 files changed, 184 insertions(+), 286 deletions(-) delete mode 100644 include/delphi/m_toolbar.inc delete mode 100644 include/delphi/m_updater.inc (limited to 'include') diff --git a/include/delphi/interfaces.inc b/include/delphi/interfaces.inc index fd40e34582..09004fff94 100644 --- a/include/delphi/interfaces.inc +++ b/include/delphi/interfaces.inc @@ -23,8 +23,6 @@ const MIID_UIHISTORY :MUUID='{7F7E3D98-CE1F-4962-8284-968550F1D3D9}'; const MIID_AUTOAWAY :MUUID='{9C87F7DC-3BD7-4983-B7FB-B848FDBC91F0}'; const MIID_USERONLINE :MUUID='{130829E0-2463-4FF8-BBC8-CE73C0188442}'; const MIID_IDLE :MUUID='{296F9F3B-5B6F-40E5-8FB0-A6496C18BF0A}'; -const MIID_FONTSERVICE :MUUID='{56F39112-E37F-4234-A9E6-7A811745C175}'; -const MIID_UPDATENOTIFY :MUUID='{4E68B12A-6B54-44DE-8637-F1120DB68140}'; const MIID_CRYPTO :MUUID='{415CA6E1-895F-40E6-87BD-9B396016D0E5}'; // Common plugin interfaces (core plugins) @@ -43,17 +41,16 @@ const MIID_EXTRAICONSSERVICE:MUUID='{62D80749-F169-4592-B44D-3DD6DE9D50C5}'; const MIID_VERSIONINFO :MUUID='{CFEB6325-334E-4052-A645-562193DFCC77}'; const MIID_FOLDERS :MUUID='{CFEBEC29-39EF-4B62-AD38-9A652CA324ED}'; const MIID_BIRTHDAYNOTIFY:MUUID='{CFBA5784-3701-4D83-816A-199C00D4A67A}'; -const MIID_BONSAI :MUUID='{CFAAE811-30E1-4A4F-8784-153CCCB0037A}'; const MIID_EXCHANGE :MUUID='{CFD79A89-9959-4E65-B076-413F98FE0D15}'; const MIID_MIRPY :MUUID='{CFF91A5C-1786-41C1-8886-094B14281F15}'; const MIID_SERVICESLIST :MUUID='{CF4BDF02-5D27-4241-99E5-1951AAB0C454}'; -const MIID_TRANSLATOR :MUUID='{CFB637B0-7217-4C1E-B22A-D922323A5D0B}'; const MIID_TOOLTIPS :MUUID='{BCBDA043-2716-4404-B0FA-3D2D93819E03}'; const MIID_POPUPS :MUUID='{33299069-1919-4FF8-B131-1D072178A766}'; const MIID_LOGWINDOW :MUUID='{C53AFB90-FA44-4304-BC9D-6A841C3905F5}'; const MIID_EVENTNOTIFY :MUUID='{F3D7EC5A-F7EF-45DD-8CA5-B0F6BA18647B}'; const MIID_SRCONTACTS :MUUID='{7CA6050E-BAF7-42D2-B936-0DB9DF572B95}'; const MIID_HISTORYEXPORT :MUUID='{18FA2ADE-E31B-4B5D-953D-0AB25781C604}'; + const MIID_SMILEY :MUUID='{E03C71B2-6DEE-467E-A4F0-DD516745876A}'; const MIID_FLAGS :MUUID='{88A3B66E-C438-4381-BC17-71D99D225F9C}'; const MIID_SPELLCHECKER :MUUID='{26EED12A-7016-4D0F-9B4A-0CAA7E2229F3}'; diff --git a/include/delphi/m_api.pas b/include/delphi/m_api.pas index 56bbe9cf3b..9d04c30ff1 100644 --- a/include/delphi/m_api.pas +++ b/include/delphi/m_api.pas @@ -24,6 +24,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. {$IFDEF WIN32}{$A4}{$ENDIF} {$IFDEF WIN64}{$A8}{$ENDIF} {$ENDIF} +{$IFDEF FPC} + {$DEFINE AllowInline} +{$ELSE} + {$IFDEF NativeCode} // Delphi.NET+ + {$DEFINE AllowInline} + {$ENDIF} +{$ENDIF} + unit m_api; interface @@ -243,7 +251,6 @@ var {$include m_fontservice.inc} {$include m_chat.inc} {$include m_fingerprint.inc} - {$include m_updater.inc} {$include m_variables.inc} {$include m_cluiframes.inc} {$include m_popup.inc} @@ -265,7 +272,6 @@ var {$include m_help.inc} {$include m_proto_listeningto.inc} {$include m_toptoolbar.inc} - {$include m_toolbar.inc} {$include m_msg_buttonsbar.inc} {$include m_json.inc} {$define M_API_UNIT} diff --git a/include/delphi/m_button.inc b/include/delphi/m_button.inc index 7a8860a7ce..dd2c371e66 100644 --- a/include/delphi/m_button.inc +++ b/include/delphi/m_button.inc @@ -86,6 +86,6 @@ const Usage: SendMessage(hwndbutton, BUTTONSETCUSTOM, 0, (LPARAM)&CustomData); Only works on MButtonClass buttons } - BUTTONSETCUSTOM = WM_USER+7; + BUTTONSETCUSTOM = WM_USER + 7; {$ENDIF} diff --git a/include/delphi/m_clistint.inc b/include/delphi/m_clistint.inc index 7a0dd226e3..4bc4b97e37 100644 --- a/include/delphi/m_clistint.inc +++ b/include/delphi/m_clistint.inc @@ -218,22 +218,13 @@ type end; type - PClcCacheEntryBase = pointer; - PClcCacheEntryBaseA = ^ClcCacheEntryBaseA; - ClcCacheEntryBaseA = record + PClcCacheEntryBase = ^ClcCacheEntryBase; + ClcCacheEntryBase = record hContact:THANDLE; name :TCHAR; group :TCHAR; isHidden:int; end; - PClcCacheEntryBaseW = ^ClcCacheEntryBaseW; - ClcCacheEntryBaseW = record - hContact:THANDLE; - name :TCHAR; - szName :PAnsiChar; - group :TCHAR; - isHidden:int; - end; type PCLIST_INTERFACE = ^CLIST_INTERFACE; @@ -479,35 +470,43 @@ var {$ELSE} function IsHContactGroup(h:THANDLE):bool; + {$IFDEF AllowInline}inline;{$ENDIF} begin result:=(h xor HCONTACT_ISGROUP)<(HCONTACT_ISGROUP xor HCONTACT_ISINFO); end; function IsHContactInfo(h:THANDLE):bool; + {$IFDEF AllowInline}inline;{$ENDIF} begin result:=(h and HCONTACT_ISINFO)=HCONTACT_ISINFO; end; function IsHContactContact(h:THANDLE):bool; + {$IFDEF AllowInline}inline;{$ENDIF} begin result:=(h and HCONTACT_ISGROUP)=0; end; function CLCDEFAULT_BKCOLOUR:dword; + {$IFDEF AllowInline}inline;{$ENDIF} begin result:=GetSysColor(COLOR_3DFACE); end; function CLCDEFAULT_TEXTCOLOUR:dword; + {$IFDEF AllowInline}inline;{$ENDIF} begin result:=GetSysColor(COLOR_WINDOWTEXT); end; function CLCDEFAULT_SELBKCOLOUR:dword; + {$IFDEF AllowInline}inline;{$ENDIF} begin result:=GetSysColor(COLOR_HIGHLIGHT); end; function CLCDEFAULT_SELTEXTCOLOUR:dword; + {$IFDEF AllowInline}inline;{$ENDIF} begin result:=GetSysColor(COLOR_HIGHLIGHTTEXT); end; function CLCDEFAULT_HOTTEXTCOLOUR:dword; + {$IFDEF AllowInline}inline;{$ENDIF} begin { if IsWinVer98Plus then diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index 9445241e66..5036322301 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -463,7 +463,11 @@ function ltrimp(str:pAnsiChar):pAnsiChar; stdcall; function wildcmp(name:pAnsiChar; mask:pAnsiChar):int; stdcall; external CoreDLL name 'wildcmp'; - +// mir_free dest, mir_strdup src to dest +function replaceStr(var dest:pAnsiChar; const src:pAnsiChar):pAnsiChar; stdcall; + external CoreDLL name 'replaceStr'; +function replaceStrW(var dest:pWideChar; const src:pWideChar):pWideChar; stdcall; + external CoreDLL name 'replaceStrW'; /////////////////////////////////////////////////////////////////////////////// // text conversion functions diff --git a/include/delphi/m_fontservice.inc b/include/delphi/m_fontservice.inc index f13173ac03..4317ecf2b6 100644 --- a/include/delphi/m_fontservice.inc +++ b/include/delphi/m_fontservice.inc @@ -241,7 +241,7 @@ const // register an effect // wparam = (EffectID *)&effect_id // lparam = hLangpack - MS_EFFECT_REGISTER :pAnsiChar = 'Effect/Register'; + MS_EFFECT_REGISTERA:pAnsiChar = 'Effect/Register'; MS_EFFECT_REGISTERW:pAnsiChar = 'Effect/RegisterW'; // get a effect diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index 8eb4aa804c..c46ad2bb5f 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -8,7 +8,7 @@ function PLUGIN_MAKE_VERSION(a,b,c,d: Cardinal): int; function PLUGIN_CMP_VERSION(verA: LongInt; verB: LongInt): int; function mir_forkthread(aFunc:pThreadFunc; arg:pointer):THANDLE; {inline} -function mir_forkthreadex(aFunc:pThreadFuncEx; arg:pointer; stackSize:int; pThreadID:puint_ptr):THANDLE; {inline} +function mir_forkthreadex(aFunc:pThreadFuncEx; arg:pointer; pThreadID:puint_ptr):THANDLE; {inline} function mir_forkthreadowner(aFunc:pThreadFuncOwner; owner:pointer; arg:pointer; pThreadID:puint_ptr):THANDLE; {inline} function Netlib_CloseHandle(Handle: THandle): int; @@ -35,7 +35,7 @@ function Translate(sz: PAnsiChar): PAnsiChar; function Translatew(sz: PWideChar): PWideChar; function TranslateString(const sz: AnsiString): AnsiString; function TranslateWideString(const sz:WideString):WideString; -function TranslateUnicodeString(sz: String): String;{$ifdef FPC}inline;{$endif} +function TranslateUnicodeString(sz: UnicodeString): UnicodeString; procedure TranslateDialogDefault(hwndDlg: THandle); procedure TranslateMenu(hMenu: HMENU); function Langpack_Register:int_ptr; @@ -71,6 +71,8 @@ procedure ColourRegisterW(pColorID:pColourIDW); procedure EffectRegister(pEffectID:pEffectID); procedure EffectRegisterW(pEffectID:pEffectIDW); +function TopToolbar_AddButton(pButton:PTTBButton):THANDLE; + {$ELSE} function ProtoServiceExists(const proto,service: PAnsiChar): int; @@ -101,11 +103,13 @@ begin end; function CreateVersionStringPlugin(pluginInfo:PPluginInfoEx;buf:PAnsiChar):PAnsiChar; + {$IFDEF AllowInline}inline;{$ENDIF} begin result:=CreateVersionString(pluginInfo^.version,buf); end; function PLUGIN_MAKE_VERSION(a,b,c,d: Cardinal): int; + {$IFDEF AllowInline}inline;{$ENDIF} begin Result := (a shl 24) or (b shl 16) or (c shl 8) or d; end; @@ -122,31 +126,37 @@ begin end; -function mir_forkthread(aFunc:pThreadFunc; arg:pointer):THANDLE; {inline} +function mir_forkthread(aFunc:pThreadFunc; arg:pointer):THANDLE; + {$IFDEF AllowInline}inline;{$ENDIF} begin result:=forkthread(aFunc, 0, arg); end; -function mir_forkthreadex(aFunc:pThreadFuncEx; arg:pointer; stackSize:int; pThreadID:puint_ptr):THANDLE; {inline} +function mir_forkthreadex(aFunc:pThreadFuncEx; arg:pointer; pThreadID:puint_ptr):THANDLE; + {$IFDEF AllowInline}inline;{$ENDIF} begin - result:=forkthreadex(nil, stackSize, aFunc, nil, arg, pThreadID); + result:=forkthreadex(nil, 0, aFunc, nil, arg, pThreadID); end; -function mir_forkthreadowner(aFunc:pThreadFuncOwner; owner:pointer; arg:pointer; pThreadID:puint_ptr):THANDLE; {inline} +function mir_forkthreadowner(aFunc:pThreadFuncOwner; owner:pointer; arg:pointer; pThreadID:puint_ptr):THANDLE; + {$IFDEF AllowInline}inline;{$ENDIF} begin result:=forkthreadex(nil, 0, pThreadFuncEx(aFunc), owner, arg, pThreadID); end; function Netlib_CloseHandle(Handle: THandle): int; + {$IFDEF AllowInline}inline;{$ENDIF} begin Result := CallService(MS_NETLIB_CLOSEHANDLE, Handle, 0); end; function Netlib_GetBase64DecodedBufferSize(const cchEncoded: int): int; + {$IFDEF AllowInline}inline;{$ENDIF} begin Result := (cchEncoded shr 2) * 3; end; function Netlib_GetBase64EncodedBufferSize(const cbDecoded: int): int; + {$IFDEF AllowInline}inline;{$ENDIF} begin Result := (cbDecoded * 4+11) div 12*4+1; end; @@ -172,6 +182,7 @@ begin end; procedure Netlib_Log(hNetLib: THandle; const sz: PAnsiChar); + {$IFDEF AllowInline}inline;{$ENDIF} begin CallService(MS_NETLIB_LOG, hNetLib, lParam(sz)); end; @@ -188,11 +199,13 @@ begin end; function WindowList_Remove(hList: THandle; hWnd: THandle): int_ptr; + {$IFDEF AllowInline}inline;{$ENDIF} begin Result := CallService(MS_UTILS_REMOVEFROMWINDOWLIST, hList, hWnd); end; function WindowList_Find(hList: THandle; hContact: THandle): int_ptr; + {$IFDEF AllowInline}inline;{$ENDIF} begin Result := CallService(MS_UTILS_FINDWINDOWINLIST, hList, hContact); end; @@ -256,18 +269,20 @@ begin end; end; -function lrtrim(str:pAnsiChar):pAnsiChar; {inline} +function lrtrim(str:pAnsiChar):pAnsiChar; + {$IFDEF AllowInline}inline;{$ENDIF} begin result:=ltrim(rtrim(str)); end; -function lrtrimp(str:pAnsiChar):pAnsiChar; {inline} +function lrtrimp(str:pAnsiChar):pAnsiChar; + {$IFDEF AllowInline}inline;{$ENDIF} begin result:=ltrimp(rtrim(str)); end; -function mir_utf8decodeA(const src:pAnsiChar):pAnsiChar; {inline} +function mir_utf8decodeA(const src:pAnsiChar):pAnsiChar; type - ppWideChar = ^pWidechar; + ppWideChar = ^pWidechar; var tmp:pAnsiChar; begin @@ -289,19 +304,17 @@ end; function TranslateString(const sz:AnsiString):AnsiString; begin - Result:=AnsiString(PAnsiChar( - CallService(MS_LANGPACK_TRANSLATESTRING,hLangpack,lparam(@sz)))); + Result:=AnsiString(TranslateA_LP(PAnsiChar(sz),hLangpack)); end; function TranslateWideString(const sz:WideString):WideString; begin - Result:=WideString(PWideChar( - CallService(MS_LANGPACK_TRANSLATESTRING, LANG_UNICODE, lParam(sz)))); + Result:=WideString(TranslateW_LP(PWideChar(sz),hLangpack)); end; -function TranslateUnicodeString(sz: String): String;{$ifdef FPC}inline;{$endif} +function TranslateUnicodeString(sz: UnicodeString): UnicodeString; begin - Result := String(PChar(CallService(MS_LANGPACK_TRANSLATESTRING, LANG_UNICODE, lParam(sz)))); + Result:=UnicodeString(TranslateW_LP(PWideChar(sz),hLangpack)); end; procedure TranslateDialogDefault(hwndDlg: THandle); @@ -350,11 +363,13 @@ end; function LoadSkinnedIcon(id: int): THandle; + {$IFDEF AllowInline}inline;{$ENDIF} begin Result := CallService(MS_SKIN_LOADICON, id, 0); end; function LoadSkinnedProtoIcon(const szProto: PAnsiChar; status: int): THandle; + {$IFDEF AllowInline}inline;{$ENDIF} begin Result := CallService(MS_SKIN_LOADPROTOICON, wParam(szProto), status); end; @@ -372,6 +387,7 @@ begin end; function SkinPlaySound (const name: PAnsiChar): int_ptr; + {$IFDEF AllowInline}inline;{$ENDIF} begin Result := CallService(MS_SKIN_PLAYSOUND, 0, lParam(name)); end; @@ -450,29 +466,34 @@ end; procedure FontRegister(pFontID:pFontID); begin - CallService('Font/Register', WPARAM(pFontID), hLangpack); + CallService(MS_FONT_REGISTERA, WPARAM(pFontID), hLangpack); end; procedure FontRegisterW(pFontID:pFontIDW); begin - CallService('Font/RegisterW', WPARAM(pFontID), hLangpack); + CallService(MS_FONT_REGISTERW, WPARAM(pFontID), hLangpack); end; procedure ColourRegister(pColorID:pColourID); begin - CallService('Colour/Register', WPARAM(pColorID), hLangpack); + CallService(MS_COLOUR_REGISTERA, WPARAM(pColorID), hLangpack); end; procedure ColourRegisterW(pColorID:pColourIDW); begin - CallService('Colour/RegisterW', WPARAM(pColorID), hLangpack); + CallService(MS_COLOUR_REGISTERW, WPARAM(pColorID), hLangpack); end; procedure EffectRegister(pEffectID:pEffectID); begin - CallService('Effect/Register', WPARAM(pEffectID), hLangpack); + CallService(MS_EFFECT_REGISTERA, WPARAM(pEffectID), hLangpack); end; procedure EffectRegisterW(pEffectID:pEffectIDW); begin - CallService('Effect/RegisterW', WPARAM(pEffectID), hLangpack); + CallService(MS_EFFECT_REGISTERW, WPARAM(pEffectID), hLangpack); +end; + +function TopToolbar_AddButton(pButton:PTTBButton):THANDLE; +begin + result:=CallService(MS_TTB_ADDBUTTON, WPARAM(pButton), hLangpack); end; {$ENDIF} diff --git a/include/delphi/m_langpack.inc b/include/delphi/m_langpack.inc index 0db455c5b7..82ec483662 100644 --- a/include/delphi/m_langpack.inc +++ b/include/delphi/m_langpack.inc @@ -112,4 +112,12 @@ const } MS_LANGPACK_RELOAD:PAnsiChar = 'LangPack/Reload'; +{ + retrieves the hLangpack of a plugin by its HINSTANCE + wParam = 0 (ignored) + lParam = (LPARAM)(HINSTANCE)plugin's base address + returns hLangpack if found, or 0 if error occurred +} + MS_LANGPACK_LOOKUPHANDLE:PAnsiChar = 'LangPack/LookupHandle'; + {$ENDIF} diff --git a/include/delphi/m_timezones.inc b/include/delphi/m_timezones.inc index 61bcb69a2b..f73627cea7 100644 --- a/include/delphi/m_timezones.inc +++ b/include/delphi/m_timezones.inc @@ -35,6 +35,9 @@ const LOCAL_TIME_HANDLE = 0; UTC_TIME_HANDLE = pointer(-1); +type + mir_time = int_ptr; + type TIME_API = record cbSize:size_t; @@ -45,7 +48,7 @@ type printDateTime:function(hTZ:THANDLE; szFormat:TChar; szDest:TChar; cbDest:int; dwFlags:dword):int; cdecl; - printTimeStamp:function(hTZ:THANDLE; ts:time_t; szFormat:TChar; szDest:TChar; + printTimeStamp:function(hTZ:THANDLE; ts:mir_time; szFormat:TChar; szDest:TChar; cbDest:int; dwFlags:dword):int; cdecl; prepareList :function (hContact:THANDLE; hWnd:HWND; dwFlags:dword):int; cdecl; @@ -53,7 +56,7 @@ type storeListResults:procedure(hContact:THANDLE; hWnd:HWND; dwFlags:dword); cdecl; getTimeZoneTime:function(hTZ:THANDLE; var st:SYSTEMTIME):int; cdecl; - timeStampToTimeZoneTimeStamp:function(hTZ:THANDLE; ts:time_t):time_t; cdecl; + timeStampToTimeZoneTimeStamp:function(hTZ:THANDLE; ts:mir_time):time_t; cdecl; getTzi:function(hTZ:THANDLE):PTimeZoneInformation; cdecl; getTzName:function(hTZ:THANDLE):TChar; diff --git a/include/delphi/m_toolbar.inc b/include/delphi/m_toolbar.inc deleted file mode 100644 index 75d291b073..0000000000 --- a/include/delphi/m_toolbar.inc +++ /dev/null @@ -1,96 +0,0 @@ -{$IFNDEF M_TOOLBAR} -{$DEFINE M_TOOLBAR} - -// Modern contact list toolbar - -const - TOOLBARBUTTON_ICONIDPREFIX = 'MTB_'; - TOOLBARBUTTON_ICONIDPRIMARYSUFFIX = '_Primary'; - TOOLBARBUTTON_ICONIDSECONDARYSUFFIX = '_Secondary'; - TOOLBARBUTTON_ICONNAMEPRESSEDSUFFIX = 'Pressed'; - -//button flags - TBBF_DISABLED = 1 shl 0; - TBBF_VISIBLE = 1 shl 1; - TBBF_PUSHED = 1 shl 2; - TBBF_SHOWTOOLTIP = 1 shl 3; - TBBF_ISSEPARATOR = 1 shl 5; - TBBF_ISLBUTTON = 1 shl 6; - TBBF_FLEXSIZESEPARATOR = TBBF_ISSEPARATOR or TBBF_PUSHED; - -type - _tagTBButton = record - cbSize :int; // size of structure - pszButtonID :pAnsiChar; // char id of button used to store button info in DB and know about icon - pszButtonName :pAnsiChar; // name of button (not translated) - pszServiceName :pAnsiChar; // service name to be executed - lParam :LPARAM; // param of service to be called - pszTooltipUp :pAnsiChar; - pszTooltipDn :pAnsiChar; - defPos :dword; // default order pos of button (less values are nearer to - // edge)..please use values greater that 100. the default - // buttons has pos: 10,20..90 - tbbFlags :dword; // combine of TBBF_ flags above - ParamDestructor :procedure(var param); //will be called on parameters deletion - hPrimaryIconHandle :THANDLE; - hSecondaryIconHandle:THANDLE; - end; - TBButton = _tagTBButton; - -const -////////////////////////////////////////////////////////////////////////// -// Events -// Only after this event module subscribers should register their buttons -// wparam=lparam=0 -// don't forget to return 0 to continue processing - ME_TB_MODULELOADED:PAnsiChar = 'ToolBar/ModuleLoaded'; - -////////////////////////////////////////////////////////////////////////// -// Services -// -////////////////////////////////////////////////////////////////////////// -// Adding a button -// WPARAM = 0 -// LPARAM = (TBButton *) &description -// LRESULT = (HANDLE) hButton -// in order to correctly process default icons via iconlib it should be -// registered icolib icon with id named: -// 'TBButton_'+pszButtonID+ 'Up' or +'Down' for Push (2-state) buttons - MS_TB_ADDBUTTON:PAnsiChar = 'ToolBar/AddButton'; - -////////////////////////////////////////////////////////////////////////// -// Remove button -// WPARAM = (HANDLE) hButton; -// LPARAM = 0; - MS_TB_REMOVEBUTTON:PAnsiChar = 'ToolBar/RemoveButton'; - -////////////////////////////////////////////////////////////////////////// -// SetState -// WPARAM = (HANDLE) hButton; -// LPARAM = one of below TBST_ states -// LRESULT= old state - TBST_PUSHED = 1; - TBST_RELEASED = 0; - MS_TB_SETBUTTONSTATE:PAnsiChar = 'ToolBar/SetButtonState'; - -////////////////////////////////////////////////////////////////////////// -// SetStatebyId -// WPARAM = (char *) szButtonID; -// LPARAM = one of below TBST_ states -// LRESULT= old state - MS_TB_SETBUTTONSTATEBYID:PAnsiChar = 'ToolBar/SetButtonStateId'; -////////////////////////////////////////////////////////////////////////// -// GetState -// WPARAM = (HANLDE) hButton; -// LPARAM = 0 -// LRESULT= current state - MS_TB_GETBUTTONSTATE:PAnsiChar = 'ToolBar/GetButtonState'; - -////////////////////////////////////////////////////////////////////////// -// GetState -// WPARAM = (char *) szButtonID; -// LPARAM = 0 -// LRESULT= current state - MS_TB_GETBUTTONSTATEBYID:PAnsiChar = 'ToolBar/GetButtonStateId'; - -{$ENDIF} diff --git a/include/delphi/m_toptoolbar.inc b/include/delphi/m_toptoolbar.inc index d990c458e8..ab88c97822 100644 --- a/include/delphi/m_toptoolbar.inc +++ b/include/delphi/m_toptoolbar.inc @@ -1,31 +1,35 @@ {$IFNDEF M_TOPTOOLBAR} {$DEFINE M_TOPTOOLBAR} +const + TTB_OPTDIR = 'TopToolBar'; + //button flags const - TTBBF_DISABLED = 1; - TTBBF_VISIBLE = 2; - TTBBF_PUSHED = 4; - TTBBF_SHOWTOOLTIP = 8; - TTBBF_ISSEPARATOR = 32; - TTBBF_ISLBUTTON = 64; - TTBBF_ICONBYHANDLE = 128; - TTBBF_ISSBUTTON = 256; - TTBBF_ASPUSHBUTTON = 512; + TTBBF_DISABLED = $0001; + TTBBF_VISIBLE = $0002; + TTBBF_PUSHED = $0004; + TTBBF_SHOWTOOLTIP = $0008; + TTBBF_ISSEPARATOR = $0020; + TTBBF_ISLBUTTON = $0040; + TTBBF_ISSBUTTON = $0100; + TTBBF_ASPUSHBUTTON = $0200; type PTTBButton = ^TTBButton; TTBButton = record - cbSize :int; - pszService :PAnsiChar; // or program for lButtons - dwFlags :DWORD; - lParamUp :LPARAM; - wParamUp :WPARAM; - lParamDown :LPARAM; - wParamDown :WPARAM; - name :PAnsiChar; - hIconUp :HICON; // or hIconHandleUp:HANDLE - hIconDn :HICON; // or hIconHandleDn:HANDLE + cbSize :int; + pszService :PAnsiChar; // or program for lButtons + dwFlags :DWORD; + lParamUp :LPARAM; + wParamUp :WPARAM; + lParamDown :LPARAM; + wParamDown :WPARAM; + name :PAnsiChar; + hIconUp :HICON; // or hIconHandleUp:HANDLE + hIconDn :HICON; // or hIconHandleDn:HANDLE + pszTooltipUp :PansiChar; + pszTooltipDn :PansiChar; end; const @@ -43,12 +47,20 @@ const } ME_TTB_MODULELOADED:PAnsiChar = 'TopToolBar/ModuleLoaded'; + +{ + toptoolbar/initbuttons event + wParam = lParam = 0 + Called when the toolbar needs to add default buttons +} + ME_TTB_INITBUTTONS:PAnsiChar = 'TopToolBar/InitButtons'; + { //=== SERVICES === toptoolbar/addbutton service wparam = (TTBButton*)lpTTBButton - lparam = 0 + lparam = (hLangpack) returns: hTTBButton - handle of added button on success, -1 on failure. } MS_TTB_ADDBUTTON:PAnsiChar = 'TopToolBar/AddButton'; @@ -105,4 +117,74 @@ const } MS_TTB_SETBUTTONOPTIONS:PAnsiChar = 'TopToolBar/SetOptions'; +{ + toptoolbar/setcustomproc service + wparam = pfnCustomproc + lparam = procedure parameter + returns: always returns 0. +} + MS_TTB_SETCUSTOMPROC:PAnsiChar = 'TopToolBar/SetCustomProc'; + +const + TTB_WINDOW_HANDLE = THANDLE(-1); + +{ + this procedure is executed on each button on toolbar + and on a toolbar itself with hTTButton == TTB_WINDOW_HANDLE + hTTButton = button handle + hwndBtn = button window handle + userInfo = lParam passed into TopToolbar_SetCustomProc +} +type + pfnCustomProc = procedure(hTTButton:THANDLE; hwndBtn:HWND; userInfo:LPARAM); cdecl; + + +/////////////////////////////////////////////////////////////////////////////// +// Toolbar internal structures + +type + TTBCtrlButton = record + hWindow:HWND; + end; + +type + pfnTTBPainterFunc = procedure(btnctrl:pointer{PTTBCtrl}; hdc:HDC); cdecl; + +type + PTTBCtrl = ^TTBCtrl; + TTBCtrl = record + hWnd :HWND; + hFrame :THANDLE; + nButtonWidth :int; + nButtonHeight:int; + nButtonSpace :int; + nLastHeight :int; // fix against recursion in WM_SIZE + bOrderChanged:boolean; // set by buttons' arrange procedure if the buttons' order was changed + bFlatButtons, + bAutoSize, + bSingleLine :boolean; + + pButtonList :PSortedList; + + lResult :LRESULT; // custom window proc result + fnWindowProc :TWNDPROC; // custom window proc + end; + +type + PTBCtrlCustomize = ^TTBCtrlCustomize; + TTBCtrlCustomize = record + cbLen :size_t; // total length of the internal data structure + fnWindowProc:TWNDPROC; // subclassed windows procedure for the custom button + end; + +{ + Sets the custom painting procedure for a toolbar + wParam = not used + lParam = TTBCtrlCustomize* + Usage: SendMessage(hwndToolbar, TTB_SETCUSTOM, 0, (LPARAM)&CustomData); + Only works on TopToolbars +} +const + TTB_SETCUSTOM = WM_USER+1; + {$ENDIF} diff --git a/include/delphi/m_updater.inc b/include/delphi/m_updater.inc deleted file mode 100644 index ff000f71bf..0000000000 --- a/include/delphi/m_updater.inc +++ /dev/null @@ -1,126 +0,0 @@ -{$IFNDEF M_UPDATER} -{$DEFINE M_UPDATER} - -{ - if you set Update::szUpdateURL to the following value when registering, as - well as setting your beta site and version data, updater will ignore - szVersionURL and pbVersionPrefix, and attempt to find the file listing URL's - from the backend XML data. for this to work, the plugin name in - pluginInfo.shortName must match the file listing exactly (except for case) -} -const - UPDATER_AUTOREGISTER = 'UpdaterAUTOREGISTER'; - -type - PUpdate_tag = ^TUpdate_tag; - TUpdate_tag = record - cbSize : int; - szComponentName : PAnsiChar; // component name as it will appear in the UI - // (will be translated before displaying) - szVersionURL : PAnsiChar; // URL where the current version can be found (NULL to disable) - - pbVersionPrefix : PAnsiChar; // bytes occuring in VersionURL before the version, - // used to locate the version information within - // the URL data (not that this URL could point at - // a binary file - dunno why, but it could :) - cpbVersionPrefix: int; // number of bytes pionted to by pbVersionPrefix - szUpdateURL : PAnsiChar; // URL where dll/zip is located - szBetaVersionURL: PAnsiChar; // URL where the beta version can be found (NULL to disable betas) - - pbBetaVersionPrefix:PAnsiChar; // bytes occuring in VersionURL before the - // version, used to locate the version - // information within the URL data - cpbBetaVersionPrefix:int; // number of bytes pointed to by pbVersionPrefix - szBetaUpdateURL : PAnsiChar; // URL where dll/zip is located - pbVersion : PAnsiChar; // bytes of current version, used for comparison - // with those in VersionURL - cpbVersion : int; // number of bytes pionted to by pbVersion - szBetaChangelogURL:PAnsiChar; // url for displaying changelog for beta versions - end; - TUpdate = TUpdate_tag; - PUpdate = ^TUpdate; - -const - {$IFNDEF WIN64} - OLD_UPDATER_SIZE = SizeOf(TUpdate)-SizeOf(PAnsiChar); - {$ELSE} - OLD_UPDATER_SIZE = SizeOf(TUpdate); - {$ENDIF} - -const - { - register a comonent with the updater - wparam = 0 - lparam = (LPARAM)&Update - } - MS_UPDATE_REGISTER:PAnsiChar = 'Update/Register'; - - { - register the 'easy' way - use this method if you have no beta URL and the - plugin is on the miranda file listing - NOTE: the plugin 'short name' in pluginInfo must match the name of the - plugin on the file listing, exactly (including case) AND the plugin version - string on the file listing must be the string version of the version in - pluginInfo (i.e. 0.0.0.1, so no letters, brackets, etc.) - - wParam = (int)fileID - this is the file ID from the file listing - (i.e. the number at the end of the download link) - lParam = (PLUGININFO*)&pluginInfo - } - MS_UPDATE_REGISTERFL:PAnsiChar = 'Update/RegisterFL'; - - { - this function can be used to 'unregister' components - useful for plugins - that register non-plugin/langpack components and may need to change those - components on the fly - lParam = (AnsiChar *)szComponentName - } - MS_UPDATE_UNREGISTER:PAnsiChar = 'Update/Unregister'; - - { - this event is fired when the startup process is complete, but NOT if a - restart is imminent it is designed for status managment plugins to use as a - trigger for beggining their own startup process - wParam = lParam = 0 (unused) - (added in version 0.1.6.0) - } - ME_UPDATE_STARTUPDONE:PAnsiChar = 'Update/StartupDone'; - - { - this service can be used to enable/disable Updater's global status control - it can be called from the StartupDone event handler - wParam = (BOOL)enable - lParam = 0 - (added in version 0.1.6.0) - } - MS_UPDATE_ENABLESTATUSCONTROL:PAnsiChar = 'Update/EnableStatusControl'; - - { - An description of usage of the above service and event: - Say you are a status control plugin that normally sets protocol or global statuses in your ModulesLoaded event handler. - In order to make yourself 'Updater compatible', you would move the status control code from ModulesLoaded to another function, - say DoStartup. Then, in ModulesLoaded you would check for the existence of the MS_UPDATE_ENABLESTATUSCONTROL service. - If it does not exist, call DoStartup. If it does exist, hook the ME_UPDATE_STARTUPDONE event and call DoStartup from there. You may - also wish to call MS_UPDATE_ENABLESTATUSCONTROL with wParam == FALSE at this time, to disable Updater's own status control feature. - - this service can be used to determine whether updates are possible for a component with the given name - wParam = 0 - lParam = (AnsiChar *)szComponentName - returns TRUE if updates are supported, FALSE otherwise - } - MS_UPDATE_ISUPDATESUPPORTED:PAnsiChar = 'Update/IsUpdateSupported'; - -{ - An description of usage of the above service and event: - Say you are a status control plugin that normally sets protocol or global - statuses in your ModulesLoaded event handler. - In order to make yourself 'updater compatible', you would move the status - control code from ModulesLoaded to another function, say DoStartup. Then, in - ModulesLoaded you would check for the existence of the MS_UPDATE_ENABLESTATUSCONTROL - service. If it does not exist, call DoStartup. If it does exist, hook the - ME_UPDATE_STARTUPDONE event and call DoStartup from there. You may also wish - to call MS_UPDATE_ENABLESTATUSCONTROL with wParam == FALSE at this time, to - disable Updater's own status control feature. -} - -{$ENDIF} -- cgit v1.2.3