parent
006e02358a
commit
da80212715
|
@ -141,13 +141,6 @@ remove_tap_listener_flow_graph(void)
|
|||
static void
|
||||
flow_graph_on_destroy(GtkObject *object _U_, gpointer user_data _U_)
|
||||
{
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
/* Destroy the graph analysis window when we're destroyed. This is
|
||||
* handled under GTK2 with a call to gtk_window_set_destroy_with_parent
|
||||
* in graph_analysis.c */
|
||||
window_destroy(graph_analysis_data->dlg.window);
|
||||
#endif
|
||||
|
||||
/* remove_tap_listeners */
|
||||
remove_tap_listener_flow_graph();
|
||||
|
||||
|
@ -488,9 +481,6 @@ static void flow_graph_dlg_create (void)
|
|||
GtkWidget *top_label = NULL;
|
||||
#endif
|
||||
GtkWidget *flow_type_fr, *range_fr, *range_tb, *flow_type_tb, *node_addr_fr, *node_addr_tb;
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
GtkAccelGroup *accel_group;
|
||||
#endif
|
||||
|
||||
|
||||
GtkTooltips *tooltips = gtk_tooltips_new();
|
||||
|
@ -503,14 +493,6 @@ static void flow_graph_dlg_create (void)
|
|||
gtk_container_add(GTK_CONTAINER(flow_graph_dlg_w), main_vb);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vb), 12);
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
/* Accelerator group for the accelerators (or, as they're called in
|
||||
Windows and, I think, in Motif, "mnemonics"; Alt+<key> is a mnemonic,
|
||||
Ctrl+<key> is an accelerator). */
|
||||
accel_group = gtk_accel_group_new();
|
||||
gtk_window_add_accel_group(GTK_WINDOW(main_vb), accel_group);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
top_label = gtk_label_new ("Choose packets to include in the graph");
|
||||
gtk_box_pack_start (GTK_BOX (main_vb), top_label, FALSE, FALSE, 8);
|
||||
|
|
360
gtk/font_utils.c
360
gtk/font_utils.c
|
@ -56,9 +56,6 @@
|
|||
|
||||
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
guint m_font_height, m_font_width;
|
||||
#endif
|
||||
FONT_TYPE *m_r_font, *m_b_font;
|
||||
|
||||
|
||||
|
@ -80,27 +77,6 @@ FONT_TYPE *user_font_get_bold(void)
|
|||
return m_b_font;
|
||||
}
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
/* Get the regular user font height.
|
||||
*
|
||||
* @return the regular user font height
|
||||
*/
|
||||
guint user_font_get_regular_height(void)
|
||||
{
|
||||
return m_font_height;
|
||||
}
|
||||
|
||||
/* Get the regular user font width.
|
||||
*
|
||||
* @return the regular user font width
|
||||
*/
|
||||
guint user_font_get_regular_width(void)
|
||||
{
|
||||
return m_font_width;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
set_fonts(FONT_TYPE *regular, FONT_TYPE *bold)
|
||||
{
|
||||
|
@ -109,11 +85,6 @@ set_fonts(FONT_TYPE *regular, FONT_TYPE *bold)
|
|||
g_assert(m_r_font && m_b_font);
|
||||
m_r_font = regular;
|
||||
m_b_font = bold;
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
m_font_height = m_r_font->ascent + m_r_font->descent;
|
||||
m_font_width = gdk_string_width(m_r_font, "0");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -196,104 +167,13 @@ view_zoom_100_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
}
|
||||
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
/* Given a font name, construct the name of the next heavier version of
|
||||
that font. */
|
||||
|
||||
#define XLFD_WEIGHT 3 /* index of the "weight" field */
|
||||
|
||||
/* Map from a given weight to the appropriate weight for the "bold"
|
||||
version of a font.
|
||||
XXX - the XLFD says these strings shouldn't be used for font matching;
|
||||
can we get the weight, as a number, from GDK, and ask GDK to find us
|
||||
a font just like the given font, but with the appropriate higher
|
||||
weight? */
|
||||
static const struct {
|
||||
char *light;
|
||||
char *heavier;
|
||||
} weight_map[] = {
|
||||
{ "ultralight", "light" },
|
||||
{ "extralight", "semilight" },
|
||||
{ "light", "medium" },
|
||||
{ "semilight", "semibold" },
|
||||
{ "medium", "bold" },
|
||||
{ "normal", "bold" },
|
||||
{ "semibold", "extrabold" },
|
||||
{ "bold", "ultrabold" }
|
||||
};
|
||||
#define N_WEIGHTS (sizeof weight_map / sizeof weight_map[0])
|
||||
|
||||
/* Try to convert a font name to it's bold version.
|
||||
*
|
||||
* @param the font to convert
|
||||
* @return the bold font
|
||||
*/
|
||||
static char *
|
||||
user_font_boldify(const char *font_name)
|
||||
{
|
||||
char *bold_font_name;
|
||||
gchar **xlfd_tokens;
|
||||
unsigned int i;
|
||||
|
||||
/* Is this an XLFD font? If it begins with "-", yes, otherwise no. */
|
||||
if (font_name[0] == '-') {
|
||||
xlfd_tokens = g_strsplit(font_name, "-", XLFD_WEIGHT+1);
|
||||
|
||||
/*
|
||||
* Make sure we *have* a weight (this might not be a valid
|
||||
* XLFD font name).
|
||||
*/
|
||||
for (i = 0; i < XLFD_WEIGHT+1; i++) {
|
||||
if (xlfd_tokens[i] == NULL) {
|
||||
/*
|
||||
* We don't, so treat this as a non-XLFD
|
||||
* font name.
|
||||
*/
|
||||
goto not_xlfd;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < N_WEIGHTS; i++) {
|
||||
if (strcmp(xlfd_tokens[XLFD_WEIGHT],
|
||||
weight_map[i].light) == 0) {
|
||||
g_free(xlfd_tokens[XLFD_WEIGHT]);
|
||||
xlfd_tokens[XLFD_WEIGHT] =
|
||||
g_strdup(weight_map[i].heavier);
|
||||
break;
|
||||
}
|
||||
}
|
||||
bold_font_name = g_strjoinv("-", xlfd_tokens);
|
||||
g_strfreev(xlfd_tokens);
|
||||
return bold_font_name;
|
||||
}
|
||||
|
||||
not_xlfd:
|
||||
/*
|
||||
* This isn't an XLFD font name; just append "bold" to the name
|
||||
* of the font.
|
||||
*/
|
||||
bold_font_name = g_strconcat(font_name, "bold", NULL);
|
||||
return bold_font_name;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
gboolean
|
||||
user_font_test(gchar *font_name)
|
||||
{
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
gchar *bold_font_name;
|
||||
#endif
|
||||
FONT_TYPE *new_r_font, *new_b_font;
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
/* Get the name that the boldface version of that font would have. */
|
||||
bold_font_name = user_font_boldify(font_name);
|
||||
|
||||
/* Now load those fonts, just to make sure we can. */
|
||||
new_r_font = gdk_font_load(font_name);
|
||||
#else
|
||||
new_r_font = pango_font_description_from_string(font_name);
|
||||
#endif
|
||||
if (new_r_font == NULL) {
|
||||
/* Oops, that font didn't work.
|
||||
Tell the user, but don't tear down the font selection
|
||||
|
@ -301,18 +181,11 @@ user_font_test(gchar *font_name)
|
|||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"The font you selected can't be loaded.");
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
g_free(bold_font_name);
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
new_b_font = gdk_font_load(bold_font_name);
|
||||
#else
|
||||
new_b_font = pango_font_description_copy(new_r_font);
|
||||
pango_font_description_set_weight(new_b_font, PANGO_WEIGHT_BOLD);
|
||||
#endif
|
||||
if (new_b_font == NULL) {
|
||||
/* Oops, that font didn't work.
|
||||
Tell the user, but don't tear down the font selection
|
||||
|
@ -320,12 +193,7 @@ user_font_test(gchar *font_name)
|
|||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"The font you selected doesn't have a boldface version.");
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
g_free(bold_font_name);
|
||||
gdk_font_unref(new_r_font);
|
||||
#else
|
||||
pango_font_description_free(new_r_font);
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -343,23 +211,6 @@ font_zoom(char *gui_font_name)
|
|||
char *font_name_dup;
|
||||
char *font_name_p;
|
||||
long font_point_size_l;
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
int minus_chars;
|
||||
char *font_foundry;
|
||||
char *font_family;
|
||||
char *font_weight;
|
||||
char *font_slant;
|
||||
char *font_set_width;
|
||||
char *font_add_style;
|
||||
char *font_pixel_size;
|
||||
char *font_point_size;
|
||||
char *font_res_x;
|
||||
char *font_res_y;
|
||||
char *font_spacing;
|
||||
char *font_aver_width;
|
||||
char *font_charset_reg;
|
||||
char *font_charset_encoding;
|
||||
#endif
|
||||
|
||||
if (recent.gui_zoom_level == 0) {
|
||||
/* There is no zoom factor - just return the name, so that if
|
||||
|
@ -371,7 +222,6 @@ font_zoom(char *gui_font_name)
|
|||
font_name_dup = g_strdup(gui_font_name);
|
||||
font_name_p = font_name_dup;
|
||||
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
/* find the start of the font_size string */
|
||||
font_name_p = strrchr(font_name_dup, ' ');
|
||||
*font_name_p = '\0';
|
||||
|
@ -383,100 +233,6 @@ font_zoom(char *gui_font_name)
|
|||
|
||||
/* build a new font name */
|
||||
new_font_name = g_strdup_printf("%s %ld", font_name_dup, font_point_size_l);
|
||||
#else
|
||||
minus_chars = 0;
|
||||
/* replace all '-' chars by NUL and count them */
|
||||
while ((font_name_p = strchr(font_name_p, '-')) != NULL) {
|
||||
*font_name_p = '\0';
|
||||
font_name_p++;
|
||||
minus_chars++;
|
||||
}
|
||||
|
||||
if (minus_chars != 14) {
|
||||
/*
|
||||
* Not a valid XLFD font name.
|
||||
* XXX - can we try scaling it by looking for a size at the end
|
||||
* and tweaking that? Unfortunately, some fonts have numbers
|
||||
* at the end that aren't, as far as I know, sizes, e.g. "nil2".
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* first element (font name registry) empty */
|
||||
font_name_p = font_name_dup;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
/* get pointers to all font name elements */
|
||||
font_foundry = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_family = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_weight = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_slant = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_set_width = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_add_style = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_pixel_size = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_point_size = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_res_x = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_res_y = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_spacing = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_aver_width = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_charset_reg = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
font_charset_encoding = font_name_p;
|
||||
font_name_p += strlen(font_name_p);
|
||||
font_name_p++;
|
||||
|
||||
/* calculate the new font size */
|
||||
font_point_size_l = strtol(font_point_size, NULL, 10);
|
||||
font_point_size_l += recent.gui_zoom_level*10;
|
||||
if (font_point_size_l <= 0)
|
||||
font_point_size_l = 10;
|
||||
|
||||
/* build a new font name */
|
||||
new_font_name = g_strdup_printf("-%s-%s-%s-%s-%s-%s-%s-%ld-%s-%s-%s-%s-%s-%s",
|
||||
font_foundry, font_family, font_weight, font_slant, font_set_width,
|
||||
font_add_style, font_pixel_size, font_point_size_l, font_res_x,
|
||||
font_res_y, font_spacing, font_aver_width, font_charset_reg,
|
||||
font_charset_encoding);
|
||||
#endif
|
||||
|
||||
g_free(font_name_dup);
|
||||
|
||||
|
@ -486,9 +242,6 @@ font_zoom(char *gui_font_name)
|
|||
fa_ret_t
|
||||
user_font_apply(void) {
|
||||
char *gui_font_name;
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
char *bold_font_name;
|
||||
#endif
|
||||
FONT_TYPE *new_r_font, *new_b_font;
|
||||
FONT_TYPE *old_r_font = NULL, *old_b_font = NULL;
|
||||
|
||||
|
@ -506,29 +259,16 @@ user_font_apply(void) {
|
|||
}
|
||||
|
||||
/* load normal and bold font */
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
new_r_font = gdk_font_load(gui_font_name);
|
||||
bold_font_name = user_font_boldify(gui_font_name);
|
||||
new_b_font = gdk_font_load(bold_font_name);
|
||||
#else
|
||||
new_r_font = pango_font_description_from_string(gui_font_name);
|
||||
new_b_font = pango_font_description_copy(new_r_font);
|
||||
pango_font_description_set_weight(new_b_font, PANGO_WEIGHT_BOLD);
|
||||
#endif
|
||||
|
||||
if (new_r_font == NULL || new_b_font == NULL) {
|
||||
/* We're no longer using the new fonts; unreference them. */
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
if (new_r_font != NULL)
|
||||
gdk_font_unref(new_r_font);
|
||||
if (new_b_font != NULL)
|
||||
gdk_font_unref(new_b_font);
|
||||
#else
|
||||
if (new_r_font != NULL)
|
||||
pango_font_description_free(new_r_font);
|
||||
if (new_b_font != NULL)
|
||||
pango_font_description_free(new_b_font);
|
||||
#endif
|
||||
g_free(gui_font_name);
|
||||
|
||||
/* We let our caller pop up a dialog box, as the error message
|
||||
|
@ -543,9 +283,6 @@ user_font_apply(void) {
|
|||
old_r_font = m_r_font;
|
||||
old_b_font = m_b_font;
|
||||
set_fonts(new_r_font, new_b_font);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
g_free(bold_font_name);
|
||||
#endif
|
||||
|
||||
/* Redraw the hex dump windows. */
|
||||
redraw_hex_dump_all();
|
||||
|
@ -554,17 +291,10 @@ user_font_apply(void) {
|
|||
follow_tcp_redraw_all();
|
||||
|
||||
/* We're no longer using the old fonts; unreference them. */
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
if (old_r_font != NULL)
|
||||
gdk_font_unref(old_r_font);
|
||||
if (old_b_font != NULL)
|
||||
gdk_font_unref(old_b_font);
|
||||
#else
|
||||
if (old_r_font != NULL)
|
||||
pango_font_description_free(old_r_font);
|
||||
if (old_b_font != NULL)
|
||||
pango_font_description_free(old_b_font);
|
||||
#endif
|
||||
g_free(gui_font_name);
|
||||
|
||||
return FA_SUCCESS;
|
||||
|
@ -575,56 +305,6 @@ user_font_apply(void) {
|
|||
|
||||
#define NAME_BUFFER_LEN 32
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
|
||||
|
||||
/* The setting of the MS default font for system stuff (menus, dialogs, ...),
|
||||
* coming from: Allin Cottrell, http://www.ecn.wfu.edu/~cottrell/gtk_win32,
|
||||
* Thank you very much for this! */
|
||||
static int get_windows_font_gtk1(char *fontspec, int fontspec_len)
|
||||
{
|
||||
HDC h_dc;
|
||||
HGDIOBJ h_font;
|
||||
TEXTMETRIC tm;
|
||||
TCHAR name[NAME_BUFFER_LEN];
|
||||
int len, pix_height;
|
||||
|
||||
h_dc = CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
|
||||
if (h_dc == NULL) return 1;
|
||||
h_font = GetStockObject(DEFAULT_GUI_FONT);
|
||||
if (h_font == NULL || !SelectObject(h_dc, h_font)) {
|
||||
DeleteDC(h_dc);
|
||||
return 1;
|
||||
}
|
||||
len = GetTextFace(h_dc, NAME_BUFFER_LEN, name);
|
||||
if (len <= 0) {
|
||||
DeleteDC(h_dc);
|
||||
return 1;
|
||||
}
|
||||
if (!GetTextMetrics(h_dc, &tm)) {
|
||||
DeleteDC(h_dc);
|
||||
return 1;
|
||||
}
|
||||
pix_height = tm.tmHeight;
|
||||
DeleteDC(h_dc);
|
||||
g_snprintf(fontspec, fontspec_len, "-*-%s-*-*-*-*-%i-*-*-*-p-*-iso8859-1",
|
||||
utf_16to8(name), pix_height);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void app_font_gtk1_init(GtkWidget *top_level_w)
|
||||
{
|
||||
GtkStyle *style;
|
||||
char winfont[80];
|
||||
|
||||
style = gtk_widget_get_style(top_level_w);
|
||||
if (get_windows_font_gtk1(winfont, sizeof(winfont)) == 0)
|
||||
style->font = gdk_font_load(winfont);
|
||||
if (style->font) gtk_widget_set_style(top_level_w, style);
|
||||
}
|
||||
|
||||
|
||||
#else /* GTK_MAJOR_VERSION */
|
||||
static char appfontname[128] = "tahoma 8";
|
||||
|
||||
static void
|
||||
|
@ -710,56 +390,17 @@ static void try_to_get_windows_font_gtk2(void)
|
|||
g_free(fontspec);
|
||||
}
|
||||
}
|
||||
#endif /* GTK_MAJOR_VERSION */
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
void font_init(void)
|
||||
{
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
gchar *bold_font_name;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
/* try to load the application font for GTK2 */
|
||||
try_to_get_windows_font_gtk2();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Try to load the regular and boldface fixed-width fonts */
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
bold_font_name = user_font_boldify(prefs.gui_font_name1);
|
||||
m_r_font = gdk_font_load(prefs.gui_font_name1);
|
||||
m_b_font = gdk_font_load(bold_font_name);
|
||||
if (m_r_font == NULL || m_b_font == NULL) {
|
||||
/* XXX - pop this up as a dialog box? no */
|
||||
if (m_r_font == NULL) {
|
||||
fprintf(stderr, "wireshark: Warning: font %s not found - defaulting to 6x13 and 6x13bold\n",
|
||||
prefs.gui_font_name1);
|
||||
} else {
|
||||
gdk_font_unref(m_r_font);
|
||||
}
|
||||
if (m_b_font == NULL) {
|
||||
fprintf(stderr, "wireshark: Warning: font %s not found - defaulting to 6x13 and 6x13bold\n",
|
||||
bold_font_name);
|
||||
} else {
|
||||
gdk_font_unref(m_b_font);
|
||||
}
|
||||
g_free(bold_font_name);
|
||||
if ((m_r_font = gdk_font_load("6x13")) == NULL) {
|
||||
fprintf(stderr, "wireshark: Error: font 6x13 not found\n");
|
||||
exit(1);
|
||||
}
|
||||
if ((m_b_font = gdk_font_load("6x13bold")) == NULL) {
|
||||
fprintf(stderr, "wireshark: Error: font 6x13bold not found\n");
|
||||
exit(1);
|
||||
}
|
||||
g_free(prefs.gui_font_name1);
|
||||
prefs.gui_font_name1 = g_strdup("6x13");
|
||||
}
|
||||
#else /* GTK_MAJOR_VERSION */
|
||||
m_r_font = pango_font_description_from_string(prefs.gui_font_name2);
|
||||
m_b_font = pango_font_description_copy(m_r_font);
|
||||
pango_font_description_set_weight(m_b_font, PANGO_WEIGHT_BOLD);
|
||||
|
@ -790,7 +431,6 @@ void font_init(void)
|
|||
pango_font_description_set_weight(m_b_font, PANGO_WEIGHT_BOLD);
|
||||
prefs.gui_font_name2 = g_strdup("Monospace 9");
|
||||
}
|
||||
#endif /* GTK_MAJOR_VERSION */
|
||||
|
||||
/* Call this for the side-effects that set_fonts() produces */
|
||||
set_fonts(m_r_font, m_b_font);
|
||||
|
|
|
@ -169,14 +169,6 @@ static funnel_text_window_t* new_text_window(const gchar* title) {
|
|||
|
||||
gtk_container_add(GTK_CONTAINER(main_vb), txt_scrollw);
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(txt_scrollw),
|
||||
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
tw->txt = gtk_text_new(NULL, NULL);
|
||||
gtk_text_set_editable(GTK_TEXT(tw->txt), FALSE);
|
||||
gtk_text_set_word_wrap(GTK_TEXT(tw->txt), TRUE);
|
||||
gtk_text_set_line_wrap(GTK_TEXT(tw->txt), TRUE);
|
||||
#else
|
||||
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(txt_scrollw),
|
||||
GTK_SHADOW_IN);
|
||||
|
||||
|
@ -189,7 +181,6 @@ static funnel_text_window_t* new_text_window(const gchar* title) {
|
|||
|
||||
gtk_text_view_set_left_margin(GTK_TEXT_VIEW(tw->txt), 4);
|
||||
gtk_text_view_set_right_margin(GTK_TEXT_VIEW(tw->txt), 4);
|
||||
#endif
|
||||
|
||||
hbox = gtk_hbox_new(FALSE, 0);
|
||||
gtk_widget_show(hbox);
|
||||
|
@ -213,12 +204,7 @@ static funnel_text_window_t* new_text_window(const gchar* title) {
|
|||
gtk_widget_grab_default(tw->bt_close);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(txt_scrollw), tw->txt);
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
gtk_window_resize(GTK_WINDOW(tw->win),400,300);
|
||||
#else
|
||||
gtk_window_set_default_size(GTK_WINDOW(tw->win), 400, 300);
|
||||
gtk_widget_set_usize(tw->win, 400, 300);
|
||||
#endif
|
||||
gtk_widget_show_all(tw->win);
|
||||
|
||||
return tw;
|
||||
|
@ -227,21 +213,6 @@ static funnel_text_window_t* new_text_window(const gchar* title) {
|
|||
|
||||
static void text_window_clear(funnel_text_window_t* tw)
|
||||
{
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
GtkText *txt;
|
||||
|
||||
if (! tw->win) return;
|
||||
|
||||
txt = GTK_TEXT(tw->txt);
|
||||
|
||||
gtk_text_set_point(txt, 0);
|
||||
/* Keep GTK+ 1.2.3 through 1.2.6 from dumping core - see
|
||||
http://www.ethereal.com/lists/ethereal-dev/199912/msg00312.html and
|
||||
http://www.gnome.org/mailing-lists/archives/gtk-devel-list/1999-October/0051.shtml
|
||||
for more information */
|
||||
gtk_adjustment_set_value(txt->vadj, 0.0);
|
||||
gtk_text_forward_delete(txt, gtk_text_get_length(txt));
|
||||
#else
|
||||
GtkTextBuffer *buf;
|
||||
|
||||
if (! tw->win) return;
|
||||
|
@ -249,7 +220,6 @@ http://www.gnome.org/mailing-lists/archives/gtk-devel-list/1999-October/0051.sht
|
|||
buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tw->txt));
|
||||
|
||||
gtk_text_buffer_set_text(buf, "", 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -257,10 +227,8 @@ static void text_window_append(funnel_text_window_t* tw, const char *str)
|
|||
{
|
||||
GtkWidget *txt;
|
||||
int nchars = strlen(str);
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
GtkTextBuffer *buf;
|
||||
GtkTextIter iter;
|
||||
#endif
|
||||
|
||||
if (! tw->win) return;
|
||||
|
||||
|
@ -268,10 +236,6 @@ static void text_window_append(funnel_text_window_t* tw, const char *str)
|
|||
nchars = strlen(str);
|
||||
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
gtk_text_set_point(GTK_TEXT(txt),gtk_text_get_length(GTK_TEXT(txt)));
|
||||
gtk_text_insert(GTK_TEXT(txt), user_font_get_regular(), NULL, NULL, str, nchars);
|
||||
#else
|
||||
buf= gtk_text_view_get_buffer(GTK_TEXT_VIEW(txt));
|
||||
|
||||
gtk_text_buffer_get_end_iter(buf, &iter);
|
||||
|
@ -281,7 +245,6 @@ static void text_window_append(funnel_text_window_t* tw, const char *str)
|
|||
printf("Invalid utf8 encoding: %s\n", str);
|
||||
|
||||
gtk_text_buffer_insert(buf, &iter, str, nchars);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -290,26 +253,16 @@ static void text_window_set_text(funnel_text_window_t* tw, const gchar* text)
|
|||
|
||||
if (! tw->win) return;
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
gtk_text_freeze(GTK_TEXT(tw->txt));
|
||||
#endif
|
||||
|
||||
text_window_clear(tw);
|
||||
text_window_append(tw, text);
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
gtk_text_thaw(GTK_TEXT(tw->txt));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void text_window_prepend(funnel_text_window_t* tw, const char *str _U_) {
|
||||
GtkWidget *txt;
|
||||
int nchars = strlen(str);
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
GtkTextBuffer *buf;
|
||||
GtkTextIter iter;
|
||||
#endif
|
||||
|
||||
if (! tw->win) return;
|
||||
|
||||
|
@ -317,10 +270,6 @@ static void text_window_prepend(funnel_text_window_t* tw, const char *str _U_)
|
|||
nchars = strlen(str);
|
||||
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
gtk_text_set_point(GTK_TEXT(txt),0);
|
||||
gtk_text_insert(GTK_TEXT(txt), user_font_get_regular(), NULL, NULL, str, nchars);
|
||||
#else
|
||||
buf= gtk_text_view_get_buffer(GTK_TEXT_VIEW(txt));
|
||||
|
||||
gtk_text_buffer_get_start_iter(buf, &iter);
|
||||
|
@ -330,31 +279,23 @@ static void text_window_prepend(funnel_text_window_t* tw, const char *str _U_)
|
|||
printf("Invalid utf8 encoding: %s\n", str);
|
||||
|
||||
gtk_text_buffer_insert(buf, &iter, str, nchars);
|
||||
#endif
|
||||
}
|
||||
|
||||
static const gchar* text_window_get_text(funnel_text_window_t* tw) {
|
||||
GtkWidget *txt;
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
GtkTextBuffer *buf;
|
||||
GtkTextIter start;
|
||||
GtkTextIter end;
|
||||
#endif
|
||||
|
||||
if (! tw->win) return "";
|
||||
|
||||
txt = tw->txt;
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
/* to do */
|
||||
return "";
|
||||
#else
|
||||
buf= gtk_text_view_get_buffer(GTK_TEXT_VIEW(txt));
|
||||
gtk_text_buffer_get_start_iter(buf, &start);
|
||||
gtk_text_buffer_get_end_iter(buf, &end);
|
||||
|
||||
return gtk_text_buffer_get_text(buf, &start, &end, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -390,12 +331,8 @@ static void text_window_destroy(funnel_text_window_t* tw) {
|
|||
}
|
||||
|
||||
static void text_window_set_editable(funnel_text_window_t* tw, gboolean editable){
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
gtk_text_set_editable(GTK_TEXT(tw->txt), editable);
|
||||
#else
|
||||
gtk_text_view_set_editable(GTK_TEXT_VIEW(tw->txt), editable);
|
||||
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(tw->txt), editable);
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean text_window_button_cb(GtkWidget *bt _U_, gpointer user_data)
|
||||
|
@ -482,12 +419,7 @@ static void funnel_new_dialog(const gchar* title,
|
|||
|
||||
dd->win = win;
|
||||
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
gtk_window_resize(GTK_WINDOW(win),400,10*(i+2));
|
||||
#else
|
||||
gtk_window_set_default_size(GTK_WINDOW(win), 400, 10*(i+2));
|
||||
gtk_widget_set_usize(win, 400, 10*(i+2));
|
||||
#endif
|
||||
|
||||
main_vb = gtk_vbox_new(TRUE,5);
|
||||
gtk_container_add(GTK_CONTAINER(win), main_vb);
|
||||
|
|
|
@ -42,9 +42,7 @@
|
|||
|
||||
/* in /gtk ... */
|
||||
#include <gtk/gtk.h>
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
#include <glib-object.h>
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include "gtkglobals.h"
|
||||
|
@ -71,15 +69,6 @@
|
|||
#include "graph_analysis.h"
|
||||
|
||||
|
||||
/* XXX FIXME */
|
||||
/* GTK-1.x does not have GDK_IS_DRAWABLE so just define is as always being true
|
||||
* so that Wireshark compiles.
|
||||
* At later stage we should implement it as a real fallback for gtk-1.x
|
||||
* but for the time being us very few gtk-1.2 users at elast can compile.
|
||||
*/
|
||||
#if (GTK_MAJOR_VERSION < 2)
|
||||
#define GDK_IS_DRAWABLE(x) 1
|
||||
#endif
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
|
@ -87,11 +76,6 @@
|
|||
#define PT_UNDEFINED -1
|
||||
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
GtkRcStyle *rc_style;
|
||||
GdkColormap *colormap;
|
||||
#endif
|
||||
|
||||
static GtkWidget *save_to_file_w = NULL;
|
||||
|
||||
#define MAX_LABEL 50
|
||||
|
@ -246,11 +230,7 @@ static void enlarge_string(GString *gstr, guint32 length, char pad){
|
|||
static void overwrite (GString *gstr, char *text_to_insert, guint32 p1, guint32 p2){
|
||||
|
||||
guint32 len;
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
gint pos;
|
||||
#else
|
||||
gsize pos;
|
||||
#endif
|
||||
|
||||
if (p1 == p2)
|
||||
return;
|
||||
|
@ -616,15 +596,9 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
GdkGC *frame_bg_color;
|
||||
GdkGC *div_line_color;
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
GdkFont *font;
|
||||
FONT_TYPE *big_font;
|
||||
FONT_TYPE *small_font;
|
||||
#else
|
||||
PangoLayout *layout;
|
||||
PangoLayout *big_layout;
|
||||
PangoLayout *small_layout;
|
||||
#endif
|
||||
gint label_width, label_height;
|
||||
guint32 draw_width, draw_height;
|
||||
char label_string[MAX_COMMENT];
|
||||
|
@ -632,11 +606,6 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
|
||||
/* new variables */
|
||||
|
||||
#if GTK_MAJOR_VERSION <2
|
||||
font = user_data->dlg.draw_area->style->font;
|
||||
big_font = gdk_font_load("-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1");
|
||||
small_font = gdk_font_load("-adobe-helvetica-bold-r-normal--10-120-75-75-p-70-iso8859-1");
|
||||
#endif
|
||||
if(!user_data->dlg.needs_redraw){
|
||||
return;
|
||||
}
|
||||
|
@ -739,10 +708,6 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
/* Calculate the x borders */
|
||||
/* We use time from the last display item to calcultate the x left border */
|
||||
g_snprintf(label_string, MAX_LABEL, "%.3f", user_data->dlg.items[display_items-1].time);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
label_width=gdk_string_width(font, label_string);
|
||||
label_height=gdk_string_height(font, label_string);
|
||||
#else
|
||||
layout = gtk_widget_create_pango_layout(user_data->dlg.draw_area_time, label_string);
|
||||
big_layout = gtk_widget_create_pango_layout(user_data->dlg.draw_area_time, label_string);
|
||||
small_layout = gtk_widget_create_pango_layout(user_data->dlg.draw_area_time, label_string);
|
||||
|
@ -754,7 +719,6 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
pango_layout_set_font_description(small_layout, pango_font_description_from_string("Helvetica,Sans,Bold 7"));
|
||||
|
||||
pango_layout_get_pixel_size(layout, &label_width, &label_height);
|
||||
#endif
|
||||
|
||||
/* resize the "time" draw area */
|
||||
|
||||
|
@ -795,16 +759,6 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
|
||||
/* Draw the word "Time" on top of time column */
|
||||
g_snprintf(label_string, label_width, "%s", "Time");
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
label_width=gdk_string_width(font, label_string);
|
||||
label_height=gdk_string_height(font, label_string);
|
||||
gdk_draw_string(user_data->dlg.pixmap_time,
|
||||
font,
|
||||
user_data->dlg.draw_area_time->style->black_gc,
|
||||
left_x_border+4,
|
||||
top_y_border/2-label_height/2,
|
||||
label_string);
|
||||
#else
|
||||
pango_layout_set_text(layout, label_string, -1);
|
||||
pango_layout_get_pixel_size(layout, &label_width, &label_height);
|
||||
if (GDK_IS_DRAWABLE(user_data->dlg.pixmap_time)) {
|
||||
|
@ -814,20 +768,9 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
top_y_border/2-label_height/2,
|
||||
layout);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Draw the word "Comment" on top of comment column */
|
||||
g_snprintf(label_string, label_width, "%s", "Comment");
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
label_width=gdk_string_width(font, label_string);
|
||||
label_height=gdk_string_height(font, label_string);
|
||||
gdk_draw_string(user_data->dlg.pixmap_comments,
|
||||
font,
|
||||
user_data->dlg.draw_area_comments->style->black_gc,
|
||||
MAX_COMMENT/2-label_width/2,
|
||||
top_y_border/2-label_height/2,
|
||||
label_string);
|
||||
#else
|
||||
pango_layout_set_text(layout, label_string, -1);
|
||||
pango_layout_get_pixel_size(layout, &label_width, &label_height);
|
||||
if (GDK_IS_DRAWABLE(user_data->dlg.pixmap_comments)) {
|
||||
|
@ -837,7 +780,6 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
top_y_border/2-label_height/2,
|
||||
layout);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Paint the background items */
|
||||
for (current_item=0; current_item<display_items; current_item++){
|
||||
|
@ -865,16 +807,6 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
/* XXX we assign 5 pixels per character in the node identity */
|
||||
g_snprintf(label_string, NODE_WIDTH/5, "%s",
|
||||
get_addr_name(&(user_data->nodes[i])));
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
label_width=gdk_string_width(font, label_string);
|
||||
label_height=gdk_string_height(font, label_string);
|
||||
gdk_draw_string(user_data->dlg.pixmap,
|
||||
font,
|
||||
user_data->dlg.draw_area->style->black_gc,
|
||||
left_x_border+NODE_WIDTH/2-label_width/2+NODE_WIDTH*i,
|
||||
top_y_border/2-label_height/2,
|
||||
label_string);
|
||||
#else
|
||||
pango_layout_set_text(layout, label_string, -1);
|
||||
pango_layout_get_pixel_size(layout, &label_width, &label_height);
|
||||
if (GDK_IS_DRAWABLE(user_data->dlg.pixmap)) {
|
||||
|
@ -884,7 +816,6 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
top_y_border/2-label_height/2,
|
||||
layout);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* draw the node division lines */
|
||||
if (GDK_IS_DRAWABLE(user_data->dlg.pixmap) ) {
|
||||
|
@ -901,16 +832,6 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
for (current_item=0; current_item<display_items; current_item++){
|
||||
/* draw the time */
|
||||
g_snprintf(label_string, MAX_LABEL, "%.3f", user_data->dlg.items[current_item].time);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
label_width=gdk_string_width(font, label_string);
|
||||
label_height=gdk_string_height(font, label_string);
|
||||
gdk_draw_string(user_data->dlg.pixmap_time,
|
||||
font,
|
||||
user_data->dlg.draw_area->style->black_gc,
|
||||
3,
|
||||
top_y_border+current_item*ITEM_HEIGHT+ITEM_HEIGHT/2+label_height/4,
|
||||
label_string);
|
||||
#else
|
||||
pango_layout_set_text(layout, label_string, -1);
|
||||
pango_layout_get_pixel_size(layout, &label_width, &label_height);
|
||||
if (GDK_IS_DRAWABLE(user_data->dlg.pixmap_time)) {
|
||||
|
@ -920,20 +841,9 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
top_y_border+current_item*ITEM_HEIGHT+ITEM_HEIGHT/2-label_height/2,
|
||||
layout);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*draw the comments */
|
||||
g_snprintf(label_string, MAX_COMMENT, "%s", user_data->dlg.items[current_item].comment);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
label_width=gdk_string_width(small_font, label_string);
|
||||
label_height=gdk_string_height(small_font, label_string);
|
||||
gdk_draw_string(user_data->dlg.pixmap_comments,
|
||||
small_font,
|
||||
user_data->dlg.draw_area_comments->style->black_gc,
|
||||
2,
|
||||
top_y_border+current_item*ITEM_HEIGHT+ITEM_HEIGHT/2+label_height/4,
|
||||
label_string);
|
||||
#else
|
||||
pango_layout_set_text(small_layout, label_string, -1);
|
||||
pango_layout_get_pixel_size(small_layout, &label_width, &label_height);
|
||||
if (GDK_IS_DRAWABLE(user_data->dlg.pixmap_comments)) {
|
||||
|
@ -943,7 +853,6 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
top_y_border+current_item*ITEM_HEIGHT+ITEM_HEIGHT/2-label_height/2,
|
||||
small_layout);
|
||||
}
|
||||
#endif
|
||||
/* select colors */
|
||||
if ( current_item+first_item == user_data->dlg.selected_item ){
|
||||
frame_fg_color = user_data->dlg.draw_area->style->white_gc;
|
||||
|
@ -981,13 +890,8 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
|
||||
/* draw the frame comment */
|
||||
g_snprintf(label_string, MAX_LABEL, "%s", user_data->dlg.items[current_item].frame_label);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
label_width=gdk_string_width(big_font, label_string);
|
||||
label_height=gdk_string_height(big_font, label_string);
|
||||
#else
|
||||
pango_layout_set_text(big_layout, label_string, -1);
|
||||
pango_layout_get_pixel_size(big_layout, &label_width, &label_height);
|
||||
#endif
|
||||
if (start_arrow<end_arrow){
|
||||
arrow_width = end_arrow-start_arrow;
|
||||
label_x = arrow_width/2+start_arrow;
|
||||
|
@ -1002,14 +906,6 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
if ((int)left_x_border > ((int)label_x-(int)label_width/2))
|
||||
label_x = left_x_border + label_width/2;
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
gdk_draw_string(user_data->dlg.pixmap,
|
||||
big_font,
|
||||
frame_fg_color,
|
||||
label_x - label_width/2,
|
||||
top_y_border+current_item*ITEM_HEIGHT+ITEM_HEIGHT/2+label_height/4-3,
|
||||
label_string);
|
||||
#else
|
||||
if (GDK_IS_DRAWABLE(user_data->dlg.pixmap)) {
|
||||
gdk_draw_layout(user_data->dlg.pixmap,
|
||||
frame_fg_color,
|
||||
|
@ -1017,32 +913,17 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
top_y_border+current_item*ITEM_HEIGHT+ITEM_HEIGHT/2-label_height/2-3,
|
||||
big_layout);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* draw the source port number */
|
||||
g_snprintf(label_string, MAX_LABEL, "(%i)", user_data->dlg.items[current_item].port_src);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
label_width=gdk_string_width(small_font, label_string);
|
||||
label_height=gdk_string_height(small_font, label_string);
|
||||
#else
|
||||
pango_layout_set_text(small_layout, label_string, -1);
|
||||
pango_layout_get_pixel_size(small_layout, &label_width, &label_height);
|
||||
#endif
|
||||
if (start_arrow<end_arrow){
|
||||
src_port_x = start_arrow - label_width - 2;
|
||||
}
|
||||
else {
|
||||
src_port_x = start_arrow + 2;
|
||||
}
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
gdk_draw_string(user_data->dlg.pixmap,
|
||||
small_font,
|
||||
div_line_color,
|
||||
src_port_x,
|
||||
top_y_border+current_item*ITEM_HEIGHT+ITEM_HEIGHT-2+label_height/4-2,
|
||||
label_string);
|
||||
#else
|
||||
if (GDK_IS_DRAWABLE(user_data->dlg.pixmap)) {
|
||||
gdk_draw_layout(user_data->dlg.pixmap,
|
||||
div_line_color,
|
||||
|
@ -1050,31 +931,17 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
top_y_border+current_item*ITEM_HEIGHT+ITEM_HEIGHT-2-label_height/2-2,
|
||||
small_layout);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* draw the destination port number */
|
||||
g_snprintf(label_string, MAX_LABEL, "(%i)", user_data->dlg.items[current_item].port_dst);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
label_width=gdk_string_width(small_font, label_string);
|
||||
label_height=gdk_string_height(small_font, label_string);
|
||||
#else
|
||||
pango_layout_set_text(small_layout, label_string, -1);
|
||||
pango_layout_get_pixel_size(small_layout, &label_width, &label_height);
|
||||
#endif
|
||||
if (start_arrow<end_arrow){
|
||||
dst_port_x = end_arrow + 2;
|
||||
}
|
||||
else {
|
||||
dst_port_x = end_arrow - label_width - 2;
|
||||
}
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
gdk_draw_string(user_data->dlg.pixmap,
|
||||
small_font,
|
||||
div_line_color,
|
||||
dst_port_x,
|
||||
top_y_border+current_item*ITEM_HEIGHT+ITEM_HEIGHT-2+label_height/4-2,
|
||||
label_string);
|
||||
#else
|
||||
if (GDK_IS_DRAWABLE(user_data->dlg.pixmap)) {
|
||||
gdk_draw_layout(user_data->dlg.pixmap,
|
||||
div_line_color,
|
||||
|
@ -1082,7 +949,6 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
top_y_border+current_item*ITEM_HEIGHT+ITEM_HEIGHT-2-label_height/2-2,
|
||||
small_layout);
|
||||
}
|
||||
#endif
|
||||
/* draw the div line of the selected item with soft gray*/
|
||||
if ( current_item+first_item == user_data->dlg.selected_item )
|
||||
for (i=0; i<user_data->num_nodes; i++){
|
||||
|
@ -1096,10 +962,7 @@ static void dialog_graph_draw(graph_analysis_data_t* user_data)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
g_object_unref(G_OBJECT(layout));
|
||||
#endif
|
||||
|
||||
/* refresh the draw areas */
|
||||
if (GDK_IS_DRAWABLE(user_data->dlg.draw_area_time->window) )
|
||||
|
@ -1169,8 +1032,6 @@ static gint button_press_event(GtkWidget *widget, GdkEventButton *event _U_)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
/* scroll events are not available in gtk-1.2 */
|
||||
/****************************************************************************/
|
||||
static gint scroll_event(GtkWidget *widget, GdkEventScroll *event)
|
||||
{
|
||||
|
@ -1203,7 +1064,6 @@ static gint scroll_event(GtkWidget *widget, GdkEventScroll *event)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
static gint key_press_event(GtkWidget *widget, GdkEventKey *event _U_)
|
||||
|
@ -1358,29 +1218,13 @@ static gint configure_event(GtkWidget *widget, GdkEventConfigure *event _U_)
|
|||
for (i=0; i<2; i++){
|
||||
user_data->dlg.div_line_gc[i]=gdk_gc_new(user_data->dlg.pixmap);
|
||||
gdk_gc_set_line_attributes(user_data->dlg.div_line_gc[i], 1, GDK_LINE_ON_OFF_DASH, 0, 0);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
colormap = gtk_widget_get_colormap (widget);
|
||||
if (!gdk_color_alloc (colormap, &color_div_line[i])){
|
||||
g_warning ("Couldn't allocate color");
|
||||
}
|
||||
gdk_gc_set_foreground(user_data->dlg.div_line_gc[i], &color_div_line[i]);
|
||||
#else
|
||||
gdk_gc_set_rgb_fg_color(user_data->dlg.div_line_gc[i], &color_div_line[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* create gcs for the background items */
|
||||
for (i=0; i<MAX_NUM_COL_CONV+1; i++){
|
||||
user_data->dlg.bg_gc[i]=gdk_gc_new(user_data->dlg.pixmap);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
colormap = gtk_widget_get_colormap (widget);
|
||||
if (!gdk_color_alloc (colormap, &col[i])){
|
||||
g_warning ("Couldn't allocate color");
|
||||
}
|
||||
gdk_gc_set_foreground(user_data->dlg.bg_gc[i], &col[i]);
|
||||
#else
|
||||
gdk_gc_set_rgb_fg_color(user_data->dlg.bg_gc[i], &col[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
dialog_graph_redraw(user_data);
|
||||
|
@ -1455,7 +1299,6 @@ static gint configure_event_time(GtkWidget *widget, GdkEventConfigure *event _U_
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
/****************************************************************************/
|
||||
static gint pane_callback(GtkWidget *widget, GParamSpec *pspec _U_, gpointer data)
|
||||
{
|
||||
|
@ -1479,7 +1322,6 @@ static gint pane_callback(GtkWidget *widget, GParamSpec *pspec _U_, gpointer dat
|
|||
user_data->dlg.draw_area_comments->allocation.height);
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
static gint v_scrollbar_changed(GtkWidget *widget _U_, gpointer data)
|
||||
|
@ -1531,9 +1373,7 @@ static void create_draw_area(graph_analysis_data_t* user_data, GtkWidget *box)
|
|||
OBJECT_SET_DATA(user_data->dlg.draw_area_comments, "graph_analysis_data_t", user_data);
|
||||
gtk_widget_add_events (user_data->dlg.draw_area_comments, GDK_BUTTON_PRESS_MASK);
|
||||
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
SIGNAL_CONNECT(user_data->dlg.draw_area_comments, "scroll_event", scroll_event, user_data);
|
||||
#endif
|
||||
/* create main Graph draw area */
|
||||
user_data->dlg.draw_area=gtk_drawing_area_new();
|
||||
if (user_data->num_nodes < 2)
|
||||
|
@ -1569,9 +1409,7 @@ static void create_draw_area(graph_analysis_data_t* user_data, GtkWidget *box)
|
|||
|
||||
gtk_widget_add_events (user_data->dlg.draw_area, GDK_BUTTON_PRESS_MASK);
|
||||
SIGNAL_CONNECT(user_data->dlg.draw_area, "button_press_event", button_press_event, user_data);
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
SIGNAL_CONNECT(user_data->dlg.draw_area, "scroll_event", scroll_event, user_data);
|
||||
#endif
|
||||
SIGNAL_CONNECT(user_data->dlg.draw_area, "key_press_event", key_press_event, user_data);
|
||||
|
||||
gtk_widget_show(user_data->dlg.draw_area_time);
|
||||
|
@ -1588,9 +1426,7 @@ static void create_draw_area(graph_analysis_data_t* user_data, GtkWidget *box)
|
|||
user_data->dlg.hpane = gtk_hpaned_new();
|
||||
gtk_paned_pack1(GTK_PANED (user_data->dlg.hpane), user_data->dlg.scroll_window, FALSE, TRUE);
|
||||
gtk_paned_pack2(GTK_PANED (user_data->dlg.hpane), scroll_window_comments, TRUE, TRUE);
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
SIGNAL_CONNECT(user_data->dlg.hpane, "notify::position", pane_callback, user_data);
|
||||
#endif
|
||||
gtk_widget_show(user_data->dlg.hpane);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox), user_data->dlg.hpane, TRUE, TRUE, 0);
|
||||
|
@ -1667,11 +1503,9 @@ static void dialog_graph_create_window(graph_analysis_data_t* user_data)
|
|||
if(user_data->dlg.parent_w) {
|
||||
gtk_window_set_transient_for(GTK_WINDOW(user_data->dlg.window),
|
||||
GTK_WINDOW(user_data->dlg.parent_w));
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
/* Destruction of this child window in GTK1 is handled by a call
|
||||
* to destroy_window() in flow_graph.c. */
|
||||
gtk_window_set_destroy_with_parent(GTK_WINDOW(user_data->dlg.window), TRUE);
|
||||
#endif
|
||||
}
|
||||
g_free(win_name);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue