Commit Graph

262 Commits

Author SHA1 Message Date
Guy Harris b736ff6251 In the "Preferences" dialog box, "Save" sets the current preference
values to the ones specified in the dialog box, so it should also
redissect the packets and re-evaluate the display filter if any of them
changed.  (I.e., it did part of an "Apply"; it needs to do all of it.)

"Cancel" also needs to find out if any preferences were changed by the
reversion and redissect and refilter if they did.

svn path=/trunk/; revision=2132
2000-07-10 09:18:38 +00:00
Guy Harris ebb525fac6 Put up a progress dialog when changing the time display; it can take a
long time on a large capture.

If the user is changing the setting of "Display TOS as DiffServ" *and*
the time stamp format, don't bother doing the time display update -
we'll regenerate the entire display anyway because we changed the
setting of "Display TOS as DiffServ".

svn path=/trunk/; revision=2130
2000-07-09 23:22:33 +00:00
Guy Harris 2801bb142a In the "Display Options" dialog box code, separately keep track of the
timestamp type when the dialog box was popped up, so we can revert to it
if the user clicks "Cancel", and the timestamp type as of when we
started *or* as of when we last changed it, so that we can check whether
the user's changed it from its current value and only redisplay the time
fields if they've changed it (as redisplaying the time fields could be
expensive - we have to scan through all the packets and rebuild the
packet list).

svn path=/trunk/; revision=2128
2000-07-09 20:59:23 +00:00
Guy Harris 0a71de8137 Turn the code of "colorize_packet()" into a static routine that is given
a word to use in the progress dialog, and a flag indicating whether the
display filter is to be reevaluated or not, and:

	have "colorize_packet()" call that routine with "Colorizing" and
	FALSE as those arguments;

	have the filtering code call that routine with "Filtering" and
	TRUE as those arguments;

	add an exported routine to call that routine with "Reprocessing"
	and TRUE as those arguments, to use to re-generate the packet
	list and to re-filter the packets if a protocol preference has
	been changed.

Keep track of whether preferences are changed from their initial value
by a preferences file or a command-line option, or from their previous
value by the "Preferences" dialog box; have "prefs_apply_all()" only
call the "apply" callback for a module if they have.

Call "prefs_apply_all()" after the command-line arguments have been
parsed and after "OK" has been clicked in the "Preferences" dialog box,
to notify modules of preference changes if they've registered a callback
for that.

After "OK" has been clicked in the "Preferences" dialog box, if any
preferences have changed, call the reprocessing routine, as the summary
line for some frames and/or the current display filter's value when
applied to some frames may have changed as a result of a preference
change.  Do the same after "OK" or "Apply" has been clicked in the
"Display Options" dialog box (as it controls a protocol preferences
item.

svn path=/trunk/; revision=2126
2000-07-09 03:29:42 +00:00
Guy Harris ae1df37513 If the progress dialog gets a "delete" event, have the handler return
TRUE, meaning "don't delete this", and if its "stop this operation"
button gets clicked, don't have its handler delete the progress dialog;
instead, leave the deletion of the window up to the code using the
dialog, as it'll do so when it stops the operation.

Make the "read file" operation destroy the dialog; all the other
operations already did so (as they just broke out of the loop doing the
operation, rather than returning).

Don't catch the "destroy" operation on the dialog box - its handler
appeared never to get called; we can just free the "progdlg_t" for the
dialog in "destroy_progress_dlg()", right after destroying the dialog
box widget.

svn path=/trunk/; revision=2122
2000-07-07 23:09:15 +00:00
Guy Harris 4e69c6bc87 Use "progdlg_t *" rather than "void *" as the handle for a progress
dialog box; that lets us do some type-checking, but we can still typedef
it to an incompletely-defined structure to hide the implementation
details from the caller.

Make "create_progress_dlg()" take, as an argument, the title to put in
the "stop the operation" button, and use "Stop" rather than "Cancel" if
stopping the operation doesn't undo all the work it's done.

Thaw the clist if we break out of a "read the file" operation, as we
freeze it before the operation.

Have the handler for the "delete" event on the progress dialog box
return FALSE, to let GTK+ know that it should, in fact, delete the
window.  ("delete" event handlers should return TRUE if the window
shouldn't actually be deleted, FALSE if it should; they should not
return "void".)

svn path=/trunk/; revision=2120
2000-07-07 07:01:58 +00:00
Guy Harris b1f950b377 Add support for a global "ethereal.conf" preferences file, stored in the
same directory as the "manuf" file ("/etc" or "/usr/local/etc", most
likely).

Add a mechanism to allow modules (e.g., dissectors) to register
preference values, which:

	can be put into the global or the user's preference file;

	can be set from the command line, with arguments to the "-o"
	flag;

	can be set from tabs in the "Preferences" dialog box.

Use that mechanism to register the "Decode IPv4 TOS field as DiffServ
field" variable for IP as a preference.

Stuff that still needs to be done:

	documenting the API for registering preferences;

	documenting the "-o" values in the man page (probably needs a
	flag similar to "-G", and a Perl script to turn the output into
	documentation as is done with the list of field);

	handling error checking for numeric values (range checking,
	making sure that if the user changes the variable from the GUI
	they change it to a valid numeric value);

	using the callbacks to, for example, update the display when
	preferences are changed (could be expensive);

	panic if the user specifies a numeric value with a base other
	than 10, 8, or 16.

We may also want to clean up the existing wired-in preferences not to
take effect the instant you tweak the widget, and to add an "Apply"
button to the "Preferences" dialog.

svn path=/trunk/; revision=2117
2000-07-05 09:41:07 +00:00
Guy Harris ed5651a909 Get rid of the stuff to let the callback that pops up the Preferences
dialog select a particular page - I think that was used only by the
filter code back when "Filter:" buttons popped up a Preferences dialog
with the Filter page (which is no longer a Preferences dialog page)
selected, but now there's a separate Filter dialog box.

svn path=/trunk/; revision=2116
2000-07-05 06:33:02 +00:00
Guy Harris 4522bab239 Put the close button in an HButtonBox, so that it doesn't expand to the
width of the window.

svn path=/trunk/; revision=2115
2000-07-05 06:19:27 +00:00
Guy Harris 83fe7fc195 Put the "Cancel" button in a progress dialog box in an HButtonBox,
rather than an Alignment; that appears to be the correct way to keep
buttons from expanding to the full width of the window.

Don't use "gtk_widget_show()" on every single widget in the progress
dialog box, use "gtk_widget_show_all()" on the top-level widget.

svn path=/trunk/; revision=2114
2000-07-05 05:50:00 +00:00
Guy Harris 36d85ce33c To make windows modal, use "gtk_window_set_modal()" rather than
"gtk_grab_add()"; the former makes it a bit clearer what's being done,
and I think it may be considered the right way to do it (GTK+ remembers
the state of the window and appears to add and remove the grab as
appropriate).

svn path=/trunk/; revision=2113
2000-07-05 02:52:39 +00:00
Guy Harris 105d0f4f70 Add a "dlg_window_new()" routine, which creates a GTK_WINDOW_DIALOG
window and makes it transient for the top-level window; the
transient-for at least provides a hint to X window managers to

	minimize the dialog if the main window is minimized;

	keep the dialog on top of the main window in the Z order for
	windows;

	perhaps (if there are any window managers that actually *do*
	this) even put it atop the main window in the X-Y plane (KWM
	doesn't and I seem to remember that the Exceed X server for
	Windows doesn't).

It's generally considered the Right Thing To Do for dialog boxes.

Use that routine to create dialog boxes, rather than doing it directly
in the code for that dialog box.

svn path=/trunk/; revision=2112
2000-07-05 02:45:42 +00:00
Guy Harris 0c94e5bd81 Note, in a comment, that "gtk_set_locale()" sets the C-language locale.
svn path=/trunk/; revision=2110
2000-07-05 02:04:16 +00:00
Gilbert Ramirez 32fe73b2de Change version to 0.8.10
In gtk/Makefile.nmake, add progress_dlg.obj

svn path=/trunk/; revision=2108
2000-07-04 12:10:06 +00:00
Guy Harris 864c5eabe1 GtkLabel is a subclass of GtkMisc, so it has alignment and padding
parameters and doesn't have to be stuffed into a GtkAlignment to align
it on the left.  (Alas, GtkButton *isn't* a subclass of GtkMisc, so we
have to stuff the Cancel button into an alignment to keep it from
growing to the width of the window.)

svn path=/trunk/; revision=2105
2000-07-03 19:42:36 +00:00
Guy Harris e4a9d0f426 If the user clicks the "Cancel" button in a progress-bar dialog box for
reading a capture file, we should just clean up and return so that
Ethereal continues running with no capture file loaded, unless the read
is being done as a result of Ethereal being run with the "-r" flag, in
which case we still exit (although we may eventually choose to continue
running with no capture file loaded even in that case).

svn path=/trunk/; revision=2104
2000-07-03 09:34:27 +00:00
Guy Harris 9e42b3a4ed Remove the progress bar from the status line, and, instead, for any
potentially long-running operation that has a progress indicator, pop up
a modal dialog box with

	an indication of what is being done;

	a progress bar;

	a "Cancel" button to stop the operation.

This:

	leaves more room on the status line for a filter expression;

	provides a mechanism to allow the user to cancel long-running
	operations (although the way we do so may not back out of them
	as nicely as the user might like, if it's not obvious what the
	"right" way is or if the "right" way is difficult to implement
	or involves doing as much work as letting the operation
	continue);

	means that, because the dialog box is modal, we don't have to
	worry about the user performing arbitrary UI operations out from
	under the operation and changing arbitrary bits of state being
	used by that operation.

svn path=/trunk/; revision=2103
2000-07-03 08:36:52 +00:00
Guy Harris 7843ac6d0e Add routines to Wiretap to allow a client of Wiretap to get:
a pointer to the "wtap_pkthdr" structure for an open capture
	file;

	a pointer to the "wtap_pseudo_header" union for an open capture
	file;

	a pointer to the packet buffer for an open capture file;

so that a program using "wtap_read()" in a loop can get at those items.

Keep, in a "capture_file" structure, an indicator of whether:

	no file is open;

	a file is open, and being read;

	a file is open, and is being read, but the user tried to quit
	out of reading the file (e.g., by doing "File/Quit");

	a file is open, and has been completely read.

Abort if we try to close a capture that's being read if the user hasn't
tried to quit out of the read.

Have "File/Quit" check if a file is being read; if so, just set the
state indicator to "user tried to quit out of it", so that the code
reading the file can do what's appropriate to clean up, rather than
closing the file out from under that code and causing crashes.

Have "read_cap_file()" read the capture file with a loop using
"wtap_read()", rather than by using "wtap_loop()"; have it check after
reading each packet whether the user tried to abort the read and, if so,
close the capture and return an indication that the read was aborted by
the user.  Otherwise, return an indication of whether the read
completely succeeded or failed in the middle (and, if it failed, return
the error code through a pointer).

Have "continue_tail_cap_file()" read the capture file with a loop using
"wtap_read()", rather than by using "wtap_loop()"; have it check after
reading each packet whether the user tried to abort the read and, if so,
quit the loop, and after the loop finishes (even if it read no packets),
return an indication that the read was aborted by the user if that
happened.  Otherwise, return an indication of whether the read
completely succeeded or failed in the middle (and, if it failed, return
the error code through a pointer).

Have "finish_tail_cap_file()" read the capture file with a loop using
"wtap_read()", rather than by using "wtap_loop()"; have it check after
reading each packet whether the user tried to abort the read and, if so,
quit the loop, and after the loop finishes (even if it read no packets),
close the capture and return an indication that the read was aborted by
the user if that happened.  Otherwise, return an indication of whether
the read completely succeeded or failed in the middle (and, if it
failed, return the error code through a pointer).

Have their callers check whether the read was aborted or not and, if it
was, bail out in the appropriate fashion (exit if it's reading a file
specified by "-r" on the command line; exit the main loop if it's
reading a file specified with File->Open; kill the capture child if it's
"continue_tail_cap_file()"; exit the main loop if it's
"finish_tail_cap_file()".

svn path=/trunk/; revision=2095
2000-06-27 07:13:42 +00:00
Guy Harris 5af6a8d416 Pull the code to fetch display options from the display options dialog
box into a common subroutine.

Don't call "change_time_formats()" to update the display unless the time
format actually changed.

svn path=/trunk/; revision=2094
2000-06-27 05:18:44 +00:00
Guy Harris 252385f3fa Get rid of a debugging fprintf.
svn path=/trunk/; revision=2093
2000-06-27 04:40:15 +00:00
Guy Harris 7fbf320b8a Patch from Ben Fowler to rename the global variable "cf" to "cfile", to
make it easier to use grep to find all references to it without getting
a lot of false hits and to check, after allocating the memory chunk for
"frame_data" structures, that the allocation succeeded.

svn path=/trunk/; revision=2092
2000-06-27 04:36:03 +00:00
Guy Harris 068f36c4fe Write and read the temporary file for "Follow TCP Stream" as a binary
file, not as a text file; that makes no difference on UNIX, but, as the
file *is* binary, it makes a difference on Win32 systems.

svn path=/trunk/; revision=2086
2000-06-24 05:06:29 +00:00
Guy Harris f3eddb46cc Changes from Graham Bloice to support "Update list of packets in real
time" during captures on Win32.

svn path=/trunk/; revision=2074
2000-06-15 08:02:43 +00:00
Gilbert Ramirez 78cd3a9a26 Add gtk_set_locale() as recommended by
"Kaoru.Kusunoki" <kusunoki@mbox.kyoto-inet.or.jp>

svn path=/trunk/; revision=2038
2000-06-05 03:09:21 +00:00
Gilbert Ramirez 0f7cf64763 Add a "Enable name resolution" check box to the File Open dialogue.
svn path=/trunk/; revision=2035
2000-06-02 03:35:39 +00:00
Guy Harris baaad29bf8 Graham Bloice's Win32 Makefile changes to build in batch mode (gets rid
of multiple compile lines in the output of the build, speeds the build
up).

svn path=/trunk/; revision=2024
2000-05-29 20:11:41 +00:00
Guy Harris d6a6de8cb3 Incorporate the GTK+ 1.2.8 version of "gtkclist.c" (which includes all
the speedups ours included, and some others).

svn path=/trunk/; revision=2010
2000-05-26 07:47:47 +00:00
Guy Harris cfc9ec9f21 Don't duplicate the "gtk_radio_button_new_with_label()" and
"gtk_check_button_new_with_label()" code, just call those routines and
then fix up the label, as suggested by Dermot Musgrove on the gtk
mailing list.

svn path=/trunk/; revision=2009
2000-05-26 07:32:56 +00:00
Gilbert Ramirez d7e6e0e384 Add wtap-int.h. Move definitions relevant to the internal workins of wiretap
to that file, leave public definitions in wtap.h.

Rename "union pseudo_header" to "union wtap_pseudo_header".
Make the wtap_pseudo_header pointer available in packet_info struct.

svn path=/trunk/; revision=1989
2000-05-19 23:07:04 +00:00
Guy Harris f3d90d30a4 Remove the "union pseudo_header" from the "frame_data" structure;
there's no need to keep it around in memory - when the frame data is
read in when handing a frame, read in the information, if any, necessary
to reconstruct the frame header, and reconstruct it.  This saves some
memory.

This requires that the seek-and-read function be implemented inside
Wiretap, and that the Wiretap handle remain open even after we've
finished reading the file sequentially.

This also points out that we can't really do X.25-over-Ethernet
correctly, as we don't know where the direction (DTE->DCE or DCE->DTE)
flag is stored; it's not clear how the Ethernet type 0x0805 for X.25
Layer 3 is supposed to be handled in any case.  We eliminate
X.25-over-Ethernet support (until we find out what we're supposed to
do).

svn path=/trunk/; revision=1975
2000-05-18 09:09:50 +00:00
Guy Harris 7bf3c7523b Have "proto_tree_is_visible" false except when we're in the middle of
doing something that requires that the text for protocol tree entries be
generated, i.e.

	1) initialize it to FALSE;

	2) have every routine that sets it clear it when it's done;

	3) when printing packets, set it to TRUE only if we're not just
	   printing packet summary lines;

and then get rid of settings to FALSE made unnecessary as a result of
those changes.

This makes sure it's not set when it doesn't have to be (which causes
the protocol tree code to format the text when it doesn't have to,
wasting CPU time).

svn path=/trunk/; revision=1973
2000-05-18 08:35:01 +00:00
Guy Harris 33f9afee30 Graham Bloice's changes to make clicking on a column header cause the
display to be sorted by the value in that column (and to reverse the sort
order the next time you click on that column).

Use "F<>" rather than "B<>" for file names in the Ethereal man page.

svn path=/trunk/; revision=1931
2000-05-10 06:00:22 +00:00
Guy Harris 740bb55521 Make the "Preferences" dialog box use the new utilities to make the Esc
key cancel the dialog box.

svn path=/trunk/; revision=1923
2000-05-08 07:58:20 +00:00
Guy Harris 158df5470a Keep a pointer to the current "Preferences" window, if any - if not, the
pointer is NULL - so that, instead of doing nothing if the user selects
"Edit->Preferences" when there's already a "Preferences" dialog box
open, we raise and de-iconify that window.

Connect the preferences dialog box and any file selection dialog box
opened from its Print tab, so that:

	if the preferences dialog box goes away, so does the file
	selection dialog box (as it no longer has a text widget into
	which it can stuff the selected file name);

	if the "File:" button is clicked when there's already a file
	selection dialog box open, we just reactivate that existing
	dialog box rather than popping up a new one.

Catch the ESC key in the file selection dialog box popped up for the
"File:" button in the Print tab of the Preferences dialog box, and make
it cancel the file selection dialog box.

svn path=/trunk/; revision=1922
2000-05-08 07:54:54 +00:00
Guy Harris 9bb3a841e3 Catch the ESC key in the file selection dialog boxes popped up for
"File->Open", "File->Save As", and the "File:" buttons in the Capture
Preferences and Print dialog boxes, and make it cancel the file
selection dialog box.

svn path=/trunk/; revision=1921
2000-05-08 07:13:40 +00:00
Guy Harris be87df37bf Set up the buttons in the "Capture Preferences" dialog box to use
mnemonics.

Give the button, in the "Display Options" dialog box, that controls
whether name resolution is enabled or not the same label ("Enable name
resolution") as the equivalent button in the "Capture Preferencs" dialog
box.

svn path=/trunk/; revision=1920
2000-05-08 05:51:37 +00:00
Guy Harris f0991d4a51 Connect the capture preferences dialog box and any file selection dialog
box it has open, so that:

	if the capture preferences dialog box goes away, so does the
	file selection dialog box (as it no longer has a text widget
	into which it can stuff the selected file name);

	if the "File:" button is clicked when there's already a file
	selection dialog box open, we just reactivate that existing
	dialog box rather than popping up a new one.

svn path=/trunk/; revision=1919
2000-05-08 05:42:54 +00:00
Guy Harris b6f55c2966 Keep a pointer to the current "Print" window, if any - if not, the
pointer is NULL - so that, instead of doing nothing if the user selects
"File->print" when there's already a "Print" dialog box open, we raise
and de-iconify that window.

Connect the print dialog box and any file selection dialog box it has
open, so that:

	if the print dialog box goes away, so does the filter dialog box
	(as it no longer has a text widget into which it can stuff the
	selected file name);

	if the "File:" button is clicked when there's already a file
	selection dialog box open, we just reactivate that existing
	dialog box rather than popping up a new one.

svn path=/trunk/; revision=1918
2000-05-08 05:35:08 +00:00
Guy Harris 63d3730e11 Keep a pointer to the current "Display Options" window, if any - if not,
the pointer is NULL - so that, instead of doing nothing if the user
selects "Display->Options" when there's already a "Display Options"
dialog box open, we raise and de-iconify that window.

Register a "destroy" callback for the "Display Options" window, so that
no matter how it's destroyed, even if it's destroyed by a window manager
close button rather than by clicking the "OK" or "Cancel" button, we
note that fact by clearing the pointer to the current "Display Options"
window, so that if the user then selects "Display->Options", we know
that we need to pop a new "Display Options" window up.

svn path=/trunk/; revision=1917
2000-05-08 05:12:19 +00:00
Guy Harris 73d9b5f47c Set up the buttons in the "Find Frame" and "Print" dialog boxes to use
mnemonics.

svn path=/trunk/; revision=1916
2000-05-08 04:53:21 +00:00
Guy Harris e160ffa08c Add functions to create buttons whose labels specify mnemonics, i.e.
that contain an "_" preceding a letter, indicating that the letter is to
be underlined in the label, and that if the key for that letter is
pressed (either with Alt or without it) in the dialog box to which the
button belongs, and the widget with the input focus doesn't do anything
with that button, the button is sent the "clicked" signal.

Attach mnemonics to the buttons in the "Display->Options" dialog box.

svn path=/trunk/; revision=1915
2000-05-08 04:23:46 +00:00
Guy Harris e701346096 Make the display options dialog box use the new utilities to make the
Esc key cancel the dialog box.

svn path=/trunk/; revision=1914
2000-05-08 01:23:16 +00:00
Guy Harris 3d8fa758b5 Get rid of some unnecessary (and "#if 0"ed-out) includes.
svn path=/trunk/; revision=1913
2000-05-08 01:11:46 +00:00
Guy Harris 6dd7421ac7 Make the "Print" dialog box use the new utilities to make the Return
key print the packets and make the Esc key cancel the dialog box.

svn path=/trunk/; revision=1907
2000-05-03 07:50:38 +00:00
Guy Harris d96eb452ac Make the summary dialog box use the new utilities to make the Return
and Esc keys close the dialog box; to make the Return key work, we have
to make the "Close" button the default widget.

svn path=/trunk/; revision=1906
2000-05-03 07:44:12 +00:00
Guy Harris 2d51ff4e4f Make dialog boxes created with "simple_dialog()" use the new utilities
to make the Esc key cancel the dialog box (or accept it, if it has no
"Cancel" button).

svn path=/trunk/; revision=1905
2000-05-03 07:19:38 +00:00
Guy Harris 4509614da1 Make the "Capture Preferences" dialog box use the new utilities to make
the Return key start the capture and make the Esc key cancel the dialog
box.

svn path=/trunk/; revision=1904
2000-05-03 07:09:40 +00:00
Guy Harris ebdbff44e8 Add some utilities to:
set the "activate" signal for a widget to call a routine to
	activate the "OK" button for a dialog box;

	set the "key_press_event" signal for a top-level dialog window
	to call a routine to activate the "Cancel" button for a dialog
	box if the key being pressed is the <Esc> key;

to make it easier to drive dialog boxes entirely from the keyboard.

Make the "Find Frame" and "Go To Frame" dialog boxes use those
utilities.

svn path=/trunk/; revision=1903
2000-05-02 08:04:31 +00:00
Guy Harris f3feac3b1d Put in a comment to note what we'd do if we ever wanted to make the
contents of the popup menu differ based on what row or column we're in.

svn path=/trunk/; revision=1902
2000-05-02 07:44:37 +00:00
Guy Harris 592f641bfc Make "P" a mnemonic for "Print" in the "File" menu.
svn path=/trunk/; revision=1901
2000-05-02 03:21:41 +00:00