first commit
This commit is contained in:
@@ -0,0 +1,284 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.MacrosTabControl"
|
||||
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:avalon="http://icsharpcode.net/sharpdevelop/avalonedit"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:controls="clr-namespace:ClassicAssist.UI.Controls"
|
||||
xmlns:local="clr-namespace:ClassicAssist.Data.Macros"
|
||||
xmlns:misc="clr-namespace:ClassicAssist.UI.Misc"
|
||||
xmlns:viewModels="clr-namespace:ClassicAssist.UI.ViewModels;assembly=ClassicAssist.Shared"
|
||||
xmlns:valueConverters="clr-namespace:ClassicAssist.UI.Misc.ValueConverters"
|
||||
xmlns:macros="clr-namespace:ClassicAssist.Data.Macros;assembly=ClassicAssist.Shared"
|
||||
xmlns:hotkeys1="clr-namespace:ClassicAssist.Data.Hotkeys;assembly=ClassicAssist.Shared"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="500" Padding="5">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Resources/Icons.xaml" />
|
||||
<ResourceDictionary Source="../../Resources/ResourceDictionary.xaml" />
|
||||
<ResourceDictionary Source="../../Resources/LeftRightIconToggleButton.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<valueConverters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
|
||||
<valueConverters:CellWidthValueConverter x:Key="CellWidthValueConverter" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<UserControl.DataContext>
|
||||
<viewModels:MacrosTabViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition>
|
||||
<ColumnDefinition.Style>
|
||||
<Style TargetType="{x:Type ColumnDefinition}">
|
||||
<Setter Property="Width" Value="155" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsChecked, ElementName=ToggleButton}" Value="True">
|
||||
<Setter Property="Width" Value="0" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ColumnDefinition.Style>
|
||||
</ColumnDefinition>
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0" Margin="0,0,5,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox Grid.Row="0" ItemsSource="{Binding Items}" x:Name="ListBox"
|
||||
SelectedItem="{Binding SelectedItem}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
MinHeight="40" HorizontalContentAlignment="Stretch"
|
||||
IsEnabled="{Binding IsRecording, Converter={StaticResource InverseBooleanConverter}}"
|
||||
misc:ListBoxBehavior.ScrollOnNewItem="True">
|
||||
<ListBox.InputBindings>
|
||||
<KeyBinding Modifiers="Control" Key="Delete"
|
||||
Command="{Binding RemoveMacroCommand}"
|
||||
CommandParameter="{Binding SelectedItem}" />
|
||||
<KeyBinding Key="Delete"
|
||||
Command="{Binding RemoveMacroConfirmCommand}"
|
||||
CommandParameter="{Binding SelectedItem}" />
|
||||
</ListBox.InputBindings>
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:ItemsControlSelectNewEntryBehaviour SelectedItem="{Binding SelectedItem}"
|
||||
Type="{x:Type macros:MacroEntry}" />
|
||||
</i:Interaction.Behaviors>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" x:Name="LeftColumn" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:EditTextBlock
|
||||
Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" Grid.Column="0"
|
||||
Width="{Binding ActualWidth, ConverterParameter=20, Converter={StaticResource CellWidthValueConverter}, ElementName=LeftColumn, Mode=OneWay}">
|
||||
<controls:EditTextBlock.Resources>
|
||||
<Style TargetType="{x:Type TextBlock}"
|
||||
BasedOn="{StaticResource {x:Type TextBlock}}">
|
||||
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger
|
||||
Binding="{Binding Global}" Value="True">
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
</DataTrigger>
|
||||
<DataTrigger
|
||||
Binding="{Binding IsRunning}" Value="True">
|
||||
<Setter Property="FontStyle" Value="Italic" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</controls:EditTextBlock.Resources>
|
||||
</controls:EditTextBlock>
|
||||
<TextBlock x:Name="Hotkey" Text="{Binding Hotkey}" Margin="2,0,0,0"
|
||||
Grid.Column="1" FontSize="7" Foreground="SpringGreen" TextAlignment="Right"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Hotkey}"
|
||||
Value="{x:Static hotkeys1:ShortcutKeys.Default}">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<Grid Grid.Row="1" Margin="0,5,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.Resources>
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="FontSize" Value="10" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Button Content="{x:Static resources:Strings.Remove}" Grid.Column="0" Margin="0,0,2.5,0"
|
||||
Command="{Binding RemoveMacroConfirmCommand, Mode=OneWay}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=ListBox}">
|
||||
<Button.Style>
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=SelectedItem, ElementName=ListBox}"
|
||||
Value="{x:Null}">
|
||||
<Setter Property="IsEnabled" Value="False" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
<Button Content="{x:Static resources:Strings.New}" Grid.Column="1" Margin="2.5,0"
|
||||
Command="{Binding NewMacroCommand, Mode=OneWay}" />
|
||||
<Button Content="{x:Static resources:Strings.Save}" Grid.Column="2" Margin="2.5,0,0,0"
|
||||
Command="{Binding SaveMacroCommand, Mode=OneWay}" CommandParameter="{Binding SelectedItem}" />
|
||||
</Grid>
|
||||
<Grid Grid.Row="2" Margin="0,5,0,5">
|
||||
<Button Content="{Binding RecordLabel}" Command="{Binding RecordCommand}" />
|
||||
</Grid>
|
||||
<Grid Grid.Row="3" Margin="0,0,0,0">
|
||||
<Grid.Resources>
|
||||
<valueConverters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
|
||||
</Grid.Resources>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="{x:Static resources:Strings.Play}" Grid.Column="0" Margin="0,0,2.5,0"
|
||||
Command="{Binding ExecuteCommand, Mode=OneWay}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=ListBox}"
|
||||
IsEnabled="{Binding SelectedItem.IsRunning, Converter={StaticResource InverseBooleanConverter}, ElementName=ListBox}" />
|
||||
<Button Content="{x:Static resources:Strings.Stop}" Grid.Column="1" Margin="2.5,0,0,0"
|
||||
IsEnabled="{Binding SelectedItem.IsRunning, ElementName=ListBox}"
|
||||
Command="{Binding StopCommand, Mode=OneWay}" CommandParameter="{Binding SelectedItem}" />
|
||||
</Grid>
|
||||
<GroupBox Header="{x:Static resources:Strings.Hotkeys}" Grid.Row="5" Padding="5" Margin="0,5,0,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<controls:TextBoxKey Shortcut="{Binding Hotkey}" Grid.Row="0" />
|
||||
<CheckBox Content="{x:Static resources:Strings.Pass_to_UO}" Grid.Row="1" Padding="4,-1,0,0"
|
||||
Margin="0,5,0,0" IsChecked="{Binding SelectedItem.PassToUO}" />
|
||||
<Button Content="{x:Static resources:Strings.Clear}" Grid.Row="2" Padding="1,0,1,1"
|
||||
Margin="0,5,0,0" Command="{Binding ClearHotkeyCommand, Mode=OneWay}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=ListBox}" />
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" />
|
||||
<Grid Grid.Column="2" Initialized="Grid_Initialized" Margin="5,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<avalon:TextEditor ShowLineNumbers="True" x:Name="CodeTextEditor" Grid.Row="0"
|
||||
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
|
||||
FontFamily="Consolas">
|
||||
<avalon:TextEditor.InputBindings>
|
||||
<KeyBinding Modifiers="Control" Key="S" Command="{Binding SaveMacroCommand}" />
|
||||
</avalon:TextEditor.InputBindings>
|
||||
<avalon:TextEditor.Style>
|
||||
<Style TargetType="{x:Type avalon:TextEditor}"
|
||||
BasedOn="{StaticResource {x:Type avalon:TextEditor}}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding SelectedItem, ElementName=ListBox}" Value="{x:Null}">
|
||||
<Setter Property="IsEnabled" Value="False" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsRecording}" Value="True">
|
||||
<Setter Property="IsEnabled" Value="False" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</avalon:TextEditor.Style>
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:AvalonEditBehaviour
|
||||
TextBinding="{Binding SelectedItem.Macro, ElementName=ListBox, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<misc:AvalonBindingBehaviour DocumentBinding="{Binding Document}"
|
||||
CaretBinding="{Binding CaretPosition}" />
|
||||
</i:Interaction.Behaviors>
|
||||
</avalon:TextEditor>
|
||||
<WrapPanel Orientation="Horizontal" Grid.Row="1" Margin="5">
|
||||
<WrapPanel.Resources>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource {x:Type CheckBox}}">
|
||||
<Setter Property="Margin" Value="0,0,10,0" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=SelectedItem, ElementName=ListBox}"
|
||||
Value="{x:Null}">
|
||||
<Setter Property="IsEnabled" Value="False" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</WrapPanel.Resources>
|
||||
<CheckBox Content="{x:Static resources:Strings.Loop}"
|
||||
IsChecked="{Binding SelectedItem.Loop, ElementName=ListBox}" />
|
||||
<CheckBox Content="{x:Static resources:Strings.Do_not_auto_interupt}"
|
||||
IsChecked="{Binding SelectedItem.DoNotAutoInterrupt, ElementName=ListBox}" />
|
||||
<CheckBox Content="{x:Static resources:Strings.Run_in_background}"
|
||||
IsChecked="{Binding SelectedItem.IsBackground, ElementName=ListBox}" />
|
||||
<CheckBox Content="{x:Static resources:Strings.Autostart}"
|
||||
IsChecked="{Binding SelectedItem.IsAutostart, ElementName=ListBox}"
|
||||
ToolTip="{x:Static resources:Strings.When_checked_macro_will_execute_automatically_after_login_}" />
|
||||
<CheckBox Content="{x:Static resources:Strings.Undisableable}"
|
||||
ToolTip="{x:Static resources:Strings.Hotkey_will_still_trigger_with_hotkeys_disabled}"
|
||||
IsChecked="{Binding SelectedItem.Disableable, Converter={StaticResource InverseBooleanConverter}}" />
|
||||
<CheckBox Content="{x:Static resources:Strings.Global}"
|
||||
ToolTip="{x:Static resources:Strings.Loaded_to_all_profiles}"
|
||||
IsChecked="{Binding SelectedItem.Global}" />
|
||||
</WrapPanel>
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ToggleButton x:Name="ToggleButton" Height="15" Grid.Column="0" Margin="0"
|
||||
Style="{DynamicResource LeftRightIconToggleButton}" VerticalAlignment="Bottom" />
|
||||
<controls:StretchyWrapPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Center">
|
||||
<controls:StretchyWrapPanel.Resources>
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Margin" Value="0,10,10,0" />
|
||||
<Setter Property="Padding" Value="10,0,10,0" />
|
||||
<Setter Property="Height" Value="25" />
|
||||
</Style>
|
||||
</controls:StretchyWrapPanel.Resources>
|
||||
<Button Content="{x:Static resources:Strings.Object_Inspector}"
|
||||
Command="{Binding InspectObjectCommand, Mode=OneWay}" />
|
||||
<Button Content="{x:Static resources:Strings.Commands}" Command="{Binding ShowCommandsCommand}" />
|
||||
<Button Command="{Binding ShowMacrosWikiCommand}" Padding="5,0,5,0"
|
||||
ToolTip="{x:Static resources:Strings.Macro_Commands_Wiki__Launches_in_Browser_}">
|
||||
<Image Source="{StaticResource WebIcon}" Height="16" />
|
||||
</Button>
|
||||
<Button Content="{x:Static resources:Strings.Active_Objects}"
|
||||
Command="{Binding ShowActiveObjectsWindowCommand}" />
|
||||
</controls:StretchyWrapPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user