From 656be2f50e2998b4bfad0b9556ca6e6c83d83d55 Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 22 Mar 2005 23:33:18 +0000 Subject: [PATCH] works now. :) git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@915 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/qccgui.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/engine/qclib/qccgui.c b/engine/qclib/qccgui.c index 99fb2c0a0..843f2f766 100644 --- a/engine/qclib/qccgui.c +++ b/engine/qclib/qccgui.c @@ -1559,21 +1559,36 @@ static LONG CALLBACK MainWndProc(HWND hWnd,UINT message, TVITEM i; char filename[256]; char itemtext[256]; - nm = lParam; + int oldlen; + int newlen; + nm = (NMHDR*)lParam; if (nm->hwndFrom == projecttree) { switch(nm->code) { - case NM_CLICK: + case NM_DBLCLK: item = TreeView_GetSelection(projecttree); i.hItem = item; i.mask = TVIF_TEXT; i.pszText = itemtext; i.cchTextMax = sizeof(itemtext)-1; - TreeView_GetItem(projecttree, &i); - while(i.hItem) + if (!TreeView_GetItem(projecttree, &i)) + return; + strcpy(filename, i.pszText); + while(item) { item = TreeView_GetParent(projecttree, item); + i.hItem = item; + if (!TreeView_GetItem(projecttree, &i)) + break; + if (!TreeView_GetParent(projecttree, item)) + break; + + oldlen = strlen(filename); + newlen = strlen(i.pszText); + memmove(filename+newlen+1, filename, oldlen+1); + filename[newlen] = '/'; + strncpy(filename, i.pszText, newlen); } EditFile(filename, -1); break; @@ -1903,6 +1918,7 @@ void SetProgsSrc(void) { //add a directory. item.hParent = pi; pi = (HANDLE)SendMessage(projecttree,TVM_INSERTITEM,0,(LPARAM)&item); + item.hParent = pi; } else pi = item.hParent;