works now. :)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@915 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-03-22 23:33:18 +00:00
parent ade32bfce0
commit 656be2f50e

View file

@ -1559,21 +1559,36 @@ static LONG CALLBACK MainWndProc(HWND hWnd,UINT message,
TVITEM i; TVITEM i;
char filename[256]; char filename[256];
char itemtext[256]; char itemtext[256];
nm = lParam; int oldlen;
int newlen;
nm = (NMHDR*)lParam;
if (nm->hwndFrom == projecttree) if (nm->hwndFrom == projecttree)
{ {
switch(nm->code) switch(nm->code)
{ {
case NM_CLICK: case NM_DBLCLK:
item = TreeView_GetSelection(projecttree); item = TreeView_GetSelection(projecttree);
i.hItem = item; i.hItem = item;
i.mask = TVIF_TEXT; i.mask = TVIF_TEXT;
i.pszText = itemtext; i.pszText = itemtext;
i.cchTextMax = sizeof(itemtext)-1; i.cchTextMax = sizeof(itemtext)-1;
TreeView_GetItem(projecttree, &i); if (!TreeView_GetItem(projecttree, &i))
while(i.hItem) return;
strcpy(filename, i.pszText);
while(item)
{ {
item = TreeView_GetParent(projecttree, 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); EditFile(filename, -1);
break; break;
@ -1903,6 +1918,7 @@ void SetProgsSrc(void)
{ //add a directory. { //add a directory.
item.hParent = pi; item.hParent = pi;
pi = (HANDLE)SendMessage(projecttree,TVM_INSERTITEM,0,(LPARAM)&item); pi = (HANDLE)SendMessage(projecttree,TVM_INSERTITEM,0,(LPARAM)&item);
item.hParent = pi;
} }
else pi = item.hParent; else pi = item.hParent;