Commit for development environment setup

This commit is contained in:
2023-06-19 16:12:33 -04:00
parent be72063a3c
commit bbce2ad0a6
2209 changed files with 1171775 additions and 625 deletions

View File

@@ -0,0 +1,665 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
using System.Reflection;
using LBWordLibrary;
namespace Volian.Controls.Library
{
public partial class DSOTabPanel : DevComponents.DotNetBar.PanelDockContainer
{
#region Private Fields
private DisplayTabControl _MyDisplayTabControl;
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private AxDSOFramer.AxFramerControl _MyDSOFramer;
private TransparentPanel _MyTransparentPanel;
private static int _Count = 0;
private DocumentInfo _MyDocumentInfo;
private int _MyCount;
private DisplayTabItem _MyDisplayTabItem;
private DSOFile _DSOFile;
public static int MSWordLimit = 10;
#endregion
#region Public Properties
private String _SearchString;
public String SearchString
{
get { return _SearchString; }
set { _SearchString = value; FindSearchString(); }
}
/// <summary>
/// Count of DSO Pages open. Limited to 18 in DisplayTabControl
/// </summary>
public static int Count
{
get { return _Count; }
set { _Count = value; }
}
/// <summary>
/// Pointer to the related DisplayTabItem
/// </summary>
public DisplayTabItem MyDisplayTabItem
{
get { return _MyDisplayTabItem; }
set
{
_MyDisplayTabItem = value;
_MyDisplayTabItem.Visible = false;
_MyDisplayTabItem.Visible = true;
}
}
/// <summary>
/// DocumentInfo record for the Word document
/// </summary>
public DocumentInfo MyDocumentInfo
{
get { return _MyDocumentInfo; }
}
/// <summary>
/// Temporary Word file used for editing.
/// </summary>
internal DSOFile MyDSOFile
{
get
{
if (_DSOFile == null)
_DSOFile = new DSOFile(_MyDocumentInfo);
return _DSOFile;
}
}
/// <summary>
/// Dirty status. Only saved if dirty.
/// </summary>
public bool IsDirty
{
get
{
if (_MyDSOFramer == null) return false;
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
return !doc.Saved;
}
}
private bool _OverrideClose = false;
public bool OverrideClose
{
get { return _OverrideClose; }
set { _OverrideClose = value; }
}
public E_ViewMode PanelViewEditMode = E_ViewMode.Edit;
#endregion
//private frmPG _frm = null;
#region Constructors
private Timer _RefreshTimer;
private ItemInfo _ItemInfo;
private bool _AllowedToEdit;
public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myDisplayTabControl, ItemInfo itemInfo, bool allowedToEdit)
{
_MyDisplayTabControl = myDisplayTabControl;
_ItemInfo = itemInfo;
_AllowedToEdit = allowedToEdit;
InitializeComponent();
SetupDSOTabPanel();
_MyDocumentInfo = documentInfo;
SetupDSO();
_RefreshTimer = new Timer(); // Enabled is false and interval is 1/10th of second.
ClientSizeChanged += new EventHandler(DSOTabPanel_ClientSizeChanged);
_RefreshTimer.Tick += new EventHandler(_RefreshTimer_Tick);
//_frm = new frmPG(_MyDSOFramer);
//_frm.Show();
}
void _RefreshTimer_Tick(object sender, EventArgs e)
{
_RefreshTimer.Enabled = false;
if(_MyDSOFramer != null)
_MyDSOFramer.Focus();
}
void DSOTabPanel_ClientSizeChanged(object sender, EventArgs e)
{
_RefreshTimer.Enabled = false; // This assures that interval is used from last event.
_RefreshTimer.Enabled = true;
}
#endregion
#region Private Methods
private void SetupDSOTabPanel()
{
Dock = System.Windows.Forms.DockStyle.Fill; // Automatically Fill the panel
}
private void SetupDSO()
{
_Count++; // Increment the count of open Word documents (Limit = MSWordLimit)
_MyCount = _Count;
this._MyTransparentPanel = new TransparentPanel();
this._MyDSOFramer = new AxDSOFramer.AxFramerControl();
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).BeginInit();
this.Controls.Add(this._MyDSOFramer);
this.Controls.Add(this._MyTransparentPanel); // A transparent panel is added over top of the DSO Framer window so that
// the related tab can be activated when the user clicks on a Word Document. Since the Word document is actually running
// in a different thread, it does not behave properly with focus events.
this.components.Add(this._MyDSOFramer);
this.components.Add(this._MyTransparentPanel);
this._MyTransparentPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this._MyTransparentPanel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._MyTransparentPanel.ForeColor = System.Drawing.Color.Brown; // This is the color used to show InActive on the right side on the Word
// document menu line.
//this._MyTransPanel.Location = new System.Drawing.Point(0, 0);
//this._MyTransPanel.Name = "transPanel1";
//this._MyTransPanel.Size = new System.Drawing.Size(370, 423);
//this._MyTransPanel.TabIndex = 1;
this._MyTransparentPanel.Click += new EventHandler(_MyTransparentPanel_Click);
this._MyDSOFramer.Dock = System.Windows.Forms.DockStyle.Fill;
//System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab));
//this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState")));
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).EndInit();
try
{
try
{
this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
//this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName,false,"Word.Document","","");
}
catch (Exception ex)
{
_MyLog.Warn("dso fraimer error", ex); // put exception message in the error log
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
using (DocumentAuditInfoList dail = DocumentAuditInfoList.Get(MyDocumentInfo.DocID))
{
if (dail.Count > 0)
{
//DocumentAuditInfo dai = dail[0];
//foreach (DocumentAuditInfo tmpa in dail)
//{
// if (tmpa.DTS > dai.DTS) dai = tmpa;
//}
if(MessageBox.Show("Do you want to revert to a previous version?", "Error in MS Word section",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)==DialogResult.Yes)
{
//fs.Write(dai.DocContent, 0, dai.DocContent.Length);
using (Document myDoc = Document.Get(MyDocumentInfo.DocID))
{
myDoc.RestoreWordDoc(_ItemInfo);
_DSOFile = null;
_MyDocumentInfo = DocumentInfo.Get(MyDocumentInfo.DocID);
}
}
}
else
MessageBox.Show("Reverting to Blank Document", "Error in MS Word section",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
fs.Close();
this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
}
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
Console.WriteLine("Version {0}", doc.Application.Version);
float ver;
if (!float.TryParse(doc.Application.Version, out ver))
ver = 12.0F;
this._MyDSOFramer.Menubar = ver < 12.0F;
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileClose, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileNew, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePageSetup, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePrint, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePrintPreview, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileProperties, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileSave, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileSaveAs, false);
this._MyDSOFramer.Titlebar = false;
//if (_MyCount < 20)
// this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
//this._MyDSOFramer.BeforeDocumentClosed += new AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEventHandler(_MyDSOFramer_BeforeDocumentClosed);
//this._MyDSOFramer.OnSaveCompleted += new AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEventHandler(_MyDSOFramer_OnSaveCompleted);
//this._MyDSOFramer.LostFocus += new EventHandler(_MyDSOFramer_LostFocus);
//this._MyDSOFramer.GotFocus += new EventHandler(_MyDSOFramer_GotFocus);
//this._MyDSOFramer.Enter += new EventHandler(_MyDSOFramer_Enter);
//this._MyDSOFramer.Leave += new EventHandler(_MyDSOFramer_Leave);
//this._MyDSOFramer.OnActivationChange += new AxDSOFramer._DFramerCtlEvents_OnActivationChangeEventHandler(_MyDSOFramer_OnActivationChange);
this.Enter += new EventHandler(DSOTabPanel_Enter);
//this.Leave += new EventHandler(DSOTabPanel_Leave);
//this.GotFocus += new EventHandler(DSOTabPanel_GotFocus);
//this.LostFocus += new EventHandler(DSOTabPanel_LostFocus);
Application.DoEvents();
// The following line corrects Symbol characters in MSWord Sections
// CheckForSymbolCharacters(doc);
InitializeWordDocument(doc);
FindSearchString();
}
catch (Exception ex)
{
string message = ShowException(ex);
Console.WriteLine("\r\n-------------\r\n{0}{1}{2}\r\n-------------\r\n", MyDSOFile.MyFile.FullName, ex.GetType().Name, message);
// TODO: Should output a message
// TODO: Should try to do a direct open using Word.
}
}
public void FixSymbolCharacters()
{
CheckForSymbolCharacters(new LBDocumentClass(_MyDSOFramer.ActiveDocument));
}
private void CheckForSymbolCharacters(LBDocumentClass doc)
{
string fontHasSymbolCharacters = doc.FontHasSymbolCharacters;
if (fontHasSymbolCharacters != null)
{
// do a string for the log message, depending if this is a libdoc.
string msg = null;
if (MyDocumentInfo.LibTitle == null || MyDocumentInfo.LibTitle == "")
{
if (MyDocumentInfo.DocumentEntryCount>0)
msg = string.Format("Procedure = {0}, Section {1}", MyDocumentInfo.DocumentEntries[0].MyContent.ContentItems[0].MyProcedure, MyDocumentInfo.DocumentEntries[0].MyContent.ContentItems[0].DisplayText);
else
msg = string.Format("Procedure and Section can't be determined");
}
else
msg = string.Format("Library Document: {0}", MyDocumentInfo.LibTitle);
if (doc.AttemptToFixASymbolCharacter()) // font is installed correctly, 'fix' this file.
{
//MessageBox.Show(string.Format("This document uses the font {0}, which previously had an error.\r\nThe program will attempt to fix the problem for this Word section.", fontHasSymbolCharacters),
// "Font Being Corrected", MessageBoxButtons.OK);
doc.FixSymbolCharacters();
_MyLog.Info(string.Format("Font problem being fixed in Font: {0}, {1}.",fontHasSymbolCharacters, msg));
}
else
{
MessageBox.Show(string.Format("This document uses the font {0}, which has an error.\r\n\r\nReinstall this font.", fontHasSymbolCharacters),
"Reinstall Font", MessageBoxButtons.OK);
_MyLog.Info(string.Format("Font problem found in Font: {0}, {1}.",fontHasSymbolCharacters, msg));
}
}
}
private void InitializeWordDocument(LBDocumentClass doc)
{
if (MyDocumentInfo.Config == null || MyDocumentInfo.Config == "" && MyDocumentInfo.DocumentEntryCount > 0)
{
DocStyle ds = MyDocumentInfo.DocumentEntries[0].MyContent.ContentItems[0].MyDocStyle;
// this will cause an error and goto the Catch if the family or size is null,
// Westinghouse needs it to to this - at least for now
//if (ds.Font.Family != null) doc.Application.Selection.Font.Name = ds.Font.Family;
//if (ds.Font.Size != null) doc.Application.Selection.Font.Size = (float)ds.Font.Size;
doc.Application.Selection.Font.Name = ds.Font.Family;
doc.Application.Selection.Font.Size = (float)ds.Font.Size;
doc.Application.Selection.ParagraphFormat.SpaceBefore = 0;
doc.Application.Selection.ParagraphFormat.SpaceAfter = 0;
doc.Application.Selection.ParagraphFormat.LineSpacingRule = LBWdLineSpacing.wdLineSpaceExactly;
doc.Application.Selection.ParagraphFormat.LineSpacing = 72 / 6; // for 6 LPI
MSWordToPDF.AdjustMargins(ds, doc, false);
}
if (doc.ActiveWindow.ActivePane.View.Zoom.Percentage < 40)
doc.ActiveWindow.ActivePane.View.Zoom.Percentage = 100;
}
public void FindSearchString()
{
if (SearchString == null) return;
// Get the Document
LBDocumentClass wordDoc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
//LBSelection sel = wordDoc.Application.Selection;
LBFind find = wordDoc.Application.Selection.Find;
find.ClearFormatting();
bool wildCards = SearchString.Contains("?") || SearchString.Contains("*");
bool found = find.Execute(SearchString, false, false, wildCards, false, false, true, LBWdFindWrap.wdFindContinue, null, null, null, false, false, false, false);
//Console.WriteLine("find = {0}", found);
}
/// <summary>
/// Text will either replace current selection or be inserted at the current cursor position if no selection
/// </summary>
/// <param name="txt"></param>
public void InsertText(string txt)
{
if (txt == null || txt.Length == 0) return; //nothing to insert
// Get the Document
LBDocumentClass wordDoc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
//This will get the selected range or just the current cursor position
LBSelection sel = wordDoc.Application.Selection;
// This will replace the selection or insert at current position
sel.Text = txt;
}
public string GetSelectedString()
{
LBDocumentClass wordDoc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
//This will get the selected range or just the current cursor position
LBSelection sel = wordDoc.Application.Selection;
// if the start & end are the same, nothing is selected:
if (sel.Start == sel.End) return null;
return sel.Text;
}
private string ShowException(Exception ex)
{
string sep = "\r\n ";
StringBuilder sb = new StringBuilder();
do
{
sb.Append(sep + ex.Message);
sep += " ";
ex = ex.InnerException;
} while (ex != null);
return sb.ToString();
}
//void _MyDSOFramer_Leave(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSO Leave {0}", this.MyDocumentInfo.DocID);
//}
//void _MyDSOFramer_Enter(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSO Enter {0}", this.MyDocumentInfo.DocID);
//}
//void _MyDSOFramer_GotFocus(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSO Got Focus {0}",this.MyDocumentInfo.DocID);
//}
//void _MyDSOFramer_LostFocus(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSO Lost Focus {0}", this.MyDocumentInfo.DocID);
//}
public void EnterPanel()
{
DSOTabPanel_Enter(this, new EventArgs());
}
//void DSOTabPanel_LostFocus(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSOTabPanel_LostFocus {0} DocID {1} Index {2} {3}", _In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName);
//}
//void DSOTabPanel_GotFocus(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSOTabPanel_GotFocus {0} DocID {1} Index {2} {3}", _In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName);
//}
#endregion
#region Event Handlers
/// <summary>
/// Display MyTransparentPanel over the DSOPanel so that the Word "Inactive" appears in the upper right hand corner.
/// </summary>
public void InActive()
{
_MyTransparentPanel.BringToFront();
}
/// <summary>
/// Force this item to be selected when the transparent window is clicked.
/// This will in-turn send the Transparent Panel to back and make the DSO Panel
/// editable.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void _MyTransparentPanel_Click(object sender, EventArgs e)
{
this.Select();
}
///// <summary>
///// If the user presses the save button, tell the file to save it's contents to the database
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//void _MyDSOFramer_OnSaveCompleted(object sender, AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEvent e)
//{
// _MyLog.WarnFormat("_MyDSOFramer_OnSaveCompleted");
// Volian.Base.Library.vlnStackTrace.ShowStack("_MyDSOFramer_OnSaveCompleted");
// SaveDSO_Phase2();
//}
private void SaveDSO_Phase2()
{
// Unfortunately, the only way to handle view mode for DSO Framer is to not save.
if (PanelViewEditMode == E_ViewMode.View)
{
MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip);
return;
}
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
while (doc.Saved = false)
Application.DoEvents();
string tmp = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
if (System.IO.File.Exists(tmp))
MyDSOFile.FullName = tmp;
else
_MyLog.FatalFormat("File does not exist {0}\r\nFile was {1}", tmp, MyDSOFile.FullName);
// if this was a library document, ask user if it should be saved for all usages.
bool cvtLibDoc = false;
if (MyDisplayTabItem.MyItemInfo != null) // B2016-131 if myiteminfo is null then the lib doc is not referenced, so just save the changes - don't generate a pdf
{
EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry;
if (myei != null && myei.MyDocument != null && myei.MyDocument.LibTitle != null && myei.MyDocument.LibTitle != "")
{
DialogResult ans = MessageBox.Show("Save as Library Document for all usages?", "Document Save", MessageBoxButtons.YesNo);
if (ans == DialogResult.No) cvtLibDoc = true;
}
}
MyDSOFile.SaveFile(doc.Length, doc.Ascii, MyDisplayTabItem.MyItemInfo, cvtLibDoc, StatusChanged);
if (cvtLibDoc)
{
MyDisplayTabItem.Text = MyDisplayTabItem.MyItemInfo.TabTitle;
MyDisplayTabItem.Tooltip = MyDisplayTabItem.MyItemInfo.TabToolTip;
MyDisplayTabItem.SetPrivateTooltip(MyDisplayTabItem.MyItemInfo.TabToolTip);
}
}
public void StatusChanged(VolianStatusType type, int count, string text)
{
if (Parent != null && Parent.Parent != null && Parent.Parent.Parent is DisplayTabControl)
{
DisplayTabControl tc = Parent.Parent.Parent as DisplayTabControl;
tc.ONStatusChanged(this, new DisplayTabControlStatusEventArgs(type, count, text));
}
}
///// <summary>
///// Before a document closes check to see if it's contents should be saved.
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//void _MyDSOFramer_BeforeDocumentClosed(object sender, AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEvent e)
//{
// SaveDSOPhase1();
//}
private void SaveDSO_Phase1()
{
try
{
if (!IsBeingDeleted)
SaveDirty();
this.Enter -= new EventHandler(DSOTabPanel_Enter);
// this.Leave -= new EventHandler(DSOTabPanel_Leave);
// SaveDirty(); // SaveDirty happens in CloseDSO(bool)
}
catch (Exception ex)
{
_MyLog.Warn("Before Closing Document ", ex);
}
}
public static bool IgnoreEnter = false;
private bool _In_DSOTabPanel_Enter=false;
/// <summary>
/// When a Word document is selected make sure it's tab is activated and
/// the SelectedItem for the DisplayTabControl is updated.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DSOTabPanel_Enter(object sender, EventArgs e)
{
if (IgnoreEnter) return;
_MyTransparentPanel.SendToBack();
// Set whether this worddoc is in view/edit mode by checking whether the
// procedure is in view/edit mode (based on the steppanel. This occurs on
// the enter event so that the mode is determined any time this panel becomes
// active.
// find steptabpanel and its view/edit. If it doesn't have a steptabpanel
// use default - edit. Later when we have ownership, need to use that.
PanelViewEditMode = E_ViewMode.Edit; // default to edit
if (MyDisplayTabItem.MyItemInfo != null) // lib doc with no associated active procedure defaults to edit
{
StepTabPanel stpanel = _MyDisplayTabControl.GetProcedureTabPanel(MyDisplayTabItem.MyItemInfo);
PanelViewEditMode = (stpanel == null) ? E_ViewMode.Edit : stpanel.MyStepPanel.VwMode;
}
try
{
//_MyDSOFramer.EventsEnabled = true;
_MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.ErrorFormat("DSOTabPage_Enter", ex);
}
if (_In_DSOTabPanel_Enter) return;
//vlnStackTrace.ShowStack("DSOTabPanel_Enter {0} DocID {1} Index {2} {3}",_In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName);
_In_DSOTabPanel_Enter = true;
if (MyDisplayTabItem.MyItemInfo != null)
_MyDisplayTabControl.OnItemSelectedChanged(this,new ItemSelectedChangedEventArgs(MyDisplayTabItem.MyItemInfo));
_MyDSOFramer.Focus();
_In_DSOTabPanel_Enter = false;
_MyDisplayTabControl.SelectedDisplayTabItem = MyDisplayTabItem;
}
#endregion
#region Public Methods
/// <summary>
/// Save the contents of the Word Document to a file
/// and save the file to the database
/// </summary>
/// <returns></returns>
public bool SaveDSO()
{
bool result = true;
try
{
_MyDSOFramer.Save();
SaveDSO_Phase2();
//_MyDSOFramer_OnSaveCompleted(this, null);
// These are handled in the method above
//LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
//MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
//MyDSOFile.SaveFile(doc.Length, doc.Ascii);
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("SaveDSO", ex);
MessageBox.Show(ex.Message, "Error Saving Document", MessageBoxButtons.OK, MessageBoxIcon.Error);
result = false;
}
return result;
}
/// <summary>
/// Check to see if a Word document should be saved. If it is dirty ask the user if the
/// changes should be changed. Save the changes if the user says "yes".
/// </summary>
/// <returns></returns>
public bool SaveDirty()
{
if (OverrideClose)
return false;
if (IsDirty)
{
// Unfortunately, the only way to handle view mode for DSO Framer is to not save.
if (PanelViewEditMode == E_ViewMode.View || !_AllowedToEdit)
{
MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip);
return false;
}
//if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.MyItemInfo.TabTitle + "\r\n" + _MyDisplayTabItem.MyItemInfo.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.Text + "\r\n" + _MyDisplayTabItem.Tooltip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
return SaveDSO();
return false;
}
return true;
}
private bool _IsBeingDeleted = false;
public bool IsBeingDeleted
{
get { return _IsBeingDeleted; }
set { _IsBeingDeleted = value; }
}
/// <summary>
/// Cleans-up the DSO Framer window
/// </summary>
/// <returns></returns>
public bool CloseDSO()
{
return CloseDSO(false);
}
/// <summary>
/// Cleans-up the DSO Framer window
/// </summary>
/// <param name="force"></param>
/// <returns></returns>
public bool CloseDSO(bool force)
{
_MyLog.Debug("CloseDSO");
bool result = true;
try
{
if (_MyDSOFramer != null)
{
SaveDSO_Phase1();
_MyDSOFramer.Close();
Controls.Remove(_MyDSOFramer);
components.Remove(_MyDSOFramer);
_MyDSOFramer.Dispose();
_MyDSOFramer = null;
_Count--;
}
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("SaveDSO - " + this.Name, ex);
result = false;
}
return result;
}
/// <summary>
/// Activates the current DSO Framer window (Word)
/// </summary>
public void Activate()
{
try
{
this._MyDSOFramer.Activate();
if (_MyCount <= MSWordLimit)
this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("Activate", ex);
}
}
#endregion
#region DocumentProperties
private string GetReflectiveProperty(object objectToInspect, string propertyName)
{
string returnString = "";
//To use reflection on an object, you
// first need to get an instance
// of that object's type.
Type objectType = objectToInspect.GetType();
//After you have the object's type, you can get
// information on that type. In this case, we're
// asking the type to tell us all the
// properties that it contains.
PropertyInfo[] properties = objectType.GetProperties();
//You can then use the PropertyInfo array
// to loop through each property of the type.
foreach (PropertyInfo property in properties)
{
//The interest part of this code
// is the GetValue method. This method
// returns the value of the property.
if(property.Name == propertyName)
return property.GetValue(objectToInspect, null).ToString();
}
return null;
}
#endregion
public override string ToString()
{
return string.Format("DSOTabPanel Document {0}", MyDocumentInfo.DocID);
}
}
}

View File

@@ -0,0 +1,36 @@
namespace Volian.Controls.Library
{
partial class DSOTabPanel
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@@ -0,0 +1,695 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
using System.Reflection;
using LBWordLibrary;
namespace Volian.Controls.Library
{
public partial class DSOTabPanel : DevComponents.DotNetBar.PanelDockContainer
{
#region Private Fields
private DisplayTabControl _MyDisplayTabControl;
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private AxEDWordLib.AxEDWord _MyEdWord; // B2017-133 Edraw DSO Framer Replacement
private TransparentPanel _MyTransparentPanel;
private static int _Count = 0;
private DocumentInfo _MyDocumentInfo;
private int _MyCount;
private DisplayTabItem _MyDisplayTabItem;
private DSOFile _DSOFile;
public static int MSWordLimit = 10;
#endregion
#region Public Properties
private String _SearchString;
public String SearchString
{
get { return _SearchString; }
set { _SearchString = value; FindSearchString(); }
}
/// <summary>
/// Count of DSO Pages open. Limited to 18 in DisplayTabControl
/// </summary>
public static int Count
{
get { return _Count; }
set { _Count = value; }
}
/// <summary>
/// Pointer to the related DisplayTabItem
/// </summary>
public DisplayTabItem MyDisplayTabItem
{
get { return _MyDisplayTabItem; }
set
{
_MyDisplayTabItem = value;
_MyDisplayTabItem.Visible = false;
_MyDisplayTabItem.Visible = true;
}
}
/// <summary>
/// DocumentInfo record for the Word document
/// </summary>
public DocumentInfo MyDocumentInfo
{
get { return _MyDocumentInfo; }
}
/// <summary>
/// Temporary Word file used for editing.
/// </summary>
internal DSOFile MyDSOFile
{
get
{
if (_DSOFile == null)
_DSOFile = new DSOFile(_MyDocumentInfo);
return _DSOFile;
}
}
/// <summary>
/// Dirty status. Only saved if dirty.
/// </summary>
public bool IsDirty
{
get
{
if (_MyEdWord == null) return false; // B2017-133 Edraw Is Dirty Property
return _MyEdWord.IsDirty();
//LBDocumentClass doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//return !doc.Saved;
}
}
private bool _OverrideClose = false;
public bool OverrideClose
{
get { return _OverrideClose; }
set { _OverrideClose = value; }
}
public E_ViewMode PanelViewEditMode = E_ViewMode.Edit;
#endregion
//private frmPG _frm = null;
#region Constructors
private Timer _RefreshTimer;
private ItemInfo _ItemInfo;
private bool _AllowedToEdit;
public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myDisplayTabControl, ItemInfo itemInfo, bool allowedToEdit)
{
_MyDisplayTabControl = myDisplayTabControl;
_ItemInfo = itemInfo;
_AllowedToEdit = allowedToEdit;
InitializeComponent();
SetupDSOTabPanel();
_MyDocumentInfo = documentInfo;
SetupDSO();
_RefreshTimer = new Timer(); // Enabled is false and interval is 1/10th of second.
_RefreshTimer.Interval = 1000;// B2017-133 Edraw
ClientSizeChanged += new EventHandler(DSOTabPanel_ClientSizeChanged);
_RefreshTimer.Tick += new EventHandler(_RefreshTimer_Tick);
_MyEdWord.BeforeDocumentClosed += _MyEdWord_BeforeDocumentClosed;// B2017-133 Edraw
_MyEdWord.BeforeDocumentOpened += _MyEdWord_BeforeDocumentOpened;// B2017-133 Edraw
_MyEdWord.BeforeDocumentSaved += _MyEdWord_BeforeDocumentSaved;// B2017-133 Edraw
//_frm = new frmPG(_MyDSOFramer);
//_frm.Show();
}
void _MyEdWord_BeforeDocumentSaved(object sender, EventArgs e)// B2017-133 Edraw
{
SaveDSO();
}
//void DisableWordCommands()// B2017-133 Edraw
// {
// _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableClose, true);
// _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableNew, true);
// _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrint, true);
// _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintPreview, true);
// _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintQuick, true);
// _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSave, true);
// _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSaveAs, true);
// _MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeSave, true);
// _MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeClose, true);
// _MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypePrint, true);
// _MyEdWord.DisableSaveHotKey(true);
// _MyEdWord.DisablePrintHotKey(true);
// }
void _MyEdWord_BeforeDocumentOpened(object sender, EventArgs e)// B2017-133 Edraw
{
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableClose, true);
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableNew, true);
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrint, true);
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintPreview, true);
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintQuick, true);
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSave, true);
_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSaveAs, true);
_MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeSave, true);
_MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeClose, true);
_MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypePrint, true);
_MyEdWord.DisableSaveHotKey(true);
_MyEdWord.DisablePrintHotKey(true);
}
void _MyEdWord_BeforeDocumentClosed(object sender, EventArgs e)// B2017-133 Edraw
{
Console.WriteLine("B2017-133 Edraw Before Document Closed");
}
void _RefreshTimer_Tick(object sender, EventArgs e)
{
_RefreshTimer.Enabled = false;
if (_MyEdWord != null)// B2017-133 Edraw
{
_MyEdWord.Focus();
_MyEdWord.GotoItem(EDWordLib.WdGoToItem.wdGoToStart, EDWordLib.WdGoToDirection.wdGoToFirst);
//_MyEdWord.BringToFront();
//_MyEdWord.EndInit();
}
}
void DSOTabPanel_ClientSizeChanged(object sender, EventArgs e)
{
_RefreshTimer.Enabled = false; // This assures that interval is used from last event.
_RefreshTimer.Enabled = true;
}
#endregion
#region Private Methods
private void SetupDSOTabPanel()
{
Dock = System.Windows.Forms.DockStyle.Fill; // Automatically Fill the panel
}
private void SetupDSO()
{
_Count++; // Increment the count of open Word documents (Limit = MSWordLimit)
_MyCount = _Count;
this._MyTransparentPanel = new TransparentPanel();
this._MyEdWord = new AxEDWordLib.AxEDWord();// B2017-133 Edraw
_MyEdWord.BeginInit();
this.Controls.Add(this._MyEdWord);
this.Controls.Add(this._MyTransparentPanel); // A transparent panel is added over top of the DSO Framer window so that
// the related tab can be activated when the user clicks on a Word Document. Since the Word document is actually running
// in a different thread, it does not behave properly with focus events.
this.components.Add(this._MyEdWord);// B2017-133 Edraw
this.components.Add(this._MyTransparentPanel);
this._MyTransparentPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this._MyTransparentPanel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._MyTransparentPanel.ForeColor = System.Drawing.Color.Brown; // This is the color used to show InActive on the right side on the Word
// document menu line.
//this._MyTransPanel.Location = new System.Drawing.Point(0, 0);
//this._MyTransPanel.Name = "transPanel1";
//this._MyTransPanel.Size = new System.Drawing.Size(370, 423);
//this._MyTransPanel.TabIndex = 1;
this._MyTransparentPanel.Click += new EventHandler(_MyTransparentPanel_Click);
this._MyEdWord.Dock = System.Windows.Forms.DockStyle.Fill;
//System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab));
//this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState")));
try
{
try
{
this._MyEdWord.LicenseName = "Volian7573291802";// B2017-133 Edraw
this._MyEdWord.LicenseCode = "EDW8-5527-1201-AB8A";// B2017-133 Edraw
//_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSave, true);
//_MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSaveAs, true);
//_MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeSave, true);
//DisableWordCommands();
this._MyEdWord.Open(MyDSOFile.MyFile.FullName);
}
catch (Exception ex)
{
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
using (DocumentAuditInfoList dail = DocumentAuditInfoList.Get(MyDocumentInfo.DocID))
{
if (dail.Count > 0)
{
//DocumentAuditInfo dai = dail[0];
//foreach (DocumentAuditInfo tmpa in dail)
//{
// if (tmpa.DTS > dai.DTS) dai = tmpa;
//}
if(MessageBox.Show("Do you want to revert to a previous version?", "Error in MS Word section",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)==DialogResult.Yes)
{
//fs.Write(dai.DocContent, 0, dai.DocContent.Length);
using (Document myDoc = Document.Get(MyDocumentInfo.DocID))
{
myDoc.RestoreWordDoc(_ItemInfo);
_DSOFile = null;
_MyDocumentInfo = DocumentInfo.Get(MyDocumentInfo.DocID);
}
}
}
else
MessageBox.Show("Reverting to Blank Document", "Error in MS Word section",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
fs.Close();
this._MyEdWord.Open(MyDSOFile.MyFile.FullName);// B2017-133 Edraw
}
LBDocumentClass doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
Console.WriteLine("Version {0}", doc.Application.Version);
float ver;
if (!float.TryParse(doc.Application.Version, out ver))
ver = 12.0F;
this.Enter += new EventHandler(DSOTabPanel_Enter);
Application.DoEvents();
// The following line corrects Symbol characters in MSWord Sections
// CheckForSymbolCharacters(doc);
InitializeWordDocument(doc);
FindSearchString();
}
catch (Exception ex)
{
string message = ShowException(ex);
Console.WriteLine("\r\n-------------\r\n{0}{1}{2}\r\n-------------\r\n", MyDSOFile.MyFile.FullName, ex.GetType().Name, message);
// TODO: Should output a message
// TODO: Should try to do a direct open using Word.
}
}
public void FixSymbolCharacters()
{
CheckForSymbolCharacters(new LBDocumentClass(_MyEdWord.ActiveDocument()));// B2017-133 Edraw
}
private void CheckForSymbolCharacters(LBDocumentClass doc)
{
string fontHasSymbolCharacters = doc.FontHasSymbolCharacters;
if (fontHasSymbolCharacters != null)
{
// do a string for the log message, depending if this is a libdoc.
string msg = null;
if (MyDocumentInfo.LibTitle == null || MyDocumentInfo.LibTitle == "")
{
if (MyDocumentInfo.DocumentEntryCount>0)
msg = string.Format("Procedure = {0}, Section {1}", MyDocumentInfo.DocumentEntries[0].MyContent.ContentItems[0].MyProcedure, MyDocumentInfo.DocumentEntries[0].MyContent.ContentItems[0].DisplayText);
else
msg = string.Format("Procedure and Section can't be determined");
}
else
msg = string.Format("Library Document: {0}", MyDocumentInfo.LibTitle);
if (doc.AttemptToFixASymbolCharacter()) // font is installed correctly, 'fix' this file.
{
//MessageBox.Show(string.Format("This document uses the font {0}, which previously had an error.\r\nThe program will attempt to fix the problem for this Word section.", fontHasSymbolCharacters),
// "Font Being Corrected", MessageBoxButtons.OK);
doc.FixSymbolCharacters();
_MyLog.Info(string.Format("Font problem being fixed in Font: {0}, {1}.",fontHasSymbolCharacters, msg));
}
else
{
MessageBox.Show(string.Format("This document uses the font {0}, which has an error.\r\n\r\nReinstall this font.", fontHasSymbolCharacters),
"Reinstall Font", MessageBoxButtons.OK);
_MyLog.Info(string.Format("Font problem found in Font: {0}, {1}.",fontHasSymbolCharacters, msg));
}
}
}
private void InitializeWordDocument(LBDocumentClass doc)
{
if (MyDocumentInfo.Config == null || MyDocumentInfo.Config == "" && MyDocumentInfo.DocumentEntryCount > 0)
{
DocStyle ds = MyDocumentInfo.DocumentEntries[0].MyContent.ContentItems[0].MyDocStyle;
// this will cause an error and goto the Catch if the family or size is null,
// Westinghouse needs it to to this - at least for now
//if (ds.Font.Family != null) doc.Application.Selection.Font.Name = ds.Font.Family;
//if (ds.Font.Size != null) doc.Application.Selection.Font.Size = (float)ds.Font.Size;
doc.Application.Selection.Font.Name = ds.Font.Family;
doc.Application.Selection.Font.Size = (float)ds.Font.Size;
doc.Application.Selection.ParagraphFormat.SpaceBefore = 0;
doc.Application.Selection.ParagraphFormat.SpaceAfter = 0;
doc.Application.Selection.ParagraphFormat.LineSpacingRule = LBWdLineSpacing.wdLineSpaceExactly;
doc.Application.Selection.ParagraphFormat.LineSpacing = 72 / 6; // for 6 LPI
MSWordToPDF.AdjustMargins(ds, doc, false);
}
if (doc.ActiveWindow.ActivePane.View.Zoom.Percentage < 40)
doc.ActiveWindow.ActivePane.View.Zoom.Percentage = 100;
}
public void FindSearchString()
{
if (SearchString == null) return;
// Get the Document
LBDocumentClass wordDoc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//LBSelection sel = wordDoc.Application.Selection;
LBFind find = wordDoc.Application.Selection.Find;
find.ClearFormatting();
bool wildCards = SearchString.Contains("?") || SearchString.Contains("*");
bool found = find.Execute(SearchString, false, false, wildCards, false, false, true, LBWdFindWrap.wdFindContinue, null, null, null, false, false, false, false);
//Console.WriteLine("find = {0}", found);
}
/// <summary>
/// Text will either replace current selection or be inserted at the current cursor position if no selection
/// </summary>
/// <param name="txt"></param>
public void InsertText(string txt)
{
if (txt == null || txt.Length == 0) return; //nothing to insert
// Get the Document
LBDocumentClass wordDoc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//This will get the selected range or just the current cursor position
LBSelection sel = wordDoc.Application.Selection;
// This will replace the selection or insert at current position
sel.Text = txt;
}
public string GetSelectedString()
{
LBDocumentClass wordDoc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//This will get the selected range or just the current cursor position
LBSelection sel = wordDoc.Application.Selection;
// if the start & end are the same, nothing is selected:
if (sel.Start == sel.End) return null;
return sel.Text;
}
private string ShowException(Exception ex)
{
string sep = "\r\n ";
StringBuilder sb = new StringBuilder();
do
{
sb.Append(sep + ex.Message);
sep += " ";
ex = ex.InnerException;
} while (ex != null);
return sb.ToString();
}
//void _MyDSOFramer_Leave(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSO Leave {0}", this.MyDocumentInfo.DocID);
//}
//void _MyDSOFramer_Enter(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSO Enter {0}", this.MyDocumentInfo.DocID);
//}
//void _MyDSOFramer_GotFocus(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSO Got Focus {0}",this.MyDocumentInfo.DocID);
//}
//void _MyDSOFramer_LostFocus(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSO Lost Focus {0}", this.MyDocumentInfo.DocID);
//}
public void EnterPanel()
{
DSOTabPanel_Enter(this, new EventArgs());
}
//void DSOTabPanel_LostFocus(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSOTabPanel_LostFocus {0} DocID {1} Index {2} {3}", _In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName);
//}
//void DSOTabPanel_GotFocus(object sender, EventArgs e)
//{
// vlnStackTrace.ShowStack("DSOTabPanel_GotFocus {0} DocID {1} Index {2} {3}", _In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName);
//}
#endregion
#region Event Handlers
/// <summary>
/// Display MyTransparentPanel over the DSOPanel so that the Word "Inactive" appears in the upper right hand corner.
/// </summary>
public void InActive()
{
_MyTransparentPanel.BringToFront();
}
/// <summary>
/// Force this item to be selected when the transparent window is clicked.
/// This will in-turn send the Transparent Panel to back and make the DSO Panel
/// editable.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void _MyTransparentPanel_Click(object sender, EventArgs e)
{
this.Select();
}
///// <summary>
///// If the user presses the save button, tell the file to save it's contents to the database
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//void _MyDSOFramer_OnSaveCompleted(object sender, AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEvent e)
//{
// _MyLog.WarnFormat("_MyDSOFramer_OnSaveCompleted");
// Volian.Base.Library.vlnStackTrace.ShowStack("_MyDSOFramer_OnSaveCompleted");
// SaveDSO_Phase2();
//}
private void SaveDSO_Phase2()
{
// Unfortunately, the only way to handle view mode for DSO Framer is to not save.
if (PanelViewEditMode == E_ViewMode.View)
{
MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip);
return;
}
LBDocumentClass doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//while (doc.Saved = false)
// Application.DoEvents();
string tmp = GetReflectiveProperty(_MyEdWord.ActiveDocument(), "FullName");
if (System.IO.File.Exists(tmp))
MyDSOFile.FullName = tmp;
else
_MyLog.FatalFormat("File does not exist {0}\r\nFile was {1}", tmp, MyDSOFile.FullName);
// if this was a library document, ask user if it should be saved for all usages.
bool cvtLibDoc = false;
if (MyDisplayTabItem.MyItemInfo != null) // B2016-131 if myiteminfo is null then the lib doc is not referenced, so just save the changes - don't generate a pdf
{
EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry;
if (myei != null && myei.MyDocument != null && myei.MyDocument.LibTitle != null && myei.MyDocument.LibTitle != "")
{
DialogResult ans = MessageBox.Show("Save as Library Document for all usages?", "Document Save", MessageBoxButtons.YesNo);
if (ans == DialogResult.No) cvtLibDoc = true;
}
}
MyDSOFile.SaveFile(doc.Length, doc.Ascii, MyDisplayTabItem.MyItemInfo, cvtLibDoc, StatusChanged);
if (cvtLibDoc)
{
MyDisplayTabItem.Text = MyDisplayTabItem.MyItemInfo.TabTitle;
MyDisplayTabItem.Tooltip = MyDisplayTabItem.MyItemInfo.TabToolTip;
MyDisplayTabItem.SetPrivateTooltip(MyDisplayTabItem.MyItemInfo.TabToolTip);
}
}
public void StatusChanged(VolianStatusType type, int count, string text)
{
if (Parent != null && Parent.Parent != null && Parent.Parent.Parent is DisplayTabControl)
{
DisplayTabControl tc = Parent.Parent.Parent as DisplayTabControl;
tc.ONStatusChanged(this, new DisplayTabControlStatusEventArgs(type, count, text));
}
}
///// <summary>
///// Before a document closes check to see if it's contents should be saved.
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//void _MyDSOFramer_BeforeDocumentClosed(object sender, AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEvent e)
//{
// SaveDSOPhase1();
//}
private void SaveDSO_Phase1()
{
try
{
if (!IsBeingDeleted)
SaveDirty();
this.Enter -= new EventHandler(DSOTabPanel_Enter);
// this.Leave -= new EventHandler(DSOTabPanel_Leave);
// SaveDirty(); // SaveDirty happens in CloseDSO(bool)
}
catch (Exception ex)
{
_MyLog.Warn("Before Closing Document ", ex);
}
}
/// <summary>
/// Save the contents of the Word Document to a file
/// and save the file to the database
/// </summary>
/// <returns></returns>
public bool SaveDSO()
{
bool result = true;
try
{
bool stat = _MyEdWord.Save();// B2017-133 Edraw
Console.WriteLine("Save = {0}", stat);
SaveDSO_Phase2();
//_MyDSOFramer_OnSaveCompleted(this, null);
// These are handled in the method above
//LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
//MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
//MyDSOFile.SaveFile(doc.Length, doc.Ascii);
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("SaveDSO", ex);
MessageBox.Show(ex.Message, "Error Saving Document", MessageBoxButtons.OK, MessageBoxIcon.Error);
result = false;
}
return result;
}
/// <summary>
/// Check to see if a Word document should be saved. If it is dirty ask the user if the
/// changes should be changed. Save the changes if the user says "yes".
/// </summary>
/// <returns></returns>
public bool SaveDirty()
{
if (OverrideClose)
return false;
if (IsDirty)
{
// Unfortunately, the only way to handle view mode for DSO Framer is to not save.
if (PanelViewEditMode == E_ViewMode.View || !_AllowedToEdit)
{
MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip);
return false;
}
//if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.MyItemInfo.TabTitle + "\r\n" + _MyDisplayTabItem.MyItemInfo.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.Text + "\r\n" + _MyDisplayTabItem.Tooltip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
return SaveDSO();
return false;
}
return true;
}
public static bool IgnoreEnter = false;
private bool _In_DSOTabPanel_Enter=false;
/// <summary>
/// When a Word document is selected make sure it's tab is activated and
/// the SelectedItem for the DisplayTabControl is updated.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DSOTabPanel_Enter(object sender, EventArgs e)
{
if (IgnoreEnter) return;
_MyTransparentPanel.SendToBack();
// Set whether this worddoc is in view/edit mode by checking whether the
// procedure is in view/edit mode (based on the steppanel. This occurs on
// the enter event so that the mode is determined any time this panel becomes
// active.
// find steptabpanel and its view/edit. If it doesn't have a steptabpanel
// use default - edit. Later when we have ownership, need to use that.
PanelViewEditMode = E_ViewMode.Edit; // default to edit
if (MyDisplayTabItem.MyItemInfo != null) // lib doc with no associated active procedure defaults to edit
{
StepTabPanel stpanel = _MyDisplayTabControl.GetProcedureTabPanel(MyDisplayTabItem.MyItemInfo);
PanelViewEditMode = (stpanel == null) ? E_ViewMode.Edit : stpanel.MyStepPanel.VwMode;
}
try
{
//_MyDSOFramer.EventsEnabled = true;
//_MyEdWord.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.ErrorFormat("DSOTabPage_Enter", ex);
}
if (_In_DSOTabPanel_Enter) return;
//vlnStackTrace.ShowStack("DSOTabPanel_Enter {0} DocID {1} Index {2} {3}",_In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName);
_In_DSOTabPanel_Enter = true;
if (MyDisplayTabItem.MyItemInfo != null)
_MyDisplayTabControl.OnItemSelectedChanged(this,new ItemSelectedChangedEventArgs(MyDisplayTabItem.MyItemInfo));
_MyEdWord.Focus();
_In_DSOTabPanel_Enter = false;
_MyDisplayTabControl.SelectedDisplayTabItem = MyDisplayTabItem;
}
#endregion
#region Public Methods
private bool _IsBeingDeleted = false;
public bool IsBeingDeleted
{
get { return _IsBeingDeleted; }
set { _IsBeingDeleted = value; }
}
/// <summary>
/// Cleans-up the DSO Framer window
/// </summary>
/// <returns></returns>
public bool CloseDSO()
{
return CloseDSO(false);
}
/// <summary>
/// Cleans-up the DSO Framer window
/// </summary>
/// <param name="force"></param>
/// <returns></returns>
public bool CloseDSO(bool force)
{
_MyLog.Debug("CloseDSO");
bool result = true;
try
{
if (_MyEdWord != null)
{
SaveDSO_Phase1();
_MyEdWord.CloseDoc();
Controls.Remove(_MyEdWord);
components.Remove(_MyEdWord);
_MyEdWord.Dispose();
_MyEdWord = null;
_Count--;
}
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("SaveDSO - " + this.Name, ex);
result = false;
}
return result;
}
/// <summary>
/// Activates the current DSO Framer window (Word)
/// </summary>
public void Activate()
{
try
{
//this._MyEdWord.Activate();
//if (_MyCount <= MSWordLimit)
// this._MyEdWord.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("Activate", ex);
}
}
#endregion
#region DocumentProperties
private string GetReflectiveProperty(object objectToInspect, string propertyName)
{
string returnString = "";
//To use reflection on an object, you
// first need to get an instance
// of that object's type.
Type objectType = objectToInspect.GetType();
//After you have the object's type, you can get
// information on that type. In this case, we're
// asking the type to tell us all the
// properties that it contains.
PropertyInfo[] properties = objectType.GetProperties();
//You can then use the PropertyInfo array
// to loop through each property of the type.
foreach (PropertyInfo property in properties)
{
//The interest part of this code
// is the GetValue method. This method
// returns the value of the property.
if(property.Name == propertyName)
return property.GetValue(objectToInspect, null).ToString();
}
return null;
}
#endregion
public override string ToString()
{
return string.Format("DSOTabPanel Document {0}", MyDocumentInfo.DocID);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,885 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.IO;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using XYPlots;
using DevComponents.DotNetBar;
namespace Volian.Controls.Library
{
public partial class DisplayRO : UserControl
{
#region Properties
private DisplayTabControl _TabControl;
public DisplayTabControl TabControl
{
get { return _TabControl; }
set { _TabControl = value; }
}
private ROFstInfo _CurROFST = null;
private ROFstInfo _MyROFST;
public ROFstInfo MyROFST
{
get { return _MyROFST; }
set
{
if (!Visible) return; // don't reset anything if the form is invisible.
_MyROFST = value; // define the tree nodes based on this rofst
LoadTree();
}
}
private RoUsageInfo _CurROLink;
public RoUsageInfo CurROLink
{
get { return _CurROLink; }
set
{
if (!Visible) return; // don't reset anything if the form is invisible.
if (value != null) // modify - set the controls to the current ro
{
if (_CurROLink == value) return;
_CurROLink = value;
_SavCurROLink = _CurROLink;
UpdateROTree();
}
else // insert - clear out controls
{
_CurROLink = value;
tbROValue.Text = null;
lbROId.Text = "";
tvROFST.SelectedNode = null;
btnSaveRO.Enabled = btnCancelRO.Enabled = false;
}
}
}
private RoUsageInfo _SavCurROLink;
private StepRTB _MyRTB;
public StepRTB MyRTB
{
get { return _MyRTB; }
set
{
if (!Visible) return;
if (_MyRTB != null)
{
_MyRTB.LinkChanged -= new StepRTBLinkEvent(_MyRTB_LinkChanged);
_MyRTB.SelectionChanged -= new EventHandler(_MyRTB_SelectionChanged);
}
if (value == null) return;
_MyRTB = value;
_MyRTB.LinkChanged += new StepRTBLinkEvent(_MyRTB_LinkChanged);
_MyRTB.SelectionChanged+=new EventHandler(_MyRTB_SelectionChanged);
if (_MyRTB.MyLinkText == null)
{
CurROLink = null;
_SavCurROLink = null;
}
}
}
void _MyRTB_SelectionChanged(object sender, EventArgs e)
{
lbFound.SelectionMode = SelectionMode.None;
lbFound.DataSource = null;
//Spin through ROs looking for the selected text
string lookFor = _MyRTB.SelectedText;
List<ROFSTLookup.roChild> children = _MyROFST.ROFSTLookup.GetRosByValue(lookFor);
if (children != null)
{
lbFound.Visible = true;
lbFound.DataSource = children.ToArray();
lbFound.SelectionMode = SelectionMode.One;
lbFound.SelectedIndex = -1;
}
else
lbFound.Visible = false;
}
void _MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args)
{
if (_MyRTB.MyLinkText == null)
CurROLink = null;
else
{
CurROLink = args.MyLinkText.MyRoUsageInfo;
}
}
private DocVersionInfo _Mydvi;
public DocVersionInfo Mydvi
{
get { return _Mydvi; }
set { _Mydvi = value; }
}
private ProgressBarItem _ProgressBar;
public ProgressBarItem ProgressBar
{
get { return _ProgressBar; }
set { _ProgressBar = value; }
}
//public int ProgBarMax
//{
// get { return _ProgressBar.Maximum; }
// set { _ProgressBar.Maximum = value; }
//}
//public int ProgBarValue
//{
// get { return _ProgressBar.Value; }
// set { _ProgressBar.Value = value; }
//}
//public string ProgBarText
//{
// get { return _ProgressBar.Text; }
// set
// {
// _ProgressBar.TextVisible = true;
// _ProgressBar.Text = value;
// }
//}
#endregion
#region Constructors
public DisplayRO()
{
InitializeComponent();
_ProgressBar = null;
panelRoValue.BackColor = Color.Cornsilk;
panelValue.BackColor = Color.Cornsilk;
}
#endregion
#region Events
ROFSTLookup.rochild selectedChld;
private void tvROFST_AfterSelect(object sender, TreeViewEventArgs e)
{
tbROValue.Text = null;
lbROId.Text = "";
btnCancelRO.Enabled = false;
btnSaveRO.Enabled = false;
btnPreviewRO.Enabled = false;
if (e.Node.Tag is ROFSTLookup.rochild)
{
ROFSTLookup.rochild chld = (ROFSTLookup.rochild)e.Node.Tag;
selectedChld = chld;
if (chld.value != null)
{
RoUsageInfo SavROLink = null;
if (_SavCurROLink != null)
SavROLink = _SavCurROLink; ;
lbROId.Text = chld.appid;
btnSaveRO.Enabled = ((_SavCurROLink == null) || !(chld.roid.Equals(SavROLink)));
btnCancelRO.Enabled = ((_SavCurROLink != null) && !(chld.roid.Equals(SavROLink)));
switch (chld.type)
{
case 1: // standard (regular) text RO type
tbROValue.Text = chld.value;
btnPreviewRO.Enabled = false;
break;
case 2: // Table RO type
tbROValue.Text = "(Table)";
btnPreviewRO.Enabled = true;
break;
case 4: // X/Y Plot RO type
tbROValue.Text = "(Graph)";
btnPreviewRO.Enabled = true;
break;
case 8: // Intergrated Graphics RO type
tbROValue.Text = "(Image)";
btnPreviewRO.Enabled = true;
break;
}
}
}
//if (e.Node.Tag is ROFST.rochild)
//{
// ROFST.rochild chld = (ROFST.rochild)e.Node.Tag;
// if (chld.type == 1 && chld.value != null)
// {
// string SavROLink = "";
// if (_SavCurROLink != null)
// SavROLink = _SavCurROLink.Substring(_SavCurROLink.IndexOf(' ') + 1, 12);
// tbROValue.Text = chld.value;
// btnSaveRO.Enabled = ((_SavCurROLink == null) || !(chld.roid.Equals(SavROLink)));
// btnCancelRO.Enabled = ((_SavCurROLink != null) && !(chld.roid.Equals(SavROLink)));
// }
// //else
// //{
// // tbROValue.Text = null;
// // btnCancelRO.Enabled = btnSaveRO.Enabled = false;
// //}
//}
////else
////{
//// tbROValue.Text = null;
//// btnCancelRO.Enabled = btnSaveRO.Enabled = false;
////}
}
private void tvROFST_BeforeExpand(object sender, TreeViewCancelEventArgs e)
{
LoadChildren(e.Node);
}
private void LoadChildren(TreeNode tn)
{
object tag = tn.Tag;
if (tn.FirstNode != null && tn.FirstNode.Text != "VLN_DUMMY_FOR_TREE") return; // already loaded.
if (tn.FirstNode != null && tn.FirstNode.Text == "VLN_DUMMY_FOR_TREE") tn.FirstNode.Remove();
ROFSTLookup.rochild[] chld = null;
if (tn.Tag is ROFSTLookup.rodbi)
{
ROFSTLookup.rodbi db = (ROFSTLookup.rodbi)tn.Tag;
chld = db.children;
}
else if (tn.Tag is ROFSTLookup.rochild)
{
ROFSTLookup.rochild ch = (ROFSTLookup.rochild)tn.Tag;
chld = ch.children;
}
else
{
Console.WriteLine("error - no type");
return;
}
// if children, add dummy node
if (chld != null && chld.Length > 0)
{
ProgressBar_Initialize(chld.Length, tn.Text);
for (int i = 0; i < chld.Length; i++)
{
ProgressBar_SetValue(i);
TreeNode tmp = null;
// if this is a group, i.e. type 0, add a dummy node
if (chld[i].type == 0 && chld[i].children == null)
//skip it.
// TODO: KBR how to handle this?
//Console.WriteLine("ro junk");
continue;
else if (/*chld[i].type == 1 && */ chld[i].value == null)
{
tmp = new TreeNode(chld[i].title);
tmp.Tag = chld[i];
tn.Nodes.Add(tmp);
TreeNode sub = new TreeNode("VLN_DUMMY_FOR_TREE");
tmp.Nodes.Add(sub);
}
//else if (chld[i].type == 2 && chld[i].value == null) // table
//{
// if ((_MyRTB.MyItemInfo.MyContent.Type % 10000) == (int)E_FromType.Table)
// {
// tmp = new TreeNode(chld[i].title);
// tmp.Tag = chld[i];
// tn.Nodes.Add(tmp);
// TreeNode sub = new TreeNode("VLN_DUMMY_FOR_TREE");
// tmp.Nodes.Add(sub);
// }
//}
else
{
tmp = new TreeNode(chld[i].title);
tmp.Tag = chld[i];
tn.Nodes.Add(tmp);
}
}
}
ProgressBar_Clear();
}
private void LoadTree()
{
if (_MyROFST == null) return;
if (_MyROFST == _CurROFST) return;
tvROFST.Nodes.Clear();
_CurROFST = _MyROFST;
for (int i = 0; i < _MyROFST.ROFSTLookup.myHdr.myDbs.Length; i++)
{
TreeNode tn = new TreeNode(_MyROFST.ROFSTLookup.myHdr.myDbs[i].dbiTitle);
tn.Tag = _MyROFST.ROFSTLookup.myHdr.myDbs[i];
tvROFST.Nodes.Add(tn);
AddDummyGroup(_MyROFST.ROFSTLookup.myHdr.myDbs[i], tn);
}
}
private void AddDummyGroup(ROFSTLookup.rodbi rodbi, TreeNode tn)
{
if (rodbi.children != null && rodbi.children.Length > 0)
{
TreeNode tmp = new TreeNode("VLN_DUMMY_FOR_TREE");
tn.Nodes.Add(tmp);
}
}
private void UpdateROTree()
{
// walk down from root of tree, expanding values in the string
// that represents the ro link.
//string tmpstr = _CurROLink;
//int sp = tmpstr.IndexOf(" "); // because parse of ro info is wrong!!
//int rousageid = System.Convert.ToInt32(tmpstr.Substring(0, sp));
ExpandTree(_CurROLink.ROID);// tmpstr.Substring(sp + 1, tmpstr.Length - sp - 1);
}
private void ExpandTree(string roid)
{
string db = roid.Substring(0, 4);
bool multValSel = false;
if (roid.Length == 16)
multValSel = true;
ROFSTLookup.rochild rochld = MyROFST.ROFSTLookup.GetRoChild(roid.Substring(0, 12).ToUpper());
// use this to walk up tree until database - this is used to expand tree.
List<int> path = new List<int>();
int myid = rochld.ID;
while (myid > 0)
{
path.Insert(0, myid);
myid = rochld.ParentID;
rochld = MyROFST.ROFSTLookup.GetRoChildFromID(myid);
if (rochld.ID == -1) myid = -1;
}
TreeNode tnExpand = null;
int titm = System.Convert.ToInt32(db);
// find database first
foreach (TreeNode tn in tvROFST.Nodes)
{
ROFSTLookup.rodbi thisdb = (ROFSTLookup.rodbi)tn.Tag;
if (thisdb.dbiID == titm)
{
LoadChildren(tn);
tnExpand = tn;
break;
}
}
if (tnExpand == null) return; // something went wrong?
// use the path id list to load/find the treeview's nodes.
foreach (int citm in path)
{
if (citm != System.Convert.ToInt32(db))
{
LoadChildren(tnExpand);
tnExpand.Expand();
foreach (TreeNode tn in tnExpand.Nodes)
{
ROFSTLookup.rochild chld = (ROFSTLookup.rochild)tn.Tag;
if (chld.ID == citm)
{
tnExpand = tn;
break;
}
}
}
}
//if (tnExpand != null) tvROFST.SelectedNode = tnExpand;
if (tnExpand != null)
{
// If a multiple return value, try to select the proper node
if (multValSel)
{
LoadChildren(tnExpand);
tnExpand.Expand();
foreach (TreeNode tn in tnExpand.Nodes)
{
ROFSTLookup.rochild chld = (ROFSTLookup.rochild)tn.Tag;
if (chld.roid == roid)
{
tnExpand = tn;
break;
}
}
}
tvROFST.SelectedNode = tnExpand;
}
}
private void btnSaveRO_Click(object sender, EventArgs e)
{
if (tbROValue.Text == null || tbROValue.Text == "")
{
MessageBox.Show("Must select an RO Value from the tree.");
return;
}
Object obj = tvROFST.SelectedNode.Tag;
if (obj is ROFSTLookup.rochild)
{
ROFSTLookup.rochild roch = (ROFSTLookup.rochild)obj;
DisplayTabItem dti = _TabControl.SelectedDisplayTabItem; //.OpenItem(_ItemInfo); // open the corresponding procedure text
if (dti.MyDSOTabPanel != null) // A Word Document tab is the active tab
{
ROFSTLookup.rodbi[] dbs = MyROFST.ROFSTLookup.GetRODatabaseList();
ROFSTLookup.rodbi db = dbs[int.Parse(roch.roid.Substring(0, 4))-1];
string accPrefix = db.dbiAP.Replace(_Mydvi.DocVersionConfig.RODefaults_graphicsprefix,"IG");
accPrefix = accPrefix.Replace(_Mydvi.DocVersionConfig.RODefaults_setpointprefix, "SP");
// string accPrefix = (roch.type == 8) ? _Mydvi.DocVersionConfig.RODefaults_graphicsprefix : _Mydvi.DocVersionConfig.RODefaults_setpointprefix;
string AccPageID = string.Format("<{0}-{1}>", accPrefix, roch.appid);// makes <SP1-A.1> for example
Console.WriteLine(AccPageID);
//string AccPageID = string.Format("{0} <{1}-{2}>", ConvertSymbolsAndStuff(selectedChld.value), accPrefix, roch.appid); // value and accesory ID
//string AccPageID = string.Format("{0} {1}", ConvertSymbolsAndStuff(selectedChld.value), string.Format(@"#Link:ReferencedObject:<NewID> {0} {1}", roch.roid, _MyROFST.MyRODb.RODbID)); // value and link reference
//if (MessageBox.Show(AccPageID,"Place on Windows Clipboard?",MessageBoxButtons.YesNo) == DialogResult.Yes)
// Clipboard.SetText(AccPageID);
// Insert the RO text at the current cursor position in the word document
// NOTE: assuming any type of RO can be put in an Accessory (MSWord) Document
if (dti.MyDSOTabPanel != null)
dti.MyDSOTabPanel.InsertText(AccPageID);
}
else if (_MyRTB != null) // a Procedure Steps section tab is active
{
_MyRTB.inRoAdd = true;
if (CheckROSelection(roch)) // check for RO type is valid for this type of step/substep
{
// the roid may be 12 or 16 chars long, with the last 4 set if there is unit specific
// menuing. Pad to 12 to store in the rousage table.
string padroid = (roch.roid.Length <= 12) ? roch.roid + "0000" : roch.roid;
string linktxt = string.Format(@"#Link:ReferencedObject:<NewID> {0} {1}", padroid, _MyROFST.MyRODb.RODbID);
// Resolve symbols and scientific notation in the RO return value
string valtxt = ConvertSymbolsAndStuff(selectedChld.value);
_MyRTB.InsertRO(valtxt, linktxt);
_MyRTB.Select(_MyRTB.SelectionStart + valtxt.Length + linktxt.Length, 0);
_MyRTB.SaveText();
_MyRTB.Focus();
}
_MyRTB.inRoAdd = false;
btnSaveRO.Enabled = btnCancelRO.Enabled = btnPreviewRO.Enabled = false;
_SavCurROLink = null;
CurROLink = null;
}
//else // we're in an Word attachment
//{
// string accPrefix = (roch.type == 8) ? _Mydvi.DocVersionConfig.RODefaults_graphicsprefix : _Mydvi.DocVersionConfig.RODefaults_setpointprefix;
// string AccPageID = string.Format("<{0}-{1}>", accPrefix, roch.appid);
// //TODO: CAN WE AUTOMATICALLY PLACE RO ONTO WORD ATTACHEMNT?
// //if (MessageBox.Show(AccPageID,"Place on Windows Clipboard?",MessageBoxButtons.YesNo) == DialogResult.Yes)
// // Clipboard.SetText(AccPageID);
// if (dti.MyDSOTabPanel != null)
// dti.MyDSOTabPanel.InsertText(AccPageID);
//}
}
}
private bool CheckROSelection(ROFSTLookup.rochild selectedRO)
{
bool goodToGo = true;
bool replacingRO = (_SavCurROLink != null);
string insrpl = (replacingRO) ? "Cannot Replace" : "Cannot Insert";
string errormsg = "";
switch (selectedRO.type)
{
case 1: // regular text RO
if (_MyRTB.MyItemInfo.IsFigure)
{
errormsg = (replacingRO) ? "a Figure with a non-figure." : "a text RO in a Figure type.";
goodToGo = false;
}
break;
case 2: // table RO
if (_MyRTB.MyItemInfo.IsFigure)
{
errormsg = (replacingRO) ? "a Figure with a non-figure." : "a table into a Figure type.";
goodToGo = false;
}
else if (!_MyRTB.MyItemInfo.IsTable)
{
errormsg = (replacingRO) ? "a non-table RO with a Table RO." : "a table into a non-table type.";
//TODO: Prompt user to insert a new Table substep type and place this RO into it
goodToGo = false;
}
break;
case 4: // X/Y Plot RO type
if (!_MyRTB.MyItemInfo.IsAccPages)
{
errormsg = (replacingRO) ? "a non-X/Y Plot RO with an X/Y Plot RO." : "an X/Y Plot RO in an non-Accessory Page type.";
//TODO: Prompt user to insert a new substep type that handles x/y Plots and place this RO into it
goodToGo = false;
}
break;
case 8: // figure (intergrated graphics)
if (!_MyRTB.MyItemInfo.IsFigure && !_MyRTB.MyItemInfo.IsAccPages)
{
errormsg = (replacingRO) ? "a graphics RO with a non-graphcis RO." : "a Graphics RO in an non-Figure or a non-Accessory Page type.";
//TODO: Prompt user to insert a new substep type that handles x/y Plots and place this RO into it
goodToGo = false;
}
break;
}
if (!goodToGo)
MessageBox.Show(string.Format("{0} {1}", insrpl, errormsg), (replacingRO)?"Invalid RO Replacement":"Invalid RO Insert");
return goodToGo;
}
private void btnCancelRO_Click(object sender, EventArgs e)
{
_CurROLink = _SavCurROLink;
btnCancelRO.Enabled = false;
UpdateROTree();
}
private void btnPreviewRO_Click(object sender, EventArgs e)
{
if (selectedChld.type == 8) // integrated graphic
{
string fname = selectedChld.value.Substring(0, selectedChld.value.IndexOf('\n'));
int thedot = fname.LastIndexOf('.');
if (thedot == -1 || (thedot != (fname.Length - 4)))
fname += string.Format(".{0}", MyROFST.MyRODb.RODbConfig.GetDefaultGraphicExtension());
ROImageInfo tmp = ROImageInfo.GetByROFstID_FileName(MyROFST.ROFstID, fname);
if (tmp !=null)
{
PreviewROImage pvROImg = new PreviewROImage(tmp.Content, selectedChld.title);
pvROImg.ShowDialog();
}
else
MessageBox.Show("Cannot Find Image Data");
}
else if (selectedChld.type == 2) // table
{
PreviewMultiLineRO pmlROTable = new PreviewMultiLineRO(selectedChld.value, selectedChld.title);
pmlROTable.ShowDialog();
}
else if (selectedChld.type == 4) // x/y plot
{
//PreviewMultiLineRO pmlROTable = new PreviewMultiLineRO(selectedChld.value, selectedChld.title);
//pmlROTable.ShowDialog(); // This will show the graph commands
this.Cursor = Cursors.WaitCursor;
// TemporaryFolder is magical. It will automatically (behind the scenes) build a path to a temporary
// folder on the user's machine. It does this only the first time it's reference (GET), after that
// it uses what it has.
string pdfname = TemporaryFolder; //@"G:\debugdat\testplot\";
pdfname += "\\" + selectedChld.appid + ".pdf";
//if (File.Exists(pdfname))
// File.Delete(pdfname);
XYPlot ROGraph = new XYPlot(selectedChld.value, pdfname);
this.Cursor = Cursors.Default;
// Run an internet browser window
WebBrowser wb = new WebBrowser(pdfname);
wb.TitleText = selectedChld.title;
wb.ShowDialog();// .Show();
// Run the default PDF reader
//System.Diagnostics.Process ActRdr = System.Diagnostics.Process.Start(pdfname);
//ActRdr.WaitForExit();
// Wait for the PDF viewing process to close then delete the temporary file
// wait for a one minute max
if (!WaitToDeleteFile(pdfname,1))
MessageBox.Show(string.Format("The PDF viewer was holding this file open: \n\n{0}",pdfname),"Cannot Delete Temporary File");
}
}
private void ProgressBar_Initialize(int max, string desc)
{
if (_ProgressBar != null)
{
_ProgressBar.Maximum = max;
_ProgressBar.Text = desc;
_ProgressBar.TextVisible = true;
}
}
private void ProgressBar_SetValue(int curval)
{
if (_ProgressBar != null)
{
_ProgressBar.Value = curval;
}
}
private void ProgressBar_Clear()
{
if (_ProgressBar != null)
{
_ProgressBar.Text = "";
_ProgressBar.Maximum = 0;
_ProgressBar.Value = 0;
_ProgressBar.TextVisible = false;
}
}
#region Utils
private string ConvertSymbolsAndStuff(string instr)
{
string outstr = instr;
outstr = outstr.Replace("`", @"\'b0"); // convert backquote to degree - left over from DOS days.
outstr = outstr.Replace("\xa0", @"\u160?"); // hardspace
outstr = outstr.Replace("\xb0", @"\'b0"); // degree
outstr = outstr.Replace("\x7f", @"\u916?"); // delta
outstr = outstr.Replace("\x2265", @"\u8805?"); // greater than or equal
outstr = outstr.Replace("\x2264", @"\u8804?"); // less than or equal
outstr = outstr.Replace("\xB1", @"\'b1"); // plus minus
outstr = outstr.Replace("\x3A3", @"\u931?"); // sigma
outstr = outstr.Replace("\x3C4", @"\u947?"); // gamma
outstr = outstr.Replace("\xBD", @"\'bd"); // half
outstr = outstr.Replace("\x25A0", @"\u9604?"); // accum 2584
outstr = outstr.Replace("\x7", @"\u9679?"); // bullet 25CF
outstr = outstr.Replace("\x2248", @"\u8776?"); // approx eq
outstr = outstr.Replace("\x2261", @"\u8773?"); // similar eq 2245
outstr = outstr.Replace("\xF7", @"\'f7"); // division
outstr = outstr.Replace("\x221A", @"\u8730?"); // square root
outstr = outstr.Replace("\x393", @"\u961?"); // rho 3C1
outstr = outstr.Replace("\x3C0", @"\u960?"); // pi
outstr = outstr.Replace("\xb5", @"\u956?"); // micro 3BC (try e6, if not work try 109)
outstr = outstr.Replace("\x3B4", @"\u948?"); // lower case delta
outstr = outstr.Replace("\x3C3", @"\u963?"); // lower case sigma
outstr = outstr.Replace("\xBC", @"\'bc"); // quarter
outstr = outstr.Replace("\x3C6", @"\'d8"); // dist zero, D8
outstr = outstr.Replace("\xC9", @"\u274?"); // energy, 112
outstr = outstr.Replace("\xEC", @"\'ec"); // grave
outstr = outstr.Replace("\x2502", @"\u9474?"); // bar
outstr = outstr.Replace("\x3B5", @"\u949?"); // epsilon
outstr = outstr.Replace("\x398", @"\u952?"); // theta, 3B8
outstr = outstr.Replace("\x221E", @"\u8857?"); // dot in oval, 2299
outstr = outstr.Replace("\xBF", @"\u964?"); // tau, 3C4
outstr = outstr.Replace("\x2310", @"\u9830?"); // diamond, 2666
outstr = outstr.Replace("\x2192", @"\u8594?");
outstr = outstr.Replace("\x2190", @"\u8592?");
outstr = outstr.Replace("\x2191", @"\u8593?");
outstr = outstr.Replace("\x2193", @"\u8595?");
outstr = outstr.Replace("\x2207", @"\u8711?");
// DisplayTODO: DO WE NEED TO CHECK WHETHER TO REPLACE ^ CHARACTER FOR SETPOINTS?
//if (DoCaret) s2 = s2.Replace("^", @"\u916");
outstr = outstr.Replace("^", @"\u916");
outstr = ConvertDOSSuperAndSubScripts(outstr);
outstr = ConvertFortranFormatToScienctificNotation(outstr);
return outstr;
}
private string ConvertFortranFormatToScienctificNotation(string str)
{
string outstr = "";
int orglen = str.Length;
int cnt = 0;
int ptr;
int nbytes;
int tstr, tstr2, rptr, start = 0;
while (cnt < orglen)
{
// position up to the the next number, sign, or period
ptr = str.IndexOfAny("+-0123456789.".ToCharArray(), cnt);
if (ptr == -1)
{
outstr += str.Substring(cnt);
break; // jump out of while loop - nothing else to process
}
if ((ptr - cnt) > 0)
{
outstr += str.Substring(cnt, ptr - cnt);
cnt = ptr;
}
if (cnt > start && str[cnt - 1] == '\'')
{
//B2003-053: only remove the single quote character
// if str ptr is not at the end of the string or
// the next char (after the str ptr) is not a space
// or newline... (as per Paul Linn on 7/17/03)
int len = orglen - cnt;
if (len <= 1 || str[cnt + 1] == ' ' || str[cnt + 1] == '\n')
start = cnt;
else
start = cnt - 1;
}
else start = cnt;
tstr = cnt;
//Skip preceeding signs
if (str[cnt] == '+' || str[cnt] == '-')
cnt++;
cnt = NextNonNumber(str, cnt);
if (str[cnt] == '.')
{
cnt = NextNonNumber(str, cnt + 1);
if (cnt >= str.Length) //jsj bug fix
{
outstr += str.Substring(tstr);
break; // jump out of while loop - nothing else to process
}
if (str[start] == '\'')
{
start++;
}
else if (str[cnt] == 'E' && cnt > tstr)
{
nbytes = (cnt - tstr); // don't include the 'E'
outstr += str.Substring(tstr, nbytes);
cnt++;
rptr = outstr.Length - 1;
while (outstr[rptr] == '0') rptr--;
if (outstr[rptr] != '.') rptr++;
if (rptr < (outstr.Length - 1))
outstr = outstr.Substring(0, rptr + 1); // trim trailing 0's
int poutstr = 0;
if (outstr[poutstr] == '+' || outstr[poutstr] == '-') poutstr++;
if (!outstr[poutstr].Equals("1"))
{
outstr += "x1";
}
outstr += "0\\super ";
tstr2 = cnt;
if (str[cnt] == '+' || str[cnt] == '-') cnt++;
cnt = NextNonNumber(str, cnt);
if (str[cnt] == '.' && char.IsDigit(str, cnt + 1))
cnt = NextNonNumber(str, cnt + 1);
nbytes = cnt - tstr2; // +1;
outstr += str.Substring(tstr2, nbytes);
outstr += "\\nosupersub ";
if (!char.IsLetterOrDigit(str, cnt) && !char.IsWhiteSpace(str, cnt))
return (str.Substring(tstr));
}
}
else
{
outstr += str.Substring(start, cnt - start + 1);
cnt++;
}
}
return (outstr);
}
private int NextNonNumber(string str, int cnt)
{
int rtn = 0;
string tstr = str.Substring(cnt);
int len = tstr.Length;
while (rtn < len && char.IsDigit(tstr,rtn)) rtn++;
return rtn + cnt;
}
private string ConvertDOSSuperAndSubScripts(string instr)
{
string outstr = "";
string tstr = instr;
int cnt = 0;
int ptr = 0;
bool issupper=false, issub = false;
while (tstr != null && (ptr = tstr.IndexOfAny("#~".ToCharArray(), cnt)) >= 0)
{
if (ptr > cnt)
outstr += tstr.Substring(cnt, ptr - cnt);
switch (tstr[ptr])
{
case '#':
if (issub || issupper)
outstr += "\\nosupersub ";
else
outstr += "\\super ";
issupper = !issupper;
issub = false;
break;
case '~':
if (issupper || issub)
outstr += "\\nosupersub ";
else
outstr += "\\sub ";
issub = !issub;
issupper = false;
break;
}
cnt = ptr + 1;
if (cnt >= tstr.Length)
tstr = null;
else
tstr = instr.Substring(cnt);
cnt = 0;
}
if (tstr != null)
outstr += tstr;
return outstr;
}
private static string _TemporaryFolder = null;
public static string TemporaryFolder
{
get
{
if (_TemporaryFolder == null)
{
// This will create a Temp\VE-PROMS folder in the LocalSettings Folder.
//XP - C:\Documents and Settings\{user}\Local Settings\Application Data\Temp\VE-PROMS
//Vista - C:\Users\{user}\AppData\Local\Temp\VE-PROMS
_TemporaryFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Temp";
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
_TemporaryFolder += @"\VE-PROMS";
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
}
return _TemporaryFolder;
}
}
/// <summary>
/// Keep trying to delete the given file until successful OR until MaxMinutes has elasped
/// </summary>
/// <param name="fname">File to delete (including path)</param>
/// <param name="MaxMinutes">Maxium Minutes to keep trying</param>
/// <returns></returns>
private static bool WaitToDeleteFile(string fname, int MaxMinutes)
{
bool deletedfile = false;
DateTime dt_start = DateTime.Now;
DateTime dt_loop = dt_start;
int mins_start = dt_start.Minute;
int mins_loop = dt_loop.Minute;
while (!deletedfile && ((mins_loop - mins_start) < MaxMinutes))
{
try
{
dt_loop = DateTime.Now;
File.Delete(fname);
deletedfile = true;
}
catch
{
continue; // The process is still holding file, try again.
}
}
return deletedfile;
}
#endregion // utils
private void lbROId_DoubleClick(object sender, EventArgs e)
{
// TODO: This is hard-coded to particular folders
//System.Diagnostics.Process.Start(@"C:\VE-PROMS.NET\BIN\RoEditor.EXE",@"c:\Plant\hlp\vehlp\ro " + CurROLink.ROID);
string roapp = Environment.GetEnvironmentVariable("roapp");
string roloc = "\"" + _MyROFST.MyRODb.FolderPath + "\"";
System.Diagnostics.Process.Start(roapp, roloc + " " + CurROLink.ROID);
}
#endregion
private void lbFound_SelectedValueChanged(object sender, EventArgs e)
{
ROFSTLookup.roChild child = lbFound.SelectedValue as ROFSTLookup.roChild;
if (child != null)
{
ExpandTree(child.MyChild.roid);
}
}
}
}

View File

@@ -0,0 +1,987 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.IO;
using VEPROMS.CSLA.Library;
using DevComponents.DotNetBar;
using DevComponents.AdvTree;
using System.Text.RegularExpressions;
using Volian.Base.Library;
namespace Volian.Controls.Library
{
public partial class DisplayReports : UserControl
{
#region Events
public event DisplayReportsEvent PrintRequest;
private void OnPrintRequest(DisplayReportsEventArgs args)
{
if (PrintRequest != null)
PrintRequest(this, args);
}
#endregion
private List<DocVersionInfo> lstCheckedDocVersions = new List<DocVersionInfo>();
private List<object> lstCheckedROs = new List<object>();
private List<ItemInfoList> lstReportResults = new List<ItemInfoList>();
private List<string> ROList = new List<string>();
private List<object> lstROObj = new List<object>();
private int _MyRODbID;
private string DocVersionList
{
get
{
// append list of document versions to search
if (lstCheckedDocVersions.Count > 0)
{
string strRtnStr = "";
// get list of doc versions to search
foreach (DocVersionInfo dvi in lstCheckedDocVersions)
{
strRtnStr += string.Format(",{0}", dvi.VersionID.ToString());
}
return strRtnStr.Substring(1);
}
return "";
}
}
private DocVersionInfo _MyDocVersion;
public DocVersionInfo Mydocversion
{
get { return _MyDocVersion; }
set
{
_MyDocVersion = value;
if (_MyDocVersion != null)
{
if (_MyDocVersion.DocVersionAssociationCount > 0)
{
// if the count variable is not consistent with the actual list count,
// do a refresh. There was a bug, B2012-040, that was not reproducable..
// so this is an attempt to fix it.
if (_MyDocVersion.DocVersionAssociations.Count == 0)
{
_MyDocVersion.RefreshDocVersionAssociations();
if (_MyDocVersion.DocVersionAssociations.Count == 0) return;
}
MyROFSTLookup = _MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(_MyDocVersion);
_MyRODbID = _MyDocVersion.DocVersionAssociations[0].MyROFst.RODbID;
}
}
}
}
private ROFSTLookup _MyROFSTLookup;
public ROFSTLookup MyROFSTLookup
{
get { return _MyROFSTLookup; }
set
{
//if (!Visible) return; // don't reset anything if the form is invisible.
_MyROFSTLookup = value; // define the tree nodes based on this rofst
advTreeROFillIn(true);
//LoadROComboTree();
}
}
private ItemInfoList _ReportResult;
public ItemInfoList ReportResult
{
get { return _ReportResult; }
set
{
_ReportResult = value;
}
}
private void GenerateROList()
{
string rtnStr = "";
ROFSTLookup.rochild[] chld = null;
ROFSTLookup.rochild ch;
ROList.Clear();
foreach (object rolkup in lstCheckedROs)
{
if (rolkup == null) // All Referenced Objects selected, return list of RO databases
{
foreach (ROFSTLookup.rodbi rodbi in _MyROFSTLookup.GetRODatabaseList())
{
rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", rodbi.dbiID.ToString("X4"));
ROList.Add(rtnStr);
}
continue;
}
else if (rolkup is ROFSTLookup.rodbi)
rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", ((ROFSTLookup.rodbi)rolkup).dbiID.ToString("X4"));
else if (rolkup is ROFSTLookup.rochild)
{
ch = (ROFSTLookup.rochild)rolkup;
chld = ch.children;
rtnStr = _MyRODbID.ToString() + ":" + GetROChildren(rolkup).TrimEnd(',');
}
//else if (rolkup is ROFSTLookup.rogrp)
// Console.WriteLine("RO Group");
//else if (rolkup is ROFSTLookup.roHdr)
// Console.WriteLine("RO Header");
ROList.Add(rtnStr);
}
}
// same function as GetROsToSearch in DisplaySearch.cs
private string GetROChildren(object roObj)
{
ROFSTLookup.rochild chld = (ROFSTLookup.rochild)roObj;
string rtnstr = "";
if (chld.children == null) // get a single ROID
{
rtnstr += string.Format("{0}", chld.roid);
if (rtnstr.Length == 12) rtnstr += "0000"; // last four digits are used for multiple return values
}
else if (!cbxROUsage.Checked && chld.children[0].ParentID == 0)
{
rtnstr += string.Format("{0},", chld.roid); // doing a RO Summary or RO Complete report - don't want children that are multiple return values
}
else
{ // spin through the child list and get the ROIDs.
// if the child has children, then call this function recursivly
foreach (ROFSTLookup.rochild roc in chld.children)
{
// Don't get the children if we are doing a RO Summary or RO Complete report & children are the multiple return values
if (roc.children != null && (cbxROUsage.Checked || roc.children[0].ParentID != 0))
rtnstr += GetROChildren(roc);
else
rtnstr += string.Format("{0},", roc.roid);
}
}
return rtnstr;
}
private string GetListOfROs(bool keepRODbID)
{
string rtnStr = "";
string strRODbID = "";
int cnt = 0;
foreach (string rostr in ROList)
{
int ndxOf = rostr.IndexOf(":");
if (ndxOf > 0)
{
string tstr = rostr.Substring(0, ndxOf + 1);
if (tstr != strRODbID && keepRODbID)
{
strRODbID = tstr;
rtnStr += rostr;
}
else
rtnStr += rostr.Substring(ndxOf + 1);
}
else
rtnStr += rostr;
if (rtnStr.EndsWith(",")) rtnStr = rtnStr.Substring(0, rtnStr.Length - 1);
if (++cnt < ROList.Count)
rtnStr += ",";
}
return rtnStr;
}
public DisplayReports()
{
InitializeComponent();
EnableOrDisablePrintButton();
cmbxROUsageSort.SelectedIndex = 0;
tabTransitionReports.Visible = false;
cbxComplete.Enabled = true;
cbxSummary.Enabled = true;
if (cbxROUsage.Checked)
cbxIncldMissingROs.Text = "Include Missing ROs (red ? in the editor)";
else if (cbxComplete.Checked)
cbxIncldMissingROs.Text = "Include Empty RO Fields";
cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked;
cbxIncldMissingROs.Visible = cbxROUsage.Checked || cbxComplete.Checked;
}
public void SelectReferencedObjectTab()
{
tabROReports.PerformClick();
}
private void AddSelectedROChildren(DevComponents.AdvTree.NodeCollection chldrn)
{
if (chldrn.Count > 0)
{
foreach (DevComponents.AdvTree.Node n in chldrn)
{
if (n.Checked)
lstCheckedROs.Add(n.Tag);
else
AddSelectedROChildren(n.Nodes);
}
}
}
private void BuildCheckedROsList()
{
lstCheckedROs.Clear();
if (advTreeRO.Nodes.Count == 0) return;
DevComponents.AdvTree.Node node = advTreeRO.Nodes[0];
if (node.Checked) // top node (all Referenced Objects) selected
lstCheckedROs.Add(node.Tag);
else
AddSelectedROChildren(node.Nodes);
}
private void EnableOrDisablePrintButton()
{
switch (tctrlReports.SelectedTabIndex)
{
case 0: // Transition Reports
btnPrintReport.Enabled = (lstCheckedDocVersions.Count > 0);
break;
case 1: // Referenced Objects Reports
BuildCheckedROsList(); // this list is sent to the report generator
if (cbxROUsage.Checked)
btnPrintReport.Enabled = (lstCheckedDocVersions.Count > 0 && lstCheckedROs.Count > 0);
else
btnPrintReport.Enabled = ((cbxComplete.Checked || cbxSummary.Checked) && lstCheckedROs.Count > 0);
break;
}
if (cbxROUsage.Checked)
cbxIncldMissingROs.Text = "Include Missing ROs (red ? in the editor)";
else if (cbxComplete.Checked)
cbxIncldMissingROs.Text = "Include Empty RO Fields";
//cbxIncldMissingROs.Checked = cbxROUsage.Checked || cbxComplete.Checked;
cbxIncldMissingROs.Visible = cbxROUsage.Checked || cbxComplete.Checked;
}
private void tabTransitionReports_Click(object sender, EventArgs e)
{
xpSetToReport.Enabled = true;
xpSetToReport.Expanded = true;
xpSelROs.Expanded = false;
xpSelROs.Enabled = false;
EnableOrDisablePrintButton();
}
private void tabROReports_Click(object sender, EventArgs e)
{
xpSetToReport.Enabled = cbxROUsage.Checked;
xpSetToReport.Expanded = cbxROUsage.Checked;
cmbxROUsageSort.Enabled = cbxROUsage.Checked;
xpSelROs.Enabled = true;
xpSelROs.Expanded = true;
cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked;
EnableOrDisablePrintButton();
}
private void cbxROUsage_CheckedChanged(object sender, EventArgs e)
{
xpSetToReport.Enabled = cbxROUsage.Checked;
xpSetToReport.Expanded = cbxROUsage.Checked;
cmbxROUsageSort.Enabled = cbxROUsage.Checked;
// reset the RO tree and clear anything that was selected
advTreeROFillIn(true);
lstCheckedROs.Clear();
cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked;
EnableOrDisablePrintButton();
}
#region Procedure List
private DevComponents.AdvTree.Node NewAdvTreeNode(string nodetext, bool selectable, bool chxbxvisable)
{
DevComponents.AdvTree.Node newnode;
newnode = new DevComponents.AdvTree.Node();
newnode.Text = nodetext;
newnode.Selectable = selectable;
newnode.CheckBoxAlignment = DevComponents.AdvTree.eCellPartAlignment.NearCenter;
newnode.CheckBoxStyle = eCheckBoxStyle.CheckBox;
newnode.CheckBoxThreeState = false;
newnode.CheckBoxVisible = chxbxvisable;
return newnode;
}
public void advTreeProcSetsFillIn(bool blSeachTabClicked)
{
DevComponents.AdvTree.Node topnode = null;
int cntnd = 0;
VETreeNode vtn = VETreeNode.GetFolder(1);
FolderInfo fi = vtn.VEObject as FolderInfo;
int fiCount = fi.ChildFolderCount;
advTreeProcSets.Nodes.Clear();
lstCheckedDocVersions.Clear();
topnode = new DevComponents.AdvTree.Node();
topnode.Text = "Available Procedure Sets";
topnode.Tag = fi;
advTreeProcSets.Nodes.Add(topnode);
//advTreeProcSets.AfterNodeInsert += new TreeNodeCollectionEventHandler(advTreeProcSets_AfterNodeInsert);
foreach (FolderInfo fic in fi.ChildFolders)
{
DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node();
newnode.Text = fic.ToString();
newnode.Tag = fic;
//int tmp;
//if (topnode == null)
//{
// newnode.Text = "Available Procedure Sets";
// tmp = advTreeProcSets.Nodes.Add(newnode);
// topnode = newnode;
//}
//else
//{
// newnode.Selectable = true;
// newnode.CheckBoxAlignment = DevComponents.AdvTree.eCellPartAlignment.NearCenter;
// newnode.CheckBoxStyle = eCheckBoxStyle.CheckBox;
// newnode.CheckBoxThreeState = false;
// newnode.CheckBoxVisible = true;
// tmp = topnode.Nodes.Add(newnode);
//}
cntnd++;
if (fic.ChildFolderCount > 0 || fic.FolderDocVersionCount > 0) // allow for '+' for tree expansion
{
DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node();
tnt.Text = "VLN_DUMMY";
newnode.Nodes.Add(tnt);
topnode.Nodes.Add(newnode);
}
}
// if nothing was added to the tree, just put in the node above the docversions...
if (advTreeProcSets.Nodes.Count == 0)
{
cntnd++;
fi = Mydocversion.MyFolder;
topnode = new DevComponents.AdvTree.Node();
topnode.Text = fi.ToString();
advTreeProcSets.Nodes.Add(topnode);
topnode.Tag = fi;
}
advTreeProcSets.BeforeExpand += new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(advTreeProcSets_BeforeExpand);
// position to the procedure set in the tree if we have a procedure open
if (Mydocversion != null)
advTreeProcSetsPreSelect();
else
advTreeProcSets.Nodes[0].SelectedCell = advTreeProcSets.Nodes[0].Cells[0]; // select the first node - fixes cosmetic problem
//if (blSeachTabClicked)
// cbxTextSearchText.Focus(); // set initial focus to enter search text
}
void advTreeProcSets_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e)
{
DevComponents.AdvTree.Node par = e.Node;
// get first child's text, if it has one & if the text is VLN_DUMMY, load children
DevComponents.AdvTree.Node tn = null;
if (par.Nodes.Count > 0) tn = par.Nodes[0];
if (tn.Text == "VLN_DUMMY") // expand this
{
par.Nodes.Clear();
Object obj = par.Tag;
if (!(obj is FolderInfo)) return; // should always be folderinfo on expand
FolderInfo fi = (FolderInfo)obj;
if (fi.ChildFolderCount > 0)
{
foreach (FolderInfo fic in fi.ChildFolders)
{
DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node();
newnode.Text = fic.ToString();
newnode.Tag = fic;
par.Nodes.Add(newnode);
if (fic.HasChildren) // allow for '+' for tree expansion
{
DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node();
tnt.Text = "VLN_DUMMY";
newnode.Nodes.Add(tnt);
}
}
}
else if (fi.FolderDocVersionCount > 0)
{
foreach (DocVersionInfo dv in fi.FolderDocVersions)
{
DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node();
newnode.Text = dv.ToString();
newnode.Tag = dv;
newnode.Selectable = true;
newnode.CheckBoxAlignment = DevComponents.AdvTree.eCellPartAlignment.NearCenter;
newnode.CheckBoxStyle = eCheckBoxStyle.CheckBox;
newnode.CheckBoxThreeState = false;
newnode.CheckBoxVisible = true;
par.Nodes.Add(newnode);
}
}
}
}
private void advTreeProcSets_AfterCheck(object sender, DevComponents.AdvTree.AdvTreeCellEventArgs e)
{
DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode;
if (n.Checked)
{
n.Style = DevComponents.AdvTree.NodeStyles.Apple;
lstCheckedDocVersions.Add((DocVersionInfo)n.Tag);
if (lstCheckedDocVersions.Count == 1)//Mydocversion == null)
{
Mydocversion = (DocVersionInfo)n.Tag;
}
}
else
{
n.Style = null;
lstCheckedDocVersions.Remove((DocVersionInfo)n.Tag);
if (lstCheckedDocVersions.Count == 1)
{
if (Mydocversion != lstCheckedDocVersions[0])
{
Mydocversion = lstCheckedDocVersions[0];
}
}
else
{
if (lstCheckedDocVersions.Count == 0)
Mydocversion = null;
// do this if either none, or more than one procedure set selected
//advTreeStepTypes.Nodes.Clear();
//lstCheckedStepTypes.Clear();
//lstCheckedStepTypesStr.Clear();
//Node newnode = new DevComponents.AdvTree.Node();
//newnode.Text = "....select a procedure set for types to appear...";
//advTreeStepTypes.Nodes.Add(newnode);
//buildStepTypePannelTitle();
}
}
//// Enable the RO combo list only if at least one procedure set node
//// is selected
//cmboTreeROs.Enabled = (lstCheckedDocVersions.Count > 0);
//gpFindROs.Enabled = cmboTreeROs.Enabled;
//SetupContextMenu();
//buildSetToSearchPanelTitle();
EnableOrDisablePrintButton();
}
private void advTreeProcSets_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
{
DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode;
}
private void advTreeProcSetsPreSelect()
{
bool keeplooking = true;
//build a stack (bread crumb trail) of where is procedure set came from within the tree.
Stack<string> crumbs = new Stack<string>();
crumbs.Push(Mydocversion.Name); // ex: "working draft"
crumbs.Push(Mydocversion.MyFolder.Name); // ex: "Emergency Procedures"
FolderInfo fi = Mydocversion.MyFolder.MyParent;
while (fi != null)
{
if (fi.MyParent != null)
crumbs.Push(fi.Name);
fi = fi.MyParent;
}
crumbs.Push(advTreeProcSets.Nodes[0].Text); //top node of my tree
// now walk the tree, looking for the node names we saved in the stack.
NodeCollection monkeys = advTreeProcSets.Nodes;
while (keeplooking)
{
Node climber = LookInTree(monkeys, crumbs.Pop());
keeplooking = (climber != null && crumbs.Count > 0);
if (keeplooking)
monkeys = climber.Nodes;
if (!keeplooking && climber != null)
{
climber.Checked = true;
}
}
}
private Node LookInTree(NodeCollection monkeys, string bananna)
{
Node foundit = null;
foreach (Node chimp in monkeys)
{
if (chimp.Text.Equals(bananna))
{
foundit = chimp;
// need to select the node (cell) for it to be checked
chimp.SelectedCell = chimp.Cells[0];
if (chimp.Nodes.Count > 0)
chimp.Expand();
break;
}
chimp.Collapse();
}
return foundit;
}
#endregion
#region RO Tree
public void advTreeROFillIn(bool blSeachTabClicked)
{
DevComponents.AdvTree.Node topnode = null;
advTreeRO.Nodes.Clear();
if (_MyROFSTLookup == null) return;
advTreeRO.BeforeExpand +=new AdvTreeNodeCancelEventHandler(advTreeRO_BeforeExpand);
advTreeRO.AfterExpand += new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse);
advTreeRO.AfterCollapse += new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse);
topnode = new DevComponents.AdvTree.Node();
topnode.Text = "All Referenced Objects";
topnode.Tag = null;
topnode.CheckBoxVisible = true;
advTreeRO.Nodes.Add(topnode);
for (int i = 0; i < _MyROFSTLookup.myHdr.myDbs.Length; i++)
{
DevComponents.AdvTree.Node tn = new DevComponents.AdvTree.Node();
tn.Text = _MyROFSTLookup.myHdr.myDbs[i].dbiTitle;
tn.Tag = _MyROFSTLookup.myHdr.myDbs[i];
tn.CheckBoxVisible = true;
topnode.Nodes.Add(tn);
AddDummyGroup(_MyROFSTLookup.myHdr.myDbs[i], tn);
}
//foreach (FolderInfo fic in fi.ChildFolders)
//{
// DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node();
// newnode.Text = fic.ToString();
// newnode.Tag = fic;
// cntnd++;
// if (fic.ChildFolderCount > 0 || fic.FolderDocVersionCount > 0) // allow for '+' for tree expansion
// {
// DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node();
// tnt.Text = "VLN_DUMMY";
// newnode.Nodes.Add(tnt);
// topnode.Nodes.Add(newnode);
// }
//}
//// if nothing was added to the tree, just put in the node above the docversions...
//if (advTreeProcSets.Nodes.Count == 0)
//{
// cntnd++;
// fi = Mydocversion.MyFolder;
// topnode = new DevComponents.AdvTree.Node();
// topnode.Text = fi.ToString();
// advTreeProcSets.Nodes.Add(topnode);
// topnode.Tag = fi;
//}
//advTreeProcSets.BeforeExpand += new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(advTreeProcSets_BeforeExpand);
//// position to the procedure set in the tree if we have a procedure open
//if (Mydocversion != null)
// advTreeProcSetsPreSelect();
//else
// advTreeProcSets.Nodes[0].SelectedCell = advTreeProcSets.Nodes[0].Cells[0]; // select the first node - fixes cosmetic problem
//if (blSeachTabClicked)
// cbxTextSearchText.Focus(); // set initial focus to enter search text
}
private void AddDummyGroup(ROFSTLookup.rodbi rodbi, DevComponents.AdvTree.Node tn)
{
if (rodbi.children != null && rodbi.children.Length > 0)
{
DevComponents.AdvTree.Node tmp = new DevComponents.AdvTree.Node();
tmp.Text = "VLN_DUMMY_FOR_TREE";
tn.Nodes.Add(tmp);
}
}
private void advTreeRO_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e)
{
LoadChildren(e.Node);
}
private void LoadChildren(DevComponents.AdvTree.Node tn)
{
object tag = tn.Tag;
if (tn.HasChildNodes && tn.Nodes[0].Text != "VLN_DUMMY_FOR_TREE") return; // already loaded.
if (tn.HasChildNodes && tn.Nodes[0].Text == "VLN_DUMMY_FOR_TREE") tn.Nodes[0].Remove();
ROFSTLookup.rochild[] chld = null;
if (tn.Tag is ROFSTLookup.rodbi)
{
ROFSTLookup.rodbi db = (ROFSTLookup.rodbi)tn.Tag;
chld = db.children;
}
else if (tn.Tag is ROFSTLookup.rochild)
{
ROFSTLookup.rochild ch = (ROFSTLookup.rochild)tn.Tag;
chld = ch.children;
}
else
{
Console.WriteLine("error - no type");
return;
}
// if children, add dummy node
if (chld != null && chld.Length > 0)
{
//ProgressBar_Initialize(chld.Length, tn.Text);
for (int i = 0; i < chld.Length; i++)
{
//ProgressBar_SetValue(i);
DevComponents.AdvTree.Node tmp = null;
// if this is a group, i.e. type 0, add a dummy node
if (chld[i].type == 0 && chld[i].children == null)
//skip it.
// TODO: KBR how to handle this?
//Console.WriteLine("ro junk");
continue;
else if (chld[i].value == null && (cbxROUsage.Checked || chld[i].children[0].ParentID != 0))
{
tmp = new DevComponents.AdvTree.Node();
tmp.Text = chld[i].title;
tmp.Tag = chld[i];
tmp.CheckBoxVisible = true;
int index = FindIndex(tn.Nodes, tmp.Text);
tn.Nodes.Insert(index, tmp);
DevComponents.AdvTree.Node sub = new DevComponents.AdvTree.Node();
sub.Text = "VLN_DUMMY_FOR_TREE";
tmp.Nodes.Add(sub);
}
else
{
tmp = new DevComponents.AdvTree.Node();
tmp.Text = chld[i].title;
tmp.Tag = chld[i];
tmp.CheckBoxVisible = true;
int index = FindIndex(tn.Nodes, tmp.Text);
tn.Nodes.Insert(index, tmp);
}
}
}
//ProgressBar_Clear();
}
void advTreeRO_AfterExpandorCollapse(object sender, AdvTreeNodeEventArgs e)
{
Node bottomNode = BottomTreeNode(advTreeRO.Nodes);
Node lastNode = advTreeRO.Nodes[advTreeRO.Nodes.Count - 1];
int top = advTreeRO.Nodes[0].Bounds.Top;
int bottom = bottomNode.Bounds.Bottom + 5;
int hScrollBarHeight = advTreeRO.HScrollBar != null ? advTreeRO.HScrollBar.Height : 0;
bottom = bottomNode.Bounds.Bottom + 5;
advTreeRO.Size = new Size(advTreeRO.Size.Width, Math.Min(525, bottom - top + hScrollBarHeight));
if (advTreeRO.VScrollBar != null && bottom < advTreeRO.Size.Height)
{
int yLookFor = (bottom - advTreeRO.Size.Height) + 2 * hScrollBarHeight;
Node topNode = FindTreeNodeAt(advTreeRO.Nodes, yLookFor);
if (topNode != null)
topNode.EnsureVisible();
}
}
private Node FindTreeNodeAt(NodeCollection nodes, int y)
{
foreach (Node node in nodes)
{
if (node.Bounds.Top <= y && node.Bounds.Bottom >= y)
return node;
if (node.Bounds.Top > y)
{
if (node.PrevNode != null && node.PrevNode.Expanded)
return FindTreeNodeAt(node.PrevNode.Nodes, y);
return node;
}
}
return null;
}
private Node BottomTreeNode(NodeCollection nodes)
{
Node bottomNode = nodes[nodes.Count - 1]; // Return bottom node in collection
if (bottomNode.Expanded) // If expanded return bottom child
return BottomTreeNode(bottomNode.Nodes);
return bottomNode;
}
private int FindIndex(NodeCollection nodes, string value)
{
int index = 0;
foreach (Node node in nodes)
{
if (GreaterValue(node.Text, value)) return index;
index++;
}
return index;
}
//private static Regex _RegExGetNumber = new Regex(@"^ *[+-]?[.,0-9]+(E[+-]?[0-9]+)?");
private bool GreaterValue(string value1, string value2)
{
return DisplayRO.GreaterValue(value1, value2);
// Match match1 = _RegExGetNumber.Match(value1);
// Match match2 = _RegExGetNumber.Match(value2);
// if (match1.Success && match2.Success) // Compare the numeric value
// {
// double dbl1 = double.Parse(match1.ToString());
// double dbl2 = double.Parse(match2.ToString());
// return dbl1 > dbl2;
// }
// return String.Compare(value1, value2, true) > 0;
}
#endregion
private void DisplayReports_Load(object sender, EventArgs e)
{
tabTransitionReports.PerformClick();
}
// when a node is checked (selected) then uncheck any of its children
private void UncheckChildren(DevComponents.AdvTree.NodeCollection chldrn)
{
if (chldrn.Count > 0)
{
foreach (DevComponents.AdvTree.Node n in chldrn)
{
if (n.Checked)
n.Checked = false;
else
UncheckChildren(n.Nodes);
}
}
}
// when a node is checked (selected), uncheck the parents, grand parents, great grand parents, etc.
private void UncheckParents(DevComponents.AdvTree.Node pNode)
{
while (pNode != null)
{
if (pNode.Checked) pNode.Checked = false;
pNode = pNode.Parent;
}
}
private void advTreeRO_AfterCheck(object sender, AdvTreeCellEventArgs e)
{
DevComponents.AdvTree.Node n = advTreeRO.SelectedNode;
if (n.Checked)
{
UncheckChildren(n.Nodes);
UncheckParents(n.Parent);
}
EnableOrDisablePrintButton();
}
private void cbxTransToProcs_CheckedChanged(object sender, EventArgs e)
{
EnableOrDisablePrintButton();
}
private void cbxTransFromProcs_CheckedChanged(object sender, EventArgs e)
{
EnableOrDisablePrintButton();
}
private void cbxComplete_CheckedChanged(object sender, EventArgs e)
{
cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked;
EnableOrDisablePrintButton();
}
private void cbxSummary_CheckedChanged(object sender, EventArgs e)
{
EnableOrDisablePrintButton();
}
private string BuildRODataFile(string ROList)
{
DocVersionInfo MyDVI = Mydocversion;
string roDataFile = "PRINT.TMP";
if (VlnSettings.ReleaseMode.Equals("DEMO"))
{
MessageBox.Show("Referenced Object Reports not available in the Demo version.", "PROMS Demo Version");
return "";
}
//string roapp = Environment.GetEnvironmentVariable("roapp");
string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable
if (roapp == null)
{
MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable");
return "";
}
if (MyDVI == null || MyDVI.DocVersionAssociationCount < 1)
{
MessageBox.Show("Could not find associated path for ro data.","No RO Data", MessageBoxButtons.OK, MessageBoxIcon.Information);
return "";
}
//string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" " + "\"" + ROList + "\"";
if (!Directory.Exists(MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath))
{
MessageBox.Show(string.Format("RO Database directory does not exist: {0}", MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath));
return "";
}
string cmpRptExePath = roapp.Substring(0, roapp.LastIndexOf("\\")) + "\\CmpRpt.exe ";
roDataFile = MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\\" + roDataFile;
try
{
if (File.Exists(roDataFile)) File.Delete(roDataFile);
Application.DoEvents();
string fname = VlnSettings.TemporaryFolder + "\\ROCompleteRprt.txt";
FileInfo fi = new FileInfo(fname);
using (StreamWriter sw = fi.CreateText())
{
sw.Write(ROList);
sw.Close();
}
string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" \"/f=" + fname + "\"";
System.Diagnostics.Process p = System.Diagnostics.Process.Start(cmpRptExePath, roloc);
// need to wait, sometimes the Print.tmp file that is generated is not available
p.WaitForExit(); // without arguments, this will wait indefinately
Application.DoEvents();
}
catch (Exception ex)
{
while (ex.InnerException != null)
ex = ex.InnerException;
string tmpmsg = ex.Message;
MessageBox.Show(tmpmsg, "RO Report Error: " + ex.GetType().Name);
}
return roDataFile;
}
private void btnPrintReport_Click(object sender, EventArgs e)
{
Cursor curcur = Cursor;
Cursor = Cursors.WaitCursor;
if (cbxSummary.Checked) // RO Summary Report
{
GenerateROList();
OnPrintRequest(new DisplayReportsEventArgs("RO Summary Report", "RO Summary Report", MyROFSTLookup, ROList));
}
else if (cbxComplete.Checked) // Complete RO Report
{
GenerateROList();
string ROList = GetListOfROs(false);//don't include the RODbID in the RO list
string roDataFile = BuildRODataFile(ROList);
OnPrintRequest(new DisplayReportsEventArgs("Complete RO Report", "Complete RO Report", roDataFile, MyROFSTLookup, cbxComplete.Checked, this.Mydocversion.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, cbxIncldMissingROs.Checked));
}
else if (cbxROUsage.Checked)
{
bool usageSortedByProcedure = (cmbxROUsageSort.SelectedIndex == 1);
GenerateROList();
string SearchString = GetListOfROs(true);// Include the RODbID in the RO list
ItemInfoList SearchResults = ItemInfoList.GetListFromROReport(DocVersionList, "", SearchString, "");
if (!usageSortedByProcedure) // sort on ROs
{
Csla.SortedBindingList<ItemInfo> sortedResults = new Csla.SortedBindingList<ItemInfo>(SearchResults);
sortedResults.ApplySort("FoundROID", ListSortDirection.Ascending);
OnPrintRequest(new DisplayReportsEventArgs("Referenced Objects Usage By RO", "RO Usage", sortedResults, usageSortedByProcedure,cbxIncldMissingROs.Checked));
}
else
OnPrintRequest(new DisplayReportsEventArgs("Referenced Objects Usage By Procedure", "RO Usage", SearchResults, usageSortedByProcedure,cbxIncldMissingROs.Checked));
}
else if (cbxTransFromProcs.Checked)
{
}
else if (cbxTransToProcs.Checked)
{
}
Cursor = curcur;
}
}
public class DisplayReportsEventArgs
{
private string _ReportTitle;
public string ReportTitle
{
get { return _ReportTitle; }
set { _ReportTitle = value; }
}
private string _TypesSelected;
public string TypesSelected
{
get { return _TypesSelected; }
set { _TypesSelected = value; }
}
private ICollection<ItemInfo> _MyItemInfoList;
public ICollection<ItemInfo> MyItemInfoList
{
get { return _MyItemInfoList; }
set { _MyItemInfoList = value; }
}
private bool _SortUsageByProcedure;
public bool SortUsageByProcedure
{
get { return _SortUsageByProcedure; }
set { _SortUsageByProcedure = value; }
}
private string _RODataFile = "";
public string RODataFile
{
get { return _RODataFile; }
set { _RODataFile = value; }
}
private bool _CompleteROReport = true;
public bool CompleteROReport
{
get { return _CompleteROReport; }
set { _CompleteROReport = value; }
}
private ROFSTLookup _rofstLookup;
public ROFSTLookup RofstLookup
{
get { return _rofstLookup; }
set { _rofstLookup = value; }
}
private List<string> _ROListForReport;
public List<string> ROListForReport
{
get { return _ROListForReport; }
set { _ROListForReport = value; }
}
private bool _IncludeMissingROs = true;
public bool IncludeMissingROs
{
get { return _IncludeMissingROs; }
set { _IncludeMissingROs = value; }
}
private bool _ConvertCaretToDelta = true;
public bool ConvertCaretToDelta
{
get { return _ConvertCaretToDelta; }
set { _ConvertCaretToDelta = value; }
}
private bool _IncludeEmptyROFields = true;
public bool IncludeEmptyROFields
{
get { return _IncludeEmptyROFields; }
set { _IncludeEmptyROFields = value; }
}
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ICollection<ItemInfo> myItemInfoList, bool sortByProcedure, bool includeMissingROs)
{
// RO Usage Report
_ReportTitle = reportTitle;
_TypesSelected = typesSelected;
_MyItemInfoList = myItemInfoList;
_SortUsageByProcedure = sortByProcedure;
_IncludeMissingROs = includeMissingROs;
}
public DisplayReportsEventArgs(string reportTitle, string typesSelected, string roDataFile, ROFSTLookup rofstLookUp, bool completeROReport, bool convertCaretToDelta, bool includeEmptyROFields)
{
_ReportTitle = reportTitle;
_TypesSelected = typesSelected;
_RODataFile = roDataFile;
_CompleteROReport = completeROReport;
_ConvertCaretToDelta = convertCaretToDelta;
_rofstLookup = rofstLookUp;
_IncludeEmptyROFields = includeEmptyROFields;
}
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ROFSTLookup rofstLookUp, List<string> roListForReport)
{
// RO Summary Report
_ReportTitle = reportTitle;
_TypesSelected = typesSelected;
_rofstLookup = rofstLookUp;
_ROListForReport = roListForReport;
}
}
public delegate void DisplayReportsEvent(object sender, DisplayReportsEventArgs args);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,45 @@
namespace Volian.Controls.Library
{
partial class DisplaySecurity
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// DisplaySecurity
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "DisplaySecurity";
this.Size = new System.Drawing.Size(933, 646);
this.ResumeLayout(false);
}
#endregion
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace Volian.Controls.Library
{
public partial class DisplaySecurity : UserControl
{
public DisplaySecurity()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,341 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Drawing;
using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library
{
public partial class DisplayTabItem : DevComponents.DotNetBar.DockContainerItem
{
#region Private Fields
private DisplayTabControl _MyDisplayTabControl;
private ItemInfo _MyItemInfo;
private StepTabPanel _MyStepTabPanel;
private string _MyKey;
private DSOTabPanel _MyDSOTabPanel;
private DocumentInfo _MyDocumentInfo;
#endregion
#region Properties
/// <summary>
/// ItemInfo associated with this DisplayTabItem
/// </summary>
private int _OwnerID;
public int OwnerID
{
get { return _OwnerID; }
set { _OwnerID = value; }
}
public ItemInfo MyItemInfo
{
get { return _MyItemInfo; }
//set { _MyItemInfo = value; }
}
/// <summary>
/// get Key Either:
/// "Item - " + Procedure ItemID for step pages
/// "Doc - " + DocumentID for Word Documents
/// </summary>
public string MyKey
{
get { return _MyKey; }
}
/// <summary>
/// Related StepTabPanel for a Step page
/// </summary>
public StepTabPanel MyStepTabPanel
{
get { return _MyStepTabPanel; }
set { _MyStepTabPanel = value; }
}
/// <summary>
/// Related DSOTabPanle for a Word page
/// </summary>
public DSOTabPanel MyDSOTabPanel
{
get { return _MyDSOTabPanel; }
set { _MyDSOTabPanel = value; }
}
private string _MyUserRole;
public string MyUserRole
{
get { return _MyUserRole; }
set { _MyUserRole = value; }
}
/// <summary>
/// Current SelectedItemInfo for this page
/// </summary>
public ItemInfo SelectedItemInfo
{
get
{
if (_MyStepTabPanel == null) return null;
return _MyStepTabPanel.SelectedItemInfo;
}
set
{
Console.WriteLine("selectediteminfo");
_MyStepTabPanel.SelectedItemInfo = value;
}
}
/// <summary>
/// Current DocumentInfo for this page - only set if library document
/// </summary>
public DocumentInfo MyDocumentInfo
{
get { return _MyDocumentInfo; }
}
#endregion
#region Constructors
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, ItemInfo myItemInfo, string myKey)
{
_MyItemInfo = myItemInfo;
if(MyItemInfo.MyContent.MyEntry == null)
OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure);
else
OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyContent.MyEntry.DocID, CheckOutType.Document);
Console.WriteLine("DisplayTabItem");
_MyKey = myKey;
_MyDisplayTabControl = myDisplayTabControl;
container.Add(this);
InitializeComponent();
this.Click += new EventHandler(DisplayTabItem_Click);
if (myItemInfo.MyContent.MyEntry == null)
SetupStepTabPanel();
else
SetupDSOTabPanel();
SetupSecurity(myItemInfo);
Name = string.Format("DisplayTabItem {0}", myItemInfo.ItemID);
}
private bool MesssageShown = false;
public void SetupSecurity(ItemInfo myItem)
{
UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID);
if (ui == null)
{
if (!MesssageShown)
{
System.Windows.Forms.MessageBox.Show("Security has not been defined for PROMS. All functionality has been defaulted to the lowest level for all users until security is defined.", "no security defined", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
MesssageShown = true;
}
_MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
}
else if (ui.IsAdministrator())
{
if(_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupAdminMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Administrator";
}
else if (ui.IsSetAdministrator(myItem.MyDocVersion))
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupSetAdminMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Set Administrator";
}
else if (ui.IsROEditor(myItem.MyDocVersion))
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupROEditorMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - RO Editor";
}
else if (ui.IsWriter(myItem.MyDocVersion))
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupWriterMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Writer";
}
else if (ui.IsReviewer(myItem.MyDocVersion))
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer";
}
else
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer";
}
}
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, DocumentInfo myDocumentInfo, string myKey)
{
_MyKey = myKey;
_MyDisplayTabControl = myDisplayTabControl;
_MyDocumentInfo = myDocumentInfo;
container.Add(this);
InitializeComponent();
this.Click += new EventHandler(DisplayTabItem_Click);
SetupLibraryDocumentDSOTabPanel();
Name = string.Format("DisplayTabLibraryDocument {0}", myDocumentInfo.DocID);
}
protected override void OnDisplayedChanged()
{
//Console.WriteLine("=>=>=>=> OnDisplayedChanged");
if(_MyStepTabPanel != null)
_MyStepTabPanel.MyStepPanel.DisplayItemChanging = true;
base.OnDisplayedChanged();
if(_MyStepTabPanel != null)
_MyStepTabPanel.MyStepPanel.DisplayItemChanging = false;
//Console.WriteLine("<=<=<=<= OnDisplayedChanged");
}
//void DisplayTabItem_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
//{
// Console.WriteLine("DisplayTabItem_MouseUp");
//}
//void DisplayTabItem_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
//{
// Console.WriteLine("DisplayTabItem_MouseDown");
//}
//void DisplayTabItem_LostFocus(object sender, EventArgs e)
//{
// Console.WriteLine("DisplayTabItem_LostFocus");
//}
//void DisplayTabItem_GotFocus(object sender, EventArgs e)
//{
// Console.WriteLine("DisplayTabItem_GotFocus");
//}
#endregion
#region Event Handlers
/// <summary>
/// Updates SelectedRTBItem when the user selects a DisplayTabItem
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DisplayTabItem_Click(object sender, EventArgs e)
{
// Tell the TabControl that the ItemSelected has changed
DisplayTabItem myTabItem = sender as DisplayTabItem;
if(myTabItem == null)return;
StepTabPanel myTabPanel = myTabItem.MyStepTabPanel as StepTabPanel;
if(myTabPanel == null) return;
if (MyStepTabPanel.SelectedEditItem == null) return;
_MyDisplayTabControl.OnItemSelectedChanged(this,new ItemSelectedChangedEventArgs(MyStepTabPanel.SelectedEditItem));
}
#endregion
#region private Methods
/// <summary>
/// Creates and sets-up a StepTabPanel
/// </summary>
private void SetupStepTabPanel()
{
((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).BeginInit();
_MyDisplayTabControl.MyBar.SuspendLayout();
_MyStepTabPanel = new StepTabPanel(_MyDisplayTabControl);
//
// tabItem
//
Control = _MyStepTabPanel;
Name = "tabItem Item " + _MyItemInfo.ItemID;
Text = _MyItemInfo.TabTitle;
Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-");
MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove);
LostFocus += new EventHandler(DisplayTabItem_LostFocus);
//
_MyDisplayTabControl.Controls.Add(_MyStepTabPanel);
_MyDisplayTabControl.MyBar.Items.Add(this);
_MyDisplayTabControl.MyBar.Width = 300; // This triggers the bar to resize itself
//
// tabPanel
//
_MyStepTabPanel.MyDisplayTabItem = this;
((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).EndInit();
_MyDisplayTabControl.MyBar.ResumeLayout(false);
DocVersionInfo dvi = _MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; //MyRTBItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
if (dvi == null) return;
if (dvi.VersionType > 127)
MyStepTabPanel.MyStepPanel.VwMode = E_ViewMode.View;
//added by jcb 20130718 to support disabling create pdf button when multiunit until user selects a unit
if (dvi.MultiUnitCount > 1)
this.MyStepTabPanel.MyStepTabRibbon.btnPdfCreate.Enabled = false;
else
this.MyStepTabPanel.MyStepTabRibbon.btnPdfCreate.Enabled = true;
//end added by jcb 20130718
}
void DisplayTabItem_LostFocus(object sender, EventArgs e)
{
if(Tooltip != _Tooltip)
Tooltip = _Tooltip;
}
private string _Tooltip;
public void SetPrivateTooltip(string tt)
{
_Tooltip = tt;
}
void DisplayTabItem_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
string newTooltip = e.Y > 30 ? null : _Tooltip;
if(Tooltip != newTooltip)
Tooltip = newTooltip;
}
/// <summary>
/// Creates and sets-up a DSOTabPanel
/// </summary>
private void SetupDSOTabPanel()
{
EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry;
_MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl, _MyItemInfo);
//
// tabItem
//
Control = _MyDSOTabPanel;
Name = "tabItem Item " + _MyItemInfo.ItemID;
Text = _MyItemInfo.TabTitle;
Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-");
MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove);
LostFocus += new EventHandler(DisplayTabItem_LostFocus);
_MyDisplayTabControl.Controls.Add(_MyDSOTabPanel);
DSOTabPanel.IgnoreEnter = true;
//Console.WriteLine("AddRange {0}", Name);
_MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
this});
//
// tabPanel
//
_MyDisplayTabControl.SelectDisplayTabItem(this);
_MyDSOTabPanel.MyDisplayTabItem = this;
DSOTabPanel.IgnoreEnter = false;
}
private void SetupLibraryDocumentDSOTabPanel()
{
_MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl, _MyItemInfo);
//
// tabItem
//
Control = _MyDSOTabPanel;
Name = "tabLibraryDocument " + _MyDocumentInfo.DocID;
Text = _MyDocumentInfo.LibTitle;
DocumentConfig dc = new DocumentConfig(_MyDocumentInfo);
Tooltip = _Tooltip = dc.LibDoc_Comment;
MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove);
LostFocus += new EventHandler(DisplayTabItem_LostFocus);
_MyDisplayTabControl.Controls.Add(_MyDSOTabPanel);
DSOTabPanel.IgnoreEnter = true;
_MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
this});
//
// tabPanel
//
_MyDisplayTabControl.SelectDisplayTabItem(this);
_MyDSOTabPanel.MyDisplayTabItem = this;
DSOTabPanel.IgnoreEnter = false;
}
#endregion
public override string ToString()
{
if (MyDSOTabPanel != null)
return MyDSOTabPanel.ToString();
if (MyStepTabPanel != null)
return MyStepTabPanel.ToString();
return "NULL";
}
}
}

View File

@@ -0,0 +1,295 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library
{
public partial class DisplayTags : UserControl
{
#region Properties
private ItemInfo _CurItemInfo=null;
private bool _Initalizing = false;
private IList<int> _MyStepTypeInd = null; // use to keep track of step types put in step type menu
private StepRTB _NotVisibleRTB = null;
private StepRTB _MyRTB;
public StepRTB MyRTB
{
get { return _MyRTB; }
set
{
if (!Visible)
{
_NotVisibleRTB = value;
return;
}
_NotVisibleRTB = null;
if (value == null)
{
ClearControls();
return;
}
if (_CurItemInfo != null && _CurItemInfo.ItemID == value.MyItemInfo.ItemID) return;
if (!value.MyItemInfo.IsStep)
{
ClearControls();
return;
}
_MyRTB = value;
_CurItemInfo = MyRTB.MyItemInfo;
cbChgAll.Checked = !_CurItemInfo.IsHigh;
TagsFillIn();
}
}
#endregion
#region Constructor
public DisplayTags()
{
InitializeComponent();
_MyStepTypeInd = new List<int>();
}
#endregion
#region Initialize Controls
private void ClearControls()
{
cmbCheckoff.Enabled = false;
cbPageBreak.Enabled = false;
cbCAS.Enabled = false;
rbChgBarOff.Enabled = false;
rbChgBarOn.Enabled = false;
listBoxStepTypes.Items.Clear();
_MyStepTypeInd.Clear();
}
private bool StepOverRide()
{
ItemInfo myparent = _CurItemInfo.MyActiveParent as ItemInfo;
if (_CurItemInfo.IsRNO && myparent !=null && myparent.IsHigh)
{
// does the high level step of an RNO have a checkoff, if so it
// can be overridden?
StepConfig sc = myparent.MyConfig as StepConfig;
if (sc != null && sc.Step_CheckOffIndex != -1) return true;
}
return false;
}
public void HighlightChangeStep()
{
groupPanelChgStepType.Style.BackColor = Color.PaleVioletRed;
}
private void TagsFillIn()
{
_Initalizing = true;
// do some coloring (didn't work when setting properties)
// don't like: Goldenrod, Gold
groupPanelChgBar.Style.BackColor = Color.Cornsilk;
groupPanelChgStepType.Style.BackColor = Color.Cornsilk;
groupPanelMisc.Style.BackColor = Color.Cornsilk;
groupPanelCheckoff.Style.BackColor = Color.Cornsilk;
cbPageBreak.Enabled = true; // these may have been set to false if non-step item was selected.
cbCAS.Enabled = true;
rbChgBarOff.Enabled = true;
rbChgBarOn.Enabled = true;
FormatData fmtdata = _CurItemInfo.ActiveFormat.PlantFormat.FormatData;
StepConfig sc = _CurItemInfo.MyConfig as StepConfig;
// in certain cases, the checkbox control should be disabled, check for this stuff now...
int formatSteptype = _CurItemInfo.FormatStepType;
cmbCheckoff.Enabled = true;
if ((_CurItemInfo.IsCaution || _CurItemInfo.IsNote) & !fmtdata.SectData.StepSectionData.StepSectionLayoutData.TieTabToLevel)
cmbCheckoff.Enabled = false;
if (_CurItemInfo.IsRNO && sc != null && sc.Step_CheckOffIndex != -1 && !fmtdata.StepDataList[formatSteptype].CheckOffSameAsParent)
cmbCheckoff.Enabled = false; // Checkoffs already assigned to RNO.
if (StepOverRide()) cmbCheckoff.Enabled = false; // Checkoffs already assigned to AER
if (fmtdata.ProcData.CheckOffData.CheckOffList == null || fmtdata.ProcData.CheckOffData.CheckOffList.Count == 0)
cmbCheckoff.Enabled = false;
if (sc == null) // if there is no config data, Page Break and CAS check boxes are false
{
cbPageBreak.Checked = false;
cbCAS.Checked = false;
}
else // otherwise, get data from config
{
cbPageBreak.Checked = sc.Step_ManualPagebreak;
cbCAS.Checked = sc.Step_CAS;
}
if (!(fmtdata.ProcData.CheckOffData.CheckOffList == null) && !(fmtdata.ProcData.CheckOffData.CheckOffList.Count == 0))
{
foreach (CheckOff co in fmtdata.ProcData.CheckOffData.CheckOffList)
{
cmbCheckoff.Items.Add(co.RightCheckOffPrompt);
}
if (sc.Step_CheckOffIndex != -1) cmbCheckoff.SelectedIndex = sc.Step_CheckOffIndex;
}
// change bar setting depends on whether step has changed (dts) as compared to date/time off the
// procedure that it's in.
// There is also an override flag in the config for the step, used to override the change bar to 'off'
// if the date show it as having one, or allow a change bar to be 'on' if there the dates are
// not different. Note also that a user may edit data after the change bar is set to 'on'.
DateTime curDts;
using (Item itm = Item.Get(_CurItemInfo.ItemID))
{
curDts = itm.DTS;
}
// set change bar radio buttons for the default that there is no change
// bar & override sets it to On.
rbChgBarOff.Checked = true;
rbChgBarOn.Text = "ON (Override)";
rbChgBarOff.Text = "OFF";
// if there is no override & a change occurred to the text, there is a
// change bar & override sets it to Off.
if (sc.Step_CBOverride == null)
{
if (curDts > _CurItemInfo.MyProcedure.DTS)
{
rbChgBarOn.Checked = true;
rbChgBarOff.Text = "OFF (Override)";
rbChgBarOn.Text = "ON";
}
}
else
{
// there is override settings in the config... If the date time stamp says that text was changed
// so a change bar should exist - check override to see how change bar controls are set:
// if Override is 'Off' then
if (curDts > _CurItemInfo.MyProcedure.DTS)
{
rbChgBarOff.Checked = (sc.Step_CBOverride == "Off") ? true : false;
rbChgBarOn.Checked = (sc.Step_CBOverride == "On") ? true : false;
rbChgBarOff.Text = "OFF (Override)";
rbChgBarOn.Text = "ON";
}
else // if (curDts <= _CurItemInfo.MyProcedure.DTS && sc.Step_CBOverride == "On")
{
// date time stamp says no change bar should be displayed:
rbChgBarOff.Checked = (sc.Step_CBOverride == "On") ? true : false;
rbChgBarOn.Checked = (sc.Step_CBOverride == "Off") ? true : false;
rbChgBarOff.Text = "OFF";
rbChgBarOn.Text = "ON (Override)";
}
}
// Walk up tree until this step type's parentType is "Base". Start adding menuitems from this step type.
StepData top = fmtdata.StepDataList[formatSteptype];
//int tmpi = formatSteptype;
// RNO is a special case in that it has a parent type of high, for formatting, but does not walk
// up tree to define types that it can be changed into....
if (!_CurItemInfo.IsRNO) top = fmtdata.StepTopUnderBase(top, formatSteptype);
listBoxStepTypes.Items.Clear();
listBoxStepTypes.SelectedIndex = DoListStepTypes(fmtdata, top, fmtdata.StepDataList[formatSteptype].Type);
lblNoTypeChgReason.Visible = !(listBoxStepTypes.Items.Count>0);
cbChgAll.Enabled = (listBoxStepTypes.Items.Count > 0);
listBoxStepTypes.Visible = (listBoxStepTypes.Items.Count>0);
_Initalizing = false;
}
private int DoListStepTypes(FormatData fmtdata, StepData topType, string curType)
{
int cursel=-1;
List<StepDataRetval> sdl = fmtdata.StepGetLevelTypes(false, topType, ref cursel, curType, _CurItemInfo);
if (sdl==null || sdl.Count==0)
{
if (listBoxStepTypes.Items.Count==0)lblNoTypeChgReason.Text = topType.StepEditData.TypeMenu.NoChgReason;
}
else
{
_MyStepTypeInd.Clear();
foreach (StepDataRetval sdr in sdl)
{
listBoxStepTypes.Items.Add(sdr.Name);
_MyStepTypeInd.Add(sdr.Index);
}
}
return cursel;
}
//private void AddToGallery(StepData sd, string curType)
//{
// DevComponents.DotNetBar.ButtonItem bi = new DevComponents.DotNetBar.ButtonItem("btn" + sd.Type, sd.Type);
// bi.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
// bi.Image = this.imageListStepTypes.Images[0];
// bi.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;
// bi.Checked = (sd.Type == curType);
// galleryContainerStepTypes.SubItems.Add(bi);
// listBoxStepTypes.Items.Add(sd.Type);
//}
#endregion
#region Events
private void cbPageBreak_CheckedChanged(object sender, EventArgs e)
{
if (_Initalizing) return;
StepConfig sc = _CurItemInfo.MyConfig as StepConfig;
if (sc == null) return;
sc.Step_ManualPagebreak = cbPageBreak.Checked;
}
private void cbCAS_CheckedChanged(object sender, EventArgs e)
{
if (_Initalizing) return;
StepConfig sc = _CurItemInfo.MyConfig as StepConfig;
if (sc == null) return;
sc.Step_CAS = cbCAS.Checked;
}
private void listBoxStepTypes_SelectedIndexChanged(object sender, EventArgs e)
{
if (_Initalizing) return;
FormatData fmtdata = _CurItemInfo.ActiveFormat.PlantFormat.FormatData;
if (cbChgAll.Checked)
{
ItemInfo startitm = _CurItemInfo.FirstSibling;
while (startitm != null)
{
Content cnt = Content.Get(startitm.MyContent.ContentID);
cnt.Type = 20000 + fmtdata.StepDataList[_MyStepTypeInd[listBoxStepTypes.SelectedIndex]].Index;
cnt.Save();
startitm = startitm.NextItem; // (startitm.NextItemCount > 0 ? startitm.NextItems[0] : null);
}
}
else
{
Content cnt = Content.Get(_CurItemInfo.MyContent.ContentID);
cnt.Type = 20000 + fmtdata.StepDataList[_MyStepTypeInd[listBoxStepTypes.SelectedIndex]].Index;
cnt.Save();
}
_MyRTB.MyStepItem.SetAllTabs();
}
private void groupPanelCheckoff_VisibleChanged(object sender, EventArgs e)
{
if (Visible==true && _NotVisibleRTB != null) MyRTB = _NotVisibleRTB;
}
private void rbChgBarOvrRideOn_CheckedChanged(object sender, EventArgs e)
{
if (_Initalizing) return;
// if checked, set the config data to 'On'. Otherwise, the 'check' event
// handler for the other control sets the data appropriately.
if (rbChgBarOn.Checked)
{
StepConfig sc = _CurItemInfo.MyConfig as StepConfig;
sc.Step_CBOverride = "On";
}
}
private void rbChgBarOvrRideOff_CheckedChanged(object sender, EventArgs e)
{
if (_Initalizing) return;
// if checked, set the config data to 'On'. Otherwise, the 'check' event
// handler for the other control sets the data appropriately.
if (rbChgBarOff.Checked)
{
StepConfig sc = _CurItemInfo.MyConfig as StepConfig;
sc.Step_CBOverride = "Off";
}
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library
{
public abstract partial class EditItem
{
public abstract void SetToolTip(string tip); // { ;}
public abstract void RefreshContent(); // { ; }
public abstract EditItem MyParentEditItem { get; set ; }
public abstract EditItem MyPreviousEditItem { get; set; }//{ get { return null; } set { ;} }
public abstract int ItemLeft { get; set; }//{ get { return 0; } set { ;} }
public abstract int TextLeft { get; }//{ get { return 0; } set { ;} }
public abstract int TextWidth { get; set ; }//{ get { return 0; } set { ;} }
public abstract Point ItemLocation { get; set ; }//{ get { return new Point(0, 0); } set { ;} }
public abstract int ItemWidth { get; set ; }//{ get { return 0; } set { ;} }
public abstract void RefreshOrdinal(); // { ;}
public abstract bool Expanded { get; set ; }//{ get { return false; } set { ;} }
public abstract void RefreshTab(); // { ;}
public abstract void SetFocus(); // { ;}
public abstract void SaveContents(); // { ;}
public abstract bool CanExpand { get; set ; }//{ get { return false; } set { ;} }
public abstract void HandleResize(); // { ;}
public abstract void MatchExpanded(); // { ;}
public abstract void ItemSelect(); // { ;}
public abstract void ItemShow(); // { ;}
public abstract StepRTB MyStepRTB { get; }
public abstract DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg);
public abstract bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse);
public abstract void PositionToEnd();
public abstract string SelecteTextForFind { get;}
public abstract bool SpellCheckNext();
public abstract void IdentifyMe(bool highlight);
public abstract void SetActive();
public abstract bool IsEmpty();
public abstract void MakeNotEmpty();
public abstract void RefreshDisplay(bool editMode);
public abstract void ToggleEditView(E_ViewMode vwMode);
}
}

View File

@@ -0,0 +1,306 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Volian.Controls.Library
{
public class OutlineRTFTable
{
public OutlineRTFTable(string rtf, bool withBorder)
{
Rtf = rtf;
WithBorder = withBorder;
}
private string _Rtf;
public string Rtf
{
get { return _Rtf; }
set { _Rtf = value; }
}
private bool _WithBorder;
public bool WithBorder
{
get { return _WithBorder; }
set { _WithBorder = value; }
}
private RtfLines _Lines;
public RtfLines Lines
{
get
{
if (_Lines == null)
_Lines = new RtfLines(Rtf);
return _Lines;
}
}
public void OutlineTable()
{
int maxWidth = Lines.MaximumWidth;// Determine maximum width
// spaces here if not an outlined table:
Lines.Pad(maxWidth, WithBorder ? @"\u9474?" : " "); // Pad the lines to the appropriate width
Lines.Insert(0, new RtfLine(maxWidth, WithBorder ? @"\u9484?" : " ", WithBorder ? @"\u9472?" : " ", WithBorder ? @"\u9488?" : " ")); // Insert top line
Lines.Add(new RtfLine(maxWidth, WithBorder ? @"\u9492?" : " ", WithBorder ? @"\u9472?" : " ", WithBorder ? @"\u9496?" : " ")); // Insert bottom line
Lines.ReplaceLines(WithBorder);
}
public override string ToString()
{
return Lines.ToString();
}
}
public class RtfLines : List<RtfLine>
{
public static Regex _RegReplaceLine = new Regex(@"\\line((\\[^ \[\]\\\(\)]*) )");
public RtfLines(string text)
{
// replace RTF \line with crlf
string txt = _RegReplaceLine.Replace(text, "$1\r\n");
// split text into lines
string[] breaks = { "\r\n" };
string[] lines = txt.Split(breaks, StringSplitOptions.None);
//string lastLine = lines[lines.Length - 1];
foreach (string line in lines)
Add(new RtfLine(line.Replace("\\bullet","*")));
}
public int MaximumWidth
{
get
{
int retval = 0;
foreach (RtfLine myLine in this)
if (myLine.MaximumWidth > retval) retval = myLine.MaximumWidth;
return retval;
}
}
public void Pad(int maxWidth, string edge)
{
foreach (RtfLine myLine in this)
myLine.Pad(maxWidth, edge);
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
string sep = "";
foreach (RtfLine myLine in this)
{
sb.Append(sep + myLine.ToString());
sep = "\r\n";
}
return sb.ToString();
}
private static Regex _RegRightCheck = new Regex(@"-|\\u9472?|\\u8209\?");
private static Regex _RegAboveCheck = new Regex(@"\||\\u9474\?|\\u9492\?|\\u9516\?|\\u9532\?|\\u9500\?|\\u9484\?|\\u9524\?|\\u9488\?|\\u9508\?");
private static Regex _RegLeftCheck = new Regex(@"-|\\u9472\?|\\u9508\?|\\u9516\?|\\u9500\?|\\u9532\?|\\u9484\?|\\u9488\?|\\u9492\?|\\u8209\?");
private static Regex _RegBelowCheck = new Regex(@"\||\\u9474\?");
private static Regex _RegRightCheck1 = new Regex(@"\\u9474\?");
private static Regex _RegAboveCheck1 = new Regex(@"\\u9472\?|\\u8209\?");
private static Regex _RegLeftCheck1 = new Regex(@"\\u9474\?");
private static Regex _RegBelowCheck1 = new Regex(@"\\u9472\?|\\u8209\?");
private static Regex _RegHorizontalCheck = new Regex(@"-|\\u9472\?|\\u8209\?");
private static Regex _RegVerticalCheck = new Regex(@"\||\\u9474\?");
static private string[] TableCharsU = {
"\x0", // HEX"\x0", // No character
@"\u9472?", // HEX@"\u2500",// - Horizontal line - 16-bit char: '\xC4'
@"\u9474?", // HEX@"\u2502",// | Vertical line - 16-bit char: '\xB3'
@"\u9492?", // HEX@"\u2514",// L Bottom Left corner - 16-bit char: '\xC0'
@"\u9472?", // HEX@"\u2500",// - Horizontal line - 16-bit char: '\xC4'
@"\u9472?", // HEX@"\u2500",// - Horizontal line - 16-bit char: '\xC4'
@"\u9496?", // HEX@"\u2518",// Bottom Right Corner - 16-bit char: '\xD9'
@"\u9524?", // HEX@"\u2534",// Bottom Tee - 16-bit char: '\xC1'
@"\u9474?", // HEX@"\u2502",// | Vertical Bar - 16-bit char: '\xB3'
@"\u9484?", // HEX@"\u250c",// Upper Left corner - 16-bit char: '\xDA'
@"\u9474?", // HEX@"\u2502",// | Vertical Bar - 16-bit char: '\xB3'
@"\u9500?", // HEX@"\u251c",// Left Tee - 16-bit char: '\xC3'
@"\u9488?", // HEX@"\u2510",// Upper Right corner - 16-bit char: '\xBF'
@"\u9516?", // HEX@"\u252c",// T Top Tee - 16-bit char: '\xC2'
@"\u9508?", // HEX@"\u2524",// Right Tee - 16-bit char: '\xB4'
@"\u9532?", // HEX@"\u253c" // + Plus - 16-bit char: '\xC5'
};
internal void ReplaceLines(bool withBorder)
{
int maxWidth = this[0].Count;
for (int row = 1; row < Count - 1; row++)
{
RtfLine lineAbove = this[row - 1];
RtfLine line = this[row];
RtfLine lineBelow = this[row + 1];
for (int col = 1; col < maxWidth - 1; col++)
{
RtfPiece curPiece = line[col];
string current = curPiece.Text;
bool horizontal = _RegHorizontalCheck.IsMatch(current); // Horizontal
bool vertical = _RegVerticalCheck.IsMatch(current); // Vertical
if (horizontal || vertical)
{
int index = _RegRightCheck.IsMatch(line[col + 1].Text) ||
(horizontal && _RegRightCheck1.IsMatch(line[col + 1].Text)) ? 1 : 0; // Right
index += _RegAboveCheck.IsMatch(lineAbove[col].Text) ||
(vertical && _RegAboveCheck1.IsMatch(lineAbove[col].Text)) ? 2 : 0; // Above
index += _RegLeftCheck.IsMatch(line[col - 1].Text) ||
(horizontal && _RegLeftCheck1.IsMatch(line[col - 1].Text)) ? 4 : 0; // Left
index += _RegBelowCheck.IsMatch(lineBelow[col].Text) ||
(vertical && _RegBelowCheck1.IsMatch(lineBelow[col].Text)) ? 8 : 0; // Below
if (index > 0)
{
curPiece.Text = TableCharsU[index];
// this connects the lines to the border, so only do it if there is a border
if (withBorder)
{
if (vertical && row == 1) lineAbove[col].Text = TableCharsU[13]; // Upper Tee
if (vertical && row == Count - 2) lineBelow[col].Text = TableCharsU[7]; // Lower Tee
if (horizontal && col == 1) line[col - 1].Text = TableCharsU[11];// Left Tee
if (horizontal && col == maxWidth - 2) line[col + 1].Text = TableCharsU[14];// Right Tee
}
}
}
}
}
}
private void ListItems(string loc, string str)
{
StringBuilder sb = new StringBuilder(string.Format("{0} = @\"", loc));
string sep = "";
foreach (char c in str)
{
if (c < 127)
sb.Append(sep + c.ToString());
else
sb.Append(sep + string.Format("\\u{0}?", (int)c));
sep = "|";
}
Console.WriteLine(sb.ToString());
}
}
public class RtfLine : List<RtfPiece>
{
private static Regex _RegRtfText = new Regex(@"((\\[^'u ]*|\\up[0-9]|\\ul|\\ulnone)+( |$|(?=\\['u])))?(<START\]|#Link.*?\[END>|\\'[0-9a-fA-F]{2}|\\u[0-9]*\?|[^\\]{1}|$|)");
public RtfLine(string text)
{
MatchCollection matches = _RegRtfText.Matches(text);
int nextIndex = 0;
foreach (Match match in matches)
{
if (nextIndex != match.Index) // This should never happen
{
throw new Exception(string.Format("\"RtfPiece Missing Content\",{0},{1},\"{2}\",\"{3}\",\"{4}\"", nextIndex, match.Index, text.Substring(nextIndex, match.Index - nextIndex), match.Groups[2].Value, match.Groups[4].Value));
//Console.WriteLine("\"RtfPiece Missing Content\",{0},{1},\"{2}\",\"{3}\",\"{4}\"", nextIndex, match.Index, text.Substring(nextIndex, match.Index - nextIndex), match.Groups[2].Value, match.Groups[4].Value);
//Console.WriteLine(text.Substring(nextIndex));
}
nextIndex = match.Index + match.Length;
string rtfPart = match.Groups[1].ToString();
if (match.Groups[1].ToString().TrimEnd(" ".ToCharArray()).Length + match.Groups[4].ToString().Length > 0)
this.Add(new RtfPiece(match.Groups[1].ToString().TrimEnd(" ".ToCharArray()), match.Groups[4].ToString()));
//if (match.Groups[1].ToString().Length + match.Groups[4].ToString().Length > 0)
// this.Add(new RtfPiece(match.Groups[1].ToString(), match.Groups[4].ToString()));
}
}
public RtfLine(int width, string left, string fill, string right)
{
Add(new RtfPiece("", left));
for (int i = 0; i < width; i++) this.Add(new RtfPiece("", fill)); // Pad
Add(new RtfPiece("", right));
}
public int MaximumWidth
{
get
{
int retval = 0;
foreach (RtfPiece myPiece in this)
retval += myPiece.MaximumWidth;
return retval;
}
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
foreach (RtfPiece myPiece in this)
sb.Append(myPiece.ToString());
return sb.ToString();
}
internal void Pad(int maxWidth, string edge)
{
int pad = maxWidth - MaximumWidth;
this.Insert(0, new RtfPiece("", edge)); // Left Edge
for (int i = 0; i < pad; i++) this.Add(new RtfPiece("", " ")); // Pad
this.Add(new RtfPiece("", edge)); // Right Edge
}
public new RtfPiece this[int index]
{
get
{
int j = 0;
foreach (RtfPiece myPiece in this)
{
if (myPiece.Text != "")
{
if (j == index) return myPiece;
j++;
}
}
return null;
}
}
}
public class RtfPiece
{
private string _Rtf;
public string Rtf
{
get { return _Rtf; }
set { _Rtf = value; }
}
private string _Text = "";
public string Text
{
get { return _Text; }
set { _Text = value; }
}
public int TextLength
{
get { return Text.Length; }
}
public int MaximumWidth
{
get { return Text == "" ? 0 : 1; }
}
private static Regex _RegStartLink = new Regex(@"<START\]");
private static Regex _RegEndLink = new Regex(@"#Link.*?\[END>");
public RtfPiece(string rtf, string text)
{
_Rtf = rtf;
if (_RegStartLink.IsMatch(text) || _RegEndLink.IsMatch(text))
_Rtf += (rtf == "" ? "" : " ") + text;
else
{
_Rtf += rtf == "" ? "" : " ";
_Text = text;
}
}
public override string ToString()
{
return _Rtf + _Text;
//string retval = _RegUnicode.Replace(_Text, new MatchEvaluator(RtfUnicodeCharacter));
//retval = _RegHex.Replace(retval, new MatchEvaluator(RtfHexCharacter));
//return retval;
}
//private static Regex _RegUnicode = new Regex(@"\\u([0-9ABCDEF]*)\?");
//internal static string RtfUnicodeCharacter(Match myMatch)
//{
// string hexStr = myMatch.Groups[1].ToString();
// int i = int.Parse(hexStr);
// Char schar = Convert.ToChar(i);
// return schar.ToString();
//}
//private static Regex _RegHex = new Regex(@"\\'([0-9A-Fa-f]{2})");
//internal static string RtfHexCharacter(Match myMatch)
//{
// string hexStr = myMatch.Groups[1].ToString();
// int i = int.Parse(hexStr, System.Globalization.NumberStyles.HexNumber);
// Char schar = Convert.ToChar(i);
// return schar.ToString();
//}
}
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="StepConfig" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>VEPROMS.CSLA.Library.StepConfig, VEPROMS.CSLA.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,908 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library
{
#region Enums
public enum ExpandingStatus : int
{
No = 0,
Expanding = 1,
Colapsing = 2,
Hiding = 4,
Showing = 8,
Done = 16
}
#endregion
public partial class RTBItem : EditItem
{
#region Private Fields
public Label MyLabel
{ get { return lblTab; } }
/// <summary>
/// Used to connect the RichTextBox with the menus and toolbars
/// </summary>
public override StepRTB MyStepRTB
{
get { return _MyStepRTB; }
}
public override int TableWidth { get { return (int)GetTableWidth(_MyStepRTB.Font, MyItemInfo.MyContent.Text, true); } }
/// <summary>
/// The left edge of the Tab
/// </summary>
public override int ItemLeft
{
get { return Left + lblTab.Left; }
set { Left = value - lblTab.Left; }
}
/// <summary>
/// The Location of the Tab
/// </summary>
public override Point ItemLocation
{
get { return new Point(Location.X + lblTab.Left, Location.Y); }
set { Location = new Point(value.X - lblTab.Left, value.Y); }
}
/// <summary>
/// Width of the Tab and RTB
/// </summary>
public override int ItemWidth
{
get { return Width - lblTab.Left; }
set
{
Width = CheckOffMargin + RTBMargin + value + lblTab.Left;
}
}
/// <summary>
/// Width of the RichTextBox
/// </summary>
public override int ContentWidth
{
get { return _MyStepRTB.Width; }
set
{
// This is wrong for single column (KBR) - RHM Debug:
//MyStepRTB.Width = value;
Width = value + lblTab.Left + lblTab.Width + (this.Width - MyStepRTB.Right);
}
}
public override int BorderWidth { get { return (_MyStepRTB.Width - _MyStepRTB.ClientRectangle.Width); } }
/// <summary>
/// Location of the RichTextBox
/// </summary>
public override Point ContentLocation
{
get { return new Point(Location.X + _MyStepRTB.Left, Location.Y); }
set { Location = new Point(value.X - _MyStepRTB.Left, value.Y); }
}
/// <summary>
/// Left edge of the RichTextBox
/// </summary>
public override int ContentLeft
{
get { return Left + _MyStepRTB.Left; }
}
/// <summary>
/// Returns the status of the vlnExpander unless it is in the process of expanding or collapsing
/// If it is colapsing it returns false
/// If it is expanding it returns true
/// </summary>
public override bool Expanded
{
get
{
return !Colapsing && (MyExpandingStatus != ExpandingStatus.No || _MyvlnExpander.Expanded);
}
set
{
_MyvlnExpander.Expanded = value;
}
}
#endregion
#region IEditItem
override public void AdjustTableWidthAndLocation()
{
_MyStepRTB.Font = MyStepData.Font.WindowsFont;
ItemWidth = (int)GetTableWidth(_MyStepRTB.Font, MyItemInfo.MyContent.Text, true);
ItemLocation = new Point(50, _MyParentEditItem.Bottom);
ItemLocation = TableLocation(_MyParentEditItem, MyStepSectionLayoutData, ItemWidth);
}
override public void SetToolTip(string tip)
{
DevComponents.DotNetBar.SuperTooltipInfo tpi = new DevComponents.DotNetBar.SuperTooltipInfo("", "", tip, null, null, DevComponents.DotNetBar.eTooltipColor.Lemon);
_MyToolTip.MinimumTooltipSize = new Size(0, 24);
_MyToolTip.TooltipDuration = 3;
_MyToolTip.SetSuperTooltip(MyStepRTB, tpi);
}
public override void RefreshContent()
{
MyStepRTB.RefreshDisplay();
IdentifyMe(false);
SetExpandAndExpander(MyItemInfo);
}
public override void RefreshOrdinal()
{
TabFormat = null; // Reset Tab
}
/// <summary>
/// Tab Format used for outputing the Tab
/// </summary>
public override string TabFormat
{
get
{
if (_TabFormat == null) TabFormat = null; // execute 'set' code.
return _TabFormat;
}
set
{
if (MyItemInfo != null)
{
ItemInfo.ResetTabString(MyID);
string tabString = MyItemInfo.IsSection ? MyItemInfo.DisplayNumber.PadRight(MyItemInfo.MyTab.CleanText.Length) : MyItemInfo.MyTab.CleanText;
//string tabString = /*MyItemInfo.IsSection ? MyItemInfo.DisplayNumber : */ MyItemInfo.MyTab.CleanText;
lblTab.Text = tabString;
// calculate the width based upon characters per inch considering user's DPI
int cpi = MyItemInfo.IsStep ? (int)MyItemInfo.FormatStepData.TabData.Font.CPI : 12;
// if the tab ends with a single digit & has a '.' before it, add space for the possibility
// that the number can be two digits, for example... 8.1.9 goes to 8.1.10. We want
// the step windows to line up, so the 8.1.9 has one character more space (lastDigitSingle)
bool lastDigitSingle = Regex.IsMatch(tabString, "^.*[^0-9][0-9] *$");
lblTab.Width = ((lastDigitSingle ? 1 : 0) + tabString.Length) * MyStepPanel.DPI / cpi;
Invalidate();
if (MyItemInfo.MyTab.Offset == 0)
{
// In the following if statement, the last part, 'IsHigh & PageBreakOnStep' (PageBreakOnStep
// flags background steps and IsHigh is for the HLS - Cautions/Notes were ok), was added
// for hls in background documents - without this, the tab gets overwritten by the rtb.
if (MyItemInfo.FormatStepData == null || MyItemInfo.FormatStepData.TabData.IdentEdit.Contains("{Section Prefix}") || !MyItemInfo.IsHigh ||
(MyItemInfo.IsHigh && MyItemInfo.FormatStepData.PageBreakOnStep))
_MyStepRTB.Left = lblTab.Left + lblTab.Width;
_MyStepRTB.Width = Width - _MyStepRTB.Left - RTBMargin - CheckOffMargin;
}
_TabFormat = value;
}
}
}
#endregion
#region Properties
private static int _RTBMargin = 3;
/// <summary>
/// Margin between the EditItem and the StepRTB. Appears on the Right.
/// Will allow space to draw a Change Bar on the right side of the EditItem.
/// </summary>
public static int RTBMargin
{
get { return _RTBMargin; }
set { _RTBMargin = value; }
}
private int? _CheckOffMargin = null;
/// <summary>
/// Margin between the EditItem and the StepRTB. Appears on the Right.
/// Will allow space to draw a CheckOff on the right side of the EditItem.
/// </summary>
public int CheckOffMargin
{
get
{
if (_CheckOffMargin == null)
{
if (MyItemInfo == null) _CheckOffMargin = 0;
else
{
if (!MyItemInfo.IsStep || !MyItemInfo.SectionHasCheckOffs()) _CheckOffMargin = 0;
else
{
Graphics g = CreateGraphics();
SizeF sz = g.MeasureString("M", MyItemInfo.FormatStepData.Font.WindowsFont);
_CheckOffMargin = (int)sz.Width;
}
}
}
return (int)_CheckOffMargin;
}
set { _CheckOffMargin = value; }
}
#endregion
#region Constructors
public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand)
{
//// TIMING: DisplayItem.TimeIt("CSLARTB Top");
InitializeComponent();// TODO: Performance 25%
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, false);
MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged);
}
public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem)
{
//// TIMING: DisplayItem.TimeIt("CSLARTB Top");
InitializeComponent();// TODO: Performance 25%
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false);
MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged);
}
public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, bool addFirstChld)
{
//// TIMING: DisplayItem.TimeIt("CSLARTB Top");
InitializeComponent();// TODO: Performance 25%
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, addFirstChld);
MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged);
}
//private void SetupRTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem)
//{
// //if (itemInfo.ItemID == 225) _MyStepRTB.Resize += new EventHandler(_MyStepRTB_Resize);
// //_MyStepRTB.MyRTBItem = this;
// //// TIMING: DisplayItem.TimeIt("CSLARTB InitComp");
// BackColor = myStepPanel.PanelColor;
// //_MyStepRTB.BackColor = myStepPanel.InactiveColor;
// // TODO: Adjust top based upon format
// // TODO: Remove Label and just output ident on the paint event
// lblTab.Left = 20;
// SetupHeader(itemInfo);
// this.Paint += new PaintEventHandler(RTBItem_Paint);
// this.BackColorChanged += new EventHandler(RTBItem_BackColorChanged);
// if (itemInfo != null)
// {
// ContentType = (int)itemInfo.MyContent.Type;
// switch (ContentType / 10000)
// {
// case 0: // Procedure
// _MyStepRTB.Font = myStepPanel.ProcFont;// lblTab.Font = myStepPanel.ProcFont;
// lblTab.Font = itemInfo.MyTab.MyFont.WindowsFont;
// break;
// case 1: // Section
// _MyStepRTB.Font = myStepPanel.SectFont;// lblTab.Font = myStepPanel.SectFont;
// lblTab.Font = itemInfo.MyTab.MyFont.WindowsFont;
// break;
// case 2: // Steps
// _MyStepRTB.Font = myStepPanel.StepFont;//lblTab.Font = myStepPanel.StepFont;
// lblTab.Font = itemInfo.MyTab.MyFont.WindowsFont;
// MyStepData = itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[ContentType % 10000];
// break;
// }
// //this.Move += new EventHandler(DisplayItem_Move);
// }
// else
// {
// if (myStepPanel.MyFont != null) _MyStepRTB.Font = lblTab.Font = myStepPanel.MyFont;
// }
// if (expand) _MyvlnExpander.ShowExpanded();
// MyStepPanel = myStepPanel;
// if (itemInfo != null) myStepPanel._LookupEditItems.Add(itemInfo.ItemID, this);
// _MyChildRelation = myChildRelation;
// if (myParentEditItem != null) RNOLevel = myParentEditItem.RNOLevel;
// if (itemInfo != null)
// {
// //// TIMING: DisplayItem.TimeIt("CSLARTB before _Layout");
// MyStepSectionLayoutData = itemInfo.ActiveFormat.MyStepSectionLayoutData;
// //// TIMING: DisplayItem.TimeIt("CSLARTB _Layout");
// if (myParentEditItem != null)
// SeqLevel = myParentEditItem.SeqLevel + ((myChildRelation == ChildRelation.After || myChildRelation == ChildRelation.Before) && itemInfo.IsSequential ? 1 : 0);
// //// TIMING: DisplayItem.TimeIt("CSLARTB seqLevel");
// MyItemInfo = itemInfo;
// MyItemInfo.MyConfig.PropertyChanged += new PropertyChangedEventHandler(MyConfig_PropertyChanged);
// }
// //// TIMING: DisplayItem.TimeIt("CSLARTB MyItem");
// myStepPanel.Controls.Add(this);
// switch (myChildRelation)
// {
// case ChildRelation.After:
// AddItem(myParentEditItem, ref myParentEditItem._MyAfterEditItems, nextEditItem);
// break;
// case ChildRelation.Before:
// AddItem(myParentEditItem, ref myParentEditItem._MyBeforeEditItems, nextEditItem);
// break;
// case ChildRelation.RNO:
// RNOLevel = myParentEditItem.RNOLevel + 1;
// AddItem(myParentEditItem, ref myParentEditItem._MyRNOEditItems, nextEditItem);
// break;
// case ChildRelation.None:
// break;
// }
// if (itemInfo != null)
// {
// if (myChildRelation == ChildRelation.None)
// {
// if (ContentType == 0 && MyStepSectionLayoutData != null)
// {
// LastMethodsPush(string.Format("SetupRTBItem {0}", MyID));
// Width = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT);
// }
// }
// }
// //// TIMING: DisplayItem.TimeIt("CSLARTB Parent");
// SetText();
// //// TIMING: DisplayItem.TimeIt("CSLARTB SetText");
// if (itemInfo != null)
// {
// Name = string.Format("Item-{0}", itemInfo.ItemID);
// SetExpandAndExpander(itemInfo);
// if (expand && (itemInfo.MyContent.ContentPartCount != 0)) // If it should expand and it can expand
// Expand(true);
// else
// if (myParentEditItem == null)// If it is the top node
// if (ContentType >= 20000) // and it is a step - fully expand
// Expand(true);
// else // otherwise only expand one level
// Expand(false);
// }
// //// TIMING: DisplayItem.TimeIt("CSLARTB before Controls Add");
// //myStepPanel.Controls.Add(this);
// int top = FindTop(0);
// if (Top < top)
// {
// LastMethodsPush("SetupRTBItem");
// MyStepPanel.ItemMoving++;
// Top = top;
// MyStepPanel.ItemMoving--;
// LastMethodsPop();
// }
// _Loading = false;
// //// TIMING: DisplayItem.TimeIt("CSLARTB Controls Add");
//}
private void SetupHeader()
{
SetupHeader(MyItemInfo);
LastMethodsPush("SetupHeader");
Height = _MyStepRTB.Height + _MyStepRTB.Top + 7;
LastMethodsPop();
}
void _MyStepRTB_Resize(object sender, EventArgs e)
{
if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem)
ScrollToCenter();
//MyStepPanel.ScrollControlIntoView(this);
}
void MyStepRTB_TextChanged(object sender, EventArgs e)
{
if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem)
ScrollToCenter();
//MyStepPanel.ScrollControlIntoView(this);
}
private Label lblHeader = null;
private Label lblFooter = null;
private void SetupHeaderFooter(ref Label lbl, string name, MetaTag mTag)
{
if (lbl == null) lbl = new Label();
lbl.BackColor = System.Drawing.Color.Transparent;
lbl.Location = new System.Drawing.Point(0, 0);
lbl.Name = name;
lbl.Size = new System.Drawing.Size(this.Width, 23);
lbl.Visible = true;
lbl.Font = mTag.MyFont.WindowsFont;
lbl.Text = mTag.CleanText;
lbl.TextAlign = mTag.Justify;
this.Controls.Add(lbl);
}
#endregion
#region EventHandlers
/// <summary>
/// When the RichTextBox height changes, change the height of the control to match
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void _MyStepRTB_HeightChanged(object sender, EventArgs args)
{
if (this.Height != _MyStepRTB.Height + _MyStepRTB.Top + 7) // add in 7 to make it look good // + 10)
{
LastMethodsPush(string.Format("_StepRTB_HeightChanged {0}", _MyStepRTB.Height));
this.Height = _MyStepRTB.Height + _MyStepRTB.Top + 7;
LastMethodsPop();
}
}
/// <summary>
/// When a RichTextBox is entered, the selected StepRTB is set
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void _StepRTB_Enter(object sender, EventArgs e)
{
if (MyStepPanel.DisplayItemChanging) return;
//vlnStackTrace.ShowStack("_StepRTB_Enter {0}",this.MyID);
MyStepPanel.SelectedEditItem = this;
}
/// <summary>
/// Pass the AttachmentClick event to the StepPanel control.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void vlnExp_AttachmentClick(object sender, vlnExpanderEventArgs args)
{
if (_MyvlnExpander.AutoTOC) return;
MyStepPanel.OnAttachmentClicked(sender, new StepPanelAttachmentEventArgs(this));
}
/// <summary>
/// Handle the colape event
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void vlnExp_BeforeColapse(object sender, vlnExpanderEventArgs args)
{
Cursor tmp = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;
int top = TopMostEditItem.Top;// This doesn't work - this is since the last time it was expanded.
int topOffset = TopMostEditItem.Top + MyStepPanel.VerticalScroll.Value;
Colapsing = true;
// Hide Children
HideChildren();
// Adjust Positions
int topOffsetAfter = TopMostEditItem.Top + MyStepPanel.VerticalScroll.Value;
ExpandPrefix = topOffset - topOffsetAfter;
//ExpandSuffix = BottomMostEditItem.Bottom - Bottom;
if (topOffsetAfter != topOffset)
{
LastMethodsPush(string.Format("Colapse {0}", MyID));
MyStepPanel.ItemMoving++;
Top += (topOffset - topOffsetAfter);
MyStepPanel.ItemMoving--;
LastMethodsPop();
}
else
AdjustLocation();
BottomMostEditItem.AdjustLocation();
Colapsing = false;
Cursor.Current = tmp;
}
/// <summary>
/// Handle the expand event
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void vlnExp_BeforeExpand(object sender, vlnExpanderEventArgs args)
{
Cursor tmp = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;
if (!_Loading && MyExpandingStatus == ExpandingStatus.No)
{
if (MyStepPanel.AutoExpand)
Expand((ContentType >= 20000) || MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format);
else
Expand(false);
}
Cursor.Current = tmp;
}
/// <summary>
/// Raises an ItemClick event when the user clicks on the Tab
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void lblTab_MouseDown(object sender, MouseEventArgs e)
{
MyStepPanel.OnItemClick(this, new StepPanelEventArgs(this, e));
}
/// <summary>
/// Handle the LinkGoTO event
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void _MyStepRTB_LinkGoTo(object sender, StepPanelLinkEventArgs args)
{
_MyLog.DebugFormat("_DisplayRTB_LinkGoTo " + args.LinkInfoText);
MyStepPanel.OnLinkClicked(sender, args);
}
void _MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args)
{
MyStepRTB.UpdateStepRtb(args.LinkText, args.ValText);
}
/// <summary>
/// Raise a OnLinkModifyTran event, when the user chooses to Modify a transition
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void _MyStepRTB_LinkModifyTran(object sender, StepPanelLinkEventArgs args)
{
MyStepPanel.OnLinkModifyTran(sender, args);
}
/// <summary>
/// Raise a OnLinkModifyRO event, when the user chooses to modify an RO
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void _MyStepRTB_LinkModifyRO(object sender, StepPanelLinkEventArgs args)
{
MyStepPanel.OnLinkModifyRO(sender, args);
}
private void _MyStepRTB_CursorKeyPress(object sender, KeyEventArgs args)
{
MyStepPanel.StepCursorKeys(this, args);
}
private void _MyStepRTB_CursorMovement(object sender, StepRTBCursorMovementEventArgs args)
{
MyStepPanel.CursorMovement(this, args.CursorLocation, args.Key);
}
//private void _MyStepRTB_ModeChange(object sender, StepRTBModeChangeEventArgs args)
//{
// MyStepPanel.OnModeChange(sender as StepRTB, args);
//}
void _MyStepRTB_SetMenu(object sender, StepRTBMenuEventArgs args)
{
if (args.MenuGroup == null)
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu();
else if (args.MenuGroup == "OpenContextMenu")
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetContextMenu();
else
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetShortCutContextMenu(args.MenuGroup);
}
void _MyStepRTB_AdjustTableWidth(object sender, StepRTBTableWidthEventArgs args)
{
//if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
if (MyItemInfo.IsTable || MyItemInfo.IsFigure)
{
if (args.EditMode)
{
// First get ColR
int colR = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode);
// Second get WidS
int widS = /* _WidthAdjust + borderWidth + */ MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode);
//int wNew = MyRTBItem.MyStepPanel.ToDisplay(MyRTBItem.MyStepSectionLayoutData.WidT);
int wNew = 70 + widS + colR * MyItemInfo.ColumnMode;
if (wNew > ItemWidth)
{
ItemWidth = wNew;
ItemLocation = TableLocation(MyParentEditItem, MyStepSectionLayoutData, wNew);
}
}
else
{
int newwidth = (int)GetTableWidth(MyStepRTB.Font, MyStepRTB.Text, false);
if (ItemWidth != newwidth)
{
ItemWidth = newwidth;
ItemLocation = TableLocation(MyParentEditItem, MyStepSectionLayoutData, newwidth);
}
}
}
}
/// <summary>
/// Calculate TableWidth based upon the the contents
/// </summary>
/// <param name="myFont"></param>
/// <param name="txt"></param>
/// <param name="addBorder"></param>
/// <returns></returns>
private float GetTableWidth(Font myFont, string txt, bool addBorder)
{
string[] lines = txt.Split("\n".ToCharArray());
float max = 0;
using (Graphics g = this.CreateGraphics())
{
PointF pnt = new PointF(0, 0);
foreach (string line in lines)
{
string lineAdj = Regex.Replace(line, @"\\u....\?", "X"); // Replace Special characters
//line2 = Regex.Replace(line2, @"\\.*? ", ""); // Remove RTF Commands - Really should not be any
lineAdj = StepRTB.RemoveLinkComments(lineAdj);
// MeasureString doesn't work properly if the line include graphics characters.
// So, Measure a string of the same length with 'M's.
SizeF siz = g.MeasureString("".PadLeft(lineAdj.Length + (addBorder ? 2 : 0), 'M'), myFont, pnt, StringFormat.GenericTypographic);
float wid = siz.Width;
if (wid > max)
{
max = wid;
}
}
}
float widLimit = (float)MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode);
widLimit += (float)MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColS);
widLimit += (float)MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode);
max += MyStepPanel.MyStepPanelSettings.TableWidthAdjust;
return Math.Min(max, widLimit);
}
bool _MyStepRTB_IsNotCurrentSelection(object sender, System.EventArgs args)
{
return MyStepPanel.SelectedEditItem != this;
}
void _MyStepRTB_OpenAnnotations(object sender, System.EventArgs args)
{
OpenAnnotations();
}
void _MyStepRTB_InsertPgBrk(object sender, System.EventArgs args)
{
InsertPgBrk();
}
void _MyStepRTB_EnterKeyPressed(object sender, System.Windows.Forms.KeyEventArgs args)
{
if (!MyItemInfo.IsTablePart)
{
args.Handled = true;
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ProcessEnterKey();
}
}
bool _MyStepRTB_CheckClipboard(object sender, System.EventArgs args)
{
return CheckClipboard();
}
void _MyStepRTB_CopyStep(object sender, System.EventArgs args)
{
CopyStep();
}
void _MyStepRTB_OpenContextMenu(object sender, StepRTBLocationEventArgs args)
{
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.OpenContextMenu(args.Location);
}
void _MyStepRTB_DoMouseWheel(object sender, System.Windows.Forms.MouseEventArgs args)
{
DoMouseWheel(args);
}
void _MyStepRTB_DoSaveContents(object sender, System.EventArgs args)
{
SaveContents();
}
#endregion
#region override methods
public override void RefreshTab()
{
TabFormat = null;
SetupHeader();
}
public override void SetFocus()
{
MyStepRTB.Focus();
}
public override void SaveContents()
{
MyStepRTB.Visible = false;
while (MyStepRTB.Text.Contains("\\"))
{
int loc = MyStepRTB.Text.IndexOf("\\");
MyStepRTB.SelectionStart = loc;
MyStepRTB.SelectionLength = 1;
MyStepRTB.SelectedText = "<BackSlash>";
}
SaveText();
MyStepRTB.Visible = true;
SaveConfig(); // This may be redundant
}
public void SaveText()
{
if (MyStepRTB.ReadOnly) return;
if (!MyStepRTB.ActiveMode) return;
if (MyStepRTB.MyItemInfo.MyContent.Number != null && !MyStepRTB.IsDirty && MyStepRTB.Text.Contains("(Resolved Transition Text)") == false) return;
bool success = MyStepRTB.OrigDisplayText.Save((RichTextBox)MyStepRTB);
if (success)
{
StepConfig sc = MyStepRTB.MyItemInfo.MyConfig as StepConfig;
// if the plant has the change id option, the change id was entered when the program started.
// this should be saved for every piece of edited data. Note that the set of config
// item Step_MultipleChangeID has the save built in to it.
if (MyStepRTB.MyItemInfo.IsStep &&
MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds
&& !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange)
{
//StepConfig sc = MyStepRTB.MyItemInfo.MyConfig as StepConfig;
if (sc == null) sc = new StepConfig();
sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId;
//if (MyStepRTB.MyItemInfo.MyConfig == null) itm.MyContent.Config = sc.ToString();
}
// We saved changes made to some step text. Reset the change bar override.
// IF there is a step config remove the change bar override by setting the CBOverride value to null
// This fixes a problem reported by Farly where if the change bar or overridden to be off, the next
// time a change was made, the change bar remained turned off.
if (sc != null)
sc.Step_CBOverride = null; // clear the change bar override
MyStepRTB.FindAllLinks();
MyStepRTB.OrigRTF = MyStepRTB.Rtf;
MyStepRTB.ClearUndo();
}
}
//public override void SetBackgroundColor()
//{
// MyStepRTB.SetBackColor();
//}
public override void IdentifyMe(bool highlight)
{
if (highlight)
MyStepRTB.BackColor = Color.Gray;
else
{
if (MyStepRTB.Focused) // If active Set BackColor to the active color
MyStepRTB.BackColor = MyStepPanel.ActiveColor;
else // Otherwise Set the BackColor to either the InactiveColor or the AnnotationColor
MyStepRTB.BackColor = MyItemInfo.ItemAnnotationCount == 0 ? MyStepPanel.InactiveColor : MyStepPanel.AnnotationColor;
}
}
/// <summary>
/// Gets or Sets the ability to expand
/// </summary>
public override bool CanExpand
{
get { return _MyvlnExpander.Visible; }
set { _MyvlnExpander.Visible = value; }
}
public override void HandleResize()
{
if (lblHeader != null) lblHeader.Width = this.Width;
}
public override void MatchExpanded()
{
if (!_MyvlnExpander.Expanded)
_MyvlnExpander.ShowExpanded();
}
/// <summary>
/// Sets the focus to this RTBItem and positions the cursor to the begining of the string
/// </summary>
public override void ItemSelect()
{
// Was getting an Error that _MyStepRTB was Disposed RHM 20101217
if (!_MyStepRTB.Disposing && !MyStepRTB.Closed)
{
_MyStepRTB.Focus();
_MyStepRTB.Select(0, 0);
}
else
{
_MyLog.WarnFormat("Attempt to give Focus to Disposed Object {0}", MyID);
}
// if (CanExpand) AutoExpand(); // Expand the item if you can
ScrollToCenter();
}
/// <summary>
/// Sets the focus to this RTBItem
/// </summary>
public override void ItemShow()
{
_MyStepRTB.Focus();
ScrollToCenter();
}
public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg)
{
return MyStepRTB.ReplaceText(rpltxt, fndstr, caseSensitive, matchWholeWord, reverse, prompt, fndrpldlg);
}
public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse)
{
return MyStepRTB.FindText(str, caseSensitive, matchWholeWord, reverse);
}
public override void PositionToEnd()
{
MyStepRTB.SelectionStart = MyStepRTB.Text.Length;
}
public override void PositionToStart()
{
return;
}
public override string SelectedTextForFind
{
get
{
StepRTB srtb = MyStepRTB;
if (srtb.SelectionLength > 0)
{
if (srtb.IsSelectionLinked(srtb.SelectionStart, srtb.SelectionLength))
return srtb.SelectedText.Substring(0, srtb.SelectedText.IndexOf("#Link"));
else
return srtb.SelectedText;
}
return null;
}
}
public override bool SpellCheckNext()
{
return MyStepRTB.SpellCheckNext();
}
public override void SetActive()
{
MyStepRTB.BackColor = MyStepPanel.ActiveColor;
}
public override bool Empty
{
get
{
// Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf);
// string txt = MyStepRTB.Text;
// Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf);
// return txt == "";
//return MyStepRTB.IsEmpty;
return MyStepRTB.Text == "";
}
set { MyStepRTB.Text = value ? "" : " "; }
}
//public override bool IsEmpty() // this becomes 'Empty' property, i.e. get/set.
//{ // for the set, emtpy is following line (= not ==).
// // for not empty - it's code that is in 'MakeNotEmpty'
// return MyStepRTB.Text == "";
//}
//public override void MakeNotEmpty()
//{
// MyStepRTB.Text = " ";
//}
public override void RefreshDisplay(bool activeMode)
{
MyStepRTB.VwMode = MyStepPanel.VwMode;
MyStepRTB.RefreshDisplay(activeMode);
//MyStepRTB.ViewRTB = !activeMode;
}
public override void ToggleEditView(E_ViewMode vwMode)
{
SaveContents();
MyStepRTB.VwMode = vwMode;
MyStepRTB.RefreshDisplay();
MyStepRTB.SelectionStart = 0;
MyStepRTB.SelectionLength = 0;
}
public override int TabLeft { get { return lblTab.Left; } set { lblTab.Left = value; } }
public override Font TabFont { get { return lblTab.Font; } set { lblTab.Font = value; } }
public override string TabText { get { return lblTab.Text; } }
public override Point TabLocation { get { return lblTab.Location; } }
public override Font ContentFont { get { return MyStepRTB.Font; } set { MyStepRTB.Font = value; } }
public override float ContentTop { get { return MyStepRTB.Top; } }
public override void SetupHeader(ItemInfo itemInfo)
{
lblTab.Top = 3 + ((itemInfo.HasHeader) ? 23 : 0);
_MyStepRTB.Top = lblTab.Top; // 3 + ((itemInfo.HasHeader) ? 23 : 0);
//lblTab.Move += new EventHandler(lblTab_Move);
if (itemInfo.HasHeader)
SetupHeaderFooter(ref lblHeader, "Header", itemInfo.MyHeader);
else
{
// remove header from screen if it exists:
this.Controls.Remove(lblHeader);
lblHeader = null;
}
}
public override void ShowExpanded()
{
_MyvlnExpander.ShowExpanded();
}
/// <summary>
/// Sets the Item and as a result the text for the RichTextBox
/// </summary>
public override void SetText()
{
LastMethodsPush("SetText");
if (MyItemInfo != null)
{
MyStepRTB.MyItemInfo = MyItemInfo;
MyStepRTB.RefreshDisplay();
IdentifyMe(false);
}
LastMethodsPop();
}
public override void SetExpandAndExpander(ItemInfo itemInfo)
{
// Don't allow substeps to expand
switch (ContentType / 10000)
{
case 1: // Section can expand
CanExpand = true;
// If a word document set the expander to attachment
_MyvlnExpander.Attachment = !(itemInfo.IsStepSection);
_MyvlnExpander.AutoTOC = itemInfo.IsAutoTOCSection;
//OLD: _MyvlnExpander.Attachment = (itemInfo.MyContent.ContentPartCount == 0);
break;
case 2: // High level steps with children can expand
if(MyStepPanel.AutoExpand)
CanExpand = itemInfo.IsHigh && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && itemInfo.HasChildren; // TemporaryFormat.IsHigh(item); ;
else
CanExpand = itemInfo.HasChildren;
break;
default://Procedures cannot expand, because they automatically expand
CanExpand = false;
break;
}
}
public override void SaveCurrentAndContents()
{
SaveContents();
}
#endregion
}
}

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="lblTab.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="_MyToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>148, 17</value>
</metadata>
<metadata name="_MyStepRTB.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="_MyvlnExpander.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,316 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using C1.Win.C1SpellChecker;
namespace Volian.Controls.Library
{
// Our custom Spell Checker dialog
public partial class VlnSpellCheckDlg : DevComponents.DotNetBar.Office2007Form, ISpellDialog
{
private C1SpellChecker _Spell;
private ISpellCheckableEditor _Editor;
private CharRangeList _Errors;
private int _ErrorCount;
private int _ErrorIndex = -1; // current error index
private bool _AutoSuggest = true;
private string _NoSuggestionsText = "(no suggestions)";
Dictionary<string, string> _changeAll = new Dictionary<string, string>();
/// <summary>
/// Gets the <see cref="CharRange"/> object that represents the error currently
/// displayed in the dialog.
/// </summary>
public CharRange CurrentError
{
get { return _Errors[_ErrorIndex]; }
}
public bool DidCorrectSpelling = false; // B2015-024 have Spell Checker text changes be in editorial mode (not assign a change bar but keep existing change bar)
public VlnSpellCheckDlg()
{
InitializeComponent();
}
/// <summary>
/// Initializes the dialog to use the given parameters.
/// </summary>
/// <param name="spell"><see cref="C1SpellChecker"/> to use for spelling.</param>
/// <param name="editor"><see cref="ISpellCheckableEditor"/> that contains the text to spell-check.</param>
/// <param name="errors"><see cref="CharRangeList"/> that contains the initial error list.</param>
public void Initialize(C1SpellChecker spell, ISpellCheckableEditor editor, CharRangeList errors)
{
_Spell = spell;
_Editor = editor;
_Errors = errors;
if (_Errors == null)
{
_Errors = _Spell.CheckText(_Editor.Text);
}
_ErrorCount += _Errors.Count;
btnAddToDictionary.Visible = _Spell.UserDictionary.Enabled;
}
/// <summary>
/// Gets the total number of errors detected in the control.
/// </summary>
public int ErrorCount
{
get { return _ErrorCount; }
}
/// <summary>
/// Gets or sets the index of the current error into the <see cref="Errors"/> list.
/// </summary>
public int ErrorIndex
{
get { return _ErrorIndex; }
set
{
_ErrorIndex = value;
UpdateCurrentError();
}
}
private void UpdateEditor(string replacement)
{
DidCorrectSpelling = true;
// save starting point to continue checking from here
int start = CurrentError.Start;
if (replacement.Length == 0)
{
// if replacement is empty, expand over spaces and commas
CharRange delete = CharRange.ExpandOverWhitespace(_Editor.Text, CurrentError);
_Editor.Select(delete.Start, delete.Text.Length);
}
// replace word in text and re-check
_Editor.SelectedText = replacement;
_Errors = _Spell.CheckText(_Editor.Text, start);
// update index
ErrorIndex = ErrorIndex; // originally 0;
}
public void Ignore()
{
btnIgnore.PerformClick();
}
/// <summary>
/// Raises the <see cref="Form.Load"/> event.
/// </summary>
/// <param name="e"><see cref="EventArgs"/> that contains the event data.</param>
protected override void OnLoad(EventArgs e)
{
// fire load event
base.OnLoad(e);
Volian.Base.Library.HWndCounter.GetWindowHandlesForCurrentProcess(this.Handle);
//AddHandle();
// show first error (after firing load event)
ErrorIndex = 0;
}
// added for debugging - comment out when not using
//public void AddHandle()
//{
// if (!Handles.Contains(this.Handle))
// {
// GC.Collect();
// Handles.Add(this.Handle);
// Console.WriteLine("Handles {0}, RTB Count Created {1}, RTB Count Not Disposed = {2} ", Handles.Count,StepRTB.CountCreated,StepRTB.CountNotDisposed);
// }
//}
//private static List<IntPtr> Handles = new List<IntPtr>();
private bool _Initializing = false;
private string _OrgWord;
// update dialog to show current error
private void UpdateCurrentError()
{
// design time
if (DesignMode || _Errors == null)
{
return;
}
// finished with this batch of errors
if (ErrorIndex >= _Errors.Count)
{
// check whether the editor has more text to check
while (_Editor.HasMoreText())
{
_Errors = _Spell.CheckText(_Editor.Text);
if (_Errors.Count > 0)
{
_ErrorCount += _Errors.Count;
ErrorIndex = 0;
return;
}
}
// editor has no more text...
DialogResult = DialogResult.OK;
return;
}
// update current error
CharRange err = CurrentError;
// select word in editor
_Editor.Select(err.Start, err.Text.Length);
// honor 'change all' list
if (_changeAll.ContainsKey(err.Text))
{
txbBadWord.Text = _changeAll[err.Text];
btnChange_Click(this, EventArgs.Empty);
return;
}
_Initializing = true;
// show bad word, new text
txbBadWord.Text = _OrgWord = err.Text;
// repeated word?
if (err.Duplicate)
{
// adjust dialog
lblNotInDictionary.Text = "Duplicate Word";
btnIgnoreAll.Enabled = false;
btnAddToDictionary.Enabled = false;
btnRemove.Enabled = true;
// no suggestions
lbSuggestList.Items.Clear();
}
else
{
// adjust dialog
lblNotInDictionary.Text = "Not In Dictionary";
btnIgnoreAll.Enabled = true;
btnAddToDictionary.Enabled = true;
btnRemove.Enabled = false;
SetupSuggestions(err.Text);
}
// focus to new word
_AutoSuggest = false;
txbBadWord.SelectAll();
txbBadWord.Focus();
_AutoSuggest = true;
AcceptButton = btnIgnore;
// show 'Add' button only if user dictionary is enabled
btnAddToDictionary.Visible = _Spell.UserDictionary.Enabled;
// all ready, fire ErrorDisplayed event
//OnErrorDisplayed(EventArgs.Empty);
}
private void SetupSuggestions(string badWord)
{
// show suggestions
_Initializing = true;
string[] suggestions = _Spell.GetSuggestions(badWord);
lbSuggestList.Items.Clear();
if (suggestions.Length > 0)
{
lbSuggestList.Items.AddRange(suggestions);
lbSuggestList.SelectedIndex = -1;
lbSuggestList.Enabled = true;
}
else
{
lbSuggestList.Items.Add(_NoSuggestionsText);
lbSuggestList.SelectedIndex = -1;
lbSuggestList.Enabled = false;
}
_Initializing = false;
if (_Editor.Control is StepRTB && !(_Editor.Control as StepRTB).MyItemInfo.IsHigh)
{
Ignore();
}
}
private void txbBadWord_TextChanged(object sender, EventArgs e)
{
btnChange.Enabled = (_OrgWord != txbBadWord.Text);
btnChangeAll.Enabled = btnChange.Enabled && lblNotInDictionary.Text == "Not In Dictionary";
btnAddToDictionary.Enabled = _Spell.UserDictionary.Enabled && !InDictionary(txbBadWord.Text);
if (_AutoSuggest && !_Initializing)
{
SetupSuggestions(txbBadWord.Text);
}
}
private bool InDictionary(string word)
{
if (_Spell.MainDictionary.Contains(word))
return true;
if (_Spell.CustomDictionary != null && _Spell.CustomDictionary.Contains(word))
return true;
if (_Spell.UserDictionary != null && _Spell.UserDictionary.Contains(word))
return true;
return false;
}
private void btnChange_Click(object sender, EventArgs e)
{
UpdateEditor(txbBadWord.Text);
}
private void btnChangeAll_Click(object sender, EventArgs e)
{
_changeAll[CurrentError.Text] = txbBadWord.Text;
UpdateEditor(txbBadWord.Text);
}
private void btnIgnore_Click(object sender, EventArgs e)
{
ErrorIndex++;
}
private void btnIgnoreAll_Click(object sender, EventArgs e)
{
//Console.WriteLine("handle: {0}", this.Handle);
_Spell.IgnoreList.Add(CurrentError.Text);
_Errors = _Spell.CheckText(_Editor.Text, CurrentError.Start);
UpdateCurrentError();
}
private void btnAddToDictionary_Click(object sender, EventArgs e)
{
_Spell.UserDictionary.AddWord(CurrentError.Text);
_Errors = _Spell.CheckText(_Editor.Text, CurrentError.Start);
ErrorIndex = 0;
}
private void lbSuggestList_SelectedIndexChanged(object sender, EventArgs e)
{
_AutoSuggest = false;
if (!_Initializing && lbSuggestList.Text != _NoSuggestionsText)
txbBadWord.Text = lbSuggestList.Text;
_AutoSuggest = true;
}
// double-click selects word for suggestion list and changes mis-spelled word
private void lbSuggestList_DoubleClick(object sender, EventArgs e)
{
if (txbBadWord.Text == lbSuggestList.Text)
{
UpdateEditor(txbBadWord.Text);
}
}
private void btnRemove_Click(object sender, EventArgs e)
{
UpdateEditor("");
}
}
}

View File

@@ -14,7 +14,7 @@
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
@@ -31,6 +31,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -39,6 +40,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Demo|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -47,6 +49,7 @@
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
@@ -55,14 +58,16 @@
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\Release\</OutputPath>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Demo|x86' ">
<DebugSymbols>true</DebugSymbols>
@@ -71,31 +76,28 @@
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="AxInterop.DSOFramer">
<HintPath>..\..\Proms3rdPartyLibraries\DSOFramer\AxInterop.DSOFramer.dll</HintPath>
<Reference Include="C1.Win.C1FlexGrid.2, Version=2.0.20162.188, Culture=neutral, PublicKeyToken=79882d576c6336da, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="C1.Win.C1FlexGrid.2, Version=2.6.20142.835, Culture=neutral, PublicKeyToken=79882d576c6336da, processorArchitecture=MSIL" />
<Reference Include="C1.Win.C1SpellChecker.2, Version=2.0.20142.141, Culture=neutral, PublicKeyToken=79882d576c6336da, processorArchitecture=MSIL">
<Reference Include="C1.Win.C1SpellChecker.2, Version=2.0.20162.188, Culture=neutral, PublicKeyToken=79882d576c6336da, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Csla, Version=2.1.4.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\csla20cs-2.1.4-070223\csla20cs\csla20cs\Csla\bin\Debug\Csla.dll</HintPath>
</Reference>
<Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04, processorArchitecture=MSIL">
<Private>True</Private>
<Reference Include="DevComponents.DotNetBar2, Version=14.1.0.37, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Program Files (x86)\DotNetBar for Windows Forms\DevComponents.DotNetBar2.dll</HintPath>
</Reference>
<Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies\EnvDTE.dll</HintPath>
</Reference>
<Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Interop.DSOFramer">
<HintPath>..\..\Proms3rdPartyLibraries\DSOFramer\Interop.DSOFramer.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DataLoader\bin\Debug\log4net.dll</HintPath>
@@ -110,6 +112,7 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="AlphabeticalNumbering.cs" />
@@ -137,6 +140,9 @@
<Compile Include="BorderSelectionPanel.Designer.cs">
<DependentUpon>BorderSelectionPanel.cs</DependentUpon>
</Compile>
<Compile Include="ConvertTable.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DisplayApplicability.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -191,6 +197,24 @@
<Compile Include="dlgChgId.designer.cs">
<DependentUpon>dlgChgId.cs</DependentUpon>
</Compile>
<Compile Include="dlgDelProcReason.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="dlgDelProcReason.designer.cs">
<DependentUpon>dlgDelProcReason.cs</DependentUpon>
</Compile>
<Compile Include="dlgEnhMissingItem.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="dlgEnhMissingItem.Designer.cs">
<DependentUpon>dlgEnhMissingItem.cs</DependentUpon>
</Compile>
<Compile Include="dlgUCFImportOptions.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="dlgUCFImportOptions.Designer.cs">
<DependentUpon>dlgUCFImportOptions.cs</DependentUpon>
</Compile>
<Compile Include="EditItem.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -233,6 +257,12 @@
<Compile Include="GridItem.Designer.cs">
<DependentUpon>GridItem.cs</DependentUpon>
</Compile>
<Compile Include="ImageItem.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ImageItem.designer.cs">
<DependentUpon>ImageItem.cs</DependentUpon>
</Compile>
<Compile Include="LinkText.cs" />
<Compile Include="PreviewMultiLineRO.cs">
<SubType>Form</SubType>
@@ -257,6 +287,12 @@
<Compile Include="RTBItem.designer.cs">
<DependentUpon>RTBItem.cs</DependentUpon>
</Compile>
<Compile Include="RtfRawItem.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="RtfRawItem.designer.cs">
<DependentUpon>RtfRawItem.cs</DependentUpon>
</Compile>
<Compile Include="Settings.cs" />
<Compile Include="StepPanel.cs">
<SubType>Component</SubType>
@@ -353,6 +389,7 @@
<Compile Include="VlnFlexGrid.Designer.cs">
<DependentUpon>VlnFlexGrid.cs</DependentUpon>
</Compile>
<Compile Include="VlnGridCellShading.cs" />
<Compile Include="VlnSpellCheck.cs" />
<Compile Include="VlnSpellCheckDlg.cs">
<SubType>Form</SubType>
@@ -408,6 +445,15 @@
<DependentUpon>DisplayTags.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="dlgDelProcReason.resx">
<DependentUpon>dlgDelProcReason.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="dlgEnhMissingItem.resx">
<DependentUpon>dlgEnhMissingItem.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="dlgUCFImportOptions.resx">
<DependentUpon>dlgUCFImportOptions.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FindReplace.resx">
<DependentUpon>FindReplace.cs</DependentUpon>
<SubType>Designer</SubType>
@@ -511,6 +557,23 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<COMReference Include="AxEDWordLib">
<Guid>{C2034871-761F-4DA0-80F2-6644E616C0F5}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>aximp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="EDWordLib">
<Guid>{C2034871-761F-4DA0-80F2-6644E616C0F5}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
@@ -562,6 +625,10 @@
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="UCFDiffDetails.xsl" />
<Content Include="UCFImpDetails.xsl" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -0,0 +1,623 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8556527C-6615-487F-8AF7-22EBC3EF0268}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Volian.Controls.Library</RootNamespace>
<AssemblyName>Volian.Controls.Library</AssemblyName>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Demo|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Demo\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Demo|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Demo\</OutputPath>
<DefineConstants>TRACE;DEMO</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="C1.Win.C1FlexGrid.2, Version=2.0.20162.188, Culture=neutral, PublicKeyToken=79882d576c6336da, processorArchitecture=MSIL" />
<Reference Include="C1.Win.C1SpellChecker.2, Version=2.0.20162.188, Culture=neutral, PublicKeyToken=79882d576c6336da, processorArchitecture=MSIL" />
<Reference Include="Csla, Version=2.1.4.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\csla20cs-2.1.4-070223\csla20cs\csla20cs\Csla\bin\Debug\Csla.dll</HintPath>
</Reference>
<Reference Include="DevComponents.DotNetBar2, Version=14.0.0.11, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04, processorArchitecture=MSIL">
<Private>True</Private>
</Reference>
<Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies\EnvDTE.dll</HintPath>
</Reference>
<Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DataLoader\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">
<HintPath>..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="AlphabeticalNumbering.cs" />
<Compile Include="AnnotationDetails.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="AnnotationDetails.designer.cs">
<DependentUpon>AnnotationDetails.cs</DependentUpon>
</Compile>
<Compile Include="AnnotationSearch.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="AnnotationSearch.designer.cs">
<DependentUpon>AnnotationSearch.cs</DependentUpon>
</Compile>
<Compile Include="BorderListBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="BorderListBox.designer.cs">
<DependentUpon>BorderListBox.cs</DependentUpon>
</Compile>
<Compile Include="BorderSelectionPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="BorderSelectionPanel.Designer.cs">
<DependentUpon>BorderSelectionPanel.cs</DependentUpon>
</Compile>
<Compile Include="ConvertTable.cs" />
<Compile Include="DisplayApplicability.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="DisplayApplicability.designer.cs">
<DependentUpon>DisplayApplicability.cs</DependentUpon>
</Compile>
<Compile Include="DisplayBookMarks.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="DisplayBookMarks.Designer.cs">
<DependentUpon>DisplayBookMarks.cs</DependentUpon>
</Compile>
<Compile Include="DisplayFoldoutMaint.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="DisplayFoldoutMaint.Designer.cs">
<DependentUpon>DisplayFoldoutMaint.cs</DependentUpon>
</Compile>
<Compile Include="DisplayHistory.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="DisplayHistory.designer.cs">
<DependentUpon>DisplayHistory.cs</DependentUpon>
</Compile>
<Compile Include="DisplayLibDocs.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="DisplayLibDocs.Designer.cs">
<DependentUpon>DisplayLibDocs.cs</DependentUpon>
</Compile>
<Compile Include="DisplayReports.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="DisplayReports.designer.cs">
<DependentUpon>DisplayReports.cs</DependentUpon>
</Compile>
<Compile Include="DisplaySearch.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="DisplaySearch.Designer.cs">
<DependentUpon>DisplaySearch.cs</DependentUpon>
</Compile>
<Compile Include="DisplayTags.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="DisplayTags.Designer.cs">
<DependentUpon>DisplayTags.cs</DependentUpon>
</Compile>
<Compile Include="dlgChgId.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="dlgChgId.designer.cs">
<DependentUpon>dlgChgId.cs</DependentUpon>
</Compile>
<Compile Include="dlgEnhMissingItem.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="dlgEnhMissingItem.Designer.cs">
<DependentUpon>dlgEnhMissingItem.cs</DependentUpon>
</Compile>
<Compile Include="dlgUCFImportOptions.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="dlgUCFImportOptions.Designer.cs">
<DependentUpon>dlgUCFImportOptions.cs</DependentUpon>
</Compile>
<Compile Include="EditItem.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="EditItem.Designer.cs">
<DependentUpon>EditItem.cs</DependentUpon>
</Compile>
<Compile Include="FindReplace.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FindReplace.designer.cs">
<DependentUpon>FindReplace.cs</DependentUpon>
</Compile>
<Compile Include="frmEnhanced.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmEnhanced.Designer.cs">
<DependentUpon>frmEnhanced.cs</DependentUpon>
</Compile>
<Compile Include="frmImportWordContents.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmImportWordContents.Designer.cs">
<DependentUpon>frmImportWordContents.cs</DependentUpon>
</Compile>
<Compile Include="frmSendErrorLog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmSendErrorLog.designer.cs">
<DependentUpon>frmSendErrorLog.cs</DependentUpon>
</Compile>
<Compile Include="frmViewTextFile.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmViewTextFile.designer.cs">
<DependentUpon>frmViewTextFile.cs</DependentUpon>
</Compile>
<Compile Include="GridItem.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GridItem.Designer.cs">
<DependentUpon>GridItem.cs</DependentUpon>
</Compile>
<Compile Include="ImageItem.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ImageItem.designer.cs">
<DependentUpon>ImageItem.cs</DependentUpon>
</Compile>
<Compile Include="LinkText.cs" />
<Compile Include="PreviewMultiLineRO.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PreviewMultiLineRO.designer.cs">
<DependentUpon>PreviewMultiLineRO.cs</DependentUpon>
</Compile>
<Compile Include="PreviewROImage.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PreviewROImage.designer.cs">
<DependentUpon>PreviewROImage.cs</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="RTBItem.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="RTBItem.designer.cs">
<DependentUpon>RTBItem.cs</DependentUpon>
</Compile>
<Compile Include="RtfRawItem.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="RtfRawItem.designer.cs">
<DependentUpon>RtfRawItem.cs</DependentUpon>
</Compile>
<Compile Include="Settings.cs" />
<Compile Include="StepPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="StepPanel.designer.cs">
<DependentUpon>StepPanel.cs</DependentUpon>
</Compile>
<Compile Include="DisplayRO.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="DisplayRO.Designer.cs">
<DependentUpon>DisplayRO.cs</DependentUpon>
</Compile>
<Compile Include="DisplayTabControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="DisplayTabControl.designer.cs">
<DependentUpon>DisplayTabControl.cs</DependentUpon>
</Compile>
<Compile Include="DisplayTabItem.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="DisplayTabItem.designer.cs">
<DependentUpon>DisplayTabItem.cs</DependentUpon>
</Compile>
<Compile Include="StepTabPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="StepTabPanel.designer.cs">
<DependentUpon>StepTabPanel.cs</DependentUpon>
</Compile>
<Compile Include="StepTabRibbon.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="StepTabRibbon.designer.cs">
<DependentUpon>StepTabRibbon.cs</DependentUpon>
</Compile>
<Compile Include="DisplayTransition.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="DisplayTransition.Designer.cs">
<DependentUpon>DisplayTransition.cs</DependentUpon>
</Compile>
<Compile Include="DropDownNode.cs" />
<Compile Include="DropDownTree.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="DSOTabPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="DSOTabPanel.designer.cs">
<DependentUpon>DSOTabPanel.cs</DependentUpon>
</Compile>
<Compile Include="FlagEnumEditor.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MostRecentItem.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="RichTextBox41.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="RichTextBox41.Designer.cs">
<DependentUpon>RichTextBox41.cs</DependentUpon>
</Compile>
<Compile Include="RomanNumeral.cs" />
<Compile Include="RTBAPI.cs" />
<Compile Include="TransPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="TransPanel.designer.cs">
<DependentUpon>TransPanel.cs</DependentUpon>
</Compile>
<Compile Include="VlnBorders.cs" />
<Compile Include="vlnExpander.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="vlnExpander.designer.cs">
<DependentUpon>vlnExpander.cs</DependentUpon>
</Compile>
<Compile Include="StepRTB.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="StepRTB.designer.cs">
<DependentUpon>StepRTB.cs</DependentUpon>
</Compile>
<Compile Include="VlnFlexGrid.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="VlnFlexGrid.Designer.cs">
<DependentUpon>VlnFlexGrid.cs</DependentUpon>
</Compile>
<Compile Include="VlnSpellCheck.cs" />
<Compile Include="VlnSpellCheckDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="VlnSpellCheckDlg.designer.cs">
<DependentUpon>VlnSpellCheckDlg.cs</DependentUpon>
</Compile>
<Compile Include="vlnTreeCombo.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="vlnTreeView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="vlnTreeView.Designer.cs">
<DependentUpon>vlnTreeView.cs</DependentUpon>
</Compile>
<Compile Include="vlnTreeView3.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="vlnTreeView3.Designer.cs">
<DependentUpon>vlnTreeView3.cs</DependentUpon>
</Compile>
<Compile Include="WebBrowser.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="WebBrowser.designer.cs">
<DependentUpon>WebBrowser.cs</DependentUpon>
</Compile>
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="AnnotationDetails.resx">
<DependentUpon>AnnotationDetails.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="AnnotationSearch.resx">
<DependentUpon>AnnotationSearch.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="DisplayBookMarks.resx">
<DependentUpon>DisplayBookMarks.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="DisplayLibDocs.resx">
<DependentUpon>DisplayLibDocs.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="DisplaySearch.resx">
<DependentUpon>DisplaySearch.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="DisplayTags.resx">
<DependentUpon>DisplayTags.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="dlgEnhMissingItem.resx">
<DependentUpon>dlgEnhMissingItem.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="dlgUCFImportOptions.resx">
<DependentUpon>dlgUCFImportOptions.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FindReplace.resx">
<DependentUpon>FindReplace.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="frmEnhanced.resx">
<DependentUpon>frmEnhanced.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmImportWordContents.resx">
<DependentUpon>frmImportWordContents.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PreviewMultiLineRO.resx">
<DependentUpon>PreviewMultiLineRO.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="PreviewROImage.resx">
<DependentUpon>PreviewROImage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="RTBItem.resx">
<DependentUpon>RTBItem.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="StepPanel.resx">
<SubType>Designer</SubType>
<DependentUpon>StepPanel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DisplayRO.resx">
<SubType>Designer</SubType>
<DependentUpon>DisplayRO.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DisplayTabControl.resx">
<DependentUpon>DisplayTabControl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="StepTabRibbon.resx">
<DependentUpon>StepTabRibbon.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="DisplayTransition.resx">
<SubType>Designer</SubType>
<DependentUpon>DisplayTransition.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="vlnExpander.resx">
<DependentUpon>vlnExpander.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="StepRTB.resx">
<DependentUpon>StepRTB.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="VlnSpellCheckDlg.resx">
<DependentUpon>VlnSpellCheckDlg.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="WebBrowser.resx">
<DependentUpon>WebBrowser.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DropDownPanel\DropDownPanel.csproj">
<Project>{34ADDF19-CBBA-4A11-BC99-D141BA2D29EC}</Project>
<Name>DropDownPanel</Name>
</ProjectReference>
<ProjectReference Include="..\FlexableMessageBox\FlexableMessageBox.csproj">
<Project>{b22ce5ad-288c-44cd-8a22-b3bcf77b7161}</Project>
<Name>FlexableMessageBox</Name>
</ProjectReference>
<ProjectReference Include="..\LBWordLibrary\LBWordLibrary.csproj">
<Project>{70F23722-19A3-4AC1-A900-55831C945786}</Project>
<Name>LBWordLibrary</Name>
</ProjectReference>
<ProjectReference Include="..\TablePicker\TablePicker.csproj">
<Project>{23DECB23-7CEA-433E-88BD-67DA7689B89E}</Project>
<Name>TablePicker</Name>
</ProjectReference>
<ProjectReference Include="..\VEPROMS.CSLA.Library\VEPROMS.CSLA.Library.csproj">
<Project>{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}</Project>
<Name>VEPROMS.CSLA.Library</Name>
</ProjectReference>
<ProjectReference Include="..\VG\VG.csproj">
<Project>{52D74078-3822-410E-889B-464BD21AAB9E}</Project>
<Name>VG</Name>
</ProjectReference>
<ProjectReference Include="..\Volian.Base.Library\Volian.Base.Library.csproj">
<Project>{AEEE9FD1-6892-45E2-A67E-418C06D46FF9}</Project>
<Name>Volian.Base.Library</Name>
</ProjectReference>
<ProjectReference Include="..\volian.Pipe.Library\Volian.Pipe.Library.csproj">
<Project>{2bd7d42a-a8f6-4dea-bdca-5f4d58c6140f}</Project>
<Name>Volian.Pipe.Library</Name>
</ProjectReference>
<ProjectReference Include="..\XYPlots\XYPlots.csproj">
<Project>{04E168D0-9CC7-43D9-A9F1-93E481EA86A3}</Project>
<Name>XYPlots</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<COMReference Include="AxEDWordLib">
<Guid>{C2034871-761F-4DA0-80F2-6644E616C0F5}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>aximp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="EDWordLib">
<Guid>{C2034871-761F-4DA0-80F2-6644E616C0F5}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="ClassDiagram1.cd" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="DisplayApplicability.resx">
<DependentUpon>DisplayApplicability.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="DisplayFoldoutMaint.resx">
<SubType>Designer</SubType>
<DependentUpon>DisplayFoldoutMaint.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DisplayReports.resx">
<DependentUpon>DisplayReports.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="dlgChgId.resx">
<DependentUpon>dlgChgId.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="frmSendErrorLog.resx">
<DependentUpon>frmSendErrorLog.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="frmViewTextFile.resx">
<DependentUpon>frmViewTextFile.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="GridItem.resx">
<SubType>Designer</SubType>
<DependentUpon>GridItem.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="VlnFlexGrid.resx">
<DependentUpon>VlnFlexGrid.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="UCFDiffDetails.xsl" />
<Content Include="UCFImpDetails.xsl" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -12,4 +12,4 @@
</setting>
</Volian.Controls.Library.Properties.Settings>
</userSettings>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>

View File

@@ -0,0 +1,9 @@
select dbo.ve_getitemapplicability(iii.itemid) fromappl,dbo.ve_getitemapplicability(ii.itemid) toappl,
dbo.ve_GetShortPath(iii.itemid) frompath,dbo.ve_GetShortPath(ii.itemid) topath,
ccc.type fromtype,cc.type totype
from transitions tt
inner join contents ccc on tt.fromid = ccc.contentid
inner join items iii on ccc.contentid = iii.contentid
inner join items ii on tt.toid = ii.itemid
inner join contents cc on ii.contentid = cc.contentid
where dbo.ve_getitemapplicability(iii.itemid) != dbo.ve_getitemapplicability(ii.itemid)

View File

@@ -0,0 +1,195 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace Volian.Controls.Library
{
public static class vlnStackTrace
{
public static string GetStack(string str, params object[] objects)
{
return string.Format(str, objects) + StackToString();
}
public static void ShowStack(string str, params object[] objects)
{
Console.WriteLine(string.Format(str, objects) + StackToString());
}
public static string GetStack()
{
return StackToString();
}
public static void ShowStack()
{
Console.WriteLine(StackToString());
}
private static string StackToString()
{
StringBuilder sb = new StringBuilder();
StackTrace st = new StackTrace(true);
StackFrame[] sfs = st.GetFrames();
int ii = 0;
string sLast = "";
string sThis = "";
int imax = MatchingStackFrame(sfs);
foreach (StackFrame sf in sfs)
{
if (imax == 0)
sb.Append(string.Format("\r\n{0}---------", "".PadLeft(ii++ * 2)));
imax--;
if (ii < 2) ii++;
else
{
string sMethod = sf.GetMethod().Name;
string sNamespace = sf.GetMethod().ReflectedType.Namespace;
string sType = sf.GetMethod().ReflectedType.Name;
if (sf.GetFileLineNumber() != 0)
{
sMethod += string.Format(" {0}[{1}]", sf.GetFileName(), sf.GetFileLineNumber());
sThis = "";
}
else
{
sThis = sNamespace;
}
if (sLast == sThis && sThis != "")
sb.Append(string.Format("\t*.{0}.{1}", sType, sMethod));
else
sb.Append(string.Format("\r\n{0}{1}.{2}.{3}", "".PadLeft(ii++ * 2), sNamespace, sType, sMethod));
}
sLast = sThis;
}
return sb.ToString();
}
public static void ShowStackFirstLocal(string str)
{
Console.WriteLine(str + " " + StackToStringLocal(3,0));
}
public static void ShowStackLocal(string str,int start)
{
Console.WriteLine(str + " " + StackToStringLocal(start,1));
}
public static void ShowStackLocal(string str,int start, int limit)
{
Console.WriteLine(str + " " + StackToStringLocal(start, limit));
}
private static string StackToStringLocal(int start, int limit)
{
StringBuilder sb = new StringBuilder();
string sep = "Local Method - ";
StackTrace st = new StackTrace(true);
StackFrame[] sfs = st.GetFrames();
int count = 0;
int localCount = 0;
foreach (StackFrame sf in sfs)
{
count++;
if (count > start)
{
if (sf.GetFileLineNumber() != 0)
{
string sMethod = sf.GetMethod().Name;
string sNamespace = sf.GetMethod().ReflectedType.Namespace;
string sType = sf.GetMethod().ReflectedType.Name;
sMethod += string.Format(" {0}[{1}]", sf.GetFileName(), sf.GetFileLineNumber());
sb.Append(sep + string.Format("{0}.{1}.{2}", sNamespace, sType, sMethod));
localCount ++;
if (localCount >= limit)
return sb.ToString();
sep = "\r\n" + "".PadRight(localCount *2);
}
}
}
if (localCount > 0)
return sb.ToString();
return "No Local Method";
}
public static string CalledFrom
{
get
{
StackTrace st = new StackTrace(true);
StackFrame[] sfs = st.GetFrames();
int count = 0;
foreach (StackFrame sf in sfs)
{
if (sf.GetFileLineNumber() != 0)
{
count++;
{
string sMethod = sf.GetMethod().Name;
string sNamespace = sf.GetMethod().ReflectedType.Namespace;
string sType = sf.GetMethod().ReflectedType.Name;
sMethod += string.Format(" {0}[{1}]", sf.GetFileName(), sf.GetFileLineNumber());
if (count > 3)
return string.Format("{0}.{1}.{2}", sNamespace, sType, sMethod);
}
}
}
return "No Local Method";
}
}
private static StackFrame[] _LastSFS;
private static int MatchingStackFrame(StackFrame[] sfs)
{
int iFound = -1;
if (_LastSFS != null)
{
// start at the far end and work backward
for (int i = 1; iFound < 0 && i <= sfs.Length && i <= _LastSFS.Length; i++)
{
if (!Match(sfs[sfs.Length - i],_LastSFS[_LastSFS.Length - i]))
iFound = 1+ sfs.Length - i;
}
}
if (iFound < 0) iFound = sfs.Length;
_LastSFS = (StackFrame[])sfs.Clone();
return iFound;
}
private static bool Match(StackFrame stackFrame1, StackFrame stackFrame2)
{
if (stackFrame1.GetMethod().Name != stackFrame2.GetMethod().Name) return false;
if (stackFrame1.GetMethod().DeclaringType.FullName != stackFrame2.GetMethod().DeclaringType.FullName) return false;
if (stackFrame1.GetILOffset() != stackFrame2.GetILOffset()) return false;
return true;
}
public static bool ScrollInStack()
{
StackTrace st = new StackTrace(true);
StackFrame[] sfs = st.GetFrames();
bool retval = false;
foreach (StackFrame sf in sfs)
{
string sMethod = sf.GetMethod().Name;
string sNamespace = sf.GetMethod().ReflectedType.Namespace;
string sType = sf.GetMethod().ReflectedType.Name;
if (sMethod.ToUpper().Contains("SCROLL") || sType.ToUpper().Contains("SCROLL"))
{
retval = true;
Console.WriteLine("{0}.{1}.{2}", sNamespace, sType, sMethod);
}
}
return retval;
}
/// <summary>
/// This will clear the Output window when run in the Development Environment
/// Add EnvDTE and EnvDTE80 to references from .NET
/// </summary>
public static void ClearOutputWindow()
{
#if (DEBUG)
try
{
EnvDTE80.DTE2 dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.8.0");
dte2.ToolWindows.OutputWindow.ActivePane.Clear();
}
catch (Exception ex)
{
Console.WriteLine("ClearOutputWindow {0} - {1}\r\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace);
}
#endif
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff