Files
OpenNest/OpenNest.Avalonia/NestView.axaml
T
aj f11f77f879 feat(avalonia): add parts from the drawing list
As in the WinForms nest window, a part can be added from the Drawings
tab two ways. Pressing a drawing picks it up: when the pointer then
enters the plate view, the place tool starts with one part of the
drawing selected in the list, placed by a click, Enter or F1 like a
copy. Dragging a drawing onto the plate adds one part centred where it
is dropped, as one Add Part step.

A drop is refused while Auto Nest runs on the nest and for a drawing of
another nest. A double-click, a drop (at once, before the pointer can
re-enter the plate on X11 and macOS), Edit > Cut or Copy, or an Undo
puts the pick-up down, and the plate takes it only once. The list
selects one drawing at a time and keeps it selected when rebuilt.

As in WinForms, the pointer entering the plate view gives it the
keyboard, and a dropped part leaves the cut-offs as they are.
2026-11-17 17:36:19 -05:00

43 lines
2.2 KiB
XML

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="using:OpenNest.Avalonia.Controls"
xmlns:local="using:OpenNest.Avalonia"
x:Class="OpenNest.Avalonia.NestView">
<Grid ColumnDefinitions="290,4,*">
<Border Grid.Column="0" Background="White">
<TabControl x:Name="SideTabs" Padding="0">
<TabItem Header="Plates" FontSize="14" MinHeight="34">
<ListBox x:Name="PlateList" SelectionChanged="OnPlateSelected" />
</TabItem>
<TabItem Header="Drawings" FontSize="14" MinHeight="34">
<DataGrid x:Name="DrawingGrid" x:DataType="local:DrawingRow" IsReadOnly="True"
SelectionMode="Single"
FontSize="13" AutoGenerateColumns="False"
GridLinesVisibility="Horizontal" CanUserSortColumns="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Drawing" Binding="{Binding Name}" Width="*" />
<DataGridTextColumn Header="Nested" Binding="{Binding Nested}" />
<DataGridTextColumn Header="Required" Binding="{Binding Required}" />
</DataGrid.Columns>
</DataGrid>
</TabItem>
</TabControl>
</Border>
<GridSplitter Grid.Column="1" ResizeDirection="Columns" Background="#D0D4D8" />
<DockPanel Grid.Column="2">
<Border DockPanel.Dock="Top" Padding="8,4" Background="White"
BorderBrush="#D0D4D8" BorderThickness="0,0,0,1">
<StackPanel Orientation="Horizontal" Spacing="6">
<Button Content="&#x23EE;" ToolTip.Tip="First plate" Click="OnFirstPlate" />
<Button Content="&#x25C0;" ToolTip.Tip="Previous plate (Page Up)"
Click="OnPreviousPlate" />
<TextBlock x:Name="PlateLabel" VerticalAlignment="Center" FontSize="13" Margin="6,0" />
<Button Content="&#x25B6;" ToolTip.Tip="Next plate (Page Down)" Click="OnNextPlate" />
<Button Content="&#x23ED;" ToolTip.Tip="Last plate" Click="OnLastPlate" />
</StackPanel>
</Border>
<c:PlateCanvas x:Name="Canvas" />
</DockPanel>
</Grid>
</UserControl>