Added pasting new memes, fixed offsets and changed out tray icon.

This commit is contained in:
Ebbe Baß
2026-08-19 10:15:16 +02:00
parent 4c755919d4
commit b6644ebecf
11 changed files with 226 additions and 9 deletions
@@ -75,9 +75,11 @@
</Setter>
</Style>
<!-- Shared by the favourites row and the main grid so both behave identically. -->
<!-- Shared by the favourites row and the main grid so both behave identically.
No fixed Width: the tile stretches to fill its UniformGrid cell, so a row always
spans the full panel width instead of leaving a ragged gap on the right. -->
<DataTemplate x:Key="MemeTileTemplate" DataType="{x:Type vm:MemeTileViewModel}">
<Grid Width="88" Height="88" Margin="4">
<Grid Height="118" Margin="4">
<Button Padding="0"
Style="{StaticResource FlatButtonStyle}"
Command="{Binding DataContext.SelectItemCommand, ElementName=RootWindow}"
@@ -96,7 +98,7 @@
CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
</ContextMenu>
</Button.ContextMenu>
<Image Source="{Binding Thumbnail}" Stretch="Uniform" Width="80" Height="80"/>
<Image Source="{Binding Thumbnail}" Stretch="Uniform" Margin="5"/>
</Button>
<!-- Star overlay: marks favourites at a glance without needing a second grid. -->
@@ -174,7 +176,7 @@
ItemTemplate="{StaticResource MemeTileTemplate}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal"/>
<UniformGrid Columns="3"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
@@ -182,7 +184,7 @@
</StackPanel>
<Grid>
<TextBlock Text="No memes yet. Click + or drag files in here."
<TextBlock Text="No memes yet. Click +, drag files in, or paste with Ctrl+V."
Foreground="#7B7D85" FontSize="13"
HorizontalAlignment="Center" VerticalAlignment="Center"
TextWrapping="Wrap" TextAlignment="Center" Width="260"
@@ -207,7 +209,7 @@
ItemTemplate="{StaticResource MemeTileTemplate}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal"/>
<UniformGrid Columns="3"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
@@ -108,6 +108,27 @@ public partial class PickerWindow : Window
if (e.Key == Key.Escape) Hide();
}
/// <summary>
/// Ctrl+V adds whatever image is on the clipboard to the local library. The clipboard is
/// inspected synchronously so the decision to swallow the keystroke can be made before the
/// event reaches the search box - when the clipboard holds plain text instead, the paste is
/// deliberately left alone so it still lands in the search field as normal.
/// </summary>
protected override void OnPreviewKeyDown(KeyEventArgs e)
{
if (e.Key == Key.V && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
{
var payload = _viewModel.ReadClipboardImage();
if (payload is not null)
{
e.Handled = true;
_ = _viewModel.ImportClipboardAsync(payload);
}
}
base.OnPreviewKeyDown(e);
}
private void PickerWindow_OnDragOver(object sender, DragEventArgs e)
{
e.Effects = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;