Skip to content

Commit

Permalink
- Better handling of concepts
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis committed Jan 29, 2020
1 parent fafb6ed commit dd564d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
17 changes: 9 additions & 8 deletions PDF/Viewer/IPDFViewer.SuperMemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
Expand All @@ -21,8 +21,7 @@
// DEALINGS IN THE SOFTWARE.
//
//
// Created On: 2018/12/10 14:46
// Modified On: 2019/02/22 13:43
// Modified On: 2020/01/29 12:37
// Modified By: Alexis

#endregion
Expand Down Expand Up @@ -63,7 +62,7 @@ protected bool CreateSMExtract()
var selImages = SelectedImages;
var selImageAreas = SelectedAreas.Where(a => a.Type == PDFAreaSelection.AreaType.Normal);
var selTextAreas = SelectedAreas.Where(a => a.Type == PDFAreaSelection.AreaType.Ocr).ToList();
var pageIndices = new HashSet<int>();
var pageIndices = new HashSet<int>();

// Image extract
foreach (var selImage in selImages)
Expand Down Expand Up @@ -117,7 +116,7 @@ protected bool CreateSMExtract()

// Text extract
var hasTextSelection = string.IsNullOrWhiteSpace(SelectedText) == false;
var hasTextOcr = selTextAreas.Any();
var hasTextOcr = selTextAreas.Any();

if (hasTextSelection)
{
Expand Down Expand Up @@ -155,20 +154,22 @@ protected bool CreateSMExtract()
.Distinct()
.Select(b => $"({b.ToHierarchyString()})");
var bookmarksStr = StringEx.Join(" ; ", bookmarks);
var parentEl = Svc.SM.Registry.Element[PDFElement.ElementId];

ret = Svc.SM.Registry.Element.Add(
out _,
ElemCreationFlags.CreateSubfolders,
new ElementBuilder(ElementType.Topic,
contents.ToArray())
.WithParent(Svc.SM.Registry.Element[PDFElement.ElementId])
.WithParent(parentEl)
.WithConcept(parentEl.Concept)
.WithLayout(Config.Layout)
.WithPriority(Config.SMExtractPriority)
.WithReference(r => PDFElement.ConfigureSMReferences(r, bookmarks: bookmarksStr))
.WithForcedGeneratedTitle()
.DoNotDisplay()
);

Window.GetWindow(this)?.Activate();

if (ret)
Expand Down Expand Up @@ -198,7 +199,7 @@ protected bool CreateSMExtract()

if (txtExtract)
{
_selectInfo.StartPage = _selectInfo.EndPage = lastSelInfo.StartPage;
_selectInfo.StartPage = _selectInfo.EndPage = lastSelInfo.StartPage;
_selectInfo.StartIndex = _selectInfo.EndIndex = lastSelInfo.StartIndex;
}
}
Expand Down
6 changes: 3 additions & 3 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.1.14")]
[assembly: AssemblyFileVersion("2.0.1.14")]
[assembly: AssemblyVersion("2.0.2.5")]
[assembly: AssemblyFileVersion("2.0.2.5")]

[assembly: AssemblyInformationalVersion("2.0.1")]
[assembly: AssemblyInformationalVersion("2.0.2")]

0 comments on commit dd564d0

Please sign in to comment.