This commit is contained in:
Kathy Ruffing 2011-03-01 13:27:32 +00:00
parent 4a118e0a31
commit 25b9449794

View File

@ -22,10 +22,18 @@ namespace Volian.Controls.Library
public delegate bool StepRTBBooleanEvent(object sender, EventArgs args);
public delegate void StepRTBLocationEvent(object sender, StepRTBLocationEventArgs args);
public delegate void StepRTBMouseEvent(object sender, MouseEventArgs args);
public delegate void StepRTBRoEvent(object sender, StepRTBRoEventArgs args);
//public delegate void StepRTBMouseWheelEvent(object sender, MouseEventArgs args);
public partial class StepRTB : RichTextBox // , IStepRTB
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Events
public event StepRTBRoEvent RoInsert;
public void OnRoInsert(object sender, StepRTBRoEventArgs args)
{
if (RoInsert != null) RoInsert(sender, args);
}
public event StepRTBEvent ReturnToEditor;
public void OnReturnToEditor(object sender, EventArgs args)
{
@ -141,6 +149,10 @@ namespace Volian.Controls.Library
}
#endregion
#region Properties and Variables
public bool IsRoTable
{
get { return (Parent is VlnFlexGrid && (Parent as VlnFlexGrid).IsRoTable); }
}
public bool HasVScroll
{
get
@ -584,7 +596,6 @@ namespace Volian.Controls.Library
{
if (ReadOnly) return;
}
public bool inRoAdd = false;
void StepRTB_SelectionChanged(object sender, EventArgs e)
{
//Console.WriteLine("StepRTB_SelectionChanged id= {0}", MyItemInfo.ItemID);
@ -2789,7 +2800,26 @@ namespace Volian.Controls.Library
return Rtf;
}
#endregion
#region RoInsertInterface
public void UpdateStepRtb(string linktxt, string valtxt)
{
int ss = SelectionStart; // Remember where the link is being added
int sl = SelectionLength;
OnReturnToEditor(this, new EventArgs());
Select(ss, sl);
InsertRO(valtxt, linktxt); // Insert the LINK
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
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 = Text.Substring(SelectionStart, SelectionLength);
if (_MyLog.IsInfoEnabled && (linkText.Contains("NewID") || linkText.Contains("CROUSGID")))
_MyLog.InfoFormat("ItemID {0}, LinkText '{1}'", MyItemInfo.ItemID, linkText);
int sel = SelectionStart + SelectionLength;
Select(sel, 0);// Move cursor to end of LINK
Focus();
}
#endregion
#region Debug
private bool _ShowDebug = false;
public bool ShowDebug
@ -2897,6 +2927,47 @@ namespace Volian.Controls.Library
_Location = location;
}
}
public partial class StepRTBRoEventArgs : EventArgs
{
private string _ValText;
public string ValText
{
get { return _ValText; }
set { _ValText = value; }
}
private string _RawValText;
public string RawValText
{
get { return _RawValText; }
set { _RawValText = value; }
}
private string _LinkText;
public string LinkText
{
get { return _LinkText; }
set { _LinkText = value; }
}
private string _ROID;
public string ROID
{
get { return _ROID; }
set { _ROID = value; }
}
private int _RODbID;
public int RODbID
{
get { return _RODbID; }
set { _RODbID = value; }
}
public StepRTBRoEventArgs(string valtext, string rawvaltext, string linktext, string roid, int rodbid)
{
_ValText = valtext;
_RawValText = rawvaltext;
_LinkText = linktext;
_ROID = roid;
_RODbID = rodbid;
}
}
#region LinkLocation Class
public class LinkLocation
{