Skip to content

Implement dynamic shared-file icon overlay in BrowserUI #13

@jochenwezel

Description

@jochenwezel

Summary

CompuMaster.Dms.BrowserUI currently distinguishes normal and shared file icons through two default ImageList indices:

  • index 6: default document/file icon
  • index 7: default shared document/file icon

These are wired in DmsBrowser.vb via:

_FileIcons = New SystemIconsImageListWrapper(Me.ImageListFileIcons, 6, 7)

The file list uses SystemIconsImageListWrapper.GetSIImageListIndexForFileExtension(FileExtension, file.ExtendedInfosIsShared), so shared file state is functionally relevant.

Current behavior

SystemIconsImageListWrapper.OverlaySharedIcon(source As Icon) is currently only a workaround:

'WORKAROUND: until fully implemented, just return the default shared icon
Return ImageToIcon(Me.SIImageList.Images(Me.DefaultSharedIconIndex))

As a result, shared files do not get a true overlay on top of their actual file-extension icon. Instead, shared files fall back to one generic default shared icon.

After fixing #12, DmsBrowser no longer deserializes a designer-generated ImageListStreamer. The initial ImageList is now constructed from normal embedded bitmap resources. During that change it became visible that there is no separate embedded iconfinder_Document... - Shared.png resource file in the project. The old designer stream apparently carried a pre-serialized image for index 7.

Desired behavior

Implement the shared-file marker dynamically instead of relying on a pre-rendered Document - Shared.png resource.

The desired approach is:

  • keep index 6 as the normal default document/file icon
  • create index 7 dynamically from index 6 plus a share overlay
  • apply the same overlay logic to shell/file-extension icons returned by ExtractIcon
  • avoid adding or shipping a separate Document - Shared.png file
  • keep existing ImageList indices and keys stable for compatibility

Relevant code

  • CompuMaster.Dms.BrowserUI/DmsBrowser.vb
    • constructs SystemIconsImageListWrapper(Me.ImageListFileIcons, 6, 7)
    • calls GetSIImageListIndexForFileExtension(..., file.ExtendedInfosIsShared)
  • CompuMaster.Dms.BrowserUI/SystemIconsImageListWrapper.vb
    • GetSIImageListIndexForFileExtension
    • GetIconForFileExtension
    • GetIconFromDLL
    • OverlaySharedIcon
  • CompuMaster.Dms.BrowserUI/Resources/sharing.png
    • likely candidate overlay artwork already available in the project

Acceptance criteria

  • Shared files show their normal file-extension icon with a visual shared marker overlay.
  • Files without shell/file-extension icons use a dynamically generated shared default document icon.
  • No designer-serialized ImageListStreamer or binary WinForms object resource is reintroduced.
  • No additional static Document - Shared.png resource is required.
  • Existing ImageList keys/indices used by DmsBrowser remain compatible.
  • Add or update tests where practical to verify the ImageList contains the default shared icon and that shared extension icons are added through the wrapper path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions