PowerToys/src/modules/previewpane
Pedro Lamas 4ba1d83cf5
[FileExplorerAddOns]Improves handling of Gcode Thumbnails (#27947)
* Improves handling of Gcode Thumbnails

* Remove Peek support

* Moves GcodeHelper to PreviewHandlerCommon

* Reverts minor change

* Skip unknown data on GcodeHelper.GetBestThumbnail

* Replaces QOI.Core with QoiImage

* Fixes spellchecker

* Reverts changes to NOTICE.md

* Minor QoiImage improvements

* Use custom QoiPixel struct

* Add MIT notice for the QOI reference code

* Fix spellcheck for the MIT notice

* Update NOTICE.md

tweaked notice a bit
2023-09-19 15:33:55 +01:00
..
common [FileExplorerAddOns]Improves handling of Gcode Thumbnails (#27947) 2023-09-19 15:33:55 +01:00
GcodePreviewHandler [FileExplorerAddOns]Improves handling of Gcode Thumbnails (#27947) 2023-09-19 15:33:55 +01:00
GcodePreviewHandlerCpp [Deps]Upgrade to WinAppSDK 1.4 (#28310) 2023-09-07 09:36:47 +01:00
GcodeThumbnailProvider [FileExplorerAddOns]Improves handling of Gcode Thumbnails (#27947) 2023-09-19 15:33:55 +01:00
GcodeThumbnailProviderCpp [Deps]Upgrade to WinAppSDK 1.4 (#28310) 2023-09-07 09:36:47 +01:00
MarkdownPreviewHandler [General]Reduce installer size by flattening application paths (#27451) 2023-07-20 00:12:46 +01:00
MarkdownPreviewHandlerCpp [Deps]Upgrade to WinAppSDK 1.4 (#28310) 2023-09-07 09:36:47 +01:00
MonacoPreviewHandler [Peek][Monaco Preview] Open Monaco URI in default browser (#27774) 2023-08-21 15:51:29 +02:00
MonacoPreviewHandlerCpp [Deps]Upgrade to WinAppSDK 1.4 (#28310) 2023-09-07 09:36:47 +01:00
PdfPreviewHandler [General]Reduce installer size by flattening application paths (#27451) 2023-07-20 00:12:46 +01:00
PdfPreviewHandlerCpp [Deps]Upgrade to WinAppSDK 1.4 (#28310) 2023-09-07 09:36:47 +01:00
PdfThumbnailProvider [General]Reduce installer size by flattening application paths (#27451) 2023-07-20 00:12:46 +01:00
PdfThumbnailProviderCpp [Deps]Upgrade to WinAppSDK 1.4 (#28310) 2023-09-07 09:36:47 +01:00
powerpreview [Deps]Upgrade to WinAppSDK 1.4 (#28310) 2023-09-07 09:36:47 +01:00
StlThumbnailProvider [General]Reduce installer size by flattening application paths (#27451) 2023-07-20 00:12:46 +01:00
StlThumbnailProviderCpp [Deps]Upgrade to WinAppSDK 1.4 (#28310) 2023-09-07 09:36:47 +01:00
SvgPreviewHandler [General]Reduce installer size by flattening application paths (#27451) 2023-07-20 00:12:46 +01:00
SvgPreviewHandlerCpp [Deps]Upgrade to WinAppSDK 1.4 (#28310) 2023-09-07 09:36:47 +01:00
SvgThumbnailProvider [SVGThumbnail]Optimize CPU usage (#28286) 2023-09-07 16:06:49 +01:00
SvgThumbnailProviderCpp [Deps]Upgrade to WinAppSDK 1.4 (#28310) 2023-09-07 09:36:47 +01:00
UnitTests-GcodePreviewHandler [FileExplorerAddOns]Improves handling of Gcode Thumbnails (#27947) 2023-09-19 15:33:55 +01:00
UnitTests-GcodeThumbnailProvider [FileExplorerAddOns]Improves handling of Gcode Thumbnails (#27947) 2023-09-19 15:33:55 +01:00
UnitTests-MarkdownPreviewHandler [General]Reduce installer size by flattening application paths (#27451) 2023-07-20 00:12:46 +01:00
UnitTests-PdfPreviewHandler [General]Reduce installer size by flattening application paths (#27451) 2023-07-20 00:12:46 +01:00
UnitTests-PdfThumbnailProvider [General]Reduce installer size by flattening application paths (#27451) 2023-07-20 00:12:46 +01:00
UnitTests-PreviewHandlerCommon [Build] Upgraded NetAnalyzers to 7.0.1 (#24792) 2023-03-16 15:51:31 +01:00
UnitTests-StlThumbnailProvider [General]Reduce installer size by flattening application paths (#27451) 2023-07-20 00:12:46 +01:00
UnitTests-SvgPreviewHandler [General]Reduce installer size by flattening application paths (#27451) 2023-07-20 00:12:46 +01:00
UnitTests-SvgThumbnailProvider [SVGThumbnail]Optimize CPU usage (#28286) 2023-09-07 16:06:49 +01:00
README.md Self-contained .NET (#22217) 2022-12-14 13:37:23 +01:00
STATestClassAttribute.cs [PreviewPane] Porting .NET Core 3.1 (#8432) 2020-12-11 09:59:42 +01:00
STATestMethodAttribute.cs [PreviewPane] Porting .NET Core 3.1 (#8432) 2020-12-11 09:59:42 +01:00

File Explorer

End user facing:

Please visit our overview

Developing

  • Add new C++ DLL project in the preview pane folder. This DLL is actual preview handler, i.e. implements IPreviewHandler/IThumbnailProvider interface.
  • Add new .NET EXE project in the preview pane folder. This EXE is being spawned by C++ DLL to generate preview/thumbnail.

Installation

To add a new Previewer update the Product.wxs file in PowerToysSetup similar to existing Previewer to register the Preview Handler. More details about registration of Preview Handlers can be found here. - implemented in modulesRegistry.h.

Directly registering/unregistering DLL's

[Important] This method of registering Preview Handler DLL's is not recommended. It could lead to registry corruption.

Registering Preview Handler

  1. Restart Visual studio as administrator.
  2. Sign XYZPreviewHandler and it's dependencies. To sign an assembly in VS, follow steps given here.
  3. Build XYZPreviewHandler project.
  4. Open developer command prompt from Tools > Command Line > Developer Command Prompt.
  5. Run following command for each nuget and project dependency to add them to Global Assembly Cache(GAC).
gacutil -i <path to dependency>
  1. Run following commands to register preview handler.
cd C:\Windows\Microsoft.NET\Framework64\4.0.x.x
gacutil -i <path to XYZPreviewHandler.dll>
RegAsm.exe /codebase <path to XYZPreviewHandler.dll>
  1. Restart Windows Explorer process.

Unregistering Preview Handler

  1. Run following commands in elevated developer command prompt to unregister preview handler.
cd C:\Windows\Microsoft.NET\Framework64\4.0.x.x
RegAsm.exe /unregister <path to XYZPreviewHandler.dll>
gacutil -u XYZPreviewHandler

Debugging

Since in-process preview handlers run under a surrogate hosting process (prevhost.exe by default), to debug a preview handler, you need to attach the debugger to the host process.

  1. Click on a file with registered extension to start host process.
  2. Attach debugger in Visual studio from Debug->Attach to Process and select prevhost.exe with type Managed(version), x64.

Managing Preview Handlers

After successful integration, your preview handler should appear in the PowerToys settings UI under the File Explorer Preview Tab. In here you should be able to enable and disable all the preview handles.

Settings UI - File Explorer Preview Tab