Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions Src/Common/Controls/DetailControls/AtomicReferenceSlice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// <summary>
Expand Down
11 changes: 0 additions & 11 deletions Src/Common/Controls/DetailControls/CommandSlice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
10 changes: 2 additions & 8 deletions Src/Common/Controls/DetailControls/DataTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down
13 changes: 0 additions & 13 deletions Src/Common/Controls/DetailControls/PhoneEnvReferenceSlice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/// <summary>
/// Handle changes in the size of the underlying view.
/// </summary>
Expand Down
16 changes: 0 additions & 16 deletions Src/Common/Controls/DetailControls/ReferenceComboBoxSlice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,21 +196,5 @@ protected virtual void SelectionChanged(object sender, EventArgs e)
m_cache.DomainDataByFlid.SetObjProp(Object.Hvo, m_flid, newValue);
});
}

/// <summary></summary>
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);
}
}
}
}
36 changes: 0 additions & 36 deletions Src/Common/Controls/DetailControls/ReferenceVectorSlice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,42 +245,6 @@ protected void OnViewSizeChanged(object sender, FwViewSizeEventArgs e)
Height = hNew - 1;
}
}

// // Overhaul Aug 05: want all Window backgrounds in Detail controls.
// /// <summary>
// /// 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.
// /// </summary>
// /// <param name="clr"></param>
// 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);
}
}
}
}

/// <summary>
Expand Down
18 changes: 0 additions & 18 deletions Src/Common/Controls/DetailControls/Slice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -519,24 +519,6 @@ protected override void OnEnter(EventArgs e)
#endregion Construction and initialization

#region Miscellaneous UI methods

/// <summary></summary>
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
Expand Down
48 changes: 1 addition & 47 deletions Src/XCore/FlexUIAdapter/ContextHelper.cs
Original file line number Diff line number Diff line change
@@ -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)
//
Expand All @@ -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; }
Expand Down
93 changes: 2 additions & 91 deletions Src/XCore/xCoreInterfaces/BaseContextHelper.cs
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -13,19 +13,12 @@

namespace XCore
{

/// <summary>
/// Summary description for IContextHelper.
/// </summary>
public interface IContextHelper
{
Control ParentControl
{
set;
}

string GetToolTip(string id);

}

/// summary>
Expand Down Expand Up @@ -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
/// <summary/>
public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters)
Expand All @@ -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<Control>("window");
m_document= new XmlDocument();

//we use the directory of the file which held are parameters as the starting point
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}

}
/// <summary>
/// register a control with the context of system
/// </summary>
/// <param name="argument"></param>
/// <returns>always returns true</returns>
//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;
}
}
}
}
Loading