summaryrefslogtreecommitdiff
path: root/plugins/Utils.pas/mApiCardM.pas
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-10 20:15:02 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-10 20:15:02 +0000
commit66a5a3ee980520f1bb690b78e85b6105d0f80347 (patch)
tree6f84f83e07c1af460812090503ec7404cf92b8cd /plugins/Utils.pas/mApiCardM.pas
parentbd7fe0980cf5974c432b789323a3fe2f68a107d3 (diff)
other pascal merge
git-svn-id: http://svn.miranda-ng.org/main/trunk@3966 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Utils.pas/mApiCardM.pas')
-rw-r--r--plugins/Utils.pas/mApiCardM.pas68
1 files changed, 59 insertions, 9 deletions
diff --git a/plugins/Utils.pas/mApiCardM.pas b/plugins/Utils.pas/mApiCardM.pas
index 8a3011153d..6002ee2dbc 100644
--- a/plugins/Utils.pas/mApiCardM.pas
+++ b/plugins/Utils.pas/mApiCardM.pas
@@ -8,14 +8,16 @@ uses windows,messages;
type
tmApiCard = class
private
- function GetDescription:pAnsiChar;
- function GetResultType :pAnsiChar;
+ function GetDescription:pAnsiChar;
+ function GetResultType :pAnsiChar;
procedure SetCurrentService(item:pAnsiChar);
public
constructor Create(fname:pAnsiChar; lparent:HWND=0);
- destructor Free;
+ destructor Destroy; override;
procedure FillList(combo:HWND; mode:integer=0);
+ function NameFromList(cb:HWND):pAnsiChar;
+ function HashToName(ahash:longword):pAnsiChar;
function FillParams(wnd:HWND{;item:pAnsiChar};wparam:boolean):pAnsiChar;
procedure Show;//(item:pAnsiChar);
@@ -39,7 +41,7 @@ function CreateEventCard (parent:HWND=0):tmApiCard;
implementation
-uses common,io,m_api,mirutils,memini;
+uses common,io,m_api,mirutils,memini,wrapper;
{$r mApiCard.res}
@@ -147,10 +149,54 @@ begin
SendMessage(wnd,CB_SETCURSEL,0,0);
end;
+function tmApiCard.HashToName(ahash:longword):pAnsiChar;
+var
+ p,pp:PAnsiChar;
+begin
+ result:=nil;
+ if storage<>nil then
+ begin
+ p:=GetSectionList(storage,namespace);
+ pp:=p;
+ while p^<>#0 do
+ begin
+ if ahash=Hash(p,StrLen(p)) then
+ begin
+ StrDup(result,p);
+ end;
+ while p^<>#0 do inc(p); inc(p);
+ end;
+ FreeSectionList(pp);
+ end;
+end;
+
+function tmApiCard.NameFromList(cb:HWND):pAnsiChar;
+var
+ buf:array [0..255] of AnsiChar;
+ pc:pAnsiChar;
+ idx:integer;
+begin
+ pc:=GetDlgText(cb,true);
+ idx:=SendMessage(cb,CB_GETCURSEL,0,0);
+ if idx<>CB_ERR then
+ begin
+ SendMessageA(cb,CB_GETLBTEXT,idx,lparam(@buf));
+ // edit field is text from list
+ if StrCmp(pc,@buf)=0 then
+ begin
+ result:=HashToName(CB_GetData(cb,idx));
+ exit;
+ end;
+ end;
+ // no select or changed text
+ result:=pc;
+end;
+
procedure tmApiCard.FillList(combo:hwnd; mode:integer=0);
var
tmpbuf:array [0..127] of AnsiChar;
p,pp,pc:PAnsiChar;
+ idx:integer;
begin
if storage<>nil then
begin
@@ -187,7 +233,8 @@ begin
else // just constant value
pc:=p;
end;
- SendMessageA(combo,CB_ADDSTRING,0,lparam(pc));
+ idx:=SendMessageA(combo,CB_ADDSTRING,0,lparam(pc));
+ SendMessageA(combo,CB_SETITEMDATA,idx,Hash(p,StrLen(p)));
while p^<>#0 do inc(p); inc(p);
end;
FreeSectionList(pp);
@@ -239,7 +286,7 @@ begin
SetDlgItemTextA(Dialog,IDC_HLP_ALIAS,
GetParamSectionStr(current,'alias',''));
-
+
FastAnsiToWideBuf(GetParamSectionStr(current,'return','Undefined'),tmp);
SetDlgItemTextW(Dialog,IDC_HLP_RETURN,TranslateW(tmp));
@@ -367,19 +414,22 @@ begin
if fname<>nil then
begin
ConvertFileName(fname,@INIFile);
+ // CallService(MS_UTILS_PATHTOABSOLUTE,
+ // WPARAM(PAnsiChar(ServiceHlpFile)),LPARAM(INIFile));
if GetFSize(pAnsiChar(@INIFile))=0 then
begin
INIFile[0]:=#0;
end;
parent:=lparent;
end;
- storage:=OpenStorage(@IniFile);
+ storage:=OpenStorage(pAnsiChar(@IniFile));
end;
-destructor tmApiCard.Free;
+destructor tmApiCard.Destroy;
begin
CloseStorage(storage);
-// inherited;
+
+ inherited;
end;
function CreateServiceCard(parent:HWND=0):tmApiCard;