279 lines
14 KiB
XML
279 lines
14 KiB
XML
<Window x:Class="Nodify.Calculator.MainWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:local="clr-namespace:Nodify.Calculator"
|
|
xmlns:shared="clr-namespace:Nodify;assembly=Nodify.Shared"
|
|
Background="{DynamicResource NodifyEditor.BackgroundBrush}"
|
|
Foreground="{DynamicResource ForegroundBrush}"
|
|
mc:Ignorable="d"
|
|
Title="MainWindow"
|
|
Height="650"
|
|
Width="1200">
|
|
<Window.DataContext>
|
|
<local:ApplicationViewModel />
|
|
</Window.DataContext>
|
|
|
|
<Window.InputBindings>
|
|
<KeyBinding Key="T"
|
|
Modifiers="Ctrl"
|
|
Command="{Binding Source={x:Static shared:ThemeManager.SetNextThemeCommand}}" />
|
|
<KeyBinding Key="N"
|
|
Modifiers="Ctrl"
|
|
Command="{Binding AddEditorCommand}" />
|
|
|
|
<KeyBinding Key="R"
|
|
Modifiers="Ctrl"
|
|
Command="{Binding RunFlowCommand}" />
|
|
|
|
<KeyBinding Key="S"
|
|
Modifiers="Ctrl"
|
|
Command="{Binding SaveFileCommand}" />
|
|
|
|
<KeyBinding Key="O"
|
|
Modifiers="Ctrl"
|
|
Command="{Binding OpenFileCommand}" />
|
|
|
|
<KeyBinding Key="W"
|
|
Modifiers="Ctrl"
|
|
Command="{Binding CloseEditorCommand}"
|
|
CommandParameter="{Binding SelectedEditor.Id}"/>
|
|
</Window.InputBindings>
|
|
|
|
<Window.Resources>
|
|
<shared:BindingProxy x:Key="Proxy"
|
|
DataContext="{Binding}"/>
|
|
|
|
<DataTemplate DataType="{x:Type local:EditorViewModel}">
|
|
<local:EditorView/>
|
|
</DataTemplate>
|
|
</Window.Resources>
|
|
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" MinHeight="0" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<shared:TabControlEx Grid.Row="0"
|
|
ItemsSource="{Binding Editors}"
|
|
SelectedItem="{Binding SelectedEditor}"
|
|
AddTabCommand="{Binding AddEditorCommand}"
|
|
AutoScrollToEnd="{Binding AutoSelectNewEditor}">
|
|
<shared:TabControlEx.ItemContainerStyle>
|
|
<Style TargetType="{x:Type shared:TabItemEx}"
|
|
BasedOn="{StaticResource {x:Type shared:TabItemEx}}">
|
|
<Setter Property="Header"
|
|
Value="{Binding Name}"/>
|
|
<Setter Property="CloseTabCommand"
|
|
Value="{Binding DataContext.CloseEditorCommand ,Source={StaticResource Proxy}}"/>
|
|
<Setter Property="CloseTabCommandParameter"
|
|
Value="{Binding Id}"/>
|
|
<Setter Property="ToolTip"
|
|
Value="Double click to edit" />
|
|
</Style>
|
|
</shared:TabControlEx.ItemContainerStyle>
|
|
</shared:TabControlEx>
|
|
|
|
<!-- Log Panel -->
|
|
<Border Grid.Row="1" Height="3" Cursor="SizeNS"
|
|
Background="Transparent">
|
|
<Border.Style>
|
|
<Style TargetType="Border">
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding LogPanel.IsOpen}" Value="False">
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Border.Style>
|
|
<GridSplitter HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Background="#FF3F3F46"
|
|
ResizeBehavior="PreviousAndNext"
|
|
ResizeDirection="Rows" />
|
|
</Border>
|
|
|
|
<Border Grid.Row="2" Background="#FF1E1E1E" BorderBrush="#FF3F3F46" BorderThickness="0,1,0,0">
|
|
<Border.Style>
|
|
<Style TargetType="Border">
|
|
<Setter Property="Height" Value="180" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding LogPanel.IsOpen}" Value="False">
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
<Setter Property="Height" Value="0" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Border.Style>
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="28" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- Header bar -->
|
|
<Border Grid.Row="0" Background="#FF2D2D30" BorderBrush="#FF3F3F46" BorderThickness="0,0,0,1">
|
|
<DockPanel Margin="8,0">
|
|
<TextBlock Text="⚡ Output" VerticalAlignment="Center" Foreground="#FFDCDCDC" FontWeight="SemiBold" FontSize="12" />
|
|
<TextBlock VerticalAlignment="Center" Margin="10,0,0,0" Foreground="#FF888888" FontSize="11">
|
|
<TextBlock.Style>
|
|
<Style TargetType="TextBlock">
|
|
<Setter Property="Text" Value="" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding LogPanel.IsRunning}" Value="True">
|
|
<Setter Property="Text" Value="● Running..." />
|
|
<Setter Property="Foreground" Value="#FF4EC9B0" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</TextBlock.Style>
|
|
</TextBlock>
|
|
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right">
|
|
<Button Content="🗑 Clear" Command="{Binding LogPanel.ClearLogsCommand}"
|
|
Background="Transparent" Foreground="#FFAAAAAA" BorderThickness="0"
|
|
Padding="6,2" FontSize="11" Cursor="Hand" Margin="0,0,4,0" />
|
|
<Button Content="💾 Export" Command="{Binding LogPanel.ExportLogsCommand}"
|
|
ToolTip="Export all logs to a file"
|
|
Background="Transparent" Foreground="#FFAAAAAA" BorderThickness="0"
|
|
Padding="6,2" FontSize="11" Cursor="Hand" Margin="0,0,4,0" />
|
|
<Button Content="✕" Command="{Binding LogPanel.ClosePanelCommand}"
|
|
Background="Transparent" Foreground="#FFAAAAAA" BorderThickness="0"
|
|
Padding="6,2" FontSize="11" Cursor="Hand" />
|
|
</StackPanel>
|
|
</DockPanel>
|
|
</Border>
|
|
|
|
<!-- Log entries -->
|
|
<ListBox Grid.Row="1" x:Name="LogListBox"
|
|
ItemsSource="{Binding LogPanel.LogEntries}"
|
|
Background="#FF1E1E1E" BorderThickness="0"
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
|
VirtualizingStackPanel.IsVirtualizing="True"
|
|
FontFamily="Consolas" FontSize="12">
|
|
<ListBox.ItemContainerStyle>
|
|
<Style TargetType="ListBoxItem">
|
|
<Setter Property="Padding" Value="8,1" />
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
<Setter Property="Focusable" Value="False" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="ListBoxItem">
|
|
<Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}">
|
|
<ContentPresenter />
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</ListBox.ItemContainerStyle>
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<TextBlock TextWrapping="NoWrap">
|
|
<Run Text="{Binding Timestamp, Mode=OneTime}" Foreground="#FF608B4E" />
|
|
<Run Text=" " />
|
|
<Run Text="{Binding Message, Mode=OneTime}" Foreground="{Binding Color, Mode=OneTime}" />
|
|
</TextBlock>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<Expander Grid.Row="0" Header="Click to hide/show"
|
|
IsExpanded="False"
|
|
Margin="10"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Bottom">
|
|
<Border MaxWidth="325"
|
|
MaxHeight="300"
|
|
CornerRadius="3">
|
|
<Border.Background>
|
|
<SolidColorBrush Color="{DynamicResource BackgroundColor}"
|
|
Opacity="0.7" />
|
|
</Border.Background>
|
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
|
|
<StackPanel Margin="10"
|
|
IsHitTestVisible="False">
|
|
<StackPanel.Resources>
|
|
<Style TargetType="{x:Type TextBlock}"
|
|
BasedOn="{StaticResource {x:Type TextBlock}}">
|
|
<Setter Property="Margin"
|
|
Value="0 0 0 5" />
|
|
</Style>
|
|
</StackPanel.Resources>
|
|
|
|
<StackPanel Margin="0 0 0 20">
|
|
<TextBlock Text="(New) Drag and drop nodes from the toolbox"
|
|
TextWrapping="Wrap"
|
|
Foreground="{DynamicResource NodeInput.BorderBrush}"
|
|
FontWeight="Bold"/>
|
|
</StackPanel>
|
|
<TextBlock TextWrapping="Wrap">
|
|
<Run Foreground="Red"
|
|
FontWeight="Bold">CTRL + N/W</Run>
|
|
<Run>: open/close editor</Run>
|
|
</TextBlock>
|
|
<TextBlock TextWrapping="Wrap">
|
|
<Run Foreground="Red"
|
|
FontWeight="Bold">CTRL + R</Run>
|
|
<Run>: Run Flow</Run>
|
|
</TextBlock>
|
|
<TextBlock TextWrapping="Wrap">
|
|
<Run Foreground="Red"
|
|
FontWeight="Bold">CTRL + S</Run>
|
|
<Run>: Save Flow</Run>
|
|
</TextBlock>
|
|
<TextBlock TextWrapping="Wrap">
|
|
<Run Foreground="Red"
|
|
FontWeight="Bold">CTRL + O</Run>
|
|
<Run>: Open Saved Flow</Run>
|
|
</TextBlock>
|
|
<TextBlock TextWrapping="Wrap">
|
|
<Run Foreground="Red"
|
|
FontWeight="Bold">ALT + Click</Run>
|
|
<Run>: disconnect connector</Run>
|
|
</TextBlock>
|
|
<TextBlock TextWrapping="Wrap">
|
|
<Run Foreground="Red"
|
|
FontWeight="Bold">Right Click</Run>
|
|
<Run>: show operations menu (create nodes)</Run>
|
|
</TextBlock>
|
|
<TextBlock TextWrapping="Wrap">
|
|
<Run Foreground="Red"
|
|
FontWeight="Bold">Delete</Run>
|
|
<Run>: delete selection</Run>
|
|
</TextBlock>
|
|
<TextBlock TextWrapping="Wrap">
|
|
<Run Foreground="Red"
|
|
FontWeight="Bold">CTRL + T</Run>
|
|
<Run>: change theme</Run>
|
|
</TextBlock>
|
|
<TextBlock TextWrapping="Wrap">
|
|
<Run Foreground="Red"
|
|
FontWeight="Bold">CTRL + G</Run>
|
|
<Run>: group selection (hold SHIFT and mouse drag the header to move the group node alone)</Run>
|
|
</TextBlock>
|
|
<TextBlock Text="Drag a connection and drop it on the editor"
|
|
TextWrapping="Wrap"
|
|
FontWeight="Bold" />
|
|
<TextBlock Text="Hover over a connector to see its value"
|
|
TextWrapping="Wrap"
|
|
FontWeight="Bold" />
|
|
<TextBlock Text="Create a Calculator node and double click it to open"
|
|
TextWrapping="Wrap"
|
|
FontWeight="Bold" />
|
|
<TextBlock Text="Create an Operation Graph and add operations to it"
|
|
TextWrapping="Wrap"
|
|
FontWeight="Bold" />
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</Border>
|
|
</Expander>
|
|
</Grid>
|
|
</Window>
|