File tree Expand file tree Collapse file tree 5 files changed +24
-13
lines changed
Expand file tree Collapse file tree 5 files changed +24
-13
lines changed Original file line number Diff line number Diff line change 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" />
Original file line number Diff line number Diff line change @@ -63,15 +63,5 @@ Global
6363 GlobalSection (ExtensibilityGlobals ) = postSolution
6464 SolutionGuid = {A1CB1A18-09C5-4D7F-916D-2346D29A8563}
6565 EndGlobalSection
66- GlobalSection (AutomaticVersions ) = postSolution
67- UpdateAssemblyVersion .Release| Any CPU = True
68- UpdateAssemblyFileVersion .Release| Any CPU = True
69- UpdateAssemblyInfoVersion .Release| Any CPU = True
70- AssemblyVersionSettings .Release| Any CPU = None .None .DateStamp .IncrementWithResetOnIncrease
7166 AssemblyFileVersionSettings .Release| Any CPU = None .None .DateStamp .IncrementWithResetOnIncrease
72- AssemblyInfoVersionSettings .Release| Any CPU = None .None .DateStamp .IncrementWithResetOnIncrease
73- UpdatePackageVersion .Release| Any CPU = False
74- AssemblyInfoVersionType .Release| Any CPU = SettingsVersion
75- InheritWinAppVersionFrom .Release| Any CPU = None
76- EndGlobalSection
7767EndGlobal
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments