Icon overlays

Features wanted...
diarrhio
Posts: 83
Joined: 14 Jun 2005 09:42

Icon overlays

Post by diarrhio »

First off, this is the coolest program, ever. Well, not ever, but it's defnitely up there :D

I'm already totally impressed with both it's functionality, speed, and cleanliness. It's all just very logical and just utterly perfect.

The only thing missing that is keeping me from using it is it's (lack of) support of icon overlays. I'm a software dev and use TortoiseSVN as my source control front end. It is basically an explorer shell extension which adds icon overlays to show the status of files and folders, among other things. I've never written any sort of explorer type component, so i have no idea how hard it would be to add this functionality. Seems like functionality it should have, though.

I can send a screen cap of what I am referring to if you need.

Thanks!

D

admin
Site Admin
Posts: 65246
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Icon overlays

Post by admin »

diarrhio wrote:I can send a screen cap of what I am referring to if you need.
Yes, please. I'm afraid I don't even know what you mean by icon overlays.

diarrhio
Posts: 83
Joined: 14 Jun 2005 09:42

Post by diarrhio »

Here is a cap of what I am talking about. Icon overlays are basically "layers" of rendering on top of each file's normal icon in explorer. In the cap, the files/folders with green checkboxes on them are files and folders who are version controlled using SVN, and who have not been modified. In the list view, you'll see two icons with red exclamation marks laid over them, which means they have been modified locally and are different from what is on the server.

As you can see, overlays just "lay" on top of existing file/folder icons. It saves devs from having to having to create an icon for each and every single combination of states they want an item to be in, and instead add overlays as needed.

The more I think about it, the more I think TortoiseSVN is doing the icon overlaying itself, since it is a shell extension. I don't know if it's possible to get the files icon + overlay just through the API. You woud basically have to replace your list control with a standard explorer list control that the VC Appwizard gives you. Though, I may be wrong, since your context menus show TortoiseSVN's context menus, which are context dependant (modified files will have different menu items than unmodified files). I'm just confused :D

Do you have any insight into how this might work?

Image

diarrhio
Posts: 83
Joined: 14 Jun 2005 09:42

Post by diarrhio »

http://www.codeproject.com/shell/explorer.asp

This might help. I don't know what language you are using or if you have tried using a standard explorer window, but here is a link with some info on how to do it.

Also, I take back what I said about using VC6 appwizard to create an explorer app. I just tested it and it doesn't provide a standard explorer control. It just gives you an app with splitters.

D

admin
Site Admin
Posts: 65246
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

Thanks for the shot. I did some research and TortoiseSVN appears to be the main if not only app that uses such icon overlays... :wink:
Well, to do anything I would need something to test my code but I don't want to install TortoiseSVN...

diarrhio
Posts: 83
Joined: 14 Jun 2005 09:42

Post by diarrhio »

Yah. That is the first one that I came across that uses overlays. TortoiseSVN is a pretty safe install (I've never had issues with it in all the time I used it). Though I can understand if you don't want to install it.

Out of curiousity, why do you roll your own tree/list controls instead of using the ones windows gives you? Are they a pain to work with? Does it not give you the functionality you are looking for? Again, just curious.

D

admin
Site Admin
Posts: 65246
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

diarrhio wrote:TortoiseSVN
I might try out of curiousity. I really wonder how this is done. Maybe TrackerV3 itself could use overlay icons, who knows... :wink:
diarrhio wrote:Out of curiousity, why do you roll your own tree/list controls instead of using the ones windows gives you?
I want maximum control and I like to know what's happening under the surface. My list and tree can do things nobody else can, and that gives me a kick! And of course I have less file dependencies. The downside is that I have a lot of work emulating the functionality of the MS-controls.

diarrhio
Posts: 83
Joined: 14 Jun 2005 09:42

Post by diarrhio »

admin wrote:I might try out of curiousity. I really wonder how this is done. Maybe TrackerV3 itself could use overlay icons, who knows... :wink:
TortoiseSVN is an open source project. The source is free to be browsed by all, even just using your browser. Check out http://svn.collab.net/viewcvs/tortoisesvn/
admin wrote:I want maximum control and I like to know what's happening under the surface. My list and tree can do things nobody else can, and that gives me a kick! And of course I have less file dependencies. The downside is that I have a lot of work emulating the functionality of the MS-controls.
Yah. I can see how that is beneficial. It's always a toss up deciding between using standard windows controls and rolling your own. It's usually a give and take. In both cases you are chasing a moving target. Personally, I would prefer it to be a standard control, but it's not my app :wink:

Cheers

admin
Site Admin
Posts: 65246
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

Bad luck. Installed TortoiseSVN but could not bring T4 to show the overlays as Explorer does. At least there's no easy way, and documentation is very scarce on the net. I'm sure it can be done somehow, but right now it's not on top of my list, sorry.

diarrhio
Posts: 83
Joined: 14 Jun 2005 09:42

Post by diarrhio »

admin wrote:I'm sure it can be done somehow, but right now it's not on top of my list, sorry.
Bummer :( I'll see if I can dig up anything myself.

D

diarrhio
Posts: 83
Joined: 14 Jun 2005 09:42

Post by diarrhio »

Have you looked at SHGetFileInfo? It has a flag you can add to the flags field called SHGFI_ADDOVERLAYS, which "should" do what we want. I haven't tested it, though. I'll try if I get some free time.

How are you getting icons for the files you are adding to the list?

D

admin
Site Admin
Posts: 65246
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

SHGFI_ADDOVERLAYS was the first thing I tried but overlay dod not appear. Maybe you have more luck.
diarrhio wrote:How are you getting icons for the files you are adding to the list?
VB syntax:

Code: Select all

Public Const BASIC_SHGFI_FLAGS As Long = SHGFI_TYPENAME Or SHGFI_DISPLAYNAME Or _
             SHGFI_SYSICONINDEX Or SHGFI_SMALLICON Or SHGFI_USEFILEATTRIBUTES

...

          SHGetFileInfo sPathFile, _
              (WFD.dwFileAttributes), shinfo, Len(shinfo), _
              BASIC_SHGFI_FLAGS

admin
Site Admin
Posts: 65246
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

OK, I'm making progress!
This does draw your icon overlays:

Code: Select all

                SHGetFileInfo sPathFile, _
                   (WFD.dwFileAttributes), shinfo, Len(shinfo), _
                   SHGFI_SMALLICON Or SHGFI_ICON Or SHGFI_ADDOVERLAYS
                DrawIconEx ...
                DestroyIcon ...
Now it's just building it into the T4-framework. Maybe next weekend...

diarrhio
Posts: 83
Joined: 14 Jun 2005 09:42

Post by diarrhio »

You rule! Nice work man. This was the one thing that was keeping me from using tracker.

admin
Site Admin
Posts: 65246
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

It's not done yet. I have to take another route for performance reasons.

Not this anymore: SHGFI_ADDOVERLAYS + DrawIconEx
but this: SHGFI_OVERLAYINDEX + ImageList_DrawEx hImgList, idxOverlay ...

Works fine and fast, IF you know idxOverlay BUT: at the moment I cannot find the right idxOverlay. SHGFI_OVERLAYINDEX is supposed to return it in the upper eight bits of the iIcon member of the shinfo structure, but it does return a wrong index. And SHGetIconOverlayIndex does return 0 always. Hmmm

Maybe some wise guy is reading this...

Post Reply