Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added .gitattributes and normalised line endings

  • Loading branch information...
commit 0ae751d73aea8d2b565b38f057831b952a58a10b 1 parent 7be8870
@JakeGinnivan JakeGinnivan authored
Showing with 23,963 additions and 23,941 deletions.
  1. +22 −0 .gitattributes
  2. +22 −22 Licence.md
  3. +37 −37 README.md
  4. +12 −12 build.cmd
  5. +17 −17 create-installer.cmd
  6. +39 −39 docs/markdown-tests/test-link-and-resource-behaviour.md
  7. +6,071 −6,071 lib/Awesomium.Core.XML
  8. +3,248 −3,248 lib/Awesomium.Windows.Controls.XML
  9. +10 −10 lib/Hunspell.0.9.6.0/Licence.txt
  10. +16 −16 package.cmd
  11. +9 −9 run-tests.cmd
  12. +52 −52 src/.nuget/NuGet.targets
  13. +10 −10 src/GlobalAssemblyInfo.cs
  14. +11 −11 src/MarkPad.PluginApi/ICanCreateNewPage.cs
  15. +11 −11 src/MarkPad.PluginApi/ICanSavePage.cs
  16. +8 −8 src/MarkPad.PluginApi/IDocumentParser.cs
  17. +16 −16 src/MarkPad.PluginApi/IMarkpadDocument.cs
  18. +17 −17 src/MarkPad.PluginApi/IPlugin.cs
  19. +15 −15 src/MarkPad.PluginApi/IPluginSettings.cs
  20. +11 −11 src/MarkPad.PluginApi/IPluginSettingsProvider.cs
  21. +21 −21 src/MarkPad.PluginApi/ISiteContext.cs
  22. +16 −16 src/MarkPad.PluginApi/ISiteItem.cs
  23. +64 −64 src/MarkPad.PluginApi/MarkPad.Plugins.csproj
  24. +16 −16 src/MarkPad.PluginApi/MarkPad.Plugins.ncrunchproject
  25. +36 −36 src/MarkPad.PluginApi/Properties/AssemblyInfo.cs
  26. +193 −193 src/MarkPad.PreviewControl/AwesomiumHost.cs
  27. +81 −81 src/MarkPad.PreviewControl/AwesomiumResourceHandler.cs
  28. +38 −38 src/MarkPad.PreviewControl/Constants.cs
  29. +33 −33 src/MarkPad.PreviewControl/FontSizes.cs
  30. +17 −17 src/MarkPad.PreviewControl/HtmlPreview.xaml
  31. +189 −189 src/MarkPad.PreviewControl/HtmlPreview.xaml.cs
  32. +46 −46 src/MarkPad.PreviewControl/HwndContentHost.cs
  33. +88 −88 src/MarkPad.PreviewControl/MarkPad.PreviewControl.csproj
  34. +16 −16 src/MarkPad.PreviewControl/MarkPad.PreviewControl.ncrunchproject
  35. +36 −36 src/MarkPad.PreviewControl/Properties/AssemblyInfo.cs
  36. +23 −23 src/MarkPad.PreviewControl/UnsafeNativeMethods.cs
  37. +3 −3 src/MarkPad.PreviewControl/packages.config
  38. +38 −38 src/MarkPad.Setup.sln
  39. +73 −73 src/MarkPad.Setup/Components.wxs
  40. +8 −8 src/MarkPad.Setup/Config.wxi
  41. +63 −63 src/MarkPad.Setup/MarkPad.Setup.wixproj
  42. +79 −79 src/MarkPad.Setup/Product.wxs
  43. +192 −192 src/MarkPad.Setup/license.rtf
  44. +63 −63 src/MarkPad.Tests/Document/AvalonEditPreviewKeyDownHandlers/CursorLeftRightWithSelectionTests.cs
  45. +130 −130 src/MarkPad.Tests/DocumentSources/FileSystem/FileSystemSiteItemTests.cs
  46. +134 −134 src/MarkPad.Tests/DocumentSources/FileSystem/JekyllSiteContextTests.cs
  47. +103 −103 src/MarkPad.Tests/DocumentSources/SiteItemBaseTests.cs
  48. +34 −34 src/MarkPad.Tests/DocumentSources/TestItem.cs
  49. +124 −124 src/MarkPad.Tests/MarkPad.Tests.csproj
  50. +15 −15 src/MarkPad.Tests/MarkPad.Tests.ncrunchproject
  51. +161 −161 src/MarkPad.Tests/OpenFromWeb/OpenFromWebViewModelTests.cs
  52. +36 −36 src/MarkPad.Tests/Properties/AssemblyInfo.cs
  53. +61 −61 src/MarkPad.Tests/Services/TestWebRequestFactory.cs
  54. +9 −9 src/MarkPad.Tests/packages.config
  55. +11 −11 src/MarkPad.ncrunchsolution
  56. +75 −75 src/MarkPad.sln
  57. +8 −8 src/MarkPad/App.xaml
  58. +57 −57 src/MarkPad/App.xaml.cs
  59. +35 −35 src/MarkPad/Behaviors/FocusExtension.cs
  60. +32 −32 src/MarkPad/Behaviors/StateHelper.cs
  61. +43 −43 src/MarkPad/Converters/BoolToGridLengthConverter.cs
  62. +59 −59 src/MarkPad/Converters/EnumDisplayConverter.cs
  63. +21 −21 src/MarkPad/Converters/InPathMultiConverter.cs
  64. +11 −11 src/MarkPad/Document/Commands/DisplayCommands.cs
  65. +13 −13 src/MarkPad/Document/Commands/FormattingCommands.cs
  66. +168 −168 src/MarkPad/Document/Controls/FloatingToolBar.cs
  67. +91 −91 src/MarkPad/Document/Controls/HyperlinkEditorView.xaml
  68. +18 −18 src/MarkPad/Document/Controls/HyperlinkEditorView.xaml.cs
  69. +31 −31 src/MarkPad/Document/Controls/HyperlinkEditorViewModel.cs
  70. +140 −140 src/MarkPad/Document/Controls/MarkdownEditor.xaml
  71. +368 −368 src/MarkPad/Document/Controls/MarkdownEditor.xaml.cs
  72. +153 −153 src/MarkPad/Document/Controls/SiteTreeViewStyle.xaml
  73. +58 −58 src/MarkPad/Document/Controls/SiteView.xaml
  74. +157 −157 src/MarkPad/Document/Controls/SiteView.xaml.cs
  75. +122 −122 src/MarkPad/Document/Controls/TreeViewHelper.cs
  76. +65 −65 src/MarkPad/Document/DocumentView.xaml
  77. +162 −162 src/MarkPad/Document/DocumentView.xaml.cs
  78. +359 −359 src/MarkPad/Document/DocumentViewModel.cs
  79. +4 −4 src/MarkPad/Document/EditorBehaviours/AutoContinueLists.cs
  80. +4 −4 src/MarkPad/Document/EditorBehaviours/ControlRightTweakedForMarkdown.cs
  81. +4 −4 src/MarkPad/Document/EditorBehaviours/CopyLeadingWhitespaceOnNewLine.cs
  82. +4 −4 src/MarkPad/Document/EditorBehaviours/CursorLeftRightWithSelection.cs
  83. +4 −4 src/MarkPad/Document/EditorBehaviours/HardLineBreak.cs
  84. +4 −4 src/MarkPad/Document/EditorBehaviours/IndentLists.cs
  85. +4 −4 src/MarkPad/Document/EditorBehaviours/OvertypeMode.cs
  86. +4 −4 src/MarkPad/Document/EditorBehaviours/PasteImagesUsingSiteContext.cs
  87. +3 −3 src/MarkPad/Document/Events/EditorPreviewKeyDownEvent.cs
  88. +3 −3 src/MarkPad/Document/Events/EditorTextEnteringEvent.cs
  89. +19 −19 src/MarkPad/Document/MarkPadHyperlink.cs
  90. +133 −133 src/MarkPad/Document/ParsedDocument.cs
  91. +13 −13 src/MarkPad/Document/SpellCheck/ISpellCheckProvider.cs
  92. +12 −12 src/MarkPad/Document/SpellCheck/ISpellingService.cs
  93. +57 −57 src/MarkPad/Document/SpellCheck/SpellCheckBackgroundRenderer.cs
  94. +107 −107 src/MarkPad/Document/SpellCheck/SpellCheckProvider.cs
  95. +16 −16 src/MarkPad/Document/SpellCheck/SpellingLanguages.cs
  96. +75 −75 src/MarkPad/Document/SpellCheck/SpellingService.cs
  97. +333 −333 src/MarkPad/Document/Styles/Scrollbars.xaml
  98. +199 −199 src/MarkPad/DocumentSources/DocumentFactory.cs
  99. +55 −55 src/MarkPad/DocumentSources/FileMarkdownDocument.cs
  100. +105 −105 src/MarkPad/DocumentSources/FileSystem/FileSystemSiteItem.cs
  101. +196 −196 src/MarkPad/DocumentSources/FileSystem/JekyllSiteContext.cs
  102. +16 −16 src/MarkPad/DocumentSources/HelpDocument.cs
  103. +16 −16 src/MarkPad/DocumentSources/IDocumentFactory.cs
  104. +8 −8 src/MarkPad/DocumentSources/ISiteContextGenerator.cs
  105. +51 −51 src/MarkPad/DocumentSources/MarkpadDocumentBase.cs
  106. +136 −136 src/MarkPad/DocumentSources/MetaWeblog/BlogService.cs
  107. +10 −10 src/MarkPad/DocumentSources/MetaWeblog/Entry.cs
  108. +13 −13 src/MarkPad/DocumentSources/MetaWeblog/IBlogService.cs
  109. +67 −67 src/MarkPad/DocumentSources/MetaWeblog/OpenFromWebView.xaml
  110. +21 −21 src/MarkPad/DocumentSources/MetaWeblog/OpenFromWebView.xaml.cs
  111. +116 −116 src/MarkPad/DocumentSources/MetaWeblog/OpenFromWebViewModel.cs
  112. +68 −68 src/MarkPad/DocumentSources/MetaWeblog/PublishDetailsView.xaml
  113. +39 −39 src/MarkPad/DocumentSources/MetaWeblog/PublishDetailsView.xaml.cs
  114. +50 −50 src/MarkPad/DocumentSources/MetaWeblog/PublishDetailsViewModel.cs
  115. +8 −8 src/MarkPad/DocumentSources/MetaWeblog/Service/Category.cs
  116. +14 −14 src/MarkPad/DocumentSources/MetaWeblog/Service/CategoryInfo.cs
  117. +12 −12 src/MarkPad/DocumentSources/MetaWeblog/Service/Enclosure.cs
  118. +5 −5 src/MarkPad/DocumentSources/MetaWeblog/Service/Generated/BloggerAPI.json
  119. +209 −209 src/MarkPad/DocumentSources/MetaWeblog/Service/Generated/MetaWeblog.generated.cs
  120. +142 −142 src/MarkPad/DocumentSources/MetaWeblog/Service/Generated/MetaWeblog.tt
  121. +11 −11 src/MarkPad/DocumentSources/MetaWeblog/Service/Generated/MetaWeblogAPI.json
  122. +14 −14 src/MarkPad/DocumentSources/MetaWeblog/Service/IMetaWeblogService.cs
  123. +12 −12 src/MarkPad/DocumentSources/MetaWeblog/Service/MediaObject.cs
  124. +10 −10 src/MarkPad/DocumentSources/MetaWeblog/Service/MediaObjectInfo.cs
  125. +11 −11 src/MarkPad/DocumentSources/MetaWeblog/Service/MetaWeblog.cs
  126. +40 −40 src/MarkPad/DocumentSources/MetaWeblog/Service/MetaWeblogService.cs
  127. +20 −20 src/MarkPad/DocumentSources/MetaWeblog/Service/Post.cs
  128. +37 −37 src/MarkPad/DocumentSources/MetaWeblog/Service/Rsd/DiscoveryResult.cs
  129. +8 −8 src/MarkPad/DocumentSources/MetaWeblog/Service/Rsd/IRsdService.cs
  130. +185 −185 src/MarkPad/DocumentSources/MetaWeblog/Service/Rsd/RsdService.cs
  131. +11 −11 src/MarkPad/DocumentSources/MetaWeblog/Service/Source.cs
  132. +12 −12 src/MarkPad/DocumentSources/MetaWeblog/Service/UserInfo.cs
  133. +17 −17 src/MarkPad/DocumentSources/NewMarkpadDocument.cs
  134. +62 −62 src/MarkPad/DocumentSources/SiteContextGenerator.cs
  135. +62 −62 src/MarkPad/DocumentSources/SiteItem.cs
  136. +68 −68 src/MarkPad/DocumentSources/WebMarkdownFile.cs
  137. +10 −10 src/MarkPad/Events/AppReadyEvent.cs
  138. +11 −11 src/MarkPad/Events/FileCreatedEvent.cs
  139. +11 −11 src/MarkPad/Events/FileDeletedEvent.cs
  140. +12 −12 src/MarkPad/Events/FileOpenEvent.cs
  141. +13 −13 src/MarkPad/Events/FileRenamedEvent.cs
  142. +5 −5 src/MarkPad/Events/SettingsCloseEvent.cs
  143. +3 −3 src/MarkPad/FodyWeavers.xml
  144. +10 −10 src/MarkPad/Helpers/DataImage.cs
  145. +110 −110 src/MarkPad/Helpers/DataObjectExtensions.cs
  146. +15 −15 src/MarkPad/Helpers/FontHelpers.cs
  147. +69 −69 src/MarkPad/Helpers/MarkdownHelpers.cs
  148. +60 −60 src/MarkPad/Helpers/ObjectExtensions.cs
  149. +24 −24 src/MarkPad/Helpers/TaskExtensions.cs
  150. +102 −102 src/MarkPad/Helpers/VisualExtensions.cs
  151. +9 −9 src/MarkPad/Infrastructure/Abstractions/FileSystemWatcherFactory.cs
  152. +89 −89 src/MarkPad/Infrastructure/Abstractions/FileSystemWatcherWrapper.cs
  153. +109 −109 src/MarkPad/Infrastructure/Abstractions/IFileSystemWatcher.cs
  154. +6 −6 src/MarkPad/Infrastructure/Abstractions/IFileSystemWatcherFactory.cs
  155. +9 −9 src/MarkPad/Infrastructure/Abstractions/ITaskSchedulerFactory.cs
  156. +9 −9 src/MarkPad/Infrastructure/Abstractions/IWebRequestFactory.cs
  157. +16 −16 src/MarkPad/Infrastructure/Abstractions/TaskSchedulerFactory.cs
  158. +12 −12 src/MarkPad/Infrastructure/Abstractions/WebRequestFactory.cs
  159. +158 −158 src/MarkPad/Infrastructure/AppBootstrapper.cs
  160. +38 −38 src/MarkPad/Infrastructure/CaliburnExtensions/DebugLogger.cs
  161. +2,288 −2,288 src/MarkPad/Infrastructure/CaliburnExtensions/Dynamic.cs
  162. +192 −192 src/MarkPad/Infrastructure/CaliburnExtensions/FrameworkExtensions.cs
  163. +108 −108 src/MarkPad/Infrastructure/Controls/UITextBlock.cs
  164. +16 −16 src/MarkPad/Infrastructure/Controls/UITextBlockAutomationPeer.cs
  165. +20 −20 src/MarkPad/Infrastructure/DialogService/ButtonExtras.cs
  166. +235 −235 src/MarkPad/Infrastructure/DialogService/DialogMessageService.cs
  167. +155 −155 src/MarkPad/Infrastructure/DialogService/DialogService.cs
  168. +15 −15 src/MarkPad/Infrastructure/DialogService/IDialogService.cs
  169. +190 −190 src/MarkPad/Infrastructure/ExceptionBuilder.cs
  170. +90 −90 src/MarkPad/Infrastructure/ExceptionDialog.xaml
  171. +92 −92 src/MarkPad/Infrastructure/ExceptionDialog.xaml.cs
  172. +43 −43 src/MarkPad/Infrastructure/InputBindingTrigger.cs
  173. +161 −161 src/MarkPad/Infrastructure/JumpListIntegration.cs
  174. +38 −38 src/MarkPad/Infrastructure/MarkPadAutofacModule.cs
  175. +8 −8 src/MarkPad/Infrastructure/Plugins/IPluginManager.cs
  176. +25 −25 src/MarkPad/Infrastructure/Plugins/PluginManager.cs
  177. +23 −23 src/MarkPad/Infrastructure/Plugins/PluginSettingsProvider.cs
  178. +24 −24 src/MarkPad/Infrastructure/ServicesModule.cs
  179. +485 −485 src/MarkPad/Infrastructure/SingleInstance.cs
  180. +58 −58 src/MarkPad/MDIView.xaml
  181. +10 −10 src/MarkPad/MDIView.xaml.cs
  182. +50 −50 src/MarkPad/MDIViewModel.cs
  183. +526 −526 src/MarkPad/MarkPad.csproj
  184. +16 −16 src/MarkPad/MarkPad.ncrunchproject
  185. +84 −84 src/MarkPad/MarkPadHelp.md
  186. +49 −49 src/MarkPad/MarkdownHelp.md
  187. +33 −33 src/MarkPad/Properties/AssemblyInfo.cs
  188. +91 −91 src/MarkPad/Settings/IsolatedStorageSettingsStore.cs
  189. +12 −12 src/MarkPad/Settings/Models/BlogInfo.cs
  190. +95 −95 src/MarkPad/Settings/Models/BlogSetting.cs
  191. +10 −10 src/MarkPad/Settings/Models/FetchedBlogInfo.cs
  192. +7 −7 src/MarkPad/Settings/Models/IndentType.cs
  193. +31 −31 src/MarkPad/Settings/Models/MarkPadSettings.cs
  194. +296 −296 src/MarkPad/Settings/SettingsProvider.cs
  195. +118 −118 src/MarkPad/Settings/UI/BlogSettingsView.xaml
  196. +43 −43 src/MarkPad/Settings/UI/BlogSettingsView.xaml.cs
  197. +166 −166 src/MarkPad/Settings/UI/BlogSettingsViewModel.cs
  198. +15 −15 src/MarkPad/Settings/UI/ExtensionViewModel.cs
  199. +46 −46 src/MarkPad/Settings/UI/PluginViewModel.cs
Sorry, we could not display the entire diff because it was too big.
View
22 .gitattributes
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
View
44 Licence.md
@@ -1,22 +1,22 @@
-###Microsoft Public License (MS-PL)
-
-This license governs use of the accompanying software. If you use the software, you
-accept this license. If you do not accept the license, do not use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution" have the
-same meaning here as under U.S. copyright law.
-A "contribution" is the original software, or any additions or changes to the software.
-A "contributor" is any person that distributes its contribution under this license.
-"Licensed patents" are a contributor's patent claims that read directly on its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
-(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
+###Microsoft Public License (MS-PL)
+
+This license governs use of the accompanying software. If you use the software, you
+accept this license. If you do not accept the license, do not use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution" have the
+same meaning here as under U.S. copyright law.
+A "contribution" is the original software, or any additions or changes to the software.
+A "contributor" is any person that distributes its contribution under this license.
+"Licensed patents" are a contributor's patent claims that read directly on its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
+(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
View
74 README.md
@@ -1,37 +1,37 @@
-# DownmarkerWPF
-
-This codebase contains the [DownmarkerWPF](http://code52.org/DownmarkerWPF/) project, by [Code52](http://code52.org/)
-
-## About DownmarkerWPF
-
-MarkPad (formerly known as DownmarkerWPF) is an editor for [Markdown](http://daringfireball.net/projects/markdown/) - a widely used syntax for formatting plain text to convert to blogs, comments, and in other places like on [Stack Overflow](http://stackoverflow.com/).
-
-Our aim is to create a useably, stylish new version of the project utilising Microsoft's WPF technology to provide a fresh UI for creating files that we can use to create blog posts for this, and other blogs using Markdown.
-
-## Dependencies
-
- - Windows 7 (please provide feedback if you encounter issues with Vista, XP or Windows 8)
- - .NET Framework 4.0 (should install if you don't already have it on your machine)
-
-## Tools required to develop
-
- - Visual Studio 2010
- - WiX - to generate the installer (optional)
- - 7-Zip - to generate a zip version of the tool (optional)
-
-## Contributing
-
-If you want to contribute to the project, check out the [Issues](https://github.com/Code52/DownmarkerWPF/issues) tab.
-
-You can:
-
- - Raise an issue
- - Suggest a feature for the application
-
-Feeling like writing some code? Why not take the next [step](http://code52.org/contributing.html):
-
- - Fork the repository
- - Make the changes to the codebase
- - Send a pull request once you're happy with it
-
-The team will then review the changes, discuss if anything needs to be addressed, and integrate your changes back into the application.
+# DownmarkerWPF
+
+This codebase contains the [DownmarkerWPF](http://code52.org/DownmarkerWPF/) project, by [Code52](http://code52.org/)
+
+## About DownmarkerWPF
+
+MarkPad (formerly known as DownmarkerWPF) is an editor for [Markdown](http://daringfireball.net/projects/markdown/) - a widely used syntax for formatting plain text to convert to blogs, comments, and in other places like on [Stack Overflow](http://stackoverflow.com/).
+
+Our aim is to create a useably, stylish new version of the project utilising Microsoft's WPF technology to provide a fresh UI for creating files that we can use to create blog posts for this, and other blogs using Markdown.
+
+## Dependencies
+
+ - Windows 7 (please provide feedback if you encounter issues with Vista, XP or Windows 8)
+ - .NET Framework 4.0 (should install if you don't already have it on your machine)
+
+## Tools required to develop
+
+ - Visual Studio 2010
+ - WiX - to generate the installer (optional)
+ - 7-Zip - to generate a zip version of the tool (optional)
+
+## Contributing
+
+If you want to contribute to the project, check out the [Issues](https://github.com/Code52/DownmarkerWPF/issues) tab.
+
+You can:
+
+ - Raise an issue
+ - Suggest a feature for the application
+
+Feeling like writing some code? Why not take the next [step](http://code52.org/contributing.html):
+
+ - Fork the repository
+ - Make the changes to the codebase
+ - Send a pull request once you're happy with it
+
+The team will then review the changes, discuss if anything needs to be addressed, and integrate your changes back into the application.
View
24 build.cmd
@@ -1,13 +1,13 @@
-@ECHO OFF
-
-SET msbuild="%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
-
-IF '%1'=='' (SET configuration=Debug) ELSE (SET configuration=%1)
-IF '%2'=='' (SET platform="x86") ELSE (SET platform=%2)
-
-:: Build the solution. Override the platform to account for running
-:: from Visual Studio Tools command prompt (x64). Log quietly to the
-:: console and verbosely to a file.
-%msbuild% src/MarkPad.sln /nologo /property:Platform=%platform% /property:Configuration=%configuration% /verbosity:minimal /flp:verbosity=diagnostic
-
+@ECHO OFF
+
+SET msbuild="%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
+
+IF '%1'=='' (SET configuration=Debug) ELSE (SET configuration=%1)
+IF '%2'=='' (SET platform="x86") ELSE (SET platform=%2)
+
+:: Build the solution. Override the platform to account for running
+:: from Visual Studio Tools command prompt (x64). Log quietly to the
+:: console and verbosely to a file.
+%msbuild% src/MarkPad.sln /nologo /property:Platform=%platform% /property:Configuration=%configuration% /verbosity:minimal /flp:verbosity=diagnostic
+
IF NOT ERRORLEVEL 0 EXIT /B %ERRORLEVEL%
View
34 create-installer.cmd
@@ -1,18 +1,18 @@
-@ECHO OFF
-
-CALL rmdir "%~dp0artifacts\" /s /q
-
-SET msbuild="%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
-
-SET configuration=Release
-SET platform="Mixed Platforms"
-
-:: Build the solution. Override the platform to account for running
-:: from Visual Studio Tools command prompt (x64). Log quietly to the
-:: console and verbosely to a file.
-%msbuild% src/MarkPad.Setup.sln /nologo /property:Platform=%platform% /property:Configuration=%configuration% /verbosity:minimal /flp:verbosity=diagnostic
-
-:: get build output and copy out to root
-CALL xcopy "%~dp0src\MarkPad.Setup\bin\Release\*.msi" "%~dp0artifacts\" /s /e /Y
-
+@ECHO OFF
+
+CALL rmdir "%~dp0artifacts\" /s /q
+
+SET msbuild="%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
+
+SET configuration=Release
+SET platform="Mixed Platforms"
+
+:: Build the solution. Override the platform to account for running
+:: from Visual Studio Tools command prompt (x64). Log quietly to the
+:: console and verbosely to a file.
+%msbuild% src/MarkPad.Setup.sln /nologo /property:Platform=%platform% /property:Configuration=%configuration% /verbosity:minimal /flp:verbosity=diagnostic
+
+:: get build output and copy out to root
+CALL xcopy "%~dp0src\MarkPad.Setup\bin\Release\*.msi" "%~dp0artifacts\" /s /e /Y
+
IF NOT ERRORLEVEL 0 EXIT /B %ERRORLEVEL%
View
78 docs/markdown-tests/test-link-and-resource-behaviour.md
@@ -1,39 +1,39 @@
-# Testing link and resource behaviour in the Awesomium preview control
-
-See `DocumentView.xaml.cs`, specifically:
-
-- `WebControlLinkClicked()`, and
-- `WebControlResourceRequest()`
-
-
-## Working scenarios
-
-### Resource request for remote resources
-This should show the Daring Fireball logo, deep-linked from the site itself:
-
-![DF](http://daringfireball.net/graphics/logos/)
-
-### Resource request for local resources
-This should show the MarkPad icon, stored alongside this document:
-
-<img alt="MarkPad icon" src="icon.png"/>
-
-### Links for remote resources
-This link to the [Code52](http://code52.org) site should open in a new browser window or tab.
-
-### Links for local resources that do not exist
-- Clicking this link to a non-existent url [should do nothing](abcd)
-- Clicking this links to an empty url [should flash an error but immediately re-render the page]()
-- Right-clicking the preview pane and selecting *Refresh*, or left-clicking the preview and pressing `F5` should also flash an error but immediately re-render the page
-
-
-## Broken or unreliable scenarios
-### Links for local resources that exist
-This is a [link to the local MarkPad icon](icon.png). Usually the file will open using `Process.Start()` (preferred behaviour), but sometimes it will open in the preview. This behaviour is erratic but appears to be an upstream issue with the Awesomium control.
-
-### Alt text for images where the image is not found
-Alt text is not displayed for images. The following `img` tags should render as the text "This image is missing" but instead an empty box is displayed. This appears to be an upstream issue with the Awesomium control.
-
-- ![This image is missing](missing.jpg)
-- <img alt="This image is missing" src="missing.jpg"/>
-
+# Testing link and resource behaviour in the Awesomium preview control
+
+See `DocumentView.xaml.cs`, specifically:
+
+- `WebControlLinkClicked()`, and
+- `WebControlResourceRequest()`
+
+
+## Working scenarios
+
+### Resource request for remote resources
+This should show the Daring Fireball logo, deep-linked from the site itself:
+
+![DF](http://daringfireball.net/graphics/logos/)
+
+### Resource request for local resources
+This should show the MarkPad icon, stored alongside this document:
+
+<img alt="MarkPad icon" src="icon.png"/>
+
+### Links for remote resources
+This link to the [Code52](http://code52.org) site should open in a new browser window or tab.
+
+### Links for local resources that do not exist
+- Clicking this link to a non-existent url [should do nothing](abcd)
+- Clicking this links to an empty url [should flash an error but immediately re-render the page]()
+- Right-clicking the preview pane and selecting *Refresh*, or left-clicking the preview and pressing `F5` should also flash an error but immediately re-render the page
+
+
+## Broken or unreliable scenarios
+### Links for local resources that exist
+This is a [link to the local MarkPad icon](icon.png). Usually the file will open using `Process.Start()` (preferred behaviour), but sometimes it will open in the preview. This behaviour is erratic but appears to be an upstream issue with the Awesomium control.
+
+### Alt text for images where the image is not found
+Alt text is not displayed for images. The following `img` tags should render as the text "This image is missing" but instead an empty box is displayed. This appears to be an upstream issue with the Awesomium control.
+
+- ![This image is missing](missing.jpg)
+- <img alt="This image is missing" src="missing.jpg"/>
+
View
12,142 lib/Awesomium.Core.XML
6,071 additions, 6,071 deletions not shown
View
6,496 lib/Awesomium.Windows.Controls.XML
3,248 additions, 3,248 deletions not shown
View
20 lib/Hunspell.0.9.6.0/Licence.txt
@@ -1,10 +1,10 @@
-NHunspell Tri-Licence:
-* GPL (http://www.gnu.org/copyleft/gpl.html)
-* LGPL (http://www.gnu.org/licenses/lgpl.html)
-* MPL (http://www.mozilla.org/MPL/MPL-1.1.html)
-
-Copyright: Thomas MAierhofer, Lazlo Nemeth and all contributing authors.
-Sponsor of this Project : maierhofer software (www.maierhofer.de) and MSE-iT (www.mse-it.de)
-
-If you use NHunspell and like it, please put a link on http://nhunspell.sourceforge.net/
-or write something in your blog about it. Thanks.
+NHunspell Tri-Licence:
+* GPL (http://www.gnu.org/copyleft/gpl.html)
+* LGPL (http://www.gnu.org/licenses/lgpl.html)
+* MPL (http://www.mozilla.org/MPL/MPL-1.1.html)
+
+Copyright: Thomas MAierhofer, Lazlo Nemeth and all contributing authors.
+Sponsor of this Project : maierhofer software (www.maierhofer.de) and MSE-iT (www.mse-it.de)
+
+If you use NHunspell and like it, please put a link on http://nhunspell.sourceforge.net/
+or write something in your blog about it. Thanks.
View
32 package.cmd
@@ -1,16 +1,16 @@
-@ECHO OFF
-
-SET build="%~dp0\build.cmd"
-SET copy="copy"
-
-CALL rmdir "%~dp0artifacts\" /s /q
-
-:: Pass the configuration parameter and all other parameters
-CALL %build% Release "x86"
-
-:: get build output and copy out to root
-CALL xcopy "%~dp0src\MarkPad\bin\Release\*" "%~dp0artifacts\" /s /e /Y
-
-CALL "C:\Program Files\7-Zip\7z.exe" a -tzip "%~dp0artifacts\MarkPad.zip" "%~dp0artifacts\*"
-
-IF NOT ERRORLEVEL 0 EXIT /B %ERRORLEVEL%
+@ECHO OFF
+
+SET build="%~dp0\build.cmd"
+SET copy="copy"
+
+CALL rmdir "%~dp0artifacts\" /s /q
+
+:: Pass the configuration parameter and all other parameters
+CALL %build% Release "x86"
+
+:: get build output and copy out to root
+CALL xcopy "%~dp0src\MarkPad\bin\Release\*" "%~dp0artifacts\" /s /e /Y
+
+CALL "C:\Program Files\7-Zip\7z.exe" a -tzip "%~dp0artifacts\MarkPad.zip" "%~dp0artifacts\*"
+
+IF NOT ERRORLEVEL 0 EXIT /B %ERRORLEVEL%
View
18 run-tests.cmd
@@ -1,10 +1,10 @@
-@ECHO OFF
-
-SET build="%~dp0\build.cmd"
-SET xunit="%~dp0\tools\xunit\xunit.console.clr4.x86.exe"
-
-CALL %build% Testing "x86"
-
-CALL %xunit% "%~dp0src\MarkPad.Tests\bin\Testing\MarkPad.Tests.dll"
-
+@ECHO OFF
+
+SET build="%~dp0\build.cmd"
+SET xunit="%~dp0\tools\xunit\xunit.console.clr4.x86.exe"
+
+CALL %build% Testing "x86"
+
+CALL %xunit% "%~dp0src\MarkPad.Tests\bin\Testing\MarkPad.Tests.dll"
+
IF NOT ERRORLEVEL 0 EXIT /B %ERRORLEVEL%
View
104 src/.nuget/NuGet.targets
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
- <NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
- <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
- <PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
- <PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
- <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
-
- <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
- <PackageSources>""</PackageSources>
-
- <!-- Enable the restore command to run before builds -->
- <RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages>
-
- <!-- Property that enables building a package from a project -->
- <BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage>
-
- <!-- Commands -->
- <RestoreCommand>"$(NuGetExePath)" install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
- <BuildCommand>"$(NuGetExePath)" pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
-
- <!-- Make the build depend on restore packages -->
- <BuildDependsOn Condition="$(RestorePackages) == 'true'">
- RestorePackages;
- $(BuildDependsOn);
- </BuildDependsOn>
-
- <!-- Make the build depend on restore packages -->
- <BuildDependsOn Condition="$(BuildPackage) == 'true'">
- $(BuildDependsOn);
- BuildPackage;
- </BuildDependsOn>
- </PropertyGroup>
-
- <Target Name="CheckPrerequisites">
- <!-- Raise an error if we're unable to locate nuget.exe -->
- <Error Condition="!Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
- </Target>
-
- <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
- <Exec Command="$(RestoreCommand)"
- LogStandardErrorAsError="true"
- Condition="Exists('$(PackagesConfig)')" />
- </Target>
-
- <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
- <Exec Command="$(BuildCommand)"
- LogStandardErrorAsError="true" />
- </Target>
-</Project>
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
+ <NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
+ <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
+ <PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
+ <PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
+ <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
+
+ <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
+ <PackageSources>""</PackageSources>
+
+ <!-- Enable the restore command to run before builds -->
+ <RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages>
+
+ <!-- Property that enables building a package from a project -->
+ <BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage>
+
+ <!-- Commands -->
+ <RestoreCommand>"$(NuGetExePath)" install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
+ <BuildCommand>"$(NuGetExePath)" pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
+
+ <!-- Make the build depend on restore packages -->
+ <BuildDependsOn Condition="$(RestorePackages) == 'true'">
+ RestorePackages;
+ $(BuildDependsOn);
+ </BuildDependsOn>
+
+ <!-- Make the build depend on restore packages -->
+ <BuildDependsOn Condition="$(BuildPackage) == 'true'">
+ $(BuildDependsOn);
+ BuildPackage;
+ </BuildDependsOn>
+ </PropertyGroup>
+
+ <Target Name="CheckPrerequisites">
+ <!-- Raise an error if we're unable to locate nuget.exe -->
+ <Error Condition="!Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
+ </Target>
+
+ <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(RestoreCommand)"
+ LogStandardErrorAsError="true"
+ Condition="Exists('$(PackagesConfig)')" />
+ </Target>
+
+ <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(BuildCommand)"
+ LogStandardErrorAsError="true" />
+ </Target>
+</Project>
View
20 src/GlobalAssemblyInfo.cs
@@ -1,10 +1,10 @@
-using System.Reflection;
-
-[assembly: AssemblyConfiguration("RC")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-[assembly: AssemblyCompany("Code52")]
-[assembly: AssemblyCopyright("Copyright © Code52")]
-
-[assembly: AssemblyVersion("0.9.6")]
-[assembly: AssemblyFileVersion("0.9.6")]
+using System.Reflection;
+
+[assembly: AssemblyConfiguration("RC")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: AssemblyCompany("Code52")]
+[assembly: AssemblyCopyright("Copyright © Code52")]
+
+[assembly: AssemblyVersion("0.9.6")]
+[assembly: AssemblyFileVersion("0.9.6")]
View
22 src/MarkPad.PluginApi/ICanCreateNewPage.cs
@@ -1,11 +1,11 @@
-using System.ComponentModel.Composition;
-
-namespace MarkPad.Plugins
-{
- [InheritedExport]
- public interface ICanCreateNewPage : IPlugin
- {
- string CreateNewPageLabel { get; }
- string CreateNewPage();
- }
-}
+using System.ComponentModel.Composition;
+
+namespace MarkPad.Plugins
+{
+ [InheritedExport]
+ public interface ICanCreateNewPage : IPlugin
+ {
+ string CreateNewPageLabel { get; }
+ string CreateNewPage();
+ }
+}
View
22 src/MarkPad.PluginApi/ICanSavePage.cs
@@ -1,11 +1,11 @@
-using System.ComponentModel.Composition;
-
-namespace MarkPad.Plugins
-{
- [InheritedExport]
- public interface ICanSavePage : IPlugin
- {
- string SavePageLabel { get; }
- void SavePage(IMarkpadDocument documentViewModel);
- }
-}
+using System.ComponentModel.Composition;
+
+namespace MarkPad.Plugins
+{
+ [InheritedExport]
+ public interface ICanSavePage : IPlugin
+ {
+ string SavePageLabel { get; }
+ void SavePage(IMarkpadDocument documentViewModel);
+ }
+}
View
16 src/MarkPad.PluginApi/IDocumentParser.cs
@@ -1,8 +1,8 @@
-namespace MarkPad.Plugins
-{
- public interface IDocumentParser
- {
- string Parse(string source);
- string ParseClean(string source);
- }
-}
+namespace MarkPad.Plugins
+{
+ public interface IDocumentParser
+ {
+ string Parse(string source);
+ string ParseClean(string source);
+ }
+}
View
32 src/MarkPad.PluginApi/IMarkpadDocument.cs
@@ -1,16 +1,16 @@
-using System.ComponentModel;
-using System.Threading.Tasks;
-
-namespace MarkPad.Plugins
-{
- public interface IMarkpadDocument : INotifyPropertyChanged
- {
- string MarkdownContent { get; set; }
- string Title { get; }
- ISiteContext SiteContext { get; }
- string SaveLocation { get; }
- Task<IMarkpadDocument> Save();
- Task<IMarkpadDocument> SaveAs();
- Task<IMarkpadDocument> Publish();
- }
-}
+using System.ComponentModel;
+using System.Threading.Tasks;
+
+namespace MarkPad.Plugins
+{
+ public interface IMarkpadDocument : INotifyPropertyChanged
+ {
+ string MarkdownContent { get; set; }
+ string Title { get; }
+ ISiteContext SiteContext { get; }
+ string SaveLocation { get; }
+ Task<IMarkpadDocument> Save();
+ Task<IMarkpadDocument> SaveAs();
+ Task<IMarkpadDocument> Publish();
+ }
+}
View
34 src/MarkPad.PluginApi/IPlugin.cs
@@ -1,17 +1,17 @@
-using System.ComponentModel.Composition;
-
-namespace MarkPad.Plugins
-{
- [InheritedExport]
- public interface IPlugin
- {
- string Name { get; }
- string Version { get; }
- string Authors { get; }
- string Description { get; }
- IPluginSettings Settings { get; }
- void SaveSettings();
- bool IsConfigurable { get; }
- bool IsHidden { get; }
- }
-}
+using System.ComponentModel.Composition;
+
+namespace MarkPad.Plugins
+{
+ [InheritedExport]
+ public interface IPlugin
+ {
+ string Name { get; }
+ string Version { get; }
+ string Authors { get; }
+ string Description { get; }
+ IPluginSettings Settings { get; }
+ void SaveSettings();
+ bool IsConfigurable { get; }
+ bool IsHidden { get; }
+ }
+}
View
30 src/MarkPad.PluginApi/IPluginSettings.cs
@@ -1,15 +1,15 @@
-using System.ComponentModel;
-
-namespace MarkPad.Plugins
-{
- public interface IPluginSettings
- {
- bool IsEnabled { get; set; }
- }
-
- public class PluginSettings : IPluginSettings
- {
- [DefaultValue(true)]
- public bool IsEnabled { get; set; }
- }
-}
+using System.ComponentModel;
+
+namespace MarkPad.Plugins
+{
+ public interface IPluginSettings
+ {
+ bool IsEnabled { get; set; }
+ }
+
+ public class PluginSettings : IPluginSettings
+ {
+ [DefaultValue(true)]
+ public bool IsEnabled { get; set; }
+ }
+}
View
22 src/MarkPad.PluginApi/IPluginSettingsProvider.cs
@@ -1,11 +1,11 @@
-using System.ComponentModel.Composition;
-
-namespace MarkPad.Plugins
-{
- [InheritedExport]
- public interface IPluginSettingsProvider
- {
- T GetSettings<T>() where T : IPluginSettings, new();
- void SaveSettings<T>(T settings) where T : IPluginSettings, new();
- }
-}
+using System.ComponentModel.Composition;
+
+namespace MarkPad.Plugins
+{
+ [InheritedExport]
+ public interface IPluginSettingsProvider
+ {
+ T GetSettings<T>() where T : IPluginSettings, new();
+ void SaveSettings<T>(T settings) where T : IPluginSettings, new();
+ }
+}
View
42 src/MarkPad.PluginApi/ISiteContext.cs
@@ -1,22 +1,22 @@
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Drawing;
-
-namespace MarkPad.Plugins
-{
- public interface ISiteContext : INotifyPropertyChanged
- {
- /// <summary>
- /// Saves the image to the file system
- /// </summary>
- /// <param name="image"></param>
- /// <returns>The relative path to the image</returns>
- string SaveImage(Bitmap image);
-
- string ConvertToAbsolutePaths(string htmlDocument);
-
- ObservableCollection<ISiteItem> Items { get; }
-
- void OpenItem(ISiteItem selectedItem);
- }
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Drawing;
+
+namespace MarkPad.Plugins
+{
+ public interface ISiteContext : INotifyPropertyChanged
+ {
+ /// <summary>
+ /// Saves the image to the file system
+ /// </summary>
+ /// <param name="image"></param>
+ /// <returns>The relative path to the image</returns>
+ string SaveImage(Bitmap image);
+
+ string ConvertToAbsolutePaths(string htmlDocument);
+
+ ObservableCollection<ISiteItem> Items { get; }
+
+ void OpenItem(ISiteItem selectedItem);
+ }
}
View
32 src/MarkPad.PluginApi/ISiteItem.cs
@@ -1,17 +1,17 @@
-using System;
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-
-namespace MarkPad.Plugins
-{
- public interface ISiteItem : INotifyPropertyChanged, IDisposable
- {
- string Name { get; set; }
- ObservableCollection<ISiteItem> Children { get; }
- bool Selected { get; set; }
- bool IsRenaming { get; set; }
- void CommitRename();
- void UndoRename();
- void Delete();
- }
+using System;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+
+namespace MarkPad.Plugins
+{
+ public interface ISiteItem : INotifyPropertyChanged, IDisposable
+ {
+ string Name { get; set; }
+ ObservableCollection<ISiteItem> Children { get; }
+ bool Selected { get; set; }
+ bool IsRenaming { get; set; }
+ void CommitRename();
+ void UndoRename();
+ void Delete();
+ }
}
View
128 src/MarkPad.PluginApi/MarkPad.Plugins.csproj
@@ -1,65 +1,65 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{E780D0E3-37A4-43D3-89C1-76053FA63752}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>MarkPad.Plugins</RootNamespace>
- <AssemblyName>MarkPad.Plugins</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DebugType>full</DebugType>
- <PlatformTarget>x86</PlatformTarget>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <Optimize>true</Optimize>
- <DebugType>pdbonly</DebugType>
- <PlatformTarget>x86</PlatformTarget>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.ComponentModel.Composition" />
- <Reference Include="System.Core" />
- <Reference Include="System.Drawing" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ICanCreateNewPage.cs" />
- <Compile Include="ICanSavePage.cs" />
- <Compile Include="IDocumentParser.cs" />
- <Compile Include="IMarkpadDocument.cs" />
- <Compile Include="IPlugin.cs" />
- <Compile Include="IPluginSettings.cs" />
- <Compile Include="IPluginSettingsProvider.cs" />
- <Compile Include="ISiteContext.cs" />
- <Compile Include="ISiteItem.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{E780D0E3-37A4-43D3-89C1-76053FA63752}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>MarkPad.Plugins</RootNamespace>
+ <AssemblyName>MarkPad.Plugins</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.ComponentModel.Composition" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ICanCreateNewPage.cs" />
+ <Compile Include="ICanSavePage.cs" />
+ <Compile Include="IDocumentParser.cs" />
+ <Compile Include="IMarkpadDocument.cs" />
+ <Compile Include="IPlugin.cs" />
+ <Compile Include="IPluginSettings.cs" />
+ <Compile Include="IPluginSettingsProvider.cs" />
+ <Compile Include="ISiteContext.cs" />
+ <Compile Include="ISiteItem.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
</Project>
View
32 src/MarkPad.PluginApi/MarkPad.Plugins.ncrunchproject
@@ -1,17 +1,17 @@
-<ProjectConfiguration>
- <CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
- <ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
- <AllowCodeContractChecking>false</AllowCodeContractChecking>
- <IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
- <RunPreBuildEvents>false</RunPreBuildEvents>
- <RunPostBuildEvents>false</RunPostBuildEvents>
- <PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
- <InstrumentAssembly>true</InstrumentAssembly>
- <PreventSigningOfAssembly>false</PreventSigningOfAssembly>
- <AnalyseExecutionTimes>true</AnalyseExecutionTimes>
- <IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
- <DefaultTestTimeout>60000</DefaultTestTimeout>
- <UseBuildConfiguration />
- <ProxyProcessPath />
- <UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
+<ProjectConfiguration>
+ <CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
+ <ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
+ <AllowCodeContractChecking>false</AllowCodeContractChecking>
+ <IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
+ <RunPreBuildEvents>false</RunPreBuildEvents>
+ <RunPostBuildEvents>false</RunPostBuildEvents>
+ <PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
+ <InstrumentAssembly>true</InstrumentAssembly>
+ <PreventSigningOfAssembly>false</PreventSigningOfAssembly>
+ <AnalyseExecutionTimes>true</AnalyseExecutionTimes>
+ <IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
+ <DefaultTestTimeout>60000</DefaultTestTimeout>
+ <UseBuildConfiguration />
+ <ProxyProcessPath />
+ <UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
</ProjectConfiguration>
View
72 src/MarkPad.PluginApi/Properties/AssemblyInfo.cs
@@ -1,36 +1,36 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("MarkPad.PluginApi")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("MarkPad.PluginApi")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("897765a6-82f6-41e4-9455-03b6cb18728f")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MarkPad.PluginApi")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("MarkPad.PluginApi")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("897765a6-82f6-41e4-9455-03b6cb18728f")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
386 src/MarkPad.PreviewControl/AwesomiumHost.cs
@@ -1,194 +1,194 @@
-using System;
-using System.Security.Permissions;
-using System.Threading;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Interop;
-using System.Windows.Media;
-using Awesomium.Windows.Controls;
-
-namespace MarkPad.PreviewControl
-{
- public class AwesomiumHost : MarshalByRefObject, IDisposable
- {
- WebControl wb;
- long? windowHandle;
- readonly Application app;
- readonly UserControl control;
- readonly ManualResetEvent loadedWaitHandle;
- readonly string baseDirectory;
- static bool awesomiumInitialised;
-
- public AwesomiumHost(string filename, string baseDirectory)
- {
- if (Application.Current == null)
- app = new Application();
- FileName = filename;
- this.baseDirectory = baseDirectory;
-
- loadedWaitHandle = new ManualResetEvent(false);
-
- // We need a hosting user control because awesomium has issues rendering if we create it before
- // dispatcher is running
- control = new UserControl();
- control.Loaded += ControlLoaded;
- }
-
- public string FileName { get; private set; }
- public string Html { get; set; }
-
- void ControlLoaded(object sender, RoutedEventArgs e)
- {
- control.Loaded -= ControlLoaded;
-
- wb = new WebControl
- {
- UseLayoutRounding = true,
- HorizontalAlignment = HorizontalAlignment.Stretch,
- VerticalAlignment = VerticalAlignment.Stretch,
- };
-
- wb.Loaded += WbLoaded;
- AwesomiumResourceHandler.Host = this;
- wb.OpenExternalLink += AwesomiumResourceHandler.WebControlLinkClicked;
- wb.ResourceRequest += AwesomiumResourceHandler.WebControlResourceRequest;
- wb.LoadHTML(Html);
-
- control.Content = wb;
- }
-
- void WbLoaded(object sender, RoutedEventArgs e)
- {
- WbProcentualZoom();
- LoadedWaitHandle.Set();
- }
-
- public double ScrollPercentage { get; set; }
-
- public IntPtr ControlHandle
- {
- get
- {
- if (windowHandle == null)
- {
- windowHandle = CreateWindowHandle(control);
- }
- return new IntPtr(windowHandle.Value);
- }
- }
-
- public ManualResetEvent LoadedWaitHandle
- {
- get { return loadedWaitHandle; }
- }
-
- /// <summary>
- /// Convert the framework element to a Window Handle so it can be serialized.
- /// </summary>
- /// <param name="frameworkElement">The framework element to convert to a Window Handle.</param>
- /// <returns>The Window Handle that is hosting the framework element.</returns>
- static long CreateWindowHandle(Visual frameworkElement)
- {
- // ReSharper disable InconsistentNaming
- const int WS_VISIBLE = 0x10000000;
- // ReSharper restore InconsistentNaming
-
- var parameters = new HwndSourceParameters(String.Format("NewWindowHost{0}", Guid.NewGuid()), 1, 1);
- parameters.WindowStyle &= ~WS_VISIBLE;
-
- var intPtr = new HwndSource(parameters)
- {
- RootVisual = frameworkElement
- }.Handle;
- return intPtr.ToInt64();
- }
-
- public void SetZoom(int getZoomLevel)
- {
- app.Dispatcher.BeginInvoke(new Action(() =>
- {
- if (wb == null) return;
- wb.Zoom = getZoomLevel;
- }));
- }
-
- public void SetHtml(string content)
- {
- if (Application.Current == null) return;
- Application.Current.Dispatcher.BeginInvoke(new Action(() =>
- {
- if (!awesomiumInitialised)
- {
- var c = new Awesomium.Core.WebCoreConfig
- {
- CustomCSS = @"body { font-family: Segoe UI, sans-serif; font-size:0.8em;}
- ::-webkit-scrollbar { width: 12px; height: 12px; }
- ::-webkit-scrollbar-track { background-color: white; }
- ::-webkit-scrollbar-thumb { background-color: #B9B9B9; }
- ::-webkit-scrollbar-thumb:hover { background-color: #000000; }",
- };
-
- Awesomium.Core.WebCore.Initialize(c, true);
- Awesomium.Core.WebCore.BaseDirectory = baseDirectory;
- awesomiumInitialised = true;
- }
-
- Html = content;
- if (wb == null) return;
-
- wb.CacheMode = new BitmapCache();
- EventHandler webControlOnLoadCompleted = null;
- webControlOnLoadCompleted = (sender, args) =>
- {
- wb.LoadCompleted -= webControlOnLoadCompleted;
- WbProcentualZoom();
- wb.CacheMode = null;
- };
- wb.LoadCompleted += webControlOnLoadCompleted;
- wb.LoadHTML(content);
- }));
- }
-
- public void WbProcentualZoom()
- {
- if (!app.Dispatcher.CheckAccess())
- {
- app.Dispatcher.BeginInvoke(new Action(WbProcentualZoom));
- return;
- }
-
- if (wb == null) return;
- var javascript = string.Format("window.scrollTo(0,{0} * (document.body.scrollHeight - document.body.clientHeight));", ScrollPercentage);
- wb.ExecuteJavascript(javascript);
- }
-
- public void Dispose()
- {
- app.Dispatcher.Invoke(new Action(() =>
- {
- app.Shutdown();
- if (wb != null)
- {
- wb.Close();
- }
- }));
- }
-
- public void Print()
- {
- app.Dispatcher.BeginInvoke(new Action(() => wb.Print()));
- }
-
- public void Run()
- {
- app.Run();
- }
-
- // http://social.msdn.microsoft.com/Forums/en-US/netfxremoting/thread/3ab17b40-546f-4373-8c08-f0f072d818c9/
- [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.Infrastructure)]
- public override object InitializeLifetimeService()
- {
- return null;
- }
- }
+using System;
+using System.Security.Permissions;
+using System.Threading;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Interop;
+using System.Windows.Media;
+using Awesomium.Windows.Controls;
+
+namespace MarkPad.PreviewControl
+{
+ public class AwesomiumHost : MarshalByRefObject, IDisposable
+ {
+ WebControl wb;
+ long? windowHandle;
+ readonly Application app;
+ readonly UserControl control;
+ readonly ManualResetEvent loadedWaitHandle;
+ readonly string baseDirectory;
+ static bool awesomiumInitialised;
+
+ public AwesomiumHost(string filename, string baseDirectory)
+ {
+ if (Application.Current == null)
+ app = new Application();
+ FileName = filename;
+ this.baseDirectory = baseDirectory;
+
+ loadedWaitHandle = new ManualResetEvent(false);
+
+ // We need a hosting user control because awesomium has issues rendering if we create it before
+ // dispatcher is running
+ control = new UserControl();
+ control.Loaded += ControlLoaded;
+ }
+
+ public string FileName { get; private set; }
+ public string Html { get; set; }
+
+ void ControlLoaded(object sender, RoutedEventArgs e)
+ {
+ control.Loaded -= ControlLoaded;
+
+ wb = new WebControl
+ {
+ UseLayoutRounding = true,
+ HorizontalAlignment = HorizontalAlignment.Stretch,
+ VerticalAlignment = VerticalAlignment.Stretch,
+ };
+
+ wb.Loaded += WbLoaded;
+ AwesomiumResourceHandler.Host = this;
+ wb.OpenExternalLink += AwesomiumResourceHandler.WebControlLinkClicked;
+ wb.ResourceRequest += AwesomiumResourceHandler.WebControlResourceRequest;
+ wb.LoadHTML(Html);
+
+ control.Content = wb;
+ }
+
+ void WbLoaded(object sender, RoutedEventArgs e)
+ {
+ WbProcentualZoom();
+ LoadedWaitHandle.Set();
+ }
+
+ public double ScrollPercentage { get; set; }
+
+ public IntPtr ControlHandle
+ {
+ get
+ {
+ if (windowHandle == null)
+ {
+ windowHandle = CreateWindowHandle(control);
+ }
+ return new IntPtr(windowHandle.Value);
+ }
+ }
+
+ public ManualResetEvent LoadedWaitHandle
+ {
+ get { return loadedWaitHandle; }
+ }
+
+ /// <summary>
+ /// Convert the framework element to a Window Handle so it can be serialized.
+ /// </summary>
+ /// <param name="frameworkElement">The framework element to convert to a Window Handle.</param>
+ /// <returns>The Window Handle that is hosting the framework element.</returns>
+ static long CreateWindowHandle(Visual frameworkElement)
+ {
+ // ReSharper disable InconsistentNaming
+ const int WS_VISIBLE = 0x10000000;
+ // ReSharper restore InconsistentNaming
+
+ var parameters = new HwndSourceParameters(String.Format("NewWindowHost{0}", Guid.NewGuid()), 1, 1);
+ parameters.WindowStyle &= ~WS_VISIBLE;
+
+ var intPtr = new HwndSource(parameters)
+ {
+ RootVisual = frameworkElement
+ }.Handle;
+ return intPtr.ToInt64();
+ }
+
+ public void SetZoom(int getZoomLevel)
+ {
+ app.Dispatcher.BeginInvoke(new Action(() =>
+ {
+ if (wb == null) return;
+ wb.Zoom = getZoomLevel;
+ }));
+ }
+
+ public void SetHtml(string content)
+ {
+ if (Application.Current == null) return;
+ Application.Current.Dispatcher.BeginInvoke(new Action(() =>
+ {
+ if (!awesomiumInitialised)
+ {
+ var c = new Awesomium.Core.WebCoreConfig
+ {
+ CustomCSS = @"body { font-family: Segoe UI, sans-serif; font-size:0.8em;}
+ ::-webkit-scrollbar { width: 12px; height: 12px; }
+ ::-webkit-scrollbar-track { background-color: white; }
+ ::-webkit-scrollbar-thumb { background-color: #B9B9B9; }
+ ::-webkit-scrollbar-thumb:hover { background-color: #000000; }",
+ };
+
+ Awesomium.Core.WebCore.Initialize(c, true);
+ Awesomium.Core.WebCore.BaseDirectory = baseDirectory;
+ awesomiumInitialised = true;
+ }
+
+ Html = content;
+ if (wb == null) return;
+
+ wb.CacheMode = new BitmapCache();
+ EventHandler webControlOnLoadCompleted = null;
+ webControlOnLoadCompleted = (sender, args) =>
+ {
+ wb.LoadCompleted -= webControlOnLoadCompleted;
+ WbProcentualZoom();
+ wb.CacheMode = null;
+ };
+ wb.LoadCompleted += webControlOnLoadCompleted;
+ wb.LoadHTML(content);
+ }));
+ }
+
+ public void WbProcentualZoom()
+ {
+ if (!app.Dispatcher.CheckAccess())
+ {
+ app.Dispatcher.BeginInvoke(new Action(WbProcentualZoom));
+ return;
+ }
+
+ if (wb == null) return;
+ var javascript = string.Format("window.scrollTo(0,{0} * (document.body.scrollHeight - document.body.clientHeight));", ScrollPercentage);
+ wb.ExecuteJavascript(javascript);
+ }
+
+ public void Dispose()
+ {
+ app.Dispatcher.Invoke(new Action(() =>
+ {
+ app.Shutdown();
+ if (wb != null)
+ {
+ wb.Close();
+ }
+ }));
+ }
+
+ public void Print()
+ {
+ app.Dispatcher.BeginInvoke(new Action(() => wb.Print()));
+ }
+
+ public void Run()
+ {
+ app.Run();
+ }
+
+ // http://social.msdn.microsoft.com/Forums/en-US/netfxremoting/thread/3ab17b40-546f-4373-8c08-f0f072d818c9/
+ [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.Infrastructure)]
+ public override object InitializeLifetimeService()
+ {
+ return null;
+ }
+ }
}
View
162 src/MarkPad.PreviewControl/AwesomiumResourceHandler.cs
@@ -1,82 +1,82 @@
-using System.Diagnostics;
-using System.IO;
-using System.Text;
-using Awesomium.Core;
-
-namespace MarkPad.PreviewControl
-{
- class AwesomiumResourceHandler
- {
- const string LocalRequestUrlBase = "local://base_request.html/";
- public static AwesomiumHost Host { get; set; }
-
- public static ResourceResponse WebControlResourceRequest(object o, ResourceRequestEventArgs e)
- {
- // This tries to get a local resource. If there is no local resource null is returned by GetLocalResource, which
- // triggers the default handler, which should respect the "target='_blank'" attribute added
- // in ParsedDocument.ToHtml(), thus avoiding a bug in Awesomium where trying to navigate to a
- // local resource fails when showing an in-memory file (https://github.com/Code52/DownmarkerWPF/pull/208)
-
- // What works:
- // - resource requests for remote resources (like <link href="http://somecdn.../jquery.js"/>)
- // - resource requests for local resources that exist relative to filename of the file (like <img src="images/logo.png"/>)
- // - clicking links for remote resources (like [Google](http://www.google.com))
- // - clicking links for local resources which don't exist (eg [test](test)) does nothing (WebControl_LinkClicked checks for existence)
- // What fails:
- // - clicking links for local resources where the resource exists (like [test](images/logo.png))
- // - This _sometimes_ opens the resource in the preview pane, and sometimes opens the resource
- // using Process.Start (WebControl_LinkClicked gets triggered). The behaviour seems stochastic.
- // - alt text for images where the image resource is not found
-
- if (e.Request.Url.StartsWith(LocalRequestUrlBase)) return GetLocalResource(e.Request.Url.Replace(LocalRequestUrlBase, ""));
-
- // If the request wasn't local, return null to let the usual handler load the url from the network
- return null;
- }
-
- public static void WebControlLinkClicked(object sender, OpenExternalLinkEventArgs e)
- {
- // Although all links have "target='_blank'" added (see ParsedDocument.ToHtml()), they go through this first
- // unless the url is local (a bug in Awesomium) in which case this event isn't triggered, and the "target='_blank'"
- // takes over to avoid crashing the preview. Local resource requests where the resource doesn't exist are thrown
- // away. See WebControl_ResourceRequest().
-
- var file = e.Url;
- if (e.Url.StartsWith(LocalRequestUrlBase))
- {
- file = GetResourceFileName(e.Url.Replace(LocalRequestUrlBase, "")) ?? "";
- if (!File.Exists(file)) return;
- }
-
- if (string.IsNullOrWhiteSpace(file)) return;
-
- Process.Start(file);
- }
-
- public static string GetResourceFileName(string url)
- {
- if (string.IsNullOrEmpty(Host.FileName)) return null;
-
- var directoryName = Path.GetDirectoryName(Host.FileName);
- if (directoryName == null)
- return null;
- var resourceFileName = Path.Combine(directoryName, url);
- return resourceFileName;
- }
-
- static ResourceResponse GetLocalResource(string url)
- {
- if (string.IsNullOrWhiteSpace(url))
- {
- var encoding = new UTF8Encoding();
-
- return new ResourceResponse(encoding.GetBytes(Host.Html), "text/html");
- }
-
- var resourceFileName = GetResourceFileName(url);
- if (!File.Exists(resourceFileName)) return null;
-
- return new ResourceResponse(resourceFileName);
- }
- }
+using System.Diagnostics;
+using System.IO;
+using System.Text;
+using Awesomium.Core;
+
+namespace MarkPad.PreviewControl
+{
+ class AwesomiumResourceHandler
+ {
+ const string LocalRequestUrlBase = "local://base_request.html/";
+ public static AwesomiumHost Host { get; set; }
+
+ public static ResourceResponse WebControlResourceRequest(object o, ResourceRequestEventArgs e)
+ {
+ // This tries to get a local resource. If there is no local resource null is returned by GetLocalResource, which
+ // triggers the default handler, which should respect the "target='_blank'" attribute added
+ // in ParsedDocument.ToHtml(), thus avoiding a bug in Awesomium where trying to navigate to a
+ // local resource fails when showing an in-memory file (https://github.com/Code52/DownmarkerWPF/pull/208)
+
+ // What works:
+ // - resource requests for remote resources (like <link href="http://somecdn.../jquery.js"/>)
+ // - resource requests for local resources that exist relative to filename of the file (like <img src="images/logo.png"/>)
+ // - clicking links for remote resources (like [Google](http://www.google.com))
+ // - clicking links for local resources which don't exist (eg [test](test)) does nothing (WebControl_LinkClicked checks for existence)
+ // What fails:
+ // - clicking links for local resources where the resource exists (like [test](images/logo.png))
+ // - This _sometimes_ opens the resource in the preview pane, and sometimes opens the resource
+ // using Process.Start (WebControl_LinkClicked gets triggered). The behaviour seems stochastic.
+ // - alt text for images where the image resource is not found
+
+ if (e.Request.Url.StartsWith(LocalRequestUrlBase)) return GetLocalResource(e.Request.Url.Replace(LocalRequestUrlBase, ""));
+
+ // If the request wasn't local, return null to let the usual handler load the url from the network
+ return null;
+ }
+
+ public static void WebControlLinkClicked(object sender, OpenExternalLinkEventArgs e)
+ {
+ // Although all links have "target='_blank'" added (see ParsedDocument.ToHtml()), they go through this first
+ // unless the url is local (a bug in Awesomium) in which case this event isn't triggered, and the "target='_blank'"
+ // takes over to avoid crashing the preview. Local resource requests where the resource doesn't exist are thrown
+ // away. See WebControl_ResourceRequest().
+
+ var file = e.Url;
+ if (e.Url.StartsWith(LocalRequestUrlBase))
+ {
+ file = GetResourceFileName(e.Url.Replace(LocalRequestUrlBase, "")) ?? "";
+ if (!File.Exists(file)) return;
+ }
+
+ if (string.IsNullOrWhiteSpace(file)) return;
+
+ Process.Start(file);
+ }
+
+ public static string GetResourceFileName(string url)
+ {
+ if (string.IsNullOrEmpty(Host.FileName)) return null;
+
+ var directoryName = Path.GetDirectoryName(Host.FileName);
+ if (directoryName == null)
+ return null;
+ var resourceFileName = Path.Combine(directoryName, url);
+ return resourceFileName;
+ }
+
+ static ResourceResponse GetLocalResource(string url)
+ {
+ if (string.IsNullOrWhiteSpace(url))
+ {
+ var encoding = new UTF8Encoding();
+
+ return new ResourceResponse(encoding.GetBytes(Host.Html), "text/html");
+ }
+
+ var resourceFileName = GetResourceFileName(url);
+ if (!File.Exists(resourceFileName)) return null;
+
+ return new ResourceResponse(resourceFileName);
+ }
+ }
}
View
76 src/MarkPad.PreviewControl/Constants.cs
@@ -1,38 +1,38 @@
-using System;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-
-namespace MarkPad.PreviewControl
-{
- public static class Constants
- {
- public static readonly string[] DefaultExtensions = new[] { ".md", ".markdown", ".mdown", ".mkd" };
-
- public static readonly string[] Icons = new[] { "markpaddoc.ico" };
-
- public static string ExtensionFilter
- {
- get
- {
- var extWildcards = DefaultExtensions.Select(ext => "*" + ext).ToArray();
-
- return "Markdown Files (" + string.Join(", ", extWildcards) + ")|" + string.Join(";", extWildcards);
- }
- }
-
- public static string IconDir
- {
- get
- {
- var assemblyName = Assembly.GetEntryAssembly().GetName();
-
- return Path.Combine(Path.GetTempPath(), String.Format("{0}.{1}", assemblyName.Name, assemblyName.Version));
- }
- }
-
- public const string DEFAULT_EDITOR_FONT_FAMILY = "Segoe UI";
- public const FontSizes DEFAULT_EDITOR_FONT_SIZE = FontSizes.FontSize12;
- public const int FONT_SIZE_ENUM_ADJUSTMENT = 12;
- }
-}
+using System;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+
+namespace MarkPad.PreviewControl
+{
+ public static class Constants
+ {
+ public static readonly string[] DefaultExtensions = new[] { ".md", ".markdown", ".mdown", ".mkd" };
+
+ public static readonly string[] Icons = new[] { "markpaddoc.ico" };
+
+ public static string ExtensionFilter
+ {
+ get
+ {
+ var extWildcards = DefaultExtensions.Select(ext => "*" + ext).ToArray();
+
+ return "Markdown Files (" + string.Join(", ", extWildcards) + ")|" + string.Join(";", extWildcards);
+ }
+ }
+
+ public static string IconDir
+ {
+ get
+ {
+ var assemblyName = Assembly.GetEntryAssembly().GetName();
+
+ return Path.Combine(Path.GetTempPath(), String.Format("{0}.{1}", assemblyName.Name, assemblyName.Version));
+ }
+ }
+
+ public const string DEFAULT_EDITOR_FONT_FAMILY = "Segoe UI";
+ public const FontSizes DEFAULT_EDITOR_FONT_SIZE = FontSizes.FontSize12;
+ public const int FONT_SIZE_ENUM_ADJUSTMENT = 12;
+ }
+}
View
66 src/MarkPad.PreviewControl/FontSizes.cs
@@ -1,33 +1,33 @@
-using System.ComponentModel;
-
-namespace MarkPad.PreviewControl
-
-{
- public enum FontSizes
- {
- [Description("12 px")]
- FontSize12 = 0,
- [Description("14 px")]
- FontSize14 = 2,
- [Description("16 px")]
- FontSize16 = 4,
- [Description("18 px")]
- FontSize18 = 6,
- [Description("20 px")]
- FontSize20 = 8,
- [Description("22 px")]
- FontSize22 = 10,
- [Description("24 px")]
- FontSize24 = 12,
- [Description("26 px")]
- FontSize26 = 14,
- [Description("28 px")]
- FontSize28 = 16,
- [Description("36 px")]
- FontSize36 = 24,
- [Description("48 px")]
- FontSize48 = 36,
- [Description("72 px")]
- FontSize72 = 60
- }
-}
+using System.ComponentModel;
+
+namespace MarkPad.PreviewControl
+
+{
+ public enum FontSizes
+ {
+ [Description("12 px")]
+ FontSize12 = 0,
+ [Description("14 px")]
+ FontSize14 = 2,
+ [Description("16 px")]
+ FontSize16 = 4,
+ [Description("18 px")]
+ FontSize18 = 6,
+ [Description("20 px")]
+ FontSize20 = 8,
+ [Description("22 px")]
+ FontSize22 = 10,
+ [Description("24 px")]
+ FontSize24 = 12,
+ [Description("26 px")]
+ FontSize26 = 14,
+ [Description("28 px")]
+ FontSize28 = 16,
+ [Description("36 px")]
+ FontSize36 = 24,
+ [Description("48 px")]
+ FontSize48 = 36,
+ [Description("72 px")]
+ FontSize72 = 60
+ }
+}
View
34 src/MarkPad.PreviewControl/HtmlPreview.xaml
@@ -1,18 +1,18 @@
-<UserControl x:Class="MarkPad.PreviewControl.HtmlPreview"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- Loaded="HtmlPreviewLoaded">
- <UserControl.Effect>
- <DropShadowEffect BlurRadius="10"
- Color="Black"
- Opacity="0.25"
- Direction="270" />
- </UserControl.Effect>
-
- <Border BorderThickness="0"
- Background="White">
- <TextBlock Text="Preview loading..."
- HorizontalAlignment="Center"
- VerticalAlignment="Center" />
- </Border>
+<UserControl x:Class="MarkPad.PreviewControl.HtmlPreview"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Loaded="HtmlPreviewLoaded">
+ <UserControl.Effect>
+ <DropShadowEffect BlurRadius="10"
+ Color="Black"
+ Opacity="0.25"
+ Direction="270" />
+ </UserControl.Effect>
+
+ <Border BorderThickness="0"
+ Background="White">
+ <TextBlock Text="Preview loading..."
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center" />
+ </Border>
</UserControl>
View
378 src/MarkPad.PreviewControl/HtmlPreview.xaml.cs
@@ -1,189 +1,189 @@
-using System;
-using System.Globalization;
-using System.Reflection;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Media;
-
-namespace MarkPad.PreviewControl
-{
- public partial class HtmlPreview
- {
- static string content;
- AwesomiumHost host;
- AppDomain hostAppDomain;
- HwndContentHost hwndContentHost;
-
- public static string BaseDirectory { get; set; }
-
- #region public string Html
- public static DependencyProperty HtmlProperty = DependencyProperty.Register("Html", typeof (string), typeof (HtmlPreview),
- new PropertyMetadata(" ", HtmlChanged));
-
- public string Html
- {
- get { return (string)GetValue(HtmlProperty); }
- set { SetValue(HtmlProperty, value); }
- }
- #endregion
-
- #region public string FileName
- public static readonly DependencyProperty FileNameProperty =
- DependencyProperty.Register("FileName", typeof (string), typeof (HtmlPreview), new PropertyMetadata(default(string)));
-
- public string FileName
- {
- get { return (string)GetValue(FileNameProperty); }
- set { SetValue(FileNameProperty, value); }
- }
- #endregion
-
- #region public double BrowserFontSize
- public static DependencyProperty BrowserFontSizeProperty = DependencyProperty.Register("BrowserFontSize", typeof(double), typeof(HtmlPreview),
- new PropertyMetadata(default(double), FontSizeChanged));
-
- public double BrowserFontSize
- {
- get { return (double)GetValue(BrowserFontSizeProperty); }
- set { SetValue(BrowserFontSizeProperty, value); }
- }
- #endregion
-
- #region public int ScrollPercentage
- public static DependencyProperty ScrollPercentageProperty = DependencyProperty.Register("ScrollPercentage", typeof(double), typeof(HtmlPreview),
- new PropertyMetadata(default(double), ScrollPercentageChanged));
-
- public double ScrollPercentage
- {
- get { return (double)GetValue(ScrollPercentageProperty); }
- set { SetValue(ScrollPercentageProperty, value); }
- }
-
- #endregion
-
- public HtmlPreview()
- {
- InitializeComponent();
- }
-
- private static void ScrollPercentageChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
- {
- var awesomiumHost = ((HtmlPreview) dependencyObject).host;
- awesomiumHost.ScrollPercentage = (double)dependencyPropertyChangedEventArgs.NewValue;
- awesomiumHost.WbProcentualZoom();
- }
-
- private static void FontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var htmlPreview = ((HtmlPreview) d);
- if (htmlPreview.host != null)
- htmlPreview.host.SetZoom(GetZoomLevel((double)e.NewValue));
- }
-
- private static void HtmlChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- content = e.NewValue as string;
- if (string.IsNullOrEmpty(content))
- content = " ";
-
- var htmlPreview = (HtmlPreview) d;
- if (htmlPreview.host != null)
- htmlPreview.host.SetHtml(content);
- }
-
- /// <summary>
- /// Turn the font size into a zoom level for the browser.
- /// </summary>
- /// <returns></returns>
- private static int GetZoomLevel(double fontSize)
- {
- // The default font size 12 corresponds to 100 (which maps to 0 here); for an increment of 1, we add 50/6 to the number.
- // For 18 we end up with 150, which looks really fine. TODO: Feel free to try to further outline this, but this is a good start.
- var zoom = 100.0 + (fontSize - Constants.FONT_SIZE_ENUM_ADJUSTMENT) * 40.0 / 6.0;
-
- // Limit the zoom by the limits of Awesomium.NET.
- if (zoom < 50) zoom = 50;
- if (zoom > 500) zoom = 500;
- return (int)zoom;
- }
-
- public void Close()
- {
- host.Dispose();
- }
-
- public void Print()
- {
- host.Print();
- }
-
- private void HtmlPreviewLoaded(object sender, RoutedEventArgs e)
- {
- Loaded -= HtmlPreviewLoaded;
- var context = TaskScheduler.FromCurrentSynchronizationContext();
-
- //This is a perf helper, the MetroContentControl slides content in
- // The preview pane stutters and looks crap, but hiding it then showing it after the animation it looks way better
- Unloaded += (o, args) =>
- {
- if (hwndContentHost == null) return;
- hwndContentHost.Visibility = Visibility.Hidden;
- };
- Loaded +=
- (o, args) =>
- {
- var delay = TaskEx.Delay(500);
- delay.ContinueWith(t =>
- {
- hwndContentHost.Visibility = Visibility.Visible;
- }, context);
- };
-
- //We are hosting the Awesomium preview in another appdomain so our main UI thread does not take the hit
- hostAppDomain = AppDomain.CreateDomain("HtmlPreviewDomain");
- var filename = FileName;
-
- // create the AppDomain on a new thread as we want to ensure it is an
- // STA thread as this makes life easier for creating UI components
- var thread = new Thread(() =>
- {
- var awesomiumHostType = typeof(AwesomiumHost);
- host = (AwesomiumHost)hostAppDomain.CreateInstanceAndUnwrap(awesomiumHostType.Assembly.FullName, awesomiumHostType.FullName,
- false, BindingFlags.Default, null, new object[] { filename, BaseDirectory }, CultureInfo.CurrentCulture, null);
-
- host.SetHtml(content);
-
- var controlHandle = host.ControlHandle;
-
- Task.Factory.StartNew(() =>
- {
- //Delay until preview control has loaded before creating content host
- host.LoadedWaitHandle.WaitOne();
-
- // We need to invoke on the Markpad dispatcher, we are currently in the host appdomains STA Thread.
- Dispatcher.BeginInvoke(new Action(() =>
- {
- hwndContentHost = new HwndContentHost(controlHandle);
- //Without the border we don't get the dropshadows
- Content = new Border
- {
- Background = Brushes.White,
- Padding = new Thickness(3),
- Child = hwndContentHost
- };
- }));
- }, TaskCreationOptions.LongRunning);
-
- host.Run();
- //I can't get this unloading without an error,
- // I am gathering Application.Shutdown is causing the appdomain to shutdown too
- //AppDomain.Unload(hostAppDomain);
- });
-
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
- }
-}
+using System;
+using System.Globalization;
+using System.Reflection;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace MarkPad.PreviewControl
+{
+ public partial class HtmlPreview
+ {
+ static string content;
+ AwesomiumHost host;
+ AppDomain hostAppDomain;
+ HwndContentHost hwndContentHost;
+
+ public static string BaseDirectory { get; set; }
+
+ #region public string Html
+ public static DependencyProperty HtmlProperty = DependencyProperty.Register("Html", typeof (string), typeof (HtmlPreview),
+ new PropertyMetadata(" ", HtmlChanged));
+
+ public string Html
+ {
+ get { return (string)GetValue(HtmlProperty); }
+ set { SetValue(HtmlProperty, value); }
+ }
+ #endregion
+
+ #region public string FileName
+ public static readonly DependencyProperty FileNameProperty =
+ DependencyProperty.Register("FileName", typeof (string), typeof (HtmlPreview), new PropertyMetadata(default(string)));
+
+ public string FileName
+ {
+ get { return (string)GetValue(FileNameProperty); }
+ set { SetValue(FileNameProperty, value); }
+ }
+ #endregion
+
+ #region public double BrowserFontSize
+ public static DependencyProperty BrowserFontSizeProperty = DependencyProperty.Register("BrowserFontSize", typeof(double), typeof(HtmlPreview),
+ new PropertyMetadata(default(double), FontSizeChanged));
+
+ public double BrowserFontSize
+ {
+ get { return (double)GetValue(BrowserFontSizeProperty); }
+ set { SetValue(BrowserFontSizeProperty, value); }
+ }
+ #endregion
+
+ #region public int ScrollPercentage
+ public static DependencyProperty ScrollPercentageProperty = DependencyProperty.Register("ScrollPercentage", typeof(double), typeof(HtmlPreview),
+ new PropertyMetadata(default(double), ScrollPercentageChanged));
+
+ public double ScrollPercentage
+ {
+ get { return (double)GetValue(ScrollPercentageProperty); }
+ set { SetValue(ScrollPercentageProperty, value); }
+ }
+
+ #endregion
+
+ public HtmlPreview()
+ {
+ InitializeComponent();
+ }
+
+ private static void ScrollPercentageChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
+ {
+ var awesomiumHost = ((HtmlPreview) dependencyObject).host;
+ awesomiumHost.ScrollPercentage = (double)dependencyPropertyChangedEventArgs.NewValue;
+ awesomiumHost.WbProcentualZoom();
+ }
+
+ private static void FontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var htmlPreview = ((HtmlPreview) d);
+ if (htmlPreview.host != null)
+ htmlPreview.host.SetZoom(GetZoomLevel((double)e.NewValue));
+ }
+
+ private static void HtmlChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ content = e.NewValue as string;
+ if (string.IsNullOrEmpty(content))
+ content = " ";
+
+ var htmlPreview = (HtmlPreview) d;
+ if (htmlPreview.host != null)
+ htmlPreview.host.SetHtml(content);
+ }
+
+ /// <summary>
+ /// Turn the font size into a zoom level for the browser.
+ /// </summary>
+ /// <returns></returns>
+ private static int GetZoomLevel(double fontSize)
+ {
+ // The default font size 12 corresponds to 100 (which maps to 0 here); for an increment of 1, we add 50/6 to the number.
+ // For 18 we end up with 150, which looks really fine. TODO: Feel free to try to further outline this, but this is a good start.