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 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
|
<?xml version="1.0" encoding="utf-8"?>
<!-- -*- indent-tabs-mode: nil -*- -->
<chapter id="core-tech">
<title>Core Technologies</title>
<section id="graphics">
<title>Graphical Interfaces</title>
<para>Most applications will need to provide a graphical interface to
interact with users. Graphical interfaces can create an intuitive and
discoverable medium for people to interact with software, and users expect
applications to provide usable and attractive user interfaces.</para>
<para>The GNOME Platform features sophisticated graphics and user interface
technology, from standard user interface controls to an API for drawing
high-quality graphics to the screen. Using the graphics technologies in
GNOME allows you to create applications that are consistent, intuitive,
and aesthetically pleasing.</para>
<figure>
<title>Layered Look at Graphics Libraries</title>
<mediaobject>
<imageobject>
<imagedata format="PNG" fileref="figures/graphics.png"/>
</imageobject>
</mediaobject>
</figure>
<section id="gtk">
<title>GTK+</title>
<para>GTK+ is the primary library used to construct user interfaces
in GNOME. It provides all the user interface controls, or widgets,
used in a common graphical application. Its modern, object-oriented
API allows you to construct attractive and sophisticated user
interfaces without dealing with the low-level details of drawing and
device interaction.</para>
<para>In addition to basic widgets, such as buttons, check boxes,
and text entries, GTK+ also provides powerful Model-View-Controller
(MVC) APIs for tree views, multi-line text fields, and menu and
toolbar actions.</para>
<para>Widgets in GTK+ are placed on windows using a box-packing model.
Programmers specify only how to pack widgets together in container
boxes, rather than position them directly with absolute coordinates.
GTK+ ensures that windows are sized correctly to fit their contents,
and it automatically handles window resizing.</para>
<para>Because GTK+ offers a flexible API, developing additional widgets
for use in GTK+ applications is easy. A number of third-party libraries
exist which provide additional widgets, and many developers have created
custom, special-purpose widgets for their applications.</para>
<para>GTK+ handles the difficult details of user interfaces and user
interaction, and provides a simple yet powerful API which allows you
to focus on the details of your application. Applications developed
with GTK+ will automatically follow the user's theme and font settings,
will interact properly with accessibility technologies, and will behave
as users expect.</para>
<para>For more information on GTK+, see the
<ulink url="http://library.gnome.org/devel/gtk/stable/">GTK+ Reference
Manual</ulink> or visit
<ulink url="http://gtk.org/">the GTK+ web site</ulink>.</para>
</section> <!-- gtk -->
<section id="libglade">
<title>Libglade</title>
<note><para><note><para>Note that Libglade has been deprecated in favor of
<ulink url="http://library.gnome.org/devel/gtk/stable/GtkBuilder.html">GtkBuilder</ulink>.
Newly written code should use GtkBuilder instead.</para></note></para></note>
<para>Libglade is a library for constructing user interfaces dynamically
from XML descriptions. You can use a graphical interface builder like
<application>Glade</application> to construct your user interface,
and then import the interface description into your application. This
makes it easy to construct complex layouts and adjust layout details.</para>
<para>Libglade allows programmers to focus their code on the logic of
their applications, keeping it uncluttered by the actual construction
of the interface. Graphical interface builders also make it easy for
dedicated interface designers to construct the interfaces without having
to know how to program.</para>
<para>For more information on Libglade, see the <ulink url="http://library.gnome.org/devel/libglade/stable/">Libglade
Reference Manual</ulink>.</para>
</section>
<section id="pango">
<title>Pango</title>
<para>Pango is the core text and font handling library in the GNOME
platform. It is responsible for laying out and rendering text, and
is used throughout GTK+.<footnote>
<para>The Pango layout engine can be used with different font
backends and drawing backends. On most GNOME systems, Pango
will use FreeType, fontconfig, and Cairo to access fonts and
render text. On other systems, Pango will use the native font
systems, such as Uniscribe on Microsoft Windows and ATSUI on
MacOS</para></footnote></para>
<para>Pango has extensive support for the various writing systems
used throughout the world. Many of the writing systems used for
languages have complex rules for laying out glyphs and composing
characters. With Pango, nearly all languages can be written and
displayed correctly, allowing users everywhere to view text in their
native languages. Pango support for multiple writing systems is
automatic; application developers do not have to write any special
code to support other languages.</para>
<figure>
<title>Displaying Multiple Languages With Pango</title>
<screenshot>
<mediaobject>
<imageobject>
<imagedata format="PNG" fileref="figures/pango.png"/>
</imageobject>
<textobject><para>Screenshot of the <application>gedit</application>
text editor displaying phrases from multiple languages and writing
systems.</para></textobject>
</mediaobject>
</screenshot>
</figure>
<para>Pango supports the text styling used in typical documents
and interfaces, including italics, font weights, and underlines.
Pango uses a simple XML-like vocabulary called PangoMarkup which
enables you to set font size, color, styles, and other text
attributes. Using PangoMarkup, you can specify inline styles
without manually iterating over text blocks. PangoMarkup can
be used directly from GTK+, enabling you to style text in your
graphical interfaces easily.</para>
<para>You should use Pango directly whenever you need to lay
text out on the screen or on a different medium. Using Pango
will allow your text layout to work seamlessly with GTK+ and
the rest of the GNOME platform. It will help you create
portable code, and most importantly, it will ensure that your
application can render text correctly in hundreds of different
languages.</para>
<para>For more information on Pango, see the
<ulink url="http://library.gnome.org/devel/pango/stable/">Pango
Reference Manual</ulink>.</para>
</section> <!-- pango -->
<section id="gdk">
<title>GDK</title>
<para>GDK is the low-level library used by GTK+ to interact with the
system for graphics and input devices. Although you will rarely use
GDK directly in application code, it contains all the necessary
functionality to draw objects and text to the screen and to interact
with the user with various input devices.<footnote>
<para>GDK runs on a number of different platforms, including the X Window
System, Microsoft Windows, DirectFB, and Quartz. On any platform, GDK
provides the same consistent API, allowing GTK+ and GTK+ applications to
run unmodified.</para></footnote></para>
<para>GDK features a graphics context and drawing primitives that are
suitable for drawing simple objects and rendering images on the screen.
Since a more extensive drawing system is provided by Cairo, GDK provides
hooks to use Cairo contexts within GDK.</para>
<para>GDK enables you to access events from keyboards, mice, and other
input devices, rather than connect to the high-level signals used in
GTK+. GDK also provides low-level routines to access drag and drop
and clipboard data from the system. When implementing custom controls,
you may need to access these features to implement proper user interaction
behavior.</para>
<para>GDK provides other functionality which is needed to implement
a complete graphical toolkit like GTK+. Since GDK acts as a platform
abstraction, allowing GTK+ to run under multiple environments, it
provides an API for all of the system functionality needed by GTK+.
This includes information about multi-head displays, resolution and
color depth, colormaps, and cursors.</para>
<para>You should use GDK whenever you need low-level access to the
underlying windowing system, including low-level access to events,
windows, and the clipboard. Using GDK for these tasks ensures that
your code is portable and integrates with the rest of your GTK+ code.
The simple drawing routines in GDK should generally not be used.
Instead, you should use the extensive functionality provide by
Cairo.</para>
<para>For more information on GDK, see the
<ulink url="http://library.gnome.org/devel/gdk/stable/">GDK Reference
Manual</ulink>.</para>
</section> <!-- gdk -->
<section id="cairo">
<title>Cairo</title>
<para>Cairo is a 2D graphics library featuring a sophisticated API for
drawing vector graphics, compositing images, and rendering anti-aliased
text. Cairo provides support for multiple output devices, including the
X Window System, Microsoft Windows, and image buffers, allowing you to
write platform-independent code to draw graphics on different media.</para>
<para>The Cairo drawing model is similar to those provided by PostScript
and PDF. The Cairo API provides such drawing operations as stroking and
filling cubic Bézier splines, compositing images, and performing affine
transformations. These vector operations allow for rich, anti-aliased
graphics without using expensive pixel-based drawing in your application
code.</para>
<para>Cairo's rich drawing model allows for high-quality rendering to
multiple media. The same API can be used to create stunning on-screen
graphics and text, to render images, or create crisp output suitable
for printing.</para>
<para>You should use Cairo whenever you need to draw graphics in your
application beyond the widgets provided by GTK+. Much of the drawing
inside GTK+ is done using Cairo. Using Cairo for your custom drawing
will allow your application to have high-quality, anti-aliased, and
resolution-independent graphics.</para>
<para>For more information on Cairo, see <ulink url="http://www.cairographics.org/manual/">Cairo: A Vector Graphics
Library</ulink>.</para>
</section> <!-- cairo -->
</section> <!-- graphics -->
<section id="gio">
<title>Virtual File System</title>
<para>GIO, a part of GLib, is the core library used for file and folder
operations in GNOME applications. GIO provides a unified file system
abstraction layer with pluggable backends. In GNOME, the GVFS library
provides a GIO backend implementing multiple network and local protocols.
Using GIO with GVFS allows your application to work with files on remote
machines as easily as local files.</para>
<para>GIO can provide extensive information about files and folders, including
the MIME type and icon of a file and which applications can be used to open
a file. Since the GVFS uses the standard from <ulink url="http://www.freedesktop.org/">freedesktop.org</ulink> to determine
file types and associations, it works correctly on different free desktop
environments, helping independent software developers create
software that can be run in different environments.</para>
<para>GIO is used throughout the GNOME desktop. The file manager,
<application>Nautilus</application>, uses GIO to display folders on local
and remote systems. For the user, this means that network servers act just
like local folders: They can drag and drop files between them, view the files'
properties, and open the file with an application. Using GIO will allow your
application to open all the files that users can access on their desktop.</para>
<para>For more information on GIO, see the <ulink url="http://library.gnome.org/devel/gio/stable/">GIO Reference Manual</ulink>.</para>
<anchor id="gnome-vfs"/>
<para>In previous versions of GNOME, the GnomeVFS library was used for
access to files and folders. While GnomeVFS provided many of the same
features, including transparent access to remote folders, it had a number
of limitations which have been addressed in GIO. GnomeVFS is deprecated
and should not be used in newly written code, although it will continue
to be supported throughout the GNOME 2 lifetime. For information on
GnomeVFS, see <ulink url="http://library.gnome.org/devel/gnome-vfs-2.0/stable/">GnomeVFS -
Filesystem Abstraction Library</ulink>.</para>
</section> <!-- gio -->
<section id="gconf">
<title>Configuration and Lockdown</title>
<para>GConf is the system for storing and retrieving configuration settings
in GNOME. GConf consists of two parts: a client library for accessing
settings, and a session daemon which is responsible for the details of
storing and retrieving those settings. Using a daemon allows GConf to
use different storage backends, validate input, and provide simultaneous
access to different applications.</para>
<para>Settings stored in GConf are stored and retrieved using a unique
key, or identifier string. Keys use a simple hierarchical namespace to
avoid collision among settings for applications and the desktop. You
can provide a schema file to detail your configuration keys. This allows
GConf to validate the type of the input, and to show localized documentation
about the key. This helps systems administrators, who can set multiple
settings at once without having to navigate preference dialogs.</para>
<para>GConf can look up settings from different settings at once, typically
from different locations on the file system. By having appropriate system
sources configured, GConf enables systems administrators to provide both
default and mandatory settings for all users. Tools such as GNOME's
<application>Configuration Editor</application> and
<application>Sabayon</application> make it easy to deploy fully
configured systems using GConf.</para>
<para>The GConf client library provides notifications of changes to
settings, making it easy to provide instant-apply settings in your
application, regardless if settings are changed from within your
application or using another tool. Setting the value of a key will
notify all interested applications, allowing desktop-wide and other
cross-application settings to work instantly and effortlessly.</para>
<para>GConf makes it easy to lock down systems by setting particular
keys read-only, preventing users from changing their values. In
addition, GNOME provides a number of high-level keys that can be used
to disable actions such as saving to disk and changing the panel layout.
Tools such as <application>Pessulus</application> make it easy for
administrators to find and lock down important keys.</para>
<para>You should use GConf to store all user preferences in your
application. Using GConf will make it easy to provide instant-apply
preferences, and it will make your settings accessible to systems
administrators and configuration and backup tools.</para>
<para>For more information on GConf, see the <ulink url="http://library.gnome.org/devel/gconf/stable/">GConf
Reference Manual</ulink>.</para>
</section> <!-- gconf -->
<section id="i18n">
<title>Internacionalizacion</title>
<para>The GNOME Desktop and Developer Platform provides full support for
internationalizing and localizing applications. Internationalization is
the process of ensuring your application can be localized, including
marking all strings for translations, using numbers and format strings
correctly, and making adjustments for variations in conventions for
times and dates, units, and formatting.</para>
<para>GNOME uses the standard gettext and related routines for accessing
localizations. Support for localization using gettext is built into
every component of the GNOME platform. Your source code can be scanned
for specially-marked tools by automated tools. Those strings are then
placed in PO files to allow translators to track their translations.
Using gettext, you can easily and efficiently access translated versions
of all user-visible strings in your application from translation domains
installed along with your application.</para>
<para>These translation domains can be created using PO files, which
can be used by translators to track string changes and update their
translations accordingly. GNOME ships with intltool, a tool for
managing translations in PO files. Using intltool, translators can
use PO files to translate not only the strings in your application,
but also other types of files that you use, such as GConf schema
files, desktop entry files, and XML files.</para>
<para>GNOME also provides the xml2po tool as part of the gnome-doc-utils
package. This tool allows translators to use PO files to create
translated versions of documentation written in various XML formats,
including XHTML and DocBook.</para>
<para>Internationalization involves more than just allowing strings
to be translated, and GNOME supports your application development
at every step of the process. GTK+ will automatically adjust its
presentation for languages that are read right-to-left, and Pango
has complete support for rendering bidirectional text and text in
various different writing systems. GTK+ supports multiple input
methods, allowing users from all language to input text efficiently
with their keyboards. The entire GNOME platform uses the UTF-8
encoding of Unicode natively, providing access to the characters
and writing systems of the entire world.</para>
<figure>
<title><application>Gnumeric</application> in Multiple Languages</title>
<screenshot>
<mediaobject>
<imageobject>
<imagedata format="PNG" fileref="figures/i18n.png"/>
</imageobject>
<textobject><para>Screenshots of the <application>Gnumeric</application>
spreadsheet application running in Hebrew, Japanese, and Serbian.</para>
</textobject>
</mediaobject>
</screenshot>
</figure>
<para>Internationalizing your application helps make it available
to many more users across the world. While skilled translators
must provide translations for any language, programmers must ensure
the application is properly internationalized before it can be fully
localized.</para>
<!-- FIXME: where is danilo's awesome guide? -->
<para>For more information on internationalization in GNOME, see <ulink url="http://www.gnome.org/~malcolm/i18n/">Internationalizing GNOME
Applications</ulink>.</para>
</section> <!-- i18n -->
<section id="a11y">
<title>Accessibilitat</title>
<para>Accessibility is the process of ensuring your application can be
used by people with various disabilities. Disabilities come in many forms:
visual impairments, movement impairments, hearing impairments, cognitive
and language impairments, and seizure disorders. Many people have some
sort of disability, and making your application accessibility will allow
more people to use your application effectively.</para>
<para>GNOME provides support for accessibility devices using the ATK
framework. This framework defines a set of interfaces to which graphical
interface components adhere. This allows, for instance, screen readers
to read the text of an interface and interact with its controls. ATK
support is built into GTK+ and the rest of the GNOME platform using the
GAIL library, so any application using GTK+ will have reasonable
accessibility support for free.</para>
<para>Nonetheless, you should be aware of accessibility issues when
when developing your applications. Although GTK+ interfaces provide
reasonable accessibility by default, you can often improve how well
your program behaves with accessibility tools by providing additional
information to ATK. If you develop custom widgets, you should ensure
that they expose their properties to ATK. You should also avoid using
sound, graphics, or color as the sole means of conveying information
to the user.</para>
<para>The GNOME desktop ships with a number of accessibility tools
which enable users with disabilities to take full advantage of their
desktop and applications. Applications that fully implement ATK will
be able to work with the accessibility tools. GNOME's accessibility
tools include a screen reader, a screen magnifier, an on-screen
keyboard, and <application>Dasher</application>, an innovative
predictive text entry tool.</para>
<para>For extensive recommendations on accessibility, see <ulink url="http://developer.gnome.org/projects/gap/guide/gad/index.html">GNOME
Accessibility for Developers</ulink>. See also <ulink url="http://library.gnome.org/devel/atk/stable/">ATK -
Accessibility Toolkit</ulink> and the <ulink url="http://library.gnome.org/devel/gail-libgail-util/stable/">GAIL
Reference Manual</ulink>.</para>
</section> <!-- a11y -->
<section id="multimedia">
<title>Multimedià</title>
<para>GStreamer is a powerful multimedia library for playing, creating,
and manipulating sound, video, and other media. You can use GStreamer
to provide sound and video playback, record input from multiple sources,
and edit multimedia content. GStreamer supports encoding and decoding
numerous formats by default, and support for additional formats can be
added with plug-ins.</para>
<para>GStreamer provides a flexible architecture wherein media is
processed through a pipeline of elements. Each element may apply
filters to the content, such as encoding or decoding, combining
multiple sources, or transforming the multimedia content. This
architecture allows for an arbitrary arrangement of elements,
so that you can accomplish virtually any effect using GStreamer.
Furthermore, GStreamer is designed to have low overhead, so it
can be used in applications with high demands on latency.</para>
<para>While GStreamer provides a powerful API for manipulating
multimedia, it also provides convenient routines for simple
playback. GStreamer can automatically construct a pipeline to
read and playback files in any supported format, allowing you
to use sound and video in your application easily.</para>
<para>The GStreamer architecture allows plugins to add encoders,
decoders, and all sorts of content filters. Third-party developers
can provide GStreamer plugins which will be automatically available
to other applications using GStreamer. Plugins can provide support
for other multimedia formats or provide additional functionality
and effects.</para>
<para>You should use GStreamer whenever you need to read or play
multimedia content in your application, or if your application
needs to manipulate sound or video. Using GStreamer makes your
application development easy, and it provides you well-tested
elements for many of your needs.</para>
<para>For comprehensive information on GStreamer, see <ulink url="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html">The
GStreamer Application Development Manual</ulink>, <ulink url="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/">The
GStreamer 0.10 Core Reference Manual</ulink>, and <ulink url="http://gstreamer.freedesktop.org/documentation/">the
GStreamer documentation page</ulink>.</para>
</section> <!-- multimedia -->
<section id="printing">
<title>Estampatge</title>
<para>Most applications need to provide support for printing. Users expect
to be able to print the contents they can view on-screen. The GNOME platform
provides libraries to help you add support for high-quality printing to your
application.</para>
<section id="gnomeprint">
<title>GNOME Print</title>
<note><para>Note that this section is outdated and that libgnomeprint and
libgnomeprintui have been deprecated in favor of <ulink url="http://library.gnome.org/devel/gtk/stable/Printing.html">GtkPrint</ulink>.
Printing has been integrated directly into GTK+ 2.10 and later versions,
providing a cross-platform print API that all applications can use.
API and ABI stability guarantees ensures that Gnomeprint will continue to
be functional and supported throughout the GNOME 2 lifecycle.</para></note>
<para>The GNOME print framework consists of two libraries which help
you provide high-quality printing with a consistent interface in your
application. At the core of the printing framework is libgnomeprint,
a library for creating PostScript output to send to printers. On top
of that is libgnomeprintui, which provides standard print controls for
your user interface.</para>
<para>The libgnomeprint library implements the PostScript imaging model,
which is used by most printers. Printers which do not support PostScript
can still be supported through CUPS, described below. In addition to the
standard PostScript imaging, libgnomeprint also features alpha channel
support and anti-aliasing.</para>
<para>The libgnomeprintui library provides a standard print dialog, a print
preview dialog, and various other controls and functionality required to
build printing into an intuitive user interface. The GNOME print framework
handles the details of locating printers and spooling print jobs, and also
provides PostScript and PDF export directly in the print dialog.</para>
<para>You should use libgnomeprint whenever you need to render content to
PostScript for printing. You should use libgnomeprintui to construct your
printing user interface, even if your rendered output comes from another
source. Using the GNOME print framework provides your users a consistent
user interface with the features they expect of printing appliations.</para>
</section>
<section id="cups">
<title>CUPS</title>
<para>On most GNOME systems, CUPS (Common UNIX Printing System) acts as
the low-level printing system. CUPS provides a modern, feature-rich
architecture for printer discovery, printer option access, and spooling
print jobs to different types of printers.</para>
<para>CUPS provides a set of utilities for automatically discovering
printers locally and on the network. This allows users not only to see
all available printers, but to use different types of printers without
manual configuration.</para>
<para>CUPS provides a unified interface for printing, regardless of the
location or type of the printer. Multiple print protocols are handled
seamlessly by CUPS by automatically applying filters to content sent to
the printers. Applications can simply provide PostScript output, and
CUPS will automatically convert it for printers that do not support
PostScript natively.</para>
<para>CUPS also provides printer configuration options in the form of
PostScript Printer Description (PPD) files. PPD configurations allow
applications to expose the capabilities of individual printers to the
users with a consistent user interface. For instance, PPD allows you
to detect whether a printer can collate and staple print jobs, and to
provide an option in your user interface.</para>
<para>In most cases, you will not need to interface directly with CUPS
in your applications. By using the GNOME print framework, you have
access to the power and flexibility of CUPS automatically. Having CUPS
underneath means a better user experience with less programming.</para>
</section>
</section> <!-- printing -->
</chapter>
|