Skip to content

Commit

Permalink
Updated branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyamahunt committed Apr 20, 2020
2 parents 67d0771 + 07fa99a commit 74262ee
Show file tree
Hide file tree
Showing 24 changed files with 175 additions and 129 deletions.
65 changes: 43 additions & 22 deletions src/Notepads.Controls/SetsView/SetsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
<StaticResource x:Key="SetsViewItemHeaderRevealBorderBrush"
ResourceKey="SystemControlBackgroundTransparentRevealBorderBrush" />
<x:Double x:Key="SetsEdgeShadowOpacity">0.4</x:Double>
<x:Double x:Key="SetsEdgeShadowOpacity">0.55</x:Double>
<RevealBackgroundBrush x:Key="SetsViewItemRevealBackgroundBrush"
Color="Gray"
Opacity="0.3"
Expand Down Expand Up @@ -66,7 +66,7 @@
ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
<StaticResource x:Key="SetsViewItemHeaderRevealBorderBrush"
ResourceKey="SystemControlBackgroundTransparentRevealBorderBrush" />
<x:Double x:Key="SetsEdgeShadowOpacity">0.4</x:Double>
<x:Double x:Key="SetsEdgeShadowOpacity">0.7</x:Double>
<RevealBackgroundBrush x:Key="SetsViewItemRevealBackgroundBrush"
Color="Transparent"
FallbackColor="Transparent" />
Expand Down Expand Up @@ -126,26 +126,23 @@
FalseValue="{StaticResource SetsViewItemHeaderCloseWidth}"
TrueValue="NaN" />

<Style x:Key="TopEdgeShadowStyle"
TargetType="controls:DropShadowPanel">
<Style x:Key="TopEdgeShadowStyle" TargetType="controls:DropShadowPanel">
<Setter Property="BlurRadius" Value="10" />
<Setter Property="ShadowOpacity" Value="{ThemeResource SetsEdgeShadowOpacity}" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>

<Style x:Key="BottomEdgeShadowStyle"
TargetType="controls:DropShadowPanel">
<Style x:Key="BottomEdgeShadowStyle" TargetType="controls:DropShadowPanel">
<Setter Property="BlurRadius" Value="10" />
<Setter Property="ShadowOpacity" Value="{ThemeResource SetsEdgeShadowOpacity}" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>

<Style x:Key="SideEdgeShadowStyle"
TargetType="controls:DropShadowPanel">
<Style x:Key="SideEdgeShadowStyle" TargetType="controls:DropShadowPanel">
<Setter Property="BlurRadius" Value="8" />
<Setter Property="ShadowOpacity" Value="{ThemeResource SetsEdgeShadowOpacity}" />
<Setter Property="Visibility" Value="Collapsed" />
Expand Down Expand Up @@ -223,11 +220,15 @@
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}" />

<!-- Shadow under Start Header -->
<controls:DropShadowPanel
Style="{StaticResource BottomEdgeShadowStyle}"
Grid.Row="1"
Grid.Column="0">
<Grid Height="1"/>
<Grid Height="1" Margin="0,0,-2,-1"/>
<controls:DropShadowPanel.Clip>
<RectangleGeometry Rect="0,-12,1024,12"></RectangleGeometry>
</controls:DropShadowPanel.Clip>
</controls:DropShadowPanel>

<ContentPresenter Grid.Row="1"
Expand Down Expand Up @@ -256,11 +257,15 @@
Padding="{TemplateBinding Padding}" />
</ScrollViewer>

<!-- Shadow under Add Button -->
<controls:DropShadowPanel
Style="{StaticResource BottomEdgeShadowStyle}"
Grid.Row="1"
Grid.Column="3">
<Grid Height="1"/>
<Grid Height="1" Margin="-1,0,0,-1"/>
<controls:DropShadowPanel.Clip>
<RectangleGeometry Rect="0,-12,1024,12"></RectangleGeometry>
</controls:DropShadowPanel.Clip>
</controls:DropShadowPanel>

<ContentPresenter Grid.Row="1"
Expand All @@ -269,11 +274,15 @@
Content="{TemplateBinding SetsActionHeader}"
ContentTemplate="{TemplateBinding SetsActionHeaderTemplate}" />

<!-- Shadow under Padding area (23040 = 3 x 8k resolution in width just in case) -->
<controls:DropShadowPanel
Style="{StaticResource BottomEdgeShadowStyle}"
Grid.Row="1"
Grid.Column="4">
<Grid Height="1"/>
<Grid Height="1" Margin="0,0,0,-1"/>
<controls:DropShadowPanel.Clip>
<RectangleGeometry Rect="0,-12,23040,12"></RectangleGeometry>
</controls:DropShadowPanel.Clip>
</controls:DropShadowPanel>

<ContentPresenter Grid.Row="1"
Expand All @@ -282,11 +291,15 @@
Content="{TemplateBinding SetsPaddingHeader}"
ContentTemplate="{TemplateBinding SetsPaddingHeaderTemplate}" />

<!-- Shadow under SetsEndHeader -->
<controls:DropShadowPanel
Style="{StaticResource BottomEdgeShadowStyle}"
Grid.Row="1"
Grid.Column="5">
<Grid Height="1"/>
<Grid Height="1" Margin="0,0,0,-1"/>
<controls:DropShadowPanel.Clip>
<RectangleGeometry Rect="0,-12,1024,12"></RectangleGeometry>
</controls:DropShadowPanel.Clip>
</controls:DropShadowPanel>

<ContentPresenter Grid.Row="1"
Expand All @@ -303,13 +316,17 @@
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" />

<!-- Shadow above Footer -->
<controls:DropShadowPanel
Style="{StaticResource TopEdgeShadowStyle}"
Canvas.ZIndex="50"
Grid.Row="3"
Grid.ColumnSpan="6"
Grid.Column="0">
<Grid Height="1"/>
<controls:DropShadowPanel.Clip>
<RectangleGeometry Rect="0,0,23040,12"></RectangleGeometry>
</controls:DropShadowPanel.Clip>
</controls:DropShadowPanel>

<ContentPresenter Grid.Row="3"
Expand Down Expand Up @@ -951,10 +968,14 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<!-- Scroll to the left button bottom shadow -->
<controls:DropShadowPanel
Style="{StaticResource BottomEdgeShadowStyle}"
Grid.Column="0">
<Grid Height="1"/>
<Grid Height="1" Margin="-1,0,0,-1"/>
<controls:DropShadowPanel.Clip>
<RectangleGeometry Rect="-1,-12,1024,12"></RectangleGeometry>
</controls:DropShadowPanel.Clip>
</controls:DropShadowPanel>

<RepeatButton x:Name="SetsScrollBackButton"
Expand All @@ -970,43 +991,43 @@
&#xE76B;
</RepeatButton>

<!-- SetsItemsScrollViewer left side shadow -->
<controls:DropShadowPanel
x:Name="SetsItemsScrollViewerLeftSideShadow"
Style="{StaticResource SideEdgeShadowStyle}"
Grid.Column="1"
HorizontalAlignment="Left">

<Grid Width="1"/>
<controls:DropShadowPanel.Clip>
<RectangleGeometry Rect="-10,0,10,32"></RectangleGeometry>
</controls:DropShadowPanel.Clip>

<Grid Width="1"/>

</controls:DropShadowPanel>

<!-- SetsItemsScrollViewer right side shadow -->
<controls:DropShadowPanel
x:Name="SetsItemsScrollViewerRightSideShadow"
Style="{StaticResource SideEdgeShadowStyle}"
Grid.Column="1"
HorizontalAlignment="Right">

<Grid Width="1"/>
<controls:DropShadowPanel.Clip>
<RectangleGeometry Rect="1,0,10,32"></RectangleGeometry>
</controls:DropShadowPanel.Clip>

<Grid Width="1"/>

</controls:DropShadowPanel>

<ScrollContentPresenter x:Name="ScrollContentPresenter"
Grid.Column="1"
TabFocusNavigation="Once"
Margin="{TemplateBinding Padding}"/>

<!-- Scroll to the right button bottom shadow -->
<controls:DropShadowPanel
Style="{StaticResource BottomEdgeShadowStyle}"
Grid.Column="2">
<Grid Height="1"/>
<Grid Height="1" Margin="0,0,0,-1"/>
<controls:DropShadowPanel.Clip>
<RectangleGeometry Rect="0,-12,1024,12"></RectangleGeometry>
</controls:DropShadowPanel.Clip>
</controls:DropShadowPanel>

<RepeatButton x:Name="SetsScrollForwardButton"
Expand Down
4 changes: 2 additions & 2 deletions src/Notepads/Controls/DiffViewer/SideBySideDiffViewer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
using System.Threading;
using System.Threading.Tasks;
using Notepads.Commands;
using Notepads.Extensions;
using Notepads.Services;
using Notepads.Utilities;
using Windows.System;
using Windows.UI;
using Windows.UI.Core;
Expand Down Expand Up @@ -70,7 +70,7 @@ private void SideBySideDiffViewer_Loaded(object sender, RoutedEventArgs e)

private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
{
await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
await Dispatcher.CallOnUIThreadAsync(() =>
{
LeftBox.SelectionHighlightColor = new SolidColorBrush(color);
RightBox.SelectionHighlightColor = new SolidColorBrush(color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using System;
using System.Collections.Generic;
using Notepads.Commands;
using Notepads.Extensions;
using Notepads.Services;
using Notepads.Utilities;
using Windows.System;
using Windows.UI;
using Windows.UI.Core;
Expand Down Expand Up @@ -64,7 +64,7 @@ private void FindAndReplaceControl_Loaded(object sender, RoutedEventArgs e)

private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
{
await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
await Dispatcher.CallOnUIThreadAsync(() =>
{
SetSelectionHighlightColor(color);
});
Expand Down
4 changes: 2 additions & 2 deletions src/Notepads/Controls/GoTo/GoToControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace Notepads.Controls.GoTo
{
using System;
using Notepads.Extensions;
using Notepads.Services;
using Notepads.Utilities;
using Windows.ApplicationModel.Resources;
using Windows.System;
using Windows.UI;
Expand Down Expand Up @@ -51,7 +51,7 @@ private void GoToControl_Loaded(object sender, RoutedEventArgs e)

private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
{
await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
await Dispatcher.CallOnUIThreadAsync(() =>
{
SetSelectionHighlightColor(color);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public MarkdownExtensionView()

private async void OnThemeChanged(object sender, ElementTheme theme)
{
await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
await Dispatcher.CallOnUIThreadAsync(() =>
{
MarkdownTextBlock.RequestedTheme = theme;
});
Expand Down
8 changes: 5 additions & 3 deletions src/Notepads/Controls/TextEditor/TextEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,14 @@
<controls:DropShadowPanel
Canvas.ZIndex="50"
Grid.Column="1"
ShadowOpacity="0.4"
ShadowOpacity="0.3"
BlurRadius="12"
Margin="-1,0"
VerticalAlignment="Stretch"
HorizontalAlignment="Left">
<Grid Width="1"/>
<Grid Width="2"/>
<controls:DropShadowPanel.Clip>
<RectangleGeometry Rect="-12,0,12,12960"></RectangleGeometry>
</controls:DropShadowPanel.Clip>
</controls:DropShadowPanel>
<ContentPresenter x:Name="SplitPanel"
x:Load="False"
Expand Down
18 changes: 9 additions & 9 deletions src/Notepads/Controls/TextEditor/TextEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,14 @@ public void Dispose()

private async void ThemeSettingsService_OnThemeChanged(object sender, ElementTheme theme)
{
await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
await Dispatcher.CallOnUIThreadAsync(() =>
{
if (Mode == TextEditorMode.DiffPreview)
{
SideBySideDiffViewer.RenderDiff(LastSavedSnapshot.Content, TextEditorCore.GetText(), theme);
Task.Factory.StartNew(async () =>
{
await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () => { SideBySideDiffViewer.Focus(); });
await Dispatcher.CallOnUIThreadAsync(() => { SideBySideDiffViewer.Focus(); });
});
}
});
Expand Down Expand Up @@ -400,7 +400,7 @@ private async Task CheckAndUpdateFileStatus(CancellationToken cancellationToken)
return;
}

await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
await Dispatcher.CallOnUIThreadAsync(() =>
{
FileModificationState = newState.Value;
});
Expand Down Expand Up @@ -1071,7 +1071,7 @@ private void DrawLineHighlighter()

private async void LineHighlighter_OnViewStateChanged(object sender, bool enabled)
{
await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
await Dispatcher.CallOnUIThreadAsync(() =>
{
if (enabled)
{
Expand All @@ -1087,15 +1087,15 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>

private async void LineHighlighter_OnSelectionChanged(object sender, RoutedEventArgs e)
{
await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
await Dispatcher.CallOnUIThreadAsync(() =>
{
if (EditorSettingsService.IsLineHighlighterEnabled) DrawLineHighlighter();
});
}

private async void LineHighlighter_OnTextWrappingChanged(object sender, TextWrapping e)
{
await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
await Dispatcher.CallOnUIThreadAsync(() =>
{
if (EditorSettingsService.IsLineHighlighterEnabled)
{
Expand All @@ -1108,23 +1108,23 @@ await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>

private async void LineHighlighter_OnFontSizeChanged(object sender, double e)
{
await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
await Dispatcher.CallOnUIThreadAsync(() =>
{
if (EditorSettingsService.IsLineHighlighterEnabled) DrawLineHighlighter();
});
}

private async void LineHighlighter_OnSizeChanged(object sender, SizeChangedEventArgs e)
{
await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
await Dispatcher.CallOnUIThreadAsync(() =>
{
if (EditorSettingsService.IsLineHighlighterEnabled) DrawLineHighlighter();
});
}

private async void LineHighlighter_OnScrollViewerViewChanging(object sender, ScrollViewerViewChangingEventArgs e)
{
await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
await Dispatcher.CallOnUIThreadAsync(() =>
{
if (EditorSettingsService.IsLineHighlighterEnabled) DrawLineHighlighter();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text.RegularExpressions;
using Windows.UI.Text;
using Notepads.Controls.FindAndReplace;
using Notepads.Utilities;
using Notepads.Extensions;

public partial class TextEditorCore
{
Expand Down
Loading

0 comments on commit 74262ee

Please sign in to comment.