Make tree_is_expanded array static, add setter/getter function.
svn path=/trunk/; revision=50433
This commit is contained in:
parent
cd7712fd2f
commit
792f35a28c
16
epan/proto.c
16
epan/proto.c
|
@ -304,7 +304,7 @@ static void save_same_name_hfinfo(gpointer data)
|
||||||
/* Points to the first element of an array of Booleans, indexed by
|
/* Points to the first element of an array of Booleans, indexed by
|
||||||
a subtree item type; that array element is TRUE if subtrees of
|
a subtree item type; that array element is TRUE if subtrees of
|
||||||
an item of that type are to be expanded. */
|
an item of that type are to be expanded. */
|
||||||
gboolean *tree_is_expanded;
|
static gboolean *tree_is_expanded;
|
||||||
|
|
||||||
/* Number of elements in that array. */
|
/* Number of elements in that array. */
|
||||||
int num_tree_types;
|
int num_tree_types;
|
||||||
|
@ -7404,6 +7404,20 @@ proto_check_field_name(const gchar *field_name)
|
||||||
return wrs_check_charset(fld_abbrev_chars, field_name);
|
return wrs_check_charset(fld_abbrev_chars, field_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
tree_expanded(int tree_type)
|
||||||
|
{
|
||||||
|
g_assert(tree_type >= 0 && tree_type < num_tree_types);
|
||||||
|
return tree_is_expanded[tree_type];
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
tree_expanded_set(int tree_type, gboolean value)
|
||||||
|
{
|
||||||
|
g_assert(tree_type >= 0 && tree_type < num_tree_types);
|
||||||
|
tree_is_expanded[tree_type] = value;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||||
*
|
*
|
||||||
|
|
13
epan/proto.h
13
epan/proto.h
|
@ -1852,17 +1852,16 @@ WS_DLL_PUBLIC void proto_registrar_dump_fields(void);
|
||||||
WS_DLL_PUBLIC void proto_registrar_dump_ftypes(void);
|
WS_DLL_PUBLIC void proto_registrar_dump_ftypes(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Points to the first element of an array of Booleans, indexed by
|
|
||||||
a subtree item type. That array element is TRUE if subtrees of
|
|
||||||
an item of that type are to be expanded. With MSVC and a
|
|
||||||
libwireshark.dll, we need a special declaration. */
|
|
||||||
WS_DLL_PUBLIC gboolean *tree_is_expanded;
|
|
||||||
|
|
||||||
/** Number of elements in the tree_is_expanded array. With MSVC and a
|
/** Number of elements in the tree_is_expanded array. With MSVC and a
|
||||||
* libwireshark.dll, we need a special declaration. */
|
* libwireshark.dll, we need a special declaration. */
|
||||||
WS_DLL_PUBLIC int num_tree_types;
|
WS_DLL_PUBLIC int num_tree_types;
|
||||||
|
|
||||||
|
/** Returns TRUE if subtrees of that type are to be expanded. */
|
||||||
|
WS_DLL_PUBLIC gboolean tree_expanded(int tree_type);
|
||||||
|
|
||||||
|
/** Sets if subtrees of that type are to be expanded. */
|
||||||
|
WS_DLL_PUBLIC void tree_expanded_set(int tree_type, gboolean value);
|
||||||
|
|
||||||
/** glib doesn't have g_ptr_array_len of all things!*/
|
/** glib doesn't have g_ptr_array_len of all things!*/
|
||||||
#ifndef g_ptr_array_len
|
#ifndef g_ptr_array_len
|
||||||
#define g_ptr_array_len(a) ((a)?(a)->len:0)
|
#define g_ptr_array_len(a) ((a)?(a)->len:0)
|
||||||
|
|
2
print.c
2
print.c
|
@ -238,7 +238,7 @@ void proto_tree_print_node(proto_node *node, gpointer data)
|
||||||
g_assert((fi->tree_type >= -1) && (fi->tree_type < num_tree_types));
|
g_assert((fi->tree_type >= -1) && (fi->tree_type < num_tree_types));
|
||||||
if ((pdata->print_dissections == print_dissections_expanded) ||
|
if ((pdata->print_dissections == print_dissections_expanded) ||
|
||||||
((pdata->print_dissections == print_dissections_as_displayed) &&
|
((pdata->print_dissections == print_dissections_as_displayed) &&
|
||||||
(fi->tree_type >= 0) && tree_is_expanded[fi->tree_type])) {
|
(fi->tree_type >= 0) && tree_expanded(fi->tree_type))) {
|
||||||
if (node->first_child != NULL) {
|
if (node->first_child != NULL) {
|
||||||
pdata->level++;
|
pdata->level++;
|
||||||
proto_tree_children_foreach(node,
|
proto_tree_children_foreach(node,
|
||||||
|
|
|
@ -214,11 +214,8 @@ expand_tree(GtkTreeView *tree_view, GtkTreeIter *iter,
|
||||||
* Nodes with "finfo->tree_type" of -1 have no ett_ value, and
|
* Nodes with "finfo->tree_type" of -1 have no ett_ value, and
|
||||||
* are thus presumably leaf nodes and cannot be expanded.
|
* are thus presumably leaf nodes and cannot be expanded.
|
||||||
*/
|
*/
|
||||||
if (finfo->tree_type != -1) {
|
if (finfo->tree_type != -1)
|
||||||
g_assert(finfo->tree_type >= 0 &&
|
tree_expanded_set(finfo->tree_type, TRUE);
|
||||||
finfo->tree_type < num_tree_types);
|
|
||||||
tree_is_expanded[finfo->tree_type] = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -236,11 +233,8 @@ collapse_tree(GtkTreeView *tree_view, GtkTreeIter *iter,
|
||||||
* Nodes with "finfo->tree_type" of -1 have no ett_ value, and
|
* Nodes with "finfo->tree_type" of -1 have no ett_ value, and
|
||||||
* are thus presumably leaf nodes and cannot be collapsed.
|
* are thus presumably leaf nodes and cannot be collapsed.
|
||||||
*/
|
*/
|
||||||
if (finfo->tree_type != -1) {
|
if (finfo->tree_type != -1)
|
||||||
g_assert(finfo->tree_type >= 0 &&
|
tree_expanded_set(finfo->tree_type, FALSE);
|
||||||
finfo->tree_type < num_tree_types);
|
|
||||||
tree_is_expanded[finfo->tree_type] = FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct field_lookup_info {
|
struct field_lookup_info {
|
||||||
|
@ -1288,9 +1282,10 @@ void
|
||||||
expand_all_tree(proto_tree *protocol_tree _U_, GtkWidget *tree_view)
|
expand_all_tree(proto_tree *protocol_tree _U_, GtkWidget *tree_view)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i < num_tree_types; i++) {
|
|
||||||
tree_is_expanded[i] = TRUE;
|
for(i=0; i < num_tree_types; i++)
|
||||||
}
|
tree_expanded_set(i, TRUE);
|
||||||
|
|
||||||
gtk_tree_view_expand_all(GTK_TREE_VIEW(tree_view));
|
gtk_tree_view_expand_all(GTK_TREE_VIEW(tree_view));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1298,9 +1293,10 @@ void
|
||||||
collapse_all_tree(proto_tree *protocol_tree _U_, GtkWidget *tree_view)
|
collapse_all_tree(proto_tree *protocol_tree _U_, GtkWidget *tree_view)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i < num_tree_types; i++) {
|
|
||||||
tree_is_expanded[i] = FALSE;
|
for(i=0; i < num_tree_types; i++)
|
||||||
}
|
tree_expanded_set(i, FALSE);
|
||||||
|
|
||||||
gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree_view));
|
gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree_view));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1377,7 +1373,7 @@ expand_finfos(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointe
|
||||||
|
|
||||||
g_assert(fi->tree_type >= 0 && fi->tree_type < num_tree_types);
|
g_assert(fi->tree_type >= 0 && fi->tree_type < num_tree_types);
|
||||||
|
|
||||||
if (tree_is_expanded[fi->tree_type])
|
if (tree_expanded(fi->tree_type))
|
||||||
gtk_tree_view_expand_to_path(tree_view, path);
|
gtk_tree_view_expand_to_path(tree_view, path);
|
||||||
else
|
else
|
||||||
gtk_tree_view_collapse_row(tree_view, path);
|
gtk_tree_view_collapse_row(tree_view, path);
|
||||||
|
|
|
@ -140,7 +140,7 @@ proto_tree_draw_node(proto_node *node, gpointer data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_branch) {
|
if (is_branch) {
|
||||||
if (tree_is_expanded[fi->tree_type]) {
|
if (tree_expanded(fi->tree_type)) {
|
||||||
item->setExpanded(true);
|
item->setExpanded(true);
|
||||||
} else {
|
} else {
|
||||||
item->setExpanded(false);
|
item->setExpanded(false);
|
||||||
|
@ -334,7 +334,7 @@ void ProtoTree::expand(const QModelIndex & index) {
|
||||||
if (fi->tree_type != -1) {
|
if (fi->tree_type != -1) {
|
||||||
g_assert(fi->tree_type >= 0 &&
|
g_assert(fi->tree_type >= 0 &&
|
||||||
fi->tree_type < num_tree_types);
|
fi->tree_type < num_tree_types);
|
||||||
tree_is_expanded[fi->tree_type] = TRUE;
|
tree_expanded_set(fi->tree_type, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ void ProtoTree::collapse(const QModelIndex & index) {
|
||||||
if (fi->tree_type != -1) {
|
if (fi->tree_type != -1) {
|
||||||
g_assert(fi->tree_type >= 0 &&
|
g_assert(fi->tree_type >= 0 &&
|
||||||
fi->tree_type < num_tree_types);
|
fi->tree_type < num_tree_types);
|
||||||
tree_is_expanded[fi->tree_type] = FALSE;
|
tree_expanded_set(fi->tree_type, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ void ProtoTree::expandAll()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i < num_tree_types; i++) {
|
for(i=0; i < num_tree_types; i++) {
|
||||||
tree_is_expanded[i] = TRUE;
|
tree_expanded_set(i, TRUE);
|
||||||
}
|
}
|
||||||
QTreeWidget::expandAll();
|
QTreeWidget::expandAll();
|
||||||
}
|
}
|
||||||
|
@ -397,7 +397,7 @@ void ProtoTree::collapseAll()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i < num_tree_types; i++) {
|
for(i=0; i < num_tree_types; i++) {
|
||||||
tree_is_expanded[i] = FALSE;
|
tree_expanded_set(i, FALSE);
|
||||||
}
|
}
|
||||||
QTreeWidget::collapseAll();
|
QTreeWidget::collapseAll();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue