Size: 10333
Comment:
|
Size: 10178
Comment: Initial version
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
UNDER CONSTRUCTION |
|
Line 43: | Line 41: |
Line 45: | Line 43: |
Line 50: | Line 48: |
Line 52: | Line 50: |
Line 54: | Line 52: |
Line 60: | Line 58: |
Line 66: | Line 64: |
Line 70: | Line 68: |
Line 72: | Line 70: |
Line 74: | Line 72: |
Line 77: | Line 75: |
Line 83: | Line 81: |
Line 92: | Line 90: |
Line 94: | Line 92: |
Line 96: | Line 94: |
Line 98: | Line 96: |
Line 145: | Line 143: |
<<BR>>It is used to build the Settings window (button {{attachment:Settings24.png || width=24}} of the command bar).<<BR>> | <<BR>>It is used to build the Settings window.<<BR>> |
Line 156: | Line 154: |
Line 161: | Line 158: |
CategoryDyalogWpfUtilities |
[[CategoryDyalogWpfUtilities||target='_blank']] |
wpfXamlEditor
Overview
XamlEditor is a Xaml editor for an APL variable or for a file on disk. This Dyalog APL user command is able to show the Xaml in color with folding, print it, reorganize it so it is more readable according to some settings set by the user. It is inspired by the work of Robby Ingebretsen of Kaxaml (http://www.Kaxaml.com). It is particularly valuable for APLers that like to keep their Xaml in the workspace. With XamlEditor they have a tool to maintain it without effort.
Usage
Once installed the user command can be invoke by typing ]XamlEditor (casing is not important, no argument). The following start-up screen will appear:
Here is a short description for each buttons:
Button |
Explanation |
Button |
Explanation |
Execute the Xaml and Show the Result in a Separate Window |
|
Select All the Xaml |
|
|
Rewrite the Xaml According to the Settings (Scrub) |
|
Delete the Selected Text |
|
Open a Dialog Box to Select a Xaml Variable in the WS |
|
Clear the Clipboard |
|
Open a Dialog Box to Save the Xaml as a Variable in the WS |
|
Undo Last Operation |
|
Open a Dialog Box to Select a File on Disk |
|
Redo Previous Operation |
|
Open a Dialog Box to Save the Xaml to a File |
|
Print All the Xaml |
|
Cut the Selected Text to The Clipboard |
|
Print Preview All the Xaml |
|
Copy the Selected Text to the Clipboard |
|
Make Selected Text a Comment |
|
Paste the Text From the clipboard |
|
Choose the Settings when Scrubbing |
Installation
Download the file wpfXamlEditor.1.0.zip. It contains the Dyalog user command file wpfXamlEditor.dyalog and a dll named ICSharpCode.AvalonEdit.dll
Copy the file wpfXamlEditor.dyalog to your user command directory (for advice how to organize your User Commands see UserCommands/WhereShouldTheyGo).
Copy the file ICSharpCode.AvalonEdit.dll to the same directory as your dyalog.exe file (as shown by +2 ⎕NQ'.' 'GetEnvironment' 'Dyalog'). You may need administrator privileges for copying the file. That dll is free of charge and was written by Daniel Grunwald. It can be downloaded from CodeProject or from AvalonEdit but is included in the zip file for commodity.
Detailed Explanations
Execute the Xaml and Show the Result in a Separate Window |
The Xaml will be parsed and show in a separate window. If the root element of the Xaml is not a window it will be made the content of a new window. The x:Class attribute will be removed if present. All the events will be removed before parsing the Xaml by the function ScrubAndFix. It does not rely on a prefix to removed the events. ( Show ScrubAndFix )
|
Rewrite the Xaml According to the Settings (Scrub) |
Will rewrite the Xaml according to the Settings. The most important Settings is Attribute Tolerance, it allows you to define up to how many attributes there could be on one line of Xaml. Past that number all the attributes are written on a separate line.
|
Open a Dialog Box to Select a Xaml Variable in the WS |
|
Open a Dialog Box to Save the Xaml as a Variable in the WS |
The dialog box contains a tree element where each branch is a namespace that has a character variable that responded positive to the following test: '><'≡¯2↑1⌽variableName~⎕UCS 32 10 13 9 (first and last character is '<>' after removing the space,LF,NL,HT characters)
|
Open a Dialog Box to Select a File on Disk |
|
Open a Dialog Box to Save the Xaml to a File |
A standard OpenFileDialog and SaveFileDialog are used to select and save the file.
|
Print All the Xaml |
|
Print Preview All the Xaml |
Will take the Xaml to a FlowDocument where it can be preview or print directly.
|
Make Selected Text a Comment |
The following rules applied to this button when clicked:
If nothing is selected it will insert '<!-- -->' at the caret.
If the selection is positive to the test: ' --><!-- '≡9↑¯4⌽selectedText, the comments are removed.
Otherwise it will insert: '<!-- ',selectedText,' -->'
|
Choose the Settings when Scrubbing |
The settings for scrubbing are saved in a xml file named XED.Settings.xml. The file will be created automatically with default values the first time the user command runs. It will be located next to the wpfXamlEditor.dyalog file or in the AppData directory depending on the Windows version and security. The data of the file looks like this:
1 <Settings>
2 <EditorFont>APL385 Unicode</EditorFont>
3 <EditorFontSize>14</EditorFontSize>
4 <ReducePrecision>1</ReducePrecision>
5 <Precision>3</Precision>
6 <AttributeCounteTolerance>3</AttributeCounteTolerance>
7 <ReorderAttributes>1</ReorderAttributes>
8 <RemoveCommonDefaultValues>0</RemoveCommonDefaultValues>
9 <ConvertTabsToSpaces>1</ConvertTabsToSpaces>
10 <SpaceCount>3</SpaceCount>
11 </Settings>
It is used to build the Settings window.
Item |
Description |
Font: |
Font used by Xaml Editor |
Font Size: |
Size of the font used by Xaml Editor |
Numeric Precision: |
Reduce the Precision of Large Numbers to a Maximum of this Number of Digits Beyond the Decimal Point |
Attribute Tolerance: |
If More Than This Number of Attributes are Defined on an Element, Scrubber Will Move Each Attribute onto its Own Line |
Reorder Attributes by Importance |
Scrubber Will Reorder Attributes on a Given Element According to a Predetermined Set of Rules About Which Attributes Are Most Important |
Remove Common Default Values |
Scrubber Will Remove Common Properties Which Are Being Set to Their Default Values |
Indent Using Spaces |
If This is Checked, Scrubber Will Indent Using Spaces Instead of Tabs |
Version Information
Original author: |
Pierre Gilbert |
Responsible: |
|
Email: |
<apgil AT SPAMFREE videotron DOT ca> |