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 Build/mkall.targets
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
<ChorusNugetVersion>5.2.0-beta0003</ChorusNugetVersion>
<PalasoNugetVersion>15.0.0-beta0117</PalasoNugetVersion>
<ParatextNugetVersion>9.4.0.1-beta</ParatextNugetVersion>
<LcmNugetVersion>11.0.0-beta0135</LcmNugetVersion>
<LcmNugetVersion>11.0.0-beta0136</LcmNugetVersion>
<IcuNugetVersion>70.1.123</IcuNugetVersion>
<HermitCrabNugetVersion>3.7.4</HermitCrabNugetVersion>
<IPCFrameworkVersion>1.1.1-beta0001</IPCFrameworkVersion>
Expand Down
18 changes: 9 additions & 9 deletions Build/nuget-common/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
<package id="SIL.Core" version="8.1.0-beta0035" targetFramework="net461" />
<package id="SIL.DesktopAnalytics" version="4.0.0" targetFramework="net461" />
<package id="SIL.FLExBridge.IPCFramework" version="1.1.1-beta0001" targetFramework="net461" />
<package id="SIL.LCModel.Build.Tasks" version="11.0.0-beta0135" targetFramework="net461" />
<package id="SIL.LCModel.Core.Tests" version="11.0.0-beta0135" targetFramework="net461" />
<package id="SIL.LCModel.Core" version="11.0.0-beta0135" targetFramework="net461" />
<package id="SIL.LCModel.FixData" version="11.0.0-beta0135" targetFramework="net461" />
<package id="SIL.LCModel.Tests" version="11.0.0-beta0135" targetFramework="net461" />
<package id="SIL.LCModel.Tools" version="11.0.0-beta0135" targetFramework="net461" />
<package id="SIL.LCModel.Utils.Tests" version="11.0.0-beta0135" targetFramework="net461" />
<package id="SIL.LCModel.Utils" version="11.0.0-beta0135" targetFramework="net461" />
<package id="SIL.LCModel" version="11.0.0-beta0135" targetFramework="net461" />
<package id="SIL.LCModel.Build.Tasks" version="11.0.0-beta0136" targetFramework="net461" />
<package id="SIL.LCModel.Core.Tests" version="11.0.0-beta0136" targetFramework="net461" />
<package id="SIL.LCModel.Core" version="11.0.0-beta0136" targetFramework="net461" />
<package id="SIL.LCModel.FixData" version="11.0.0-beta0136" targetFramework="net461" />
<package id="SIL.LCModel.Tests" version="11.0.0-beta0136" targetFramework="net461" />
<package id="SIL.LCModel.Tools" version="11.0.0-beta0136" targetFramework="net461" />
<package id="SIL.LCModel.Utils.Tests" version="11.0.0-beta0136" targetFramework="net461" />
<package id="SIL.LCModel.Utils" version="11.0.0-beta0136" targetFramework="net461" />
<package id="SIL.LCModel" version="11.0.0-beta0136" targetFramework="net461" />
<package id="SIL.Lexicon" version="15.0.0-beta0117" targetFramework="net462" />
<package id="SIL.libpalaso.l10ns" version="6.0.0" targetFramework="net461" />
<package id="SIL.Lift" version="15.0.0-beta0117" targetFramework="net462" />
Expand Down
3 changes: 3 additions & 0 deletions DistFiles/Language Explorer/Configuration/Main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@
</command>
<!-- This is on the popup menu, and is for non-record level objects. -->
<command id="CmdDeleteSelectedObject" label="Delete selected {0}" message="DeleteSelectedItem"/>
<command id="CmdDuplicateSelectedObject" label="Duplicate selected {0}" message="DuplicateSelectedItem"/>
<command id="CmdAlwaysVisible" label="Always visible" message="ShowFieldAlwaysVisible"/>
<command id="CmdIfData" label="Normally hidden, unless non-empty" message="ShowFieldIfData"/>
<command id="CmdNormallyHidden" label="Normally hidden" message="ShowFieldNormallyHidden"/>
Expand Down Expand Up @@ -654,6 +655,7 @@
<item command="CmdEnvironmentsJumpToDefault"/>
<item label="-" translate="do not translate"/>
<item command="CmdDeleteSelectedObject"/>
<item command="CmdDuplicateSelectedObject"/>
</menu>

<menu id="mnuBrowseView">
Expand All @@ -674,6 +676,7 @@
<item command="CmdEnvironmentsJumpToDefault"/>
<item label="-" translate="do not translate"/>
<item command="CmdDeleteSelectedObject"/>
<item command="CmdDuplicateSelectedObject"/>
</menu>
<!-- The following commands are involked/displayed on a right click on a slice on at Possibility list item.

Expand Down
41 changes: 27 additions & 14 deletions Src/Common/Controls/XMLViews/BrowseViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
// This software is licensed under the LGPL, version 2.1 or later
// (http://www.gnu.org/licenses/lgpl-2.1.html)

using SIL.FieldWorks.Common.FwUtils;
using SIL.FieldWorks.Common.RootSites;
using SIL.FieldWorks.Common.ViewsInterfaces;
using SIL.FieldWorks.Filters;
using SIL.FieldWorks.Resources;
using SIL.LCModel;
using SIL.LCModel.Application;
using SIL.LCModel.Core.KernelInterfaces;
using SIL.LCModel.Core.WritingSystems;
using SIL.LCModel.DomainServices;
using SIL.LCModel.Utils;
using SIL.PlatformUtilities;
using SIL.Reporting;
using SIL.Utils;
using System;
using System.Collections;
using System.Collections.Generic;
Expand All @@ -11,20 +25,6 @@
using System.Text;
using System.Windows.Forms;
using System.Xml;
using SIL.LCModel.Core.WritingSystems;
using SIL.LCModel.Core.KernelInterfaces;
using SIL.FieldWorks.Common.ViewsInterfaces;
using SIL.FieldWorks.Common.FwUtils;
using SIL.FieldWorks.Common.RootSites;
using SIL.LCModel;
using SIL.LCModel.Application;
using SIL.LCModel.DomainServices;
using SIL.FieldWorks.Filters;
using SIL.FieldWorks.Resources;
using SIL.Reporting;
using SIL.LCModel.Utils;
using SIL.PlatformUtilities;
using SIL.Utils;
using XCore;

namespace SIL.FieldWorks.Common.Controls
Expand Down Expand Up @@ -328,6 +328,19 @@ protected override void OnGotFocus(EventArgs e)
m_xbv.Focus();
}

/// <summary>
/// Update the selected cache for the given item.
/// </summary>
public void OnUpdateItemCheckedState(object obj)
{
if (obj is ICmObject)
{
int hvoItem = ((ICmObject)obj).Hvo;
int currentValue = GetCheckState(hvoItem);
SetItemCheckedState(hvoItem, currentValue, false);
}
}

/// <summary>
/// This supports external clients using the Bulk Edit Preview functionality.
/// To turn on, set to the index of the column that should have the preview
Expand Down
5 changes: 3 additions & 2 deletions Src/LexText/Lexicon/ReversalEntryBulkEdit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ public override bool CanInsertClass(string className)
return className == "ReversalIndexEntry";
}

public override bool CreateAndInsert(string className)
public override bool CreateAndInsert(string className, out ICmObject newObj)
{
if (className != "ReversalIndexEntry")
return base.CreateAndInsert(className);
return base.CreateAndInsert(className, out newObj);
m_newItem = m_cache.ServiceLocator.GetInstance<IReversalIndexEntryFactory>().Create();
newObj = m_newItem;
var ri = (IReversalIndex)m_owningObject;
ri.EntriesOC.Add(m_newItem);
var extensions = m_cache.ActionHandlerAccessor as IActionHandlerExtensions;
Expand Down
79 changes: 78 additions & 1 deletion Src/xWorks/RecordClerk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2536,7 +2536,7 @@ public bool OnInsertItemInVector(object argument)
UndoableUnitOfWorkHelper.Do(string.Format(xWorksStrings.ksUndoInsert, command.UndoRedoTextInsert),
string.Format(xWorksStrings.ksRedoInsert, command.UndoRedoTextInsert), Cache.ActionHandlerAccessor, () =>
{
result = m_list.CreateAndInsert(className);
result = m_list.CreateAndInsert(className, out _);
});
}
catch (ApplicationException ae)
Expand Down Expand Up @@ -2612,6 +2612,83 @@ public bool OnDuplicateItemInVector(object argument)
return result;
}

/// <summary>
/// see if it makes sense to provide the "duplicate XXX" command now
/// </summary>
/// <param name="commandObject"></param>
/// <param name="display"></param>
/// <returns></returns>
public virtual bool OnDisplayDuplicateSelectedItem(object commandObject, ref UIItemDisplayProperties display)
{
CheckDisposed();

string className = Cache.MetaDataCacheAccessor.GetClassName(m_list.ListItemsClass);
if (m_list.CurrentObject == null ||
!m_list.IsCurrentObjectValid() ||
!m_list.CanInsertClass(m_list.CurrentObject.ClassName) ||
!(m_list.CurrentObject is ICloneableCmObject))
{
display.Visible = display.Enabled = false;
}
else
{
display.Text = string.Format(display.Text, GetTypeNameForUi(m_list.CurrentObject));
}

return true;
}

/// <summary>
/// Duplicate selected item in a non-possibilities list.
/// </summary>
public bool OnDuplicateSelectedItem(object argument)
{
CheckDisposed();

if (!Editable)
return false;

if (m_list.CurrentObject == null ||
!m_list.IsCurrentObjectValid() ||
!m_list.CanInsertClass(m_list.CurrentObject.ClassName) ||
!(m_list.CurrentObject is ICloneableCmObject))
return false;

SaveOnChangeRecord();

var command = (Command)argument;
ICmObject selectedObject = m_list.CurrentObject;
string className = selectedObject.ClassName;
bool result = false;
m_suppressSaveOnChangeRecord = true;
ICmObject newObj = null;

try
{
UndoableUnitOfWorkHelper.Do(string.Format(xWorksStrings.ksUndoDuplicate, className),
string.Format(xWorksStrings.ksRedoDuplicate, className),
Cache.ActionHandlerAccessor, () =>
{
result = m_list.CreateAndInsert(className, out newObj);
((ICloneableCmObject)selectedObject).SetCloneProperties(newObj);
});
}
catch (ApplicationException ae)
{
throw new ApplicationException("Could not duplicate the item requested by the command " + command.ConfigurationNode, ae);
}
finally
{
m_suppressSaveOnChangeRecord = false;
}

if (newObj != null)
m_mediator.BroadcastMessage("UpdateItemCheckedState", newObj);
m_mediator.BroadcastMessage("FocusFirstPossibleSlice", null);
return result;
}


#endregion

/// <summary>
Expand Down
5 changes: 3 additions & 2 deletions Src/xWorks/RecordList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3215,10 +3215,11 @@ public static void SetUpConstChartTemplateTemplate(ICmPossibility templateRoot)
/// </summary>
/// <param name="className"></param>
/// <returns>true if successful (the class is known)</returns>
public virtual bool CreateAndInsert(string className)
public virtual bool CreateAndInsert(string className, out ICmObject newObj)
{
CheckDisposed();

newObj = null;
ClassAndPropInfo cpi = GetMatchingClass(className);
Debug.Assert(cpi != null, "This object should not have been asked to insert an object of the class " + className + ".");
if (cpi != null)
Expand All @@ -3245,7 +3246,7 @@ public virtual bool CreateAndInsert(string className)
cpiPath = new List<ClassAndPropInfo>(new ClassAndPropInfo[] { cpi });
#endif
var createAndInsertMethodObj = new CpiPathBasedCreateAndInsert(m_owningObject.Hvo, cpiPath, this);
var newObj = DoCreateAndInsert(createAndInsertMethodObj);
newObj = DoCreateAndInsert(createAndInsertMethodObj);
int hvoNew = newObj != null ? newObj.Hvo : 0;
return hvoNew != 0; // If we get zero, we couldn't do it for some reason.
}
Expand Down
Loading