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/Common/Controls/XMLViews/FlatListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private void StoreData(IEnumerable<ICmObject> objs)
{
var rghvo = (from obj in objs
select obj.Hvo).ToArray();
m_listPublisher.CacheVecProp(m_cache.LanguageProject.Hvo, rghvo);
m_listPublisher.CacheVecProp(m_cache.LanguageProject.Hvo, rghvo, true);
}
#endregion

Expand Down
28 changes: 5 additions & 23 deletions Src/Common/Controls/XMLViews/LayoutFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,29 +150,10 @@ internal set
}
}

// /// ------------------------------------------------------------------------------------
// /// <summary>
// /// Given a spec that might be some sort of element, or might be something wrapping a flow object
// /// around that element, return the element. Or, it might be a "frag" element wrapping all of that.
// /// </summary>
// /// <param name="viewSpec">The view spec.</param>
// /// <returns></returns>
// /// ------------------------------------------------------------------------------------
// XmlNode ExtractFromFlow(XmlNode viewSpec)
// {
// if (viewSpec == null)
// return null;
// if (viewSpec.Name == "frag")
// viewSpec = viewSpec.FirstChild;
// if (viewSpec.Name == "para" || viewSpec.Name == "div")
// {
// if (viewSpec.ChildNodes.Count == 2 && viewSpec.FirstChild.Name == "properties")
// return viewSpec.ChildNodes[1];
// else if (viewSpec.ChildNodes.Count == 1)
// return viewSpec.FirstChild;
// }
// return viewSpec; // None of the special flow object cases, use the node itself.
// }
/// <summary>
/// Stores the reversal ws that should be used for filtering.
/// </summary>
public int ReversalWs { set; get; }

#region StringFinder Members

Expand Down Expand Up @@ -278,6 +259,7 @@ public ITsString Key(IManyOnePathSortItem item, bool fForSorting)
m_vc = new XmlBrowseViewBaseVc(m_cache);
m_vc.SuppressPictures = true; // we won't dispose of it, so it mustn't make pictures (which we don't need)
m_vc.DataAccess = m_sda;
m_vc.ReversalWs = ReversalWs;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Src/Common/Controls/XMLViews/MatchingObjectsBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ private void UpdateResults(SearchField firstField, IEnumerable<int> results)
int count = hvos.Length;
int prevIndex = m_bvMatches.SelectedIndex;
int prevHvo = prevIndex == -1 ? 0 : m_bvMatches.AllItems[prevIndex];
m_listPublisher.CacheVecProp(m_cache.LanguageProject.LexDbOA.Hvo, hvos);
m_listPublisher.CacheVecProp(m_cache.LanguageProject.LexDbOA.Hvo, hvos, true);
TabStop = count > 0;
// Disable the list so that it doesn't steal the focus (LT-9481)
m_bvMatches.Enabled = false;
Expand Down
10 changes: 7 additions & 3 deletions Src/Common/Controls/XMLViews/ObjectListPublisher.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2015 SIL International
// Copyright (c) 2015 SIL International
// This software is licensed under the LGPL, version 2.1 or later
// (http://www.gnu.org/licenses/lgpl-2.1.html)

Expand Down Expand Up @@ -76,7 +76,8 @@ public void SetOwningPropInfo(int destClass, string className, string fieldName)
/// </summary>
/// <param name="hvoObj">The hvo.</param>
/// <param name="hvos">The hvos.</param>
public void CacheVecProp(int hvoObj, int[] hvos)
/// <param name="updateAndNotify">If true: Gui and properties should be updated, and notifications sent.</param>
public void CacheVecProp(int hvoObj, int[] hvos, bool updateAndNotify)
{
if (hvos == null)
throw new ArgumentNullException("Should not pass null to CacheVecProp");
Expand All @@ -86,7 +87,10 @@ public void CacheVecProp(int hvoObj, int[] hvos)
cvDel = old.Length;

m_values[hvoObj] = hvos;
SendPropChanged(hvoObj, 0, hvos.Length, cvDel);
if (updateAndNotify)
{
SendPropChanged(hvoObj, 0, hvos.Length, cvDel);
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2015 SIL International
// Copyright (c) 2015 SIL International
// This software is licensed under the LGPL, version 2.1 or later
// (http://www.gnu.org/licenses/lgpl-2.1.html)

Expand Down Expand Up @@ -37,7 +37,7 @@ public void SetAndAccessDummyList()
var values = new int[] {23, 56, 2048};
Notifiee recorder = new Notifiee();
publisher.AddNotification(recorder);
publisher.CacheVecProp(hvoRoot, values);
publisher.CacheVecProp(hvoRoot, values, true);
Assert.AreEqual(values.Length, publisher.get_VecSize(hvoRoot, ObjectListFlid), "override of vec size");
//Assert.AreEqual(Cache.LangProject.Texts.Count, publisher.get_VecSize(Cache.LangProject.Hvo, LangProjectTags.kflidTexts), "base vec size");

Expand Down
20 changes: 1 addition & 19 deletions Src/Common/Controls/XMLViews/XmlBrowseViewBaseVc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,13 +1024,6 @@ internal override int WsForce
set { m_wsForce = value; }
}

/// <summary>
/// If we are uploading multiple reversals to Webonary then the writing system can be different for
/// each reversal. OverrideWs is a hack to allow cell data to be generated using the writing system
/// for the current reversal (instead of using the writing system for the displayed column). LT-21198
/// </summary>
public int OverrideWs { get; set; }

private void AddTableCell(IVwEnv vwenv, int hvo, int index, int hvoRoot, int icolActive, int cAdjCol, int icol)
{
XmlNode node = m_columns[icol - 1];
Expand Down Expand Up @@ -1414,18 +1407,7 @@ public void DisplayCell(IManyOnePathSortItem item, XmlNode node, int hvo, IVwEnv
{
if (node.Name == "column")
{
// Unfortunately this method is called to generate non-displayed data (data that is
// uploaded to Webonary). If we are uploading multiple reversals then the writing system
// can be different for each reversal. OverrideWs is the reversal writing system (instead
// of using the writing system for the displayed column). LT-21198
if (OverrideWs != 0)
{
WsForce = OverrideWs;
}
else
{
SetForcedWs(node);
}
SetForcedWs(node);
}
OpenOuterParts(outerParts, vwenv, hvo);
if (hvoToDisplay == hvo)
Expand Down
2 changes: 1 addition & 1 deletion Src/Common/Controls/XMLViews/XmlSeqView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public static ISilDataAccessManaged CachePrintDecorator(ISilDataAccessManaged ol
int rootHvo, int mainFlid, int[] selectedObjects)
{
var printDecorator = new ObjectListPublisher(oldSda, mainFlid);
printDecorator.CacheVecProp(rootHvo, selectedObjects);
printDecorator.CacheVecProp(rootHvo, selectedObjects, true);
return printDecorator;
}

Expand Down
2 changes: 1 addition & 1 deletion Src/FdoUi/Dialogs/SummaryDialogForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private XmlView CreateSummaryView(List<int> rghvoEntries, LcmCache cache, IVwSty
int kflidEntriesFound = 8999950; // some arbitrary number not conflicting with real flids.
var sda = new ObjectListPublisher(cache.DomainDataByFlid as ISilDataAccessManaged, kflidEntriesFound);
int hvoRoot = RootHvo;
sda.CacheVecProp(hvoRoot, rghvoEntries.ToArray());
sda.CacheVecProp(hvoRoot, rghvoEntries.ToArray(), true);
//TODO: Make this method return a GeckoBrowser control, and generate the content here.
// The name of this property must match the property used by the publishFound layout.
sda.SetOwningPropInfo(LexDbTags.kflidClass, "LexDb", "EntriesFound");
Expand Down
7 changes: 4 additions & 3 deletions Src/LexText/Interlinear/ConcordanceControlBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2015-2017 SIL International
// Copyright (c) 2015-2017 SIL International
// This software is licensed under the LGPL, version 2.1 or later
// (http://www.gnu.org/licenses/lgpl-2.1.html)

Expand Down Expand Up @@ -52,7 +52,8 @@ public virtual void Init(Mediator mediator, PropertyTable propertyTable, XmlNode
m_configurationParameters = configurationParameters;
m_cache = m_propertyTable.GetValue<LcmCache>("cache");
string name = RecordClerk.GetCorrespondingPropertyName(XmlUtils.GetAttributeValue(configurationParameters, "clerk"));
m_clerk = m_propertyTable.GetValue<OccurrencesOfSelectedUnit>(name) ?? (OccurrencesOfSelectedUnit)RecordClerkFactory.CreateClerk(m_mediator, m_propertyTable, m_configurationParameters, true);
m_clerk = m_propertyTable.GetValue<OccurrencesOfSelectedUnit>(name) ?? (OccurrencesOfSelectedUnit)RecordClerkFactory.CreateClerk(
m_mediator, m_propertyTable, m_configurationParameters, true, true);
m_clerk.ConcordanceControl = this;
}

Expand Down Expand Up @@ -126,7 +127,7 @@ internal protected void LoadMatches(bool fLoadVirtualProperty)
IsLoadingMatches = true;
try
{
m_clerk.OwningObject = m_cache.LangProject;
m_clerk.SetOwningObject(m_cache.LangProject, true);
decorator.SetOccurrences(m_cache.LangProject.Hvo, occurrences);
m_clerk.UpdateList(true);
}
Expand Down
2 changes: 1 addition & 1 deletion Src/LexText/Interlinear/StatisticsView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configu
string name = XmlUtils.GetAttributeValue(configurationParameters, "clerk");
var clerk = RecordClerk.FindClerk(_propertyTable, name);
m_clerk = (clerk == null || clerk is TemporaryRecordClerk) ?
(InterlinearTextsRecordClerk)RecordClerkFactory.CreateClerk(mediator, _propertyTable, configurationParameters, true) :
(InterlinearTextsRecordClerk)RecordClerkFactory.CreateClerk(mediator, _propertyTable, configurationParameters, true, true) :
(InterlinearTextsRecordClerk)clerk;
// There's no record bar for it to control, but it should control the staus bar (e.g., it should update if we change
// the set of selected texts).
Expand Down
4 changes: 2 additions & 2 deletions Src/LexText/LexTextControls/PhonologicalFeatureChooserDlg.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 SIL International
// Copyright (c) 2017 SIL International
// This software is licensed under the LGPL, version 2.1 or later
// (http://www.gnu.org/licenses/lgpl-2.1.html)

Expand Down Expand Up @@ -482,7 +482,7 @@ private void BuildInitialBrowseView()
orderby s.Name.BestAnalysisAlternative.Text
select s.Hvo;
int[] featureHvos = sortedFeatureHvos.ToArray();
m_sda.CacheVecProp(m_cache.LangProject.Hvo, featureHvos);
m_sda.CacheVecProp(m_cache.LangProject.Hvo, featureHvos, true);
m_bvList = new BrowseViewer(toolNode, m_cache.LangProject.Hvo, PhonologicalFeaturePublisher.ListFlid, m_cache, m_mediator, m_propertyTable, null, m_sda);
m_bvList.SelectionChanged += m_bvList_SelectionChanged;
m_bvList.ScrollBar.ValueChanged += ScrollBar_ValueChanged;
Expand Down
47 changes: 9 additions & 38 deletions Src/LexText/LexTextDll/AreaListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ private bool FillList(UIListDisplayProperties display, string areaId)
if (display.List.Count > 0)
return true;
var windowConfiguration = m_propertyTable.GetValue<XmlNode>("WindowConfiguration");
XmlNodeList nodes = windowConfiguration.SelectNodes(GetToolXPath(areaId));
XmlNodeList nodes = windowConfiguration.SelectNodes(XWindow.GetToolXPath(areaId));
if (nodes != null)
{
foreach (XmlNode node in nodes)
Expand Down Expand Up @@ -350,7 +350,7 @@ private bool FillListAreaList(UIListDisplayProperties display)
}
else
{
var nodes = windowConfiguration.SelectNodes(GetToolXPath("lists"));
var nodes = windowConfiguration.SelectNodes(XWindow.GetToolXPath("lists"));
if (nodes == null)
{
return true;
Expand Down Expand Up @@ -549,7 +549,7 @@ private void LoadAllCustomLists(List<ICmPossibilityList> customLists, XmlNode wi
// We have to update this because other things besides 'tools' need to get set.
UpdateMediatorConfig(windowConfig);

var nodes = windowConfig.SelectNodes(GetToolXPath("lists"));
var nodes = windowConfig.SelectNodes(XWindow.GetToolXPath("lists"));
if (nodes != null)
m_ctotalLists = nodes.Count;
m_ccustomLists = customLists.Count;
Expand Down Expand Up @@ -648,7 +648,7 @@ private void AddClerkToConfigForList(ICmPossibilityList curList, XmlNode windowC
if (x == null)
x = FindToolParamNode(windowConfig, curList);
// REVIEW: I'm not sure where the created RecordClerk gets disposed
RecordClerkFactory.CreateClerk(m_mediator, m_propertyTable, x, true);
RecordClerkFactory.CreateClerk(m_mediator, m_propertyTable, x, true, true);
}

private void AddCommandToConfigForList(ICmPossibilityList curList, XmlNode windowConfig)
Expand Down Expand Up @@ -682,14 +682,6 @@ private static XmlNode CreateCustomToolNode(ICmPossibilityList curList, XmlNode

#region Static XPaths

private static string GetToolXPath(string areaId)
{
if(areaId == null)
return "//item/parameters/tools/tool";

return "//item[@value='"+areaId + "']/parameters/tools/tool";
}

private static string GetListToolsXPath()
{
return "//item[@value='lists']/parameters/tools";
Expand Down Expand Up @@ -725,17 +717,6 @@ private XmlNode FindToolParamNode(XmlNode windowConfig, ICmPossibilityList curLi
return null;
}

private XmlNode FindToolNode(XmlNode windowConfig, string areaName, string toolName)
{
foreach (XmlNode node in windowConfig.SelectNodes(GetToolXPath(areaName)))
{
string value = XmlUtils.GetAttributeValue(node, "value");
if (value == toolName)
return node;
}
return null;
}

private static string GetListClerksXPath()
{
return "//item[@value='lists']/parameters/clerks";
Expand Down Expand Up @@ -958,12 +939,12 @@ private XmlNode GetToolNodeForArea(string areaName, out string toolName)
throw new ConfigurationException("There must be a property named " + property + " in the <defaultProperties> section of the configuration file.");

XmlNode node;
if (!TryGetToolNode(areaName, toolName, out node))
if (!XWindow.TryGetToolNode(areaName, toolName, m_propertyTable, out node))
{
// the tool must be obsolete, so just get the default tool for this area
var windowConfiguration = m_propertyTable.GetValue<XmlNode>("WindowConfiguration");
toolName = windowConfiguration.SelectSingleNode("//defaultProperties/property[@name='" + property + "']/@value").InnerText;
if (!TryGetToolNode(areaName, toolName, out node))
if (!XWindow.TryGetToolNode(areaName, toolName, m_propertyTable, out node))
throw new ConfigurationException("There must be a property named " + property + " in the <defaultProperties> section of the configuration file.");
}
return node;
Expand All @@ -983,23 +964,13 @@ public bool OnGetContentControlParameters(object parameterObj)
string tool = param.Item2;
XmlNode[] result = param.Item3;
XmlNode node;
if (TryGetToolNode(area, tool, out node))
if (XWindow.TryGetToolNode(area, tool, m_propertyTable, out node))
{
result[0] = node.SelectSingleNode("control");
}
return true; // whatever happened, we did the best that can be done.
}

private bool TryGetToolNode(string areaName, string toolName, out XmlNode node)
{
string xpath = GetToolXPath(areaName) + "[@value = '" + XmlUtils.MakeSafeXmlAttribute(toolName) + "']";
var windowConfiguration = m_propertyTable.GetValue<XmlNode>("WindowConfiguration");
node = windowConfiguration.SelectSingleNode(xpath);
if (node == null)
node = FindToolNode(windowConfiguration, areaName, toolName);
return node != null;
}

protected string GetCurrentAreaName()
{
return m_propertyTable.GetValue<string>("areaChoice");
Expand All @@ -1014,7 +985,7 @@ public bool OnSetToolFromName(object toolName)
CheckDisposed();

XmlNode node;
if (!TryGetToolNode(null, (string)toolName, out node))
if (!XWindow.TryGetToolNode(null, (string)toolName, m_propertyTable, out node))
throw new ApplicationException (String.Format(LexTextStrings.CannotFindToolNamed0, toolName));

var windowConfiguration = m_propertyTable.GetValue<XmlNode>("WindowConfiguration");
Expand Down Expand Up @@ -1048,7 +1019,7 @@ public bool OnSetToolFromName(object toolName)

private static bool IsToolInArea(string toolName, string area, XmlNode windowConfiguration)
{
XmlNodeList nodes = windowConfiguration.SelectNodes(GetToolXPath(area));
XmlNodeList nodes = windowConfiguration.SelectNodes(XWindow.GetToolXPath(area));
if (nodes != null)
{
foreach (XmlNode node in nodes)
Expand Down
4 changes: 2 additions & 2 deletions Src/LexText/Lexicon/FindExampleSentenceDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ private void AddConfigurableControls()
XmlNode xnBrowseViewControlParameters = this.BrowseViewControlParameters;

// First create our Clerk, since we can't set it's OwningObject via the configuration/mediator/PropertyTable info.
m_clerk = RecordClerkFactory.CreateClerk(m_mediator, m_propertyTable, xnBrowseViewControlParameters, true);
m_clerk.OwningObject = m_owningSense;
m_clerk = RecordClerkFactory.CreateClerk(m_mediator, m_propertyTable, xnBrowseViewControlParameters, true, true);
m_clerk.SetOwningObject(m_owningSense, true);

m_rbv = DynamicLoader.CreateObject(xnBrowseViewControlParameters.ParentNode.SelectSingleNode("dynamicloaderinfo")) as ConcOccurrenceBrowseView;
m_rbv.Init(m_mediator, m_propertyTable, xnBrowseViewControlParameters, m_previewPane, m_clerk.VirtualListPublisher);
Expand Down
13 changes: 11 additions & 2 deletions Src/LexText/Lexicon/ReversalEntryBulkEdit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,18 @@ public override void DeleteCurrentObject(ProgressState state, ICmObject thingToD
ReloadList();
}

protected override string PropertyTableId(string sorterOrFilter)
protected override string PropertyTableId(string sorterOrFilter, DictionaryConfigurationModel revConfig = null)
{
var reversalPub = m_propertyTable.GetStringProperty("ReversalIndexPublicationLayout", null);
string reversalPub = null;
if (revConfig != null)
{
reversalPub = revConfig.FilePath;
}
else
{
reversalPub = m_propertyTable.GetStringProperty("ReversalIndexPublicationLayout", null);
}

if (reversalPub == null)
return null; // there is no current Reversal Index; don't try to find Properties (sorter & filter) for a nonexistant Reversal Index
var reversalLang = reversalPub.Substring(reversalPub.IndexOf('-') + 1); // strip initial "publishReversal-"
Expand Down
Loading
Loading