Skip to content

Commit 7b6c3f6

Browse files
committed
Fixed bugs and added filter feature
Fixed line number display bug and added token filtering along with a max render count setting.
1 parent 887d414 commit 7b6c3f6

File tree

5 files changed

+26
-28
lines changed

5 files changed

+26
-28
lines changed

Grun.Net.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
that must get queued up between two render cycles before "long delay" throttling kicks in. Once "long delay" throttling kicks in, all
1414
render cycles are suspended until the source text stops changing for at least a full second. -->
1515
<add key="MinimumRenderCountToTriggerLongDelay" value="5"/>
16+
<!-- If the number of graph nodes exceeds the maximum render count then the graph is simply not rendered. After a certain point the MSAGL
17+
graph canvas will lock up the UI while it is busy rendering and frankly a huge graph is sort of useless. It is better to graph subsections
18+
of a graph that has reached such a size. Your CPU will also thank you. -->
19+
<add key="MaximumNodeRenderCount" value="500"/>
1620
<!-- Heuristic Syntax Highlighting Color Settings -->
1721
<add key="DefaultTokenColor" value="Black"/>
1822
<add key="DefaultTokenBackgroundColor" value="Transparent"/>

Grun.Net.sln

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio 15
3-
VisualStudioVersion = 15.0.28307.1022
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.6.33829.357
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grun", "Grun\Grun.csproj", "{B614368A-F4C9-409F-8896-CB1DA204AD6D}"
66
EndProject
@@ -63,27 +63,4 @@ Global
6363
GlobalSection(ExtensibilityGlobals) = postSolution
6464
SolutionGuid = {A1CB1A18-09C5-4D7F-916D-2346D29A8563}
6565
EndGlobalSection
66-
GlobalSection(AutomaticVersions) = postSolution
67-
UpdateAssemblyVersion = True
68-
UpdateAssemblyFileVersion = True
69-
UpdateAssemblyInfoVersion = True
70-
ShouldCreateLogs = True
71-
AdvancedSettingsExpanded = True
72-
AssemblyVersionSettings = None.None.None.None
73-
AssemblyFileVersionSettings = None.None.None.None
74-
AssemblyInfoVersionSettings = None.None.None.None
75-
UpdatePackageVersion = False
76-
AssemblyInfoVersionType = SettingsVersion
77-
InheritWinAppVersionFrom = None
78-
UpdateAssemblyVersion.Release|Any CPU = True
79-
UpdateAssemblyFileVersion.Release|Any CPU = True
80-
UpdateAssemblyInfoVersion.Release|Any CPU = True
81-
ShouldCreateLogs.Release|Any CPU = True
82-
AssemblyVersionSettings.Release|Any CPU = None.None.DateStamp.IncrementWithResetOnIncrease
83-
AssemblyFileVersionSettings.Release|Any CPU = None.None.DateStamp.IncrementWithResetOnIncrease
84-
AssemblyInfoVersionSettings.Release|Any CPU = None.None.DateStamp.IncrementWithResetOnIncrease
85-
UpdatePackageVersion.Release|Any CPU = False
86-
AssemblyInfoVersionType.Release|Any CPU = SettingsVersion
87-
InheritWinAppVersionFrom.Release|Any CPU = None
88-
EndGlobalSection
8966
EndGlobal

GunWin/VisualAnalyzer.Designer.cs

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GunWin/VisualAnalyzer.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,10 @@ public void SetSourceCode(string code)
364364
private void GraphingFinished(object sender, GraphingResult e)
365365
{
366366
BuildParseTreeTreeViewGuide(e.ParseTree);
367-
RenderParseTreeGraph(e.Graph);
367+
368+
// Bail if our graph node count is too high
369+
if (e.Graph.Nodes.Count() <= _Settings.MaximumNodeRenderCount) RenderParseTreeGraph(e.Graph);
370+
368371
if (e.Graph != null)
369372
stripLabelNodeCount.Text = e.Graph.Nodes.Count().ToString();
370373

Utilities/Configuration/Settings.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ public class Settings
7474
/// <value>The minimum render count to trigger a long delay.</value>
7575
public int MinimumRenderCountToTriggerLongDelay { get; set; }
7676

77+
/// <summary>
78+
/// Gets or sets the maximum node render count.
79+
/// </summary>
80+
/// <value>The maximum node count to render.</value>
81+
public int MaximumNodeRenderCount { get; set; }
82+
7783
/// <summary>
7884
/// Gets or sets the color of the keyword token.
7985
/// </summary>
@@ -732,6 +738,7 @@ private void LoadGraphThrottlingSettings(KeyValueConfigurationCollection appSett
732738
var defDelayPerNode = 5;
733739
var defMaxRenderDelay = 1000;
734740
var defMinRenderCountForLongDelay = 10;
741+
var defMaxNodeRenderCount = 500;
735742

736743
if (appSettings == null)
737744
{
@@ -757,6 +764,10 @@ private void LoadGraphThrottlingSettings(KeyValueConfigurationCollection appSett
757764
// Fetch MinimumRenderCountToTriggerLongDelay setting
758765
result = appSettings["MinimumRenderCountToTriggerLongDelay"]?.Value ?? string.Empty;
759766
MinimumRenderCountToTriggerLongDelay = !int.TryParse(result, out settingValue) ? defMinRenderCountForLongDelay : settingValue;
767+
768+
// Fetch MaximumNodeRenderCount setting
769+
result = appSettings["MaximumNodeRenderCount"]?.Value ?? string.Empty;
770+
MaximumNodeRenderCount = !int.TryParse(result, out settingValue) ? defMaxNodeRenderCount : settingValue;
760771
}
761772
}
762773
}

0 commit comments

Comments
 (0)