Other type of conditions may be available in the future version.
The code analyzing @@@if series command is rather complicated. It is based on the state diagram below.
@@@table
This type of @@@ command starts with a line begins with “@@@table”. The contents of this command is a table of GFM or pandoc’s markdown. The command makes a table easy to read. For example, a text file sample.md has a table like this:
diff --git a/docs/image/TfeTextView.png b/docs/image/TfeTextView.png
new file mode 100644
index 0000000..0861906
Binary files /dev/null and b/docs/image/TfeTextView.png differ
diff --git a/docs/image/TfeTextViewClass.png b/docs/image/TfeTextViewClass.png
new file mode 100644
index 0000000..35cebea
Binary files /dev/null and b/docs/image/TfeTextViewClass.png differ
diff --git a/docs/image/box.png b/docs/image/box.png
new file mode 100644
index 0000000..7b31757
Binary files /dev/null and b/docs/image/box.png differ
diff --git a/docs/image/cairo.png b/docs/image/cairo.png
new file mode 100644
index 0000000..bb0a3bc
Binary files /dev/null and b/docs/image/cairo.png differ
diff --git a/docs/image/child.png b/docs/image/child.png
new file mode 100644
index 0000000..8e0d713
Binary files /dev/null and b/docs/image/child.png differ
diff --git a/docs/image/color.png b/docs/image/color.png
new file mode 100644
index 0000000..f0c4294
Binary files /dev/null and b/docs/image/color.png differ
diff --git a/docs/image/column.png b/docs/image/column.png
new file mode 100644
index 0000000..3e11c02
Binary files /dev/null and b/docs/image/column.png differ
diff --git a/docs/image/column_view.png b/docs/image/column_view.png
new file mode 100644
index 0000000..71ebc14
Binary files /dev/null and b/docs/image/column_view.png differ
diff --git a/docs/image/da1.png b/docs/image/da1.png
new file mode 100644
index 0000000..a7af64c
Binary files /dev/null and b/docs/image/da1.png differ
diff --git a/docs/image/dialog_warning.png b/docs/image/dialog_warning.png
new file mode 100644
index 0000000..8622e57
Binary files /dev/null and b/docs/image/dialog_warning.png differ
diff --git a/docs/image/directorylist.png b/docs/image/directorylist.png
new file mode 100644
index 0000000..6db3440
Binary files /dev/null and b/docs/image/directorylist.png differ
diff --git a/docs/image/dispose_handler.png b/docs/image/dispose_handler.png
new file mode 100644
index 0000000..4e2d713
Binary files /dev/null and b/docs/image/dispose_handler.png differ
diff --git a/docs/image/expression.png b/docs/image/expression.png
new file mode 100644
index 0000000..9965f27
Binary files /dev/null and b/docs/image/expression.png differ
diff --git a/docs/image/gnome_calculator_advanced.png b/docs/image/gnome_calculator_advanced.png
new file mode 100644
index 0000000..e12ee07
Binary files /dev/null and b/docs/image/gnome_calculator_advanced.png differ
diff --git a/docs/image/gnome_calculator_basic.png b/docs/image/gnome_calculator_basic.png
new file mode 100644
index 0000000..d0d6edc
Binary files /dev/null and b/docs/image/gnome_calculator_basic.png differ
diff --git a/docs/image/list.png b/docs/image/list.png
new file mode 100644
index 0000000..09bfbef
Binary files /dev/null and b/docs/image/list.png differ
diff --git a/docs/image/list3.png b/docs/image/list3.png
new file mode 100644
index 0000000..89f9c77
Binary files /dev/null and b/docs/image/list3.png differ
diff --git a/docs/image/list4.png b/docs/image/list4.png
new file mode 100644
index 0000000..91c1d7a
Binary files /dev/null and b/docs/image/list4.png differ
diff --git a/docs/image/menu.png b/docs/image/menu.png
new file mode 100644
index 0000000..bf20ecd
Binary files /dev/null and b/docs/image/menu.png differ
diff --git a/docs/image/menu1.png b/docs/image/menu1.png
new file mode 100644
index 0000000..8617334
Binary files /dev/null and b/docs/image/menu1.png differ
diff --git a/docs/image/menu1_screenshot.png b/docs/image/menu1_screenshot.png
new file mode 100644
index 0000000..0fb9537
Binary files /dev/null and b/docs/image/menu1_screenshot.png differ
diff --git a/docs/image/menu2.png b/docs/image/menu2.png
new file mode 100644
index 0000000..b3fa53a
Binary files /dev/null and b/docs/image/menu2.png differ
diff --git a/docs/image/menu3.png b/docs/image/menu3.png
new file mode 100644
index 0000000..261ef3c
Binary files /dev/null and b/docs/image/menu3.png differ
diff --git a/docs/image/menu_structure.png b/docs/image/menu_structure.png
new file mode 100644
index 0000000..1442abd
Binary files /dev/null and b/docs/image/menu_structure.png differ
diff --git a/docs/image/open.png b/docs/image/open.png
new file mode 100644
index 0000000..378b899
Binary files /dev/null and b/docs/image/open.png differ
diff --git a/docs/image/proc_call.png b/docs/image/proc_call.png
new file mode 100644
index 0000000..357bcfb
Binary files /dev/null and b/docs/image/proc_call.png differ
diff --git a/docs/image/rectangle.png b/docs/image/rectangle.png
new file mode 100644
index 0000000..e79986e
Binary files /dev/null and b/docs/image/rectangle.png differ
diff --git a/docs/image/refcount.png b/docs/image/refcount.png
new file mode 100644
index 0000000..407740a
Binary files /dev/null and b/docs/image/refcount.png differ
diff --git a/docs/image/saveas.png b/docs/image/saveas.png
new file mode 100644
index 0000000..c9c1775
Binary files /dev/null and b/docs/image/saveas.png differ
diff --git a/docs/image/screenshot_gtk_notebook.png b/docs/image/screenshot_gtk_notebook.png
new file mode 100644
index 0000000..b61771f
Binary files /dev/null and b/docs/image/screenshot_gtk_notebook.png differ
diff --git a/docs/image/screenshot_lb1.png b/docs/image/screenshot_lb1.png
new file mode 100644
index 0000000..7452b94
Binary files /dev/null and b/docs/image/screenshot_lb1.png differ
diff --git a/docs/image/screenshot_lb2.png b/docs/image/screenshot_lb2.png
new file mode 100644
index 0000000..858ae6e
Binary files /dev/null and b/docs/image/screenshot_lb2.png differ
diff --git a/docs/image/screenshot_lb4.png b/docs/image/screenshot_lb4.png
new file mode 100644
index 0000000..243ddd7
Binary files /dev/null and b/docs/image/screenshot_lb4.png differ
diff --git a/docs/image/screenshot_list4.png b/docs/image/screenshot_list4.png
new file mode 100644
index 0000000..c162b25
Binary files /dev/null and b/docs/image/screenshot_list4.png differ
diff --git a/docs/image/screenshot_pr3.png b/docs/image/screenshot_pr3.png
new file mode 100644
index 0000000..57a4a88
Binary files /dev/null and b/docs/image/screenshot_pr3.png differ
diff --git a/docs/image/screenshot_pr4.png b/docs/image/screenshot_pr4.png
new file mode 100644
index 0000000..281ae5b
Binary files /dev/null and b/docs/image/screenshot_pr4.png differ
diff --git a/docs/image/screenshot_tfe2.png b/docs/image/screenshot_tfe2.png
new file mode 100644
index 0000000..e41f432
Binary files /dev/null and b/docs/image/screenshot_tfe2.png differ
diff --git a/docs/image/screenshot_tfv1.png b/docs/image/screenshot_tfv1.png
new file mode 100644
index 0000000..f369509
Binary files /dev/null and b/docs/image/screenshot_tfv1.png differ
diff --git a/docs/image/screenshot_tfv3.png b/docs/image/screenshot_tfv3.png
new file mode 100644
index 0000000..0f59844
Binary files /dev/null and b/docs/image/screenshot_tfv3.png differ
diff --git a/docs/image/stack.png b/docs/image/stack.png
new file mode 100644
index 0000000..a2b440c
Binary files /dev/null and b/docs/image/stack.png differ
diff --git a/docs/image/state_diagram.png b/docs/image/state_diagram.png
new file mode 100644
index 0000000..51edbe7
Binary files /dev/null and b/docs/image/state_diagram.png differ
diff --git a/docs/image/table.png b/docs/image/table.png
new file mode 100644
index 0000000..ee3d100
Binary files /dev/null and b/docs/image/table.png differ
diff --git a/docs/image/tfe6.png b/docs/image/tfe6.png
new file mode 100644
index 0000000..3133cf6
Binary files /dev/null and b/docs/image/tfe6.png differ
diff --git a/docs/image/transformation.png b/docs/image/transformation.png
new file mode 100644
index 0000000..ff42044
Binary files /dev/null and b/docs/image/transformation.png differ
diff --git a/docs/image/tree2.png b/docs/image/tree2.png
new file mode 100644
index 0000000..9d63948
Binary files /dev/null and b/docs/image/tree2.png differ
diff --git a/docs/image/turtle.png b/docs/image/turtle.png
new file mode 100644
index 0000000..e37513f
Binary files /dev/null and b/docs/image/turtle.png differ
diff --git a/docs/image/turtle1.png b/docs/image/turtle1.png
new file mode 100644
index 0000000..847ce5f
Binary files /dev/null and b/docs/image/turtle1.png differ
diff --git a/docs/image/turtle2.png b/docs/image/turtle2.png
new file mode 100644
index 0000000..c2f9a5c
Binary files /dev/null and b/docs/image/turtle2.png differ
diff --git a/docs/image/turtle3.png b/docs/image/turtle3.png
new file mode 100644
index 0000000..6f89cde
Binary files /dev/null and b/docs/image/turtle3.png differ
diff --git a/docs/image/turtle_compile_process.png b/docs/image/turtle_compile_process.png
new file mode 100644
index 0000000..015ead7
Binary files /dev/null and b/docs/image/turtle_compile_process.png differ
diff --git a/docs/image/turtle_koch.png b/docs/image/turtle_koch.png
new file mode 100644
index 0000000..f438380
Binary files /dev/null and b/docs/image/turtle_koch.png differ
diff --git a/docs/image/turtle_parser_tree.png b/docs/image/turtle_parser_tree.png
new file mode 100644
index 0000000..53906a2
Binary files /dev/null and b/docs/image/turtle_parser_tree.png differ
diff --git a/docs/image/turtle_square_koch.png b/docs/image/turtle_square_koch.png
new file mode 100644
index 0000000..4c514c9
Binary files /dev/null and b/docs/image/turtle_square_koch.png differ
diff --git a/docs/image/turtle_tree.png b/docs/image/turtle_tree.png
new file mode 100644
index 0000000..0ad22b0
Binary files /dev/null and b/docs/image/turtle_tree.png differ
diff --git a/docs/image/window_widget.png b/docs/image/window_widget.png
new file mode 100644
index 0000000..713ff43
Binary files /dev/null and b/docs/image/window_widget.png differ
diff --git a/docs/sec11.html b/docs/sec11.html
index 3f73401..abe75b4 100644
--- a/docs/sec11.html
+++ b/docs/sec11.html
@@ -113,7 +113,7 @@
Initialization and destruction of instances
-
A new version of the text file editor (tfe) will be made in this section and the following four sections. It is tfe5. There are many changes from the prior version. All the sources are listed in Section 16. They are located in two directories, src/tfe5 and src/tfetextview.
+
A new version of the text file editor (tfe) will be made in this section and the following four sections. It is tfe5. There are many changes from the prior version. All the sources are listed in Section 16. They are located in two directories, src/tfe5 and src/tfetextview.
Encapsulation
We’ve divided C source file into two parts. But it is not enough in terms of encapsulation.
@@ -172,7 +172,7 @@
};
In each structure, its parent is declared at the top of the members. So, every ancestors is included in the child instance. This is very important. It guarantees a child widget to inherit all the features from ancestors. The structure of TfeTextView is like the following diagram.
Initialization of a TfeTextView instance
The function tfe_text_view_new creates a new TfeTextView instance.
@@ -387,13 +387,13 @@
TfeTextViewClass includes its ancestors’ class in it. It is illustrated in the following diagram.
Destruction of TfeTextView
Every Object derived from GObject has a reference count. If an object A refers to an object B, then A keeps a pointer to B in A and at the same time increases the reference count of B by one with the function g_object_ref (B). If A doesn’t need B any longer, then A discards the pointer to B (usually it is done by assigning NULL to the pointer) and decreases the reference count of B by one with the function g_object_unref (B).
If two objects A and B refer to C, then the reference count of C is two. If A no longer needs C, A discards the pointer to C and decreases the reference count in C by one. Now the reference count of C is one. In the same way, if B no longer needs C, B discards the pointer to C and decreases the reference count in C by one. At this moment, no object refers to C and the reference count of C is zero. This means C is no longer useful. Then C destructs itself and finally the memories allocated to C is freed.
The idea above is based on an assumption that an object referred by nothing has reference count of zero. When the reference count drops to zero, the object starts its destruction process. The destruction process is split into two phases: disposing and finalizing. In the disposing process, the object invokes the function pointed by dispose in its class to release all references to other objects. In the finalizing process, it invokes the function pointed by finalize in its class to complete the destruction process. These functions are also called handlers or methods. For example, dispose handler or dispose method.
In the destruction process of TfeTextView, the reference count of widgets related to TfeTextView is automatically decreased. But GFile pointed by tv->file needs to decrease its reference count by one. You must write the code in the dispose handler tfe_text_view_dispose.
@@ -420,7 +420,7 @@
}
Each ancestors’ class has been created before TfeTextViewClass is created. Therefore, there are four classes and each class has a pointer to each dispose handler. Look at the following diagram. There are four classes – GObjectClass (GInitiallyUnownedClass), GtkWidgetClass, GtkTextViewClass and TfeTextViewClass. Each class has its own dispose handler – dh1, dh2, dh3 and tfe_text_view_dispose.
Now, look at the tfe_text_view_dispose program above. It first releases the reference to GFile object pointed by tv->file. Then it invokes its parent’s dispose handler in line 8.
When you use GtkFileChooserDialog, you need to divide the program into two parts. One is a function which creates GtkFileChooserDialog and the other is a signal handler. The function just creates and shows GtkFileChooserDialog. The rest is done by the handler. It gets Gfile from GtkFileChooserDialog and saves the buffer to the file by calling save_file.
Open function
@@ -397,7 +397,7 @@
Now let’s think about the whole process between the caller and TfeTextView. It is shown in the following diagram and you would think that it is really complicated. Because signal is the only way for GtkFileChooserDialog to communicate with others. In Gtk3, gtk_dialog_run function is available. It simplifies the process. However, in Gtk4, gtk_dialog_run is unavailable any more.
A caller gets a pointer tv to a TfeTextView instance by calling tfe_text_view_new.
@@ -420,8 +420,8 @@
}
The important thing is to duplicate tv->file. Otherwise, if the caller frees the GFile object, tv->file is no more guaranteed to point the GFile. Another reason to use g_file_dup is that GFile isn’t thread-safe. If you use GFile in the different thread, the duplication is necessary. See Gio API Reference, g_file_dup.