mc/doc/DEVEL

120 lines
4.0 KiB
Plaintext
Raw Normal View History

1998-02-27 07:54:42 +03:00
-*-outline-*-
This is the developers' hint guide.
Some parts are based on mail messages.
Please feel free to add your name to this list:
by Miguel de Icaza
* Working with the Midnight Commander
If you plan on working on the Midnight Commander, here are some
tips on how to make your development easier and my job of merging
your code easier, I find them useful.
o Run make depend if you modify the source code structure (e.g. you
add/remove include files). This is very important, it will help you
to get an accurate compilation.
o It's recommended that you use GNU Make (if you want to use the
depend feature).
o I work with the tags feature of GNU emacs. Run the make tags
command to get an updated TAGS file. The command Alt-. will take
you to any function or variable definition.
o Try to keep the indenting style as it is currently. Normally if you
just created a new file with a different coding style, run the GNU
indent program on it (remember to make a backup copy first) like
this: indent -kr -i4 -psl -pcs filename.c
1998-02-27 07:54:42 +03:00
o This code is distributed under the GNU General Public License and
Keep this in mind when adding code to the program.
* Code structure.
The program uses extensively the dialog manager written by Radek
Doulik. To understand how the dialog manager works, please read
the dlg.c and dlg.h. You will find the basic widgets in the file
widget.c and the widget.h file. If you understand this two files,
you are done. The files option.c and boxes.c contain some examples
of how the dialog manager functions are used. For a more complete
example, take a look at the main.c file.
The file util.c has a lot of utility functions. Get familiar with
them, they are very simple.
The code has almost no hardcoded limits, there are a lot of ways of
avoiding them. For example, when you want to concatenate strings,
use the g_strconcat functions, it is used like this:
1998-02-27 07:54:42 +03:00
new_text = g_strconcat (username, " ", password, NULL);
1998-02-27 07:54:42 +03:00
This mallocs the required area, so it still needs to be freed.
* Upcoming changes.
* Panels
* Input handling
The routines for input handling on the Midnight Commander are:
getch, get_key_code, mi_getch and get_event.
1998-02-27 07:54:42 +03:00
getch is an interface to the low level system input mechanism. It
1998-02-27 07:54:42 +03:00
does not deal with the mouse.
In the case of ncurses, this is a function implemented in the
ncurses library that translates key sequences to key codes (\E[A to
something like KEY_UP and so on).
1998-02-27 07:54:42 +03:00
In the case of S-Lang there is no such conversion, that's why we
1998-02-27 07:54:42 +03:00
load a set of extra definitions.
The get_key_code routine converts the data from getch to the
constants the Midnight Commander uses.
1998-02-27 07:54:42 +03:00
In the case of S-Lang, it will actually do all the jobs that getch
1998-02-27 07:54:42 +03:00
does for curses. In the case of curses it patches a couple of
sequences that are not available on some terminal databases. This
routine is the one you want to use if you want a character without
the mouse support.
get_event is the routine you want to use if you want to handle mouse
events, it will return 0 on a mouse event, ERR if no input is
available or a key code if there is some input available. This
routine in turn uses get_key_code to decode the input stream and
convert it to useful constants.
mi_getch is just a wrapper around get_event that ignores all the mouse
events. It's used only in a couple of places, this routine may return
ERR if no input is available (if you have set the nodelay option of
ncurses or S-Lang with nodelay) or a character code if no such option is
1998-02-27 07:54:42 +03:00
available.
* Mouse support.
The mouse support in the Midnight Commander is based on the get_event
routine. The core of the mouse event dispatching is in the
dlg.c:run_dlg routine.
* ncurses
Althougt S-Lang is now used by default, we still support it ncurses. We
1998-02-27 07:54:42 +03:00
basically are using a small subset of ncurses because we want to be
compatible with Slang.
* The Dialog manager and the Widgets
** Button widget
** Check box widget
** Radio widget
** Input widget
** Listbox widget