(guile.info.gz) Dia Objective
Info Catalog
(guile.info.gz) Extending Dia
(guile.info.gz) Dia Steps
17.1.1 Deciding Why You Want to Add Guile
-----------------------------------------
First off, you should understand why you want to add Guile to Dia at
all, and that means forming a picture of what Dia does and how it does
it. So, what are the constituents of the Dia application?
* Most importantly, the "application domain objects" -- in other
words, the concepts that differentiate Dia from another
application such as a word processor or spreadsheet: shapes,
templates, connectors, pages, plus the properties of all these
things.
* The code that manages the graphical face of the application,
including the layout and display of the objects above.
* The code that handles input events, which indicate that the
application user is wanting to do something.
(In other words, a textbook example of the "model - view - controller"
paradigm.)
Next question: how will Dia benefit once the Guile integration is
complete? Several (positive!) answers are possible here, and the choice
is obviously up to the application developers. Still, one answer is
that the main benefit will be the ability to manipulate Dia's
application domain objects from Scheme.
Suppose that Dia made a set of procedures available in Scheme,
representing the most basic operations on objects such as shapes,
connectors, and so on. Using Scheme, the application user could then
write code that builds upon these basic operations to create more
complex procedures. For example, given basic procedures to enumerate
the objects on a page, to determine whether an object is a square, and
to change the fill pattern of a single shape, the user can write a
Scheme procedure to change the fill pattern of all squares on the
current page:
(define (change-squares'-fill-pattern new-pattern)
(for-each-shape current-page
(lambda (shape)
(if (square? shape)
(change-fill-pattern shape new-pattern)))))
Info Catalog
(guile.info.gz) Extending Dia
(guile.info.gz) Dia Steps
automatically generated byinfo2html