Skip to content

Commit

Permalink
Added Font options and About Window
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergiu Marton committed Aug 1, 2018
1 parent db7b25f commit 1714b83
Show file tree
Hide file tree
Showing 8 changed files with 314 additions and 33 deletions.
103 changes: 103 additions & 0 deletions PseudoEditor/AboutWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<Window x:Class="PseudoEditor.AboutWindow"
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:PseudoEditor"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="Despre" Height="375" Width="350" ResizeMode="NoResize"
Icon="Images/Icons/info-icon.png"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{DynamicResource MaterialDesignFont}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="8"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="8"/>
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="8"/>
</Grid.ColumnDefinitions>

<TextBlock Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="WrapWithOverflow"
Text="PseudoEditor &amp; PseudocodeInterpreter" FontWeight="Bold"/>
<TextBlock Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="WrapWithOverflow"
Text="creat de Sergiu Marton (brown121407)" FontSize="11"/>

<Border Grid.Row="3" Grid.Column="1" BorderThickness="0 2 0 0" BorderBrush="{DynamicResource MaterialDesignDivider}" Margin="0 8 0 0"/>

<TextBlock Grid.Row="4" Grid.Column="1" Margin="0 8 0 0" TextWrapping="WrapWithOverflow"
Text="{Binding Source={x:Static local:StringResources.StayInTouch}}"/>

<Border Grid.Row="6" Grid.Column="1" BorderThickness="0 1 0 0" BorderBrush="{DynamicResource MaterialDesignDivider}" Margin="0 8 0 0">
<Grid Margin="8">
<Button HorizontalAlignment="Left" Style="{DynamicResource MaterialDesignFlatButton}" ToolTip="Repository-ul proiectului"
x:Name="GitHubButton" Click="GitHubButton_OnClick">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="GithubCircle" />
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center" Text="GitHub"/>
</StackPanel>
</Button>
<Button HorizontalAlignment="Right" Style="{DynamicResource MaterialDesignFlatButton}" ToolTip="Profilul meu de Twitter"
x:Name="TwitterButton" Click="TwitterButton_OnClick">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Twitter" />
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center" Text="Twitter"/>
</StackPanel>
</Button>
</Grid>
</Border>

<Border Grid.Column="1" Grid.Row="7" BorderThickness="0 1 0 0" BorderBrush="{DynamicResource MaterialDesignDivider}">
<Grid Margin="8">
<Button HorizontalAlignment="Left" Style="{DynamicResource MaterialDesignFlatButton}" ToolTip="Profilul meu de Instagram"
x:Name="InstagramButton" Click="InstagramButton_OnClick">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Instagram" />
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center" Text="Instagram"/>
</StackPanel>
</Button>
<Button HorizontalAlignment="Right" Style="{DynamicResource MaterialDesignFlatButton}" ToolTip="Trimite-mi un mail"
x:Name="EmailButton" Click="EmailButton_OnClick">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Email" />
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center" Text="Email"/>
</StackPanel>
</Button>
</Grid>
</Border>
<Border Grid.Row="8" Grid.Column="1" BorderThickness="0 1 0 0" BorderBrush="{DynamicResource MaterialDesignDivider}"/>

<materialDesign:Card Grid.Row="9" Grid.Column="1" Margin="0 8 0 0">
<StackPanel Orientation="Vertical" Margin="8">
<TextBlock Margin="0 0 0 8" Text="Credits" TextAlignment="Center" FontStyle="Italic" FontWeight="Bold"/>
<TextBlock>
<Hyperlink NavigateUri="https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit">Material Design in XAML Toolkit</Hyperlink> - Interfata
<LineBreak/>
<Hyperlink NavigateUri="http://avalonedit.net/">AvalonEdit</Hyperlink> - Controlul de baza al editorului
<LineBreak/>
<Hyperlink NavigateUri="http://www.antlr.org/">ANTLR</Hyperlink> - Unealta cu care am creat interpretorul
<LineBreak/>
<Hyperlink NavigateUri="https://icons8.com/" RequestNavigate="Hyperlink_OnRequestNavigate">Icons8</Hyperlink> - Unele imagini
</TextBlock>
</StackPanel>
</materialDesign:Card>
</Grid>
</Window>
55 changes: 55 additions & 0 deletions PseudoEditor/AboutWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace PseudoEditor
{
/// <summary>
/// Interaction logic for AboutWindow.xaml
/// </summary>
public partial class AboutWindow : Window
{
public AboutWindow()
{
InitializeComponent();
}


private void GitHubButton_OnClick(object sender, RoutedEventArgs e)
{
Process.Start("https://github.com/brown121407/PseudocodeInterpreter");
}

private void TwitterButton_OnClick(object sender, RoutedEventArgs e)
{
Process.Start("https://twitter.com/brown121407");
}

private void InstagramButton_OnClick(object sender, RoutedEventArgs e)
{
Process.Start("https://www.instagram.com/brown121407/");
}

private void EmailButton_OnClick(object sender, RoutedEventArgs e)
{
Process.Start("mailto://[email protected]");
}

private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e)
{
Process.Start(e.Uri.ToString());
}
}
}
30 changes: 30 additions & 0 deletions PseudoEditor/CustomCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace PseudoEditor
{
public static class CustomCommands
{
public static readonly RoutedUICommand Execute = new RoutedUICommand
(
"Execute",
"Execute",
typeof(CustomCommands),
new InputGestureCollection()
{
new KeyGesture(Key.F5, ModifierKeys.Control)
}
);

public static readonly RoutedUICommand About = new RoutedUICommand
(
"About",
"About",
typeof(CustomCommands)
);
}
}
Binary file added PseudoEditor/Images/Icons/info-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 45 additions & 30 deletions PseudoEditor/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:avalonEdit="clr-namespace:ICSharpCode.AvalonEdit;assembly=ICSharpCode.AvalonEdit"
mc:Ignorable="d"
Title="PseudoEditor - NewFile*" Height="600" Width="800" MinHeight="400" MinWidth="400"
Title="PseudoEditor - NewFile*" Height="600" Width="800" MinHeight="400" MinWidth="450"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{DynamicResource MaterialDesignFont}"
>
FontFamily="{DynamicResource MaterialDesignFont}">

<Window.CommandBindings>
<CommandBinding Command="Close" Executed="Close_Executed"/>
Expand All @@ -26,6 +25,8 @@
<CommandBinding Command="Cut"/>
<CommandBinding Command="Copy"/>
<CommandBinding Command="Paste"/>
<CommandBinding Command="local:CustomCommands.Execute" Executed="Execute_Executed"/>
<CommandBinding Command="local:CustomCommands.About" Executed="About_Executed"/>
</Window.CommandBindings>
<Window.InputBindings>
<KeyBinding Key="E" Modifiers="Control" Command="Close"/>
Expand Down Expand Up @@ -84,7 +85,7 @@
</MenuItem>
</MenuItem>
<MenuItem Header="_Ajutor">
<MenuItem Header="Despre">
<MenuItem Header="Despre" Command="local:CustomCommands.About">
<MenuItem.Icon>
<materialDesign:PackIcon Kind="Information"></materialDesign:PackIcon>
</MenuItem.Icon>
Expand Down Expand Up @@ -117,38 +118,52 @@
<materialDesign:PackIcon Kind="ContentPaste"/>
</Button>
<Separator/>
<Button ToolTip="{Binding Source={x:Static local:StringResources.Execute}}">
<Button ToolTip="{Binding Source={x:Static local:StringResources.Execute}}" Command="local:CustomCommands.Execute">
<materialDesign:PackIcon Kind="ArrowRightDropCircleOutline"/>
</Button>
<Separator/>
<StackPanel Orientation="Horizontal">
<Label Content="Font:" VerticalAlignment="Center"/>
<ComboBox x:Name="ComboBoxFontName" SelectionChanged="ComboBoxFontName_OnSelectionChanged"
Loaded="ComboBoxFontName_OnLoaded"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="8 0 0 0">
<Label Content="Mărime font:" VerticalAlignment="Center"/>
<ComboBox x:Name="ComboBoxFontSize" SelectionChanged="ComboBoxFontSize_OnSelectionChanged"
Loaded="ComboBoxFontSize_OnLoaded"/>
</StackPanel>
</ToolBar>
</ToolBarTray>

<avalonEdit:TextEditor x:Name="Editor" Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
FontFamily="Consolas" ShowLineNumbers="True" FontSize="16"
TextChanged="Editor_OnTextChanged">
<avalonEdit:TextEditor.ContextMenu>
<ContextMenu>
<MenuItem Header="{Binding Source={x:Static local:StringResources.Cut}}" Command="Cut">
<MenuItem.Icon>
<materialDesign:PackIcon Kind="ContentCut" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{Binding Source={x:Static local:StringResources.Copy}}" Command="Copy">
<MenuItem.Icon>
<materialDesign:PackIcon Kind="ContentCopy" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{Binding Source={x:Static local:StringResources.Paste}}" Command="Paste">
<MenuItem.Icon>
<materialDesign:PackIcon Kind="ContentPaste" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</avalonEdit:TextEditor.ContextMenu>
</avalonEdit:TextEditor>
<materialDesign:Card Grid.Row="2" Margin="8" materialDesign:ShadowAssist.ShadowDepth="Depth3">
<avalonEdit:TextEditor x:Name="Editor" Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
FontFamily="Consolas" ShowLineNumbers="True" FontSize="16"
TextChanged="Editor_OnTextChanged">
<avalonEdit:TextEditor.ContextMenu>
<ContextMenu>
<MenuItem Header="{Binding Source={x:Static local:StringResources.Cut}}" Command="Cut">
<MenuItem.Icon>
<materialDesign:PackIcon Kind="ContentCut" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{Binding Source={x:Static local:StringResources.Copy}}" Command="Copy">
<MenuItem.Icon>
<materialDesign:PackIcon Kind="ContentCopy" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{Binding Source={x:Static local:StringResources.Paste}}" Command="Paste">
<MenuItem.Icon>
<materialDesign:PackIcon Kind="ContentPaste" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</avalonEdit:TextEditor.ContextMenu>
</avalonEdit:TextEditor>
</materialDesign:Card>


<materialDesign:Card Grid.Row="3">
<materialDesign:Card Grid.Row="3" Margin="8" materialDesign:ShadowAssist.ShadowDepth="Depth3">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
Expand Down
Loading

0 comments on commit 1714b83

Please sign in to comment.