[latexila] Structure: document why a custom GtkTreeModel is used
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Structure: document why a custom GtkTreeModel is used
- Date: Sat, 29 Mar 2014 12:05:23 +0000 (UTC)
commit 86b9d1c22ee6de82b0cdf25d1bbce49c8610caea
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Mar 29 13:04:15 2014 +0100
Structure: document why a custom GtkTreeModel is used
src/structure_model.vala | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/structure_model.vala b/src/structure_model.vala
index f6c9458..c2f0618 100644
--- a/src/structure_model.vala
+++ b/src/structure_model.vala
@@ -23,6 +23,18 @@ using Gtk;
// View: structure.vala
// Controller: document_structure.vala
+// A custom GtkTreeModel based on GNode (N-ary tree) is used instead of GtkTreeStore for
+// several reasons:
+// - The tree must be traversed to know where to insert a new item. Traversing a
+// GtkTreeStore is not convenient and is slower than traversing a GNode.
+// - For the right click actions (cut, comment, shift left/right, etc), some items must be
+// moved or removed in the middle of the tree. It is not easily feasible with
+// GtkTreeStore to move a node with all its children, the items must be removed and
+// reinserted one by one. On the other hand we can do that easily with GNode.
+// - For the future, if we want to implement the update on the fly of the structure when
+// the document is modified, some items must also be moved, removed, inserted in the
+// middle, etc.
+
public struct StructData
{
StructType type;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]