Commit 928966dd authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

oleview: Added some features to IDL data displaying.

parent 83edbac0
...@@ -115,6 +115,7 @@ typedef struct ...@@ -115,6 +115,7 @@ typedef struct
typedef struct typedef struct
{ {
WCHAR *idl; WCHAR *idl;
WCHAR wszInsertAfter[MAX_LOAD_STRING];
INT idlLen; INT idlLen;
}TYPELIB_DATA; }TYPELIB_DATA;
......
...@@ -37,6 +37,8 @@ static const WCHAR wszOpenBrackets1[] = { '[','\0' }; ...@@ -37,6 +37,8 @@ static const WCHAR wszOpenBrackets1[] = { '[','\0' };
static const WCHAR wszCloseBrackets1[] = { ']','\0' }; static const WCHAR wszCloseBrackets1[] = { ']','\0' };
static const WCHAR wszOpenBrackets2[] = { '(','\0' }; static const WCHAR wszOpenBrackets2[] = { '(','\0' };
static const WCHAR wszCloseBrackets2[] = { ')','\0' }; static const WCHAR wszCloseBrackets2[] = { ')','\0' };
static const WCHAR wszOpenBrackets3[] = { '{','\0' };
static const WCHAR wszCloseBrackets3[] = { '}','\0' };
static const WCHAR wszUUID[] = { 'u','u','i','d','\0' }; static const WCHAR wszUUID[] = { 'u','u','i','d','\0' };
...@@ -93,6 +95,25 @@ LPARAM InitializeTLData(void) ...@@ -93,6 +95,25 @@ LPARAM InitializeTLData(void)
return (LPARAM)pTLData; return (LPARAM)pTLData;
} }
void AddChildrenData(HTREEITEM hParent, TYPELIB_DATA *pData)
{
HTREEITEM hCur;
TVITEM tvi;
memset(&tvi, 0, sizeof(&tvi));
hCur = TreeView_GetChild(typelib.hTree, hParent);
do
{
tvi.hItem = hCur;
SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
if(tvi.lParam && ((TYPELIB_DATA *)(tvi.lParam))->idlLen)
AddToTLDataStrW(pData, ((TYPELIB_DATA *)(tvi.lParam))->idl);
}while((hCur = TreeView_GetNextSibling(typelib.hTree, hCur)));
AddToTLDataStrW(pData, pData->wszInsertAfter);
}
void CreateTypeInfo(WCHAR *wszAddTo, WCHAR *wszAddAfter, TYPEDESC tdesc, ITypeInfo *pTypeInfo) void CreateTypeInfo(WCHAR *wszAddTo, WCHAR *wszAddAfter, TYPEDESC tdesc, ITypeInfo *pTypeInfo)
{ {
int i; int i;
...@@ -166,7 +187,7 @@ int EnumVars(ITypeInfo *pTypeInfo, int cVars, HTREEITEM hParent) ...@@ -166,7 +187,7 @@ int EnumVars(ITypeInfo *pTypeInfo, int cVars, HTREEITEM hParent)
WCHAR wszText[MAX_LOAD_STRING]; WCHAR wszText[MAX_LOAD_STRING];
WCHAR wszAfter[MAX_LOAD_STRING]; WCHAR wszAfter[MAX_LOAD_STRING];
U(tvis).item.mask = TVIF_TEXT; U(tvis).item.mask = TVIF_TEXT|TVIF_PARAM;
U(tvis).item.cchTextMax = MAX_LOAD_STRING; U(tvis).item.cchTextMax = MAX_LOAD_STRING;
U(tvis).item.pszText = wszText; U(tvis).item.pszText = wszText;
tvis.hInsertAfter = (HTREEITEM)TVI_LAST; tvis.hInsertAfter = (HTREEITEM)TVI_LAST;
...@@ -184,6 +205,10 @@ int EnumVars(ITypeInfo *pTypeInfo, int cVars, HTREEITEM hParent) ...@@ -184,6 +205,10 @@ int EnumVars(ITypeInfo *pTypeInfo, int cVars, HTREEITEM hParent)
AddToStrW(wszText, wszSpace); AddToStrW(wszText, wszSpace);
AddToStrW(wszText, bstrName); AddToStrW(wszText, bstrName);
AddToStrW(wszText, wszAfter); AddToStrW(wszText, wszAfter);
U(tvis).item.lParam = InitializeTLData();
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszText);
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSemicolon);
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
SendMessage(typelib.hTree, TVM_INSERTITEM, 0, (LPARAM)&tvis); SendMessage(typelib.hTree, TVM_INSERTITEM, 0, (LPARAM)&tvis);
SysFreeString(bstrName); SysFreeString(bstrName);
...@@ -309,6 +334,7 @@ int PopulateTree(void) ...@@ -309,6 +334,7 @@ int PopulateTree(void)
const WCHAR wszHelpString[] = { 'h','e','l','p','s','t','r','i','n','g','\0' }; const WCHAR wszHelpString[] = { 'h','e','l','p','s','t','r','i','n','g','\0' };
const WCHAR wszLibrary[] = { 'l','i','b','r','a','r','y',' ','\0' }; const WCHAR wszLibrary[] = { 'l','i','b','r','a','r','y',' ','\0' };
const WCHAR wszTag[] = { 't','a','g','\0' };
U(tvis).item.mask = TVIF_TEXT|TVIF_PARAM; U(tvis).item.mask = TVIF_TEXT|TVIF_PARAM;
U(tvis).item.cchTextMax = MAX_LOAD_STRING; U(tvis).item.cchTextMax = MAX_LOAD_STRING;
...@@ -361,6 +387,10 @@ int PopulateTree(void) ...@@ -361,6 +387,10 @@ int PopulateTree(void)
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszLibrary); AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszLibrary);
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), bstrName); AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), bstrName);
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine); AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets3);
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter, wszCloseBrackets3);
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter, wszSemicolon);
wsprintfW(wszText, wszFormat, bstrName, bstrData); wsprintfW(wszText, wszFormat, bstrName, bstrData);
SysFreeString(bstrName); SysFreeString(bstrName);
...@@ -377,18 +407,49 @@ int PopulateTree(void) ...@@ -377,18 +407,49 @@ int PopulateTree(void)
memset(wszText, 0, sizeof(wszText)); memset(wszText, 0, sizeof(wszText));
memset(wszAfter, 0, sizeof(wszAfter)); memset(wszAfter, 0, sizeof(wszAfter));
U(tvis).item.lParam = InitializeTLData();
switch(pTypeAttr->typekind) switch(pTypeAttr->typekind)
{ {
#define TKINDADDTOSTR(x) case x:\ case TKIND_ENUM:
AddToStrW(wszText, wsz##x);\ AddToStrW(wszText, wszTKIND_ENUM);
AddToStrW(wszText, bstrName);\ AddToStrW(wszText, bstrName);
break break;
TKINDADDTOSTR(TKIND_ENUM); case TKIND_RECORD:
TKINDADDTOSTR(TKIND_RECORD); AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszTKIND_RECORD);
TKINDADDTOSTR(TKIND_MODULE); AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszTag);
TKINDADDTOSTR(TKIND_INTERFACE); AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), bstrName);
TKINDADDTOSTR(TKIND_COCLASS); AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszSpace);
TKINDADDTOSTR(TKIND_UNION); AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszOpenBrackets3);
AddToTLDataStrW((TYPELIB_DATA*)(U(tvis).item.lParam), wszNewLine);
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
wszCloseBrackets3);
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
wszSpace);
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
bstrName);
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
wszSemicolon);
AddToStrW(((TYPELIB_DATA*)(U(tvis).item.lParam))->wszInsertAfter,
wszNewLine);
AddToStrW(wszText, wszTKIND_RECORD);
AddToStrW(wszText, bstrName);
break;
case TKIND_MODULE:
AddToStrW(wszText, wszTKIND_MODULE);
AddToStrW(wszText, bstrName);
break;
case TKIND_INTERFACE:
AddToStrW(wszText, wszTKIND_INTERFACE);
AddToStrW(wszText, bstrName);
break;
case TKIND_COCLASS:
AddToStrW(wszText, wszTKIND_COCLASS);
AddToStrW(wszText, bstrName);
break;
case TKIND_UNION:
AddToStrW(wszText, wszTKIND_UNION);
AddToStrW(wszText, bstrName);
break;
case TKIND_DISPATCH: case TKIND_DISPATCH:
AddToStrW(wszText, wszTKIND_DISPATCH); AddToStrW(wszText, wszTKIND_DISPATCH);
AddToStrW(wszText, bstrName); AddToStrW(wszText, bstrName);
...@@ -397,6 +458,7 @@ int PopulateTree(void) ...@@ -397,6 +458,7 @@ int PopulateTree(void)
hParent = TreeView_InsertItem(typelib.hTree, &tvis); hParent = TreeView_InsertItem(typelib.hTree, &tvis);
EnumImplTypes(pTypeInfo, pTypeAttr->cImplTypes, hParent); EnumImplTypes(pTypeInfo, pTypeAttr->cImplTypes, hParent);
memset(wszText, 0, sizeof(wszText)); memset(wszText, 0, sizeof(wszText));
U(tvis).item.lParam = InitializeTLData();
ITypeInfo_GetRefTypeInfo(pTypeInfo, hRefType, &pRefTypeInfo); ITypeInfo_GetRefTypeInfo(pTypeInfo, hRefType, &pRefTypeInfo);
ITypeInfo_GetDocumentation(pRefTypeInfo, MEMBERID_NIL, &bstrName, ITypeInfo_GetDocumentation(pRefTypeInfo, MEMBERID_NIL, &bstrName,
...@@ -424,6 +486,8 @@ int PopulateTree(void) ...@@ -424,6 +486,8 @@ int PopulateTree(void)
EnumFuncs(pTypeInfo, pTypeAttr->cFuncs, hParent); EnumFuncs(pTypeInfo, pTypeAttr->cFuncs, hParent);
EnumImplTypes(pTypeInfo, pTypeAttr->cImplTypes, hParent); EnumImplTypes(pTypeInfo, pTypeAttr->cImplTypes, hParent);
AddChildrenData(hParent, (TYPELIB_DATA*)(U(tvis).item.lParam));
ITypeInfo_ReleaseTypeAttr(pTypeInfo, pTypeAttr); ITypeInfo_ReleaseTypeAttr(pTypeInfo, pTypeAttr);
ITypeInfo_Release(pTypeInfo); ITypeInfo_Release(pTypeInfo);
SysFreeString(bstrName); SysFreeString(bstrName);
...@@ -443,7 +507,11 @@ void UpdateData(HTREEITEM item) ...@@ -443,7 +507,11 @@ void UpdateData(HTREEITEM item)
tvi.hItem = item; tvi.hItem = item;
SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi); SendMessage(typelib.hTree, TVM_GETITEM, 0, (LPARAM)&tvi);
if(!tvi.lParam || !((TYPELIB_DATA*)tvi.lParam)->idlLen) return; if(!tvi.lParam)
{
SetWindowText(typelib.hEdit, wszSpace);
return;
}
SetWindowText(typelib.hEdit, ((TYPELIB_DATA*)tvi.lParam)->idl); SetWindowText(typelib.hEdit, ((TYPELIB_DATA*)tvi.lParam)->idl);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment