diff options
-rw-r--r-- | gtk/Makefile.common | 1 | ||||
-rw-r--r-- | gtk/color_dlg.c | 2 | ||||
-rw-r--r-- | gtk/color_edit_dlg.c | 2 | ||||
-rw-r--r-- | gtk/color_utils.c | 80 | ||||
-rw-r--r-- | gtk/color_utils.h (renamed from gtk/colors.h) | 0 | ||||
-rw-r--r-- | gtk/colors.c | 108 | ||||
-rw-r--r-- | gtk/expert_dlg.c | 2 | ||||
-rw-r--r-- | gtk/follow_ssl.c | 2 | ||||
-rw-r--r-- | gtk/follow_stream.c | 2 | ||||
-rw-r--r-- | gtk/follow_tcp.c | 2 | ||||
-rw-r--r-- | gtk/libui.vcproj | 16 | ||||
-rw-r--r-- | gtk/main.c | 2 | ||||
-rw-r--r-- | gtk/main_packet_list.c | 2 | ||||
-rw-r--r-- | gtk/main_proto_draw.c | 3 | ||||
-rw-r--r-- | gtk/stream_prefs.c | 2 |
15 files changed, 98 insertions, 128 deletions
diff --git a/gtk/Makefile.common b/gtk/Makefile.common index 1037700325..b61ec67aca 100644 --- a/gtk/Makefile.common +++ b/gtk/Makefile.common @@ -47,7 +47,6 @@ WIRESHARK_GTK_SRC = \ color_dlg.c \ color_edit_dlg.c \ color_utils.c \ - colors.c \ column_prefs.c \ conversations_table.c \ decode_as_ber.c \ diff --git a/gtk/color_dlg.c b/gtk/color_dlg.c index 753e059559..98b4500286 100644 --- a/gtk/color_dlg.c +++ b/gtk/color_dlg.c @@ -40,7 +40,7 @@ #include "../simple_dialog.h" #include "gtk/main.h" -#include "gtk/colors.h" +#include "gtk/color_utils.h" #include "gtk/color_dlg.h" #include "gtk/dlg_utils.h" #include "gtk/gui_utils.h" diff --git a/gtk/color_edit_dlg.c b/gtk/color_edit_dlg.c index f1e9518e79..f6f044307b 100644 --- a/gtk/color_edit_dlg.c +++ b/gtk/color_edit_dlg.c @@ -36,7 +36,7 @@ #include "../color_filters.h" #include "../simple_dialog.h" -#include "gtk/colors.h" +#include "gtk/color_utils.h" #include "gtk/dlg_utils.h" #include "gtk/gui_utils.h" #include "gtk/stock_icons.h" diff --git a/gtk/color_utils.c b/gtk/color_utils.c index cee6d8a955..abe531d4d6 100644 --- a/gtk/color_utils.c +++ b/gtk/color_utils.c @@ -25,12 +25,25 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include <string.h> + #include <gtk/gtk.h> #include "../color.h" +#include "../simple_dialog.h" + +#include "gtk/color_utils.h" +#include "gtk/gtkglobals.h" + + +static GdkColormap* sys_cmap; +static GdkColormap* our_cmap = NULL; + +GdkColor WHITE = { 0, 65535, 65535, 65535 }; +GdkColor LTGREY = { 0, 57343, 57343, 57343 }; +GdkColor BLACK = { 0, 0, 0, 0 }; -#include "gtk/colors.h" /* * Initialize a color with R, G, and B values, including any toolkit-dependent @@ -50,3 +63,68 @@ initialize_color(color_t *color, guint16 red, guint16 green, guint16 blue) gdkcolor_to_color_t(color, &gdk_color); return TRUE; } + +/* Initialize the colors */ +void +colors_init(void) +{ + gboolean got_white, got_black; + + sys_cmap = gdk_colormap_get_system(); + + /* Allocate "constant" colors. */ + got_white = get_color(&WHITE); + got_black = get_color(&BLACK); + + /* Got milk? */ + if (!got_white) { + if (!got_black) + simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, + "Could not allocate colors black or white."); + else + simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, + "Could not allocate color white."); + } else { + if (!got_black) + simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, + "Could not allocate color black."); + } +} + +/* allocate a color from the color map */ +gboolean +get_color(GdkColor *new_color) +{ + GdkVisual *pv; + + if (!our_cmap) { + if (!gdk_colormap_alloc_color (sys_cmap, new_color, FALSE, + TRUE)) { + pv = gdk_visual_get_best(); + if (!(our_cmap = gdk_colormap_new(pv, TRUE))) { + simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, + "Could not create new colormap"); + } + } else + return (TRUE); + } + return (gdk_colormap_alloc_color(our_cmap, new_color, FALSE, TRUE)); +} + +void +color_t_to_gdkcolor(GdkColor *target, color_t *source) +{ + target->pixel = source->pixel; + target->red = source->red; + target->green = source->green; + target->blue = source->blue; +} + +void +gdkcolor_to_color_t(color_t *target, GdkColor *source) +{ + target->pixel = source->pixel; + target->red = source->red; + target->green = source->green; + target->blue = source->blue; +} diff --git a/gtk/colors.h b/gtk/color_utils.h index 84456113aa..84456113aa 100644 --- a/gtk/colors.h +++ b/gtk/color_utils.h diff --git a/gtk/colors.c b/gtk/colors.c deleted file mode 100644 index 4793b47a56..0000000000 --- a/gtk/colors.c +++ /dev/null @@ -1,108 +0,0 @@ -/* colors.c - * Routines for colors - * - * $Id$ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gtk/gtk.h> - -#include <string.h> - -#include "../color.h" /* to declare "color_t" */ -#include "../simple_dialog.h" - -#include "gtk/colors.h" -#include "gtk/gtkglobals.h" - -static GdkColormap* sys_cmap; -static GdkColormap* our_cmap = NULL; - -GdkColor WHITE = { 0, 65535, 65535, 65535 }; -GdkColor LTGREY = { 0, 57343, 57343, 57343 }; -GdkColor BLACK = { 0, 0, 0, 0 }; - -/* Initialize the colors */ -void -colors_init(void) -{ - gboolean got_white, got_black; - - sys_cmap = gdk_colormap_get_system(); - - /* Allocate "constant" colors. */ - got_white = get_color(&WHITE); - got_black = get_color(&BLACK); - - /* Got milk? */ - if (!got_white) { - if (!got_black) - simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, - "Could not allocate colors black or white."); - else - simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, - "Could not allocate color white."); - } else { - if (!got_black) - simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, - "Could not allocate color black."); - } -} - -/* allocate a color from the color map */ -gboolean -get_color(GdkColor *new_color) -{ - GdkVisual *pv; - - if (!our_cmap) { - if (!gdk_colormap_alloc_color (sys_cmap, new_color, FALSE, - TRUE)) { - pv = gdk_visual_get_best(); - if (!(our_cmap = gdk_colormap_new(pv, TRUE))) { - simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, - "Could not create new colormap"); - } - } else - return (TRUE); - } - return (gdk_colormap_alloc_color(our_cmap, new_color, FALSE, TRUE)); -} - -void -color_t_to_gdkcolor(GdkColor *target, color_t *source) -{ - target->pixel = source->pixel; - target->red = source->red; - target->green = source->green; - target->blue = source->blue; -} - -void -gdkcolor_to_color_t(color_t *target, GdkColor *source) -{ - target->pixel = source->pixel; - target->red = source->red; - target->green = source->green; - target->blue = source->blue; -} diff --git a/gtk/expert_dlg.c b/gtk/expert_dlg.c index 4a247be7dd..dd2697990c 100644 --- a/gtk/expert_dlg.c +++ b/gtk/expert_dlg.c @@ -57,7 +57,7 @@ #include "gtk/dlg_utils.h" #include "gtk/gui_stat_menu.h" #include "gtk/tap_dfilter_dlg.h" -#include "gtk/colors.h" +#include "gtk/color_utils.h" #include "gtk/main_proto_draw.h" #include "gtk/help_dlg.h" diff --git a/gtk/follow_ssl.c b/gtk/follow_ssl.c index 256e564a74..e3256292e0 100644 --- a/gtk/follow_ssl.c +++ b/gtk/follow_ssl.c @@ -54,7 +54,7 @@ #include <../util.h> #include <wiretap/file_util.h> -#include <gtk/colors.h> +#include <gtk/color_utils.h> #include <gtk/main.h> #include <gtk/dlg_utils.h> #include <gtk/file_dlg.h> diff --git a/gtk/follow_stream.c b/gtk/follow_stream.c index 2e47682620..d065cc420b 100644 --- a/gtk/follow_stream.c +++ b/gtk/follow_stream.c @@ -47,7 +47,7 @@ #include <../simple_dialog.h> #include <wiretap/file_util.h> -#include <gtk/colors.h> +#include <gtk/color_utils.h> #include <gtk/stock_icons.h> #include <gtk/dlg_utils.h> #include <gtk/follow_stream.h> diff --git a/gtk/follow_tcp.c b/gtk/follow_tcp.c index 89fab0fc91..d516900f5d 100644 --- a/gtk/follow_tcp.c +++ b/gtk/follow_tcp.c @@ -57,7 +57,7 @@ #include "../tempfile.h" #include "wiretap/file_util.h" -#include "gtk/colors.h" +#include "gtk/color_utils.h" #include "gtk/follow_tcp.h" #include "gtk/dlg_utils.h" #include "gtk/file_dlg.h" diff --git a/gtk/libui.vcproj b/gtk/libui.vcproj index 8781876a2e..be1cd8c680 100644 --- a/gtk/libui.vcproj +++ b/gtk/libui.vcproj @@ -84,7 +84,7 @@ >
</File>
<File
- RelativePath=".\capture_if_details_dlg.c"
+ RelativePath=".\capture_if_details_dlg_win32.c"
>
</File>
<File
@@ -168,6 +168,10 @@ >
</File>
<File
+ RelativePath=".\file_dlg_win32.c"
+ >
+ </File>
+ <File
RelativePath=".\fileset_dlg.c"
>
</File>
@@ -312,11 +316,11 @@ >
</File>
<File
- RelativePath=".\print_mswin.c"
+ RelativePath=".\print_prefs.c"
>
</File>
<File
- RelativePath=".\print_prefs.c"
+ RelativePath=".\print_win32.c"
>
</File>
<File
@@ -400,7 +404,7 @@ >
</File>
<File
- RelativePath=".\text_page.c"
+ RelativePath=".\text_page_utils.c"
>
</File>
<File
@@ -420,10 +424,6 @@ >
</File>
<File
- RelativePath=".\win32-file-dlg.c"
- >
- </File>
- <File
RelativePath=".\wireshark-tap-register.c"
>
</File>
diff --git a/gtk/main.c b/gtk/main.c index faba7696fa..674adf6a08 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -119,7 +119,7 @@ /* GTK related */ #include "gtk/file_dlg.h" #include "gtk/gtkglobals.h" -#include "gtk/colors.h" +#include "gtk/color_utils.h" #include "gtk/gui_utils.h" #include "gtk/color_dlg.h" #include "gtk/filter_dlg.h" diff --git a/gtk/main_packet_list.c b/gtk/main_packet_list.c index 8f99c0ad4e..f17e26832f 100644 --- a/gtk/main_packet_list.c +++ b/gtk/main_packet_list.c @@ -43,7 +43,7 @@ #include "gtk/gtkglobals.h" #include "gtk/gui_utils.h" -#include "gtk/colors.h" +#include "gtk/color_utils.h" #include "gtk/capture_file_dlg.h" #include "gtk/keys.h" #include "gtk/font_utils.h" diff --git a/gtk/main_proto_draw.c b/gtk/main_proto_draw.c index 44088a746c..4b6961ecdc 100644 --- a/gtk/main_proto_draw.c +++ b/gtk/main_proto_draw.c @@ -58,7 +58,7 @@ #include "wiretap/file_util.h" #include "gtk/keys.h" -#include "gtk/colors.h" +#include "gtk/color_utils.h" #include "gtk/capture_file_dlg.h" #include "gtk/packet_win.h" #include "gtk/file_dlg.h" @@ -76,6 +76,7 @@ #include "file_dlg_win32.h" #endif + #define BYTE_VIEW_WIDTH 16 #define BYTE_VIEW_SEP 8 diff --git a/gtk/stream_prefs.c b/gtk/stream_prefs.c index 1c0445e8f9..197ff01b04 100644 --- a/gtk/stream_prefs.c +++ b/gtk/stream_prefs.c @@ -34,7 +34,7 @@ #include "../globals.h" #include "../print.h" -#include "gtk/colors.h" +#include "gtk/color_utils.h" #include "gtk/stream_prefs.h" #include "gtk/keys.h" #include "gtk/follow_tcp.h" |