Skip to content

Commit 145983d

Browse files
authored
LT-21476: Remove RegisterHelpTargetWithId
Cherry-pick from the PubSub branch to the main branch using the following command: git cherry-pick --no-commit e02f872
1 parent 81fb4e3 commit 145983d

9 files changed

Lines changed: 5 additions & 254 deletions

File tree

Src/Common/Controls/DetailControls/AtomicReferenceSlice.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -203,20 +203,6 @@ protected override void UpdateDisplayFromDatabase()
203203
var arl = (AtomicReferenceLauncher)Control;
204204
arl.UpdateDisplayFromDatabase();
205205
}
206-
public override void RegisterWithContextHelper()
207-
{
208-
CheckDisposed();
209-
210-
if (Control == null)
211-
return;
212-
213-
string caption = XmlUtils.GetLocalizedAttributeValue(ConfigurationNode, "label", "");
214-
var launcher = (AtomicReferenceLauncher)Control;
215-
Mediator.SendMessage("RegisterHelpTargetWithId",
216-
new object[]{launcher.AtomicRefViewControl, caption, HelpId}, false);
217-
Mediator.SendMessage("RegisterHelpTargetWithId",
218-
new object[]{launcher.PanelControl, caption, HelpId, "Button"}, false);
219-
}
220206

221207
#region IVwNotifyChange Members
222208
/// <summary>

Src/Common/Controls/DetailControls/CommandSlice.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,6 @@ protected override void Dispose(bool disposing)
100100
// this.Control.BackColor = System.Drawing.SystemColors.Control;
101101
// }
102102

103-
public override void RegisterWithContextHelper()
104-
{
105-
CheckDisposed();
106-
if (Control != null)//grouping nodes do not have a control
107-
{
108-
Mediator.SendMessage("RegisterHelpTargetWithId",
109-
new object[]{Control, ConfigurationNode.Attributes["label"].Value, HelpId},
110-
false);
111-
}
112-
}
113-
114103
protected override string HelpId
115104
{
116105
get { return m_command.Id; }

Src/Common/Controls/DetailControls/DataTree.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,6 @@ private ToolTip ToolTip
238238
}
239239
}
240240

241-
private void InsertSliceAndRegisterWithContextHelp(int index, Slice slice)
242-
{
243-
slice.RegisterWithContextHelper();
244-
InsertSlice(index, slice);
245-
}
246-
247241
private void InsertSlice(int index, Slice slice)
248242
{
249243
InstallSlice(slice, index);
@@ -2499,7 +2493,7 @@ internal void MakeGhostSlice(ArrayList path, XmlNode node, ObjSeqHashMap reuseMa
24992493
SetNodeWeight(node, slice);
25002494

25012495
slice.FinishInit();
2502-
InsertSliceAndRegisterWithContextHelp(insertPosition, slice);
2496+
InsertSlice(insertPosition, slice);
25032497
}
25042498
else
25052499
{
@@ -2952,7 +2946,7 @@ private NodeTestResult AddSimpleNode(ArrayList path, XmlNode node, ObjSeqHashMap
29522946
// Now done in Slice.ctor
29532947
//slice.Visible = false; // don't show it until we position and size it.
29542948

2955-
InsertSliceAndRegisterWithContextHelp(insPos, slice);
2949+
InsertSlice(insPos, slice);
29562950
}
29572951
else
29582952
{

Src/Common/Controls/DetailControls/PhoneEnvReferenceSlice.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,6 @@ protected override void OnSizeChanged(EventArgs e)
143143
}
144144
}
145145

146-
public override void RegisterWithContextHelper()
147-
{
148-
CheckDisposed();
149-
150-
string caption = XmlUtils.GetLocalizedAttributeValue(ConfigurationNode, "label", "");
151-
152-
PhoneEnvReferenceLauncher launcher = (PhoneEnvReferenceLauncher)this.Control;
153-
Mediator.SendMessage("RegisterHelpTargetWithId",
154-
new object[]{launcher.Controls[1], caption, HelpId}, false);
155-
Mediator.SendMessage("RegisterHelpTargetWithId",
156-
new object[]{launcher.Controls[0], caption, HelpId, "Button"}, false);
157-
}
158-
159146
/// <summary>
160147
/// Handle changes in the size of the underlying view.
161148
/// </summary>

Src/Common/Controls/DetailControls/ReferenceComboBoxSlice.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,21 +196,5 @@ protected virtual void SelectionChanged(object sender, EventArgs e)
196196
m_cache.DomainDataByFlid.SetObjProp(Object.Hvo, m_flid, newValue);
197197
});
198198
}
199-
200-
/// <summary></summary>
201-
public override void RegisterWithContextHelper()
202-
{
203-
CheckDisposed();
204-
205-
if (Control != null)
206-
{
207-
string caption = XmlUtils.GetLocalizedAttributeValue(ConfigurationNode, "label", "");
208-
Mediator.SendMessage("RegisterHelpTargetWithId",
209-
new object[]{m_combo.Controls[0], caption, HelpId}, false);
210-
//balloon was making it hard to actually click this
211-
//Mediator.SendMessage("RegisterHelpTargetWithId",
212-
// new object[]{launcher.Controls[1], caption, HelpId, "Button"}, false);
213-
}
214-
}
215199
}
216200
}

Src/Common/Controls/DetailControls/ReferenceVectorSlice.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -245,42 +245,6 @@ protected void OnViewSizeChanged(object sender, FwViewSizeEventArgs e)
245245
Height = hNew - 1;
246246
}
247247
}
248-
249-
// // Overhaul Aug 05: want all Window backgrounds in Detail controls.
250-
// /// <summary>
251-
// /// This is passed the color that the XDE specified, if any, otherwise null.
252-
// /// The default is to use the normal window color for editable text.
253-
// /// Subclasses which know they should have a different default should
254-
// /// override this method, but normally should use the specified color if not
255-
// /// null.
256-
// /// </summary>
257-
// /// <param name="clr"></param>
258-
// public override void OverrideBackColor(String backColorName)
259-
// {
260-
// CheckDisposed();
261-
//
262-
// if (this.Control == null)
263-
// return;
264-
// VectorReferenceLauncher vrl = (VectorReferenceLauncher)this.Control;
265-
// vrl.BackColor = System.Drawing.SystemColors.Control;
266-
// }
267-
268-
public override void RegisterWithContextHelper ()
269-
{
270-
CheckDisposed();
271-
if (Control != null)
272-
{
273-
if (Mediator != null) // paranoia and unit testing
274-
{
275-
string caption = XmlUtils.GetLocalizedAttributeValue(ConfigurationNode, "label", "");
276-
var vrl = (VectorReferenceLauncher)Control;
277-
Mediator.SendMessage("RegisterHelpTargetWithId",
278-
new object[]{vrl.Controls[1], caption, HelpId}, false);
279-
Mediator.SendMessage("RegisterHelpTargetWithId",
280-
new object[]{vrl.Controls[0], caption, HelpId, "Button"}, false);
281-
}
282-
}
283-
}
284248
}
285249

286250
/// <summary>

Src/Common/Controls/DetailControls/Slice.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -519,24 +519,6 @@ protected override void OnEnter(EventArgs e)
519519
#endregion Construction and initialization
520520

521521
#region Miscellaneous UI methods
522-
523-
/// <summary></summary>
524-
public virtual void RegisterWithContextHelper()
525-
{
526-
CheckDisposed();
527-
528-
if (Control != null) //grouping nodes do not have a control
529-
{
530-
//It's OK to send null as an id
531-
if (m_mediator != null) // helpful for robustness and testing.
532-
{
533-
string caption = XmlUtils.GetLocalizedAttributeValue(ConfigurationNode, "label", "");
534-
m_mediator.SendMessage("RegisterHelpTargetWithId",
535-
new object[] { Control, caption, HelpId }, false);
536-
}
537-
}
538-
}
539-
540522
protected virtual string HelpId
541523
{
542524
get

Src/XCore/FlexUIAdapter/ContextHelper.cs

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2003-2013 SIL International
1+
// Copyright (c) 2003-2023 SIL International
22
// This software is licensed under the LGPL, version 2.1 or later
33
// (http://www.gnu.org/licenses/lgpl-2.1.html)
44
//
@@ -17,57 +17,11 @@
1717

1818
namespace XCore
1919
{
20-
21-
2220
/// summary>
2321
/// adapts DotNetBar to provide context help
2422
/// /summary>
2523
public class ContextHelper : BaseContextHelper
2624
{
27-
//DevComponents.DotNetBar.BalloonTip m_balloon;
28-
29-
30-
public ContextHelper() : base()
31-
{
32-
// m_balloon = new DevComponents.DotNetBar.BalloonTip();
33-
}
34-
35-
36-
#region XCORE Message Handlers
37-
38-
39-
40-
protected override void SetHelps(Control target,string caption, string text )
41-
{
42-
// m_balloon.SetBalloonCaption(target, caption);
43-
// m_balloon.SetBalloonText(target, text);
44-
}
45-
#endregion
46-
47-
48-
public override Control ParentControl
49-
{
50-
set
51-
{
52-
CheckDisposed();
53-
// m_balloon.SetBalloonText(value, "containing control");
54-
// m_balloon.ShowAlways=true;
55-
// m_balloon.AutoClose =false;
56-
// m_balloon.ShowCloseButton = false;
57-
}
58-
}
59-
60-
61-
62-
protected override bool ShowAlways
63-
{
64-
set
65-
{
66-
// m_balloon.ShowAlways= value;
67-
// m_balloon.Enabled= value;
68-
}
69-
}
70-
7125
public override int Priority
7226
{
7327
get { return (int)ColleaguePriority.Low; }

Src/XCore/xCoreInterfaces/BaseContextHelper.cs

Lines changed: 2 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2003-2017 SIL International
1+
// Copyright (c) 2003-2023 SIL International
22
// This software is licensed under the LGPL, version 2.1 or later
33
// (http://www.gnu.org/licenses/lgpl-2.1.html)
44

@@ -13,19 +13,12 @@
1313

1414
namespace XCore
1515
{
16-
1716
/// <summary>
1817
/// Summary description for IContextHelper.
1918
/// </summary>
2019
public interface IContextHelper
2120
{
22-
Control ParentControl
23-
{
24-
set;
25-
}
26-
2721
string GetToolTip(string id);
28-
2922
}
3023

3124
/// summary>
@@ -149,18 +142,6 @@ protected virtual void Dispose(bool disposing)
149142

150143
#endregion IDisposable & Co. implementation
151144

152-
abstract protected void SetHelps(Control target,string caption, string text );
153-
154-
abstract public Control ParentControl
155-
{
156-
set;
157-
}
158-
159-
protected abstract bool ShowAlways
160-
{
161-
set;
162-
}
163-
164145
#region IxCoreColleague
165146
/// <summary/>
166147
public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters)
@@ -172,7 +153,6 @@ public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configu
172153
m_propertyTable.SetProperty("ContextHelper", this, false);
173154
m_propertyTable.SetPropertyPersistence("ContextHelper", false);
174155

175-
ParentControl = m_propertyTable.GetValue<Control>("window");
176156
m_document= new XmlDocument();
177157

178158
//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
182162
var configParamatersBasePath = FileUtils.StripFilePrefix(configurationParameters.BaseURI);
183163
path = Path.Combine(Path.GetDirectoryName(configParamatersBasePath), path);
184164
m_document.Load(path);
185-
//m_items = m_document.SelectNodes("strings/item");
186-
187-
ShowAlways = m_propertyTable.GetBoolProperty("ShowBalloonHelp", true);
188165
}
189166

190167
public IxCoreColleague[] GetMessageTargets()
@@ -215,7 +192,7 @@ public string GetToolTip(string id)
215192
return text;
216193
}
217194

218-
protected bool GetHelpText (string id, ref string caption, out string text)
195+
private bool GetHelpText (string id, ref string caption, out string text)
219196
{
220197
text ="";
221198
if (id == null)
@@ -300,71 +277,5 @@ protected bool GetHelpText (string id, ref string caption, out string text)
300277
}
301278
return false; //there was no real match
302279
}
303-
304-
//this will just give each sub controlled the same helped message. If you want to have
305-
//different messages for individual controls, you need register them separately.
306-
protected void AddControls (Control parent, string helpid, string caption, string text)
307-
{
308-
foreach(Control child in parent.Controls)
309-
{
310-
SetHelps(child,caption, text);
311-
AddControls(child, helpid, caption, text);
312-
}
313-
314-
}
315-
/// <summary>
316-
/// register a control with the context of system
317-
/// </summary>
318-
/// <param name="argument"></param>
319-
/// <returns>always returns true</returns>
320-
//arguments:
321-
// 0) the target control
322-
// 1) the id to use when looking up the help text
323-
// 2) (optional) a string to concatenate to the Id for a more specific help message, if it exists.
324-
public bool OnRegisterHelpTargetWithId(object argument)
325-
{
326-
CheckDisposed();
327-
object[] arguments= (object[])argument;
328-
System.Diagnostics.Debug.Assert( arguments.Length == 3 || arguments.Length == 4,"OnRegisterHelpTargetWithId Expects three or four arguments");
329-
330-
Control target = (Control) arguments[0];
331-
string caption = (string) arguments[1];
332-
string helpid = (string) arguments[2];
333-
//this can be used for some elements of the control, to give them their own help message.
334-
string helpSubId ="";
335-
if (arguments.Length == 4)
336-
helpSubId = (string) arguments[3];
337-
338-
string text;
339-
//first tried to see if there is an item for the fully qualified if
340-
if (!GetHelpText(helpid+ helpSubId, ref caption, out text))
341-
{
342-
GetHelpText(helpid, ref caption, out text);//just use the id without the qualifier
343-
}
344-
else helpid= helpid+ helpSubId; //this is what will be fed to any sub controls
345-
346-
SetHelps(target, caption, text);
347-
348-
AddControls(target, helpid, caption, text);
349-
return true; //we handled this.
350-
}
351-
352-
/// summary>
353-
/// Receives the broadcast message "PropertyChanged"
354-
/// /summary>
355-
public void OnPropertyChanged(string name)
356-
{
357-
CheckDisposed();
358-
359-
// Debug.WriteLine("record clerk ("+this.m_vectorName + ") saw OnPropertyChanged " + name);
360-
switch(name)
361-
{
362-
case "ShowBalloonHelp":
363-
ShowAlways = m_propertyTable.GetBoolProperty(name, true);
364-
break;
365-
default:
366-
break;
367-
}
368-
}
369280
}
370281
}

0 commit comments

Comments
 (0)