Object and Property name changes for consistency
This commit is contained in:
@@ -11,8 +11,8 @@ using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
public delegate void DisplayRTBEvent(object sender, EventArgs args);
|
||||
public partial class StepRTB : RichTextBox
|
||||
public delegate void StepRTBEvent(object sender, EventArgs args);
|
||||
public partial class StepRTB : RichTextBox , IStepRTB
|
||||
{
|
||||
#region Properties and Variables
|
||||
// use newer rich text box....
|
||||
@@ -32,6 +32,12 @@ namespace Volian.Controls.Library
|
||||
// return prams;
|
||||
// }
|
||||
//}
|
||||
private StepItem _MyStepItem;
|
||||
public StepItem MyStepItem
|
||||
{
|
||||
get { return _MyStepItem; }
|
||||
set { _MyStepItem = value; }
|
||||
}
|
||||
private bool _IsDirty = false;
|
||||
private bool _InitializingRTB;
|
||||
private IContainer _Container = null;
|
||||
@@ -53,19 +59,19 @@ namespace Volian.Controls.Library
|
||||
get { return _vwMode; }
|
||||
set { _vwMode = value; }
|
||||
}
|
||||
private ItemInfo _MyItem;
|
||||
public ItemInfo MyItem
|
||||
private ItemInfo _MyItemInfo;
|
||||
public ItemInfo MyItemInfo
|
||||
{
|
||||
get { return _MyItem; }
|
||||
get { return _MyItemInfo; }
|
||||
set
|
||||
{
|
||||
_MyItem = value;
|
||||
_MyItemInfo = value;
|
||||
if (value != null)
|
||||
{
|
||||
_InitializingRTB = true;
|
||||
DisplayText vlntxt = new DisplayText(_MyItem, EpMode, VwMode);
|
||||
_origVlnText = vlntxt;
|
||||
Font = _origVlnText.TextFont.WindowsFont;
|
||||
DisplayText vlntxt = new DisplayText(_MyItemInfo, EpMode, VwMode);
|
||||
_origDisplayText = vlntxt;
|
||||
Font = _origDisplayText.TextFont.WindowsFont;
|
||||
AddRtfText(vlntxt);
|
||||
ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
|
||||
RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT);
|
||||
@@ -122,7 +128,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
public System.Windows.Forms.AutoScaleMode AutoScaleMode;
|
||||
private DisplayText _origVlnText;
|
||||
private DisplayText _origDisplayText;
|
||||
private RichTextBox _rtbTemp = new RichTextBox();
|
||||
private string _MyLinkText;
|
||||
|
||||
@@ -134,7 +140,7 @@ namespace Volian.Controls.Library
|
||||
if (value != _MyLinkText)
|
||||
{
|
||||
_MyLinkText = value;
|
||||
OnLinkChanged(this, new LinkClickedEventArgs(_MyLinkText));
|
||||
OnLinkChanged(this, new StepPanelLinkEventArgs(_MyStepItem, _MyLinkText));
|
||||
Console.WriteLine("DisplayRTB - MyLinkText changed {0}", _MyLinkText);
|
||||
}
|
||||
}
|
||||
@@ -170,17 +176,17 @@ namespace Volian.Controls.Library
|
||||
BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.DetectUrls = true;
|
||||
ContextMenuStrip = contextMenuStrip;
|
||||
ContentsResized += new ContentsResizedEventHandler(DisplayRTB_ContentsResized);
|
||||
this.LinkClicked += new LinkClickedEventHandler(DisplayRTB_LinkClicked);
|
||||
this.Click +=new EventHandler(DisplayRTB_Click);
|
||||
this.KeyPress += new KeyPressEventHandler(DisplayRTB_KeyPress);
|
||||
this.KeyUp += new KeyEventHandler(DisplayRTB_KeyUp);
|
||||
this.KeyDown += new KeyEventHandler(DisplayRTB_KeyDown);
|
||||
this.TextChanged += new EventHandler(DisplayRTB_TextChanged);
|
||||
ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized);
|
||||
this.LinkClicked += new LinkClickedEventHandler(StepRTB_LinkClicked);
|
||||
this.Click +=new EventHandler(StepRTB_Click);
|
||||
this.KeyPress += new KeyPressEventHandler(StepRTB_KeyPress);
|
||||
this.KeyUp += new KeyEventHandler(StepRTB_KeyUp);
|
||||
this.KeyDown += new KeyEventHandler(StepRTB_KeyDown);
|
||||
this.TextChanged += new EventHandler(StepRTB_TextChanged);
|
||||
//this.SelectionChanged += new EventHandler(DisplayRTB_SelectionChanged);
|
||||
}
|
||||
|
||||
private void DisplayRTB_Click(object sender, EventArgs e)
|
||||
private void StepRTB_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ReadOnly) return;
|
||||
|
||||
@@ -190,7 +196,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayRTB_SelectionChanged(object sender, EventArgs e)
|
||||
void StepRTB_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
Console.WriteLine("SelectionStart {0}, SelectionLength {1}", SelectionStart, SelectionLength);
|
||||
if (!SelectionProtected && MyLinkText != null)
|
||||
@@ -202,13 +208,13 @@ namespace Volian.Controls.Library
|
||||
#region ApplicationSupport
|
||||
public void ToggleViewEdit()
|
||||
{
|
||||
ItemInfo tmp = MyItem;
|
||||
MyItem = null;
|
||||
ItemInfo tmp = MyItemInfo;
|
||||
MyItemInfo = null;
|
||||
ReadOnly = !ReadOnly;
|
||||
EpMode = ReadOnly ? E_EditPrintMode.Print : E_EditPrintMode.Edit;
|
||||
VwMode = ReadOnly ? E_ViewMode.View : E_ViewMode.Edit;
|
||||
Clear();
|
||||
MyItem = tmp;
|
||||
MyItemInfo = tmp;
|
||||
}
|
||||
public void InsertRO(string value, string link)
|
||||
{
|
||||
@@ -228,14 +234,14 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (ReadOnly) return;
|
||||
if (!_IsDirty) return;
|
||||
bool success = _origVlnText.Save((RichTextBox)this);
|
||||
bool success = _origDisplayText.Save((RichTextBox)this);
|
||||
if (!success) Console.WriteLine("Failed to save text: {0}", this.Text);
|
||||
}
|
||||
#endregion
|
||||
#region AddRtfText
|
||||
private void AddRtfText(DisplayText vlntext)
|
||||
private void AddRtfText(DisplayText myDisplayText)
|
||||
{
|
||||
foreach (displayTextElement vte in vlntext.DisplayTextElementList)
|
||||
foreach (displayTextElement vte in myDisplayText.DisplayTextElementList)
|
||||
{
|
||||
if (vte.Type == E_TextElementType.TEXT)
|
||||
AddRtf(vte);
|
||||
@@ -245,30 +251,30 @@ namespace Volian.Controls.Library
|
||||
AddRtfLink((displayLinkElement)vte);
|
||||
}
|
||||
}
|
||||
private void AddRtf(displayTextElement vte)
|
||||
private void AddRtf(displayTextElement myDisplayTextElement)
|
||||
{
|
||||
SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset2 "+this.Font.FontFamily.Name+@";}}\f0\fs" + this.Font.SizeInPoints*2 + " " + vte.Text + @"}}";
|
||||
SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset2 "+this.Font.FontFamily.Name+@";}}\f0\fs" + this.Font.SizeInPoints*2 + " " + myDisplayTextElement.Text + @"}}";
|
||||
}
|
||||
private void AddRtf(string str)
|
||||
{
|
||||
SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset2 " + this.Font.FontFamily.Name + @";}}\f0\fs" + this.Font.SizeInPoints * 2 + " " + str + @"}}";
|
||||
}
|
||||
private void AddSymbol(displayTextElement vte)
|
||||
private void AddSymbol(displayTextElement myDisplayTextElement)
|
||||
{
|
||||
SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset0 Arial Unicode MS;}}\f0\fs" + this.Font.SizeInPoints * 2 + " " + vte.Text + @"}";
|
||||
SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset0 Arial Unicode MS;}}\f0\fs" + this.Font.SizeInPoints * 2 + " " + myDisplayTextElement.Text + @"}";
|
||||
}
|
||||
private void AddSymbol(string str)
|
||||
{
|
||||
SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset0 Arial Unicode MS;}}\f0\fs" + this.Font.SizeInPoints * 2 + " " + /* ConvertUnicodeChar(str) */ str + @"}";
|
||||
}
|
||||
private void AddRtfLink(displayLinkElement vte)
|
||||
private void AddRtfLink(displayLinkElement myDisplayLinkElement)
|
||||
{
|
||||
if (CreateParams.ClassName == "RICHEDIT50W")
|
||||
|
||||
AddLink50(vte.Text, vte.Link);
|
||||
AddLink50(myDisplayLinkElement.Text, myDisplayLinkElement.Link);
|
||||
else
|
||||
|
||||
AddLink20(vte.Text, vte.Link);
|
||||
AddLink20(myDisplayLinkElement.Text, myDisplayLinkElement.Link);
|
||||
}
|
||||
public void AddRtfLink(string linkUrl, string linkValue)
|
||||
{
|
||||
@@ -305,7 +311,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
#endregion
|
||||
#region HeightSupport
|
||||
public event DisplayRTBEvent HeightChanged;
|
||||
public event StepRTBEvent HeightChanged;
|
||||
private void OnHeightChanged(object sender, EventArgs args)
|
||||
{
|
||||
if (HeightChanged != null) HeightChanged(sender, args);
|
||||
@@ -376,40 +382,40 @@ namespace Volian.Controls.Library
|
||||
#endregion
|
||||
#region EventSupport
|
||||
#region LinkEvents
|
||||
private LinkClickedEventArgs _LinkClickedEventArgs;
|
||||
public event DisplayRTBLinkEvent LinkChanged; // TODO: ?
|
||||
private void OnLinkChanged(object sender, LinkClickedEventArgs args)
|
||||
private StepPanelLinkEventArgs _MyLinkClickedEventArgs;
|
||||
public event StepRTBLinkEvent LinkChanged; // TODO: ?
|
||||
private void OnLinkChanged(object sender, StepPanelLinkEventArgs args)
|
||||
{
|
||||
_LinkClickedEventArgs = args;
|
||||
_MyLinkClickedEventArgs = args;
|
||||
if (LinkChanged != null) LinkChanged(sender, args);
|
||||
}
|
||||
public event DisplayRTBLinkEvent LinkGoTo;
|
||||
private void OnLinkGoTo(object sender, LinkClickedEventArgs args)
|
||||
public event StepRTBLinkEvent LinkGoTo;
|
||||
private void OnLinkGoTo(object sender, StepPanelLinkEventArgs args)
|
||||
{
|
||||
_LinkClickedEventArgs = args;
|
||||
_MyLinkClickedEventArgs = args;
|
||||
if (LinkGoTo != null) LinkGoTo(sender, args);
|
||||
}
|
||||
public event DisplayRTBLinkEvent LinkModifyTran;
|
||||
private void OnLinkModifyTran(object sender, LinkClickedEventArgs args)
|
||||
public event StepRTBLinkEvent LinkModifyTran;
|
||||
private void OnLinkModifyTran(object sender, StepPanelLinkEventArgs args)
|
||||
{
|
||||
_LinkClickedEventArgs = args;
|
||||
_MyLinkClickedEventArgs = args;
|
||||
if (LinkModifyTran != null) LinkModifyTran(sender, args);
|
||||
}
|
||||
public event DisplayRTBLinkEvent LinkModifyRO;
|
||||
private void OnLinkModifyRO(object sender, LinkClickedEventArgs args)
|
||||
public event StepRTBLinkEvent LinkModifyRO;
|
||||
private void OnLinkModifyRO(object sender, StepPanelLinkEventArgs args)
|
||||
{
|
||||
_LinkClickedEventArgs = args;
|
||||
_MyLinkClickedEventArgs = args;
|
||||
if (LinkModifyRO != null) LinkModifyRO(sender, args);
|
||||
}
|
||||
private Point _savcurpos;
|
||||
private void DisplayRTB_LinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e)
|
||||
private void StepRTB_LinkClicked(object sender,LinkClickedEventArgs args)
|
||||
{
|
||||
if (ReadOnly) return;
|
||||
|
||||
_LinkClickedEventArgs = e;
|
||||
_MyLinkClickedEventArgs = new StepPanelLinkEventArgs(_MyStepItem, args.LinkText);
|
||||
_savcurpos = Cursor.Position;
|
||||
SelectLink(e.LinkText);
|
||||
OnLinkChanged(sender, e);
|
||||
SelectLink(args.LinkText);
|
||||
OnLinkChanged(sender, _MyLinkClickedEventArgs);
|
||||
//_savcurpos = Cursor.Position;
|
||||
//if (e.LinkText.IndexOf("ReferencedObject") > -1)
|
||||
// this.contextMenuStripROs.Show(System.Windows.Forms.Cursor.Position);
|
||||
@@ -440,18 +446,18 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
#endregion
|
||||
#region TextOrContents
|
||||
void DisplayRTB_TextChanged(object sender, EventArgs e)
|
||||
void StepRTB_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
_IsDirty = true;
|
||||
}
|
||||
void DisplayRTB_ContentsResized(object sender, ContentsResizedEventArgs e)
|
||||
void StepRTB_ContentsResized(object sender, ContentsResizedEventArgs e)
|
||||
{
|
||||
ContentsRectangle = e.NewRectangle;
|
||||
}
|
||||
#endregion
|
||||
#region KeyboardHandling
|
||||
private bool IsControlChar = false;
|
||||
void DisplayRTB_KeyDown(object sender, KeyEventArgs e)
|
||||
void StepRTB_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Modifiers == Keys.Control)
|
||||
{
|
||||
@@ -467,7 +473,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
void DisplayRTB_KeyUp(object sender, KeyEventArgs e)
|
||||
void StepRTB_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
|
||||
{
|
||||
@@ -514,7 +520,7 @@ namespace Volian.Controls.Library
|
||||
SelectLink();
|
||||
return true;
|
||||
}
|
||||
private void DisplayRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
|
||||
private void StepRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
|
||||
{
|
||||
if (!ReadOnly)
|
||||
{
|
||||
@@ -713,12 +719,12 @@ namespace Volian.Controls.Library
|
||||
if (e.ClickedItem.ToString() == "Delete Transition") DeleteTransition();
|
||||
else if (e.ClickedItem.ToString() == "Modify Transition")
|
||||
{
|
||||
OnLinkModifyTran(sender, _LinkClickedEventArgs);
|
||||
OnLinkModifyTran(sender, _MyLinkClickedEventArgs);
|
||||
}
|
||||
else if (e.ClickedItem.ToString() == "Go To")
|
||||
{
|
||||
Console.WriteLine("DisplayRTB:contextMenu:Go TO");
|
||||
OnLinkGoTo(sender, _LinkClickedEventArgs);
|
||||
OnLinkGoTo(sender, _MyLinkClickedEventArgs);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -741,7 +747,7 @@ namespace Volian.Controls.Library
|
||||
private void contextMenuStripROs_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
||||
{
|
||||
if (e.ClickedItem.ToString() == "Delete RO") DeleteRefObj();
|
||||
else if (e.ClickedItem.ToString() == "Modify RO") OnLinkModifyRO(sender, _LinkClickedEventArgs);
|
||||
else if (e.ClickedItem.ToString() == "Modify RO") OnLinkModifyRO(sender, _MyLinkClickedEventArgs);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Reference in New Issue
Block a user