}
protected SyntaxRootNode root;
-
public Command CMDRefreshSyntaxTree;
+
protected override void initCommands()
{
base.initCommands();
+
CMDRefreshSyntaxTree = new ActionCommand ("Reparse", parse, "#icons.refresh.svg", true);
}
public SyntaxRootNode Root => root;
//CrowEditBase.App.Log (LogType.Low, $"Syntax Analysis done in {sw.ElapsedMilliseconds}(ms) {sw.ElapsedTicks}(ticks)");
}
+ public SyntaxException CurrentException {
+ get => CrowEditBase.App.CurrentException;
+ set {
+ CrowEditBase.App.CurrentException = value;
+ SetLocation(value.Location);
+ }
+ }
+
}
}
\ No newline at end of file
return false;
}
+ public CommandGroup SyntaxViewCommands =>
+ currentDocument is SourceDocument src ? new CommandGroup (src.CMDRefreshSyntaxTree) : null;
public Document CurrentDocument {
get => currentDocument;
set {
EditCommands[0] = currentDocument.CMDUndo;
EditCommands[1] = currentDocument.CMDRedo;
+ NotifyValueChanged("SyntaxViewCommands", SyntaxViewCommands);
}
}
public Project CurrentProject {
EditCommands[4] = currentEditor.CMDPaste;
}
}
+ SyntaxException currentException;
+ public SyntaxException CurrentException {
+ get => currentException;
+ set {
+ if (currentException == value)
+ return;
+ currentException = value;
+ NotifyValueChanged(currentException);
+ }
+ }
public string CurrentDir {
get => Configuration.Global.Get<string>("CurrentDir");
set {
CurrentEditor?.RegisterForGraphicUpdate ();
}
}
-
public bool IndentWithSpace {
get => Configuration.Global.Get<bool> ("IndentWithSpace", false);
set {
lock (filteredLinesMutex) {
//Console.WriteLine("updatefilteredlines");
lock (logger.LogMutext)
- filteredLines = logger.log.Where (l=>((int)l.Type & (int)filter) > 0);
+ filteredLines = logger.log.Where (l=>((int)l.Type & (int)filter) > 0).ToArray();
MaxScrollY = filteredLines == null ? 0 : filteredLines.Count() - visibleLines;
NotifyValueChanged ("ChildHeightRatio", Math.Min (1.0, (double)visibleLines / filteredLines.Count()));
}
IEnumerable<LogEntry> entries;
lock (filteredLinesMutex) {
- entries = filteredLines.Skip(ScrollY).Take(visibleLines);
+ entries = filteredLines.Skip(ScrollY).Take(visibleLines).ToArray();
}
//perf.Restart();
<!--<Label Text='{Caption}' HorizontalAlignment='Left' Width='Stretched'/>-->
</ListItem>
</ItemTemplate>
- <ItemTemplate DataType='CrowEditBase.ColorSuggestion'>
+ <ItemTemplate DataType='CECrowPlugin.ColorSuggestion'>
<ListItem Height='Fit' Margin='0' Focusable='false' HorizontalAlignment='Left' Width='Stretched'
Selected = '{Background=${ControlHighlight}}'
Unselected = '{Background=Transparent}'>
<Image Margin='6' Path='{Icon}' Width='32' Height='24' Background='{Fill}' CornerRadius='2'/>
<Label Text='{Caption}' HorizontalAlignment='Left' Width='Stretched'/>
</HorizontalStack>
- <!--<Label Text='{Caption}' HorizontalAlignment='Left' Width='Stretched'/>-->
</ListItem>
</ItemTemplate>
</ListBox>
int printedLines = 0;
int linesToSkip = (int)Math.Floor(ScrollY / lineHeight);
+
IEnumerator<SyntaxNode> foldsEnum = doc.Root.VisibleFoldableNodes.GetEnumerator ();
bool notEndOfFolds = foldsEnum.MoveNext();
int curLine = linesToSkip;
pixY = -(ScrollY % lineHeight);
+ IEnumerator<int> exceptionLines = doc.Root.GetAllExceptions()?.Select(e=>e.Location.Line).Order().GetEnumerator();
+ bool hasExceptions = exceptionLines.MoveNext();
+
while (curLine < doc.LinesCount && printedLines < Math.Min(visibleLines, doc.LinesCount)) {
+
+ while (hasExceptions && exceptionLines.Current < curLine) {
+ hasExceptions = exceptionLines.MoveNext();
+ }
int encodedChar = 0;
TextLine curTxtLine = doc.GetLine (curLine);
fillHighlight (gr, curLine, hoverNodeStart.Value, hoverNodeEnd.Value, lineRect, new Color(0,0,0.8,0.1));;
#endif
if (selectionNotEmpty && curLine >= selStart.Line && curLine <= selEnd.Line)
- fillHighlight (gr, curLine, selStart, selEnd, lineRect, SelectionBackground);
+ fillHighlight (gr, curLine, selStart, selEnd, lineRect, SelectionBackground);
+ if (hasExceptions && exceptionLines.Current == curLine) {
+ gr.Operator = Operator.DestOver;
+ gr.SetSource (new Color(1.0,0,0.0,0.3));
+ gr.Rectangle (lineRect);
+ gr.Fill ();
+ gr.Operator = Operator.Over;
+ }
//Draw line numbering
if (printLineNumbers){
registeredClients.Remove (client);
ExitWriteLock();
}
- void notifyClients (TextChange tc, object triggeringClient = null) {
+ protected void notifyClients (TextChange tc, object triggeringClient = null) {
object[] clients = registeredClients.Keys.ToArray ();
for (int i = 0; i < clients.Length; i++) {
if (clients[i] != triggeringClient)
notifyClient (clients[i], tc);
}
}
- void notifyClient (object client, TextChange tc) {
+ protected void notifyClient (object client, TextChange tc) {
if (registeredClients[client] == null)
registeredClients[client] = new List<TextChange> ();
registeredClients[client].Add (tc);
<VerticalStack Spacing="0" Name="MoveHandle">
<HorizontalStack Visible="{./IsDockedInStack}" Height="Fit" Margin="1" Background="Jet" Width="Stretched">
<Label Text="{./Caption}" TextAlignment="Left" Width="Stretched" Foreground="DimGrey" Font="${SmallUIFont}"/>
+ <ListBox Style="DockWinTitleBarIconMenu" Data="{./AdditionalCommands}"/>
<ListBox Style="DockWinTitleBarIconMenu" Data="{./DockCommands}"/>
<ListBox Style="DockWinTitleBarIconMenu" Data="{./Commands}"/>
</HorizontalStack>
<Widget Width="5"/>
<Image Margin="1" Width="10" Height="10" Path="{./Icon}"/>
<Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Left" Text="{./Caption}" />
+ <ListBox Style="DockWinTitleBarIconMenu" Data="{./AdditionalCommands}"/>
<ListBox Style="DockWinTitleBarIconMenu" Data="{./DockCommands}"/>
<ListBox Style="DockWinTitleBarIconMenu" Data="{./Commands}"/>
<Widget Width="5"/>
t.Start ();
}
public bool Terminate;
+ public bool Edition = true;
+ public bool FirstRenderingFinished = false;
void interfaceThread () {
while (!Terminate) {
try
{
- Update();
+ if (Edition) {
+ if (FirstRenderingFinished)
+ Thread.Sleep(500);
+
+ int lqiCount;
+ lock(LayoutMutex)
+ lqiCount = LayoutingQueue.Count;
+ while(lqiCount > 0) {
+ Update();
+ lock(LayoutMutex)
+ lqiCount = LayoutingQueue.Count;
+ }
+ FirstRenderingFinished = true;
+ }
}
catch (System.Exception ex)
{
delCrowServiceSetCurrentException (ex);
Console.WriteLine ($"[DbgIFace] {ex}");
ClearInterface();
- Thread.Sleep(1000);
+ Thread.Sleep(2000);
}
/*if (IsDirty)
resetInterface ();
if (string.IsNullOrEmpty(source))
return;
+ FirstRenderingFinished = false;
Widget tmp = CreateITorFromIMLFragment (source).CreateInstance();
AddWidget (tmp);
tmp.DataSource = this;
}
public void Resize (int width, int height) {
ProcessResize (new Rectangle(0, 0, width, height));
+ FirstRenderingFinished = false;
}
/*public override void ProcessResize(Rectangle bounds) {
lock (UpdateMutex) {
NotifyValueChangedAuto (crowIFaceService);
}
}
- Command CMDRefresh, CMDZoomIn, CMDZoomOut;
+
+ Command CMDRefresh, CMDZoomIn, CMDZoomOut, CMDRun;
public DebugInterfaceWidget () : base () {
CMDRefresh = new ActionCommand (this, "Refresh",
() => {
RegisterForGraphicUpdate ();
}
}, "#icons.zoom-out.svg");
+ //CMDRun = new ToggleCommand(this,"Run",,)
Thread t = new Thread (backgroundThreadFunc);
t.IsBackground = true;
}
}
void updateIMLSource (TextChange change) {
+ if (string.IsNullOrEmpty(change.ChangedText) && change.CharDiff == 0)
+ return;
ReadOnlySpan<char> src = imlSource.AsSpan ();
- Span<char> tmp = stackalloc char[src.Length + (change.ChangedText.Length - change.Length)];
+ Span<char> tmp = stackalloc char[src.Length + change.CharDiff];
//Console.WriteLine ($"{Text.Length,-4} {change.Start,-4} {change.Length,-4} {change.ChangedText.Length,-4} tmp:{tmp.Length,-4}");
src.Slice (0, change.Start).CopyTo (tmp);
- change.ChangedText.AsSpan ().CopyTo (tmp.Slice (change.Start));
- src.Slice (change.End).CopyTo (tmp.Slice (change.Start + change.ChangedText.Length));
+
+ if (!string.IsNullOrEmpty(change.ChangedText)) {
+ change.ChangedText.AsSpan ().CopyTo (tmp.Slice (change.Start));
+ }
+ src.Slice (change.End).CopyTo (tmp.Slice (change.End2));
imlSource = tmp.ToString ();
delGetName = (Func<string>)Delegate.CreateDelegate(typeof(Func<string>), instance, type.GetProperty("Name").GetGetMethod());
}
- public string Icon => $"#icons.{type.FullName}.svg";
public IEnumerable<MemberInfo> Members => type.GetMembers (BindingFlags.Public | BindingFlags.Instance).
Where (m=>((m is PropertyInfo pi && pi.CanWrite) || (m is EventInfo)) &&
public IEnumerable<PropertyContainer> Properties => Members.Where(m=>m.MemberType == MemberTypes.Property).Select(p=> new PropertyContainer(this, p as PropertyInfo));
public string Name => delGetName();
+ public string DesignId => (string)fiWidget_design_id?.GetValue(instance);
+ public string Icon => $"#icons.{type.FullName}.svg";
+
+ public string TypeName => type.FullName;
public IEnumerable<ForeignWidgetContainer> Children {
get {
<ListBox Data="{Properties}">
<Template>
<VerticalStack Background="{./Background}">
- <Label Text="{Name}"/>
+ <HorizontalStack Height="Fit" Spacing="10" Margin="10" Background="DimGrey">
+ <Image Width="40" Height="40" Margin="4" Path="{Icon}" Background="Jet"/>
+ <Label Text="{TypeName}" Width="Stretched" TextAlignment="Left" />
+ <Label Font="mono bold, 16" Foreground="PaleGreen" Text="{DesignId}" Width="Fit" Margin="4" />
+ </HorizontalStack>
<HorizontalStack Margin="1">
<Scroller Name="ItemsScroller" Margin="2">
<VerticalStack Height="Fit" MinimumSize="10,10"
<?xml version="1.0"?>
<DockWindow Caption="Exceptions" Width="40%" Height="20%">
- <ListBox DataSource="{CurrentDocument}" Data='{Exceptions}' Height='Stretched' Width='Stretched'/>
+ <ListBox DataSource="{CurrentDocument}" Data='{Exceptions}' SelectedItem="{²CurrentException}"
+ Height='Stretched' Width='Stretched'>
+ <Template>
+ <Scroller Name="scroller1" >
+ <Table Columns="Message,Stretched;Location,Fit"
+ Height="Fit" Name="ItemsContainer" VerticalAlignment="Top"/>
+ </Scroller>
+ </Template>
+ <ItemTemplate>
+ <TableRow Selected = "{Background=${ControlHighlight}}"
+ Unselected = "{Background=Transparent}">
+ <Label Text="{Message}" />
+ <Label Text="{Location}"/>
+ </TableRow>
+ </ItemTemplate>
+ </ListBox>
</DockWindow>
<?xml version="1.0"?>
-<DockWindow Caption="Syntax" Width="30%">
+<DockWindow Caption="Syntax" Width="30%" AdditionalCommands="{SyntaxViewCommands}">
<VerticalStack RootDataLevel="true" Spacing="0" DataSource="{CurrentDocument}">
- <Button Command="{CMDRefreshSyntaxTree}"/>
<Label Text="{}"/>
<Label Text="{SyntaxRootNode}"/>
<Label Text="{CurrentNode}"/>