1 Commits
Author SHA1 Message Date
rogier 5bdc851fa0 1.1.3 2026-11-09 13:02:24 +01:00
13 changed files with 126 additions and 32 deletions

No files matched your search

+7
View File
@@ -2,6 +2,13 @@
Alle noemenswaardige wijzigingen in kniip staan in dit bestand. De nieuwste versie staat bovenaan. Alle noemenswaardige wijzigingen in kniip staan in dit bestand. De nieuwste versie staat bovenaan.
## 1.1.3 - 2026-11-09
### Nieuw
- **Sneltoets voor het klembord.** In de tab **Sneltoetsen** kun je een combinatie zetten op **Vanaf klembord**. Die opent de afbeelding op het klembord in de editor. Standaard is er geen sneltoets. De gekozen combinatie staat ook bij **Bewerken vanaf klembord** in het systeemvakmenu.
- **Afbeelding naar de editor slepen.** Sleep een afbeeldingsbestand, of een afbeelding uit een ander programma, naar het kniip-venster. kniip vraagt daarna of je die afbeelding wilt openen, zodat een lopende bewerking niet zomaar verdwijnt.
## 1.1.2 - 2026-11-09 ## 1.1.2 - 2026-11-09
### Opgelost ### Opgelost
+2 -2
View File
@@ -24,7 +24,7 @@ kniip is een annotatie-editor die naast het Windows Knipprogramma werkt. Maak ee
| Versie | Installer | | Versie | Installer |
| ------ | --------- | | ------ | --------- |
| 1.1.2 | [Kniip-Setup-1.1.2.exe](https://git.hibbit.net/rogier/kniip/releases/download/1.1.2/Kniip-Setup-1.1.2.exe) | | 1.1.3 | [Kniip-Setup-1.1.3.exe](https://git.hibbit.net/rogier/kniip/releases/download/1.1.3/Kniip-Setup-1.1.3.exe) |
Oudere versies vind je bij [alle releases](https://git.hibbit.net/rogier/kniip/releases). Oudere versies vind je bij [alle releases](https://git.hibbit.net/rogier/kniip/releases).
@@ -70,7 +70,7 @@ Vereisten:
Bouwen: Bouwen:
```powershell ```powershell
.\build.ps1 # versie 1.1.2 .\build.ps1 # versie 1.1.3
.\build.ps1 -Version 1.2.0 # andere versie .\build.ps1 -Version 1.2.0 # andere versie
``` ```
+1 -1
View File
@@ -7,7 +7,7 @@
# .\build.ps1 -Version 1.2.0 # .\build.ps1 -Version 1.2.0
param( param(
[string]$Version = "1.1.2", [string]$Version = "1.1.3",
[string]$Runtime = "win-x64" [string]$Runtime = "win-x64"
) )
+1 -1
View File
@@ -5,7 +5,7 @@
#define AppName "kniip" #define AppName "kniip"
#define AppExe "Kniip.exe" #define AppExe "Kniip.exe"
#ifndef AppVersion #ifndef AppVersion
#define AppVersion "1.1.2" #define AppVersion "1.1.3"
#endif #endif
#ifndef PublishDir #ifndef PublishDir
#define PublishDir "..\artifacts\publish" #define PublishDir "..\artifacts\publish"
+2 -1
View File
@@ -298,11 +298,12 @@ public partial class App : Application
Bind(Settings.WindowHotkey, BeginWindowSnip); Bind(Settings.WindowHotkey, BeginWindowSnip);
Bind(Settings.RecordHotkey, () => Recorder.Toggle(ScreencastFormat.Mp4)); Bind(Settings.RecordHotkey, () => Recorder.Toggle(ScreencastFormat.Mp4));
Bind(Settings.GifHotkey, () => Recorder.Toggle(ScreencastFormat.Gif)); Bind(Settings.GifHotkey, () => Recorder.Toggle(ScreencastFormat.Gif));
Bind(Settings.ClipboardHotkey, OpenFromClipboard);
HotkeyHook.Bindings = bindings; HotkeyHook.Bindings = bindings;
} }
_tray?.SetHotkeys(HotkeyDisplay(Settings.SnipHotkey), HotkeyDisplay(Settings.WindowHotkey), _tray?.SetHotkeys(HotkeyDisplay(Settings.SnipHotkey), HotkeyDisplay(Settings.WindowHotkey),
HotkeyDisplay(Settings.RecordHotkey), HotkeyDisplay(Settings.GifHotkey)); HotkeyDisplay(Settings.RecordHotkey), HotkeyDisplay(Settings.GifHotkey), HotkeyDisplay(Settings.ClipboardHotkey));
} }
/// <summary>Start een screencast: eerst het gebied kiezen, daarna de knoppenbalk.</summary> /// <summary>Start een screencast: eerst het gebied kiezen, daarna de knoppenbalk.</summary>
+60 -21
View File
@@ -41,6 +41,58 @@ internal static class ClipboardImageReader
return null; return null;
} }
if (ReadData(data, includeFiles) is { } image)
{
return image;
}
if (Clipboard.ContainsImage() && Clipboard.GetImage() is { } bitmap)
{
return OpaqueCopy(bitmap);
}
}
catch (Exception ex) when (ex is COMException or ExternalException or NotSupportedException or FileFormatException)
{
return null;
}
return null;
}
/// <summary>Snelle controle tijdens het slepen, zonder te decoderen.</summary>
public static bool CanDrop(IDataObject data)
{
try
{
return data.GetDataPresent("PNG") || data.GetDataPresent(DataFormats.Dib) || data.GetDataPresent(DataFormats.Bitmap)
|| (data.GetData(DataFormats.FileDrop) is string[] files && Array.Exists(files, IsImageFile));
}
catch (Exception ex) when (ex is COMException or ExternalException)
{
return false;
}
}
/// <summary>Afbeelding uit iets dat in kniip is neergezet: een afbeeldingsbestand of afbeeldingsdata.</summary>
public static BitmapSource? FromDrop(IDataObject data)
{
try
{
if (ReadData(data, includeFiles: true) is { } image)
{
return image;
}
return data.GetData(DataFormats.Bitmap) is BitmapSource bitmap ? OpaqueCopy(bitmap) : null;
}
catch (Exception ex) when (ex is COMException or ExternalException or NotSupportedException or FileFormatException)
{
return null;
}
}
private static BitmapSource? ReadData(IDataObject data, bool includeFiles)
{
if (includeFiles && TryReadFile(data) is { } fromFile) if (includeFiles && TryReadFile(data) is { } fromFile)
{ {
return fromFile; return fromFile;
@@ -53,31 +105,18 @@ internal static class ClipboardImageReader
if (data.GetDataPresent(DataFormats.Dib) && data.GetData(DataFormats.Dib) is MemoryStream dib) if (data.GetDataPresent(DataFormats.Dib) && data.GetData(DataFormats.Dib) is MemoryStream dib)
{ {
BitmapSource? fromDib = FromDib(dib.ToArray()); return FromDib(dib.ToArray());
if (fromDib != null)
{
return fromDib;
}
}
if (Clipboard.ContainsImage())
{
BitmapSource? image = Clipboard.GetImage();
if (image != null)
{
var copy = PixelUtil.CreateBitmap(PixelUtil.ToOpaqueBgra(image), image.PixelWidth, image.PixelHeight);
return copy;
}
}
}
catch (Exception ex) when (ex is COMException or ExternalException or NotSupportedException or FileFormatException)
{
return null;
} }
return null; return null;
} }
private static BitmapSource OpaqueCopy(BitmapSource image) =>
PixelUtil.CreateBitmap(PixelUtil.ToOpaqueBgra(image), image.PixelWidth, image.PixelHeight);
private static bool IsImageFile(string file) =>
Array.IndexOf(ImageExtensions, Path.GetExtension(file).ToLowerInvariant()) >= 0;
private static BitmapSource? TryReadFile(IDataObject data) private static BitmapSource? TryReadFile(IDataObject data)
{ {
if (!data.GetDataPresent(DataFormats.FileDrop) || data.GetData(DataFormats.FileDrop) is not string[] files) if (!data.GetDataPresent(DataFormats.FileDrop) || data.GetData(DataFormats.FileDrop) is not string[] files)
@@ -87,7 +126,7 @@ internal static class ClipboardImageReader
foreach (string file in files) foreach (string file in files)
{ {
if (!File.Exists(file) || Array.IndexOf(ImageExtensions, Path.GetExtension(file).ToLowerInvariant()) < 0) if (!File.Exists(file) || !IsImageFile(file))
{ {
continue; continue;
} }
+2 -1
View File
@@ -5,7 +5,8 @@
Title="kniip" Width="1180" Height="780" MinWidth="760" MinHeight="420" Title="kniip" Width="1180" Height="780" MinWidth="760" MinHeight="420"
WindowStartupLocation="CenterScreen" Background="{StaticResource WindowBrush}" WindowStartupLocation="CenterScreen" Background="{StaticResource WindowBrush}"
FontFamily="Segoe UI" FontSize="13" UseLayoutRounding="True" FontFamily="Segoe UI" FontSize="13" UseLayoutRounding="True"
Icon="pack://application:,,,/AppIcon.ico"> Icon="pack://application:,,,/AppIcon.ico"
AllowDrop="True" PreviewDragEnter="Window_PreviewDragOver" PreviewDragOver="Window_PreviewDragOver" PreviewDrop="Window_PreviewDrop">
<Window.Resources> <Window.Resources>
<local:CornerPreviewConverter x:Key="CornerPreview" /> <local:CornerPreviewConverter x:Key="CornerPreview" />
<local:CursorIconConverter x:Key="CursorIcon" /> <local:CursorIconConverter x:Key="CursorIcon" />
+30
View File
@@ -1595,6 +1595,36 @@ public partial class EditorWindow : Window
ReplaceWith(image, "Wil je doorgaan en de afbeelding van het klembord openen?"); ReplaceWith(image, "Wil je doorgaan en de afbeelding van het klembord openen?");
} }
private void Window_PreviewDragOver(object sender, DragEventArgs e)
{
if (!ClipboardImageReader.CanDrop(e.Data))
{
return;
}
e.Effects = DragDropEffects.Copy;
e.Handled = true;
}
private void Window_PreviewDrop(object sender, DragEventArgs e)
{
if (!ClipboardImageReader.CanDrop(e.Data))
{
return;
}
e.Handled = true;
BitmapSource? image = ClipboardImageReader.FromDrop(e.Data);
if (image == null)
{
ShowTemporaryHint("Deze afbeelding kon niet worden geopend.");
return;
}
// Pas na het slepen vragen: een dialoog tijdens Drop blokkeert Verkenner.
Dispatcher.BeginInvoke(() => ReplaceWith(image, "Wil je doorgaan en deze afbeelding openen?"));
}
private void OpenImageFile() private void OpenImageFile()
{ {
CommitTextEdit(); CommitTextEdit();
+5 -3
View File
@@ -9,6 +9,7 @@ internal sealed class TrayIcon : IDisposable
private readonly NotifyIcon _icon; private readonly NotifyIcon _icon;
private const string RecordText = "Screencast opnemen (MP4)..."; private const string RecordText = "Screencast opnemen (MP4)...";
private readonly ToolStripMenuItem _clipboardItem;
private readonly ToolStripMenuItem _pauseItem; private readonly ToolStripMenuItem _pauseItem;
private readonly ToolStripMenuItem _snipItem; private readonly ToolStripMenuItem _snipItem;
private readonly ToolStripMenuItem _windowItem; private readonly ToolStripMenuItem _windowItem;
@@ -28,11 +29,11 @@ internal sealed class TrayIcon : IDisposable
public TrayIcon() public TrayIcon()
{ {
var menu = new ContextMenuStrip(); var menu = new ContextMenuStrip();
var openClipboard = new ToolStripMenuItem("Bewerken vanaf klembord", null, (_, _) => OpenFromClipboardRequested?.Invoke()) _clipboardItem = new ToolStripMenuItem("Bewerken vanaf klembord", null, (_, _) => OpenFromClipboardRequested?.Invoke())
{ {
Font = new Font(SystemFonts.MenuFont ?? Control.DefaultFont, FontStyle.Bold) Font = new Font(SystemFonts.MenuFont ?? Control.DefaultFont, FontStyle.Bold)
}; };
menu.Items.Add(openClipboard); menu.Items.Add(_clipboardItem);
menu.Items.Add("Afbeelding openen...", null, (_, _) => OpenFileRequested?.Invoke()); menu.Items.Add("Afbeelding openen...", null, (_, _) => OpenFileRequested?.Invoke());
menu.Items.Add(new ToolStripSeparator()); menu.Items.Add(new ToolStripSeparator());
_snipItem = new ToolStripMenuItem("Rechthoek knippen", null, (_, _) => SnipRequested?.Invoke()); _snipItem = new ToolStripMenuItem("Rechthoek knippen", null, (_, _) => SnipRequested?.Invoke());
@@ -71,8 +72,9 @@ internal sealed class TrayIcon : IDisposable
public bool IsPaused => _pauseItem.Checked; public bool IsPaused => _pauseItem.Checked;
/// <summary>Toont de sneltoetsen naast de menu-items; null = geen sneltoets.</summary> /// <summary>Toont de sneltoetsen naast de menu-items; null = geen sneltoets.</summary>
public void SetHotkeys(string? snip, string? window, string? record, string? gif) public void SetHotkeys(string? snip, string? window, string? record, string? gif, string? clipboard)
{ {
_clipboardItem.ShortcutKeyDisplayString = clipboard;
_snipItem.ShortcutKeyDisplayString = snip; _snipItem.ShortcutKeyDisplayString = snip;
_windowItem.ShortcutKeyDisplayString = window; _windowItem.ShortcutKeyDisplayString = window;
_recordItem.ShortcutKeyDisplayString = record; _recordItem.ShortcutKeyDisplayString = record;
+1 -1
View File
@@ -18,7 +18,7 @@
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
<Product>kniip</Product> <Product>kniip</Product>
<Description>Annotatie-editor naast het Windows Knipprogramma</Description> <Description>Annotatie-editor naast het Windows Knipprogramma</Description>
<Version>1.1.2</Version> <Version>1.1.3</Version>
<SatelliteResourceLanguages>nl;en</SatelliteResourceLanguages> <SatelliteResourceLanguages>nl;en</SatelliteResourceLanguages>
<!-- WPF regelt DPI via app.manifest; de WinForms-analyzer is hier niet van toepassing. --> <!-- WPF regelt DPI via app.manifest; de WinForms-analyzer is hier niet van toepassing. -->
<NoWarn>$(NoWarn);WFAC010</NoWarn> <NoWarn>$(NoWarn);WFAC010</NoWarn>
+3
View File
@@ -63,6 +63,9 @@ public sealed class AppSettings
/// <summary>Sneltoets voor een screencast die als GIF wordt aangeboden.</summary> /// <summary>Sneltoets voor een screencast die als GIF wordt aangeboden.</summary>
public string GifHotkey { get; set; } = "Ctrl+Shift+G"; public string GifHotkey { get; set; } = "Ctrl+Shift+G";
/// <summary>Sneltoets om de afbeelding op het klembord in de editor te openen; standaard geen.</summary>
public string ClipboardHotkey { get; set; } = "";
public bool RecordSystemAudio { get; set; } = true; public bool RecordSystemAudio { get; set; } = true;
public bool RecordMicrophone { get; set; } public bool RecordMicrophone { get; set; }
public bool RecordShowCursor { get; set; } = true; public bool RecordShowCursor { get; set; } = true;
+8 -1
View File
@@ -127,13 +127,20 @@
<Button Tag="Record" Style="{StaticResource FlatButton}" Content="Geen" Click="ClearHotkey_Click" Margin="6,0,0,0" <Button Tag="Record" Style="{StaticResource FlatButton}" Content="Geen" Click="ClearHotkey_Click" Margin="6,0,0,0"
ToolTip="Geen sneltoets gebruiken" /> ToolTip="Geen sneltoets gebruiken" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,6"> <StackPanel Orientation="Horizontal" Margin="0,0,0,4">
<TextBlock Text="Screencast (GIF)" VerticalAlignment="Center" Width="150" /> <TextBlock Text="Screencast (GIF)" VerticalAlignment="Center" Width="150" />
<Button x:Name="GifHotkeyButton" Tag="Gif" Style="{StaticResource SecondaryButton}" Width="170" Margin="0" <Button x:Name="GifHotkeyButton" Tag="Gif" Style="{StaticResource SecondaryButton}" Width="170" Margin="0"
Click="HotkeyButton_Click" ToolTip="Klik en druk daarna de gewenste toetscombinatie in" /> Click="HotkeyButton_Click" ToolTip="Klik en druk daarna de gewenste toetscombinatie in" />
<Button Tag="Gif" Style="{StaticResource FlatButton}" Content="Geen" Click="ClearHotkey_Click" Margin="6,0,0,0" <Button Tag="Gif" Style="{StaticResource FlatButton}" Content="Geen" Click="ClearHotkey_Click" Margin="6,0,0,0"
ToolTip="Geen sneltoets gebruiken" /> ToolTip="Geen sneltoets gebruiken" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,6">
<TextBlock Text="Vanaf klembord" VerticalAlignment="Center" Width="150" />
<Button x:Name="ClipboardHotkeyButton" Tag="Clipboard" Style="{StaticResource SecondaryButton}" Width="170" Margin="0"
Click="HotkeyButton_Click" ToolTip="Klik en druk daarna de gewenste toetscombinatie in; opent de afbeelding op het klembord" />
<Button Tag="Clipboard" Style="{StaticResource FlatButton}" Content="Geen" Click="ClearHotkey_Click" Margin="6,0,0,0"
ToolTip="Geen sneltoets gebruiken" />
</StackPanel>
<TextBlock x:Name="HotkeyHint" Style="{StaticResource Hint}" Margin="0,0,0,4" /> <TextBlock x:Name="HotkeyHint" Style="{StaticResource Hint}" Margin="0,0,0,4" />
</StackPanel> </StackPanel>
</TabItem> </TabItem>
@@ -26,6 +26,7 @@ public partial class SettingsWindow : Window
["Window"] = "venster knippen", ["Window"] = "venster knippen",
["Record"] = "screencast (MP4)", ["Record"] = "screencast (MP4)",
["Gif"] = "screencast (GIF)", ["Gif"] = "screencast (GIF)",
["Clipboard"] = "bewerken vanaf klembord",
}; };
private readonly AppSettings _settings; private readonly AppSettings _settings;
@@ -62,6 +63,7 @@ public partial class SettingsWindow : Window
["Window"] = WindowHotkeyButton, ["Window"] = WindowHotkeyButton,
["Record"] = RecordHotkeyButton, ["Record"] = RecordHotkeyButton,
["Gif"] = GifHotkeyButton, ["Gif"] = GifHotkeyButton,
["Clipboard"] = ClipboardHotkeyButton,
}; };
HotkeyHint.Text = App.Instance.HotkeyHook?.IsActive == true HotkeyHint.Text = App.Instance.HotkeyHook?.IsActive == true
@@ -105,6 +107,7 @@ public partial class SettingsWindow : Window
_hotkeys["Window"] = settings.WindowHotkey; _hotkeys["Window"] = settings.WindowHotkey;
_hotkeys["Record"] = settings.RecordHotkey; _hotkeys["Record"] = settings.RecordHotkey;
_hotkeys["Gif"] = settings.GifHotkey; _hotkeys["Gif"] = settings.GifHotkey;
_hotkeys["Clipboard"] = settings.ClipboardHotkey;
foreach (string id in _hotkeys.Keys) foreach (string id in _hotkeys.Keys)
{ {
ShowHotkey(id); ShowHotkey(id);
@@ -438,6 +441,7 @@ public partial class SettingsWindow : Window
_settings.WindowHotkey = _hotkeys["Window"]; _settings.WindowHotkey = _hotkeys["Window"];
_settings.RecordHotkey = _hotkeys["Record"]; _settings.RecordHotkey = _hotkeys["Record"];
_settings.GifHotkey = _hotkeys["Gif"]; _settings.GifHotkey = _hotkeys["Gif"];
_settings.ClipboardHotkey = _hotkeys["Clipboard"];
_settings.RecordSystemAudio = SystemAudioBox.IsChecked == true; _settings.RecordSystemAudio = SystemAudioBox.IsChecked == true;
_settings.RecordMicrophone = MicrophoneBox.IsChecked == true; _settings.RecordMicrophone = MicrophoneBox.IsChecked == true;
_settings.RecordShowCursor = ShowCursorBox.IsChecked == true; _settings.RecordShowCursor = ShowCursorBox.IsChecked == true;