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
10 changes: 10 additions & 0 deletions SeforimApp/src/commonMain/composeResources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,16 @@
<string name="select_at_least_one_commentator">אנא בחר לפחות מפרש אחד מהרשימה</string>
<string name="select_line_for_sources">בחר שורה כדי לצפות במקורות</string>
<string name="no_sources_for_line">אין מקורות זמינים לשורה זו</string>
<string name="references">מראי מקומות</string>
<string name="show_references">מראי מקומות</string>
<string name="show_references_tooltip">הצג את הספרים שמזכירים שורה זו</string>
<string name="select_line_for_references">בחר שורה כדי לראות אילו ספרים מזכירים אותה</string>
<string name="no_references_for_line">אין מראי מקומות לשורה זו</string>
<string name="references_summary">%1$d ספרים · %2$d מקומות</string>
<string name="references_more_from_book">עוד %1$d מקומות מ%2$s</string>
<string name="references_one_more_from_book">עוד מקום אחד מ%1$s</string>
<string name="references_ein_mishpat">עין משפט</string>
<string name="references_mesorat_hashas">מסורת הש״ס</string>
<string name="no_commentators_available">אין מפרשים זמינים</string>

<!-- Line Links View (special links strings) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import io.github.kdroidfilter.seforimapp.features.bookcontent.ui.panels.bookcont
import io.github.kdroidfilter.seforimapp.features.bookcontent.ui.panels.bookcontent.LocalBookTextReady
import io.github.kdroidfilter.seforimapp.features.bookcontent.ui.panels.bookcontent.isBookTextShown
import io.github.kdroidfilter.seforimapp.features.bookcontent.ui.panes.DockedPaneCard
import io.github.kdroidfilter.seforimapp.features.bookcontent.ui.panes.LineLayeredSides
import io.github.kdroidfilter.seforimapp.features.bookcontent.ui.panes.LineSideOrder
import io.github.kdroidfilter.seforimapp.features.bookcontent.ui.panes.NavigationLayeredSides
import io.github.kdroidfilter.seforimapp.features.bookcontent.ui.panes.PaneCard
Expand Down Expand Up @@ -107,6 +108,7 @@ fun WindowBody(openWindow: OpenWindow) {
workspace = lineWorkspace,
modifier = Modifier.weight(1f).fillMaxWidth().onSizeChanged { innerSize = it },
sideOrder = LineSideOrder,
layeredSides = LineLayeredSides,
splitter = { ReaderSplitter() },
panel = { panel -> DockedPaneCard(bottomOpen) { panel() } },
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ sealed interface BookContentEvent {

data object ToggleSources : BookContentEvent

/** Shows or hides the pane of the places that refer to the selected line (its REFERENCE links). */
data object ToggleReferences : BookContentEvent

/** Shows or hides the book-details pane (in every tab: one setting). */
data object ToggleBookDetails : BookContentEvent

Expand Down Expand Up @@ -230,11 +233,6 @@ sealed interface BookContentEvent {
val selectedIds: Set<Long>,
) : BookContentEvent

data class SelectedSourcesChanged(
val lineId: Long,
val selectedIds: Set<Long>,
) : BookContentEvent

// Scroll events
data class ParagraphScrolled(
val position: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,6 @@ class BookContentViewModel(
}
else -> state.content.selectedLinkSourcesByBook[bookId].orEmpty()
}
val selectedSources: Set<Long> =
when {
lineId != null -> {
val perLine = state.content.selectedSourcesByLine[lineId].orEmpty()
perLine.ifEmpty { state.content.selectedSourcesByBook[bookId].orEmpty() }
}
else -> state.content.selectedSourcesByBook[bookId].orEmpty()
}
state.copy(
providers =
Providers(
Expand All @@ -166,15 +158,11 @@ class BookContentViewModel(
prefetchCommentaries = commentariesUseCase::prefetchCommentaries,
buildLinksPagerFor = commentariesUseCase::buildLinksPager,
getAvailableLinksForLine = commentariesUseCase::getAvailableLinks,
buildSourcesPagerFor = commentariesUseCase::buildSourcesPager,
getAvailableSourcesForLine = commentariesUseCase::getAvailableSources,
// Multi-line providers
buildCommentariesPagerForLines = commentariesUseCase::buildCommentariesPagerForLines,
getCommentatorGroupsForLines = commentariesUseCase::getCommentatorGroupsForLines,
buildLinksPagerForLines = commentariesUseCase::buildLinksPagerForLines,
getAvailableLinksForLines = commentariesUseCase::getAvailableLinksForLines,
buildSourcesPagerForLines = commentariesUseCase::buildSourcesPagerForLines,
getAvailableSourcesForLines = commentariesUseCase::getAvailableSourcesForLines,
getCommentaryCharCountsForLine = commentariesUseCase::getCommentaryCharCountsForLine,
getCommentaryCharCountsForLines = commentariesUseCase::getCommentaryCharCountsForLines,
getLinkCharCountsForLine = commentariesUseCase::getLinkCharCountsForLine,
Expand All @@ -186,7 +174,6 @@ class BookContentViewModel(
state.content.copy(
selectedCommentatorIds = selectedCommentators,
selectedTargumSourceIds = selectedLinks,
selectedSourceIds = selectedSources,
),
)
}.stateIn(
Expand All @@ -212,14 +199,6 @@ class BookContentViewModel(
}
else -> s.content.selectedLinkSourcesByBook[bookId].orEmpty()
}
val selectedSources: Set<Long> =
when {
lineId != null -> {
val perLine = s.content.selectedSourcesByLine[lineId].orEmpty()
perLine.ifEmpty { s.content.selectedSourcesByBook[bookId].orEmpty() }
}
else -> s.content.selectedSourcesByBook[bookId].orEmpty()
}
s.copy(
providers =
Providers(
Expand All @@ -231,15 +210,11 @@ class BookContentViewModel(
prefetchCommentaries = commentariesUseCase::prefetchCommentaries,
buildLinksPagerFor = commentariesUseCase::buildLinksPager,
getAvailableLinksForLine = commentariesUseCase::getAvailableLinks,
buildSourcesPagerFor = commentariesUseCase::buildSourcesPager,
getAvailableSourcesForLine = commentariesUseCase::getAvailableSources,
// Multi-line providers
buildCommentariesPagerForLines = commentariesUseCase::buildCommentariesPagerForLines,
getCommentatorGroupsForLines = commentariesUseCase::getCommentatorGroupsForLines,
buildLinksPagerForLines = commentariesUseCase::buildLinksPagerForLines,
getAvailableLinksForLines = commentariesUseCase::getAvailableLinksForLines,
buildSourcesPagerForLines = commentariesUseCase::buildSourcesPagerForLines,
getAvailableSourcesForLines = commentariesUseCase::getAvailableSourcesForLines,
getCommentaryCharCountsForLine = commentariesUseCase::getCommentaryCharCountsForLine,
getCommentaryCharCountsForLines = commentariesUseCase::getCommentaryCharCountsForLines,
getLinkCharCountsForLine = commentariesUseCase::getLinkCharCountsForLine,
Expand All @@ -251,7 +226,6 @@ class BookContentViewModel(
s.content.copy(
selectedCommentatorIds = selectedCommentators,
selectedTargumSourceIds = selectedLinks,
selectedSourceIds = selectedSources,
),
)
},
Expand Down Expand Up @@ -644,6 +618,9 @@ class BookContentViewModel(
BookContentEvent.ToggleSources ->
contentUseCase.toggleSources()

BookContentEvent.ToggleReferences ->
stateManager.updateContent { copy(showReferences = !showReferences) }

BookContentEvent.ToggleBookDetails ->
appSettings.setBookDetailsPaneVisible(!appSettings.isBookDetailsPaneVisible())

Expand Down Expand Up @@ -720,9 +697,6 @@ class BookContentViewModel(
is BookContentEvent.SelectedTargumSourcesChanged ->
commentariesUseCase.updateSelectedLinkSources(event.lineId, event.selectedIds)

is BookContentEvent.SelectedSourcesChanged ->
commentariesUseCase.updateSelectedSources(event.lineId, event.selectedIds)

// State
BookContentEvent.SaveState ->
stateManager.saveAllStates()
Expand Down Expand Up @@ -798,7 +772,7 @@ class BookContentViewModel(
val persisted = persistedBeforeLoad ?: persistedStore.get(tabId)?.bookContent
val shouldEnsureSelectionForPanes =
persisted?.let {
it.showCommentaries || it.showTargum || it.showSources
it.showCommentaries || it.showTargum || it.showSources || it.showReferences
} == true
// Restaurer la sélection multi-ligne ou simple
val selectedLineIds = persisted?.selectedLineIds?.takeIf { it.isNotEmpty() }
Expand Down Expand Up @@ -1042,12 +1016,10 @@ class BookContentViewModel(
val primaryLineId = currentState.content.primarySelectedLineId ?: lineIds.firstOrNull() ?: line.id
commentariesUseCase.reapplySelectedCommentatorsForLines(lineIds, primaryLineId, bookId)
commentariesUseCase.reapplySelectedLinkSourcesForLines(lineIds, primaryLineId, bookId)
commentariesUseCase.reapplySelectedSourcesForLines(lineIds, primaryLineId, bookId)
} else {
val primaryLine = selectedLines.firstOrNull() ?: line
commentariesUseCase.reapplySelectedCommentators(primaryLine)
commentariesUseCase.reapplySelectedLinkSources(primaryLine)
commentariesUseCase.reapplySelectedSources(primaryLine)
}

if (syncAltToc) {
Expand Down
Loading
Loading