diff options
author | George Hazan <george.hazan@gmail.com> | 2016-09-13 18:13:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-09-13 18:13:42 +0000 |
commit | a6b06e8fee136a38231c3c15a438fe5043ed82eb (patch) | |
tree | 8a8d792864ee2fd0e91250ab1475cb3bffecd3a3 | |
parent | f51624f1de698b42024ac7a41470ca347ee6f996 (diff) |
more useless helpers wiped out of pascal code
git-svn-id: http://svn.miranda-ng.org/main/trunk@17293 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | include/delphi/m_database.inc | 70 | ||||
-rw-r--r-- | plugins/Actman/i_options.inc | 2 | ||||
-rw-r--r-- | plugins/Actman/iac_dbrw.pas | 4 | ||||
-rw-r--r-- | plugins/Actman/ua/i_options.inc | 24 | ||||
-rw-r--r-- | plugins/HistoryPlusPlus/hpp_events.pas | 11 | ||||
-rw-r--r-- | plugins/QuickSearch/sr_global.pas | 2 | ||||
-rw-r--r-- | plugins/QuickSearch/sr_window.pas | 2 | ||||
-rw-r--r-- | plugins/Utils.pas/dbsettings.pas | 21 | ||||
-rw-r--r-- | plugins/Watrack/proto/i_proto_dlg.inc | 2 | ||||
-rw-r--r-- | plugins/Watrack/watrack.dpr | 2 | ||||
-rw-r--r-- | plugins/mRadio/i_optdlg.inc | 2 | ||||
-rw-r--r-- | plugins/mRadio/i_search.inc | 4 | ||||
-rw-r--r-- | plugins/mRadio/rbass.pas | 2 | ||||
-rw-r--r-- | plugins/mRadio/rccenter.pas | 10 | ||||
-rw-r--r-- | plugins/mRadio/roptions.pas | 4 |
15 files changed, 43 insertions, 119 deletions
diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc index 15b8755073..b11c097a1e 100644 --- a/include/delphi/m_database.inc +++ b/include/delphi/m_database.inc @@ -389,64 +389,14 @@ const DETF_MSGWINDOW = 2; // show event in message window
DETF_NONOTIFY = 4; // block event notify (e.g. Popups)
-const
- MS_DB_EVENT_REGISTERTYPE:PAnsiChar = 'DB/EventType/Register';
-
- { DB/EventType/Get service (0.7+)
- Retrieves the previously registered database event type, by module & id.
- wParam=(WPARAM)(AnsiChar*)szModule
- lParam=(LPARAM)(int)eventType
- Returns DBEVENTTYPEDESCR* or NULL, if an event isn't found.
- }
- MS_DB_EVENT_GETTYPE:PAnsiChar = 'DB/EventType/Get';
+function DbEvent_RegisterType(et:PDBEVENTTYPEDESCR) : int; stdcall; external AppDll;
- { DB/Event/GetText (0.7.0+)
- Retrieves the event's text
- wParam=0
- lParam=pointer to TDBEVENTGETTEXT
- dbe should be the valid database event read via MS_DB_EVENT_GET
- Only events of type EVENTTYPE_MESSAGE are supported.
+function DbEvent_GetType(szModule:PAnsiChar; eventType:int) : PDBEVENTTYPEDESCR; stdcall; external AppDll;
- egt->dbei should be the valid database event read via db_event_get()
- egt->datatype = DBVT_WCHAR or DBVT_ASCIIZ or DBVT_TCHAR.
- egt->codepage is any valid codepage, CP_ACP by default.
+function DbEvent_GetTextA(dbei:PDBEVENTINFO; codepage:int) : PAnsiChar; stdcall; external AppDll;
+function DbEvent_GetTextW(dbei:PDBEVENTINFO; codepage:int) : PWideChar; stdcall; external AppDll;
- Function returns a pointer to a string in the required format.
- This string should be freed by a call of mir_free
- }
-type
- TDBEVENTGETTEXT = record
- dbei:PDBEVENTINFO;
- datatype:int; // DBVT_ASCIIZ, DBVT_WCHAR (DBVT_TCHAR)
- codepage:int;
- end;
-
-const
- MS_DB_EVENT_GETTEXT:PAnsiChar = 'DB/Event/GetText';
-
- { DB/Event/GetIcon (0.7.0.1+)
- wParam : flags - use LR_SHARED for shared HICON
- lParam : dbei - pointer to DBEVENTINFO
- affect : Retrieves the event's icon
- Returns: HICON (use DestroyIcon to release resources if not LR_SHARED)
- notes : dbei should be a valid database event read via MS_DB_EVENT_GET
- A plugin can register the standard event icon in IcoLib named
- 'eventicon_'+Module+EvtID,like eventicon_ICQ2001. Otherwise, to declare an icon
- with the non-standard name, you can declare the special service,
- Module/GetEventIcon<id>, which will retrieve the custom icon handle (HICON). This
- service function has the same parameters MS_DB_EVENT_GETICON does.
- }
- MS_DB_EVENT_GETICON:PAnsiChar = 'DB/Event/GetIcon';
-
-{ DB/Event/GetString (0.9.0+)
- Converts the event's string to TCHAR* depending on the event's format
- wParam=(LPARAM)(DBEVENTINFO*)dbei
- lParam=(WPARAM)(char*)str - string to be converted
- returns TCHAR* - the converted string
- Caller must free the result using mir_free
-}
-
- MS_DB_EVENT_GETSTRINGT:PAnsiChar = 'DB/Event/GetStringT';
+function DbEvent_GetIcon(dbei:PDBEVENTINFO; flags:int) : HICON; stdcall; external AppDll;
//*************************** Random *******************************
@@ -464,6 +414,7 @@ const Returns: Always returns 0 (successful)
notes : This is set to true initally
}
+const
MS_DB_SETSAFETYMODE:PAnsiChar = 'DB/SetSafetyMode';
//*************************** Modules ******************************
@@ -491,13 +442,7 @@ type const
MS_DB_MODULES_ENUM:PAnsiChar = 'DB/Modules/Enum';
-{ DB/Module/Delete 0.8.0+
-
- Removes all settings for the specified module.
- wParam=Contact's handle or 0 for global settings
- lParam=(LPARAM)(AnsiChar*)szModuleName - the module name to be deleted
-}
- MS_DB_MODULE_DELETE:PAnsiChar = 'DB/Module/Delete';
+function DbModule_Delete(hContact:TMCONTACT; szModuleName:PAnsiChar) : int; stdcall; external AppDll;
//************************** EVENTS ********************************
@@ -512,6 +457,7 @@ const that TMEVENT is in any particular position in the chain.
}
+const
ME_DB_EVENT_ADDED:PAnsiChar = 'DB/Event/Added';
{
diff --git a/plugins/Actman/i_options.inc b/plugins/Actman/i_options.inc index 2dc6af1665..1c7ccec6df 100644 --- a/plugins/Actman/i_options.inc +++ b/plugins/Actman/i_options.inc @@ -467,7 +467,7 @@ begin if v2 then
begin
- DBDeleteSetting(0,DBBranch,opt_numacts);
+ db_unset(0,DBBranch,opt_numacts);
SaveMacros;
MessageBoxW(0,TranslateW(Notes),TranslateW(ConvResult),MB_ICONINFORMATION);
end;
diff --git a/plugins/Actman/iac_dbrw.pas b/plugins/Actman/iac_dbrw.pas index dffd5ca233..416827c598 100644 --- a/plugins/Actman/iac_dbrw.pas +++ b/plugins/Actman/iac_dbrw.pas @@ -213,9 +213,9 @@ begin if (asbuf[0]='*') or (asbuf[StrLen(asbuf)-1]='*') then
DBDeleteGroup(hContact,ambuf,asbuf)
else if asbuf[0]=#0 then
- DBDeleteModule(hContact,ambuf)
+ DbModule_Delete(hContact,ambuf)
else
- DBDeleteSetting(hContact,ambuf,asbuf);
+ db_unset(hContact,ambuf,asbuf);
end
else
begin
diff --git a/plugins/Actman/ua/i_options.inc b/plugins/Actman/ua/i_options.inc index 977ff7891b..fd023c6480 100644 --- a/plugins/Actman/ua/i_options.inc +++ b/plugins/Actman/ua/i_options.inc @@ -30,24 +30,24 @@ begin p^:='*'; inc(p); p^:=#0;
DBDeleteGroup(0,DBBranch,setting);
!!}
- StrCopy(p,opt_Flags); DBDeleteSetting(0,DBBranch,setting);
+ StrCopy(p,opt_Flags); db_unset(0,DBBranch,setting);
- StrCopy(p,opt_TTBTooltip ); DBDeleteSetting(0,DBBranch,setting);
- StrCopy(p,opt_TTBTooltipPressed ); DBDeleteSetting(0,DBBranch,setting);
- StrCopy(p,opt_TTBShowWhenVars ); DBDeleteSetting(0,DBBranch,setting);
+ StrCopy(p,opt_TTBTooltip ); db_unset(0,DBBranch,setting);
+ StrCopy(p,opt_TTBTooltipPressed ); db_unset(0,DBBranch,setting);
+ StrCopy(p,opt_TTBShowWhenVars ); db_unset(0,DBBranch,setting);
- StrCopy(p,opt_TabBTooltip ); DBDeleteSetting(0,DBBranch,setting);
- StrCopy(p,opt_TabBTooltipPressed); DBDeleteSetting(0,DBBranch,setting);
+ StrCopy(p,opt_TabBTooltip ); db_unset(0,DBBranch,setting);
+ StrCopy(p,opt_TabBTooltipPressed); db_unset(0,DBBranch,setting);
for lmenu:=main_menu to HIGH(tMenuType) do
begin
pm:=p;
pm^:=AnsiChar(ORD(lmenu)+ORD('0')); inc(pm);
pm^:='_'; inc(pm);
- StrCopy(pm,opt_MenuPopup ); DBDeleteSetting(0,DBBranch,setting);
- StrCopy(pm,opt_MenuNameVars ); DBDeleteSetting(0,DBBranch,setting);
- StrCopy(pm,opt_MenuShowWhenVars); DBDeleteSetting(0,DBBranch,setting);
- StrCopy(pm,opt_MenuOptions ); DBDeleteSetting(0,DBBranch,setting);
+ StrCopy(pm,opt_MenuPopup ); db_unset(0,DBBranch,setting);
+ StrCopy(pm,opt_MenuNameVars ); db_unset(0,DBBranch,setting);
+ StrCopy(pm,opt_MenuShowWhenVars); db_unset(0,DBBranch,setting);
+ StrCopy(pm,opt_MenuOptions ); db_unset(0,DBBranch,setting);
end;
end;
end;
@@ -55,13 +55,13 @@ end; procedure addSaveUA(setting:pAnsiChar;txt:pWideChar); overload;
begin
- if (txt=nil) or (txt^=#0) then DBDeleteSetting(0,DBBranch,setting)
+ if (txt=nil) or (txt^=#0) then db_unset(0,DBBranch,setting)
else DBWriteUnicode(0,DBBranch,setting,txt);
end;
procedure addSaveUA(setting:pAnsiChar;txt:pAnsiChar); overload;
begin
- if (txt=nil) or (txt^=#0) then DBDeleteSetting(0,DBBranch,setting)
+ if (txt=nil) or (txt^=#0) then db_unset(0,DBBranch,setting)
else DBWriteString(0,DBBranch,setting,txt);
end;
diff --git a/plugins/HistoryPlusPlus/hpp_events.pas b/plugins/HistoryPlusPlus/hpp_events.pas index 848008a37e..f3493adf03 100644 --- a/plugins/HistoryPlusPlus/hpp_events.pas +++ b/plugins/HistoryPlusPlus/hpp_events.pas @@ -298,8 +298,7 @@ begin exit;
end;
end;
- etd := Pointer(CallService(MS_DB_EVENT_GETTYPE, WPARAM(PAnsiChar(Hi.Module)),
- LPARAM(Hi.EventType)));
+ etd := DbEvent_GetType(PAnsiChar(Hi.Module), Hi.EventType);
if etd = nil then
begin
Result := @EventRecords[mtOther];
@@ -525,16 +524,12 @@ end; function GetEventCoreText(EventInfo: TDBEventInfo; var Hi: THistoryItem): Boolean;
var
- dbegt: TDBEVENTGETTEXT;
- msg: Pointer;
+ msg: PWideChar;
begin
Result := False;
- dbegt.dbei := @EventInfo;
- dbegt.datatype := DBVT_WCHAR;
- dbegt.codepage := hi.Codepage;
msg := nil;
try
- msg := Pointer(CallService(MS_DB_EVENT_GETTEXT,0,LPARAM(@dbegt)));
+ msg := DbEvent_GetTextW(@EventInfo, CP_ACP);
Result := Assigned(msg);
except
if Assigned(msg) then mir_free(msg);
diff --git a/plugins/QuickSearch/sr_global.pas b/plugins/QuickSearch/sr_global.pas index 0abc91cf62..d6b60ebed8 100644 --- a/plugins/QuickSearch/sr_global.pas +++ b/plugins/QuickSearch/sr_global.pas @@ -696,7 +696,7 @@ var begin
if DBGetSettingType(0,qs_module,so_flags)=DBVT_DELETED then
begin
- DBDeleteModule(0,qs_module);
+ DbModule_Delete(0,qs_module);
qsopt.flags:=
QSO_SORTBYSTATUS or QSO_DRAWGRID or
QSO_CLIENTICONS or QSO_COLORIZE or
diff --git a/plugins/QuickSearch/sr_window.pas b/plugins/QuickSearch/sr_window.pas index 3ed4343e6d..de7b108950 100644 --- a/plugins/QuickSearch/sr_window.pas +++ b/plugins/QuickSearch/sr_window.pas @@ -539,7 +539,7 @@ begin begin
contact:=FlagBuf[LV_GetLParam(grid,i)].contact;
if container^=#0 then
- DBDeleteSetting(contact,'Tab_SRMsg','containerW')
+ db_unset(contact,'Tab_SRMsg','containerW')
else
DBWriteUnicode(contact,'Tab_SRMsg','containerW',container);
if ((qsopt.flags and QSO_AUTOCLOSE)=0) and (grcol>=0) then
diff --git a/plugins/Utils.pas/dbsettings.pas b/plugins/Utils.pas/dbsettings.pas index df2b28aa22..c60220e3a2 100644 --- a/plugins/Utils.pas/dbsettings.pas +++ b/plugins/Utils.pas/dbsettings.pas @@ -32,13 +32,8 @@ function DBWriteString (hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiCha function DBWriteUTF8 (hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:PAnsiChar):int_ptr;
function DBWriteUnicode(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:PWideChar):int_ptr;
-//function db_free(dbv:PDBVARIANT):int_ptr;
-function DBDeleteSetting(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):int_ptr;
-
function DBDeleteGroup(hContact:TMCONTACT;szModule:PAnsiChar;prefix:PAnsiChar=nil):int_ptr;
-function DBDeleteModule(hContact:TMCONTACT;szModule:PAnsiChar):integer;
-
function DBGetSettingType(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
implementation
@@ -204,12 +199,6 @@ begin result:=db_set_ws(hContact, szModule, szSetting, val);
end;
-function DBDeleteSetting(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):int_ptr;
- {$IFDEF AllowInline}inline;{$ENDIF}
-begin
- result:=db_unset(hContact, szModule, szSetting);
-end;
-
type
ppchar = ^PAnsiChar;
@@ -238,7 +227,7 @@ var begin
if (prefix=nil) or (prefix^=#0) then
begin
- DBDeleteModule(hContact,szModule);
+ DbModule_Delete(hContact,szModule);
result:=0;
exit;
end;
@@ -307,7 +296,7 @@ begin if res then
begin
- DBDeleteSetting(hContact,szModule,ptr);
+ db_unset(hContact,szModule,ptr);
end;
while ptr^<>#0 do inc(ptr);
inc(ptr);
@@ -315,12 +304,6 @@ begin FreeMem(p);
end;
-function DBDeleteModule(hContact:TMCONTACT;szModule:PAnsiChar):integer;
-begin
- result:=0;
- CallService(MS_DB_MODULE_DELETE,hContact,lParam(szModule));
-end;
-
function DBGetSettingType(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
var
ldbv:TDBVARIANT;
diff --git a/plugins/Watrack/proto/i_proto_dlg.inc b/plugins/Watrack/proto/i_proto_dlg.inc index d5c3f2262b..fff194f5d9 100644 --- a/plugins/Watrack/proto/i_proto_dlg.inc +++ b/plugins/Watrack/proto/i_proto_dlg.inc @@ -32,7 +32,7 @@ begin if SendMessage(hwndList,CLM_GETCHECKMARK,hItem,0)<>0 then
DBWriteByte(hContact,strCList,ShareOptText,1)
else
- DBDeleteSetting(hContact,strCList,ShareOptText);
+ db_unset(hContact,strCList,ShareOptText);
end;
hContact:=db_find_next(hContact);
end;
diff --git a/plugins/Watrack/watrack.dpr b/plugins/Watrack/watrack.dpr index f653ec22ea..d766d53b06 100644 --- a/plugins/Watrack/watrack.dpr +++ b/plugins/Watrack/watrack.dpr @@ -557,7 +557,7 @@ begin dbetd.flags :=cdbetd[i].flags;
dbetd.eventType :=cdbetd[i].event;
dbetd.descr :=cdbetd[i].descr;
- CallService(MS_DB_EVENT_REGISTERTYPE,0,TLPARAM(@dbetd));
+ DbEvent_RegisterType(@dbetd);
end;
// Load WATrack modules
diff --git a/plugins/mRadio/i_optdlg.inc b/plugins/mRadio/i_optdlg.inc index 3b13dffae6..69e9ab3971 100644 --- a/plugins/mRadio/i_optdlg.inc +++ b/plugins/mRadio/i_optdlg.inc @@ -172,7 +172,7 @@ begin if dst<>nil then
DBWriteUnicode(i,strCList,optGroup,dst)
else
- DBDeleteSetting(i,strCList,optGroup);
+ db_unset(i,strCList,optGroup);
end
else if loword(wParam)=IDC_ADD_INI then
diff --git a/plugins/mRadio/i_search.inc b/plugins/mRadio/i_search.inc index d6e65e4794..355d91f833 100644 --- a/plugins/mRadio/i_search.inc +++ b/plugins/mRadio/i_search.inc @@ -388,8 +388,8 @@ begin mFreeMem(p);
if l then
begin
- DBDeleteSetting(hContact,strCList,'NotOnList');
- DBDeleteSetting(hContact,strCList,'Hidden');
+ db_unset(hContact,strCList,'NotOnList');
+ db_unset(hContact,strCList,'Hidden');
result:=hContact;
exit;
end;
diff --git a/plugins/mRadio/rbass.pas b/plugins/mRadio/rbass.pas index 41516866ce..509d4e9057 100644 --- a/plugins/mRadio/rbass.pas +++ b/plugins/mRadio/rbass.pas @@ -185,7 +185,7 @@ begin chan:=0;
mFreeMem(StationHeader);
mFreeMem(ActiveURL);
- DBDeleteSetting(ActiveContact,strCList,optStatusMsg);
+ db_unset(ActiveContact,strCList,optStatusMsg);
MyStopBass;
end;
diff --git a/plugins/mRadio/rccenter.pas b/plugins/mRadio/rccenter.pas index 2b8f48b1a7..ef8b77bf9a 100644 --- a/plugins/mRadio/rccenter.pas +++ b/plugins/mRadio/rccenter.pas @@ -81,7 +81,7 @@ begin mFreeMem(buf);
end
else
- DBDeleteSetting(ActiveContact,strCList,optStatusMsg);
+ db_unset(ActiveContact,strCList,optStatusMsg);
end;
{$IFDEF Debug}
@@ -351,7 +351,7 @@ begin SetStatus(ActiveContact,ID_STATUS_OFFLINE);
ActiveContact:=0;
- DBDeleteSetting(0,PluginName,optActiveURL);
+ db_unset(0,PluginName,optActiveURL);
PlayStatus:=RD_STATUS_NOSTATION;
// empty message
@@ -359,10 +359,10 @@ begin RD_STATUS_STOPPED: begin
if ActiveContact<>0 then //!! fools proof
- DBDeleteSetting(ActiveContact,strCList,optStatusMsg);
+ db_unset(ActiveContact,strCList,optStatusMsg);
- DBDeleteSetting(0,PluginName,optTitle);
- DBDeleteSetting(0,PluginName,optArtist);
+ db_unset(0,PluginName,optTitle);
+ db_unset(0,PluginName,optArtist);
PlayStatus:=RD_STATUS_STOPPED;
// empty message
diff --git a/plugins/mRadio/roptions.pas b/plugins/mRadio/roptions.pas index 2932dbbcbd..59fbba0042 100644 --- a/plugins/mRadio/roptions.pas +++ b/plugins/mRadio/roptions.pas @@ -134,8 +134,8 @@ begin while j>Length(Presets) do
begin
dec(j);
- StrCopy(p ,IntToStr(num,j)); DBDeleteSetting(0,PluginName,preset);
- StrCopy(pd,num); DBDeleteSetting(0,PluginName,descr);
+ StrCopy(p ,IntToStr(num,j)); db_unset(0,PluginName,preset);
+ StrCopy(pd,num); db_unset(0,PluginName,descr);
end;
DBWriteByte(0,PluginName,optOldPreset,OldEQPreset);
DBWriteByte(0,PluginName,optPresets ,Length(Presets));
|