├── .gitattributes
├── .github
└── ISSUE_TEMPLATE.md
├── .gitignore
├── LICENSE.md
├── MarkdownViewerPlusPlus.sln
├── MarkdownViewerPlusPlus
├── Forms
│ ├── AboutDialog.Designer.cs
│ ├── AboutDialog.cs
│ ├── AboutDialog.resx
│ ├── AbstractOptionsPanel.cs
│ ├── AbstractRenderer.Designer.cs
│ ├── AbstractRenderer.cs
│ ├── AbstractRenderer.resx
│ ├── MarkdownViewerHtmlPanel.cs
│ ├── MarkdownViewerOptions.Designer.cs
│ ├── MarkdownViewerOptions.cs
│ ├── MarkdownViewerOptions.resx
│ ├── MarkdownViewerRenderer.cs
│ ├── OptionsPanelGeneral.Designer.cs
│ ├── OptionsPanelGeneral.cs
│ ├── OptionsPanelGeneral.resx
│ ├── OptionsPanelHTML.Designer.cs
│ ├── OptionsPanelHTML.cs
│ ├── OptionsPanelHTML.resx
│ ├── OptionsPanelPDF.Designer.cs
│ ├── OptionsPanelPDF.cs
│ └── OptionsPanelPDF.resx
├── Helper
│ └── ClipboardHelper.cs
├── ILMerge.props
├── ILMergeOrder.txt
├── Main.cs
├── MarkdownViewer.cs
├── MarkdownViewerConfiguration.cs
├── MarkdownViewerPlusPlus.csproj
├── PluginInfrastructure
│ ├── ClikeStringArray.cs
│ ├── DllExport
│ │ ├── DllExportAttribute.cs
│ │ ├── Mono.Cecil.dll
│ │ ├── NppPlugin.DllExport.MSBuild.dll
│ │ ├── NppPlugin.DllExport.dll
│ │ └── NppPlugin.DllExport.targets
│ ├── Docking_h.cs
│ ├── GatewayDomain.cs
│ ├── IScintillaGateway.cs
│ ├── MenuCmdID_h.cs
│ ├── Msgs_h.cs
│ ├── NotepadPPGateway.cs
│ ├── NppPluginNETBase.cs
│ ├── NppPluginNETHelper.cs
│ ├── Preference_h.cs
│ ├── Resource_h.cs
│ ├── ScintillaGateway.cs
│ ├── Scintilla_iface.cs
│ ├── UnmanagedExports.cs
│ └── Win32.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Resources
│ ├── Donate-PayPal-green.png
│ ├── MarkdownViewerHTML.css
│ ├── MarkdownViewerPlusPlus-Options.png
│ ├── MarkdownViewerPlusPlus.png
│ ├── fa-clipboard-16x16.png
│ ├── fa-cog-16x16.png
│ ├── fa-download-16x16.png
│ ├── fa-envelope-16x16.png
│ ├── fa-file-pdf-o-16x16.png
│ ├── fa-html5-16x16.png
│ ├── fa-info-16x16.png
│ ├── fa-paypal-16x16.png
│ ├── fa-print-16x16.png
│ ├── fa-refresh-16x16.png
│ ├── fa-tv-16x16.png
│ ├── fa-upload-16x16.png
│ ├── markdown-16x16-solid.bmp
│ └── markdown-16x16-solid.png
├── Windows
│ └── WindowsMessage.cs
├── app.config
└── packages.config
├── README.md
├── _config.yml
├── appveyor.yml
└── license
├── Apache-2.0-License.md
├── HtmlRenderer-License.md
├── Markdig-License.md
├── Ms-PL-License.md
├── OFL.txt
└── PDFSharp-License.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Issue description
2 | _Please describe your issue and expected result_
3 |
4 | ### Markdown to reproduce
5 | ```
6 | Please post the markdown code producing the described issue, if any
7 | ```
8 |
9 | ### Screenshot
10 | _If available_
11 |
12 | ### Environment
13 | * Notepad++ _X.Y.Z (x86/x64)_
14 | * MarkdownViewer++ _X.Y.Z_
15 | * Windows _7/8/10 (x86/x64)_
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # MSTest test Results
33 | [Tt]est[Rr]esult*/
34 | [Bb]uild[Ll]og.*
35 |
36 | # NUNIT
37 | *.VisualState.xml
38 | TestResult.xml
39 |
40 | # Build Results of an ATL Project
41 | [Dd]ebugPS/
42 | [Rr]eleasePS/
43 | dlldata.c
44 |
45 | # .NET Core
46 | project.lock.json
47 | project.fragment.lock.json
48 | artifacts/
49 | **/Properties/launchSettings.json
50 |
51 | *_i.c
52 | *_p.c
53 | *_i.h
54 | *.ilk
55 | *.meta
56 | *.obj
57 | *.pch
58 | *.pdb
59 | *.pgc
60 | *.pgd
61 | *.rsp
62 | *.sbr
63 | *.tlb
64 | *.tli
65 | *.tlh
66 | *.tmp
67 | *.tmp_proj
68 | *.log
69 | *.vspscc
70 | *.vssscc
71 | .builds
72 | *.pidb
73 | *.svclog
74 | *.scc
75 |
76 | # Chutzpah Test files
77 | _Chutzpah*
78 |
79 | # Visual C++ cache files
80 | ipch/
81 | *.aps
82 | *.ncb
83 | *.opendb
84 | *.opensdf
85 | *.sdf
86 | *.cachefile
87 | *.VC.db
88 | *.VC.VC.opendb
89 |
90 | # Visual Studio profiler
91 | *.psess
92 | *.vsp
93 | *.vspx
94 | *.sap
95 |
96 | # TFS 2012 Local Workspace
97 | $tf/
98 |
99 | # Guidance Automation Toolkit
100 | *.gpState
101 |
102 | # ReSharper is a .NET coding add-in
103 | _ReSharper*/
104 | *.[Rr]e[Ss]harper
105 | *.DotSettings.user
106 |
107 | # JustCode is a .NET coding add-in
108 | .JustCode
109 |
110 | # TeamCity is a build add-in
111 | _TeamCity*
112 |
113 | # DotCover is a Code Coverage Tool
114 | *.dotCover
115 |
116 | # Visual Studio code coverage results
117 | *.coverage
118 | *.coveragexml
119 |
120 | # NCrunch
121 | _NCrunch_*
122 | .*crunch*.local.xml
123 | nCrunchTemp_*
124 |
125 | # MightyMoose
126 | *.mm.*
127 | AutoTest.Net/
128 |
129 | # Web workbench (sass)
130 | .sass-cache/
131 |
132 | # Installshield output folder
133 | [Ee]xpress/
134 |
135 | # DocProject is a documentation generator add-in
136 | DocProject/buildhelp/
137 | DocProject/Help/*.HxT
138 | DocProject/Help/*.HxC
139 | DocProject/Help/*.hhc
140 | DocProject/Help/*.hhk
141 | DocProject/Help/*.hhp
142 | DocProject/Help/Html2
143 | DocProject/Help/html
144 |
145 | # Click-Once directory
146 | publish/
147 |
148 | # Publish Web Output
149 | *.[Pp]ublish.xml
150 | *.azurePubxml
151 | # TODO: Comment the next line if you want to checkin your web deploy settings
152 | # but database connection strings (with potential passwords) will be unencrypted
153 | *.pubxml
154 | *.publishproj
155 |
156 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
157 | # checkin your Azure Web App publish settings, but sensitive information contained
158 | # in these scripts will be unencrypted
159 | PublishScripts/
160 |
161 | # NuGet Packages
162 | *.nupkg
163 | # The packages folder can be ignored because of Package Restore
164 | **/packages/*
165 | # except build/, which is used as an MSBuild target.
166 | !**/packages/build/
167 | # Uncomment if necessary however generally it will be regenerated when needed
168 | #!**/packages/repositories.config
169 | # NuGet v3's project.json files produces more ignoreable files
170 | *.nuget.props
171 | *.nuget.targets
172 |
173 | # Microsoft Azure Build Output
174 | csx/
175 | *.build.csdef
176 |
177 | # Microsoft Azure Emulator
178 | ecf/
179 | rcf/
180 |
181 | # Windows Store app package directories and files
182 | AppPackages/
183 | BundleArtifacts/
184 | Package.StoreAssociation.xml
185 | _pkginfo.txt
186 |
187 | # Visual Studio cache files
188 | # files ending in .cache can be ignored
189 | *.[Cc]ache
190 | # but keep track of directories ending in .cache
191 | !*.[Cc]ache/
192 |
193 | # Others
194 | ClientBin/
195 | ~$*
196 | *~
197 | *.dbmdl
198 | *.dbproj.schemaview
199 | *.jfm
200 | *.pfx
201 | *.publishsettings
202 | node_modules/
203 | orleans.codegen.cs
204 |
205 | # Since there are multiple workflows, uncomment next line to ignore bower_components
206 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
207 | #bower_components/
208 |
209 | # RIA/Silverlight projects
210 | Generated_Code/
211 |
212 | # Backup & report files from converting an old project file
213 | # to a newer Visual Studio version. Backup files are not needed,
214 | # because we have git ;-)
215 | _UpgradeReport_Files/
216 | Backup*/
217 | UpgradeLog*.XML
218 | UpgradeLog*.htm
219 |
220 | # SQL Server files
221 | *.mdf
222 | *.ldf
223 |
224 | # Business Intelligence projects
225 | *.rdl.data
226 | *.bim.layout
227 | *.bim_*.settings
228 |
229 | # Microsoft Fakes
230 | FakesAssemblies/
231 |
232 | # GhostDoc plugin setting file
233 | *.GhostDoc.xml
234 |
235 | # Node.js Tools for Visual Studio
236 | .ntvs_analysis.dat
237 |
238 | # Visual Studio 6 build log
239 | *.plg
240 |
241 | # Visual Studio 6 workspace options file
242 | *.opt
243 |
244 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
245 | *.vbw
246 |
247 | # Visual Studio LightSwitch build output
248 | **/*.HTMLClient/GeneratedArtifacts
249 | **/*.DesktopClient/GeneratedArtifacts
250 | **/*.DesktopClient/ModelManifest.xml
251 | **/*.Server/GeneratedArtifacts
252 | **/*.Server/ModelManifest.xml
253 | _Pvt_Extensions
254 |
255 | # Paket dependency manager
256 | .paket/paket.exe
257 | paket-files/
258 |
259 | # FAKE - F# Make
260 | .fake/
261 |
262 | # JetBrains Rider
263 | .idea/
264 | *.sln.iml
265 |
266 | # CodeRush
267 | .cr/
268 |
269 | # Python Tools for Visual Studio (PTVS)
270 | __pycache__/
271 | *.pyc
272 |
273 | # Cake - Uncomment if you are using it
274 | # tools/**
275 | # !tools/packages.config
276 | /_site
277 | /Gemfile.lock
278 | /Gemfile
279 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Savas Ziplies
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarkdownViewerPlusPlus", "MarkdownViewerPlusPlus\MarkdownViewerPlusPlus.csproj", "{E56F6E12-089C-40ED-BCFD-923E5FA121A1}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|x64 = Debug|x64
12 | Debug|x86 = Debug|x86
13 | Release|Any CPU = Release|Any CPU
14 | Release|x64 = Release|x64
15 | Release|x86 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|x64.ActiveCfg = Debug|x64
21 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|x64.Build.0 = Debug|x64
22 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|x86.ActiveCfg = Debug|x86
23 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Debug|x86.Build.0 = Debug|x86
24 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|x64.ActiveCfg = Release|x64
27 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|x64.Build.0 = Release|x64
28 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|x86.ActiveCfg = Release|x86
29 | {E56F6E12-089C-40ED-BCFD-923E5FA121A1}.Release|x86.Build.0 = Release|x86
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/AboutDialog.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
2 | {
3 | partial class AboutDialog
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.btnClose = new System.Windows.Forms.Button();
32 | this.btnVisit = new System.Windows.Forms.Button();
33 | this.lblAbout = new System.Windows.Forms.Label();
34 | this.picBoxDonate = new System.Windows.Forms.PictureBox();
35 | ((System.ComponentModel.ISupportInitialize)(this.picBoxDonate)).BeginInit();
36 | this.SuspendLayout();
37 | //
38 | // btnClose
39 | //
40 | this.btnClose.Location = new System.Drawing.Point(212, 254);
41 | this.btnClose.Name = "btnClose";
42 | this.btnClose.Size = new System.Drawing.Size(94, 23);
43 | this.btnClose.TabIndex = 0;
44 | this.btnClose.Text = "Close";
45 | this.btnClose.UseVisualStyleBackColor = true;
46 | this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
47 | //
48 | // btnVisit
49 | //
50 | this.btnVisit.Location = new System.Drawing.Point(12, 254);
51 | this.btnVisit.Name = "btnVisit";
52 | this.btnVisit.Size = new System.Drawing.Size(94, 23);
53 | this.btnVisit.TabIndex = 1;
54 | this.btnVisit.Text = "Visit Website";
55 | this.btnVisit.UseVisualStyleBackColor = true;
56 | this.btnVisit.Click += new System.EventHandler(this.btnVisit_Click);
57 | //
58 | // lblAbout
59 | //
60 | this.lblAbout.Location = new System.Drawing.Point(13, 13);
61 | this.lblAbout.Name = "lblAbout";
62 | this.lblAbout.Size = new System.Drawing.Size(259, 238);
63 | this.lblAbout.TabIndex = 2;
64 | //
65 | // picBoxDonate
66 | //
67 | this.picBoxDonate.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
68 | this.picBoxDonate.Image = global::com.insanitydesign.MarkdownViewerPlusPlus.Properties.Resources.Donate_PayPal_green;
69 | this.picBoxDonate.InitialImage = null;
70 | this.picBoxDonate.Location = new System.Drawing.Point(112, 254);
71 | this.picBoxDonate.Name = "picBoxDonate";
72 | this.picBoxDonate.Size = new System.Drawing.Size(94, 23);
73 | this.picBoxDonate.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
74 | this.picBoxDonate.TabIndex = 3;
75 | this.picBoxDonate.TabStop = false;
76 | this.picBoxDonate.Click += new System.EventHandler(this.picBoxDonate_Click);
77 | //
78 | // AboutDialog
79 | //
80 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
81 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
82 | this.ClientSize = new System.Drawing.Size(318, 289);
83 | this.Controls.Add(this.picBoxDonate);
84 | this.Controls.Add(this.lblAbout);
85 | this.Controls.Add(this.btnVisit);
86 | this.Controls.Add(this.btnClose);
87 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
88 | this.MaximizeBox = false;
89 | this.MinimizeBox = false;
90 | this.Name = "AboutDialog";
91 | this.ShowIcon = false;
92 | this.ShowInTaskbar = false;
93 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
94 | this.Text = "About MarkdownViewer++";
95 | ((System.ComponentModel.ISupportInitialize)(this.picBoxDonate)).EndInit();
96 | this.ResumeLayout(false);
97 |
98 | }
99 |
100 | #endregion
101 |
102 | private System.Windows.Forms.Button btnClose;
103 | private System.Windows.Forms.Button btnVisit;
104 | private System.Windows.Forms.Label lblAbout;
105 | private System.Windows.Forms.PictureBox picBoxDonate;
106 | }
107 | }
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/AboutDialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Windows.Forms;
4 |
5 | ///
6 | ///
7 | ///
8 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
9 | {
10 | ///
11 | /// About Dialog for this plugin with basic information and link to the website.
12 | ///
13 | public partial class AboutDialog : Form
14 | {
15 | ///
16 | /// Init the about dialog text from the Assembly Information
17 | ///
18 | public AboutDialog()
19 | {
20 | InitializeComponent();
21 |
22 | //Get the assembly information for the About dialog
23 | string title = ((AssemblyTitleAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute), false)).Title;
24 | string description = ((AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyDescriptionAttribute), false)).Description;
25 | string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
26 | //About Text
27 | this.lblAbout.Text = $@"{title}
28 |
29 | {description}
30 |
31 | Version: {version}
32 |
33 | Many thanks to:
34 | Notepad++ PluginPack.net by kbilsted
35 | Markdig by lunet-io
36 | PDFSharp by empira Software GmbH
37 | HTMLRenderer by ArthurHub
38 | SVG.NET by vvvv
39 | FontAwesome
40 | dcurtis
41 |
42 | For more information, visit the website or check the included README.md
43 | ";
44 | }
45 |
46 | ///
47 | ///
48 | ///
49 | ///
50 | ///
51 | private void btnClose_Click(object sender, System.EventArgs e)
52 | {
53 | this.Close();
54 | }
55 |
56 | ///
57 | /// Visit GitHub
58 | ///
59 | ///
60 | ///
61 | private void btnVisit_Click(object sender, System.EventArgs e)
62 | {
63 | System.Diagnostics.Process.Start("https://github.com/nea/MarkdownViewerPlusPlus");
64 | }
65 |
66 | ///
67 | ///
68 | ///
69 | ///
70 | ///
71 | private void picBoxDonate_Click(object sender, EventArgs e)
72 | {
73 | System.Diagnostics.Process.Start("https://www.paypal.me/insanitydesign");
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/AboutDialog.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/AbstractOptionsPanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewerConfiguration;
4 |
5 | ///
6 | ///
7 | ///
8 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
9 | {
10 | ///
11 | /// Abstract class not being abstract for Designer compatibility
12 | ///
13 | public class AbstractOptionsPanel : UserControl
14 | {
15 | ///
16 | ///
17 | ///
18 | public AbstractOptionsPanel()
19 | {
20 | //
21 | this.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
22 | this.Dock = DockStyle.Fill;
23 | //
24 | InitializeComponent();
25 | }
26 |
27 | ///
28 | /// Load all options from the local Options instance
29 | /// onto the panel.
30 | ///
31 | public virtual void LoadOptions(Options options)
32 | {
33 | throw new NotImplementedException();
34 | }
35 |
36 | ///
37 | /// Save the made selections/entries of the panel
38 | /// in the local Options instance.
39 | ///
40 | public virtual void SaveOptions(ref Options options)
41 | {
42 | throw new NotImplementedException();
43 | }
44 |
45 | ///
46 | ///
47 | ///
48 | protected virtual void InitializeComponent()
49 | {
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/AbstractRenderer.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs:
--------------------------------------------------------------------------------
1 | using TheArtOfDev.HtmlRenderer.WinForms;
2 |
3 | ///
4 | ///
5 | ///
6 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
7 | {
8 | ///
9 | ///
10 | ///
11 | public class MarkdownViewerHtmlPanel : HtmlPanel
12 | {
13 | ///
14 | ///
15 | ///
16 | public MarkdownViewerHtmlPanel()
17 | {
18 | this.AllowDrop = false;
19 | this.Dock = System.Windows.Forms.DockStyle.Fill;
20 | this.IsContextMenuEnabled = false;
21 | this.Location = new System.Drawing.Point(0, 24);
22 | this.MinimumSize = new System.Drawing.Size(20, 20);
23 | this.Name = "markdownViewerHtmlPanel";
24 | this.Size = new System.Drawing.Size(284, 237);
25 | this.TabIndex = 0;
26 | this.AvoidImagesLateLoading = false;
27 | }
28 |
29 | ///
30 | ///
31 | ///
32 | public override string Text {
33 | get { return _text; }
34 | set {
35 | _text = value;
36 | if (!IsDisposed)
37 | {
38 | _htmlContainer.SetHtml(_text, _baseCssData);
39 | Redraw();
40 | }
41 | }
42 | }
43 |
44 | ///
45 | /// Scroll by the given ratio, calculated with max and page
46 | ///
47 | ///
48 | public void ScrollByRatioVertically(double scrollRatio)
49 | {
50 | if (!IsDisposed)
51 | {
52 | VerticalScroll.Value = (int)((VerticalScroll.Maximum - VerticalScroll.LargeChange) * scrollRatio);
53 | Redraw();
54 | }
55 | }
56 |
57 | ///
58 | ///
59 | ///
60 | protected void Redraw()
61 | {
62 | PerformLayout();
63 | Invalidate();
64 | InvokeMouseMove();
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/MarkdownViewerOptions.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
2 | {
3 | partial class MarkdownViewerOptions
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | //
21 | base.Dispose(disposing);
22 | }
23 |
24 | #region Windows Form Designer generated code
25 |
26 | ///
27 | /// Required method for Designer support - do not modify
28 | /// the contents of this method with the code editor.
29 | ///
30 | private void InitializeComponent()
31 | {
32 | this.components = new System.ComponentModel.Container();
33 | System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("General");
34 | System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("HTML", 1, 1);
35 | System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("PDF", 2, 2);
36 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MarkdownViewerOptions));
37 | this.btnOptionsSave = new System.Windows.Forms.Button();
38 | this.btnOptionsCancel = new System.Windows.Forms.Button();
39 | this.splitOptions = new System.Windows.Forms.SplitContainer();
40 | this.treeOptions = new System.Windows.Forms.TreeView();
41 | this.imgOptions = new System.Windows.Forms.ImageList(this.components);
42 | ((System.ComponentModel.ISupportInitialize)(this.splitOptions)).BeginInit();
43 | this.splitOptions.Panel1.SuspendLayout();
44 | this.splitOptions.SuspendLayout();
45 | this.SuspendLayout();
46 | //
47 | // btnOptionsSave
48 | //
49 | this.btnOptionsSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
50 | this.btnOptionsSave.Location = new System.Drawing.Point(455, 312);
51 | this.btnOptionsSave.Name = "btnOptionsSave";
52 | this.btnOptionsSave.Size = new System.Drawing.Size(75, 23);
53 | this.btnOptionsSave.TabIndex = 0;
54 | this.btnOptionsSave.Text = "Save";
55 | this.btnOptionsSave.UseVisualStyleBackColor = true;
56 | this.btnOptionsSave.Click += new System.EventHandler(this.btnOptionsSave_Click);
57 | //
58 | // btnOptionsCancel
59 | //
60 | this.btnOptionsCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
61 | this.btnOptionsCancel.CausesValidation = false;
62 | this.btnOptionsCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
63 | this.btnOptionsCancel.Location = new System.Drawing.Point(374, 312);
64 | this.btnOptionsCancel.Name = "btnOptionsCancel";
65 | this.btnOptionsCancel.Size = new System.Drawing.Size(75, 23);
66 | this.btnOptionsCancel.TabIndex = 1;
67 | this.btnOptionsCancel.Text = "Cancel";
68 | this.btnOptionsCancel.UseVisualStyleBackColor = true;
69 | this.btnOptionsCancel.Click += new System.EventHandler(this.btnOptionsCancel_Click);
70 | //
71 | // splitOptions
72 | //
73 | this.splitOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
74 | | System.Windows.Forms.AnchorStyles.Left)
75 | | System.Windows.Forms.AnchorStyles.Right)));
76 | this.splitOptions.Location = new System.Drawing.Point(0, 0);
77 | this.splitOptions.Margin = new System.Windows.Forms.Padding(10);
78 | this.splitOptions.Name = "splitOptions";
79 | //
80 | // splitOptions.Panel1
81 | //
82 | this.splitOptions.Panel1.Controls.Add(this.treeOptions);
83 | this.splitOptions.Size = new System.Drawing.Size(530, 306);
84 | this.splitOptions.SplitterDistance = 135;
85 | this.splitOptions.TabIndex = 2;
86 | //
87 | // treeOptions
88 | //
89 | this.treeOptions.Dock = System.Windows.Forms.DockStyle.Fill;
90 | this.treeOptions.FullRowSelect = true;
91 | this.treeOptions.HideSelection = false;
92 | this.treeOptions.ImageIndex = 0;
93 | this.treeOptions.ImageList = this.imgOptions;
94 | this.treeOptions.Location = new System.Drawing.Point(0, 0);
95 | this.treeOptions.Name = "treeOptions";
96 | treeNode1.Checked = true;
97 | treeNode1.Name = "nodeGeneral";
98 | treeNode1.Tag = "OptionsPanelGeneral";
99 | treeNode1.Text = "General";
100 | treeNode2.ImageIndex = 1;
101 | treeNode2.Name = "nodeHTML";
102 | treeNode2.SelectedImageIndex = 1;
103 | treeNode2.Tag = "OptionsPanelHTML";
104 | treeNode2.Text = "HTML";
105 | treeNode3.ImageIndex = 2;
106 | treeNode3.Name = "nodePDF";
107 | treeNode3.SelectedImageIndex = 2;
108 | treeNode3.Tag = "OptionsPanelPDF";
109 | treeNode3.Text = "PDF";
110 | this.treeOptions.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
111 | treeNode1,
112 | treeNode2,
113 | treeNode3});
114 | this.treeOptions.SelectedImageIndex = 0;
115 | this.treeOptions.Size = new System.Drawing.Size(135, 306);
116 | this.treeOptions.TabIndex = 0;
117 | //
118 | // imgOptions
119 | //
120 | this.imgOptions.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgOptions.ImageStream")));
121 | this.imgOptions.TransparentColor = System.Drawing.Color.Transparent;
122 | this.imgOptions.Images.SetKeyName(0, "markdown-16x16-solid.png");
123 | this.imgOptions.Images.SetKeyName(1, "fa-html5-16x16.png");
124 | this.imgOptions.Images.SetKeyName(2, "fa-file-pdf-o-16x16.png");
125 | //
126 | // MarkdownViewerOptions
127 | //
128 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
129 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
130 | this.CancelButton = this.btnOptionsCancel;
131 | this.ClientSize = new System.Drawing.Size(534, 341);
132 | this.Controls.Add(this.splitOptions);
133 | this.Controls.Add(this.btnOptionsCancel);
134 | this.Controls.Add(this.btnOptionsSave);
135 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
136 | this.MaximizeBox = false;
137 | this.MinimizeBox = false;
138 | this.MinimumSize = new System.Drawing.Size(550, 380);
139 | this.Name = "MarkdownViewerOptions";
140 | this.ShowIcon = false;
141 | this.ShowInTaskbar = false;
142 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
143 | this.Text = "Options - MarkdownViewer++";
144 | this.splitOptions.Panel1.ResumeLayout(false);
145 | ((System.ComponentModel.ISupportInitialize)(this.splitOptions)).EndInit();
146 | this.splitOptions.ResumeLayout(false);
147 | this.ResumeLayout(false);
148 |
149 | }
150 |
151 | #endregion
152 |
153 | private System.Windows.Forms.Button btnOptionsSave;
154 | private System.Windows.Forms.Button btnOptionsCancel;
155 | private System.Windows.Forms.SplitContainer splitOptions;
156 | private System.Windows.Forms.TreeView treeOptions;
157 | private System.Windows.Forms.ImageList imgOptions;
158 | }
159 | }
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/MarkdownViewerOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewerConfiguration;
6 |
7 | ///
8 | ///
9 | ///
10 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
11 | {
12 | ///
13 | ///
14 | ///
15 | public partial class MarkdownViewerOptions : Form
16 | {
17 | ///
18 | ///
19 | ///
20 | protected MarkdownViewerConfiguration configuration;
21 |
22 | ///
23 | ///
24 | ///
25 | protected Dictionary optionPanels = new Dictionary();
26 |
27 | ///
28 | ///
29 | ///
30 | ///
31 | protected delegate void SaveHandler(ref Options options);
32 |
33 | ///
34 | ///
35 | ///
36 | protected SaveHandler SaveEvent;
37 |
38 | ///
39 | ///
40 | ///
41 | ///
42 | protected delegate void LoadHandler(Options options);
43 |
44 | ///
45 | ///
46 | ///
47 | protected LoadHandler LoadEvent;
48 |
49 | ///
50 | ///
51 | ///
52 | public MarkdownViewerOptions(ref MarkdownViewerConfiguration configuration)
53 | {
54 | //
55 | this.configuration = configuration;
56 | //
57 | InitializeComponent();
58 | //Iterate over all menu items and register their classes
59 | string thisNamespace = typeof(MarkdownViewerOptions).Namespace;
60 | foreach (TreeNode node in this.treeOptions.Nodes)
61 | {
62 | AbstractOptionsPanel optionsPanel = (AbstractOptionsPanel)Activator.CreateInstance(Type.GetType(thisNamespace + "." + node.Tag.ToString()));
63 | this.SaveEvent += optionsPanel.SaveOptions;
64 | this.LoadEvent += optionsPanel.LoadOptions;
65 | //Add to map to store for changes
66 | this.optionPanels.Add(node.Tag.ToString(), optionsPanel);
67 | }
68 | //
69 | this.treeOptions.AfterSelect += treeOptions_AfterSelect;
70 | //Start with the general options panel
71 | this.splitOptions.Panel2.Controls.Add(this.optionPanels.First().Value);
72 | this.treeOptions.Select();
73 | //Set the according dialog result to their respective buttons
74 | this.btnOptionsCancel.DialogResult = DialogResult.Cancel;
75 | this.btnOptionsSave.DialogResult = DialogResult.OK;
76 | //
77 | this.LoadEvent(this.configuration.options);
78 | }
79 |
80 | ///
81 | ///
82 | ///
83 | ///
84 | ///
85 | protected void treeOptions_AfterSelect(object sender, TreeViewEventArgs treeNodeEvent)
86 | {
87 | //Remove old (if any)
88 | if (this.splitOptions.Panel2.Controls.Count > 0)
89 | {
90 | this.splitOptions.Panel2.Controls.RemoveAt(0);
91 | }
92 | //Add selected options panel
93 | AbstractOptionsPanel optionPanel = this.optionPanels.Where(entry => entry.Key == treeNodeEvent.Node.Tag.ToString()).First().Value;
94 | this.splitOptions.Panel2.Controls.Add(optionPanel);
95 | }
96 |
97 | ///
98 | ///
99 | ///
100 | ///
101 | ///
102 | private void btnOptionsCancel_Click(object sender, System.EventArgs e)
103 | {
104 | this.Dispose();
105 | }
106 |
107 | ///
108 | ///
109 | ///
110 | ///
111 | ///
112 | private void btnOptionsSave_Click(object sender, System.EventArgs e)
113 | {
114 | //Fire the save event for all listeners
115 | this.SaveEvent(ref this.configuration.options);
116 | //Save to init
117 | this.configuration.Save();
118 | //Close the options dialog when all has been done
119 | this.Dispose();
120 | }
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/MarkdownViewerOptions.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
124 |
125 | AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
126 | LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
127 | ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADm
128 | CQAAAk1TRnQBSQFMAgEBAwEAAUABAAFAAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
129 | AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
130 | AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
131 | AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
132 | AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm
133 | AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM
134 | AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA
135 | ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz
136 | AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ
137 | AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM
138 | AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA
139 | AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA
140 | AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ
141 | AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/
142 | AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA
143 | AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm
144 | ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ
145 | Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz
146 | AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA
147 | AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM
148 | AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM
149 | ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM
150 | Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA
151 | AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM
152 | AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ
153 | AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz
154 | AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm
155 | AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw
156 | AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/xUAAf8B9ALvAfMB/wgA
157 | C/8kAAH/AfABbQYAARIBvAH/BAABbQsAAW0jAAHtCgABFAUAAf8JAAH/EwAB6g4AAeoBAAHqAgABEwG8
158 | AvQBvAETCAAB/wHyAfQHAAH/JAABDwEAAfMGAAH0AgAB/wQAAv8B7wH/BgAB/xUAAW0B7wMAAe8BbQIA
159 | ARIBDgMAAf8CAAH/AQAB8gHtAewB8QEAAf8CAAH/BAAB/wIAAfAB9AP/AfEB8AH/FQAB7wIAARICAAHv
160 | AQABEgH/AfADAAH/AgAB/wUAAv8CAAH/BAAB/wIAAf8B8wH/AW0BBwHwAfQB/xUAAe8BAAFtAf8BbQEA
161 | Ae8BFQH/AgABBwIAAf8CAAYSAf8DAAH0BAAB/wMAAbwB8wH0AwAB/xUAAe8BAAH/AfMB/wEAAe8DAAHv
162 | AwAB/wIAAf8HAAEVAQAB8wQAAf8DAAH0AQcEAAH/FQAB7wEAAfIBAAHyAQAB7wMAAe8DAAH0AQABEAgA
163 | AesBAAHxBAAB/wMAAf8B9AQAAf8VAAFtAe8BEQEAAREB7wFtAgAB7wFtAwAB8gEAAW0BAAH/CAABvAQA
164 | Af8DAAH0Af8CAAP/IwAB8AEAAZIBAAH/BusBEQEAAe8EAAH/AwAB9AH/AQABFQMAARASAAFtDgABbQEH
165 | AQABBwgAAfEBAAHsBAAB/wUAAf8DAAHyAfAiAAGSAQABDggQAQ4BAAEUBAAB/wUAAf8CAAHyAQcjAAFt
166 | EQAH/wEAAfIBByQAARANAAH/AgAB7AcAARAB8BUAAUIBTQE+BwABPgMAASgDAAFAAwABEAMAAQEBAAEB
167 | BQABgBcAA/8BAAL/AfABPwHAAQcCAAL/AYABBwGAAQMCAAL/AYABBwGfAfMEAAGAAQcBhwHzBAABjwHD
168 | AYMB8wQAAQgBQwGYAQMCAAERAQABCAEDAZgBAwIAAREBGAEAASMBnAFzAgABEQEQAQ8B4wGcAfMCAAER
169 | ARABHwHjAZwB8wQAARABAwGcAcMEAAEQAQMBnAGDBAABHwHjAZ8BMwIAAv8BAAEDAZ8BJwIAAv8BAAED
170 | AYABDwIAAv8BAAEBAYABHwIACw==
171 |
172 |
173 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/MarkdownViewerRenderer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using Svg;
4 | using System.Drawing;
5 | using System.Drawing.Imaging;
6 | using System.Net;
7 | using System.Threading;
8 | using TheArtOfDev.HtmlRenderer.Core.Entities;
9 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewer;
10 |
11 | ///
12 | ///
13 | ///
14 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
15 | {
16 | ///
17 | ///
18 | ///
19 | public class MarkdownViewerRenderer : AbstractRenderer
20 | {
21 | ///
22 | ///
23 | ///
24 | public MarkdownViewerHtmlPanel markdownViewerHtmlPanel;
25 |
26 | ///
27 | ///
28 | ///
29 | ///
30 | public MarkdownViewerRenderer(MarkdownViewer markdownViewer) : base(markdownViewer)
31 | {
32 | }
33 |
34 | ///
35 | ///
36 | ///
37 | protected override void Init()
38 | {
39 | base.Init();
40 | //
41 | this.markdownViewerHtmlPanel = new MarkdownViewerHtmlPanel();
42 | //Add a custom image loader
43 | this.markdownViewerHtmlPanel.ImageLoad += OnImageLoad;
44 | //Add to view
45 | this.Controls.Add(this.markdownViewerHtmlPanel);
46 | this.Controls.SetChildIndex(this.markdownViewerHtmlPanel, 0);
47 | }
48 |
49 | ///
50 | ///
51 | ///
52 | ///
53 | ///
54 | public override void Render(string text, FileInformation fileInfo)
55 | {
56 | base.Render(text, fileInfo);
57 | this.markdownViewerHtmlPanel.Text = BuildHtml(ConvertedText, fileInfo.FileName);
58 | }
59 |
60 | ///
61 | /// Scroll the rendered panel vertically based on the given ration
62 | /// taken from Notepad++
63 | ///
64 | ///
65 | public override void ScrollByRatioVertically(double scrollRatio)
66 | {
67 | this.markdownViewerHtmlPanel.ScrollByRatioVertically(scrollRatio);
68 | }
69 |
70 | ///
71 | /// Custom renderer for SVG images in the markdown as not supported natively.
72 | /// @see https://htmlrenderer.codeplex.com/wikipage?title=Rendering%20SVG%20images
73 | ///
74 | ///
75 | ///
76 | protected void OnImageLoad(object sender, HtmlImageLoadEventArgs imageLoadEvent)
77 | {
78 | try
79 | {
80 | //Get some file information
81 | string src = imageLoadEvent.Src;
82 | Uri uri = new Uri(src);
83 | string extension = Path.GetExtension(src);
84 |
85 | //Check if local file or web resource
86 | switch (uri.Scheme.ToLowerInvariant())
87 | {
88 | case "file":
89 | //In case of a local file -> Try to load it directly
90 | imageLoadEvent.Handled = true; //Tell the event it was handled, so no error border is drawn
91 | ThreadPool.QueueUserWorkItem(state => LoadImageFromFile(src, imageLoadEvent));
92 | break;
93 | case "http":
94 | case "https":
95 | //For web resources check extension and parameter, to fetch from e.g. "badge" creating sources
96 | if ((extension != null && extension.Equals(".svg", StringComparison.OrdinalIgnoreCase))
97 | || uri.ToString().Contains("svg="))
98 | {
99 | //In case of a web resource file -> Load async
100 | using (WebClient webClient = new WebClient())
101 | {
102 | imageLoadEvent.Handled = true; //Tell the event it was handled, so no error border is drawn
103 | webClient.DownloadDataCompleted += (downloadSender, downloadEvent) => { OnDownloadDataCompleted(downloadEvent, imageLoadEvent); };
104 | webClient.DownloadDataAsync(uri);
105 | }
106 | }
107 | break;
108 | }
109 |
110 | }
111 | catch
112 | {
113 | }
114 | }
115 |
116 | ///
117 | ///
118 | ///
119 | ///
120 | ///
121 | protected void LoadImageFromFile(string src, HtmlImageLoadEventArgs imageLoadEvent)
122 | {
123 | try
124 | {
125 | Uri uri = new Uri(src);
126 | //Try to load the file as Image from file
127 | //Remove the scheme first
128 | string srcWithoutScheme = src;
129 | int i = srcWithoutScheme.IndexOf(':');
130 | if (i > 0) srcWithoutScheme = srcWithoutScheme.Substring(i + 1).TrimStart('/');
131 | //If not absolute, add the current file path
132 | if (!Path.IsPathRooted(srcWithoutScheme))
133 | {
134 | uri = new Uri(@"file:///" + this.FileInfo.FileDirectory + "/" + srcWithoutScheme);
135 | }
136 |
137 | //For SVG images: Convert to Bitmap
138 | string extension = Path.GetExtension(src);
139 | if (extension != null && extension.Equals(".svg", StringComparison.OrdinalIgnoreCase))
140 | {
141 | ConvertSvgToBitmap(SvgDocument.Open(uri.LocalPath), imageLoadEvent);
142 | }
143 | else
144 | {
145 | //Load uri, 8, 1
146 | imageLoadEvent.Callback((Bitmap)Image.FromFile(uri.LocalPath, true));
147 | }
148 | }
149 | catch { } //Not able to handle, refer back to orginal process
150 | }
151 |
152 | ///
153 | ///
154 | ///
155 | ///
156 | ///
157 | protected Bitmap ConvertSvgToBitmap(SvgDocument svgDocument, HtmlImageLoadEventArgs imageLoadEvent)
158 | {
159 | Bitmap svgImage = new Bitmap((int)svgDocument.Width, (int)svgDocument.Height, PixelFormat.Format32bppArgb);
160 | svgDocument.Draw(svgImage);
161 | imageLoadEvent.Callback(svgImage);
162 | imageLoadEvent.Handled = true;
163 | return svgImage;
164 | }
165 |
166 | ///
167 | ///
168 | ///
169 | ///
170 | ///
171 | protected void OnDownloadDataCompleted(DownloadDataCompletedEventArgs downloadEvent, HtmlImageLoadEventArgs imageLoadEvent)
172 | {
173 | using (MemoryStream stream = new MemoryStream(downloadEvent.Result))
174 | {
175 | ConvertSvgToBitmap(SvgDocument.Open(stream), imageLoadEvent);
176 | }
177 | }
178 |
179 | ///
180 | /// Release the custom loader
181 | ///
182 | protected override void Dispose(bool disposing)
183 | {
184 | if (this.markdownViewerHtmlPanel != null)
185 | {
186 | this.markdownViewerHtmlPanel.ImageLoad -= OnImageLoad;
187 | }
188 | base.Dispose(disposing);
189 | }
190 | }
191 | }
192 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/OptionsPanelGeneral.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
2 | {
3 | partial class OptionsPanelGeneral
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | protected override void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | this.lblFileExtensions = new System.Windows.Forms.Label();
33 | this.chkBoxNewFiles = new System.Windows.Forms.CheckBox();
34 | this.toolTipFileExtensions = new System.Windows.Forms.ToolTip(this.components);
35 | this.grpBoxFiles = new System.Windows.Forms.GroupBox();
36 | this.txtFileExtensions = new System.Windows.Forms.TextBox();
37 | this.grpBoxFiles.SuspendLayout();
38 | this.SuspendLayout();
39 | //
40 | // lblFileExtensions
41 | //
42 | this.lblFileExtensions.AutoSize = true;
43 | this.lblFileExtensions.Location = new System.Drawing.Point(6, 16);
44 | this.lblFileExtensions.Name = "lblFileExtensions";
45 | this.lblFileExtensions.Size = new System.Drawing.Size(76, 13);
46 | this.lblFileExtensions.TabIndex = 0;
47 | this.lblFileExtensions.Text = "File extensions";
48 | //
49 | // chkBoxNewFiles
50 | //
51 | this.chkBoxNewFiles.AutoSize = true;
52 | this.chkBoxNewFiles.Location = new System.Drawing.Point(9, 62);
53 | this.chkBoxNewFiles.Name = "chkBoxNewFiles";
54 | this.chkBoxNewFiles.Size = new System.Drawing.Size(111, 17);
55 | this.chkBoxNewFiles.TabIndex = 2;
56 | this.chkBoxNewFiles.Text = "Include new files?";
57 | this.chkBoxNewFiles.UseVisualStyleBackColor = true;
58 | //
59 | // toolTipFileExtensions
60 | //
61 | this.toolTipFileExtensions.AutomaticDelay = 0;
62 | this.toolTipFileExtensions.IsBalloon = true;
63 | this.toolTipFileExtensions.ShowAlways = true;
64 | this.toolTipFileExtensions.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info;
65 | this.toolTipFileExtensions.ToolTipTitle = "File extensions";
66 | //
67 | // grpBoxFiles
68 | //
69 | this.grpBoxFiles.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
70 | this.grpBoxFiles.Controls.Add(this.lblFileExtensions);
71 | this.grpBoxFiles.Controls.Add(this.chkBoxNewFiles);
72 | this.grpBoxFiles.Controls.Add(this.txtFileExtensions);
73 | this.grpBoxFiles.Dock = System.Windows.Forms.DockStyle.Top;
74 | this.grpBoxFiles.Location = new System.Drawing.Point(0, 0);
75 | this.grpBoxFiles.Name = "grpBoxFiles";
76 | this.grpBoxFiles.Size = new System.Drawing.Size(1255, 86);
77 | this.grpBoxFiles.TabIndex = 3;
78 | this.grpBoxFiles.TabStop = false;
79 | this.grpBoxFiles.Text = "Files";
80 | //
81 | // txtFileExtensions
82 | //
83 | this.txtFileExtensions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
84 | | System.Windows.Forms.AnchorStyles.Right)));
85 | this.txtFileExtensions.Location = new System.Drawing.Point(9, 36);
86 | this.txtFileExtensions.Name = "txtFileExtensions";
87 | this.txtFileExtensions.Size = new System.Drawing.Size(1240, 20);
88 | this.txtFileExtensions.TabIndex = 1;
89 | //
90 | // OptionsPanelGeneral
91 | //
92 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
93 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
94 | this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
95 | this.Controls.Add(this.grpBoxFiles);
96 | this.Name = "OptionsPanelGeneral";
97 | this.Size = new System.Drawing.Size(1255, 626);
98 | this.grpBoxFiles.ResumeLayout(false);
99 | this.grpBoxFiles.PerformLayout();
100 | this.ResumeLayout(false);
101 |
102 | }
103 |
104 | #endregion
105 |
106 | private System.Windows.Forms.Label lblFileExtensions;
107 | private System.Windows.Forms.CheckBox chkBoxNewFiles;
108 | private System.Windows.Forms.ToolTip toolTipFileExtensions;
109 | private System.Windows.Forms.GroupBox grpBoxFiles;
110 | private System.Windows.Forms.TextBox txtFileExtensions;
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/OptionsPanelGeneral.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Text.RegularExpressions;
4 | using System.Windows;
5 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewerConfiguration;
6 |
7 | ///
8 | ///
9 | ///
10 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
11 | {
12 | ///
13 | ///
14 | ///
15 | public partial class OptionsPanelGeneral : AbstractOptionsPanel
16 | {
17 | ///
18 | ///
19 | ///
20 | protected string msgFileExtensions = "Add a list of comma-separated file extensions (e.g. \'log,txt,html\'). Empty the box for \'All files\'.";
21 |
22 | ///
23 | ///
24 | ///
25 | protected string regExFileExtensions = "^([a-zA-Z,]*)$";
26 |
27 | ///
28 | ///
29 | ///
30 | public OptionsPanelGeneral()
31 | {
32 | //
33 | this.txtFileExtensions.Enter += txtFileExtensions_Enter;
34 | this.txtFileExtensions.Leave += txtFileExtensions_Leave;
35 | this.txtFileExtensions.Validating += txtFileExtensions_Validating;
36 | }
37 |
38 | ///
39 | /// Validate that the file extensions field has a correct value
40 | ///
41 | ///
42 | ///
43 | protected void txtFileExtensions_Validating(object sender, CancelEventArgs e)
44 | {
45 | if (!Regex.IsMatch(this.txtFileExtensions.Text, this.regExFileExtensions, RegexOptions.IgnoreCase))
46 | {
47 | MessageBox.Show(string.Format("Please check \'{0}\'\r\n" + this.msgFileExtensions, this.lblFileExtensions.Text), "Warning!", MessageBoxButton.OK, MessageBoxImage.Error);
48 | e.Cancel = true;
49 | }
50 | else
51 | {
52 | e.Cancel = false;
53 | }
54 | }
55 |
56 | ///
57 | ///
58 | ///
59 | ///
60 | ///
61 | private void txtFileExtensions_Enter(object sender, EventArgs e)
62 | {
63 | this.toolTipFileExtensions.Show(this.msgFileExtensions, this.txtFileExtensions, this.lblFileExtensions.Width, -75);
64 | }
65 |
66 | ///
67 | ///
68 | ///
69 | ///
70 | ///
71 | private void txtFileExtensions_Leave(object sender, EventArgs e)
72 | {
73 | this.toolTipFileExtensions.Hide(this.txtFileExtensions);
74 |
75 | }
76 |
77 | ///
78 | ///
79 | ///
80 | public override void SaveOptions(ref Options options)
81 | {
82 | options.inclNewFiles = this.chkBoxNewFiles.Checked;
83 | options.fileExtensions = this.txtFileExtensions.Text;
84 | }
85 |
86 | ///
87 | ///
88 | ///
89 | public override void LoadOptions(Options options)
90 | {
91 | this.chkBoxNewFiles.Checked = options.inclNewFiles;
92 | this.txtFileExtensions.Text = options.fileExtensions;
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/OptionsPanelGeneral.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/OptionsPanelHTML.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
2 | {
3 | partial class OptionsPanelHTML
4 | {
5 | ///
6 | ///
7 | ///
8 | private System.Windows.Forms.GroupBox grpStyles;
9 |
10 | ///
11 | ///
12 | ///
13 | protected override void InitializeComponent()
14 | {
15 | this.grpStyles = new System.Windows.Forms.GroupBox();
16 | this.lblCssStyles = new System.Windows.Forms.Label();
17 | this.txtCssStyles = new System.Windows.Forms.TextBox();
18 | this.grpHTMLExport = new System.Windows.Forms.GroupBox();
19 | this.chkOpenHTMLExport = new System.Windows.Forms.CheckBox();
20 | this.grpStyles.SuspendLayout();
21 | this.grpHTMLExport.SuspendLayout();
22 | this.SuspendLayout();
23 | //
24 | // grpStyles
25 | //
26 | this.grpStyles.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
27 | this.grpStyles.Controls.Add(this.lblCssStyles);
28 | this.grpStyles.Controls.Add(this.txtCssStyles);
29 | this.grpStyles.Dock = System.Windows.Forms.DockStyle.Top;
30 | this.grpStyles.Location = new System.Drawing.Point(0, 0);
31 | this.grpStyles.Name = "grpStyles";
32 | this.grpStyles.Size = new System.Drawing.Size(1255, 169);
33 | this.grpStyles.TabIndex = 0;
34 | this.grpStyles.TabStop = false;
35 | this.grpStyles.Text = "Styles";
36 | //
37 | // lblCssStyles
38 | //
39 | this.lblCssStyles.AutoSize = true;
40 | this.lblCssStyles.Location = new System.Drawing.Point(7, 20);
41 | this.lblCssStyles.Name = "lblCssStyles";
42 | this.lblCssStyles.Size = new System.Drawing.Size(66, 13);
43 | this.lblCssStyles.TabIndex = 1;
44 | this.lblCssStyles.Text = "Custom CSS";
45 | //
46 | // txtCssStyles
47 | //
48 | this.txtCssStyles.AcceptsReturn = true;
49 | this.txtCssStyles.AcceptsTab = true;
50 | this.txtCssStyles.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
51 | | System.Windows.Forms.AnchorStyles.Right)));
52 | this.txtCssStyles.Location = new System.Drawing.Point(10, 39);
53 | this.txtCssStyles.Multiline = true;
54 | this.txtCssStyles.Name = "txtCssStyles";
55 | this.txtCssStyles.ScrollBars = System.Windows.Forms.ScrollBars.Both;
56 | this.txtCssStyles.Size = new System.Drawing.Size(1239, 124);
57 | this.txtCssStyles.TabIndex = 0;
58 | //
59 | // grpHTMLExport
60 | //
61 | this.grpHTMLExport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
62 | this.grpHTMLExport.Controls.Add(this.chkOpenHTMLExport);
63 | this.grpHTMLExport.Dock = System.Windows.Forms.DockStyle.Top;
64 | this.grpHTMLExport.Location = new System.Drawing.Point(0, 169);
65 | this.grpHTMLExport.Name = "grpHTMLExport";
66 | this.grpHTMLExport.Size = new System.Drawing.Size(1255, 50);
67 | this.grpHTMLExport.TabIndex = 1;
68 | this.grpHTMLExport.TabStop = false;
69 | this.grpHTMLExport.Text = "Export";
70 | //
71 | // chkOpenHTMLExport
72 | //
73 | this.chkOpenHTMLExport.AutoSize = true;
74 | this.chkOpenHTMLExport.Location = new System.Drawing.Point(10, 20);
75 | this.chkOpenHTMLExport.Name = "chkOpenHTMLExport";
76 | this.chkOpenHTMLExport.Size = new System.Drawing.Size(141, 17);
77 | this.chkOpenHTMLExport.TabIndex = 0;
78 | this.chkOpenHTMLExport.Text = "Open HTML after export";
79 | this.chkOpenHTMLExport.UseVisualStyleBackColor = true;
80 | //
81 | // OptionsPanelHTML
82 | //
83 | this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
84 | this.Controls.Add(this.grpHTMLExport);
85 | this.Controls.Add(this.grpStyles);
86 | this.Name = "OptionsPanelHTML";
87 | this.Size = new System.Drawing.Size(1255, 709);
88 | this.grpStyles.ResumeLayout(false);
89 | this.grpStyles.PerformLayout();
90 | this.grpHTMLExport.ResumeLayout(false);
91 | this.grpHTMLExport.PerformLayout();
92 | this.ResumeLayout(false);
93 |
94 | }
95 |
96 | private System.Windows.Forms.Label lblCssStyles;
97 | private System.Windows.Forms.TextBox txtCssStyles;
98 | private System.Windows.Forms.GroupBox grpHTMLExport;
99 | private System.Windows.Forms.CheckBox chkOpenHTMLExport;
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/OptionsPanelHTML.cs:
--------------------------------------------------------------------------------
1 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewerConfiguration;
2 | ///
3 | ///
4 | ///
5 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
6 | {
7 | ///
8 | ///
9 | ///
10 | public partial class OptionsPanelHTML : AbstractOptionsPanel
11 | {
12 | ///
13 | ///
14 | ///
15 | ///
16 | public override void LoadOptions(Options options)
17 | {
18 | this.txtCssStyles.Text = options.HtmlCssStyle;
19 | this.chkOpenHTMLExport.Checked = options.htmlOpenExport;
20 | }
21 |
22 | ///
23 | ///
24 | ///
25 | ///
26 | public override void SaveOptions(ref Options options)
27 | {
28 | options.HtmlCssStyle = this.txtCssStyles.Text;
29 | options.htmlOpenExport = this.chkOpenHTMLExport.Checked;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/OptionsPanelHTML.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/OptionsPanelPDF.cs:
--------------------------------------------------------------------------------
1 | using PdfSharp;
2 | using System;
3 | using System.Linq;
4 | using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewerConfiguration;
5 |
6 | ///
7 | ///
8 | ///
9 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
10 | {
11 | ///
12 | ///
13 | ///
14 | public partial class OptionsPanelPDF : AbstractOptionsPanel
15 | {
16 | ///
17 | ///
18 | ///
19 | ///
20 | public override void LoadOptions(Options options)
21 | {
22 | //Load options from enum
23 | this.cmbPDFOrientation.Items.AddRange(Enum.GetNames(typeof(PageOrientation)));
24 | //Set a default value
25 | this.cmbPDFOrientation.SelectedItem = PageOrientation.Portrait.ToString();
26 | //Now load
27 | this.cmbPDFOrientation.SelectedItem = options.pdfOrientation.ToString();
28 | //
29 | this.cmbPDFPageSize.Items.AddRange(Enum.GetNames(typeof(PageSize)));
30 | this.cmbPDFPageSize.Items.Remove(PageSize.Undefined.ToString());
31 | this.cmbPDFPageSize.SelectedItem = PageSize.A4.ToString();
32 | this.cmbPDFPageSize.SelectedItem = options.pdfPageSize.ToString();
33 | //Load margins
34 | int[] margins = options.GetMargins();
35 | this.numMarginLeft.Value = margins[0];
36 | this.numMarginTop.Value = margins[1];
37 | this.numMarginRight.Value = margins[2];
38 | this.numMarginBottom.Value = margins[3];
39 | //
40 | this.chkOpenPDFExport.Checked = options.pdfOpenExport;
41 | }
42 |
43 | ///
44 | ///
45 | ///
46 | ///
47 | public override void SaveOptions(ref Options options)
48 | {
49 | PageOrientation pdfOrientation;
50 | if (Enum.TryParse(this.cmbPDFOrientation.SelectedItem.ToString(), out pdfOrientation))
51 | {
52 | options.pdfOrientation = pdfOrientation;
53 | }
54 | PageSize pdfPageSize;
55 | if (Enum.TryParse(this.cmbPDFPageSize.SelectedItem.ToString(), out pdfPageSize))
56 | {
57 | options.pdfPageSize = pdfPageSize;
58 | }
59 | //Save margins
60 | options.margins = this.numMarginLeft.Value + "," + this.numMarginTop.Value + "," + this.numMarginRight.Value + "," + this.numMarginBottom.Value;
61 | //
62 | options.pdfOpenExport = this.chkOpenPDFExport.Checked;
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Forms/OptionsPanelPDF.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/MarkdownViewerPlusPlus/Helper/ClipboardHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 |
7 | namespace com.insanitydesign.MarkdownViewerPlusPlus.Helper
8 | {
9 | ///
10 | /// Helper to encode and set HTML fragment to clipboard.
11 | /// See http://theartofdev.com/2014/06/12/setting-htmltext-to-clipboard-revisited/.
12 | /// .
13 | ///
14 | ///
15 | /// The MIT License (MIT) Copyright (c) 2014 Arthur Teplitzki.
16 | ///
17 | public static class ClipboardHelper
18 | {
19 | #region Fields and Consts
20 |
21 | ///
22 | /// The string contains index references to other spots in the string, so we need placeholders so we can compute the offsets.
23 | /// The _ strings are just placeholders. We'll back-patch them actual values afterwards.
24 | /// The string layout () also ensures that it can't appear in the body of the html because the
25 | /// character must be escaped.
26 | ///
27 | private const string Header = @"Version:0.9
28 | StartHTML:<<<<<<<<1
29 | EndHTML:<<<<<<<<2
30 | StartFragment:<<<<<<<<3
31 | EndFragment:<<<<<<<<4
32 | StartSelection:<<<<<<<<3
33 | EndSelection:<<<<<<<<4";
34 |
35 | ///
36 | /// html comment to point the beginning of html fragment
37 | ///
38 | public const string StartFragment = "";
39 |
40 | ///
41 | /// html comment to point the end of html fragment
42 | ///
43 | public const string EndFragment = @"";
44 |
45 | ///
46 | /// Used to calculate characters byte count in UTF-8
47 | ///
48 | private static readonly char[] _byteCount = new char[1];
49 |
50 | #endregion
51 |
52 |
53 | ///
54 | /// Create with given html and plain-text ready to be used for clipboard or drag and drop.
55 | /// Handle missing ]]> tags, specified start\end segments and Unicode characters.
56 | ///
57 | ///
58 | ///
59 | /// Windows Clipboard works with UTF-8 Unicode encoding while .NET strings use with UTF-16 so for clipboard to correctly
60 | /// decode Unicode string added to it from .NET we needs to be re-encoded it using UTF-8 encoding.
61 | ///
62 | ///
63 | /// Builds the CF_HTML header correctly for all possible HTMLs
64 | /// If given html contains start/end fragments then it will use them in the header:
65 | /// hello world