From e1b72ed0c0ef666bf353060b650f75aabf1fa319 Mon Sep 17 00:00:00 2001 From: mark-sil <83427558+mark-sil@users.noreply.github.com> Date: Thu, 29 Jan 2026 11:57:34 -0500 Subject: [PATCH] LT-21476: Remove RegisterHelpTargetWithId Cherry-pick from the PubSub branch to the main branch using the following command: git cherry-pick --no-commit e02f872c --- .../DetailControls/AtomicReferenceSlice.cs | 14 --- .../Controls/DetailControls/CommandSlice.cs | 11 --- .../Controls/DetailControls/DataTree.cs | 10 +- .../DetailControls/PhoneEnvReferenceSlice.cs | 13 --- .../DetailControls/ReferenceComboBoxSlice.cs | 16 ---- .../DetailControls/ReferenceVectorSlice.cs | 36 ------- Src/Common/Controls/DetailControls/Slice.cs | 18 ---- Src/XCore/FlexUIAdapter/ContextHelper.cs | 48 +--------- .../xCoreInterfaces/BaseContextHelper.cs | 93 +------------------ 9 files changed, 5 insertions(+), 254 deletions(-) diff --git a/Src/Common/Controls/DetailControls/AtomicReferenceSlice.cs b/Src/Common/Controls/DetailControls/AtomicReferenceSlice.cs index 97ba3d2575..9ae1795497 100644 --- a/Src/Common/Controls/DetailControls/AtomicReferenceSlice.cs +++ b/Src/Common/Controls/DetailControls/AtomicReferenceSlice.cs @@ -203,20 +203,6 @@ protected override void UpdateDisplayFromDatabase() var arl = (AtomicReferenceLauncher)Control; arl.UpdateDisplayFromDatabase(); } - public override void RegisterWithContextHelper() - { - CheckDisposed(); - - if (Control == null) - return; - - string caption = XmlUtils.GetLocalizedAttributeValue(ConfigurationNode, "label", ""); - var launcher = (AtomicReferenceLauncher)Control; - Mediator.SendMessage("RegisterHelpTargetWithId", - new object[]{launcher.AtomicRefViewControl, caption, HelpId}, false); - Mediator.SendMessage("RegisterHelpTargetWithId", - new object[]{launcher.PanelControl, caption, HelpId, "Button"}, false); - } #region IVwNotifyChange Members /// diff --git a/Src/Common/Controls/DetailControls/CommandSlice.cs b/Src/Common/Controls/DetailControls/CommandSlice.cs index dd61266342..ef895d2b55 100644 --- a/Src/Common/Controls/DetailControls/CommandSlice.cs +++ b/Src/Common/Controls/DetailControls/CommandSlice.cs @@ -100,17 +100,6 @@ protected override void Dispose(bool disposing) // this.Control.BackColor = System.Drawing.SystemColors.Control; // } - public override void RegisterWithContextHelper() - { - CheckDisposed(); - if (Control != null)//grouping nodes do not have a control - { - Mediator.SendMessage("RegisterHelpTargetWithId", - new object[]{Control, ConfigurationNode.Attributes["label"].Value, HelpId}, - false); - } - } - protected override string HelpId { get { return m_command.Id; } diff --git a/Src/Common/Controls/DetailControls/DataTree.cs b/Src/Common/Controls/DetailControls/DataTree.cs index 6e1e514030..65adc8f8c6 100644 --- a/Src/Common/Controls/DetailControls/DataTree.cs +++ b/Src/Common/Controls/DetailControls/DataTree.cs @@ -238,12 +238,6 @@ private ToolTip ToolTip } } - private void InsertSliceAndRegisterWithContextHelp(int index, Slice slice) - { - slice.RegisterWithContextHelper(); - InsertSlice(index, slice); - } - private void InsertSlice(int index, Slice slice) { InstallSlice(slice, index); @@ -2499,7 +2493,7 @@ internal void MakeGhostSlice(ArrayList path, XmlNode node, ObjSeqHashMap reuseMa SetNodeWeight(node, slice); slice.FinishInit(); - InsertSliceAndRegisterWithContextHelp(insertPosition, slice); + InsertSlice(insertPosition, slice); } else { @@ -2952,7 +2946,7 @@ private NodeTestResult AddSimpleNode(ArrayList path, XmlNode node, ObjSeqHashMap // Now done in Slice.ctor //slice.Visible = false; // don't show it until we position and size it. - InsertSliceAndRegisterWithContextHelp(insPos, slice); + InsertSlice(insPos, slice); } else { diff --git a/Src/Common/Controls/DetailControls/PhoneEnvReferenceSlice.cs b/Src/Common/Controls/DetailControls/PhoneEnvReferenceSlice.cs index 874a0471c8..93d640412a 100644 --- a/Src/Common/Controls/DetailControls/PhoneEnvReferenceSlice.cs +++ b/Src/Common/Controls/DetailControls/PhoneEnvReferenceSlice.cs @@ -143,19 +143,6 @@ protected override void OnSizeChanged(EventArgs e) } } - public override void RegisterWithContextHelper() - { - CheckDisposed(); - - string caption = XmlUtils.GetLocalizedAttributeValue(ConfigurationNode, "label", ""); - - PhoneEnvReferenceLauncher launcher = (PhoneEnvReferenceLauncher)this.Control; - Mediator.SendMessage("RegisterHelpTargetWithId", - new object[]{launcher.Controls[1], caption, HelpId}, false); - Mediator.SendMessage("RegisterHelpTargetWithId", - new object[]{launcher.Controls[0], caption, HelpId, "Button"}, false); - } - /// /// Handle changes in the size of the underlying view. /// diff --git a/Src/Common/Controls/DetailControls/ReferenceComboBoxSlice.cs b/Src/Common/Controls/DetailControls/ReferenceComboBoxSlice.cs index c8e4790e94..8e929ca9b9 100644 --- a/Src/Common/Controls/DetailControls/ReferenceComboBoxSlice.cs +++ b/Src/Common/Controls/DetailControls/ReferenceComboBoxSlice.cs @@ -196,21 +196,5 @@ protected virtual void SelectionChanged(object sender, EventArgs e) m_cache.DomainDataByFlid.SetObjProp(Object.Hvo, m_flid, newValue); }); } - - /// - public override void RegisterWithContextHelper() - { - CheckDisposed(); - - if (Control != null) - { - string caption = XmlUtils.GetLocalizedAttributeValue(ConfigurationNode, "label", ""); - Mediator.SendMessage("RegisterHelpTargetWithId", - new object[]{m_combo.Controls[0], caption, HelpId}, false); - //balloon was making it hard to actually click this - //Mediator.SendMessage("RegisterHelpTargetWithId", - // new object[]{launcher.Controls[1], caption, HelpId, "Button"}, false); - } - } } } diff --git a/Src/Common/Controls/DetailControls/ReferenceVectorSlice.cs b/Src/Common/Controls/DetailControls/ReferenceVectorSlice.cs index 38d924ad7e..1b5163e95e 100644 --- a/Src/Common/Controls/DetailControls/ReferenceVectorSlice.cs +++ b/Src/Common/Controls/DetailControls/ReferenceVectorSlice.cs @@ -245,42 +245,6 @@ protected void OnViewSizeChanged(object sender, FwViewSizeEventArgs e) Height = hNew - 1; } } - -// // Overhaul Aug 05: want all Window backgrounds in Detail controls. -// /// -// /// This is passed the color that the XDE specified, if any, otherwise null. -// /// The default is to use the normal window color for editable text. -// /// Subclasses which know they should have a different default should -// /// override this method, but normally should use the specified color if not -// /// null. -// /// -// /// -// public override void OverrideBackColor(String backColorName) -// { -// CheckDisposed(); -// -// if (this.Control == null) -// return; -// VectorReferenceLauncher vrl = (VectorReferenceLauncher)this.Control; -// vrl.BackColor = System.Drawing.SystemColors.Control; -// } - - public override void RegisterWithContextHelper () - { - CheckDisposed(); - if (Control != null) - { - if (Mediator != null) // paranoia and unit testing - { - string caption = XmlUtils.GetLocalizedAttributeValue(ConfigurationNode, "label", ""); - var vrl = (VectorReferenceLauncher)Control; - Mediator.SendMessage("RegisterHelpTargetWithId", - new object[]{vrl.Controls[1], caption, HelpId}, false); - Mediator.SendMessage("RegisterHelpTargetWithId", - new object[]{vrl.Controls[0], caption, HelpId, "Button"}, false); - } - } - } } /// diff --git a/Src/Common/Controls/DetailControls/Slice.cs b/Src/Common/Controls/DetailControls/Slice.cs index ba417c5615..10e1b16cfe 100644 --- a/Src/Common/Controls/DetailControls/Slice.cs +++ b/Src/Common/Controls/DetailControls/Slice.cs @@ -519,24 +519,6 @@ protected override void OnEnter(EventArgs e) #endregion Construction and initialization #region Miscellaneous UI methods - - /// - public virtual void RegisterWithContextHelper() - { - CheckDisposed(); - - if (Control != null) //grouping nodes do not have a control - { - //It's OK to send null as an id - if (m_mediator != null) // helpful for robustness and testing. - { - string caption = XmlUtils.GetLocalizedAttributeValue(ConfigurationNode, "label", ""); - m_mediator.SendMessage("RegisterHelpTargetWithId", - new object[] { Control, caption, HelpId }, false); - } - } - } - protected virtual string HelpId { get diff --git a/Src/XCore/FlexUIAdapter/ContextHelper.cs b/Src/XCore/FlexUIAdapter/ContextHelper.cs index f3ccd2d9cf..555bfdc7cd 100644 --- a/Src/XCore/FlexUIAdapter/ContextHelper.cs +++ b/Src/XCore/FlexUIAdapter/ContextHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2003-2013 SIL International +// Copyright (c) 2003-2023 SIL International // This software is licensed under the LGPL, version 2.1 or later // (http://www.gnu.org/licenses/lgpl-2.1.html) // @@ -17,57 +17,11 @@ namespace XCore { - - /// summary> /// adapts DotNetBar to provide context help /// /summary> public class ContextHelper : BaseContextHelper { - //DevComponents.DotNetBar.BalloonTip m_balloon; - - - public ContextHelper() : base() - { -// m_balloon = new DevComponents.DotNetBar.BalloonTip(); - } - - - #region XCORE Message Handlers - - - - protected override void SetHelps(Control target,string caption, string text ) - { -// m_balloon.SetBalloonCaption(target, caption); -// m_balloon.SetBalloonText(target, text); - } - #endregion - - - public override Control ParentControl - { - set - { - CheckDisposed(); -// m_balloon.SetBalloonText(value, "containing control"); -// m_balloon.ShowAlways=true; -// m_balloon.AutoClose =false; -// m_balloon.ShowCloseButton = false; - } - } - - - - protected override bool ShowAlways - { - set - { -// m_balloon.ShowAlways= value; -// m_balloon.Enabled= value; - } - } - public override int Priority { get { return (int)ColleaguePriority.Low; } diff --git a/Src/XCore/xCoreInterfaces/BaseContextHelper.cs b/Src/XCore/xCoreInterfaces/BaseContextHelper.cs index 8596d58c6b..6417ef5299 100644 --- a/Src/XCore/xCoreInterfaces/BaseContextHelper.cs +++ b/Src/XCore/xCoreInterfaces/BaseContextHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2003-2017 SIL International +// Copyright (c) 2003-2023 SIL International // This software is licensed under the LGPL, version 2.1 or later // (http://www.gnu.org/licenses/lgpl-2.1.html) @@ -13,19 +13,12 @@ namespace XCore { - /// /// Summary description for IContextHelper. /// public interface IContextHelper { - Control ParentControl - { - set; - } - string GetToolTip(string id); - } /// summary> @@ -149,18 +142,6 @@ protected virtual void Dispose(bool disposing) #endregion IDisposable & Co. implementation - abstract protected void SetHelps(Control target,string caption, string text ); - - abstract public Control ParentControl - { - set; - } - - protected abstract bool ShowAlways - { - set; - } - #region IxCoreColleague /// public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters) @@ -172,7 +153,6 @@ public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configu m_propertyTable.SetProperty("ContextHelper", this, false); m_propertyTable.SetPropertyPersistence("ContextHelper", false); - ParentControl = m_propertyTable.GetValue("window"); m_document= new XmlDocument(); //we use the directory of the file which held are parameters as the starting point @@ -182,9 +162,6 @@ public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configu var configParamatersBasePath = FileUtils.StripFilePrefix(configurationParameters.BaseURI); path = Path.Combine(Path.GetDirectoryName(configParamatersBasePath), path); m_document.Load(path); - //m_items = m_document.SelectNodes("strings/item"); - - ShowAlways = m_propertyTable.GetBoolProperty("ShowBalloonHelp", true); } public IxCoreColleague[] GetMessageTargets() @@ -215,7 +192,7 @@ public string GetToolTip(string id) return text; } - protected bool GetHelpText (string id, ref string caption, out string text) + private bool GetHelpText (string id, ref string caption, out string text) { text =""; if (id == null) @@ -300,71 +277,5 @@ protected bool GetHelpText (string id, ref string caption, out string text) } return false; //there was no real match } - - //this will just give each sub controlled the same helped message. If you want to have - //different messages for individual controls, you need register them separately. - protected void AddControls (Control parent, string helpid, string caption, string text) - { - foreach(Control child in parent.Controls) - { - SetHelps(child,caption, text); - AddControls(child, helpid, caption, text); - } - - } - /// - /// register a control with the context of system - /// - /// - /// always returns true - //arguments: - // 0) the target control - // 1) the id to use when looking up the help text - // 2) (optional) a string to concatenate to the Id for a more specific help message, if it exists. - public bool OnRegisterHelpTargetWithId(object argument) - { - CheckDisposed(); - object[] arguments= (object[])argument; - System.Diagnostics.Debug.Assert( arguments.Length == 3 || arguments.Length == 4,"OnRegisterHelpTargetWithId Expects three or four arguments"); - - Control target = (Control) arguments[0]; - string caption = (string) arguments[1]; - string helpid = (string) arguments[2]; - //this can be used for some elements of the control, to give them their own help message. - string helpSubId =""; - if (arguments.Length == 4) - helpSubId = (string) arguments[3]; - - string text; - //first tried to see if there is an item for the fully qualified if - if (!GetHelpText(helpid+ helpSubId, ref caption, out text)) - { - GetHelpText(helpid, ref caption, out text);//just use the id without the qualifier - } - else helpid= helpid+ helpSubId; //this is what will be fed to any sub controls - - SetHelps(target, caption, text); - - AddControls(target, helpid, caption, text); - return true; //we handled this. - } - - /// summary> - /// Receives the broadcast message "PropertyChanged" - /// /summary> - public void OnPropertyChanged(string name) - { - CheckDisposed(); - - // Debug.WriteLine("record clerk ("+this.m_vectorName + ") saw OnPropertyChanged " + name); - switch(name) - { - case "ShowBalloonHelp": - ShowAlways = m_propertyTable.GetBoolProperty(name, true); - break; - default: - break; - } - } } }