BioGTK  6.7.0
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images. Including whole slide, pyramidal, and series.
Loading...
Searching...
No Matches
Recorder.cs
1using Gtk;
2using Gdk;
3using System;
4using System.Collections.Generic;
5using System.Linq;
6using System.Text;
7using System.Threading.Tasks;
8using System.Runtime.CompilerServices;
9using System.IO;
10
11namespace BioGTK
12{
13
14 public class Recorder : Gtk.Window
15 {
16 #region Properties
17 private Builder _builder;
18#pragma warning disable 649
19
20 [Builder.Object]
21 private Gtk.Button clearBut;
22 [Builder.Object]
23 private Gtk.Button copyBut;
24 [Builder.Object]
25 private Gtk.CheckButton internalBox;
26 [Builder.Object]
27 private Gtk.TextView textBox;
28 public bool Internal
29 {
30 get
31 {
32 return internalBox.Active;
33 }
34 }
35#pragma warning restore 649
36
37 #endregion
38
39 #region Constructors / Destructors
40
44 public static Recorder Create()
45 {
46 Builder builder = new Builder(new FileStream(System.IO.Path.GetDirectoryName(Environment.ProcessPath) + "/" + "Glade/Recorder.glade", FileMode.Open));
47 return new Recorder(builder, builder.GetObject("recorderWindow").Handle);
48 }
49
50 /* The constructor for the class. */
51 protected Recorder(Builder builder, IntPtr handle) : base(handle)
52 {
53 _builder = builder;
54 builder.Autoconnect(this);
56 App.ApplyStyles(this);
57 }
58
59
60 #endregion
61
62 #region Handlers
63
65 protected void SetupHandlers()
66 {
67 clearBut.Clicked += ClearBut_Clicked;
68 copyBut.Clicked += CopyBut_Clicked;
69 internalBox.Activated += InternalBox_Activated;
70 this.FocusInEvent += Recorder_FocusActivated;
71 }
72
73 private void InternalBox_Activated(object sender, EventArgs e)
74 {
75 if (internalBox.Active)
76 BioLib.Recorder.Internal = true;
77 else
78 BioLib.Recorder.Internal = false;
79 }
80
81 private void CopyBut_Clicked(object sender, EventArgs e)
82 {
83 // Get the default clipboard
84 Clipboard clipboard = Clipboard.Get(Gdk.Selection.Clipboard);
85 string s = "";
86 for (int i = 0; i < BioLib.Recorder.Lines.Length; i++)
87 {
88 s += BioLib.Recorder.Lines[i] + Environment.NewLine;
89 }
90 clipboard.Text = s;
91 }
92
98 private void Recorder_DeleteEvent(object o, DeleteEventArgs args)
99 {
100 args.RetVal = true;
101 Hide();
102 }
103
108 private void Recorder_FocusActivated(object sender, EventArgs e)
109 {
110 textBox.Buffer.Text = "";
111 for (int i = 0; i < BioLib.Recorder.Lines.Length; i++)
112 {
113 textBox.Buffer.Text += BioLib.Recorder.Lines[i] + Environment.NewLine;
114 }
115 }
116
121 private void ClearBut_Clicked(object? sender, EventArgs e)
122 {
123 textBox.Buffer.Text = "";
124 BioLib.Recorder.Clear();
125 }
126 #endregion
127
128 }
129}
void SetupHandlers()
It sets up the event handlers for the delete event and the clear button.
Definition Recorder.cs:65
static Recorder Create()
Definition Recorder.cs:44
Definition ML.cs:17
Definition Zarr.cs:20