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
16 changes: 6 additions & 10 deletions Src/xWorks/FwXApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,16 @@ public virtual string DefaultConfigurationPathname
}

/// <summary>
/// This is the one (and should be only) handler for the user Refresh command.
/// Refresh wants to first clean up the cache, then give things like Clerks a
/// chance to reload stuff (calling the old OnRefresh methods), then give
/// windows a chance to redisplay themselves.
/// Refresh all main windows. This method is almost an exact duplicate of
/// FwXWindow.OnMasterRefresh(), but differing since this class overrides
/// ActiveForm. (Possible merge them into a single method.)
/// This method is intentionally NOT named OnMasterRefresh(), to prevent it from
/// being called by the Mediator's reflection dispatch. (LT-22644)
/// </summary>
public void OnMasterRefresh(object sender)
public void RefreshAllWindows()
{
// TODO: This is no longer called by the PropertyTable, since this class
// is no longer an xcore colleague. But, it can't be removed either,
// since it is used by another method on this clsss. :-(
CheckDisposed();

// Susanna asked that refresh affect only the currently active project, which is
// what the string and List variables below attempt to handle. See LT-6444.
FwXWindow activeWnd = ActiveForm as FwXWindow;

List<FwXWindow> rgxw = new List<FwXWindow>();
Expand Down
28 changes: 10 additions & 18 deletions Src/xWorks/FwXWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,16 @@ public virtual void OnMasterRefresh(object sender)
{
CheckDisposed();

// Susanna asked that refresh affect only the currently active project, which is
// what the string and List variables below attempt to handle. See LT-6444.
FwXWindow activeWnd = ActiveForm as FwXWindow;

LcmCache activeCache = null;
if (activeWnd != null)
activeCache = activeWnd.Cache;

List<FwXWindow> rgxw = new List<FwXWindow>();
foreach (IFwMainWnd wnd in m_app.MainWindows)
{
FwXWindow xwnd = wnd as FwXWindow;
if (xwnd != null)
{
if (activeCache == null || xwnd.Cache == activeCache)
{
xwnd.PrepareToRefresh();
rgxw.Add(xwnd);
}
xwnd.PrepareToRefresh();
rgxw.Add(xwnd);
}
}
if (activeWnd != null)
Expand Down Expand Up @@ -1336,7 +1327,7 @@ private void OnWritingSystemListChanged(object sender, EventArgs eventArgs)
// any writing systems are removed that a rootsite is currently displaying
if (m_app is FwXApp)
{
((FwXApp)m_app).OnMasterRefresh(null);
((FwXApp)m_app).RefreshAllWindows();
}

ReversalIndexServices.CreateOrRemoveReversalIndexConfigurationFiles(m_app.Cache.ServiceLocator.WritingSystemManager,
Expand All @@ -1350,7 +1341,7 @@ private void OnWritingSystemUpdated(object param, EventArgs args)
{
if (m_app is FwXApp)
{
((FwXApp)m_app).OnMasterRefresh(null);
((FwXApp)m_app).RefreshAllWindows();
}
}

Expand Down Expand Up @@ -1675,9 +1666,9 @@ protected bool OnRedo(object args)
}

/// <summary>
/// Called in FwXApp.OnMasterRefresh BEFORE clearing the cache, typically to
/// save any work in progress.
/// REVIEW (Hasso) 2023.07: 2/3 production callers call this in a foreach loop in OnMasterRefresh. There has to be a more efficient way.
/// Called during a master refresh (OnMasterRefresh / FwXApp.RefreshAllWindows)
/// BEFORE clearing the cache, typically to save any work in progress.
/// REVIEW (Hasso) 2023.07: 2/3 production callers call this in a foreach loop. There has to be a more efficient way.
/// </summary>
public void PrepareToRefresh()
{
Expand All @@ -1690,7 +1681,8 @@ public void PrepareToRefresh()
}

/// <summary>
/// Called in FwXApp.OnMasterRefresh AFTER clearing the cache, to reset everything.
/// Called during a master refresh (OnMasterRefresh / FwXApp.RefreshAllWindows)
/// AFTER clearing the cache, to reset everything.
/// </summary>
/// <returns></returns>
public bool FinishRefresh()
Expand Down Expand Up @@ -1880,7 +1872,7 @@ public bool ShowStylesDialog(string paraStyleName, string charStyleName,
if (m_delegate.ShowStylesDialog(paraStyleName, charStyleName, setPropsToFactorySettings))
{
// Need to refresh to reload the cache. See LT-6265.
(m_app as FwXApp).OnMasterRefresh(null);
(m_app as FwXApp).RefreshAllWindows();

// Refresh the fonts on popup windows.
Publisher.Publish(new PublisherParameterObject(EventConstants.RefreshPopupWindowFonts, null, this));
Expand Down
Loading