2022-12-21 14:31:33 +01:00
|
|
|
Up: [README.md](../README.md), Prev: [Section 15](sec15.md), Next: [Section 17](sec17.md)
|
2021-01-11 03:15:04 +01:00
|
|
|
|
2022-12-21 14:31:33 +01:00
|
|
|
# How to build tfe (text file editor)
|
2020-12-22 03:30:06 +01:00
|
|
|
|
2021-06-19 08:52:24 +02:00
|
|
|
## How to compile and execute the text editor 'tfe'.
|
2020-12-22 03:30:06 +01:00
|
|
|
|
2022-12-21 14:31:33 +01:00
|
|
|
First, source files are in the [Gtk4-tutorila repository](https://github.com/ToshioCP/Gtk4-tutorial).
|
2021-06-15 04:24:42 +02:00
|
|
|
How to download them is written at the end of the [previous section](sec15.md).
|
2020-12-22 03:30:06 +01:00
|
|
|
|
2021-06-15 04:24:42 +02:00
|
|
|
The following is the instruction of compilation and execution.
|
2020-12-22 03:30:06 +01:00
|
|
|
|
2021-06-15 04:24:42 +02:00
|
|
|
- You need meson and ninja.
|
2022-12-21 14:31:33 +01:00
|
|
|
- If you have installed gtk4 from the source, you need to set environment variables to suit your installation.
|
|
|
|
- Change your current directory to `src/tfe5` directory.
|
2023-07-15 10:27:53 +02:00
|
|
|
- Type `meson setup _build` for configuration.
|
2022-12-21 14:31:33 +01:00
|
|
|
- Type `ninja -C _build` for compilation.
|
2021-06-19 08:52:24 +02:00
|
|
|
Then the application `tfe` is built under the `_build` directory.
|
2022-12-21 14:31:33 +01:00
|
|
|
- Type `_build/tfe` to execute it.
|
2020-12-22 03:30:06 +01:00
|
|
|
|
2021-06-15 04:24:42 +02:00
|
|
|
Then the window appears.
|
|
|
|
There are four buttons, `New`, `Open`, `Save` and `Close`.
|
2020-12-22 03:30:06 +01:00
|
|
|
|
2023-07-15 10:27:53 +02:00
|
|
|
- Click on `Open` button, then a file chooser dialog appears.
|
2021-06-15 04:24:42 +02:00
|
|
|
Choose a file in the list and click on `Open` button.
|
|
|
|
Then the file is read and a new Notebook Page appears.
|
|
|
|
- Edit the file and click on `Save` button, then the text is saved to the original file.
|
|
|
|
- Click `Close`, then the Notebook Page disappears.
|
|
|
|
- Click `Close` again, then the `Untitled` Notebook Page disappears and at the same time the application quits.
|
2020-12-22 03:30:06 +01:00
|
|
|
|
2021-06-15 04:24:42 +02:00
|
|
|
This is a very simple editor.
|
|
|
|
It is a good practice for you to add more features.
|
2020-12-22 03:30:06 +01:00
|
|
|
|
2021-06-15 04:24:42 +02:00
|
|
|
## Total number of lines, words and characters
|
|
|
|
|
|
|
|
~~~
|
2022-12-21 14:31:33 +01:00
|
|
|
$ LANG=C wc tfe5/meson.build tfe5/tfeapplication.c tfe5/tfe.gresource.xml tfe5/tfenotebook.c tfe5/tfenotebook.h tfetextview/tfetextview.c tfetextview/tfetextview.h tfe5/tfe.ui
|
2022-08-27 14:43:28 +02:00
|
|
|
10 17 294 tfe5/meson.build
|
2023-07-15 10:27:53 +02:00
|
|
|
110 334 3601 tfe5/tfeapplication.c
|
2022-08-27 14:43:28 +02:00
|
|
|
6 9 153 tfe5/tfe.gresource.xml
|
2023-07-15 10:27:53 +02:00
|
|
|
144 390 3668 tfe5/tfenotebook.c
|
2022-08-27 14:43:28 +02:00
|
|
|
15 21 241 tfe5/tfenotebook.h
|
2023-07-15 10:27:53 +02:00
|
|
|
235 821 8473 tfetextview/tfetextview.c
|
|
|
|
32 54 624 tfetextview/tfetextview.h
|
2022-08-27 14:43:28 +02:00
|
|
|
61 100 2073 tfe5/tfe.ui
|
2023-07-15 10:27:53 +02:00
|
|
|
613 1746 19127 total
|
2021-06-15 04:24:42 +02:00
|
|
|
~~~
|
2020-12-22 03:30:06 +01:00
|
|
|
|
2022-12-21 14:31:33 +01:00
|
|
|
Up: [README.md](../README.md), Prev: [Section 15](sec15.md), Next: [Section 17](sec17.md)
|