This commit is contained in:
parent
bbe29f2b0a
commit
3363e0f69a
@ -72,14 +72,14 @@ namespace Volian.Controls.Library
|
|||||||
if (!Visible) return;
|
if (!Visible) return;
|
||||||
if (_MyRTB != null)
|
if (_MyRTB != null)
|
||||||
{
|
{
|
||||||
_MyRTB.LinkChanged -= new StepRTBLinkEvent(_MyRTB_LinkChanged);
|
_MyRTB.LinkChanged -= new StepRTBLinkEvent(MyRTB_LinkChanged);
|
||||||
_MyRTB.SelectionChanged -= new EventHandler(_MyRTB_SelectionChanged);
|
_MyRTB.SelectionChanged -= new EventHandler(MyRTB_SelectionChanged);
|
||||||
}
|
}
|
||||||
if (value == null) return;
|
if (value == null) return;
|
||||||
_MyRTB = value;
|
_MyRTB = value;
|
||||||
_MyRTB.LinkChanged += new StepRTBLinkEvent(_MyRTB_LinkChanged);
|
MyRTB.LinkChanged += new StepRTBLinkEvent(MyRTB_LinkChanged);
|
||||||
_MyRTB.SelectionChanged+=new EventHandler(_MyRTB_SelectionChanged);
|
MyRTB.SelectionChanged+=new EventHandler(MyRTB_SelectionChanged);
|
||||||
if (_MyRTB.MyLinkText == null)
|
if (MyRTB.MyLinkText == null)
|
||||||
{
|
{
|
||||||
CurROLink = null;
|
CurROLink = null;
|
||||||
_SavCurROLink = null;
|
_SavCurROLink = null;
|
||||||
@ -87,14 +87,14 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _MyRTB_SelectionChanged(object sender, EventArgs e)
|
void MyRTB_SelectionChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
lbFound.SelectionMode = SelectionMode.None;
|
lbFound.SelectionMode = SelectionMode.None;
|
||||||
lbFound.DataSource = null;
|
lbFound.DataSource = null;
|
||||||
//Spin through ROs looking for the selected text
|
//Spin through ROs looking for the selected text
|
||||||
if (_MyRTB.SelectedText != "")
|
if (MyRTB.SelectedText != "")
|
||||||
{
|
{
|
||||||
string lookFor = _MyRTB.SelectedText;
|
string lookFor = MyRTB.SelectedText;
|
||||||
List<ROFSTLookup.roChild> children = _MyROFST.ROFSTLookup.GetRosByValue(lookFor);
|
List<ROFSTLookup.roChild> children = _MyROFST.ROFSTLookup.GetRosByValue(lookFor);
|
||||||
if (children != null)
|
if (children != null)
|
||||||
{
|
{
|
||||||
@ -110,9 +110,9 @@ namespace Volian.Controls.Library
|
|||||||
lbFound.Visible = false;
|
lbFound.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args)
|
void MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args)
|
||||||
{
|
{
|
||||||
if (_MyRTB.MyLinkText == null)
|
if (MyRTB.MyLinkText == null)
|
||||||
CurROLink = null;
|
CurROLink = null;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -292,7 +292,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
//else if (chld[i].type == 2 && chld[i].value == null) // table
|
//else if (chld[i].type == 2 && chld[i].value == null) // table
|
||||||
//{
|
//{
|
||||||
// if ((_MyRTB.MyItemInfo.MyContent.Type % 10000) == (int)E_FromType.Table)
|
// if ((MyRTB.MyItemInfo.MyContent.Type % 10000) == (int)E_FromType.Table)
|
||||||
// {
|
// {
|
||||||
// tmp = new TreeNode(chld[i].title);
|
// tmp = new TreeNode(chld[i].title);
|
||||||
// tmp.Tag = chld[i];
|
// tmp.Tag = chld[i];
|
||||||
@ -492,31 +492,35 @@ namespace Volian.Controls.Library
|
|||||||
if (dti.MyDSOTabPanel != null)
|
if (dti.MyDSOTabPanel != null)
|
||||||
dti.MyDSOTabPanel.InsertText(AccPageID);
|
dti.MyDSOTabPanel.InsertText(AccPageID);
|
||||||
}
|
}
|
||||||
else if (_MyRTB != null) // a Procedure Steps section tab is active
|
else if (MyRTB != null) // a Procedure Steps section tab is active
|
||||||
{
|
{
|
||||||
_MyRTB.inRoAdd = true;
|
MyRTB.inRoAdd = true;
|
||||||
if (CheckROSelection(roch)) // check for RO type is valid for this type of step/substep
|
if (CheckROSelection(roch)) // check for RO type is valid for this type of step/substep
|
||||||
{
|
{
|
||||||
//int ss = _MyRTB.SelectionStart;
|
//int ss = MyRTB.SelectionStart;
|
||||||
// the roid may be 12 or 16 chars long, with the last 4 set if there is unit specific
|
// 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.
|
// menuing. Pad to 12 to store in the rousage table.
|
||||||
string padroid = (roch.roid.Length <= 12) ? roch.roid + "0000" : roch.roid;
|
string padroid = (roch.roid.Length <= 12) ? roch.roid + "0000" : roch.roid;
|
||||||
string linktxt = string.Format(@"#Link:ReferencedObject:<NewID> {0} {1}", padroid, _MyROFST.MyRODb.RODbID);
|
string linktxt = string.Format(@"#Link:ReferencedObject:<NewID> {0} {1}", padroid, _MyROFST.MyRODb.RODbID);
|
||||||
// Resolve symbols and scientific notation in the RO return value
|
// Resolve symbols and scientific notation in the RO return value
|
||||||
string valtxt = ConvertSymbolsAndStuff(selectedChld.value);
|
string valtxt = ConvertSymbolsAndStuff(selectedChld.value);
|
||||||
int ss = _MyRTB.SelectionStart; // Remember where the link is being added
|
int ss = MyRTB.SelectionStart; // Remember where the link is being added
|
||||||
_MyRTB.InsertRO(valtxt, linktxt); // Insert the LINK
|
int sl = MyRTB.SelectionLength;
|
||||||
_MyRTB.SaveText(); // Save the text with the LINK - This also moves the cursor to the end of the text
|
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
|
// 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
|
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));
|
//Console.WriteLine("'{0}'",MyRTB.Text.Substring(MyRTB.SelectionStart,MyRTB.SelectionLength));
|
||||||
string linkText = _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")))
|
if (_MyLog.IsInfoEnabled && (linkText.Contains("NewID") || linkText.Contains("CROUSGID")))
|
||||||
_MyLog.InfoFormat("ItemID {0}, LinkText '{1}'", _MyRTB.MyItemInfo.ItemID, linkText);
|
_MyLog.InfoFormat("ItemID {0}, LinkText '{1}'", MyRTB.MyItemInfo.ItemID, linkText);
|
||||||
_MyRTB.Select(_MyRTB.SelectionStart + _MyRTB.SelectionLength, 0);// Move cursor to end of LINK
|
int sel = MyRTB.SelectionStart + MyRTB.SelectionLength;
|
||||||
_MyRTB.Focus();
|
MyRTB.Select(sel, 0);// Move cursor to end of LINK
|
||||||
|
MyRTB.Focus();
|
||||||
}
|
}
|
||||||
_MyRTB.inRoAdd = false;
|
MyRTB.inRoAdd = false;
|
||||||
btnGoToRO.Enabled = btnSaveRO.Enabled = btnCancelRO.Enabled = btnPreviewRO.Enabled = false;
|
btnGoToRO.Enabled = btnSaveRO.Enabled = btnCancelRO.Enabled = btnPreviewRO.Enabled = false;
|
||||||
_SavCurROLink = null;
|
_SavCurROLink = null;
|
||||||
CurROLink = null;
|
CurROLink = null;
|
||||||
@ -543,19 +547,19 @@ namespace Volian.Controls.Library
|
|||||||
switch (selectedRO.type)
|
switch (selectedRO.type)
|
||||||
{
|
{
|
||||||
case 1: // regular text RO
|
case 1: // regular text RO
|
||||||
if (_MyRTB.MyItemInfo.IsFigure)
|
if (MyRTB.MyItemInfo.IsFigure)
|
||||||
{
|
{
|
||||||
errormsg = (replacingRO) ? "a Figure with a non-figure." : "a text RO in a Figure type.";
|
errormsg = (replacingRO) ? "a Figure with a non-figure." : "a text RO in a Figure type.";
|
||||||
goodToGo = false;
|
goodToGo = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // table RO
|
case 2: // table RO
|
||||||
if (_MyRTB.MyItemInfo.IsFigure)
|
if (MyRTB.MyItemInfo.IsFigure)
|
||||||
{
|
{
|
||||||
errormsg = (replacingRO) ? "a Figure with a non-figure." : "a table into a Figure type.";
|
errormsg = (replacingRO) ? "a Figure with a non-figure." : "a table into a Figure type.";
|
||||||
goodToGo = false;
|
goodToGo = false;
|
||||||
}
|
}
|
||||||
else if (!_MyRTB.MyItemInfo.IsTable)
|
else if (!MyRTB.MyItemInfo.IsTable)
|
||||||
{
|
{
|
||||||
errormsg = (replacingRO) ? "a non-table RO with a Table RO." : "a table into a non-table type.";
|
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
|
//TODO: Prompt user to insert a new Table substep type and place this RO into it
|
||||||
@ -563,7 +567,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: // X/Y Plot RO type
|
case 4: // X/Y Plot RO type
|
||||||
if (!_MyRTB.MyItemInfo.IsAccPages)
|
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.";
|
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
|
//TODO: Prompt user to insert a new substep type that handles x/y Plots and place this RO into it
|
||||||
@ -571,7 +575,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8: // figure (intergrated graphics)
|
case 8: // figure (intergrated graphics)
|
||||||
if (!_MyRTB.MyItemInfo.IsFigure && !_MyRTB.MyItemInfo.IsAccPages)
|
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.";
|
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
|
//TODO: Prompt user to insert a new substep type that handles x/y Plots and place this RO into it
|
||||||
|
@ -1431,12 +1431,13 @@ namespace Volian.Controls.Library
|
|||||||
IDataObject myDO = Clipboard.GetDataObject();
|
IDataObject myDO = Clipboard.GetDataObject();
|
||||||
if (myDO.GetDataPresent(DataFormats.Rtf))
|
if (myDO.GetDataPresent(DataFormats.Rtf))
|
||||||
{
|
{
|
||||||
StepRTB stpRTB = new StepRTB();
|
RichTextBox rtb = new RichTextBox();
|
||||||
stpRTB.SelectedRtf = myDO.GetData(DataFormats.Rtf).ToString();
|
rtb.SelectedRtf = ItemInfo.StripLinks(myDO.GetData(DataFormats.Rtf).ToString());
|
||||||
|
|
||||||
if (cbxTextSearchAnnotation.Focused)
|
if (cbxTextSearchAnnotation.Focused)
|
||||||
cbxTextSearchAnnotation.SelectedText = stpRTB.Text;
|
cbxTextSearchAnnotation.SelectedText = rtb.Text;
|
||||||
else if (cbxTextSearchText.Focused)
|
else if (cbxTextSearchText.Focused)
|
||||||
cbxTextSearchText.SelectedText = stpRTB.Text;// .SelectedText;//myDO.GetData(DataFormats.Text,true).ToString();
|
cbxTextSearchText.SelectedText = rtb.Text;// .SelectedText;//myDO.GetData(DataFormats.Text,true).ToString();
|
||||||
}
|
}
|
||||||
else if (myDO.GetDataPresent(DataFormats.Text))
|
else if (myDO.GetDataPresent(DataFormats.Text))
|
||||||
if (cbxTextSearchAnnotation.Focused)
|
if (cbxTextSearchAnnotation.Focused)
|
||||||
|
@ -32,7 +32,7 @@ namespace Volian.Controls.Library
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private int _UniqueBarCount;
|
private int _UniqueBarCount;
|
||||||
private ItemInfo _MyItemInfo = null;
|
private ItemInfo _MyItemInfo = null;
|
||||||
private RTBItem _MyRTBItem = null;
|
private EditItem _MyEditItem = null;
|
||||||
private bool _RibbonExpanded=true;
|
private bool _RibbonExpanded=true;
|
||||||
public bool RibbonExpanded
|
public bool RibbonExpanded
|
||||||
{
|
{
|
||||||
@ -154,12 +154,12 @@ namespace Volian.Controls.Library
|
|||||||
if (args != null)
|
if (args != null)
|
||||||
{
|
{
|
||||||
_MyItemInfo = args.MyItemInfo;
|
_MyItemInfo = args.MyItemInfo;
|
||||||
_MyRTBItem = args.MyRTBItem;
|
_MyEditItem = args.MyEditItem;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_MyItemInfo = null;
|
_MyItemInfo = null;
|
||||||
_MyRTBItem = null;
|
_MyEditItem = null;
|
||||||
}
|
}
|
||||||
if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args);
|
if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args);
|
||||||
}
|
}
|
||||||
@ -213,8 +213,8 @@ namespace Volian.Controls.Library
|
|||||||
void DisplayTabControl_Resize(object sender, EventArgs e)
|
void DisplayTabControl_Resize(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// If the currently selected Item is in a Step, then adjust the scroll as necessary to keep it visible
|
// If the currently selected Item is in a Step, then adjust the scroll as necessary to keep it visible
|
||||||
if (_MyRTBItem != null)
|
if (_MyEditItem != null)
|
||||||
_MyRTBItem.ItemShow();
|
_MyEditItem.ItemShow();
|
||||||
}
|
}
|
||||||
private void SetupBar(Bar myBar)
|
private void SetupBar(Bar myBar)
|
||||||
{
|
{
|
||||||
@ -313,20 +313,20 @@ namespace Volian.Controls.Library
|
|||||||
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
||||||
{
|
{
|
||||||
DisplayTabItem pg = _MyDisplayTabItems[key];
|
DisplayTabItem pg = _MyDisplayTabItems[key];
|
||||||
if (pg.MyStepTabPanel.MyStepPanel._LookupRTBItems.ContainsKey(myItemInfo.ItemID))
|
if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID))
|
||||||
{
|
{
|
||||||
RTBItem stpitm = pg.MyStepTabPanel.MyStepPanel._LookupRTBItems[myItemInfo.ItemID];
|
EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID];
|
||||||
switch (pasteType)
|
switch (pasteType)
|
||||||
{
|
{
|
||||||
case ItemInfo.EAddpingPart.Before:
|
case ItemInfo.EAddpingPart.Before:
|
||||||
stpitm.PasteSiblingBefore(copyStartID);
|
edtitm.PasteSiblingBefore(copyStartID);
|
||||||
break;
|
break;
|
||||||
case ItemInfo.EAddpingPart.After:
|
case ItemInfo.EAddpingPart.After:
|
||||||
stpitm.PasteSiblingAfter(copyStartID);
|
edtitm.PasteSiblingAfter(copyStartID);
|
||||||
break;
|
break;
|
||||||
case ItemInfo.EAddpingPart.Replace:
|
case ItemInfo.EAddpingPart.Replace:
|
||||||
stpitm.PasteReplace(copyStartID);
|
edtitm.PasteReplace(copyStartID);
|
||||||
stpitm.Dispose();
|
edtitm.Dispose();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false; ;
|
return false; ;
|
||||||
@ -354,10 +354,10 @@ namespace Volian.Controls.Library
|
|||||||
CloseTabItem(pg);
|
CloseTabItem(pg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (pg.MyStepTabPanel.MyStepPanel._LookupRTBItems.ContainsKey(myItemInfo.ItemID))
|
if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID))
|
||||||
{
|
{
|
||||||
RTBItem stpitm = pg.MyStepTabPanel.MyStepPanel._LookupRTBItems[myItemInfo.ItemID];
|
EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID];
|
||||||
stpitm.RemoveItem();
|
edtitm.RemoveItem();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -372,19 +372,19 @@ namespace Volian.Controls.Library
|
|||||||
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
||||||
{
|
{
|
||||||
DisplayTabItem pg = _MyDisplayTabItems[key];
|
DisplayTabItem pg = _MyDisplayTabItems[key];
|
||||||
if (pg.MyStepTabPanel.MyStepPanel._LookupRTBItems.ContainsKey(myItemInfo.ItemID))
|
if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID))
|
||||||
{
|
{
|
||||||
RTBItem stpitm = pg.MyStepTabPanel.MyStepPanel._LookupRTBItems[myItemInfo.ItemID];
|
EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID];
|
||||||
switch (insertType)
|
switch (insertType)
|
||||||
{
|
{
|
||||||
case E_InsertType.Before:
|
case E_InsertType.Before:
|
||||||
stpitm.AddSiblingBefore(text,updateSelection);
|
edtitm.AddSiblingBefore(text,updateSelection);
|
||||||
break;
|
break;
|
||||||
case E_InsertType.After:
|
case E_InsertType.After:
|
||||||
stpitm.AddSiblingAfter(text,updateSelection);
|
edtitm.AddSiblingAfter(text,updateSelection);
|
||||||
break;
|
break;
|
||||||
case E_InsertType.Child:
|
case E_InsertType.Child:
|
||||||
stpitm.AddChild(text, fromType, type);
|
edtitm.AddChild(text, fromType, type);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false; ;
|
return false; ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user