This repository was archived by the owner on Mar 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 743
When junctions are hidden, also hide from left pane #297
Merged
+94
−33
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,6 +166,7 @@ ScanDirLevel(PDNODE pParentNode, LPTSTR szPath, DWORD view) | |
| { | ||
| BOOL bFound; | ||
| LFNDTA lfndta; | ||
| BOOL bExclude; | ||
|
|
||
| /* Add '*.*' to the current path. */ | ||
| lstrcpy(szMessage, szPath); | ||
|
|
@@ -178,9 +179,18 @@ ScanDirLevel(PDNODE pParentNode, LPTSTR szPath, DWORD view) | |
|
|
||
| while (bFound) | ||
| { | ||
| /* Is this a junction and are those displayed? */ | ||
| bExclude = FALSE; | ||
| if ((view & ATTR_JUNCTION) == 0 && | ||
| (lfndta.fd.dwFileAttributes & ATTR_JUNCTION)) { | ||
|
|
||
| bExclude = TRUE; | ||
| } | ||
|
|
||
| /* Is this not a '.' or '..' directory? */ | ||
| if (!ISDOTDIR(lfndta.fd.cFileName) && | ||
| (lfndta.fd.dwFileAttributes & ATTR_DIR)) { | ||
| (lfndta.fd.dwFileAttributes & ATTR_DIR) && | ||
| !bExclude) { | ||
|
|
||
| pParentNode->wFlags |= TF_HASCHILDREN; | ||
| bFound = FALSE; | ||
|
|
@@ -482,6 +492,39 @@ wfYield() | |
| } | ||
| } | ||
|
|
||
| ///////////////////////////////////////////////////////////////////// | ||
| // | ||
| // Name: WFFindNextNonJunction | ||
| // | ||
| // Synopsis: Returns the next non-junction entry, which may be the | ||
| // current entry. Continually calls WFFindNext so long as | ||
| // the current entry is a junction. | ||
| // | ||
| // lpFind Pointer to the find context, which may (or may | ||
| // not) be advanced to a later entry. | ||
| // | ||
| // Return: TRUE = non-junction successfully found | ||
| // FALSE = no non-junction remaining. | ||
| BOOL | ||
| WFFindNextNonJunction(LPLFNDTA lpFind) | ||
| { | ||
| BOOL bFound; | ||
|
|
||
| bFound = TRUE; | ||
|
|
||
| while (bFound) | ||
| { | ||
| // If it's not a junction, return it. | ||
| if (!(lpFind->fd.dwFileAttributes & ATTR_JUNCTION)) | ||
| { | ||
| return bFound; | ||
| } | ||
|
|
||
| bFound = WFFindNext(lpFind); | ||
| } | ||
|
|
||
| return bFound; | ||
| } | ||
|
|
||
|
|
||
| ///////////////////////////////////////////////////////////////////// | ||
|
|
@@ -663,6 +706,14 @@ ReadDirLevel( | |
| lstrcpy(szMessage, szPath); | ||
|
|
||
| bFound = WFFindFirst(&lfndta, szMessage, dwAttribs); | ||
|
|
||
| // | ||
| // if junctions are not displayed, continue to the next non-junction | ||
| // | ||
| if (bFound && !(dwAttribs & ATTR_JUNCTION)) | ||
| { | ||
| bFound = WFFindNextNonJunction(&lfndta); | ||
| } | ||
| } | ||
|
|
||
| // for net drive case where we can't actually see what is in these | ||
|
|
@@ -787,7 +838,7 @@ ReadDirLevel( | |
| goto DONE; | ||
| } | ||
| } else if (dwView & VIEW_PLUSES) { | ||
| ScanDirLevel(pNode, szPath, dwAttribs & ATTR_HS); | ||
| ScanDirLevel(pNode, szPath, dwAttribs & (ATTR_HS | ATTR_JUNCTION)); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -837,6 +888,14 @@ ReadDirLevel( | |
| else | ||
| { | ||
| bFound = WFFindNext(&lfndta); // get it from dos | ||
|
|
||
| // | ||
| // if junctions are not displayed, continue to the next non-junction | ||
| // | ||
| if (bFound && !(dwAttribs & ATTR_JUNCTION)) | ||
| { | ||
| bFound = WFFindNextNonJunction(&lfndta); | ||
| } | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This block and the one above at line 676 are doing essentially the same thing. Can we create a method to "SkipJunctionPoints" or something like that?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| } | ||
|
|
||
|
|
@@ -932,7 +991,7 @@ StealTreeData( | |
| // we need to match on these attributes as well as the name | ||
| // | ||
| dwView = GetWindowLongPtr(GetParent(hwndTC), GWL_VIEW) & VIEW_PLUSES; | ||
| dwAttribs = GetWindowLongPtr(GetParent(hwndTC), GWL_ATTRIBS) & ATTR_HS; | ||
| dwAttribs = GetWindowLongPtr(GetParent(hwndTC), GWL_ATTRIBS) & (ATTR_HS | ATTR_JUNCTION); | ||
|
|
||
| // | ||
| // get the dir of this new window for compare below | ||
|
|
@@ -948,7 +1007,7 @@ StealTreeData( | |
| (hwndT != hwndTC) && | ||
| !GetWindowLongPtr(hwndT, GWL_READLEVEL) && | ||
| (dwView == (DWORD)(GetWindowLongPtr(hwndSrc, GWL_VIEW) & VIEW_PLUSES)) && | ||
| (dwAttribs == (DWORD)(GetWindowLongPtr(hwndSrc, GWL_ATTRIBS) & ATTR_HS))) { | ||
| (dwAttribs == (DWORD)(GetWindowLongPtr(hwndSrc, GWL_ATTRIBS) & (ATTR_HS | ATTR_JUNCTION)))) { | ||
|
|
||
| SendMessage(hwndSrc, FS_GETDIRECTORY, COUNTOF(szSrc), (LPARAM)szSrc); | ||
| StripBackslash(szSrc); | ||
|
|
@@ -1084,7 +1143,8 @@ FillTreeListbox(HWND hwndTC, | |
|
|
||
| if (pNode) { | ||
|
|
||
| dwAttribs = ATTR_DIR | (GetWindowLongPtr(GetParent(hwndTC), GWL_ATTRIBS) & ATTR_HS); | ||
| dwAttribs = GetWindowLongPtr(GetParent(hwndTC), GWL_ATTRIBS); | ||
| dwAttribs = ATTR_DIR | (dwAttribs & (ATTR_HS | ATTR_JUNCTION)); | ||
| cNodes = 0; | ||
| bCancelTree = FALSE; | ||
|
|
||
|
|
@@ -1155,7 +1215,8 @@ FillOutTreeList(HWND hwndTC, | |
|
|
||
| SendMessage(hwndLB, WM_SETREDRAW, FALSE, 0L); | ||
|
|
||
| dwAttribs = ATTR_DIR | (GetWindowLongPtr(GetParent(hwndTC), GWL_ATTRIBS) & ATTR_HS); | ||
| dwAttribs = GetWindowLongPtr(GetParent(hwndTC), GWL_ATTRIBS); | ||
| dwAttribs = ATTR_DIR | (dwAttribs & (ATTR_HS | ATTR_JUNCTION)); | ||
|
|
||
| // get path to node that already exists in tree; will start reading from there | ||
| GetTreePath(pNode, szExists); | ||
|
|
@@ -1861,6 +1922,7 @@ ExpandLevel(HWND hWnd, WPARAM wParam, INT nIndex, LPTSTR szPath) | |
| INT iExpandInView; | ||
| INT iCurrentIndex; | ||
| RECT rc; | ||
| DWORD dwAttribs; | ||
|
|
||
| // | ||
| // Don't do anything while the tree is being built. | ||
|
|
@@ -1916,8 +1978,9 @@ ExpandLevel(HWND hWnd, WPARAM wParam, INT nIndex, LPTSTR szPath) | |
|
|
||
| if (IsTheDiskReallyThere(hWnd, szPath, FUNC_EXPAND, FALSE)) | ||
| { | ||
| ReadDirLevel(hWnd, pNode, szPath, pNode->nLevels + 1, nIndex, | ||
| (DWORD)(ATTR_DIR | (GetWindowLongPtr(GetParent(hWnd), GWL_ATTRIBS) & ATTR_HS)), | ||
| dwAttribs = GetWindowLongPtr(GetParent(hWnd), GWL_ATTRIBS); | ||
| dwAttribs = ATTR_DIR | (dwAttribs & (ATTR_HS | ATTR_JUNCTION)); | ||
| ReadDirLevel(hWnd, pNode, szPath, pNode->nLevels + 1, nIndex, dwAttribs, | ||
| (BOOL)wParam, NULL, IS_PARTIALSORT(DRIVEID(szPath))); | ||
| } | ||
|
|
||
|
|
@@ -2355,7 +2418,7 @@ TreeControlWndProc( | |
| lstrcpy(szPath, (LPTSTR)lParam); | ||
| ScanDirLevel( (PDNODE)pNodeT, | ||
| szPath, | ||
| (GetWindowLongPtr(hwndParent, GWL_ATTRIBS) & ATTR_HS)); | ||
| (GetWindowLongPtr(hwndParent, GWL_ATTRIBS) & (ATTR_HS | ATTR_JUNCTION))); | ||
|
|
||
| // | ||
| // Invalidate the window so the plus gets drawn if needed | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary as lpFind->fd.dwFileAttributes was already combined with ATTR_USED.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lpFind->fd.dwFileAttributes are combined with ATTR_USED, then ATTR_JUNCTION/ATTR_SYMBOLIC are added (which are not part of ATTR_USED), then this compare occurs. The intention was not to compare against ATTR_JUNCTION/ATTR_SYMBOLIC. Another approach would be to perform this compare, and if the entry is filtered call FindNext (which adds them); if the entry is not filtered then add them here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this to the alternate approach which avoids the back-and-forth conversion, effectively setting ATTR_JUNCTION/ATTR_SYMBOLIC after the decision to return the entry has already been made.