Changed code to use RtfToSvg.cs and convert directly from VE-PROMS\Format folder using "RTF" files. The "RTF" files are not truely Rich Text Format, they are Bang Files containing the GenMac macros for Windows printing.

This commit is contained in:
Rich 2010-05-01 10:20:50 +00:00
parent fdf3284d8f
commit 52f5166e99

View File

@ -33,6 +33,7 @@ namespace fmtxml
private Button btnBrowseResult; private Button btnBrowseResult;
private StatusStrip statusStrip1; private StatusStrip statusStrip1;
private ToolStripStatusLabel tsslStatus; private ToolStripStatusLabel tsslStatus;
private Button btnRtfToSvg;
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
@ -98,6 +99,7 @@ namespace fmtxml
this.btnBrowseResult = new System.Windows.Forms.Button(); this.btnBrowseResult = new System.Windows.Forms.Button();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.tsslStatus = new System.Windows.Forms.ToolStripStatusLabel(); this.tsslStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.btnRtfToSvg = new System.Windows.Forms.Button();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -120,7 +122,7 @@ namespace fmtxml
// //
// btnExit // btnExit
// //
this.btnExit.Location = new System.Drawing.Point(508, 186); this.btnExit.Location = new System.Drawing.Point(528, 194);
this.btnExit.Name = "btnExit"; this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(64, 24); this.btnExit.Size = new System.Drawing.Size(64, 24);
this.btnExit.TabIndex = 2; this.btnExit.TabIndex = 2;
@ -129,13 +131,17 @@ namespace fmtxml
// //
// listBox1 // listBox1
// //
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listBox1.Location = new System.Drawing.Point(8, 224); this.listBox1.Location = new System.Drawing.Point(8, 224);
this.listBox1.Name = "listBox1"; this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(584, 368); this.listBox1.Size = new System.Drawing.Size(579, 316);
this.listBox1.TabIndex = 3; this.listBox1.TabIndex = 3;
// //
// btnCvtGenmac // btnCvtGenmac
// //
this.btnCvtGenmac.Enabled = false;
this.btnCvtGenmac.Location = new System.Drawing.Point(8, 149); this.btnCvtGenmac.Location = new System.Drawing.Point(8, 149);
this.btnCvtGenmac.Name = "btnCvtGenmac"; this.btnCvtGenmac.Name = "btnCvtGenmac";
this.btnCvtGenmac.Size = new System.Drawing.Size(153, 40); this.btnCvtGenmac.Size = new System.Drawing.Size(153, 40);
@ -145,6 +151,7 @@ namespace fmtxml
// //
// btnCvtXmlToSVG // btnCvtXmlToSVG
// //
this.btnCvtXmlToSVG.Enabled = false;
this.btnCvtXmlToSVG.Location = new System.Drawing.Point(166, 147); this.btnCvtXmlToSVG.Location = new System.Drawing.Point(166, 147);
this.btnCvtXmlToSVG.Name = "btnCvtXmlToSVG"; this.btnCvtXmlToSVG.Name = "btnCvtXmlToSVG";
this.btnCvtXmlToSVG.Size = new System.Drawing.Size(152, 44); this.btnCvtXmlToSVG.Size = new System.Drawing.Size(152, 44);
@ -200,6 +207,7 @@ namespace fmtxml
// //
// tbGenmacPath // tbGenmacPath
// //
this.tbGenmacPath.Enabled = false;
this.tbGenmacPath.Location = new System.Drawing.Point(129, 125); this.tbGenmacPath.Location = new System.Drawing.Point(129, 125);
this.tbGenmacPath.Name = "tbGenmacPath"; this.tbGenmacPath.Name = "tbGenmacPath";
this.tbGenmacPath.Size = new System.Drawing.Size(296, 20); this.tbGenmacPath.Size = new System.Drawing.Size(296, 20);
@ -207,6 +215,7 @@ namespace fmtxml
// //
// btnBrowseGenmac // btnBrowseGenmac
// //
this.btnBrowseGenmac.Enabled = false;
this.btnBrowseGenmac.Location = new System.Drawing.Point(440, 124); this.btnBrowseGenmac.Location = new System.Drawing.Point(440, 124);
this.btnBrowseGenmac.Name = "btnBrowseGenmac"; this.btnBrowseGenmac.Name = "btnBrowseGenmac";
this.btnBrowseGenmac.Size = new System.Drawing.Size(127, 20); this.btnBrowseGenmac.Size = new System.Drawing.Size(127, 20);
@ -218,6 +227,7 @@ namespace fmtxml
// lblPathGenmac // lblPathGenmac
// //
this.lblPathGenmac.AutoSize = true; this.lblPathGenmac.AutoSize = true;
this.lblPathGenmac.Enabled = false;
this.lblPathGenmac.Location = new System.Drawing.Point(6, 129); this.lblPathGenmac.Location = new System.Drawing.Point(6, 129);
this.lblPathGenmac.Name = "lblPathGenmac"; this.lblPathGenmac.Name = "lblPathGenmac";
this.lblPathGenmac.Size = new System.Drawing.Size(112, 13); this.lblPathGenmac.Size = new System.Drawing.Size(112, 13);
@ -254,9 +264,9 @@ namespace fmtxml
// //
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsslStatus}); this.tsslStatus});
this.statusStrip1.Location = new System.Drawing.Point(0, 607); this.statusStrip1.Location = new System.Drawing.Point(0, 548);
this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(712, 22); this.statusStrip1.Size = new System.Drawing.Size(593, 22);
this.statusStrip1.TabIndex = 19; this.statusStrip1.TabIndex = 19;
this.statusStrip1.Text = "statusStrip1"; this.statusStrip1.Text = "statusStrip1";
// //
@ -266,10 +276,20 @@ namespace fmtxml
this.tsslStatus.Size = new System.Drawing.Size(39, 17); this.tsslStatus.Size = new System.Drawing.Size(39, 17);
this.tsslStatus.Text = "Ready"; this.tsslStatus.Text = "Ready";
// //
// btnRtfToSvg
//
this.btnRtfToSvg.Location = new System.Drawing.Point(394, 145);
this.btnRtfToSvg.Name = "btnRtfToSvg";
this.btnRtfToSvg.Size = new System.Drawing.Size(152, 44);
this.btnRtfToSvg.TabIndex = 20;
this.btnRtfToSvg.Text = "Convert Genmac RTF to SVG (GenMac One Step)";
this.btnRtfToSvg.Click += new System.EventHandler(this.btnRtfToSvg_Click);
//
// Form1 // Form1
// //
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(712, 629); this.ClientSize = new System.Drawing.Size(593, 570);
this.Controls.Add(this.btnRtfToSvg);
this.Controls.Add(this.statusStrip1); this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.btnBrowseResult); this.Controls.Add(this.btnBrowseResult);
this.Controls.Add(this.tbResultPath); this.Controls.Add(this.tbResultPath);
@ -470,7 +490,26 @@ namespace fmtxml
if (Directory.Exists(fbd.SelectedPath)) tbResultPath.Text = fbd.SelectedPath; if (Directory.Exists(fbd.SelectedPath)) tbResultPath.Text = fbd.SelectedPath;
} }
} }
private void btnRtfToSvg_Click(object sender, EventArgs e)
{
// delete current svg's
DirectoryInfo disvg = new DirectoryInfo(tbResultPath.Text + @"\genmacall"); //(@"C:\development\proms.net\genmac.xml");
FileInfo[] fissvg = disvg.GetFiles("*.svg");
foreach (FileInfo fi in fissvg) fi.Delete();
DirectoryInfo di = new DirectoryInfo(tbFmtPath.Text);
FileInfo[] fis = di.GetFiles("*.rtf");
ClearListBox();
foreach (FileInfo fi in fis)
{
// results go to e:\proms.net\genmac.xml
AddFileToListBox(fi);
RtfToSvg myConvert = new RtfToSvg(fi);
if(myConvert.IsGenMac)
myConvert.Save(tbResultPath.Text + @"genmacall\" + fi.Name.ToLower().Replace(".rtf", ".svg"));
}
MessageBox.Show("DONE converting GenMac RTF files to drawing svg - Results are in " + tbResultPath.Text + @"genmacall");
}
// old code: // old code:
//private void button5_Click(object sender, System.EventArgs e) //private void button5_Click(object sender, System.EventArgs e)
//{ //{