<?xml version="1.0"?>
--<HorizontalStack Name="ItemsContainer" Spacing = "0" Margin="0"/>
++<HorizontalStack Name="ItemsContainer" Spacing = "2" Margin="0"/>
imlSource = tmp.ToString ();
- crowIFaceService?.LoadIML (imlSource);
- /*if (crowIFaceService.EncloseInTemplatedControl && !string.IsNullOrEmpty(crowIFaceService.TemplateContainerSource)) {
++ if (document.EncloseInTemplatedControl && !string.IsNullOrEmpty(document.TemplateContainerSource)) {
+ if (!string.IsNullOrEmpty(imlSource) && imlSource.StartsWith("<?xml")) {
+ int pos = src.IndexOf('>');
+ if (pos > 0)
+ src = imlSource.Substring(pos + 1);
+ }
- string tmpCloseTag = crowIFaceService.TemplateContainerSource.Split (' ', StringSplitOptions.RemoveEmptyEntries)[0].Replace ("<","").TrimEnd('/','>');
- crowIFaceService?.LoadIML ($"{crowIFaceService.TemplateContainerSource.TrimEnd('/','>')}><Template>{src}</Template></{tmpCloseTag}>");
- } else*/
++ string tmpCloseTag = document.TemplateContainerSource.Split (' ', StringSplitOptions.RemoveEmptyEntries)[0].Replace ("<","").TrimEnd('/','>');
++ crowIFaceService?.LoadIML ($"{document.TemplateContainerSource.TrimEnd('/','>')}><Template>{src}</Template></{tmpCloseTag}>");
++ } else
+ crowIFaceService?.LoadIML (imlSource);
RegisterForRedraw ();
}
using CrowEdit.Xml;
using Drawing2D;
using System.Diagnostics;
++using System.IO;
namespace CECrowPlugin
{
public static bool Is(this Token tok, ImlTokenType type) => (ImlTokenType)tok.Type == type;
}
public class ImlDocument : XmlDocument {
++ Configuration conf;
public ImlDocument (string fullPath, string editorPath) : base (fullPath, editorPath) {
App.GetService<CrowService> ()?.Start ();
++ conf = new Configuration(Path.Combine(Configuration.AppConfigPath, "editor", this.FileName + ".conf"));
/*if (project is MSBuildProject msbp) {
if (msbp.IsCrowProject)
}*/
}
- get => Configuration.Global.Get (nameof(EncloseInTemplatedControl), false);
+ CrowService crowService;
+ public CrowService CrowService {
+ get => crowService;
+ set {
+ if (crowService == value)
+ return;
+ crowService = value;
+ NotifyValueChanged (crowService);
+ }
+ }
+ public bool EncloseInTemplatedControl {
- Configuration.Global.Set (nameof(EncloseInTemplatedControl), value);
++ get => conf.Get (nameof(EncloseInTemplatedControl), false);
+ set {
+ if (EncloseInTemplatedControl == value)
+ return;
- get => Configuration.Global.Get (nameof(TemplateContainerSource), "<Button/>");
++ conf.Set (nameof(EncloseInTemplatedControl), value);
+ NotifyValueChanged (value);
+
+ }
+ }
+ public string TemplateContainerSource {
- Configuration.Global.Set (nameof(TemplateContainerSource), value);
++ get => conf.Get (nameof(TemplateContainerSource), "<Button/>");
+ set {
+ if (TemplateContainerSource == value)
+ return;
++ conf.Set (nameof(TemplateContainerSource), value);
+ NotifyValueChanged (value);
+ }
+ }
+
protected override SyntaxAnalyser CreateSyntaxAnalyser() => new ImlSyntaxAnalyser (ImmutableBufferCopy);
public override string GetTokenTypeString (TokenType tokenType) => ((ImlTokenType)tokenType).ToString();
--- /dev/null
- <ListBox Style="DockWinTitleBarIconMenu" Data="{../dbgIfaceWidget.WindowCommands}"/>
- <VerticalStack Background="Black" Height="40%" >
- <HorizontalStack Height="Fit" Spacing="5" >
- <CheckBox Caption="Load source as template in:" Width="Fit" Name="cbEncloseInTemplate" IsChecked="{²EncloseInTemplatedControl}"/>
- <TextBox Width="Stretched" Text="{²TemplateContainerSource}" IsEnabled="{../cbEncloseInTemplate.IsChecked}"/>
- </HorizontalStack>
- <DebugInterfaceWidget Name="dbgIfaceWidget" Focusable="true" CurrentWidget="{²CurrentWidget}"
- BubbleEvents="None"
- Document="{}"/>
- <!--<Popper IsVisible="{PreviewHasError}" Background="DarkRed">
- <Template>
- <CheckBox IsChecked="{²./IsPopped}" MouseEnter="{IsChecked='true'}" MouseLeave="{IsChecked='false'}">
- <Template>
- <Label DataSource="{CurrentException}" Text="{Message}" Background="Red" Foreground="White" Width="Stretched" Margin="2"
- Multiline="true"/>
- </Template>
- </CheckBox>
- </Template>
- <Label Text="{CurrentException}" Background="DarkRed" Foreground="White" Width="90%" Margin="2" Multiline="true"/>
- </Popper>-->
- </VerticalStack>
- <Splitter/>
+ <?xml version="1.0"?>
+ <ListItem IsVisible="{IsSelected}" IsSelected="{²IsSelected}" Selected="{/tb.HasFocus='true'}">
+ <VerticalStack Spacing="0">
++ <HorizontalStack Height="Fit" Spacing="5" >
++ <CheckBox Caption="Load source as template in:" Width="Fit" Name="cbEncloseInTemplate" IsChecked="{²EncloseInTemplatedControl}"/>
++ <TextBox Width="Stretched" Text="{²TemplateContainerSource}" IsEnabled="{../cbEncloseInTemplate.IsChecked}"/>
++ </HorizontalStack>
+ <HorizontalStack Spacing="0" Background="WhiteSmoke">
+ <SourceEditor Name="tb" Font="mono, 14" Margin='0' CurrentNode="{CurrentNode}"
+ Document="{}" TextChanged="onTextChanged" />
+ <ScrollBar Value="{²../tb.ScrollY}"
+ LargeIncrement="{../tb.PageHeight}" SmallIncrement="1"
+ CursorRatio="{../tb.ChildHeightRatio}" Maximum="{../tb.MaxScrollY}" />
+ </HorizontalStack>
+ <ScrollBar Style="HScrollBar" Value="{²../tb.ScrollX}"
+ LargeIncrement="{../tb.PageWidth}" SmallIncrement="1"
+ CursorRatio="{../tb.ChildWidthRatio}" Maximum="{../tb.MaxScrollX}" />
+ <HorizontalStack Height="Fit" Spacing='3'>
+ <Widget Width="Stretched"/>
+ <Label Text="TokType" Foreground="Grey"/>
+ <Label Text="{../../tb.CurrentTokenType}" Margin="3"/>
+ <Label Text="Tok" Foreground="Grey"/>
+ <Label Text="{../../tb.CurrentTokenString}" Margin="3"/>
+ <Label Text="Node" Foreground="Grey"/>
+ <Label Text="{../../tb.CurrentNode}" Margin="3"/>
+ <Label Text="MouseY:" Foreground="Grey"/>
+ <Label Text="{../../tb.MouseY}" Margin="3"/>
+ <Label Text="VisibleLines:" Foreground="Grey"/>
+ <Label Text="{../../tb.VisibleLines}" Margin="3"/>
+ <Label Text="ScrollX:" Foreground="Grey"/>
+ <Label Text="{../../tb.ScrollX}" Margin="3"/>
+ <Label Text="ScrollY:" Foreground="Grey"/>
+ <Label Text="{../../tb.ScrollY}" Margin="3"/>
+ <Label Text="ScrollLine:" Foreground="Grey"/>
+ <Label Text="{../../tb.ScrollLine}" Margin="3"/>
+ <Label Text="HoverLine:" Foreground="Grey"/>
+ <Label Text="{../../tb.HoverLine}" Margin="3"/>
+ <Label Text="Line:" Foreground="Grey"/>
+ <Label Text="{../../tb.CurrentLine}" Margin="3"/>
+ <Label Text="Col:" Foreground="Grey"/>
+ <Label Text="{../../tb.TabulatedColumn}" Margin="3"/>
+ </HorizontalStack>
+ </VerticalStack>
+ </ListItem>
<?xml version="1.0"?>
--<DockWindow Caption="Crow Preview" Width="60%" Commands="{/dbgIfaceWidget.WindowCommands}">
- <VerticalStack Background="Black" >
- <DebugInterfaceWidget Name="dbgIfaceWidget" Focusable="true" CurrentWidget="{CurrentWidget}"
++<DockWindow Caption="Crow Preview" Width="60%" FreezeDockState="true" AdditionalCommands="{/dbgIfaceWidget.WindowCommands}">
+ <VerticalStack Background="Black" >
- <HorizontalStack Height="Fit" Spacing="5" >
- <CheckBox Caption="Load source as template in:" Width="Fit" Name="cbEncloseInTemplate" IsChecked="{²EncloseInTemplatedControl}"/>
- <TextBox Width="Stretched" Text="{²TemplateContainerSource}" IsEnabled="{../cbEncloseInTemplate.IsChecked}"/>
- </HorizontalStack>
+ <DebugInterfaceWidget Name="dbgIfaceWidget" Focusable="true" CurrentWidget="{²CurrentWidget}"
BubbleEvents="None"
Document="{CurrentDocument}"/>
- <Popper IsVisible="{PreviewHasError}" Background="DarkRed">
+ <Popper DataSource="{../dbgIfaceWidget.CrowIFaceService}" IsVisible="{PreviewHasError}" Background="DarkRed">
<Template>
<CheckBox IsChecked="{²./IsPopped}" MouseEnter="{IsChecked='true'}" MouseLeave="{IsChecked='false'}">
<Template>