Skip to content

Commit 2d1a723

Browse files
committed
Some fixes, version 2.9.2
1 parent 171e96f commit 2d1a723

File tree

9 files changed

+90
-37
lines changed

9 files changed

+90
-37
lines changed

ScreenToGif/Controls/DropDownButton.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@ public class DropDownButton : ComboBox
1111
{
1212
#region Variables
1313

14-
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register("Content", typeof(UIElement), typeof(DropDownButton), new FrameworkPropertyMetadata());
15-
16-
public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register("Description", typeof(string), typeof(DropDownButton), new FrameworkPropertyMetadata());
17-
18-
public static readonly DependencyProperty MaxSizeProperty = DependencyProperty.Register("MaxSize", typeof(double), typeof(DropDownButton), new FrameworkPropertyMetadata(26.0));
19-
20-
public static readonly DependencyProperty IsVerticalProperty = DependencyProperty.Register("IsVertical", typeof(bool), typeof(DropDownButton), new FrameworkPropertyMetadata(false));
14+
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(nameof(Content), typeof(UIElement), typeof(DropDownButton), new FrameworkPropertyMetadata());
15+
public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register(nameof(Description), typeof(string), typeof(DropDownButton), new FrameworkPropertyMetadata());
16+
public static readonly DependencyProperty MaxSizeProperty = DependencyProperty.Register(nameof(MaxSize), typeof(double), typeof(DropDownButton), new FrameworkPropertyMetadata(26.0));
17+
public static readonly DependencyProperty IsVerticalProperty = DependencyProperty.Register(nameof(IsVertical), typeof(bool), typeof(DropDownButton), new FrameworkPropertyMetadata(false));
2118

2219
#endregion
2320

@@ -70,4 +67,4 @@ static DropDownButton()
7067
DefaultStyleKeyProperty.OverrideMetadata(typeof(DropDownButton), new FrameworkPropertyMetadata(typeof(DropDownButton)));
7168
}
7269
}
73-
}
70+
}

ScreenToGif/Controls/ImageListBoxItem.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ public class ImageListBoxItem : ListBoxItem
1111
{
1212
#region Variables
1313

14-
public static readonly DependencyProperty ImageProperty;
15-
public static readonly DependencyProperty AuthorProperty;
16-
public static readonly DependencyProperty MaxSizeProperty;
14+
public static readonly DependencyProperty ImageProperty = DependencyProperty.Register(nameof(Image), typeof(UIElement), typeof(ImageListBoxItem), new FrameworkPropertyMetadata());
15+
public static readonly DependencyProperty MainAuthorProperty = DependencyProperty.Register(nameof(MainAuthor), typeof(string), typeof(ImageListBoxItem), new FrameworkPropertyMetadata(""));
16+
public static readonly DependencyProperty AuthorProperty = DependencyProperty.Register(nameof(Author), typeof(string), typeof(ImageListBoxItem), new FrameworkPropertyMetadata(""));
17+
public static readonly DependencyProperty MaxSizeProperty = DependencyProperty.Register(nameof(MaxSize), typeof(double), typeof(ImageListBoxItem), new FrameworkPropertyMetadata(20.0));
1718

1819
#endregion
1920

@@ -29,6 +30,16 @@ public UIElement Image
2930
set => SetCurrentValue(ImageProperty, value);
3031
}
3132

33+
/// <summary>
34+
/// The author of the ListBoxItem.
35+
/// </summary>
36+
[Description("The main author of the ListBoxItem.")]
37+
public string MainAuthor
38+
{
39+
get => (string)GetValue(MainAuthorProperty);
40+
set => SetCurrentValue(MainAuthorProperty, value);
41+
}
42+
3243
/// <summary>
3344
/// The author of the ListBoxItem.
3445
/// </summary>
@@ -54,10 +65,6 @@ public double MaxSize
5465
static ImageListBoxItem()
5566
{
5667
DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageListBoxItem), new FrameworkPropertyMetadata(typeof(ImageListBoxItem)));
57-
58-
ImageProperty = DependencyProperty.Register("Image", typeof(UIElement), typeof(ImageListBoxItem), new FrameworkPropertyMetadata());
59-
AuthorProperty = DependencyProperty.Register("Author", typeof(string), typeof(ImageListBoxItem), new FrameworkPropertyMetadata());
60-
MaxSizeProperty = DependencyProperty.Register("MaxSize", typeof(double), typeof(ImageListBoxItem), new FrameworkPropertyMetadata(20.0));
6168
}
6269
}
6370
}

ScreenToGif/Controls/TextPath.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,12 @@ public string Text
115115

116116
protected override void OnRender(DrawingContext drawingContext)
117117
{
118-
_textGeometry.Transform = new TranslateTransform(-_textGeometry.Bounds.X, -_textGeometry.Bounds.Y + 1);
118+
try
119+
{
120+
_textGeometry.Transform = new TranslateTransform(-_textGeometry.Bounds.X, -_textGeometry.Bounds.Y + 1);
121+
}
122+
catch (Exception)
123+
{}
119124

120125
//If the outline of the text should not be rendered outside, use the base OnRender method.
121126
if (!UserSettings.All.DrawOutlineOutside)

ScreenToGif/ImageUtil/Gif/LegacyEncoder/PixelUtilOld.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ public void LockBits()
7171
throw new ArgumentException("Only 8, 24 and 32 bpp images are supported.");
7272

7373
// Lock bitmap and return bitmap data
74-
_bitmapData = _source.LockBits(rect, ImageLockMode.ReadWrite,
75-
_source.PixelFormat);
76-
74+
_bitmapData = _source.LockBits(rect, ImageLockMode.ReadWrite, _source.PixelFormat);
75+
7776
// Create byte array to copy pixel values
7877
var step = Depth / 8;
7978
Pixels = new byte[pixelCount * step];

ScreenToGif/ImageUtil/Video/AviWriter.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ private struct BITMAPINFOHEADER
433433
public uint biClrImportant;
434434
}
435435

436-
437436
/// <summary>Open mode value for AVIs to create and write to the file.</summary>
438437
private const int AVI_OPEN_MODE_CREATEWRITE = 0x00001000 | 0x00000001;
439438

@@ -545,9 +544,7 @@ private enum AviErrors : uint
545544
UserAbort = 0x800440C6,
546545
Error = 0x800440C7
547546
}
548-
549-
550-
547+
551548
#endregion
552549
}
553550
}

ScreenToGif/Resources/Commands.xaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,52 @@
141141
</RoutedUICommand>
142142

143143
<!--Edit-->
144+
<RoutedUICommand x:Key="Command.Undo" Text="S.Command.Undo">
145+
<RoutedUICommand.InputGestures>
146+
<KeyGesture>Ctrl + Z</KeyGesture>
147+
</RoutedUICommand.InputGestures>
148+
</RoutedUICommand>
149+
150+
<RoutedUICommand x:Key="Command.Redo" Text="S.Command.Redo">
151+
<RoutedUICommand.InputGestures>
152+
<KeyGesture>Ctrl + Y</KeyGesture>
153+
</RoutedUICommand.InputGestures>
154+
</RoutedUICommand>
155+
144156
<RoutedUICommand x:Key="Command.Reset" Text="S.Command.Reset">
145157
<RoutedUICommand.InputGestures>
146158
<KeyGesture>Ctrl + R</KeyGesture>
147159
</RoutedUICommand.InputGestures>
148160
</RoutedUICommand>
149161

162+
<RoutedUICommand x:Key="Command.Copy" Text="S.Command.Copy">
163+
<RoutedUICommand.InputGestures>
164+
<KeyGesture>Ctrl + C</KeyGesture>
165+
</RoutedUICommand.InputGestures>
166+
</RoutedUICommand>
167+
168+
<RoutedUICommand x:Key="Command.Cut" Text="S.Command.Cut">
169+
<RoutedUICommand.InputGestures>
170+
<KeyGesture>Ctrl + X</KeyGesture>
171+
</RoutedUICommand.InputGestures>
172+
</RoutedUICommand>
173+
174+
<RoutedUICommand x:Key="Command.Paste" Text="S.Command.Paste">
175+
<RoutedUICommand.InputGestures>
176+
<KeyGesture>Ctrl + V</KeyGesture>
177+
</RoutedUICommand.InputGestures>
178+
</RoutedUICommand>
179+
150180
<RoutedUICommand x:Key="Command.ExploreClipboard" Text="S.Command.ExploreClipboard"/>
151181

152182
<RoutedUICommand x:Key="Command.RemoveClipboardEntry" Text="S.Command.RemoveClipboardEntry"/>
153183

184+
<RoutedUICommand x:Key="Command.Delete" Text="S.Command.Delete">
185+
<RoutedUICommand.InputGestures>
186+
<KeyGesture>Delete</KeyGesture>
187+
</RoutedUICommand.InputGestures>
188+
</RoutedUICommand>
189+
154190
<RoutedUICommand x:Key="Command.DeletePrevious" Text="S.Command.DeletePrevious">
155191
<RoutedUICommand.InputGestures>
156192
<KeyGesture>Alt + Left</KeyGesture>

ScreenToGif/Resources/Localization/StringResources.en.xaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@
6262
<s:String x:Key="S.Command.Play">Play the animation</s:String>
6363
<s:String x:Key="S.Command.NextFrame">Select the next frame</s:String>
6464
<s:String x:Key="S.Command.LastFrame">Select the last frame</s:String>
65+
<s:String x:Key="S.Command.Undo">Undo</s:String>
66+
<s:String x:Key="S.Command.Redo">Redo</s:String>
6567
<s:String x:Key="S.Command.Reset">Undo all changes in the project</s:String>
68+
<s:String x:Key="S.Command.Copy">Copy the selected frames and store them in the clipboard</s:String>
69+
<s:String x:Key="S.Command.Cut">Cut the selected frames and store them in the clipboard</s:String>
70+
<s:String x:Key="S.Command.Paste">Paste the frames from the clipboard</s:String>
71+
<s:String x:Key="S.Command.Delete">Delete all selected frames</s:String>
6672
<s:String x:Key="S.Command.DeletePrevious">Delete all previous frames</s:String>
6773
<s:String x:Key="S.Command.DeleteNext">Delete all next frames</s:String>
6874
<s:String x:Key="S.Command.RemoveDuplicates">Remove duplicates</s:String>
@@ -166,8 +172,8 @@
166172
<s:String x:Key="Application.ScreenRecorder.Magnifier.Info">(It enables a magnifier while selecting the recording area)</s:String>
167173
<s:String x:Key="Application.ScreenRecorder.CursorFollowing">Enable cursor following.</s:String>
168174
<s:String x:Key="Application.ScreenRecorder.CursorFollowing.Info">(The recording area will reposition itself based on the location of the cursor)</s:String>
169-
<s:String x:Key="Application.ScreenRecorder.FollowMargin.Info">(Buffer margin where the recording area starts getting repositioned)</s:String>
170-
<s:String x:Key="Application.ScreenRecorder.FollowMarginInvisible.Info">(Additional buffer margin where the UI starts getting hidden)</s:String>
175+
<s:String x:Key="Application.ScreenRecorder.FollowMargin.Info">(Buffer margin in pixels, where the recording area starts getting repositioned)</s:String>
176+
<s:String x:Key="Application.ScreenRecorder.FollowMarginInvisible.Info">(Additional buffer margin in pixels, where the UI starts getting hidden)</s:String>
171177

172178
<s:String x:Key="Application.Other">Other</s:String>
173179
<s:String x:Key="Application.Other.SystemTray">Display the app on the system tray (notification area).</s:String>

ScreenToGif/Resources/Localization/StringResources.pt.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@
6262
<s:String x:Key="S.Command.Play">Pré-visualize a animação</s:String>
6363
<s:String x:Key="S.Command.NextFrame">Selecione o próximo quadro</s:String>
6464
<s:String x:Key="S.Command.LastFrame">Selecione o último quadro</s:String>
65+
<s:String x:Key="S.Command.Undo">Desfazer</s:String>
66+
<s:String x:Key="S.Command.Redo">Refazer</s:String>
6567
<s:String x:Key="S.Command.Reset">Desfaça todas as alterações no projeto</s:String>
68+
<s:String x:Key="S.Command.Copy">Copie os quadros selecionados e armazene-os na área de transferência</s:String>
69+
<s:String x:Key="S.Command.Cut">Corte os quadros selecionados e armazene-os na área de transferência</s:String>
70+
<s:String x:Key="S.Command.Paste">Cole os quadros da área de transferência</s:String>
71+
<s:String x:Key="S.Command.Delete">Remover todos os quadros selecionados</s:String>
6672
<s:String x:Key="S.Command.DeletePrevious">Remover todos os quadros anteriores</s:String>
6773
<s:String x:Key="S.Command.DeleteNext">Remover todos os próximos quadros</s:String>
6874
<s:String x:Key="S.Command.RemoveDuplicates">Remover quadros duplicados</s:String>

ScreenToGif/Windows/Editor.xaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,14 @@
234234
<CommandBinding Command="{StaticResource Command.DiscardProject}" CanExecute="File_CanExecute" Executed="DiscardProject_Executed"/>
235235

236236
<!--Action Stack-->
237-
<CommandBinding Command="Undo" CanExecute="Undo_CanExecute" Executed="Undo_Executed"/>
237+
<CommandBinding Command="{StaticResource Command.Undo}" CanExecute="Undo_CanExecute" Executed="Undo_Executed"/>
238238
<CommandBinding Command="{StaticResource Command.Reset}" CanExecute="Reset_CanExecute" Executed="Reset_Executed"/>
239-
<CommandBinding Command="Redo" CanExecute="Redo_CanExecute" Executed="Redo_Executed"/>
239+
<CommandBinding Command="{StaticResource Command.Redo}" CanExecute="Redo_CanExecute" Executed="Redo_Executed"/>
240240

241241
<!--Clipboard-->
242-
<CommandBinding Command="Cut" CanExecute="ClipBoard_CanExecute" Executed="Cut_Executed"/>
243-
<CommandBinding Command="Copy" CanExecute="ClipBoard_CanExecute" Executed="Copy_Executed"/>
244-
<CommandBinding Command="Paste" CanExecute="Paste_CanExecute" Executed="Paste_Executed"/>
242+
<CommandBinding Command="{StaticResource Command.Cut}" CanExecute="ClipBoard_CanExecute" Executed="Cut_Executed"/>
243+
<CommandBinding Command="{StaticResource Command.Copy}" CanExecute="ClipBoard_CanExecute" Executed="Copy_Executed"/>
244+
<CommandBinding Command="{StaticResource Command.Paste}" CanExecute="Paste_CanExecute" Executed="Paste_Executed"/>
245245
<CommandBinding Command="{StaticResource Command.ExploreClipboard}" CanExecute="ClipBoardSelection_CanExecute" Executed="ExploreClipBoard_Executed"/>
246246
<CommandBinding Command="{StaticResource Command.RemoveClipboardEntry}" CanExecute="ClipBoardSelection_CanExecute" Executed="RemoveClipboard_Executed"/>
247247

@@ -264,7 +264,7 @@
264264
<CommandBinding Command="{StaticResource Command.LastFrame}" CanExecute="Playback_CanExecute" Executed="LastFrame_Executed"/>
265265

266266
<!--Frames-->
267-
<CommandBinding Command="Delete" CanExecute="Delete_CanExecute" Executed="Delete_Executed"/>
267+
<CommandBinding Command="{StaticResource Command.Delete}" CanExecute="Delete_CanExecute" Executed="Delete_Executed"/>
268268
<CommandBinding Command="{StaticResource Command.DeletePrevious}" CanExecute="DeletePrevious_CanExecute" Executed="DeletePrevious_Executed"/>
269269
<CommandBinding Command="{StaticResource Command.DeleteNext}" CanExecute="DeleteNext_CanExecute" Executed="DeleteNext_Executed"/>
270270
<CommandBinding Command="{StaticResource Command.RemoveDuplicates}" CanExecute="RemoveDuplicates_CanExecute" Executed="RemoveDuplicates_Executed"/>
@@ -596,7 +596,7 @@
596596
FontSize="12" Foreground="{DynamicResource Element.Foreground.Gray112}"/>
597597

598598
<n:ImageButton x:Name="UndoButton" Grid.Row="0" Grid.Column="0" Text="{DynamicResource Editor.Home.Undo}" Content="{StaticResource Vector.Undo}"
599-
MinWidth="55" ContentHeight="28" ContentWidth="28" Style="{StaticResource Style.Button.Vertical}" Command="Undo"
599+
MinWidth="55" ContentHeight="28" ContentWidth="28" Style="{StaticResource Style.Button.Vertical}" Command="{StaticResource Command.Undo}"
600600
ToolTip="{Binding Command, RelativeSource={RelativeSource Self}, Converter={StaticResource CommandToInputGestureText}}"
601601
ToolTipService.Placement="Bottom" ToolTipService.HorizontalOffset="-5"/>
602602

@@ -612,7 +612,7 @@
612612
ToolTipService.Placement="Top" ToolTipService.HorizontalOffset="-5"/>
613613

614614
<n:ImageButton x:Name="RedoButton" Grid.Row="1" Text="{DynamicResource Editor.Home.Redo}" Content="{StaticResource Vector.Redo}"
615-
Padding="2" MinWidth="60" MaxSize="25" Style="{StaticResource Style.Button.Horizontal}" Command="Redo"
615+
Padding="2" MinWidth="60" MaxSize="25" Style="{StaticResource Style.Button.Horizontal}" Command="{StaticResource Command.Redo}"
616616
ToolTip="{Binding Command, RelativeSource={RelativeSource Self}, Converter={StaticResource CommandToInputGestureText}}"
617617
ToolTipService.Placement="Bottom" ToolTipService.HorizontalOffset="-5"/>
618618
</Grid>
@@ -647,7 +647,7 @@
647647
</Grid>
648648

649649
<n:ImageButton Grid.Row="0" Grid.Column="0" x:Name="PasteButton" Text="{DynamicResource Editor.Home.Paste}" Content="{StaticResource Vector.Paste}"
650-
MinWidth="55" ContentHeight="28" ContentWidth="28" Style="{StaticResource Style.Button.Vertical}" Command="Paste"
650+
MinWidth="55" ContentHeight="28" ContentWidth="28" Style="{StaticResource Style.Button.Vertical}" Command="{StaticResource Command.Paste}"
651651
ToolTip="{Binding Command, RelativeSource={RelativeSource Self}, Converter={StaticResource CommandToInputGestureText}}"
652652
ToolTipService.Placement="Bottom" ToolTipService.HorizontalOffset="-5"/>
653653

@@ -658,12 +658,12 @@
658658
</Grid.RowDefinitions>
659659

660660
<n:ImageButton x:Name="CopyButton" Grid.Row="0" Grid.Column="0" Text="{DynamicResource Editor.Home.Copy}" Content="{StaticResource Vector.Copy}"
661-
Padding="2" MinWidth="60" MaxSize="28" Style="{StaticResource Style.Button.Horizontal}" Command="Copy"
661+
Padding="2" MinWidth="60" MaxSize="28" Style="{StaticResource Style.Button.Horizontal}" Command="{StaticResource Command.Copy}"
662662
ToolTip="{Binding Command, RelativeSource={RelativeSource Self}, Converter={StaticResource CommandToInputGestureText}}"
663663
ToolTipService.Placement="Top" ToolTipService.HorizontalOffset="-5"/>
664664

665665
<n:ImageButton x:Name="CutButton" Grid.Row="1" Text="{DynamicResource Editor.Home.Cut}" Content="{StaticResource Vector.Cut}"
666-
Padding="2" MinWidth="60" MaxSize="28" Style="{StaticResource Style.Button.Horizontal}" Command="Cut"
666+
Padding="2" MinWidth="60" MaxSize="28" Style="{StaticResource Style.Button.Horizontal}" Command="{StaticResource Command.Cut}"
667667
ToolTip="{Binding Command, RelativeSource={RelativeSource Self}, Converter={StaticResource CommandToInputGestureText}}"
668668
ToolTipService.Placement="Bottom" ToolTipService.HorizontalOffset="-5"/>
669669
</Grid>
@@ -873,7 +873,7 @@
873873
FontSize="12" Foreground="{DynamicResource Element.Foreground.Gray112}"/>
874874

875875
<n:ImageButton Grid.Row="0" Grid.Column="0" x:Name="DeleteButton" Text="{DynamicResource Editor.Edit.Delete}" Content="{StaticResource Vector.RemoveImage}"
876-
MinWidth="55" ContentHeight="28" ContentWidth="28" Style="{StaticResource Style.Button.Vertical}" Command="Delete"
876+
MinWidth="55" ContentHeight="28" ContentWidth="28" Style="{StaticResource Style.Button.Vertical}" Command="{StaticResource Command.Delete}"
877877
ToolTip="{Binding Command, RelativeSource={RelativeSource Self}, Converter={StaticResource CommandToInputGestureText}}"
878878
ToolTipService.Placement="Bottom" ToolTipService.HorizontalOffset="-5"/>
879879

0 commit comments

Comments
 (0)