Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 0a80c35de1
Fetching contributors…

Cannot retrieve contributors at this time

163 lines (151 sloc) 9.016 kb
<!--
[The "BSD licence"]
Copyright (c) 2011 Terence Parr
All rights reserved.
Conversion to C#:
Copyright (c) 2011 Sam Harwell, Tunnel Vision Laboratories, LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<UserControl x:Class="Antlr4.StringTemplate.Visualizer.TemplateVisualizerFrame"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Antlr4.StringTemplate.Visualizer"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.RowSpan="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TreeView Name="CallHierarchyTreeView" Grid.Column="0" Grid.ColumnSpan="1" SelectedItemChanged="HandleCallHierarchyTreeViewSelectedItemChanged"
ItemsSource="{Binding TemplateCallHierarchy}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<ContentPresenter Content="{Binding}">
<ContentPresenter.Resources>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsUserInstanced}" Value="true">
<Setter Property="FontWeight" Value="Bold" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentPresenter.Resources>
</ContentPresenter>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding IsExpanded}" />
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
<Setter Property="local:TreeViewItemDisplay.BringSelectionIntoView" Value="true" />
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
<GridSplitter Width="5" Grid.Column="1" Grid.ColumnSpan="1" ResizeBehavior="PreviousAndNext" />
<RichTextBox Name="OutputTextBox" Grid.Column="2" Grid.ColumnSpan="1" SelectionChanged="HandleOutputTextBoxSelectionChanged" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" />
</Grid>
<GridSplitter HorizontalAlignment="Stretch" Height="5" Grid.Row="1" Grid.RowSpan="1" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext" />
<Grid Grid.Row="2" Grid.RowSpan="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TreeView Name="AttributesListBox" Grid.Column="0" Grid.ColumnSpan="1" SelectedItemChanged="HandleAttributesTreeViewSelectedItemChanged"
ItemsSource="{Binding AttributeStack}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Attributes}">
<ContentPresenter Content="{Binding}">
<ContentPresenter.Resources>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsHidden}" Value="true">
<Setter Property="Foreground" Value="Gray" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentPresenter.Resources>
</ContentPresenter>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="True" />
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
<GridSplitter Width="5" Grid.Column="1" Grid.ColumnSpan="1" ResizeBehavior="PreviousAndNext" />
<TabControl Grid.Column="2" Grid.ColumnSpan="1">
<TabItem Header="Template">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<RichTextBox Grid.Column="0" Grid.ColumnSpan="1" Name="TemplateTextBox" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" />
<GridSplitter Grid.Column="1" Grid.ColumnSpan="1" Width="5" ResizeBehavior="PreviousAndNext" />
<TreeView Grid.Column="2" Grid.ColumnSpan="1" Name="AstTreeView" SelectedItemChanged="HandleAstTreeViewSelectedItemChanged"
ItemsSource="{Binding Ast.Children}">
<TreeView.Resources>
<local:AstNodeToStringConverter x:Key="AstNodeToStringConverter" />
</TreeView.Resources>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<ContentPresenter Content="{Binding Converter={StaticResource AstNodeToStringConverter}}" />
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Grid>
</TabItem>
<TabItem Header="Bytecode">
<Grid>
<TextBox Name="BytecodeTextBox" Text="{Binding Bytecode}" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" />
</Grid>
</TabItem>
<TabItem Header="Trace">
<Grid>
<ListBox Name="TraceListBox" ItemsSource="{Binding Trace}" />
</Grid>
</TabItem>
</TabControl>
</Grid>
<GridSplitter HorizontalAlignment="Stretch" Height="5" Grid.Row="3" Grid.RowSpan="1" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext" />
<!-- Errors -->
<ListBox Name="ErrorsListBox" MinHeight="50" Grid.Row="4" Grid.RowSpan="1"
SelectionChanged="HandleErrorsListBoxSelectionChanged"
ItemsSource="{Binding Errors}" />
</Grid>
</UserControl>
Jump to Line
Something went wrong with that request. Please try again.