New Plugin: Source Code Viewer


Just to let you know I will be releasing a new viewer plugin in the next few days that syntax colours source code.

It uses the Scintilla library for the coluring/code collapsing/etc and the wordlists/languages are configurable via an XML file.

Here are a couple of (large) screenshots:

This looks excellent! Something I know a few people (myself included) have wanted for a while.

Sounds good.

Look forward to seeing this.

So how are you writting plugins for DOpus 8?

Has the SDK been released?

If so, where?

I'm using the 6.1 interface.

As an update for everyone it's almost done. The only thing I need to do it save state information to the registry, e.g. find dialog preferences, and that's it.

Hopefully I will get this done today and till release it tonight.

scintilla is a very good choice (it use it myself..)
Do you allow the ability to modify/ save file ?


I am toying with the idea.

Please consider it!

Would be VERY handy to be able to modify text of varing sorts within DOpus.

I've implemented it.

Look for the release at about 9pm GMT.


The software has been released. More info and the download link can be found at:

Very nice. I tested this on a Perl script and it looks good.

However according to the ReadMe.txt file we should be able to learn how to add our own file types etc by studying the SourceCodeViewer.XML file but I really don't see anything in there that explains it. I've figured out how to add a file type, set basic colors and so on, but the rest is a mystery. The plugin seems to work fine but I'd like to configure it for the languages I use.

Am I missing something or is something missing?


Hi John,

The easiest way to do it is to download the Scintilla source code and examine the parser of the language you are interested in, e.g. LexPerl.cxx. This will tell you the keyword sets and style identifiers that are in use by the parser.

With this information you can configure SCV.

Ok thanks. It took me awhile, as each time I made a change in order to see the results of it I had to completely exit and restart DOpus. But I think I have the general idea now.

At the end of thus is what I've temporarily inserted into the SourceCodeViewer.xml file so it does syntax highlighting in CSS files. It's crude, the colors are a bad choice and there's no keywords. On the other hand keywords do not seem to be necessary with CSS in this case. I'm posting what I am at the end of this only for general information for anyone else who might be looking to configure their own special language syntax highlighting.

The foreground colors are set with standard RGB decimal values (0-255).

One thing that kind of threw me was the fact that the identifiers in the CSS parser file don't often match up with what they would seem to be in actual CSS files. For example I would think SCE_CSS_COMMENT would represent a CSS comment however it doesn't. Instead SCE_CSS_IDENTIFIER is a comment. Oh well, it looks like I can make this work for CSS with a little more tweaking.

Thanks again for this handy tool.


<Language Name="CSS" Extensions="css" FontName="Lucida Console" FontSize="13">
	<Style Index="0" Foreground="0,0,128"      LexerIndex="SCE_CSS_COMMENT"/>
	<Style Index="1" Foreground="0,128,0"      LexerIndex="SCE_CSS_IMPORTANT"/>
	<Style Index="2" Foreground="0,100,0"      LexerIndex="SCE_CSS_DEFAULT"/>
	<Style Index="3" Foreground="100,100,0"    LexerIndex="SCE_CSS_TAG"/>
	<Style Index="4" Foreground="0,100,100"    LexerIndex="SCE_CSS_SINGLESTRING"/>
	<Style Index="5" Foreground="200,180,0"    LexerIndex="SCE_CSS_OPERATOR"/>
	<Style Index="6" Foreground="128,128,128"  LexerIndex="SCE_CSS_DOUBLESTRING"/>
	<Style Index="7" Foreground="0,100,255"    LexerIndex="SCE_CSS_VALUE"/>
	<Style Index="8" Foreground="0,200,200"    LexerIndex="SCE_CSS_DIRECTIVE"/>
	<Style Index="9" Foreground="0,255,0"      LexerIndex="SCE_CSS_IDENTIFIER"/>
	<Style Index="10" Foreground="255,0,0"     LexerIndex="SCE_CSS_ID"/>

 <!-- SCE_CSS_COMMENT does nothing -->
 <!-- SCE_CSS_TAG does nothing -->
 <!-- SCE_CSS_DOUBLESTRING does nothing -->

JohnZeman wrote:
Ok thanks. It took me awhile, as each time I made a change in order to see the results of it I had to completely exit and restart DOpus. But I think I have the general idea now.[/quote]

In the next version before viewing a file I'll get it to reload the XML if it has changed so you won't have to do that anymore.

Provided the plugin isn't currently in use in any viewer panes, you can unload it (and thus force it to be reloaded) without quitting Opus by running this:Show FLUSHPLUGINSThat's also very useful when developing plugins. Of course, if you copy your plugin over an old version using Opus, Opus may reload and re-lock the plugin when it displays the Replace-File dialog (since it'll use viewer plugins to generate thumbnails and other info for the dialog). Either flush after the dialog is visible, or copy using a DOS script or whatever.

(There are little DOS batch files with the source to my plugins which flush the old DLLs and then copy over the new one.)

Just released v1.0.0.2, changes include:

  1. If XML file has been changed prior to viewing a file the contents will be reloaded.
  2. Added bookmarks. CTRL+F2 to toggle, F2 to skip forward, SHIFT+F2 to skip backwards and CTRL+SHIFT+F2 to clear all.
  3. Added edge support. Set EdgeColumn="n" as a language attribute to draw a line at this column position.
  4. Edit control now shows DOpus popup menu on a right-mouse click.
  5. Added several items to the DOpus popup menu to control SCV.
  6. Added toggling of whitespace ... CTRL+SHIFT+8
  7. Added CTRL+R which will change selection from line mode to a rectangle mode.
  8. Added control over whether SCV should set focus to the edit control when loading, default is NO. See SetFocusAfterLoading in XML.
  9. Added control over whether SCV should allow editing of writable files, default is YES. See AllowEditing in XML.
  10. Altered titlebar returned to DOpus to be more readable

I haven't tried yet, but one thing I noticed with the original version is that you can't insert tabs into files, since they cause tabbing between the viewer pane and other parts of the lister... Problem is, sometimes that's wanted, but sometimes not... An option in the XML that decides whether tabs go to the edit control or not would be pretty useful for editing source code.

The edit control seems quite advanced so I assume it can do block tab insertion and deletion, although I was only trying to insert single tabs today.

It's a very useful plugin. Thanks for making it!

Plugin is working great - thanks.

Minor issue: The View Whitespace uses v as a shortcut key - v is already used in the same menu by the View Size option.

Just tried the new version and the hotkeys don't seem to work for me. When I press Ctrl-F2 or Ctrl-Shift-8 nothing happens, although the corresponding right-click menu items work fine.

When I press Ctrl-F it inserts "ACK" in reverse colours:

(Maybe it's been watching Mars Attacks!, hehe.)


Just seeked through the halls and read this thread
by accident.. 8)

Nice thing! Problem is, I can't get it to work.. 8(

I copied the dlls into winnt\system32 and the Viewer.dll and *.xml into Dopus/Viewers..

I restart opus and no source-files show up in colors,
its the regular text viewer wich is used.
The text viewer is the last in my top-down viewerplugin-

I guess I would also see the plugin in the
prefs-section of DO ?!..
Unfortunately there's nothing to find.