Skip to content

Commit 1df0ed3

Browse files
Update docs to: #182: Add Notification Manager ( autoload) (@mkh-user)
1 parent d762393 commit 1df0ed3

13 files changed

Lines changed: 170 additions & 347 deletions

docs/action_scripts.md

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,42 @@
11
# Action Scripts in Text Forge
22

3-
Action Scripts are a way to separate and manage possible actions in the Text Forge, helping them keep dozens of
4-
different capabilities separately and safely and add new capabilities in the shortest time.
3+
Action Scripts are a way to separate and manage possible actions in the Text Forge, helping them keep dozens of different capabilities separately and safely and add new capabilities in the shortest time.
54

65
## Design goals
76

8-
- Modularity: Each action script is an independent unit with a specified output and input, almost all Action Scripts are
9-
detachable from the editor without making an error in its performance
7+
- Modularity: Each action script is an independent unit with a specified output and input, almost all Action Scripts are detachable from the editor without making an error in its performance
108
- Development: Developers can design new capabilities through simple Action Script APIs
11-
- Accessibility: Action Scripts are easily accessible through code, command palette, and shortcuts
9+
- Accessibility: Action Scripts are easily accessible through menus, code, command palette, and shortcuts
1210

1311
## Structure
1412

15-
An action script must extend `ActionScript` or `MultiActionScript` class or another class that extends one of these
16-
classes. Each action script should be stored in `action_scripts/` directory and have snake_case file name of an option
17-
english name in menus. For example if we have a `Save As...` option in `File` menu, editor will load `action_scripts/save_as.gd`
18-
as its action script (will remove dots) and otherwise this action script will not be loaded.
13+
An action script must extend `ActionScript` or `MultiActionScript` class or another class that extends one of these classes. Each action script should be stored in `action_scripts/` directory and have snake_case file name of an option english name in menus. For example if we have a `Save As...` option in `File` menu, editor will load `action_scripts/save_as.gd` as its action script (will remove dots) and otherwise this action script will not be loaded.
1914

20-
Also, action scripts can have a shortcut in `shortcuts/` directory with same name. This file should be a `Shortcut`
21-
resource (`.tres` file) with a `InputEventKey` as shortcut. Loading shortcut will be done by `ActionScript` class.
15+
Also, action scripts can have a shortcut in `data/shortcuts.tres` resource file with same name as key. Value should be a `InputEventKey` resource. Loading shortcut will be done by `ShortcutMap` and `ActionScript` class.
2216

23-
All loaded action script will be children nodes of `Scripts` node in core, you can use `Global.get_scripts_node()` to
24-
access to it.
17+
All loaded action script will be children nodes of `Scripts` node in core, you can use `Global.get_scripts_node()` to access to it.
2518

26-
Each action script should override base class `Virtual` functions, you can see them in docstrings. There is a list of
27-
virtual functions of regular `ActionScript`:
19+
Each action script should override base class `Virtual` functions, you can see them in docstrings. There is a list of virtual functions of regular `ActionScript`:
2820
- `_initialize()`: For action script initializing
2921
- `_run_action()`: Main part of action script
3022

3123
## Features
3224

3325
### Access to menu option
3426

35-
Each action script have an item in menus, this item is accessible with `menu` and `index` property of action script.
36-
For checkbox and radio-checkbox options, editor will handle checking state itself.
27+
Each action script have an item in menus, this item is accessible with `menu` and `index` property of action script. For checkbox and radio-checkbox options, editor will handle checking state itself.
3728

3829
### Automated shortcut loading
3930

40-
`ActionScript` and `MultiActionScript` class will load shortcuts from `shortcuts/` directory and call required functions
41-
in shortcut pressing.
31+
`ActionScript` and `MultiActionScript` class will load shortcuts from `data/shortcuts.tres` resource and call required functions in shortcut pressing.
4232

4333
### Define commands
4434

45-
An action script will define itself as a command for command palette, so command palettes can list action scripts for
46-
user and run them based on selections. If an action script has shortcut, it will add that shortcut in commands database
47-
so users can see shortcuts in command palette.
35+
An action script will define itself as a command for command palette, so command palettes can list action scripts for user and run them based on selections. If an action script has shortcut, it will add that shortcut in commands database so users can see shortcuts in command palette.
4836

4937
### Automated enabling / disabling
5038

51-
`requires_file` and `requires_saved_file` properties can be used to make smarter action scripts, must action scripts
52-
just available when there is an opened file, so `requires_file == true` can disable them other times.
39+
The `requires_file` and `requires_saved_file` properties can make action scripts smarter. Most action scripts should only be available when a file is open, so setting `requires_file = true` disables them otherwise automatically.
5340

5441
## Create new action scripts
5542

docs/build.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
!!! Note
44

5-
This page currently haven't complete guide for build, there is just manual for open project source in Godot.
6-
To build editor from source use [this guide](https://docs.godotengine.org/en/stable/tutorials/export/exporting_projects.html)
7-
from official Godot docs.
5+
This page currently haven't complete guide for build, there is just manual for open project source in Godot. To build editor from source use [this guide](https://docs.godotengine.org/en/stable/tutorials/export/exporting_projects.html) from official Godot docs.
86

97
## Get Engine
108

docs/contributing.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,12 @@ Before opening an issue or submitting a pull request:
6262
```
6363
addons/ Third-party or custom Godot plugins
6464
assets/ Assets like images, fonts, icons
65-
data/ Config files and static data (e.g. menus)
66-
modes/ Standalone editing modes (e.g. HTML Mode)
65+
data/ Config files and static data (e.g. menus, shortcuts)
6766
docs/ Project documentation and external guides
6867
core/ Main application structure and base nodes
6968
action_scripts/ Action scripts and command logic
70-
action_scripts/scenes/ Scenes and assets tied to action scripts
71-
shortcuts/ Keybinding definitions for action scripts
69+
action_scripts/scenes/ Scenes and assets tied to action scripts
70+
tests/ Tests to track regressions and metrics
7271
```
7372

7473
---

docs/create_action_scripts.md

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,33 @@
77

88
There is a checklist before selecting action script as your solution:
99

10-
- I need add an action that user can trigger it?
10+
- I need to add an action that a user can trigger?
1111

12-
If yes, It **can** be action script. Users can use menus, shortcuts, and commands to trigger action scripts. You can
13-
use other ways to add triggerable actions, but action scripts are a standard way, specially for a lot of actions.
12+
If yes, it **can** be an action script. Users can trigger action scripts via menus, shortcuts, and commands. You can add triggerable actions in other ways, but action scripts are the standard approach for many actions.
1413

15-
- I need add a new option in menus?
14+
- I need to add a new option in menus?
1615

17-
If yes, It **must** be action script. Everything in menus is action script.
16+
If yes, it **must** be an action script. Everything in menus is implemented via an action script.
1817

19-
- I need add a new command?
18+
- I need to add a new command?
2019

21-
If yes, It **may** be action script. Action scripts have internal command defining system, and you can use them from
22-
command palette, but you can define commands from everywhere in Text Forge, in modes, panels, extensions, action scripts, etc.
20+
If yes, it **may** be an action script. Action scripts have an internal command-definition system, and you can use them from the command palette, but commands can also be defined in modes, panels, extensions, action scripts, and other parts of Text Forge.
2321

2422
## Regular action scripts
2523

26-
There is some different types of action scripts based on their base classes, `ActionScript` class designed for regular
27-
action scripts and can handle a lot of tasks.
24+
There are different types of action scripts based on their base classes. The `ActionScript` class is designed for regular action scripts and can handle many tasks.
2825

29-
To add new action script you should make sure there is an item in menus for that action script, you can use `data/main_ui.ini`
30-
to add new options (or menus), to understand about structure of this file you can see [here](https://text-forge.github.io/docs/data_driven_ui/#menus).
31-
After select your option create a script in `action_scripts/` directory with same name (but in snake_case), it this case
32-
we will create **Copy Path** action script that will copy file path of opened file in clipboard, so we will create
33-
`action_scripts/copy_path.gd` and use this script as start point:
26+
To add a new action script, first ensure there is a matching menu item. You can add options (or menus) in `data/main_ui.ini`; see the [Data-driven UI menu structure](https://text-forge.github.io/docs/data_driven_ui/#menus). After selecting your option, create a script in the `action_scripts/` directory with the same name in snake_case. In this example, we will create a **Copy Path** action script to copy the currently opened file path to the clipboard, so we create `action_scripts/copy_path.gd` and start with:
3427

3528
```gdscript
3629
extends ActionScript
3730
```
3831

39-
Just that! Run project and see option is enabled. But there is no action for now, so we have 3 steps to complete our
40-
action script:
32+
That’s it for setup. Run the project and confirm the option is enabled. There is no behavior yet, so complete these three steps:
4133

4234
### Add initializing
4335

44-
We needn't any special initializing for this action script, all we need is disabling it when there is no opened file,
45-
there is ready-made feature for this:
36+
We don't need special initialization for this action script. We only need to disable when no file exists or when the file hasn’t been saved yet; `ActionScript` already provides this:
4637

4738
```gdscript
4839
extends ActionScript
@@ -52,15 +43,11 @@ func _initialize() -> void:
5243
requires_saved_file = true
5344
```
5445

55-
With this function `ActionScript` class will disable option when there isn't saved file, it means when you create a new
56-
file this option will keep disabled until that file saved, because before that there is no file path. Otherwise, (for
57-
example when user uses Open) option will be enabled.
46+
With this function, `ActionScript` disables the option when no saved file exists. For example, after creating a new file, the option stays disabled until the file is saved (because no file path exists yet). When opening an existing file, the option is enabled.
5847

5948
### Add main action
6049

61-
We have initialized action script, but there is no action, so let's add it. To do this we use `_run_action()` function,
62-
this function will be called when user clicks in option in menus, presses shortcut (we will add shortcut later) or uses
63-
command palette. So we can complete our action script with this function:
50+
We have initialized the action script, but it still has no behavior, so let’s add it. We do this with `_run_action()`, which runs when the user clicks the menu option, presses the shortcut (added later), or uses the command palette.
6451

6552
```gdscript
6653
extends ActionScript
@@ -73,13 +60,8 @@ func _run_action() -> void:
7360
DisplayServer.clipboard_set(Global.get_file_path())
7461
```
7562

76-
Almost done! We have completed action script, and you can try it now in witch way you want.
63+
Almost done! The action script logic is complete, and you can try it now. Next, we'll add a shortcut.
7764

7865
### Add shortcut
7966

80-
There is an easy way for adding shortcuts to action scripts, so let's see how we can do it. To have shortcut we need a
81-
`Shortcut` resource stored in `shortcuts/` directory, so go to Godot's FileSystem dock and use RMB on `res://shortcuts/`,
82-
then click on Create New > Resource... and create a `Shortcut` resource and save it as `copy_path.tres`. Shortcut will
83-
be opened in Inspector, click on `Events` and add new element, then create a new `InputEventKey` in that element. Use
84-
`Configure` button and set your shortcut, then run project and try it. You can open command palette (Ctrl+P) and type `copy path`
85-
to see shortcut.
67+
To add a shortcut, open `data/shortcuts.tres` from Godot’s FileSystem dock and add a new `String: InputEventKey` pair (for example, key `copy_path`). Click **Configure** to set the keybinding, run the project, then open the command palette (`Ctrl+P`) and type `copy path` to confirm the shortcut appears.

docs/data_driven_ui.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
# Explanation about Text Forge "Data Driven UI"
22

3-
Text Forge uses a data driven system for important parts UI, including menu options and texts. This architecture make
4-
a dynamic UI and clean translation system.
3+
Text Forge uses a data-driven system for important parts of the UI, including menu options and texts. This architecture makes a dynamic UI and a clean translation system.
54

65
## Menus
76

8-
All data related to menus stored in `data/main_ui.ini`, this file have a section for menus and a key for each menu (or
9-
submenu). Each item is an array of dictionaries and each dictionary has the following structure:
7+
All data related to menus is stored in `data/main_ui.ini`. This file has a section for menus and a key for each menu (or submenu). Each item is an array of dictionaries and each dictionary has the following structure:
108

11-
- `"code"` - a unique integer for connect this option to its action script, its value can be any non-negative int bug must
12-
be unique.
9+
- `"code"` - a unique integer used to connect this option to its action script; its value can be any non-negative int but must be unique.
1310
- `"text"` - english text of option, it will be used for add name to action scripts and call them based on names.
1411
- `"key"` - linked translation key in translation file, menu loader will use it to set item text.
1512
- `"type"` - an integer related to option type, this key can have these values:
@@ -19,12 +16,4 @@ submenu). Each item is an array of dictionaries and each dictionary has the foll
1916
- `2` - Checkbox
2017
- `3` - Radio Checkbox
2118

22-
Each key must have `_menu` or `_submenu` suffix, items with `_menu` suffix will load in main menu and items with `_submenu`
23-
suffix will load as submenus based on texts, for example `Convert Case` submenu in `Edit` menu will load from `convert_case_submenu`
24-
key (snake case of submenu text with suffix).
25-
26-
## Panels
27-
28-
To handle panels, we have `data/panels/` folder. Here, each panel have a folder with icon, configuration file, and scene.
29-
In config file, we have place of panel (`R`, `L`, or `B`). Panel manager will load panels from here based on configuration
30-
file and stored files.
19+
Each key must have a `_menu` or `_submenu` suffix. Items with the `_menu` suffix will load in the main menu, and items with the `_submenu` suffix will load as submenus based on their texts. For example, the `Convert Case` submenu in the `Edit` menu will load from the `convert_case_submenu` key (snake case of submenu text with suffix).

docs/index.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Text Forge Documentation
22

3-
Welcome to the official documentation of **Text Forge** — a modular, extensible, and language-agnostic text editor
4-
built with user empowerment at its core.
3+
Welcome to the official documentation of **Text Forge** — a modular, extensible, and language-agnostic text editor built with user empowerment at its core.
54

6-
Whether you're a developer, programmer, or data manager, Text Forge gives you the tools to shape your editing experience
7-
exactly the way you want.
5+
Whether you're a developer, programmer, or data manager, Text Forge gives you the tools to shape your editing experience exactly the way you want.
86

97
---
108

@@ -47,8 +45,7 @@ New to Text Forge? Start here: [Introduction to Text Forge](introduction.md)
4745

4846
## 🛠️ Contribute
4947

50-
Text Forge is open source and community-driven. Join us on [GitHub](https://github.com/text-forge/text-forge), share
51-
your ideas, and help shape the future of the editor.
48+
Text Forge is open source and community-driven. Join us on [GitHub](https://github.com/text-forge/text-forge), share your ideas, and help shape the future of the editor.
5249

5350
Note that here is for documentations, so if you want to contribute in main project, please see [here](https://github.com/text-forge/text-forge)
5451

0 commit comments

Comments
 (0)