Next: Validator
Up: Editor
Previous: Overview
  Contents
Drawing Area
The Drawing Area is the main component of the Editor module. It is a
GTK drawing area which is described in Appendix B. There
are four important events which Drawing Area handles:
- expose_event calls function named
on_drawingarea_expose_event. It is to redraw visible
part of Drawing Area e.g. when Drawing Area becomes visible.
- button_press_event calls
on_drawingarea_button_press_event function. It is
executed every time when the user presses a mouse button when a mouse
pointer is within the Drawing Area. This function is used to create, to
select and to delete graphical objects depending on the pointer
behavior which is controlled by the Editor toolbar.
- button_release_event calls
on_drawingarea_button_release_event function. Similar
to the previous action; it is called when the user releases a mouse
button within the Drawing Area. It is used to notify where to move
or where to link a graphical object.
- motion_notify_event calls
on_drawingarea_motion_notify_event function. It is
called when a mouse pointer passes through the Drawing Area. It is
used to move graphical objects and link them one another. Selection
between moving and linking depends on where a mouse pointer is. If
it is on a connection area of a graphical object then Osiris makes
a connection if it is elsewhere within an object then the object is
moved.
Dealing with many graphical objects forces to arrange them in such a
way that helps to manipulate them. Doubly-linked lists are chosen to
arrange a graphical layer. Each object is a separate element in the list
and each element in the list has information about where is the next
and the previous element. Such a structure allows to keep all objects
together using dynamic memory allocation and provides an easy way to
perform operations on a separate object or on a group of objects.
What is more, doubly-linked lists technology is fully supported by
the GLib library described in Appendix B which is very
helpful.
There are several support functions to manipulate graphical objects
e.g. create, move or draw, and are declared in the header file
main.h in the Osiris source code tree. They all use doubly-linked
lists from Glib library.
Next: Validator
Up: Editor
Previous: Overview
  Contents
Igor Wojnicki
2001-02-21