This commit is contained in:
parent
0fa130eb77
commit
e290df0fdb
@ -24,6 +24,24 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args);
|
||||
}
|
||||
public event DisplayPanelLinkEvent LinkActiveChanged;
|
||||
internal void OnLinkActiveChanged(object sender, DisplayLinkEventArgs args)
|
||||
{
|
||||
if (LinkActiveChanged != null) LinkActiveChanged(sender, args);
|
||||
else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Active Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
public event DisplayPanelLinkEvent LinkInsertTran;
|
||||
internal void OnLinkInsertTran(object sender, DisplayLinkEventArgs args)
|
||||
{
|
||||
if (LinkInsertTran != null) LinkInsertTran(sender, args);
|
||||
else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Insert Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
public event DisplayPanelLinkEvent LinkInsertRO;
|
||||
internal void OnLinkInsertRO(object sender, DisplayLinkEventArgs args)
|
||||
{
|
||||
if (LinkInsertRO != null) LinkInsertRO(sender, args);
|
||||
else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Insert RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
public event DisplayPanelLinkEvent LinkClicked;
|
||||
internal void OnLinkClicked(object sender, DisplayLinkEventArgs args)
|
||||
{
|
||||
@ -573,6 +591,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (_Type == ParsedLinkType.NotParsed)
|
||||
{
|
||||
if (_LinkInfo == null) return;
|
||||
// First parse the string
|
||||
Match m = Regex.Match(_LinkInfo.LinkText, ".*[#]Link:([A-Za-z]*):(.*)");
|
||||
switch (m.Groups[1].Value)
|
||||
@ -587,12 +606,13 @@ namespace Volian.Controls.Library
|
||||
_Type = (ParsedLinkType)Enum.Parse(_Type.GetType(), m.Groups[1].Value);
|
||||
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("Link String - '{0}'", m.Groups[2].Value);
|
||||
int transitionID = Convert.ToInt32(m.Groups[2].Value.Split(" ".ToCharArray())[1]);
|
||||
foreach (TransitionInfo ti in _LinkedRTB.MyItem.MyContent.ContentTransitions)
|
||||
{
|
||||
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("Transition ID = '{0}'", ti.TransitionID);
|
||||
if (ti.TransitionID == transitionID)
|
||||
_MyTransition = ti;
|
||||
}
|
||||
_MyTransition = TransitionInfo.Get(transitionID);
|
||||
//foreach (TransitionInfo ti in _LinkedRTB.MyItem.MyContent.ContentTransitions)
|
||||
//{
|
||||
// if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("Transition ID = '{0}'", ti.TransitionID);
|
||||
// if (ti.TransitionID == transitionID)
|
||||
// _MyTransition = ti;
|
||||
//}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,9 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
get { return _MyROFST; }
|
||||
set
|
||||
{
|
||||
_MyROFST = value;
|
||||
{
|
||||
if (!Visible) return; // don't reset anything if the form is invisible.
|
||||
_MyROFST = value; // define the tree nodes based on this rofst
|
||||
LoadTree();
|
||||
}
|
||||
}
|
||||
@ -29,26 +30,50 @@ namespace Volian.Controls.Library
|
||||
get { return _CurROLink; }
|
||||
set
|
||||
{
|
||||
_CurROLink = value;
|
||||
if (_CurROLink != null)
|
||||
if (!Visible) return; // don't reset anything if the form is invisible.
|
||||
if (value != null) // modify - set the controls to the current ro
|
||||
{
|
||||
if (_CurROLink == value) return;
|
||||
_CurROLink = value;
|
||||
UpdateROTree();
|
||||
_SavCurROLink = _CurROLink;
|
||||
}
|
||||
else // insert - clear out controls
|
||||
{
|
||||
_CurROLink = value;
|
||||
tbROValue.Text = null;
|
||||
tvROFST.SelectedNode = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
private string _SavCurROLink;
|
||||
private ItemInfo _CurItem;
|
||||
public ItemInfo CurItem
|
||||
{
|
||||
get { return _CurItem; }
|
||||
set { _CurItem = value; }
|
||||
}
|
||||
private DisplayRTB _MyRTB;
|
||||
public DisplayRTB MyRTB
|
||||
{
|
||||
get { return _MyRTB; }
|
||||
set { _MyRTB = value; }
|
||||
set
|
||||
{
|
||||
if (!Visible) return;
|
||||
if (_MyRTB != null)
|
||||
_MyRTB.LinkChanged -= new DisplayRTBLinkEvent(_MyRTB_LinkChanged);
|
||||
if (value == null) return;
|
||||
_MyRTB = value;
|
||||
_MyRTB.LinkChanged += new DisplayRTBLinkEvent(_MyRTB_LinkChanged);
|
||||
if (_MyRTB.MyLinkText == null)
|
||||
{
|
||||
_CurROLink = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
void _MyRTB_LinkChanged(object sender, LinkClickedEventArgs e)
|
||||
{
|
||||
if (_MyRTB.MyLinkText == null)
|
||||
CurROLink = null;
|
||||
else
|
||||
{
|
||||
DisplayLinkEventArgs tmp = new DisplayLinkEventArgs(null, e);
|
||||
CurROLink = tmp.RoUsageid;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Constructors
|
||||
@ -56,14 +81,6 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
//public DisplayRO(ROFST rofst, ItemInfo curitm, bool modify, DisplayRTB rtb)
|
||||
//{
|
||||
// _MyROFST = rofst;
|
||||
// _CurItem = curitm;
|
||||
// _MyRTB = rtb;
|
||||
// InitializeComponent();
|
||||
// LoadTree();
|
||||
//}
|
||||
#endregion
|
||||
#region Events
|
||||
private void tvROFST_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
@ -113,7 +130,9 @@ namespace Volian.Controls.Library
|
||||
// if this is a group, i.e. type 0, add a dummy node
|
||||
if (chld[i].type == 0 && chld[i].children == null)
|
||||
//skip it.
|
||||
Console.WriteLine("ro junk");
|
||||
// TODO: KBR how to handle this?
|
||||
//Console.WriteLine("ro junk");
|
||||
continue;
|
||||
else if (chld[i].type == 1 && chld[i].value == null)
|
||||
{
|
||||
tmp = new TreeNode(chld[i].title);
|
||||
@ -135,6 +154,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (_MyROFST == null) return;
|
||||
if (_MyROFST == _CurROFST) return;
|
||||
tvROFST.Nodes.Clear();
|
||||
_CurROFST = _MyROFST;
|
||||
for (int i = 0; i < _MyROFST.myHdr.myDbs.Length; i++)
|
||||
{
|
||||
@ -223,12 +243,11 @@ namespace Volian.Controls.Library
|
||||
_MyRTB.InsertRO(tbROValue.Text, linktxt);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void btnCancelRO_Click(object sender, EventArgs e)
|
||||
{
|
||||
_CurROLink = _SavCurROLink;
|
||||
UpdateROTree();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,21 @@ namespace Volian.Controls.Library
|
||||
public System.Windows.Forms.AutoScaleMode AutoScaleMode;
|
||||
private DisplayText _origVlnText;
|
||||
private RichTextBox _rtbTemp = new RichTextBox();
|
||||
private string _eLinkText;
|
||||
private string _MyLinkText;
|
||||
|
||||
public string MyLinkText
|
||||
{
|
||||
get { return _MyLinkText; }
|
||||
set
|
||||
{
|
||||
if (value != _MyLinkText)
|
||||
{
|
||||
_MyLinkText = value;
|
||||
OnLinkChanged(this, new LinkClickedEventArgs(_MyLinkText));
|
||||
Console.WriteLine("DisplayRTB - MyLinkText changed {0}", _MyLinkText);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Constructors
|
||||
/// <summary>
|
||||
@ -158,10 +172,31 @@ namespace Volian.Controls.Library
|
||||
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);
|
||||
//this.SelectionChanged += new EventHandler(DisplayRTB_SelectionChanged);
|
||||
}
|
||||
|
||||
private void DisplayRTB_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ReadOnly) return;
|
||||
|
||||
if (!SelectionProtected)
|
||||
{
|
||||
MyLinkText = null;
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayRTB_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
Console.WriteLine("SelectionStart {0}, SelectionLength {1}", SelectionStart, SelectionLength);
|
||||
if (!SelectionProtected && MyLinkText != null)
|
||||
MyLinkText = null;
|
||||
// TODO: Else Set mylinktext to what is currently selected (null if not on link, otherwise link info)
|
||||
// TODO: Raise event if moving on (modify) or moving off (insert)
|
||||
}
|
||||
#endregion
|
||||
#region ApplicationSupport
|
||||
@ -342,6 +377,12 @@ namespace Volian.Controls.Library
|
||||
#region EventSupport
|
||||
#region LinkEvents
|
||||
private LinkClickedEventArgs _LinkClickedEventArgs;
|
||||
public event DisplayRTBLinkEvent LinkChanged; // TODO: ?
|
||||
private void OnLinkChanged(object sender, LinkClickedEventArgs args)
|
||||
{
|
||||
_LinkClickedEventArgs = args;
|
||||
if (LinkChanged != null) LinkChanged(sender, args);
|
||||
}
|
||||
public event DisplayRTBLinkEvent LinkGoTo;
|
||||
private void OnLinkGoTo(object sender, LinkClickedEventArgs args)
|
||||
{
|
||||
@ -364,28 +405,38 @@ namespace Volian.Controls.Library
|
||||
private void DisplayRTB_LinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e)
|
||||
{
|
||||
if (ReadOnly) return;
|
||||
|
||||
_LinkClickedEventArgs = e;
|
||||
_eLinkText = e.LinkText;
|
||||
_savcurpos = Cursor.Position;
|
||||
if (e.LinkText.IndexOf("ReferencedObject") > -1)
|
||||
this.contextMenuStripROs.Show(System.Windows.Forms.Cursor.Position);
|
||||
else
|
||||
this.contextMenuStripTrans.Show(System.Windows.Forms.Cursor.Position);
|
||||
SelectLink(e.LinkText);
|
||||
OnLinkChanged(sender, e);
|
||||
//_savcurpos = Cursor.Position;
|
||||
//if (e.LinkText.IndexOf("ReferencedObject") > -1)
|
||||
// this.contextMenuStripROs.Show(System.Windows.Forms.Cursor.Position);
|
||||
//else
|
||||
// this.contextMenuStripTrans.Show(System.Windows.Forms.Cursor.Position);
|
||||
}
|
||||
private void SelectLink(string LinkText)
|
||||
{
|
||||
Point cp = PointToClient(_savcurpos);
|
||||
int index = GetCharIndexFromPosition(cp);
|
||||
int iMax = index;
|
||||
//int iMax = index;
|
||||
//int iMin = index;
|
||||
//Select(index, 0);
|
||||
|
||||
//while (iMin > 0 && SelectionProtected)
|
||||
// Select(--iMin, 0);
|
||||
//Select(iMin + 1, 0);
|
||||
//SelectLink();
|
||||
////SelectionProtected = false; // unprotect link only if deleted
|
||||
//MyLinkText = SelectedText;
|
||||
//int index = SelectionStart;
|
||||
int iMin = index;
|
||||
Select(index, 0);
|
||||
|
||||
while (iMin > 0 && SelectionProtected)
|
||||
Select(--iMin, 0);
|
||||
|
||||
Select(iMin - 1, 1 + LinkText.Length);
|
||||
SelectionProtected = false;
|
||||
Select(iMin, LinkText.Length);
|
||||
Select(iMin + 1, 0);
|
||||
SelectLink();
|
||||
}
|
||||
#endregion
|
||||
#region TextOrContents
|
||||
@ -426,26 +477,41 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
e.Handled = HandleRightArrow();
|
||||
}
|
||||
|
||||
}
|
||||
private bool HandleRightArrow()
|
||||
private void SelectLink()
|
||||
{
|
||||
if (!SelectionProtected) return false;
|
||||
int index = SelectionStart;
|
||||
int iMax = index;
|
||||
Select(index, 0);
|
||||
while (iMax < TextLength && SelectionProtected)
|
||||
Select(++iMax, 0);
|
||||
Select(index - 1, SelectionStart + 1 - index);
|
||||
MyLinkText = SelectedText;
|
||||
}
|
||||
private bool HandleRightArrow()
|
||||
{
|
||||
if (!SelectionProtected)
|
||||
{
|
||||
MyLinkText = null;
|
||||
return false;
|
||||
}
|
||||
SelectLink();
|
||||
return true;
|
||||
}
|
||||
private bool HandleLUDArrows()
|
||||
{
|
||||
if (!SelectionProtected) return false;
|
||||
if (!SelectionProtected)
|
||||
{
|
||||
MyLinkText = null;
|
||||
return false;
|
||||
}
|
||||
int index = this.SelectionStart;
|
||||
int iMin = index;
|
||||
Select(index, 0);
|
||||
while (iMin > 0 && SelectionProtected)
|
||||
Select(--iMin, 0);
|
||||
Select(iMin + 1, 0);
|
||||
SelectLink();
|
||||
return true;
|
||||
}
|
||||
private void DisplayRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
|
||||
@ -639,7 +705,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
private void DeleteTransition()
|
||||
{
|
||||
SelectLink(_eLinkText);
|
||||
SelectLink(_MyLinkText);
|
||||
SelectedText = "";
|
||||
}
|
||||
private void contextMenuStripTrans_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
||||
@ -669,7 +735,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
private void DeleteRefObj()
|
||||
{
|
||||
SelectLink(_eLinkText);
|
||||
SelectLink(_MyLinkText);
|
||||
SelectedText = "";
|
||||
}
|
||||
private void contextMenuStripROs_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
||||
|
@ -20,6 +20,24 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (ItemClick != null) ItemClick(sender, args);
|
||||
}
|
||||
public event DisplayPanelLinkEvent LinkActiveChanged;
|
||||
internal void OnLinkActiveChanged(object sender, DisplayLinkEventArgs args)
|
||||
{
|
||||
if (LinkActiveChanged != null) LinkActiveChanged(sender, args);
|
||||
else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Active Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
public event DisplayPanelLinkEvent LinkInsertTran;
|
||||
internal void OnLinkInsertTran(object sender, DisplayLinkEventArgs args)
|
||||
{
|
||||
if (LinkInsertTran != null) LinkInsertTran(sender, args);
|
||||
else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Insert Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
public event DisplayPanelLinkEvent LinkInsertRO;
|
||||
internal void OnLinkInsertRO(object sender, DisplayLinkEventArgs args)
|
||||
{
|
||||
if (LinkInsertRO != null) LinkInsertRO(sender, args);
|
||||
else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Insert RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
public event DisplayPanelLinkEvent LinkModifyTran;
|
||||
internal void OnLinkModifyTran(object sender, DisplayLinkEventArgs args)
|
||||
{
|
||||
|
@ -12,6 +12,12 @@ namespace Volian.Controls.Library
|
||||
public partial class DisplayTabPanel : DevComponents.DotNetBar.PanelDockContainer
|
||||
{
|
||||
private DisplayTabControl _MyTabControl;
|
||||
|
||||
public DisplayTabControl MyTabControl
|
||||
{
|
||||
get { return _MyTabControl; }
|
||||
set { _MyTabControl = value; }
|
||||
}
|
||||
private DisplayTabRibbon _MyTabRibbon;
|
||||
private Volian.Controls.Library.DisplayPanel _MyPanel;
|
||||
public Volian.Controls.Library.DisplayPanel MyPanel
|
||||
@ -78,12 +84,27 @@ namespace Volian.Controls.Library
|
||||
_MyPanel.AutoScroll = true;
|
||||
_MyPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
_MyPanel.LinkClicked +=new Volian.Controls.Library.DisplayPanelLinkEvent(_MyPanel_LinkClicked);
|
||||
_MyPanel.LinkActiveChanged += new Volian.Controls.Library.DisplayPanelLinkEvent(_MyPanel_LinkActiveChanged);
|
||||
_MyPanel.LinkInsertTran += new DisplayPanelLinkEvent(_MyPanel_LinkInsertTran);
|
||||
_MyPanel.LinkInsertRO += new DisplayPanelLinkEvent(_MyPanel_LinkInsertRO);
|
||||
_MyPanel.LinkModifyTran += new DisplayPanelLinkEvent(_MyPanel_LinkModifyTran);
|
||||
_MyPanel.LinkModifyRO += new DisplayPanelLinkEvent(_MyPanel_LinkModifyRO);
|
||||
_MyPanel.ItemClick +=new Volian.Controls.Library.DisplayPanelEvent(_MyPanel_ItemClick);
|
||||
_MyPanel.AttachmentClicked += new Volian.Controls.Library.DisplayPanelAttachmentEvent(_MyPanel_AttachmentClicked);
|
||||
_MyPanel.ItemSelectedChanged += new DisplayPanelEvent(_MyPanel_ItemSelectedChanged);
|
||||
}
|
||||
void _MyPanel_LinkActiveChanged(object sender, DisplayLinkEventArgs args)
|
||||
{
|
||||
_MyTabControl.OnLinkActiveChanged(sender, args);
|
||||
}
|
||||
void _MyPanel_LinkInsertTran(object sender, DisplayLinkEventArgs args)
|
||||
{
|
||||
_MyTabControl.OnLinkInsertTran(sender, args);
|
||||
}
|
||||
void _MyPanel_LinkInsertRO(object sender, DisplayLinkEventArgs args)
|
||||
{
|
||||
_MyTabControl.OnLinkInsertRO(sender, args);
|
||||
}
|
||||
void _MyPanel_LinkModifyTran(object sender, DisplayLinkEventArgs args)
|
||||
{
|
||||
_MyTabControl.OnLinkModifyTran(sender, args);
|
||||
|
Loading…
x
Reference in New Issue
Block a user