Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
NickeManarin committed Apr 21, 2021
2 parents db87e62 + 1624cf8 commit 5ab1508
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 32 deletions.
7 changes: 5 additions & 2 deletions ScreenToGif/ImageUtil/Gif/LegacyEncoder/GifEncoder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
Expand Down Expand Up @@ -118,7 +118,10 @@ private void InitHeader(Stream sourceGif, int w, int h)
WriteByte(0); // Pixel aspect ratio
WriteColorTable(sourceGif);

// App Extension Header
if (_repeatCount < 0)
return;

//App Extension Header
WriteShort(ApplicationExtensionBlockIdentifier);
WriteByte(ApplicationBlockSize);
WriteString(ApplicationIdentification);
Expand Down
4 changes: 2 additions & 2 deletions ScreenToGif/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.28.0.0")]
[assembly: AssemblyFileVersion("2.28.0.0")]
[assembly: AssemblyVersion("2.28.1.0")]
[assembly: AssemblyFileVersion("2.28.1.0")]
11 changes: 11 additions & 0 deletions ScreenToGif/UserControls/ExportPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,17 @@ public ExportPanel()
_searchTimer.Tick += SearchTimer_Tick;

#endregion

#region UWP restrictions

#if UWP

CustomCommandsCheckBox.IsEnabled = false;
CustomCommandsTextBox.IsEnabled = false;

#endif

#endregion
}


Expand Down
4 changes: 2 additions & 2 deletions ScreenToGif/UserControls/GfycatPanel.xaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<UserControl x:Class="ScreenToGif.UserControls.GfycatPanel"
<UserControl x:Class="ScreenToGif.UserControls.GfycatPanel"
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:n="clr-namespace:ScreenToGif.Controls"
xmlns:u="clr-namespace:ScreenToGif.Util"
mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="320" Background="White"
mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="320"
x:Name="ThisPanel" Loaded="Panel_Loaded">

<Grid>
Expand Down
2 changes: 1 addition & 1 deletion ScreenToGif/UserControls/ImgurPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:n="clr-namespace:ScreenToGif.Controls"
mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="320" Background="White"
mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="320"
x:Name="ThisPanel" Loaded="ImgurPanel_Loaded">

<Grid>
Expand Down
4 changes: 2 additions & 2 deletions ScreenToGif/UserControls/YandexPanel.xaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<UserControl x:Class="ScreenToGif.UserControls.YandexPanel"
<UserControl x:Class="ScreenToGif.UserControls.YandexPanel"
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:n="clr-namespace:ScreenToGif.Controls"
mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="320" Background="White"
mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="320"
x:Name="ThisPanel" Loaded="YandexPanel_Loaded">

<Grid>
Expand Down
6 changes: 3 additions & 3 deletions ScreenToGif/Util/EncodingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ private static async Task Encode(ExportProject project, ExportPreset preset, int
{
var frameCount = project.FramesFiles.Count(x => x.HasArea);

using (var encoder = new Apng(stream, frameCount, embApngPreset.RepeatCount))
using (var encoder = new Apng(stream, frameCount, embApngPreset.Looped && project.FrameCount > 1 ? (embApngPreset.RepeatForever ? 0 : embApngPreset.RepeatCount) : 1))
{
for (var i = 0; i < project.FramesFiles.Count; i++)
{
Expand Down Expand Up @@ -598,7 +598,7 @@ private static async Task Encode(ExportProject project, ExportPreset preset, int
{
using (var encoder = new GifFile(stream))
{
encoder.RepeatCount = project.FrameCount > 1 ? embGifPreset.RepeatCount : -1;
encoder.RepeatCount = embGifPreset.Looped && project.FrameCount > 1 ? (embGifPreset.RepeatForever ? 0 : embGifPreset.RepeatCount) : -1;
encoder.UseGlobalColorTable = embGifPreset.UseGlobalColorTable;
encoder.TransparentColor = embGifPreset.PaintTransparent || embGifPreset.EnableTransparency ?
System.Windows.Media.Color.FromArgb(0, embGifPreset.ChromaKey.R, embGifPreset.ChromaKey.G, embGifPreset.ChromaKey.B) : new System.Windows.Media.Color?();
Expand Down Expand Up @@ -665,7 +665,7 @@ private static async Task Encode(ExportProject project, ExportPreset preset, int

using (var stream = new MemoryStream())
{
using (var encoder = new GifEncoder(stream, null, null, systemGifPreset.RepeatCount))
using (var encoder = new GifEncoder(stream, null, null, systemGifPreset.Looped && project.FrameCount > 1 ? (systemGifPreset.RepeatForever ? 0 : systemGifPreset.RepeatCount) : -1))
{
for (var i = 0; i < project.FramesFiles.Count; i++)
{
Expand Down
29 changes: 11 additions & 18 deletions ScreenToGif/Windows/Editor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,23 +225,6 @@ public Editor()
WindowStartupLocation = WindowStartupLocation.CenterScreen;

#endregion

#region UWP restrictions

#if UWP

CustomCommandsCheckBox.Visibility = Visibility.Collapsed;
CustomCommandsTextBox.Visibility = Visibility.Collapsed;
CustomCommandsApngCheckBox.Visibility = Visibility.Collapsed;
CustomCommandsApngTextBox.Visibility = Visibility.Collapsed;
CustomCommandsVideoCheckBox.Visibility = Visibility.Collapsed;
CustomCommandsVideoTextBox.Visibility = Visibility.Collapsed;
CustomCommandsPsdCheckBox.Visibility = Visibility.Collapsed;
CustomCommandsPsdTextBox.Visibility = Visibility.Collapsed;

#endif

#endregion
}

#region Main Events
Expand Down Expand Up @@ -4816,6 +4799,16 @@ private bool UpdatePositioning(bool onLoad = true)
if (closest.WorkingArea.Bottom < top + 100)
top = closest.WorkingArea.Bottom - height;

if (top > int.MaxValue || top < int.MinValue || left > int.MaxValue || left < int.MinValue ||
width > int.MaxValue || width < int.MinValue || height > int.MaxValue || height < int.MinValue)
{
var desc = $"On load: {onLoad}\nScale: {this.Scale()}\n\n" +
$"Screen: {closest.AdapterName}\nBounds: {closest.Bounds}\n\nTopLeft: {top}x{left}\nWidthHeight: {width}x{height}\n\n" +
$"TopLeft Settings: {UserSettings.All.EditorTop}x{UserSettings.All.EditorLeft}\nWidthHeight Settings: {UserSettings.All.EditorWidth}x{UserSettings.All.EditorHeight}";
LogWriter.Log("Wrong Editor window sizing", desc);
return false;
}

Top = top;
Left = left;
Width = width;
Expand Down Expand Up @@ -6950,4 +6943,4 @@ private void MouseClicksCallback(IAsyncResult ar)

#endregion
}
}
}
4 changes: 2 additions & 2 deletions ScreenToGif/app.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="2.27.3.0" name="ScreenToGif" processorArchitecture="msil"/>
<assemblyIdentity version="2.28.1.0" name="ScreenToGif" processorArchitecture="msil"/>

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
Expand Down

0 comments on commit 5ab1508

Please sign in to comment.