summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--epan/prefs.c21
-rw-r--r--epan/prefs.h1
-rw-r--r--ui/gtk/filter_dlg.c9
-rw-r--r--ui/gtk/prefs_font_color.c60
4 files changed, 82 insertions, 9 deletions
diff --git a/epan/prefs.c b/epan/prefs.c
index ca89935852..f71825fb44 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -1988,6 +1988,15 @@ prefs_register_modules(void)
prefs_register_string_custom_preference(gui_column_module, "colorized_frame.bg", "Colorized Background",
"Filter Colorized Background", &custom_cbs, (const char **)&prefs.gui_colorized_bg);
+ prefs_register_color_preference(gui_color_module, "color_filter_bg.valid", "Valid color filter background",
+ "Valid color filter background", &prefs.gui_text_valid);
+
+ prefs_register_color_preference(gui_color_module, "color_filter_bg.invalid", "Invalid color filter background",
+ "Invalid color filter background", &prefs.gui_text_invalid);
+
+ prefs_register_color_preference(gui_color_module, "color_filter_bg.deprecated", "Deprecated color filter background",
+ "Deprecated color filter background", &prefs.gui_text_deprecated);
+
prefs_register_enum_preference(gui_module, "console_open",
"Open a console window",
"Open a console window (WIN32 only)",
@@ -2666,6 +2675,18 @@ pre_init_prefs(void)
prefs.st_server_bg.red = 60909;
prefs.st_server_bg.green = 60909;
prefs.st_server_bg.blue = 64507;
+ prefs.gui_text_valid.pixel = 0; /* light green */
+ prefs.gui_text_valid.red = 0xAFFF;
+ prefs.gui_text_valid.green = 0xFFFF;
+ prefs.gui_text_valid.blue = 0xAFFF;
+ prefs.gui_text_invalid.pixel = 0; /* light red */
+ prefs.gui_text_invalid.red = 0xFFFF;
+ prefs.gui_text_invalid.green = 0xAFFF;
+ prefs.gui_text_invalid.blue = 0xAFFF;
+ prefs.gui_text_deprecated.pixel = 0; /* light yellow */
+ prefs.gui_text_deprecated.red = 0xFFFF;
+ prefs.gui_text_deprecated.green = 0xFFFF;
+ prefs.gui_text_deprecated.blue = 0xAFFF;
prefs.gui_geometry_save_position = TRUE;
prefs.gui_geometry_save_size = TRUE;
prefs.gui_geometry_save_maximized= TRUE;
diff --git a/epan/prefs.h b/epan/prefs.h
index 4355d20997..e9dd89de99 100644
--- a/epan/prefs.h
+++ b/epan/prefs.h
@@ -137,6 +137,7 @@ typedef struct _e_prefs {
GList *col_list;
gint num_cols;
color_t st_client_fg, st_client_bg, st_server_fg, st_server_bg;
+ color_t gui_text_valid, gui_text_invalid, gui_text_deprecated;
gboolean gui_altern_colors;
gboolean gui_expert_composite_eyecandy;
gboolean filter_toolbar_show_in_statusbar;
diff --git a/ui/gtk/filter_dlg.c b/ui/gtk/filter_dlg.c
index 731e8d8184..b3319b4826 100644
--- a/ui/gtk/filter_dlg.c
+++ b/ui/gtk/filter_dlg.c
@@ -1291,22 +1291,19 @@ colorize_filter_te_as_empty(GtkWidget *w)
void
colorize_filter_te_as_invalid(GtkWidget *w)
{
- /* light red */
- color_filter_te(w, 0xFFFF, 0xAFFF, 0xAFFF);
+ color_filter_te(w, prefs.gui_text_invalid.red, prefs.gui_text_invalid.green, prefs.gui_text_invalid.blue);
}
static void
colorize_filter_te_as_deprecated(GtkWidget *w)
{
- /* light yellow */
- color_filter_te(w, 0xFFFF, 0xFFFF, 0xAFFF);
+ color_filter_te(w, prefs.gui_text_deprecated.red, prefs.gui_text_deprecated.green, prefs.gui_text_deprecated.blue);
}
void
colorize_filter_te_as_valid(GtkWidget *w)
{
- /* light green */
- color_filter_te(w, 0xAFFF, 0xFFFF, 0xAFFF);
+ color_filter_te(w, prefs.gui_text_valid.red, prefs.gui_text_valid.green, prefs.gui_text_valid.blue);
}
/*
diff --git a/ui/gtk/prefs_font_color.c b/ui/gtk/prefs_font_color.c
index 07dc2b3928..ade3806aba 100644
--- a/ui/gtk/prefs_font_color.c
+++ b/ui/gtk/prefs_font_color.c
@@ -75,6 +75,9 @@
#define SAMPLE_IGNORED_TEXT "Sample ignored packet text\n"
#define SAMPLE_CLIENT_TEXT "Sample 'Follow Stream' client text\n"
#define SAMPLE_SERVER_TEXT "Sample 'Follow Stream' server text\n"
+#define SAMPLE_TEXT_VALID_TEXT "Sample valid filter text\n"
+#define SAMPLE_TEXT_INVALID_TEXT "Sample invalid filter text\n"
+#define SAMPLE_TEXT_DEPRECATED_TEXT "Sample deprecated filter text\n"
#define MFG_IDX 0
#define MBG_IDX 1
@@ -84,7 +87,10 @@
#define CBG_IDX 5
#define SFG_IDX 6
#define SBG_IDX 7
-#define MAX_IDX 8 /* set this to the number of IDX values */
+#define FTV_IDX 8
+#define FTI_IDX 9
+#define FTD_IDX 10
+#define MAX_IDX 11 /* set this to the number of IDX values */
#define COLOR_SAMPLE_KEY "text_color_sample"
#define FONT_SAMPLE_KEY "font_sample"
@@ -95,7 +101,8 @@ static void update_font(PangoFontDescription *, GtkWidget *, GtkWidget *);
static void update_text_color(GObject *obj, GParamSpec *pspec, gpointer data);
static void update_current_color(GtkWidget *, gpointer);
-static GdkXxx tcolors[MAX_IDX], *curcolor = NULL;
+static const color_t filter_text_fg_color = {0, 0, 0, 0}; /* black */
+static GdkXxx tcolors[MAX_IDX], filter_text_fg, *curcolor = NULL;
#if ! GTK_CHECK_VERSION(3,4,0)
static GdkXxx tcolors_orig[MAX_IDX];
@@ -133,7 +140,10 @@ font_color_prefs_show(void)
"'Follow Stream' client foreground", /* CFG_IDX 4*/
"'Follow Stream' client background", /* CBG_IDX 5*/
"'Follow Stream' server foreground", /* SFG_IDX 6*/
- "'Follow Stream' server background" /* SBG_IDX 7*/
+ "'Follow Stream' server background", /* SBG_IDX 7*/
+ "Valid filter text entry", /* FTV_IDX 8*/
+ "Invalid filter text entry", /* FTI_IDX 9*/
+ "Deprecated filter text entry" /* FTD_IDX 10*/
};
int mcount = sizeof(mt) / sizeof (gchar *);
GtkTextBuffer *buf;
@@ -157,6 +167,10 @@ font_color_prefs_show(void)
color_t_to_gdkxxx(&tcolors[CBG_IDX], &prefs.st_client_bg);
color_t_to_gdkxxx(&tcolors[SFG_IDX], &prefs.st_server_fg);
color_t_to_gdkxxx(&tcolors[SBG_IDX], &prefs.st_server_bg);
+ color_t_to_gdkxxx(&tcolors[FTV_IDX], &prefs.gui_text_valid);
+ color_t_to_gdkxxx(&tcolors[FTI_IDX], &prefs.gui_text_invalid);
+ color_t_to_gdkxxx(&tcolors[FTD_IDX], &prefs.gui_text_deprecated);
+ color_t_to_gdkxxx(&filter_text_fg, &filter_text_fg_color);
#if ! GTK_CHECK_VERSION(3,4,0)
for (i=0; i<MAX_IDX; i++) {
@@ -262,6 +276,18 @@ font_color_prefs_show(void)
TAG_PROP_FG_COLOR, &tcolors[SFG_IDX],
TAG_PROP_BG_COLOR, &tcolors[SBG_IDX],
NULL);
+ gtk_text_buffer_create_tag(buf, "text_valid",
+ TAG_PROP_FG_COLOR, &filter_text_fg,
+ TAG_PROP_BG_COLOR, &tcolors[FTV_IDX],
+ NULL);
+ gtk_text_buffer_create_tag(buf, "text_invalid",
+ TAG_PROP_FG_COLOR, &filter_text_fg,
+ TAG_PROP_BG_COLOR, &tcolors[FTI_IDX],
+ NULL);
+ gtk_text_buffer_create_tag(buf, "text_deprecated",
+ TAG_PROP_FG_COLOR, &filter_text_fg,
+ TAG_PROP_BG_COLOR, &tcolors[FTD_IDX],
+ NULL);
gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_MARKED_TEXT, -1,
"marked", NULL);
@@ -271,6 +297,12 @@ font_color_prefs_show(void)
"client", NULL);
gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_SERVER_TEXT, -1,
"server", NULL);
+ gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_TEXT_VALID_TEXT, -1,
+ "text_valid", NULL);
+ gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_TEXT_INVALID_TEXT, -1,
+ "text_invalid", NULL);
+ gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_TEXT_DEPRECATED_TEXT, -1,
+ "text_deprecated", NULL);
ws_gtk_grid_attach_extended(GTK_GRID(main_grid), color_sample,
2, GRID_COLOR_ROW, 1, 2,
@@ -392,6 +424,25 @@ update_text_color(GObject *obj, GParamSpec *pspec _U_, gpointer data _U_) {
TAG_PROP_FG_COLOR, &tcolors[SFG_IDX],
TAG_PROP_BG_COLOR, &tcolors[SBG_IDX],
NULL);
+
+ tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buf), "text_valid");
+ g_object_set(tag,
+ TAG_PROP_FG_COLOR, &filter_text_fg,
+ TAG_PROP_BG_COLOR, &tcolors[FTV_IDX],
+ NULL);
+
+ tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buf), "text_invalid");
+ g_object_set(tag,
+ TAG_PROP_FG_COLOR, &filter_text_fg,
+ TAG_PROP_BG_COLOR, &tcolors[FTI_IDX],
+ NULL);
+
+ tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buf), "text_deprecated");
+ g_object_set(tag,
+ TAG_PROP_FG_COLOR, &filter_text_fg,
+ TAG_PROP_BG_COLOR, &tcolors[FTD_IDX],
+ NULL);
+
}
@@ -429,6 +480,9 @@ font_color_prefs_fetch(GtkWidget *w _U_)
gdkxxx_to_color_t(&prefs.st_client_bg, &tcolors[CBG_IDX]);
gdkxxx_to_color_t(&prefs.st_server_fg, &tcolors[SFG_IDX]);
gdkxxx_to_color_t(&prefs.st_server_bg, &tcolors[SBG_IDX]);
+ gdkxxx_to_color_t(&prefs.gui_text_valid, &tcolors[FTV_IDX]);
+ gdkxxx_to_color_t(&prefs.gui_text_invalid, &tcolors[FTI_IDX]);
+ gdkxxx_to_color_t(&prefs.gui_text_deprecated, &tcolors[FTD_IDX]);
/*
* XXX - we need to have a way to fetch the preferences into