Added support for Visio
This commit is contained in:
parent
bb9198aa4f
commit
8defa23e65
@ -156,7 +156,10 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
MyStepRTB.VwMode = MyStepPanel.VwMode;
|
MyStepRTB.VwMode = MyStepPanel.VwMode;
|
||||||
Size sz = GetRtfRawSize(MyStepRTB.Rtf);
|
Size sz = GetRtfRawSize(MyStepRTB.Rtf);
|
||||||
if (MyStepRTB.Rtf == null || MyStepRTB.Rtf == "" || !MyStepRTB.Rtf.ToUpper().Contains("OBJCLASS EQUATION")) // this is a new insert
|
if (MyStepRTB.Rtf == null || MyStepRTB.Rtf == ""
|
||||||
|
|| !(MyStepRTB.Rtf.ToUpper().Contains("OBJCLASS EQU")
|
||||||
|
|| MyStepRTB.Rtf.ToUpper().Contains("OBJCLASS VIS")) //Support Visio
|
||||||
|
) // this is a new insert
|
||||||
{
|
{
|
||||||
sz.Width = 50;
|
sz.Width = 50;
|
||||||
sz.Height = 50;
|
sz.Height = 50;
|
||||||
|
@ -2081,7 +2081,8 @@ namespace Volian.Controls.Library
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
richTextBox1.Paste(frm);
|
richTextBox1.Paste(frm);
|
||||||
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS EQUATION")) hasEquation = true;
|
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS EQU")) hasEquation = true;
|
||||||
|
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS VIS")) hasEquation = true; // Support Visio
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -1031,24 +1031,32 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
else if (InsertingEquation(contenttype))
|
else if (InsertingEquation(contenttype))
|
||||||
{
|
{
|
||||||
// launch equation editor
|
// launch Ole Object Editor - added support for Visio
|
||||||
string EqnEdt = GetEqnEdt();
|
switch (OleObjectEditors)
|
||||||
if (EqnEdt == null)
|
|
||||||
{
|
{
|
||||||
|
case 0: // None
|
||||||
_MyLog.WarnFormat("Equation Editor is not correctly configured in the registry.");
|
_MyLog.WarnFormat("Equation Editor is not correctly configured in the registry.");
|
||||||
MessageBox.Show("The Equation Editor needs to be started.", "Reminder", MessageBoxButtons.OK);
|
MessageBox.Show("The Equation Editor needs to be started.", "Reminder", MessageBoxButtons.OK);
|
||||||
}
|
break;
|
||||||
|
case 1: // Equation Editor
|
||||||
|
Process.Start(EqnEdtPath);
|
||||||
|
break;
|
||||||
|
case 2: // Visio
|
||||||
|
Process.Start(VisioPath);
|
||||||
|
break;
|
||||||
|
case 3: // Both
|
||||||
|
string editor = (sender as ButtonItem).Tag.ToString();
|
||||||
|
if (editor.EndsWith("Visio"))
|
||||||
|
Process.Start(VisioPath);
|
||||||
else
|
else
|
||||||
Process.Start(EqnEdt);
|
Process.Start(EqnEdtPath);
|
||||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype);
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype);
|
_MyEditItem.AddChild((E_FromType)fromtype, contenttype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// the following launches the equation editor based on registry setting:
|
// the following launches the equation editor based on registry setting:
|
||||||
private string GetEqnEdt()
|
private static string GetEqnEdt()
|
||||||
{
|
{
|
||||||
string retval = null;
|
string retval = null;
|
||||||
try
|
try
|
||||||
@ -1076,7 +1084,73 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
public String GetDefaultKeyValue(String key)
|
private static string GetVisio() // Added support for Visio
|
||||||
|
{
|
||||||
|
string retval = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RegistryKey key = Registry.ClassesRoot;
|
||||||
|
string rootName = key.Name;
|
||||||
|
string curVer = GetDefaultKeyValue(key.Name + "Visio.Drawing\\CurVer");
|
||||||
|
string clsid = GetDefaultKeyValue(key.Name + "\\" + curVer + "\\CLSID");
|
||||||
|
retval = GetDefaultKeyValue(key.Name + "\\CLSID\\" + clsid + "\\LocalServer32");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
DirectoryInfo di = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
|
||||||
|
string path = FindFile(di, "visio.exe");
|
||||||
|
if (path != null) return path;
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
private static string _EqnEdtPath = null;
|
||||||
|
public static string EqnEdtPath
|
||||||
|
{
|
||||||
|
get { return StepTabRibbon._EqnEdtPath; }
|
||||||
|
}
|
||||||
|
private static string _VisioPath = null;
|
||||||
|
public static string VisioPath
|
||||||
|
{
|
||||||
|
get { return StepTabRibbon._VisioPath; }
|
||||||
|
}
|
||||||
|
private int _OleObjectEditors = -1;
|
||||||
|
public int OleObjectEditors
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_OleObjectEditors == -1)
|
||||||
|
{
|
||||||
|
_OleObjectEditors = 0;// no OLE Object Editors
|
||||||
|
_EqnEdtPath = GetEqnEdt();
|
||||||
|
if (_EqnEdtPath != null) _OleObjectEditors += 1;
|
||||||
|
_VisioPath = GetVisio();
|
||||||
|
if (_VisioPath != null) _OleObjectEditors += 2;
|
||||||
|
}
|
||||||
|
return _OleObjectEditors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string FindFile(DirectoryInfo di, string fileName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
foreach (FileInfo fi in di.GetFiles(fileName))
|
||||||
|
return fi.FullName;
|
||||||
|
foreach (DirectoryInfo sub in di.GetDirectories())
|
||||||
|
{
|
||||||
|
string path = FindFile(sub, fileName);
|
||||||
|
if (path != null)
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static String GetDefaultKeyValue(String key)
|
||||||
{
|
{
|
||||||
object xxx = null;
|
object xxx = null;
|
||||||
return Registry.GetValue(key, "", xxx).ToString();
|
return Registry.GetValue(key, "", xxx).ToString();
|
||||||
@ -1313,7 +1387,8 @@ namespace Volian.Controls.Library
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
richTextBox1.Paste(frm);
|
richTextBox1.Paste(frm);
|
||||||
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS EQUATION")) noEquationData = false;
|
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS EQU")) noEquationData = false;
|
||||||
|
if (richTextBox1.Rtf.ToUpper().Contains("OBJCLASS VIS")) noEquationData = false;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -1826,10 +1901,12 @@ namespace Volian.Controls.Library
|
|||||||
cmbi.Text = sdr.Name;
|
cmbi.Text = sdr.Name;
|
||||||
cmbi.Tag = string.Format("{0} {1}", fromtype, sdr.Index); // index of type to insert it when button is clicked
|
cmbi.Tag = string.Format("{0} {1}", fromtype, sdr.Index); // index of type to insert it when button is clicked
|
||||||
cmbi.Checked = (selType == null || (sd.Type == selType.Type));
|
cmbi.Checked = (selType == null || (sd.Type == selType.Type));
|
||||||
|
if(!AddVisioOrEqnEdt(cmbi)) // Added support for Visio
|
||||||
cmbi.Click += new System.EventHandler(btnInsStep_Click);
|
cmbi.Click += new System.EventHandler(btnInsStep_Click);
|
||||||
cmbtn.SubItems.Add(cmbi);
|
cmbtn.SubItems.Add(cmbi);
|
||||||
}
|
}
|
||||||
if (MyItemInfo.IsHigh && hlsSubType != -1 && sdr.Index == hlsSubType) bi.Checked = true;
|
if (MyItemInfo.IsHigh && hlsSubType != -1 && sdr.Index == hlsSubType) bi.Checked = true;
|
||||||
|
if(!AddVisioOrEqnEdt(bi)) // Added support for Visio
|
||||||
bi.Click += new System.EventHandler(btnInsStep_Click);
|
bi.Click += new System.EventHandler(btnInsStep_Click);
|
||||||
// Assign only A-Z to the KeyTips in the list (i.e. assign only the first 24 in the list)
|
// Assign only A-Z to the KeyTips in the list (i.e. assign only the first 24 in the list)
|
||||||
// Note that KeyTips logic support only single characters at this level (can't have 'AA' for example)
|
// Note that KeyTips logic support only single characters at this level (can't have 'AA' for example)
|
||||||
@ -1919,6 +1996,26 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
rbnStepParts.Refresh();
|
rbnStepParts.Refresh();
|
||||||
}
|
}
|
||||||
|
// Added Support for Visio
|
||||||
|
private bool AddVisioOrEqnEdt(DevComponents.DotNetBar.ButtonItem cmbi)
|
||||||
|
{
|
||||||
|
if (cmbi.Text.Contains("Equation") && OleObjectEditors == 3)
|
||||||
|
{
|
||||||
|
DevComponents.DotNetBar.ButtonItem btn1 = new DevComponents.DotNetBar.ButtonItem("btnEquation", "Equation Editor");
|
||||||
|
btn1.Click += new System.EventHandler(btnInsStep_Click);
|
||||||
|
btn1.Tag = cmbi.Tag + " EqnEdt";
|
||||||
|
btn1.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways;
|
||||||
|
//btn1.Tag = string.Format("Equation"); // index of type to insert it when button is clicked
|
||||||
|
cmbi.SubItems.Add(btn1);
|
||||||
|
DevComponents.DotNetBar.ButtonItem btn2 = new DevComponents.DotNetBar.ButtonItem("btnVisio", "Visio");
|
||||||
|
btn2.Click += new System.EventHandler(btnInsStep_Click);
|
||||||
|
btn2.Tag = cmbi.Tag + " Visio";
|
||||||
|
btn2.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways;
|
||||||
|
cmbi.SubItems.Add(btn2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// From Figure menuing, need to map those strings to the index in the StepdataList for setting item's content type:
|
// From Figure menuing, need to map those strings to the index in the StepdataList for setting item's content type:
|
||||||
//<Step Index="36" Type="Figure" ParentType="Base" />
|
//<Step Index="36" Type="Figure" ParentType="Base" />
|
||||||
//<Step Index="37" Type="AERFigure" ParentType="Figure" />
|
//<Step Index="37" Type="AERFigure" ParentType="Figure" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user