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;
|
||||
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.Height = 50;
|
||||
|
@ -2081,7 +2081,8 @@ namespace Volian.Controls.Library
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -965,10 +965,10 @@ namespace Volian.Controls.Library
|
||||
if (insdata.Length < 2) return;
|
||||
int fromtype = Convert.ToInt32(insdata[0]);
|
||||
int contenttype = Convert.ToInt32(insdata[1]) + 20000;
|
||||
string tabOrFigType = (insdata.Length == 3)? insdata[2]:null;
|
||||
string tabOrFigType = (insdata.Length == 3) ? insdata[2] : null;
|
||||
// if CautionNoteOrder format variable is set then use it to determine the placement of the
|
||||
// Caution, Note, Warning, or Message (calvert format)
|
||||
if (cautNoteOrder != null && (","+cautNoteOrder+",").Contains(","+(contenttype % 10000).ToString() + ",") && (_MyEditItem.MyItemInfo.Cautions != null || _MyEditItem.MyItemInfo.Notes != null))
|
||||
if (cautNoteOrder != null && ("," + cautNoteOrder + ",").Contains("," + (contenttype % 10000).ToString() + ",") && (_MyEditItem.MyItemInfo.Cautions != null || _MyEditItem.MyItemInfo.Notes != null))
|
||||
{
|
||||
EditItem stepBefore = FindStepBefore(cautNoteOrder, contenttype);
|
||||
if (stepBefore != null)
|
||||
@ -991,64 +991,72 @@ namespace Volian.Controls.Library
|
||||
hlsEditItem.AddSiblingAfter((int?)contenttype, true);
|
||||
}
|
||||
else if (InsertingTable(contenttype))
|
||||
{
|
||||
if (tabOrFigType.Contains("RO"))
|
||||
{
|
||||
VlnFlexGrid grd = new VlnFlexGrid();
|
||||
grd.Rows.Count = 1;
|
||||
grd.Cols.Count = 1;
|
||||
grd.IsRoTable = true;
|
||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype, grd);
|
||||
StepTabPanel tmp = Parent as StepTabPanel;
|
||||
tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(null));
|
||||
}
|
||||
else
|
||||
{
|
||||
VlnFlexGrid grd = CreateNewTable();
|
||||
if (grd != null) _MyEditItem.AddChild((E_FromType)fromtype, contenttype, grd);
|
||||
}
|
||||
}
|
||||
else if (InsertingFigure(contenttype))
|
||||
{
|
||||
if (tabOrFigType.Contains("RO"))
|
||||
{
|
||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype, ImageItem.E_ImageSource.RoFigure);
|
||||
StepTabPanel tmp = Parent as StepTabPanel;
|
||||
tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(null));
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Drawing.Image img = Clipboard.GetImage();
|
||||
if (img == null && tabOrFigType.Contains("CL"))
|
||||
{
|
||||
MessageBox.Show("Clipboard does not contain image data. Cannot create figure.", "Clipboard Error");
|
||||
return;
|
||||
}
|
||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype, tabOrFigType.Contains("CL")?ImageItem.E_ImageSource.Clipboard:ImageItem.E_ImageSource.File);
|
||||
}
|
||||
if (_MyEditItem.MyItemInfo.IsFigure && tabOrFigType.Contains("RO"))
|
||||
btnInsRO_Click(sender, e);
|
||||
}
|
||||
else if (InsertingEquation(contenttype))
|
||||
{
|
||||
// launch equation editor
|
||||
string EqnEdt = GetEqnEdt();
|
||||
if (EqnEdt == null)
|
||||
if (tabOrFigType.Contains("RO"))
|
||||
{
|
||||
_MyLog.WarnFormat("Equation Editor is not correctly configured in the registry.");
|
||||
MessageBox.Show("The Equation Editor needs to be started.", "Reminder", MessageBoxButtons.OK);
|
||||
VlnFlexGrid grd = new VlnFlexGrid();
|
||||
grd.Rows.Count = 1;
|
||||
grd.Cols.Count = 1;
|
||||
grd.IsRoTable = true;
|
||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype, grd);
|
||||
StepTabPanel tmp = Parent as StepTabPanel;
|
||||
tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(null));
|
||||
}
|
||||
else
|
||||
Process.Start(EqnEdt);
|
||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype);
|
||||
{
|
||||
VlnFlexGrid grd = CreateNewTable();
|
||||
if (grd != null) _MyEditItem.AddChild((E_FromType)fromtype, contenttype, grd);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (InsertingFigure(contenttype))
|
||||
{
|
||||
if (tabOrFigType.Contains("RO"))
|
||||
{
|
||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype, ImageItem.E_ImageSource.RoFigure);
|
||||
StepTabPanel tmp = Parent as StepTabPanel;
|
||||
tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(null));
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Drawing.Image img = Clipboard.GetImage();
|
||||
if (img == null && tabOrFigType.Contains("CL"))
|
||||
{
|
||||
MessageBox.Show("Clipboard does not contain image data. Cannot create figure.", "Clipboard Error");
|
||||
return;
|
||||
}
|
||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype, tabOrFigType.Contains("CL") ? ImageItem.E_ImageSource.Clipboard : ImageItem.E_ImageSource.File);
|
||||
}
|
||||
if (_MyEditItem.MyItemInfo.IsFigure && tabOrFigType.Contains("RO"))
|
||||
btnInsRO_Click(sender, e);
|
||||
}
|
||||
else if (InsertingEquation(contenttype))
|
||||
{
|
||||
// launch Ole Object Editor - added support for Visio
|
||||
switch (OleObjectEditors)
|
||||
{
|
||||
case 0: // None
|
||||
_MyLog.WarnFormat("Equation Editor is not correctly configured in the registry.");
|
||||
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
|
||||
Process.Start(EqnEdtPath);
|
||||
break;
|
||||
}
|
||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype);
|
||||
}
|
||||
}
|
||||
// the following launches the equation editor based on registry setting:
|
||||
private string GetEqnEdt()
|
||||
private static string GetEqnEdt()
|
||||
{
|
||||
string retval = null;
|
||||
try
|
||||
@ -1076,7 +1084,73 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
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;
|
||||
return Registry.GetValue(key, "", xxx).ToString();
|
||||
@ -1313,7 +1387,8 @@ namespace Volian.Controls.Library
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -1826,11 +1901,13 @@ namespace Volian.Controls.Library
|
||||
cmbi.Text = sdr.Name;
|
||||
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.Click += new System.EventHandler(btnInsStep_Click);
|
||||
if(!AddVisioOrEqnEdt(cmbi)) // Added support for Visio
|
||||
cmbi.Click += new System.EventHandler(btnInsStep_Click);
|
||||
cmbtn.SubItems.Add(cmbi);
|
||||
}
|
||||
if (MyItemInfo.IsHigh && hlsSubType != -1 && sdr.Index == hlsSubType) bi.Checked = true;
|
||||
bi.Click += new System.EventHandler(btnInsStep_Click);
|
||||
if(!AddVisioOrEqnEdt(bi)) // Added support for Visio
|
||||
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)
|
||||
// Note that KeyTips logic support only single characters at this level (can't have 'AA' for example)
|
||||
if (kt != '0')
|
||||
@ -1919,6 +1996,26 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
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:
|
||||
//<Step Index="36" Type="Figure" ParentType="Base" />
|
||||
//<Step Index="37" Type="AERFigure" ParentType="Figure" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user