GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Plugins: Source code viewer based on Scintilla


#1

Source code viewer for DOpus

This addin allows the displaying of formatted sourcecode in the DOpus view panel.


Downloads

Installation

  • download dosv_0_0_0_*.zip
  • download the InstallPlugin_*.dcf file from above and place it next to dosv_0_0_0_4.zip file
  • double click the InstallPlugin_*.dcf file (it is a DOpus button).
  • restart DO or refresh the list of viewer plugins via DO prefs

Installation Output in the "Other Logs" utility panel is something like this.

Output in the "Other Logs" utility panel is something like this.

Plugin Installer..
    TabPath        : C:
    TmpDirPath     : C:\dosv_0_0_0_4.zip.tmp
    64bit          : true
    Run Command    : COPY EXTRACT WHENEXISTS=replace COPYFILETIMES=yes COPYDIRTIMES=yes COPYATTR=yes FILE="C:\dosv_0_0_0_4.zip"..
    ZipInnerDirName: 0.0.0.4
    Run Command    : COPY WHENEXISTS=replace COPYFILETIMES=yes COPYDIRTIMES=yes COPYATTR=yes EXTRACT FILE="C:\dosv_0_0_0_4.zip.tmp..
    Run Command    : COPY WHENEXISTS=replace COPYFILETIMES=yes COPYDIRTIMES=yes COPYATTR=yes EXTRACT FILE="C:\dosv_0_0_0_4.zip.tmp..
    Run Command    : COPY WHENEXISTS=replace COPYFILETIMES=yes COPYDIRTIMES=yes COPYATTR=yes FILE="C:\dosv_0_0_0_4.zip.tmp\0.0.0.4\..
    Run Command    : DELETE NOFROMFOCUS QUIET FILE="C:\dosv_0_0_0_4.zip.tmp"
Done!

Expect this:

  • support for 32 and 64bit installations
  • USB export (if I did everything correct according to the information spread here from you Leo)
  • will ask if existing files are to be replaced (which is DO magic)

Note, I am posting this here so there is an easy place to find it. The original dev thread is a bit fragmented, and while this addon was never officially completed its the best we have

Full credit goes to

  • @gdobin who wrote this (but does not seem to be around any more).
  • @Tbone for the installer

Plugins: New source code editor based on Scintilla for W7 and x64?
#2

Very good plugin! You want to join the topic definition feature as soon as possible.


#3

The dosv plugin above uses scintilla and supports a colour scheme system similar to what notepad++ uses.

Because of this with a little bit of tweaking we can take the original dosv.config.xml merge it with a notepad++ theme and load it in to DOpus.

If you would like to use any of the styles in the table do the flowing:

  • Download the dosv generated file
  • rename the file to dosv.config.xml
  • copy the file to %APPDATA%\GPSoftware\Directory Opus\ConfigFiles\Plugins

Sample themes

Visual Studio 2015 Dark Theme
vsdark

dosv generated file
dosv.config.xml-VS2015-Dark.txt (207.4 KB)

Original Notepad++ file
VS2015-Dark.xml.txt (89.6 KB)

Solarized Light Themes

dosv generated file
dosv.config.xml-Solarized-Light.txt (205.5 KB)

Original Notepad++ file
Solarized-Light.xml.txt (84.9 KB)

Solarized Dark Themes

dosv generated file
dosv.config.xml-Solarized-Dark.txt (206.0 KB)

Original Notepad++ file
Solarized-Dark.xml.txt (85.5 KB)

Bespin theme

dosv generated file
dosv.config.xml-Bespin.txt (208.0 KB)

Original Notepad++ file
Bespin.xml.txt (87.4 KB)

http://orizens.com/wp/topics/update-for-no■■■■n-inspired/

Material Theme (Dark)

dosv generated file
dosv.config.xml-Material-Dark.txt (207.7 KB)

Original Notepad++ file
Material-Dark.xml.txt (89.6 KB)

Dracula

dosv generated file
dosv.config.xml-Dracula.txt (198.6 KB)

Original Notepad++ file
Dracula.xml.txt (42.1 KB)

Obsidian PyCs

dosv generated file
dosv.config.xml-Obsidian_PyCs.txt (206.5 KB)

Original Notepad++ file
Obsidian PyCs.xml.txt (86.3 KB)

Slush & Poppies

dosv generated file
dosv.config.xml-slush_poppies.txt (205.4 KB)

Original Notepad++ file
slush_poppies.xml.txt (84.2 KB)

Nord Theme

dosv generated file
dosv.config.xml-nord.txt (200.3 KB)

Original Notepad++ file
nord.xml.txt (34.2 KB)

Neon

dosv generated file
dosv.config.xml-Techmantium_Neon.txt (206.4 KB)

Original Notepad++ file
Techmantium_Neon.xml.txt (86.4 KB)

Nautical but Nice

dosv generated file
dosv.config.xml-Techmantium-NauticalButNice.txt (206.4 KB)

Original Notepad++ file
Techmantium_NauticalButNice.xml.txt (86.4 KB)

Girly Edition

dosv generated file
dosv.config.xml-Techmantium_Girly.txt (206.4 KB)

Original Notepad++ file
Techmantium_Girly.xml.txt (86.4 KB)

These colour schemes came from this site, it has a list of some nice Notepad++ colour schemes. I have converted them to work with the dosv DOpus addin. Full credit goes to the original creator of the colour scheme and Tim Trott for the page listing them

Converting from Notepad++ style to dosv
A powershell script was used to to generate the dosv config files in the above table from the original notepad++ styles.
If you have another style form notepad++ you want to use, the script should work. You will need to pass in the notpad ++ style and the original dosvconfig file.

function Format-Xml {
<#
.SYNOPSIS
Format the incoming object as the text of an XML document.
#>
    param(
        ## Text of an XML document.
        [Parameter(ValueFromPipeline = $true)]
        [string[]]$Text
    )
    begin {
        $data = New-Object System.Collections.ArrayList
    }
    process {
        [void] $data.Add($Text -join "`n")
    }
    end {
        $doc=New-Object System.Xml.XmlDataDocument
        $doc.LoadXml($data -join "`n")
        $sw=New-Object System.Io.Stringwriter
        $writer=New-Object System.Xml.XmlTextWriter($sw)
        $writer.Formatting = [System.Xml.Formatting]::Indented
        $doc.WriteContentTo($writer)
        $sw.ToString()
    }
}

function Add-WordStyleElement {
    param(
        [string[]]$Text
    )
}

function Merge-ScintillaConfigElement {
<#
.SYNOPSIS
Converts a scintilla to the DOpus DOSV format
#>
    param(
        [System.Xml.XmlElement]$DosvElement,
        [System.Xml.XmlElement]$ScintillaElement
    )

    $dosv = $DosvElement.OwnerDocument
    #$referenceObject = @($DosElement.WordStyles.WordStyle | Select-Object -ExpandProperty name)
    $dosvWordStyles = $DosvElement.SelectSingleNode("./WordStyles")
    $referenceObject = @($dosvWordStyles.ChildNodes | Select-Object -ExpandProperty name)
    $differenceObject = @($ScintillaElement.ChildNodes | Select-Object -ExpandProperty name)
    $delta = @(Compare-Object $referenceObject $differenceObject -IncludeEqual)
    $delta | ForEach-Object {
        $deltaItem = $_
        write-host "'$($deltaItem.SideIndicator)' WordStyles '$($deltaItem.InputObject)'"

        switch ($deltaItem.SideIndicator)
        {
            '==' { 
                #update
                $dosvItem = $DosvElement.WordStyles.selectSingleNode("./WordStyle[@name='$($deltaItem.InputObject)']")
                $scintillaItem = $ScintillaElement.selectSingleNode("./WordsStyle[@name='$($deltaItem.InputObject)']")
                $dosvItem.SetAttribute('fgColor', $scintillaItem.fgColor) | out-null
                $dosvItem.SetAttribute('bgColor', $scintillaItem.bgColor) | out-null
                $dosvItem.SetAttribute('fontName', $scintillaItem.fontName) | out-null
                $dosvItem.SetAttribute('fontStyle', $scintillaItem.fontStyle) | out-null
                $dosvItem.SetAttribute('fontSize', $scintillaItem.fontSize) | out-null
                $dosvItem.SetAttribute('keywordClass', $scintillaItem.keywordClass) | out-null
            }
            '=>' { 
                #add
                $scintillaItem = $ScintillaElement.selectSingleNode("./WordsStyle[@name='$($deltaItem.InputObject)']")
                [System.Xml.XmlElement]$xmlNode  = $dosv.CreateElement('WordStyle')
                $xmlNode.SetAttribute('bgColor',$($scintillaItem.bgColor)) | out-null
                $xmlNode.SetAttribute('eolFill','') | out-null
                $xmlNode.SetAttribute('fgColor',$($scintillaItem.fgColor)) | out-null
                $xmlNode.SetAttribute('fontName',$($scintillaItem.fontName)) | out-null
                $xmlNode.SetAttribute('fontSize',$($scintillaItem.fontSize))
                $xmlNode.SetAttribute('fontStyle',$($scintillaItem.fontStyle)) | out-null
                $xmlNode.SetAttribute('name',$($scintillaItem.name)) | out-null
                $xmlNode.SetAttribute('styleID',$($scintillaItem.styleID)) | out-null
                $xmlNode.SetAttribute('keywordClass',$($scintillaItem.keywordClass)) | out-null
                $dosvWordStyles.AppendChild($xmlNode);
            }
            '<=' {
                #ignore
            }
        }
        write-host "'$($deltaItem.SideIndicator)' WordStyles '$($deltaItem.InputObject)' - done"
    }

    return $DosvElement
}

function Merge-ScintillaGlobalElement {
<#
.SYNOPSIS
Converts a scintilla to the DOpus DOSV format
#>
    param(
        [System.Xml.XmlElement]$DosvElement,
        [System.Xml.XmlElement]$ScintillaGlobalElement
    )

    $dosv = $DosvElement.OwnerDocument
    #$referenceObject = @($DosElement.WordStyles.WordStyle | Select-Object -ExpandProperty name)
    $dosvWordStyles = $DosvElement.SelectSingleNode("./WordStyles")
 
    $dosvWordStyles.OuterXml | Out-Host
    $ScintillaGlobalElement.OuterXml | Out-Host

    $referenceObject = @($dosvWordStyles.ChildNodes | Select-Object -ExpandProperty name)
    if($DosvElement.name -eq "default")
    {
        $differenceObject = @($ScintillaGlobalElement.ChildNodes | Select-Object -ExpandProperty name)
    }
    else
    {
        $differenceObject = @($ScintillaGlobalElement.ChildNodes | Where-Object { $_.name -eq 'Line number margin'} | Select-Object -ExpandProperty name)
    }
    
    $delta = @(Compare-Object $referenceObject $differenceObject -IncludeEqual)
    $delta | ForEach-Object {
        $deltaItem = $_
        write-host "'$($deltaItem.SideIndicator)' GlobalStyles '$($deltaItem.InputObject)'"

        switch ($deltaItem.SideIndicator)
        {
            '==' { 
                #update
            }
            '=>' { 
                #add
                $scintillaItem = $ScintillaGlobalElement.selectSingleNode("./WidgetStyle[@name='$($deltaItem.InputObject)']")
                [System.Xml.XmlElement]$xmlNode  = $dosv.CreateElement('WordStyle')
                $xmlNode.SetAttribute('bgColor',$scintillaItem.bgColor) 
                $xmlNode.SetAttribute('eolFill','') 
                $xmlNode.SetAttribute('fgColor',$scintillaItem.fgColor) 
                $xmlNode.SetAttribute('fontName',$scintillaItem.fontName)
                $xmlNode.SetAttribute('fontSize',$scintillaItem.fontSize) 
                $xmlNode.SetAttribute('fontStyle',$scintillaItem.fontStyle) 
                $xmlNode.SetAttribute('name',$scintillaItem.name)
                $xmlNode.SetAttribute('styleID',$scintillaItem.styleID)
                $xmlNode.SetAttribute('keywordClass',$scintillaItem.keywordClass) 
                $dosvWordStyles.AppendChild($xmlNode)
            }
            '<=' {
                #ignore
            }
        }
        write-host "'$($deltaItem.SideIndicator)' WordStyles '$($deltaItem.InputObject)' - done"
    }

    return $DosvElement
}

function Convert-ScintillaConfig {
<#
.SYNOPSIS
Converts a scintilla to the DOpus DOSV format
#>
    param(
        [string[]]$ScintillaConfigPath,
        [string[]]$DosvConfigPath
    )

    $lexerCounter = 0

    [xml]$scintillaConfig = Get-Content -Path $ScintillaConfigPath
    [xml]$dosvConfig = Get-Content -Path $DosvConfigPath
 
    $scintillaConfig.SelectNodes("//comment()") | ForEach-Object { $_.ParentNode.RemoveChild($_); } | out-null
    $dosvConfig.SelectNodes("//comment()") | ForEach-Object { $_.ParentNode.RemoveChild($_); } | out-null


    $scintillaGlobalStyles = $scintillaConfig.NotepadPlus.GlobalStyles

    $referenceObject = @($dosvConfig.Config.Styles.Style | Select-Object -ExpandProperty name)
    $differenceObject = @($scintillaConfig.NotepadPlus.LexerStyles.LexerType | Select-Object  -ExpandProperty name)

    $delta = @(Compare-Object $referenceObject $differenceObject -IncludeEqual)
    $delta | ForEach-Object {
        $deltaItem = $_
        write-host "'$($deltaItem.SideIndicator)' Style '$($deltaItem.InputObject)'"

        switch ( $deltaItem.SideIndicator)
        {
            '==' { 
                #update
                $dosvItem = $dosvConfig.Config.Styles.selectSingleNode("./Style[@name='$($deltaItem.InputObject)']")
                $scintillaItem = $scintillaConfig.NotepadPlus.LexerStyles.selectSingleNode("./LexerType[@name='$($deltaItem.InputObject)']")
                $dosvItem = Merge-ScintillaConfigElement $dosvItem $scintillaItem
            }
            '=>' { 
                #add
                #$result = 'Monday'    
            }
            '<=' {
                #ignore
                #$result = 'Tuesday'   
            }
        }
        
        write-host "'$($deltaItem.SideIndicator)' Style '$($deltaItem.InputObject)' - Done"
        $dosvItem = $dosvConfig.Config.Styles.selectSingleNode("./Style[@name='$($deltaItem.InputObject)']")
        if( $dosvItem -ne $null)
        {
            $dosvItem = Merge-ScintillaGlobalElement $dosvItem $scintillaGlobalStyles
            write-host "'$($deltaItem.SideIndicator)' Style Defaults '$($deltaItem.InputObject)' - Done"
        }
    }

    write-host "Done All"
        
    return $dosvConfig
}

$originalDosvConfigPath = 'c:\dosv.config.original.xml'
$notepadConfigPath = 'C:\yourstyle.xml'
$outputpath = 'c:\dosv.config.xml'

$result = Convert-ScintillaConfig $notepadConfigPath $originalDosvConfigPath
$result.OuterXml | set-content -LiteralPath $outputpath