Don't store both "start" and "length" in each GUI proto_tree item. Just
[obnox/wireshark/wip.git] / colors.h
1 /* colors.h
2  * Definitions for color structures and routines
3  *
4  * $Id: colors.h,v 1.5 1999/10/07 22:50:45 guy Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@zing.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * 
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  * 
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  * 
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25 #ifndef  __COLORS_H__
26 #define  __COLORS_H__
27
28 #ifndef   __DFILTER_H__
29 #include  "proto.h"
30 #include  "dfilter.h"
31 #endif
32
33 #ifndef __GTK_H__
34 #include <gtk/gtk.h>
35 #endif
36
37 #define MAXCOLORS       255
38 #define MAX_COLOR_FILTER_NAME_LEN 33
39 #define MAX_COLOR_FILTER_STRING_LEN 256
40
41 #define CFILTERS_CONTAINS_FILTER(cf) \
42         ((cf)->colors->num_of_filters != 0)
43
44 extern GdkColor         proto_colors[MAXCOLORS];
45 extern GdkColormap*     sys_cmap;
46 extern GdkColor color_light_gray;
47 extern GdkColor WHITE;
48 extern GdkColor BLACK;
49
50 /* This struct is used in the GtkCList which holds the filter information.
51  * The filter name and text string for the filter are the clist data
52  */
53
54 typedef struct _color_filter {
55         GdkColor bg_color;
56         GdkColor fg_color;
57         dfilter *c_colorfilter;
58 } color_filter_t;
59
60 typedef struct _colfilter  {
61         GtkWidget  *color_filters;
62         gint      num_of_filters;  /* first num_of_filters rows filled */
63         gint      row_selected;    /* row in color_filters that is selected */
64 } colfilter;
65
66
67
68 typedef struct _capture_file cap_file;
69
70
71 void colors_init(cap_file *cf);
72 void set_color_filter_name(cap_file *cf, gint n, gchar *str);
73 gchar* get_color_filter_name(cap_file *cf, gint n);
74
75 void set_color_filter_string(cap_file *cf, gint n, gchar *str);
76
77 gchar* get_color_filter_string(cap_file *cf, gint n);
78 color_filter_t *color_filter(cap_file *cf, gint n);
79
80 void new_color_filter(colfilter *filters, gchar *name, gchar *filter_string);
81
82 /* ===================== USER INTERFACE ====================== */
83
84 void
85 color_display_cb(GtkWidget *w, gpointer d);
86
87 void
88 color_delete_cb                        (GtkWidget       *widget,
89                                         gpointer         user_data);
90 void
91 color_cancel_cb                        (GtkWidget       *widget,
92                                         gpointer         user_data);
93 void
94 color_filt_up_cb                       (GtkButton       *button,
95                                         gpointer         user_data);
96
97 void
98 color_filter_down_cb                   (GtkButton       *button,
99                                         gpointer         user_data);
100
101 void
102 rembember_selected_row                 (GtkCList        *clist,
103                                         gint             row,
104                                         gint             column,
105                                         GdkEvent        *event,
106                                         gpointer         user_data);
107
108 void
109 create_new_cb                          (GtkButton       *button,
110                                         gpointer         user_data);
111
112 void
113 color_change_cb                        (GtkButton       *button,
114                                         gpointer         user_data);
115
116 void
117 color_save_cb                          (GtkButton       *button,
118                                         gpointer         user_data);
119
120 void
121 color_ok_cb                            (GtkButton       *button,
122                                         gpointer         user_data);
123
124 void
125 color_apply_cb                         (GtkButton       *button,
126                                         gpointer         user_data);
127
128 void
129 colorize_cancel_cb                     (GtkObject       *object,
130                                         gpointer         user_data);
131
132 void
133 colorize_fg_cb                         (GtkButton       *button,
134                                         gpointer         user_data);
135
136 void
137 colorize_bg_cb                         (GtkButton       *button,
138                                         gpointer         user_data);
139
140 void
141 colorize_ok_cb                         (GtkButton       *button,
142                                         gpointer         user_data);
143
144 void
145 color_cel_cancel_cb                    (GtkObject       *object,
146                                         gpointer         user_data);
147
148 void
149 color_sel_ok_cb                        (GtkButton       *button,
150                                         gpointer         user_data);
151
152 gboolean
153 get_color                               (GdkColor       *new_color);
154
155 GtkWidget* create_color_win (cap_file *cf);
156 GtkWidget* create_colorize_win (cap_file *cf,
157                                  GtkWidget **colorize_filter_name,
158                                  GtkWidget **colorize_filter_text);
159
160 #endif