Skip to content

Commit

Permalink
Added more click events supported for mouse
Browse files Browse the repository at this point in the history
  • Loading branch information
NickeManarin committed Mar 24, 2024
1 parent d4a7029 commit 1037dae
Show file tree
Hide file tree
Showing 16 changed files with 109 additions and 25 deletions.
4 changes: 3 additions & 1 deletion ScreenToGif.Model/Enums/MouseButtons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ public enum MouseButtons
None,
Left,
Middle,
Right
Right,
FirstExtra,
SecondExtra,
}
2 changes: 1 addition & 1 deletion ScreenToGif.Model/ScreenToGif.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<DebugType>embedded</DebugType>
<UseWPF>True</UseWPF>
<Platforms>AnyCPU;ARM64;x64;x86</Platforms>
<Version>2.40.2</Version>
<Version>2.41.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<UseVSHostingProcess>true</UseVSHostingProcess>
Expand Down
2 changes: 1 addition & 1 deletion ScreenToGif.Native/ScreenToGif.Native.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<UseWindowsForms>True</UseWindowsForms>
<DebugType>embedded</DebugType>
<Platforms>AnyCPU;ARM64;x64;x86</Platforms>
<Version>2.40.2</Version>
<Version>2.41.0</Version>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down
2 changes: 1 addition & 1 deletion ScreenToGif.Util/ScreenToGif.Util.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<UseWPF>True</UseWPF>
<DebugType>embedded</DebugType>
<Platforms>AnyCPU;ARM64;x64;x86</Platforms>
<Version>2.40.2</Version>
<Version>2.41.0</Version>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<!--<UseWindowsForms>True</UseWindowsForms>-->
</PropertyGroup>
Expand Down
12 changes: 12 additions & 0 deletions ScreenToGif.Util/Settings/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2406,6 +2406,18 @@ public Color MiddleMouseButtonClicksColor
set => SetValue(value);
}

public Color FirstExtraMouseButtonClicksColor
{
get => (Color)GetValue();
set => SetValue(value);
}

public Color SecondExtraMouseButtonClicksColor
{
get => (Color)GetValue();
set => SetValue(value);
}

public double MouseEventsWidth
{
get => (double)GetValue();
Expand Down
2 changes: 1 addition & 1 deletion ScreenToGif.ViewModel/ScreenToGif.ViewModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Nullable>disable</Nullable>
<DebugType>embedded</DebugType>
<Platforms>AnyCPU;ARM64;x64;x86</Platforms>
<Version>2.40.2</Version>
<Version>2.41.0</Version>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
Expand Down
28 changes: 24 additions & 4 deletions ScreenToGif.ViewModel/Tasks/MouseEventsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ namespace ScreenToGif.ViewModel.Tasks;

public class MouseEventsViewModel : BaseTaskViewModel
{
private Color _highlightForegroundColor;
private Color _leftButtonForegroundColor;
private Color _rightButtonForegroundColor;
private Color _middleButtonForegroundColor;
private Color _highlightForegroundColor;
private Color _firstExtraButtonForegroundColor;
private Color _secondExtraButtonForegroundColor;
private double _width;
private double _height;

Expand Down Expand Up @@ -43,6 +45,18 @@ public Color MiddleButtonForegroundColor
set => SetProperty(ref _middleButtonForegroundColor, value);
}

public Color FirstExtraButtonForegroundColor
{
get => _firstExtraButtonForegroundColor;
set => SetProperty(ref _firstExtraButtonForegroundColor, value);
}

public Color SecondExtraButtonForegroundColor
{
get => _secondExtraButtonForegroundColor;
set => SetProperty(ref _secondExtraButtonForegroundColor, value);
}

public double Width
{
get => _width;
Expand All @@ -58,9 +72,11 @@ public double Height
public override string ToString()
{
return $"{LocalizationHelper.Get("S.MouseHighlight.Color")} #{HighlightForegroundColor.A:X2}{HighlightForegroundColor.R:X2}{HighlightForegroundColor.G:X2}{HighlightForegroundColor.B:X2}, " +
$"{LocalizationHelper.Get("S.MouseClicks.Color.Left")} #{LeftButtonForegroundColor.A:X2}{LeftButtonForegroundColor.R:X2}{LeftButtonForegroundColor.G:X2}{LeftButtonForegroundColor.B:X2}, " +
$"{LocalizationHelper.Get("S.MouseClicks.Color.Middle")} #{MiddleButtonForegroundColor.A:X2}{MiddleButtonForegroundColor.R:X2}{MiddleButtonForegroundColor.G:X2}{MiddleButtonForegroundColor.B:X2}, " +
$"{LocalizationHelper.Get("S.MouseClicks.Color.Left")} #{LeftButtonForegroundColor.A:X2}{LeftButtonForegroundColor.R:X2}{LeftButtonForegroundColor.G:X2}{LeftButtonForegroundColor.B:X2}, " +
$"{LocalizationHelper.Get("S.MouseClicks.Color.Right")} #{RightButtonForegroundColor.A:X2}{RightButtonForegroundColor.R:X2}{RightButtonForegroundColor.G:X2}{RightButtonForegroundColor.B:X2}, " +
$"{LocalizationHelper.Get("S.MouseClicks.Color.Middle")} #{MiddleButtonForegroundColor.A:X2}{MiddleButtonForegroundColor.R:X2}{MiddleButtonForegroundColor.G:X2}{MiddleButtonForegroundColor.B:X2}, " +
$"{LocalizationHelper.Get("S.MouseClicks.Color.FirstExtra")} #{FirstExtraButtonForegroundColor.A:X2}{FirstExtraButtonForegroundColor.R:X2}{FirstExtraButtonForegroundColor.G:X2}{FirstExtraButtonForegroundColor.B:X2}, " +
$"{LocalizationHelper.Get("S.MouseClicks.Color.SecondExtra")} #{SecondExtraButtonForegroundColor.A:X2}{SecondExtraButtonForegroundColor.R:X2}{SecondExtraButtonForegroundColor.G:X2}{SecondExtraButtonForegroundColor.B:X2}, " +
$"{LocalizationHelper.Get("S.FreeDrawing.Width")} {Width}, {LocalizationHelper.Get("S.FreeDrawing.Height")} {Height}";
}

Expand All @@ -72,6 +88,8 @@ public static MouseEventsViewModel Default()
LeftButtonForegroundColor = Color.FromArgb(120, 255, 255, 0),
RightButtonForegroundColor = Color.FromArgb(120, 255, 0, 0),
MiddleButtonForegroundColor = Color.FromArgb(120, 0, 255, 255),
FirstExtraButtonForegroundColor = Color.FromArgb(120, 255, 0, 128),
SecondExtraButtonForegroundColor = Color.FromArgb(120, 255, 128, 0),
Height = 12,
Width = 12
};
Expand All @@ -83,8 +101,10 @@ public static MouseEventsViewModel FromSettings()
{
HighlightForegroundColor = UserSettings.All.MouseHighlightColor,
LeftButtonForegroundColor = UserSettings.All.LeftMouseButtonClicksColor,
MiddleButtonForegroundColor = UserSettings.All.MiddleMouseButtonClicksColor,
RightButtonForegroundColor = UserSettings.All.RightMouseButtonClicksColor,
MiddleButtonForegroundColor = UserSettings.All.MiddleMouseButtonClicksColor,
FirstExtraButtonForegroundColor = UserSettings.All.FirstExtraMouseButtonClicksColor,
SecondExtraButtonForegroundColor = UserSettings.All.SecondExtraMouseButtonClicksColor,
Height = UserSettings.All.MouseEventsHeight,
Width = UserSettings.All.MouseEventsWidth
};
Expand Down
2 changes: 2 additions & 0 deletions ScreenToGif/Resources/Localization/StringResources.en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,8 @@
<s:String x:Key="S.MouseClicks.Color.Left">Left button color:</s:String>
<s:String x:Key="S.MouseClicks.Color.Middle">Middle button color:</s:String>
<s:String x:Key="S.MouseClicks.Color.Right">Right button color:</s:String>
<s:String x:Key="S.MouseClicks.Color.FirstExtra">1st extra button color:</s:String>
<s:String x:Key="S.MouseClicks.Color.SecondExtra">2nd extra button color:</s:String>

<!--Editor • Watermark-->
<s:String x:Key="S.Watermark.Image">Image</s:String>
Expand Down
10 changes: 8 additions & 2 deletions ScreenToGif/Resources/Localization/StringResources.pt.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,8 @@
<s:String x:Key="S.Preset.Gif.Embedded.Transparent.Description">Suporta salvar a animação com um fundo transparente.</s:String>
<s:String x:Key="S.Preset.Gif.Embedded.Graphics.Title">Alta qualidade • Gráficos</s:String>
<s:String x:Key="S.Preset.Gif.Embedded.Graphics.Description">Melhor para gravações com menor quantidade de cores.</s:String>
<s:String x:Key="S.Preset.Gif.KGySoft.Default.Title">KGy SOFT • Padrão</s:String>
<s:String x:Key="S.Preset.Gif.KGySoft.Default.Description">Recomendado para gravações de tela normais. Usa quantizador Median Cut sem pontilhamento.</s:String>
<s:String x:Key="S.Preset.Gif.KGySoft.Balanced.Title">KGy SOFT • Balanceado</s:String>
<s:String x:Key="S.Preset.Gif.KGySoft.Balanced.Description">Boa qualidade para imagens semelhantes a fotos usando o quantizador de Wu sem pontilhamento.</s:String>
<s:String x:Key="S.Preset.Gif.KGySoft.High.Title">KGy SOFT • Alta qualidade</s:String>
Expand Down Expand Up @@ -1390,6 +1392,8 @@
<s:String x:Key="S.MouseClicks.Color.Left">Cor do botão esquerdo:</s:String>
<s:String x:Key="S.MouseClicks.Color.Middle">Cor do botão do meio:</s:String>
<s:String x:Key="S.MouseClicks.Color.Right">Cor do botão direito:</s:String>
<s:String x:Key="S.MouseClicks.Color.FirstExtra">Cor do 1º botão extra:</s:String>
<s:String x:Key="S.MouseClicks.Color.SecondExtra">Cor do 2º botão extra:</s:String>
<s:String x:Key="S.MouseClicks.Warning.None">Não há cliques de mouse detectados no seu projeto.</s:String>

<!--Editor • Watermark-->
Expand Down Expand Up @@ -1608,7 +1612,7 @@
<s:String x:Key="S.SaveAs.GifOptions.Dither">Pontilhado:</s:String>
<s:String x:Key="S.SaveAs.GifOptions.Dither.Scale">Escala Bayer:</s:String>

<!--Editor • Save as > KGy SOFT options-->
<!--Editor • Save as > KGy SOFT options-->
<s:String x:Key="S.SaveAs.KGySoft.Quantizer">Quantizador</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Quantizer.BackColor">Cor de Fundo:</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Quantizer.BackColor.Info">Pixels com alfa (transparência) que são considerados opacos pelo quantizador selecionado serão misturados com esta cor antes de obter a cor quantizada.</s:String>
Expand All @@ -1623,6 +1627,8 @@
<s:String x:Key="S.SaveAs.KGySoft.Quantizer.CustomBitLevel">Nível de bits personalizado.</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Quantizer.CustomBitLevel.Info">Quando marcado, o nível de bits pode ser configurado manualmente.&#x0d;&#x0a;⚠️ Aviso: O nível de bit mais alto pode exigir MUITA memória!</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Quantizer.BitLevel.Info">Um valor mais alto significa mais precisão, maior espaço de cores de destino, processamento mais lento e maior uso de memória.&#x0d;&#x0a;Por exemplo, se 1, então o resultado não pode ter mais de 8 cores, ou quando 2, não mais de 64 cores.&#x0d;&#x0a;Para os quantizadores Octree e Wu, afeta também o número máximo de tons monocromáticos.&#x0d;&#x0a;Por exemplo, se 5 (que é o padrão para o quantizador Wu), apenas 32 tons monocromáticos podem ser diferenciados.&#x0d;&#x0a;⚠️ Cuidado: O quantizador Wu consome pelo menos 650 MB com o valor mais alto.</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Quantizer.LinearColorSpace">Espaço de cor linear</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Quantizer.LinearColorSpace.Info">Quando marcado, algumas operações (mistura de alfa com plano de fundo, quantização, pontilhamento, procurar cores próximas na palete) são feitas no espaço de cor linear ao invés de no sRGB.&#x0d;&#x0a;Trabalhar no espaço de cores linear é mais lento, mas proporciona um resultado de melhor qualidade, especialmente quando o quantizador usa apenas algumas cores.&#x0d;&#x0a;&#x0d;&#x0a;⚠️ Observação: Ao usar apenas algumas cores, o brilho de uma visualização possivelmente redimensionada pode estar incorreto porque o WPF realiza o redimensionamento no espaço de cores sRGB.</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Quantizer.PredefinedColorsQuantizer.BlackAndWhite">Preto e Branco</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Quantizer.PredefinedColorsQuantizer.BlackAndWhite.Info">Paleta fixa de 1 bpp com as cores preto e branco.</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Quantizer.PredefinedColorsQuantizer.Grayscale4">Tons de cinza com 4 cores</s:String>
Expand Down Expand Up @@ -1702,7 +1708,7 @@
<s:String x:Key="S.SaveAs.KGySoft.Animation.LoopCount">Repetições:</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Animation.LoopCount.Info">Especifica quantas vezes a animação será reproduzida.</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Animation.AllowDeltaFrames">Permitir quadros delta.</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Animation.AllowDeltaFrames.Info">Quando marcado, os pixels inalterados tentam ser detectados durante a codificação.&#x0d;&#x0a;Ao usar com um quantizador otimizado, esta opção possibilita que um quadro tenha mais de 256 cores.&#x0d;&#x0a;Esta opção é ignorada se o quantizador não usar transparência e a opção Permitir Quadros Recortados estiver desmarcada.</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Animation.AllowDeltaFrames.Info">Quando marcado, os pixels inalterados tentam ser detectados durante a codificação.&#x0d;&#x0a;Ao usar com um quantizador otimizado, esta opção possibilita que um quadro tenha mais de 256 cores.&#x0d;&#x0a;Esta opção é ignorada se o quantizador não usar transparência e a opção Permitir Quadros Recortados estiver desmarcada.&#x0d;&#x0a;&#x0d;&#x0a;⚠️ Observação: Esta opção pode causar artefatos visíveis nas cores ou no padrão de pontilhamento.</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Animation.DeltaTolerance">Tolerância Delta:</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Animation.DeltaTolerance.Info">Especifica a tolerância máxima ao detectar pixels alterados.&#x0d;&#x0a;Se 0, então nenhuma diferença é tolerada.&#x0d;&#x0a;Se 255, então pode haver quadros (ou mesmo todos eles) que são adicionados sem conteúdo.&#x0d;&#x0a;O intervalo razoável está entre 0 e 16 para um quantizador otimizado. Aqueles com cores fixas podem ser usados com valores um pouco maiores com dithering.</s:String>
<s:String x:Key="S.SaveAs.KGySoft.Animation.HighDeltaTolerance">Se a tolerância Delta for muito alta, o resultado pode ter baixa qualidade. Clique para redefinir a tolerância delta.</s:String>
Expand Down
6 changes: 4 additions & 2 deletions ScreenToGif/Resources/Settings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@

<!--Options • Automated Tasks-->
<c:ArrayList Capacity="1" x:Key="AutomatedTasksList">
<t:MouseEventsViewModel HighlightForegroundColor="#000000FF" LeftButtonForegroundColor="#78FFFF00" RightButtonForegroundColor="#78FF0000" MiddleButtonForegroundColor="#7800FFFF" Width="12" Height="12" TaskType="MouseEvents"/>
<t:MouseEventsViewModel HighlightForegroundColor="#000000FF" LeftButtonForegroundColor="#78FFFF00" RightButtonForegroundColor="#78FF0000" MiddleButtonForegroundColor="#7800FFFF" FirstExtraButtonForegroundColor="#78FF0080" SecondExtraButtonForegroundColor="#78FF8000" Width="12" Height="12" TaskType="MouseEvents"/>
</c:ArrayList>

<!--Options • Shortcuts-->
Expand Down Expand Up @@ -357,8 +357,10 @@
<!--Editor • Mouse Events -->
<Color x:Key="MouseHighlightColor">#00000000</Color>
<Color x:Key="LeftMouseButtonClicksColor">#78FFFF00</Color>
<Color x:Key="MiddleMouseButtonClicksColor">#7800FFFF</Color>
<Color x:Key="RightMouseButtonClicksColor">#78FF0000</Color>
<Color x:Key="MiddleMouseButtonClicksColor">#7800FFFF</Color>
<Color x:Key="FirstExtraMouseButtonClicksColor">#78FF0080</Color>
<Color x:Key="SecondExtraMouseButtonClicksColor">#78FF8000</Color>
<s:Double x:Key="MouseEventsWidth">12</s:Double>
<s:Double x:Key="MouseEventsHeight">12</s:Double>

Expand Down
2 changes: 1 addition & 1 deletion ScreenToGif/ScreenToGif.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<Company>Nicke Manarin</Company>
<Authors>Nicke Manarin</Authors>
<Version>2.40.2</Version>
<Version>2.41.0</Version>
<Copyright>Copyright© Nicke Manarin 2023</Copyright>
<PackageProjectUrl>https://www.screentogif.com</PackageProjectUrl>
<PackageReadmeFile>Readme.md</PackageReadmeFile>
Expand Down
16 changes: 12 additions & 4 deletions ScreenToGif/UserControls/MouseClicksPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
Expand All @@ -40,12 +42,18 @@
<TextBlock Grid.Row="3" Grid.Column="0" Text="{DynamicResource S.MouseClicks.Color.Right}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
<n:ColorBox Grid.Row="3" Grid.Column="1" SelectedColor="{Binding RightButtonForegroundColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10,5"/>

<TextBlock Grid.Row="4" Grid.Column="0" Text="{DynamicResource S.FreeDrawing.Width}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
<n:DoubleUpDown Grid.Row="4" Grid.Column="1" x:Name="ClickWidthDoubleUpDown" Minimum="1" Maximum="1000" Margin="10,5" MinWidth="70"
<TextBlock Grid.Row="4" Grid.Column="0" Text="{DynamicResource S.MouseClicks.Color.FirstExtra}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
<n:ColorBox Grid.Row="4" Grid.Column="1" SelectedColor="{Binding FirstExtraMouseButtonClicksColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10,5"/>

<TextBlock Grid.Row="5" Grid.Column="0" Text="{DynamicResource S.MouseClicks.Color.SecondExtra}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
<n:ColorBox Grid.Row="5" Grid.Column="1" SelectedColor="{Binding SecondExtraMouseButtonClicksColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10,5"/>

<TextBlock Grid.Row="6" Grid.Column="0" Text="{DynamicResource S.FreeDrawing.Width}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
<n:DoubleUpDown Grid.Row="6" Grid.Column="1" x:Name="ClickWidthDoubleUpDown" Minimum="1" Maximum="1000" Margin="10,5" MinWidth="70"
Value="{Binding Width, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

<TextBlock Grid.Row="5" Grid.Column="0" Text="{DynamicResource S.FreeDrawing.Height}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
<n:DoubleUpDown Grid.Row="5" Grid.Column="1" x:Name="ClickHeightDoubleUpDown" Minimum="1" Maximum="1000" Margin="10,5" MinWidth="70"
<TextBlock Grid.Row="7" Grid.Column="0" Text="{DynamicResource S.FreeDrawing.Height}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
<n:DoubleUpDown Grid.Row="7" Grid.Column="1" x:Name="ClickHeightDoubleUpDown" Minimum="1" Maximum="1000" Margin="10,5" MinWidth="70"
Value="{Binding Height, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</Grid>
Expand Down
Loading

0 comments on commit 1037dae

Please sign in to comment.