using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using PdfSharpCore.Pdf;
namespace KillerPDF
{
///
/// Outward stubs: the annotation, text, crop, form and link members under the names the rest of
/// the window already calls them by.
///
/// The point of this file is that ~170 call sites across ContextMenu.cs, TextSettingsBar.cs,
/// KeyboardShortcuts.cs, FileOperations.cs, Tabs.cs, Signing.cs, Shapes.cs, Search.cs,
/// SidebarOutline.cs, Stamps.cs, ToolSelection.cs, TempReload.cs, Rotate.cs, Ocr.cs and
/// DirtyTracking.cs need no changes at all.
///
/// THE XAML ONES ARE NOT OPTIONAL. WPF resolves Click="Undo_Click" against the code-behind of
/// the XAML ROOT - MainWindow - not against whichever class the method ended up in. Eleven
/// handlers in MainWindow.xaml point at members that now live in the viewer, and without these
/// declarations InitializeComponent throws XamlParseException before the window ever appears.
/// Verified against MainWindow.xaml rather than remembered: Undo_Click (2 bindings),
/// ClearAllAnnotations_Click (2), PageJumpBox_KeyDown, PageJumpBox_GotFocus,
/// PageList_SelectionChanged, ShortcutHelp_Click, ShortcutOverlay_MouseLeftButtonDown (2),
/// ShortcutOverlayCard_MouseLeftButtonDown (2), ShortcutOverlayClose_Click,
/// Hyperlink_RequestNavigate.
///
public partial class MainWindow
{
// ── Annotations ──────────────────────────────────────────────────────────────────────
private void RenderAllAnnotations(int pageIndex) => ActiveViewer.RenderAllAnnotations(pageIndex);
private void ClearSelection() => ActiveViewer.ClearSelection();
private void ClearTextSelection() => ActiveViewer.ClearTextSelection();
private SolidColorBrush AccentBrush(byte alpha = 255) => ActiveViewer.AccentBrush(alpha);
private void AddAnnotation(PageAnnotation a) => ActiveViewer.AddAnnotationExt(a);
private Rect AnnotBounds(PageAnnotation a) => ActiveViewer.AnnotBoundsExt(a);
private static Point AnnotGetPos(PageAnnotation a) => Controls.PdfViewer.AnnotGetPosExt(a);
private static void AnnotSetPos(PageAnnotation a, Point pos) => Controls.PdfViewer.AnnotSetPosExt(a, pos);
private Point ClampAnnotPos(PageAnnotation a) => ActiveViewer.ClampAnnotPosExt(a);
private bool HitTestAnnotation(PageAnnotation a, Point pos, out Rect bounds)
=> ActiveViewer.HitTestAnnotationExt(a, pos, out bounds);
private static bool IsDraggable(PageAnnotation a) => Controls.PdfViewer.IsDraggableExt(a);
private void SelectAnnotation(PageAnnotation a, Rect bounds) => ActiveViewer.SelectAnnotationExt(a, bounds);
private void ToggleMultiSelect(PageAnnotation a, Rect bounds, Canvas canvas)
=> ActiveViewer.ToggleMultiSelectExt(a, bounds, canvas);
private void SelectGroup(PageAnnotation lead) => ActiveViewer.SelectGroupExt(lead);
private PageAnnotation? SelectedPaired() => ActiveViewer.SelectedPairedExt();
private int SelectionCount() => ActiveViewer.SelectionCountExt();
private void ReattachSelectionVisuals() => ActiveViewer.ReattachSelectionVisualsExt();
private void UnpairSelected() => ActiveViewer.UnpairSelectedExt();
private void GroupSelected() => ActiveViewer.GroupSelectedExt();
private void UngroupAnnotation(PageAnnotation a) => ActiveViewer.UngroupAnnotationExt(a);
private void RemoveFromGroup(PageAnnotation a) => ActiveViewer.RemoveFromGroupExt(a);
private void DeleteSelected() => ActiveViewer.DeleteSelectedExt();
private bool SelectAllAnnotations() => ActiveViewer.SelectAllAnnotationsExt();
private void HideBrushPreview() => ActiveViewer.HideBrushPreviewExt();
private void FinishStuckGesture() => ActiveViewer.FinishStuckGestureExt();
private void RefreshSelectionAccent() => ActiveViewer.RefreshSelectionAccentExt();
// ── Page canvases ────────────────────────────────────────────────────────────────────
private Canvas CanvasForPage(int page) => ActiveViewer.CanvasForPageExt(page);
private Canvas? VisibleCanvasForPage(int page) => ActiveViewer.VisibleCanvasForPageExt(page);
private IEnumerable