Access Your Bible from Anywhere
-Create notes, track progress, sync content across devices, and more.
-

diff --git a/BibleViwer.gd b/BibleViwer.gd index 0f05067..7052ceb 100644 --- a/BibleViwer.gd +++ b/BibleViwer.gd @@ -104,13 +104,15 @@ func load_book_names() -> Array: func get_chapter_text(book:String, chapter:int) -> String: - var path:= "Bibles/%s/%s_%s.txt" \ + var path:= "res://bibles/%s/%s_%s.txt" \ % [bible_version, book.replace(" ", "_"), int(chapter)] + if not DirAccess.dir_exists_absolute(path): + path = "user://bibles/%s/%s_%s.txt" \ + % [bible_version, book.replace(" ", "_"), int(chapter)] + var file:= FileAccess.open(path, FileAccess.READ) - if file == null: return "" - return file.get_as_text() diff --git a/BibleViwer.tscn b/BibleViwer.tscn index 647c7fe..e1f20e6 100644 --- a/BibleViwer.tscn +++ b/BibleViwer.tscn @@ -39,7 +39,6 @@ chapter_tab = ExtResource("2_rn5h4") [node name="ChapterTabs" type="MarginContainer" parent="."] unique_name_in_owner = true -layout_mode = 2 offset_left = 5.0 offset_top = 5.0 offset_right = 1147.0 @@ -64,19 +63,16 @@ theme_override_constants/margin_right = 5 theme_override_constants/margin_bottom = 5 [node name="VBoxContainer" type="VBoxContainer" parent="Window/MarginContainer"] -layout_mode = 2 offset_left = 5.0 offset_top = 5.0 offset_right = 1147.0 offset_bottom = 643.0 [node name="TabControls" type="HBoxContainer" parent="Window/MarginContainer/VBoxContainer"] -layout_mode = 2 offset_right = 1142.0 offset_bottom = 31.0 [node name="ScrollContainer" type="ScrollContainer" parent="Window/MarginContainer/VBoxContainer/TabControls"] -layout_mode = 2 offset_right = 1049.0 offset_bottom = 31.0 size_flags_horizontal = 3 @@ -85,14 +81,12 @@ vertical_scroll_mode = 0 [node name="ChapterTabBar" type="TabBar" parent="Window/MarginContainer/VBoxContainer/TabControls/ScrollContainer"] unique_name_in_owner = true -layout_mode = 2 offset_right = 1049.0 size_flags_horizontal = 3 clip_tabs = false tab_close_display_policy = 2 [node name="NewTab" type="Button" parent="Window/MarginContainer/VBoxContainer/TabControls"] -layout_mode = 2 offset_left = 1053.0 offset_right = 1142.0 offset_bottom = 31.0 @@ -100,20 +94,17 @@ size_flags_vertical = 0 text = "+ New Tab" [node name="BookSearchContainer" type="HBoxContainer" parent="Window/MarginContainer/VBoxContainer"] -layout_mode = 2 offset_top = 35.0 offset_right = 1142.0 offset_bottom = 66.0 [node name="VBoxContainer" type="VBoxContainer" parent="Window/MarginContainer/VBoxContainer/BookSearchContainer"] -layout_mode = 2 offset_right = 569.0 offset_bottom = 31.0 size_flags_horizontal = 3 [node name="SearchBook" type="LineEdit" parent="Window/MarginContainer/VBoxContainer/BookSearchContainer/VBoxContainer"] unique_name_in_owner = true -layout_mode = 2 offset_right = 569.0 offset_bottom = 31.0 focus_neighbor_right = NodePath("../../SearchChapter") @@ -126,20 +117,17 @@ script = SubResource("GDScript_jd8xs") [node name="FuzzyBooks" type="PanelContainer" parent="Window/MarginContainer/VBoxContainer/BookSearchContainer/VBoxContainer"] unique_name_in_owner = true visible = false -layout_mode = 2 offset_top = 35.0 offset_right = 569.0 offset_bottom = 67.0 [node name="VBoxContainer" type="VBoxContainer" parent="Window/MarginContainer/VBoxContainer/BookSearchContainer/VBoxContainer/FuzzyBooks"] -layout_mode = 2 offset_right = 569.0 offset_bottom = 32.0 theme_override_constants/separation = 0 [node name="FuzzyBook1" type="Button" parent="Window/MarginContainer/VBoxContainer/BookSearchContainer/VBoxContainer/FuzzyBooks/VBoxContainer" node_paths=PackedStringArray("shortcut_context")] unique_name_in_owner = true -layout_mode = 2 offset_right = 569.0 offset_bottom = 8.0 shortcut = SubResource("Shortcut_apwqq") @@ -149,7 +137,6 @@ alignment = 0 [node name="FuzzyBook2" type="Button" parent="Window/MarginContainer/VBoxContainer/BookSearchContainer/VBoxContainer/FuzzyBooks/VBoxContainer" node_paths=PackedStringArray("shortcut_context")] unique_name_in_owner = true -layout_mode = 2 offset_top = 8.0 offset_right = 569.0 offset_bottom = 16.0 @@ -159,7 +146,6 @@ alignment = 0 [node name="FuzzyBook3" type="Button" parent="Window/MarginContainer/VBoxContainer/BookSearchContainer/VBoxContainer/FuzzyBooks/VBoxContainer" node_paths=PackedStringArray("shortcut_context")] unique_name_in_owner = true -layout_mode = 2 offset_top = 16.0 offset_right = 569.0 offset_bottom = 24.0 @@ -169,7 +155,6 @@ alignment = 0 [node name="FuzzyBook4" type="Button" parent="Window/MarginContainer/VBoxContainer/BookSearchContainer/VBoxContainer/FuzzyBooks/VBoxContainer" node_paths=PackedStringArray("shortcut_context")] unique_name_in_owner = true -layout_mode = 2 offset_top = 24.0 offset_right = 569.0 offset_bottom = 32.0 @@ -180,7 +165,6 @@ alignment = 0 [node name="SearchChapter" type="SpinBox" parent="Window/MarginContainer/VBoxContainer/BookSearchContainer"] unique_name_in_owner = true -layout_mode = 2 offset_left = 573.0 offset_right = 1142.0 offset_bottom = 31.0 @@ -193,7 +177,6 @@ value = 1.0 [node name="SearchVerse" type="SpinBox" parent="Window/MarginContainer/VBoxContainer/BookSearchContainer"] unique_name_in_owner = true visible = false -layout_mode = 2 offset_left = 764.0 offset_right = 1142.0 offset_bottom = 31.0 @@ -204,21 +187,18 @@ max_value = 200.0 value = 1.0 [node name="PageLabel" type="Label" parent="Window/MarginContainer/VBoxContainer"] -layout_mode = 2 offset_top = 70.0 offset_right = 1142.0 offset_bottom = 96.0 text = "Page Resolution" [node name="PageResolutionControls" type="HBoxContainer" parent="Window/MarginContainer/VBoxContainer"] -layout_mode = 2 offset_top = 100.0 offset_right = 1142.0 offset_bottom = 131.0 [node name="PageResolutionX" type="SpinBox" parent="Window/MarginContainer/VBoxContainer/PageResolutionControls"] unique_name_in_owner = true -layout_mode = 2 offset_right = 516.0 offset_bottom = 31.0 size_flags_horizontal = 3 @@ -229,7 +209,6 @@ suffix = "px" [node name="PageResolutionY" type="SpinBox" parent="Window/MarginContainer/VBoxContainer/PageResolutionControls"] unique_name_in_owner = true -layout_mode = 2 offset_left = 520.0 offset_right = 1037.0 offset_bottom = 31.0 @@ -241,7 +220,6 @@ suffix = "px" [node name="PageResiazable" type="CheckBox" parent="Window/MarginContainer/VBoxContainer/PageResolutionControls"] unique_name_in_owner = true -layout_mode = 2 offset_left = 1041.0 offset_right = 1142.0 offset_bottom = 31.0 @@ -249,21 +227,18 @@ button_pressed = true text = "Resizable" [node name="FontLabel" type="Label" parent="Window/MarginContainer/VBoxContainer"] -layout_mode = 2 offset_top = 135.0 offset_right = 1142.0 offset_bottom = 161.0 text = "Font" [node name="FontControls" type="HBoxContainer" parent="Window/MarginContainer/VBoxContainer"] -layout_mode = 2 offset_top = 165.0 offset_right = 1142.0 offset_bottom = 196.0 [node name="FontSizeLabel" type="Label" parent="Window/MarginContainer/VBoxContainer/FontControls"] self_modulate = Color(0.678431, 0.678431, 0.678431, 1) -layout_mode = 2 offset_top = 2.0 offset_right = 70.0 offset_bottom = 28.0 @@ -271,7 +246,6 @@ text = "Font Size" [node name="FontSize" type="SpinBox" parent="Window/MarginContainer/VBoxContainer/FontControls"] unique_name_in_owner = true -layout_mode = 2 offset_left = 74.0 offset_right = 157.0 offset_bottom = 31.0 @@ -282,7 +256,6 @@ suffix = "px" [node name="PanelContainer" type="PanelContainer" parent="Window/MarginContainer/VBoxContainer"] visible = false self_modulate = Color(1, 1, 1, 0) -layout_mode = 2 offset_top = 200.0 offset_right = 1142.0 offset_bottom = 638.0 diff --git a/Scenes/ChapterTab.gd b/Scenes/ChapterTab.gd index 5a16cfb..8041f8d 100644 --- a/Scenes/ChapterTab.gd +++ b/Scenes/ChapterTab.gd @@ -19,3 +19,11 @@ extends VBoxContainer text = v %BibleText.text = text + + +func _on_text_scroll_velocity_started() -> void: + Engine.target_fps = 30 + + +func _on_text_scroll_velocity_stopped() -> void: + Engine.target_fps = 5 diff --git a/Scenes/ChapterTab.tscn b/Scenes/ChapterTab.tscn index c8907b3..b6b97bf 100644 --- a/Scenes/ChapterTab.tscn +++ b/Scenes/ChapterTab.tscn @@ -46,10 +46,12 @@ grow_vertical = 2 script = ExtResource("1_qo15t") [node name="PanelContainer2" type="PanelContainer" parent="."] +layout_mode = 2 offset_right = 1152.0 offset_bottom = 46.0 [node name="MarginContainer" type="MarginContainer" parent="PanelContainer2"] +layout_mode = 2 offset_right = 1152.0 offset_bottom = 46.0 theme_override_constants/margin_left = 10 @@ -58,6 +60,7 @@ theme_override_constants/margin_right = 10 theme_override_constants/margin_bottom = 10 [node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer2/MarginContainer"] +layout_mode = 2 offset_left = 10.0 offset_top = 10.0 offset_right = 1142.0 @@ -66,12 +69,14 @@ theme_override_constants/separation = 0 [node name="BookTitle" type="Label" parent="PanelContainer2/MarginContainer/HBoxContainer"] unique_name_in_owner = true +layout_mode = 2 offset_right = 38.0 offset_bottom = 26.0 text = "Luke" [node name="TextScroll" type="ScrollContainer" parent="."] visible = false +layout_mode = 2 offset_top = 50.0 offset_right = 1152.0 offset_bottom = 347.0 @@ -80,12 +85,14 @@ theme = SubResource("Theme_d175w") horizontal_scroll_mode = 0 [node name="PanelContainer" type="PanelContainer" parent="."] +layout_mode = 2 offset_top = 50.0 offset_right = 1152.0 offset_bottom = 648.0 size_flags_vertical = 3 [node name="MarginContainer" type="MarginContainer" parent="PanelContainer"] +layout_mode = 2 offset_right = 1152.0 offset_bottom = 598.0 theme_override_constants/margin_left = 10 @@ -95,17 +102,20 @@ theme_override_constants/margin_bottom = 10 [node name="TextScroll" type="ScrollContainer" parent="PanelContainer/MarginContainer"] unique_name_in_owner = true +layout_mode = 2 offset_left = 10.0 offset_top = 10.0 offset_right = 1142.0 offset_bottom = 588.0 theme = SubResource("Theme_d175w") script = ExtResource("2_h6cu7") -speed = 1.0 +speed = 3.0 damping = 0.05 +friction_scroll = 0.91 [node name="BibleText" type="RichTextLabel" parent="PanelContainer/MarginContainer/TextScroll"] unique_name_in_owner = true +layout_mode = 2 offset_right = 1132.0 offset_bottom = 920.0 size_flags_horizontal = 3 @@ -153,3 +163,6 @@ context_menu_enabled = true custom_effects = [ExtResource("3_i2cr3")] progress_bar_delay = 0 selection_enabled = true + +[connection signal="velocity_started" from="PanelContainer/MarginContainer/TextScroll" to="." method="_on_text_scroll_velocity_started"] +[connection signal="velocity_stopped" from="PanelContainer/MarginContainer/TextScroll" to="." method="_on_text_scroll_velocity_stopped"] diff --git a/addons/SmoothScroll/SmoothScrollContainer.gd b/addons/SmoothScroll/SmoothScrollContainer.gd index 11b2c97..d686141 100644 --- a/addons/SmoothScroll/SmoothScrollContainer.gd +++ b/addons/SmoothScroll/SmoothScrollContainer.gd @@ -4,8 +4,11 @@ ## functionality to a ScrollContainer extends ScrollContainer +signal velocity_started +signal velocity_stopped + # Drag impact for one scroll input -@export_range(10, 1) +@export_range(0, 100, 1) var speed := 2 # Softness of damping when "overdragging" @export_range(0, 1) @@ -48,48 +51,50 @@ func _process(delta: float) -> void: # If no scroll needed, don't apply forces if content_node.size.y - self.size.y < 1: return - + var d := delta # Distance between content_node's bottom and bottom of the scroll box var bottom_distance : float = content_node.position.y + content_node.size.y - self.size.y # Distance between content_node and top of the scroll box var top_distance : float = content_node.position.y - + # If overdragged on bottom: if bottom_distance< 0 : over_drag_multiplicator_bottom = 1/abs(bottom_distance)*10 else: over_drag_multiplicator_bottom = 1 - + # If overdragged on top: if top_distance> 0: over_drag_multiplicator_top = 1/abs(top_distance)*10 else: over_drag_multiplicator_top = 1 - + # Simulate friction velocity *= friction - + # If velocity is too low, just set it to 0 if velocity.length() <= just_stop_under: + if not is_zero_approx(velocity.length()): + velocity_stopped.emit() velocity = Vector2(0,0) - + # Applies counterforces when overdragging if bottom_distance< 0 : velocity.y = lerp(velocity.y, -bottom_distance/8, damping) if top_distance> 0: velocity.y = lerp(velocity.y, -top_distance/8, damping) - + # If using scroll bar dragging, set the content_node's # position by using the scrollbar position if scrolling: pos = content_node.position return - + # Move content node by applying velocity pos += velocity content_node.position = pos - + # Update vertical scroll bar set_v_scroll(-pos.y) @@ -102,14 +107,22 @@ func _gui_input(event: InputEvent) -> void: var scrolled = true match event.button_index: - MOUSE_BUTTON_WHEEL_DOWN: velocity.y -= speed - MOUSE_BUTTON_WHEEL_UP: velocity.y += speed + MOUSE_BUTTON_WHEEL_DOWN: + if is_zero_approx(velocity.length()): + velocity_started.emit() + velocity.y -= speed + MOUSE_BUTTON_WHEEL_UP: + if is_zero_approx(velocity.length()): + velocity_started.emit() + velocity.y += speed _: scrolled = false if scrolled: friction = friction_scroll elif event is InputEventScreenDrag: friction = friction_drag + if is_zero_approx(velocity.length()): + velocity_started.emit() if scroll_horizontal: velocity.x = event.relative.x if scroll_vertically: velocity.y = event.relative.y diff --git a/file.txt b/file.txt deleted file mode 100644 index cd9f179..0000000 --- a/file.txt +++ /dev/null @@ -1,994 +0,0 @@ - - - -
- - - - -