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
2 changes: 1 addition & 1 deletion Src/xWorks/FwXWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ protected bool OnJumpToPopupLexEntry(object command)
}
m_popupLexEntryWindow.BringToFront();
m_popupLexEntryWindow.Activate();
Mediator.BroadcastMessage("JumpToRecord", command);
Mediator.BroadcastMessage("JumpToPopupRecord", command);
Mediator.BroadcastMessage("FocusFirstPossibleSlice", null);
}
return true;
Expand Down
27 changes: 27 additions & 0 deletions Src/xWorks/PopupToolWindow.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using SIL.LCModel;
using SIL.Utils;
using System;
using System.Windows.Forms;
using System.Xml;
using XCore;
Expand All @@ -15,6 +16,9 @@ public Control MainControl
get { return m_mainContentControl; }
}

private PropertyTable m_propertyTable;
private RecordClerk m_recordClerk;

public PopupToolWindow()
{
InitializeComponent();
Expand All @@ -36,9 +40,30 @@ private void InitializeComponent()
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
this.Text = "Popup Tool Window";
this.WindowState = System.Windows.Forms.FormWindowState.Normal;
this.Deactivate += new System.EventHandler(PopupToolWindow_Deactivate);
this.Activated += new System.EventHandler(PopupToolWindow_Activated);
this.ResumeLayout(false);
}

private void PopupToolWindow_Deactivate(object sender, EventArgs e)
{
var oldActiveClerk = m_propertyTable.GetValue<RecordClerk>("OldActiveClerk");
var oldUseRecordTreeBar = m_propertyTable.GetValue<Boolean>("OldUseRecordTreeBar");
var oldOldUpdateStatusBar = m_propertyTable.GetValue<Boolean>("OldUpdateStatusBar");
if (oldActiveClerk != null)
{
oldActiveClerk.ActivateUI(oldUseRecordTreeBar, oldOldUpdateStatusBar);
}
}

private void PopupToolWindow_Activated(object sender, EventArgs e)
{
if (m_recordClerk != null)
{
m_recordClerk.ActivateUI(false);
}
}

private IxCoreColleague MainContentControlAsIxCoreColleague
{
get { return m_mainContentControl as IxCoreColleague; }
Expand All @@ -61,6 +86,7 @@ public virtual IxCoreColleague[] GetMessageTargets()

public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode toolNode)
{
m_propertyTable = propertyTable;
XmlNode contentClassNode = toolNode.SelectSingleNode("control");
XmlNode dynLoaderNode = contentClassNode.SelectSingleNode("dynamicloaderinfo");
string contentAssemblyPath = XmlUtils.GetMandatoryAttributeValue(dynLoaderNode, "assemblyPath");
Expand Down Expand Up @@ -93,6 +119,7 @@ public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode toolNod
this.Show();
this.BringToFront();
this.Activate();
m_recordClerk = m_propertyTable.GetValue<RecordClerk>("ActiveClerk");
}
}
}
37 changes: 35 additions & 2 deletions Src/xWorks/RecordClerk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,9 @@ internal protected bool IsActiveInGui
get { return m_fIsActiveInGui; }
}

private bool m_updateStatusBar;
private bool m_useRecordTreeBar;

/// <summary>
/// determine if we're in the (given) tool
/// </summary>
Expand Down Expand Up @@ -1051,12 +1054,22 @@ protected virtual bool AddItemToList(int hvoItem)
return false;
}

public bool OnJumpToPopupRecord(object argument)
{
return JumpToRecord(argument, true);
}

public bool OnJumpToRecord(object argument)
{
return JumpToRecord(argument);
}

/// <summary>
/// display the given record
/// </summary>
/// <param name="argument">the hvo of the record</param>
/// <returns></returns>
public bool OnJumpToRecord(object argument)
bool JumpToRecord(object argument, bool popup = false)
{
CheckDisposed();

Expand Down Expand Up @@ -1101,7 +1114,10 @@ public bool OnJumpToRecord(object argument)
// update issue reported in (LT-2448). However, that message only works in the context of a
// BrowseViewer, not a document view (e.g. Dictionary) (see LT-7298). So, I've
// tested OnChangeFilterClearAll, and it seems to solve both problems now.
OnChangeFilterClearAll(null);
if (!popup)
{
OnChangeFilterClearAll(null);
}
m_activeMenuBarFilter = null;
index = IndexOfObjOrChildOrParent(hvoTarget);
}
Expand Down Expand Up @@ -2027,8 +2043,22 @@ virtual public bool IsControllingTheRecordTreeBar
var oldActiveClerk = m_propertyTable.GetValue<RecordClerk>("ActiveClerk");
if (oldActiveClerk != this)
{
var oldUseRecordTreeBar = m_propertyTable.GetValue<Boolean>("UseRecordTreeBar");
m_propertyTable.SetProperty("OldUseRecordTreeBar", oldUseRecordTreeBar, true);
m_propertyTable.SetPropertyPersistence("OldUseRecordTreeBar", false);
m_propertyTable.SetProperty("UseRecordTreeBar", m_useRecordTreeBar, true);
m_propertyTable.SetPropertyPersistence("UseRecordTreeBar", false);

var oldUpdateStatusBar = m_propertyTable.GetValue<Boolean>("UpdateStatusBar");
m_propertyTable.SetProperty("OldUpdateStatusBar", oldUpdateStatusBar, true);
m_propertyTable.SetPropertyPersistence("OldUpdateStatusBar", false);
m_propertyTable.SetProperty("UpdateStatusBar", m_updateStatusBar, true);
m_propertyTable.SetPropertyPersistence("UpdateStatusBar", false);

if (oldActiveClerk != null)
oldActiveClerk.BecomeInactive();
m_propertyTable.SetProperty("OldActiveClerk", oldActiveClerk, true);
m_propertyTable.SetPropertyPersistence("OldActiveClerk", false);
m_propertyTable.SetProperty("ActiveClerk", this, true);
m_propertyTable.SetPropertyPersistence("ActiveClerk", false);
// We are adding this property so that EntryDlgListener can get access to the owning object
Expand Down Expand Up @@ -2077,6 +2107,9 @@ virtual public void ActivateUI(bool useRecordTreeBar, bool updateStatusBar = tru
m_fIsActiveInGui = true;
CheckDisposed();

m_useRecordTreeBar = useRecordTreeBar;
m_updateStatusBar = updateStatusBar;

if (m_recordBarHandler != null)
{
IsControllingTheRecordTreeBar = true;
Expand Down
Loading