-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlotView.cs
120 lines (92 loc) · 2.96 KB
/
PlotView.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace GraphSharp
{
public partial class PlotView : UserControl
{
public string expression { get; set; }
public Color color { get; set; }
private List<string> usingDirectives = new List<string>();
private Form1 mainForm;
[JsonConstructor]
public PlotView(string expression, Color color)
{
this.expression = expression;
this.color = color;
InitializeComponent();
}
public PlotView(Form1 mainForm, string expression, Color color)
{
this.mainForm = mainForm;
this.expression = expression;
this.color = color;
InitializeComponent();
}
public void SetMainForm(Form1 mainForm)
{
this.mainForm = mainForm;
}
public string GetExpression()
{
return expression;
}
public string[] GetUsingDirectives()
{
return usingDirectives.ToArray();
}
public Pen GetPen()
{
return new Pen(color);
}
private void PlotView_Load(object sender, EventArgs e)
{
fastColoredTextBox1.Text = expression;
panel1.BackColor = color;
}
private void panel1_Click(object sender, EventArgs e)
{
ColorDialog colorDialog = new ColorDialog();
colorDialog.Color = color;
if (colorDialog.ShowDialog() == DialogResult.OK)
{
// Update the selected color
color = colorDialog.Color;
panel1.BackColor = color;
}
}
private void panel2_Click(object sender, EventArgs e)
{
mainForm.RemoveExpView(this);
}
private void fastColoredTextBox1_TextChanged(object sender, FastColoredTextBoxNS.TextChangedEventArgs e)
{
}
private void fastColoredTextBox1_TextChangedDelayed(object sender, FastColoredTextBoxNS.TextChangedEventArgs e)
{
expression = fastColoredTextBox1.Text;
}
private void hopeButton1_Click(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
string use = Microsoft.VisualBasic.Interaction.InputBox("Add or delete a using directive for this node, enter the name of the directive e.x: System.Drawing", "Add/Delete Using Directives", "System.Drawing");
if (usingDirectives.Contains(use))
{
usingDirectives.Remove(use);
}
else
{
usingDirectives.Add(use);
}
}
}
}