summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-06 17:14:40 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-06 17:14:47 +0300
commitc09a65cb4153f151ec2eb074614b4ccfe7c22bdb (patch)
tree171522c9a9aaf456bd68484008e7692a6b7d8361 /plugins
parent000d773f687e5931699fc4de4d4b472b6325f3fb (diff)
popups: pascal code cleaning
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Utils.pas/mirutils.pas5
-rw-r--r--plugins/Watrack/lastfm/i_last_api.inc4
-rw-r--r--plugins/Watrack/lastfm/i_last_opt.inc4
-rw-r--r--plugins/Watrack/myshows/i_myshows_api.inc38
-rw-r--r--plugins/Watrack/myshows/i_myshows_opt.inc4
-rw-r--r--plugins/Watrack/popup/pop_dlg.inc2
-rw-r--r--plugins/Watrack/popup/popups.pas153
7 files changed, 65 insertions, 145 deletions
diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas
index 47f28ea776..852223cbda 100644
--- a/plugins/Utils.pas/mirutils.pas
+++ b/plugins/Utils.pas/mirutils.pas
@@ -228,16 +228,13 @@ procedure ShowPopupW(text:PWideChar;title:PWideChar=nil);
var
ppdu:TPOPUPDATAW;
begin
- if not ServiceExists(MS_POPUP_ADDPOPUPW) then
- exit;
-
FillChar(ppdu,SizeOf(TPOPUPDATAW),0);
StrCopyW(ppdu.lpwzText,text,MAX_SECONDLINE-1);
if title<>nil then
StrCopyW(ppdu.lpwzContactName,title,MAX_CONTACTNAME-1)
else
ppdu.lpwzContactName[0]:=' ';
- CallService(MS_POPUP_ADDPOPUPW,wparam(@ppdu),APF_NO_HISTORY);
+ PUAddPopupW(@ppdu,APF_NO_HISTORY);
end;
function TranslateA2W(sz:PAnsiChar):PWideChar;
diff --git a/plugins/Watrack/lastfm/i_last_api.inc b/plugins/Watrack/lastfm/i_last_api.inc
index 3d58bd27dd..f8975305df 100644
--- a/plugins/Watrack/lastfm/i_last_api.inc
+++ b/plugins/Watrack/lastfm/i_last_api.inc
@@ -81,7 +81,7 @@ begin
else if StrCmp(res,'BADAUTH' )=0 then StrCopy(tmp,Translate('Bad Auth. Check login and password'))
else if StrCmp(res,'BADTIME' )=0 then StrCopy(tmp,Translate('Bad TimeStamp'))
else if StrCmp(res,'FAILED',6)=0 then StrCopy(tmp,res+7);
- CallService(MS_POPUP_SHOWMESSAGE,wparam(@request),SM_ERROR);
+ PUShowMessage(@request,SM_ERROR);
end;
mFreeMem(res);
end;
@@ -194,7 +194,7 @@ begin
else if StrCmp(res,'FAILED',6)=0 then
begin
StrCopy(StrCopyE(args,Translate('Last.fm error: ')),res+7);
- CallService(MS_POPUP_SHOWMESSAGE,wparam(@args),SM_NOTIFY);
+ PUShowMessage(@args,SM_NOTIFY);
result:=0;
end;
mFreeMem(res);
diff --git a/plugins/Watrack/lastfm/i_last_opt.inc b/plugins/Watrack/lastfm/i_last_opt.inc
index c629962697..9628dcf163 100644
--- a/plugins/Watrack/lastfm/i_last_opt.inc
+++ b/plugins/Watrack/lastfm/i_last_opt.inc
@@ -23,9 +23,7 @@ begin
mFreeMem(lfm_login ); lfm_login :=DBReadString(0,PluginShort,optLogin);
mFreeMem(lfm_password); lfm_password:=DBReadString(0,PluginShort,optPassword);
if (lfm_login=nil) or (lfm_password=nil) then
- CallService(MS_POPUP_SHOWMESSAGEW,
- wparam(TranslateW('Don''t forget to enter Login and Password to use Last.fm service')),
- SM_WARNING);
+ PUShowMessageW(TranslateW('Don''t forget to enter Login and Password to use Last.fm service'), SM_WARNING);
end;
procedure FreeOpt;
diff --git a/plugins/Watrack/myshows/i_myshows_api.inc b/plugins/Watrack/myshows/i_myshows_api.inc
index 25593311d7..f92df86b50 100644
--- a/plugins/Watrack/myshows/i_myshows_api.inc
+++ b/plugins/Watrack/myshows/i_myshows_api.inc
@@ -36,10 +36,7 @@ begin
end;
StrCopyW(StrCopyEW(buf,'MyShows: '),TranslateW(ppc));
- if ServiceExists(MS_POPUP_SHOWMESSAGEW) then
- CallService(MS_POPUP_SHOWMESSAGEW,TWPARAM(@buf),SM_WARNING)
- else
- MessageBoxW(0,@buf,'ERROR',MB_ICONERROR)
+ PUShowMessage(@buf,SM_WARNING);
end;
function GetMD5Str(const digest:TMD5Hash; buf:pAnsiChar):PAnsiChar;
@@ -199,28 +196,25 @@ begin
if SendMSRequest(buf,show) then
begin
//!! add option to show it??
- if ServiceExists(MS_POPUP_SHOWMESSAGEW) then
- begin
- jn:=json_get(jroot,'show');
- shId:=json_as_string(json_get(jn,'title'));
+ jn:=json_get(jroot,'show');
+ shId:=json_as_string(json_get(jn,'title'));
- jn:=json_get(jn,'episodes');
- jn:=json_get(jn,'episodes');
- pWideChar(epId):=json_as_string(json_get(jn,'title'));
+ jn:=json_get(jn,'episodes');
+ jn:=json_get(jn,'episodes');
+ pWideChar(epId):=json_as_string(json_get(jn,'title'));
- mGetMem(pc,1024);
- StrCopyW(
+ mGetMem(pc,1024);
+ StrCopyW(
+ StrCopyEW(
StrCopyEW(
StrCopyEW(
- StrCopyEW(
- StrCopyEW(pWideChar(pc),'Show "'),
- shId),
- '"'#13#10'episode "'),
- pWideChar(epId)),
- '" checked');
- CallService(MS_POPUP_SHOWMESSAGEW,TWPARAM(pc),SM_NOTIFY);
- mFreeMem(pc);
- end;
+ StrCopyEW(pWideChar(pc),'Show "'),
+ shId),
+ '"'#13#10'episode "'),
+ pWideChar(epId)),
+ '" checked');
+ PUShowMessage(pc,SM_NOTIFY);
+ mFreeMem(pc);
result:=true;
end;
end;
diff --git a/plugins/Watrack/myshows/i_myshows_opt.inc b/plugins/Watrack/myshows/i_myshows_opt.inc
index 125d4deda5..c5696771c6 100644
--- a/plugins/Watrack/myshows/i_myshows_opt.inc
+++ b/plugins/Watrack/myshows/i_myshows_opt.inc
@@ -26,9 +26,7 @@ begin
mFreeMem(msh_login ); msh_login :=DBReadString(0,PluginShort,optLogin);
mFreeMem(msh_password); msh_password:=DBReadString(0,PluginShort,optPassword);
if (msh_login=nil) or (msh_password=nil) then
- CallService(MS_POPUP_SHOWMESSAGEW,
- WPARAM(TranslateW('Don''t forget to enter Login and Password to use MyShows service')),
- SM_WARNING);
+ PUShowMessageW(TranslateW('Don''t forget to enter Login and Password to use MyShows service'), SM_WARNING);
end;
procedure FreeOpt;
diff --git a/plugins/Watrack/popup/pop_dlg.inc b/plugins/Watrack/popup/pop_dlg.inc
index 4ee10e1952..4e76a6c6ed 100644
--- a/plugins/Watrack/popup/pop_dlg.inc
+++ b/plugins/Watrack/popup/pop_dlg.inc
@@ -98,7 +98,7 @@ begin
ppd^.colorBack:=SendMessage(back,CPM_GETCOLOUR,0,0);
ppd^.colorText:=SendMessage(fore,CPM_GETCOLOUR,0,0);
end;
- CallService(MS_POPUP_ADDPOPUPW,twparam(ppd),0);
+ PUAddPopupW(ppd,0);
mFreeMem(ppd);
end;
IDC_DELAYCUST:
diff --git a/plugins/Watrack/popup/popups.pas b/plugins/Watrack/popup/popups.pas
index 604436c835..4bf7f5adc0 100644
--- a/plugins/Watrack/popup/popups.pas
+++ b/plugins/Watrack/popup/popups.pas
@@ -97,8 +97,7 @@ begin
result:=CallServiceSync(MS_WAT_PRESSBUTTON,lParam,0);
end;
UM_FREEPLUGINDATA: begin
- h:=0;
- h:=CallService(MS_POPUP_GETPLUGINDATA,wnd,h);
+ h:=PUGetPluginData(wnd);
if h<>0 then
DeleteObject(h);
result:=0;
@@ -144,10 +143,9 @@ end;
procedure ThShowPopup(si:pSongInfo); cdecl;
var
- ppdu:PPOPUPDATAW;
+ ppdu:TPOPUPDATAW;
title,descr:pWideChar;
flag:dword;
- ppd2:PPOPUPDATA2;
Icon:HICON;
sec:integer;
cb,ct:TCOLORREF;
@@ -185,78 +183,35 @@ begin
ct:=0;
end;
- if IsPopup2Present then
+ FillChar(ppdu,SizeOf(TPOPUPDATAW),0);
+ with ppdu do
begin
- mGetMem (ppd2 ,SizeOf(TPOPUPDATA2));
- FillChar(ppd2^,SizeOf(TPOPUPDATA2),0);
- with ppd2^ do
- begin
- cbSize :=SizeOf(TPOPUPDATA2);
- flags :=PU2_UNICODE;
- lchIcon :=Icon;
- colorBack :=cb;
- colorText :=ct;
- PluginWindowProc:=@DumbPopupDlgProc;
-
- pzTitle.w:=title;
- pzText .w:=descr;
-
- if ActionList=nil then
- flag:=0
- else
- begin
- flag :=APF_NEWDATA;
- actionCount:=7;
- lpActions :=ActionList;
- end;
+ if title<>nil then
+ StrCopyW(lpwzContactName,title,MAX_CONTACTNAME-1)
+ else
+ lpwzContactName[0]:=' ';
+ if descr<>nil then
+ StrCopyW(lpwzText,descr,MAX_SECONDLINE-1)
+ else
+ lpwzText[0]:=' ';
- if si.cover<>nil then
- begin
- hbmAvatar:=Image_Load(si.cover, IMGL_WCHAR);
- if hbmAvatar=0 then
- begin
- hbmAvatar:=CallService(MS_UTILS_LOADBITMAPW,0,lparam(si.cover));
- end;
- end;
- PluginData:=pointer(hbmAvatar);
- end;
- CallService(MS_POPUP_ADDPOPUP2,wparam(ppd2),flag);
- mFreeMem(ppd2);
- end
- else
- begin
- mGetMem (ppdu ,SizeOf(TPOPUPDATAW));
- FillChar(ppdu^,SizeOf(TPOPUPDATAW),0);
- with ppdu^ do
+ lchIcon :=Icon;
+ PluginWindowProc:=@DumbPopupDlgProc;
+ iSeconds :=sec;
+ colorBack :=cb;
+ colorText :=ct;
+
+ if ActionList=nil then
+ flag:=0
+ else
begin
- if title<>nil then
- StrCopyW(lpwzContactName,title,MAX_CONTACTNAME-1)
- else
- lpwzContactName[0]:=' ';
- if descr<>nil then
- StrCopyW(lpwzText,descr,MAX_SECONDLINE-1)
- else
- lpwzText[0]:=' ';
-
- lchIcon :=Icon;
- PluginWindowProc:=@DumbPopupDlgProc;
- iSeconds :=sec;
- colorBack :=cb;
- colorText :=ct;
-
- if ActionList=nil then
- flag:=0
- else
- begin
- flag :=APF_NEWDATA;
- icbSize :=SizeOf(TPOPUPDATAW);
- actionCount:=7;
- lpActions :=ActionList;
- end;
+ flag :=0;
+ actionCount:=7;
+ lpActions :=ActionList;
end;
- CallService(MS_POPUP_ADDPOPUPW,wparam(ppdu),flag);
- mFreeMem(ppdu);
end;
+ PUAddPopupW(@ppdu,flag);
+
mFreeMem(title);
mFreeMem(descr);
end;
@@ -339,7 +294,7 @@ begin
begin
mFreeMem(ActionList);
ActionList:=MakeActions;
- CallService(MS_POPUP_REGISTERACTIONS,twparam(ActionList),7);
+ PURegisterActions(ActionList,7);
end;
end;
@@ -385,31 +340,19 @@ var
newstate:boolean;
begin
result:=true;
- // Popups
- newstate:=ServiceExists(MS_POPUP_ADDPOPUPW);
- if newstate=PopupPresent then
- exit;
- PopupPresent:=newstate;
- if PopupPresent then
+ // Popups
+ if PopupPresent=false then
begin
- IsPopup2Present :=ServiceExists(MS_POPUP_ADDPOPUP2);
+ PopupPresent:=true;
opthook:=HookEvent(ME_OPT_INITIALISE,@OnOptInitialise);
- if ServiceExists(MS_POPUP_REGISTERACTIONS) then
+ if RegisterButtonIcons then
begin
- if RegisterButtonIcons then
- begin
- ActionList:=MakeActions;
- if ActionList<>nil then
- CallService(MS_POPUP_REGISTERACTIONS,wparam(ActionList),7);
- end;
+ ActionList:=MakeActions;
+ if ActionList<>nil then
+ PURegisterActions(ActionList,7);
end;
- end
- else
- begin
- UnhookEvent(opthook);
- mFreeMem(ActionList);
end;
// TTB
@@ -474,28 +417,18 @@ begin
hMenuInfo:=Menu_AddMainMenuItem(@mi);
ActionList:=nil;
- if ServiceExists(MS_POPUP_ADDPOPUPW) then
- begin
- IsPopup2Present := ServiceExists(MS_POPUP_ADDPOPUP2);
- PopupPresent:=true;
- opthook:=HookEvent(ME_OPT_INITIALISE,@OnOptInitialise);
- loadpopup;
- if ServiceExists(MS_POPUP_REGISTERACTIONS) then
- begin
- if RegisterButtonIcons then
- begin
- ActionList:=MakeActions;
- if ActionList<>nil then
- CallService(MS_POPUP_REGISTERACTIONS,wparam(ActionList),7);
- end;
- end;
- end
- else
+ PopupPresent:=true;
+ opthook:=HookEvent(ME_OPT_INITIALISE,@OnOptInitialise);
+ loadpopup;
+
+ if RegisterButtonIcons then
begin
- PopupPresent:=false;
- opthook:=0;
+ ActionList:=MakeActions;
+ if ActionList<>nil then
+ PURegisterActions(ActionList,7);
end;
+
regpophotkey;
plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);