Yet another source code viewer plugin based on Scintilla control

Scintilla-based plugin for viewing source files in DO.


Originally created as a demo for a modern Scintilla API wrapper for Delphi.
Source code now is available on github.
works correctly with Dopus 12/13 on Windows 10/11. There are no plans to support Windows 7 (at least for now).

Features

  • Display of source code files with syntax highlighting, similar Notepad++ / dosv
  • Autodetect encoding
  • Text search (built-in search + search dialog — accessible via Ctrl+F / Shift+Ctrl+F, then F3 / Shift+F3)
  • Jump to a specific line/character (Ctrl+G)
  • Highlight identical words (double-click)
  • Collapse/expand blocks (all, current block only, nested blocks within current block)
  • Configurable (like dosv) display styles for lexers
  • Support for Notepad++ theme files for easy styling (simply move the theme folder from npp++ to plugin settings folder, or import the desired theme-xml-file in “Settings/Styles/Import”)
  • Manage the list of supported file types for display (add your own / remove existing ones) - this requires restarting plugin / DO since the plugin explicitly registers lists of supported file extensions.
  • Copying content to the clipboard while preserving the current formatting style.

Installation:

DOSrcVwr.zip (3.1 MB)

Copy both DLLs from the archive to %dopus_installation_directory%\viewers and refresh plugin list
Settings are stored in %appdata%\GPSoftware\Directory Opus\ConfigFiles, logs (if you enable them will be saved to %appdata%\GPSoftware\Directory Opus\Logs).

4 Likes

自定义设置后无法退出首选项状态

Cannot exit preference state after custom settings

Yes, I’ve encountered this error myself. The core issue is that the VCL framefork doesn’t always work correctly within a DLL. However, this problem doesn’t occur in the WindowsPreviewHandler version - perhaps because it uses a different control. In any case, the error has been fixed; please download the updated version of the plugin from the first post.

For the future - if you encounter any errors—try enabling logging so that I can more easily track and reproduce them.

这个问题 自定义设置后无法退出首选项状态 还是老样子,从查看器面板中的右键菜单进行设置没有问题。

This problem Cannot exit preference state after custom settings is still the same. There is no problem in setting it from the right-click menu in the viewer panel.

无法导入Notepad++主题

Unable to import Notepad++ theme

  1. Could you describe in more detail context how this happens and, if possible, attach a log snippet? The plugin settings dialog was opened via the settings button in the lister panel, from the lister context menu, or from the DO plugins settings page.
  2. Oh, so that's how it is. I've only used (practiced with) the themes that come with Notepad++.. The error seems to be related to an XML validation issue, not the theme itself. The validation might be too strict. In XML, "&" and other "special" characters need to be escaped, but that hasn't been done here. I'll see what can be done.

I think I get it. The plugin settings dialog is accessed from within DO's settings, via the button next to the plugin's name. And after closing the settings, it becomes impossible to close DO's settings themselves. It feels like they're disabled.

yepp I think I figured it out. The plugin settings dialog is opened from the DO settings, via the button alongs the plugin name. And after closing the settings, it's impossible to close the DO settings themselves. Is that what you meant?
After viewing logs, i see that the viewer's UI thread is successfully displaying the settings, although it's running on a different thread (not the one where the VCL was initialized). Perhaps this is why EnablethreadWindows isn't called symmetrically (in end of vcl.tform`s.showModal) . I need to figure out what to do about it. The DO multithreading model for plugins turned out to be more complicated than I expected....

PS Actually, there's a similar viewer that works via PreviewHandlers Host, and it doesn't have these issues (at least I hope so :joy:).

I`ve fixed glitches with the DOpus main window blocking after closing the plugin settings dialog if it was not opened from the lister.

The archive with the plugin in the first post has been updated.

1 Like

主题样式还是无法导入

Yes, because the XML file is invalid. It contains unescaped "&" in the attributes. I'm not sure what dscintilla need to edit the theme files; they are only checked for syntactic correctness.

分享一下你的主题文件

fixed file in the attachment, but you can correct it yourself - all you need to do is replace "&" with "&" in one place:


but in theory it needs to be fixed in generate-themes.ts by adding escape methods for reserved xml characters to node serializers. I also attached it
dracula.zip (12.1 KB).
Later I will create issue for the dracula authors on github or you can do it for me)

Damn, I wanted to edit the message above and say that I created this issue myself, but something went wrong /~