apply this patch,when you double click the item on manager tree,
if item is folder ,the item will expand or collapse.
Index: projectmanager.cpp
===================================================================
--- projectmanager.cpp (revision 5744)
+++ projectmanager.cpp (working copy)
@@ -1761,6 +1761,12 @@
#endif
}
}
+ else if (ftd && ftd->GetKind() == FileTreeData::ftdkVirtualGroup)
+ {
+ #ifdef __WXMSW__
+ m_pTree->IsExpanded(id) ? m_pTree->Collapse(id) : m_pTree->Expand(id);
+ #endif
+ }
else
DoOpenSelectedFile();
}
This is what I expect for long time.
I will apply and test it!
Thanks!!!
Edit
It works OK!
I find a bug.
It seems only the second level of the tree can be open and collapse by double click.
See the screen shot blew:
[attachment deleted by admin]
@ollydbg
thank you for your feedback.
here is the new patch.
Index: projectmanager.cpp
===================================================================
--- projectmanager.cpp (revision 5744)
+++ projectmanager.cpp (working copy)
@@ -1761,6 +1761,12 @@
#endif
}
}
+ else if (ftd && (ftd->GetKind() == FileTreeData::ftdkVirtualGroup || ftd->GetKind() == FileTreeData::ftdkFolder))
+ {
+ #ifdef __WXMSW__
+ m_pTree->IsExpanded(id) ? m_pTree->Collapse(id) : m_pTree->Expand(id);
+ #endif
+ }
else
DoOpenSelectedFile();
}
Ok, I think you should add another option.
It seems the "first tree level" which named "Code::blocks" in my previous image still can't work.
So, it should like:
else if (ftd && (ftd->GetKind() == FileTreeData::ftdkVirtualGroup || ftd->GetKind() == FileTreeData::ftdkFolder) || ftd->GetKind() == XXXXXXX)
:D
the first level is project and had been implemented by prior codes.
it can work when the current project is not that you double click.
The first level is "workplace", then "project".
Till now, these two levels can't work. see my screen shot.
[attachment deleted by admin]
ok , by this patch, everytingn work now.
Index: projectmanager.cpp
===================================================================
--- projectmanager.cpp (revision 5744)
+++ projectmanager.cpp (working copy)
@@ -1754,13 +1754,25 @@
if (ftd->GetProject() != m_pActiveProject)
{
SetProject(ftd->GetProject(), false);
- // prevent item expand state toggle when project is activated
- #ifdef __WXMSW__
- // toggle it one time so that it is toggled back by wx
- m_pTree->IsExpanded(id) ? m_pTree->Collapse(id) : m_pTree->Expand(id);
- #endif
}
+ // prevent item expand state toggle when project is activated
+ #ifdef __WXMSW__
+ // toggle it one time so that it is toggled back by wx
+ m_pTree->IsExpanded(id) ? m_pTree->Collapse(id) : m_pTree->Expand(id);
+ #endif
}
+ else if (ftd && (ftd->GetKind() == FileTreeData::ftdkVirtualGroup || ftd->GetKind() == FileTreeData::ftdkFolder))
+ {
+ #ifdef __WXMSW__
+ m_pTree->IsExpanded(id) ? m_pTree->Collapse(id) : m_pTree->Expand(id);
+ #endif
+ }
+ else if (!ftd && m_pWorkspace)
+ {
+ #ifdef __WXMSW__
+ m_pTree->IsExpanded(m_TreeRoot) ? m_pTree->Collapse(m_TreeRoot) : m_pTree->Expand(m_TreeRoot);
+ #endif
+ }
else
DoOpenSelectedFile();
}
@blueshake
Thanks, it works now, till now I haven't found any bug!
What a great improvement! :D
Why do you have those windows guards?
I'll give it a try (on linux) when I get home later today.
Quote from: oBFusCATed on August 27, 2009, 03:39:15 PM
Why do you have those windows guards?
I'll give it a try (on linux) when I get home later today.
Both blueshake and I use only Windows OS I think. :D
If it works on Linux. these guards should be deleted.
It works.... with some modifications....
Index: src/sdk/projectmanager.cpp
===================================================================
--- src/sdk/projectmanager.cpp (revision 5742)
+++ src/sdk/projectmanager.cpp (working copy)
@@ -1754,12 +1754,18 @@
if (ftd->GetProject() != m_pActiveProject)
{
SetProject(ftd->GetProject(), false);
- // prevent item expand state toggle when project is activated
- #ifdef __WXMSW__
- // toggle it one time so that it is toggled back by wx
- m_pTree->IsExpanded(id) ? m_pTree->Collapse(id) : m_pTree->Expand(id);
- #endif
}
+ // prevent item expand state toggle when project is activated
+ // toggle it one time so that it is toggled back by wx
+ m_pTree->IsExpanded(id) ? m_pTree->Collapse(id) : m_pTree->Expand(id);
+ }
+ else if (ftd && (ftd->GetKind() == FileTreeData::ftdkVirtualGroup || ftd->GetKind() == FileTreeData::ftdkFolder))
+ {
+ m_pTree->IsExpanded(id) ? m_pTree->Collapse(id) : m_pTree->Expand(id);
+ }
+ else if (!ftd && m_pWorkspace)
+ {
+ m_pTree->IsExpanded(m_TreeRoot) ? m_pTree->Collapse(m_TreeRoot) : m_pTree->Expand(m_TreeRoot);
}
else
DoOpenSelectedFile();
Best regards
p.s. blueshake, please call svn diff from the root of the project, so the patches are easier to apply
p.s.s. guards should be place only if the wx docs say that the used API is platform specific... in the above code non-win32 users won't be able to test your work