Module: wine Branch: refs/heads/master Commit: 0defa4e807f00b6285d0e3fcfede9327870e78a6 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=0defa4e807f00b6285d0e3fc...
Author: Piotr Caban piotr.caban@gmail.com Date: Thu Jun 22 20:00:11 2006 +0200
oleview: Added copy HTML tag functionality.
---
programs/oleview/En.rc | 2 +- programs/oleview/oleview.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/programs/oleview/En.rc b/programs/oleview/En.rc index 94ba40b..0baf385 100644 --- a/programs/oleview/En.rc +++ b/programs/oleview/En.rc @@ -49,7 +49,7 @@ IDM_MENU MENU MENUITEM "Create Instance &On", IDM_CREATEINSTON, GRAYED MENUITEM "&Release Instance", IDM_RELEASEINST, GRAYED MENUITEM SEPARATOR - MENUITEM "Copy &CLSID to clipboard", IDM_COPYCLSID, GRAYED + MENUITEM "Copy C&LSID to clipboard", IDM_COPYCLSID, GRAYED MENUITEM "Copy &HTML object Tag to clipboard", IDM_HTMLTAG, GRAYED MENUITEM SEPARATOR MENUITEM "&View...", IDM_VIEW, GRAYED diff --git a/programs/oleview/oleview.c b/programs/oleview/oleview.c index 3bebfe2..3bd6dbf 100644 --- a/programs/oleview/oleview.c +++ b/programs/oleview/oleview.c @@ -22,6 +22,9 @@ #include "main.h"
GLOBALS globals; static WCHAR wszRegEdit[] = { 'r','e','g','e','d','i','t','.','e','x','e','\0' }; +static WCHAR wszFormat[] = { '<','o','b','j','e','c','t','\n',' ',' ',' ', + 'c','l','a','s','s','i','d','=','"','c','l','s','i','d',':','%','s','"','\n', + '>','\n','<','/','o','b','j','e','c','t','>' };
INT_PTR CALLBACK CreateInstOnProc(HWND hDlgWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -70,6 +73,31 @@ void CopyClsid(HTREEITEM item) } }
+void CopyHTMLTag(HTREEITEM item) +{ + TVITEM tvi; + + memset(&tvi, 0, sizeof(TVITEM)); + tvi.hItem = item; + tvi.cchTextMax = MAX_LOAD_STRING; + SendMessage(globals.hTree, TVM_GETITEM, 0, (LPARAM)&tvi); + + if(OpenClipboard(globals.hMainWnd) && EmptyClipboard() && tvi.lParam) + { + HANDLE hClipData = GlobalAlloc(GHND, sizeof(WCHAR[MAX_LOAD_STRING])); + LPVOID pLoc = GlobalLock(hClipData); + int clsidLen = lstrlenW(((ITEM_INFO *)tvi.lParam)->clsid)-1; + + ((ITEM_INFO *)tvi.lParam)->clsid[clsidLen] = '\0'; + wsprintfW(pLoc, wszFormat, ((ITEM_INFO *)tvi.lParam)->clsid+1); + ((ITEM_INFO *)tvi.lParam)->clsid[clsidLen] = '}'; + + GlobalUnlock(hClipData); + hClipData = SetClipboardData(CF_UNICODETEXT, hClipData); + CloseClipboard(); + } +} + void ResizeChild(void) { RECT client, stat, tool; @@ -150,7 +178,7 @@ void RefreshMenu(HTREEITEM item) EnableMenuItem(hMenu, IDM_VIEW, MF_GRAYED); } parent = TreeView_GetParent(globals.hTree, item); - if(parent==tree.hAID || parent==tree.hGBCC) + if(parent==tree.hAID || parent==tree.hGBCC || parent==tree.hTL) EnableMenuItem(hMenu, IDM_COPYCLSID, MF_ENABLED); }
@@ -174,6 +202,10 @@ int MenuCommand(WPARAM wParam, HWND hWnd hSelect = TreeView_GetSelection(globals.hTree); CopyClsid(hSelect); break; + case IDM_HTMLTAG: + hSelect = TreeView_GetSelection(globals.hTree); + CopyHTMLTag(hSelect); + break; case IDM_CREATEINST: hSelect = TreeView_GetSelection(globals.hTree); CreateInst(hSelect, NULL);