Author: Jaka Mocnik
Keywords: GHex, ghex, GNOME, Hex Editor

# GNOME Hex Editor Documentation

Copyright (C) 1998, 1999, 2000 Jaka Mocnik

This program and the documentation are 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

For more details see the file COPYING.

## 1. Table of contents

1. Table of contents
2. Introduction
3. Use
4. Feedback

## 2. Introduction

GHex (the GNOME Hex Editor) is a small tool that enables you, its user, to view and edit contents of any file in hex and as ASCII text. It is supposed to be a part of the GNOME desktop environment and tries to nicely integrate with its other components and conform to the general guidelines for GNOME applications.

## 3. Use

When starting GHex, it will pop up a window with nothing but a menubar. When a file is loaded, its contents will be displayed below the menubar in an area that will occupy the largest part of the window. The contents are displayed in both hex and ascii at once, with hexadecimal values on the left and the corresponding ascii representation of those bytes on the right-hand side of the display.

#### The menubar

Menu File

- Open lets you select a file and opens it, reading its contents to a buffer and displaying it immediately in a view.
- Save writes the contents of the buffer to the file with the same name. Be careful with this since you can easily corrupt many files that correspond to a given format.
- Save As lets you select a filename and then saves the contents of the buffer to a file with this name.
- Export to HTML lets you select a filename and then saves the contents of the buffer to a set of files with this name plus number of the page plus the .html extension if it doesn't exist.
- Revert reloads the contents of the file.
- Print prints the contents of the file.
- Print preview shows a preview of the printout of the file.
- Close closes all views and removes the file from the memory.
- Exit should be obvious: it exits GHex.

Menu Edit (only when a file is open)

- Undo undoes the last action.
- Redo redoes the last undone action.
- Find opens the Find Dialog.
- Replace opens the Find & Replace Dialog.
- Goto Byte opens the Jump To Byte Dialog. You can enter the offset of the cursor in decimal or in hex (preceeded by "0x").
- Insert mode selects inserting data rather than overwriting it.
- Group Data As offers three different ways how the bytes in the hex display are grouped: either as single bytes or in groups of two bytes (words) or four bytes (long words).

Menu View (only when a file is open)

- Add view adds another view of the currently edited file.
- Remove view removes the active view. Even if this is the last view of the corresponding file, the file will not be closed and will remain accessible through the Files menu.

Menu Tools

- Open Converter... opens the Base Conversion Dialog.
- Character Table... shows a table with ASCII description, a hexadecimal, decimal, octal and binary representation of each value from 0 to 255. A double click on a row will set the byte at the cursor position in the active view to the value of the row.

Menu Settings

- Preferences brings up the Preferences Dialog.

Menu Files

- Displays names of all the open files. You can access any of them by simply picking them from this menu.

Menu Help

- Help brings up the Gnome help browser with this very file.
- About tells you what GHex is and who is responsible for it.

#### Editing a file

You can move around the file using the arrow keys, the numeric keypad, the scrollbar on the left of the buffer display or by clicking into display with a mouse. Clicking into the hex or ascii display will activate hex or ascii editing mode. The active display is indicated by a full cursor, while the other one displays cursor as an outline.

In ascii mode, you can edit the file pretty much as with any text editor. In hex mode, you can change the value of the nibble (four bits, a half of a byte) under the cursor with keys '0' .. '9' and 'a' .. 'f', representing the hex digits.

#### Finding and replacing data

Selecting Find from the Edit menu will bring up the Find Dialog. It allows you to search the file for a string that you can enter in either hex or ascii. To find an ascii string, simply enter it into the entry widget and click on the Find Next or Find Previous button. You can choose in which form (either hex or ASCII) you wish to enter the search string with the two radio buttons below the entry widget.

Replacing data is much alike, except that you have to enter both a string to be found and a string that will replace the found value. The Find Next button will search for the next occurence of the string from the first entry widget, the Replace button will replace the data if the cursor is on the beginning of a string that equals to the searched-for one and then search for the next occurence, if the cursor is not positioned on the beginning of the searched-for string, it will try to find the next occurence of it, but will not replace that one. Finally, the Replace All button will replace all occurences of the searched-for string from the current cursor position to the end of the file.

#### Base Conversion Dialog

Shows you up to four bytes of data as their binary, decimal, hexadecimal and ASCII representation. The values automatically update when you change data in any entry. 'Get cursor value' button grabs the value of the data under the cursor (either byte, word or long word, depending on the groupping setting).

#### Setting user preferences

- Editing settings: here you can set the maximum number of changes that can be undone and pick the format the the cursor offset will be shown at. This format can be either decimal or hexadecimal or a custom printf style string containing no other format specifiers but 'x', 'o' and 's'. You can also set whether the hex editing widget will show an extra column with the offsets of beginning of lines on the left.
- Display settings: here you can set the default data grouping type and the display font.
- MDI settings: lets user select preferred interface type. Currently supported options are:

- Default: mode chosen by the user with Look and Feel properties.
- Notebook: displays views in notebook pages, enabling user to create a new toplevel window from each notebook page by dragging it to the root window.
- Toplevel: displays each view in its own toplevel window.
- Modal: only displays one view at a time, allowing user to select a document from the Files menu.

- Printing settings: you can select the paper size, font for the data and the header and whether parts of the output should be shaded.

## 4. Feedback

GHex is being maintained by Jaka Mocnik <jaka.mocnik@kiss.uni-lj.si>. If you are having trouble installing and/or running GHex, feel free to e-mail me.

You can check the current status and/or get the latest stable release of GHex via WWW at this page. The most recent version is also available at the Gnome CVS repository in module gnome-utils.

Comments, ideas and (most of all) bug reports (and especially patches) are very welcome at the above e-mail address.