News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

project manager tree item double click

Started by blueshake, August 27, 2009, 08:06:46 AM

Previous topic - Next topic

blueshake

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();
}
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

ollydbg

#1
This is what I expect for long time.
I will apply and test it!
Thanks!!!

Edit

It works OK!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

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]
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

blueshake

@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();
}
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

ollydbg

#4
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
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

blueshake

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.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

ollydbg

The first level is "workplace", then "project".
Till now, these two levels can't work. see my screen shot.


[attachment deleted by admin]
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

blueshake

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();
}
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

ollydbg

@blueshake

Thanks, it works now, till now I haven't found any bug!
What a great improvement! :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

oBFusCATed

Why do you have those windows guards?
I'll give it a try (on linux) when I get home later today.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

ollydbg

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.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

oBFusCATed

#11
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
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]