This commit is contained in:
Kathy Ruffing 2009-05-05 13:31:29 +00:00
parent 16f3af2b37
commit 8b2435c876

View File

@ -27,8 +27,8 @@ namespace Volian.Controls.Library
LoadTree(); LoadTree();
} }
} }
private string _CurROLink; private RoUsageInfo _CurROLink;
public string CurROLink public RoUsageInfo CurROLink
{ {
get { return _CurROLink; } get { return _CurROLink; }
set set
@ -51,7 +51,7 @@ namespace Volian.Controls.Library
} }
} }
} }
private string _SavCurROLink; private RoUsageInfo _SavCurROLink;
private StepRTB _MyRTB; private StepRTB _MyRTB;
public StepRTB MyRTB public StepRTB MyRTB
{ {
@ -66,7 +66,7 @@ namespace Volian.Controls.Library
_MyRTB.LinkChanged += new StepRTBLinkEvent(_MyRTB_LinkChanged); _MyRTB.LinkChanged += new StepRTBLinkEvent(_MyRTB_LinkChanged);
if (_MyRTB.MyLinkText == null) if (_MyRTB.MyLinkText == null)
{ {
CurROLink = null; //_CurROLink CurROLink = null;
_SavCurROLink = null; _SavCurROLink = null;
} }
} }
@ -78,7 +78,7 @@ namespace Volian.Controls.Library
CurROLink = null; CurROLink = null;
else else
{ {
CurROLink = args.MyLinkText.RoUsageid; CurROLink = args.MyLinkText.MyRoUsageInfo;
} }
} }
@ -145,9 +145,9 @@ namespace Volian.Controls.Library
selectedChld = chld; selectedChld = chld;
if (chld.value != null) if (chld.value != null)
{ {
string SavROLink = ""; RoUsageInfo SavROLink = null;
if (_SavCurROLink != null) if (_SavCurROLink != null)
SavROLink = _SavCurROLink.Substring(_SavCurROLink.IndexOf(' ') + 1, 12); SavROLink = _SavCurROLink; ;
lbROId.Text = chld.appid; lbROId.Text = chld.appid;
btnSaveRO.Enabled = ((_SavCurROLink == null) || !(chld.roid.Equals(SavROLink))); btnSaveRO.Enabled = ((_SavCurROLink == null) || !(chld.roid.Equals(SavROLink)));
btnCancelRO.Enabled = ((_SavCurROLink != null) && !(chld.roid.Equals(SavROLink))); btnCancelRO.Enabled = ((_SavCurROLink != null) && !(chld.roid.Equals(SavROLink)));
@ -295,10 +295,10 @@ namespace Volian.Controls.Library
{ {
// walk down from root of tree, expanding values in the string // walk down from root of tree, expanding values in the string
// that represents the ro link. // that represents the ro link.
string tmpstr = _CurROLink; //string tmpstr = _CurROLink;
int sp = tmpstr.IndexOf(" "); // because parse of ro info is wrong!! //int sp = tmpstr.IndexOf(" "); // because parse of ro info is wrong!!
int rousageid = System.Convert.ToInt32(tmpstr.Substring(0, sp)); //int rousageid = System.Convert.ToInt32(tmpstr.Substring(0, sp));
string roid = tmpstr.Substring(sp + 1, tmpstr.Length - sp - 1); string roid = _CurROLink.ROID; // tmpstr.Substring(sp + 1, tmpstr.Length - sp - 1);
string db = roid.Substring(0, 4); string db = roid.Substring(0, 4);
bool multValSel = false; bool multValSel = false;
if (roid.Length == 16) if (roid.Length == 16)
@ -386,21 +386,9 @@ namespace Volian.Controls.Library
_MyRTB.inRoAdd = true; _MyRTB.inRoAdd = true;
if (CheckROSelection(roch)) if (CheckROSelection(roch))
{ {
string ROID = roch.roid; string linktxt = string.Format(@"#Link:ReferencedObject:<NewID> {0} {1}", roch.roid, _MyROFST.MyRODb.RODbID);
using (RODb rodb = RODb.Get(_MyROFST.MyRODb.RODbID)) // Resolve symbols and scientific notation in the RO return value
{ _MyRTB.InsertRO(ConvertSymbolsAndStuff(tbROValue.Text), linktxt);
// saving of selstart & end is a work around - the Makerousage updates contentinfo object
// which caused the selection in _MyRTB to be changed. This inserted the ro at an incorrect
// location in the string.
int selstart = _MyRTB.SelectionStart;
int sellen = _MyRTB.SelectionLength;
RoUsage ro = RoUsage.MakeRoUsage(MyRTB.MyItemInfo.MyContent.Get(), ROID, null, rodb);
string linktxt = string.Format(@"#Link:ReferencedObject:{0} {1} {2}", ro.ROUsageID, ROID, rodb.RODbID);
// Resolve symbols and scientific notation in the RO return value
_MyRTB.SelectionStart = selstart;
_MyRTB.SelectionLength = sellen;
_MyRTB.InsertRO(ConvertSymbolsAndStuff(tbROValue.Text), linktxt);
}
} }
_MyRTB.inRoAdd = false; _MyRTB.inRoAdd = false;
} }