File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml"
33 xmlns : d =" http://schemas.microsoft.com/expression/blend/2008"
44 xmlns : mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"
5+ xmlns : svg =" using:Avalonia.Svg.Skia"
56 mc : Ignorable =" d" d : DesignWidth =" 800" d : DesignHeight =" 450"
67 x : Class =" ZXBasicStudio.Controls.ZXOutputLog" >
7- <ScrollViewer HorizontalAlignment =" Stretch" VerticalAlignment =" Stretch" Background =" #FF202020" Name =" scrOutput" VerticalScrollBarVisibility =" Auto" >
8- <TextBlock TextWrapping =" Wrap" Foreground =" White" Name =" tbOutput" Padding =" 10" ></TextBlock >
9- </ScrollViewer >
10- </UserControl >
8+ <UserControl .ContextMenu>
9+ <ContextMenu Placement =" Pointer" >
10+ <MenuItem Header =" Clear output window" Name =" mnuClearOutputWindow" />
11+ <MenuItem Header =" Copy to clipboard" Name =" mnuCopyToClipboard" />
12+ </ContextMenu >
13+ </UserControl .ContextMenu>
14+ <Grid RowDefinitions =" auto,*" >
15+ <Grid ColumnDefinitions =" 1*" DataContext =" .ZXMemoryView" >
16+ <StackPanel Grid.Row=" 0" Spacing =" 2" Orientation =" Horizontal" Margin =" 2,4" HorizontalAlignment =" Left" >
17+ <Button Width =" 30" Foreground =" Black" Classes =" toolbar" Name =" btnClearOutputWindow" ToolTip.Tip=" Clear output window" ><svg : Svg Path =" /Svg/eraser-solid.svg" ></svg : Svg ></Button >
18+ <Button Width =" 30" Foreground =" Black" Classes =" toolbar" Name =" btnCopyToClipboard" ToolTip.Tip=" Copy output log to clipboard" ><svg : Svg Path =" /Svg/copy-solid.svg" ></svg : Svg ></Button >
19+ </StackPanel >
20+ </Grid >
21+ <Grid Grid.Row=" 1" >
22+ <ScrollViewer HorizontalAlignment =" Stretch" VerticalAlignment =" Stretch" Background =" #FF202020" Name =" scrOutput"
23+ VerticalScrollBarVisibility =" Auto" >
24+ <TextBlock TextWrapping =" Wrap" Foreground =" White" Name =" tbOutput" Padding =" 10" ></TextBlock >
25+ </ScrollViewer >
26+ </Grid >
27+ </Grid >
28+ </UserControl >
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Threading . Tasks ;
13using Avalonia . Controls ;
4+ using Avalonia ;
5+ using Avalonia . Controls . ApplicationLifetimes ;
26using ZXBasicStudio . Classes ;
37
48namespace ZXBasicStudio . Controls
@@ -8,16 +12,40 @@ public partial class ZXOutputLog : UserControl
812 ZXLogTextWriter _writer ;
913
1014 public ZXLogTextWriter Writer { get { return _writer ; } }
11-
15+
16+
1217 public ZXOutputLog ( )
1318 {
1419 InitializeComponent ( ) ;
1520 _writer = new ZXLogTextWriter ( tbOutput , scrOutput ) ;
21+ mnuClearOutputWindow . Click += ClearOutputWindow ;
22+ mnuCopyToClipboard . Click += CopyToClipboard ;
23+ btnClearOutputWindow . Click += ClearOutputWindow ;
24+ btnCopyToClipboard . Click += CopyToClipboard ;
1625 }
1726
1827 public void Clear ( )
1928 {
2029 tbOutput . Text = "" ;
2130 }
31+
32+ private async void ClearOutputWindow ( object ? sender , Avalonia . Interactivity . RoutedEventArgs e )
33+ {
34+ tbOutput . Text = "" ;
35+ }
36+
37+ private async void CopyToClipboard ( object ? sender , Avalonia . Interactivity . RoutedEventArgs e )
38+ {
39+ await DoSetClipboardTextAsync ( tbOutput . Text ) ;
40+ }
41+
42+ private async Task DoSetClipboardTextAsync ( string ? text )
43+ {
44+ if ( Application . Current ? . ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop ||
45+ desktop . MainWindow ? . Clipboard is not { } provider )
46+ throw new NullReferenceException ( "Missing Clipboard instance." ) ;
47+
48+ await provider . SetTextAsync ( text ) ;
49+ }
2250 }
2351}
Original file line number Diff line number Diff line change 397397 <AvaloniaResource Include =" Svg\diagram-project-solid.svg" />
398398 <AvaloniaResource Include =" Svg\display-lines-solid.svg" />
399399 <AvaloniaResource Include =" Svg\dumpster-solid.svg" />
400+ <AvaloniaResource Include =" Svg\eraser-solid.svg" />
400401 <AvaloniaResource Include =" Svg\eject-solid.svg" />
401402 <AvaloniaResource Include =" Svg\file-arrow-down-solid.svg" />
402403 <AvaloniaResource Include =" Svg\file-circle-minus-solid.svg" />
459460 <AvaloniaResource Include =" Svg\White\display-lines-solid.svg" />
460461 <AvaloniaResource Include =" Svg\White\dumpster-solid.svg" />
461462 <AvaloniaResource Include =" Svg\White\eject-solid.svg" />
463+ <AvaloniaResource Include =" Svg\White\eraser-solid.svg" />
462464 <AvaloniaResource Include =" Svg\White\file-arrow-down-solid.svg" />
463465 <AvaloniaResource Include =" Svg\White\file-circle-minus-solid.svg" />
464466 <AvaloniaResource Include =" Svg\White\file-circle-plus-solid.svg" />
525527 <PackageReference Include =" CommunityToolkit.Mvvm" Version =" 8.2.1" />
526528 <PackageReference Include =" Newtonsoft.Json" Version =" 13.0.3" />
527529 <PackageReference Include =" System.Resources.ResourceManager" Version =" 4.3.0" />
530+ <PackageReference Include =" TextCopy" Version =" 6.2.1" />
528531 </ItemGroup >
529532
530533 <ItemGroup >
You can’t perform that action at this time.
0 commit comments