-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetupForm.cs
More file actions
125 lines (109 loc) · 4.48 KB
/
Copy pathSetupForm.cs
File metadata and controls
125 lines (109 loc) · 4.48 KB
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
121
122
123
124
125
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;
using ajkControls.Primitive;
namespace pluginVerilog
{
public partial class SetupForm : Form
{
public SetupForm()
{
InitializeComponent();
IcarusVerilogTsmi.Image = Global.Icons.IcarusVerilog.GetImage(
codeEditor.Controller.NavigatePanel.GetContextMenuStrip().ImageScalingSize.Height,
IconImage.ColorStyle.Original );
iVerilogRunTsmi.Image = codeEditor.Global.IconImages.Play.GetImage(
codeEditor.Controller.NavigatePanel.GetContextMenuStrip().ImageScalingSize.Height,
IconImage.ColorStyle.Blue);
gtkWaveTsmi.Image = codeEditor.Global.IconImages.Wave0.GetImage(
codeEditor.Controller.NavigatePanel.GetContextMenuStrip().ImageScalingSize.Height,
IconImage.ColorStyle.Blue);
CreateVerilogFileTsmi.Image = Global.Icons.Verilog.GetImage(
codeEditor.Controller.NavigatePanel.GetContextMenuStrip().ImageScalingSize.Height,
IconImage.ColorStyle.Blue);
}
private void IVerilogRunTsmi_Click(object sender, EventArgs e)
{
codeEditor.NavigatePanel.NavigatePanelNode node;
codeEditor.Controller.NavigatePanel.GetSelectedNode(out node);
NavigatePanel.VerilogFileNode vnode = node as NavigatePanel.VerilogFileNode;
if (vnode == null) return;
Data.VerilogFile topFile = vnode.VerilogFile;
if (topFile == null) return;
IcarusVerilog.SimulationTab tabPage = new IcarusVerilog.SimulationTab(topFile);
codeEditor.Controller.Tabs.AddPage(tabPage);
}
private void GtkWaveTsmi_Click(object sender, EventArgs e)
{
}
private void CreateVerilogFileTsmi_Click(object sender, EventArgs e)
{
codeEditor.NavigatePanel.NavigatePanelNode node;
codeEditor.Controller.NavigatePanel.GetSelectedNode(out node);
var item = node.Item;
codeEditor.Data.Project project = item.Project;
string path;
if(item == null)
{
path = project.RootPath;
}
else
{
path = project.GetAbsolutePath(item.RelativePath);
}
if (!System.IO.Directory.Exists(path))
{
path = path.Substring(0, path.LastIndexOf(@"\"));
if (!System.IO.Directory.Exists(path))
{
return;
}
}
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.FileName = "new.v";
saveFileDialog.InitialDirectory = path;
saveFileDialog.Filter = "verilog file (*.v)|*.v";
if( codeEditor.Controller.ShowDialogForm(saveFileDialog) == DialogResult.OK)
{
System.IO.Stream stream = saveFileDialog.OpenFile();
string moduleName = saveFileDialog.FileName;
if (moduleName.Contains('\\')) moduleName = moduleName.Substring(moduleName.LastIndexOf('\\')+1);
if (moduleName.Contains('.')) moduleName = moduleName.Substring(0, moduleName.IndexOf('.'));
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(stream))
{
sw.Write("module ");
sw.Write(moduleName);
sw.Write(";\r\n");
sw.Write("\r\n");
sw.Write("endmodule ");
sw.Write("\r\n");
}
}
if(item == null)
{
project.Update();
}
else
{
item.Update();
}
codeEditor.Controller.NavigatePanel.UpdateVisibleNode();
}
private void checkParseDataToolStripMenuItem_Click(object sender, EventArgs e)
{
codeEditor.NavigatePanel.NavigatePanelNode node;
codeEditor.Controller.NavigatePanel.GetSelectedNode(out node);
var item = node.Item;
codeEditor.Data.Project project = item.Project;
string path;
if (item == null) return;
path = project.GetAbsolutePath(item.RelativePath);
}
}
}