diff --git a/PROMS/VEPROMS User Interface/Properties/Settings.Designer.cs b/PROMS/VEPROMS User Interface/Properties/Settings.Designer.cs index 6626e4b7..e0f23034 100644 --- a/PROMS/VEPROMS User Interface/Properties/Settings.Designer.cs +++ b/PROMS/VEPROMS User Interface/Properties/Settings.Designer.cs @@ -124,5 +124,17 @@ namespace VEPROMS.Properties { this["MRIList"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("192, 255, 255")] + public global::System.Drawing.Color TransitionRangeColor { + get { + return ((global::System.Drawing.Color)(this["TransitionRangeColor"])); + } + set { + this["TransitionRangeColor"] = value; + } + } } } diff --git a/PROMS/Volian.Controls.Library/DisplayItem.cs b/PROMS/Volian.Controls.Library/DisplayItem.cs index 0903896b..7b1b9943 100644 --- a/PROMS/Volian.Controls.Library/DisplayItem.cs +++ b/PROMS/Volian.Controls.Library/DisplayItem.cs @@ -977,5 +977,10 @@ namespace Volian.Controls.Library { _Panel.OnLinkModifyTran(sender, new DisplayLinkEventArgs(this, e)); } + + private void _DisplayRTB_LinkModifyRO(object sender, LinkClickedEventArgs e) + { + _Panel.OnLinkModifyRO(sender, new DisplayLinkEventArgs(this, e)); + } } } diff --git a/PROMS/Volian.Controls.Library/DisplayItem.designer.cs b/PROMS/Volian.Controls.Library/DisplayItem.designer.cs index a5aebb0e..172a8506 100644 --- a/PROMS/Volian.Controls.Library/DisplayItem.designer.cs +++ b/PROMS/Volian.Controls.Library/DisplayItem.designer.cs @@ -65,6 +65,7 @@ namespace Volian.Controls.Library this._DisplayRTB.LinkGoTo += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkGoTo); this._DisplayRTB.HeightChanged += new Volian.Controls.Library.DisplayRTBEvent(this.veRichTextBoxText_HeightChanged); this._DisplayRTB.LinkModifyTran += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkModifyTran); + this._DisplayRTB.LinkModifyRO += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkModifyRO); // // vlnExp // diff --git a/PROMS/Volian.Controls.Library/DisplayPanel.cs b/PROMS/Volian.Controls.Library/DisplayPanel.cs index 2a2defd6..6dc272c0 100644 --- a/PROMS/Volian.Controls.Library/DisplayPanel.cs +++ b/PROMS/Volian.Controls.Library/DisplayPanel.cs @@ -36,6 +36,12 @@ namespace Volian.Controls.Library if (LinkModifyTran != null) LinkModifyTran(sender, args); else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Modify Tran", MessageBoxButtons.OK, MessageBoxIcon.Information); } + public event DisplayPanelLinkEvent LinkModifyRO; + internal void OnLinkModifyRO(object sender, DisplayLinkEventArgs args) + { + if (LinkModifyRO != null) LinkModifyRO(sender, args); + else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Modify RO", MessageBoxButtons.OK, MessageBoxIcon.Information); + } public event DisplayPanelAttachmentEvent AttachmentClicked; internal void OnAttachmentClicked(object sender, DisplayPanelAttachmentEventArgs args) { @@ -167,7 +173,7 @@ namespace Volian.Controls.Library if (_DisplayRTB != null) { _DisplayRTB.BackColor = InactiveColor; - //_DisplayRTB.SaveText(); // Save any changes to the text + _DisplayRTB.SaveText(); // Save any changes to the text } _DisplayRTB = value; if (_ItemSelected.ItemID != value.MyItem.ItemID) diff --git a/PROMS/Volian.Controls.Library/DisplayRO.Designer.cs b/PROMS/Volian.Controls.Library/DisplayRO.Designer.cs index c7e0c2d2..115c031f 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.Designer.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.Designer.cs @@ -30,11 +30,14 @@ namespace Volian.Controls.Library { this.tvROFST = new System.Windows.Forms.TreeView(); this.panelValue = new System.Windows.Forms.Panel(); + this.pnlROButtons = new System.Windows.Forms.Panel(); + this.btnCancelRO = new DevComponents.DotNetBar.ButtonX(); + this.btnSaveRO = new DevComponents.DotNetBar.ButtonX(); this.panelRoValue = new System.Windows.Forms.Panel(); this.tbROValue = new DevComponents.DotNetBar.Controls.TextBoxX(); this.lblROValue = new DevComponents.DotNetBar.LabelX(); - this.btnInsertRO = new DevComponents.DotNetBar.ButtonX(); this.panelValue.SuspendLayout(); + this.pnlROButtons.SuspendLayout(); this.panelRoValue.SuspendLayout(); this.SuspendLayout(); // @@ -43,6 +46,7 @@ namespace Volian.Controls.Library this.tvROFST.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.tvROFST.HideSelection = false; this.tvROFST.Location = new System.Drawing.Point(0, 52); this.tvROFST.Name = "tvROFST"; this.tvROFST.Size = new System.Drawing.Size(226, 455); @@ -52,14 +56,48 @@ namespace Volian.Controls.Library // // panelValue // + this.panelValue.Controls.Add(this.pnlROButtons); this.panelValue.Controls.Add(this.panelRoValue); - this.panelValue.Controls.Add(this.btnInsertRO); this.panelValue.Dock = System.Windows.Forms.DockStyle.Top; this.panelValue.Location = new System.Drawing.Point(0, 0); this.panelValue.Name = "panelValue"; this.panelValue.Size = new System.Drawing.Size(226, 53); this.panelValue.TabIndex = 7; // + // pnlROButtons + // + this.pnlROButtons.Controls.Add(this.btnCancelRO); + this.pnlROButtons.Controls.Add(this.btnSaveRO); + this.pnlROButtons.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlROButtons.Location = new System.Drawing.Point(0, 25); + this.pnlROButtons.Name = "pnlROButtons"; + this.pnlROButtons.Size = new System.Drawing.Size(226, 28); + this.pnlROButtons.TabIndex = 9; + // + // btnCancelRO + // + this.btnCancelRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnCancelRO.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnCancelRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.btnCancelRO.Location = new System.Drawing.Point(142, 0); + this.btnCancelRO.Name = "btnCancelRO"; + this.btnCancelRO.Size = new System.Drawing.Size(84, 27); + this.btnCancelRO.TabIndex = 9; + this.btnCancelRO.Text = "Cancel"; + this.btnCancelRO.Click += new System.EventHandler(this.btnCancelRO_Click); + // + // btnSaveRO + // + this.btnSaveRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnSaveRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.btnSaveRO.Dock = System.Windows.Forms.DockStyle.Left; + this.btnSaveRO.Location = new System.Drawing.Point(0, 0); + this.btnSaveRO.Name = "btnSaveRO"; + this.btnSaveRO.Size = new System.Drawing.Size(78, 28); + this.btnSaveRO.TabIndex = 8; + this.btnSaveRO.Text = "Save RO"; + this.btnSaveRO.Click += new System.EventHandler(this.btnSaveRO_Click); + // // panelRoValue // this.panelRoValue.Controls.Add(this.tbROValue); @@ -72,15 +110,14 @@ namespace Volian.Controls.Library // // tbROValue // - this.tbROValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); // // // this.tbROValue.Border.Class = "TextBoxBorder"; - this.tbROValue.Location = new System.Drawing.Point(54, 0); + this.tbROValue.Dock = System.Windows.Forms.DockStyle.Fill; + this.tbROValue.Location = new System.Drawing.Point(59, 0); this.tbROValue.Name = "tbROValue"; - this.tbROValue.Size = new System.Drawing.Size(167, 25); + this.tbROValue.Size = new System.Drawing.Size(167, 20); this.tbROValue.TabIndex = 7; // // lblROValue @@ -92,17 +129,6 @@ namespace Volian.Controls.Library this.lblROValue.TabIndex = 6; this.lblROValue.Text = "RO Value:"; // - // btnInsertRO - // - this.btnInsertRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnInsertRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnInsertRO.Dock = System.Windows.Forms.DockStyle.Bottom; - this.btnInsertRO.Location = new System.Drawing.Point(0, 27); - this.btnInsertRO.Name = "btnInsertRO"; - this.btnInsertRO.Size = new System.Drawing.Size(226, 26); - this.btnInsertRO.TabIndex = 7; - this.btnInsertRO.Text = "Select RO"; - // // DisplayRO // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -112,6 +138,7 @@ namespace Volian.Controls.Library this.Name = "DisplayRO"; this.Size = new System.Drawing.Size(226, 507); this.panelValue.ResumeLayout(false); + this.pnlROButtons.ResumeLayout(false); this.panelRoValue.ResumeLayout(false); this.ResumeLayout(false); @@ -121,9 +148,11 @@ namespace Volian.Controls.Library private System.Windows.Forms.TreeView tvROFST; private System.Windows.Forms.Panel panelValue; - private DevComponents.DotNetBar.ButtonX btnInsertRO; private System.Windows.Forms.Panel panelRoValue; private DevComponents.DotNetBar.Controls.TextBoxX tbROValue; private DevComponents.DotNetBar.LabelX lblROValue; + private System.Windows.Forms.Panel pnlROButtons; + private DevComponents.DotNetBar.ButtonX btnCancelRO; + private DevComponents.DotNetBar.ButtonX btnSaveRO; } } diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index ace5a4cb..8dab83b6 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -12,6 +12,7 @@ namespace Volian.Controls.Library public partial class DisplayRO : UserControl { #region Properties + private ROFST _CurROFST = null; private ROFST _MyROFST; public ROFST MyROFST { @@ -22,12 +23,21 @@ namespace Volian.Controls.Library LoadTree(); } } - private bool _Modify = false; - public bool Modify + private string _CurROLink; + public string CurROLink { - get { return _Modify; } - set { _Modify = value; } + get { return _CurROLink; } + set + { + _CurROLink = value; + if (_CurROLink != null) + { + UpdateROTree(); + _SavCurROLink = _CurROLink; + } + } } + private string _SavCurROLink; private ItemInfo _CurItem; public ItemInfo CurItem { @@ -35,7 +45,6 @@ namespace Volian.Controls.Library set { _CurItem = value; } } private DisplayRTB _MyRTB; - public DisplayRTB MyRTB { get { return _MyRTB; } @@ -47,15 +56,14 @@ namespace Volian.Controls.Library { InitializeComponent(); } - public DisplayRO(ROFST rofst, ItemInfo curitm, bool modify, DisplayRTB rtb) - { - _MyROFST = rofst; - _CurItem = curitm; - _Modify = modify; - _MyRTB = rtb; - InitializeComponent(); - LoadTree(); - } + //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) @@ -77,6 +85,7 @@ namespace Volian.Controls.Library private void LoadChildren(TreeNode tn) { object tag = tn.Tag; + if (tn.FirstNode != null && tn.FirstNode.Text != "VLN_DUMMY_FOR_TREE") return; // already loaded. if (tn.FirstNode != null && tn.FirstNode.Text == "VLN_DUMMY_FOR_TREE") tn.FirstNode.Remove(); ROFST.rochild[] chld = null; @@ -125,6 +134,8 @@ namespace Volian.Controls.Library private void LoadTree() { if (_MyROFST == null) return; + if (_MyROFST == _CurROFST) return; + _CurROFST = _MyROFST; for (int i = 0; i < _MyROFST.myHdr.myDbs.Length; i++) { TreeNode tn = new TreeNode(_MyROFST.myHdr.myDbs[i].dbiTitle); @@ -141,7 +152,63 @@ namespace Volian.Controls.Library tn.Nodes.Add(tmp); } } - private void btnInsertRO_Click(object sender, EventArgs e) + private void UpdateROTree() + { + // walk down from root of tree, expanding values in the string + // that represents the ro link. + string tmpstr = _CurROLink; + int sp = tmpstr.IndexOf(" "); // because parse of ro info is wrong!! + int rousageid = System.Convert.ToInt32(tmpstr.Substring(0, sp)); + string roid = tmpstr.Substring(sp + 1, tmpstr.Length - sp - 1); + string db = roid.Substring(0, 4); + + ROFST.rochild rochld = MyROFST.GetRoChild(roid.Substring(0, 12).ToUpper()); + // use this to walk up tree until database - this is used to expand tree. + List path = new List(); + int myid = rochld.ID; + while (myid > 0) + { + path.Insert(0,myid); + myid = rochld.ParentID; + rochld = MyROFST.GetRoChildFromID(myid); + if (rochld.ID == -1) myid = -1; + } + TreeNode tnExpand = null; + int titm = System.Convert.ToInt32(db); + // find database first + foreach (TreeNode tn in tvROFST.Nodes) + { + ROFST.rodbi thisdb = (ROFST.rodbi)tn.Tag; + if (thisdb.dbiID == titm) + { + LoadChildren(tn); + tnExpand = tn; + break; + } + } + if (tnExpand == null) return; // something went wrong? + // use the path id list to load/find the treeview's nodes. + foreach (int citm in path) + { + if (citm != System.Convert.ToInt32(db)) + { + LoadChildren(tnExpand); + tnExpand.Expand(); + foreach (TreeNode tn in tnExpand.Nodes) + { + ROFST.rochild chld = (ROFST.rochild)tn.Tag; + if (chld.ID == citm) + { + tnExpand = tn; + break; + } + } + } + } + + if (tnExpand != null) tvROFST.SelectedNode = tnExpand; + } + private void btnSaveRO_Click(object sender, EventArgs e) { if (tbROValue.Text == null || tbROValue.Text == "") { @@ -157,5 +224,11 @@ namespace Volian.Controls.Library } } #endregion + + private void btnCancelRO_Click(object sender, EventArgs e) + { + _CurROLink = _SavCurROLink; + UpdateROTree(); + } } } diff --git a/PROMS/Volian.Controls.Library/DisplayRTB.cs b/PROMS/Volian.Controls.Library/DisplayRTB.cs index 46975a6f..800c141c 100644 --- a/PROMS/Volian.Controls.Library/DisplayRTB.cs +++ b/PROMS/Volian.Controls.Library/DisplayRTB.cs @@ -32,6 +32,8 @@ namespace Volian.Controls.Library // return prams; // } //} + private bool _IsDirty = false; + private bool _InitializingRTB; private IContainer _Container = null; private string _MyClassName=string.Empty; public string MyClassName @@ -60,12 +62,15 @@ namespace Volian.Controls.Library _MyItem = value; if (value != null) { + _InitializingRTB = true; DisplayText vlntxt = new DisplayText(_MyItem, EpMode, VwMode); _origVlnText = vlntxt; Font = _origVlnText.TextFont.WindowsFont; AddRtfText(vlntxt); ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit); RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT); + _InitializingRTB = false; + _IsDirty = false; } } } @@ -121,22 +126,6 @@ namespace Volian.Controls.Library private RichTextBox _rtbTemp = new RichTextBox(); private string _eLinkText; #endregion - #region HeightSupport - public event DisplayRTBEvent HeightChanged; - private void OnHeightChanged(object sender, EventArgs args) - { - if (HeightChanged != null) HeightChanged(sender, args); - } - private void AdjustSizeForContents() - { - //Console.WriteLine("Size {0} Client {1} New {2}", Size, ClientRectangle, ContentsRectangle); - // I want the client size to match the new rectangle. - // First I need to determine the offset - Size offset = Size - ClientSize; - this.Size = ContentsSize + offset + AdjustSize; - OnHeightChanged(this, new EventArgs()); - } - #endregion #region Constructors /// /// vlnRichTextBox constructor: @@ -150,36 +139,6 @@ namespace Volian.Controls.Library /// E_EditPrintMode ep_mode - edit or print. /// E_ViewMode vw_mode - view or edit. /// - public DisplayRTB(string txtbxname, ItemInfo itemInfo, int x, int y, int iwid, int tbindx, E_EditPrintMode epMode, E_ViewMode vwMode) - { - try - { - EpMode = epMode; - VwMode = vwMode; - DisplayText vlntxt = new DisplayText(itemInfo, epMode, vwMode); - _origVlnText = vlntxt; - InitializeComponent(); - Location = new System.Drawing.Point(x, y); - Name = txtbxname; - DetectUrls = false; - // TODO: RHM20071115 Font = _origVlnText.TextFont.WindowsFont; - ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; - Width = iwid; - ContentsResized += new ContentsResizedEventHandler(vlnRichTextBox_ContentsResized); - AddRtfText(vlntxt); - //ContextMenuStrip = contextMenuStrip; - ReadOnly = !(epMode == E_EditPrintMode.Edit && vwMode == E_ViewMode.Edit); - RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT); - this.LinkClicked += new LinkClickedEventHandler(onLinkClicked); - this.KeyPress += new KeyPressEventHandler(onKeyPress); - this.KeyDown += new KeyEventHandler(onKeyDown); - //this.Leave += new EventHandler(DisplayRTB_Leave); - } - catch (Exception ex) - { - Console.WriteLine("Error in creating vlnRichTextBox: " + ex.Message); - } - } public DisplayRTB() { InitializeComponent(); @@ -197,11 +156,12 @@ namespace Volian.Controls.Library BorderStyle = System.Windows.Forms.BorderStyle.None; this.DetectUrls = true; ContextMenuStrip = contextMenuStrip; - ContentsResized += new ContentsResizedEventHandler(vlnRichTextBox_ContentsResized); - this.LinkClicked += new LinkClickedEventHandler(onLinkClicked); - this.KeyPress += new KeyPressEventHandler(onKeyPress); - this.KeyDown += new KeyEventHandler(onKeyDown); - //this.Leave += new EventHandler(DisplayRTB_Leave); + ContentsResized += new ContentsResizedEventHandler(DisplayRTB_ContentsResized); + this.LinkClicked += new LinkClickedEventHandler(DisplayRTB_LinkClicked); + this.KeyPress += new KeyPressEventHandler(DisplayRTB_KeyPress); + this.KeyUp += new KeyEventHandler(DisplayRTB_KeyUp); + this.KeyDown += new KeyEventHandler(DisplayRTB_KeyDown); + this.TextChanged += new EventHandler(DisplayRTB_TextChanged); } #endregion #region ApplicationSupport @@ -229,9 +189,12 @@ namespace Volian.Controls.Library } #endregion #region SaveData - public void Save() + public void SaveText() { - bool success = _origVlnText.Save((RichTextBox) this); + if (ReadOnly) return; + if (!_IsDirty) return; + bool success = _origVlnText.Save((RichTextBox)this); + if (!success) Console.WriteLine("Failed to save text: {0}", this.Text); } #endregion #region AddRtfText @@ -306,7 +269,21 @@ namespace Volian.Controls.Library this.SelectionLength = 0; } #endregion - #region CalculateHeight + #region HeightSupport + public event DisplayRTBEvent HeightChanged; + private void OnHeightChanged(object sender, EventArgs args) + { + if (HeightChanged != null) HeightChanged(sender, args); + } + private void AdjustSizeForContents() + { + //Console.WriteLine("Size {0} Client {1} New {2}", Size, ClientRectangle, ContentsRectangle); + // I want the client size to match the new rectangle. + // First I need to determine the offset + Size offset = Size - ClientSize; + this.Size = ContentsSize + offset + AdjustSize; + OnHeightChanged(this, new EventArgs()); + } public int CalculateHeight() { if (this.CreateParams.ClassName == "RICHEDIT50W") @@ -363,12 +340,12 @@ namespace Volian.Controls.Library } #endregion #region EventSupport + #region LinkEvents private LinkClickedEventArgs _LinkClickedEventArgs; public event DisplayRTBLinkEvent LinkGoTo; private void OnLinkGoTo(object sender, LinkClickedEventArgs args) { _LinkClickedEventArgs = args; - Console.WriteLine("DisplayRTB " + _LinkClickedEventArgs.LinkText); if (LinkGoTo != null) LinkGoTo(sender, args); } public event DisplayRTBLinkEvent LinkModifyTran; @@ -377,22 +354,14 @@ namespace Volian.Controls.Library _LinkClickedEventArgs = args; if (LinkModifyTran != null) LinkModifyTran(sender, args); } - //void DisplayRTB_Leave(object sender, EventArgs e) - //{ - // // Save returns true if text was not changed or if change was saved successfully. - // if (ReadOnly) return; - // // if selecting another rtb, save. If selecting the info panel don't because - // // we're still on a valid item.?? - - //} - public void SaveText() + public event DisplayRTBLinkEvent LinkModifyRO; + private void OnLinkModifyRO(object sender, LinkClickedEventArgs args) { - if (ReadOnly) return; - bool success = _origVlnText.Save((RichTextBox)this); - if (!success) Console.WriteLine("Failed to save text: {0}", this.Text); + _LinkClickedEventArgs = args; + if (LinkModifyRO != null) LinkModifyRO(sender, args); } private Point _savcurpos; - private void onLinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e) + private void DisplayRTB_LinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e) { if (ReadOnly) return; _LinkClickedEventArgs = e; @@ -411,20 +380,27 @@ namespace Volian.Controls.Library int iMin = index; Select(index, 0); - while (SelectionProtected) + while (iMin > 0 && SelectionProtected) Select(--iMin, 0); Select(iMin - 1, 1 + LinkText.Length); SelectionProtected = false; Select(iMin, LinkText.Length); } - void vlnRichTextBox_ContentsResized(object sender, ContentsResizedEventArgs e) + #endregion + #region TextOrContents + void DisplayRTB_TextChanged(object sender, EventArgs e) + { + _IsDirty = true; + } + void DisplayRTB_ContentsResized(object sender, ContentsResizedEventArgs e) { ContentsRectangle = e.NewRectangle; } + #endregion #region KeyboardHandling private bool IsControlChar = false; - private void onKeyDown(object sender, System.Windows.Forms.KeyEventArgs e) + void DisplayRTB_KeyDown(object sender, KeyEventArgs e) { if (e.Modifiers == Keys.Control) { @@ -433,14 +409,46 @@ namespace Volian.Controls.Library { case Keys.V: string buff = Clipboard.GetText(TextDataFormat.UnicodeText); - + // check if insertable? Console.WriteLine(String.Format("in switch, keydata = {0}, keyvalue = {1}, buff = {2}", e.KeyData, e.KeyValue, buff)); break; } } } - private void onKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) + void DisplayRTB_KeyUp(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down) + { + e.Handled = HandleLUDArrows(); + } + else if (e.KeyCode == Keys.Right) + { + e.Handled = HandleRightArrow(); + } + + } + private bool HandleRightArrow() + { + if (!SelectionProtected) return false; + int index = SelectionStart; + int iMax = index; + Select(index, 0); + while (iMax < TextLength && SelectionProtected) + Select(++iMax, 0); + return true; + } + private bool HandleLUDArrows() + { + if (!SelectionProtected) return false; + int index = this.SelectionStart; + int iMin = index; + Select(index, 0); + while (iMin > 0 && SelectionProtected) + Select(--iMin, 0); + return true; + } + private void DisplayRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (!ReadOnly) { @@ -632,10 +640,6 @@ namespace Volian.Controls.Library SelectLink(_eLinkText); SelectedText = ""; } - private void ModifyTransition() - { - Console.WriteLine("Modify Transition"); - } private void contextMenuStripTrans_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.ToString() == "Delete Transition") DeleteTransition(); @@ -666,14 +670,10 @@ namespace Volian.Controls.Library SelectLink(_eLinkText); SelectedText = ""; } - private void ModifyRefObj() - { - Console.WriteLine("ModifyRefObj"); - } private void contextMenuStripROs_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.ToString() == "Delete RO") DeleteRefObj(); - else if (e.ClickedItem.ToString() == "Modify RO") ModifyRefObj(); + else if (e.ClickedItem.ToString() == "Modify RO") OnLinkModifyRO(sender, _LinkClickedEventArgs); } #endregion