This commit is contained in:
Kathy Ruffing 2011-03-01 13:24:32 +00:00
parent eb70c087ff
commit 882c782bd1
2 changed files with 19 additions and 31 deletions

View File

@ -246,6 +246,19 @@ namespace Volian.Controls.Library
{
LoadChildren(e.Node);
}
private E_ROValueType _ROTypeFilter = E_ROValueType.All;
public E_ROValueType ROTypeFilter
{
get { return _ROTypeFilter; }
set
{
_ROTypeFilter = value;
LoadTree();
}
}
private E_ROValueType _CurrentROTypeFilter = E_ROValueType.All;
private void LoadChildren(TreeNode tn)
{
object tag = tn.Tag;
@ -282,6 +295,8 @@ namespace Volian.Controls.Library
// TODO: KBR how to handle this?
//Console.WriteLine("ro junk");
continue;
else if (ROTypeFilter != E_ROValueType.All && (chld[i].type & (uint)ROTypeFilter) == 0)
continue; // ignore if does not match filter
else if (/*chld[i].type == 1 && */ chld[i].value == null)
{
tmp = new TreeNode(chld[i].title);
@ -357,9 +372,10 @@ namespace Volian.Controls.Library
private void LoadTree()
{
if (_MyROFST == null) return;
if (_MyROFST == _CurROFST) return;
if (_MyROFST == _CurROFST && ROTypeFilter == _CurrentROTypeFilter) return;
tvROFST.Nodes.Clear();
_CurROFST = _MyROFST;
_CurrentROTypeFilter = ROTypeFilter;
for (int i = 0; i < _MyROFST.ROFSTLookup.myHdr.myDbs.Length; i++)
{
TreeNode tn = new TreeNode(_MyROFST.ROFSTLookup.myHdr.myDbs[i].dbiTitle);
@ -494,50 +510,22 @@ namespace Volian.Controls.Library
}
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
{
//int ss = MyRTB.SelectionStart;
// 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);
int ss = MyRTB.SelectionStart; // Remember where the link is being added
int sl = MyRTB.SelectionLength;
MyRTB.OnReturnToEditor(this, new EventArgs());
MyRTB.Select(ss, sl);
MyRTB.InsertRO(valtxt, linktxt); // Insert the LINK
MyRTB.OnDoSaveContents(this, new EventArgs()); // .SaveText(); // Save the text with the LINK - This also moves the cursor to the end of the text
// By selecting a starting position within a link, StepRTB (HandleSelectionChange) will select the link
MyRTB.Select(ss + 7 + valtxt.Length , 0);// Select the link, Try 7 for "<Start]" plus the length of the value
//Console.WriteLine("'{0}'",MyRTB.Text.Substring(MyRTB.SelectionStart,MyRTB.SelectionLength));
string linkText = MyRTB.Text.Substring(MyRTB.SelectionStart, MyRTB.SelectionLength);
if (_MyLog.IsInfoEnabled && (linkText.Contains("NewID") || linkText.Contains("CROUSGID")))
_MyLog.InfoFormat("ItemID {0}, LinkText '{1}'", MyRTB.MyItemInfo.ItemID, linkText);
int sel = MyRTB.SelectionStart + MyRTB.SelectionLength;
MyRTB.Select(sel, 0);// Move cursor to end of LINK
MyRTB.Focus();
MyRTB.OnRoInsert(this, new StepRTBRoEventArgs(valtxt, selectedChld.value, linktxt, padroid, _MyROFST.MyRODb.RODbID));
}
MyRTB.inRoAdd = false;
btnGoToRO.Enabled = 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;

View File

@ -398,7 +398,7 @@ namespace Volian.Controls.Library
edtitm.AddSiblingAfter(text,updateSelection);
break;
case E_InsertType.Child:
edtitm.AddChild(text, fromType, type);
edtitm.AddChild(text, fromType, type, null);
break;
default:
return false; ;