File: developer.txt

package info (click to toggle)
glade-nonus 0.6.4-5
  • links: PTS
  • area: main
  • in suites: woody
  • size: 12,152 kB
  • ctags: 3,879
  • sloc: ansic: 54,332; sh: 6,839; makefile: 743; sed: 93
file content (167 lines) | stat: -rw-r--r-- 5,696 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

This file will contain info for developers of Glade.

A lot of this is out-of-date.


Overview
========

Describe GbWidgets

Describe structs, file formats

Writing source code - use same style as GTK+ (& GNU), i.e. the standard output
of GNU indent.


Compiling Glade for Debugging
=============================

export CFLAGS=-g
./configure --enable-debug

Set the CFLAGS environment variable to -g before running configure, so you get
all the symbols for a debugger to use. (You should also compile GTK like this
as well.) e.g. 'export CFLAGS=-g' for the bash shell.

Use the --enable-debug flag when configuring Glade. This enables debugging
output, but doesn't turn it on.

Set the 'GLADE_DEBUG' environment variable, which is a list of options
separated by colons. Current options:

  warnings - causes an abort() when a WARNING message is issued, so you can
             use gdb to find out exactly what happened.
  messages - causes lots of debugging messages to be output.

e.g. to enable the warnings option:

  export GLADE_DEBUG='warnings'

for both options:

  export GLADE_DEBUG='warnings:messages'

This means that you can turn these features on/off without recompiling!!


Brief Description of the Glade Source Files
===========================================

Main files:

  project.c	  - the main project window & all its functions.
  palette.c	  - the widget palette & its functions - very simple.
  property.c	  - the property window & all its functions.

  editor.c	  - the bulk of the user interface editing code.
  gbwidget.c	  - functions for manipulating the GbWidgets.

  glade_keys_dialog.c
		  - a dialog box which shows the list of GDK keysyms to
		    select for accelerators (encapsulated as a widget).
  glade_menu_editor.c
		  - a dialog box for editing menubars/popup menus
		    (encapsulated as a widget).
  tree.c	  - the window showing a hierarchical view of the widgets.

  load.c	  - functions used when loading project files.
  save.c	  - functions used when saving project files.
  source.c	  - functions used when writing C source code.


Simple additional files:

  keys.c	  - array of Gdk keysyms which can be used for accelerators.
  utils.c	  - a few utility functions, currently 3 simple dialog boxes.

  gb.h		  - this is included by all gbwidget source files and includes
		    all the glade header files. (It is used so that we don't
		    have to change every gbwidget source file each time a new
		    header file is added.)


GbWidgets
=========

Each file in gbwidgets/ directory corresponds to one GtkWidget, and includes
functions for creating a new widget, getting & setting the properties
particular to that widget, adding items to the popup context-sensitive menus,
and writing the C source code.

I've used a flat structure (i.e. GbWidgets can't have subclasses/superclasses)
for simplicity. A class structure may have eliminated some duplicated code,
but would have been more complex to set up. Maybe in future...

When Glade development began, the reflection mechanism in GTK+ (Args) was
still immature and not complete, so I could not use it.
But we will be moving towards Args, first to support external widgets, and
then gradually moving existing widgets over. Though we need to make this
very flexible so we can still add special code for individual widgets when
needed.



GbWidgetData
============

Each widget has a GbWidgetData struct which contains extra information
for the widget. For example, it holds flags specifying whether the widget
should be visible and whether it should grab the focus & the default.
It also contains a list of accelerators and signals added to the widget.

It may also contain the widget's size and position, though this depends on
where the widget is used in the interface. For most widgets the position
is set by the parent container, but for toplevel windows and widgets in
fixed containers, the position can be set explicitly.


Properties
==========

  The property hashes for looking up value widgets, ( + labels & buttons)
  Storing values of properties in the data hash of the value widget


'Placeholders'
==============

Placeholders are used to represent spaces in boxes/tables etc. into which a
widget can be placed by the user.

The macro GB_WIDGET_IS_PLACEHOLDER(widget) can be used to see if the
widget (a GtkWidget*) is a placeholder.


'GbStyles'
==========

The GbStyle struct stores information about styles used for widgets created
in Glade. GbStyles can be named so that they can be easily shared between
widgets. The struct also stores the font specification string and the
background pixmap filenames, so that the style can be reconstructed later.

Each widget has a pointer to a GbStyle in its GbWidgetData struct. There are
also two relevant flags in the GbWidgetData -
  GB_STYLE_IS_UNNAMED - if the widget is supposedly using an unnamed GbStyle.
			Note: the widget may actually be using a named GbStyle,
			but we only create new unnamed GbStyles if the widget's
			style is changed. This is done because all widgets are
			initially created with an unnamed style so users can
			edit each widgets style individually, but we don't
			want to create individual GbStyles for all widgets
			since most will not be changed.
  GB_STYLE_PROPAGATE  - if the widget's GbStyle is propagated to its
			descendants. But it won't override a descendant
			widget's GbStyle if that has been set explicitly.

Note: A GtkStyle may be shared between GbStyles. ?

This code is unfortunately quite confusing at present. Most of it is in
apply_style() in gbwidget.c and in the functions to do with the style dialog,
after show_style_dialog() in property.c.



Damon, 26 September 1998.